ordering-ui-react-native 0.22.52 → 0.22.53-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 (164) hide show
  1. package/package.json +5 -7
  2. package/src/DeliveryApp.tsx +1 -1
  3. package/src/components/BusinessesListing/index.tsx +1 -1
  4. package/src/components/Checkout/index.tsx +40 -39
  5. package/src/components/VerifyPhone/styles.tsx +1 -2
  6. package/src/context/OfflineActions/index.tsx +236 -0
  7. package/src/providers/AlertProvider.tsx +3 -1
  8. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +9 -6
  9. package/themes/business/src/components/AcceptOrRejectOrder/styles.tsx +1 -0
  10. package/themes/business/src/components/BusinessController/index.tsx +8 -3
  11. package/themes/business/src/components/BusinessProductList/index.tsx +3 -2
  12. package/themes/business/src/components/Chat/index.tsx +15 -3
  13. package/themes/business/src/components/DriverMap/index.tsx +44 -33
  14. package/themes/business/src/components/FloatingButton/index.tsx +3 -2
  15. package/themes/business/src/components/LanguageSelector/index.tsx +1 -1
  16. package/themes/business/src/components/LoginForm/index.tsx +123 -98
  17. package/themes/business/src/components/LogoutButton/index.tsx +13 -4
  18. package/themes/business/src/components/MapView/index.tsx +22 -17
  19. package/themes/business/src/components/NewOrderNotification/index.tsx +25 -14
  20. package/themes/business/src/components/OrderDetails/Business.tsx +56 -20
  21. package/themes/business/src/components/OrderDetails/Delivery.tsx +134 -53
  22. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +155 -45
  23. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +51 -28
  24. package/themes/business/src/components/OrderDetails/styles.tsx +39 -3
  25. package/themes/business/src/components/OrderDetails/usePrinterCommands.tsx +17 -16
  26. package/themes/business/src/components/OrderDetailsLogistic/index.tsx +3 -2
  27. package/themes/business/src/components/OrderSummary/index.tsx +271 -176
  28. package/themes/business/src/components/OrdersListManager/index.tsx +13 -1
  29. package/themes/business/src/components/OrdersOption/index.tsx +345 -231
  30. package/themes/business/src/components/OrdersOption/styles.tsx +14 -0
  31. package/themes/business/src/components/PreviousMessages/index.tsx +26 -3
  32. package/themes/business/src/components/PreviousOrders/OrderItem.tsx +30 -18
  33. package/themes/business/src/components/PreviousOrders/index.tsx +74 -66
  34. package/themes/business/src/components/PreviousOrders/styles.tsx +2 -1
  35. package/themes/business/src/components/PrinterEdition/MessageAlert.tsx +33 -0
  36. package/themes/business/src/components/PrinterEdition/index.tsx +143 -75
  37. package/themes/business/src/components/PrinterEdition/printerList.tsx +23 -0
  38. package/themes/business/src/components/PrinterSettings/index.tsx +1 -1
  39. package/themes/business/src/components/ProductItemAccordion/index.tsx +3 -2
  40. package/themes/business/src/components/ReviewCustomer/index.tsx +2 -0
  41. package/themes/business/src/components/StoresList/index.tsx +2 -2
  42. package/themes/business/src/components/UserProfileForm/index.tsx +48 -10
  43. package/themes/business/src/components/UserProfileForm/styles.tsx +7 -0
  44. package/themes/business/src/components/WebsocketStatus/index.tsx +2 -2
  45. package/themes/business/src/config/currency.tsx +1010 -0
  46. package/themes/business/src/hooks/useLocation.tsx +16 -12
  47. package/themes/business/src/layouts/SafeAreaContainer.tsx +35 -19
  48. package/themes/business/src/types/index.tsx +22 -7
  49. package/themes/business/src/utils/index.tsx +28 -3
  50. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  51. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  52. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  53. package/themes/kiosk/src/components/Checkout/index.tsx +9 -5
  54. package/themes/kiosk/src/components/CustomerName/index.tsx +1 -1
  55. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  56. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  57. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
  58. package/themes/kiosk/src/components/PaymentOptions/index.tsx +121 -57
  59. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  60. package/themes/original/index.tsx +9 -1
  61. package/themes/original/src/components/AddressForm/index.tsx +19 -19
  62. package/themes/original/src/components/AddressList/index.tsx +0 -13
  63. package/themes/original/src/components/AppleLogin/index.tsx +4 -4
  64. package/themes/original/src/components/BusinessBasicInformation/index.tsx +1 -1
  65. package/themes/original/src/components/BusinessController/index.tsx +4 -2
  66. package/themes/original/src/components/BusinessItemAccordion/index.tsx +14 -6
  67. package/themes/original/src/components/BusinessListingSearch/BusinessSearchFooter.tsx +103 -92
  68. package/themes/original/src/components/BusinessListingSearch/BusinessSearchHeader.tsx +8 -6
  69. package/themes/original/src/components/BusinessListingSearch/index.tsx +1 -2
  70. package/themes/original/src/components/BusinessPreorder/index.tsx +46 -30
  71. package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/index.tsx +73 -70
  72. package/themes/original/src/components/BusinessProductsList/index.tsx +6 -7
  73. package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
  74. package/themes/original/src/components/BusinessProductsListing/index.tsx +10 -6
  75. package/themes/original/src/components/BusinessTypeFilter/index.tsx +9 -8
  76. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +2 -1
  77. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +1 -1
  78. package/themes/original/src/components/BusinessesListing/index.tsx +0 -1
  79. package/themes/original/src/components/Cart/index.tsx +49 -15
  80. package/themes/original/src/components/CartContent/index.tsx +2 -4
  81. package/themes/original/src/components/Checkout/index.tsx +109 -88
  82. package/themes/original/src/components/CitiesControl/index.tsx +0 -3
  83. package/themes/original/src/components/CouponControl/index.tsx +1 -3
  84. package/themes/original/src/components/DriverTips/index.tsx +1 -3
  85. package/themes/original/src/components/Favorite/index.tsx +1 -10
  86. package/themes/original/src/components/FavoriteList/index.tsx +0 -1
  87. package/themes/original/src/components/ForgotPasswordForm/index.tsx +5 -12
  88. package/themes/original/src/components/GiftCard/GiftCardUI/index.tsx +15 -17
  89. package/themes/original/src/components/GiftCard/PurchaseGiftCard/index.tsx +3 -7
  90. package/themes/original/src/components/GiftCard/RedeemGiftCard/index.tsx +24 -32
  91. package/themes/original/src/components/GiftCard/SendGiftCard/index.tsx +7 -9
  92. package/themes/original/src/components/GiftCard/VerticalGiftCardOrdersLayout/index.tsx +11 -12
  93. package/themes/original/src/components/GoogleMap/index.tsx +39 -18
  94. package/themes/original/src/components/Help/index.tsx +0 -5
  95. package/themes/original/src/components/HelpAccountAndPayment/index.tsx +0 -5
  96. package/themes/original/src/components/HelpGuide/index.tsx +0 -5
  97. package/themes/original/src/components/HelpOrder/index.tsx +0 -5
  98. package/themes/original/src/components/HighestRatedBusinesses/index.tsx +1 -1
  99. package/themes/original/src/components/Home/index.tsx +35 -19
  100. package/themes/original/src/components/LoginForm/Otp/index.tsx +0 -3
  101. package/themes/original/src/components/LoginForm/index.tsx +12 -14
  102. package/themes/original/src/components/MessageListing/index.tsx +1 -6
  103. package/themes/original/src/components/Messages/index.tsx +20 -13
  104. package/themes/original/src/components/MomentOption/TimeListItem.tsx +56 -0
  105. package/themes/original/src/components/MomentOption/index.tsx +73 -59
  106. package/themes/original/src/components/MomentSelector/index.tsx +5 -2
  107. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +1 -0
  108. package/themes/original/src/components/MultiCheckout/index.tsx +55 -27
  109. package/themes/original/src/components/MultiOrdersDetails/index.tsx +1 -0
  110. package/themes/original/src/components/MyOrders/index.tsx +2 -7
  111. package/themes/original/src/components/NavBar/index.tsx +7 -6
  112. package/themes/original/src/components/NetworkError/index.tsx +0 -5
  113. package/themes/original/src/components/NotFoundSource/index.tsx +0 -3
  114. package/themes/original/src/components/Notifications/index.tsx +0 -5
  115. package/themes/original/src/components/OrderDetails/OrderEta.tsx +4 -3
  116. package/themes/original/src/components/OrderDetails/OrderHistory.tsx +16 -11
  117. package/themes/original/src/components/OrderDetails/index.tsx +44 -21
  118. package/themes/original/src/components/OrderDetails/styles.tsx +0 -1
  119. package/themes/original/src/components/OrderProgress/index.tsx +4 -3
  120. package/themes/original/src/components/OrderSummary/index.tsx +32 -11
  121. package/themes/original/src/components/OrderTypeSelector/index.tsx +7 -11
  122. package/themes/original/src/components/OrdersOption/index.tsx +3 -6
  123. package/themes/original/src/components/PaymentOptionStripe/index.tsx +0 -5
  124. package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
  125. package/themes/original/src/components/PaymentOptions/index.tsx +462 -461
  126. package/themes/original/src/components/PhoneInputNumber/index.tsx +92 -7
  127. package/themes/original/src/components/PlaceSpot/index.tsx +1 -3
  128. package/themes/original/src/components/PreviousOrders/index.tsx +1 -4
  129. package/themes/original/src/components/ProductForm/ActionButton.tsx +7 -12
  130. package/themes/original/src/components/ProductItemAccordion/index.tsx +28 -37
  131. package/themes/original/src/components/ProductOptionSubOption/index.tsx +16 -8
  132. package/themes/original/src/components/ProfessionalProfile/index.tsx +4 -5
  133. package/themes/original/src/components/Promotions/index.tsx +2 -7
  134. package/themes/original/src/components/ReviewDriver/index.tsx +1 -6
  135. package/themes/original/src/components/ReviewOrder/index.tsx +2 -7
  136. package/themes/original/src/components/ReviewProducts/index.tsx +1 -6
  137. package/themes/original/src/components/ReviewTrigger/index.tsx +2 -2
  138. package/themes/original/src/components/ServiceForm/index.tsx +53 -55
  139. package/themes/original/src/components/Sessions/index.tsx +3 -8
  140. package/themes/original/src/components/SignupForm/index.tsx +44 -37
  141. package/themes/original/src/components/SingleOrderCard/index.tsx +7 -5
  142. package/themes/original/src/components/SingleProductCard/index.tsx +3 -4
  143. package/themes/original/src/components/SingleProductCard/styles.tsx +0 -3
  144. package/themes/original/src/components/StripeCardForm/index.tsx +0 -3
  145. package/themes/original/src/components/StripeCardsList/index.tsx +16 -3
  146. package/themes/original/src/components/StripeElementsForm/index.tsx +6 -4
  147. package/themes/original/src/components/StripeElementsForm/naked.tsx +1 -1
  148. package/themes/original/src/components/StripeRedirectForm/index.tsx +0 -3
  149. package/themes/original/src/components/TaxInformation/index.tsx +3 -2
  150. package/themes/original/src/components/UpsellingProducts/UpsellingContent.tsx +8 -5
  151. package/themes/original/src/components/UserDetails/index.tsx +17 -16
  152. package/themes/original/src/components/UserFormDetails/index.tsx +113 -73
  153. package/themes/original/src/components/UserProfile/index.tsx +9 -1
  154. package/themes/original/src/components/UserProfileForm/index.tsx +0 -5
  155. package/themes/original/src/components/UserVerification/index.tsx +18 -5
  156. package/themes/original/src/components/Wallets/index.tsx +1 -3
  157. package/themes/original/src/components/WebsocketStatus/index.tsx +1 -4
  158. package/themes/original/src/components/shared/OAlert.tsx +2 -1
  159. package/themes/original/src/components/shared/OButton.tsx +5 -4
  160. package/themes/original/src/components/shared/OInput.tsx +4 -8
  161. package/themes/original/src/components/shared/OModal.tsx +7 -2
  162. package/themes/original/src/types/index.tsx +12 -4
  163. package/themes/original/src/utils/index.tsx +29 -0
  164. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
@@ -36,10 +36,10 @@ const RedeemGiftCardUI = (props: any) => {
36
36
  marginTop: 20
37
37
  },
38
38
  inputStyle: {
39
- borderWidth: 1,
40
- borderColor: theme.colors.border,
41
- borderRadius: 7.6,
42
- },
39
+ borderWidth: 1,
40
+ borderColor: theme.colors.border,
41
+ borderRadius: 7.6,
42
+ },
43
43
  })
44
44
 
45
45
  const onSubmit = (values) => {
@@ -65,7 +65,7 @@ const RedeemGiftCardUI = (props: any) => {
65
65
  t('ERROR', 'Error'),
66
66
  stringError,
67
67
  [
68
- { text: t('OK', 'oK'), onPress: () => {} }
68
+ { text: t('OK', 'oK'), onPress: () => { } }
69
69
  ]
70
70
  )
71
71
  }
@@ -85,7 +85,7 @@ const RedeemGiftCardUI = (props: any) => {
85
85
  t('ERROR', 'Error'),
86
86
  stringError,
87
87
  [
88
- { text: t('OK', 'oK'), onPress: () => {} }
88
+ { text: t('OK', 'oK'), onPress: () => { } }
89
89
  ]
90
90
  )
91
91
  }, [actionState.error])
@@ -108,12 +108,10 @@ const RedeemGiftCardUI = (props: any) => {
108
108
  borderWidth: 0,
109
109
  width: 26,
110
110
  height: 26,
111
- backgroundColor: '#FFF',
112
- borderColor: '#FFF',
113
- shadowColor: '#FFF',
114
111
  paddingLeft: 0,
115
112
  paddingRight: 0,
116
113
  }}
114
+ useArrow
117
115
  onClick={onClose}
118
116
  icon={AntDesignIcon}
119
117
  iconProps={{
@@ -124,25 +122,25 @@ const RedeemGiftCardUI = (props: any) => {
124
122
  }
125
123
  }}
126
124
  />
127
- <OText color={theme.colors.textNormal} weight='bold' size={20} mLeft={10}>{t('REDEEM_GIFT_CARD', 'Redeem a gift card')}</OText>
125
+ <OText color={theme.colors.textNormal} weight='bold' size={20} mLeft={10}>{t('REDEEM_GIFT_CARD', 'Redeem a gift card')}</OText>
128
126
  </View>
129
127
  <FormController>
130
128
  <OText color={theme.colors.textNormal} size={14} mBottom={10}>{t('GIFT_CARD_CODE', 'Gift card code')}</OText>
131
129
  <Controller
132
130
  control={control}
133
131
  render={({ onChange, value }: any) => (
134
- <OInput
135
- placeholder='XXXX-XXXX-XXXX-XXXX'
136
- value={codeValue}
137
- onChange={(val: any) => {
138
- onChange(val)
139
- handleChangeCode(val)
140
- }}
141
- autoCapitalize='characters'
142
- autoCorrect={false}
143
- blurOnSubmit={false}
144
- style={style.inputStyle}
145
- />
132
+ <OInput
133
+ placeholder='XXXX-XXXX-XXXX-XXXX'
134
+ value={codeValue}
135
+ onChange={(val: any) => {
136
+ onChange(val)
137
+ handleChangeCode(val)
138
+ }}
139
+ autoCapitalize='characters'
140
+ autoCorrect={false}
141
+ blurOnSubmit={false}
142
+ style={style.inputStyle}
143
+ />
146
144
  )}
147
145
  name='code'
148
146
  rules={{
@@ -178,9 +176,7 @@ const RedeemGiftCardUI = (props: any) => {
178
176
  <OButton
179
177
  onClick={handleSubmit(onSubmit)}
180
178
  text={actionState?.loading ? t('LOADING', 'Loading') : t('APPLY_TO_YOUR_BALANCE', 'Apply to your balance')}
181
- bgColor={theme.colors.primary}
182
- borderColor={theme.colors.primary}
183
- textStyle={{ color: 'white', fontSize: 13 }}
179
+ textStyle={{ fontSize: 13 }}
184
180
  imgRightSrc={null}
185
181
  style={style.btnStyle}
186
182
  isDisabled={actionState.loading}
@@ -202,12 +198,10 @@ const RedeemGiftCardUI = (props: any) => {
202
198
  borderWidth: 0,
203
199
  width: 26,
204
200
  height: 26,
205
- backgroundColor: '#FFF',
206
- borderColor: '#FFF',
207
- shadowColor: '#FFF',
208
201
  paddingLeft: 0,
209
202
  paddingRight: 0,
210
203
  }}
204
+ useArrow
211
205
  onClick={onClose}
212
206
  icon={AntDesignIcon}
213
207
  iconProps={{
@@ -218,7 +212,7 @@ const RedeemGiftCardUI = (props: any) => {
218
212
  }
219
213
  }}
220
214
  />
221
- <OText color={theme.colors.textNormal} weight='bold' size={20} mLeft={10}>{t('GIFT_CARD', 'Gift card')}</OText>
215
+ <OText color={theme.colors.textNormal} weight='bold' size={20} mLeft={10}>{t('GIFT_CARD', 'Gift card')}</OText>
222
216
  </View>
223
217
  <View>
224
218
  <OText color={theme.colors.textNormal} size={14} mBottom={6}>{t('TYPE', 'Type')}: {redeemedGiftCard?.type}</OText>
@@ -232,9 +226,7 @@ const RedeemGiftCardUI = (props: any) => {
232
226
  onClose()
233
227
  }}
234
228
  text={t('OK', 'Ok')}
235
- bgColor={theme.colors.primary}
236
- borderColor={theme.colors.primary}
237
- textStyle={{ color: 'white', fontSize: 13 }}
229
+ textStyle={{ fontSize: 13 }}
238
230
  imgRightSrc={null}
239
231
  style={style.btnStyle}
240
232
  />
@@ -1,6 +1,6 @@
1
1
  import React, { useEffect } from 'react'
2
2
  import { StyleSheet, Platform, Alert } from 'react-native';
3
- import { useLanguage, SendGiftCard as SendGiftCardController } from 'ordering-components/native';
3
+ import { useLanguage, SendGiftCard as SendGiftCardController } from 'ordering-components/native';
4
4
  import { useTheme } from 'styled-components/native';
5
5
  import { OText, OButton, OInput } from '../../shared';
6
6
  import { useForm, Controller } from 'react-hook-form'
@@ -29,10 +29,10 @@ const SendGiftCardUI = (props: any) => {
29
29
  marginTop: 20
30
30
  },
31
31
  inputStyle: {
32
- borderWidth: 1,
33
- borderColor: theme.colors.border,
34
- borderRadius: 7.6,
35
- },
32
+ borderWidth: 1,
33
+ borderColor: theme.colors.border,
34
+ borderRadius: 7.6,
35
+ },
36
36
  })
37
37
 
38
38
  const onSubmit = (values) => {
@@ -50,7 +50,7 @@ const SendGiftCardUI = (props: any) => {
50
50
  t('ERROR', 'Error'),
51
51
  stringError,
52
52
  [
53
- { text: t('OK', 'oK'), onPress: () => {} }
53
+ { text: t('OK', 'oK'), onPress: () => { } }
54
54
  ]
55
55
  )
56
56
  }
@@ -144,9 +144,7 @@ const SendGiftCardUI = (props: any) => {
144
144
  <OButton
145
145
  onClick={handleSubmit(onSubmit)}
146
146
  text={actionState?.loading ? t('LOADING', 'Loading') : t('SEND_GIFT_CARD', 'Send gift card')}
147
- bgColor={theme.colors.primary}
148
- borderColor={theme.colors.primary}
149
- textStyle={{ color: 'white', fontSize: 13 }}
147
+ textStyle={{ fontSize: 13 }}
150
148
  imgRightSrc={null}
151
149
  style={style.btnStyle}
152
150
  isDisabled={actionState.loading}
@@ -2,9 +2,9 @@ import React, { useEffect } from 'react';
2
2
  import { useLanguage, GiftCardOrdersList as GiftCardOrdersListController } from 'ordering-components/native';
3
3
  import { useTheme } from 'styled-components/native';
4
4
  import {
5
- Placeholder,
6
- PlaceholderLine,
7
- Fade
5
+ Placeholder,
6
+ PlaceholderLine,
7
+ Fade
8
8
  } from 'rn-placeholder';
9
9
  import { SingleGiftCard } from '../SingleGiftCard';
10
10
  import { OButton, OText } from '../../shared';
@@ -24,7 +24,7 @@ const VerticalGiftCardOrdersLayoutUI = (props: any) => {
24
24
  onNavigationRedirect
25
25
  } = props
26
26
 
27
- const theme = useTheme();
27
+ const theme = useTheme();
28
28
  const [, t] = useLanguage()
29
29
 
30
30
  useEffect(() => {
@@ -40,8 +40,8 @@ const VerticalGiftCardOrdersLayoutUI = (props: any) => {
40
40
  <PlaceholderLine width={30} height={16} />
41
41
  </Placeholder>
42
42
  ) : giftCards.list?.length > 0 && (
43
- <OText size={16} lineHeight={24} weight={'500'} color={theme.colors.textNormal} mBottom={24} style={{ marginTop: 24 }}>{title}</OText>
44
- )}
43
+ <OText size={16} lineHeight={24} weight={'500'} color={theme.colors.textNormal} mBottom={24} style={{ marginTop: 24 }}>{title}</OText>
44
+ )}
45
45
  {giftCards.list.map(card => (
46
46
  <SingleGiftCardWrapper key={card.id}>
47
47
  <SingleGiftCard
@@ -62,12 +62,11 @@ const VerticalGiftCardOrdersLayoutUI = (props: any) => {
62
62
  {paginationProps.totalPages && paginationProps.currentPage < paginationProps.totalPages && (
63
63
  <WrappButton>
64
64
  <OButton
65
- onClick={loadMoreOrders}
66
- text={t('LOAD_MORE_ORDERS', 'Load more orders')}
67
- imgRightSrc={null}
68
- textStyle={{ color: theme.colors.white }}
69
- style={{ borderRadius: 7.6, shadowOpacity: 0 }}
70
- />
65
+ onClick={loadMoreOrders}
66
+ text={t('LOAD_MORE_ORDERS', 'Load more orders')}
67
+ imgRightSrc={null}
68
+ style={{ borderRadius: 7.6, shadowOpacity: 0 }}
69
+ />
71
70
  </WrappButton>
72
71
  )}
73
72
  </ProductsListContainer>
@@ -8,7 +8,6 @@ import Alert from '../../../../../src/providers/AlertProvider'
8
8
  import { OIcon } from '../shared';
9
9
 
10
10
  export const GoogleMap = (props: GoogleMapsParams) => {
11
-
12
11
  const {
13
12
  location,
14
13
  handleChangeAddressMap,
@@ -21,7 +20,10 @@ export const GoogleMap = (props: GoogleMapsParams) => {
21
20
  locations,
22
21
  isIntGeoCoder,
23
22
  businessZones,
24
- delta
23
+ delta,
24
+ autoCompleteAddress,
25
+ setAutoCompleteAddress,
26
+ manualZoom
25
27
  } = props
26
28
 
27
29
  const [, t] = useLanguage()
@@ -59,7 +61,7 @@ export const GoogleMap = (props: GoogleMapsParams) => {
59
61
  strokeWidth: 2
60
62
  }
61
63
 
62
- const geocodePosition = (pos: { latitude: number, longitude: number }, isMovingRegion ?: boolean) => {
64
+ const geocodePosition = (pos: { latitude: number, longitude: number }, isMovingRegion?: boolean) => {
63
65
  Geocoder.from({
64
66
  latitude: pos.latitude,
65
67
  longitude: pos.longitude
@@ -84,7 +86,7 @@ export const GoogleMap = (props: GoogleMapsParams) => {
84
86
  }
85
87
  handleChangeAddressMap && handleChangeAddressMap(address, details)
86
88
  setSaveLocation && setSaveLocation(false)
87
- if(!isMovingRegion){
89
+ if (!isMovingRegion) {
88
90
  handleToggleMap && handleToggleMap()
89
91
  }
90
92
  } else {
@@ -95,7 +97,7 @@ export const GoogleMap = (props: GoogleMapsParams) => {
95
97
  })
96
98
  }
97
99
 
98
- const validateResult = (curPos: { latitude: number, longitude: number }) => {
100
+ const validateResult = (curPos: any) => {
99
101
  const loc1 = center
100
102
  const loc2 = curPos
101
103
  const distance = calculateDistance(loc1, loc2)
@@ -103,25 +105,33 @@ export const GoogleMap = (props: GoogleMapsParams) => {
103
105
  if (!maxLimitLocation) {
104
106
  geocodePosition(curPos)
105
107
  setMarkerPosition(curPos)
106
- setRegion({ ...region, longitude: curPos.longitude, latitude: curPos.latitude })
108
+ if (!autoCompleteAddress) {
109
+ setRegion({ longitude: curPos?.longitude || 0, latitude: curPos?.latitude || 0, latitudeDelta: curPos?.latitudeDelta || 0.0010, longitudeDelta: curPos?.longitudeDelta || (delta ?? 0.0010) * ASPECT_RATIO })
110
+ } else {
111
+ setRegion({ longitude: curPos?.longitude, latitude: curPos?.latitude, latitudeDelta: delta ?? 0.0010, longitudeDelta: (delta ?? 0.0010) * ASPECT_RATIO })
112
+ }
107
113
  return
108
114
  }
109
115
 
110
116
  const _maxLimitLocation = typeof maxLimitLocation === 'string' ? parseInt(maxLimitLocation, 10) : maxLimitLocation
111
117
 
112
118
  if (distance <= _maxLimitLocation) {
113
- if (!aproxEqual(curPos.latitude, center.lat) || !aproxEqual(curPos.longitude, center.lng)){
119
+ if (!aproxEqual(curPos?.latitude, center.lat) || !aproxEqual(curPos?.longitude, center.lng)) {
114
120
  geocodePosition(curPos, true)
115
121
  }
116
122
  setMarkerPosition(curPos)
117
- setRegion({ ...region, longitude: curPos.longitude, latitude: curPos.latitude })
123
+ if (!autoCompleteAddress) {
124
+ setRegion({ longitude: curPos?.longitude || 0, latitude: curPos?.latitude || 0, latitudeDelta: curPos?.latitudeDelta || 0.0010, longitudeDelta: curPos?.longitudeDelta || (delta ?? 0.0010) * ASPECT_RATIO })
125
+ } else {
126
+ setRegion({ longitude: curPos?.longitude, latitude: curPos?.latitude, latitudeDelta: delta ?? 0.0010, longitudeDelta: (delta ?? 0.0010) * ASPECT_RATIO })
127
+ }
118
128
  } else {
119
129
  setMapErrors && setMapErrors('ERROR_MAX_LIMIT_LOCATION')
120
130
  setMarkerPosition({ latitude: center.lat, longitude: center.lng })
121
131
  }
122
132
  }
123
133
 
124
- const aproxEqual = (n1 : number, n2 : number, epsilon = 0.000001) => {
134
+ const aproxEqual = (n1: number, n2: number, epsilon = 0.000001) => {
125
135
  return Math.abs(n1 - n2) < epsilon
126
136
  }
127
137
 
@@ -182,11 +192,21 @@ export const GoogleMap = (props: GoogleMapsParams) => {
182
192
  }, [isIntGeoCoder])
183
193
 
184
194
  useEffect(() => {
185
- mapRef.current.animateToRegion({
186
- ...region,
195
+ const regionConfig = {
187
196
  latitude: location?.lat,
188
197
  longitude: location?.lng,
189
- })
198
+ latitudeDelta: region?.latitudeDelta ?? delta ?? 0.0010,
199
+ longitudeDelta: region?.longitudeDelta ?? (delta ?? 0.0010) * ASPECT_RATIO
200
+ }
201
+
202
+ mapRef.current.animateToRegion(autoCompleteAddress
203
+ ? regionConfig
204
+ : { ...region, ...regionConfig }
205
+ )
206
+
207
+ if (autoCompleteAddress) {
208
+ setAutoCompleteAddress && setAutoCompleteAddress(false)
209
+ }
190
210
  }, [location])
191
211
 
192
212
  useEffect(() => {
@@ -197,11 +217,12 @@ export const GoogleMap = (props: GoogleMapsParams) => {
197
217
 
198
218
  useEffect(() => {
199
219
  const interval = setInterval(() => {
200
- if (mapRef.current && locations) {
220
+ if (mapRef.current && locations && !manualZoom) {
201
221
  fitAllMarkers()
202
222
  }
203
223
  }, 1000)
204
224
  if (locations) {
225
+ fitAllMarkers()
205
226
  SETMARKERS(locations)
206
227
  }
207
228
  return () => clearInterval(interval)
@@ -213,7 +234,7 @@ export const GoogleMap = (props: GoogleMapsParams) => {
213
234
  provider={PROVIDER_GOOGLE}
214
235
  initialRegion={region}
215
236
  style={styles.map}
216
- onRegionChangeComplete={!readOnly ? (coordinates) => handleChangeRegion(coordinates) : () => { }}
237
+ onRegionChangeComplete={!readOnly ? (coordinates) => { handleChangeRegion(coordinates) } : () => { }}
217
238
  zoomTapEnabled
218
239
  zoomEnabled
219
240
  zoomControlEnabled
@@ -249,7 +270,7 @@ export const GoogleMap = (props: GoogleMapsParams) => {
249
270
  <React.Fragment key={i}>
250
271
  {businessZone?.type === 2 && Array.isArray(businessZone?.data) && (
251
272
  <Polygon
252
- coordinates={businessZone?.data.map((item: any) => ({ latitude: item.lat, longitude: item.lng}))}
273
+ coordinates={businessZone?.data.map((item: any) => ({ latitude: item.lat, longitude: item.lng }))}
253
274
  fillColor={fillStyles.fillColor}
254
275
  strokeColor={fillStyles.strokeColor}
255
276
  strokeWidth={fillStyles.strokeWidth}
@@ -257,7 +278,7 @@ export const GoogleMap = (props: GoogleMapsParams) => {
257
278
  )}
258
279
  {(businessZone.type === 1 && businessZone?.data?.center && businessZone?.data?.radio) && (
259
280
  <Circle
260
- center={{ latitude: businessZone?.data?.center.lat, longitude: businessZone?.data?.center.lng}}
281
+ center={{ latitude: businessZone?.data?.center.lat, longitude: businessZone?.data?.center.lng }}
261
282
  radius={businessZone?.data.radio * 1000}
262
283
  fillColor={fillStyles.fillColor}
263
284
  strokeColor={fillStyles.strokeColor}
@@ -266,7 +287,7 @@ export const GoogleMap = (props: GoogleMapsParams) => {
266
287
  )}
267
288
  {(businessZone.type === 5 && businessZone?.data?.distance) && (
268
289
  <Circle
269
- center={{ latitude: center.lat, longitude: center.lng}}
290
+ center={{ latitude: center.lat, longitude: center.lng }}
270
291
  radius={businessZone?.data.distance * units[businessZone?.data?.unit]}
271
292
  fillColor={fillStyles.fillColor}
272
293
  strokeColor={fillStyles.strokeColor}
@@ -275,7 +296,7 @@ export const GoogleMap = (props: GoogleMapsParams) => {
275
296
  )}
276
297
  </React.Fragment>
277
298
  ))}
278
- </MapView>
299
+ </MapView >
279
300
  <Alert
280
301
  open={alertState.open}
281
302
  onAccept={closeAlert}
@@ -48,11 +48,6 @@ export const Help = (props: HelpParams) => {
48
48
  onActionLeft={goToBack}
49
49
  showCall={false}
50
50
  btnStyle={{ paddingLeft: 0 }}
51
- buttonProps={{
52
- bgColor: theme.colors.white,
53
- borderColor: theme.colors.white,
54
- textStyle: { color: theme.colors.btnFont }
55
- }}
56
51
  />
57
52
  <HelpSubItem
58
53
  onPress={() => onRedirect('HelpOrder')}
@@ -37,11 +37,6 @@ export const HelpAccountAndPayment = (props: HelpAccountAndPaymentParams) => {
37
37
  onActionLeft={goToBack}
38
38
  btnStyle={{ paddingLeft: 0 }}
39
39
  showCall={false}
40
- buttonProps={{
41
- bgColor: theme.colors.white,
42
- borderColor: theme.colors.white,
43
- textStyle: { color: theme.colors.btnFont }
44
- }}
45
40
  />
46
41
  <Content>
47
42
  <OText mBottom={20}>
@@ -43,11 +43,6 @@ export const HelpGuide = (props: HelpGuideParams) => {
43
43
  onActionLeft={goToBack}
44
44
  btnStyle={{ paddingLeft: 0 }}
45
45
  showCall={false}
46
- buttonProps={{
47
- bgColor: theme.colors.white,
48
- borderColor: theme.colors.white,
49
- textStyle: { color: theme.colors.btnFont }
50
- }}
51
46
  />
52
47
  <Content>
53
48
  <OText mBottom={15}>
@@ -39,11 +39,6 @@ export const HelpOrder = (props: HelpOrderParams) => {
39
39
  onActionLeft={goToBack}
40
40
  btnStyle={{ paddingLeft: 0 }}
41
41
  showCall={false}
42
- buttonProps={{
43
- bgColor: theme.colors.white,
44
- borderColor: theme.colors.white,
45
- textStyle: { color: theme.colors.btnFont }
46
- }}
47
42
  />
48
43
  <Content>
49
44
  <OText mBottom={20}>
@@ -162,4 +162,4 @@ export const HighestRatedBusinesses = (props: any) => {
162
162
  };
163
163
 
164
164
  return <BusinessesListingController {...highestRatedBusinessesProps} />;
165
- };
165
+ };
@@ -1,33 +1,53 @@
1
- import React, { useEffect } from 'react';
2
- import { useLanguage, useOrder, useConfig } from 'ordering-components/native';
1
+ import React from 'react';
2
+ import { useLanguage, useOrder, useConfig, useSession, useApi, ToastType, useToast } from 'ordering-components/native';
3
3
  import { useTheme } from 'styled-components/native';
4
4
  import { StyleSheet, View } from 'react-native';
5
5
  import { OButton, OIcon, OText } from '../shared';
6
6
  import { LanguageSelector } from '../LanguageSelector';
7
7
  import { TouchableOpacity } from 'react-native-gesture-handler';
8
8
  import { useWindowDimensions, Platform } from 'react-native';
9
+ import uuid from 'react-native-uuid';
9
10
 
10
11
  export const Home = (props: any) => {
11
12
  const { onNavigationRedirect, businessSlug } = props;
12
13
  const { width, height } = useWindowDimensions();
13
14
  const [, t] = useLanguage();
14
- const [orderState] = useOrder();
15
+ const [orderState, { handleOrderStateLoading, setStateInitialValues }] = useOrder();
15
16
  const [{ configs }] = useConfig()
17
+ const [, { login }] = useSession()
18
+ const [ordering] = useApi()
19
+ const [, { showToast }] = useToast()
16
20
 
17
21
  const theme = useTheme();
18
- const unaddressedTypes = configs?.unaddressed_order_types_allowed?.value.split('|').map((value: any) => Number(value)) || []
19
- const isAllowUnaddressOrderType = unaddressedTypes.includes(orderState?.options?.type)
20
22
 
21
- useEffect(() => {
22
- if (isAllowUnaddressOrderType) {
23
- onNavigationRedirect(!!businessSlug ? 'Business' : 'BusinessList')
23
+ const handleCreateGuestUser = async (values: any) => {
24
+ try {
25
+ await handleOrderStateLoading(true)
26
+ const { content: { error, result } } = await ordering.users().save(values)
27
+ if (!error) {
28
+ await login({
29
+ user: result,
30
+ token: result.session?.access_token
31
+ })
32
+ } else {
33
+ showToast(ToastType.Error, t('ERROR_CREATING_GUEST_USER', 'Error creating guest users'))
34
+ }
35
+ await handleOrderStateLoading(false)
36
+ } catch (err) {
37
+ await handleOrderStateLoading(false)
38
+ showToast(ToastType.Error, t('ERROR_CREATING_GUEST_USER', 'Error creating guest users'))
24
39
  }
25
- }, [isAllowUnaddressOrderType])
40
+ }
41
+
42
+ const handleUpdateGuest = async () => {
43
+ const guestToken = uuid.v4()
44
+ if (guestToken) await handleCreateGuestUser({ guest_token: guestToken })
45
+ }
26
46
 
27
47
  return (
28
48
  <View style={styles.container}>
29
49
  <View>
30
- <View style={{ paddingTop: (height <= 756 && Platform.OS !== 'ios') ? (height * 0.05) : 0 }}>
50
+ <View style={{paddingTop: (height <= 756 && Platform.OS !== 'ios') ? (height * 0.05) : 0 }}>
31
51
  <LanguageSelector />
32
52
  </View>
33
53
  <OIcon
@@ -49,13 +69,11 @@ export const Home = (props: any) => {
49
69
  </OText>
50
70
  <OButton
51
71
  text={t('LOGIN_NOW', 'Login now')}
52
- bgColor={theme.colors.primary}
53
- borderColor={theme.colors.primary}
54
72
  style={styles.buttons}
55
73
  isCircle={false}
56
- textStyle={{ color: 'white' }}
57
74
  onClick={() => onNavigationRedirect('Login')}
58
75
  imgRightSrc={null}
76
+ isDisabled={orderState?.loading}
59
77
  />
60
78
  <OButton
61
79
  text={t('SIGNUP', 'Signup')}
@@ -65,15 +83,13 @@ export const Home = (props: any) => {
65
83
  textStyle={{ color: 'black' }}
66
84
  onClick={() => onNavigationRedirect('Signup')}
67
85
  imgRightSrc={null}
86
+ isDisabled={orderState?.loading}
68
87
  />
69
88
  <TouchableOpacity
89
+ disabled={orderState?.loading}
70
90
  style={{ ...styles.textLink, marginTop: 12 }}
71
- onPress={() =>
72
- orderState?.options?.address?.address
73
- ? onNavigationRedirect(!!businessSlug ? 'Business' : 'BusinessList', { isGuestUser: true })
74
- : onNavigationRedirect('AddressForm', { isGuestUser: true })
75
- }>
76
- <OText weight="normal" size={18} color={theme.colors.white}>
91
+ onPress={() => handleUpdateGuest()}>
92
+ <OText weight="normal" size={18} color={orderState?.loading ? '#ccc' : theme.colors.white}>
77
93
  {t('CONTINUE_AS_GUEST', 'Continue as guest')}
78
94
  </OText>
79
95
  </TouchableOpacity>
@@ -145,9 +145,6 @@ export const Otp = (props: otpParams) => {
145
145
  </TouchableOpacity>
146
146
  <OButton
147
147
  onClick={() => handleCloseOtp()}
148
- bgColor={theme.colors.white}
149
- borderColor={theme.colors.primary}
150
- textStyle={{ color: theme.colors.primary }}
151
148
  style={{ borderRadius: 8, width: '100%' }}
152
149
  text={t('CANCEL', 'Cancel')}
153
150
  />
@@ -73,7 +73,8 @@ const LoginFormUI = (props: LoginParams) => {
73
73
  generateOtpCode,
74
74
  useLoginOtpEmail,
75
75
  useLoginOtpCellphone,
76
- isGuest
76
+ isGuest,
77
+ setCellphoneStartZero
77
78
  } = props;
78
79
 
79
80
  const [, { showToast }] = useToast();
@@ -106,9 +107,9 @@ const LoginFormUI = (props: LoginParams) => {
106
107
 
107
108
  const [isCheckingCode, setCheckingCode] = useState(false)
108
109
 
109
- const googleLoginEnabled = configs?.google_login_enabled?.value === '1' || !configs?.google_login_enabled?.enabled
110
- const facebookLoginEnabled = configs?.facebook_login_enabled?.value === '1' || !configs?.facebook_login_enabled?.enabled
111
- const appleLoginEnabled = Platform.OS === 'ios' && (configs?.apple_login_enabled?.value === '1' || !configs?.apple_login_enabled?.enabled)
110
+ const googleLoginEnabled = configs?.google_login_enabled?.value === '1'
111
+ const facebookLoginEnabled = configs?.facebook_login_enabled?.value === '1'
112
+ const appleLoginEnabled = Platform.OS === 'ios' && (configs?.apple_login_enabled?.value === '1')
112
113
 
113
114
  const loginStyle = StyleSheet.create({
114
115
  btnOutline: {
@@ -300,6 +301,11 @@ const LoginFormUI = (props: LoginParams) => {
300
301
  setTabLayouts(_tabLayouts)
301
302
  }
302
303
 
304
+ const handleChangePhoneNumber = (number: any, rawNumber: any) => {
305
+ setPhoneInputData(number)
306
+ setCellphoneStartZero && setCellphoneStartZero(rawNumber?.number && rawNumber?.countryCallingCode ? rawNumber?.number : null)
307
+ }
308
+
303
309
  useEffect(() => {
304
310
  if (configs && Object.keys(configs).length > 0 && enableReCaptcha) {
305
311
  if (configs?.security_recaptcha_type?.value === 'v3' &&
@@ -412,11 +418,6 @@ const LoginFormUI = (props: LoginParams) => {
412
418
  btnStyle={{ paddingLeft: 0 }}
413
419
  titleWrapStyle={{ paddingHorizontal: 0 }}
414
420
  titleStyle={{ marginRight: 0, marginLeft: 0 }}
415
- buttonProps={{
416
- bgColor: theme.colors.white,
417
- borderColor: theme.colors.white,
418
- textStyle: { color: theme.colors.btnFont }
419
- }}
420
421
  />
421
422
  )}
422
423
  <FormSide>
@@ -591,7 +592,7 @@ const LoginFormUI = (props: LoginParams) => {
591
592
  <View style={{ marginBottom: 28 }}>
592
593
  <PhoneInputNumber
593
594
  data={phoneInputData}
594
- handleData={(val: any) => setPhoneInputData(val)}
595
+ handleData={handleChangePhoneNumber}
595
596
  textInputProps={{
596
597
  returnKeyType: 'next',
597
598
  onSubmitEditing: () => passwordRef?.current?.focus?.(),
@@ -635,6 +636,7 @@ const LoginFormUI = (props: LoginParams) => {
635
636
  />
636
637
  )
637
638
  }
639
+ autoCapitalize='none'
638
640
  value={value}
639
641
  forwardRef={passwordRef}
640
642
  onChange={(val: any) => onChange(val)}
@@ -711,9 +713,6 @@ const LoginFormUI = (props: LoginParams) => {
711
713
  <OButton
712
714
  onClick={handleSubmit(onSubmit)}
713
715
  text={loginTab !== 'otp' ? loginButtonText : t('GET_VERIFY_CODE', 'Get verify code')}
714
- bgColor={theme.colors.primary}
715
- borderColor={theme.colors.primary}
716
- textStyle={{ color: 'white' }}
717
716
  imgRightSrc={null}
718
717
  isLoading={formState.loading}
719
718
  style={{ borderRadius: 7.6, marginTop: 10, marginBottom: 25 }}
@@ -752,7 +751,6 @@ const LoginFormUI = (props: LoginParams) => {
752
751
  <OButton
753
752
  onClick={handleVerifyCodeClick}
754
753
  text={t('GET_VERIFY_CODE', 'Get Verify Code')}
755
- borderColor={theme.colors.primary}
756
754
  style={loginStyle.btnOutline}
757
755
  imgRightSrc={null}
758
756
  isLoading={isLoadingVerifyModal}
@@ -200,7 +200,7 @@ export const OrderListing = (props: OrdersOptionParams) => {
200
200
  const OrderListingProps = {
201
201
  ...props,
202
202
  UIComponent: OrdersOptionUI,
203
- orderStatus: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23],
203
+ orderStatus: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26],
204
204
  useDefualtSessionManager: true,
205
205
  paginationSettings: {
206
206
  initialPage: 1,
@@ -266,11 +266,6 @@ export const MessageListing = (props: MessageListingParams) => {
266
266
  showCall={false}
267
267
  paddingTop={Platform.OS === 'ios' ? 20 : 10}
268
268
  btnStyle={{ paddingLeft: 0 }}
269
- buttonProps={{
270
- bgColor: theme.colors.white,
271
- borderColor: theme.colors.white,
272
- textStyle: { color: theme.colors.btnFont }
273
- }}
274
269
  />
275
270
  <OrderListing
276
271
  ordersLength={{ activeOrdersLength: 0, previousOrdersLength: 0 }}