@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,368 @@
|
|
|
1
|
+
import React, { useCallback, useEffect, useState } from "react";
|
|
2
|
+
import {
|
|
3
|
+
View,
|
|
4
|
+
Text,
|
|
5
|
+
ScrollView,
|
|
6
|
+
TouchableOpacity,
|
|
7
|
+
Image,
|
|
8
|
+
Alert,
|
|
9
|
+
Keyboard,
|
|
10
|
+
TouchableWithoutFeedback,
|
|
11
|
+
ActivityIndicator,
|
|
12
|
+
} from "react-native";
|
|
13
|
+
import styles from "./styles";
|
|
14
|
+
import { useAppDispatch } from "../../../src-app/hooks/useAppDispatch";
|
|
15
|
+
import {
|
|
16
|
+
myOrdersGenerateOtpRequest,
|
|
17
|
+
myOrdersValidateOtpRequest,
|
|
18
|
+
myProfileRequest,
|
|
19
|
+
resetAuthState,
|
|
20
|
+
uploadProfileImageRequest,
|
|
21
|
+
} from "../../../src-app/redux/authSlice";
|
|
22
|
+
import { CustomImage, Logout } from "../../../src-app/components";
|
|
23
|
+
import Images from "../../../src-app/constants/Images";
|
|
24
|
+
import { useAppSelector } from "../../../src-app/hooks/useAppSelector";
|
|
25
|
+
import { RootState } from "../../../src-app/redux/store";
|
|
26
|
+
import { launchImageLibrary } from "react-native-image-picker";
|
|
27
|
+
import OTPModal from "../../../src-app/components/OTPModal";
|
|
28
|
+
import { SafeAreaView } from "react-native-safe-area-context";
|
|
29
|
+
import CustomLoader from "../../../src-app/components/CustomLoader";
|
|
30
|
+
import { useFocusEffect } from "@react-navigation/native";
|
|
31
|
+
import { ROUTES } from "../../../src-app/constants/Routes";
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
interface ProfileProps {
|
|
35
|
+
navigation?: any;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
interface CustomViewProps {
|
|
39
|
+
icon: React.ReactNode;
|
|
40
|
+
label: string;
|
|
41
|
+
onPress: () => void;
|
|
42
|
+
showSeparator?: boolean;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const CustomView = ({
|
|
46
|
+
icon,
|
|
47
|
+
label,
|
|
48
|
+
onPress,
|
|
49
|
+
showSeparator = true,
|
|
50
|
+
}: CustomViewProps) => {
|
|
51
|
+
return (
|
|
52
|
+
<>
|
|
53
|
+
<TouchableOpacity
|
|
54
|
+
activeOpacity={0.7}
|
|
55
|
+
style={styles.menuItem}
|
|
56
|
+
onPress={onPress}
|
|
57
|
+
>
|
|
58
|
+
<View style={styles.menuItemContent}>
|
|
59
|
+
{icon}
|
|
60
|
+
<Text style={styles.menuItemText}>{label}</Text>
|
|
61
|
+
</View>
|
|
62
|
+
<CustomImage
|
|
63
|
+
source={Images.arrowright}
|
|
64
|
+
imgStyle={styles.arrowRightIcon}
|
|
65
|
+
/>
|
|
66
|
+
</TouchableOpacity>
|
|
67
|
+
{showSeparator && <View style={styles.separator} />}
|
|
68
|
+
</>
|
|
69
|
+
);
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
const Profile: React.FC<ProfileProps> = ({ navigation }) => {
|
|
73
|
+
const dispatch = useAppDispatch();
|
|
74
|
+
const [otpModalVisible, setOtpModalVisible] = useState(false);
|
|
75
|
+
const [resetOtpTrigger, setResetOtpTrigger] = useState(0);
|
|
76
|
+
const [screen, setScreen] = useState(""); // Track which screen triggered OTP flow
|
|
77
|
+
const {
|
|
78
|
+
myProfileData,
|
|
79
|
+
uploadProfileImageLoading,
|
|
80
|
+
uploadProfileImageError
|
|
81
|
+
} = useAppSelector((state: RootState) => state.auth);
|
|
82
|
+
const [logoutModalVisible, setLogoutModalVisible] = useState(false);
|
|
83
|
+
const myProfileLoading = useAppSelector((state: RootState) => state.auth.myProfileLoading);
|
|
84
|
+
const { myOrdersValidateOtpSuccessMessage } = useAppSelector(
|
|
85
|
+
(state: RootState) => state.auth
|
|
86
|
+
);
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
useFocusEffect(
|
|
91
|
+
useCallback(() => {
|
|
92
|
+
dispatch(myProfileRequest());
|
|
93
|
+
}, [dispatch])
|
|
94
|
+
);
|
|
95
|
+
|
|
96
|
+
// Handle upload errors
|
|
97
|
+
useEffect(() => {
|
|
98
|
+
if (uploadProfileImageError) {
|
|
99
|
+
Alert.alert("Upload Failed", uploadProfileImageError);
|
|
100
|
+
}
|
|
101
|
+
}, [uploadProfileImageError]);
|
|
102
|
+
|
|
103
|
+
useEffect(() => {
|
|
104
|
+
if (otpModalVisible && myOrdersValidateOtpSuccessMessage) {
|
|
105
|
+
setOtpModalVisible(false);
|
|
106
|
+
|
|
107
|
+
// Navigate based on which screen triggered the OTP flow
|
|
108
|
+
// With new Root Stack architecture, navigate directly to stack screens
|
|
109
|
+
if (screen === ROUTES.REDEMPTION_HISTORY) {
|
|
110
|
+
navigation.navigate("RedemptionHistory", { from: "Profile" });
|
|
111
|
+
} else {
|
|
112
|
+
navigation.navigate("MyOrders", { from: "Profile" });
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
setScreen("");
|
|
116
|
+
dispatch(resetAuthState("myOrdersValidateOtpSuccessMessage" as any));
|
|
117
|
+
dispatch(resetAuthState("myOrdersValidateOtpError" as any));
|
|
118
|
+
}
|
|
119
|
+
}, [otpModalVisible, myOrdersValidateOtpSuccessMessage, screen, navigation, dispatch]);
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
const handleLogout = () => {
|
|
123
|
+
setLogoutModalVisible(true);
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
const handleMenuPress = (screen: string) => {
|
|
127
|
+
console.log('🚀 Profile handleMenuPress called with screen:', screen);
|
|
128
|
+
if (navigation) {
|
|
129
|
+
switch (screen) {
|
|
130
|
+
case "TransactionHistory":
|
|
131
|
+
console.log('🚀 Profile navigating to TransactionHistory/RedemptionHistory - showing OTP modal');
|
|
132
|
+
setScreen(ROUTES.REDEMPTION_HISTORY);
|
|
133
|
+
setOtpModalVisible(true);
|
|
134
|
+
dispatch(myOrdersGenerateOtpRequest({}));
|
|
135
|
+
break;
|
|
136
|
+
case "MyOrders":
|
|
137
|
+
console.log('🚀 Profile navigating to MyOrders - showing OTP modal');
|
|
138
|
+
setScreen(ROUTES.MY_ORDERS);
|
|
139
|
+
setOtpModalVisible(true);
|
|
140
|
+
dispatch(myOrdersGenerateOtpRequest({}));
|
|
141
|
+
break;
|
|
142
|
+
case "FAQ":
|
|
143
|
+
console.log('🚀 Profile navigating to FAQ');
|
|
144
|
+
navigation.navigate("FAQ", { from: "Profile" });
|
|
145
|
+
break;
|
|
146
|
+
case "TnC":
|
|
147
|
+
console.log('🚀 Profile navigating to TnC');
|
|
148
|
+
navigation.navigate("TnC", { from: "Profile" });
|
|
149
|
+
break;
|
|
150
|
+
default:
|
|
151
|
+
console.log('🚀 Profile unknown screen:', screen);
|
|
152
|
+
break;
|
|
153
|
+
}
|
|
154
|
+
} else {
|
|
155
|
+
console.warn('⚠️ Profile navigation is null');
|
|
156
|
+
}
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
const handleMyProfile = () => {
|
|
160
|
+
const options = {
|
|
161
|
+
mediaType: "photo" as const,
|
|
162
|
+
quality: 0.8 as const,
|
|
163
|
+
maxWidth: 1000,
|
|
164
|
+
maxHeight: 1000,
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
launchImageLibrary(options, (response) => {
|
|
168
|
+
if (response.didCancel) {
|
|
169
|
+
console.log('User cancelled image picker');
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
172
|
+
if (response.errorCode) {
|
|
173
|
+
console.error('ImagePicker Error: ', response.errorMessage);
|
|
174
|
+
Alert.alert("Error", response.errorMessage || "Failed to pick image");
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
const asset = response.assets?.[0];
|
|
179
|
+
if (!asset?.uri) {
|
|
180
|
+
Alert.alert("Error", "No image selected");
|
|
181
|
+
return;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
// Validate file type
|
|
185
|
+
if (!asset.type?.startsWith('image/')) {
|
|
186
|
+
Alert.alert("Error", "Please select a valid image file");
|
|
187
|
+
return;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
// Validate file size (5MB limit)
|
|
191
|
+
if (asset.fileSize && asset.fileSize > 5 * 1024 * 1024) {
|
|
192
|
+
Alert.alert("Error", "Image size should be less than 5MB");
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
const formData = new FormData();
|
|
197
|
+
formData.append("name", myProfileData?.client?.employee?.name || "");
|
|
198
|
+
// Proper FormData structure for React Native
|
|
199
|
+
formData.append("image", {
|
|
200
|
+
uri: asset.uri,
|
|
201
|
+
type: asset.type,
|
|
202
|
+
name: asset.fileName || `profile_${Date.now()}.jpg`,
|
|
203
|
+
} as any);
|
|
204
|
+
|
|
205
|
+
console.log('Uploading image:', {
|
|
206
|
+
uri: asset.uri,
|
|
207
|
+
type: asset.type,
|
|
208
|
+
name: asset.fileName,
|
|
209
|
+
size: asset.fileSize,
|
|
210
|
+
});
|
|
211
|
+
|
|
212
|
+
dispatch(uploadProfileImageRequest(formData));
|
|
213
|
+
});
|
|
214
|
+
};
|
|
215
|
+
|
|
216
|
+
const handleVerify = async (otp: string) => {
|
|
217
|
+
try {
|
|
218
|
+
dispatch(
|
|
219
|
+
myOrdersValidateOtpRequest({
|
|
220
|
+
otp: otp,
|
|
221
|
+
})
|
|
222
|
+
);
|
|
223
|
+
} catch (error) {
|
|
224
|
+
console.error("Error getting dynamic headers:", error);
|
|
225
|
+
}
|
|
226
|
+
};
|
|
227
|
+
|
|
228
|
+
return (
|
|
229
|
+
<SafeAreaView style={styles.container} edges={["top", "bottom"]}>
|
|
230
|
+
<TouchableWithoutFeedback onPress={Keyboard.dismiss}>
|
|
231
|
+
<ScrollView
|
|
232
|
+
showsVerticalScrollIndicator={false}
|
|
233
|
+
contentContainerStyle={styles.content}
|
|
234
|
+
>
|
|
235
|
+
{/* Profile Section */}
|
|
236
|
+
|
|
237
|
+
<TouchableOpacity
|
|
238
|
+
onPress={handleMyProfile}
|
|
239
|
+
style={styles.profileSection}
|
|
240
|
+
disabled={uploadProfileImageLoading}
|
|
241
|
+
>
|
|
242
|
+
<View style={styles.avatarContainer}>
|
|
243
|
+
<Image
|
|
244
|
+
source={Images.circleblack}
|
|
245
|
+
style={styles.outerCircle}
|
|
246
|
+
/>
|
|
247
|
+
<Image
|
|
248
|
+
source={
|
|
249
|
+
myProfileData?.client?.image
|
|
250
|
+
? { uri: myProfileData.client.image }
|
|
251
|
+
: Images.profileicon
|
|
252
|
+
}
|
|
253
|
+
style={[styles.avatar, uploadProfileImageLoading && { opacity: 0.5 }]}
|
|
254
|
+
/>
|
|
255
|
+
|
|
256
|
+
{uploadProfileImageLoading ? (
|
|
257
|
+
<View style={styles.cameraIconContainer}>
|
|
258
|
+
<ActivityIndicator size="small" color="#fff" />
|
|
259
|
+
</View>
|
|
260
|
+
) : (
|
|
261
|
+
<View style={styles.cameraIconContainer}>
|
|
262
|
+
<CustomImage
|
|
263
|
+
source={Images.camera}
|
|
264
|
+
imgStyle={styles.cameraIcon}
|
|
265
|
+
/>
|
|
266
|
+
</View>
|
|
267
|
+
)}
|
|
268
|
+
</View>
|
|
269
|
+
</TouchableOpacity>
|
|
270
|
+
|
|
271
|
+
<View style={styles.userInfo}>
|
|
272
|
+
<Text style={styles.userName}>
|
|
273
|
+
{myProfileData?.client?.employee?.name}
|
|
274
|
+
</Text>
|
|
275
|
+
<Text style={styles.userEmail}>
|
|
276
|
+
{myProfileData?.client?.employee?.email}
|
|
277
|
+
</Text>
|
|
278
|
+
<Text style={styles.userPhone}>
|
|
279
|
+
{myProfileData?.client?.employee?.phone}
|
|
280
|
+
</Text>
|
|
281
|
+
</View>
|
|
282
|
+
|
|
283
|
+
{/* My Account Section */}
|
|
284
|
+
<Text style={styles.sectionTitle}>My Account</Text>
|
|
285
|
+
|
|
286
|
+
<View style={styles.menuSection}>
|
|
287
|
+
<CustomView
|
|
288
|
+
icon={
|
|
289
|
+
<CustomImage
|
|
290
|
+
source={Images.redemptionHistory}
|
|
291
|
+
imgStyle={styles.icon}
|
|
292
|
+
/>
|
|
293
|
+
}
|
|
294
|
+
label="Transaction History"
|
|
295
|
+
onPress={() => handleMenuPress("TransactionHistory")}
|
|
296
|
+
/>
|
|
297
|
+
|
|
298
|
+
<CustomView
|
|
299
|
+
icon={
|
|
300
|
+
<CustomImage source={Images.myOrders} imgStyle={styles.icon} />
|
|
301
|
+
}
|
|
302
|
+
label="My Orders"
|
|
303
|
+
onPress={() => {
|
|
304
|
+
dispatch(resetAuthState("verifyOtpSuccessMessage"));
|
|
305
|
+
handleMenuPress("MyOrders");
|
|
306
|
+
}}
|
|
307
|
+
/>
|
|
308
|
+
|
|
309
|
+
<CustomView
|
|
310
|
+
icon={<CustomImage source={Images.faq} imgStyle={styles.icon} />}
|
|
311
|
+
label="FAQ"
|
|
312
|
+
onPress={() => handleMenuPress("FAQ")}
|
|
313
|
+
/>
|
|
314
|
+
|
|
315
|
+
<CustomView
|
|
316
|
+
icon={<CustomImage source={Images.tnc} imgStyle={styles.icon} />}
|
|
317
|
+
label="TnC"
|
|
318
|
+
onPress={() => handleMenuPress("TnC")}
|
|
319
|
+
showSeparator={false}
|
|
320
|
+
/>
|
|
321
|
+
</View>
|
|
322
|
+
|
|
323
|
+
{/* Logout Button */}
|
|
324
|
+
<TouchableOpacity style={styles.logoutButton} onPress={handleLogout}>
|
|
325
|
+
<CustomImage source={Images.logout} imgStyle={styles.logoutIcon} />
|
|
326
|
+
<Text style={styles.logoutButtonText}>Logout</Text>
|
|
327
|
+
</TouchableOpacity>
|
|
328
|
+
</ScrollView>
|
|
329
|
+
</TouchableWithoutFeedback>
|
|
330
|
+
<OTPModal
|
|
331
|
+
visible={otpModalVisible}
|
|
332
|
+
onClose={() => {
|
|
333
|
+
setOtpModalVisible(false);
|
|
334
|
+
setScreen("");
|
|
335
|
+
dispatch(resetAuthState("myOrdersGenerateOtpError" as any));
|
|
336
|
+
dispatch(resetAuthState("myOrdersValidateOtpError" as any));
|
|
337
|
+
dispatch(resetAuthState("myOrdersValidateOtpSuccessMessage" as any));
|
|
338
|
+
}}
|
|
339
|
+
onVerify={(otp) => {
|
|
340
|
+
handleVerify(otp);
|
|
341
|
+
setResetOtpTrigger((prev) => prev + 1);
|
|
342
|
+
}}
|
|
343
|
+
onResend={() => dispatch(myOrdersGenerateOtpRequest({}))}
|
|
344
|
+
onNavigateToOrders={() => {
|
|
345
|
+
setOtpModalVisible(false);
|
|
346
|
+
setScreen("");
|
|
347
|
+
navigation.navigate("MyOrders", { from: "Profile" });
|
|
348
|
+
}}
|
|
349
|
+
resetOtpTrigger={resetOtpTrigger}
|
|
350
|
+
otpLength={4}
|
|
351
|
+
screen={screen}
|
|
352
|
+
/>
|
|
353
|
+
<Logout
|
|
354
|
+
visible={logoutModalVisible}
|
|
355
|
+
onClose={() => setLogoutModalVisible(false)}
|
|
356
|
+
onPress={() => {
|
|
357
|
+
setLogoutModalVisible(false);
|
|
358
|
+
navigation.reset({ index: 0, routes: [{ name: 'Login' }], });
|
|
359
|
+
dispatch(resetAuthState("verifyOtpSuccessMessage"));
|
|
360
|
+
dispatch(resetAuthState("otpSuccessMessage"));
|
|
361
|
+
}}
|
|
362
|
+
/>
|
|
363
|
+
<CustomLoader loading={!!myProfileLoading} text="Loading profile..." fullScreen />
|
|
364
|
+
</SafeAreaView>
|
|
365
|
+
);
|
|
366
|
+
};
|
|
367
|
+
|
|
368
|
+
export default Profile;
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import { Platform, StatusBar, StyleSheet } from 'react-native';
|
|
2
|
+
import FontFamily from '../../../src-app/constants/Fonts';
|
|
3
|
+
import { SCALE, VSCALE } from '../../../src-app/constants/Scaling';
|
|
4
|
+
import { colors } from '../../../src-app/styles/colors';
|
|
5
|
+
|
|
6
|
+
const styles = StyleSheet.create({
|
|
7
|
+
container: {
|
|
8
|
+
flex: 1,
|
|
9
|
+
backgroundColor: colors.profileBackground,
|
|
10
|
+
},
|
|
11
|
+
content: {
|
|
12
|
+
flexGrow: 1,
|
|
13
|
+
paddingBottom: VSCALE(40),
|
|
14
|
+
paddingTop: Platform.OS === 'android' ? StatusBar.currentHeight : 0,
|
|
15
|
+
},
|
|
16
|
+
profileSection: {
|
|
17
|
+
alignItems: 'center',
|
|
18
|
+
paddingTop: 0,
|
|
19
|
+
paddingBottom: VSCALE(32),
|
|
20
|
+
width: SCALE(150),
|
|
21
|
+
height: VSCALE(100),
|
|
22
|
+
alignSelf: 'center',
|
|
23
|
+
},
|
|
24
|
+
avatarContainer: {
|
|
25
|
+
alignItems: 'center',
|
|
26
|
+
width: SCALE(80),
|
|
27
|
+
height: VSCALE(80),
|
|
28
|
+
marginBottom: VSCALE(16),
|
|
29
|
+
marginTop: VSCALE(5)
|
|
30
|
+
},
|
|
31
|
+
cameraIconContainer: {
|
|
32
|
+
position: 'absolute',
|
|
33
|
+
right: -SCALE(2),
|
|
34
|
+
width: SCALE(30),
|
|
35
|
+
height: VSCALE(30),
|
|
36
|
+
bottom: VSCALE(0),
|
|
37
|
+
},
|
|
38
|
+
userInfo: {
|
|
39
|
+
alignItems: 'center',
|
|
40
|
+
gap: VSCALE(6),
|
|
41
|
+
paddingHorizontal: SCALE(4),
|
|
42
|
+
alignSelf: 'center',
|
|
43
|
+
marginTop: VSCALE(4),
|
|
44
|
+
width:VSCALE(203),
|
|
45
|
+
},
|
|
46
|
+
userName: {
|
|
47
|
+
fontFamily: FontFamily.LEXEND_SEMIBOLD,
|
|
48
|
+
fontSize: SCALE(18),
|
|
49
|
+
fontWeight: '600',
|
|
50
|
+
color: colors.profileTextPrimary,
|
|
51
|
+
textTransform: 'capitalize',
|
|
52
|
+
textAlign:'center'
|
|
53
|
+
},
|
|
54
|
+
userEmail: {
|
|
55
|
+
fontFamily: FontFamily.LEXEND_REGULAR,
|
|
56
|
+
fontSize: SCALE(12),
|
|
57
|
+
fontWeight: '400',
|
|
58
|
+
color: colors.profileTextSecondary,
|
|
59
|
+
width: '100%',
|
|
60
|
+
textAlign:'center'
|
|
61
|
+
},
|
|
62
|
+
userPhone: {
|
|
63
|
+
fontFamily: FontFamily.LEXEND_REGULAR,
|
|
64
|
+
fontSize: SCALE(12),
|
|
65
|
+
fontWeight: '400',
|
|
66
|
+
color: colors.profileTextSecondary,
|
|
67
|
+
letterSpacing: 0.24,
|
|
68
|
+
textTransform: 'lowercase',
|
|
69
|
+
width: '100%',
|
|
70
|
+
textAlign:'center'
|
|
71
|
+
},
|
|
72
|
+
sectionTitle: {
|
|
73
|
+
fontFamily: FontFamily.LEXEND_SEMIBOLD,
|
|
74
|
+
fontSize: SCALE(16),
|
|
75
|
+
fontWeight: '600',
|
|
76
|
+
color: colors.profileTextPrimary,
|
|
77
|
+
marginHorizontal: SCALE(30),
|
|
78
|
+
marginBottom: VSCALE(10),
|
|
79
|
+
marginTop: VSCALE(30),
|
|
80
|
+
},
|
|
81
|
+
menuSection: {
|
|
82
|
+
marginHorizontal: SCALE(30),
|
|
83
|
+
marginBottom: '20%',
|
|
84
|
+
},
|
|
85
|
+
menuItem: {
|
|
86
|
+
flexDirection: 'row',
|
|
87
|
+
justifyContent: 'space-between',
|
|
88
|
+
alignItems: 'center',
|
|
89
|
+
paddingVertical: VSCALE(15),
|
|
90
|
+
},
|
|
91
|
+
menuItemContent: {
|
|
92
|
+
flexDirection: 'row',
|
|
93
|
+
alignItems: 'center',
|
|
94
|
+
gap: SCALE(12),
|
|
95
|
+
},
|
|
96
|
+
menuItemText: {
|
|
97
|
+
fontFamily: FontFamily.LEXEND_REGULAR,
|
|
98
|
+
fontSize: SCALE(14),
|
|
99
|
+
fontWeight: '400',
|
|
100
|
+
color: colors.profileTextPrimary,
|
|
101
|
+
},
|
|
102
|
+
separator: {
|
|
103
|
+
width: '100%',
|
|
104
|
+
height: VSCALE(1.2),
|
|
105
|
+
backgroundColor: colors.profileSeparator,
|
|
106
|
+
},
|
|
107
|
+
logoutButton: {
|
|
108
|
+
marginHorizontal: SCALE(22),
|
|
109
|
+
borderRadius: SCALE(10),
|
|
110
|
+
borderWidth: 1,
|
|
111
|
+
borderColor: colors.profileLogout,
|
|
112
|
+
alignItems: 'center',
|
|
113
|
+
flexDirection: 'row',
|
|
114
|
+
justifyContent: 'center',
|
|
115
|
+
padding: VSCALE(20),
|
|
116
|
+
gap: SCALE(7),
|
|
117
|
+
},
|
|
118
|
+
logoutButtonText: {
|
|
119
|
+
fontFamily: FontFamily.LEXEND_REGULAR,
|
|
120
|
+
fontSize: SCALE(14),
|
|
121
|
+
fontWeight: '500',
|
|
122
|
+
color: colors.profileLogout,
|
|
123
|
+
letterSpacing: 0.02,
|
|
124
|
+
},
|
|
125
|
+
|
|
126
|
+
logoutIcon: {
|
|
127
|
+
height: VSCALE(12),
|
|
128
|
+
width: SCALE(12),
|
|
129
|
+
},
|
|
130
|
+
icon: {
|
|
131
|
+
height: VSCALE(20),
|
|
132
|
+
width: SCALE(20),
|
|
133
|
+
},
|
|
134
|
+
arrowRightIcon: {
|
|
135
|
+
height: VSCALE(12),
|
|
136
|
+
width: SCALE(12),
|
|
137
|
+
},
|
|
138
|
+
cameraIcon: {
|
|
139
|
+
height: VSCALE(30),
|
|
140
|
+
width: SCALE(30),
|
|
141
|
+
},
|
|
142
|
+
avatar: {
|
|
143
|
+
width:SCALE(72),
|
|
144
|
+
height:SCALE(72),
|
|
145
|
+
borderRadius: SCALE(72) / 2,
|
|
146
|
+
top:VSCALE(4)
|
|
147
|
+
},
|
|
148
|
+
outerCircle: {
|
|
149
|
+
width: SCALE(82),
|
|
150
|
+
height: SCALE(82),
|
|
151
|
+
resizeMode:'contain',
|
|
152
|
+
position:'absolute',
|
|
153
|
+
},
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
});
|
|
157
|
+
|
|
158
|
+
export default styles;
|