ordering-ui-react-native 0.15.62 → 0.15.64-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 (213) hide show
  1. package/package.json +7 -3
  2. package/src/DeliveryApp.tsx +43 -1
  3. package/src/components/AddressForm/index.tsx +18 -2
  4. package/src/components/BusinessBasicInformation/index.tsx +11 -19
  5. package/src/components/BusinessController/index.tsx +16 -8
  6. package/src/components/BusinessInformation/index.tsx +14 -0
  7. package/src/components/BusinessTypeFilter/index.tsx +1 -2
  8. package/src/components/BusinessesListing/index.tsx +1 -1
  9. package/src/components/Checkout/index.tsx +23 -2
  10. package/src/components/DriverTips/index.tsx +11 -6
  11. package/src/components/LanguageSelector/index.tsx +6 -2
  12. package/src/components/LoginForm/index.tsx +120 -30
  13. package/src/components/LoginForm/styles.tsx +6 -0
  14. package/src/components/OrderDetails/index.tsx +7 -21
  15. package/src/components/PaymentOptions/index.tsx +67 -50
  16. package/src/components/PaymentOptionsWebView/index.tsx +120 -121
  17. package/src/components/ReviewDriver/index.tsx +1 -1
  18. package/src/components/ReviewOrder/index.tsx +2 -1
  19. package/src/components/ReviewProducts/index.tsx +11 -0
  20. package/src/components/SignupForm/index.tsx +145 -61
  21. package/src/components/SingleProductCard/index.tsx +16 -4
  22. package/src/components/SingleProductReview/index.tsx +1 -1
  23. package/src/components/StripeMethodForm/index.tsx +22 -24
  24. package/src/components/UpsellingProducts/index.tsx +1 -1
  25. package/src/components/UserProfileForm/index.tsx +63 -6
  26. package/src/components/UserProfileForm/styles.tsx +8 -0
  27. package/src/components/VerifyPhone/styles.tsx +1 -2
  28. package/src/components/shared/OModal.tsx +1 -1
  29. package/src/hooks/useCountdownTimer.tsx +26 -0
  30. package/src/navigators/CheckoutNavigator.tsx +6 -0
  31. package/src/navigators/HomeNavigator.tsx +12 -0
  32. package/src/pages/BusinessesListing.tsx +7 -6
  33. package/src/pages/MultiCheckout.tsx +31 -0
  34. package/src/pages/MultiOrdersDetails.tsx +27 -0
  35. package/src/pages/OrderDetails.tsx +1 -1
  36. package/src/pages/ReviewDriver.tsx +2 -2
  37. package/src/pages/ReviewOrder.tsx +2 -2
  38. package/src/pages/Sessions.tsx +22 -0
  39. package/src/theme.json +0 -1
  40. package/src/types/index.tsx +18 -11
  41. package/src/utils/index.tsx +68 -1
  42. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +103 -15
  43. package/themes/business/src/components/AcceptOrRejectOrder/styles.tsx +6 -0
  44. package/themes/business/src/components/Chat/index.tsx +42 -90
  45. package/themes/business/src/components/DriverMap/index.tsx +6 -5
  46. package/themes/business/src/components/LoginForm/index.tsx +89 -2
  47. package/themes/business/src/components/LoginForm/styles.tsx +6 -0
  48. package/themes/business/src/components/LogoutButton/index.tsx +1 -1
  49. package/themes/business/src/components/NewOrderNotification/index.tsx +26 -13
  50. package/themes/business/src/components/OrderDetails/Business.tsx +2 -2
  51. package/themes/business/src/components/OrderDetails/Delivery.tsx +28 -11
  52. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +14 -7
  53. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +6 -0
  54. package/themes/business/src/components/OrdersListManager/index.tsx +1 -1
  55. package/themes/business/src/components/OrdersOption/index.tsx +8 -4
  56. package/themes/business/src/components/PreviousOrders/index.tsx +7 -7
  57. package/themes/business/src/components/ProductItemAccordion/index.tsx +2 -2
  58. package/themes/business/src/components/UserFormDetails/index.tsx +5 -2
  59. package/themes/business/src/components/UserProfileForm/index.tsx +2 -0
  60. package/themes/business/src/components/shared/OModal.tsx +1 -1
  61. package/themes/business/src/types/index.tsx +8 -2
  62. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  63. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  64. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  65. package/themes/kiosk/src/components/BusinessMenu/index.tsx +39 -28
  66. package/themes/kiosk/src/components/BusinessesListing/index.tsx +2 -3
  67. package/themes/kiosk/src/components/Cart/index.tsx +11 -12
  68. package/themes/kiosk/src/components/CartBottomSheet/index.tsx +9 -2
  69. package/themes/kiosk/src/components/CartContent/index.tsx +0 -11
  70. package/themes/kiosk/src/components/CartItem/index.tsx +4 -3
  71. package/themes/kiosk/src/components/CategoriesMenu/index.tsx +107 -62
  72. package/themes/kiosk/src/components/Checkout/index.tsx +40 -22
  73. package/themes/kiosk/src/components/CustomerName/index.tsx +0 -6
  74. package/themes/kiosk/src/components/DrawerView/index.tsx +1 -0
  75. package/themes/kiosk/src/components/DrawerView/styles.tsx +2 -2
  76. package/themes/kiosk/src/components/NavBar/index.tsx +29 -20
  77. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  78. package/themes/kiosk/src/components/OrderDetails/index.tsx +32 -27
  79. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +9 -11
  80. package/themes/kiosk/src/components/PaymentOptions/index.tsx +56 -54
  81. package/themes/kiosk/src/components/ProductForm/index.tsx +7 -8
  82. package/themes/kiosk/src/components/ProductItemAccordion/index.tsx +2 -2
  83. package/themes/kiosk/src/components/ProductOption/index.tsx +1 -1
  84. package/themes/kiosk/src/components/ProductOptionSubOption/index.tsx +3 -1
  85. package/themes/kiosk/src/components/UpsellingProducts/index.tsx +16 -5
  86. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  87. package/themes/kiosk/src/types/index.d.ts +1 -0
  88. package/themes/original/index.tsx +30 -8
  89. package/themes/original/src/components/ActiveOrders/index.tsx +15 -132
  90. package/themes/original/src/components/ActiveOrders/styles.tsx +0 -54
  91. package/themes/original/src/components/AddressForm/index.tsx +7 -6
  92. package/themes/original/src/components/AddressList/index.tsx +30 -18
  93. package/themes/original/src/components/AppleLogin/index.tsx +7 -12
  94. package/themes/original/src/components/BusinessBasicInformation/index.tsx +305 -159
  95. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +6 -2
  96. package/themes/original/src/components/BusinessController/index.tsx +168 -96
  97. package/themes/original/src/components/BusinessController/styles.tsx +5 -0
  98. package/themes/original/src/components/BusinessItemAccordion/index.tsx +8 -5
  99. package/themes/original/src/components/BusinessItemAccordion/styles.tsx +3 -1
  100. package/themes/original/src/components/BusinessListingSearch/index.tsx +231 -63
  101. package/themes/original/src/components/BusinessListingSearch/styles.tsx +22 -2
  102. package/themes/original/src/components/BusinessPreorder/index.tsx +1 -1
  103. package/themes/original/src/components/BusinessProductsCategories/index.tsx +2 -2
  104. package/themes/original/src/components/BusinessProductsList/CategoryDescription/index.tsx +44 -0
  105. package/themes/original/src/components/BusinessProductsList/index.tsx +51 -52
  106. package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
  107. package/themes/original/src/components/BusinessProductsListing/index.tsx +317 -155
  108. package/themes/original/src/components/BusinessProductsListing/styles.tsx +32 -0
  109. package/themes/original/src/components/BusinessReviews/index.tsx +6 -1
  110. package/themes/original/src/components/BusinessTypeFilter/index.tsx +106 -39
  111. package/themes/original/src/components/BusinessTypeFilter/styles.tsx +2 -0
  112. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +560 -0
  113. package/themes/original/src/components/BusinessesListing/{styles.tsx → Layout/Appointment/styles.tsx} +24 -2
  114. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +679 -0
  115. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +137 -0
  116. package/themes/original/src/components/BusinessesListing/index.tsx +99 -458
  117. package/themes/original/src/components/Cart/index.tsx +62 -43
  118. package/themes/original/src/components/Checkout/index.tsx +90 -39
  119. package/themes/original/src/components/DriverTips/index.tsx +17 -12
  120. package/themes/original/src/components/Favorite/index.tsx +92 -0
  121. package/themes/original/src/components/Favorite/styles.tsx +22 -0
  122. package/themes/original/src/components/FavoriteList/index.tsx +298 -0
  123. package/themes/original/src/components/FavoriteList/styles.tsx +5 -0
  124. package/themes/original/src/components/ForgotPasswordForm/index.tsx +84 -4
  125. package/themes/original/src/components/GPSButton/index.tsx +15 -8
  126. package/themes/original/src/components/GoogleMap/index.tsx +11 -11
  127. package/themes/original/src/components/Help/index.tsx +21 -4
  128. package/themes/original/src/components/HighestRatedBusinesses/index.tsx +18 -1
  129. package/themes/original/src/components/LastOrders/index.tsx +12 -1
  130. package/themes/original/src/components/LoginForm/Otp/index.tsx +91 -0
  131. package/themes/original/src/components/LoginForm/Otp/styles.tsx +7 -0
  132. package/themes/original/src/components/LoginForm/index.tsx +332 -164
  133. package/themes/original/src/components/LoginForm/styles.tsx +1 -3
  134. package/themes/original/src/components/MessageListing/index.tsx +10 -1
  135. package/themes/original/src/components/Messages/index.tsx +1 -1
  136. package/themes/original/src/components/MomentOption/index.tsx +10 -1
  137. package/themes/original/src/components/MomentOption/styles.tsx +1 -1
  138. package/themes/original/src/components/MomentSelector/index.tsx +197 -0
  139. package/themes/original/src/components/MomentSelector/styles.tsx +6 -0
  140. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +243 -0
  141. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/styles.tsx +46 -0
  142. package/themes/original/src/components/MultiCheckout/index.tsx +298 -0
  143. package/themes/original/src/components/MultiCheckout/styles.tsx +59 -0
  144. package/themes/original/src/components/MultiOrdersDetails/SingleOrderCard.tsx +372 -0
  145. package/themes/original/src/components/MultiOrdersDetails/index.tsx +258 -0
  146. package/themes/original/src/components/MultiOrdersDetails/styles.tsx +50 -0
  147. package/themes/original/src/components/MyOrders/index.tsx +120 -32
  148. package/themes/original/src/components/MyOrders/styles.tsx +8 -1
  149. package/themes/original/src/components/NavBar/index.tsx +4 -4
  150. package/themes/original/src/components/OrderDetails/OrderHistory.tsx +167 -0
  151. package/themes/original/src/components/OrderDetails/index.tsx +151 -65
  152. package/themes/original/src/components/OrderDetails/styles.tsx +1 -2
  153. package/themes/original/src/components/OrderSummary/index.tsx +6 -6
  154. package/themes/original/src/components/OrderTypeSelector/index.tsx +79 -35
  155. package/themes/original/src/components/OrderTypeSelector/styles.tsx +19 -1
  156. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/index.tsx +153 -0
  157. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/styles.tsx +6 -0
  158. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +53 -0
  159. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/styles.tsx +6 -0
  160. package/themes/original/src/components/OrdersOption/index.tsx +137 -38
  161. package/themes/original/src/components/OrdersOption/styles.tsx +4 -1
  162. package/themes/original/src/components/PaymentOptionCash/index.tsx +2 -2
  163. package/themes/original/src/components/PaymentOptionWallet/index.tsx +17 -23
  164. package/themes/original/src/components/PaymentOptionWallet/styles.tsx +1 -1
  165. package/themes/original/src/components/PaymentOptions/index.tsx +58 -37
  166. package/themes/original/src/components/PhoneInputNumber/index.tsx +5 -11
  167. package/themes/original/src/components/PreviousOrders/index.tsx +18 -147
  168. package/themes/original/src/components/ProductForm/index.tsx +718 -679
  169. package/themes/original/src/components/ProductForm/styles.tsx +6 -2
  170. package/themes/original/src/components/ProductItemAccordion/index.tsx +2 -2
  171. package/themes/original/src/components/ProductOption/index.tsx +1 -1
  172. package/themes/original/src/components/ProductOptionSubOption/index.tsx +18 -12
  173. package/themes/original/src/components/ProfessionalFilter/index.tsx +128 -0
  174. package/themes/original/src/components/ProfessionalFilter/styles.tsx +0 -0
  175. package/themes/original/src/components/ProfessionalProfile/index.tsx +298 -0
  176. package/themes/original/src/components/ProfessionalProfile/styles.tsx +46 -0
  177. package/themes/original/src/components/Promotions/index.tsx +151 -133
  178. package/themes/original/src/components/Promotions/styles.tsx +3 -23
  179. package/themes/original/src/components/ReviewDriver/index.tsx +6 -6
  180. package/themes/original/src/components/ReviewOrder/index.tsx +1 -1
  181. package/themes/original/src/components/ReviewTrigger/index.tsx +118 -0
  182. package/themes/original/src/components/ReviewTrigger/styles.tsx +34 -0
  183. package/themes/original/src/components/SearchBar/index.tsx +13 -5
  184. package/themes/original/src/components/ServiceForm/index.tsx +579 -0
  185. package/themes/original/src/components/ServiceForm/styles.tsx +50 -0
  186. package/themes/original/src/components/Sessions/index.tsx +160 -0
  187. package/themes/original/src/components/Sessions/styles.tsx +15 -0
  188. package/themes/original/src/components/SignupForm/index.tsx +237 -126
  189. package/themes/original/src/components/SingleOrderCard/index.tsx +275 -0
  190. package/themes/original/src/components/SingleOrderCard/styles.tsx +54 -0
  191. package/themes/original/src/components/SingleProductCard/index.tsx +161 -88
  192. package/themes/original/src/components/SingleProductCard/styles.tsx +2 -2
  193. package/themes/original/src/components/StripeElementsForm/index.tsx +16 -8
  194. package/themes/original/src/components/StripeElementsForm/naked.tsx +2 -2
  195. package/themes/original/src/components/UpsellingProducts/index.tsx +86 -74
  196. package/themes/original/src/components/UserDetails/index.tsx +15 -81
  197. package/themes/original/src/components/UserFormDetails/index.tsx +98 -66
  198. package/themes/original/src/components/UserProfile/index.tsx +11 -2
  199. package/themes/original/src/components/UserProfileForm/index.tsx +33 -22
  200. package/themes/original/src/components/UserVerification/index.tsx +178 -192
  201. package/themes/original/src/components/VerifyPhone/index.tsx +10 -7
  202. package/themes/original/src/components/VerifyPhone/styles.tsx +2 -1
  203. package/themes/original/src/components/Wallets/index.tsx +76 -9
  204. package/themes/original/src/components/Wallets/styles.tsx +21 -0
  205. package/themes/original/src/components/shared/OBottomPopup.tsx +44 -13
  206. package/themes/original/src/components/shared/OButton.tsx +2 -0
  207. package/themes/original/src/components/shared/OInput.tsx +3 -2
  208. package/themes/original/src/components/shared/OModal.tsx +4 -2
  209. package/themes/original/src/layouts/FloatingBottomContainer.tsx +5 -1
  210. package/themes/original/src/types/index.tsx +187 -35
  211. package/themes/original/src/utils/index.tsx +96 -2
  212. package/themes/single-business/src/components/OrderTypeSelector/index.tsx +1 -1
  213. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
@@ -3,6 +3,7 @@ import { View, Pressable, StyleSheet, Keyboard, Linking, Platform, TouchableOpac
3
3
  import { useForm, Controller } from 'react-hook-form';
4
4
  import Spinner from 'react-native-loading-spinner-overlay';
5
5
  import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons'
6
+ import Recaptcha from 'react-native-recaptcha-that-works'
6
7
 
7
8
  import { PhoneInputNumber } from '../PhoneInputNumber'
8
9
  import { FacebookLogin } from '../FacebookLogin'
@@ -23,7 +24,7 @@ import {
23
24
  SocialButtons
24
25
  } from './styles'
25
26
 
26
- import { LoginWith as SignupWith, OTab, OTabs } from '../LoginForm/styles'
27
+ import { LoginWith as SignupWith, OTab, OTabs, RecaptchaButton } from '../LoginForm/styles'
27
28
 
28
29
  import { _removeStoreData } from '../../providers/StoreUtil';
29
30
  import NavBar from '../NavBar'
@@ -58,7 +59,9 @@ const SignupFormUI = (props: SignupParams) => {
58
59
  setCheckPhoneCodeState,
59
60
  handleSendVerifyCode,
60
61
  handleCheckPhoneCode,
61
- notificationState
62
+ notificationState,
63
+ enableReCaptcha,
64
+ handleReCaptcha
62
65
  } = props
63
66
 
64
67
  const theme = useTheme()
@@ -107,6 +110,9 @@ const SignupFormUI = (props: SignupParams) => {
107
110
  }
108
111
  });
109
112
 
113
+ const [recaptchaConfig, setRecaptchaConfig] = useState<any>({})
114
+ const [recaptchaVerified, setRecaptchaVerified] = useState(false)
115
+
110
116
  const nameRef = useRef<any>(null)
111
117
  const lastnameRef = useRef<any>(null)
112
118
  const middleNameRef = useRef<any>(null)
@@ -114,6 +120,9 @@ const SignupFormUI = (props: SignupParams) => {
114
120
  const emailRef = useRef<any>(null)
115
121
  const phoneRef = useRef<any>(null)
116
122
  const passwordRef = useRef<any>(null)
123
+ const recaptchaRef = useRef<any>({});
124
+
125
+ const googleLoginEnabled = configs?.google_login_enabled?.value === '1' || !configs?.google_login_enabled?.enabled
117
126
 
118
127
  const anySocialButtonActivated = ((configs?.facebook_login?.value === 'true' || configs?.facebook_login?.value === '1') && configs?.facebook_id?.value) ||
119
128
  (configs?.google_login_client_id?.value !== '' && configs?.google_login_client_id?.value !== null) ||
@@ -194,35 +203,6 @@ const SignupFormUI = (props: SignupParams) => {
194
203
  setPasswordSee(false);
195
204
  }
196
205
 
197
- const onSubmit = (values: any) => {
198
- Keyboard.dismiss()
199
- if (phoneInputData.error) {
200
- showToast(ToastType.Error, phoneInputData.error);
201
- return
202
- }
203
- if (
204
- !phoneInputData.phone.country_phone_code &&
205
- !phoneInputData.phone.cellphone &&
206
- validationFields?.fields?.checkout?.cellphone?.enabled &&
207
- validationFields?.fields?.checkout?.cellphone?.required
208
- ) {
209
- showToast(ToastType.Error, t('VALIDATION_ERROR_MOBILE_PHONE_REQUIRED', 'The field Mobile phone is required.'))
210
- return
211
- }
212
- if (signupTab === 'email' || !useSignupByCellphone) {
213
- handleButtonSignupClick && handleButtonSignupClick({
214
- ...values,
215
- ...phoneInputData.phone
216
- })
217
- if (!formState.loading && formState.result.result && !formState.result.error) {
218
- handleSuccessSignup && handleSuccessSignup(formState.result.result)
219
- }
220
- return
221
- }
222
- setFormValues(values)
223
- handleVerifyCodeClick(values)
224
- }
225
-
226
206
  const handleVerifyCodeClick = (values: any) => {
227
207
  const formData = values || formValues
228
208
  handleSendVerifyCode && handleSendVerifyCode({
@@ -263,6 +243,68 @@ const SignupFormUI = (props: SignupParams) => {
263
243
  }
264
244
  }
265
245
 
246
+ const handleOpenRecaptcha = () => {
247
+ setRecaptchaVerified(false)
248
+
249
+ if (recaptchaVerified) {
250
+ handleReCaptcha && handleReCaptcha('')
251
+ return
252
+ }
253
+
254
+ if (!recaptchaConfig?.siteKey) {
255
+ showToast(ToastType.Error, t('NO_RECAPTCHA_SITE_KEY', 'The config doesn\'t have recaptcha site key'));
256
+ return
257
+ }
258
+ if (!recaptchaConfig?.baseUrl) {
259
+ showToast(ToastType.Error, t('NO_RECAPTCHA_BASE_URL', 'The config doesn\'t have recaptcha base url'));
260
+ return
261
+ }
262
+ recaptchaRef.current.open()
263
+ }
264
+
265
+ const onRecaptchaVerify = (token: any) => {
266
+ setRecaptchaVerified(true)
267
+ handleReCaptcha && handleReCaptcha(token)
268
+ }
269
+
270
+ const onSubmit = (values: any) => {
271
+ Keyboard.dismiss()
272
+ if (phoneInputData.error) {
273
+ showToast(ToastType.Error, phoneInputData.error);
274
+ return
275
+ }
276
+ if (
277
+ !phoneInputData.phone.country_phone_code &&
278
+ !phoneInputData.phone.cellphone &&
279
+ validationFields?.fields?.checkout?.cellphone?.enabled &&
280
+ validationFields?.fields?.checkout?.cellphone?.required
281
+ ) {
282
+ showToast(ToastType.Error, t('VALIDATION_ERROR_MOBILE_PHONE_REQUIRED', 'The field Mobile phone is required.'))
283
+ return
284
+ }
285
+ if (signupTab === 'email' || !useSignupByCellphone) {
286
+ handleButtonSignupClick && handleButtonSignupClick({
287
+ ...values,
288
+ ...phoneInputData.phone
289
+ })
290
+ if (!formState.loading && formState.result.result && !formState.result.error) {
291
+ handleSuccessSignup && handleSuccessSignup(formState.result.result)
292
+ }
293
+ return
294
+ }
295
+ setFormValues(values)
296
+ handleVerifyCodeClick(values)
297
+ }
298
+
299
+ useEffect(() => {
300
+ if (configs && Object.keys(configs).length > 0 && enableReCaptcha) {
301
+ setRecaptchaConfig({
302
+ siteKey: configs?.security_recaptcha_site_key?.value || null,
303
+ baseUrl: configs?.security_recaptcha_base_url?.value || null
304
+ })
305
+ }
306
+ }, [configs, enableReCaptcha])
307
+
266
308
  useEffect(() => {
267
309
  if (!formState.loading && formState.result?.error) {
268
310
  formState.result?.result && showToast(
@@ -490,6 +532,47 @@ const SignupFormUI = (props: SignupParams) => {
490
532
  </View>
491
533
  )}
492
534
 
535
+ {enableReCaptcha && (
536
+ <>
537
+ <TouchableOpacity
538
+ onPress={handleOpenRecaptcha}
539
+ style={{ marginHorizontal: 4, marginBottom: 10 }}
540
+ >
541
+ <RecaptchaButton>
542
+ {recaptchaVerified ? (
543
+ <MaterialCommunityIcons
544
+ name="checkbox-marked"
545
+ size={23}
546
+ color={theme.colors.primary}
547
+ />
548
+ ) : (
549
+ <MaterialCommunityIcons
550
+ name="checkbox-blank-outline"
551
+ size={23}
552
+ color={theme.colors.disabled}
553
+ />
554
+ )}
555
+ <OText size={14} mLeft={8}>{t('VERIFY_ReCAPTCHA', 'Verify reCAPTCHA')}</OText>
556
+ </RecaptchaButton>
557
+ </TouchableOpacity>
558
+ <Recaptcha
559
+ ref={recaptchaRef}
560
+ siteKey={recaptchaConfig?.siteKey}
561
+ baseUrl={recaptchaConfig?.baseUrl}
562
+ onVerify={onRecaptchaVerify}
563
+ onExpire={() => setRecaptchaVerified(false)}
564
+ footerComponent={<OButton
565
+ onClick={() => recaptchaRef.current.close()}
566
+ style={{ borderRadius: 0 }}
567
+ text={t('CLOSE', 'Close')}
568
+ bgColor={theme.colors.primary}
569
+ borderColor={theme.colors.primary}
570
+ textStyle={{ color: 'white' }}
571
+ imgRightSrc={null}
572
+ />}
573
+ />
574
+ </>
575
+ )}
493
576
  {signupTab === 'cellphone' && useSignupByEmail && useSignupByCellphone ? (
494
577
  <OButton
495
578
  onClick={handleSubmit(onSubmit)}
@@ -529,40 +612,40 @@ const SignupFormUI = (props: SignupParams) => {
529
612
  }
530
613
 
531
614
  {configs && Object.keys(configs).length > 0 && anySocialButtonActivated && (
532
- <ButtonsSection>
533
- <OText size={18} mBottom={10} color={theme.colors.disabled}>
534
- {t('SELECT_AN_OPTION_TO_LOGIN', 'Select an option to login')}
535
- </OText>
536
- <SocialButtons>
537
- {(configs?.facebook_login?.value === 'true' || configs?.facebook_login?.value === '1') &&
538
- configs?.facebook_id?.value && (
539
- <FacebookLogin
540
- notificationState={notificationState}
541
- handleErrors={(err: any) => showToast(ToastType.Error, err)}
542
- handleLoading={(val: boolean) => setIsLoadingSocialButton(val)}
543
- handleSuccessFacebookLogin={handleSuccessFacebook}
544
- />
545
- )}
546
- {(configs?.google_login_client_id?.value !== '' && configs?.google_login_client_id?.value !== null) && (
547
- <GoogleLogin
548
- notificationState={notificationState}
549
- webClientId={configs?.google_login_client_id?.value}
550
- handleErrors={(err: any) => showToast(ToastType.Error, err)}
551
- handleLoading={(val: boolean) => setIsLoadingSocialButton(val)}
552
- handleSuccessGoogleLogin={handleSuccessFacebook}
553
- />
554
- )}
555
- {(configs?.apple_login_client_id?.value !== '' && configs?.apple_login_client_id?.value !== null) && (
556
- <AppleLogin
615
+ <ButtonsSection>
616
+ <OText size={18} mBottom={10} color={theme.colors.disabled}>
617
+ {t('SELECT_AN_OPTION_TO_LOGIN', 'Select an option to login')}
618
+ </OText>
619
+ <SocialButtons>
620
+ {(configs?.facebook_login?.value === 'true' || configs?.facebook_login?.value === '1') &&
621
+ configs?.facebook_id?.value && (
622
+ <FacebookLogin
557
623
  notificationState={notificationState}
558
624
  handleErrors={(err: any) => showToast(ToastType.Error, err)}
559
625
  handleLoading={(val: boolean) => setIsLoadingSocialButton(val)}
560
- handleSuccessApple={handleSuccessApple}
626
+ handleSuccessFacebookLogin={handleSuccessFacebook}
561
627
  />
562
628
  )}
563
- </SocialButtons>
564
- </ButtonsSection>
565
- )}
629
+ {(configs?.google_login_client_id?.value !== '' && configs?.google_login_client_id?.value !== null) && googleLoginEnabled && (
630
+ <GoogleLogin
631
+ notificationState={notificationState}
632
+ webClientId={configs?.google_login_client_id?.value}
633
+ handleErrors={(err: any) => showToast(ToastType.Error, err)}
634
+ handleLoading={(val: boolean) => setIsLoadingSocialButton(val)}
635
+ handleSuccessGoogleLogin={handleSuccessFacebook}
636
+ />
637
+ )}
638
+ {(configs?.apple_login_client_id?.value !== '' && configs?.apple_login_client_id?.value !== null) && (
639
+ <AppleLogin
640
+ notificationState={notificationState}
641
+ handleErrors={(err: any) => showToast(ToastType.Error, err)}
642
+ handleLoading={(val: boolean) => setIsLoadingSocialButton(val)}
643
+ handleSuccessApple={handleSuccessApple}
644
+ />
645
+ )}
646
+ </SocialButtons>
647
+ </ButtonsSection>
648
+ )}
566
649
  </FormSide>
567
650
  <OModal
568
651
  open={isModalVisible}
@@ -579,13 +662,14 @@ const SignupFormUI = (props: SignupParams) => {
579
662
  />
580
663
  </OModal>
581
664
  <Spinner visible={formState.loading || isLoadingSocialButton} />
582
- </View >
665
+ </View>
583
666
  );
584
667
  };
585
668
 
586
669
  export const SignupForm = (props: any) => {
587
670
  const signupProps = {
588
671
  ...props,
672
+ isRecaptchaEnable: true,
589
673
  UIComponent: SignupFormUI,
590
674
  };
591
675
  return <SignUpController {...signupProps} />;
@@ -10,6 +10,7 @@ import {
10
10
  import { StyleSheet } from 'react-native'
11
11
  import { OText, OIcon } from '../shared'
12
12
  import { useTheme } from 'styled-components/native'
13
+ import FastImage from 'react-native-fast-image'
13
14
 
14
15
  export const SingleProductCard = (props: SingleProductCardParams) => {
15
16
  const {
@@ -77,10 +78,21 @@ export const SingleProductCard = (props: SingleProductCardParams) => {
77
78
  activeOpacity={1}
78
79
  onPress={() => onProductClick?.(product)}
79
80
  >
80
- <OIcon
81
- url={optimizeImage(product?.images, 'h_200,c_limit')}
82
- style={styles.productStyle}
83
- />
81
+ {product?.images ? (
82
+ <FastImage
83
+ style={styles.productStyle}
84
+ source={{
85
+ uri: optimizeImage(product?.images, 'h_250,c_limit'),
86
+ priority: FastImage.priority.normal,
87
+ }}
88
+ resizeMode={FastImage.resizeMode.cover}
89
+ />
90
+ ) : (
91
+ <OIcon
92
+ src={theme?.images?.dummies?.product}
93
+ style={styles.productStyle}
94
+ />
95
+ )}
84
96
  <CardInfo>
85
97
  <OText numberOfLines={1} ellipsizeMode='tail' style={styles.textStyle}>{product?.name}</OText>
86
98
  <OText size={12} numberOfLines={2} ellipsizeMode='tail' style={styles.textStyle}>{product?.description}</OText>
@@ -69,7 +69,7 @@ export const SingleProductReview = (props: SingleProductReviewParams) => {
69
69
  }
70
70
 
71
71
  useEffect(() => {
72
- if (comments?.length === 0 && !extraComment && formState.changes?.length === 0 && qualification === 5) return
72
+ if (comments?.length === 0 && !extraComment) return
73
73
  let _comments = ''
74
74
  if (comments.length > 0) {
75
75
  comments.map(comment => (_comments += comment.content + '. '))
@@ -102,7 +102,7 @@ export const StripeMethodForm = (props: StripeMethodFormParams) => {
102
102
  shippingMethods: [
103
103
  {
104
104
  amount: cart?.balance?.toString() ?? cart?.total?.toString?.(),
105
- identifier: 'DPS',
105
+ identifier: 'standard',
106
106
  label: 'Courier',
107
107
  detail: 'Delivery',
108
108
  type: 'final',
@@ -125,13 +125,12 @@ export const StripeMethodForm = (props: StripeMethodFormParams) => {
125
125
  last4: paymentMethod.Card.last4
126
126
  }
127
127
  })
128
- onCancel()
129
128
  }
130
129
  }
131
130
 
132
131
  return (
133
132
  <>
134
- {paymethod === 'google_pay' && (
133
+ {paymethod === 'google_pay' ? (
135
134
  <View>
136
135
  <OButton
137
136
  textStyle={{
@@ -145,27 +144,26 @@ export const StripeMethodForm = (props: StripeMethodFormParams) => {
145
144
  style={{ marginTop: 20 }}
146
145
  />
147
146
  </View>
148
- // ) : (
149
- // <View>
150
- // {isApplePaySupported ? (
151
- // <>
152
- // <OText>{t('APPLE_PAY_PAYMENT', 'Apple pay payment')}</OText>
153
- // <ApplePayButton
154
- // onPress={pay}
155
- // type="plain"
156
- // buttonStyle="black"
157
- // borderRadius={4}
158
- // style={{
159
- // width: '100%',
160
- // height: 50,
161
- // }}
162
- // />
163
- // </>
164
- // ) : (
165
- // <OText>{t('APPLE_PAY_NOT_SUPPORTED', 'Apple pay not supported')}</OText>
166
- // )}
167
- // </View>
168
- // )}
147
+ ) : (
148
+ <View>
149
+ {isApplePaySupported ? (
150
+ <>
151
+ <OText>{t('APPLE_PAY_PAYMENT', 'Apple pay payment')}</OText>
152
+ <ApplePayButton
153
+ onPress={pay}
154
+ type="plain"
155
+ buttonStyle="black"
156
+ borderRadius={4}
157
+ style={{
158
+ width: '100%',
159
+ height: 50,
160
+ }}
161
+ />
162
+ </>
163
+ ) : (
164
+ <OText>{t('APPLE_PAY_NOT_SUPPORTED', 'Apple pay not supported')}</OText>
165
+ )}
166
+ </View>
169
167
  )}
170
168
  <Spinner
171
169
  visible={loadingGooglePayment}
@@ -37,7 +37,7 @@ const UpsellingProductsUI = (props: UpsellingProductsParams) => {
37
37
  imageStyle: {
38
38
  width: 120,
39
39
  height: 90,
40
- resizeMode: 'cover',
40
+ resizeMode: 'contain',
41
41
  borderRadius: 10
42
42
  },
43
43
  closeUpsellingButton: {
@@ -1,5 +1,6 @@
1
- import React from 'react';
1
+ import React, { useEffect, useState } from 'react';
2
2
  import {
3
+ UserFormDetails as UserProfileController,
3
4
  useSession,
4
5
  useLanguage,
5
6
  } from 'ordering-components/native';
@@ -13,6 +14,7 @@ import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityI
13
14
  import Ionicons from 'react-native-vector-icons/Ionicons'
14
15
 
15
16
  import {
17
+ OAlert,
16
18
  OIcon,
17
19
  OText
18
20
  } from '../shared';
@@ -20,18 +22,24 @@ import {
20
22
  Container,
21
23
  Names,
22
24
  UserInfoContainer,
23
- LanguageContainer
25
+ LanguageContainer,
26
+ RemoveAccountContainer
24
27
  } from './styles';
25
28
 
26
- export const UserProfileForm = (props: ProfileParams) => {
29
+ export const UserProfileFormUI = (props: ProfileParams) => {
27
30
  const {
28
- navigation
31
+ navigation,
32
+ handleRemoveAccount,
33
+ removeAccountState
29
34
  } = props;
30
35
 
31
36
  const theme = useTheme();
32
- const [{ user }] = useSession();
37
+ const [{ user }, { logout }] = useSession();
33
38
  const [, t] = useLanguage();
34
39
 
40
+ const isAdmin = user?.level === 0
41
+ const [confirm, setConfirm] = useState<any>({ open: false, content: null, handleOnAccept: null, id: null, title: null })
42
+
35
43
  const styles = StyleSheet.create({
36
44
  linkStyle: {
37
45
  color: theme.colors.primary,
@@ -44,6 +52,9 @@ export const UserProfileForm = (props: ProfileParams) => {
44
52
  },
45
53
  iconStyle: {
46
54
  fontSize: 24
55
+ },
56
+ removeAccount: {
57
+ flexDirection: 'row'
47
58
  }
48
59
  });
49
60
 
@@ -78,13 +89,31 @@ export const UserProfileForm = (props: ProfileParams) => {
78
89
  },
79
90
  chevronUp: {
80
91
  display: 'none'
81
- }
92
+ },
82
93
  })
83
94
 
84
95
  const onRedirect = (route: string, params?: any) => {
85
96
  navigation.navigate(route, params)
86
97
  }
87
98
 
99
+ const onRemoveAccount = () => {
100
+ setConfirm({
101
+ open: true,
102
+ content: [t('QUESTION_REMOVE_ACCOUNT', 'Are you sure that you want to remove your account?')],
103
+ title: t('ACCOUNT_ALERT', 'Account alert'),
104
+ handleOnAccept: () => {
105
+ setConfirm({ ...confirm, open: false })
106
+ handleRemoveAccount && handleRemoveAccount(user?.id)
107
+ }
108
+ })
109
+ }
110
+
111
+ useEffect(() => {
112
+ if (removeAccountState?.result === 'OK') {
113
+ logout()
114
+ }
115
+ }, [removeAccountState])
116
+
88
117
  return (
89
118
  <Container>
90
119
  <View>
@@ -134,7 +163,35 @@ export const UserProfileForm = (props: ProfileParams) => {
134
163
  <LanguageSelector pickerStyle={_pickerStyle} />
135
164
  </LanguageContainer>
136
165
  <LogoutButton />
166
+ <RemoveAccountContainer>
167
+ <TouchableOpacity
168
+ disabled={isAdmin}
169
+ style={styles.removeAccount}
170
+ onPress={() => onRemoveAccount()}
171
+ activeOpacity={0.7}
172
+ >
173
+ <OIcon src={theme.images.general.user} width={20} color={theme.colors.black} style={{ marginEnd: 14 }} />
174
+ <OText size={14} weight={'400'} style={{ opacity: isAdmin ? 0.5 : 1, top: 1 }} color={theme.colors.red}>{t('REMOVE_ACCOUNT', 'Remove account')}</OText>
175
+ </TouchableOpacity>
176
+ </RemoveAccountContainer>
137
177
  </View>
178
+ <OAlert
179
+ open={confirm.open}
180
+ title={confirm.title}
181
+ content={confirm.content}
182
+ onAccept={confirm.handleOnAccept}
183
+ onCancel={() => setConfirm({ ...confirm, open: false, title: null })}
184
+ onClose={() => setConfirm({ ...confirm, open: false, title: null })}
185
+ />
138
186
  </Container>
139
187
  );
140
188
  };
189
+
190
+ export const UserProfileForm = (props: any) => {
191
+ const profileProps = {
192
+ ...props,
193
+ UIComponent: UserProfileFormUI,
194
+ useSessionUser: true
195
+ };
196
+ return <UserProfileController {...profileProps} />;
197
+ };
@@ -35,3 +35,11 @@ export const LanguageContainer = styled.View`
35
35
  align-items: center;
36
36
  margin-bottom: 10px;
37
37
  `
38
+
39
+ export const RemoveAccountContainer = styled.View`
40
+ flex-direction: row;
41
+ justify-content: flex-start;
42
+ align-items: center;
43
+ margin-bottom: 10px;
44
+ margin-top: 15px;
45
+ `
@@ -2,7 +2,7 @@ import styled from 'styled-components/native';
2
2
 
3
3
  export const Container = styled.View`
4
4
  width: 100%;
5
- padding: 0 43px;
5
+ padding: 0 30px;
6
6
  `
7
7
 
8
8
  export const CountDownContainer = styled.View`
@@ -20,7 +20,6 @@ export const ResendSection = styled.View`
20
20
  display: flex;
21
21
  flex-direction: row;
22
22
  justify-content: center;
23
- flex-wrap: wrap;
24
23
  `
25
24
 
26
25
  export const WrappCountdown = styled.View`
@@ -78,7 +78,7 @@ const OModal = (props: Props): React.ReactElement => {
78
78
  animationType="slide"
79
79
  transparent={isTransparent}
80
80
  visible={open}
81
- onRequestClose={() => { onClose() }}
81
+ onRequestClose={() => { onClose && onClose() }}
82
82
  style={{ height: '100%', flex: 1, position: 'absolute', ...style, zIndex: 9999 }}
83
83
  >
84
84
  {isAvoidKeyBoardView ? (
@@ -0,0 +1,26 @@
1
+ import { useEffect, useState } from 'react'
2
+
3
+ /**
4
+ * Hook for countdown seconds
5
+ * @param {int} initialCount
6
+ * @param {boolean} start
7
+ */
8
+ export function useCountdownTimer (initialCount : number, start : boolean) {
9
+ const [count, setCount] = useState(initialCount)
10
+
11
+ useEffect(() => {
12
+ if (start) {
13
+ const secondsLeft = setInterval(() => {
14
+ setCount(c => c - (c === 0 ? 0 : 1))
15
+ }, 1000)
16
+ return () => clearInterval(secondsLeft)
17
+ }
18
+ }, [start])
19
+
20
+ return [
21
+ count,
22
+ setCount,
23
+ /** reset */
24
+ () => { setCount(initialCount) }
25
+ ]
26
+ }
@@ -6,6 +6,7 @@ import AddressForm from '../pages/AddressForm'
6
6
  import CartList from '../pages/CartList'
7
7
  import CheckoutPage from '../pages/Checkout';
8
8
  import BusinessProductsList from '../pages/BusinessProductsList';
9
+ import MultiCheckout from '../pages/MultiCheckout';
9
10
 
10
11
  const Stack = createStackNavigator();
11
12
 
@@ -53,6 +54,11 @@ const CheckoutNavigator = (props: any) => {
53
54
  component={AddressForm}
54
55
  options={{ headerShown: false }}
55
56
  />
57
+ <Stack.Screen
58
+ name="MultiCheckout"
59
+ children={() => <MultiCheckout {...checkoutProps} />}
60
+ options={{ headerShown: false }}
61
+ />
56
62
  </Stack.Navigator>
57
63
  );
58
64
  }
@@ -20,8 +20,10 @@ import Help from '../pages/Help'
20
20
  import HelpOrder from '../pages/HelpOrder'
21
21
  import HelpGuide from '../pages/HelpGuide'
22
22
  import HelpAccountAndPayment from '../pages/HelpAccountAndPayment'
23
+ import Sessions from '../pages/Sessions';
23
24
  import Splash from '../pages/Splash';
24
25
  import ProductDetails from '../pages/ProductDetails';
26
+ import MultiOrdersDetails from '../pages/MultiOrdersDetails';
25
27
  const Stack = createStackNavigator();
26
28
 
27
29
  const HomeNavigator = (e : any) => {
@@ -164,6 +166,16 @@ const HomeNavigator = (e : any) => {
164
166
  component={HelpAccountAndPayment}
165
167
  options={{ headerShown: false }}
166
168
  />
169
+ <Stack.Screen
170
+ name="Sessions"
171
+ component={Sessions}
172
+ options={{ headerShown: false }}
173
+ />
174
+ <Stack.Screen
175
+ name="MultiOrdersDetails"
176
+ component={MultiOrdersDetails}
177
+ options={{ headerShown: false }}
178
+ />
167
179
  </>
168
180
  )}
169
181
  </>
@@ -1,24 +1,25 @@
1
- import React, {useEffect} from 'react'
1
+ import React, { useEffect } from 'react'
2
2
  import { BusinessesListing as BusinessListingController } from '../components/BusinessesListing'
3
3
  import styled from 'styled-components/native'
4
4
  import { useTheme } from 'styled-components/native'
5
5
 
6
6
  const BusinessesListing = (props: any) => {
7
7
  const theme = useTheme()
8
- const businessId = props.route.params?.businessId
8
+ const businessId = props.route.params?.businessId
9
9
  const categoryId = props.route.params?.categoryId
10
- const productId = props.route.params?.productId
11
- const store = props.route.params?.store
10
+ const productId = props.route.params?.productId
11
+ const store = props.route.params?.store
12
12
 
13
13
  useEffect(() => {
14
- if(store){
15
- props.navigation.navigate('Business', {store,businessId,categoryId,productId})
14
+ if (store) {
15
+ props.navigation.navigate('Business', { store, businessId, categoryId, productId })
16
16
  return
17
17
  }
18
18
  }, [businessId, categoryId, productId, store])
19
19
 
20
20
  const BusinessesListingProps = {
21
21
  ...props,
22
+ navigation: props?.navigation,
22
23
  isSearchByName: true,
23
24
  isSearchByDescription: true,
24
25
  propsToFetch: ['id', 'name', 'header', 'logo', 'ribbon', 'location', 'schedule', 'open', 'delivery_price', 'distance', 'delivery_time', 'pickup_time', 'reviews', 'featured', 'offers', 'food', 'laundry', 'alcohol', 'groceries', 'slug'],