@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.
- package/assets/fonts/Lexend-Black.ttf +0 -0
- package/assets/fonts/Lexend-Bold.ttf +0 -0
- package/assets/fonts/Lexend-ExtraBold.ttf +0 -0
- package/assets/fonts/Lexend-ExtraLight.ttf +0 -0
- package/assets/fonts/Lexend-Light.ttf +0 -0
- package/assets/fonts/Lexend-Medium.ttf +0 -0
- package/assets/fonts/Lexend-Regular.ttf +0 -0
- package/assets/fonts/Lexend-SemiBold.ttf +0 -0
- package/assets/fonts/Lexend-Thin.ttf +0 -0
- package/assets/images/HomeGoods.png +0 -0
- package/assets/images/accessories.png +0 -0
- package/assets/images/amazon.png +0 -0
- package/assets/images/apnaClubLogo.png +0 -0
- package/assets/images/apparel.png +0 -0
- package/assets/images/backgroundblue.png +0 -0
- package/assets/images/bannerCard.png +0 -0
- package/assets/images/bottomWave.png +0 -0
- package/assets/images/coin_1_1.png +0 -0
- package/assets/images/flipkart.png +0 -0
- package/assets/images/frame_1171278967.png +0 -0
- package/assets/images/gift.png +0 -0
- package/assets/images/herobanner.png +0 -0
- package/assets/images/hinduPencilsLogo.png +0 -0
- package/assets/images/icons/addwhiteicon.png +0 -0
- package/assets/images/icons/arrow-back.png +0 -0
- package/assets/images/icons/arrowgreen.png +0 -0
- package/assets/images/icons/arrowred.png +0 -0
- package/assets/images/icons/arrowright.png +0 -0
- package/assets/images/icons/arrowup.png +0 -0
- package/assets/images/icons/blackarrowdown.png +0 -0
- package/assets/images/icons/blackarrowup.png +0 -0
- package/assets/images/icons/blackcross.png +0 -0
- package/assets/images/icons/call.png +0 -0
- package/assets/images/icons/camera.png +0 -0
- package/assets/images/icons/cart.png +0 -0
- package/assets/images/icons/chat.png +0 -0
- package/assets/images/icons/circleblack.png +0 -0
- package/assets/images/icons/copy.png +0 -0
- package/assets/images/icons/cross.png +0 -0
- package/assets/images/icons/delete.png +0 -0
- package/assets/images/icons/delivery.png +0 -0
- package/assets/images/icons/eVoucher.png +0 -0
- package/assets/images/icons/editIcon.png +0 -0
- package/assets/images/icons/email.png +0 -0
- package/assets/images/icons/eye.png +0 -0
- package/assets/images/icons/faq.png +0 -0
- package/assets/images/icons/filtericon.png +0 -0
- package/assets/images/icons/greyDownArrow.png +0 -0
- package/assets/images/icons/help.png +0 -0
- package/assets/images/icons/home.png +0 -0
- package/assets/images/icons/homeinactive.png +0 -0
- package/assets/images/icons/i_blackicon.png +0 -0
- package/assets/images/icons/i_icon.png +0 -0
- package/assets/images/icons/location.png +0 -0
- package/assets/images/icons/logout.png +0 -0
- package/assets/images/icons/minus.png +0 -0
- package/assets/images/icons/myOrders.png +0 -0
- package/assets/images/icons/orders.png +0 -0
- package/assets/images/icons/pencillogo.png +0 -0
- package/assets/images/icons/pending.png +0 -0
- package/assets/images/icons/plus.png +0 -0
- package/assets/images/icons/redCross.png +0 -0
- package/assets/images/icons/redCrossicon.png +0 -0
- package/assets/images/icons/redWarningicon.png +0 -0
- package/assets/images/icons/redeem.png +0 -0
- package/assets/images/icons/redeemactive.png +0 -0
- package/assets/images/icons/redemptionHistory.png +0 -0
- package/assets/images/icons/redhelpicon.png +0 -0
- package/assets/images/icons/search.png +0 -0
- package/assets/images/icons/stopwatch.png +0 -0
- package/assets/images/icons/successTick.gif +0 -0
- package/assets/images/icons/tick.png +0 -0
- package/assets/images/icons/tnc.png +0 -0
- package/assets/images/icons/user.png +0 -0
- package/assets/images/icons/userredicon.png +0 -0
- package/assets/images/icons/wavecorner.png +0 -0
- package/assets/images/logo.png +0 -0
- package/assets/images/myntra_copy.png +0 -0
- package/assets/images/nike.png +0 -0
- package/assets/images/oq3p0u0_1.png +0 -0
- package/assets/images/profileicon.png +0 -0
- package/assets/images/topWave.png +0 -0
- package/assets/images/zagglePropelLogo.png +0 -0
- package/index.ts +23 -0
- package/lib/index.ts +25 -0
- package/package.json +70 -0
- package/src/PropelSDKScreen.tsx +98 -0
- package/src/SDKApp.tsx +540 -0
- package/src/bridge/SDKBridge.ts +104 -0
- package/src/bridge/index.ts +3 -0
- package/src/components/SDKBackHandler.tsx +187 -0
- package/src/components/SDKProfile.tsx +87 -0
- package/src/components/SDKProfileWrapper.tsx +51 -0
- package/src/constants.ts +10 -0
- package/src/contexts/SDKContext.tsx +72 -0
- package/src/hooks/useSDKBackNavigation.ts +61 -0
- package/src/navigation/SDKMainTabNavigator.tsx +315 -0
- package/src/navigation/SDKNavigator.tsx +41 -0
- package/src/redux/store.ts +32 -0
- package/src/screens/Dashboard/index.tsx +531 -0
- package/src/screens/Dashboard/styles.ts +512 -0
- package/src/screens/DeliveryAddress/index.tsx +221 -0
- package/src/screens/DeliveryAddress/styles.ts +122 -0
- package/src/screens/E-Vouchers/index.tsx +157 -0
- package/src/screens/E-Vouchers/styles.ts +106 -0
- package/src/screens/Faq/Faq.constants.ts +164 -0
- package/src/screens/Faq/index.tsx +114 -0
- package/src/screens/Faq/styles.ts +131 -0
- package/src/screens/Help/index.tsx +128 -0
- package/src/screens/Help/styles.ts +121 -0
- package/src/screens/Login/index.tsx +215 -0
- package/src/screens/Login/styles.ts +134 -0
- package/src/screens/MyCart/MyCart.constants.ts +13 -0
- package/src/screens/MyCart/index.tsx +318 -0
- package/src/screens/MyCart/styles.ts +249 -0
- package/src/screens/MyOrders/index.tsx +87 -0
- package/src/screens/MyOrders/styles.ts +281 -0
- package/src/screens/MyProfile/index.tsx +72 -0
- package/src/screens/MyProfile/styles.ts +47 -0
- package/src/screens/NewDeliveryAddress/index.tsx +360 -0
- package/src/screens/NewDeliveryAddress/styles.ts +68 -0
- package/src/screens/Onboarding/index.tsx +57 -0
- package/src/screens/Onboarding/styles.ts +60 -0
- package/src/screens/OrdersDetails/index.tsx +333 -0
- package/src/screens/OrdersDetails/styles.ts +262 -0
- package/src/screens/OtpVerification/index.tsx +283 -0
- package/src/screens/OtpVerification/styles.ts +197 -0
- package/src/screens/PaymentMethod/index.tsx +389 -0
- package/src/screens/PaymentMethod/styles.ts +246 -0
- package/src/screens/PointsLog/index.tsx +286 -0
- package/src/screens/PointsLog/styles.ts +156 -0
- package/src/screens/ProductDetails/index.tsx +682 -0
- package/src/screens/ProductDetails/styles.ts +372 -0
- package/src/screens/Profile/index.tsx +368 -0
- package/src/screens/Profile/styles.ts +158 -0
- package/src/screens/RedemptionHistory/RedemptionHistory.constants.ts +4 -0
- package/src/screens/RedemptionHistory/index.tsx +304 -0
- package/src/screens/RedemptionHistory/styles.ts +84 -0
- package/src/screens/Reedem/index.tsx +345 -0
- package/src/screens/Reedem/styles.ts +269 -0
- package/src/screens/TnC/TnC.constants.ts +169 -0
- package/src/screens/TnC/index.tsx +83 -0
- package/src/screens/TnC/styles.ts +88 -0
- package/src/screens/TransactionSuccessful/index.tsx +77 -0
- package/src/screens/TransactionSuccessful/styles.ts +77 -0
- package/src/screens/Verification/index.tsx +58 -0
- package/src/screens/Verification/styles.ts +74 -0
- package/src/screens/index.ts +23 -0
- package/src/types/index.ts +46 -0
- package/src-app/components/AmountBreakDownModal/index.tsx +86 -0
- package/src-app/components/AmountBreakDownModal/styles.ts +110 -0
- package/src-app/components/BottomNavIcons.tsx +125 -0
- package/src-app/components/Button.tsx +120 -0
- package/src-app/components/Card.tsx +47 -0
- package/src-app/components/ConfirmPopup/ConfirmPopup.constants.ts +25 -0
- package/src-app/components/ConfirmPopup/index.tsx +48 -0
- package/src-app/components/ConfirmPopup/styles.ts +167 -0
- package/src-app/components/CustomButton/index.tsx +67 -0
- package/src-app/components/CustomButton/styles.ts +44 -0
- package/src-app/components/CustomCard/index.tsx +221 -0
- package/src-app/components/CustomCard/styles.ts +184 -0
- package/src-app/components/CustomError/index.tsx +54 -0
- package/src-app/components/CustomError/styles.ts +41 -0
- package/src-app/components/CustomImage/index.tsx +37 -0
- package/src-app/components/CustomImage/styles.ts +5 -0
- package/src-app/components/CustomLoader/index.tsx +45 -0
- package/src-app/components/CustomLoader/styles.ts +35 -0
- package/src-app/components/CustomMessagePopUp/index.tsx +51 -0
- package/src-app/components/CustomMessagePopUp/styles.ts +74 -0
- package/src-app/components/CustomProductCard/index.tsx +13 -0
- package/src-app/components/CustomProductCard/styles.ts +5 -0
- package/src-app/components/FilterModal.tsx +372 -0
- package/src-app/components/Footer/index.tsx +23 -0
- package/src-app/components/Footer/styles.ts +37 -0
- package/src-app/components/Icon.tsx +80 -0
- package/src-app/components/Logout/index.tsx +82 -0
- package/src-app/components/Logout/styles.ts +116 -0
- package/src-app/components/MobileHeader.tsx +141 -0
- package/src-app/components/NoDataFound/index.tsx +18 -0
- package/src-app/components/NoDataFound/styles.ts +26 -0
- package/src-app/components/OTPModal.tsx +747 -0
- package/src-app/components/ProfileField.tsx +47 -0
- package/src-app/components/QuantityModal/index.tsx +113 -0
- package/src-app/components/QuantityModal/styles.ts +84 -0
- package/src-app/components/TabBarIcons.tsx +110 -0
- package/src-app/components/TextInput.tsx +79 -0
- package/src-app/components/ToastConfig.tsx +60 -0
- package/src-app/components/index.ts +18 -0
- package/src-app/config/env.ts +22 -0
- package/src-app/constants/Fonts.ts +12 -0
- package/src-app/constants/Formatter.ts +39 -0
- package/src-app/constants/HtmlSanitization.ts +46 -0
- package/src-app/constants/Images.ts +81 -0
- package/src-app/constants/Labels.ts +8 -0
- package/src-app/constants/Messages.ts +108 -0
- package/src-app/constants/Routes.ts +17 -0
- package/src-app/constants/Scaling.ts +5 -0
- package/src-app/constants/Text.ts +8 -0
- package/src-app/constants/offSets.ts +18 -0
- package/src-app/hooks/useAppDispatch.ts +4 -0
- package/src-app/hooks/useAppSelector.ts +4 -0
- package/src-app/hooks/useBackHandler.ts +47 -0
- package/src-app/hooks/useScreenBackHandler.ts +91 -0
- package/src-app/navigation/AppNavigator.tsx +34 -0
- package/src-app/navigation/MainTabNavigator.tsx +294 -0
- package/src-app/redux/authSaga.ts +605 -0
- package/src-app/redux/authSlice.ts +754 -0
- package/src-app/redux/rootSaga.ts +6 -0
- package/src-app/redux/store.ts +25 -0
- package/src-app/services/api.ts +14 -0
- package/src-app/services/endpoints.ts +33 -0
- package/src-app/services/index.ts +574 -0
- package/src-app/services/sdkCredentials.ts +44 -0
- package/src-app/styles/colors.ts +85 -0
- package/src-app/styles/shared.ts +112 -0
- package/src-app/types/authTypes.ts +155 -0
- package/src-app/types/navigation.ts +99 -0
- package/src-app/utils/Validation.ts +48 -0
- package/src-app/utils/filterPins.ts +29 -0
- package/src-app/utils/navigationUtils.ts +43 -0
- package/src-app/utils/useHardwareBack.ts +21 -0
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
export const colors = {
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
primary: '#DC2626',
|
|
5
|
+
primaryDark: '#B91C1C',
|
|
6
|
+
secondary: '#00ADBB',
|
|
7
|
+
success: '#22C55E',
|
|
8
|
+
warning: '#F59E0B',
|
|
9
|
+
error: '#EF4444',
|
|
10
|
+
background: '#FFFFFF',
|
|
11
|
+
surface: '#F9FAFB',
|
|
12
|
+
surfaceVariant: '#F3F4F6',
|
|
13
|
+
onSurface: '#111827',
|
|
14
|
+
onSurfaceVariant: '#6B7280',
|
|
15
|
+
outline: '#D1D5DB',
|
|
16
|
+
outlineVariant: '#E5E7EB',
|
|
17
|
+
shadow: 'rgba(0, 0, 0, 0.1)',
|
|
18
|
+
green: '#34AA44',
|
|
19
|
+
red: '#ED3B41',
|
|
20
|
+
orange: '#FF8A08',
|
|
21
|
+
black: '#1F2937',
|
|
22
|
+
white: '#FFFFFF',
|
|
23
|
+
darkGrey: '#DC291E',
|
|
24
|
+
lightbgColor : '#F3F4F773',
|
|
25
|
+
errorbgColor : '#FFECEF',
|
|
26
|
+
placeholderColor : '#9CA3AF',
|
|
27
|
+
errorAlertColor : '#FEF2F2',
|
|
28
|
+
verifyButtonText : '#FFFFFF',
|
|
29
|
+
logOutTitle: '#1F2937',
|
|
30
|
+
btnOutlinedcolor: '#0F172A',
|
|
31
|
+
// Dashboard specific colors
|
|
32
|
+
timeText: '#000000',
|
|
33
|
+
avatarText: '#1F2937',
|
|
34
|
+
greeting: '#6B7280',
|
|
35
|
+
cartBadgeBackground: '#DC291E',
|
|
36
|
+
cartBadgeText: '#DC291E',
|
|
37
|
+
cartBackground: 'rgba(255, 255, 255, 0.45)',
|
|
38
|
+
avatarBackground: 'rgba(0, 173, 187, 0.2)',
|
|
39
|
+
pointsValue: '#101820',
|
|
40
|
+
pointsLabel: '#1F2937',
|
|
41
|
+
redeemButton: '#DC291E',
|
|
42
|
+
redeemButtonText: '#FFFFFF',
|
|
43
|
+
statCardBackground: '#F6F6F6',
|
|
44
|
+
statValue: '#101820',
|
|
45
|
+
statLabel: '#101820',
|
|
46
|
+
actionBorder: '#ECEDF0',
|
|
47
|
+
actionBackground: '#FFFFFF',
|
|
48
|
+
actionLabel: '#1F2937',
|
|
49
|
+
rewardsTitle: '#1F2937',
|
|
50
|
+
rewardsSubtitle: '#6B7280',
|
|
51
|
+
viewAllButton: '#DC291E',
|
|
52
|
+
viewAllButtonText: '#FFFFFF',
|
|
53
|
+
otpPlaceholderMobile: '#6B7280',
|
|
54
|
+
// ProductDetails specific colors
|
|
55
|
+
productImageBackground: '#ECECEC',
|
|
56
|
+
variantBorder: '#D1D5DB',
|
|
57
|
+
variantBackground: 'rgba(243, 244, 247, 0.45)',
|
|
58
|
+
variantSelectedBackground: 'rgba(237, 59, 65, 0.05)',
|
|
59
|
+
dividerBackground: 'rgba(209, 213, 219, 0.45)',
|
|
60
|
+
shadowColor: 'rgba(75, 85, 98, 0.20)',
|
|
61
|
+
darkText: '#333',
|
|
62
|
+
deliveryText: '#219493',
|
|
63
|
+
disableButton: '#ccc',
|
|
64
|
+
// PaymentMethod specific colors
|
|
65
|
+
paymentBorderColor: '#F3F4F7',
|
|
66
|
+
paymentBackgroundGray: '#F3F4F7',
|
|
67
|
+
paymentSeparatorBorder: 'rgba(209, 213, 219, 0.65)',
|
|
68
|
+
paymentSubText: '#4B5563',
|
|
69
|
+
transparent: 'transparent',
|
|
70
|
+
// Profile specific colors
|
|
71
|
+
profileBackground: '#FFFFFF',
|
|
72
|
+
profileTextPrimary: '#101820',
|
|
73
|
+
profileTextSecondary: '#6B7280',
|
|
74
|
+
profileSeparator: '#F3F4F7',
|
|
75
|
+
profileLogout: '#DC291E',
|
|
76
|
+
// OrderDetails specific colors
|
|
77
|
+
orderDetailsBackground: '#FFF',
|
|
78
|
+
orderDetailsText: '#1F2937',
|
|
79
|
+
orderDetailsSecondaryText: '#6B7280',
|
|
80
|
+
orderDetailsBorder: '#ccc',
|
|
81
|
+
orderDetailsSupportBackground: '#F3F4F7',
|
|
82
|
+
orderDetailsShadow: 'rgba(75, 85, 98, 0.10)',
|
|
83
|
+
orderDetailsSeparator: 'rgba(209, 213, 219, 0.65)',
|
|
84
|
+
productimagebackground: '#eee',
|
|
85
|
+
};
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { StyleSheet, Dimensions, Platform } from 'react-native';
|
|
2
|
+
import { SCALE } from '../constants/Scaling';
|
|
3
|
+
import { colors } from './colors';
|
|
4
|
+
|
|
5
|
+
const { width, height } = Dimensions.get('window');
|
|
6
|
+
|
|
7
|
+
export const spacing = {
|
|
8
|
+
xs: 4,
|
|
9
|
+
sm: 8,
|
|
10
|
+
md: 16,
|
|
11
|
+
lg: 24,
|
|
12
|
+
xl: 32,
|
|
13
|
+
xxl: 48,
|
|
14
|
+
MARGIN_PERCENT: {
|
|
15
|
+
XS: '4%',
|
|
16
|
+
SM: '6%',
|
|
17
|
+
MD: '8%',
|
|
18
|
+
LG: '10%',
|
|
19
|
+
XL: '12%',
|
|
20
|
+
XXL: '20%',
|
|
21
|
+
},
|
|
22
|
+
LEFT_POSITION: {
|
|
23
|
+
TOP_SHAPE: Platform.OS === 'android' ? SCALE(48) : SCALE(50),
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export const borderRadius = {
|
|
28
|
+
sm: 8,
|
|
29
|
+
md: 12,
|
|
30
|
+
lg: 16,
|
|
31
|
+
xl: 20,
|
|
32
|
+
xxl: 24,
|
|
33
|
+
full: 9999,
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export const typography = {
|
|
37
|
+
h1: {
|
|
38
|
+
fontSize: 24,
|
|
39
|
+
fontWeight: '600' as '600',
|
|
40
|
+
lineHeight: 28,
|
|
41
|
+
},
|
|
42
|
+
h2: {
|
|
43
|
+
fontSize: 20,
|
|
44
|
+
fontWeight: '600' as '600',
|
|
45
|
+
lineHeight: 24,
|
|
46
|
+
},
|
|
47
|
+
h3: {
|
|
48
|
+
fontSize: 18,
|
|
49
|
+
fontWeight: '500' as '500',
|
|
50
|
+
lineHeight: 22,
|
|
51
|
+
},
|
|
52
|
+
body: {
|
|
53
|
+
fontSize: 16,
|
|
54
|
+
fontWeight: '400' as '400',
|
|
55
|
+
lineHeight: 20,
|
|
56
|
+
},
|
|
57
|
+
bodySmall: {
|
|
58
|
+
fontSize: 14,
|
|
59
|
+
fontWeight: '400' as '400',
|
|
60
|
+
lineHeight: 18,
|
|
61
|
+
},
|
|
62
|
+
caption: {
|
|
63
|
+
fontSize: 12,
|
|
64
|
+
fontWeight: '400' as '400',
|
|
65
|
+
lineHeight: 16,
|
|
66
|
+
},
|
|
67
|
+
button: {
|
|
68
|
+
fontSize: 14,
|
|
69
|
+
fontWeight: '600' as '600',
|
|
70
|
+
lineHeight: 18,
|
|
71
|
+
},
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
export const shadows = StyleSheet.create({
|
|
75
|
+
small: {
|
|
76
|
+
shadowColor: colors.shadow,
|
|
77
|
+
shadowOffset: {
|
|
78
|
+
width: 0,
|
|
79
|
+
height: 2,
|
|
80
|
+
},
|
|
81
|
+
shadowOpacity: 0.1,
|
|
82
|
+
shadowRadius: 4,
|
|
83
|
+
elevation: 2,
|
|
84
|
+
},
|
|
85
|
+
medium: {
|
|
86
|
+
shadowColor: colors.shadow,
|
|
87
|
+
shadowOffset: {
|
|
88
|
+
width: 0,
|
|
89
|
+
height: 4,
|
|
90
|
+
},
|
|
91
|
+
shadowOpacity: 0.15,
|
|
92
|
+
shadowRadius: 8,
|
|
93
|
+
elevation: 4,
|
|
94
|
+
},
|
|
95
|
+
large: {
|
|
96
|
+
shadowColor: colors.shadow,
|
|
97
|
+
shadowOffset: {
|
|
98
|
+
width: 0,
|
|
99
|
+
height: 8,
|
|
100
|
+
},
|
|
101
|
+
shadowOpacity: 0.2,
|
|
102
|
+
shadowRadius: 16,
|
|
103
|
+
elevation: 8,
|
|
104
|
+
},
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
export const layout = {
|
|
108
|
+
screenWidth: width,
|
|
109
|
+
screenHeight: height,
|
|
110
|
+
headerHeight: 60,
|
|
111
|
+
tabBarHeight: 80,
|
|
112
|
+
};
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
export interface generateOtpPayload {
|
|
2
|
+
client_name: string;
|
|
3
|
+
client_series: string;
|
|
4
|
+
client_version: string;
|
|
5
|
+
device_id: string;
|
|
6
|
+
mobile: string;
|
|
7
|
+
is_hppl_login: boolean;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface VerifyMobileOtpPayload {
|
|
11
|
+
client_key: string;
|
|
12
|
+
client_name: string;
|
|
13
|
+
client_series: string;
|
|
14
|
+
client_type: string;
|
|
15
|
+
client_version: string;
|
|
16
|
+
device_id: string;
|
|
17
|
+
fcm_token: string;
|
|
18
|
+
otp: string;
|
|
19
|
+
username: string;
|
|
20
|
+
is_hppl_login: boolean;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface UploadProfileImagePayload {
|
|
24
|
+
name: string;
|
|
25
|
+
Image: string;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface RedemptionHistoryPayload {
|
|
29
|
+
client_id: string;
|
|
30
|
+
transaction_type: string;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export interface CreateAddressPayload {
|
|
34
|
+
address: {
|
|
35
|
+
city: string;
|
|
36
|
+
country: {
|
|
37
|
+
id: string;
|
|
38
|
+
name: string;
|
|
39
|
+
};
|
|
40
|
+
email: string;
|
|
41
|
+
landmark: string;
|
|
42
|
+
line: string;
|
|
43
|
+
name: string;
|
|
44
|
+
phone_numbers: string[];
|
|
45
|
+
state: string;
|
|
46
|
+
zip_code: string;
|
|
47
|
+
};
|
|
48
|
+
address_type: string;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export interface UpdateAddressPayload {
|
|
52
|
+
id: string;
|
|
53
|
+
address: {
|
|
54
|
+
city: string;
|
|
55
|
+
country: {
|
|
56
|
+
id: string;
|
|
57
|
+
name: string;
|
|
58
|
+
};
|
|
59
|
+
email: string;
|
|
60
|
+
landmark: string;
|
|
61
|
+
line: string;
|
|
62
|
+
name: string;
|
|
63
|
+
phone_numbers: string[];
|
|
64
|
+
state: string;
|
|
65
|
+
zip_code: string;
|
|
66
|
+
};
|
|
67
|
+
address_type: string;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export interface UpdateCartPayload {
|
|
71
|
+
item: {
|
|
72
|
+
product_variation_id: string;
|
|
73
|
+
quantity: number;
|
|
74
|
+
shipping_address: {
|
|
75
|
+
email: string;
|
|
76
|
+
phone_numbers: string;
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
skip_payable_validation: boolean;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export interface AddToCartPayload {
|
|
83
|
+
order: {
|
|
84
|
+
items: [
|
|
85
|
+
{
|
|
86
|
+
free_field_value: string;
|
|
87
|
+
product_variation_id: string;
|
|
88
|
+
quantity: number;
|
|
89
|
+
shipping_address: {
|
|
90
|
+
email: string;
|
|
91
|
+
phone_numbers: string;
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
];
|
|
95
|
+
zaggle_card_client_id: string;
|
|
96
|
+
};
|
|
97
|
+
skip_payable_validation: boolean;
|
|
98
|
+
}
|
|
99
|
+
export interface MyOrdersPayload { }
|
|
100
|
+
|
|
101
|
+
export interface CheckoutPayload {
|
|
102
|
+
amount_cents: number;
|
|
103
|
+
client_id: string;
|
|
104
|
+
order_id: string;
|
|
105
|
+
redeem_propel_points: boolean;
|
|
106
|
+
redirect: string;
|
|
107
|
+
payment_method?: string;
|
|
108
|
+
transactions: [
|
|
109
|
+
{
|
|
110
|
+
amount_cents: number;
|
|
111
|
+
payment_method: string;
|
|
112
|
+
}
|
|
113
|
+
];
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export interface DeliverHerePayload {
|
|
117
|
+
skip_payable_validation: boolean,
|
|
118
|
+
order: {
|
|
119
|
+
shipping: {
|
|
120
|
+
shipping_method: string
|
|
121
|
+
},
|
|
122
|
+
shipping_address: {
|
|
123
|
+
zip_code: string,
|
|
124
|
+
city: string,
|
|
125
|
+
name: string,
|
|
126
|
+
latitude: string | null,
|
|
127
|
+
longitude: string | null,
|
|
128
|
+
state: string,
|
|
129
|
+
line: string,
|
|
130
|
+
country: {
|
|
131
|
+
id: string,
|
|
132
|
+
name: string
|
|
133
|
+
},
|
|
134
|
+
phone_numbers: string[],
|
|
135
|
+
id: string,
|
|
136
|
+
email: string
|
|
137
|
+
},
|
|
138
|
+
billing_address: {
|
|
139
|
+
zip_code: string,
|
|
140
|
+
city: string,
|
|
141
|
+
name: string,
|
|
142
|
+
latitude: string | null,
|
|
143
|
+
longitude: string | null,
|
|
144
|
+
state: string,
|
|
145
|
+
line: string,
|
|
146
|
+
country: {
|
|
147
|
+
id: string,
|
|
148
|
+
name: string
|
|
149
|
+
},
|
|
150
|
+
phone_numbers: string[],
|
|
151
|
+
id: string,
|
|
152
|
+
email: string
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
export type RootStackParamList = {
|
|
2
|
+
Onboarding: undefined;
|
|
3
|
+
Login: { isReturning?: boolean } | undefined;
|
|
4
|
+
OTPVerification: { phoneNumber: string };
|
|
5
|
+
VerificationComplete: undefined;
|
|
6
|
+
MainTabs: undefined;
|
|
7
|
+
MyProfile: undefined;
|
|
8
|
+
MyOrders: { from?: string };
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export type TabParamList = {
|
|
12
|
+
DashboardTab: {
|
|
13
|
+
screen: keyof AppStackParamList;
|
|
14
|
+
params?: any;
|
|
15
|
+
};
|
|
16
|
+
Redeem: undefined;
|
|
17
|
+
Profile: undefined;
|
|
18
|
+
Help: { from?: string };
|
|
19
|
+
MyOrders: { from?: string };
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export interface ProductData {
|
|
23
|
+
id: string;
|
|
24
|
+
title: string;
|
|
25
|
+
subtitle?: string;
|
|
26
|
+
points: string;
|
|
27
|
+
image?: string;
|
|
28
|
+
category: string;
|
|
29
|
+
logo?: string;
|
|
30
|
+
backgroundColor?: string;
|
|
31
|
+
variants?: string[];
|
|
32
|
+
description?: string;
|
|
33
|
+
redemptionTerms?: string;
|
|
34
|
+
shoppingTerms?: string;
|
|
35
|
+
imageUrl: string;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export type CardItem = {
|
|
39
|
+
id: string;
|
|
40
|
+
order_no: string;
|
|
41
|
+
date: string;
|
|
42
|
+
status: 'success' | 'failed' | 'processing' | 'dispatched' | 'pending';
|
|
43
|
+
totalPoints: number;
|
|
44
|
+
items: {
|
|
45
|
+
id: string;
|
|
46
|
+
product: ProductItem;
|
|
47
|
+
quantity: number;
|
|
48
|
+
amount_cents: number;
|
|
49
|
+
}[];
|
|
50
|
+
grand_total: number;
|
|
51
|
+
discount_cents?: number;
|
|
52
|
+
shipping_address?: {
|
|
53
|
+
line: string;
|
|
54
|
+
city: string;
|
|
55
|
+
state: string;
|
|
56
|
+
zip_code: string;
|
|
57
|
+
country: {
|
|
58
|
+
name: string;
|
|
59
|
+
};
|
|
60
|
+
email: string;
|
|
61
|
+
phone_numbers: string[];
|
|
62
|
+
};
|
|
63
|
+
shipment_status?: string;
|
|
64
|
+
created_at?: string;
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
export type ProductItem = {
|
|
68
|
+
id: string;
|
|
69
|
+
name: string;
|
|
70
|
+
description: string;
|
|
71
|
+
denomination: number;
|
|
72
|
+
quantity: number;
|
|
73
|
+
points: number;
|
|
74
|
+
image: string;
|
|
75
|
+
deliveryDetails: DeliveryDetails;
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
export type DeliveryDetails = {
|
|
79
|
+
address: string;
|
|
80
|
+
email: string;
|
|
81
|
+
phone: string;
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
export type AppStackParamList = {
|
|
85
|
+
RedemptionHistory: { from?: string; exitToHost?: boolean };
|
|
86
|
+
MyOrders: { from?: string };
|
|
87
|
+
OrderDetails: { item: CardItem };
|
|
88
|
+
FAQ: { from?: string };
|
|
89
|
+
TnC: { from?: string };
|
|
90
|
+
ProductDetail: { product: ProductData; from?: string };
|
|
91
|
+
PointsLog: undefined;
|
|
92
|
+
Dashboard: undefined;
|
|
93
|
+
MyEVouchers: undefined;
|
|
94
|
+
MyCart: { product: ProductData; from?: string };
|
|
95
|
+
DeliveryAddress: { from?: string };
|
|
96
|
+
NewDeliveryAddress: { item?: any };
|
|
97
|
+
PaymentMethod: { item?: any };
|
|
98
|
+
TransactionSuccessful: { item?: any };
|
|
99
|
+
} & TabParamList;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
// src/utils/validation.ts
|
|
2
|
+
import * as Yup from 'yup';
|
|
3
|
+
|
|
4
|
+
export const isValidEmail = (str: string): boolean => {
|
|
5
|
+
const v = str.trim();
|
|
6
|
+
const re = /^[^\s@]+@[^\s@]+\.[^\s@]{2,}$/;
|
|
7
|
+
return re.test(v);
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
export const extractLineAndLandmark = (str: string = '') => {
|
|
12
|
+
let line = '';
|
|
13
|
+
let landmark = '';
|
|
14
|
+
|
|
15
|
+
const parts = str.split('\n');
|
|
16
|
+
parts.forEach(part => {
|
|
17
|
+
if (part.startsWith('Line:')) {
|
|
18
|
+
line = part.replace('Line:', '').trim();
|
|
19
|
+
}
|
|
20
|
+
if (part.startsWith('Landmark:')) {
|
|
21
|
+
landmark = part.replace('Landmark:', '').trim();
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
return { line, landmark };
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export const formSchema = Yup.object().shape({
|
|
29
|
+
fullName: Yup.string()
|
|
30
|
+
.min(5, 'Full name must be at least 5 characters')
|
|
31
|
+
.required('Full name is required'),
|
|
32
|
+
mobileNumber: Yup.string()
|
|
33
|
+
.matches(/^[0-9]{10}$/, 'Mobile number must be 10 digits')
|
|
34
|
+
.required('Mobile number is required'),
|
|
35
|
+
email: Yup.string()
|
|
36
|
+
.email('Invalid email format')
|
|
37
|
+
.required('Email is required'),
|
|
38
|
+
address: Yup.string().required('Address is required'),
|
|
39
|
+
landmark: Yup.string()
|
|
40
|
+
.min(5, 'Landmark must be at least 5 characters')
|
|
41
|
+
.required('Landmark is required'),
|
|
42
|
+
city: Yup.string().required('City is required'),
|
|
43
|
+
state: Yup.string().required('State is required'),
|
|
44
|
+
pincode: Yup.string()
|
|
45
|
+
.matches(/^[0-9]{6}$/, 'Pincode must be 6 digits')
|
|
46
|
+
.required('Pincode is required'),
|
|
47
|
+
});
|
|
48
|
+
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Linking } from "react-native";
|
|
2
|
+
|
|
3
|
+
export const FILTER = "filter";
|
|
4
|
+
export const MAP = "map";
|
|
5
|
+
export const REDUCE = "reduce";
|
|
6
|
+
export const PUSH = "push";
|
|
7
|
+
|
|
8
|
+
export const RENDER_KEYS = {
|
|
9
|
+
IMG: "img",
|
|
10
|
+
LINK: "a",
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export const FALLBACK_TEXT = {
|
|
14
|
+
link: "Click here",
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export const URL_REGEX = /^https?:\/\//i;
|
|
18
|
+
|
|
19
|
+
export const handleLinkPress = (href?: string) => {
|
|
20
|
+
if (href && URL_REGEX.test(href)) {
|
|
21
|
+
Linking.openURL(href).catch((err) =>
|
|
22
|
+
console.log("Failed to open URL:", err)
|
|
23
|
+
);
|
|
24
|
+
} else {
|
|
25
|
+
console.log("Invalid or missing href:", href);
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export const IGNORED_DOM_TAGS = ["sup", "sub", "span", "colgroup"];
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Navigation Utilities
|
|
3
|
+
*
|
|
4
|
+
* Handles back navigation for SDK screens.
|
|
5
|
+
* Tries goBack() first; if that can't navigate, uses the map/fallback.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
export const handleCustomGoBack = (
|
|
9
|
+
navigation: any,
|
|
10
|
+
route: any,
|
|
11
|
+
options?: {
|
|
12
|
+
map?: Record<string, string>;
|
|
13
|
+
fallback?: string;
|
|
14
|
+
onDeepLinkExit?: () => boolean;
|
|
15
|
+
}
|
|
16
|
+
) => {
|
|
17
|
+
// Deep link exit takes priority
|
|
18
|
+
if (options?.onDeepLinkExit) {
|
|
19
|
+
options.onDeepLinkExit();
|
|
20
|
+
return true;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// Try goBack() first if navigator has history
|
|
24
|
+
if (navigation.canGoBack()) {
|
|
25
|
+
navigation.goBack();
|
|
26
|
+
return true;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// Fallback: use the map to determine destination based on current route
|
|
30
|
+
const currentRouteName = route?.name;
|
|
31
|
+
if (options?.map && currentRouteName && options.map[currentRouteName]) {
|
|
32
|
+
navigation.navigate(options.map[currentRouteName]);
|
|
33
|
+
return true;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// Last resort: navigate to fallback screen
|
|
37
|
+
if (options?.fallback) {
|
|
38
|
+
navigation.navigate(options.fallback);
|
|
39
|
+
return true;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return false;
|
|
43
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { useFocusEffect } from "@react-navigation/native";
|
|
2
|
+
import { useCallback } from "react";
|
|
3
|
+
import { BackHandler } from "react-native";
|
|
4
|
+
|
|
5
|
+
export const useHardwareBack = (onBackPress: () => boolean | void) => {
|
|
6
|
+
useFocusEffect(
|
|
7
|
+
useCallback(() => {
|
|
8
|
+
const backAction = () => {
|
|
9
|
+
const handled = onBackPress();
|
|
10
|
+
return handled ?? true;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
const subscription = BackHandler.addEventListener(
|
|
14
|
+
"hardwareBackPress",
|
|
15
|
+
backAction
|
|
16
|
+
);
|
|
17
|
+
|
|
18
|
+
return () => subscription.remove();
|
|
19
|
+
}, [onBackPress])
|
|
20
|
+
);
|
|
21
|
+
};
|