-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #44538 from MrMuzyk/feat/subscription-localize-cur…
…rency
- Loading branch information
Showing
16 changed files
with
73 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import {useOnyx} from 'react-native-onyx'; | ||
import CONST from '@src/CONST'; | ||
import ONYXKEYS from '@src/ONYXKEYS'; | ||
import usePreferredCurrency from './usePreferredCurrency'; | ||
import useSubscriptionPlan from './useSubscriptionPlan'; | ||
|
||
const POSSIBLE_COST_SAVINGS = { | ||
[CONST.PAYMENT_CARD_CURRENCY.USD]: { | ||
[CONST.POLICY.TYPE.TEAM]: 1000, | ||
[CONST.POLICY.TYPE.CORPORATE]: 1800, | ||
}, | ||
[CONST.PAYMENT_CARD_CURRENCY.AUD]: { | ||
[CONST.POLICY.TYPE.TEAM]: 1400, | ||
[CONST.POLICY.TYPE.CORPORATE]: 3000, | ||
}, | ||
[CONST.PAYMENT_CARD_CURRENCY.GBP]: { | ||
[CONST.POLICY.TYPE.TEAM]: 800, | ||
[CONST.POLICY.TYPE.CORPORATE]: 1400, | ||
}, | ||
[CONST.PAYMENT_CARD_CURRENCY.NZD]: { | ||
[CONST.POLICY.TYPE.TEAM]: 1600, | ||
[CONST.POLICY.TYPE.CORPORATE]: 3200, | ||
}, | ||
} as const; | ||
|
||
function useSubscriptionPossibleCostSavings(): number { | ||
const preferredCurrency = usePreferredCurrency(); | ||
const subscriptionPlan = useSubscriptionPlan(); | ||
const [privateSubscription] = useOnyx(ONYXKEYS.NVP_PRIVATE_SUBSCRIPTION); | ||
|
||
if (!subscriptionPlan || !privateSubscription?.type) { | ||
return 0; | ||
} | ||
|
||
return POSSIBLE_COST_SAVINGS[preferredCurrency][subscriptionPlan]; | ||
} | ||
|
||
export default useSubscriptionPossibleCostSavings; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters