@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,167 @@
1
+ import { StyleSheet, Dimensions } from 'react-native';
2
+ import FontFamily from '../../constants/Fonts';
3
+ import { VSCALE } from '../../constants/Scaling';
4
+ import { colors } from '../../styles/colors';
5
+
6
+ const { height: screenHeight, width: screenWidth } = Dimensions.get('window');
7
+
8
+ const styles = StyleSheet.create({
9
+ absoluteContainer: {
10
+ position: 'absolute',
11
+ top: 0,
12
+ left: 0,
13
+ right: 0,
14
+ bottom: 0,
15
+ width: screenWidth,
16
+ height: screenHeight,
17
+ justifyContent: 'flex-end',
18
+ paddingBottom: screenHeight < 700 ? 60 : 0,
19
+ zIndex: 50000,
20
+ elevation: 50000,
21
+ },
22
+ overlay: {
23
+ position: 'absolute',
24
+ top: 0,
25
+ left: 0,
26
+ right: 0,
27
+ bottom: 0,
28
+ backgroundColor: 'rgba(0, 0, 0, 0.5)',
29
+ },
30
+ modalContainer: {
31
+ width: '100%',
32
+ maxWidth: '100%',
33
+ height: '50%',
34
+ backgroundColor: colors.white,
35
+ borderTopLeftRadius: 30,
36
+ borderTopRightRadius: 30,
37
+ paddingHorizontal: 20,
38
+ paddingTop: 18,
39
+ paddingBottom: 36,
40
+ },
41
+ handleBar: {
42
+ width: 48,
43
+ height: 4,
44
+ backgroundColor: colors.outline,
45
+ borderRadius: 6,
46
+ alignSelf: 'center',
47
+ marginBottom: 27,
48
+ },
49
+ title: {
50
+ fontFamily: FontFamily.LEXEND_REGULAR,
51
+ fontSize: 16,
52
+ fontWeight: '500',
53
+ color: colors.logOutTitle,
54
+ marginBottom: VSCALE(8),
55
+ textAlign: 'center',
56
+ marginTop: VSCALE(29),
57
+ },
58
+ icon: {
59
+ height: 24,
60
+ width: 24,
61
+ bottom: 3,
62
+ },
63
+ row: {
64
+ flexDirection: 'row',
65
+ alignItems: 'center',
66
+ justifyContent: 'space-between',
67
+ gap: VSCALE(10),
68
+ marginTop: VSCALE(20),
69
+ },
70
+ leftText: {
71
+ fontFamily: FontFamily.LEXEND_REGULAR,
72
+ fontSize: 12,
73
+ fontWeight: '500',
74
+ color: colors.onSurfaceVariant,
75
+ textTransform: 'capitalize',
76
+ marginBottom: VSCALE(12),
77
+ },
78
+ amountText: {
79
+ fontFamily: FontFamily.LEXEND_REGULAR,
80
+ fontSize: 12,
81
+ fontWeight: '600',
82
+ color: colors.onSurfaceVariant,
83
+ textTransform: 'capitalize',
84
+ marginTop: 10,
85
+ },
86
+ separator: {
87
+ height: 1.2,
88
+ backgroundColor: 'transparent',
89
+ marginVertical: 8,
90
+ width: '100%',
91
+ alignSelf: 'center',
92
+ borderTopWidth: 1,
93
+ borderTopColor: 'rgba(209, 213, 219, 0.65)',
94
+ },
95
+ content: {
96
+ marginTop: 20,
97
+ },
98
+ rightText: {
99
+ fontFamily: FontFamily.LEXEND_REGULAR,
100
+ fontSize: 14,
101
+ fontWeight: '600',
102
+ color: colors.black,
103
+ textTransform: 'capitalize',
104
+ marginBottom: 12,
105
+ },
106
+ amountPoints: {
107
+ fontFamily: FontFamily.LEXEND_REGULAR,
108
+ fontSize: 16,
109
+ fontWeight: '600',
110
+ color: colors.black,
111
+ textTransform: 'capitalize',
112
+ marginTop: 10,
113
+ },
114
+ buttonContainer: {
115
+ width: VSCALE(130),
116
+ },
117
+ leftButton: {
118
+ width: VSCALE(130),
119
+ borderWidth: 1,
120
+ borderColor: colors.black,
121
+ backgroundColor: colors.white,
122
+ },
123
+ leftButtonText: {
124
+ color: colors.black,
125
+ fontFamily: FontFamily.LEXEND_MEDIUM,
126
+ fontSize: 14,
127
+ fontWeight: '600',
128
+ textTransform: 'capitalize',
129
+ },
130
+ buttonRow: {
131
+ flexDirection: 'row',
132
+ justifyContent: 'space-between',
133
+ alignItems: 'center',
134
+ marginTop: VSCALE(24),
135
+ },
136
+ btnHalf: {
137
+ width: '48%',
138
+ },
139
+ btnOutlined: {
140
+ backgroundColor: colors.white,
141
+ borderWidth: 1,
142
+ borderColor: colors.btnOutlinedcolor,
143
+ borderRadius: 12,
144
+ height: VSCALE(44),
145
+ },
146
+ btnOutlinedText: {
147
+ color: colors.btnOutlinedcolor,
148
+ fontFamily: FontFamily.LEXEND_MEDIUM,
149
+ fontSize: 14,
150
+ fontWeight: '600',
151
+ textAlign: 'center',
152
+ },
153
+ btnFilled: {
154
+ backgroundColor: colors.primary,
155
+ borderRadius: 12,
156
+ height: VSCALE(44),
157
+ },
158
+ btnFilledText: {
159
+ color: colors.white,
160
+ fontFamily: FontFamily.LEXEND_MEDIUM,
161
+ fontSize: 14,
162
+ fontWeight: '600',
163
+ textAlign: 'center',
164
+ },
165
+ });
166
+
167
+ export default styles;
@@ -0,0 +1,67 @@
1
+ import React from 'react';
2
+ import {
3
+ View,
4
+ Text,
5
+ Platform,
6
+ TouchableOpacity,
7
+ GestureResponderEvent,
8
+ ViewStyle,
9
+ TextStyle,
10
+ ActivityIndicator,
11
+ } from 'react-native';
12
+ import styles from './styles';
13
+ import Images from '../../constants/Images';
14
+ import CustomImage from '../CustomImage';
15
+
16
+ interface CustomButtonProps {
17
+ title: string;
18
+ onPress: (event: GestureResponderEvent) => void;
19
+ buttonStyle?: ViewStyle;
20
+ textStyle?: TextStyle;
21
+ disabled?: boolean;
22
+ customButtonContainerStyle?: ViewStyle;
23
+ icon?: boolean;
24
+ iconSrc?: { uri: string };
25
+ loading?: boolean;
26
+ }
27
+
28
+ const CustomButton: React.FC<CustomButtonProps> = ({
29
+ title,
30
+ onPress,
31
+ buttonStyle,
32
+ textStyle,
33
+ disabled = false,
34
+ customButtonContainerStyle,
35
+ icon = false,
36
+ iconSrc,
37
+ loading = false,
38
+ }) => {
39
+ return (
40
+ <View style={[styles.buttonContainer, customButtonContainerStyle]}>
41
+ <TouchableOpacity
42
+ style={[
43
+ styles.verifyButton,
44
+ disabled ? styles.verifyButtonInactive : styles.verifyButtonActive,
45
+ buttonStyle,
46
+ ]}
47
+ onPress={onPress}
48
+ disabled={disabled}
49
+ >
50
+ <View style={styles.row}>
51
+ {loading ? (
52
+ <ActivityIndicator size="small" color="#FFFFFF" />
53
+ ) : (
54
+ <>
55
+ {iconSrc && icon && (
56
+ <CustomImage source={iconSrc} imgStyle={styles.icon} />
57
+ )}
58
+ <Text style={[styles.verifyButtonText, textStyle]}>{title}</Text>
59
+ </>
60
+ )}
61
+ </View>
62
+ </TouchableOpacity>
63
+ </View>
64
+ );
65
+ };
66
+
67
+ export default CustomButton;
@@ -0,0 +1,44 @@
1
+ import { StyleSheet } from 'react-native';
2
+ import FontFamily from '../../constants/Fonts';
3
+ import { colors } from '../../styles/colors';
4
+
5
+ const styles = StyleSheet.create({
6
+ buttonContainer: {
7
+ marginTop: 'auto',
8
+ marginBottom: 50,
9
+ },
10
+ verifyButton: {
11
+ height: 55,
12
+ borderRadius: 12,
13
+ justifyContent: 'center',
14
+ alignItems: 'center',
15
+ },
16
+ verifyButtonActive: {
17
+ backgroundColor: '#DC2626',
18
+ },
19
+ verifyButtonInactive: {
20
+ backgroundColor: '#DC2626',
21
+ opacity: 0.5,
22
+ },
23
+ verifyButtonText: {
24
+ fontFamily: FontFamily.LEXEND_REGULAR,
25
+ fontSize: 14,
26
+ fontWeight: '600',
27
+ color: colors.verifyButtonText,
28
+ textAlign: 'center',
29
+ lineHeight: 16,
30
+ },
31
+ icon: {
32
+ height: 12,
33
+ width: 12,
34
+ resizeMode: 'contain',
35
+ },
36
+ row: {
37
+ flexDirection: 'row',
38
+ alignItems: 'center',
39
+ justifyContent:'center',
40
+ gap: 12,
41
+ },
42
+ });
43
+
44
+ export default styles;
@@ -0,0 +1,221 @@
1
+ import React from "react";
2
+ import {
3
+ View,
4
+ Text,
5
+ FlatList,
6
+ ListRenderItem,
7
+ TouchableOpacity,
8
+ Image,
9
+ ActivityIndicator,
10
+ } from "react-native";
11
+ import styles from "./styles";
12
+ import Svg, { Path } from "react-native-svg";
13
+ import { useNavigation } from "@react-navigation/native";
14
+ import CustomImage from "../CustomImage";
15
+ import Images from "../../constants/Images";
16
+ import { CardItem, AppStackParamList } from "../../types/navigation";
17
+ import { StackNavigationProp } from "@react-navigation/stack";
18
+ import NoDataFound from "../NoDataFound";
19
+ import { useAppSelector } from "../../hooks/useAppSelector";
20
+ import { RootState } from "../../redux/store";
21
+ import CustomLoader from "../CustomLoader";
22
+ import { pointsFromCentsFixed } from "../../constants/Formatter";
23
+
24
+ import { colors } from "../../styles/colors";
25
+ // Types
26
+
27
+ interface CustomCardProps {
28
+ data: CardItem[];
29
+ loading: boolean;
30
+ }
31
+
32
+ const ChevronRightIcon = () => (
33
+ <Svg width="6" height="10" viewBox="0 0 6 10" fill="none">
34
+ <Path
35
+ d="M1 9L5 5L1 1"
36
+ stroke="#DC291E"
37
+ strokeWidth="1.6"
38
+ strokeLinecap="round"
39
+ strokeLinejoin="round"
40
+ />
41
+ </Svg>
42
+ );
43
+
44
+ const getStatusIcon = (status: string) => {
45
+ console.log('📦 CustomCard getStatusIcon - status:', status);
46
+ switch (status?.toLowerCase()) {
47
+ case 'failed':
48
+ return (
49
+ <CustomImage source={Images?.crossIcon} imgStyle={[styles.icon]} />
50
+ );
51
+ case 'dispatched':
52
+ return (
53
+ <CustomImage source={Images?.tickIcon} imgStyle={[styles.icon]} />
54
+ );
55
+ case 'complete':
56
+ case 'confirmed':
57
+ case 'Complete':
58
+ return (
59
+ <CustomImage source={Images?.tickIcon} imgStyle={[styles.icon]} />
60
+ );
61
+ case 'pending':
62
+ case 'Pending':
63
+ return (
64
+ <CustomImage source={Images?.pendingIcon} imgStyle={[styles.icon]} />
65
+ );
66
+ case 'partial':
67
+ case 'Partial':
68
+ return (
69
+ <CustomImage source={Images?.pendingIcon} imgStyle={[styles.icon]} />
70
+ );
71
+ default:
72
+ return null;
73
+ }
74
+ };
75
+
76
+ const getStatusColor = (status: string) => {
77
+ switch (status?.toLowerCase()) {
78
+ case 'failed':
79
+ return colors.red;
80
+ case 'dispatched':
81
+ return colors.green;
82
+ case 'pending':
83
+ return colors.orange;
84
+ case 'partial':
85
+ return colors.orange;
86
+ case 'complete':
87
+ case 'confirmed':
88
+ return colors.green;
89
+ default:
90
+ return colors.orderDetailsText;
91
+ }
92
+ };
93
+
94
+ const getStatusText = (status: string) => {
95
+ switch (status?.toLowerCase()) {
96
+ case 'failed':
97
+ return 'Failed';
98
+ case 'dispatched':
99
+ return 'Dispatched';
100
+ case 'pending':
101
+ return 'Pending';
102
+ case 'partial':
103
+ case 'cancelled':
104
+ return 'Partial';
105
+ case 'complete':
106
+ return 'Complete';
107
+ case 'confirmed':
108
+ return 'Confirmed';
109
+ default:
110
+ return '';
111
+ }
112
+ };
113
+
114
+ const formatDate = (isoDate: string) => {
115
+ const date = new Date(isoDate);
116
+ const day = date.toLocaleString("en-GB", { day: "2-digit" });
117
+ const month = date.toLocaleString("en-GB", { month: "short" });
118
+ const year = date.getFullYear();
119
+ return `${day} ${month}, ${year}`;
120
+ };
121
+
122
+ const CustomCard: React.FC<CustomCardProps> = ({ data, loading }) => {
123
+ const navigation =
124
+ useNavigation<StackNavigationProp<AppStackParamList, "OrderDetails">>();
125
+ const renderProduct = (productItem: any, item: any) => {
126
+ const { product, quantity } = productItem;
127
+ const imageUrl = product?.image?.image?.url;
128
+
129
+ return (
130
+ <View key={productItem.id} style={styles.productRow}>
131
+ <View style={styles.productLeft}>
132
+ <View style={styles.productImageContainer}>
133
+ {imageUrl ? (
134
+ <CustomImage
135
+ source={{ uri: imageUrl }}
136
+ imgStyle={styles.productImage}
137
+ />
138
+ ) : (
139
+ <View
140
+ style={[styles.productImage, { backgroundColor: "#eee" }]}
141
+ />
142
+ )}
143
+ </View>
144
+ <View style={styles.productDetails}>
145
+ <Text style={styles.productName}>{product?.name}</Text>
146
+ <Text style={styles.productName}>{product?.product_type}</Text>
147
+ <Text style={styles.productQuantity}>Qty : {quantity}</Text>
148
+ </View>
149
+ </View>
150
+ <Text style={styles.productPoints}>{item / 100} Points</Text>
151
+ </View>
152
+ );
153
+ };
154
+
155
+ const renderItem: ListRenderItem<CardItem> = ({ item }) => (
156
+ <View style={styles.cardItem}>
157
+ <View style={styles.orderHeader}>
158
+ <View style={styles.statusRow}>
159
+ <View style={styles.row}>
160
+ {getStatusIcon(item.status ?? "")}
161
+ <Text
162
+ style={[
163
+ styles.statusText,
164
+ { color: getStatusColor(item.status ?? "") },
165
+ ]}
166
+ >
167
+ {getStatusText(item.status ?? "")}
168
+ </Text>
169
+ </View>
170
+
171
+ <Text style={styles.totalPoints}>{pointsFromCentsFixed(item.grand_total, 2)} Points</Text>
172
+ </View>
173
+ </View>
174
+
175
+ <View style={styles.orderInfo}>
176
+ <Text style={styles.orderNumber}>Order No : {item.order_no}</Text>
177
+ <Text style={styles.orderDate}>{formatDate(item.created_at ?? "")}</Text>
178
+ </View>
179
+
180
+ <View style={styles.productsContainer}>
181
+ {(item.items ?? []).map((subItem, i) => (
182
+ <View key={subItem.id}>
183
+ {renderProduct(subItem, subItem.amount_cents)}
184
+ {i < (item.items ?? []).length - 1 && <View style={styles.separator} />}
185
+ </View>
186
+ ))}
187
+ </View>
188
+
189
+ <TouchableOpacity
190
+ style={styles.viewDetails}
191
+ onPress={() => navigation.navigate("OrderDetails", { item: item })}
192
+ >
193
+ <Text style={styles.viewDetailsText}>View Details</Text>
194
+ <ChevronRightIcon />
195
+ </TouchableOpacity>
196
+ </View>
197
+ );
198
+
199
+
200
+ return (
201
+ <View style={styles.container}>
202
+ {loading ? (
203
+ <CustomLoader loading={true} />
204
+ ) : Array.isArray(data) && data.length > 0 ? (
205
+ <FlatList
206
+ data={data}
207
+ renderItem={renderItem}
208
+ keyExtractor={(item) => item.id}
209
+ style={{ flex: 1 }}
210
+ contentContainerStyle={{ paddingBottom: 80 }}
211
+ showsVerticalScrollIndicator={false}
212
+ />
213
+ ) : (
214
+ <NoDataFound containerstyle={styles.nodataFound}/>
215
+ )}
216
+ </View>
217
+ );
218
+ };
219
+
220
+ export default CustomCard;
221
+
@@ -0,0 +1,184 @@
1
+ import { StyleSheet } from 'react-native';
2
+ import FontFamily from '../../constants/Fonts';
3
+
4
+ const styles = StyleSheet.create({
5
+ container: {
6
+ flex: 1,
7
+ paddingHorizontal: 10,
8
+ backgroundColor: 'white',
9
+ paddingVertical: 10,
10
+ },
11
+ cardItem: {
12
+ paddingVertical: 20,
13
+ paddingHorizontal: 20,
14
+ shadowColor: '#000',
15
+ shadowOffset: {
16
+ width: 0,
17
+ height: 2,
18
+ },
19
+ shadowOpacity: 0.25,
20
+ shadowRadius: 3.84,
21
+ elevation: 5,
22
+ backgroundColor: '#fff',
23
+ borderRadius: 16,
24
+ marginBottom: 20,
25
+ borderWidth: 0.25,
26
+ borderColor: '#ccc',
27
+ },
28
+ orderHeader: {
29
+ marginBottom: 16,
30
+ },
31
+ orderStatus: {
32
+ flexDirection: 'row',
33
+ justifyContent: 'space-between',
34
+ alignItems: 'center',
35
+ marginBottom: 8,
36
+ },
37
+ statusRow: {
38
+ flexDirection: 'row',
39
+ alignItems: 'center',
40
+ gap: 8,
41
+ flex: 1,
42
+ justifyContent: 'space-between',
43
+ },
44
+ statusText: {
45
+ fontSize: 14,
46
+ fontWeight: '500',
47
+ textTransform: 'capitalize',
48
+ fontFamily: FontFamily.LEXEND_REGULAR,
49
+ },
50
+ totalPoints: {
51
+ fontSize: 16,
52
+ fontWeight: '600',
53
+ color: '#1F2937',
54
+ fontFamily: FontFamily.LEXEND_SEMIBOLD,
55
+ textAlign: 'right',
56
+ },
57
+ orderInfo: {
58
+ gap: 8,
59
+ marginBottom: '2%',
60
+ },
61
+ orderNumber: {
62
+ fontSize: 10,
63
+ fontWeight: '400',
64
+ color: '#6B7280',
65
+ fontFamily: FontFamily.LEXEND_REGULAR,
66
+ textTransform: 'capitalize',
67
+ },
68
+ orderDate: {
69
+ fontSize: 10,
70
+ fontWeight: '400',
71
+ color: '#6B7280',
72
+ fontFamily: FontFamily.LEXEND_REGULAR,
73
+ textTransform: 'capitalize',
74
+ },
75
+ productsContainer: {
76
+ marginBottom: 5,
77
+ },
78
+ productRow: {
79
+ flexDirection: 'row',
80
+ justifyContent: 'space-between',
81
+ alignItems: 'flex-end',
82
+ paddingVertical: 8,
83
+ },
84
+ productLeft: {
85
+ flexDirection: 'row',
86
+ alignItems: 'flex-start',
87
+ gap: 12,
88
+ flex: 1,
89
+ },
90
+ productImageContainer: {
91
+ width: 81,
92
+ height: 60,
93
+ backgroundColor: '#FFF',
94
+ borderRadius: 6.75,
95
+ shadowColor: 'rgba(75, 85, 98, 0.10)',
96
+ shadowOffset: {
97
+ width: 0,
98
+ height: 2,
99
+ },
100
+ shadowOpacity: 1,
101
+ shadowRadius: 3.84,
102
+ elevation: 2,
103
+ justifyContent: 'center',
104
+ alignItems: 'center',
105
+ borderWidth: 0.25,
106
+ borderColor: '#ccc',
107
+ },
108
+ productImage: {
109
+ width: '100%',
110
+ height: '100%',
111
+ resizeMode: 'contain',
112
+ },
113
+ productDetails: {
114
+ flex: 1,
115
+ height: 54,
116
+ justifyContent: 'space-between',
117
+ },
118
+ productName: {
119
+ fontSize: 12,
120
+ fontWeight: '500',
121
+ color: '#1F2937',
122
+ fontFamily: FontFamily.LEXEND_REGULAR,
123
+ },
124
+ productDescription: {
125
+ fontSize: 10,
126
+ fontWeight: '400',
127
+ color: '#6B7280',
128
+ fontFamily: FontFamily.LEXEND_REGULAR,
129
+ },
130
+ productQuantity: {
131
+ fontSize: 10,
132
+ fontWeight: '400',
133
+ color: '#6B7280',
134
+ fontFamily: FontFamily.LEXEND_REGULAR,
135
+ },
136
+ productPoints: {
137
+ fontSize: 14,
138
+ fontWeight: '500',
139
+ color: '#1F2937',
140
+ fontFamily: FontFamily.LEXEND_REGULAR,
141
+ textAlign: 'right',
142
+ },
143
+ separator: {
144
+ height: 1.2,
145
+ marginVertical: 8,
146
+ width: 313,
147
+ alignSelf: 'center',
148
+ backgroundColor: '#F3F4F7',
149
+ },
150
+ viewDetails: {
151
+ flexDirection: 'row',
152
+ justifyContent: 'flex-end',
153
+ alignItems: 'center',
154
+ gap: 12,
155
+ paddingTop: 8,
156
+ },
157
+ viewDetailsText: {
158
+ fontSize: 12,
159
+ fontWeight: '500',
160
+ color: '#DC291E',
161
+ fontFamily: FontFamily.LEXEND_REGULAR,
162
+ },
163
+ crossIcon: {
164
+ height: 9,
165
+ width: 9,
166
+ },
167
+ tickIcon: {
168
+ height: 22,
169
+ width: 22,
170
+ },
171
+ icon: {
172
+ height: 18,
173
+ width: 18,
174
+ },
175
+ row: {
176
+ flexDirection: 'row',
177
+ gap: 8,
178
+ },
179
+ nodataFound:{
180
+ minHeight:450
181
+ }
182
+ });
183
+
184
+ export default styles;