ordering-ui-react-native 0.15.15 → 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 (152) 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 +54 -49
  38. package/themes/business/src/components/PreviousOrders/index.tsx +82 -23
  39. package/themes/business/src/types/index.tsx +2 -1
  40. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  41. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  42. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  43. package/themes/kiosk/src/components/BusinessController/index.tsx +27 -6
  44. package/themes/kiosk/src/components/BusinessController/styles.tsx +1 -1
  45. package/themes/kiosk/src/components/BusinessProductsListing/index.tsx +48 -21
  46. package/themes/kiosk/src/components/Cart/index.tsx +98 -24
  47. package/themes/kiosk/src/components/Cart/styles.tsx +6 -0
  48. package/themes/kiosk/src/components/CartBottomSheet/index.tsx +1 -1
  49. package/themes/kiosk/src/components/CartBottomSheet/styles.tsx +1 -1
  50. package/themes/kiosk/src/components/CartContent/index.tsx +13 -3
  51. package/themes/kiosk/src/components/CartItem/index.tsx +20 -8
  52. package/themes/kiosk/src/components/CategoriesMenu/index.tsx +6 -5
  53. package/themes/kiosk/src/components/CustomerName/index.tsx +89 -88
  54. package/themes/kiosk/src/components/Intro/index.tsx +13 -13
  55. package/themes/kiosk/src/components/LanguageSelector/index.tsx +12 -8
  56. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  57. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  58. package/themes/kiosk/src/components/OrderDetails/index.tsx +136 -41
  59. package/themes/kiosk/src/components/OrderDetails/styles.tsx +5 -0
  60. package/themes/kiosk/src/components/OrderSummary/index.tsx +1 -1
  61. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +10 -12
  62. package/themes/kiosk/src/components/ProductForm/index.tsx +174 -125
  63. package/themes/kiosk/src/components/ProductForm/styles.tsx +1 -1
  64. package/themes/kiosk/src/components/ProductOption/index.tsx +1 -0
  65. package/themes/kiosk/src/components/ProductOption/styles.tsx +1 -0
  66. package/themes/kiosk/src/components/UpsellingProducts/index.tsx +48 -34
  67. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  68. package/themes/kiosk/src/components/shared/OCard.tsx +112 -78
  69. package/themes/kiosk/src/types/index.d.ts +2 -0
  70. package/themes/original/index.tsx +179 -0
  71. package/themes/original/src/components/AddressForm/index.tsx +15 -10
  72. package/themes/original/src/components/AddressList/index.tsx +56 -18
  73. package/themes/original/src/components/AppleLogin/index.tsx +117 -78
  74. package/themes/original/src/components/BusinessBasicInformation/index.tsx +96 -45
  75. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +28 -1
  76. package/themes/original/src/components/BusinessController/index.tsx +52 -22
  77. package/themes/original/src/components/BusinessController/styles.tsx +22 -0
  78. package/themes/original/src/components/BusinessFeaturedController/index.tsx +20 -1
  79. package/themes/original/src/components/BusinessFeaturedController/styles.tsx +23 -0
  80. package/themes/original/src/components/BusinessListingSearch/index.tsx +4 -0
  81. package/themes/original/src/components/BusinessMenuList/index.tsx +11 -4
  82. package/themes/original/src/components/BusinessPreorder/index.tsx +141 -121
  83. package/themes/original/src/components/BusinessProductsCategories/index.tsx +7 -5
  84. package/themes/original/src/components/BusinessProductsList/index.tsx +129 -22
  85. package/themes/original/src/components/BusinessProductsList/styles.tsx +29 -2
  86. package/themes/original/src/components/BusinessProductsListing/index.tsx +92 -37
  87. package/themes/original/src/components/BusinessProductsListing/styles.tsx +22 -0
  88. package/themes/original/src/components/BusinessReviews/index.tsx +4 -25
  89. package/themes/original/src/components/BusinessTypeFilter/index.tsx +1 -2
  90. package/themes/original/src/components/BusinessesListing/index.tsx +49 -58
  91. package/themes/original/src/components/Cart/index.tsx +58 -21
  92. package/themes/original/src/components/CartContent/index.tsx +2 -2
  93. package/themes/original/src/components/Checkout/index.tsx +57 -33
  94. package/themes/original/src/components/CouponControl/index.tsx +1 -0
  95. package/themes/original/src/components/DriverTips/index.tsx +1 -1
  96. package/themes/original/src/components/Help/index.tsx +21 -4
  97. package/themes/original/src/components/HighestRatedBusinesses/index.tsx +97 -89
  98. package/themes/original/src/components/Home/index.tsx +1 -1
  99. package/themes/original/src/components/LastOrders/index.tsx +12 -1
  100. package/themes/original/src/components/LoginForm/index.tsx +73 -2
  101. package/themes/original/src/components/LoginForm/styles.tsx +6 -1
  102. package/themes/original/src/components/MessageListing/index.tsx +10 -1
  103. package/themes/original/src/components/Messages/index.tsx +49 -44
  104. package/themes/original/src/components/Messages/styles.tsx +1 -3
  105. package/themes/original/src/components/MomentOption/index.tsx +10 -1
  106. package/themes/original/src/components/MomentOption/styles.tsx +1 -1
  107. package/themes/original/src/components/OrderDetails/index.tsx +119 -127
  108. package/themes/original/src/components/OrderDetails/styles.tsx +3 -1
  109. package/themes/original/src/components/OrderProgress/index.tsx +4 -4
  110. package/themes/original/src/components/OrderProgress/styles.tsx +1 -0
  111. package/themes/original/src/components/OrderSummary/index.tsx +35 -2
  112. package/themes/original/src/components/OrderTypeSelector/index.tsx +4 -2
  113. package/themes/original/src/components/OrdersOption/index.tsx +25 -33
  114. package/themes/original/src/components/OrdersOption/styles.tsx +0 -6
  115. package/themes/original/src/components/PaymentOptionWallet/index.tsx +10 -4
  116. package/themes/original/src/components/PaymentOptionWallet/styles.tsx +1 -1
  117. package/themes/original/src/components/PaymentOptions/index.tsx +9 -19
  118. package/themes/original/src/components/PlaceSpot/index.tsx +114 -0
  119. package/themes/original/src/components/PlaceSpot/styles.tsx +11 -0
  120. package/themes/original/src/components/PreviousOrders/index.tsx +19 -13
  121. package/themes/original/src/components/ProductForm/index.tsx +40 -35
  122. package/themes/original/src/components/ProductForm/styles.tsx +2 -2
  123. package/themes/original/src/components/ProductOptionSubOption/index.tsx +5 -3
  124. package/themes/original/src/components/Promotions/index.tsx +250 -0
  125. package/themes/original/src/components/Promotions/styles.tsx +60 -0
  126. package/themes/original/src/components/ReviewOrder/index.tsx +10 -9
  127. package/themes/original/src/components/ReviewProducts/index.tsx +1 -1
  128. package/themes/original/src/components/Sessions/index.tsx +160 -0
  129. package/themes/original/src/components/Sessions/styles.tsx +15 -0
  130. package/themes/original/src/components/SingleProductCard/index.tsx +47 -21
  131. package/themes/original/src/components/SingleProductCard/styles.tsx +28 -1
  132. package/themes/original/src/components/StripeElementsForm/index.tsx +55 -72
  133. package/themes/original/src/components/TaxInformation/index.tsx +17 -7
  134. package/themes/original/src/components/UpsellingProducts/index.tsx +87 -71
  135. package/themes/original/src/components/UserDetails/index.tsx +4 -95
  136. package/themes/original/src/components/UserFormDetails/index.tsx +32 -31
  137. package/themes/original/src/components/UserProfile/index.tsx +70 -20
  138. package/themes/original/src/components/UserProfileForm/index.tsx +28 -24
  139. package/themes/original/src/components/VerifyPhone/index.tsx +10 -7
  140. package/themes/original/src/components/VerifyPhone/styles.tsx +2 -1
  141. package/themes/original/src/components/Wallets/index.tsx +75 -8
  142. package/themes/original/src/components/Wallets/styles.tsx +21 -0
  143. package/themes/original/src/components/shared/HeaderTitle.tsx +21 -0
  144. package/themes/original/src/components/shared/index.tsx +2 -0
  145. package/themes/original/src/config/constants.tsx +6 -6
  146. package/themes/original/src/types/index.tsx +78 -25
  147. package/themes/original/src/utils/index.tsx +12 -2
  148. package/themes/single-business/src/components/AddressList/index.tsx +1 -1
  149. package/themes/single-business/src/components/OrderTypeSelector/index.tsx +6 -6
  150. package/themes/single-business/src/components/UserProfile/index.tsx +1 -1
  151. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
  152. package/src/components/StripeMethodForm/index.tsx +0 -168
@@ -2,12 +2,12 @@ import React, { useState, useEffect } from 'react'
2
2
  import { OrderList, useLanguage, useOrder, ToastType, useToast } from 'ordering-components/native'
3
3
  import { useTheme } from 'styled-components/native';
4
4
  import { useFocusEffect } from '@react-navigation/native'
5
- import { OText, OButton } from '../shared'
5
+ import { OText } from '../shared'
6
6
  import { NotFoundSource } from '../NotFoundSource'
7
7
  import { ActiveOrders } from '../ActiveOrders'
8
8
  import { PreviousOrders } from '../PreviousOrders'
9
9
 
10
- import { OptionTitle, NoOrdersWrapper } from './styles'
10
+ import { OptionTitle } from './styles'
11
11
  import { OrdersOptionParams } from '../../types'
12
12
 
13
13
  import {
@@ -33,7 +33,9 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
33
33
  loadMoreOrders,
34
34
  loadOrders,
35
35
  setOrdersLength,
36
- ordersLength
36
+ ordersLength,
37
+ refreshOrders,
38
+ setRefreshOrders
37
39
  } = props
38
40
 
39
41
  const theme = useTheme();
@@ -95,7 +97,7 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
95
97
  { key: 20, value: t('ORDER_CUSTOMER_ALMOST_ARRIVED_BUSINESS', 'Customer almost arrived to business') },
96
98
  { key: 21, value: t('ORDER_CUSTOMER_ARRIVED_BUSINESS', 'Customer arrived to business') },
97
99
  { key: 22, value: t('ORDER_LOOKING_FOR_DRIVER', 'Looking for driver') },
98
- { key: 23, value: t('ORDER_DRIVER_ON_WAY', 'Driver on way') }
100
+ { key: 23, value: t('ORDER_DRIVER_ON_WAY', 'Driver on way') }
99
101
  ]
100
102
 
101
103
  const objectStatus = orderStatus.find((o) => o.key === status)
@@ -105,9 +107,9 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
105
107
 
106
108
  useFocusEffect(
107
109
  React.useCallback(() => {
108
- loadOrders()
110
+ loadOrders(false, false, false, true)
109
111
  }, [navigation])
110
- )
112
+ )
111
113
 
112
114
  useEffect(() => {
113
115
  const hasMore = pagination?.totalPages && pagination?.currentPage !== pagination?.totalPages
@@ -128,23 +130,16 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
128
130
  }
129
131
  }, [orders, activeOrders])
130
132
 
133
+ useEffect(() => {
134
+ if(refreshOrders){
135
+ loadOrders(false, false, false, true)
136
+ setRefreshOrders && setRefreshOrders(false)
137
+ }
138
+ }, [refreshOrders])
139
+
131
140
  return (
132
141
  <>
133
- {!loading && ordersLength.activeOrdersLength === 0 && ordersLength.previousOrdersLength === 0 && !activeOrders && (
134
- <NoOrdersWrapper>
135
- <OText size={14} numberOfLines={1}>
136
- {t('YOU_DONT_HAVE_ORDERS', 'You don\'t have any orders')}
137
- </OText>
138
- <OButton
139
- text={t('ORDER_NOW', 'Order now')}
140
- onClick={() => onNavigationRedirect && onNavigationRedirect('BusinessList')}
141
- textStyle={{ color: 'white', fontSize: 14 }}
142
- style={{ borderRadius: 7.6, marginBottom: 10, marginTop: 10, height: 44, paddingLeft: 10, paddingRight: 10 }}
143
- />
144
-
145
- </NoOrdersWrapper>
146
- )}
147
- {(ordersLength.activeOrdersLength > 0 || ordersLength.previousOrdersLength > 0) && (
142
+ {(orders.length > 0) && (
148
143
  <>
149
144
  <OptionTitle>
150
145
  <OText size={16} lineHeight={24} weight={'500'} color={theme.colors.textNormal} mBottom={10} >
@@ -155,18 +150,15 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
155
150
  : t('PAST', 'Past'))}
156
151
  </OText>
157
152
  </OptionTitle>
158
- {!(ordersLength.activeOrdersLength === 0 && ordersLength.previousOrdersLength === 0) &&
159
- !loading &&
160
- orders.filter((order: any) => orderStatus.includes(order.status)).length === 0 &&
161
- (
162
- <NotFoundSource
163
- content={t('NO_RESULTS_FOUND', 'Sorry, no results found')}
164
- image={imageFails}
165
- conditioned
166
- />
167
- )}
168
153
  </>
169
154
  )}
155
+ {!loading && orders.length === 0 && (
156
+ <NotFoundSource
157
+ content={t('NO_RESULTS_FOUND', 'Sorry, no results found')}
158
+ image={imageFails}
159
+ conditioned
160
+ />
161
+ )}
170
162
  {loading && (
171
163
  <>
172
164
  {!activeOrders ? (
@@ -239,8 +231,8 @@ export const OrdersOption = (props: OrdersOptionParams) => {
239
231
  ...props,
240
232
  UIComponent: OrdersOptionUI,
241
233
  orderStatus: props.preOrders ? [13] : props.activeOrders
242
- ? [0, 3, 4, 7, 8, 9, 14, 15, 18, 19, 20, 21, 22, 23]
243
- : [1, 2, 5, 6, 10, 11, 12, 16, 17],
234
+ ? [0, 3, 4, 7, 8, 9, 14, 18, 19, 20, 21, 22, 23]
235
+ : [1, 2, 5, 6, 10, 11, 12, 15, 16, 17],
244
236
  useDefualtSessionManager: true,
245
237
  }
246
238
 
@@ -3,9 +3,3 @@ import styled from 'styled-components/native'
3
3
  export const OptionTitle = styled.View`
4
4
  margin-top: 24px;
5
5
  `
6
-
7
- export const NoOrdersWrapper = styled.View`
8
- flex-direction: column;
9
- align-items: center;
10
- margin-top: 50px;
11
- `
@@ -20,6 +20,7 @@ import { OText } from '../shared'
20
20
 
21
21
  const PaymentOptionWalletUI = (props: any) => {
22
22
  const {
23
+ businessConfigs,
23
24
  businessId,
24
25
  walletsState,
25
26
  selectWallet,
@@ -37,6 +38,9 @@ const PaymentOptionWalletUI = (props: any) => {
37
38
  const isWalletCashEnabled = configs?.wallet_cash_enabled?.value === '1'
38
39
  const isWalletPointsEnabled = configs?.wallet_credit_point_enabled?.value === '1'
39
40
 
41
+ const isBusinessWalletCashEnabled = businessConfigs.find((config: any) => config.key === 'wallet_cash_enabled')?.value === '1'
42
+ const isBusinessWalletPointsEnabled = businessConfigs.find((config: any) => config.key === 'wallet_credit_point_enabled')?.value === '1'
43
+
40
44
  const styles = StyleSheet.create({
41
45
  checkBoxStyle: {
42
46
  width: 25,
@@ -53,11 +57,11 @@ const PaymentOptionWalletUI = (props: any) => {
53
57
  const walletName: any = {
54
58
  cash: {
55
59
  name: t('PAY_WITH_CASH_WALLET', 'Pay with Cash Wallet'),
56
- isActive: isWalletCashEnabled
60
+ isActive: isWalletCashEnabled && isBusinessWalletCashEnabled
57
61
  },
58
62
  credit_point: {
59
63
  name: t('PAY_WITH_CREDITS_POINTS_WALLET', 'Pay with Credit Points Wallet'),
60
- isActive: isWalletPointsEnabled
64
+ isActive: isWalletPointsEnabled && isBusinessWalletPointsEnabled
61
65
  }
62
66
  }
63
67
 
@@ -96,17 +100,19 @@ const PaymentOptionWalletUI = (props: any) => {
96
100
  <Container
97
101
  key={wallet.id}
98
102
  isBottomBorder={idx === walletsState.result?.filter((wallet: any) => wallet.valid)?.length - 1}
103
+ onPress={() => handleOnChange(idx, wallet)}
104
+ disabled={(cart?.balance === 0 && !checkedState[idx]) || wallet.balance === 0}
99
105
  >
100
106
  <SectionLeft>
101
107
  <CheckBox
102
108
  value={checkedState[idx]}
103
- onValueChange={() => handleOnChange(idx, wallet)}
104
- disabled={(cart?.balance === 0 && !checkedState[idx]) || wallet.balance === 0 }
109
+ disabled={(cart?.balance === 0 && !checkedState[idx]) || wallet.balance === 0}
105
110
  boxType={'square'}
106
111
  tintColors={{
107
112
  true: theme.colors.primary,
108
113
  false: theme.colors.disabled
109
114
  }}
115
+ onChange={() => handleOnChange(idx, wallet)}
110
116
  tintColor={theme.colors.disabled}
111
117
  onCheckColor={theme.colors.primary}
112
118
  onTintColor={theme.colors.primary}
@@ -1,6 +1,6 @@
1
1
  import styled, { css } from 'styled-components/native'
2
2
 
3
- export const Container = styled.View`
3
+ export const Container = styled.TouchableOpacity`
4
4
  width: 100%;
5
5
  display: flex;
6
6
  padding: 20px 0;
@@ -32,8 +32,6 @@ import {
32
32
  import { getIconCard, flatArray } from '../../utils';
33
33
 
34
34
  const stripeOptions: any = ['stripe_direct', 'stripe', 'stripe_connect']
35
- const methodsPay = ['google_pay', 'apple_pay']
36
- const stripeDirectMethods = ['stripe_direct', ...methodsPay]
37
35
  // const stripeRedirectOptions = [
38
36
  // { name: 'Bancontact', value: 'bancontact' },
39
37
  // { name: 'Alipay', value: 'alipay' },
@@ -56,8 +54,7 @@ const PaymentOptionsUI = (props: any) => {
56
54
  handlePaymethodClick,
57
55
  handlePaymethodDataChange,
58
56
  isOpenMethod,
59
- handlePaymentMethodClickCustom,
60
- handlePlaceOrder
57
+ handlePaymentMethodClickCustom
61
58
  } = props
62
59
 
63
60
  const theme = useTheme();
@@ -125,16 +122,12 @@ const PaymentOptionsUI = (props: any) => {
125
122
 
126
123
  useEffect(() => {
127
124
  if (props.paySelected && props.paySelected?.data) {
128
- setPaymethodData && setPaymethodData(props.paySelected?.data)
125
+ requestAnimationFrame(() => {
126
+ setPaymethodData && setPaymethodData(props.paySelected?.data)
127
+ })
129
128
  }
130
129
  }, [props.paySelected])
131
130
 
132
- useEffect(() => {
133
- if (methodsPay.includes(paymethodSelected?.gateway) && paymethodData?.id && paymethodSelected?.data?.card) {
134
- handlePlaceOrder()
135
- }
136
- }, [paymethodData, paymethodSelected])
137
-
138
131
  const renderPaymethods = ({ item }: any) => {
139
132
  return (
140
133
  <TouchableOpacity
@@ -163,7 +156,7 @@ const PaymentOptionsUI = (props: any) => {
163
156
  )
164
157
  }
165
158
 
166
- const excludeIds: any = [32]; //exclude paypal & connect & redirect
159
+ const excludeIds: any = [32, 66]; //exclude paypal & connect & redirect
167
160
 
168
161
  return (
169
162
  <PMContainer>
@@ -296,11 +289,11 @@ const PaymentOptionsUI = (props: any) => {
296
289
  </KeyboardAvoidingView>
297
290
  </OModal>
298
291
 
299
- {/* Stripe direct, Google pay, Apple pay */}
292
+ {/* Stripe direct */}
300
293
  <OModal
301
294
  entireModal
302
295
  title={t('ADD_CREDIT_OR_DEBIT_CARD', 'Add credit or debit card')}
303
- open={stripeDirectMethods?.includes(isOpenMethod?.paymethod?.gateway) && !paymethodData.id}
296
+ open={isOpenMethod?.paymethod?.gateway === 'stripe_direct' && !paymethodData?.id}
304
297
  onClose={() => handlePaymethodClick(null)}
305
298
  >
306
299
  <KeyboardAvoidingView
@@ -309,13 +302,10 @@ const PaymentOptionsUI = (props: any) => {
309
302
  enabled={Platform.OS === 'ios' ? true : false}
310
303
  >
311
304
  <StripeElementsForm
312
- cart={cart}
313
- paymethod={isOpenMethod?.paymethod?.gateway}
314
- methodsPay={methodsPay}
315
305
  businessId={props.businessId}
316
- publicKey={isOpenMethod?.paymethod?.credentials?.publishable || isOpenMethod?.paymethod?.credentials?.publishable_key}
306
+ publicKey={isOpenMethod?.paymethod?.credentials?.publishable}
317
307
  handleSource={handlePaymethodDataChange}
318
- onCancel={() => handlePaymethodClick(null)}
308
+ onCancel={() => handlePaymethodClick(false)}
319
309
  />
320
310
  </KeyboardAvoidingView>
321
311
  </OModal>
@@ -0,0 +1,114 @@
1
+ import React, { useEffect, useState } from 'react'
2
+ import { View } from 'react-native'
3
+ import { PlaceSpot as PlaceSpotController, useLanguage } from 'ordering-components/native'
4
+ import { PlaceGroupContainer, PlaceSpotContainer } from './styles'
5
+ import { NotFoundSource } from '../NotFoundSource'
6
+ import { OText, ODropDown } from '../shared'
7
+ import { Placeholder, PlaceholderLine } from 'rn-placeholder'
8
+ import { PlaceSpotParams } from '../../types'
9
+
10
+ const PlaceSpotUI = (props: PlaceSpotParams) => {
11
+ const {
12
+ isOpenPlaceSpot,
13
+ cart,
14
+ placesState,
15
+ handleChangePlace,
16
+ getPlacesList,
17
+ setOpenPlaceModal
18
+ } = props
19
+
20
+ const [, t] = useLanguage()
21
+ const [placeGroupSelected, setPlaceGroupSelected] = useState<any>(null)
22
+
23
+ const getPlacesGroups = () => {
24
+ const groups = placesState.placeGroups?.filter((group: any) => group?.enabled && placesState?.places?.find((place: any) => place?.enabled && place?.place_group_id === group?.id))
25
+ return groups.map((group: any) => ({
26
+ value: group,
27
+ content: group?.name,
28
+ showOnSelected: group?.name
29
+ }))
30
+ }
31
+
32
+ const getPlaces = () => {
33
+ const places = placeGroupSelected && placesState?.places?.filter((place: any) => place?.enabled && place?.place_group_id === placeGroupSelected?.id)
34
+ return places.map((place: any) => ({
35
+ value: place,
36
+ content: place.name,
37
+ showOnSelected: place.name
38
+ }))
39
+ }
40
+
41
+ const handlerChangePlace = (place: any) => {
42
+ setOpenPlaceModal(false)
43
+ handleChangePlace(place)
44
+ }
45
+
46
+
47
+ useEffect(() => {
48
+ if (!placesState?.loading) {
49
+ const placeGroupOnCart = placesState?.placeGroups.find((group: any) => group?.id === cart?.place?.place_group_id)
50
+ setPlaceGroupSelected(placeGroupOnCart)
51
+ }
52
+ }, [placesState])
53
+
54
+ useEffect(() => {
55
+ getPlacesList()
56
+ }, [isOpenPlaceSpot])
57
+
58
+ return (
59
+ <PlaceSpotContainer>
60
+ {(placesState.error || placesState?.placeGroups?.length === 0) && !placesState?.loading && (
61
+ <NotFoundSource
62
+ content={t('NO_PLACES_THIS_BUSINESS', 'There are not places for this business')}
63
+ />
64
+ )}
65
+ {placesState?.loading && (
66
+ <Placeholder>
67
+ <PlaceGroupContainer>
68
+ <PlaceholderLine width={100} height={25} />
69
+ <PlaceholderLine height={30} />
70
+ </PlaceGroupContainer>
71
+ <View>
72
+ <PlaceholderLine width={120} height={25} />
73
+ <PlaceholderLine height={30} />
74
+ </View>
75
+ </Placeholder>
76
+ )}
77
+ {!(placesState.error || placesState?.placeGroups?.length === 0) && !placesState?.loading && (
78
+ <>
79
+ <PlaceGroupContainer>
80
+ <OText size={16} mBottom={10}>{t('PLACE_GROUP', 'Place group')}</OText>
81
+ <ODropDown
82
+ placeholder={t('PLACE_GROUP', 'Place group')}
83
+ options={getPlacesGroups()}
84
+ onSelect={(group: any) => setPlaceGroupSelected(group)}
85
+ defaultValue={placeGroupSelected ?? cart?.place}
86
+ isModal
87
+ />
88
+ </PlaceGroupContainer>
89
+ {placeGroupSelected && (
90
+ <View>
91
+ <OText size={16} mBottom={10}>{t('SELECT_YOUR_SPOT', 'Select your spot')}</OText>
92
+ <ODropDown
93
+ onSelect={(place: any) => handlerChangePlace(place)}
94
+ placeholder={t('SELECT_YOUR_SPOT', 'Select your spot')}
95
+ options={getPlaces()}
96
+ defaultValue={placesState?.places?.find((place : any) => place?.id === cart?.place_id)}
97
+ isModal
98
+ />
99
+ </View>
100
+ )}
101
+ </>
102
+ )}
103
+ </PlaceSpotContainer>
104
+ )
105
+ }
106
+
107
+ export const PlaceSpot = (props: PlaceSpotParams) => {
108
+ const placeSpotProps = {
109
+ ...props,
110
+ UIComponent: PlaceSpotUI
111
+ }
112
+
113
+ return <PlaceSpotController {...placeSpotProps} />
114
+ }
@@ -0,0 +1,11 @@
1
+ import styled from 'styled-components/native'
2
+
3
+ export const PlaceSpotContainer = styled.View`
4
+ min-height: 300px;
5
+ padding: 20px;
6
+ `
7
+
8
+ export const PlaceGroupContainer = styled.View`
9
+ margin-bottom: 40px;
10
+ margin-top: 20px;
11
+ `
@@ -85,7 +85,11 @@ export const PreviousOrders = (props: PreviousOrdersParams) => {
85
85
  order: {
86
86
  id: order?.id,
87
87
  business_id: order?.business_id,
88
- logo: order.business?.logo,
88
+ logo: order?.business?.logo,
89
+ driver: order?.driver,
90
+ products: order?.products,
91
+ review: order?.review,
92
+ user_review: order?.user_review
89
93
  },
90
94
  });
91
95
  };
@@ -139,18 +143,20 @@ export const PreviousOrders = (props: PreviousOrdersParams) => {
139
143
  </OText>
140
144
  </Information>
141
145
  <Status>
142
- <OButton
143
- text={t('REORDER', 'Reorder')}
144
- imgRightSrc={''}
145
- textStyle={styles.buttonText}
146
- style={
147
- reorderLoading && order.id === reorderSelected
148
- ? styles.reorderLoading
149
- : styles.reorderbutton
150
- }
151
- onClick={() => handleReorderClick(order.id)}
152
- isLoading={reorderLoading && order.id === reorderSelected}
153
- />
146
+ {order.cart && (
147
+ <OButton
148
+ text={t('REORDER', 'Reorder')}
149
+ imgRightSrc={''}
150
+ textStyle={styles.buttonText}
151
+ style={
152
+ reorderLoading && order.id === reorderSelected
153
+ ? styles.reorderLoading
154
+ : styles.reorderbutton
155
+ }
156
+ onClick={() => handleReorderClick(order.id)}
157
+ isLoading={reorderLoading && order.id === reorderSelected}
158
+ />
159
+ )}
154
160
  {allowedOrderStatus.includes(parseInt(order?.status)) &&
155
161
  !order.review && (
156
162
  <TouchableOpacity
@@ -46,7 +46,6 @@ import { ProductOptionSubOption } from '../ProductOptionSubOption';
46
46
  import { NotFoundSource } from '../NotFoundSource';
47
47
  import { Placeholder, PlaceholderLine, Fade } from 'rn-placeholder';
48
48
  import { useState } from 'react';
49
-
50
49
  const windowHeight = Dimensions.get('window').height;
51
50
  const windowWidth = Dimensions.get('window').width;
52
51
 
@@ -291,15 +290,23 @@ export const ProductOptionsUI = (props: any) => {
291
290
  if (img?.video) {
292
291
  const keys = img?.video.split('/')
293
292
  let _videoId = keys[keys.length - 1]
293
+
294
294
  if (_videoId.includes('watch')) {
295
295
  const __url = _videoId.split('=')[1]
296
296
  _videoId = __url
297
- }
298
- if (_videoId.includes('?')) {
297
+ } else if (_videoId.includes('?')) {
299
298
  const __url = _videoId.split('?')[0]
300
299
  _videoId = __url
301
300
  }
302
- videoList.push(_videoId)
301
+
302
+ if (_videoId.search(/&/i) >= 0) {
303
+ _videoId = _videoId.split('&')[0]
304
+ } else if (_videoId.search(/\?/i) >= 0) {
305
+ _videoId = _videoId.split('?')[0]
306
+ }
307
+ if ((_videoId.length === 11)) {
308
+ videoList.push(_videoId)
309
+ }
303
310
  }
304
311
  }
305
312
  }
@@ -319,28 +326,9 @@ export const ProductOptionsUI = (props: any) => {
319
326
 
320
327
  const ExtraOptions = ({ eID, options }: any) => (
321
328
  <>
322
- {product?.ingredients.length > 0 && (
323
- <TouchableOpacity
324
- key={`eopt_all_00`}
325
- onPress={() => setSelectedOpt(-1)}
326
- style={[
327
- styles.extraItem,
328
- {
329
- borderBottomColor:
330
- selOpt == -1 ? theme.colors.textNormal : theme.colors.border,
331
- },
332
- ]}>
333
- <OText
334
- color={selOpt == -1 ? theme.colors.textNormal : theme.colors.textSecondary}
335
- size={selOpt == -1 ? 14 : 12}
336
- weight={selOpt == -1 ? '600' : 'normal'}>
337
- {t('INGREDIENTS', 'Ingredients')}
338
- </OText>
339
- </TouchableOpacity>
340
- )}
341
- {options.map(({ id, name, respect_to }: any) => (
329
+ {options.map(({ id, name, respect_to, suboptions }: any) => (
342
330
  <React.Fragment key={`cont_key_${id}`}>
343
- {respect_to == null && (
331
+ {respect_to == null && suboptions?.length > 0 && (
344
332
  <TouchableOpacity
345
333
  key={`eopt_key_${id}`}
346
334
  onPress={() => setSelectedOpt(id)}
@@ -658,6 +646,25 @@ export const ProductOptionsUI = (props: any) => {
658
646
  {t('ALL', 'All')}
659
647
  </OText>
660
648
  </TouchableOpacity>
649
+ {product?.ingredients.length > 0 && (
650
+ <TouchableOpacity
651
+ key={`eopt_all_00`}
652
+ onPress={() => setSelectedOpt(-1)}
653
+ style={[
654
+ styles.extraItem,
655
+ {
656
+ borderBottomColor:
657
+ selOpt == -1 ? theme.colors.textNormal : theme.colors.border,
658
+ },
659
+ ]}>
660
+ <OText
661
+ color={selOpt == -1 ? theme.colors.textNormal : theme.colors.textSecondary}
662
+ size={selOpt == -1 ? 14 : 12}
663
+ weight={selOpt == -1 ? '600' : 'normal'}>
664
+ {t('INGREDIENTS', 'Ingredients')}
665
+ </OText>
666
+ </TouchableOpacity>
667
+ )}
661
668
  {product?.extras.map((extra: any) =>
662
669
  <ExtraOptions key={extra.id} options={extra.options} />
663
670
  )}
@@ -687,8 +694,8 @@ export const ProductOptionsUI = (props: any) => {
687
694
  </WrapperIngredients>
688
695
  </View>
689
696
  )}
690
- {product?.extras.map((extra: any) =>
691
- extra.options.map((option: any) => {
697
+ {product?.extras.sort((a: any, b: any) => a.rank - b.rank).map((extra: any) =>
698
+ extra.options.sort((a: any, b: any) => a.rank - b.rank).map((option: any) => {
692
699
  const currentState =
693
700
  productCart.options[`id:${option.id}`] || {};
694
701
  return (
@@ -704,7 +711,7 @@ export const ProductOptionsUI = (props: any) => {
704
711
  backgroundColor: isError(option.id),
705
712
  borderRadius: 7.6
706
713
  }}>
707
- {option.suboptions.map(
714
+ {option.suboptions.sort((a: any, b: any) => a.rank - b.rank).map(
708
715
  (suboption: any) => {
709
716
  const currentState =
710
717
  productCart.options[
@@ -772,7 +779,7 @@ export const ProductOptionsUI = (props: any) => {
772
779
  ) : (
773
780
  <>
774
781
  {product?.extras.map((extra: any) =>
775
- extra.options.map((option: any) => {
782
+ extra.options.sort((a: any, b: any) => a.rank - b.rank).map((option: any) => {
776
783
  if (
777
784
  option.id == selOpt ||
778
785
  (hasRespected(
@@ -797,7 +804,7 @@ export const ProductOptionsUI = (props: any) => {
797
804
  option.id,
798
805
  ),
799
806
  }}>
800
- {option.suboptions.map(
807
+ {option.suboptions.sort((a: any, b: any) => a.rank - b.rank).map(
801
808
  (suboption: any) => {
802
809
  const currentState =
803
810
  productCart.options[
@@ -887,7 +894,6 @@ export const ProductOptionsUI = (props: any) => {
887
894
  <OIcon
888
895
  src={theme.images.general.minus}
889
896
  width={16}
890
- style={{ borderWidth: 1, borderColor: 'red' }}
891
897
  color={
892
898
  productCart.quantity === 1 || isSoldOut
893
899
  ? theme.colors.backgroundGray
@@ -931,7 +937,6 @@ export const ProductOptionsUI = (props: any) => {
931
937
  <OIcon
932
938
  src={theme.images.general.plus}
933
939
  width={16}
934
- style={{ borderWidth: 1, borderColor: 'red' }}
935
940
  color={
936
941
  maxProductQuantity <= 0 ||
937
942
  productCart.quantity >= maxProductQuantity ||
@@ -993,14 +998,14 @@ export const ProductOptionsUI = (props: any) => {
993
998
  ? t('UPDATE', 'Update')
994
999
  : t('ADD', 'Add')
995
1000
  }`}
996
- isDisabled={isSoldOut || maxProductQuantity <= 0 || productCart?.quantity < product?.minimum_per_order || productCart?.quantity > product?.maximum_per_order}
1001
+ isDisabled={isSoldOut || maxProductQuantity <= 0 || (product?.minimum_per_order && (productCart?.quantity < product?.minimum_per_order)) || (product?.maximum_per_order && (productCart?.quantity > product?.maximum_per_order))}
997
1002
  textStyle={{
998
1003
  color: saveErrors || isSoldOut || maxProductQuantity <= 0 ? theme.colors.primary : theme.colors.white,
999
1004
  fontSize: orderState.loading || editMode ? 10 : 14
1000
1005
  }}
1001
1006
  style={{
1002
- backgroundColor: saveErrors || isSoldOut || maxProductQuantity <= 0 || productCart?.quantity < product?.minimum_per_order || productCart?.quantity > product?.maximum_per_order ? theme.colors.lightGray : theme.colors.primary,
1003
- borderColor: saveErrors || isSoldOut || maxProductQuantity <= 0 || productCart?.quantity < product?.minimum_per_order || productCart?.quantity > product?.maximum_per_order ? theme.colors.white : theme.colors.primary,
1007
+ backgroundColor: saveErrors || isSoldOut || maxProductQuantity <= 0 || (product?.minimum_per_order && (productCart?.quantity < product?.minimum_per_order)) || (product?.maximum_per_order && (productCart?.quantity > product?.maximum_per_order)) ? theme.colors.lightGray : theme.colors.primary,
1008
+ borderColor: saveErrors || isSoldOut || maxProductQuantity <= 0 || (product?.minimum_per_order && (productCart?.quantity < product?.minimum_per_order)) || (product?.maximum_per_order && (productCart?.quantity > product?.maximum_per_order)) ? theme.colors.white : theme.colors.primary,
1004
1009
  opacity: saveErrors || isSoldOut || maxProductQuantity <= 0 ? 0.3 : 1,
1005
1010
  borderRadius: 7.6,
1006
1011
  height: 44,
@@ -6,9 +6,10 @@ export const WrapHeader = styled.View`
6
6
  `
7
7
 
8
8
  export const TopActions = styled.TouchableOpacity`
9
- height: 44px;
9
+ height: 60px;
10
10
  justify-content: center;
11
11
  padding-horizontal: 30px;
12
+ width: 80px;
12
13
  `;
13
14
 
14
15
  export const TopHeader = styled.View`
@@ -48,7 +49,6 @@ export const ProductDescription = styled.View`
48
49
  `
49
50
 
50
51
  export const ProductEditions = styled.View`
51
-
52
52
  `
53
53
 
54
54
  export const SectionTitle = styled.View`
@@ -128,9 +128,11 @@ export const ProductOptionSubOptionUI = (props: any) => {
128
128
  </>
129
129
  )}
130
130
  </PositionControl>
131
- <OText size={12} lineHeight={18} color={theme.colors.textSecondary}>
132
- + {parsePrice(price)}
133
- </OText>
131
+ {price > 0 && (
132
+ <OText size={12} lineHeight={18} color={theme.colors.textSecondary}>
133
+ + {parsePrice(price)}
134
+ </OText>
135
+ )}
134
136
  </Container>
135
137
  {showMessage && <OText size={10} mLeft={4} mRight={4} style={{ flex: 1, textAlign: 'center' }} color={theme.colors.primary}>{`${t('OPTIONS_MAX_LIMIT', 'Maximum options to choose')}: ${option?.max}`}</OText>}
136
138
  </View>