ordering-ui-react-native 0.19.7-testing → 0.19.8-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 (219) hide show
  1. package/package.json +6 -5
  2. package/src/DeliveryApp.tsx +43 -1
  3. package/src/components/BusinessInformation/index.tsx +10 -9
  4. package/src/components/BusinessesListing/index.tsx +1 -1
  5. package/src/components/VerifyPhone/styles.tsx +1 -2
  6. package/src/components/shared/OToast.tsx +3 -2
  7. package/src/utils/index.tsx +2 -2
  8. package/themes/business/index.tsx +2 -0
  9. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +9 -2
  10. package/themes/business/src/components/BusinessController/index.tsx +19 -17
  11. package/themes/business/src/components/BusinessProductList/AccordionDropdown.tsx +63 -0
  12. package/themes/business/src/components/BusinessProductList/IterateCategories.tsx +108 -0
  13. package/themes/business/src/components/BusinessProductList/ProductList.tsx +196 -0
  14. package/themes/business/src/components/BusinessProductList/index.tsx +196 -0
  15. package/themes/business/src/components/BusinessProductList/styles.tsx +10 -0
  16. package/themes/business/src/components/Chat/index.tsx +41 -13
  17. package/themes/business/src/components/DriverMap/index.tsx +4 -2
  18. package/themes/business/src/components/DriverSchedule/index.tsx +5 -5
  19. package/themes/business/src/components/FloatingButton/index.tsx +34 -31
  20. package/themes/business/src/components/MapView/index.tsx +11 -7
  21. package/themes/business/src/components/MessagesOption/index.tsx +22 -94
  22. package/themes/business/src/components/NewOrderNotification/index.tsx +138 -106
  23. package/themes/business/src/components/OrderDetails/Delivery.tsx +19 -10
  24. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +88 -51
  25. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +26 -6
  26. package/themes/business/src/components/OrderDetailsLogistic/index.tsx +6 -1
  27. package/themes/business/src/components/OrderSummary/index.tsx +27 -13
  28. package/themes/business/src/components/OrdersListManager/index.tsx +7 -2
  29. package/themes/business/src/components/OrdersListManager/utils.tsx +1 -1
  30. package/themes/business/src/components/OrdersOption/index.tsx +83 -37
  31. package/themes/business/src/components/PreviousMessages/FooterMessageComponent.tsx +103 -0
  32. package/themes/business/src/components/PreviousMessages/index.tsx +97 -55
  33. package/themes/business/src/components/PreviousOrders/OrderItem.tsx +24 -31
  34. package/themes/business/src/components/PreviousOrders/OrderList.tsx +93 -0
  35. package/themes/business/src/components/PreviousOrders/OrdersGroupedItem.tsx +1 -1
  36. package/themes/business/src/components/PreviousOrders/index.tsx +192 -220
  37. package/themes/business/src/components/PreviousOrders/styles.tsx +10 -0
  38. package/themes/business/src/components/ReviewCustomer/index.tsx +2 -0
  39. package/themes/business/src/components/SearchBar/index.tsx +2 -1
  40. package/themes/business/src/components/StoresList/index.tsx +5 -3
  41. package/themes/business/src/components/UserProfileForm/index.tsx +26 -10
  42. package/themes/business/src/components/WebsocketStatus/index.tsx +171 -0
  43. package/themes/business/src/components/WebsocketStatus/styles.tsx +28 -0
  44. package/themes/business/src/types/index.tsx +10 -0
  45. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  46. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  47. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  48. package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
  49. package/themes/kiosk/src/components/LoginForm/index.tsx +124 -96
  50. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  51. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  52. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
  53. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  54. package/themes/original/index.tsx +7 -3
  55. package/themes/original/src/components/AddressForm/index.tsx +2 -2
  56. package/themes/original/src/components/AddressForm/styles.tsx +1 -1
  57. package/themes/original/src/components/AddressList/index.tsx +4 -7
  58. package/themes/original/src/components/AddressList/styles.tsx +4 -4
  59. package/themes/original/src/components/AppleLogin/index.tsx +4 -4
  60. package/themes/original/src/components/BusinessBasicInformation/index.tsx +3 -3
  61. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +1 -1
  62. package/themes/original/src/components/BusinessController/index.tsx +9 -6
  63. package/themes/original/src/components/BusinessController/styles.tsx +8 -7
  64. package/themes/original/src/components/BusinessInformation/index.tsx +35 -3
  65. package/themes/original/src/components/BusinessInformation/styles.tsx +2 -2
  66. package/themes/original/src/components/BusinessItemAccordion/index.tsx +11 -7
  67. package/themes/original/src/components/BusinessListingSearch/BusinessSearchFooter.tsx +317 -0
  68. package/themes/original/src/components/BusinessListingSearch/BusinessSearchHeader.tsx +96 -0
  69. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/index.tsx +1 -1
  70. package/themes/original/src/components/BusinessListingSearch/index.tsx +56 -361
  71. package/themes/original/src/components/BusinessListingSearch/styles.tsx +1 -1
  72. package/themes/original/src/components/BusinessPreorder/index.tsx +3 -4
  73. package/themes/original/src/components/BusinessProductsCategories/index.tsx +1 -1
  74. package/themes/original/src/components/BusinessProductsList/index.tsx +2 -2
  75. package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
  76. package/themes/original/src/components/BusinessProductsListing/index.tsx +43 -19
  77. package/themes/original/src/components/BusinessProductsListing/styles.tsx +3 -4
  78. package/themes/original/src/components/BusinessReviews/index.tsx +1 -1
  79. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +1 -1
  80. package/themes/original/src/components/BusinessesListing/Layout/Appointment/styles.tsx +5 -5
  81. package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListFooter.tsx +69 -0
  82. package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListHeader.tsx +406 -0
  83. package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListing.tsx +76 -0
  84. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +29 -402
  85. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +1 -1
  86. package/themes/original/src/components/BusinessesListing/index.tsx +0 -1
  87. package/themes/original/src/components/Cart/index.tsx +27 -8
  88. package/themes/original/src/components/CartContent/index.tsx +61 -39
  89. package/themes/original/src/components/CartStoresListing/styles.tsx +2 -2
  90. package/themes/original/src/components/Checkout/index.tsx +199 -55
  91. package/themes/original/src/components/Checkout/styles.tsx +17 -0
  92. package/themes/original/src/components/CitiesControl/styles.tsx +1 -1
  93. package/themes/original/src/components/DatePicker/index.tsx +17 -0
  94. package/themes/original/src/components/DatePicker/styles.tsx +20 -0
  95. package/themes/original/src/components/Favorite/index.tsx +4 -9
  96. package/themes/original/src/components/Favorite/styles.tsx +0 -2
  97. package/themes/original/src/components/FloatingButton/styles.tsx +1 -1
  98. package/themes/original/src/components/GPSButton/index.tsx +1 -1
  99. package/themes/original/src/components/GiftCard/GiftCardUI/index.tsx +8 -3
  100. package/themes/original/src/components/GiftCard/PurchaseGiftCard/index.tsx +36 -3
  101. package/themes/original/src/components/GiftCard/PurchaseGiftCard/styles.tsx +1 -1
  102. package/themes/original/src/components/GiftCard/RedeemGiftCard/index.tsx +67 -4
  103. package/themes/original/src/components/GiftCard/RedeemGiftCard/styles.tsx +1 -1
  104. package/themes/original/src/components/GiftCard/SendGiftCard/index.tsx +2 -2
  105. package/themes/original/src/components/GiftCard/SendGiftCard/styles.tsx +1 -1
  106. package/themes/original/src/components/GoogleMap/index.tsx +50 -5
  107. package/themes/original/src/components/HighestRatedBusinesses/index.tsx +2 -2
  108. package/themes/original/src/components/HighestRatedBusinesses/styles.tsx +1 -1
  109. package/themes/original/src/components/Home/index.tsx +1 -1
  110. package/themes/original/src/components/LastOrder/index.tsx +2 -1
  111. package/themes/original/src/components/LastOrders/index.tsx +2 -1
  112. package/themes/original/src/components/LoginForm/Otp/index.tsx +53 -47
  113. package/themes/original/src/components/LoginForm/index.tsx +6 -1
  114. package/themes/original/src/components/Messages/index.tsx +9 -4
  115. package/themes/original/src/components/Messages/styles.tsx +1 -1
  116. package/themes/original/src/components/MomentOption/index.tsx +4 -4
  117. package/themes/original/src/components/MomentSelector/index.tsx +1 -1
  118. package/themes/original/src/components/MultiCart/index.tsx +1 -1
  119. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +13 -4
  120. package/themes/original/src/components/MultiCheckout/index.tsx +226 -52
  121. package/themes/original/src/components/MultiCheckout/styles.tsx +17 -0
  122. package/themes/original/src/components/MultiOrdersDetails/index.tsx +19 -14
  123. package/themes/original/src/components/MyOrders/index.tsx +5 -5
  124. package/themes/original/src/components/NavBar/index.tsx +3 -1
  125. package/themes/original/src/components/NetworkError/index.tsx +2 -3
  126. package/themes/original/src/components/NetworkError/styles.tsx +2 -2
  127. package/themes/original/src/components/Notifications/index.tsx +4 -8
  128. package/themes/original/src/components/Notifications/styles.tsx +0 -1
  129. package/themes/original/src/components/OrderDetails/OrderHistory.tsx +7 -3
  130. package/themes/original/src/components/OrderDetails/index.tsx +716 -667
  131. package/themes/original/src/components/OrderDetails/styles.tsx +24 -8
  132. package/themes/original/src/components/OrderProgress/index.tsx +7 -7
  133. package/themes/original/src/components/OrderProgress/styles.tsx +1 -1
  134. package/themes/original/src/components/OrderSummary/index.tsx +5 -3
  135. package/themes/original/src/components/OrderTypeSelector/index.tsx +5 -6
  136. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/styles.tsx +1 -1
  137. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/styles.tsx +1 -1
  138. package/themes/original/src/components/OrdersOption/index.tsx +4 -3
  139. package/themes/original/src/components/OrdersOption/styles.tsx +1 -1
  140. package/themes/original/src/components/PageBanner/index.tsx +3 -0
  141. package/themes/original/src/components/PaymentOptionCard/index.tsx +4 -2
  142. package/themes/original/src/components/PaymentOptionStripe/styles.tsx +3 -0
  143. package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
  144. package/themes/original/src/components/PaymentOptions/index.tsx +75 -33
  145. package/themes/original/src/components/PhoneInputNumber/index.tsx +15 -1
  146. package/themes/original/src/components/ProductForm/ActionButton.tsx +120 -0
  147. package/themes/original/src/components/ProductForm/ExtraOptions.tsx +56 -0
  148. package/themes/original/src/components/ProductForm/index.tsx +81 -167
  149. package/themes/original/src/components/ProductForm/styles.tsx +1 -1
  150. package/themes/original/src/components/ProductItemAccordion/index.tsx +5 -0
  151. package/themes/original/src/components/ProductOptionSubOption/index.tsx +120 -79
  152. package/themes/original/src/components/ProductOptionSubOption/styles.tsx +10 -9
  153. package/themes/original/src/components/ProfessionalProfile/styles.tsx +3 -3
  154. package/themes/original/src/components/Promotions/index.tsx +4 -4
  155. package/themes/original/src/components/Promotions/styles.tsx +0 -2
  156. package/themes/original/src/components/ReviewDriver/styles.tsx +1 -1
  157. package/themes/original/src/components/ReviewOrder/styles.tsx +1 -1
  158. package/themes/original/src/components/ReviewProducts/styles.tsx +1 -1
  159. package/themes/original/src/components/ServiceForm/index.tsx +2 -2
  160. package/themes/original/src/components/ServiceForm/styles.tsx +4 -4
  161. package/themes/original/src/components/SingleOrderCard/index.tsx +4 -3
  162. package/themes/original/src/components/SingleProductCard/styles.tsx +0 -3
  163. package/themes/original/src/components/StripeCardsList/index.tsx +23 -8
  164. package/themes/original/src/components/StripeElementsForm/index.tsx +5 -3
  165. package/themes/original/src/components/StripeElementsForm/naked.tsx +12 -1
  166. package/themes/original/src/components/UpsellingProducts/UpsellingContent.tsx +170 -0
  167. package/themes/original/src/components/UpsellingProducts/UpsellingLayout.tsx +86 -0
  168. package/themes/original/src/components/UpsellingProducts/index.tsx +15 -199
  169. package/themes/original/src/components/UpsellingProducts/styles.tsx +19 -0
  170. package/themes/original/src/components/UserFormDetails/index.tsx +53 -7
  171. package/themes/original/src/components/UserProfile/index.tsx +1 -1
  172. package/themes/original/src/components/UserProfileForm/index.tsx +30 -36
  173. package/themes/original/src/components/UserVerification/index.tsx +55 -50
  174. package/themes/original/src/components/WalletTransactions/styles.tsx +1 -0
  175. package/themes/original/src/components/Wallets/index.tsx +8 -9
  176. package/themes/original/src/components/Wallets/styles.tsx +1 -1
  177. package/themes/original/src/components/shared/HeaderTitle.tsx +1 -1
  178. package/themes/original/src/components/shared/OInput.tsx +1 -4
  179. package/themes/original/src/components/shared/OModal.tsx +12 -14
  180. package/themes/original/src/layouts/Container.tsx +5 -3
  181. package/themes/original/src/types/index.tsx +10 -2
  182. package/themes/original/src/utils/index.tsx +124 -0
  183. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
  184. package/src/navigators/BottomNavigator.tsx +0 -117
  185. package/src/navigators/CheckoutNavigator.tsx +0 -66
  186. package/src/navigators/HomeNavigator.tsx +0 -202
  187. package/src/navigators/NavigationRef.tsx +0 -7
  188. package/src/navigators/RootNavigator.tsx +0 -269
  189. package/src/pages/Account.tsx +0 -34
  190. package/src/pages/AddressForm.tsx +0 -62
  191. package/src/pages/AddressList.tsx +0 -24
  192. package/src/pages/BusinessProductsList.tsx +0 -81
  193. package/src/pages/BusinessesListing.tsx +0 -43
  194. package/src/pages/CartList.tsx +0 -49
  195. package/src/pages/Checkout.tsx +0 -101
  196. package/src/pages/ForgotPassword.tsx +0 -24
  197. package/src/pages/Help.tsx +0 -23
  198. package/src/pages/HelpAccountAndPayment.tsx +0 -23
  199. package/src/pages/HelpGuide.tsx +0 -23
  200. package/src/pages/HelpOrder.tsx +0 -23
  201. package/src/pages/Home.tsx +0 -36
  202. package/src/pages/IntroductoryTutorial.tsx +0 -170
  203. package/src/pages/Login.tsx +0 -47
  204. package/src/pages/MomentOption.tsx +0 -30
  205. package/src/pages/MultiCheckout.tsx +0 -31
  206. package/src/pages/MultiOrdersDetails.tsx +0 -27
  207. package/src/pages/MyOrders.tsx +0 -40
  208. package/src/pages/NetworkError.tsx +0 -24
  209. package/src/pages/NotFound.tsx +0 -22
  210. package/src/pages/OrderDetails.tsx +0 -25
  211. package/src/pages/ProductDetails.tsx +0 -55
  212. package/src/pages/Profile.tsx +0 -36
  213. package/src/pages/ReviewDriver.tsx +0 -30
  214. package/src/pages/ReviewOrder.tsx +0 -32
  215. package/src/pages/ReviewProducts.tsx +0 -30
  216. package/src/pages/Sessions.tsx +0 -22
  217. package/src/pages/Signup.tsx +0 -53
  218. package/src/pages/SpinnerLoader.tsx +0 -10
  219. package/src/pages/Splash.tsx +0 -21
@@ -11,6 +11,7 @@ import {
11
11
  useLanguage,
12
12
  ToastType,
13
13
  useToast,
14
+ useSession
14
15
  } from 'ordering-components/native';
15
16
  import { useTheme } from 'styled-components/native';
16
17
  import { PaymentOptionCash } from '../PaymentOptionCash';
@@ -69,11 +70,16 @@ const PaymentOptionsUI = (props: any) => {
69
70
  methodPaySupported,
70
71
  setPlaceByMethodPay,
71
72
  setCardList,
72
- onPaymentChange
73
+ onPaymentChange,
74
+ requiredFields,
75
+ openUserModal,
76
+ paymethodClicked,
77
+ setPaymethodClicked
73
78
  } = props
74
79
 
75
80
  const theme = useTheme();
76
81
  const [, { showToast }] = useToast();
82
+ const [{ user }] = useSession()
77
83
  const { confirmApplePayPayment } = useApplePay()
78
84
 
79
85
  const getPayIcon = (method: string) => {
@@ -94,6 +100,8 @@ const PaymentOptionsUI = (props: any) => {
94
100
  return theme.images.general.stripesb
95
101
  case 'apple_pay':
96
102
  return theme.images.general.applePayMark
103
+ case 'google_pay':
104
+ return theme.images.general.googlePayMark
97
105
  default:
98
106
  return theme.images.general.creditCard
99
107
  }
@@ -111,8 +119,18 @@ const PaymentOptionsUI = (props: any) => {
111
119
  // { name: t('SELECT_A_PAYMENT_METHOD', 'Select a payment method'), value: '-1' },
112
120
  // ]
113
121
 
122
+ const paymethodsFieldRequired = ['paypal', 'apple_pay', 'global_apple_pay']
123
+
114
124
  const handlePaymentMethodClick = (paymethod: any) => {
115
- if (cart?.balance > 0) {
125
+ if (cart?.balance > 0 || !!user?.guest_id) {
126
+ if (paymethodsFieldRequired.includes(paymethod?.gateway) && requiredFields.length > 0) {
127
+ openUserModal && openUserModal(true)
128
+ setPaymethodClicked({
129
+ confirmed: false,
130
+ paymethod
131
+ })
132
+ return
133
+ }
116
134
  const isPopupMethod = ['stripe', 'stripe_direct', 'stripe_connect', 'stripe_redirect', 'paypal'].includes(paymethod?.gateway)
117
135
  if (webViewPaymentGateway.includes(paymethod?.gateway)) {
118
136
  handlePaymentMethodClickCustom(paymethod)
@@ -158,10 +176,17 @@ const PaymentOptionsUI = (props: any) => {
158
176
  }
159
177
  }, [paymethodData, paymethodSelected])
160
178
 
179
+ useEffect(() => {
180
+ if (paymethodClicked?.confirmed) {
181
+ handlePaymentMethodClickCustom(paymethodClicked?.paymethod)
182
+ }
183
+ }, [paymethodClicked?.confirmed])
184
+
185
+
161
186
  const renderPaymethods = ({ item }: any) => {
162
187
  return (
163
188
  <>
164
- {item?.gateway === 'apple_pay' ? (
189
+ {methodsPay.includes(item?.gateway) ? (
165
190
  <TouchableOpacity
166
191
  onPress={() => handlePaymentMethodClick(item)}
167
192
  >
@@ -192,7 +217,7 @@ const PaymentOptionsUI = (props: any) => {
192
217
  style={{ margin: 0, marginTop: 4 }}
193
218
  color={paymethodSelected?.id === item.id ? theme.colors.white : '#000'}
194
219
  >
195
- {t(item.gateway.toUpperCase(), item.name)}
220
+ {t(item?.gateway?.toUpperCase(), item.name)}
196
221
  </OText>
197
222
  </PMItem>
198
223
  </TouchableOpacity>
@@ -262,7 +287,7 @@ const PaymentOptionsUI = (props: any) => {
262
287
  />
263
288
  )}
264
289
 
265
- {stripeOptions.includes(paymethodSelected?.gateway) &&
290
+ {/* {stripeOptions.includes(paymethodSelected?.gateway) &&
266
291
  (paymethodData?.brand || paymethodData?.card?.brand) &&
267
292
  (paymethodData?.last4 || paymethodData?.card?.last4) &&
268
293
  (
@@ -291,10 +316,10 @@ const PaymentOptionsUI = (props: any) => {
291
316
  </View>
292
317
  </PMCardItemContent>
293
318
  </PMCardSelected>
294
- )}
319
+ )} */}
295
320
 
296
321
  {/* Stripe */}
297
- {isOpenMethod?.paymethod?.gateway === 'stripe' && !paymethodData?.id && (
322
+ {isOpenMethod?.paymethod?.gateway === 'stripe' && (
298
323
  <View>
299
324
  <OButton
300
325
  text={t('ADD_PAYMENT_CARD', 'Add New Payment Card')}
@@ -312,8 +337,15 @@ const PaymentOptionsUI = (props: any) => {
312
337
  payType={paymethodsList?.name}
313
338
  onSelectCard={handlePaymethodDataChange}
314
339
  onNavigationRedirect={onNavigationRedirect}
340
+ paymethodCardId={paymethodData?.id}
315
341
  onCancel={() => handlePaymethodClick(null)}
316
- setAddCardOpen={() => setAddCardOpen({ ...addCardOpen, stripe: true })}
342
+ setAddCardOpen={setAddCardOpen}
343
+ addCardOpen={addCardOpen}
344
+ isOpenMethod={isOpenMethod}
345
+ handlePaymethodDataChange={handlePaymethodDataChange}
346
+ clientSecret={props.clientSecret}
347
+ businessId={props.businessId}
348
+ onPaymentChange={onPaymentChange}
317
349
  />
318
350
  </View>
319
351
  )}
@@ -332,6 +364,7 @@ const PaymentOptionsUI = (props: any) => {
332
364
  methodPaySupported={methodPaySupported}
333
365
  placeByMethodPay={placeByMethodPay}
334
366
  setPlaceByMethodPay={setPlaceByMethodPay}
367
+ publicKeyAddCard={isOpenMethod?.paymethod?.credentials?.stripe?.publishable}
335
368
  />
336
369
  )}
337
370
 
@@ -353,29 +386,6 @@ const PaymentOptionsUI = (props: any) => {
353
386
  />
354
387
  )}
355
388
 
356
- <OModal
357
- entireModal
358
- title={t('ADD_CREDIT_OR_DEBIT_CARD', 'Add credit or debit card')}
359
- open={addCardOpen.stripe}
360
- onClose={() => setAddCardOpen({ ...addCardOpen, stripe: false })}
361
- style={{ backgroundColor: 'red' }}
362
- >
363
- <KeyboardAvoidingView
364
- behavior={Platform.OS == 'ios' ? 'padding' : 'height'}
365
- keyboardVerticalOffset={Platform.OS == 'ios' ? 0 : 0}
366
- enabled={Platform.OS === 'ios' ? true : false}
367
- >
368
- <StripeElementsForm
369
- toSave
370
- businessId={props.businessId}
371
- publicKey={isOpenMethod?.paymethod?.credentials?.publishable}
372
- requirements={props.clientSecret}
373
- onSelectCard={handlePaymethodDataChange}
374
- onCancel={() => setAddCardOpen({ ...addCardOpen, stripe: false })}
375
- />
376
- </KeyboardAvoidingView>
377
- </OModal>
378
-
379
389
  {/* Stripe direct */}
380
390
  <OModal
381
391
  entireModal
@@ -397,6 +407,7 @@ const PaymentOptionsUI = (props: any) => {
397
407
  handleSource={handlePaymethodDataChange}
398
408
  onCancel={() => handlePaymethodClick(null)}
399
409
  merchantId={merchantId}
410
+ publicKeyAddCard={isOpenMethod?.paymethod?.credentials?.stripe?.publishable}
400
411
  />
401
412
  </KeyboardAvoidingView>
402
413
  </OModal>
@@ -416,15 +427,16 @@ const PaymentOptionsUI = (props: any) => {
416
427
  <StripeCardsList
417
428
  paymethod={isOpenMethod?.paymethod}
418
429
  businessId={props.businessId}
419
- publicKey={isOpenMethod?.paymethod?.credentials.publishable}
420
430
  payType={paymethodsList?.name}
421
431
  onSelectCard={handlePaymethodDataChange}
422
432
  onNavigationRedirect={onNavigationRedirect}
423
433
  onCancel={() => handlePaymethodClick(null)}
434
+ publicKey={isOpenMethod?.paymethod?.credentials.publishable}
435
+ publicKeyAddCard={isOpenMethod?.paymethod?.credentials?.stripe?.publishable}
424
436
  />
425
437
  </View>
426
438
  )}
427
-
439
+ {/** Stripe connect add cards */}
428
440
  <OModal
429
441
  entireModal
430
442
  title={t('ADD_CREDIT_OR_DEBIT_CARD', 'Add credit or debit card')}
@@ -437,6 +449,7 @@ const PaymentOptionsUI = (props: any) => {
437
449
  enabled={Platform.OS === 'ios' ? true : false}
438
450
  >
439
451
  <StripeElementsForm
452
+ openCarts={props.openCarts}
440
453
  toSave
441
454
  businessId={props.businessId}
442
455
  publicKey={isOpenMethod?.paymethod?.credentials?.stripe?.publishable}
@@ -444,6 +457,35 @@ const PaymentOptionsUI = (props: any) => {
444
457
  accountId={isOpenMethod?.paymethod?.credentials?.user}
445
458
  onSelectCard={handlePaymethodDataChange}
446
459
  onCancel={() => setAddCardOpen({ ...addCardOpen, stripeConnect: false })}
460
+ publicKeyAddCard={isOpenMethod?.paymethod?.credentials?.stripe?.publishable}
461
+ />
462
+ </KeyboardAvoidingView>
463
+ </OModal>
464
+
465
+ {/* Stripe Add card */}
466
+ <OModal
467
+ entireModal
468
+ title={t('ADD_CREDIT_OR_DEBIT_CARD', 'Add credit or debit card')}
469
+ open={addCardOpen?.stripe}
470
+ onClose={() => setAddCardOpen({ ...addCardOpen, stripe: false })}
471
+ style={{ backgroundColor: 'red' }}
472
+ >
473
+ <KeyboardAvoidingView
474
+ behavior={Platform.OS == 'ios' ? 'padding' : 'height'}
475
+ keyboardVerticalOffset={Platform.OS == 'ios' ? 0 : 0}
476
+ enabled={Platform.OS === 'ios' ? true : false}
477
+ >
478
+ <StripeElementsForm
479
+ openCarts={props.openCarts}
480
+ toSave
481
+ businessId={props.businessId}
482
+ businessIds={props.businessIds}
483
+ publicKey={props.publicKey || isOpenMethod?.paymethod?.credentials?.publishable}
484
+ setCardsList={setCardList}
485
+ requirements={props.clientSecret}
486
+ onSelectCard={handlePaymethodDataChange}
487
+ onCancel={() => setAddCardOpen({ ...addCardOpen, stripe: false })}
488
+ publicKeyAddCard={isOpenMethod?.paymethod?.credentials?.stripe?.publishable}
447
489
  />
448
490
  </KeyboardAvoidingView>
449
491
  </OModal>
@@ -24,7 +24,8 @@ export const PhoneInputNumber = (props: PhoneInputParams) => {
24
24
  noDropIcon,
25
25
  isDisabled,
26
26
  isStartValidation,
27
- changeCountry
27
+ changeCountry,
28
+ updateStateWithSubmit
28
29
  } = props
29
30
 
30
31
  const theme = useTheme();
@@ -95,6 +96,19 @@ export const PhoneInputNumber = (props: PhoneInputParams) => {
95
96
  }
96
97
  }, [userphoneNumber])
97
98
 
99
+ useEffect(() => {
100
+ if (defaultValue && updateStateWithSubmit) {
101
+ phoneInput.current?.setState({
102
+ number: defaultValue,
103
+ countryCode: defaultCode ?
104
+ !isNaN(defaultCode)
105
+ ? transformCountryCode(defaultCode)
106
+ : findExitingCode(defaultCode)
107
+ : findExitingCode(configs?.default_country_code?.value?.toUpperCase())
108
+ })
109
+ }
110
+ }, [defaultValue])
111
+
98
112
  return (
99
113
  <Wrapper onPress={() => forwardRef?.current?.focus?.()}>
100
114
  {(isStartValidation && userphoneNumber === '') && (
@@ -0,0 +1,120 @@
1
+ import React from 'react'
2
+ import { useSession, useOrder, useLanguage, useConfig } from 'ordering-components/native'
3
+ import { useTheme } from 'styled-components/native'
4
+ import { TouchableOpacity, View } from 'react-native'
5
+ import { OButton, OText } from '../shared';
6
+ import { Placeholder, PlaceholderLine, Fade } from 'rn-placeholder';
7
+
8
+ export const ActionButton = (props : any) => {
9
+ const {
10
+ navigation,
11
+ isHaveWeight,
12
+ isSoldOut,
13
+ maxProductQuantity,
14
+ productCart,
15
+ handleSaveProduct,
16
+ editMode,
17
+ product,
18
+ errors,
19
+ productAddedToCartLength,
20
+ handleRedirectLogin,
21
+ guestCheckoutEnabled,
22
+ orderTypeEnabled,
23
+ handleUpdateGuest,
24
+ actionStatus
25
+ } = props
26
+ const [,t] = useLanguage()
27
+ const [{ auth }] = useSession()
28
+ const [orderState] = useOrder()
29
+ const theme = useTheme()
30
+ const [{ configs }] = useConfig()
31
+ const unaddressedTypes = configs?.unaddressed_order_types_allowed?.value.split('|').map((value: any) => Number(value)) || []
32
+ const isAllowUnaddressOrderType = unaddressedTypes.includes(orderState?.options?.type)
33
+
34
+ const saveErrors =
35
+ orderState.loading ||
36
+ maxProductQuantity === 0 ||
37
+ Object.keys(errors)?.length > 0;
38
+
39
+ return (
40
+ <View
41
+ style={{
42
+ width: isHaveWeight ? '100%' : ((isSoldOut || maxProductQuantity <= 0) ? '60%' : '40%'),
43
+ }}>
44
+ {((productCart &&
45
+ auth &&
46
+ (orderState.options?.address_id || isAllowUnaddressOrderType)) || (isSoldOut || maxProductQuantity <= 0)) && (
47
+ <OButton
48
+ onClick={() => handleSaveProduct()}
49
+ imgRightSrc=""
50
+ text={`${orderState.loading
51
+ ? t('LOADING', 'Loading')
52
+ : (isSoldOut || maxProductQuantity <= 0)
53
+ ? t('SOLD_OUT', 'Sold out')
54
+ : editMode
55
+ ? t('UPDATE', 'Update')
56
+ : t('ADD', 'Add')
57
+ }`}
58
+ isDisabled={isSoldOut || maxProductQuantity <= 0 || (product?.minimum_per_order && ((productCart?.quantity + productAddedToCartLength) < product?.minimum_per_order)) || (product?.maximum_per_order && ((productCart?.quantity + productAddedToCartLength) > product?.maximum_per_order))}
59
+ textStyle={{
60
+ color: saveErrors || isSoldOut || maxProductQuantity <= 0 ? theme.colors.primary : theme.colors.white,
61
+ fontSize: orderState.loading || editMode ? 10 : 14
62
+ }}
63
+ style={{
64
+ backgroundColor: saveErrors || isSoldOut || maxProductQuantity <= 0 || (product?.minimum_per_order && ((productCart?.quantity + productAddedToCartLength) < product?.minimum_per_order)) || (product?.maximum_per_order && ((productCart?.quantity + productAddedToCartLength) > product?.maximum_per_order)) ? theme.colors.lightGray : theme.colors.primary,
65
+ borderColor: saveErrors || isSoldOut || maxProductQuantity <= 0 || (product?.minimum_per_order && ((productCart?.quantity + productAddedToCartLength) < product?.minimum_per_order)) || (product?.maximum_per_order && ((productCart?.quantity + productAddedToCartLength) > product?.maximum_per_order)) ? theme.colors.white : theme.colors.primary,
66
+ opacity: saveErrors || isSoldOut || maxProductQuantity <= 0 ? 0.3 : 1,
67
+ borderRadius: 7.6,
68
+ height: 44,
69
+ shadowOpacity: 0,
70
+ borderWidth: 1,
71
+ marginTop: isHaveWeight ? 10 : 0
72
+ }}
73
+ />
74
+ )}
75
+ {auth &&
76
+ !orderState.options?.address_id && !isAllowUnaddressOrderType &&
77
+ (orderState.loading ? (
78
+ <OButton
79
+ isDisabled
80
+ text={t('LOADING', 'Loading')}
81
+ imgRightSrc=""
82
+ textStyle={{ fontSize: 10 }}
83
+ />
84
+ ) : (
85
+ <OButton onClick={navigation.navigate('AddressList')} />
86
+ ))}
87
+ {!auth && (
88
+ <OButton
89
+ isDisabled={isSoldOut || maxProductQuantity <= 0}
90
+ onClick={() => handleRedirectLogin()}
91
+ text={
92
+ isSoldOut || maxProductQuantity <= 0
93
+ ? t('SOLD_OUT', 'Sold out')
94
+ : t('LOGIN_SIGNUP', 'Login / Sign Up')
95
+ }
96
+ imgRightSrc=""
97
+ textStyle={{ color: theme.colors.primary, fontSize: 13, textAlign: 'center' }}
98
+ style={{
99
+ height: 42,
100
+ borderColor: theme.colors.primary,
101
+ backgroundColor: theme.colors.white,
102
+ paddingLeft: 0,
103
+ paddingRight: 0
104
+ }}
105
+ />
106
+ )}
107
+ {!auth && guestCheckoutEnabled && orderTypeEnabled && (
108
+ <TouchableOpacity style={{ marginTop: 10 }} onPress={handleUpdateGuest}>
109
+ {actionStatus?.loading ? (
110
+ <Placeholder Animation={Fade}>
111
+ <PlaceholderLine height={20} />
112
+ </Placeholder>
113
+ ) : (
114
+ <OText color={theme.colors.primary} size={13} style={{ textAlign: 'center' }}>{t('AS_GUEST_USER', 'As guest user')}</OText>
115
+ )}
116
+ </TouchableOpacity>
117
+ )}
118
+ </View>
119
+ )
120
+ }
@@ -0,0 +1,56 @@
1
+ import React from 'react'
2
+ import { TouchableOpacity } from 'react-native';
3
+ import { useTheme } from 'styled-components/native';
4
+ import { OText } from '../shared';
5
+
6
+ export const ExtraOptions = (props : any) => {
7
+ const {
8
+ options,
9
+ setSelectedOpt,
10
+ scrollViewRef,
11
+ optionLayout,
12
+ editionsLayoutY,
13
+ styles,
14
+ selOpt
15
+ } = props
16
+
17
+ const theme = useTheme()
18
+
19
+ return (
20
+ <>
21
+ {options.map(({ id, name, respect_to, suboptions }: any) => (
22
+ <React.Fragment key={`cont_key_${id}`}>
23
+ {respect_to == null && suboptions?.length > 0 && (
24
+ <TouchableOpacity
25
+ key={`eopt_key_${id}`}
26
+ onPress={() => {
27
+ setSelectedOpt(id)
28
+ scrollViewRef?.current?.scrollTo && scrollViewRef.current.scrollTo({
29
+ y: optionLayout[`id:${id}`]?.y + editionsLayoutY - 50,
30
+ animated: true
31
+ })
32
+ }}
33
+ style={[
34
+ styles.extraItem,
35
+ {
36
+ borderBottomColor:
37
+ selOpt == id ? theme.colors.textNormal : theme.colors.backgroundPage,
38
+ },
39
+ ]}>
40
+ <OText
41
+ color={
42
+ selOpt == id ? theme.colors.textNormal : theme.colors.textSecondary
43
+ }
44
+ size={12}
45
+ weight={selOpt == id ? '600' : 'normal'}
46
+ style={{ maxWidth: 150 }}
47
+ numberOfLines={1}>
48
+ {name}
49
+ </OText>
50
+ </TouchableOpacity>
51
+ )}
52
+ </React.Fragment>
53
+ ))}
54
+ </>
55
+ )
56
+ }