@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,333 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { View, Text, ScrollView, TouchableOpacity, Image } from 'react-native';
|
|
3
|
+
import { StackNavigationProp } from '@react-navigation/stack';
|
|
4
|
+
import { RouteProp } from '@react-navigation/native';
|
|
5
|
+
import { AppStackParamList, ProductItem } from '../../../src-app/types/navigation';
|
|
6
|
+
import styles from './styles';
|
|
7
|
+
import { AmountModal, CustomImage } from '../../../src-app/components';
|
|
8
|
+
import Images from '../../../src-app/constants/Images';
|
|
9
|
+
import { colors } from '../../../src-app/styles/colors';
|
|
10
|
+
import MobileHeader from '../../../src-app/components/MobileHeader';
|
|
11
|
+
import { pointsFromCentsFixed } from '../../../src-app/constants/Formatter';
|
|
12
|
+
import { DATE, DISCOUNTED_AMOUNT, EMAIL, ORDER_DETAILS_SUPPORT_EMAIL, ORDER_DETAILS_SUPPORT_HOURS, ORDER_DETAILS_SUPPORT_INTRO, ORDER_DETAILS_SUPPORT_PHONE, ORDER_NO, PHONE, REMAINING_AMOUNT } from '../../../src-app/constants/Messages';
|
|
13
|
+
|
|
14
|
+
type OrderDetailsNavigationProp = StackNavigationProp<
|
|
15
|
+
AppStackParamList,
|
|
16
|
+
'OrderDetails'
|
|
17
|
+
>;
|
|
18
|
+
|
|
19
|
+
type OrderDetailsRouteProp = RouteProp<AppStackParamList, 'OrderDetails'>;
|
|
20
|
+
|
|
21
|
+
interface Props {
|
|
22
|
+
navigation: OrderDetailsNavigationProp;
|
|
23
|
+
route: OrderDetailsRouteProp;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
interface Product {
|
|
27
|
+
id: string;
|
|
28
|
+
product: ProductItem;
|
|
29
|
+
quantity: number;
|
|
30
|
+
amount_cents: number;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
interface OrderDetails {
|
|
34
|
+
id: string;
|
|
35
|
+
orderNumber: string;
|
|
36
|
+
date: string;
|
|
37
|
+
status: 'failed' | 'dispatched' | 'pending';
|
|
38
|
+
totalPoints: number;
|
|
39
|
+
products: Product[];
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const OrderDetails: React.FC<Props> = ({ navigation, route }) => {
|
|
43
|
+
const { item } = route.params;
|
|
44
|
+
const [amountModalVisible, setAmountModalVisible] = useState(false);
|
|
45
|
+
|
|
46
|
+
const extractAddress = (str: string) => {
|
|
47
|
+
const parts = str.split("\n");
|
|
48
|
+
|
|
49
|
+
let houseNo = "";
|
|
50
|
+
let landmark = "";
|
|
51
|
+
|
|
52
|
+
parts.forEach(part => {
|
|
53
|
+
const [key, value] = part.split(":").map(s => s.trim());
|
|
54
|
+
if (key?.toLowerCase() === "line") {
|
|
55
|
+
houseNo = value;
|
|
56
|
+
} else if (key?.toLowerCase() === "landmark") {
|
|
57
|
+
landmark = value;
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
return { houseNo, landmark };
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
const getStatusIcon = (status: string) => {
|
|
65
|
+
switch (status?.toLowerCase()) {
|
|
66
|
+
case 'failed':
|
|
67
|
+
return (
|
|
68
|
+
<CustomImage source={Images?.crossIcon} imgStyle={[styles.icon]} />
|
|
69
|
+
);
|
|
70
|
+
case 'dispatched':
|
|
71
|
+
return (
|
|
72
|
+
<CustomImage source={Images?.tickIcon} imgStyle={[styles.icon]} />
|
|
73
|
+
);
|
|
74
|
+
case 'complete':
|
|
75
|
+
case 'confirmed':
|
|
76
|
+
return (
|
|
77
|
+
<CustomImage source={Images?.tickIcon} imgStyle={[styles.icon]} />
|
|
78
|
+
);
|
|
79
|
+
case 'pending':
|
|
80
|
+
case 'Pending':
|
|
81
|
+
return (
|
|
82
|
+
<CustomImage source={Images?.pendingIcon} imgStyle={[styles.icon]} />
|
|
83
|
+
);
|
|
84
|
+
case 'partial':
|
|
85
|
+
return (
|
|
86
|
+
<CustomImage source={Images?.pendingIcon} imgStyle={[styles.icon]} />
|
|
87
|
+
);
|
|
88
|
+
default:
|
|
89
|
+
return null;
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
const getStatusColor = (status: string) => {
|
|
94
|
+
console.log('📦 getStatusColor - status:', status);
|
|
95
|
+
switch (status?.toLowerCase()) {
|
|
96
|
+
case 'failed':
|
|
97
|
+
return colors.red;
|
|
98
|
+
case 'dispatched':
|
|
99
|
+
return colors.green;
|
|
100
|
+
case 'pending':
|
|
101
|
+
return colors.orange;
|
|
102
|
+
case 'partial':
|
|
103
|
+
return colors.orange;
|
|
104
|
+
case 'confirmed':
|
|
105
|
+
return colors.green;
|
|
106
|
+
case 'complete':
|
|
107
|
+
case 'Complete':
|
|
108
|
+
return colors.green;
|
|
109
|
+
default:
|
|
110
|
+
return colors.orderDetailsText;
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
const getStatusText = (status: string) => {
|
|
115
|
+
switch (status?.toLowerCase()) {
|
|
116
|
+
case 'failed':
|
|
117
|
+
return 'Failed';
|
|
118
|
+
case 'dispatched':
|
|
119
|
+
return 'Dispatched';
|
|
120
|
+
case 'pending':
|
|
121
|
+
return 'Pending';
|
|
122
|
+
case 'partial':
|
|
123
|
+
return 'Partial';
|
|
124
|
+
case 'cancelled':
|
|
125
|
+
return 'Cancelled';
|
|
126
|
+
case 'confirmed':
|
|
127
|
+
return 'Confirmed';
|
|
128
|
+
case 'complete':
|
|
129
|
+
return 'Complete';
|
|
130
|
+
default:
|
|
131
|
+
return status || '';
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
const getStatusGradient = (status: string) => {
|
|
136
|
+
switch (status?.toLowerCase()) {
|
|
137
|
+
case 'failed':
|
|
138
|
+
return 'https://cdn.builder.io/api/v1/image/assets/TEMP/61e5ff7f60286acb4e138d6e523d999f5735f77c?width=786';
|
|
139
|
+
case 'partial':
|
|
140
|
+
return 'https://cdn.builder.io/api/v1/image/assets/TEMP/61e5ff7f60286acb4e138d6e523d999f5735f77c?width=786';
|
|
141
|
+
case 'dispatched':
|
|
142
|
+
return 'https://cdn.builder.io/api/v1/image/assets/TEMP/dd74efefe610e5bdc765d8bdc4edebd6aca28fde?width=786';
|
|
143
|
+
case 'pending':
|
|
144
|
+
return 'https://cdn.builder.io/api/v1/image/assets/TEMP/9403c4dddd88735d6767058bb115da7d3d749746?width=786';
|
|
145
|
+
case 'complete':
|
|
146
|
+
case 'Complete':
|
|
147
|
+
case 'confirmed':
|
|
148
|
+
return 'https://cdn.builder.io/api/v1/image/assets/TEMP/dd74efefe610e5bdc765d8bdc4edebd6aca28fde?width=786';
|
|
149
|
+
default:
|
|
150
|
+
return 'https://cdn.builder.io/api/v1/image/assets/TEMP/61e5ff7f60286acb4e138d6e523d999f5735f77c?width=786';
|
|
151
|
+
}
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
const toUrlString = (raw: any): string | null => {
|
|
155
|
+
if (typeof raw === 'string') return raw;
|
|
156
|
+
if (raw?.uri && typeof raw.uri === 'string') return raw.uri;
|
|
157
|
+
if (raw?.url && typeof raw.url === 'string') return raw.url;
|
|
158
|
+
if (raw?.image?.url && typeof raw.image.url === 'string') return raw.image.url;
|
|
159
|
+
return null;
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
const renderProduct = (product: Product, index: number) => {
|
|
164
|
+
const raw = product?.product?.image;
|
|
165
|
+
const url = toUrlString(raw);
|
|
166
|
+
|
|
167
|
+
return(
|
|
168
|
+
<View key={product.id}>
|
|
169
|
+
<View style={styles.productSection}>
|
|
170
|
+
<View style={styles.productRow}>
|
|
171
|
+
<View style={styles.productLeft}>
|
|
172
|
+
<View style={styles.productImageContainer}>
|
|
173
|
+
{url ? (
|
|
174
|
+
<Image source={{ uri: url }} style={styles.productImage} />
|
|
175
|
+
) : (
|
|
176
|
+
<CustomImage source={Images.placeholder} imgStyle={styles.productImage} />
|
|
177
|
+
)}
|
|
178
|
+
</View>
|
|
179
|
+
<View style={styles.productDetails}>
|
|
180
|
+
<Text style={styles.productName}>{product?.product?.name}</Text>
|
|
181
|
+
<Text style={styles.productDescription}>
|
|
182
|
+
{product?.product?.description}
|
|
183
|
+
</Text>
|
|
184
|
+
<View style={styles.productMetadata}>
|
|
185
|
+
<Text style={styles.productDenomination}>
|
|
186
|
+
Denomination : {product?.product?.denomination}
|
|
187
|
+
</Text>
|
|
188
|
+
<Text style={styles.productQuantity}>
|
|
189
|
+
Qty : {product?.quantity}
|
|
190
|
+
</Text>
|
|
191
|
+
<Text style={styles.productPoints}>
|
|
192
|
+
{pointsFromCentsFixed(product?.amount_cents, 1)} Points
|
|
193
|
+
</Text>
|
|
194
|
+
</View>
|
|
195
|
+
</View>
|
|
196
|
+
</View>
|
|
197
|
+
</View>
|
|
198
|
+
|
|
199
|
+
{item?.shipping_address && (
|
|
200
|
+
<View style={styles.deliverySection}>
|
|
201
|
+
<Text style={styles.deliveryTitle}>Delivery Details</Text>
|
|
202
|
+
<Text style={styles.deliveryAddress}>
|
|
203
|
+
{(() => {
|
|
204
|
+
const address = extractAddress(item?.shipping_address?.line);
|
|
205
|
+
return `${address.houseNo}, ${address.landmark}, ${item?.shipping_address?.city}, ${item?.shipping_address?.state}, ${item?.shipping_address?.zip_code} , ${item?.shipping_address?.country?.name}`.trim();
|
|
206
|
+
})()}
|
|
207
|
+
|
|
208
|
+
</Text>
|
|
209
|
+
<View style={styles.contactRow}>
|
|
210
|
+
<Text style={styles.contactInfo}>
|
|
211
|
+
{item?.shipping_address?.email}
|
|
212
|
+
</Text>
|
|
213
|
+
<Text style={styles.contactInfo}>
|
|
214
|
+
{`+91 ` + item?.shipping_address?.phone_numbers[0]}
|
|
215
|
+
</Text>
|
|
216
|
+
</View>
|
|
217
|
+
</View>
|
|
218
|
+
)}
|
|
219
|
+
</View>
|
|
220
|
+
|
|
221
|
+
{index < item.items.length - 1 && <View style={styles.separator} />}
|
|
222
|
+
</View>
|
|
223
|
+
)};
|
|
224
|
+
|
|
225
|
+
const formatDate = (isoDate: string) => {
|
|
226
|
+
const date = new Date(isoDate);
|
|
227
|
+
const day = date.toLocaleString('en-GB', { day: '2-digit' });
|
|
228
|
+
const month = date.toLocaleString('en-GB', { month: 'short' });
|
|
229
|
+
const year = date.getFullYear();
|
|
230
|
+
return `${day} ${month}, ${year}`;
|
|
231
|
+
};
|
|
232
|
+
return (
|
|
233
|
+
<View style={styles.container}>
|
|
234
|
+
<MobileHeader
|
|
235
|
+
title="Order Details"
|
|
236
|
+
showBack
|
|
237
|
+
onBack={() => {
|
|
238
|
+
if (navigation.canGoBack()) {
|
|
239
|
+
navigation.goBack();
|
|
240
|
+
} else {
|
|
241
|
+
navigation.navigate('MyOrders' as never);
|
|
242
|
+
}
|
|
243
|
+
}}
|
|
244
|
+
disableSafeAreaPadding={true}
|
|
245
|
+
/>
|
|
246
|
+
|
|
247
|
+
<View style={styles.statusSection}>
|
|
248
|
+
<Image
|
|
249
|
+
source={{ uri: getStatusGradient(item?.status || 'pending') }}
|
|
250
|
+
style={styles.statusBackgroundImage}
|
|
251
|
+
/>
|
|
252
|
+
<View style={styles.statusContent}>
|
|
253
|
+
<View style={styles.statusHeader}>
|
|
254
|
+
<View style={styles.statusLeft}>
|
|
255
|
+
{getStatusIcon(item?.status || 'pending')}
|
|
256
|
+
<Text style={[styles.statusText, { color: getStatusColor(item?.status || 'pending') }]}>
|
|
257
|
+
{getStatusText(item?.status || 'pending')}
|
|
258
|
+
</Text>
|
|
259
|
+
</View>
|
|
260
|
+
<TouchableOpacity
|
|
261
|
+
style={styles.pointsSection}
|
|
262
|
+
activeOpacity={0.7}
|
|
263
|
+
onPress={() => {
|
|
264
|
+
setAmountModalVisible(true);
|
|
265
|
+
}}
|
|
266
|
+
>
|
|
267
|
+
<Text style={styles.totalPoints}>{pointsFromCentsFixed(item?.grand_total, 1)} Points</Text>
|
|
268
|
+
<CustomImage
|
|
269
|
+
source={Images.i_blackIcon}
|
|
270
|
+
imgStyle={[styles.icon, { width: 16, height: 16 }]}
|
|
271
|
+
/>
|
|
272
|
+
</TouchableOpacity>
|
|
273
|
+
</View>
|
|
274
|
+
<View style={styles.orderMeta}>
|
|
275
|
+
<View style={[styles.orderInfo]}>
|
|
276
|
+
<Text style={styles.orderLabel}>{ORDER_NO}</Text>
|
|
277
|
+
<Text style={styles.orderValue}>{item?.order_no}</Text>
|
|
278
|
+
</View>
|
|
279
|
+
<View style={styles.orderInfo}>
|
|
280
|
+
<Text style={styles.orderLabel}>{DATE}</Text>
|
|
281
|
+
<Text style={styles.orderValue}>
|
|
282
|
+
{item?.created_at ? formatDate(item.created_at) : 'N/A'}
|
|
283
|
+
</Text>
|
|
284
|
+
</View>
|
|
285
|
+
</View>
|
|
286
|
+
</View>
|
|
287
|
+
</View>
|
|
288
|
+
|
|
289
|
+
<ScrollView
|
|
290
|
+
style={styles.scrollView}
|
|
291
|
+
contentContainerStyle={styles.scrollContent}
|
|
292
|
+
showsVerticalScrollIndicator={false}
|
|
293
|
+
>
|
|
294
|
+
<View style={styles.productsContainer}>
|
|
295
|
+
{item.items.map((product, index) => renderProduct(product, index))}
|
|
296
|
+
</View>
|
|
297
|
+
|
|
298
|
+
<View style={styles.supportSection}>
|
|
299
|
+
<Text style={styles.supportIntro}>
|
|
300
|
+
{ORDER_DETAILS_SUPPORT_INTRO}
|
|
301
|
+
</Text>
|
|
302
|
+
<View style={styles.supportContact}>
|
|
303
|
+
<Text style={styles.supportLabel}>{EMAIL}</Text>
|
|
304
|
+
<Text style={styles.supportValue}>{ORDER_DETAILS_SUPPORT_EMAIL}</Text>
|
|
305
|
+
</View>
|
|
306
|
+
<View style={styles.supportContact}>
|
|
307
|
+
<Text style={styles.supportLabel}>{PHONE}</Text>
|
|
308
|
+
<Text style={styles.supportValue}>{ORDER_DETAILS_SUPPORT_PHONE}</Text>
|
|
309
|
+
</View>
|
|
310
|
+
<Text style={styles.supportHours}>
|
|
311
|
+
{ORDER_DETAILS_SUPPORT_HOURS}
|
|
312
|
+
</Text>
|
|
313
|
+
</View>
|
|
314
|
+
</ScrollView>
|
|
315
|
+
|
|
316
|
+
{amountModalVisible && (
|
|
317
|
+
<AmountModal
|
|
318
|
+
visible={amountModalVisible}
|
|
319
|
+
onClose={() => setAmountModalVisible(false)}
|
|
320
|
+
item={{
|
|
321
|
+
discount_cents: item?.discount_cents || 0,
|
|
322
|
+
grand_total: item?.grand_total,
|
|
323
|
+
total_amount_cents: item?.grand_total,
|
|
324
|
+
}}
|
|
325
|
+
label_1={REMAINING_AMOUNT}
|
|
326
|
+
label_2={DISCOUNTED_AMOUNT}
|
|
327
|
+
/>
|
|
328
|
+
)}
|
|
329
|
+
</View>
|
|
330
|
+
);
|
|
331
|
+
};
|
|
332
|
+
|
|
333
|
+
export default OrderDetails;
|
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
import { StyleSheet } from 'react-native';
|
|
2
|
+
import FontFamily from '../../../src-app/constants/Fonts';
|
|
3
|
+
import { colors } from '../../../src-app/styles/colors';
|
|
4
|
+
|
|
5
|
+
const styles = StyleSheet.create({
|
|
6
|
+
container: {
|
|
7
|
+
flex: 1,
|
|
8
|
+
backgroundColor: colors.orderDetailsBackground,
|
|
9
|
+
},
|
|
10
|
+
|
|
11
|
+
statusSection: {
|
|
12
|
+
maxWidth: 393,
|
|
13
|
+
width: '100%',
|
|
14
|
+
alignSelf: 'center',
|
|
15
|
+
position: 'relative',
|
|
16
|
+
height: 105,
|
|
17
|
+
marginBottom: 20,
|
|
18
|
+
marginTop:20
|
|
19
|
+
},
|
|
20
|
+
statusBackgroundImage: {
|
|
21
|
+
position: 'absolute',
|
|
22
|
+
top: 0,
|
|
23
|
+
left: 0,
|
|
24
|
+
right: 0,
|
|
25
|
+
bottom: 0,
|
|
26
|
+
width: '100%',
|
|
27
|
+
height: 105,
|
|
28
|
+
resizeMode: 'cover',
|
|
29
|
+
},
|
|
30
|
+
|
|
31
|
+
statusContent: {
|
|
32
|
+
position: 'absolute',
|
|
33
|
+
top: 0,
|
|
34
|
+
left: 20,
|
|
35
|
+
right: 20,
|
|
36
|
+
paddingVertical: 16,
|
|
37
|
+
gap: 16,
|
|
38
|
+
},
|
|
39
|
+
statusHeader: {
|
|
40
|
+
flexDirection: 'row',
|
|
41
|
+
justifyContent: 'space-between',
|
|
42
|
+
alignItems: 'center',
|
|
43
|
+
},
|
|
44
|
+
statusLeft: {
|
|
45
|
+
flexDirection: 'row',
|
|
46
|
+
alignItems: 'center',
|
|
47
|
+
gap: 8,
|
|
48
|
+
},
|
|
49
|
+
statusText: {
|
|
50
|
+
fontSize: 16,
|
|
51
|
+
fontWeight: '500',
|
|
52
|
+
fontFamily: FontFamily.LEXEND_REGULAR,
|
|
53
|
+
textTransform: 'capitalize',
|
|
54
|
+
},
|
|
55
|
+
pointsSection: {
|
|
56
|
+
flexDirection: 'row',
|
|
57
|
+
alignItems: 'center',
|
|
58
|
+
gap: 12,
|
|
59
|
+
},
|
|
60
|
+
totalPoints: {
|
|
61
|
+
fontSize: 20,
|
|
62
|
+
fontWeight: '600',
|
|
63
|
+
color: colors.orderDetailsText,
|
|
64
|
+
fontFamily: FontFamily.LEXEND_SEMIBOLD,
|
|
65
|
+
},
|
|
66
|
+
orderMeta: {
|
|
67
|
+
flexDirection: 'row',
|
|
68
|
+
justifyContent: 'space-between',
|
|
69
|
+
alignItems: 'flex-start',
|
|
70
|
+
},
|
|
71
|
+
orderInfo: {
|
|
72
|
+
gap: 4,
|
|
73
|
+
},
|
|
74
|
+
orderLabel: {
|
|
75
|
+
fontSize: 10,
|
|
76
|
+
fontWeight: '400',
|
|
77
|
+
color: colors.orderDetailsSecondaryText,
|
|
78
|
+
fontFamily: FontFamily.LEXEND_REGULAR,
|
|
79
|
+
textTransform: 'capitalize',
|
|
80
|
+
},
|
|
81
|
+
orderValue: {
|
|
82
|
+
fontSize: 12,
|
|
83
|
+
fontWeight: '400',
|
|
84
|
+
color: colors.orderDetailsText,
|
|
85
|
+
fontFamily: FontFamily.LEXEND_REGULAR,
|
|
86
|
+
},
|
|
87
|
+
scrollView: {
|
|
88
|
+
flex: 1,
|
|
89
|
+
},
|
|
90
|
+
scrollContent: {
|
|
91
|
+
paddingBottom: 100,
|
|
92
|
+
maxWidth: 393,
|
|
93
|
+
width: '100%',
|
|
94
|
+
alignSelf: 'center',
|
|
95
|
+
},
|
|
96
|
+
productsContainer: {
|
|
97
|
+
paddingHorizontal: 20,
|
|
98
|
+
},
|
|
99
|
+
productSection: {
|
|
100
|
+
paddingVertical: 12,
|
|
101
|
+
gap: 24,
|
|
102
|
+
},
|
|
103
|
+
productRow: {
|
|
104
|
+
flexDirection: 'row',
|
|
105
|
+
justifyContent: 'space-between',
|
|
106
|
+
alignItems: 'flex-end',
|
|
107
|
+
},
|
|
108
|
+
productLeft: {
|
|
109
|
+
flexDirection: 'row',
|
|
110
|
+
alignItems: 'flex-start',
|
|
111
|
+
gap: 12,
|
|
112
|
+
flex: 1,
|
|
113
|
+
},
|
|
114
|
+
productImageContainer: {
|
|
115
|
+
width: 81,
|
|
116
|
+
height: 60,
|
|
117
|
+
backgroundColor: colors.orderDetailsBackground,
|
|
118
|
+
borderRadius: 6.75,
|
|
119
|
+
shadowColor: colors.orderDetailsShadow,
|
|
120
|
+
shadowOffset: {
|
|
121
|
+
width: 0,
|
|
122
|
+
height: 2,
|
|
123
|
+
},
|
|
124
|
+
shadowOpacity: 1,
|
|
125
|
+
shadowRadius: 3.84,
|
|
126
|
+
elevation: 2,
|
|
127
|
+
justifyContent: 'center',
|
|
128
|
+
alignItems: 'center',
|
|
129
|
+
borderWidth: 0.25,
|
|
130
|
+
borderColor: colors.orderDetailsBorder,
|
|
131
|
+
},
|
|
132
|
+
productImage: {
|
|
133
|
+
width: '100%',
|
|
134
|
+
height: '100%',
|
|
135
|
+
resizeMode: 'contain',
|
|
136
|
+
},
|
|
137
|
+
productDetails: {
|
|
138
|
+
flex: 1,
|
|
139
|
+
height: 54,
|
|
140
|
+
justifyContent: 'space-between',
|
|
141
|
+
},
|
|
142
|
+
productName: {
|
|
143
|
+
fontSize: 12,
|
|
144
|
+
fontWeight: '500',
|
|
145
|
+
color: colors.orderDetailsText,
|
|
146
|
+
fontFamily: FontFamily.LEXEND_REGULAR,
|
|
147
|
+
},
|
|
148
|
+
productDescription: {
|
|
149
|
+
fontSize: 10,
|
|
150
|
+
fontWeight: '400',
|
|
151
|
+
color: colors.orderDetailsSecondaryText,
|
|
152
|
+
fontFamily: FontFamily.LEXEND_REGULAR,
|
|
153
|
+
},
|
|
154
|
+
productMetadata: {
|
|
155
|
+
flexDirection: 'row',
|
|
156
|
+
alignItems: 'flex-start',
|
|
157
|
+
gap: 16,
|
|
158
|
+
justifyContent: 'space-between',
|
|
159
|
+
},
|
|
160
|
+
productDenomination: {
|
|
161
|
+
fontSize: 10,
|
|
162
|
+
fontWeight: '400',
|
|
163
|
+
color: colors.orderDetailsSecondaryText,
|
|
164
|
+
fontFamily: FontFamily.LEXEND_REGULAR,
|
|
165
|
+
},
|
|
166
|
+
productQuantity: {
|
|
167
|
+
fontSize: 10,
|
|
168
|
+
fontWeight: '400',
|
|
169
|
+
color: colors.orderDetailsSecondaryText,
|
|
170
|
+
fontFamily: FontFamily.LEXEND_REGULAR,
|
|
171
|
+
},
|
|
172
|
+
productPoints: {
|
|
173
|
+
fontSize: 14,
|
|
174
|
+
fontWeight: '500',
|
|
175
|
+
color: colors.orderDetailsText,
|
|
176
|
+
fontFamily: FontFamily.LEXEND_REGULAR,
|
|
177
|
+
bottom: 3,
|
|
178
|
+
},
|
|
179
|
+
deliverySection: {
|
|
180
|
+
gap: 8,
|
|
181
|
+
},
|
|
182
|
+
deliveryTitle: {
|
|
183
|
+
fontSize: 12,
|
|
184
|
+
fontWeight: '500',
|
|
185
|
+
color: colors.orderDetailsText,
|
|
186
|
+
fontFamily: FontFamily.LEXEND_REGULAR,
|
|
187
|
+
},
|
|
188
|
+
deliveryAddress: {
|
|
189
|
+
fontSize: 10,
|
|
190
|
+
fontWeight: '400',
|
|
191
|
+
color: colors.orderDetailsSecondaryText,
|
|
192
|
+
fontFamily: FontFamily.LEXEND_REGULAR,
|
|
193
|
+
lineHeight: 13.5,
|
|
194
|
+
},
|
|
195
|
+
contactRow: {
|
|
196
|
+
flexDirection: 'row',
|
|
197
|
+
justifyContent: 'space-between',
|
|
198
|
+
alignItems: 'flex-start',
|
|
199
|
+
gap: 4,
|
|
200
|
+
},
|
|
201
|
+
contactInfo: {
|
|
202
|
+
fontSize: 10,
|
|
203
|
+
fontWeight: '400',
|
|
204
|
+
color: colors.orderDetailsSecondaryText,
|
|
205
|
+
fontFamily: FontFamily.LEXEND_REGULAR,
|
|
206
|
+
},
|
|
207
|
+
separator: {
|
|
208
|
+
height: 1.2,
|
|
209
|
+
backgroundColor: 'transparent',
|
|
210
|
+
marginVertical: 8,
|
|
211
|
+
width: '100%',
|
|
212
|
+
alignSelf: 'center',
|
|
213
|
+
borderTopWidth: 1,
|
|
214
|
+
borderTopColor: colors.orderDetailsSeparator,
|
|
215
|
+
},
|
|
216
|
+
supportSection: {
|
|
217
|
+
backgroundColor: colors.orderDetailsSupportBackground,
|
|
218
|
+
borderRadius: 8,
|
|
219
|
+
padding: 12,
|
|
220
|
+
margin: 20,
|
|
221
|
+
gap: 12,
|
|
222
|
+
},
|
|
223
|
+
supportIntro: {
|
|
224
|
+
fontSize: 12,
|
|
225
|
+
fontWeight: '400',
|
|
226
|
+
color: colors.orderDetailsSecondaryText,
|
|
227
|
+
fontFamily: FontFamily.LEXEND_REGULAR,
|
|
228
|
+
lineHeight: 16.2,
|
|
229
|
+
},
|
|
230
|
+
supportContact: {
|
|
231
|
+
flexDirection: 'row',
|
|
232
|
+
alignItems: 'center',
|
|
233
|
+
gap: 4,
|
|
234
|
+
},
|
|
235
|
+
supportLabel: {
|
|
236
|
+
fontSize: 12,
|
|
237
|
+
fontWeight: '400',
|
|
238
|
+
color: colors.orderDetailsSecondaryText,
|
|
239
|
+
fontFamily: FontFamily.LEXEND_REGULAR,
|
|
240
|
+
lineHeight: 16.2,
|
|
241
|
+
},
|
|
242
|
+
supportValue: {
|
|
243
|
+
fontSize: 12,
|
|
244
|
+
fontWeight: '400',
|
|
245
|
+
color: colors.orderDetailsText,
|
|
246
|
+
fontFamily: FontFamily.LEXEND_REGULAR,
|
|
247
|
+
lineHeight: 16.2,
|
|
248
|
+
},
|
|
249
|
+
supportHours: {
|
|
250
|
+
fontSize: 10,
|
|
251
|
+
fontWeight: '400',
|
|
252
|
+
color: colors.orderDetailsSecondaryText,
|
|
253
|
+
fontFamily: FontFamily.LEXEND_REGULAR,
|
|
254
|
+
lineHeight: 13.5,
|
|
255
|
+
},
|
|
256
|
+
icon: {
|
|
257
|
+
height: 18,
|
|
258
|
+
width: 18,
|
|
259
|
+
},
|
|
260
|
+
});
|
|
261
|
+
|
|
262
|
+
export default styles;
|