ordering-ui-react-native 0.15.14 → 0.15.16-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 (153) 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/src/utils/index.tsx +68 -1
  23. package/themes/business/index.tsx +2 -0
  24. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +56 -8
  25. package/themes/business/src/components/AcceptOrRejectOrder/styles.tsx +5 -0
  26. package/themes/business/src/components/Home/index.tsx +128 -55
  27. package/themes/business/src/components/Home/styles.tsx +8 -1
  28. package/themes/business/src/components/NewOrderNotification/index.tsx +59 -98
  29. package/themes/business/src/components/OrderDetails/Business.tsx +2 -1
  30. package/themes/business/src/components/OrderDetails/Delivery.tsx +19 -12
  31. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +150 -89
  32. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +91 -17
  33. package/themes/business/src/components/OrderDetails/styles.tsx +7 -0
  34. package/themes/business/src/components/OrdersListManager/index.tsx +874 -0
  35. package/themes/business/src/components/OrdersListManager/styles.tsx +123 -0
  36. package/themes/business/src/components/OrdersListManager/utils.tsx +216 -0
  37. package/themes/business/src/components/OrdersOption/index.tsx +70 -116
  38. package/themes/business/src/components/OrdersOption/styles.tsx +2 -5
  39. package/themes/business/src/components/PreviousOrders/index.tsx +82 -23
  40. package/themes/business/src/types/index.tsx +2 -1
  41. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  42. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  43. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  44. package/themes/kiosk/src/components/BusinessController/index.tsx +27 -6
  45. package/themes/kiosk/src/components/BusinessController/styles.tsx +1 -1
  46. package/themes/kiosk/src/components/BusinessProductsListing/index.tsx +48 -21
  47. package/themes/kiosk/src/components/Cart/index.tsx +98 -24
  48. package/themes/kiosk/src/components/Cart/styles.tsx +6 -0
  49. package/themes/kiosk/src/components/CartBottomSheet/index.tsx +1 -1
  50. package/themes/kiosk/src/components/CartBottomSheet/styles.tsx +1 -1
  51. package/themes/kiosk/src/components/CartContent/index.tsx +13 -3
  52. package/themes/kiosk/src/components/CartItem/index.tsx +20 -8
  53. package/themes/kiosk/src/components/CategoriesMenu/index.tsx +6 -5
  54. package/themes/kiosk/src/components/CustomerName/index.tsx +89 -88
  55. package/themes/kiosk/src/components/Intro/index.tsx +13 -13
  56. package/themes/kiosk/src/components/LanguageSelector/index.tsx +12 -8
  57. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  58. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  59. package/themes/kiosk/src/components/OrderDetails/index.tsx +136 -41
  60. package/themes/kiosk/src/components/OrderDetails/styles.tsx +5 -0
  61. package/themes/kiosk/src/components/OrderSummary/index.tsx +1 -1
  62. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +10 -12
  63. package/themes/kiosk/src/components/ProductForm/index.tsx +174 -125
  64. package/themes/kiosk/src/components/ProductForm/styles.tsx +1 -1
  65. package/themes/kiosk/src/components/ProductOption/index.tsx +1 -0
  66. package/themes/kiosk/src/components/ProductOption/styles.tsx +1 -0
  67. package/themes/kiosk/src/components/UpsellingProducts/index.tsx +48 -34
  68. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  69. package/themes/kiosk/src/components/shared/OCard.tsx +112 -78
  70. package/themes/kiosk/src/types/index.d.ts +2 -0
  71. package/themes/original/index.tsx +179 -0
  72. package/themes/original/src/components/AddressForm/index.tsx +15 -10
  73. package/themes/original/src/components/AddressList/index.tsx +56 -18
  74. package/themes/original/src/components/AppleLogin/index.tsx +117 -78
  75. package/themes/original/src/components/BusinessBasicInformation/index.tsx +96 -45
  76. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +28 -1
  77. package/themes/original/src/components/BusinessController/index.tsx +52 -22
  78. package/themes/original/src/components/BusinessController/styles.tsx +22 -0
  79. package/themes/original/src/components/BusinessFeaturedController/index.tsx +20 -1
  80. package/themes/original/src/components/BusinessFeaturedController/styles.tsx +23 -0
  81. package/themes/original/src/components/BusinessListingSearch/index.tsx +4 -0
  82. package/themes/original/src/components/BusinessMenuList/index.tsx +11 -4
  83. package/themes/original/src/components/BusinessPreorder/index.tsx +141 -121
  84. package/themes/original/src/components/BusinessProductsCategories/index.tsx +7 -5
  85. package/themes/original/src/components/BusinessProductsList/index.tsx +129 -22
  86. package/themes/original/src/components/BusinessProductsList/styles.tsx +29 -2
  87. package/themes/original/src/components/BusinessProductsListing/index.tsx +92 -37
  88. package/themes/original/src/components/BusinessProductsListing/styles.tsx +22 -0
  89. package/themes/original/src/components/BusinessReviews/index.tsx +4 -25
  90. package/themes/original/src/components/BusinessTypeFilter/index.tsx +1 -2
  91. package/themes/original/src/components/BusinessesListing/index.tsx +49 -58
  92. package/themes/original/src/components/Cart/index.tsx +58 -21
  93. package/themes/original/src/components/CartContent/index.tsx +2 -2
  94. package/themes/original/src/components/Checkout/index.tsx +57 -33
  95. package/themes/original/src/components/CouponControl/index.tsx +1 -0
  96. package/themes/original/src/components/DriverTips/index.tsx +1 -1
  97. package/themes/original/src/components/Help/index.tsx +21 -4
  98. package/themes/original/src/components/HighestRatedBusinesses/index.tsx +97 -89
  99. package/themes/original/src/components/Home/index.tsx +1 -1
  100. package/themes/original/src/components/LastOrders/index.tsx +12 -1
  101. package/themes/original/src/components/LoginForm/index.tsx +73 -2
  102. package/themes/original/src/components/LoginForm/styles.tsx +6 -1
  103. package/themes/original/src/components/MessageListing/index.tsx +10 -1
  104. package/themes/original/src/components/Messages/index.tsx +50 -45
  105. package/themes/original/src/components/Messages/styles.tsx +1 -3
  106. package/themes/original/src/components/MomentOption/index.tsx +10 -1
  107. package/themes/original/src/components/MomentOption/styles.tsx +1 -1
  108. package/themes/original/src/components/OrderDetails/index.tsx +143 -147
  109. package/themes/original/src/components/OrderDetails/styles.tsx +3 -1
  110. package/themes/original/src/components/OrderProgress/index.tsx +4 -4
  111. package/themes/original/src/components/OrderProgress/styles.tsx +1 -0
  112. package/themes/original/src/components/OrderSummary/index.tsx +35 -2
  113. package/themes/original/src/components/OrderTypeSelector/index.tsx +4 -2
  114. package/themes/original/src/components/OrdersOption/index.tsx +25 -33
  115. package/themes/original/src/components/OrdersOption/styles.tsx +0 -6
  116. package/themes/original/src/components/PaymentOptionWallet/index.tsx +10 -4
  117. package/themes/original/src/components/PaymentOptionWallet/styles.tsx +1 -1
  118. package/themes/original/src/components/PaymentOptions/index.tsx +9 -19
  119. package/themes/original/src/components/PlaceSpot/index.tsx +114 -0
  120. package/themes/original/src/components/PlaceSpot/styles.tsx +11 -0
  121. package/themes/original/src/components/PreviousOrders/index.tsx +19 -13
  122. package/themes/original/src/components/ProductForm/index.tsx +47 -36
  123. package/themes/original/src/components/ProductForm/styles.tsx +2 -2
  124. package/themes/original/src/components/ProductOptionSubOption/index.tsx +5 -3
  125. package/themes/original/src/components/Promotions/index.tsx +250 -0
  126. package/themes/original/src/components/Promotions/styles.tsx +60 -0
  127. package/themes/original/src/components/ReviewOrder/index.tsx +10 -9
  128. package/themes/original/src/components/ReviewProducts/index.tsx +1 -1
  129. package/themes/original/src/components/Sessions/index.tsx +160 -0
  130. package/themes/original/src/components/Sessions/styles.tsx +15 -0
  131. package/themes/original/src/components/SingleProductCard/index.tsx +47 -21
  132. package/themes/original/src/components/SingleProductCard/styles.tsx +28 -1
  133. package/themes/original/src/components/StripeElementsForm/index.tsx +55 -72
  134. package/themes/original/src/components/TaxInformation/index.tsx +17 -7
  135. package/themes/original/src/components/UpsellingProducts/index.tsx +87 -71
  136. package/themes/original/src/components/UserDetails/index.tsx +4 -95
  137. package/themes/original/src/components/UserFormDetails/index.tsx +32 -31
  138. package/themes/original/src/components/UserProfile/index.tsx +70 -20
  139. package/themes/original/src/components/UserProfileForm/index.tsx +28 -24
  140. package/themes/original/src/components/VerifyPhone/index.tsx +10 -7
  141. package/themes/original/src/components/VerifyPhone/styles.tsx +2 -1
  142. package/themes/original/src/components/Wallets/index.tsx +75 -8
  143. package/themes/original/src/components/Wallets/styles.tsx +21 -0
  144. package/themes/original/src/components/shared/HeaderTitle.tsx +21 -0
  145. package/themes/original/src/components/shared/index.tsx +2 -0
  146. package/themes/original/src/config/constants.tsx +6 -6
  147. package/themes/original/src/types/index.tsx +78 -25
  148. package/themes/original/src/utils/index.tsx +12 -2
  149. package/themes/single-business/src/components/AddressList/index.tsx +1 -1
  150. package/themes/single-business/src/components/OrderTypeSelector/index.tsx +6 -6
  151. package/themes/single-business/src/components/UserProfile/index.tsx +1 -1
  152. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
  153. package/src/components/StripeMethodForm/index.tsx +0 -168
@@ -47,7 +47,7 @@ import { getTypesText, convertToRadian } from '../../utils';
47
47
  import { OrderProgress } from '../OrderProgress';
48
48
  import { useFocusEffect, useIsFocused } from '@react-navigation/native';
49
49
 
50
- const PIXELS_TO_SCROLL = 1000;
50
+ const PIXELS_TO_SCROLL = 2000;
51
51
 
52
52
  const BusinessesListingUI = (props: BusinessesListingParams) => {
53
53
  const {
@@ -61,7 +61,6 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
61
61
  handleChangeSearch,
62
62
  businessId
63
63
  } = props;
64
-
65
64
  const theme = useTheme();
66
65
  const isFocused = useIsFocused();
67
66
  const appState = useRef(AppState.currentState)
@@ -117,10 +116,10 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
117
116
  const [featuredBusiness, setFeaturedBusinesses] = useState(Array);
118
117
  const [isFarAway, setIsFarAway] = useState(false)
119
118
  const [businessTypes, setBusinessTypes] = useState(null)
120
-
119
+ const [orderTypeValue, setOrderTypeValue] = useState(orderState?.options.value)
121
120
  const isPreorderEnabled = (configs?.preorder_status_enabled?.value === '1' || configs?.preorder_status_enabled?.value === 'true') &&
122
121
  Number(configs?.max_days_preorder?.value) > 0
123
-
122
+ const isPreOrderSetting = configs?.preorder_status_enabled?.value === '1'
124
123
  const timerId = useRef<any>(false)
125
124
  // const panResponder = useRef(
126
125
  // PanResponder.create({
@@ -166,25 +165,22 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
166
165
  return R * c
167
166
  }
168
167
 
169
- useEffect(() => {
170
- if (businessesList.businesses.length > 0) {
171
- const fb = businessesList.businesses.filter((b) => b.featured == true);
172
- const ary = [];
173
- while (fb.length > 0) {
174
- ary.push(fb.splice(0, 2));
175
- }
176
- setFeaturedBusinesses(ary);
177
- }
178
- }, [businessesList.businesses]);
179
-
180
168
  const resetInactivityTimeout = () => {
181
169
  clearTimeout(timerId.current)
182
170
  timerId.current = setInterval(() => {
183
171
  getBusinesses(true)
184
- }, 300000)
172
+ }, 120000)
185
173
  }
186
174
 
187
175
  useEffect(() => {
176
+ if (!businessesList?.loading) {
177
+ const fb = businessesList.businesses.filter((b) => b.featured === true && b?.open);
178
+ const ary = [];
179
+ while (fb.length > 0) {
180
+ ary.push(fb.splice(0, 2));
181
+ }
182
+ setFeaturedBusinesses(ary);
183
+ }
188
184
  resetInactivityTimeout()
189
185
  }, [businessesList.loading])
190
186
 
@@ -208,26 +204,13 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
208
204
  }, [orderState?.options?.address?.location])
209
205
 
210
206
  useEffect(() => {
211
- const onFocusApp = (nextAppState: any) => {
212
- if (
213
- appState.current.match(/inactive|background/) &&
214
- nextAppState === "active"
215
- ) {
216
- getBusinesses(true);
217
- }
218
- appState.current = nextAppState;
219
- setAppStateVisible(appState.current);
207
+ if(!orderState?.loading){
208
+ setOrderTypeValue(orderState?.options?.type)
220
209
  }
221
-
222
- AppState.addEventListener("change", onFocusApp);
223
- return () => {
224
- AppState.removeEventListener('change', onFocusApp);
225
- };
226
- }, [])
210
+ }, [orderState?.options?.type])
227
211
 
228
212
  useFocusEffect(
229
213
  useCallback(() => {
230
- getBusinesses(true)
231
214
  resetInactivityTimeout()
232
215
  return () => clearTimeout(timerId.current)
233
216
  }, [navigation])
@@ -280,33 +263,35 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
280
263
  )}
281
264
  <OrderControlContainer>
282
265
  <View style={styles.wrapperOrderOptions}>
283
- <WrapMomentOption onPress={() => navigation.navigate('OrderTypes', { configTypes: configTypes })}>
284
- <OText size={12} numberOfLines={1} ellipsizeMode={'tail'} color={theme.colors.textSecondary}>{t(getTypesText(orderState?.options?.type || 1), 'Delivery')}</OText>
266
+ <WrapMomentOption onPress={() => navigation.navigate('OrderTypes', { configTypes: configTypes, setOrderTypeValue })}>
267
+ <OText size={12} numberOfLines={1} ellipsizeMode={'tail'} color={theme.colors.textSecondary}>{t(getTypesText(orderTypeValue || orderState?.options?.type || 1), 'Delivery')}</OText>
285
268
  <OIcon
286
269
  src={theme.images.general.arrow_down}
287
270
  width={10}
288
271
  style={{ marginStart: 8 }}
289
272
  />
290
273
  </WrapMomentOption>
291
- <WrapMomentOption
292
- onPress={() => handleMomentClick()}>
293
- <OText
294
- size={12}
295
- numberOfLines={1}
296
- ellipsizeMode="tail"
297
- color={theme.colors.textSecondary}>
298
- {orderState.options?.momentß
299
- ? parseDate(orderState.options?.moment, { outputFormat: configs?.dates_moment_format?.value })
300
- : t('ASAP_ABBREVIATION', 'ASAP')}
301
- </OText>
302
- {isPreorderEnabled && (
303
- <OIcon
304
- src={theme.images.general.arrow_down}
305
- width={10}
306
- style={{ marginStart: 8 }}
307
- />
308
- )}
309
- </WrapMomentOption>
274
+ {isPreOrderSetting && (
275
+ <WrapMomentOption
276
+ onPress={() => handleMomentClick()}>
277
+ <OText
278
+ size={12}
279
+ numberOfLines={1}
280
+ ellipsizeMode="tail"
281
+ color={theme.colors.textSecondary}>
282
+ {orderState.options?.moment
283
+ ? parseDate(orderState.options?.moment, { outputFormat: configs?.dates_moment_format?.value })
284
+ : t('ASAP_ABBREVIATION', 'ASAP')}
285
+ </OText>
286
+ {isPreorderEnabled && (
287
+ <OIcon
288
+ src={theme.images.general.arrow_down}
289
+ width={10}
290
+ style={{ marginStart: 8 }}
291
+ />
292
+ )}
293
+ </WrapMomentOption>
294
+ )}
310
295
 
311
296
  {!businessId && (
312
297
  <SearchBar
@@ -338,7 +323,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
338
323
  {
339
324
  !businessId && !props.franchiseId && featuredBusiness && featuredBusiness.length > 0 && (
340
325
  <FeaturedWrapper>
341
- <OText size={16} style={{ marginLeft: 40 }} weight={Platform.OS === 'ios' ? '600' : 'bold'}>{t('FEATURED_BUSINESS', 'Featured business')}</OText>
326
+ <OText size={16} style={{ marginLeft: 40 }} weight={Platform.OS === 'ios' ? '600' : 'bold'}>{t('BUSINESS_FEATURE', 'Featured business')}</OText>
342
327
  <ScrollView
343
328
  showsHorizontalScrollIndicator={false}
344
329
  nestedScrollEnabled
@@ -346,7 +331,6 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
346
331
  {featuredBusiness.map((bAry: any, idx) => (
347
332
  <View key={'f-listing_' + idx}>
348
333
  <BusinessFeaturedController
349
- key={bAry[0].id}
350
334
  business={bAry[0]}
351
335
  isBusinessOpen={bAry[0]?.open}
352
336
  handleCustomClick={handleBusinessClick}
@@ -354,7 +338,6 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
354
338
  />
355
339
  {bAry.length > 1 && (
356
340
  <BusinessFeaturedController
357
- key={bAry[1].id}
358
341
  business={bAry[1]}
359
342
  isBusinessOpen={bAry[1]?.open}
360
343
  handleCustomClick={handleBusinessClick}
@@ -393,14 +376,22 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
393
376
  />
394
377
  )}
395
378
  {businessesList.businesses?.map(
396
- (business: any) => (
379
+ (business: any, i : number) => (
397
380
  <BusinessController
398
- key={business.id}
381
+ key={`${business.id}_` + i}
399
382
  business={business}
400
383
  isBusinessOpen={business.open}
401
384
  handleCustomClick={handleBusinessClick}
402
385
  orderType={orderState?.options?.type}
403
386
  navigation={navigation}
387
+ businessHeader={business?.header}
388
+ businessFeatured={business?.featured}
389
+ businessLogo={business?.logo}
390
+ businessReviews={business?.reviews}
391
+ businessDeliveryPrice={business?.delivery_price}
392
+ businessDeliveryTime={business?.delivery_time}
393
+ businessPickupTime={business?.pickup_time}
394
+ businessDistance={business?.distance}
404
395
  />
405
396
  )
406
397
  )}
@@ -24,6 +24,7 @@ import AntIcon from 'react-native-vector-icons/AntDesign'
24
24
  import { TaxInformation } from '../TaxInformation';
25
25
  import { CartStoresListing } from '../CartStoresListing';
26
26
  import { OAlert } from '../../../../../src/components/shared'
27
+ import { PlaceSpot } from '../PlaceSpot'
27
28
 
28
29
  const CartUI = (props: any) => {
29
30
  const {
@@ -54,12 +55,14 @@ const CartUI = (props: any) => {
54
55
  const [canOpenUpselling, setCanOpenUpselling] = useState(false)
55
56
  const [openTaxModal, setOpenTaxModal] = useState<any>({ open: false, data: null, type: '' })
56
57
  const [confirm, setConfirm] = useState<any>({ open: false, content: null, handleOnAccept: null, id: null, title: null })
58
+ const [openPlaceModal, setOpenPlaceModal] = useState(false)
57
59
 
58
60
  const isCartPending = cart?.status === 2
59
61
  const isCouponEnabled = validationFields?.fields?.checkout?.coupon?.enabled
60
62
 
61
63
  const business: any = (orderState?.carts && Object.values(orderState.carts).find((_cart: any) => _cart?.uuid === props.cartuuid)) ?? {}
62
64
  const businessId = business?.business_id ?? null
65
+ const placeSpotTypes = [3, 4]
63
66
 
64
67
  const momentFormatted = !orderState?.option?.moment
65
68
  ? t('RIGHT_NOW', 'Right Now')
@@ -163,9 +166,9 @@ const CartUI = (props: any) => {
163
166
  handleClickCheckout={() => setOpenUpselling(true)}
164
167
  checkoutButtonDisabled={(openUpselling && !canOpenUpselling) || cart?.subtotal < cart?.minimum || !cart?.valid_address}
165
168
  >
166
- {cart?.products?.length > 0 && cart?.products.map((product: any) => (
169
+ {cart?.products?.length > 0 && cart?.products.map((product: any, i: number) => (
167
170
  <ProductItemAccordion
168
- key={product.code}
171
+ key={`${product.code}_${i}`}
169
172
  isCartPending={isCartPending}
170
173
  isCartProduct
171
174
  product={product}
@@ -199,8 +202,8 @@ const CartUI = (props: any) => {
199
202
  </OSTable>
200
203
  )}
201
204
  {
202
- cart?.offers?.length > 0 && cart?.offers?.filter((offer: any) => offer?.target === 1)?.map((offer: any) => (
203
- <OSTable key={offer.id}>
205
+ cart?.offers?.length > 0 && cart?.offers?.filter((offer: any) => offer?.target === 1)?.map((offer: any, i: number) => (
206
+ <OSTable key={`${offer.id}_${i}`}>
204
207
  <OSRow>
205
208
  <OText size={12} lineHeight={18}>{offer.name}</OText>
206
209
  {offer.rate_type === 1 && (
@@ -231,8 +234,8 @@ const CartUI = (props: any) => {
231
234
  </OSTable>
232
235
  )}
233
236
  {
234
- cart.taxes?.length > 0 && cart.taxes.filter((tax: any) => tax.type === 2 && tax?.rate !== 0).map((tax: any) => (
235
- <OSTable key={tax.id}>
237
+ cart.taxes?.length > 0 && cart.taxes.filter((tax: any) => tax.type === 2 && tax?.rate !== 0).map((tax: any, i: number) => (
238
+ <OSTable key={`${tax.id}_${i}`}>
236
239
  <OSRow>
237
240
  <OText size={12} lineHeight={18} numberOfLines={1} >
238
241
  {tax.name || t('INHERIT_FROM_BUSINESS', 'Inherit from business')}{' '}
@@ -247,12 +250,12 @@ const CartUI = (props: any) => {
247
250
  ))
248
251
  }
249
252
  {
250
- cart?.fees?.length > 0 && cart?.fees?.filter((fee: any) => !(fee.fixed === 0 && fee.percentage === 0)).map((fee: any) => (
251
- <OSTable key={fee?.id}>
253
+ cart?.fees?.length > 0 && cart?.fees?.filter((fee: any) => !(fee.fixed === 0 && fee.percentage === 0)).map((fee: any, i: number) => (
254
+ <OSTable key={`${fee.id}_${i}`}>
252
255
  <OSRow>
253
256
  <OText size={12} lineHeight={18} numberOfLines={1}>
254
257
  {fee.name || t('INHERIT_FROM_BUSINESS', 'Inherit from business')}{' '}
255
- ({fee?.fixed > 0 && `${parsePrice(fee?.fixed)} + `}{fee.percentage}%){' '}
258
+ ({fee?.fixed > 0 && `${parsePrice(fee?.fixed)}${fee.percentage > 0 ? ' + ' : ''}`}{fee.percentage > 0 && `${fee.percentage}%`}){' '}
256
259
  </OText>
257
260
  <TouchableOpacity onPress={() => setOpenTaxModal({ open: true, data: fee, type: 'fee' })} >
258
261
  <AntIcon name='infocirlceo' size={16} color={theme.colors.primary} />
@@ -290,8 +293,8 @@ const CartUI = (props: any) => {
290
293
  </OSTable>
291
294
  )}
292
295
  {
293
- cart?.offers?.length > 0 && cart?.offers?.filter((offer: any) => offer?.target === 2)?.map((offer: any) => (
294
- <OSTable key={offer.id}>
296
+ cart?.offers?.length > 0 && cart?.offers?.filter((offer: any) => offer?.target === 2)?.map((offer: any, i: number) => (
297
+ <OSTable key={`${offer.id}_${i}`}>
295
298
  <OSRow>
296
299
  <OText size={12} lineHeight={18}>{offer.name}</OText>
297
300
  {offer.rate_type === 1 && (
@@ -353,6 +356,24 @@ const CartUI = (props: any) => {
353
356
  </OText>
354
357
  </OSTable>
355
358
  </OSTotal>
359
+ {placeSpotTypes.includes(orderState?.options?.type) && (
360
+ <OSTable style={{ marginTop: 15 }}>
361
+ <OText size={14} lineHeight={21} weight={'600'}>
362
+ {t('SPOT', 'Spot')}: {cart?.place?.name || t('NO_SELECTED', 'No selected')}
363
+ </OText>
364
+ <TouchableOpacity onPress={() => setOpenPlaceModal(true)}>
365
+ <OText
366
+ size={14}
367
+ lineHeight={21}
368
+ weight={'600'}
369
+ color={theme.colors.primary}
370
+ style={{ textDecorationLine: 'underline' }}
371
+ >
372
+ {t('EDIT', 'Edit')}
373
+ </OText>
374
+ </TouchableOpacity>
375
+ </OSTable>
376
+ )}
356
377
  {cart?.status !== 2 && (
357
378
  <OSTable>
358
379
  <View style={{ width: '100%', marginTop: 20 }}>
@@ -388,7 +409,7 @@ const CartUI = (props: any) => {
388
409
  )}
389
410
  </OSBill>
390
411
  )}
391
- {cart?.valid_products && (
412
+ {cart?.valid_products ? (
392
413
  <CheckoutAction>
393
414
  <OButton
394
415
  text={(cart?.subtotal >= cart?.minimum || !cart?.minimum) && cart?.valid_address ? (
@@ -407,6 +428,12 @@ const CartUI = (props: any) => {
407
428
  style={{ width: '100%', flexDirection: 'row', justifyContent: 'center', borderRadius: 7.6, shadowOpacity: 0 }}
408
429
  />
409
430
  </CheckoutAction>
431
+ ) : (
432
+ <View style={{ alignItems: 'center', width: '100%' }}>
433
+ <OText size={12} color={theme.colors.red} style={{ textAlign: 'center', marginTop: 5 }}>
434
+ {t('WARNING_INVALID_PRODUCTS_CHECKOUT', 'To continue with your checkout, please remove from your cart the products that are not available.')}
435
+ </OText>
436
+ </View>
410
437
  )}
411
438
  </BusinessItemAccordion>
412
439
 
@@ -425,8 +452,6 @@ const CartUI = (props: any) => {
425
452
  open={openTaxModal.open}
426
453
  onClose={() => setOpenTaxModal({ open: false, data: null, type: '' })}
427
454
  entireModal
428
- title={`${openTaxModal.data?.name ||
429
- t('INHERIT_FROM_BUSINESS', 'Inherit from business')} ${openTaxModal.data?.rate_type !== 2 ? `(${typeof openTaxModal.data?.rate === 'number' ? `${openTaxModal.data?.rate}%` : `${parsePrice(openTaxModal.data?.fixed ?? 0)} + ${openTaxModal.data?.percentage}%`})` : ''} `}
430
455
  >
431
456
  <TaxInformation
432
457
  type={openTaxModal.type}
@@ -434,14 +459,26 @@ const CartUI = (props: any) => {
434
459
  products={cart?.products}
435
460
  />
436
461
  </OModal>
437
- <OAlert
438
- open={confirm.open}
439
- title={confirm.title}
440
- content={confirm.content}
441
- onAccept={confirm.handleOnAccept}
442
- onCancel={() => setConfirm({ ...confirm, open: false, title: null })}
443
- onClose={() => setConfirm({ ...confirm, open: false, title: null })}
462
+ <OModal
463
+ open={openPlaceModal}
464
+ title={t('CHOOSE_YOUR_SPOT', 'Choose your spot')}
465
+ onClose={() => setOpenPlaceModal(false)}
466
+ entireModal
467
+ >
468
+ <PlaceSpot
469
+ cart={cart}
470
+ isOpenPlaceSpot={openPlaceModal}
471
+ setOpenPlaceModal={setOpenPlaceModal}
444
472
  />
473
+ </OModal>
474
+ <OAlert
475
+ open={confirm.open}
476
+ title={confirm.title}
477
+ content={confirm.content}
478
+ onAccept={confirm.handleOnAccept}
479
+ onCancel={() => setConfirm({ ...confirm, open: false, title: null })}
480
+ onClose={() => setConfirm({ ...confirm, open: false, title: null })}
481
+ />
445
482
  </CContainer>
446
483
  )
447
484
  }
@@ -22,9 +22,9 @@ export const CartContent = (props: any) => {
22
22
  <CCContainer>
23
23
  {isOrderStateCarts && carts?.length > 0 && (
24
24
  <>
25
- <OText size={24} lineHeight={36} weight={'600'} style={{ marginBottom: 20 }}>
25
+ {/* <OText size={24} lineHeight={36} weight={'600'} style={{ marginBottom: 20 }}>
26
26
  {carts.length > 1 ? t('MY_CARTS', 'My Carts') : t('CART', 'Cart')}
27
- </OText>
27
+ </OText> */}
28
28
  {carts.map((cart: any, i: number) => (
29
29
  <CCList key={i} style={{ overflow: 'visible' }}>
30
30
  {cart.products.length > 0 && (
@@ -112,7 +112,10 @@ const CheckoutUI = (props: any) => {
112
112
  right: Platform.OS === 'ios' ? 5 : (I18nManager.isRTL ? 30 : 0),
113
113
  position: 'absolute',
114
114
  fontSize: 20
115
- }
115
+ },
116
+ wrapperNavbar: Platform.OS === 'ios'
117
+ ? { paddingVertical: 0, paddingHorizontal: 40 }
118
+ : { paddingVertical: 20, paddingHorizontal: 40 }
116
119
  })
117
120
 
118
121
  const [, { showToast }] = useToast();
@@ -133,9 +136,19 @@ const CheckoutUI = (props: any) => {
133
136
  const [showGateway, setShowGateway] = useState<any>({ closedByUsed: false, open: false });
134
137
  const [webviewPaymethod, setWebviewPaymethod] = useState<any>(null)
135
138
 
139
+ const placeSpotTypes = [3, 4]
140
+ const businessConfigs = businessDetails?.business?.configs ?? []
141
+ const isWalletCashEnabled = businessConfigs.find((config: any) => config.key === 'wallet_cash_enabled')?.value === '1'
142
+ const isWalletCreditPointsEnabled = businessConfigs.find((config: any) => config.key === 'wallet_credit_point_enabled')?.value === '1'
143
+ const isWalletEnabled = configs?.cash_wallet?.value && configs?.wallet_enabled?.value === '1' && (isWalletCashEnabled || isWalletCreditPointsEnabled)
136
144
 
137
- const isWalletEnabled = configs?.wallet_enabled?.value === '1' && (configs?.wallet_cash_enabled?.value === '1' || configs?.wallet_credit_point_enabled?.value === '1')
138
145
  const isPreOrder = configs?.preorder_status_enabled?.value === '1'
146
+ const isDisabledButtonPlace = loading || !cart?.valid || (!paymethodSelected && cart?.balance > 0) || placing || errorCash ||
147
+ cart?.subtotal < cart?.minimum || (placeSpotTypes.includes(options?.type) && !cart?.place) ||
148
+ (options.type === 1 &&
149
+ validationFields?.fields?.checkout?.driver_tip?.enabled &&
150
+ validationFields?.fields?.checkout?.driver_tip?.required &&
151
+ (Number(cart?.driver_tip) <= 0))
139
152
 
140
153
  const driverTipsOptions = typeof configs?.driver_tip_options?.value === 'string'
141
154
  ? JSON.parse(configs?.driver_tip_options?.value) || []
@@ -156,7 +169,7 @@ const CheckoutUI = (props: any) => {
156
169
  navigation.navigate('MomentOption')
157
170
  }
158
171
  }
159
-
172
+
160
173
  const handlePlaceOrder = () => {
161
174
  if (!userErrors.length) {
162
175
  handlerClickPlaceOrder && handlerClickPlaceOrder()
@@ -201,8 +214,8 @@ const CheckoutUI = (props: any) => {
201
214
  if (
202
215
  !user?.cellphone &&
203
216
  ((validationFields?.fields?.checkout?.cellphone?.enabled &&
204
- validationFields?.fields?.checkout?.cellphone?.required) ||
205
- configs?.verification_phone_required?.value === '1')
217
+ validationFields?.fields?.checkout?.cellphone?.required) ||
218
+ configs?.verification_phone_required?.value === '1')
206
219
  ) {
207
220
  errors.push(t('VALIDATION_ERROR_MOBILE_PHONE_REQUIRED', 'The field Phone number is required'))
208
221
  }
@@ -248,13 +261,18 @@ const CheckoutUI = (props: any) => {
248
261
  return (
249
262
  <>
250
263
  <Container noPadding>
251
- <NavBar
252
- isVertical
253
- onActionLeft={() => navigation?.canGoBack() && navigation.goBack()}
254
- title={t('CHECKOUT', 'Checkout')}
255
- style={styles.pagePadding}
256
- titleStyle={{ marginLeft: 0, marginRight: 0 }}
257
- />
264
+ <View style={styles.wrapperNavbar}>
265
+ <NavBar
266
+ title={t('CHECKOUT', 'Checkout')}
267
+ titleAlign={'center'}
268
+ onActionLeft={() => navigation?.canGoBack() && navigation.goBack()}
269
+ showCall={false}
270
+ btnStyle={{ paddingLeft: 0 }}
271
+ style={{ flexDirection: 'column', alignItems: 'flex-start', marginTop: Platform.OS === 'ios' ? 0 : 20 }}
272
+ titleWrapStyle={{ paddingHorizontal: 0 }}
273
+ titleStyle={{ marginRight: 0, marginLeft: 0 }}
274
+ />
275
+ </View>
258
276
  <ChContainer style={styles.pagePadding}>
259
277
  <ChSection style={{ paddingTop: 0 }}>
260
278
  <ChHeader>
@@ -268,15 +286,15 @@ const CheckoutUI = (props: any) => {
268
286
  />
269
287
  </CHMomentWrapper>
270
288
  <CHMomentWrapper
271
- onPress={() => handleMomentClick()}
272
- disabled={loading}
289
+ onPress={() => handleMomentClick()}
290
+ disabled={loading}
273
291
  >
274
292
  <OText size={12} numberOfLines={1} ellipsizeMode='tail' color={theme.colors.textSecondary}>
275
293
  {options?.moment
276
294
  ? parseDate(options?.moment, { outputFormat: configs?.dates_moment_format?.value })
277
295
  : t('ASAP_ABBREVIATION', 'ASAP')}
278
296
  </OText>
279
- { isPreOrder && (
297
+ {isPreOrder && (
280
298
  <OIcon
281
299
  src={theme.images.general.arrow_down}
282
300
  width={10}
@@ -545,17 +563,17 @@ const CheckoutUI = (props: any) => {
545
563
  onNavigationRedirect={onNavigationRedirect}
546
564
  paySelected={paymethodSelected}
547
565
  handlePaymentMethodClickCustom={handlePaymentMethodClick}
548
- handlePlaceOrder={handlePlaceOrder}
549
566
  />
550
567
  </ChPaymethods>
551
568
  </ChSection>
552
569
  )}
553
570
 
554
- {!cartState.loading && cart && isWalletEnabled && (
571
+ {!cartState.loading && cart && isWalletEnabled && businessDetails?.business?.configs && (
555
572
  <WalletPaymentOptionContainer>
556
573
  <PaymentOptionWallet
557
574
  cart={cart}
558
575
  businessId={cart?.business_id}
576
+ businessConfigs={businessDetails?.business?.configs}
559
577
  />
560
578
  </WalletPaymentOptionContainer>
561
579
  )}
@@ -645,9 +663,28 @@ const CheckoutUI = (props: any) => {
645
663
  color={theme.colors.error}
646
664
  size={12}
647
665
  >
648
- {t('WARNING_INVALID_PRODUCTS', 'Some products are invalid, please check them.')}
666
+ {t('WARNING_INVALID_PRODUCTS_CHECKOUT', 'To continue with your checkout, please remove from your cart the products that are not available.')}
649
667
  </OText>
650
668
  )}
669
+ {placeSpotTypes.includes(options?.type) && !cart?.place && (
670
+ <OText
671
+ color={theme.colors.error}
672
+ size={12}
673
+ >
674
+ {t('WARNING_PLACE_SPOT', 'Please, select your spot to place order.')}
675
+ </OText>
676
+ )}
677
+ {options.type === 1 &&
678
+ validationFields?.fields?.checkout?.driver_tip?.enabled &&
679
+ validationFields?.fields?.checkout?.driver_tip?.required &&
680
+ (Number(cart?.driver_tip) <= 0) && (
681
+ <OText
682
+ color={theme.colors.error}
683
+ size={12}
684
+ >
685
+ {t('WARNING_INVALID_DRIVER_TIP', 'Driver Tip is required.')}
686
+ </OText>
687
+ )}
651
688
  </ChErrors>
652
689
  </View>
653
690
  )}
@@ -667,8 +704,8 @@ const CheckoutUI = (props: any) => {
667
704
  {!cartState.loading && cart && cart?.status !== 2 && (
668
705
  <FloatingButton
669
706
  handleClick={() => handlePlaceOrder()}
670
- isSecondaryBtn={loading || !cart?.valid || (!paymethodSelected && cart?.balance > 0) || placing || errorCash || cart?.subtotal < cart?.minimum}
671
- disabled={loading || !cart?.valid || (!paymethodSelected && cart?.balance > 0) || placing || errorCash || cart?.subtotal < cart?.minimum}
707
+ isSecondaryBtn={isDisabledButtonPlace}
708
+ disabled={isDisabledButtonPlace}
672
709
  btnText={cart?.subtotal >= cart?.minimum
673
710
  ? (
674
711
  placing
@@ -696,19 +733,6 @@ const CheckoutUI = (props: any) => {
696
733
  setShowGateway={setShowGateway}
697
734
  />
698
735
  )}
699
- {webviewPaymethod?.gateway === 'square' && showGateway.open && (
700
- <PaymentOptionsWebView
701
- onNavigationRedirect={onNavigationRedirect}
702
- uri={`https://test-square-f50f7.web.app`}
703
- user={user}
704
- token={token}
705
- cart={cart}
706
- currency={currency}
707
- webviewPaymethod={webviewPaymethod}
708
- setShowGateway={setShowGateway}
709
- locationId={'L1NGAY5M6KJRX'}
710
- />
711
- )}
712
736
  </>
713
737
  )
714
738
  }
@@ -87,6 +87,7 @@ const CouponControlUI = (props: any) => {
87
87
  ) : (
88
88
  <CCWrapper>
89
89
  <OInput
90
+ value={couponInput}
90
91
  placeholder={t('DISCOUNT_COUPON', 'Discount coupon')}
91
92
  onChange={(e: any) => onChangeInputCoupon(e)}
92
93
  style={styles.inputsStyle}
@@ -63,7 +63,7 @@ const DriverTipsUI = (props: any) => {
63
63
  return (
64
64
  <DTContainer>
65
65
  <DTWrapperTips>
66
- {driverTipsOptions.map((option: any, i: number) => (
66
+ {driverTipsOptions.map((option: any, i: number) => (
67
67
  <TouchableOpacity
68
68
  key={i}
69
69
  onPress={() => handlerChangeOption(option)}
@@ -1,9 +1,11 @@
1
- import React from 'react'
1
+ import React, { useState } from 'react'
2
+ import { RefreshControl } from 'react-native'
2
3
  import { HelpParams } from '../../types'
3
4
  import { useLanguage } from 'ordering-components/native'
4
5
  import NavBar from '../NavBar'
5
6
  import { OText } from '../shared'
6
7
  import { LastOrders } from '../LastOrders'
8
+ import { Container } from '../../layouts/Container'
7
9
 
8
10
  import {
9
11
  HelpSubItem,
@@ -15,13 +17,28 @@ export const Help = (props: HelpParams) => {
15
17
  navigation
16
18
  } = props
17
19
  const [, t] = useLanguage()
20
+ const [refreshing] = useState(false);
21
+ const [refresh, setRefresh] = useState(false)
18
22
 
19
23
  const goToBack = () => navigation?.canGoBack() && navigation.goBack()
20
24
  const onRedirect = (route: string, params?: any) => {
21
25
  navigation.navigate(route, params)
22
26
  }
27
+
28
+ const handleOnRefresh = () => {
29
+ setRefresh(true)
30
+ }
31
+
23
32
  return (
24
- <>
33
+ <Container
34
+ noPadding
35
+ refreshControl={
36
+ <RefreshControl
37
+ refreshing={refreshing}
38
+ onRefresh={() => handleOnRefresh()}
39
+ />
40
+ }
41
+ >
25
42
  <NavBar
26
43
  title={t('HELP', 'Help')}
27
44
  titleAlign={'center'}
@@ -48,8 +65,8 @@ export const Help = (props: HelpParams) => {
48
65
 
49
66
  <LastOrdersContainer>
50
67
  <OText size={18} weight={600}>{t('LAST_ORDERS', 'Last Orders')}</OText>
51
- <LastOrders {...props} onRedirect={onRedirect} />
68
+ <LastOrders {...props} onRedirect={onRedirect} refresh={refresh} setRefresh={setRefresh} />
52
69
  </LastOrdersContainer>
53
- </>
70
+ </Container>
54
71
  )
55
72
  }