@oxyhq/services 5.17.18 → 5.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commonjs/core/mixins/OxyServices.features.js +372 -0
- package/lib/commonjs/core/mixins/OxyServices.features.js.map +1 -0
- package/lib/commonjs/core/mixins/index.js +3 -2
- package/lib/commonjs/core/mixins/index.js.map +1 -1
- package/lib/commonjs/ui/components/GroupedItem.js +11 -1
- package/lib/commonjs/ui/components/GroupedItem.js.map +1 -1
- package/lib/commonjs/ui/components/SettingRow.js +17 -4
- package/lib/commonjs/ui/components/SettingRow.js.map +1 -1
- package/lib/commonjs/ui/components/feedback/FormInput.js +72 -0
- package/lib/commonjs/ui/components/feedback/FormInput.js.map +1 -0
- package/lib/commonjs/ui/components/feedback/ProgressIndicator.js +33 -0
- package/lib/commonjs/ui/components/feedback/ProgressIndicator.js.map +1 -0
- package/lib/commonjs/ui/components/feedback/constants.js +59 -0
- package/lib/commonjs/ui/components/feedback/constants.js.map +1 -0
- package/lib/commonjs/ui/components/feedback/feedbackStyles.js +262 -0
- package/lib/commonjs/ui/components/feedback/feedbackStyles.js.map +1 -0
- package/lib/commonjs/ui/components/feedback/index.js +54 -0
- package/lib/commonjs/ui/components/feedback/index.js.map +1 -0
- package/lib/commonjs/ui/components/feedback/types.js +6 -0
- package/lib/commonjs/ui/components/feedback/types.js.map +1 -0
- package/lib/commonjs/ui/components/feedback/useFeedbackForm.js +52 -0
- package/lib/commonjs/ui/components/feedback/useFeedbackForm.js.map +1 -0
- package/lib/commonjs/ui/components/modals/DeleteAccountModal.js +282 -0
- package/lib/commonjs/ui/components/modals/DeleteAccountModal.js.map +1 -0
- package/lib/commonjs/ui/components/modals/index.js +14 -0
- package/lib/commonjs/ui/components/modals/index.js.map +1 -0
- package/lib/commonjs/ui/components/payment/PaymentDetailsStep.js +309 -0
- package/lib/commonjs/ui/components/payment/PaymentDetailsStep.js.map +1 -0
- package/lib/commonjs/ui/components/payment/PaymentMethodStep.js +79 -0
- package/lib/commonjs/ui/components/payment/PaymentMethodStep.js.map +1 -0
- package/lib/commonjs/ui/components/payment/PaymentReviewStep.js +108 -0
- package/lib/commonjs/ui/components/payment/PaymentReviewStep.js.map +1 -0
- package/lib/commonjs/ui/components/payment/PaymentSuccessStep.js +79 -0
- package/lib/commonjs/ui/components/payment/PaymentSuccessStep.js.map +1 -0
- package/lib/commonjs/ui/components/payment/PaymentSummaryStep.js +176 -0
- package/lib/commonjs/ui/components/payment/PaymentSummaryStep.js.map +1 -0
- package/lib/commonjs/ui/components/payment/constants.js +53 -0
- package/lib/commonjs/ui/components/payment/constants.js.map +1 -0
- package/lib/commonjs/ui/components/payment/index.js +80 -0
- package/lib/commonjs/ui/components/payment/index.js.map +1 -0
- package/lib/commonjs/ui/components/payment/paymentStyles.js +409 -0
- package/lib/commonjs/ui/components/payment/paymentStyles.js.map +1 -0
- package/lib/commonjs/ui/components/payment/types.js +6 -0
- package/lib/commonjs/ui/components/payment/types.js.map +1 -0
- package/lib/commonjs/ui/hooks/index.js +26 -0
- package/lib/commonjs/ui/hooks/index.js.map +1 -1
- package/lib/commonjs/ui/hooks/useAsyncAction.js +95 -0
- package/lib/commonjs/ui/hooks/useAsyncAction.js.map +1 -0
- package/lib/commonjs/ui/hooks/useSettingToggle.js +126 -0
- package/lib/commonjs/ui/hooks/useSettingToggle.js.map +1 -0
- package/lib/commonjs/ui/navigation/routes.js +1 -0
- package/lib/commonjs/ui/navigation/routes.js.map +1 -1
- package/lib/commonjs/ui/screens/AccountCenterScreen.js +4 -2
- package/lib/commonjs/ui/screens/AccountCenterScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/AccountOverviewScreen.js +33 -30
- package/lib/commonjs/ui/screens/AccountOverviewScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/FAQScreen.js +315 -0
- package/lib/commonjs/ui/screens/FAQScreen.js.map +1 -0
- package/lib/commonjs/ui/screens/FeedbackScreen.js +73 -590
- package/lib/commonjs/ui/screens/FeedbackScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/HelpSupportScreen.js +8 -7
- package/lib/commonjs/ui/screens/HelpSupportScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/PaymentGatewayScreen.js +67 -1395
- package/lib/commonjs/ui/screens/PaymentGatewayScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/ProfileScreen.js +13 -5
- package/lib/commonjs/ui/screens/ProfileScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/SavesCollectionsScreen.js +16 -10
- package/lib/commonjs/ui/screens/SavesCollectionsScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/karma/KarmaCenterScreen.js +23 -11
- package/lib/commonjs/ui/screens/karma/KarmaCenterScreen.js.map +1 -1
- package/lib/module/core/mixins/OxyServices.features.js +369 -0
- package/lib/module/core/mixins/OxyServices.features.js.map +1 -0
- package/lib/module/core/mixins/index.js +3 -2
- package/lib/module/core/mixins/index.js.map +1 -1
- package/lib/module/ui/components/GroupedItem.js +11 -1
- package/lib/module/ui/components/GroupedItem.js.map +1 -1
- package/lib/module/ui/components/SettingRow.js +17 -4
- package/lib/module/ui/components/SettingRow.js.map +1 -1
- package/lib/module/ui/components/feedback/FormInput.js +67 -0
- package/lib/module/ui/components/feedback/FormInput.js.map +1 -0
- package/lib/module/ui/components/feedback/ProgressIndicator.js +28 -0
- package/lib/module/ui/components/feedback/ProgressIndicator.js.map +1 -0
- package/lib/module/ui/components/feedback/constants.js +55 -0
- package/lib/module/ui/components/feedback/constants.js.map +1 -0
- package/lib/module/ui/components/feedback/feedbackStyles.js +257 -0
- package/lib/module/ui/components/feedback/feedbackStyles.js.map +1 -0
- package/lib/module/ui/components/feedback/index.js +8 -0
- package/lib/module/ui/components/feedback/index.js.map +1 -0
- package/lib/module/ui/components/feedback/types.js +4 -0
- package/lib/module/ui/components/feedback/types.js.map +1 -0
- package/lib/module/ui/components/feedback/useFeedbackForm.js +47 -0
- package/lib/module/ui/components/feedback/useFeedbackForm.js.map +1 -0
- package/lib/module/ui/components/modals/DeleteAccountModal.js +276 -0
- package/lib/module/ui/components/modals/DeleteAccountModal.js.map +1 -0
- package/lib/module/ui/components/modals/index.js +4 -0
- package/lib/module/ui/components/modals/index.js.map +1 -0
- package/lib/module/ui/components/payment/PaymentDetailsStep.js +303 -0
- package/lib/module/ui/components/payment/PaymentDetailsStep.js.map +1 -0
- package/lib/module/ui/components/payment/PaymentMethodStep.js +73 -0
- package/lib/module/ui/components/payment/PaymentMethodStep.js.map +1 -0
- package/lib/module/ui/components/payment/PaymentReviewStep.js +102 -0
- package/lib/module/ui/components/payment/PaymentReviewStep.js.map +1 -0
- package/lib/module/ui/components/payment/PaymentSuccessStep.js +73 -0
- package/lib/module/ui/components/payment/PaymentSuccessStep.js.map +1 -0
- package/lib/module/ui/components/payment/PaymentSummaryStep.js +170 -0
- package/lib/module/ui/components/payment/PaymentSummaryStep.js.map +1 -0
- package/lib/module/ui/components/payment/constants.js +47 -0
- package/lib/module/ui/components/payment/constants.js.map +1 -0
- package/lib/module/ui/components/payment/index.js +10 -0
- package/lib/module/ui/components/payment/index.js.map +1 -0
- package/lib/module/ui/components/payment/paymentStyles.js +404 -0
- package/lib/module/ui/components/payment/paymentStyles.js.map +1 -0
- package/lib/module/ui/components/payment/types.js +4 -0
- package/lib/module/ui/components/payment/types.js.map +1 -0
- package/lib/module/ui/hooks/index.js +2 -0
- package/lib/module/ui/hooks/index.js.map +1 -1
- package/lib/module/ui/hooks/useAsyncAction.js +89 -0
- package/lib/module/ui/hooks/useAsyncAction.js.map +1 -0
- package/lib/module/ui/hooks/useSettingToggle.js +120 -0
- package/lib/module/ui/hooks/useSettingToggle.js.map +1 -0
- package/lib/module/ui/navigation/routes.js +1 -0
- package/lib/module/ui/navigation/routes.js.map +1 -1
- package/lib/module/ui/screens/AccountCenterScreen.js +4 -2
- package/lib/module/ui/screens/AccountCenterScreen.js.map +1 -1
- package/lib/module/ui/screens/AccountOverviewScreen.js +33 -30
- package/lib/module/ui/screens/AccountOverviewScreen.js.map +1 -1
- package/lib/module/ui/screens/FAQScreen.js +310 -0
- package/lib/module/ui/screens/FAQScreen.js.map +1 -0
- package/lib/module/ui/screens/FeedbackScreen.js +64 -581
- package/lib/module/ui/screens/FeedbackScreen.js.map +1 -1
- package/lib/module/ui/screens/HelpSupportScreen.js +8 -7
- package/lib/module/ui/screens/HelpSupportScreen.js.map +1 -1
- package/lib/module/ui/screens/PaymentGatewayScreen.js +67 -1397
- package/lib/module/ui/screens/PaymentGatewayScreen.js.map +1 -1
- package/lib/module/ui/screens/ProfileScreen.js +13 -5
- package/lib/module/ui/screens/ProfileScreen.js.map +1 -1
- package/lib/module/ui/screens/SavesCollectionsScreen.js +16 -10
- package/lib/module/ui/screens/SavesCollectionsScreen.js.map +1 -1
- package/lib/module/ui/screens/karma/KarmaCenterScreen.js +23 -11
- package/lib/module/ui/screens/karma/KarmaCenterScreen.js.map +1 -1
- package/lib/typescript/core/mixins/OxyServices.features.d.ts +229 -0
- package/lib/typescript/core/mixins/OxyServices.features.d.ts.map +1 -0
- package/lib/typescript/core/mixins/index.d.ts +71 -1
- package/lib/typescript/core/mixins/index.d.ts.map +1 -1
- package/lib/typescript/ui/components/GroupedItem.d.ts +5 -1
- package/lib/typescript/ui/components/GroupedItem.d.ts.map +1 -1
- package/lib/typescript/ui/components/SettingRow.d.ts +6 -0
- package/lib/typescript/ui/components/SettingRow.d.ts.map +1 -1
- package/lib/typescript/ui/components/feedback/FormInput.d.ts +20 -0
- package/lib/typescript/ui/components/feedback/FormInput.d.ts.map +1 -0
- package/lib/typescript/ui/components/feedback/ProgressIndicator.d.ts +11 -0
- package/lib/typescript/ui/components/feedback/ProgressIndicator.d.ts.map +1 -0
- package/lib/typescript/ui/components/feedback/constants.d.ts +5 -0
- package/lib/typescript/ui/components/feedback/constants.d.ts.map +1 -0
- package/lib/typescript/ui/components/feedback/feedbackStyles.d.ts +280 -0
- package/lib/typescript/ui/components/feedback/feedbackStyles.d.ts.map +1 -0
- package/lib/typescript/ui/components/feedback/index.d.ts +7 -0
- package/lib/typescript/ui/components/feedback/index.d.ts.map +1 -0
- package/lib/typescript/ui/components/feedback/types.d.ts +46 -0
- package/lib/typescript/ui/components/feedback/types.d.ts.map +1 -0
- package/lib/typescript/ui/components/feedback/useFeedbackForm.d.ts +9 -0
- package/lib/typescript/ui/components/feedback/useFeedbackForm.d.ts.map +1 -0
- package/lib/typescript/ui/components/modals/DeleteAccountModal.d.ts +19 -0
- package/lib/typescript/ui/components/modals/DeleteAccountModal.d.ts.map +1 -0
- package/lib/typescript/ui/components/modals/index.d.ts +2 -0
- package/lib/typescript/ui/components/modals/index.d.ts.map +1 -0
- package/lib/typescript/ui/components/payment/PaymentDetailsStep.d.ts +21 -0
- package/lib/typescript/ui/components/payment/PaymentDetailsStep.d.ts.map +1 -0
- package/lib/typescript/ui/components/payment/PaymentMethodStep.d.ts +14 -0
- package/lib/typescript/ui/components/payment/PaymentMethodStep.d.ts.map +1 -0
- package/lib/typescript/ui/components/payment/PaymentReviewStep.d.ts +16 -0
- package/lib/typescript/ui/components/payment/PaymentReviewStep.d.ts.map +1 -0
- package/lib/typescript/ui/components/payment/PaymentSuccessStep.d.ts +10 -0
- package/lib/typescript/ui/components/payment/PaymentSuccessStep.d.ts.map +1 -0
- package/lib/typescript/ui/components/payment/PaymentSummaryStep.d.ts +15 -0
- package/lib/typescript/ui/components/payment/PaymentSummaryStep.d.ts.map +1 -0
- package/lib/typescript/ui/components/payment/constants.d.ts +7 -0
- package/lib/typescript/ui/components/payment/constants.d.ts.map +1 -0
- package/lib/typescript/ui/components/payment/index.d.ts +9 -0
- package/lib/typescript/ui/components/payment/index.d.ts.map +1 -0
- package/lib/typescript/ui/components/payment/paymentStyles.d.ts +396 -0
- package/lib/typescript/ui/components/payment/paymentStyles.d.ts.map +1 -0
- package/lib/typescript/ui/components/payment/types.d.ts +40 -0
- package/lib/typescript/ui/components/payment/types.d.ts.map +1 -0
- package/lib/typescript/ui/hooks/index.d.ts +2 -0
- package/lib/typescript/ui/hooks/index.d.ts.map +1 -1
- package/lib/typescript/ui/hooks/useAsyncAction.d.ts +51 -0
- package/lib/typescript/ui/hooks/useAsyncAction.d.ts.map +1 -0
- package/lib/typescript/ui/hooks/useSettingToggle.d.ts +55 -0
- package/lib/typescript/ui/hooks/useSettingToggle.d.ts.map +1 -0
- package/lib/typescript/ui/navigation/routes.d.ts +1 -1
- package/lib/typescript/ui/navigation/routes.d.ts.map +1 -1
- package/lib/typescript/ui/screens/AccountOverviewScreen.d.ts.map +1 -1
- package/lib/typescript/ui/screens/FAQScreen.d.ts +5 -0
- package/lib/typescript/ui/screens/FAQScreen.d.ts.map +1 -0
- package/lib/typescript/ui/screens/FeedbackScreen.d.ts.map +1 -1
- package/lib/typescript/ui/screens/HelpSupportScreen.d.ts.map +1 -1
- package/lib/typescript/ui/screens/PaymentGatewayScreen.d.ts +3 -15
- package/lib/typescript/ui/screens/PaymentGatewayScreen.d.ts.map +1 -1
- package/lib/typescript/ui/screens/ProfileScreen.d.ts.map +1 -1
- package/lib/typescript/ui/screens/SavesCollectionsScreen.d.ts.map +1 -1
- package/lib/typescript/ui/screens/karma/KarmaCenterScreen.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/core/mixins/OxyServices.features.ts +428 -0
- package/src/core/mixins/index.ts +20 -17
- package/src/ui/components/GroupedItem.tsx +19 -1
- package/src/ui/components/SettingRow.tsx +26 -4
- package/src/ui/components/feedback/FormInput.tsx +84 -0
- package/src/ui/components/feedback/ProgressIndicator.tsx +35 -0
- package/src/ui/components/feedback/constants.ts +22 -0
- package/src/ui/components/feedback/feedbackStyles.ts +247 -0
- package/src/ui/components/feedback/index.ts +6 -0
- package/src/ui/components/feedback/types.ts +52 -0
- package/src/ui/components/feedback/useFeedbackForm.ts +44 -0
- package/src/ui/components/modals/DeleteAccountModal.tsx +294 -0
- package/src/ui/components/modals/index.ts +1 -0
- package/src/ui/components/payment/PaymentDetailsStep.tsx +222 -0
- package/src/ui/components/payment/PaymentMethodStep.tsx +89 -0
- package/src/ui/components/payment/PaymentReviewStep.tsx +126 -0
- package/src/ui/components/payment/PaymentSuccessStep.tsx +71 -0
- package/src/ui/components/payment/PaymentSummaryStep.tsx +159 -0
- package/src/ui/components/payment/constants.ts +39 -0
- package/src/ui/components/payment/index.ts +9 -0
- package/src/ui/components/payment/paymentStyles.ts +397 -0
- package/src/ui/components/payment/types.ts +45 -0
- package/src/ui/hooks/index.ts +3 -1
- package/src/ui/hooks/useAsyncAction.ts +129 -0
- package/src/ui/hooks/useSettingToggle.ts +147 -0
- package/src/ui/navigation/routes.ts +2 -0
- package/src/ui/screens/AccountCenterScreen.tsx +2 -2
- package/src/ui/screens/AccountOverviewScreen.tsx +35 -37
- package/src/ui/screens/FAQScreen.tsx +332 -0
- package/src/ui/screens/FeedbackScreen.tsx +91 -626
- package/src/ui/screens/HelpSupportScreen.tsx +7 -5
- package/src/ui/screens/PaymentGatewayScreen.tsx +96 -1275
- package/src/ui/screens/ProfileScreen.tsx +11 -6
- package/src/ui/screens/SavesCollectionsScreen.tsx +19 -10
- package/src/ui/screens/karma/KarmaCenterScreen.tsx +10 -10
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { PaymentMethod } from './types';
|
|
2
|
+
|
|
3
|
+
export const PAYMENT_METHODS: PaymentMethod[] = [
|
|
4
|
+
{ key: 'card', label: 'Credit/Debit Card', icon: 'card-outline', description: 'Pay securely with your credit or debit card.' },
|
|
5
|
+
{ key: 'oxy', label: 'Oxy Pay', icon: 'wallet-outline', description: 'Use your Oxy Pay in-app balance.' },
|
|
6
|
+
{ key: 'faircoin', label: 'FAIRWallet', icon: 'qr-code-outline', description: 'Pay with FairCoin by scanning a QR code.' },
|
|
7
|
+
];
|
|
8
|
+
|
|
9
|
+
export const CURRENCY_SYMBOLS: Record<string, string> = {
|
|
10
|
+
FAIR: '⊜',
|
|
11
|
+
INR: '₹',
|
|
12
|
+
USD: '$',
|
|
13
|
+
EUR: '€',
|
|
14
|
+
GBP: '£',
|
|
15
|
+
JPY: '¥',
|
|
16
|
+
CNY: '¥',
|
|
17
|
+
AUD: 'A$',
|
|
18
|
+
CAD: 'C$',
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export const CURRENCY_NAMES: Record<string, string> = {
|
|
22
|
+
FAIR: 'FairCoin',
|
|
23
|
+
INR: 'Indian Rupee',
|
|
24
|
+
USD: 'US Dollar',
|
|
25
|
+
EUR: 'Euro',
|
|
26
|
+
GBP: 'British Pound',
|
|
27
|
+
JPY: 'Japanese Yen',
|
|
28
|
+
CNY: 'Chinese Yuan',
|
|
29
|
+
AUD: 'Australian Dollar',
|
|
30
|
+
CAD: 'Canadian Dollar',
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export const getCurrencySymbol = (currency: string): string => {
|
|
34
|
+
return CURRENCY_SYMBOLS[currency.toUpperCase()] || currency;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export const getCurrencyName = (currency: string): string => {
|
|
38
|
+
return CURRENCY_NAMES[currency.toUpperCase()] || currency;
|
|
39
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { default as PaymentSummaryStep } from './PaymentSummaryStep';
|
|
2
|
+
export { default as PaymentMethodStep } from './PaymentMethodStep';
|
|
3
|
+
export { default as PaymentDetailsStep } from './PaymentDetailsStep';
|
|
4
|
+
export { default as PaymentReviewStep } from './PaymentReviewStep';
|
|
5
|
+
export { default as PaymentSuccessStep } from './PaymentSuccessStep';
|
|
6
|
+
|
|
7
|
+
export { createPaymentStyles } from './paymentStyles';
|
|
8
|
+
export { PAYMENT_METHODS, CURRENCY_SYMBOLS, CURRENCY_NAMES, getCurrencySymbol, getCurrencyName } from './constants';
|
|
9
|
+
export type { PaymentItem, PaymentGatewayResult, CardDetails, PaymentMethod, PaymentStepAnimations, PaymentColors } from './types';
|
|
@@ -0,0 +1,397 @@
|
|
|
1
|
+
import { StyleSheet, Platform } from 'react-native';
|
|
2
|
+
import { fontFamilies } from '../../styles';
|
|
3
|
+
import type { PaymentColors } from './types';
|
|
4
|
+
|
|
5
|
+
export const createPaymentStyles = (colors: PaymentColors) => StyleSheet.create({
|
|
6
|
+
container: {
|
|
7
|
+
flex: 1,
|
|
8
|
+
},
|
|
9
|
+
content: {
|
|
10
|
+
flex: 1,
|
|
11
|
+
padding: 16,
|
|
12
|
+
},
|
|
13
|
+
stepContainer: {
|
|
14
|
+
justifyContent: 'flex-start',
|
|
15
|
+
alignItems: 'flex-start',
|
|
16
|
+
width: '100%',
|
|
17
|
+
},
|
|
18
|
+
section: {
|
|
19
|
+
marginBottom: 24,
|
|
20
|
+
width: '100%',
|
|
21
|
+
},
|
|
22
|
+
sectionTitle: {
|
|
23
|
+
fontSize: 16,
|
|
24
|
+
fontWeight: '600',
|
|
25
|
+
color: colors.text,
|
|
26
|
+
marginBottom: 12,
|
|
27
|
+
fontFamily: fontFamilies.phuduSemiBold,
|
|
28
|
+
},
|
|
29
|
+
errorContainer: {
|
|
30
|
+
flex: 1,
|
|
31
|
+
justifyContent: 'center',
|
|
32
|
+
alignItems: 'center',
|
|
33
|
+
padding: 32,
|
|
34
|
+
},
|
|
35
|
+
errorText: {
|
|
36
|
+
fontSize: 18,
|
|
37
|
+
color: 'red',
|
|
38
|
+
marginBottom: 24,
|
|
39
|
+
},
|
|
40
|
+
// Summary card styles
|
|
41
|
+
summaryCard: {
|
|
42
|
+
backgroundColor: '#fff',
|
|
43
|
+
borderRadius: 16,
|
|
44
|
+
padding: 24,
|
|
45
|
+
marginBottom: 24,
|
|
46
|
+
alignItems: 'center',
|
|
47
|
+
width: '100%',
|
|
48
|
+
},
|
|
49
|
+
summaryCardContent: {
|
|
50
|
+
alignItems: 'center',
|
|
51
|
+
width: '100%',
|
|
52
|
+
},
|
|
53
|
+
summaryCardIcon: {
|
|
54
|
+
marginBottom: 8,
|
|
55
|
+
},
|
|
56
|
+
summaryCardMainTitle: {
|
|
57
|
+
fontFamily: fontFamilies.phuduBold,
|
|
58
|
+
fontWeight: 'bold',
|
|
59
|
+
fontSize: 28,
|
|
60
|
+
color: colors.text,
|
|
61
|
+
marginBottom: 2,
|
|
62
|
+
textAlign: 'center',
|
|
63
|
+
letterSpacing: 0.5,
|
|
64
|
+
},
|
|
65
|
+
summaryCardSubtitle: {
|
|
66
|
+
fontSize: 16,
|
|
67
|
+
color: colors.secondaryText,
|
|
68
|
+
textAlign: 'center',
|
|
69
|
+
marginBottom: 24,
|
|
70
|
+
width: '100%',
|
|
71
|
+
},
|
|
72
|
+
summaryCardItems: {
|
|
73
|
+
width: '100%',
|
|
74
|
+
marginBottom: 16,
|
|
75
|
+
},
|
|
76
|
+
summaryItemPrice: {
|
|
77
|
+
color: colors.text,
|
|
78
|
+
fontWeight: '600',
|
|
79
|
+
fontSize: 16,
|
|
80
|
+
},
|
|
81
|
+
summaryCardAmount: {
|
|
82
|
+
alignItems: 'center',
|
|
83
|
+
width: '100%',
|
|
84
|
+
marginBottom: 16,
|
|
85
|
+
},
|
|
86
|
+
summaryCardAmountLabel: {
|
|
87
|
+
fontSize: 16,
|
|
88
|
+
color: colors.secondaryText,
|
|
89
|
+
textAlign: 'center',
|
|
90
|
+
marginBottom: 8,
|
|
91
|
+
},
|
|
92
|
+
summaryCardAmountValue: {
|
|
93
|
+
fontSize: 32,
|
|
94
|
+
fontWeight: 'bold',
|
|
95
|
+
color: colors.text,
|
|
96
|
+
textAlign: 'center',
|
|
97
|
+
marginBottom: 8,
|
|
98
|
+
fontFamily: fontFamilies.phuduBold,
|
|
99
|
+
},
|
|
100
|
+
summaryCardAmountDescription: {
|
|
101
|
+
fontSize: 14,
|
|
102
|
+
color: colors.secondaryText,
|
|
103
|
+
textAlign: 'center',
|
|
104
|
+
lineHeight: 20,
|
|
105
|
+
},
|
|
106
|
+
summaryCardDivider: {
|
|
107
|
+
height: 1,
|
|
108
|
+
backgroundColor: colors.border,
|
|
109
|
+
marginVertical: 16,
|
|
110
|
+
width: '100%',
|
|
111
|
+
},
|
|
112
|
+
summaryCardTotalSection: {
|
|
113
|
+
width: '100%',
|
|
114
|
+
marginBottom: 8,
|
|
115
|
+
},
|
|
116
|
+
summaryCardTotalRow: {
|
|
117
|
+
flexDirection: 'row',
|
|
118
|
+
justifyContent: 'space-between',
|
|
119
|
+
alignItems: 'center',
|
|
120
|
+
paddingVertical: 4,
|
|
121
|
+
},
|
|
122
|
+
summaryCardTotalLabel: {
|
|
123
|
+
fontSize: 16,
|
|
124
|
+
color: colors.secondaryText,
|
|
125
|
+
fontWeight: '500',
|
|
126
|
+
},
|
|
127
|
+
summaryCardTotalValue: {
|
|
128
|
+
fontSize: 16,
|
|
129
|
+
color: colors.text,
|
|
130
|
+
fontWeight: '600',
|
|
131
|
+
},
|
|
132
|
+
// Card payment styles
|
|
133
|
+
cardPaymentCard: {
|
|
134
|
+
backgroundColor: '#fff',
|
|
135
|
+
borderRadius: 16,
|
|
136
|
+
padding: 24,
|
|
137
|
+
marginBottom: 24,
|
|
138
|
+
alignItems: 'center',
|
|
139
|
+
width: '100%',
|
|
140
|
+
},
|
|
141
|
+
cardPaymentContent: {
|
|
142
|
+
alignItems: 'center',
|
|
143
|
+
width: '100%',
|
|
144
|
+
},
|
|
145
|
+
cardPaymentIcon: {
|
|
146
|
+
marginBottom: 8,
|
|
147
|
+
},
|
|
148
|
+
cardPaymentMainTitle: {
|
|
149
|
+
fontFamily: fontFamilies.phuduBold,
|
|
150
|
+
fontWeight: 'bold',
|
|
151
|
+
fontSize: 28,
|
|
152
|
+
color: colors.text,
|
|
153
|
+
marginBottom: 2,
|
|
154
|
+
textAlign: 'center',
|
|
155
|
+
letterSpacing: 0.5,
|
|
156
|
+
},
|
|
157
|
+
cardPaymentSubtitle: {
|
|
158
|
+
fontSize: 16,
|
|
159
|
+
color: colors.secondaryText,
|
|
160
|
+
textAlign: 'center',
|
|
161
|
+
marginBottom: 24,
|
|
162
|
+
width: '100%',
|
|
163
|
+
},
|
|
164
|
+
cardPaymentFields: {
|
|
165
|
+
width: '100%',
|
|
166
|
+
marginBottom: 16,
|
|
167
|
+
},
|
|
168
|
+
cardPaymentWaiting: {
|
|
169
|
+
fontSize: 14,
|
|
170
|
+
color: colors.secondaryText,
|
|
171
|
+
textAlign: 'center',
|
|
172
|
+
marginBottom: 8,
|
|
173
|
+
},
|
|
174
|
+
cardRowInfo: {
|
|
175
|
+
flexDirection: 'row',
|
|
176
|
+
alignItems: 'center',
|
|
177
|
+
marginBottom: 16,
|
|
178
|
+
},
|
|
179
|
+
cardRowIcon: {
|
|
180
|
+
marginRight: 8,
|
|
181
|
+
},
|
|
182
|
+
cardRowText: {
|
|
183
|
+
fontSize: 15,
|
|
184
|
+
color: colors.secondaryText,
|
|
185
|
+
},
|
|
186
|
+
cardFieldContainer: {
|
|
187
|
+
marginBottom: 16,
|
|
188
|
+
},
|
|
189
|
+
cardFieldRow: {
|
|
190
|
+
flexDirection: 'row',
|
|
191
|
+
gap: 12,
|
|
192
|
+
},
|
|
193
|
+
cardFieldHalfLeft: {
|
|
194
|
+
flex: 1,
|
|
195
|
+
marginRight: 6,
|
|
196
|
+
},
|
|
197
|
+
cardFieldHalfRight: {
|
|
198
|
+
flex: 1,
|
|
199
|
+
marginLeft: 6,
|
|
200
|
+
},
|
|
201
|
+
// Oxy Pay styles
|
|
202
|
+
oxyPayCard: {
|
|
203
|
+
backgroundColor: '#fff',
|
|
204
|
+
borderRadius: 16,
|
|
205
|
+
padding: 24,
|
|
206
|
+
marginBottom: 24,
|
|
207
|
+
alignItems: 'center',
|
|
208
|
+
width: '100%',
|
|
209
|
+
},
|
|
210
|
+
oxyPayContent: {
|
|
211
|
+
alignItems: 'center',
|
|
212
|
+
width: '100%',
|
|
213
|
+
},
|
|
214
|
+
oxyPayIcon: {
|
|
215
|
+
marginBottom: 8,
|
|
216
|
+
},
|
|
217
|
+
oxyPayMainTitle: {
|
|
218
|
+
fontFamily: fontFamilies.phuduBold,
|
|
219
|
+
fontWeight: 'bold',
|
|
220
|
+
fontSize: 28,
|
|
221
|
+
color: colors.text,
|
|
222
|
+
marginBottom: 2,
|
|
223
|
+
textAlign: 'center',
|
|
224
|
+
letterSpacing: 0.5,
|
|
225
|
+
},
|
|
226
|
+
oxyPaySubtitle: {
|
|
227
|
+
fontSize: 16,
|
|
228
|
+
color: colors.secondaryText,
|
|
229
|
+
textAlign: 'center',
|
|
230
|
+
marginBottom: 8,
|
|
231
|
+
},
|
|
232
|
+
oxyPayBalanceBox: {
|
|
233
|
+
backgroundColor: colors.primary + '22',
|
|
234
|
+
borderRadius: 12,
|
|
235
|
+
padding: 8,
|
|
236
|
+
marginTop: 8,
|
|
237
|
+
},
|
|
238
|
+
oxyPayBalanceText: {
|
|
239
|
+
color: colors.primary,
|
|
240
|
+
fontWeight: '600',
|
|
241
|
+
},
|
|
242
|
+
oxyPayWaiting: {
|
|
243
|
+
fontSize: 14,
|
|
244
|
+
color: colors.secondaryText,
|
|
245
|
+
textAlign: 'center',
|
|
246
|
+
marginBottom: 8,
|
|
247
|
+
},
|
|
248
|
+
// FairCoin styles
|
|
249
|
+
faircoinCard: {
|
|
250
|
+
backgroundColor: '#fff',
|
|
251
|
+
borderRadius: 16,
|
|
252
|
+
padding: 24,
|
|
253
|
+
marginBottom: 24,
|
|
254
|
+
alignItems: 'center',
|
|
255
|
+
width: '100%',
|
|
256
|
+
},
|
|
257
|
+
faircoinContent: {
|
|
258
|
+
alignItems: 'center',
|
|
259
|
+
width: '100%',
|
|
260
|
+
},
|
|
261
|
+
faircoinIcon: {
|
|
262
|
+
marginBottom: 8,
|
|
263
|
+
},
|
|
264
|
+
faircoinMainTitle: {
|
|
265
|
+
fontFamily: fontFamilies.phuduBold,
|
|
266
|
+
fontWeight: 'bold',
|
|
267
|
+
fontSize: 28,
|
|
268
|
+
color: '#1b1f0a',
|
|
269
|
+
marginBottom: 2,
|
|
270
|
+
textAlign: 'center',
|
|
271
|
+
letterSpacing: 0.5,
|
|
272
|
+
},
|
|
273
|
+
faircoinSubtitle: {
|
|
274
|
+
color: '#1b1f0a',
|
|
275
|
+
fontWeight: '700',
|
|
276
|
+
fontSize: 17,
|
|
277
|
+
marginBottom: 18,
|
|
278
|
+
textAlign: 'center',
|
|
279
|
+
letterSpacing: 0.2,
|
|
280
|
+
},
|
|
281
|
+
faircoinScanText: {
|
|
282
|
+
color: '#1b1f0a',
|
|
283
|
+
fontWeight: '600',
|
|
284
|
+
fontSize: 15,
|
|
285
|
+
marginBottom: 8,
|
|
286
|
+
},
|
|
287
|
+
faircoinQRCard: {
|
|
288
|
+
width: 200,
|
|
289
|
+
height: 200,
|
|
290
|
+
backgroundColor: '#fff',
|
|
291
|
+
borderRadius: 32,
|
|
292
|
+
justifyContent: 'center',
|
|
293
|
+
alignItems: 'center',
|
|
294
|
+
marginBottom: 16,
|
|
295
|
+
padding: 16,
|
|
296
|
+
borderWidth: 3,
|
|
297
|
+
borderColor: '#9ffb50',
|
|
298
|
+
shadowColor: '#9ffb50',
|
|
299
|
+
shadowOffset: { width: 0, height: 4 },
|
|
300
|
+
shadowOpacity: 0.25,
|
|
301
|
+
shadowRadius: 12,
|
|
302
|
+
elevation: 8,
|
|
303
|
+
position: 'relative',
|
|
304
|
+
},
|
|
305
|
+
faircoinQRBadge: {
|
|
306
|
+
position: 'absolute',
|
|
307
|
+
bottom: 12,
|
|
308
|
+
right: 12,
|
|
309
|
+
backgroundColor: '#fff',
|
|
310
|
+
borderRadius: 16,
|
|
311
|
+
padding: 4,
|
|
312
|
+
shadowColor: '#000',
|
|
313
|
+
shadowOffset: { width: 0, height: 2 },
|
|
314
|
+
shadowOpacity: 0.1,
|
|
315
|
+
shadowRadius: 4,
|
|
316
|
+
elevation: 2,
|
|
317
|
+
},
|
|
318
|
+
faircoinTitle: {
|
|
319
|
+
fontSize: 16,
|
|
320
|
+
marginBottom: 8,
|
|
321
|
+
color: colors.text,
|
|
322
|
+
fontWeight: '600',
|
|
323
|
+
textAlign: 'center',
|
|
324
|
+
},
|
|
325
|
+
faircoinAddress: {
|
|
326
|
+
color: colors.secondaryText,
|
|
327
|
+
fontSize: 13,
|
|
328
|
+
textAlign: 'center',
|
|
329
|
+
marginTop: 6,
|
|
330
|
+
marginBottom: 2,
|
|
331
|
+
},
|
|
332
|
+
faircoinButton: {
|
|
333
|
+
flexDirection: 'row',
|
|
334
|
+
alignItems: 'center',
|
|
335
|
+
alignSelf: 'center',
|
|
336
|
+
backgroundColor: colors.primary + '11',
|
|
337
|
+
borderRadius: 16,
|
|
338
|
+
paddingHorizontal: 16,
|
|
339
|
+
paddingVertical: 8,
|
|
340
|
+
marginTop: 6,
|
|
341
|
+
marginBottom: 2,
|
|
342
|
+
},
|
|
343
|
+
faircoinButtonText: {
|
|
344
|
+
color: colors.primary,
|
|
345
|
+
fontWeight: '600',
|
|
346
|
+
fontSize: 15,
|
|
347
|
+
},
|
|
348
|
+
faircoinWaiting: {
|
|
349
|
+
fontSize: 14,
|
|
350
|
+
color: colors.secondaryText,
|
|
351
|
+
textAlign: 'center',
|
|
352
|
+
marginBottom: 8,
|
|
353
|
+
},
|
|
354
|
+
faircoinPlaceholder: {
|
|
355
|
+
fontSize: 13,
|
|
356
|
+
color: colors.secondaryText,
|
|
357
|
+
textAlign: 'center',
|
|
358
|
+
},
|
|
359
|
+
// Success styles
|
|
360
|
+
successCard: {
|
|
361
|
+
backgroundColor: '#fff',
|
|
362
|
+
borderRadius: 16,
|
|
363
|
+
padding: 24,
|
|
364
|
+
marginBottom: 24,
|
|
365
|
+
alignItems: 'center',
|
|
366
|
+
width: '100%',
|
|
367
|
+
},
|
|
368
|
+
successContent: {
|
|
369
|
+
alignItems: 'center',
|
|
370
|
+
width: '100%',
|
|
371
|
+
},
|
|
372
|
+
successIcon: {
|
|
373
|
+
marginBottom: 8,
|
|
374
|
+
},
|
|
375
|
+
successMainTitle: {
|
|
376
|
+
fontFamily: fontFamilies.phuduBold,
|
|
377
|
+
fontWeight: 'bold',
|
|
378
|
+
fontSize: 28,
|
|
379
|
+
color: colors.success || '#4BB543',
|
|
380
|
+
marginBottom: 2,
|
|
381
|
+
textAlign: 'center',
|
|
382
|
+
letterSpacing: 0.5,
|
|
383
|
+
},
|
|
384
|
+
successSubtitle: {
|
|
385
|
+
fontSize: 16,
|
|
386
|
+
color: colors.text,
|
|
387
|
+
textAlign: 'center',
|
|
388
|
+
marginBottom: 8,
|
|
389
|
+
width: '100%',
|
|
390
|
+
},
|
|
391
|
+
successMessage: {
|
|
392
|
+
fontSize: 14,
|
|
393
|
+
color: colors.secondaryText,
|
|
394
|
+
textAlign: 'center',
|
|
395
|
+
marginBottom: 8,
|
|
396
|
+
},
|
|
397
|
+
});
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { Animated } from 'react-native';
|
|
2
|
+
|
|
3
|
+
export type PaymentItem = {
|
|
4
|
+
type: 'product' | 'subscription' | 'service' | 'fee' | string;
|
|
5
|
+
name: string;
|
|
6
|
+
description?: string;
|
|
7
|
+
quantity?: number;
|
|
8
|
+
period?: string;
|
|
9
|
+
price: number;
|
|
10
|
+
currency?: string;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export interface PaymentGatewayResult {
|
|
14
|
+
success: boolean;
|
|
15
|
+
details?: Record<string, string | number | boolean | null>;
|
|
16
|
+
error?: string;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export interface CardDetails {
|
|
20
|
+
number: string;
|
|
21
|
+
expiry: string;
|
|
22
|
+
cvv: string;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface PaymentMethod {
|
|
26
|
+
key: string;
|
|
27
|
+
label: string;
|
|
28
|
+
icon: string;
|
|
29
|
+
description: string;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export interface PaymentStepAnimations {
|
|
33
|
+
fadeAnim: Animated.Value;
|
|
34
|
+
slideAnim: Animated.Value;
|
|
35
|
+
scaleAnim: Animated.Value;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export interface PaymentColors {
|
|
39
|
+
primary: string;
|
|
40
|
+
text: string;
|
|
41
|
+
secondaryText: string;
|
|
42
|
+
border: string;
|
|
43
|
+
success?: string;
|
|
44
|
+
background?: string;
|
|
45
|
+
}
|
package/src/ui/hooks/index.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
export { useFollow, useFollowerCounts } from './useFollow';
|
|
2
2
|
export { useFileDownloadUrl, setOxyFileUrlInstance } from './useFileDownloadUrl';
|
|
3
3
|
export { useThemeStyles } from './useThemeStyles';
|
|
4
|
-
export { useThemeColors } from './useThemeColors';
|
|
4
|
+
export { useThemeColors } from './useThemeColors';
|
|
5
|
+
export { useAsyncAction, executeWithToast } from './useAsyncAction';
|
|
6
|
+
export { useSettingToggle, useSettingToggles } from './useSettingToggle';
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { useState, useCallback } from 'react';
|
|
2
|
+
import { toast } from '../../lib/sonner';
|
|
3
|
+
|
|
4
|
+
interface UseAsyncActionOptions<T> {
|
|
5
|
+
/** Function to execute */
|
|
6
|
+
action: () => Promise<T>;
|
|
7
|
+
/** Success message to display */
|
|
8
|
+
successMessage?: string;
|
|
9
|
+
/** Error message to display (or function to get message from error) */
|
|
10
|
+
errorMessage?: string | ((error: any) => string);
|
|
11
|
+
/** Callback on success */
|
|
12
|
+
onSuccess?: (result: T) => void;
|
|
13
|
+
/** Callback on error */
|
|
14
|
+
onError?: (error: any) => void;
|
|
15
|
+
/** Show loading toast */
|
|
16
|
+
showLoadingToast?: boolean;
|
|
17
|
+
/** Loading message */
|
|
18
|
+
loadingMessage?: string;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
interface UseAsyncActionReturn<T> {
|
|
22
|
+
/** Execute the action */
|
|
23
|
+
execute: () => Promise<T | undefined>;
|
|
24
|
+
/** Whether the action is currently executing */
|
|
25
|
+
isLoading: boolean;
|
|
26
|
+
/** The last error that occurred */
|
|
27
|
+
error: Error | null;
|
|
28
|
+
/** Reset the error state */
|
|
29
|
+
resetError: () => void;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Hook for handling async actions with loading state, error handling, and toast notifications.
|
|
34
|
+
* Reduces boilerplate for common patterns like try-catch with toast feedback.
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* const { execute, isLoading } = useAsyncAction({
|
|
38
|
+
* action: () => api.saveSettings(settings),
|
|
39
|
+
* successMessage: 'Settings saved!',
|
|
40
|
+
* errorMessage: 'Failed to save settings',
|
|
41
|
+
* });
|
|
42
|
+
*
|
|
43
|
+
* <Button onPress={execute} disabled={isLoading}>Save</Button>
|
|
44
|
+
*/
|
|
45
|
+
export function useAsyncAction<T = void>(
|
|
46
|
+
options: UseAsyncActionOptions<T>
|
|
47
|
+
): UseAsyncActionReturn<T> {
|
|
48
|
+
const [isLoading, setIsLoading] = useState(false);
|
|
49
|
+
const [error, setError] = useState<Error | null>(null);
|
|
50
|
+
|
|
51
|
+
const execute = useCallback(async (): Promise<T | undefined> => {
|
|
52
|
+
const {
|
|
53
|
+
action,
|
|
54
|
+
successMessage,
|
|
55
|
+
errorMessage,
|
|
56
|
+
onSuccess,
|
|
57
|
+
onError,
|
|
58
|
+
showLoadingToast,
|
|
59
|
+
loadingMessage,
|
|
60
|
+
} = options;
|
|
61
|
+
|
|
62
|
+
setIsLoading(true);
|
|
63
|
+
setError(null);
|
|
64
|
+
|
|
65
|
+
if (showLoadingToast && loadingMessage) {
|
|
66
|
+
toast.loading(loadingMessage);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
try {
|
|
70
|
+
const result = await action();
|
|
71
|
+
|
|
72
|
+
if (successMessage) {
|
|
73
|
+
toast.success(successMessage);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
onSuccess?.(result);
|
|
77
|
+
return result;
|
|
78
|
+
} catch (err: any) {
|
|
79
|
+
const message = typeof errorMessage === 'function'
|
|
80
|
+
? errorMessage(err)
|
|
81
|
+
: errorMessage || err?.message || 'An error occurred';
|
|
82
|
+
|
|
83
|
+
toast.error(message);
|
|
84
|
+
setError(err instanceof Error ? err : new Error(message));
|
|
85
|
+
onError?.(err);
|
|
86
|
+
return undefined;
|
|
87
|
+
} finally {
|
|
88
|
+
setIsLoading(false);
|
|
89
|
+
}
|
|
90
|
+
}, [options]);
|
|
91
|
+
|
|
92
|
+
const resetError = useCallback(() => {
|
|
93
|
+
setError(null);
|
|
94
|
+
}, []);
|
|
95
|
+
|
|
96
|
+
return { execute, isLoading, error, resetError };
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Simplified version that just executes an async action with toast feedback.
|
|
101
|
+
* Useful for one-off actions.
|
|
102
|
+
*/
|
|
103
|
+
export async function executeWithToast<T>(
|
|
104
|
+
action: () => Promise<T>,
|
|
105
|
+
options?: {
|
|
106
|
+
successMessage?: string;
|
|
107
|
+
errorMessage?: string;
|
|
108
|
+
loadingMessage?: string;
|
|
109
|
+
}
|
|
110
|
+
): Promise<T | undefined> {
|
|
111
|
+
const { successMessage, errorMessage, loadingMessage } = options || {};
|
|
112
|
+
|
|
113
|
+
if (loadingMessage) {
|
|
114
|
+
toast.loading(loadingMessage);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
try {
|
|
118
|
+
const result = await action();
|
|
119
|
+
if (successMessage) {
|
|
120
|
+
toast.success(successMessage);
|
|
121
|
+
}
|
|
122
|
+
return result;
|
|
123
|
+
} catch (err: any) {
|
|
124
|
+
toast.error(errorMessage || err?.message || 'An error occurred');
|
|
125
|
+
return undefined;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
export default useAsyncAction;
|