ordering-ui-react-native 0.15.55 → 0.15.58

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 (26) hide show
  1. package/package.json +1 -1
  2. package/src/components/OrderDetails/index.tsx +2 -2
  3. package/themes/business/src/components/NewOrderNotification/index.tsx +59 -98
  4. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +125 -91
  5. package/themes/business/src/components/OrderDetails/styles.tsx +7 -0
  6. package/themes/kiosk/src/components/Cart/index.tsx +99 -25
  7. package/themes/kiosk/src/components/Cart/styles.tsx +6 -0
  8. package/themes/kiosk/src/components/OrderDetails/index.tsx +134 -39
  9. package/themes/kiosk/src/components/OrderDetails/styles.tsx +5 -0
  10. package/themes/kiosk/src/types/index.d.ts +2 -0
  11. package/themes/original/index.tsx +151 -0
  12. package/themes/original/src/components/AddressList/index.tsx +1 -1
  13. package/themes/original/src/components/AppleLogin/index.tsx +58 -21
  14. package/themes/original/src/components/BusinessProductsList/index.tsx +104 -18
  15. package/themes/original/src/components/BusinessProductsList/styles.tsx +12 -1
  16. package/themes/original/src/components/BusinessProductsListing/index.tsx +5 -0
  17. package/themes/original/src/components/BusinessesListing/index.tsx +1 -1
  18. package/themes/original/src/components/Home/index.tsx +1 -1
  19. package/themes/original/src/components/PhoneInputNumber/index.tsx +10 -4
  20. package/themes/original/src/components/SignupForm/index.tsx +41 -13
  21. package/themes/original/src/components/UserFormDetails/index.tsx +13 -2
  22. package/themes/original/src/components/UserProfile/index.tsx +1 -1
  23. package/themes/original/src/config/constants.tsx +6 -6
  24. package/themes/original/src/types/index.tsx +6 -1
  25. package/themes/single-business/src/components/AddressList/index.tsx +1 -1
  26. package/themes/single-business/src/components/UserProfile/index.tsx +1 -1
@@ -1,6 +1,6 @@
1
- import React, { useEffect } from 'react';
1
+ import React, { useEffect, useState } from 'react';
2
2
  import { Platform, Text, StyleSheet } from 'react-native';
3
- import { useApi, useSession, useLanguage, useConfig } from 'ordering-components/native';
3
+ import { useApi, useSession, useLanguage, useConfig, useToast, ToastType } from 'ordering-components/native';
4
4
  import { appleAuthAndroid, appleAuth } from '@invertase/react-native-apple-authentication';
5
5
  import uuid from 'react-native-uuid';
6
6
  import Icon from 'react-native-vector-icons/FontAwesome5';
@@ -18,7 +18,12 @@ export const AppleLogin = (props: any) => {
18
18
  const [ordering] = useApi();
19
19
  const [{ auth }] = useSession();
20
20
  const [, t] = useLanguage();
21
- const [{ configs }] = useConfig()
21
+ const [{ configs }] = useConfig();
22
+ const [, {showToast}] = useToast()
23
+ const [credentialStateForUser, updateCredentialStateForUser] = useState<any>(-1);
24
+
25
+ let user : any= null
26
+
22
27
  const buttonText = auth
23
28
  ? t('CONTINUE_WITH_APPLE', 'Logout with Apple')
24
29
  : t('CONTINUE_WITH_FACEBOOK', 'Continue with Apple');
@@ -39,8 +44,8 @@ export const AppleLogin = (props: any) => {
39
44
  handleLoading && handleLoading(false)
40
45
  }
41
46
  } else {
47
+ showToast(ToastType.Error, `Error login on apple from api Code: ${code}`, 10000)
42
48
  handleLoading && handleLoading(false)
43
- logoutFromApple()
44
49
  }
45
50
  } catch (err: any) {
46
51
  handleLoading && handleLoading(false)
@@ -48,33 +53,52 @@ export const AppleLogin = (props: any) => {
48
53
  }
49
54
  }
50
55
 
51
- const logoutFromApple = () => {
52
-
56
+ const fetchAndUpdateCredentialState = async (updateCredentialStateForUser : any) => {
57
+ if (user === null) {
58
+ updateCredentialStateForUser('N/A');
59
+ } else {
60
+ const credentialState = await appleAuth.getCredentialStateForUser(user);
61
+ if (credentialState === appleAuth.State.AUTHORIZED) {
62
+ updateCredentialStateForUser('AUTHORIZED');
63
+ } else {
64
+ updateCredentialStateForUser(credentialState);
65
+ }
66
+ }
53
67
  }
54
68
 
55
- const onIOSButtonPress = async () => {
69
+ const onIOSButtonPress = async (updateCredentialStateForUser : any) => {
56
70
  try {
57
71
  const appleAuthRequestResponse = await appleAuth.performRequest({
58
72
  requestedOperation: appleAuth.Operation.LOGIN,
59
73
  requestedScopes: [appleAuth.Scope.EMAIL, appleAuth.Scope.FULL_NAME],
60
74
  });
61
75
 
62
- // get current authentication state for user
63
- // /!\ This method must be tested on a real device. On the iOS simulator it always throws an error.
64
- const credentialState = await appleAuth.getCredentialStateForUser(appleAuthRequestResponse.user);
65
-
66
- // use credentialState response to ensure the user is authenticated
67
- if (credentialState === appleAuth.State.AUTHORIZED) {
68
- // user is authenticated
69
- if (appleAuthRequestResponse.authorizationCode) {
70
- performAppleLogin(appleAuthRequestResponse.authorizationCode)
71
- }
76
+ const {
77
+ user: newUser,
78
+ email,
79
+ identityToken,
80
+ authorizationCode
81
+ } = appleAuthRequestResponse;
82
+
83
+ user = newUser;
84
+
85
+ fetchAndUpdateCredentialState(updateCredentialStateForUser).catch(error =>
86
+ updateCredentialStateForUser(`Error: ${error.code}`),
87
+ );
88
+
89
+ if (identityToken && authorizationCode) {
90
+ showToast(ToastType.Success, `Apple Authentication Completed, ${email}`)
91
+ performAppleLogin(authorizationCode)
92
+ } else {
93
+ handleErrors && handleErrors('UNABLE_LOGIN_TOKEN', 'Unable to login, no token found')
72
94
  }
95
+
73
96
  } catch (err: any) {
74
97
  handleLoading && handleLoading(false)
75
98
  handleErrors && handleErrors(err.message)
76
99
  }
77
100
  }
101
+
78
102
  const onAndroidButtonPress = async () => {
79
103
  try {
80
104
  // Generate secure, random values for state and nonce
@@ -108,10 +132,20 @@ export const AppleLogin = (props: any) => {
108
132
  }
109
133
 
110
134
  useEffect(() => {
111
- if (Platform.OS == 'android') return;
112
- // onCredentialRevoked returns a function that will remove the event listener. useEffect will call this function when the component unmounts
135
+ if (!appleAuth.isSupported || Platform.OS === 'android') return;
136
+
137
+ fetchAndUpdateCredentialState(updateCredentialStateForUser).catch(error =>
138
+ updateCredentialStateForUser(`Error: ${error.code}`),
139
+ );
140
+ }, []);
141
+
142
+ useEffect(() => {
143
+ if (!appleAuth.isSupported || Platform.OS === 'android') return;
144
+
113
145
  return appleAuth.onCredentialRevoked(async () => {
114
- console.warn('If this function executes, User Credentials have been Revoked');
146
+ fetchAndUpdateCredentialState(updateCredentialStateForUser).catch(error =>
147
+ updateCredentialStateForUser(`Error: ${error.code}`),
148
+ );
115
149
  });
116
150
  }, []);
117
151
 
@@ -123,9 +157,12 @@ export const AppleLogin = (props: any) => {
123
157
 
124
158
  return (
125
159
  <Container>
160
+ {credentialStateForUser !== -1 && (
161
+ <Text>{credentialStateForUser}</Text>
162
+ )}
126
163
  {canShowButton() &&
127
164
  <AppleButton
128
- onPress={() => Platform.OS == 'android' ? onAndroidButtonPress() : onIOSButtonPress()}
165
+ onPress={() => Platform.OS == 'android' ? onAndroidButtonPress() : onIOSButtonPress(updateCredentialStateForUser)}
129
166
  >
130
167
  <Icon
131
168
  name="apple"
@@ -4,7 +4,7 @@ import { SingleProductCard } from '../SingleProductCard';
4
4
  import { NotFoundSource } from '../NotFoundSource';
5
5
  import { BusinessProductsListParams } from '../../types';
6
6
  import { OButton, OIcon, OModal, OText } from '../shared';
7
- import { ProductsContainer, ErrorMessage, WrapperNotFound, RibbonBox } from './styles';
7
+ import { ProductsContainer, ErrorMessage, WrapperNotFound, RibbonBox, SubCategoriesContainer, ContainerButton, HeaderWrapper } from './styles';
8
8
  import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder';
9
9
  import { View, ScrollView } from 'react-native';
10
10
  import { StyleSheet } from 'react-native';
@@ -28,7 +28,11 @@ const BusinessProductsListUI = (props: BusinessProductsListParams) => {
28
28
  handleCancelSearch,
29
29
  categoriesLayout,
30
30
  setCategoriesLayout,
31
- currentCart
31
+ currentCart,
32
+ setSubcategoriesSelected,
33
+ subcategoriesSelected,
34
+ onClickCategory,
35
+ lazyLoadProductsRecommended
32
36
  } = props;
33
37
 
34
38
  const [, t] = useLanguage();
@@ -44,20 +48,85 @@ const BusinessProductsListUI = (props: BusinessProductsListParams) => {
44
48
  setCategoriesLayout(_categoriesLayout)
45
49
  }
46
50
 
51
+ const onClickSubcategory = (subCategory : any, parentCategory : any) => {
52
+ if (parentCategory && lazyLoadProductsRecommended) {
53
+ onClickCategory(parentCategory)
54
+ }
55
+ if (!subCategory) {
56
+ setSubcategoriesSelected?.(subcategoriesSelected.filter((_subcategory : any) => _subcategory?.parent_category_id !== parentCategory?.id))
57
+ return
58
+ }
59
+ const categoryFounded = subcategoriesSelected.find((_subcategory : any) => subCategory?.id === _subcategory?.id)
60
+ if (categoryFounded) {
61
+ setSubcategoriesSelected?.(subcategoriesSelected.filter((_subcategory : any) => subCategory?.id !== _subcategory?.id))
62
+ } else {
63
+ setSubcategoriesSelected?.([...subcategoriesSelected, subCategory])
64
+ }
65
+ }
66
+
67
+ const SubcategoriesComponent = ({ category } : any) => {
68
+ const allsubcategorySelected = !subcategoriesSelected?.some((subcategory : any) => category?.id === subcategory?.parent_category_id)
69
+
70
+ return (
71
+ <SubCategoriesContainer>
72
+ <ContainerButton
73
+ isSelected={allsubcategorySelected}
74
+ >
75
+ <OButton
76
+ onClick={() => onClickSubcategory(null, category)}
77
+ bgColor={allsubcategorySelected ? theme.colors.primary : theme.colors.backgroundGray}
78
+ text={`${t('ALL', 'All')} ${allsubcategorySelected ? 'X' : ''}`}
79
+ style={bpStyles.categoryButtonStyle}
80
+ textStyle={{ color: allsubcategorySelected ? theme.colors.white : theme.colors.textNormal, fontSize: 12 }}
81
+ />
82
+ </ContainerButton>
83
+ {category?.subcategories?.map((subcategory : any) => {
84
+ const isSubcategorySelected = subcategoriesSelected?.find((_subcategory : any) => _subcategory?.id === subcategory?.id)
85
+ return (
86
+ <ContainerButton
87
+ key={subcategory?.id}
88
+ isSelected={isSubcategorySelected}
89
+ >
90
+ <OButton
91
+ onClick={() => onClickSubcategory(subcategory, category)}
92
+ bgColor={isSubcategorySelected ? theme.colors.primary : theme.colors.backgroundGray}
93
+ text={`${subcategory?.name} ${isSubcategorySelected ? 'X' : ''}`}
94
+ style={bpStyles.categoryButtonStyle}
95
+ textStyle={{ color: isSubcategorySelected ? theme.colors.white : theme.colors.textNormal, fontSize: 12 }}
96
+ />
97
+ </ContainerButton>
98
+ )
99
+ }
100
+ )}
101
+ </SubCategoriesContainer>
102
+ )
103
+ }
104
+
105
+
47
106
  return (
48
107
  <ProductsContainer renderToHardwareTextureAndroid={categoryState.loading || isBusinessLoading}>
108
+ <HeaderWrapper>
109
+ {category?.subcategories?.length > 0 && (
110
+ <SubcategoriesComponent category={category} />
111
+ )}
112
+ </HeaderWrapper>
49
113
  {category.id &&
50
- categoryState.products?.sort((a: any, b: any) => a.rank - b.rank).map((product: any) => (
51
- <SingleProductCard
52
- key={'prod_' + product.id}
53
- isSoldOut={product.inventoried && !product.quantity}
54
- product={product}
55
- businessId={businessId}
56
- onProductClick={() => onProductClick(product)}
57
- productAddedToCartLength={currentCart?.products?.reduce((productsLength: number, Cproduct: any) => { return productsLength + (Cproduct?.id === product?.id ? Cproduct?.quantity : 0) }, 0)}
58
- />
59
- ))}
60
-
114
+ categoryState.products
115
+ ?.filter((product : any) =>
116
+ !subcategoriesSelected.find((subcategory : any) => subcategory?.parent_category_id === category?.id) ||
117
+ subcategoriesSelected?.some((subcategory : any) => subcategory.id === product?.category_id)
118
+ ?.sort((a: any, b: any) => a.rank - b.rank)
119
+ ?.map((product: any) => (
120
+ <SingleProductCard
121
+ key={'prod_' + product.id}
122
+ isSoldOut={product.inventoried && !product.quantity}
123
+ product={product}
124
+ businessId={businessId}
125
+ onProductClick={() => onProductClick(product)}
126
+ productAddedToCartLength={currentCart?.products?.reduce((productsLength: number, Cproduct: any) => { return productsLength + (Cproduct?.id === product?.id ? Cproduct?.quantity : 0) }, 0)}
127
+ />
128
+ ))
129
+ )}
61
130
  {!category.id &&
62
131
  featured &&
63
132
  categoryState?.products?.find((product: any) => product.featured) && (
@@ -72,7 +141,7 @@ const BusinessProductsListUI = (props: BusinessProductsListParams) => {
72
141
  (product: any, i: any) =>
73
142
  product.featured && (
74
143
  <SingleProductCard
75
- key={i}
144
+ key={'feat_' + product.id}
76
145
  isSoldOut={product.inventoried && !product.quantity}
77
146
  product={product}
78
147
  businessId={businessId}
@@ -86,9 +155,14 @@ const BusinessProductsListUI = (props: BusinessProductsListParams) => {
86
155
  )}
87
156
 
88
157
  {!category?.id && categories.filter(category => category?.id !== null).map((category, i, _categories) => {
89
- const products = !isUseParentCategory
90
- ? categoryState?.products?.filter((product: any) => product?.category_id === category?.id) ?? []
91
- : categoryState?.products?.filter((product: any) => category?.children?.some((cat: any) => cat.category_id === product?.category_id)) ?? []
158
+ const _products = !isUseParentCategory
159
+ ? categoryState?.products?.filter((product : any) => product?.category_id === category?.id) ?? []
160
+ : categoryState?.products?.filter((product : any) => category?.children?.some((cat : any) => cat.category_id === product?.category_id)) ?? []
161
+ const products = subcategoriesSelected?.length > 0
162
+ ? _products?.filter((product : any) =>
163
+ !subcategoriesSelected.find((subcategory : any) => subcategory?.parent_category_id === category?.id) ||
164
+ subcategoriesSelected?.some((subcategory : any) => subcategory.id === product?.category_id))
165
+ : _products
92
166
 
93
167
  const shortCategoryDescription = category?.description?.length > 80 ? `${category?.description?.substring(0, 80)}...` : category?.description
94
168
 
@@ -132,7 +206,7 @@ const BusinessProductsListUI = (props: BusinessProductsListParams) => {
132
206
  </View>
133
207
  {!!category?.description && (
134
208
  <View style={{ position: 'relative' }}>
135
- <OText size={12} weight={'500'} mBottom={5}>
209
+ <OText size={12} weight={'500'} mBottom={10} color='#909BA9'>
136
210
  {shortCategoryDescription}
137
211
  {category?.description?.length > 80 && (
138
212
  <OButton
@@ -150,6 +224,9 @@ const BusinessProductsListUI = (props: BusinessProductsListParams) => {
150
224
  />
151
225
  )}
152
226
  </OText>
227
+ {category?.subcategories?.length > 0 && (
228
+ <SubcategoriesComponent category={category} />
229
+ )}
153
230
  </View>
154
231
  )}
155
232
  <>
@@ -265,6 +342,15 @@ const bpStyles = StyleSheet.create({
265
342
  shadowRadius: 1,
266
343
  marginEnd: 13,
267
344
  },
345
+ categoryButtonStyle: {
346
+ borderWidth: 0,
347
+ marginLeft: 5,
348
+ marginRight: 5,
349
+ marginBottom: 10,
350
+ height: 35,
351
+ paddingLeft: 3,
352
+ paddingRight: 3,
353
+ }
268
354
  });
269
355
 
270
356
  export const BusinessProductsList = (props: BusinessProductsListParams) => {
@@ -30,4 +30,15 @@ export const RibbonBox = styled.View`
30
30
  ${(props: any) => props.isCapsule && css`
31
31
  border-radius: 50px;
32
32
  `}
33
- `
33
+ `
34
+
35
+ export const SubCategoriesContainer = styled.View`
36
+ flex-direction: row;
37
+ flex-wrap: wrap;
38
+ margin-bottom: 10px;
39
+ `
40
+
41
+ export const ContainerButton = styled.View`
42
+ `
43
+
44
+ export const HeaderWrapper = styled.View``
@@ -92,6 +92,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
92
92
  const [categoriesLayout, setCategoriesLayout] = useState<any>({})
93
93
  const [productListLayout, setProductListLayout] = useState<any>(null)
94
94
  const [isCategoryClicked, setCategoryClicked] = useState(false)
95
+ const [subcategoriesSelected, setSubcategoriesSelected] = useState([])
95
96
 
96
97
  const currentCart: any = Object.values(orderState.carts).find((cart: any) => cart?.business?.slug === business?.slug) ?? {}
97
98
 
@@ -254,6 +255,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
254
255
  lazyLoadProductsRecommended={business?.lazy_load_products_recommended}
255
256
  setSelectedCategoryId={setSelectedCategoryId}
256
257
  setCategoryClicked={setCategoryClicked}
258
+
257
259
  />
258
260
  )}
259
261
  </>
@@ -281,8 +283,11 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
281
283
  errorQuantityProducts={errorQuantityProducts}
282
284
  handleCancelSearch={handleCancel}
283
285
  categoriesLayout={categoriesLayout}
286
+ subcategoriesSelected={subcategoriesSelected}
287
+ lazyLoadProductsRecommended={business?.lazy_load_products_recommended}
284
288
  setCategoriesLayout={setCategoriesLayout}
285
289
  currentCart={currentCart}
290
+ setSubcategoriesSelected={setSubcategoriesSelected}
286
291
  />
287
292
  </WrapContent>
288
293
  </>
@@ -317,7 +317,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
317
317
  {
318
318
  !businessId && !props.franchiseId && featuredBusiness && featuredBusiness.length > 0 && (
319
319
  <FeaturedWrapper>
320
- <OText size={16} style={{ marginLeft: 40 }} weight={Platform.OS === 'ios' ? '600' : 'bold'}>{t('FEATURED_BUSINESS', 'Featured business')}</OText>
320
+ <OText size={16} style={{ marginLeft: 40 }} weight={Platform.OS === 'ios' ? '600' : 'bold'}>{t('BUSINESS_FEATURE', 'Featured business')}</OText>
321
321
  <ScrollView
322
322
  showsHorizontalScrollIndicator={false}
323
323
  nestedScrollEnabled
@@ -36,7 +36,7 @@ export const Home = (props: any) => {
36
36
  {t('WELCOME', 'Welcome!')}
37
37
  </OText>
38
38
  <OText color={theme.colors.white} size={14} style={{ marginBottom: 46 }}>
39
- {t('LETS_START_ORDER', "Let's start to order now")}
39
+ {t('SUBTITLE_HOME', "Let's start to order now")}
40
40
  </OText>
41
41
  <OButton
42
42
  text={t('LOGIN_NOW', 'Login now')}
@@ -22,8 +22,9 @@ export const PhoneInputNumber = (props: PhoneInputParams) => {
22
22
  textStyle,
23
23
  flagStyle,
24
24
  noDropIcon,
25
- isDisabled,
26
- isStartValidation
25
+ isDisabled,
26
+ isStartValidation,
27
+ changeCountry
27
28
  } = props
28
29
 
29
30
  const theme = useTheme();
@@ -106,11 +107,16 @@ export const PhoneInputNumber = (props: PhoneInputParams) => {
106
107
  )}
107
108
  <PhoneInput
108
109
  ref={phoneInput}
109
- disabled={isDisabled}
110
+ disabled={isDisabled}
110
111
  defaultValue={userphoneNumber || defaultValue}
111
- defaultCode={defaultCode ? transformCountryCode(defaultCode) : configs?.default_country_code?.value}
112
+ defaultCode={defaultCode ?
113
+ !isNaN(defaultCode)
114
+ ? transformCountryCode(defaultCode)
115
+ : defaultCode
116
+ : configs?.default_country_code?.value}
112
117
  onChangeFormattedText={(text: string) => handleChangeNumber(text)}
113
118
  withDarkTheme
119
+ onChangeCountry={(country) => changeCountry?.(country)}
114
120
  countryPickerProps={{ withAlphaFilter: true }}
115
121
  textContainerStyle={{ ...style.input, ...inputStyle ? inputStyle : {} }}
116
122
  textInputStyle={textStyle}
@@ -119,6 +119,7 @@ const SignupFormUI = (props: SignupParams) => {
119
119
  phone: {
120
120
  country_phone_code: null,
121
121
  cellphone: null,
122
+ country_code: null
122
123
  },
123
124
  });
124
125
  const [recaptchaConfig, setRecaptchaConfig] = useState<any>({})
@@ -133,7 +134,7 @@ const SignupFormUI = (props: SignupParams) => {
133
134
  const passwordRef = useRef<any>(null);
134
135
  const recaptchaRef = useRef<any>({});
135
136
 
136
- const showInputPhoneNumber = (validationFields?.fields?.checkout?.cellphone?.enabled ?? false) || configs?.verification_phone_required?.value === '1'
137
+ const showInputPhoneNumber = (validationFields?.fields?.checkout?.cellphone?.enabled ?? false) || configs?.verification_phone_required?.value === '1'
137
138
 
138
139
  const handleRefs = (ref: any, code: string) => {
139
140
  switch (code) {
@@ -216,8 +217,8 @@ const SignupFormUI = (props: SignupParams) => {
216
217
  !phoneInputData.phone.country_phone_code &&
217
218
  !phoneInputData.phone.cellphone &&
218
219
  ((validationFields?.fields?.checkout?.cellphone?.enabled &&
219
- validationFields?.fields?.checkout?.cellphone?.required) ||
220
- configs?.verification_phone_required?.value === '1')
220
+ validationFields?.fields?.checkout?.cellphone?.required) ||
221
+ configs?.verification_phone_required?.value === '1')
221
222
  ) {
222
223
  showToast(
223
224
  ToastType.Error,
@@ -232,7 +233,8 @@ const SignupFormUI = (props: SignupParams) => {
232
233
  handleButtonSignupClick &&
233
234
  handleButtonSignupClick({
234
235
  ...values,
235
- ...((phoneInputData.phone.cellphone !== null && phoneInputData.phone.country_phone_code !== null) && {...phoneInputData.phone}),
236
+ ...((phoneInputData.phone.cellphone !== null && phoneInputData.phone.country_phone_code !== null) && { ...phoneInputData.phone }),
237
+ country_code: phoneInputData.phone.country_code
236
238
  });
237
239
  if (
238
240
  !formState.loading &&
@@ -295,7 +297,7 @@ const SignupFormUI = (props: SignupParams) => {
295
297
 
296
298
  const handleOpenRecaptcha = () => {
297
299
  setRecaptchaVerified(false)
298
- if (!recaptchaConfig?.siteKey) {
300
+ if (!recaptchaConfig?.siteKey) {
299
301
  showToast(ToastType.Error, t('NO_RECAPTCHA_SITE_KEY', 'The config doesn\'t have recaptcha site key'));
300
302
  return
301
303
  }
@@ -304,7 +306,7 @@ const SignupFormUI = (props: SignupParams) => {
304
306
  return
305
307
  }
306
308
  recaptchaRef.current.open()
307
- }
309
+ }
308
310
 
309
311
  const onRecaptchaVerify = (token: any) => {
310
312
  setRecaptchaVerified(true)
@@ -335,12 +337,12 @@ const SignupFormUI = (props: SignupParams) => {
335
337
  }, [errors]);
336
338
 
337
339
  useEffect(() => {
338
- register('cellphone', {
339
- required: isRequiredField('cellphone')
340
- ? t('VALIDATION_ERROR_MOBILE_PHONE_REQUIRED', 'The field Mobile phone is required').replace('_attribute_', t('CELLPHONE', 'Cellphone'))
341
- : null
342
- })
343
- }, [register])
340
+ register('cellphone', {
341
+ required: isRequiredField('cellphone')
342
+ ? t('VALIDATION_ERROR_MOBILE_PHONE_REQUIRED', 'The field Mobile phone is required').replace('_attribute_', t('CELLPHONE', 'Cellphone'))
343
+ : null
344
+ })
345
+ }, [register])
344
346
 
345
347
  useEffect(() => {
346
348
  if (phoneInputData?.phone?.cellphone) setValue('cellphone', phoneInputData?.phone?.cellphone, '')
@@ -367,6 +369,16 @@ const SignupFormUI = (props: SignupParams) => {
367
369
  }
368
370
  }, [verifyPhoneState]);
369
371
 
372
+ useEffect(() => {
373
+ setPhoneInputData({
374
+ ...phoneInputData,
375
+ phone: {
376
+ ...phoneInputData.phone,
377
+ country_code: configs?.default_country_code?.value
378
+ }
379
+ })
380
+ }, [configs])
381
+
370
382
  return (
371
383
  <View>
372
384
  <NavBar
@@ -490,8 +502,24 @@ const SignupFormUI = (props: SignupParams) => {
490
502
  <View style={{ marginBottom: 25 }}>
491
503
  <PhoneInputNumber
492
504
  data={phoneInputData}
493
- handleData={(val: any) => setPhoneInputData(val)}
505
+ handleData={(val: any) => setPhoneInputData({
506
+ ...phoneInputData,
507
+ ...val,
508
+ phone: {
509
+ ...phoneInputData.phone,
510
+ ...val.phone,
511
+ country_code: phoneInputData.phone.country_code
512
+ }
513
+ })}
494
514
  forwardRef={phoneRef}
515
+ defaultCode={formState?.country_code ?? formState?.country_phone_code ?? null}
516
+ changeCountry={(val: any) => setPhoneInputData({
517
+ ...phoneInputData,
518
+ phone: {
519
+ ...phoneInputData.phone,
520
+ country_code: val.cca2
521
+ }
522
+ })}
495
523
  textInputProps={{
496
524
  returnKeyType: 'next',
497
525
  onSubmitEditing: () => passwordRef?.current?.focus?.(),
@@ -27,7 +27,7 @@ export const UserFormDetailsUI = (props: any) => {
27
27
  hideUpdateButton,
28
28
  setWillVerifyOtpState,
29
29
  isVerifiedPhone,
30
- handleChangePromotions
30
+ handleChangePromotions,
31
31
  } = props;
32
32
 
33
33
  const theme = useTheme();
@@ -182,6 +182,16 @@ export const UserFormDetailsUI = (props: any) => {
182
182
  handleChangeInput(phoneNumber, true);
183
183
  };
184
184
 
185
+ const changeCountry = (country : any) => {
186
+ let countryCode = {
187
+ country_code: {
188
+ name: 'country_code',
189
+ value: country.cca2
190
+ }
191
+ }
192
+ handleChangeInput(countryCode, true);
193
+ }
194
+
185
195
  useEffect(() => {
186
196
  if (Object.keys(errors).length > 0) {
187
197
  const list = Object.values(errors);
@@ -315,8 +325,9 @@ export const UserFormDetailsUI = (props: any) => {
315
325
  <PhoneInputNumber
316
326
  data={phoneInputData}
317
327
  handleData={(val: any) => handleChangePhoneNumber(val)}
328
+ changeCountry={(val : any) => changeCountry(val)}
318
329
  defaultValue={phoneUpdate ? '' : user?.cellphone}
319
- defaultCode={user?.country_phone_code || null}
330
+ defaultCode={user?.country_code ?? user?.country_phone_code ?? null}
320
331
  boxStyle={styles.phoneSelect}
321
332
  inputStyle={styles.phoneInputStyle}
322
333
  textStyle={{ color: theme.colors.textNormal, fontSize: 12, padding: 0 }}
@@ -167,7 +167,7 @@ const ProfileListUI = (props: ProfileParams) => {
167
167
  <Actions>
168
168
  <ListItem onPress={() => onRedirect('AddressList', { isFromProfile: true, isGoBack: true })} activeOpacity={0.7}>
169
169
  <OIcon src={theme.images.general.pin} width={16} color={theme.colors.textNormal} style={{ marginEnd: 14 }} />
170
- <OText size={14} lineHeight={24} weight={'400'} color={theme.colors.textNormal}>{t('MY_SAVED_PLACES', 'My saved places')}</OText>
170
+ <OText size={14} lineHeight={24} weight={'400'} color={theme.colors.textNormal}>{t('SAVED_PLACES', 'My saved places')}</OText>
171
171
  </ListItem>
172
172
  <ListItem onPress={() => onRedirect('Messages', { isFromProfile: true, isGoBack: true })} activeOpacity={0.7}>
173
173
  <MessageCircle name='message1' style={styles.messageIconStyle} color={theme.colors.textNormal} />
@@ -8,26 +8,26 @@ export const ORDER_TYPES = [
8
8
  {
9
9
  value: 1,
10
10
  content: 'DELIVERY',
11
- description: 'DELIVERY_DESCRIPTION'
11
+ description: 'ORDERTYPE_DESCRIPTION_DELIVERY'
12
12
  },
13
13
  {
14
14
  value: 2,
15
15
  content: 'PICKUP',
16
- description: 'PICKUP_DESCRIPTION',
16
+ description: 'ORDERTYPE_DESCRIPTION_PICKUP',
17
17
  },
18
18
  {
19
19
  value: 3,
20
20
  content: 'EAT_IN',
21
- description: 'EAT_IN_DESCRIPTION',
21
+ description: 'ORDERTYPE_DESCRIPTION_EATIN',
22
22
  },
23
23
  {
24
24
  value: 4,
25
25
  content: 'CURBSIDE',
26
- description: 'CURBSIDE_DESCRIPTION',
26
+ description: 'ORDERTYPE_DESCRIPTION_CURBSIDE',
27
27
  },
28
28
  {
29
29
  value: 5,
30
30
  content: 'DRIVE_THRU',
31
- description: 'DRIVE_THRU_DESCRIPTION',
31
+ description: 'ORDERTYPE_DESCRIPTION_DRIVETHRU',
32
32
  }
33
- ]
33
+ ]
@@ -120,6 +120,7 @@ export interface PhoneInputParams {
120
120
  flagStyle?: any;
121
121
  isDisabled?: any;
122
122
  isStartValidation?: any;
123
+ changeCountry?: any;
123
124
  }
124
125
 
125
126
  export interface LanguageSelectorParams {
@@ -240,7 +241,11 @@ export interface BusinessProductsListParams {
240
241
  handleCancelSearch?: () => void,
241
242
  categoriesLayout?: any,
242
243
  setCategoriesLayout?: any,
243
- currentCart?: any
244
+ currentCart?: any,
245
+ setSubcategoriesSelected?: any,
246
+ subcategoriesSelected?: any,
247
+ onClickCategory?: any,
248
+ lazyLoadProductsRecommended?: boolean
244
249
  }
245
250
  export interface SingleProductCardParams {
246
251
  businessId: any,
@@ -140,7 +140,7 @@ const AddressListUI = (props: AddressListParams) => {
140
140
  <AddressListContainer>
141
141
  {isProfile && (
142
142
  <NavBar
143
- title={t('MY_SAVED_PLACES', 'My saved places')}
143
+ title={t('SAVED_PLACES', 'My saved places')}
144
144
  titleAlign={'center'}
145
145
  onActionLeft={() => goToBack()}
146
146
  showCall={false}
@@ -154,7 +154,7 @@ const ProfileListUI = (props: ProfileParams) => {
154
154
  <Actions>
155
155
  <ListItem onPress={() => onRedirect('AddressList', { isFromProfile: true, isGoBack: true })} activeOpacity={0.7}>
156
156
  <OIcon src={theme.images.general.pin} width={16} color={theme.colors.textNormal} style={{ marginEnd: 14 }} />
157
- <OText size={14} lineHeight={24} weight={'400'} color={theme.colors.textNormal}>{t('MY_SAVED_PLACES', 'My saved places')}</OText>
157
+ <OText size={14} lineHeight={24} weight={'400'} color={theme.colors.textNormal}>{t('SAVED_PLACES', 'My saved places')}</OText>
158
158
  </ListItem>
159
159
  <ListItem onPress={() => navigation.navigate('Help', {})} activeOpacity={0.7}>
160
160
  <OIcon src={theme.images.general.help} width={16} color={theme.colors.textNormal} style={{ marginEnd: 14 }} />