ordering-ui-react-native 0.15.11 → 0.15.13-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 (147) hide show
  1. package/package.json +5 -3
  2. package/src/DeliveryApp.tsx +43 -1
  3. package/src/components/BusinessTypeFilter/index.tsx +12 -2
  4. package/src/components/BusinessTypeFilter/styles.tsx +1 -1
  5. package/src/components/BusinessesListing/index.tsx +1 -1
  6. package/src/components/Checkout/index.tsx +0 -1
  7. package/src/components/LanguageSelector/index.tsx +1 -0
  8. package/src/components/OrderDetails/index.tsx +26 -5
  9. package/src/components/PaymentOptions/index.tsx +9 -16
  10. package/src/components/PaymentOptionsWebView/index.tsx +123 -124
  11. package/src/components/ProductForm/index.tsx +1 -1
  12. package/src/components/ProductForm/styles.tsx +1 -0
  13. package/src/components/StripeElementsForm/index.tsx +27 -48
  14. package/src/components/VerifyPhone/styles.tsx +1 -2
  15. package/src/config.json +0 -2
  16. package/src/navigators/HomeNavigator.tsx +6 -0
  17. package/src/pages/BusinessProductsList.tsx +1 -0
  18. package/src/pages/BusinessesListing.tsx +1 -1
  19. package/src/pages/Checkout.tsx +1 -1
  20. package/src/pages/Sessions.tsx +22 -0
  21. package/src/types/index.tsx +1 -9
  22. package/themes/business/index.tsx +2 -0
  23. package/themes/business/src/components/Chat/index.tsx +3 -2
  24. package/themes/business/src/components/Home/index.tsx +128 -55
  25. package/themes/business/src/components/Home/styles.tsx +8 -1
  26. package/themes/business/src/components/NewOrderNotification/index.tsx +59 -98
  27. package/themes/business/src/components/OrderDetails/Business.tsx +2 -1
  28. package/themes/business/src/components/OrderDetails/Delivery.tsx +9 -9
  29. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +150 -89
  30. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +91 -17
  31. package/themes/business/src/components/OrderDetails/styles.tsx +7 -0
  32. package/themes/business/src/components/OrdersListManager/index.tsx +874 -0
  33. package/themes/business/src/components/OrdersListManager/styles.tsx +123 -0
  34. package/themes/business/src/components/OrdersListManager/utils.tsx +216 -0
  35. package/themes/business/src/components/OrdersOption/index.tsx +70 -116
  36. package/themes/business/src/components/OrdersOption/styles.tsx +2 -5
  37. package/themes/business/src/components/PreviousOrders/index.tsx +82 -23
  38. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  39. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  40. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  41. package/themes/kiosk/src/components/BusinessController/index.tsx +27 -6
  42. package/themes/kiosk/src/components/BusinessController/styles.tsx +1 -1
  43. package/themes/kiosk/src/components/BusinessProductsListing/index.tsx +48 -21
  44. package/themes/kiosk/src/components/Cart/index.tsx +98 -24
  45. package/themes/kiosk/src/components/Cart/styles.tsx +6 -0
  46. package/themes/kiosk/src/components/CartBottomSheet/index.tsx +1 -1
  47. package/themes/kiosk/src/components/CartBottomSheet/styles.tsx +1 -1
  48. package/themes/kiosk/src/components/CartContent/index.tsx +13 -3
  49. package/themes/kiosk/src/components/CartItem/index.tsx +20 -8
  50. package/themes/kiosk/src/components/CategoriesMenu/index.tsx +6 -5
  51. package/themes/kiosk/src/components/CustomerName/index.tsx +89 -88
  52. package/themes/kiosk/src/components/Intro/index.tsx +13 -13
  53. package/themes/kiosk/src/components/LanguageSelector/index.tsx +12 -8
  54. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  55. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  56. package/themes/kiosk/src/components/OrderDetails/index.tsx +136 -41
  57. package/themes/kiosk/src/components/OrderDetails/styles.tsx +5 -0
  58. package/themes/kiosk/src/components/OrderSummary/index.tsx +1 -1
  59. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +10 -12
  60. package/themes/kiosk/src/components/ProductForm/index.tsx +174 -125
  61. package/themes/kiosk/src/components/ProductForm/styles.tsx +1 -1
  62. package/themes/kiosk/src/components/ProductOption/index.tsx +1 -0
  63. package/themes/kiosk/src/components/ProductOption/styles.tsx +1 -0
  64. package/themes/kiosk/src/components/UpsellingProducts/index.tsx +48 -34
  65. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  66. package/themes/kiosk/src/components/shared/OCard.tsx +112 -78
  67. package/themes/kiosk/src/types/index.d.ts +2 -0
  68. package/themes/original/index.tsx +179 -0
  69. package/themes/original/src/components/AddressForm/index.tsx +15 -10
  70. package/themes/original/src/components/AddressList/index.tsx +28 -2
  71. package/themes/original/src/components/AppleLogin/index.tsx +119 -78
  72. package/themes/original/src/components/BusinessBasicInformation/index.tsx +96 -45
  73. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +28 -1
  74. package/themes/original/src/components/BusinessController/index.tsx +52 -22
  75. package/themes/original/src/components/BusinessController/styles.tsx +22 -0
  76. package/themes/original/src/components/BusinessFeaturedController/index.tsx +20 -1
  77. package/themes/original/src/components/BusinessFeaturedController/styles.tsx +23 -0
  78. package/themes/original/src/components/BusinessListingSearch/index.tsx +4 -0
  79. package/themes/original/src/components/BusinessMenuList/index.tsx +11 -4
  80. package/themes/original/src/components/BusinessPreorder/index.tsx +141 -121
  81. package/themes/original/src/components/BusinessProductsCategories/index.tsx +7 -5
  82. package/themes/original/src/components/BusinessProductsList/index.tsx +129 -22
  83. package/themes/original/src/components/BusinessProductsList/styles.tsx +29 -2
  84. package/themes/original/src/components/BusinessProductsListing/index.tsx +92 -37
  85. package/themes/original/src/components/BusinessProductsListing/styles.tsx +22 -0
  86. package/themes/original/src/components/BusinessReviews/index.tsx +4 -25
  87. package/themes/original/src/components/BusinessesListing/index.tsx +40 -53
  88. package/themes/original/src/components/Cart/index.tsx +41 -10
  89. package/themes/original/src/components/CartContent/index.tsx +2 -2
  90. package/themes/original/src/components/Checkout/index.tsx +23 -27
  91. package/themes/original/src/components/CouponControl/index.tsx +1 -0
  92. package/themes/original/src/components/DriverTips/index.tsx +1 -1
  93. package/themes/original/src/components/ForgotPasswordForm/index.tsx +8 -12
  94. package/themes/original/src/components/HighestRatedBusinesses/index.tsx +97 -89
  95. package/themes/original/src/components/Home/index.tsx +1 -1
  96. package/themes/original/src/components/LoginForm/index.tsx +156 -70
  97. package/themes/original/src/components/LoginForm/styles.tsx +6 -1
  98. package/themes/original/src/components/Messages/index.tsx +50 -45
  99. package/themes/original/src/components/Messages/styles.tsx +1 -3
  100. package/themes/original/src/components/MomentOption/index.tsx +10 -1
  101. package/themes/original/src/components/MomentOption/styles.tsx +1 -1
  102. package/themes/original/src/components/OrderDetails/index.tsx +105 -127
  103. package/themes/original/src/components/OrderDetails/styles.tsx +3 -1
  104. package/themes/original/src/components/OrderProgress/index.tsx +4 -4
  105. package/themes/original/src/components/OrderProgress/styles.tsx +1 -0
  106. package/themes/original/src/components/OrderSummary/index.tsx +35 -2
  107. package/themes/original/src/components/OrderTypeSelector/index.tsx +1 -1
  108. package/themes/original/src/components/OrdersOption/index.tsx +15 -46
  109. package/themes/original/src/components/OrdersOption/styles.tsx +0 -6
  110. package/themes/original/src/components/PaymentOptionWallet/index.tsx +6 -2
  111. package/themes/original/src/components/PaymentOptions/index.tsx +24 -25
  112. package/themes/original/src/components/PhoneInputNumber/index.tsx +15 -8
  113. package/themes/original/src/components/PlaceSpot/index.tsx +114 -0
  114. package/themes/original/src/components/PlaceSpot/styles.tsx +11 -0
  115. package/themes/original/src/components/PreviousOrders/index.tsx +19 -13
  116. package/themes/original/src/components/ProductForm/index.tsx +47 -36
  117. package/themes/original/src/components/ProductForm/styles.tsx +2 -2
  118. package/themes/original/src/components/Promotions/index.tsx +233 -0
  119. package/themes/original/src/components/Promotions/styles.tsx +58 -0
  120. package/themes/original/src/components/ReviewOrder/index.tsx +10 -9
  121. package/themes/original/src/components/ReviewProducts/index.tsx +1 -1
  122. package/themes/original/src/components/Sessions/index.tsx +160 -0
  123. package/themes/original/src/components/Sessions/styles.tsx +15 -0
  124. package/themes/original/src/components/SignupForm/index.tsx +173 -154
  125. package/themes/original/src/components/SingleProductCard/index.tsx +39 -18
  126. package/themes/original/src/components/SingleProductCard/styles.tsx +28 -1
  127. package/themes/original/src/components/StripeElementsForm/index.tsx +55 -72
  128. package/themes/original/src/components/TaxInformation/index.tsx +17 -7
  129. package/themes/original/src/components/UpsellingProducts/index.tsx +6 -6
  130. package/themes/original/src/components/UserDetails/index.tsx +4 -95
  131. package/themes/original/src/components/UserFormDetails/index.tsx +2 -14
  132. package/themes/original/src/components/UserProfile/index.tsx +29 -17
  133. package/themes/original/src/components/UserProfileForm/index.tsx +8 -6
  134. package/themes/original/src/components/VerifyPhone/index.tsx +10 -7
  135. package/themes/original/src/components/VerifyPhone/styles.tsx +2 -1
  136. package/themes/original/src/components/Wallets/index.tsx +58 -4
  137. package/themes/original/src/components/Wallets/styles.tsx +21 -0
  138. package/themes/original/src/components/shared/HeaderTitle.tsx +21 -0
  139. package/themes/original/src/components/shared/index.tsx +2 -0
  140. package/themes/original/src/config/constants.tsx +6 -6
  141. package/themes/original/src/types/index.tsx +70 -23
  142. package/themes/original/src/utils/index.tsx +12 -2
  143. package/themes/single-business/src/components/AddressList/index.tsx +1 -1
  144. package/themes/single-business/src/components/OrderTypeSelector/index.tsx +6 -6
  145. package/themes/single-business/src/components/UserProfile/index.tsx +1 -1
  146. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
  147. package/src/components/StripeMethodForm/index.tsx +0 -168
@@ -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')}
@@ -4,6 +4,7 @@ import Spinner from 'react-native-loading-spinner-overlay';
4
4
  import { useForm, Controller } from 'react-hook-form';
5
5
  import { PhoneInputNumber } from '../PhoneInputNumber';
6
6
  import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons';
7
+ import Recaptcha from 'react-native-recaptcha-that-works'
7
8
 
8
9
  import {
9
10
  LoginForm as LoginFormController,
@@ -18,7 +19,6 @@ import { FacebookLogin } from '../FacebookLogin';
18
19
  import { VerifyPhone } from '../../../../../src/components/VerifyPhone';
19
20
  import { OModal } from '../../../../../src/components/shared';
20
21
 
21
-
22
22
  import {
23
23
  Container,
24
24
  ButtonsWrapper,
@@ -32,6 +32,7 @@ import {
32
32
  LineSeparator,
33
33
  SkeletonWrapper,
34
34
  TabBtn,
35
+ RecaptchaButton
35
36
  } from './styles';
36
37
 
37
38
  import NavBar from '../NavBar';
@@ -60,14 +61,16 @@ const LoginFormUI = (props: LoginParams) => {
60
61
  handleSendVerifyCode,
61
62
  handleCheckPhoneCode,
62
63
  onNavigationRedirect,
63
- notificationState
64
+ notificationState,
65
+ handleReCaptcha,
66
+ enableReCaptcha
64
67
  } = props;
65
68
 
66
69
  const [, { showToast }] = useToast();
67
70
  const [, t] = useLanguage();
68
71
  const [{ configs }] = useConfig();
69
72
  const [, { login }] = useSession();
70
- const { control, handleSubmit, errors } = useForm();
73
+ const { control, handleSubmit, errors, reset, register, setValue } = useForm();
71
74
  const [passwordSee, setPasswordSee] = useState(false);
72
75
  const [isLoadingVerifyModal, setIsLoadingVerifyModal] = useState(false);
73
76
  const [isModalVisible, setIsModalVisible] = useState(false);
@@ -79,6 +82,8 @@ const LoginFormUI = (props: LoginParams) => {
79
82
  cellphone: null,
80
83
  },
81
84
  });
85
+ const [recaptchaConfig, setRecaptchaConfig] = useState<any>({})
86
+ const [recaptchaVerified, setRecaptchaVerified] = useState(false)
82
87
 
83
88
  const theme = useTheme();
84
89
 
@@ -91,7 +96,7 @@ const LoginFormUI = (props: LoginParams) => {
91
96
  inputStyle: {
92
97
  marginBottom: 28,
93
98
  borderWidth: 1,
94
- borderColor: theme.colors.border,
99
+ // borderColor: theme.colors.border,
95
100
  borderRadius: 7.6,
96
101
  },
97
102
  line: {
@@ -100,10 +105,15 @@ const LoginFormUI = (props: LoginParams) => {
100
105
  flexGrow: 1,
101
106
  marginBottom: 7,
102
107
  },
108
+ recaptchaIcon: {
109
+ width: 100,
110
+ height: 100,
111
+ }
103
112
  });
104
113
 
105
114
  const emailRef = useRef<any>({});
106
115
  const passwordRef = useRef<any>({});
116
+ const recaptchaRef = useRef<any>({});
107
117
 
108
118
  const handleChangeTab = (val: string) => {
109
119
  props.handleChangeTab(val);
@@ -156,6 +166,33 @@ const LoginFormUI = (props: LoginParams) => {
156
166
  onChange(value.toLowerCase().replace(/[&,()%";:ç?<>{}\\[\]\s]/g, ''));
157
167
  };
158
168
 
169
+ const handleOpenRecaptcha = () => {
170
+ setRecaptchaVerified(false)
171
+ if (!recaptchaConfig?.siteKey) {
172
+ showToast(ToastType.Error, t('NO_RECAPTCHA_SITE_KEY', 'The config doesn\'t have recaptcha site key'));
173
+ return
174
+ }
175
+ if (!recaptchaConfig?.baseUrl) {
176
+ showToast(ToastType.Error, t('NO_RECAPTCHA_BASE_URL', 'The config doesn\'t have recaptcha base url'));
177
+ return
178
+ }
179
+ recaptchaRef.current.open()
180
+ }
181
+
182
+ const onRecaptchaVerify = (token: any) => {
183
+ setRecaptchaVerified(true)
184
+ handleReCaptcha(token)
185
+ }
186
+
187
+ useEffect(() => {
188
+ if (configs && Object.keys(configs).length > 0 && enableReCaptcha) {
189
+ setRecaptchaConfig({
190
+ siteKey: configs?.security_recaptcha_site_key?.value || null,
191
+ baseUrl: configs?.security_recaptcha_base_url?.value || null
192
+ })
193
+ }
194
+ }, [configs, enableReCaptcha])
195
+
159
196
  useEffect(() => {
160
197
  if (!formState.loading && formState.result?.error) {
161
198
  formState.result?.result &&
@@ -189,33 +226,21 @@ const LoginFormUI = (props: LoginParams) => {
189
226
  }, [verifyPhoneState]);
190
227
 
191
228
  useEffect(() => {
192
- if (Object.keys(errors).length > 0) {
193
- // Convert all errors in one string to show in toast provider
194
- const list = Object.values(errors);
195
- let stringError = '';
196
- if (phoneInputData.error) {
197
- list.unshift({ message: phoneInputData.error });
198
- }
199
- if (
200
- loginTab === 'cellphone' &&
201
- !phoneInputData.error &&
202
- !phoneInputData.phone.country_phone_code &&
203
- !phoneInputData.phone.cellphone
204
- ) {
205
- list.unshift({
206
- message: t(
207
- 'VALIDATION_ERROR_MOBILE_PHONE_REQUIRED',
208
- 'The field Mobile phone is required.',
209
- ),
210
- });
211
- }
212
- list.map((item: any, i: number) => {
213
- stringError +=
214
- i + 1 === list.length ? `- ${item.message}` : `- ${item.message}\n`;
215
- });
216
- showToast(ToastType.Error, stringError);
217
- }
218
- }, [errors]);
229
+ if (phoneInputData?.phone?.cellphone) setValue('cellphone', phoneInputData?.phone?.cellphone, '')
230
+ else setValue('cellphone', '')
231
+ }, [phoneInputData?.phone?.cellphone])
232
+
233
+ useEffect(() => {
234
+ register('cellphone', {
235
+ required: loginTab === 'cellphone'
236
+ ? t('VALIDATION_ERROR_MOBILE_PHONE_REQUIRED', 'The field Mobile phone is required').replace('_attribute_', t('CELLPHONE', 'Cellphone'))
237
+ : null
238
+ })
239
+ }, [register])
240
+
241
+ useEffect(() => {
242
+ reset()
243
+ }, [loginTab])
219
244
 
220
245
  return (
221
246
  <Container>
@@ -284,43 +309,58 @@ const LoginFormUI = (props: LoginParams) => {
284
309
  {(useLoginByCellphone || useLoginByEmail) && (
285
310
  <FormInput>
286
311
  {useLoginByEmail && loginTab === 'email' && (
287
- <Controller
288
- control={control}
289
- render={({ onChange, value }: any) => (
290
- <OInput
291
- placeholder={t('EMAIL', 'Email')}
292
- style={loginStyle.inputStyle}
293
- icon={theme.images.general.email}
294
- onChange={(e: any) => {
295
- handleChangeInputEmail(e, onChange);
296
- }}
297
- value={value}
298
- autoCapitalize="none"
299
- autoCorrect={false}
300
- type="email-address"
301
- autoCompleteType="email"
302
- returnKeyType="next"
303
- onSubmitEditing={() => passwordRef.current?.focus()}
304
- blurOnSubmit={false}
305
- forwardRef={emailRef}
306
- />
312
+ <>
313
+ {errors?.email && (
314
+ <OText
315
+ size={14}
316
+ color={theme.colors.danger5}
317
+ weight={'normal'}>
318
+ {errors?.email?.message}{errors?.email?.type === 'required' && '*'}
319
+ </OText>
307
320
  )}
308
- name="email"
309
- rules={{
310
- required: t(
311
- 'VALIDATION_ERROR_EMAIL_REQUIRED',
312
- 'The field Email is required',
313
- ).replace('_attribute_', t('EMAIL', 'Email')),
314
- pattern: {
315
- value: /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i,
316
- message: t(
317
- 'INVALID_ERROR_EMAIL',
318
- 'Invalid email address',
319
- ).replace('_attribute_', t('EMAIL', 'Email')),
320
- },
321
- }}
322
- defaultValue=""
323
- />
321
+ <Controller
322
+ control={control}
323
+ render={({ onChange, value }: any) => (
324
+ <OInput
325
+ placeholder={t('EMAIL', 'Email')}
326
+ style={loginStyle.inputStyle}
327
+ icon={theme.images.general.email}
328
+ onChange={(e: any) => {
329
+ handleChangeInputEmail(e, onChange);
330
+ }}
331
+ value={value}
332
+ autoCapitalize="none"
333
+ autoCorrect={false}
334
+ type="email-address"
335
+ autoCompleteType="email"
336
+ returnKeyType="next"
337
+ onSubmitEditing={() => passwordRef.current?.focus()}
338
+ blurOnSubmit={false}
339
+ forwardRef={emailRef}
340
+ borderColor={errors?.email ? theme.colors.danger5 : theme.colors.border}
341
+ />
342
+ )}
343
+ name="email"
344
+ rules={{
345
+ required: {
346
+ value: true,
347
+ message: t(
348
+ 'VALIDATION_ERROR_EMAIL_REQUIRED',
349
+ 'The field Email is required',
350
+ ).replace('_attribute_', t('EMAIL', 'Email'))
351
+ },
352
+ pattern: {
353
+ value: /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i,
354
+ message: t(
355
+ 'INVALID_ERROR_EMAIL',
356
+ 'Invalid email address',
357
+ ).replace('_attribute_', t('EMAIL', 'Email')),
358
+ }
359
+ }}
360
+ defaultValue=""
361
+ />
362
+ </>
363
+
324
364
  )}
325
365
  {useLoginByCellphone && loginTab === 'cellphone' && (
326
366
  <View style={{ marginBottom: 28 }}>
@@ -331,10 +371,18 @@ const LoginFormUI = (props: LoginParams) => {
331
371
  returnKeyType: 'next',
332
372
  onSubmitEditing: () => passwordRef?.current?.focus?.(),
333
373
  }}
374
+ isStartValidation={errors?.cellphone}
334
375
  />
335
376
  </View>
336
377
  )}
337
-
378
+ {errors?.password && (
379
+ <OText
380
+ size={14}
381
+ color={theme.colors.danger5}
382
+ weight={'normal'}>
383
+ {errors?.password?.message}{errors?.password?.type === 'required' && '*'}
384
+ </OText>
385
+ )}
338
386
  <Controller
339
387
  control={control}
340
388
  render={({ onChange, value }: any) => (
@@ -366,14 +414,18 @@ const LoginFormUI = (props: LoginParams) => {
366
414
  returnKeyType="done"
367
415
  onSubmitEditing={handleSubmit(onSubmit)}
368
416
  blurOnSubmit
417
+ borderColor={errors?.password ? theme.colors.danger5 : theme.colors.border}
369
418
  />
370
419
  )}
371
420
  name="password"
372
421
  rules={{
373
- required: t(
422
+ required: {
423
+ value: true,
424
+ message: t(
374
425
  'VALIDATION_ERROR_PASSWORD_REQUIRED',
375
426
  'The field Password is required',
376
- ).replace('_attribute_', t('PASSWORD', 'Password')),
427
+ ).replace('_attribute_', t('PASSWORD', 'Password'))
428
+ }
377
429
  }}
378
430
  defaultValue=""
379
431
  />
@@ -384,6 +436,39 @@ const LoginFormUI = (props: LoginParams) => {
384
436
  </OText>
385
437
  </TouchableOpacity>
386
438
  )}
439
+
440
+ {enableReCaptcha && (
441
+ <>
442
+ <TouchableOpacity
443
+ onPress={handleOpenRecaptcha}
444
+ >
445
+ <RecaptchaButton>
446
+ {recaptchaVerified ? (
447
+ <MaterialCommunityIcons
448
+ name="checkbox-marked"
449
+ size={26}
450
+ color={theme.colors.primary}
451
+ />
452
+ ) : (
453
+ <MaterialCommunityIcons
454
+ name="checkbox-blank-outline"
455
+ size={26}
456
+ color={theme.colors.mediumGray}
457
+ />
458
+ )}
459
+ <OText size={14} mLeft={8}>{t('VERIFY_ReCAPTCHA', 'Verify reCAPTCHA')}</OText>
460
+ </RecaptchaButton>
461
+ </TouchableOpacity>
462
+ <Recaptcha
463
+ ref={recaptchaRef}
464
+ siteKey={recaptchaConfig?.siteKey}
465
+ baseUrl={recaptchaConfig?.baseUrl}
466
+ onVerify={onRecaptchaVerify}
467
+ onExpire={() => setRecaptchaVerified(false)}
468
+ />
469
+ </>
470
+ )}
471
+
387
472
  <OButton
388
473
  onClick={handleSubmit(onSubmit)}
389
474
  text={loginButtonText}
@@ -544,6 +629,7 @@ const LoginFormUI = (props: LoginParams) => {
544
629
  export const LoginForm = (props: any) => {
545
630
  const loginProps = {
546
631
  ...props,
632
+ isRecaptchaEnable: true,
547
633
  UIComponent: LoginFormUI,
548
634
  };
549
635
  return <LoginFormController {...loginProps} />;
@@ -36,7 +36,7 @@ export const LoginWith = styled.View`
36
36
  width: 100%;
37
37
  align-items: flex-start;
38
38
  border-bottom-width: 1px;
39
- border-bottom-color: ${(props: any) => props.theme.colors.border}
39
+ border-bottom-color: ${(props: any) => props.theme.colors.border};
40
40
  `;
41
41
 
42
42
  export const FormInput = styled.View`
@@ -80,3 +80,8 @@ export const LineSeparator = styled.View`
80
80
  export const SkeletonWrapper = styled.View`
81
81
  width: 90%;
82
82
  `
83
+ export const RecaptchaButton = styled.View`
84
+ flex-direction: row;
85
+ align-items: center;
86
+ margin-bottom: 10px;
87
+ `
@@ -97,28 +97,18 @@ const MessagesUI = (props: MessagesParams) => {
97
97
  }
98
98
 
99
99
  const handleImagePicker = () => {
100
- launchImageLibrary({ mediaType: 'photo', maxHeight: 300, maxWidth: 300, includeBase64: true }, (response: any) => {
101
- if (response.didCancel) {
102
- console.log('User cancelled image picker');
103
- } else if (response.errorMessage) {
104
- console.log('ImagePicker Error: ', response.errorMessage);
100
+ launchImageLibrary({ mediaType: 'photo', maxHeight: 2048, maxWidth: 2048, includeBase64: true }, (response: any) => {
101
+ if (response?.didCancel) {
102
+ showToast(ToastType.Error, t('IMAGE_CANCELLED', 'User cancelled image picker'));
103
+ } else if (response?.errorMessage) {
105
104
  showToast(ToastType.Error, response.errorMessage);
106
105
  } else {
107
- if (Platform.OS === 'ios') {
108
- if (response.uri) {
109
- const url = `data:${response.type};base64,${response.base64}`
110
- setImage && setImage(url);
111
- } else {
112
- showToast(ToastType.Error, t('IMAGE_NOT_FOUND', 'Image not found'));
113
- }
106
+ if (response?.assets?.length > 0) {
107
+ const image = response?.assets[0]
108
+ const url = `data:${image.type};base64,${image.base64}`
109
+ setImage && setImage(url);
114
110
  } else {
115
- if (response?.assets?.length > 0) {
116
- const image = response?.assets[0]
117
- const url = `data:${image.type};base64,${image.base64}`
118
- setImage && setImage(url);
119
- } else {
120
- showToast(ToastType.Error, t('IMAGE_NOT_FOUND', 'Image not found'));
121
- }
111
+ showToast(ToastType.Error, t('IMAGE_NOT_FOUND', 'Image not found'));
122
112
  }
123
113
  }
124
114
  });
@@ -237,7 +227,7 @@ const MessagesUI = (props: MessagesParams) => {
237
227
  {image && (
238
228
  <TouchableOpacity
239
229
  style={{ position: 'absolute', top: -5, right: -5, borderColor: theme.colors.backgroundDark, backgroundColor: theme.colors.white, borderRadius: 25 }}
240
- onPress={() => removeImage()}
230
+ onPress={removeImage}
241
231
  >
242
232
  <MaterialCommunityIcon name='close-circle-outline' color={theme.colors.backgroundDark} size={24} />
243
233
  </TouchableOpacity>
@@ -342,30 +332,34 @@ const MessagesUI = (props: MessagesParams) => {
342
332
  )
343
333
  )
344
334
 
345
- const renderSend = (props: any) => (
346
- <Send
347
- {...props}
348
- disabled={(sendMessage?.loading || (message === '' && !image) || messages?.loading)}
349
- alwaysShowSend
350
- containerStyle={styles.containerSend}
351
- >
352
- <OIconButton
353
- onClick={onSubmit}
354
- style={{
355
- height: 44,
356
- width: 44,
357
- borderRadius: 7.6,
358
- opacity: (sendMessage?.loading || (message === '' && !image) || messages?.loading) ? 0.4 : 1,
359
- borderColor: theme.colors.primary,
360
- backgroundColor: theme.colors.primary,
361
- }}
362
- iconStyle={{ marginTop: 3, marginRight: 2 }}
363
- icon={theme.images.general.enter}
364
- disabled={(sendMessage?.loading || (message === '' && !image) || messages?.loading)}
365
- disabledColor={theme.colors.white}
366
- />
367
- </Send>
368
- )
335
+ const renderSend = (props: any) => {
336
+ const isDisabled = (sendMessage?.loading || (message === '' && !image) || messages?.loading)
337
+ return (
338
+ <Send
339
+ {...props}
340
+ disabled={isDisabled}
341
+ alwaysShowSend
342
+ containerStyle={styles.containerSend}
343
+ >
344
+ <OIconButton
345
+ onClick={onSubmit}
346
+ style={{
347
+ height: 44,
348
+ width: 44,
349
+ borderRadius: 7.6,
350
+ opacity: isDisabled ? 0.2 : 1,
351
+ borderColor: isDisabled ? theme.colors.secondary : theme.colors.primary,
352
+ backgroundColor: isDisabled ? theme.colors.secondary : theme.colors.primary,
353
+ }}
354
+ iconStyle={{ marginTop: 3, marginRight: 2 }}
355
+ icon={theme.images.general.enter}
356
+ iconColor={isDisabled ? '#000' : '#fff'}
357
+ disabled={isDisabled}
358
+ disabledColor={theme.colors.secondary}
359
+ />
360
+ </Send>
361
+ )
362
+ }
369
363
 
370
364
  const renderBubble = (props: any) => (
371
365
  <Bubble
@@ -545,9 +539,20 @@ const styles = StyleSheet.create({
545
539
  })
546
540
 
547
541
  export const Messages = (props: MessagesParams) => {
542
+ const [allMessages, setAllMessages] = useState(props.messages)
543
+
544
+ useEffect(() => {
545
+ setAllMessages(props.messages)
546
+ }, [props.messages])
547
+
548
548
  const MessagesProps = {
549
549
  ...props,
550
- UIComponent: MessagesUI
550
+ UIComponent: MessagesUI,
551
+ messages: allMessages,
552
+ setMessages: (values: any) => {
553
+ props.setMessages && props.setMessages(values)
554
+ setAllMessages(values)
555
+ }
551
556
  }
552
557
  return <MessagesController {...MessagesProps} />
553
558
  }
@@ -1,7 +1,5 @@
1
-
2
1
  import styled, { css } from 'styled-components/native'
3
2
 
4
-
5
3
  export const Wrapper = styled.View`
6
4
  flex: 1;
7
5
  background-color: ${(props: any) => props.theme.colors.white};
@@ -39,4 +37,4 @@ export const MessageTypeItem = styled.View`
39
37
  ${({ active }: any) => active && css`
40
38
  background-color: ${(props: any) => props.theme.colors.whiteGray};
41
39
  `}
42
- `
40
+ `
@@ -4,6 +4,7 @@ import CalendarStrip from 'react-native-calendar-strip'
4
4
  import {
5
5
  useLanguage,
6
6
  useConfig,
7
+ useUtils,
7
8
  useOrder,
8
9
  MomentOption as MomentOptionController,
9
10
  } from 'ordering-components/native';
@@ -132,6 +133,7 @@ const MomentOptionUI = (props: MomentOptionParams) => {
132
133
 
133
134
  const [, t] = useLanguage();
134
135
  const [{ configs }] = useConfig();
136
+ const [{ parseTime }] = useUtils()
135
137
  const [orderState] = useOrder();
136
138
  const [optionSelected, setOptionSelected] = useState({
137
139
  isAsap: false,
@@ -143,6 +145,8 @@ const MomentOptionUI = (props: MomentOptionParams) => {
143
145
  });
144
146
  const { bottom } = useSafeAreaInsets();
145
147
 
148
+ const is12hours = configs?.dates_moment_format?.value?.includes('hh:mm')
149
+
146
150
  const [selectedTime, setSelectedTime] = useState(null);
147
151
  const [datesWhitelist, setDateWhitelist] = useState<any>([{ start: null, end: null }])
148
152
  const [selectDate, setSelectedDate] = useState<any>(null)
@@ -338,7 +342,12 @@ const MomentOptionUI = (props: MomentOptionParams) => {
338
342
  style={{
339
343
  lineHeight: 24
340
344
  }}
341
- >{time.startTime}</OText>
345
+ >{is12hours ? (
346
+ time.startTime.includes('12')
347
+ ? `${time.startTime}PM`
348
+ : parseTime(moment(time.startTime, 'HH:mm'), { outputFormat: 'hh:mma' })
349
+ ) : time.startTime
350
+ }</OText>
342
351
  </TimeItem>
343
352
  </TouchableOpacity>
344
353
  ))}
@@ -18,7 +18,7 @@ export const OrderTimeWrapper = styled.View`
18
18
 
19
19
  export const TimeListWrapper = styled.ScrollView`
20
20
  margin-top: 30px;
21
- max-height: 160px;
21
+ max-height: 210px;
22
22
  `
23
23
 
24
24
  export const TimeContentWrapper = styled.View`