ordering-ui-react-native 0.16.35 → 0.16.36-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 (196) hide show
  1. package/package.json +7 -5
  2. package/src/DeliveryApp.tsx +43 -1
  3. package/src/components/ActiveOrders/index.tsx +61 -63
  4. package/src/components/ActiveOrders/styles.tsx +8 -14
  5. package/src/components/BusinessBasicInformation/index.tsx +11 -19
  6. package/src/components/BusinessInformation/index.tsx +33 -4
  7. package/src/components/BusinessInformation/styles.tsx +2 -2
  8. package/src/components/BusinessProductsList/index.tsx +10 -10
  9. package/src/components/BusinessesListing/index.tsx +1 -1
  10. package/src/components/Checkout/index.tsx +2 -1
  11. package/src/components/LanguageSelector/index.tsx +21 -16
  12. package/src/components/LoginForm/index.tsx +15 -0
  13. package/src/components/Messages/index.tsx +2 -2
  14. package/src/components/NotificationSetting/index.tsx +85 -0
  15. package/src/components/OrderDetails/index.tsx +2 -20
  16. package/src/components/OrdersOption/index.tsx +54 -56
  17. package/src/components/PaymentOptions/index.tsx +335 -365
  18. package/src/components/PaymentOptionsWebView/index.tsx +120 -121
  19. package/src/components/ReviewDriver/index.tsx +1 -1
  20. package/src/components/ReviewOrder/index.tsx +2 -1
  21. package/src/components/ReviewProducts/index.tsx +11 -0
  22. package/src/components/SignupForm/index.tsx +15 -0
  23. package/src/components/SingleProductReview/index.tsx +8 -5
  24. package/src/components/StripeElementsForm/index.tsx +25 -16
  25. package/src/components/VerifyPhone/styles.tsx +1 -2
  26. package/src/components/shared/OBottomPopup.tsx +6 -2
  27. package/src/index.tsx +2 -0
  28. package/src/pages/BusinessesListing.tsx +7 -6
  29. package/src/pages/OrderDetails.tsx +1 -1
  30. package/src/pages/ReviewDriver.tsx +2 -2
  31. package/src/pages/ReviewOrder.tsx +2 -2
  32. package/src/types/@fatnlazycat/react-native-recaptcha-v3/index.d.ts +1 -0
  33. package/src/utils/index.tsx +2 -1
  34. package/themes/business/src/components/BusinessController/index.tsx +2 -2
  35. package/themes/business/src/components/Chat/index.tsx +38 -30
  36. package/themes/business/src/components/DriverMap/index.tsx +7 -5
  37. package/themes/business/src/components/DriverSchedule/index.tsx +36 -19
  38. package/themes/business/src/components/LoginForm/index.tsx +111 -74
  39. package/themes/business/src/components/MapView/index.tsx +12 -1
  40. package/themes/business/src/components/MessagesOption/index.tsx +11 -1
  41. package/themes/business/src/components/NewOrderNotification/index.tsx +26 -41
  42. package/themes/business/src/components/OrderDetails/Business.tsx +1 -1
  43. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +25 -19
  44. package/themes/business/src/components/OrdersListManager/index.tsx +10 -3
  45. package/themes/business/src/components/OrdersOption/index.tsx +65 -21
  46. package/themes/business/src/components/OrdersOption/styles.tsx +5 -1
  47. package/themes/business/src/components/OrdersOptionBusiness/index.tsx +15 -1
  48. package/themes/business/src/components/OrdersOptionCity/index.tsx +15 -1
  49. package/themes/business/src/components/OrdersOptionDate/index.tsx +19 -6
  50. package/themes/business/src/components/OrdersOptionDelivery/index.tsx +15 -1
  51. package/themes/business/src/components/OrdersOptionDriver/index.tsx +15 -1
  52. package/themes/business/src/components/OrdersOptionPaymethod/index.tsx +15 -1
  53. package/themes/business/src/components/OrdersOptionStatus/index.tsx +10 -1
  54. package/themes/business/src/components/PreviousMessages/index.tsx +17 -18
  55. package/themes/business/src/components/PreviousOrders/index.tsx +21 -23
  56. package/themes/business/src/components/ProductItemAccordion/index.tsx +3 -2
  57. package/themes/business/src/components/ReviewCustomer/index.tsx +27 -13
  58. package/themes/business/src/components/ScheduleBlocked/index.tsx +2 -2
  59. package/themes/business/src/components/UserFormDetails/index.tsx +5 -2
  60. package/themes/business/src/components/UserProfileForm/index.tsx +2 -0
  61. package/themes/business/src/components/shared/ODropDown.tsx +42 -8
  62. package/themes/business/src/components/shared/ODropDownCalendar.tsx +36 -7
  63. package/themes/business/src/types/index.tsx +15 -9
  64. package/themes/business/src/utils/index.tsx +10 -0
  65. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  66. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  67. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  68. package/themes/kiosk/src/components/BusinessesListing/index.tsx +2 -1
  69. package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
  70. package/themes/kiosk/src/components/LoginForm/index.tsx +121 -10
  71. package/themes/kiosk/src/components/LoginForm/styles.tsx +5 -0
  72. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  73. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  74. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
  75. package/themes/kiosk/src/components/ProductForm/index.tsx +1 -14
  76. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  77. package/themes/kiosk/src/types/index.d.ts +2 -0
  78. package/themes/original/index.tsx +4 -0
  79. package/themes/original/src/components/AddressDetails/index.tsx +2 -2
  80. package/themes/original/src/components/AddressForm/index.tsx +151 -140
  81. package/themes/original/src/components/AddressList/index.tsx +1 -1
  82. package/themes/original/src/components/AppleLogin/index.tsx +4 -4
  83. package/themes/original/src/components/BusinessBasicInformation/index.tsx +324 -162
  84. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +6 -2
  85. package/themes/original/src/components/BusinessController/index.tsx +190 -113
  86. package/themes/original/src/components/BusinessController/styles.tsx +0 -7
  87. package/themes/original/src/components/BusinessItemAccordion/index.tsx +12 -6
  88. package/themes/original/src/components/BusinessListingSearch/BusinessControllerSkeletons/index.tsx +57 -0
  89. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/index.tsx +59 -0
  90. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/styles.tsx +13 -0
  91. package/themes/original/src/components/BusinessListingSearch/index.tsx +80 -128
  92. package/themes/original/src/components/BusinessListingSearch/styles.tsx +10 -12
  93. package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/index.tsx +87 -0
  94. package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/styles.tsx +12 -0
  95. package/themes/original/src/components/BusinessProductsList/index.tsx +49 -52
  96. package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
  97. package/themes/original/src/components/BusinessProductsListing/index.tsx +179 -104
  98. package/themes/original/src/components/BusinessProductsListing/styles.tsx +18 -11
  99. package/themes/original/src/components/BusinessReviews/index.tsx +6 -1
  100. package/themes/original/src/components/BusinessTypeFilter/index.tsx +3 -2
  101. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +37 -25
  102. package/themes/original/src/components/BusinessesListing/Layout/Appointment/styles.tsx +5 -4
  103. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +278 -104
  104. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +47 -10
  105. package/themes/original/src/components/BusinessesListing/index.tsx +95 -7
  106. package/themes/original/src/components/Cart/index.tsx +54 -16
  107. package/themes/original/src/components/Cart/styles.tsx +4 -0
  108. package/themes/original/src/components/CartContent/index.tsx +22 -16
  109. package/themes/original/src/components/Checkout/index.tsx +109 -64
  110. package/themes/original/src/components/Checkout/styles.tsx +0 -1
  111. package/themes/original/src/components/DriverTips/index.tsx +4 -4
  112. package/themes/original/src/components/DriverTips/styles.tsx +2 -1
  113. package/themes/original/src/components/Favorite/index.tsx +1 -0
  114. package/themes/original/src/components/FavoriteList/index.tsx +32 -2
  115. package/themes/original/src/components/FloatingButton/styles.tsx +1 -1
  116. package/themes/original/src/components/GPSButton/index.tsx +20 -19
  117. package/themes/original/src/components/GoogleMap/index.tsx +20 -12
  118. package/themes/original/src/components/HelpAccountAndPayment/index.tsx +25 -10
  119. package/themes/original/src/components/HelpAccountAndPayment/styles.tsx +4 -0
  120. package/themes/original/src/components/HelpGuide/index.tsx +9 -8
  121. package/themes/original/src/components/HelpOrder/index.tsx +9 -8
  122. package/themes/original/src/components/LanguageSelector/index.tsx +19 -14
  123. package/themes/original/src/components/LoginForm/Otp/index.tsx +95 -72
  124. package/themes/original/src/components/LoginForm/index.tsx +107 -50
  125. package/themes/original/src/components/LottieAnimation/index.tsx +69 -0
  126. package/themes/original/src/components/Messages/index.tsx +17 -17
  127. package/themes/original/src/components/MomentOption/index.tsx +8 -6
  128. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +92 -92
  129. package/themes/original/src/components/MultiCheckout/index.tsx +6 -0
  130. package/themes/original/src/components/MultiOrdersDetails/index.tsx +20 -16
  131. package/themes/original/src/components/MyOrders/index.tsx +70 -6
  132. package/themes/original/src/components/NavBar/index.tsx +15 -9
  133. package/themes/original/src/components/NetworkError/index.tsx +5 -3
  134. package/themes/original/src/components/NotFoundSource/index.tsx +2 -1
  135. package/themes/original/src/components/Notifications/index.tsx +148 -0
  136. package/themes/original/src/components/Notifications/styles.tsx +17 -0
  137. package/themes/original/src/components/OrderDetails/OrderHistory.tsx +167 -0
  138. package/themes/original/src/components/OrderDetails/index.tsx +200 -37
  139. package/themes/original/src/components/OrderDetails/styles.tsx +15 -2
  140. package/themes/original/src/components/OrderItAgain/index.tsx +75 -0
  141. package/themes/original/src/components/OrderItAgain/styles.tsx +10 -0
  142. package/themes/original/src/components/OrderProgress/index.tsx +77 -66
  143. package/themes/original/src/components/OrderProgress/styles.tsx +5 -0
  144. package/themes/original/src/components/OrderSummary/index.tsx +3 -36
  145. package/themes/original/src/components/OrderTypeSelector/index.tsx +85 -36
  146. package/themes/original/src/components/OrderTypeSelector/styles.tsx +19 -1
  147. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/index.tsx +97 -106
  148. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +3 -0
  149. package/themes/original/src/components/OrdersOption/index.tsx +71 -55
  150. package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
  151. package/themes/original/src/components/PaymentOptions/index.tsx +41 -23
  152. package/themes/original/src/components/PhoneInputNumber/index.tsx +5 -11
  153. package/themes/original/src/components/PlaceSpot/index.tsx +243 -47
  154. package/themes/original/src/components/PlaceSpot/styles.tsx +0 -2
  155. package/themes/original/src/components/PreviousOrders/index.tsx +3 -2
  156. package/themes/original/src/components/ProductForm/index.tsx +635 -664
  157. package/themes/original/src/components/ProductForm/styles.tsx +9 -8
  158. package/themes/original/src/components/ProductItemAccordion/index.tsx +199 -128
  159. package/themes/original/src/components/ProductOption/index.tsx +1 -1
  160. package/themes/original/src/components/ProfessionalFilter/index.tsx +2 -1
  161. package/themes/original/src/components/ProfessionalProfile/index.tsx +26 -14
  162. package/themes/original/src/components/ReviewDriver/index.tsx +7 -7
  163. package/themes/original/src/components/ReviewOrder/index.tsx +18 -3
  164. package/themes/original/src/components/ReviewProducts/index.tsx +2 -2
  165. package/themes/original/src/components/ReviewTrigger/index.tsx +118 -0
  166. package/themes/original/src/components/ReviewTrigger/styles.tsx +34 -0
  167. package/themes/original/src/components/SearchBar/index.tsx +5 -3
  168. package/themes/original/src/components/ServiceForm/index.tsx +410 -258
  169. package/themes/original/src/components/SignupForm/index.tsx +362 -210
  170. package/themes/original/src/components/SingleOrderCard/index.tsx +229 -181
  171. package/themes/original/src/components/SingleOrderCard/styles.tsx +0 -7
  172. package/themes/original/src/components/SingleProductCard/index.tsx +200 -110
  173. package/themes/original/src/components/SingleProductCard/styles.tsx +2 -10
  174. package/themes/original/src/components/SingleProductReview/index.tsx +38 -5
  175. package/themes/original/src/components/SingleProductReview/styles.tsx +12 -0
  176. package/themes/original/src/components/StripeElementsForm/index.tsx +18 -7
  177. package/themes/original/src/components/UpsellingProducts/index.tsx +15 -5
  178. package/themes/original/src/components/UserDetails/index.tsx +11 -2
  179. package/themes/original/src/components/UserFormDetails/index.tsx +67 -77
  180. package/themes/original/src/components/UserProfile/index.tsx +56 -31
  181. package/themes/original/src/components/UserProfile/styles.ts +17 -0
  182. package/themes/original/src/components/UserProfileForm/index.tsx +10 -10
  183. package/themes/original/src/components/WalletTransactions/index.tsx +76 -0
  184. package/themes/original/src/components/WalletTransactions/styles.tsx +13 -0
  185. package/themes/original/src/components/Wallets/index.tsx +176 -164
  186. package/themes/original/src/components/Wallets/styles.tsx +12 -8
  187. package/themes/original/src/components/shared/CardAnimation.tsx +47 -0
  188. package/themes/original/src/components/shared/OBottomPopup.tsx +48 -15
  189. package/themes/original/src/components/shared/OButton.tsx +10 -3
  190. package/themes/original/src/components/shared/OIcon.tsx +8 -1
  191. package/themes/original/src/components/shared/OInput.tsx +13 -3
  192. package/themes/original/src/layouts/Container.tsx +13 -9
  193. package/themes/original/src/layouts/FloatingBottomContainer.tsx +5 -1
  194. package/themes/original/src/types/index.tsx +91 -30
  195. package/themes/original/src/utils/index.tsx +121 -10
  196. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
@@ -24,6 +24,7 @@ import { DriverTips } from '../DriverTips';
24
24
  import { NotFoundSource } from '../NotFoundSource';
25
25
  import { UserDetails } from '../UserDetails';
26
26
  import { PaymentOptionWallet } from '../PaymentOptionWallet';
27
+ import { PlaceSpot } from '../PlaceSpot'
27
28
 
28
29
  import {
29
30
  ChContainer,
@@ -105,8 +106,7 @@ const CheckoutUI = (props: any) => {
105
106
  padding: 20
106
107
  },
107
108
  pagePadding: {
108
- paddingLeft: 40,
109
- paddingRight: 40
109
+ paddingHorizontal: 40
110
110
  },
111
111
  icon: {
112
112
  top: 15,
@@ -114,9 +114,15 @@ const CheckoutUI = (props: any) => {
114
114
  position: 'absolute',
115
115
  fontSize: 20
116
116
  },
117
- wrapperNavbar: Platform.OS === 'ios'
118
- ? { paddingVertical: 0, paddingHorizontal: 40 }
119
- : { paddingVertical: 20, paddingHorizontal: 40 }
117
+ detailWrapper: {
118
+ paddingHorizontal: 40,
119
+ width: '100%'
120
+ },
121
+ wrapperNavbar: {
122
+ paddingVertical: 0,
123
+ paddingHorizontal: 40,
124
+ marginVertical: 2
125
+ }
120
126
  })
121
127
 
122
128
  const [, { showToast }] = useToast();
@@ -136,8 +142,11 @@ const CheckoutUI = (props: any) => {
136
142
  const [isDeliveryOptionModalVisible, setIsDeliveryOptionModalVisible] = useState(false)
137
143
  const [showGateway, setShowGateway] = useState<any>({ closedByUsed: false, open: false });
138
144
  const [webviewPaymethod, setWebviewPaymethod] = useState<any>(null)
145
+ const [isOpen, setIsOpen] = useState(false)
146
+ const [requiredFields, setRequiredFields] = useState<any>([])
139
147
 
140
- const placeSpotTypes = [3, 4]
148
+ const placeSpotTypes = [3, 4, 5]
149
+ const placeSpotsEnabled = placeSpotTypes.includes(options?.type)
141
150
  const businessConfigs = businessDetails?.business?.configs ?? []
142
151
  const isWalletCashEnabled = businessConfigs.find((config: any) => config.key === 'wallet_cash_enabled')?.value === '1'
143
152
  const isWalletCreditPointsEnabled = businessConfigs.find((config: any) => config.key === 'wallet_credit_point_enabled')?.value === '1'
@@ -145,8 +154,14 @@ const CheckoutUI = (props: any) => {
145
154
  const isBusinessChangeEnabled = configs?.cart_change_business_validation?.value === '1'
146
155
 
147
156
  const isPreOrder = configs?.preorder_status_enabled?.value === '1'
148
- const isDisabledButtonPlace = loading || !cart?.valid || (!paymethodSelected && cart?.balance > 0) || placing || errorCash ||
149
- cart?.subtotal < cart?.minimum || (placeSpotTypes.includes(options?.type) && !cart?.place) ||
157
+ const subtotalWithTaxes = cart?.taxes?.reduce((acc: any, item: any) => {
158
+ if (item?.type === 1)
159
+ return acc = acc + item?.summary?.tax
160
+ return acc = acc
161
+ }, cart?.subtotal)
162
+ const isDisabledButtonPlace = loading || !cart?.valid || (!paymethodSelected && cart?.balance > 0) ||
163
+ placing || errorCash || subtotalWithTaxes < cart?.minimum ||
164
+ // (placeSpotTypes.includes(options?.type) && !cart?.place) ||
150
165
  (options.type === 1 &&
151
166
  validationFields?.fields?.checkout?.driver_tip?.enabled &&
152
167
  validationFields?.fields?.checkout?.driver_tip?.required &&
@@ -172,11 +187,15 @@ const CheckoutUI = (props: any) => {
172
187
  }
173
188
  }
174
189
 
175
- const handlePlaceOrder = (confirmPayment) => {
176
- if (!userErrors.length) {
190
+ const handlePlaceOrder = (confirmPayment: any, forcePlace: boolean = false) => {
191
+ if (!userErrors.length && !requiredFields?.length || forcePlace) {
177
192
  handlerClickPlaceOrder && handlerClickPlaceOrder(null, null, confirmPayment)
178
193
  return
179
194
  }
195
+ if (requiredFields?.length) {
196
+ setIsOpen(true)
197
+ return
198
+ }
180
199
  let stringError = ''
181
200
  Object.values(userErrors).map((item: any, i: number) => {
182
201
  stringError += (i + 1) === userErrors.length ? `- ${item?.message || item}` : `- ${item?.message || item}\n`
@@ -204,11 +223,12 @@ const CheckoutUI = (props: any) => {
204
223
  setUserErrors([])
205
224
  const errors = []
206
225
  const notFields = ['coupon', 'driver_tip', 'mobile_phone', 'address', 'zipcode', 'address_notes']
226
+ const _requiredFields: any = []
207
227
 
208
228
  Object.values(validationFields?.fields?.checkout).map((field: any) => {
209
- if (field?.required && !notFields.includes(field.code)) {
229
+ if (field?.required && !notFields.includes(field.code) && field?.enabled) {
210
230
  if (!user[field?.code]) {
211
- errors.push(t(`VALIDATION_ERROR_${field.code.toUpperCase()}_REQUIRED`, `The field ${field?.name} is required`))
231
+ _requiredFields.push(field?.code)
212
232
  }
213
233
  }
214
234
  })
@@ -219,8 +239,9 @@ const CheckoutUI = (props: any) => {
219
239
  validationFields?.fields?.checkout?.cellphone?.required) ||
220
240
  configs?.verification_phone_required?.value === '1')
221
241
  ) {
222
- errors.push(t('VALIDATION_ERROR_MOBILE_PHONE_REQUIRED', 'The field Phone number is required'))
242
+ _requiredFields.push('cellphone')
223
243
  }
244
+ setRequiredFields(_requiredFields)
224
245
 
225
246
  if (phoneUpdate) {
226
247
  errors.push(t('NECESSARY_UPDATE_COUNTRY_PHONE_CODE', 'It is necessary to update your phone number'))
@@ -270,7 +291,6 @@ const CheckoutUI = (props: any) => {
270
291
  onActionLeft={() => navigation?.canGoBack() && navigation.goBack()}
271
292
  showCall={false}
272
293
  btnStyle={{ paddingLeft: 0 }}
273
- style={{ marginTop: Platform.OS === 'ios' ? 0 : 30 }}
274
294
  titleWrapStyle={{ paddingHorizontal: 0 }}
275
295
  titleStyle={{ marginRight: 0, marginLeft: 0 }}
276
296
  />
@@ -315,10 +335,10 @@ const CheckoutUI = (props: any) => {
315
335
  !businessDetails?.error &&
316
336
  (
317
337
  <Placeholder Animation={Fade}>
318
- <PlaceholderLine height={20} width={70} />
319
- <PlaceholderLine height={10} width={60} />
320
- <PlaceholderLine height={10} width={60} />
321
- <PlaceholderLine height={10} width={80} style={{ marginBottom: 20 }} />
338
+ <PlaceholderLine height={20} />
339
+ <PlaceholderLine height={12} />
340
+ <PlaceholderLine height={12} />
341
+ <PlaceholderLine height={12} style={{ marginBottom: 20 }} />
322
342
  </Placeholder>
323
343
  )}
324
344
  {
@@ -327,7 +347,7 @@ const CheckoutUI = (props: any) => {
327
347
  Object.values(businessDetails?.business).length > 0 &&
328
348
  (
329
349
  <>
330
- <OText size={16} lineHeight={24} weight={'500'} mBottom={10}>
350
+ <OText size={16} lineHeight={24} weight={'500'} mBottom={10} color={theme.colors.textNormal}>
331
351
  {t('BUSINESS_DETAILS', 'Business Details')}
332
352
  </OText>
333
353
  <View>
@@ -348,7 +368,7 @@ const CheckoutUI = (props: any) => {
348
368
  )}
349
369
  {businessDetails?.error && businessDetails?.error?.length > 0 && (
350
370
  <View>
351
- <OText size={16} lineHeight={24} weight={'500'}>
371
+ <OText size={16} lineHeight={24} weight={'500'} color={theme.colors.textNormal}>
352
372
  {t('BUSINESS_DETAILS', 'Business Details')}
353
373
  </OText>
354
374
  <NotFoundSource
@@ -364,10 +384,10 @@ const CheckoutUI = (props: any) => {
364
384
  <ChUserDetails>
365
385
  {cartState.loading ? (
366
386
  <Placeholder Animation={Fade}>
367
- <PlaceholderLine height={20} width={70} />
368
- <PlaceholderLine height={10} width={60} />
369
- <PlaceholderLine height={10} width={60} />
370
- <PlaceholderLine height={10} width={80} style={{ marginBottom: 20 }} />
387
+ <PlaceholderLine height={20} />
388
+ <PlaceholderLine height={12} />
389
+ <PlaceholderLine height={12} />
390
+ <PlaceholderLine height={12} style={{ marginBottom: 20 }} />
371
391
  </Placeholder>
372
392
  ) : (
373
393
  <UserDetails
@@ -391,13 +411,13 @@ const CheckoutUI = (props: any) => {
391
411
  {cartState.loading || deliveryOptionSelected === undefined ? (
392
412
  <View style={{ height: 110 }}>
393
413
  <Placeholder Animation={Fade}>
394
- <PlaceholderLine height={20} width={70} />
395
- <PlaceholderLine height={40} width={100} />
414
+ <PlaceholderLine height={20} />
415
+ <PlaceholderLine height={40} />
396
416
  </Placeholder>
397
417
  </View>
398
418
  ) : (
399
419
  <>
400
- <OText size={16}>{t('DELIVERY_OPTIONS', 'Delivery options')}</OText>
420
+ <OText size={16} color={theme.colors.textNormal} mBottom={10}>{t('DELIVERY_OPTIONS', 'Delivery options')}</OText>
401
421
  <View
402
422
  style={{
403
423
  backgroundColor: theme.colors.inputDisabled,
@@ -583,6 +603,20 @@ const CheckoutUI = (props: any) => {
583
603
  )}
584
604
 
585
605
 
606
+ {!cartState.loading && placeSpotsEnabled && (
607
+ <>
608
+ <View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginTop: 30, marginHorizontal: -40 }} />
609
+ <PlaceSpot
610
+ isCheckout
611
+ isInputMode
612
+ cart={cart}
613
+ spotNumberDefault={cartState?.cart?.spot_number ?? cart?.spot_number}
614
+ vehicleDefault={cart?.vehicle}
615
+ />
616
+ <View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginHorizontal: -40 }} />
617
+ </>
618
+ )}
619
+
586
620
  {!cartState.loading && cart && (
587
621
  <ChSection>
588
622
  <ChCart>
@@ -598,7 +632,6 @@ const CheckoutUI = (props: any) => {
598
632
  size={16}
599
633
  lineHeight={24}
600
634
  color={theme.colors.textNormal}
601
- style={{ fontWeight: '500' }}
602
635
  >
603
636
  {t('MOBILE_FRONT_YOUR_ORDER', 'Your order')}
604
637
  </OText>
@@ -606,7 +639,7 @@ const CheckoutUI = (props: any) => {
606
639
  onPress={() => onNavigationRedirect('Business', { store: cart?.business?.slug })}
607
640
  >
608
641
  <OText
609
- size={10}
642
+ size={12}
610
643
  lineHeight={15}
611
644
  color={theme.colors.primary}
612
645
  style={{ textDecorationLine: 'underline' }}
@@ -623,7 +656,7 @@ const CheckoutUI = (props: any) => {
623
656
  <OText
624
657
  size={12}
625
658
  lineHeight={18}
626
- color={theme.colors.textSecondary}
659
+ color={theme.colors.primary}
627
660
  style={{ textDecorationLine: 'underline' }}
628
661
  >
629
662
  {t('CHANGE_STORE', 'Change store')}
@@ -634,6 +667,7 @@ const CheckoutUI = (props: any) => {
634
667
  cart={cart}
635
668
  isCartPending={cart?.status === 2}
636
669
  onNavigationRedirect={onNavigationRedirect}
670
+ placeSpotTypes={placeSpotTypes}
637
671
  />
638
672
  </>
639
673
  )}
@@ -670,14 +704,6 @@ const CheckoutUI = (props: any) => {
670
704
  {t('WARNING_INVALID_PRODUCTS_CHECKOUT', 'To continue with your checkout, please remove from your cart the products that are not available.')}
671
705
  </OText>
672
706
  )}
673
- {placeSpotTypes.includes(options?.type) && !cart?.place && (
674
- <OText
675
- color={theme.colors.error}
676
- size={12}
677
- >
678
- {t('WARNING_PLACE_SPOT', 'Please, select your spot to place order.')}
679
- </OText>
680
- )}
681
707
  {options.type === 1 &&
682
708
  validationFields?.fields?.checkout?.driver_tip?.enabled &&
683
709
  validationFields?.fields?.checkout?.driver_tip?.required &&
@@ -703,14 +729,39 @@ const CheckoutUI = (props: any) => {
703
729
  onClose={() => setOpenChangeStore(false)}
704
730
  />
705
731
  </OModal>
732
+ <OModal
733
+ open={isOpen}
734
+ onClose={() => setIsOpen(false)}
735
+ >
736
+ <View style={styles.detailWrapper}>
737
+ <UserDetails
738
+ isUserDetailsEdit
739
+ cartStatus={cart?.status}
740
+ businessId={cart?.business_id}
741
+ useValidationFields
742
+ useDefualtSessionManager
743
+ useSessionUser
744
+ isCheckout
745
+ isEdit
746
+ phoneUpdate={phoneUpdate}
747
+ togglePhoneUpdate={togglePhoneUpdate}
748
+ requiredFields={requiredFields}
749
+ hideUpdateButton
750
+ onClose={() => {
751
+ setIsOpen(false)
752
+ handlePlaceOrder(null, true)
753
+ }}
754
+ />
755
+ </View>
756
+ </OModal>
706
757
  </ChContainer>
707
758
  </Container>
708
759
  {!cartState.loading && cart && cart?.status !== 2 && (
709
760
  <FloatingButton
710
- handleClick={() => handlePlaceOrder()}
761
+ handleClick={() => handlePlaceOrder(null)}
711
762
  isSecondaryBtn={isDisabledButtonPlace}
712
763
  disabled={isDisabledButtonPlace}
713
- btnText={cart?.subtotal >= cart?.minimum
764
+ btnText={subtotalWithTaxes >= cart?.minimum
714
765
  ? (
715
766
  placing
716
767
  ? t('PLACING', 'Placing')
@@ -721,7 +772,7 @@ const CheckoutUI = (props: any) => {
721
772
  : (`${t('MINIMUN_SUBTOTAL_ORDER', 'Minimum subtotal order:')} ${parsePrice(cart?.minimum)}`)
722
773
  }
723
774
  btnRightValueShow
724
- btnRightValue={parsePrice(cart?.total)}
775
+ btnRightValue={parsePrice(cart?.balance)}
725
776
  iosBottom={30}
726
777
  />
727
778
  )}
@@ -737,19 +788,6 @@ const CheckoutUI = (props: any) => {
737
788
  setShowGateway={setShowGateway}
738
789
  />
739
790
  )}
740
- {webviewPaymethod?.gateway === 'square' && showGateway.open && (
741
- <PaymentOptionsWebView
742
- onNavigationRedirect={onNavigationRedirect}
743
- uri={`https://test-square-f50f7.web.app`}
744
- user={user}
745
- token={token}
746
- cart={cart}
747
- currency={currency}
748
- webviewPaymethod={webviewPaymethod}
749
- setShowGateway={setShowGateway}
750
- locationId={'L1NGAY5M6KJRX'}
751
- />
752
- )}
753
791
  </>
754
792
  )
755
793
  }
@@ -775,16 +813,23 @@ export const Checkout = (props: any) => {
775
813
 
776
814
  const getOrder = async (cartId: any) => {
777
815
  try {
778
- setCartState({ ...cartState, loading: true })
779
- const url = `${ordering.root}/carts/${cartId}`
780
- const response = await fetch(url, {
781
- method: 'GET',
782
- headers: {
783
- 'Content-Type': 'application/json',
784
- Authorization: `Bearer ${token}`
785
- }
786
- })
787
- const { result } = await response.json();
816
+ let result: any = {}
817
+ const cart = orderState?.carts.find((cart: any) => cart.uuid === cartId)
818
+ if (cart) {
819
+ result = { ...cart }
820
+ } else {
821
+ setCartState({ ...cartState, loading: true })
822
+ const url = `${ordering.root}/carts/${cartId}`
823
+ const response = await fetch(url, {
824
+ method: 'GET',
825
+ headers: {
826
+ 'Content-Type': 'application/json',
827
+ Authorization: `Bearer ${token}`
828
+ }
829
+ })
830
+ const content = await response.json();
831
+ result = content.result
832
+ }
788
833
 
789
834
  let publicKey = null
790
835
  try {
@@ -76,7 +76,6 @@ export const ChCart = styled(ChPaymethods)``
76
76
 
77
77
  export const WalletPaymentOptionContainer = styled(ChPaymethods)`
78
78
  padding-bottom: 0;
79
- margin-left: -20px;
80
79
  `
81
80
 
82
81
  export const ChPlaceOrderBtn = styled.View`
@@ -35,8 +35,8 @@ const DriverTipsUI = (props: any) => {
35
35
  const theme = useTheme();
36
36
 
37
37
  const style = StyleSheet.create({
38
- circle: {
39
- borderRadius: 30
38
+ semicircle: {
39
+ borderRadius: 8
40
40
  },
41
41
  inputStyle: {
42
42
  flex: 1,
@@ -75,10 +75,10 @@ const DriverTipsUI = (props: any) => {
75
75
  onPress={() => handlerChangeOption(option)}
76
76
  >
77
77
  <DTCard
78
- style={style.circle}
78
+ style={style.semicircle}
79
79
  isActive={option === optionSelected}
80
80
  >
81
- <OText size={12} numberOfLines={1} color={option === optionSelected ? '#FFF' : theme.colors.textSecondary}>
81
+ <OText size={12} numberOfLines={2} color={option === optionSelected ? '#FFF' : theme.colors.textSecondary}>
82
82
  {`${isFixedPrice ? parsePrice(option) : `${option}%`}`}
83
83
  </OText>
84
84
  </DTCard>
@@ -26,11 +26,12 @@ export const DTCard = styled.View`
26
26
  text-transform: capitalize;
27
27
  min-height: 55px;
28
28
  min-width: 55px;
29
- max-width: 55px;
29
+ max-width: 80px;
30
30
  max-height: 55px;
31
31
  margin-right: 10px;
32
32
  margin-left: 10px;
33
33
  margin-top: 10px;
34
+ padding-horizontal: 10px;
34
35
 
35
36
  ${(props: any) => props.isActive && css`
36
37
  background-color: ${(props: any) => props.theme.colors.primary};
@@ -75,6 +75,7 @@ export const Favorite = (props: any) => {
75
75
  <FavoriteList
76
76
  favoriteURL='favorite_products'
77
77
  originalURL='products'
78
+ onNavigationRedirect={onRedirect}
78
79
  isProduct
79
80
  />
80
81
  )}
@@ -14,6 +14,7 @@ import { Container, WrappButton } from './styles'
14
14
  import { OButton } from '../shared';
15
15
  import { BusinessController } from '../BusinessController';
16
16
  import { SingleProductCard } from '../SingleProductCard';
17
+ import { NotFoundSource } from '../NotFoundSource';
17
18
  import moment from 'moment';
18
19
 
19
20
 
@@ -73,6 +74,17 @@ const FavoriteListUI = (props: FavoriteParams) => {
73
74
  return objectStatus && objectStatus
74
75
  }
75
76
 
77
+ const onProductClick = (product: any) => {
78
+ const categoryId = product?.category?.id
79
+ const businessId = product?.category?.business?.id
80
+ if (!categoryId || !businessId) return
81
+ onNavigationRedirect && onNavigationRedirect('ProductDetails', {
82
+ productId: product?.id,
83
+ categoryId: categoryId,
84
+ businessId: businessId
85
+ })
86
+ }
87
+
76
88
  useEffect(() => {
77
89
  const _businessId = 'businessId:' + reorderState?.result?.business_id
78
90
  if (reorderState?.error) {
@@ -213,6 +225,12 @@ const FavoriteListUI = (props: FavoriteParams) => {
213
225
  <BusinessSkeleton key={i} />
214
226
  ))
215
227
  )}
228
+ {!favoriteList?.loading && !favoriteList?.favorites?.length && (
229
+ <NotFoundSource
230
+ content={t('NOT_FOUND_FAVORITES_LIST', 'No favorites to show at this time.')
231
+ }
232
+ />
233
+ )}
216
234
  </>
217
235
  )}
218
236
 
@@ -239,6 +257,12 @@ const FavoriteListUI = (props: FavoriteParams) => {
239
257
  <OrderSkeleton key={i} />
240
258
  ))
241
259
  )}
260
+ {!favoriteList?.loading && !favoriteList?.favorites?.length && (
261
+ <NotFoundSource
262
+ content={t('NOT_FOUND_FAVORITES_LIST', 'No favorites to show at this time.')
263
+ }
264
+ />
265
+ )}
242
266
  </>
243
267
  )}
244
268
 
@@ -248,9 +272,9 @@ const FavoriteListUI = (props: FavoriteParams) => {
248
272
  favoriteList.favorites?.sort((a: any, b: any) => a?.name?.toLowerCase() > b?.name?.toLowerCase()).map((product: any, i: number) => (
249
273
  <SingleProductCard
250
274
  key={`${product?.id}_${i}`}
251
- isSoldOut={product.inventoried && !product.quantity}
275
+ isSoldOut={product?.inventoried && !product?.quantity}
252
276
  product={product}
253
- onProductClick={() => {}}
277
+ onProductClick={onProductClick}
254
278
  handleUpdateProducts={handleUpdateFavoriteList}
255
279
  />
256
280
  ))
@@ -260,6 +284,12 @@ const FavoriteListUI = (props: FavoriteParams) => {
260
284
  <ProductSkeleton key={i} />
261
285
  ))
262
286
  )}
287
+ {!favoriteList?.loading && !favoriteList?.favorites?.length && (
288
+ <NotFoundSource
289
+ content={t('NOT_FOUND_FAVORITES_LIST', 'No favorites to show at this time.')
290
+ }
291
+ />
292
+ )}
263
293
  </>
264
294
  )}
265
295
 
@@ -12,7 +12,7 @@ export const Container = styled.View`
12
12
  width: 100%;
13
13
  justify-content: space-between;
14
14
  background-color: #FFF;
15
- z-index: 1000;
15
+ z-index: 9999;
16
16
  justify-content: space-between;
17
17
  `
18
18
 
@@ -1,17 +1,16 @@
1
1
  import React, { useEffect, useState } from 'react'
2
- import { getTrackingStatus, requestTrackingPermission } from 'react-native-tracking-transparency'
3
- import Geolocation from '@react-native-community/geolocation'
4
2
  import Geocoder from 'react-native-geocoding'
5
- import { GpsButtonStyle } from './styles'
6
- import { View } from 'react-native'
7
- import { OText } from '../shared'
8
3
  import { ActivityIndicator } from 'react-native-paper'
4
+ import Geolocation from '@react-native-community/geolocation'
5
+ import { getTrackingStatus, requestTrackingPermission } from 'react-native-tracking-transparency'
6
+
7
+ import { OText } from '../shared'
8
+ import { GpsButtonStyle } from './styles'
9
9
 
10
10
  export const GPSButton = (props: any) => {
11
11
  const {
12
12
  handleGPS,
13
13
  apiKey,
14
- googleReady,
15
14
  IconButton,
16
15
  IconLoadingButton
17
16
  } = props
@@ -56,25 +55,27 @@ export const GPSButton = (props: any) => {
56
55
  })
57
56
  }
58
57
 
59
- const getCurrentPosition = async () => {
58
+ const getCurrentPosition = async () => {
60
59
  let trackingStatus = await getTrackingStatus()
61
- if (trackingStatus === 'not-determined') {
62
- trackingStatus = await requestTrackingPermission()
63
- }
64
- if (trackingStatus === 'authorized' || trackingStatus === 'unavailable') {
65
- setLoading(true);
60
+ if (trackingStatus === 'not-determined') {
61
+ trackingStatus = await requestTrackingPermission()
62
+ }
63
+ if (trackingStatus === 'authorized' || trackingStatus === 'unavailable') {
64
+ setLoading(true)
66
65
  Geolocation.getCurrentPosition((pos) => {
67
- geoCodePosition(pos.coords);
66
+ geoCodePosition(pos.coords)
68
67
  }, (err) => {
69
68
  setLoading(false);
70
- console.log(err);
71
- });
69
+ console.log(`ERROR(${err.code}): ${err.message}`)
70
+ }, {
71
+ enableHighAccuracy: true, timeout: 15000, maximumAge: 10000
72
+ })
72
73
  }
73
- }
74
+ }
74
75
 
75
- useEffect(() => {
76
- Geocoder.init(apiKey);
77
- }, [])
76
+ useEffect(() => {
77
+ Geocoder.init(apiKey);
78
+ }, [])
78
79
 
79
80
  return (
80
81
  <GpsButtonStyle
@@ -32,6 +32,7 @@ export const GoogleMap = (props: GoogleMapsParams) => {
32
32
  latitudeDelta: 0.0010,
33
33
  longitudeDelta: 0.0010 * ASPECT_RATIO
34
34
  })
35
+ const [MARKERS, SETMARKERS] = useState(locations)
35
36
  let mapRef = useRef<any>(null)
36
37
  const googleMapsApiKey = configState?.configs?.google_maps_api_key?.value
37
38
 
@@ -41,12 +42,7 @@ export const GoogleMap = (props: GoogleMapsParams) => {
41
42
  ERROR_NOT_FOUND_ADDRESS: 'Sorry, we couldn\'t find an address',
42
43
  ERROR_MAX_LIMIT_LOCATION: `Sorry, You can only set the position to ${maxLimitLocation}m`
43
44
  }
44
- const MARKERS = locations && locations.map((location: { lat: number, lng: number }) => {
45
- return {
46
- latitude: location.lat,
47
- longitude: location.lng
48
- }
49
- })
45
+
50
46
  const geocodePosition = (pos: { latitude: number, longitude: number }) => {
51
47
  Geocoder.from({
52
48
  latitude: pos.latitude,
@@ -93,7 +89,9 @@ export const GoogleMap = (props: GoogleMapsParams) => {
93
89
  return
94
90
  }
95
91
 
96
- if (distance <= maxLimitLocation) {
92
+ const _maxLimitLocation = typeof maxLimitLocation === 'string' ? parseInt(maxLimitLocation, 10) : maxLimitLocation
93
+
94
+ if (distance <= _maxLimitLocation) {
97
95
  setMarkerPosition(curPos)
98
96
  setRegion({ ...region, longitude: curPos.longitude, latitude: curPos.latitude })
99
97
  } else {
@@ -147,7 +145,7 @@ export const GoogleMap = (props: GoogleMapsParams) => {
147
145
  }
148
146
 
149
147
  const fitAllMarkers = () => {
150
- mapRef.current.fitToCoordinates(MARKERS, {
148
+ mapRef.current.fitToCoordinates(MARKERS?.map(location => ({ latitude: location.lat, longitude: location.lng })), {
151
149
  edgePadding: { top: 80, right: 80, bottom: 80, left: 80 },
152
150
  animated: true,
153
151
  });
@@ -157,6 +155,13 @@ export const GoogleMap = (props: GoogleMapsParams) => {
157
155
  Geocoder.init(googleMapsApiKey)
158
156
  }, [])
159
157
 
158
+ useEffect(() => {
159
+ mapRef.current.animateToRegion({
160
+ ...region,
161
+ latitude: location?.lat,
162
+ longitude: location?.lng,
163
+ })
164
+ }, [location])
160
165
 
161
166
  useEffect(() => {
162
167
  if (saveLocation) {
@@ -170,6 +175,9 @@ export const GoogleMap = (props: GoogleMapsParams) => {
170
175
  fitAllMarkers()
171
176
  }
172
177
  }, 1000)
178
+ if (locations) {
179
+ SETMARKERS(locations)
180
+ }
173
181
  return () => clearInterval(interval)
174
182
  }, [locations])
175
183
 
@@ -189,16 +197,16 @@ export const GoogleMap = (props: GoogleMapsParams) => {
189
197
  >
190
198
  {locations ? (
191
199
  <>
192
- {MARKERS && MARKERS.map((location: { latitude: number, longitude: number }, i: number) => (
200
+ {MARKERS && MARKERS.map((location: { lat: number, lng: number }, i: number) => (
193
201
  <React.Fragment key={i}>
194
202
  {
195
203
  <Marker
196
204
  zIndex={i}
197
- coordinate={location}
198
- title={locations[i]?.title}
205
+ coordinate={{ latitude: location.lat ?? 0, longitude: location.lng ?? 0 }}
206
+ title={MARKERS[i]?.title}
199
207
  >
200
208
  <View>
201
- <OIcon url={locations[i].icon} width={50} height={50} />
209
+ <OIcon url={MARKERS[i].icon} width={50} height={50} />
202
210
  </View>
203
211
  </Marker>
204
212
  }