@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.
Files changed (238) hide show
  1. package/lib/commonjs/core/mixins/OxyServices.features.js +372 -0
  2. package/lib/commonjs/core/mixins/OxyServices.features.js.map +1 -0
  3. package/lib/commonjs/core/mixins/index.js +3 -2
  4. package/lib/commonjs/core/mixins/index.js.map +1 -1
  5. package/lib/commonjs/ui/components/GroupedItem.js +11 -1
  6. package/lib/commonjs/ui/components/GroupedItem.js.map +1 -1
  7. package/lib/commonjs/ui/components/SettingRow.js +17 -4
  8. package/lib/commonjs/ui/components/SettingRow.js.map +1 -1
  9. package/lib/commonjs/ui/components/feedback/FormInput.js +72 -0
  10. package/lib/commonjs/ui/components/feedback/FormInput.js.map +1 -0
  11. package/lib/commonjs/ui/components/feedback/ProgressIndicator.js +33 -0
  12. package/lib/commonjs/ui/components/feedback/ProgressIndicator.js.map +1 -0
  13. package/lib/commonjs/ui/components/feedback/constants.js +59 -0
  14. package/lib/commonjs/ui/components/feedback/constants.js.map +1 -0
  15. package/lib/commonjs/ui/components/feedback/feedbackStyles.js +262 -0
  16. package/lib/commonjs/ui/components/feedback/feedbackStyles.js.map +1 -0
  17. package/lib/commonjs/ui/components/feedback/index.js +54 -0
  18. package/lib/commonjs/ui/components/feedback/index.js.map +1 -0
  19. package/lib/commonjs/ui/components/feedback/types.js +6 -0
  20. package/lib/commonjs/ui/components/feedback/types.js.map +1 -0
  21. package/lib/commonjs/ui/components/feedback/useFeedbackForm.js +52 -0
  22. package/lib/commonjs/ui/components/feedback/useFeedbackForm.js.map +1 -0
  23. package/lib/commonjs/ui/components/modals/DeleteAccountModal.js +282 -0
  24. package/lib/commonjs/ui/components/modals/DeleteAccountModal.js.map +1 -0
  25. package/lib/commonjs/ui/components/modals/index.js +14 -0
  26. package/lib/commonjs/ui/components/modals/index.js.map +1 -0
  27. package/lib/commonjs/ui/components/payment/PaymentDetailsStep.js +309 -0
  28. package/lib/commonjs/ui/components/payment/PaymentDetailsStep.js.map +1 -0
  29. package/lib/commonjs/ui/components/payment/PaymentMethodStep.js +79 -0
  30. package/lib/commonjs/ui/components/payment/PaymentMethodStep.js.map +1 -0
  31. package/lib/commonjs/ui/components/payment/PaymentReviewStep.js +108 -0
  32. package/lib/commonjs/ui/components/payment/PaymentReviewStep.js.map +1 -0
  33. package/lib/commonjs/ui/components/payment/PaymentSuccessStep.js +79 -0
  34. package/lib/commonjs/ui/components/payment/PaymentSuccessStep.js.map +1 -0
  35. package/lib/commonjs/ui/components/payment/PaymentSummaryStep.js +176 -0
  36. package/lib/commonjs/ui/components/payment/PaymentSummaryStep.js.map +1 -0
  37. package/lib/commonjs/ui/components/payment/constants.js +53 -0
  38. package/lib/commonjs/ui/components/payment/constants.js.map +1 -0
  39. package/lib/commonjs/ui/components/payment/index.js +80 -0
  40. package/lib/commonjs/ui/components/payment/index.js.map +1 -0
  41. package/lib/commonjs/ui/components/payment/paymentStyles.js +409 -0
  42. package/lib/commonjs/ui/components/payment/paymentStyles.js.map +1 -0
  43. package/lib/commonjs/ui/components/payment/types.js +6 -0
  44. package/lib/commonjs/ui/components/payment/types.js.map +1 -0
  45. package/lib/commonjs/ui/hooks/index.js +26 -0
  46. package/lib/commonjs/ui/hooks/index.js.map +1 -1
  47. package/lib/commonjs/ui/hooks/useAsyncAction.js +95 -0
  48. package/lib/commonjs/ui/hooks/useAsyncAction.js.map +1 -0
  49. package/lib/commonjs/ui/hooks/useSettingToggle.js +126 -0
  50. package/lib/commonjs/ui/hooks/useSettingToggle.js.map +1 -0
  51. package/lib/commonjs/ui/navigation/routes.js +1 -0
  52. package/lib/commonjs/ui/navigation/routes.js.map +1 -1
  53. package/lib/commonjs/ui/screens/AccountCenterScreen.js +4 -2
  54. package/lib/commonjs/ui/screens/AccountCenterScreen.js.map +1 -1
  55. package/lib/commonjs/ui/screens/AccountOverviewScreen.js +33 -30
  56. package/lib/commonjs/ui/screens/AccountOverviewScreen.js.map +1 -1
  57. package/lib/commonjs/ui/screens/FAQScreen.js +315 -0
  58. package/lib/commonjs/ui/screens/FAQScreen.js.map +1 -0
  59. package/lib/commonjs/ui/screens/FeedbackScreen.js +73 -590
  60. package/lib/commonjs/ui/screens/FeedbackScreen.js.map +1 -1
  61. package/lib/commonjs/ui/screens/HelpSupportScreen.js +8 -7
  62. package/lib/commonjs/ui/screens/HelpSupportScreen.js.map +1 -1
  63. package/lib/commonjs/ui/screens/PaymentGatewayScreen.js +67 -1395
  64. package/lib/commonjs/ui/screens/PaymentGatewayScreen.js.map +1 -1
  65. package/lib/commonjs/ui/screens/ProfileScreen.js +13 -5
  66. package/lib/commonjs/ui/screens/ProfileScreen.js.map +1 -1
  67. package/lib/commonjs/ui/screens/SavesCollectionsScreen.js +16 -10
  68. package/lib/commonjs/ui/screens/SavesCollectionsScreen.js.map +1 -1
  69. package/lib/commonjs/ui/screens/karma/KarmaCenterScreen.js +23 -11
  70. package/lib/commonjs/ui/screens/karma/KarmaCenterScreen.js.map +1 -1
  71. package/lib/module/core/mixins/OxyServices.features.js +369 -0
  72. package/lib/module/core/mixins/OxyServices.features.js.map +1 -0
  73. package/lib/module/core/mixins/index.js +3 -2
  74. package/lib/module/core/mixins/index.js.map +1 -1
  75. package/lib/module/ui/components/GroupedItem.js +11 -1
  76. package/lib/module/ui/components/GroupedItem.js.map +1 -1
  77. package/lib/module/ui/components/SettingRow.js +17 -4
  78. package/lib/module/ui/components/SettingRow.js.map +1 -1
  79. package/lib/module/ui/components/feedback/FormInput.js +67 -0
  80. package/lib/module/ui/components/feedback/FormInput.js.map +1 -0
  81. package/lib/module/ui/components/feedback/ProgressIndicator.js +28 -0
  82. package/lib/module/ui/components/feedback/ProgressIndicator.js.map +1 -0
  83. package/lib/module/ui/components/feedback/constants.js +55 -0
  84. package/lib/module/ui/components/feedback/constants.js.map +1 -0
  85. package/lib/module/ui/components/feedback/feedbackStyles.js +257 -0
  86. package/lib/module/ui/components/feedback/feedbackStyles.js.map +1 -0
  87. package/lib/module/ui/components/feedback/index.js +8 -0
  88. package/lib/module/ui/components/feedback/index.js.map +1 -0
  89. package/lib/module/ui/components/feedback/types.js +4 -0
  90. package/lib/module/ui/components/feedback/types.js.map +1 -0
  91. package/lib/module/ui/components/feedback/useFeedbackForm.js +47 -0
  92. package/lib/module/ui/components/feedback/useFeedbackForm.js.map +1 -0
  93. package/lib/module/ui/components/modals/DeleteAccountModal.js +276 -0
  94. package/lib/module/ui/components/modals/DeleteAccountModal.js.map +1 -0
  95. package/lib/module/ui/components/modals/index.js +4 -0
  96. package/lib/module/ui/components/modals/index.js.map +1 -0
  97. package/lib/module/ui/components/payment/PaymentDetailsStep.js +303 -0
  98. package/lib/module/ui/components/payment/PaymentDetailsStep.js.map +1 -0
  99. package/lib/module/ui/components/payment/PaymentMethodStep.js +73 -0
  100. package/lib/module/ui/components/payment/PaymentMethodStep.js.map +1 -0
  101. package/lib/module/ui/components/payment/PaymentReviewStep.js +102 -0
  102. package/lib/module/ui/components/payment/PaymentReviewStep.js.map +1 -0
  103. package/lib/module/ui/components/payment/PaymentSuccessStep.js +73 -0
  104. package/lib/module/ui/components/payment/PaymentSuccessStep.js.map +1 -0
  105. package/lib/module/ui/components/payment/PaymentSummaryStep.js +170 -0
  106. package/lib/module/ui/components/payment/PaymentSummaryStep.js.map +1 -0
  107. package/lib/module/ui/components/payment/constants.js +47 -0
  108. package/lib/module/ui/components/payment/constants.js.map +1 -0
  109. package/lib/module/ui/components/payment/index.js +10 -0
  110. package/lib/module/ui/components/payment/index.js.map +1 -0
  111. package/lib/module/ui/components/payment/paymentStyles.js +404 -0
  112. package/lib/module/ui/components/payment/paymentStyles.js.map +1 -0
  113. package/lib/module/ui/components/payment/types.js +4 -0
  114. package/lib/module/ui/components/payment/types.js.map +1 -0
  115. package/lib/module/ui/hooks/index.js +2 -0
  116. package/lib/module/ui/hooks/index.js.map +1 -1
  117. package/lib/module/ui/hooks/useAsyncAction.js +89 -0
  118. package/lib/module/ui/hooks/useAsyncAction.js.map +1 -0
  119. package/lib/module/ui/hooks/useSettingToggle.js +120 -0
  120. package/lib/module/ui/hooks/useSettingToggle.js.map +1 -0
  121. package/lib/module/ui/navigation/routes.js +1 -0
  122. package/lib/module/ui/navigation/routes.js.map +1 -1
  123. package/lib/module/ui/screens/AccountCenterScreen.js +4 -2
  124. package/lib/module/ui/screens/AccountCenterScreen.js.map +1 -1
  125. package/lib/module/ui/screens/AccountOverviewScreen.js +33 -30
  126. package/lib/module/ui/screens/AccountOverviewScreen.js.map +1 -1
  127. package/lib/module/ui/screens/FAQScreen.js +310 -0
  128. package/lib/module/ui/screens/FAQScreen.js.map +1 -0
  129. package/lib/module/ui/screens/FeedbackScreen.js +64 -581
  130. package/lib/module/ui/screens/FeedbackScreen.js.map +1 -1
  131. package/lib/module/ui/screens/HelpSupportScreen.js +8 -7
  132. package/lib/module/ui/screens/HelpSupportScreen.js.map +1 -1
  133. package/lib/module/ui/screens/PaymentGatewayScreen.js +67 -1397
  134. package/lib/module/ui/screens/PaymentGatewayScreen.js.map +1 -1
  135. package/lib/module/ui/screens/ProfileScreen.js +13 -5
  136. package/lib/module/ui/screens/ProfileScreen.js.map +1 -1
  137. package/lib/module/ui/screens/SavesCollectionsScreen.js +16 -10
  138. package/lib/module/ui/screens/SavesCollectionsScreen.js.map +1 -1
  139. package/lib/module/ui/screens/karma/KarmaCenterScreen.js +23 -11
  140. package/lib/module/ui/screens/karma/KarmaCenterScreen.js.map +1 -1
  141. package/lib/typescript/core/mixins/OxyServices.features.d.ts +229 -0
  142. package/lib/typescript/core/mixins/OxyServices.features.d.ts.map +1 -0
  143. package/lib/typescript/core/mixins/index.d.ts +71 -1
  144. package/lib/typescript/core/mixins/index.d.ts.map +1 -1
  145. package/lib/typescript/ui/components/GroupedItem.d.ts +5 -1
  146. package/lib/typescript/ui/components/GroupedItem.d.ts.map +1 -1
  147. package/lib/typescript/ui/components/SettingRow.d.ts +6 -0
  148. package/lib/typescript/ui/components/SettingRow.d.ts.map +1 -1
  149. package/lib/typescript/ui/components/feedback/FormInput.d.ts +20 -0
  150. package/lib/typescript/ui/components/feedback/FormInput.d.ts.map +1 -0
  151. package/lib/typescript/ui/components/feedback/ProgressIndicator.d.ts +11 -0
  152. package/lib/typescript/ui/components/feedback/ProgressIndicator.d.ts.map +1 -0
  153. package/lib/typescript/ui/components/feedback/constants.d.ts +5 -0
  154. package/lib/typescript/ui/components/feedback/constants.d.ts.map +1 -0
  155. package/lib/typescript/ui/components/feedback/feedbackStyles.d.ts +280 -0
  156. package/lib/typescript/ui/components/feedback/feedbackStyles.d.ts.map +1 -0
  157. package/lib/typescript/ui/components/feedback/index.d.ts +7 -0
  158. package/lib/typescript/ui/components/feedback/index.d.ts.map +1 -0
  159. package/lib/typescript/ui/components/feedback/types.d.ts +46 -0
  160. package/lib/typescript/ui/components/feedback/types.d.ts.map +1 -0
  161. package/lib/typescript/ui/components/feedback/useFeedbackForm.d.ts +9 -0
  162. package/lib/typescript/ui/components/feedback/useFeedbackForm.d.ts.map +1 -0
  163. package/lib/typescript/ui/components/modals/DeleteAccountModal.d.ts +19 -0
  164. package/lib/typescript/ui/components/modals/DeleteAccountModal.d.ts.map +1 -0
  165. package/lib/typescript/ui/components/modals/index.d.ts +2 -0
  166. package/lib/typescript/ui/components/modals/index.d.ts.map +1 -0
  167. package/lib/typescript/ui/components/payment/PaymentDetailsStep.d.ts +21 -0
  168. package/lib/typescript/ui/components/payment/PaymentDetailsStep.d.ts.map +1 -0
  169. package/lib/typescript/ui/components/payment/PaymentMethodStep.d.ts +14 -0
  170. package/lib/typescript/ui/components/payment/PaymentMethodStep.d.ts.map +1 -0
  171. package/lib/typescript/ui/components/payment/PaymentReviewStep.d.ts +16 -0
  172. package/lib/typescript/ui/components/payment/PaymentReviewStep.d.ts.map +1 -0
  173. package/lib/typescript/ui/components/payment/PaymentSuccessStep.d.ts +10 -0
  174. package/lib/typescript/ui/components/payment/PaymentSuccessStep.d.ts.map +1 -0
  175. package/lib/typescript/ui/components/payment/PaymentSummaryStep.d.ts +15 -0
  176. package/lib/typescript/ui/components/payment/PaymentSummaryStep.d.ts.map +1 -0
  177. package/lib/typescript/ui/components/payment/constants.d.ts +7 -0
  178. package/lib/typescript/ui/components/payment/constants.d.ts.map +1 -0
  179. package/lib/typescript/ui/components/payment/index.d.ts +9 -0
  180. package/lib/typescript/ui/components/payment/index.d.ts.map +1 -0
  181. package/lib/typescript/ui/components/payment/paymentStyles.d.ts +396 -0
  182. package/lib/typescript/ui/components/payment/paymentStyles.d.ts.map +1 -0
  183. package/lib/typescript/ui/components/payment/types.d.ts +40 -0
  184. package/lib/typescript/ui/components/payment/types.d.ts.map +1 -0
  185. package/lib/typescript/ui/hooks/index.d.ts +2 -0
  186. package/lib/typescript/ui/hooks/index.d.ts.map +1 -1
  187. package/lib/typescript/ui/hooks/useAsyncAction.d.ts +51 -0
  188. package/lib/typescript/ui/hooks/useAsyncAction.d.ts.map +1 -0
  189. package/lib/typescript/ui/hooks/useSettingToggle.d.ts +55 -0
  190. package/lib/typescript/ui/hooks/useSettingToggle.d.ts.map +1 -0
  191. package/lib/typescript/ui/navigation/routes.d.ts +1 -1
  192. package/lib/typescript/ui/navigation/routes.d.ts.map +1 -1
  193. package/lib/typescript/ui/screens/AccountOverviewScreen.d.ts.map +1 -1
  194. package/lib/typescript/ui/screens/FAQScreen.d.ts +5 -0
  195. package/lib/typescript/ui/screens/FAQScreen.d.ts.map +1 -0
  196. package/lib/typescript/ui/screens/FeedbackScreen.d.ts.map +1 -1
  197. package/lib/typescript/ui/screens/HelpSupportScreen.d.ts.map +1 -1
  198. package/lib/typescript/ui/screens/PaymentGatewayScreen.d.ts +3 -15
  199. package/lib/typescript/ui/screens/PaymentGatewayScreen.d.ts.map +1 -1
  200. package/lib/typescript/ui/screens/ProfileScreen.d.ts.map +1 -1
  201. package/lib/typescript/ui/screens/SavesCollectionsScreen.d.ts.map +1 -1
  202. package/lib/typescript/ui/screens/karma/KarmaCenterScreen.d.ts.map +1 -1
  203. package/package.json +1 -1
  204. package/src/core/mixins/OxyServices.features.ts +428 -0
  205. package/src/core/mixins/index.ts +20 -17
  206. package/src/ui/components/GroupedItem.tsx +19 -1
  207. package/src/ui/components/SettingRow.tsx +26 -4
  208. package/src/ui/components/feedback/FormInput.tsx +84 -0
  209. package/src/ui/components/feedback/ProgressIndicator.tsx +35 -0
  210. package/src/ui/components/feedback/constants.ts +22 -0
  211. package/src/ui/components/feedback/feedbackStyles.ts +247 -0
  212. package/src/ui/components/feedback/index.ts +6 -0
  213. package/src/ui/components/feedback/types.ts +52 -0
  214. package/src/ui/components/feedback/useFeedbackForm.ts +44 -0
  215. package/src/ui/components/modals/DeleteAccountModal.tsx +294 -0
  216. package/src/ui/components/modals/index.ts +1 -0
  217. package/src/ui/components/payment/PaymentDetailsStep.tsx +222 -0
  218. package/src/ui/components/payment/PaymentMethodStep.tsx +89 -0
  219. package/src/ui/components/payment/PaymentReviewStep.tsx +126 -0
  220. package/src/ui/components/payment/PaymentSuccessStep.tsx +71 -0
  221. package/src/ui/components/payment/PaymentSummaryStep.tsx +159 -0
  222. package/src/ui/components/payment/constants.ts +39 -0
  223. package/src/ui/components/payment/index.ts +9 -0
  224. package/src/ui/components/payment/paymentStyles.ts +397 -0
  225. package/src/ui/components/payment/types.ts +45 -0
  226. package/src/ui/hooks/index.ts +3 -1
  227. package/src/ui/hooks/useAsyncAction.ts +129 -0
  228. package/src/ui/hooks/useSettingToggle.ts +147 -0
  229. package/src/ui/navigation/routes.ts +2 -0
  230. package/src/ui/screens/AccountCenterScreen.tsx +2 -2
  231. package/src/ui/screens/AccountOverviewScreen.tsx +35 -37
  232. package/src/ui/screens/FAQScreen.tsx +332 -0
  233. package/src/ui/screens/FeedbackScreen.tsx +91 -626
  234. package/src/ui/screens/HelpSupportScreen.tsx +7 -5
  235. package/src/ui/screens/PaymentGatewayScreen.tsx +96 -1275
  236. package/src/ui/screens/ProfileScreen.tsx +11 -6
  237. package/src/ui/screens/SavesCollectionsScreen.tsx +19 -10
  238. 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
+ }
@@ -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;