@propel-nsl/propel-react-native-sdk 1.0.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 (221) hide show
  1. package/assets/fonts/Lexend-Black.ttf +0 -0
  2. package/assets/fonts/Lexend-Bold.ttf +0 -0
  3. package/assets/fonts/Lexend-ExtraBold.ttf +0 -0
  4. package/assets/fonts/Lexend-ExtraLight.ttf +0 -0
  5. package/assets/fonts/Lexend-Light.ttf +0 -0
  6. package/assets/fonts/Lexend-Medium.ttf +0 -0
  7. package/assets/fonts/Lexend-Regular.ttf +0 -0
  8. package/assets/fonts/Lexend-SemiBold.ttf +0 -0
  9. package/assets/fonts/Lexend-Thin.ttf +0 -0
  10. package/assets/images/HomeGoods.png +0 -0
  11. package/assets/images/accessories.png +0 -0
  12. package/assets/images/amazon.png +0 -0
  13. package/assets/images/apnaClubLogo.png +0 -0
  14. package/assets/images/apparel.png +0 -0
  15. package/assets/images/backgroundblue.png +0 -0
  16. package/assets/images/bannerCard.png +0 -0
  17. package/assets/images/bottomWave.png +0 -0
  18. package/assets/images/coin_1_1.png +0 -0
  19. package/assets/images/flipkart.png +0 -0
  20. package/assets/images/frame_1171278967.png +0 -0
  21. package/assets/images/gift.png +0 -0
  22. package/assets/images/herobanner.png +0 -0
  23. package/assets/images/hinduPencilsLogo.png +0 -0
  24. package/assets/images/icons/addwhiteicon.png +0 -0
  25. package/assets/images/icons/arrow-back.png +0 -0
  26. package/assets/images/icons/arrowgreen.png +0 -0
  27. package/assets/images/icons/arrowred.png +0 -0
  28. package/assets/images/icons/arrowright.png +0 -0
  29. package/assets/images/icons/arrowup.png +0 -0
  30. package/assets/images/icons/blackarrowdown.png +0 -0
  31. package/assets/images/icons/blackarrowup.png +0 -0
  32. package/assets/images/icons/blackcross.png +0 -0
  33. package/assets/images/icons/call.png +0 -0
  34. package/assets/images/icons/camera.png +0 -0
  35. package/assets/images/icons/cart.png +0 -0
  36. package/assets/images/icons/chat.png +0 -0
  37. package/assets/images/icons/circleblack.png +0 -0
  38. package/assets/images/icons/copy.png +0 -0
  39. package/assets/images/icons/cross.png +0 -0
  40. package/assets/images/icons/delete.png +0 -0
  41. package/assets/images/icons/delivery.png +0 -0
  42. package/assets/images/icons/eVoucher.png +0 -0
  43. package/assets/images/icons/editIcon.png +0 -0
  44. package/assets/images/icons/email.png +0 -0
  45. package/assets/images/icons/eye.png +0 -0
  46. package/assets/images/icons/faq.png +0 -0
  47. package/assets/images/icons/filtericon.png +0 -0
  48. package/assets/images/icons/greyDownArrow.png +0 -0
  49. package/assets/images/icons/help.png +0 -0
  50. package/assets/images/icons/home.png +0 -0
  51. package/assets/images/icons/homeinactive.png +0 -0
  52. package/assets/images/icons/i_blackicon.png +0 -0
  53. package/assets/images/icons/i_icon.png +0 -0
  54. package/assets/images/icons/location.png +0 -0
  55. package/assets/images/icons/logout.png +0 -0
  56. package/assets/images/icons/minus.png +0 -0
  57. package/assets/images/icons/myOrders.png +0 -0
  58. package/assets/images/icons/orders.png +0 -0
  59. package/assets/images/icons/pencillogo.png +0 -0
  60. package/assets/images/icons/pending.png +0 -0
  61. package/assets/images/icons/plus.png +0 -0
  62. package/assets/images/icons/redCross.png +0 -0
  63. package/assets/images/icons/redCrossicon.png +0 -0
  64. package/assets/images/icons/redWarningicon.png +0 -0
  65. package/assets/images/icons/redeem.png +0 -0
  66. package/assets/images/icons/redeemactive.png +0 -0
  67. package/assets/images/icons/redemptionHistory.png +0 -0
  68. package/assets/images/icons/redhelpicon.png +0 -0
  69. package/assets/images/icons/search.png +0 -0
  70. package/assets/images/icons/stopwatch.png +0 -0
  71. package/assets/images/icons/successTick.gif +0 -0
  72. package/assets/images/icons/tick.png +0 -0
  73. package/assets/images/icons/tnc.png +0 -0
  74. package/assets/images/icons/user.png +0 -0
  75. package/assets/images/icons/userredicon.png +0 -0
  76. package/assets/images/icons/wavecorner.png +0 -0
  77. package/assets/images/logo.png +0 -0
  78. package/assets/images/myntra_copy.png +0 -0
  79. package/assets/images/nike.png +0 -0
  80. package/assets/images/oq3p0u0_1.png +0 -0
  81. package/assets/images/profileicon.png +0 -0
  82. package/assets/images/topWave.png +0 -0
  83. package/assets/images/zagglePropelLogo.png +0 -0
  84. package/index.ts +23 -0
  85. package/lib/index.ts +25 -0
  86. package/package.json +70 -0
  87. package/src/PropelSDKScreen.tsx +98 -0
  88. package/src/SDKApp.tsx +540 -0
  89. package/src/bridge/SDKBridge.ts +104 -0
  90. package/src/bridge/index.ts +3 -0
  91. package/src/components/SDKBackHandler.tsx +187 -0
  92. package/src/components/SDKProfile.tsx +87 -0
  93. package/src/components/SDKProfileWrapper.tsx +51 -0
  94. package/src/constants.ts +10 -0
  95. package/src/contexts/SDKContext.tsx +72 -0
  96. package/src/hooks/useSDKBackNavigation.ts +61 -0
  97. package/src/navigation/SDKMainTabNavigator.tsx +315 -0
  98. package/src/navigation/SDKNavigator.tsx +41 -0
  99. package/src/redux/store.ts +32 -0
  100. package/src/screens/Dashboard/index.tsx +531 -0
  101. package/src/screens/Dashboard/styles.ts +512 -0
  102. package/src/screens/DeliveryAddress/index.tsx +221 -0
  103. package/src/screens/DeliveryAddress/styles.ts +122 -0
  104. package/src/screens/E-Vouchers/index.tsx +157 -0
  105. package/src/screens/E-Vouchers/styles.ts +106 -0
  106. package/src/screens/Faq/Faq.constants.ts +164 -0
  107. package/src/screens/Faq/index.tsx +114 -0
  108. package/src/screens/Faq/styles.ts +131 -0
  109. package/src/screens/Help/index.tsx +128 -0
  110. package/src/screens/Help/styles.ts +121 -0
  111. package/src/screens/Login/index.tsx +215 -0
  112. package/src/screens/Login/styles.ts +134 -0
  113. package/src/screens/MyCart/MyCart.constants.ts +13 -0
  114. package/src/screens/MyCart/index.tsx +318 -0
  115. package/src/screens/MyCart/styles.ts +249 -0
  116. package/src/screens/MyOrders/index.tsx +87 -0
  117. package/src/screens/MyOrders/styles.ts +281 -0
  118. package/src/screens/MyProfile/index.tsx +72 -0
  119. package/src/screens/MyProfile/styles.ts +47 -0
  120. package/src/screens/NewDeliveryAddress/index.tsx +360 -0
  121. package/src/screens/NewDeliveryAddress/styles.ts +68 -0
  122. package/src/screens/Onboarding/index.tsx +57 -0
  123. package/src/screens/Onboarding/styles.ts +60 -0
  124. package/src/screens/OrdersDetails/index.tsx +333 -0
  125. package/src/screens/OrdersDetails/styles.ts +262 -0
  126. package/src/screens/OtpVerification/index.tsx +283 -0
  127. package/src/screens/OtpVerification/styles.ts +197 -0
  128. package/src/screens/PaymentMethod/index.tsx +389 -0
  129. package/src/screens/PaymentMethod/styles.ts +246 -0
  130. package/src/screens/PointsLog/index.tsx +286 -0
  131. package/src/screens/PointsLog/styles.ts +156 -0
  132. package/src/screens/ProductDetails/index.tsx +682 -0
  133. package/src/screens/ProductDetails/styles.ts +372 -0
  134. package/src/screens/Profile/index.tsx +368 -0
  135. package/src/screens/Profile/styles.ts +158 -0
  136. package/src/screens/RedemptionHistory/RedemptionHistory.constants.ts +4 -0
  137. package/src/screens/RedemptionHistory/index.tsx +304 -0
  138. package/src/screens/RedemptionHistory/styles.ts +84 -0
  139. package/src/screens/Reedem/index.tsx +345 -0
  140. package/src/screens/Reedem/styles.ts +269 -0
  141. package/src/screens/TnC/TnC.constants.ts +169 -0
  142. package/src/screens/TnC/index.tsx +83 -0
  143. package/src/screens/TnC/styles.ts +88 -0
  144. package/src/screens/TransactionSuccessful/index.tsx +77 -0
  145. package/src/screens/TransactionSuccessful/styles.ts +77 -0
  146. package/src/screens/Verification/index.tsx +58 -0
  147. package/src/screens/Verification/styles.ts +74 -0
  148. package/src/screens/index.ts +23 -0
  149. package/src/types/index.ts +46 -0
  150. package/src-app/components/AmountBreakDownModal/index.tsx +86 -0
  151. package/src-app/components/AmountBreakDownModal/styles.ts +110 -0
  152. package/src-app/components/BottomNavIcons.tsx +125 -0
  153. package/src-app/components/Button.tsx +120 -0
  154. package/src-app/components/Card.tsx +47 -0
  155. package/src-app/components/ConfirmPopup/ConfirmPopup.constants.ts +25 -0
  156. package/src-app/components/ConfirmPopup/index.tsx +48 -0
  157. package/src-app/components/ConfirmPopup/styles.ts +167 -0
  158. package/src-app/components/CustomButton/index.tsx +67 -0
  159. package/src-app/components/CustomButton/styles.ts +44 -0
  160. package/src-app/components/CustomCard/index.tsx +221 -0
  161. package/src-app/components/CustomCard/styles.ts +184 -0
  162. package/src-app/components/CustomError/index.tsx +54 -0
  163. package/src-app/components/CustomError/styles.ts +41 -0
  164. package/src-app/components/CustomImage/index.tsx +37 -0
  165. package/src-app/components/CustomImage/styles.ts +5 -0
  166. package/src-app/components/CustomLoader/index.tsx +45 -0
  167. package/src-app/components/CustomLoader/styles.ts +35 -0
  168. package/src-app/components/CustomMessagePopUp/index.tsx +51 -0
  169. package/src-app/components/CustomMessagePopUp/styles.ts +74 -0
  170. package/src-app/components/CustomProductCard/index.tsx +13 -0
  171. package/src-app/components/CustomProductCard/styles.ts +5 -0
  172. package/src-app/components/FilterModal.tsx +372 -0
  173. package/src-app/components/Footer/index.tsx +23 -0
  174. package/src-app/components/Footer/styles.ts +37 -0
  175. package/src-app/components/Icon.tsx +80 -0
  176. package/src-app/components/Logout/index.tsx +82 -0
  177. package/src-app/components/Logout/styles.ts +116 -0
  178. package/src-app/components/MobileHeader.tsx +141 -0
  179. package/src-app/components/NoDataFound/index.tsx +18 -0
  180. package/src-app/components/NoDataFound/styles.ts +26 -0
  181. package/src-app/components/OTPModal.tsx +747 -0
  182. package/src-app/components/ProfileField.tsx +47 -0
  183. package/src-app/components/QuantityModal/index.tsx +113 -0
  184. package/src-app/components/QuantityModal/styles.ts +84 -0
  185. package/src-app/components/TabBarIcons.tsx +110 -0
  186. package/src-app/components/TextInput.tsx +79 -0
  187. package/src-app/components/ToastConfig.tsx +60 -0
  188. package/src-app/components/index.ts +18 -0
  189. package/src-app/config/env.ts +22 -0
  190. package/src-app/constants/Fonts.ts +12 -0
  191. package/src-app/constants/Formatter.ts +39 -0
  192. package/src-app/constants/HtmlSanitization.ts +46 -0
  193. package/src-app/constants/Images.ts +81 -0
  194. package/src-app/constants/Labels.ts +8 -0
  195. package/src-app/constants/Messages.ts +108 -0
  196. package/src-app/constants/Routes.ts +17 -0
  197. package/src-app/constants/Scaling.ts +5 -0
  198. package/src-app/constants/Text.ts +8 -0
  199. package/src-app/constants/offSets.ts +18 -0
  200. package/src-app/hooks/useAppDispatch.ts +4 -0
  201. package/src-app/hooks/useAppSelector.ts +4 -0
  202. package/src-app/hooks/useBackHandler.ts +47 -0
  203. package/src-app/hooks/useScreenBackHandler.ts +91 -0
  204. package/src-app/navigation/AppNavigator.tsx +34 -0
  205. package/src-app/navigation/MainTabNavigator.tsx +294 -0
  206. package/src-app/redux/authSaga.ts +605 -0
  207. package/src-app/redux/authSlice.ts +754 -0
  208. package/src-app/redux/rootSaga.ts +6 -0
  209. package/src-app/redux/store.ts +25 -0
  210. package/src-app/services/api.ts +14 -0
  211. package/src-app/services/endpoints.ts +33 -0
  212. package/src-app/services/index.ts +574 -0
  213. package/src-app/services/sdkCredentials.ts +44 -0
  214. package/src-app/styles/colors.ts +85 -0
  215. package/src-app/styles/shared.ts +112 -0
  216. package/src-app/types/authTypes.ts +155 -0
  217. package/src-app/types/navigation.ts +99 -0
  218. package/src-app/utils/Validation.ts +48 -0
  219. package/src-app/utils/filterPins.ts +29 -0
  220. package/src-app/utils/navigationUtils.ts +43 -0
  221. package/src-app/utils/useHardwareBack.ts +21 -0
@@ -0,0 +1,389 @@
1
+ import { View, Text, TouchableOpacity, ScrollView } from 'react-native';
2
+ import React, { useEffect, useState, useCallback } from 'react';
3
+ import { useFocusEffect } from '@react-navigation/native';
4
+ import styles from './styles';
5
+ import MobileHeader from '../../../src-app/components/MobileHeader';
6
+ import { StackNavigationProp } from '@react-navigation/stack';
7
+ import { AppStackParamList } from '../../../src-app/types/navigation';
8
+ import { AmountModal, CustomImage, CustomLoader, CustomMessagePopUp } from '../../../src-app/components';
9
+ import OTPModal from '../../../src-app/components/OTPModal';
10
+ import Images from '../../../src-app/constants/Images';
11
+ import Svg, { Path } from 'react-native-svg';
12
+ import { useAppDispatch } from '../../../src-app/hooks/useAppDispatch';
13
+ import {
14
+ checkoutRequest,
15
+ dashboardInfoRequest,
16
+ resetAuthState,
17
+ viewMyCartRequest,
18
+ myOrdersGenerateOtpRequest,
19
+ myOrdersValidateOtpRequest,
20
+ } from '../../../src-app/redux/authSlice';
21
+ import { RootState } from '../../../src-app/redux/store';
22
+ import { useAppSelector } from '../../../src-app/hooks/useAppSelector';
23
+ import { useRoute, RouteProp } from '@react-navigation/native';
24
+
25
+ import { colors } from '../../../src-app/styles/colors';
26
+ import Toast from 'react-native-toast-message';
27
+ import { ERROR, INSUFFICIENT_BALANCE, OTP_SUBTITLE, OTP_TITLE, PROCESSING_ORDER, SUCCESS } from '../../../src-app/constants/Messages';
28
+
29
+ const extractLineAndLandmark = (address: string) => {
30
+ const raw = (address || '').replace(/\\n/g, '\n');
31
+ const lineMatch = raw.match(/Line:\s*(.*?)(\n|$)/);
32
+ const landmarkMatch = raw.match(/Landmark:\s*(.*)/);
33
+ const Line = lineMatch ? lineMatch[1].trim() : '';
34
+ const Landmark = landmarkMatch ? landmarkMatch[1].trim() : '';
35
+ return { Line, Landmark };
36
+ };
37
+
38
+ const PaymentMethod: React.FC<{
39
+ navigation: StackNavigationProp<AppStackParamList>;
40
+ }> = ({ navigation }) => {
41
+ const [showPointsBreakdown, setShowPointsBreakdown] = useState(false);
42
+ const [showPointsApply, setShowPointsApply] = useState(false);
43
+ const [amountModalVisible, setAmountModalVisible] = useState(false);
44
+ const [checkoutPoints, setCheckoutPoints] = useState<number>(0);
45
+ const [showOtpModal, setShowOtpModal] = useState(false);
46
+ const [pendingCheckoutPayload, setPendingCheckoutPayload] = useState<any>(null);
47
+ const dispatch = useAppDispatch();
48
+ const [showLoader, setShowLoader] = useState(false);
49
+
50
+ const {
51
+ viewMyCartData,
52
+ dashboardInfoData,
53
+ cartId,
54
+ checkoutSuccessMessage,
55
+ checkoutError,
56
+ myOrdersGenerateOtpLoading,
57
+ myOrdersGenerateOtpError,
58
+ myOrdersValidateOtpLoading,
59
+ myOrdersValidateOtpError,
60
+ myOrdersValidateOtpData,
61
+ } = useAppSelector((state: RootState) => state.auth);
62
+
63
+ const route = useRoute<
64
+ RouteProp<{ PaymentMethod: { item?: { line: string }; skipAddress?: boolean } }, 'PaymentMethod'>
65
+ >();
66
+ const item = route.params?.item;
67
+ const skipAddress = !!route.params?.skipAddress;
68
+ const { Line, Landmark } = extractLineAndLandmark(item?.line || '');
69
+
70
+ useEffect(() => {
71
+ if (checkoutSuccessMessage) {
72
+ setShowLoader(false);
73
+ Toast.show({
74
+ type: SUCCESS,
75
+ text1: checkoutSuccessMessage,
76
+ });
77
+ dispatch(resetAuthState('checkoutSuccessMessage'));
78
+ navigation.navigate('TransactionSuccessful', {
79
+ item: checkoutPoints,
80
+ });
81
+ }
82
+ }, [checkoutSuccessMessage, navigation, checkoutPoints, dispatch]);
83
+
84
+ useEffect(() => {
85
+ dispatch(dashboardInfoRequest({}));
86
+ }, [dispatch]);
87
+
88
+ useEffect(() => {
89
+ if (cartId) {
90
+ dispatch(viewMyCartRequest({ id: cartId }));
91
+ }
92
+ }, [cartId, dispatch]);
93
+
94
+ useEffect(() => {
95
+ // if (!skipAddress && myOrdersValidateOtpData && pendingCheckoutPayload)
96
+ if (myOrdersValidateOtpData && pendingCheckoutPayload && cartId){
97
+ setShowOtpModal(false);
98
+ setShowLoader(true);
99
+ // Use current cartId from Redux state to ensure we have the latest cart ID
100
+ const checkoutPayload = {
101
+ ...pendingCheckoutPayload,
102
+ orderId: cartId,
103
+ order_id: cartId,
104
+ };
105
+ dispatch(checkoutRequest(checkoutPayload));
106
+ setPendingCheckoutPayload(null);
107
+ }
108
+ }, [myOrdersValidateOtpData, pendingCheckoutPayload, cartId, dispatch]);
109
+
110
+
111
+ return (
112
+ <View style={styles.container}>
113
+ <MobileHeader
114
+ title="Select Payment Method"
115
+ showBack
116
+ onBack={() => {
117
+ if (navigation.canGoBack()) {
118
+ navigation.goBack();
119
+ } else {
120
+ navigation.navigate('MyCart' as never);
121
+ }
122
+ }}
123
+ disableSafeAreaPadding={true}
124
+ />
125
+ <ScrollView showsVerticalScrollIndicator={false}>
126
+ <View style={styles.content}>
127
+ <View style={styles.separator} />
128
+
129
+ {/* Address block should be hidden for e-voucher only orders */}
130
+ {!skipAddress && (
131
+ <View style={styles.inputContainer}>
132
+ <CustomImage source={Images.location} imgStyle={styles.icon} />
133
+ <View style={styles.addressContainer}>
134
+ <View style={styles.addressTextContainer}>
135
+ <Text numberOfLines={1} style={styles.label}>{dashboardInfoData?.name} </Text>
136
+ <Text style={styles.pipe}>|</Text>
137
+ <Text numberOfLines={1} style={styles.address}>
138
+ {Line} {Landmark}
139
+ </Text>
140
+ </View>
141
+ <TouchableOpacity
142
+ activeOpacity={0.7}
143
+ onPress={() => navigation.goBack()}
144
+ style={styles.changeButtonContainer}
145
+ >
146
+ <Text numberOfLines={1} style={styles.touchable}>
147
+ Change
148
+ </Text>
149
+ <View style={styles.underline} />
150
+ </TouchableOpacity>
151
+ </View>
152
+ </View>
153
+
154
+ )}
155
+
156
+ <View style={styles.pointsContainer}>
157
+ <View style={styles.headerRow}>
158
+ <Text style={styles.label}>Total Amount Payable</Text>
159
+ <TouchableOpacity
160
+ style={styles.row}
161
+ activeOpacity={0.7}
162
+ onPress={() => setShowPointsBreakdown(!showPointsBreakdown)}
163
+ >
164
+ <Text style={styles.pointsText}>
165
+ {viewMyCartData?.amount_cents / 100} Points
166
+ </Text>
167
+ <CustomImage
168
+ source={
169
+ showPointsBreakdown ? Images.upArrow : Images.downArrow
170
+ }
171
+ imgStyle={styles.arrowIcon}
172
+ />
173
+ </TouchableOpacity>
174
+ </View>
175
+ {showPointsBreakdown && (
176
+ <View style={styles.expandSection}>
177
+ <View style={styles.pointsBreakdown}>
178
+ <View style={styles.breakdownRow}>
179
+ <Text style={styles.subLabel}>Order Amount</Text>
180
+ <Text style={styles.subLabel}>
181
+ {viewMyCartData?.amount_cents / 100}
182
+ </Text>
183
+ </View>
184
+ {/* Hide Delivery Charges when skipping address */}
185
+ {/* {!skipAddress && (
186
+ <View style={styles.breakdownRow}>
187
+ <Text style={styles.subLabel}>Delivery Charges</Text>
188
+ <Text style={styles.subLabel}>
189
+ {viewMyCartData?.shipping_fee_cents}
190
+ </Text>
191
+ </View>
192
+ )} */}
193
+ </View>
194
+ </View>
195
+ )}
196
+ </View>
197
+
198
+ <Text style={styles.balanceText}>Pay Balance</Text>
199
+ <View style={styles.balancepointsContainer}>
200
+ <View style={styles.headerRow}>
201
+ <Text style={[styles.label, { color: 'black' }]}>
202
+ {viewMyCartData?.total_amount_cents / 100} Apna Points
203
+ </Text>
204
+ <TouchableOpacity
205
+ style={styles.row}
206
+ activeOpacity={0.7}
207
+ onPress={() => {
208
+ setShowPointsApply(!showPointsApply);
209
+ }}
210
+ >
211
+ <Text style={styles.applytext}>
212
+ {showPointsApply ? 'Remove' : 'Apply'}
213
+ </Text>
214
+ </TouchableOpacity>
215
+ </View>
216
+ {showPointsApply ? (
217
+ <View style={styles.applyRow}>
218
+ <CustomImage
219
+ source={Images.successTick}
220
+ imgStyle={styles.tickIcon}
221
+ />
222
+ <Text
223
+ style={[
224
+ styles.applicableSuccessText,
225
+ {
226
+ color: colors.green,
227
+ },
228
+ ]}
229
+ >
230
+ {`Applied out of ${dashboardInfoData?.current_balance}`}
231
+ </Text>
232
+ </View>
233
+ ) : (
234
+ <Text
235
+ style={[
236
+ styles.applicableText,
237
+ {
238
+ color: colors.onSurfaceVariant,
239
+ },
240
+ ]}
241
+ >
242
+ {`Applicable out of ${dashboardInfoData?.current_balance}`}
243
+ </Text>
244
+ )}
245
+
246
+ {showPointsApply && (
247
+ <View style={styles.expandSection}>
248
+ </View>
249
+ )}
250
+ </View>
251
+ </View>
252
+ </ScrollView>
253
+ <View style={styles.bottomCTA}>
254
+ <View style={styles.priceSection}>
255
+ <Text style={styles.priceText}>
256
+ {viewMyCartData?.total_amount_cents / 100} points
257
+ </Text>
258
+ <TouchableOpacity
259
+ activeOpacity={0.7}
260
+ style={styles.viewDetailsButton}
261
+ onPress={() => setAmountModalVisible(true)}
262
+ >
263
+ <Text style={styles.viewDetailsText}>View Details</Text>
264
+ <Svg width="10" height="6" viewBox="0 0 10 6" fill="none">
265
+ <Path
266
+ d="M9 5L5 1L1 5"
267
+ stroke="#DC291E"
268
+ strokeWidth="1.6"
269
+ strokeLinecap="round"
270
+ strokeLinejoin="round"
271
+ />
272
+ </Svg>
273
+ </TouchableOpacity>
274
+ </View>
275
+ <TouchableOpacity
276
+ activeOpacity={0.7}
277
+ style={[
278
+ styles.addToCartButton,
279
+ !showPointsApply && { backgroundColor: colors.disableButton },
280
+ ]}
281
+ disabled={!showPointsApply}
282
+ onPress={() => {
283
+ dispatch(resetAuthState('myOrdersValidateOtpData'));
284
+ dispatch(resetAuthState('myOrdersValidateOtpError'));
285
+ const points = viewMyCartData?.total_amount_cents ? viewMyCartData.total_amount_cents / 100 : 0;
286
+ const balance = dashboardInfoData?.current_balance || 0;
287
+ setCheckoutPoints(points);
288
+ if (points > balance) {
289
+ Toast.show({
290
+ type: ERROR,
291
+ text1: INSUFFICIENT_BALANCE,
292
+ });
293
+ return;
294
+ }
295
+ const payload = {
296
+ orderId: cartId,
297
+ amount_cents: 0,
298
+ client_id: '7b170ef2-c0a0-4968-a832-d308d54a8419',
299
+ order_id: cartId,
300
+ redeem_propel_points: true,
301
+ redirect: '',
302
+ payment_method: 'third_party_points',
303
+ transactions: [
304
+ {
305
+ amount_cents: 0,
306
+ payment_method: 'zaggleOption',
307
+ },
308
+ ],
309
+ skipAddress,
310
+ };
311
+
312
+
313
+
314
+
315
+ setPendingCheckoutPayload(payload);
316
+
317
+ dispatch(
318
+ myOrdersGenerateOtpRequest({
319
+ order_id: cartId,
320
+ otp_type: 'orders_confirm_otp',
321
+ })
322
+ );
323
+ setShowOtpModal(true);
324
+
325
+ }}
326
+ >
327
+ <Text style={styles.addToCartText}>Continue</Text>
328
+ </TouchableOpacity>
329
+ </View>
330
+
331
+ {amountModalVisible && (
332
+ <AmountModal
333
+ visible={amountModalVisible}
334
+ onClose={() => setAmountModalVisible(false)}
335
+ item={{
336
+ discount_cents: skipAddress ? 0 : viewMyCartData?.shipping_fee_cents,
337
+ grand_total: viewMyCartData?.total_amount_cents,
338
+ total_amount_cents: viewMyCartData?.total_amount_cents,
339
+ }}
340
+ label_1="Order Amount"
341
+ label_2="Delivery Charges"
342
+ />
343
+ )}
344
+ {checkoutError && (
345
+ <CustomMessagePopUp
346
+ title="Error"
347
+ message={checkoutError}
348
+ visible={!!checkoutError}
349
+ onClose={() => {
350
+ setShowLoader(false); // ✅ hide loader on failure
351
+ dispatch(resetAuthState('checkoutError'));
352
+ }}
353
+ />
354
+ )}
355
+ <OTPModal
356
+ visible={showOtpModal}
357
+ onClose={() => {
358
+ setShowOtpModal(false);
359
+ setPendingCheckoutPayload(null);
360
+ }}
361
+ onResend={() => dispatch(
362
+ myOrdersGenerateOtpRequest({
363
+ order_id: cartId,
364
+ otp_type: 'orders_confirm_otp',
365
+ }))}
366
+ onVerify={(otp: string) => {
367
+ if (otp && otp.trim()) {
368
+ dispatch(
369
+ myOrdersValidateOtpRequest({
370
+ order_id: cartId,
371
+ otp,
372
+ otp_type: 'orders_confirm_otp',
373
+ next: pendingCheckoutPayload,
374
+ })
375
+ );
376
+ }
377
+ }}
378
+ loading={!!myOrdersGenerateOtpLoading || !!myOrdersValidateOtpLoading}
379
+ errorMessage={myOrdersValidateOtpError || myOrdersGenerateOtpError}
380
+ title={OTP_TITLE}
381
+ subtitle={OTP_SUBTITLE}
382
+ />
383
+ {showLoader && <CustomLoader message={PROCESSING_ORDER} />}
384
+
385
+ </View>
386
+ );
387
+ };
388
+
389
+ export default PaymentMethod;
@@ -0,0 +1,246 @@
1
+ import {StyleSheet } from 'react-native';
2
+ import FontFamily from '../../../src-app/constants/Fonts';
3
+ import { SCALE } from '../../../src-app/constants/Scaling';
4
+ import { colors } from '../../../src-app/styles/colors';
5
+ import leftOffset from '../../../src-app/constants/offSets';
6
+
7
+ const styles = StyleSheet.create({
8
+ container: {
9
+ flex: 1,
10
+ backgroundColor: colors.white,
11
+ },
12
+ content: {
13
+ padding: 20,
14
+ flex: 1,
15
+ },
16
+ separator: {
17
+ height: 1.2,
18
+ backgroundColor: colors.transparent,
19
+ width: '100%',
20
+ alignSelf: 'center',
21
+ borderTopWidth: 1,
22
+ borderTopColor: colors.paymentSeparatorBorder,
23
+ marginBottom: '5%',
24
+ },
25
+ inputContainer: {
26
+ borderWidth: 1,
27
+ borderColor: colors.paymentBorderColor,
28
+ borderRadius: 12,
29
+ backgroundColor: colors.white,
30
+ paddingHorizontal: 20,
31
+ marginBottom: '7%',
32
+ flexDirection: 'row',
33
+ alignItems: 'center',
34
+ gap: 10,
35
+ paddingVertical: 15,
36
+ },
37
+ pointsContainer: {
38
+ borderWidth: 1,
39
+ borderColor: colors.paymentBorderColor,
40
+ borderRadius: 12,
41
+ backgroundColor: colors.paymentBackgroundGray,
42
+ paddingHorizontal: 20,
43
+ marginBottom: '7%',
44
+ paddingVertical: 15,
45
+ },
46
+ balancepointsContainer: {
47
+ borderWidth: 1,
48
+ borderColor: colors.paymentBorderColor,
49
+ borderRadius: 12,
50
+ backgroundColor: colors.white,
51
+ paddingHorizontal: 20,
52
+ marginBottom: '7%',
53
+ paddingVertical: 15,
54
+ marginTop: 10,
55
+ },
56
+ headerRow: {
57
+ flexDirection: 'row',
58
+ justifyContent: 'space-between',
59
+ alignItems: 'center',
60
+ width: '100%',
61
+ },
62
+ label: {
63
+ fontFamily: FontFamily.LEXEND_REGULAR,
64
+ fontSize: 12,
65
+ fontWeight: 400,
66
+ color: colors.onSurfaceVariant,
67
+ maxWidth: SCALE(150),
68
+ },
69
+ applicableText: {
70
+ fontFamily: FontFamily.LEXEND_REGULAR,
71
+ fontSize: 12,
72
+ fontWeight: 400,
73
+ color: colors.onSurfaceVariant,
74
+ marginTop: 5,
75
+ },
76
+ applicableSuccessText: {
77
+ fontFamily: FontFamily.LEXEND_REGULAR,
78
+ fontSize: 12,
79
+ fontWeight: 400,
80
+ color: colors.onSurfaceVariant,
81
+ },
82
+ address: {
83
+ fontFamily: FontFamily.LEXEND_REGULAR,
84
+ fontSize: 12,
85
+ fontWeight: 400,
86
+ color: colors.onSurfaceVariant,
87
+ width: SCALE(120),
88
+ right: 5,
89
+ },
90
+ icon: {
91
+ height: 14,
92
+ width: 10,
93
+ resizeMode: 'contain',
94
+ },
95
+ tickIcon: {
96
+ height: 20,
97
+ width: 20,
98
+ resizeMode: 'contain',
99
+ },
100
+ touchable: {
101
+ fontFamily: FontFamily.LEXEND_REGULAR,
102
+ fontSize: 10,
103
+ fontWeight: 500,
104
+ color: colors.darkGrey,
105
+ },
106
+ applytext: {
107
+ fontFamily: FontFamily.LEXEND_REGULAR,
108
+ fontSize: 12,
109
+ fontWeight: 500,
110
+ color: colors.darkGrey,
111
+ },
112
+ underline: {
113
+ height: 1.2,
114
+ width: 35,
115
+ alignSelf: 'center',
116
+ borderTopWidth: 1,
117
+ borderTopColor: colors.darkGrey,
118
+ },
119
+ row: {
120
+ flexDirection: 'row',
121
+ alignItems: 'center',
122
+ gap: 10,
123
+ },
124
+ applyRow: {
125
+ flexDirection: 'row',
126
+ alignItems: 'center',
127
+ gap: 2,
128
+ marginTop: 5,
129
+ },
130
+ pointsText: {
131
+ fontFamily: FontFamily.LEXEND_MEDIUM,
132
+ fontSize: 14,
133
+ fontWeight: '600',
134
+ color: colors.onSurface,
135
+ },
136
+ balanceText: {
137
+ fontFamily: FontFamily.LEXEND_SEMIBOLD,
138
+ fontSize: 14,
139
+ fontWeight: '600',
140
+ color: colors.black,
141
+ },
142
+ arrowIcon: {
143
+ height: 12,
144
+ width: 12,
145
+ resizeMode: 'contain',
146
+ },
147
+ pointsBreakdown: {
148
+ width: '100%',
149
+ },
150
+ breakdownRow: {
151
+ flexDirection: 'row',
152
+ justifyContent: 'space-between',
153
+ alignItems: 'center',
154
+ marginBottom: 8,
155
+ },
156
+ expandSection: {
157
+ marginTop: 10,
158
+ paddingTop: 10,
159
+ },
160
+ subLabel: {
161
+ fontFamily: FontFamily.LEXEND_REGULAR,
162
+ fontSize: 12,
163
+ color: colors.paymentSubText,
164
+ marginBottom: 4,
165
+ },
166
+
167
+ total: {
168
+ fontFamily: FontFamily.LEXEND_MEDIUM,
169
+ fontSize: 13,
170
+ color: colors.onSurface,
171
+ marginTop: 6,
172
+ },
173
+ bottomCTA: {
174
+ flexDirection: 'row',
175
+ justifyContent: 'space-between',
176
+ alignItems: 'center',
177
+ paddingHorizontal: 20,
178
+ paddingVertical: 16,
179
+ backgroundColor: colors.white,
180
+ shadowColor: colors.shadowColor,
181
+ shadowOffset: {
182
+ width: 0,
183
+ height: 0,
184
+ },
185
+ shadowOpacity: 1,
186
+ shadowRadius: 12,
187
+ elevation: 8,
188
+ },
189
+ priceSection: {
190
+ gap: 8,
191
+ },
192
+ priceText: {
193
+ fontFamily: FontFamily.LEXEND_REGULAR,
194
+ fontSize: 20,
195
+ fontWeight: '600',
196
+ color: colors.black,
197
+ },
198
+ viewDetailsButton: {
199
+ flexDirection: 'row',
200
+ alignItems: 'center',
201
+ gap: 8,
202
+ },
203
+ viewDetailsText: {
204
+ fontFamily: FontFamily.LEXEND_REGULAR,
205
+ fontSize: 10,
206
+ fontWeight: '500',
207
+ color: colors.darkGrey,
208
+ },
209
+ addToCartButton: {
210
+ width: 180,
211
+ height: 52,
212
+ backgroundColor: colors.darkGrey,
213
+ borderRadius: 12,
214
+ justifyContent: 'center',
215
+ alignItems: 'center',
216
+ },
217
+ addToCartText: {
218
+ fontFamily: FontFamily.LEXEND_REGULAR,
219
+ fontSize: 14,
220
+ fontWeight: '600',
221
+ color: colors.white,
222
+ },
223
+ addressContainer: {
224
+ flexDirection: 'row',
225
+ alignItems: 'center',
226
+ },
227
+ addressTextContainer: {
228
+ flexDirection: 'row',
229
+ alignItems: 'center',
230
+ gap: 10,
231
+ },
232
+ changeButtonContainer: {
233
+ alignItems: 'center',
234
+ minWidth: 50,
235
+ left: leftOffset
236
+ },
237
+ pipe: {
238
+ fontFamily: FontFamily.LEXEND_REGULAR,
239
+ fontSize: 12,
240
+ fontWeight: 400,
241
+ color: colors.onSurfaceVariant,
242
+ right:SCALE(2)
243
+ },
244
+ });
245
+
246
+ export default styles;