ordering-ui-react-native 0.22.21 → 0.22.22-release

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 (164) hide show
  1. package/package.json +6 -7
  2. package/src/DeliveryApp.tsx +43 -1
  3. package/src/components/BusinessesListing/index.tsx +1 -1
  4. package/src/components/Checkout/index.tsx +40 -39
  5. package/src/components/StripeMethodForm/index.tsx +4 -2
  6. package/src/components/VerifyPhone/styles.tsx +1 -2
  7. package/src/context/OfflineActions/index.tsx +236 -0
  8. package/src/types/index.tsx +2 -1
  9. package/themes/business/index.tsx +2 -0
  10. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +9 -6
  11. package/themes/business/src/components/AcceptOrRejectOrder/styles.tsx +1 -0
  12. package/themes/business/src/components/BusinessController/index.tsx +8 -3
  13. package/themes/business/src/components/BusinessProductList/index.tsx +3 -2
  14. package/themes/business/src/components/Chat/index.tsx +15 -3
  15. package/themes/business/src/components/DriverMap/index.tsx +49 -26
  16. package/themes/business/src/components/FloatingButton/index.tsx +3 -2
  17. package/themes/business/src/components/GoogleMap/index.tsx +15 -8
  18. package/themes/business/src/components/LanguageSelector/index.tsx +2 -3
  19. package/themes/business/src/components/LanguageSelector/lang_country.json +515 -70
  20. package/themes/business/src/components/LogoutButton/index.tsx +1 -1
  21. package/themes/business/src/components/MapView/index.tsx +36 -17
  22. package/themes/business/src/components/NewOrderNotification/index.tsx +38 -19
  23. package/themes/business/src/components/OrderDetails/Business.tsx +47 -27
  24. package/themes/business/src/components/OrderDetails/Delivery.tsx +134 -53
  25. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +128 -41
  26. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +45 -18
  27. package/themes/business/src/components/OrderDetails/styles.tsx +39 -3
  28. package/themes/business/src/components/OrderDetails/usePrinterCommands.tsx +17 -16
  29. package/themes/business/src/components/OrderDetailsLogistic/index.tsx +3 -2
  30. package/themes/business/src/components/OrderSummary/index.tsx +6 -4
  31. package/themes/business/src/components/OrdersListManager/index.tsx +13 -1
  32. package/themes/business/src/components/OrdersOption/index.tsx +217 -156
  33. package/themes/business/src/components/PhoneInputNumber/index.tsx +8 -5
  34. package/themes/business/src/components/PreviousMessages/index.tsx +26 -3
  35. package/themes/business/src/components/PreviousOrders/OrderItem.tsx +39 -16
  36. package/themes/business/src/components/PreviousOrders/index.tsx +74 -66
  37. package/themes/business/src/components/PrinterEdition/MessageAlert.tsx +33 -0
  38. package/themes/business/src/components/PrinterEdition/index.tsx +431 -0
  39. package/themes/business/src/components/PrinterEdition/printerList.tsx +23 -0
  40. package/themes/business/src/components/PrinterEdition/styles.tsx +61 -0
  41. package/themes/business/src/components/PrinterSettings/index.tsx +162 -174
  42. package/themes/business/src/components/PrinterSettings/styles.tsx +14 -1
  43. package/themes/business/src/components/ProductItemAccordion/index.tsx +3 -2
  44. package/themes/business/src/components/ReviewCustomer/index.tsx +2 -0
  45. package/themes/business/src/components/StoresList/index.tsx +2 -2
  46. package/themes/business/src/components/UserProfileForm/index.tsx +55 -22
  47. package/themes/business/src/components/UserProfileForm/styles.tsx +7 -0
  48. package/themes/business/src/components/WebsocketStatus/index.tsx +2 -2
  49. package/themes/business/src/components/shared/OTextarea.tsx +8 -9
  50. package/themes/business/src/config/currency.tsx +1010 -0
  51. package/themes/business/src/hooks/useLocation.tsx +16 -12
  52. package/themes/business/src/layouts/SafeAreaContainer.tsx +35 -19
  53. package/themes/business/src/types/index.tsx +16 -4
  54. package/themes/business/src/utils/index.tsx +33 -3
  55. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  56. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  57. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  58. package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
  59. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  60. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  61. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
  62. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  63. package/themes/original/index.tsx +11 -0
  64. package/themes/original/src/components/AddressForm/index.tsx +32 -17
  65. package/themes/original/src/components/AddressList/index.tsx +8 -7
  66. package/themes/original/src/components/AppleLogin/index.tsx +4 -4
  67. package/themes/original/src/components/BusinessBasicInformation/index.tsx +5 -8
  68. package/themes/original/src/components/BusinessItemAccordion/index.tsx +13 -5
  69. package/themes/original/src/components/BusinessListingSearch/BusinessSearchFooter.tsx +103 -92
  70. package/themes/original/src/components/BusinessListingSearch/BusinessSearchHeader.tsx +8 -6
  71. package/themes/original/src/components/BusinessListingSearch/index.tsx +1 -2
  72. package/themes/original/src/components/BusinessPreorder/index.tsx +46 -28
  73. package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/index.tsx +73 -70
  74. package/themes/original/src/components/BusinessProductsList/index.tsx +6 -7
  75. package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
  76. package/themes/original/src/components/BusinessProductsListing/index.tsx +10 -6
  77. package/themes/original/src/components/BusinessTypeFilter/index.tsx +9 -8
  78. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +2 -1
  79. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +1 -1
  80. package/themes/original/src/components/BusinessesListing/index.tsx +0 -1
  81. package/themes/original/src/components/Cart/index.tsx +46 -14
  82. package/themes/original/src/components/CartContent/index.tsx +2 -4
  83. package/themes/original/src/components/Checkout/index.tsx +127 -77
  84. package/themes/original/src/components/CitiesControl/index.tsx +0 -3
  85. package/themes/original/src/components/CouponControl/index.tsx +1 -3
  86. package/themes/original/src/components/DriverTips/index.tsx +1 -3
  87. package/themes/original/src/components/Favorite/index.tsx +1 -5
  88. package/themes/original/src/components/FavoriteList/index.tsx +0 -1
  89. package/themes/original/src/components/ForgotPasswordForm/index.tsx +5 -7
  90. package/themes/original/src/components/GiftCard/GiftCardUI/index.tsx +15 -17
  91. package/themes/original/src/components/GiftCard/PurchaseGiftCard/index.tsx +3 -7
  92. package/themes/original/src/components/GiftCard/RedeemGiftCard/index.tsx +24 -32
  93. package/themes/original/src/components/GiftCard/SendGiftCard/index.tsx +7 -9
  94. package/themes/original/src/components/GiftCard/VerticalGiftCardOrdersLayout/index.tsx +11 -12
  95. package/themes/original/src/components/GoogleMap/index.tsx +39 -18
  96. package/themes/original/src/components/Help/index.tsx +2 -0
  97. package/themes/original/src/components/HighestRatedBusinesses/index.tsx +1 -1
  98. package/themes/original/src/components/Home/index.tsx +3 -11
  99. package/themes/original/src/components/LoginForm/Otp/index.tsx +0 -3
  100. package/themes/original/src/components/LoginForm/index.tsx +12 -9
  101. package/themes/original/src/components/MessageListing/index.tsx +2 -1
  102. package/themes/original/src/components/Messages/index.tsx +27 -19
  103. package/themes/original/src/components/MomentOption/TimeListItem.tsx +56 -0
  104. package/themes/original/src/components/MomentOption/index.tsx +80 -51
  105. package/themes/original/src/components/MomentSelector/index.tsx +5 -2
  106. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +7 -3
  107. package/themes/original/src/components/MultiCheckout/index.tsx +55 -27
  108. package/themes/original/src/components/MultiOrdersDetails/index.tsx +1 -0
  109. package/themes/original/src/components/MyOrders/index.tsx +2 -2
  110. package/themes/original/src/components/NavBar/index.tsx +7 -4
  111. package/themes/original/src/components/NetworkError/index.tsx +0 -5
  112. package/themes/original/src/components/NotFoundSource/index.tsx +0 -3
  113. package/themes/original/src/components/OrderDetails/OrderEta.tsx +4 -3
  114. package/themes/original/src/components/OrderDetails/OrderHistory.tsx +16 -11
  115. package/themes/original/src/components/OrderDetails/index.tsx +44 -21
  116. package/themes/original/src/components/OrderDetails/styles.tsx +0 -1
  117. package/themes/original/src/components/OrderProgress/index.tsx +4 -3
  118. package/themes/original/src/components/OrderSummary/index.tsx +29 -10
  119. package/themes/original/src/components/OrderTypeSelector/index.tsx +7 -6
  120. package/themes/original/src/components/OrdersOption/index.tsx +3 -6
  121. package/themes/original/src/components/PaymentOptionStripe/index.tsx +0 -5
  122. package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
  123. package/themes/original/src/components/PaymentOptions/index.tsx +4 -3
  124. package/themes/original/src/components/PhoneInputNumber/index.tsx +92 -7
  125. package/themes/original/src/components/PlaceSpot/index.tsx +1 -3
  126. package/themes/original/src/components/PreviousOrders/index.tsx +1 -2
  127. package/themes/original/src/components/ProductForm/ActionButton.tsx +17 -20
  128. package/themes/original/src/components/ProductForm/index.tsx +107 -102
  129. package/themes/original/src/components/ProductItemAccordion/index.tsx +50 -43
  130. package/themes/original/src/components/ProductItemAccordion/styles.tsx +0 -3
  131. package/themes/original/src/components/ProductOptionSubOption/index.tsx +16 -8
  132. package/themes/original/src/components/ProfessionalProfile/index.tsx +4 -5
  133. package/themes/original/src/components/Promotions/index.tsx +6 -9
  134. package/themes/original/src/components/ReviewDriver/index.tsx +1 -1
  135. package/themes/original/src/components/ReviewOrder/index.tsx +2 -2
  136. package/themes/original/src/components/ReviewProducts/index.tsx +1 -1
  137. package/themes/original/src/components/ReviewTrigger/index.tsx +2 -2
  138. package/themes/original/src/components/ServiceForm/index.tsx +52 -54
  139. package/themes/original/src/components/Sessions/index.tsx +3 -3
  140. package/themes/original/src/components/SignupForm/index.tsx +102 -88
  141. package/themes/original/src/components/SingleOrderCard/index.tsx +6 -4
  142. package/themes/original/src/components/SingleProductCard/index.tsx +5 -5
  143. package/themes/original/src/components/SingleProductCard/styles.tsx +0 -3
  144. package/themes/original/src/components/StripeCardForm/index.tsx +0 -3
  145. package/themes/original/src/components/StripeCardsList/index.tsx +16 -3
  146. package/themes/original/src/components/StripeElementsForm/index.tsx +76 -62
  147. package/themes/original/src/components/StripeElementsForm/naked.tsx +48 -1
  148. package/themes/original/src/components/StripeRedirectForm/index.tsx +0 -3
  149. package/themes/original/src/components/TaxInformation/index.tsx +3 -2
  150. package/themes/original/src/components/UpsellingProducts/UpsellingContent.tsx +10 -7
  151. package/themes/original/src/components/UpsellingProducts/UpsellingLayout.tsx +8 -3
  152. package/themes/original/src/components/UserDetails/index.tsx +17 -16
  153. package/themes/original/src/components/UserFormDetails/index.tsx +164 -135
  154. package/themes/original/src/components/UserProfile/index.tsx +9 -1
  155. package/themes/original/src/components/UserVerification/index.tsx +15 -4
  156. package/themes/original/src/components/Wallets/index.tsx +6 -3
  157. package/themes/original/src/components/WebsocketStatus/index.tsx +1 -4
  158. package/themes/original/src/components/shared/OAlert.tsx +2 -1
  159. package/themes/original/src/components/shared/OButton.tsx +5 -4
  160. package/themes/original/src/components/shared/OInput.tsx +4 -8
  161. package/themes/original/src/components/shared/OModal.tsx +7 -2
  162. package/themes/original/src/types/index.tsx +10 -3
  163. package/themes/original/src/utils/index.tsx +30 -1
  164. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
@@ -16,6 +16,8 @@ import { ListItem } from '../UserProfile/styles';
16
16
  import moment from 'moment';
17
17
  import { DatePickerUI } from '../DatePicker';
18
18
 
19
+ const CONDITIONAL_CODES = ['PR']
20
+
19
21
  export const UserFormDetailsUI = (props: any) => {
20
22
  const {
21
23
  isEdit,
@@ -36,7 +38,12 @@ export const UserFormDetailsUI = (props: any) => {
36
38
  isCheckout,
37
39
  setIsOpen,
38
40
  handleRemoveAccount,
39
- isProfile
41
+ isProfile,
42
+ isGuest,
43
+ isOrderTypeValidationField,
44
+ checkoutFields,
45
+ isCheckoutPlace,
46
+ setCellphoneStartZero
40
47
  } = props;
41
48
 
42
49
  const theme = useTheme();
@@ -95,8 +102,8 @@ export const UserFormDetailsUI = (props: any) => {
95
102
  const [confirm, setConfirm] = useState<any>({ open: false, content: null, handleOnAccept: null, id: null, title: null })
96
103
 
97
104
  const isAdmin = user?.level === 0
98
- const showInputPhoneNumber = (validationFields?.fields?.checkout?.cellphone?.enabled ?? false) || configs?.verification_phone_required?.value === '1'
99
- const showInputBirthday = validationFields?.fields?.checkout?.birthdate?.enabled ?? false
105
+ const showInputPhoneNumber = isOrderTypeValidationField ? checkoutFields?.find(field => field?.validation_field?.code === 'mobile_phone')?.enabled : (validationFields?.fields?.checkout?.cellphone?.enabled ?? false)
106
+ const showInputBirthday = isOrderTypeValidationField ? checkoutFields?.find(field => field?.validation_field?.code === 'birthdate')?.enabled : (validationFields?.fields?.checkout?.birthdate?.enabled ?? false)
100
107
 
101
108
  const handleSuccessSignup = (user: any) => {
102
109
  login({
@@ -127,15 +134,27 @@ export const UserFormDetailsUI = (props: any) => {
127
134
  return rules;
128
135
  };
129
136
 
137
+ const cellphoneValue = () => {
138
+ let cellphone = user?.guest_id ? user?.guest_cellphone : user?.cellphone
139
+ if (cellphone && CONDITIONAL_CODES.includes(user?.country_code)) {
140
+ if (user?.country_code === 'PR') {
141
+ cellphone = user?.cellphone?.slice(3)
142
+ }
143
+ }
144
+ return cellphone
145
+ }
146
+
130
147
  const setUserCellPhone = (isEdit = false) => {
131
148
  if (userPhoneNumber && !userPhoneNumber.includes('null') && !isEdit) {
132
149
  setUserPhoneNumber(userPhoneNumber);
133
150
  return;
134
151
  }
135
- if (user?.cellphone) {
152
+ const cellphone = user?.guest_id ? user?.guest_cellphone : user?.cellphone
153
+
154
+ if (cellphone) {
136
155
  let phone = null;
137
156
  if (user?.country_phone_code) {
138
- phone = `+${user?.country_phone_code} ${user?.cellphone}`;
157
+ phone = `+${user?.country_phone_code} ${cellphone}`;
139
158
  } else {
140
159
  phone = user?.cellphone;
141
160
  }
@@ -144,17 +163,22 @@ export const UserFormDetailsUI = (props: any) => {
144
163
  ...phoneInputData,
145
164
  phone: {
146
165
  country_phone_code: user?.country_phone_code || null,
147
- cellphone: user?.cellphone || null,
166
+ cellphone: cellphoneValue()
148
167
  },
149
168
  });
150
169
  return;
151
170
  }
152
- setUserPhoneNumber(user?.cellphone || '');
171
+ setUserPhoneNumber(cellphone || '');
153
172
  };
154
173
 
155
174
  const onSubmit = () => {
175
+ let content = ''
176
+ if (requiredFields?.includes?.('birthdate') && !birthdate) {
177
+ content = content + `${t('VALIDATION_ERROR_BIRTHDATE_REQUIRED', 'Birthdate is required')}\n`
178
+ }
156
179
  if (phoneInputData.error) {
157
- showToast(ToastType.Error, phoneInputData.error);
180
+ content = content + `${phoneInputData.error}\n`
181
+ showToast(ToastType.Error, content);
158
182
  return;
159
183
  }
160
184
  if (Object.keys(formState.changes).length > 0) {
@@ -162,17 +186,16 @@ export const UserFormDetailsUI = (props: any) => {
162
186
  formState.changes?.cellphone === null &&
163
187
  ((validationFields?.fields?.checkout?.cellphone?.enabled &&
164
188
  validationFields?.fields?.checkout?.cellphone?.required) ||
165
- configs?.verification_phone_required?.value === '1')
189
+ (configs?.verification_phone_required?.value === '1' && !user?.guest_id))
166
190
  ) {
167
- showToast(
168
- ToastType.Error,
169
- t(
170
- 'VALIDATION_ERROR_MOBILE_PHONE_REQUIRED',
171
- 'The field Phone Number is required.',
172
- ),
173
- );
191
+ content = content + `${t('VALIDATION_ERROR_MOBILE_PHONE_REQUIRED', 'The field Phone Number is required.',)}\n`
192
+ showToast(ToastType.Error, content);
174
193
  return;
175
194
  }
195
+ if (content.length > 0) {
196
+ showToast(ToastType.Error, content);
197
+ return
198
+ }
176
199
  let changes = null;
177
200
  if (user?.cellphone && !userPhoneNumber) {
178
201
  changes = {
@@ -185,7 +208,7 @@ export const UserFormDetailsUI = (props: any) => {
185
208
  }
186
209
  };
187
210
 
188
- const handleChangePhoneNumber = (number: any) => {
211
+ const handleChangePhoneNumber = (number: any, rawNumber : any) => {
189
212
  setPhoneInputData(number);
190
213
  setIsChanged(true)
191
214
  let phoneNumber = {
@@ -198,6 +221,7 @@ export const UserFormDetailsUI = (props: any) => {
198
221
  value: number.phone.cellphone,
199
222
  },
200
223
  };
224
+ setCellphoneStartZero && setCellphoneStartZero(rawNumber?.number && rawNumber?.countryCallingCode ? rawNumber?.number : null)
201
225
  handleChangeInput(phoneNumber, true);
202
226
  };
203
227
 
@@ -298,125 +322,135 @@ export const UserFormDetailsUI = (props: any) => {
298
322
  <>
299
323
  <UDForm>
300
324
  {!validationFields?.loading &&
301
- sortInputFields({ values: validationFields?.fields?.checkout })
325
+ sortInputFields({ values: isOrderTypeValidationField ? checkoutFields : validationFields?.fields?.checkout })
302
326
  .length > 0 && (
303
327
  <UDWrapper>
304
328
  {sortInputFields({
305
- values: validationFields.fields?.checkout,
329
+ values: isOrderTypeValidationField ? checkoutFields : validationFields?.fields?.checkout,
306
330
  }).map(
307
- (field: any) =>
308
- showField &&
309
- showField(field.code) && ((requiredFields && requiredFields.includes(field.code)) || !requiredFields) && (
310
- <React.Fragment key={field.id}>
311
- <Controller
312
- key={field.id}
313
- control={control}
314
- render={() => (
315
- <>
316
- <OText size={14} lineHeight={21} color={theme.colors.textNormal} weight={'500'} style={{ textTransform: 'capitalize', alignSelf: 'flex-start' }}>
317
- {t(field?.code?.toUpperCase(), field?.name)}
318
- </OText>
319
- <OInput
320
- name={field.code}
321
- placeholder={t(
322
- field.code.toUpperCase(),
323
- field?.name,
324
- )}
325
- inputStyle={styles.inputStyle}
326
- style={{ paddingLeft: 0, paddingRight: 0, marginTop: 6, height: 44, minHeight: 44 }}
327
- autoCapitalize={
328
- field.code === 'email' ? 'none' : 'sentences'
329
- }
330
- isDisabled={false}
331
- value={
332
- formState?.changes[field.code] ??
333
- (user && user[field.code]) ??
334
- ''
335
- }
336
- onChange={(val: any) => {
337
- field.code !== 'email'
338
- ? setValue(field.code, val.target.value)
339
- : setValue(
340
- field.code,
341
- val.target.value
342
- .toLowerCase()
343
- .replace(
344
- /[&,()%";:ç?<>{}\\[\]\s]/g,
345
- '',
346
- ),
347
- );
348
- field.code !== 'email'
349
- ? handleChangeInput(val)
350
- : handleChangeInput({
351
- target: {
352
- name: 'email',
353
- value: val.target.value
331
+ (item: any) => {
332
+ const field = item?.validation_field || item
333
+ return (
334
+ ((isOrderTypeValidationField ? item?.enabled : (showField && showField(field.code))) && ((requiredFields && requiredFields?.includes?.(field.code)) || !requiredFields || !isCheckoutPlace)) && (
335
+ <React.Fragment key={field.id}>
336
+ <Controller
337
+ key={field.id}
338
+ control={control}
339
+ render={() => (
340
+ <>
341
+ <OText size={14} lineHeight={21} color={theme.colors.textNormal} weight={'500'} style={{ textTransform: 'capitalize', alignSelf: 'flex-start' }}>
342
+ {t(field?.code?.toUpperCase(), field?.name)}
343
+ </OText>
344
+ <OInput
345
+ name={field.code}
346
+ placeholder={t(
347
+ field.code.toUpperCase(),
348
+ field?.name,
349
+ )}
350
+ inputStyle={styles.inputStyle}
351
+ style={{ paddingLeft: 0, paddingRight: 0, marginTop: 6, height: 44, minHeight: 44 }}
352
+ autoCapitalize={
353
+ field.code === 'email' ? 'none' : 'sentences'
354
+ }
355
+ isDisabled={false}
356
+ value={
357
+ formState?.changes[field.code] ??
358
+ (user && user?.guest_id && field.code === 'email' ? user?.guest_email : user[field.code]) ??
359
+ ''
360
+ }
361
+ onChange={(val: any) => {
362
+ field.code !== 'email'
363
+ ? setValue(field.code, val.target.value)
364
+ : setValue(
365
+ field.code,
366
+ val.target.value
354
367
  .toLowerCase()
355
368
  .replace(
356
369
  /[&,()%";:ç?<>{}\\[\]\s]/g,
357
370
  '',
358
371
  ),
359
- },
360
- });
361
- }}
362
- autoCorrect={field.code === 'email' && false}
363
- type={
364
- field.code === 'email'
365
- ? 'email-address'
366
- : 'default'
367
- }
368
- returnKeyType="done"
369
- autoCompleteType={
370
- field.code === 'email' ? 'email' : 'off'
371
- }
372
- />
373
- </>
374
- )}
375
- name={field.code}
376
- rules={getInputRules(field)}
377
- defaultValue={user && user[field.code]}
378
- />
379
- </React.Fragment>
380
- ),
381
- )}
382
- {showInputBirthday && (
383
- <WrapperBirthdate>
384
- <OText size={14} lineHeight={21} color={theme.colors.textNormal} weight={'500'} style={{ textTransform: 'capitalize', alignSelf: 'flex-start' }}>
385
- {t('BIRTHDATE', 'Birthdate')}
386
- </OText>
387
- <TouchableOpacity onPress={() => setShowDatePicker(!showDatePicker)}>
388
- <OText size={14} lineHeight={21} color={theme.colors.textNormal} weight={'500'} style={{ marginTop: 6, marginBottom: -15 }}>
389
- {birthdate ? moment(birthdate).format('YYYY-MM-DD') : ''}
390
- </OText>
391
- </TouchableOpacity>
392
- <DatePickerUI open={showDatePicker} birthdate={birthdate} onConfirm={_handleChangeDate} onCancel={() => setShowDatePicker(false)} />
393
- </WrapperBirthdate>
394
- )}
395
- {!!showInputPhoneNumber && ((requiredFields && requiredFields.includes('cellphone')) || !requiredFields) && (
396
- <WrapperPhone>
397
- <OText size={14} lineHeight={21} weight={'500'} color={theme.colors.textNormal}>{t('PHONE', 'Phone')}</OText>
398
- <PhoneInputNumber
399
- data={phoneInputData}
400
- handleData={(val: any) => handleChangePhoneNumber(val)}
401
- changeCountry={(val: any) => changeCountry(val)}
402
- defaultValue={phoneUpdate ? '' : user?.cellphone}
403
- defaultCode={user?.country_code ?? user?.country_phone_code ?? null}
404
- boxStyle={styles.phoneSelect}
405
- inputStyle={styles.phoneInputStyle}
406
- textStyle={{ color: theme.colors.textNormal, fontSize: 12, padding: 0 }}
407
- noDropIcon
408
- />
409
- {phoneUpdate && (
410
- <OText
411
- size={10}
412
- color={theme.colors.error}
413
- style={{ marginHorizontal: 10, textAlign: 'center' }}>
414
- {t('YOUR_PREVIOUS_CELLPHONE', 'Your previous cellphone')}:{' '}
415
- {user?.cellphone}
416
- </OText>
417
- )}
418
- </WrapperPhone>
372
+ );
373
+ field.code !== 'email'
374
+ ? handleChangeInput(val)
375
+ : handleChangeInput({
376
+ target: {
377
+ name: 'email',
378
+ value: val.target.value
379
+ .toLowerCase()
380
+ .replace(
381
+ /[&,()%";:ç?<>{}\\[\]\s]/g,
382
+ '',
383
+ ),
384
+ },
385
+ });
386
+ }}
387
+ autoCorrect={field.code === 'email' && false}
388
+ type={
389
+ field.code === 'email'
390
+ ? 'email-address'
391
+ : 'default'
392
+ }
393
+ returnKeyType="done"
394
+ autoCompleteType={
395
+ field.code === 'email' ? 'email' : 'off'
396
+ }
397
+ />
398
+ </>
399
+ )}
400
+ name={field.code}
401
+ rules={getInputRules(field)}
402
+ defaultValue={user && (field.code === 'email' && user?.guest_id ? user?.guest_email : user[field.code])}
403
+ />
404
+ </React.Fragment>
405
+ ))
406
+ },
419
407
  )}
408
+ {((!user?.guest_id && showInputBirthday) || (isOrderTypeValidationField || user?.guest_id)) &&
409
+ showInputBirthday &&
410
+ ((requiredFields && requiredFields?.includes?.('birthdate')) || !requiredFields || !isCheckoutPlace) &&
411
+ (
412
+ <>
413
+ <WrapperBirthdate>
414
+ <OText size={14} lineHeight={21} color={theme.colors.textNormal} weight={'500'} style={{ textTransform: 'capitalize', alignSelf: 'flex-start' }}>
415
+ {t('BIRTHDATE', 'Birthdate')}
416
+ </OText>
417
+ <TouchableOpacity onPress={() => setShowDatePicker(!showDatePicker)}>
418
+ <OText size={14} lineHeight={21} color={theme.colors.textNormal} weight={'500'} style={{ marginTop: 6 }}>
419
+ {birthdate ? moment(birthdate).format('YYYY-MM-DD') : ''}
420
+ </OText>
421
+ </TouchableOpacity>
422
+ </WrapperBirthdate>
423
+ <DatePickerUI open={showDatePicker} birthdate={birthdate} onConfirm={_handleChangeDate} onCancel={() => setShowDatePicker(false)} />
424
+ </>
425
+ )}
426
+ {((!user?.guest_id && !!showInputPhoneNumber) || (isOrderTypeValidationField || user?.guest_id)) &&
427
+ ((requiredFields && requiredFields?.includes?.('cellphone')) || !requiredFields || !isCheckoutPlace) &&
428
+ (
429
+ <WrapperPhone>
430
+ <OText size={14} lineHeight={21} weight={'500'} color={theme.colors.textNormal}>{t('PHONE', 'Phone')}</OText>
431
+ <PhoneInputNumber
432
+ data={phoneInputData}
433
+ handleData={handleChangePhoneNumber}
434
+ changeCountry={(val: any) => changeCountry(val)}
435
+ defaultValue={phoneUpdate ? '' : cellphoneValue()}
436
+ defaultCode={user?.country_code ?? user?.country_phone_code ?? null}
437
+ defaultCodeFallback={user?.country_phone_code}
438
+ boxStyle={styles.phoneSelect}
439
+ inputStyle={styles.phoneInputStyle}
440
+ textStyle={{ color: theme.colors.textNormal, fontSize: 12, padding: 0 }}
441
+ noDropIcon
442
+ />
443
+ {phoneUpdate && (
444
+ <OText
445
+ size={10}
446
+ color={theme.colors.error}
447
+ style={{ marginHorizontal: 10, textAlign: 'center' }}>
448
+ {t('YOUR_PREVIOUS_CELLPHONE', 'Your previous cellphone')}:{' '}
449
+ {cellphoneValue()}
450
+ </OText>
451
+ )}
452
+ </WrapperPhone>
453
+ )}
420
454
  {!requiredFields && (
421
455
  <Controller
422
456
  control={control}
@@ -480,9 +514,7 @@ export const UserFormDetailsUI = (props: any) => {
480
514
  ? t('UPDATING', 'Updating...')
481
515
  : t('UPDATE', 'Update')
482
516
  }
483
- bgColor={theme.colors.primary}
484
- textStyle={{ color: theme.colors.white, fontSize: 14 }}
485
- borderColor={theme.colors.primary}
517
+ textStyle={{ fontSize: 14 }}
486
518
  isDisabled={formState.loading}
487
519
  imgRightSrc={null}
488
520
  style={{ borderRadius: 7.6, shadowOpacity: 0, width: '100%', borderWidth: 1, marginTop: 20, marginBottom: 20 }}
@@ -491,7 +523,7 @@ export const UserFormDetailsUI = (props: any) => {
491
523
  )}
492
524
  </>
493
525
  )}
494
- {requiredFields && (
526
+ {isCheckoutPlace && (
495
527
  <OButton
496
528
  text={
497
529
  formState.loading
@@ -500,12 +532,10 @@ export const UserFormDetailsUI = (props: any) => {
500
532
  ? t('SIGN_UP_AND_PLACE_ORDER', 'Sign up and place order')
501
533
  : t('CONTINUE', 'Continue'))
502
534
  }
503
- bgColor={theme.colors.primary}
504
535
  textStyle={{
505
536
  color: !user?.guest_id && (formState.loading || !isValid) ? theme.colors.primary : theme.colors.white,
506
537
  fontSize: 14
507
538
  }}
508
- borderColor={theme.colors.primary}
509
539
  isDisabled={!user?.guest_id && (formState.loading || !isValid)}
510
540
  imgRightSrc={null}
511
541
  style={{
@@ -519,10 +549,10 @@ export const UserFormDetailsUI = (props: any) => {
519
549
  borderColor: !user?.guest_id && (formState.loading || !isValid) ? theme.colors.white : theme.colors.primary,
520
550
  opacity: !user?.guest_id && (formState.loading || !isValid) ? 0.3 : 1,
521
551
  }}
522
- onClick={!user?.guest_id ? handleSubmit(onSubmit) : () => setIsModalOpen(true)}
552
+ onClick={handleSubmit(onSubmit)}
523
553
  />
524
554
  )}
525
- {isCheckout && !!user?.guest_id && (
555
+ {isCheckout && !!user?.guest_id && !requiredFields && (
526
556
  <TouchableOpacity style={{ marginTop: 10 }} onPress={() => handlePlaceOrderAsGuest()}>
527
557
  <OText color={theme.colors.primary} style={{ textAlign: 'center' }}>{t('PLACE_ORDER_AS_GUEST', 'Place order as guest')}</OText>
528
558
  </TouchableOpacity>
@@ -552,4 +582,3 @@ export const UserFormDetailsUI = (props: any) => {
552
582
  </>
553
583
  );
554
584
  };
555
-
@@ -44,6 +44,7 @@ const ProfileListUI = (props: ProfileParams) => {
44
44
  handleRemoveAccount,
45
45
  removeAccountState,
46
46
  handleChangePromotions,
47
+ appVersion
47
48
  } = props;
48
49
 
49
50
  const theme = useTheme();
@@ -151,7 +152,7 @@ const ProfileListUI = (props: ProfileParams) => {
151
152
  const detailProps = {
152
153
  goToBack: () => props.navigation?.canGoBack() && props.navigation.goBack(),
153
154
  onNavigationRedirect: (route: string, params: any) => props.navigation.navigate(route, params),
154
- handleRemoveAccount
155
+ handleRemoveAccount,
155
156
  }
156
157
 
157
158
  useEffect(() => {
@@ -271,6 +272,13 @@ const ProfileListUI = (props: ProfileParams) => {
271
272
  </Actions>
272
273
  </ListWrap>
273
274
  <WebsocketStatus />
275
+ {appVersion && (
276
+ <View
277
+ style={{ alignItems: 'center' }}
278
+ >
279
+ <OText>v{appVersion}</OText>
280
+ </View>
281
+ )}
274
282
  <OAlert
275
283
  open={confirm.open}
276
284
  title={confirm.title}
@@ -37,6 +37,7 @@ import {
37
37
  WrapperActions
38
38
  } from './styles'
39
39
 
40
+ const CONDITIONAL_CODES = [1787]
40
41
  const TIME_COUNTDOWN = 60 * 10 // 10 minutes
41
42
 
42
43
  const UserDetails = (props: any) => {
@@ -176,9 +177,18 @@ const UserVerificationUI = (props: any) => {
176
177
  setTimer(`${TIME_COUNTDOWN / 60}:00`)
177
178
  setIsSendCodeAgain(true)
178
179
  if (opt === 'phone') {
180
+ let cellphone = phoneState?.cellphone
181
+ let country_phone_code = phoneState?.country_phone_code
182
+
183
+ if (CONDITIONAL_CODES.includes(Number(country_phone_code))) {
184
+ if (Number(country_phone_code) === 1787) {
185
+ cellphone = `787${cellphone}`
186
+ country_phone_code = '1'
187
+ }
188
+ }
179
189
  sendVerifyPhoneCode({
180
- cellphone: phoneState?.cellphone,
181
- country_phone_code: phoneState?.country_phone_code
190
+ cellphone,
191
+ country_phone_code
182
192
  })
183
193
  return
184
194
  }
@@ -188,8 +198,8 @@ const UserVerificationUI = (props: any) => {
188
198
  const setupUserPhoneNumber = () => {
189
199
  if (!user || !user?.cellphone || !user?.country_phone_code) return
190
200
  setPhoneState({
191
- cellphone: user?.cellphone,
192
- country_phone_code: user?.country_phone_code,
201
+ cellphone: user?.country_code === "PR" ? user?.cellphone.replace('787', '') : user?.cellphone,
202
+ country_phone_code: user?.country_code === "PR" ? '1787' : user?.country_phone_code,
193
203
  formatted: `+${user?.country_phone_code} ${user?.cellphone}`
194
204
  })
195
205
  }
@@ -399,6 +409,7 @@ const UserVerificationUI = (props: any) => {
399
409
  defaultCode={phoneState?.country_phone_code.replace('+', '')}
400
410
  boxStyle={style.phoneSelect}
401
411
  inputStyle={style.phoneInputStyle}
412
+ defaultCodeFallback={phoneState?.country_phone_code.replace('+', '')}
402
413
  textStyle={{ color: theme.colors.textNormal, fontSize: 12, padding: 0 }}
403
414
  noDropIcon
404
415
  isDisabled
@@ -141,6 +141,11 @@ const WalletsUI = (props: any) => {
141
141
  btnStyle={{ paddingLeft: 0 }}
142
142
  isVertical={!hideWalletsTheme}
143
143
  hideArrowLeft={!hideWalletsTheme}
144
+ buttonProps={{
145
+ bgColor: theme.colors.white,
146
+ borderColor: theme.colors.white,
147
+ textStyle: { color: theme.colors.btnFont }
148
+ }}
144
149
  />
145
150
  {isChewLayout && !openHistory && (
146
151
  <OButton
@@ -304,13 +309,11 @@ const WalletsUI = (props: any) => {
304
309
  borderWidth: 0,
305
310
  width: 26,
306
311
  height: 26,
307
- backgroundColor: '#FFF',
308
- borderColor: '#FFF',
309
- shadowColor: '#FFF',
310
312
  paddingLeft: 0,
311
313
  paddingRight: 0,
312
314
  marginBottom: 10
313
315
  }}
316
+ useArrow
314
317
  onClick={() => setOpenHistory(false)}
315
318
  icon={AntDesignIcon}
316
319
  iconProps={{
@@ -143,15 +143,12 @@ const SocketStatusUI = (props: any) => {
143
143
  <OButton
144
144
  onClick={() => setOpenModal(false)}
145
145
  bgColor={theme.colors.white}
146
- borderColor={theme.colors.primary}
147
146
  textStyle={{ color: theme.colors.primary }}
148
147
  style={{ borderRadius: 8, height: 48 }}
149
148
  text={t('CLOSE', 'Close')}
150
149
  />
151
- <OButton
150
+ <OButton
152
151
  onClick={() => RNRestart.Restart()}
153
- borderColor={theme.colors.primary}
154
- textStyle={{ color: theme.colors.white }}
155
152
  style={{ borderRadius: 8, marginLeft: 16, height: 48 }}
156
153
  text={t('UPDATE', 'Update')}
157
154
  />
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react'
2
2
  import styled, { css } from 'styled-components/native'
3
- import { Alert } from 'react-native'
3
+ import { Alert, Vibration } from 'react-native'
4
4
  import { useLanguage } from 'ordering-components/native'
5
5
 
6
6
  const Wrapper = styled.TouchableOpacity`
@@ -41,6 +41,7 @@ const OAlert = (props: Props) => {
41
41
  }
42
42
 
43
43
  const handleClick = () => {
44
+ Vibration.vibrate(100)
44
45
  props.onClick && props.onClick()
45
46
  createTwoButtonAlert()
46
47
  }
@@ -85,6 +85,7 @@ interface Props {
85
85
  isDisabledWithSameStyles?: boolean;
86
86
  icon?: any;
87
87
  iconProps?: any
88
+ useArrow?: boolean;
88
89
  }
89
90
 
90
91
  const OButton = (props: Props): React.ReactElement => {
@@ -94,8 +95,8 @@ const OButton = (props: Props): React.ReactElement => {
94
95
  if (props.isDisabled) {
95
96
  return (
96
97
  <View style={props.parentStyle}>
97
- <StyledButtonDisabled style={props.style}>
98
- <StyledTextDisabled style={props.textStyle}>
98
+ <StyledButtonDisabled style={{ ...props.style, backgroundColor: theme.colors.disabled }}>
99
+ <StyledTextDisabled style={{ ...props.textStyle, color: theme.colors.backgroundGray200 }}>
99
100
  {props.text}
100
101
  </StyledTextDisabled>
101
102
  </StyledButtonDisabled>
@@ -119,7 +120,7 @@ const OButton = (props: Props): React.ReactElement => {
119
120
  style={{ width: props.isCircle ? 52 : props.style?.width, ...props.parentStyle }}
120
121
  disabled={props.isDisabledWithSameStyles}
121
122
  >
122
- <StyledButton style={{ ...props.style, backgroundColor: theme?.general?.components?.buttons?.color ?? props.bgColor, borderColor: theme?.general?.components?.buttons?.color ?? props.borderColor, borderRadius: parseInt(theme?.general?.components?.buttons?.borderRadius) || props.style?.borderRadius }}>
123
+ <StyledButton style={{ ...props.style, backgroundColor: props.useArrow ? theme.colors.white : props.bgColor ?? theme.colors.primary, borderColor: props.useArrow ? theme.colors.white : props.borderColor ?? theme.colors.primary, borderRadius: props.style?.borderRadius }}>
123
124
  {props.icon ? (
124
125
  <props.icon {...props.iconProps} />
125
126
  ) : null}
@@ -127,7 +128,7 @@ const OButton = (props: Props): React.ReactElement => {
127
128
  <OIcon style={props.imgLeftStyle} src={props.imgLeftSrc} color={theme.colors.textNormal} />
128
129
  ) : null}
129
130
  {props.text ? (
130
- <StyledText style={{ ...props.textStyle, color: theme?.general?.components?.buttons?.buttonTextColor ?? props?.textStyle?.color }}>{props.text}</StyledText>
131
+ <StyledText style={{ ...props.textStyle, color: props.useArrow ? theme.colors.btnFont : props?.textStyle?.color ?? theme.colors.white }}>{props.text}</StyledText>
131
132
  ) : null}
132
133
  {props.imgRightSrc ? (
133
134
  <EndImage style={props.imgRightStyle} source={props.imgRightSrc} />
@@ -3,7 +3,7 @@ import { ImageSourcePropType, ImageStyle, ViewStyle, TextInputProps, TextStyle }
3
3
  import styled from 'styled-components/native';
4
4
  import OIcon from './OIcon';
5
5
  import MaterialIcon from 'react-native-vector-icons/MaterialIcons'
6
- import { useTheme, css } from 'styled-components/native';
6
+ import { useTheme } from 'styled-components/native';
7
7
 
8
8
  const Input = styled.TextInput`
9
9
  flex-grow: 1;
@@ -53,9 +53,6 @@ const Wrapper = styled.Pressable`
53
53
  align-items: center;
54
54
  justify-content: center;
55
55
  width: 100%;
56
- ${(props: any) => props?.borderRadius && css`
57
- border-radius: ${typeof props?.borderRadius === 'string' ? props?.borderRadius : `${props?.borderRadius}px`};
58
- `}
59
56
  `;
60
57
 
61
58
  const OInput = (props: Props): React.ReactElement => {
@@ -70,7 +67,6 @@ const OInput = (props: Props): React.ReactElement => {
70
67
  ? props.borderColor
71
68
  : inputFocused ? theme.colors.primary : theme.colors.border,
72
69
  ...props.style,
73
- borderRadius: parseInt(theme?.general?.components?.inputs?.borderRadius) || props.style?.borderRadius
74
70
  }}>
75
71
  {props.icon ? (
76
72
  <OIcon
@@ -105,9 +101,9 @@ const OInput = (props: Props): React.ReactElement => {
105
101
  props.forwardRef && (props.forwardRef.current = e)
106
102
  }}
107
103
  style={{
108
- ...(theme?.general?.components?.inputs?.color && {
109
- color: theme?.general?.components?.inputs?.color
110
- }),
104
+ ...(theme?.general?.components?.inputs?.color && {
105
+ color: theme?.general?.components?.inputs?.color
106
+ }),
111
107
  ...props?.inputStyle
112
108
  }}
113
109
  onFocus={() => setInputFocused(true)}