ordering-ui-react-native 0.21.0 → 0.21.1-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 (239) 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/PaymentOptionsWebView/index.tsx +1 -0
  6. package/src/components/StripeMethodForm/index.tsx +3 -3
  7. package/src/components/VerifyPhone/styles.tsx +1 -2
  8. package/src/components/shared/OToast.tsx +3 -2
  9. package/src/types/index.tsx +2 -1
  10. package/src/utils/index.tsx +2 -2
  11. package/themes/business/index.tsx +4 -0
  12. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +9 -2
  13. package/themes/business/src/components/BusinessController/index.tsx +19 -17
  14. package/themes/business/src/components/BusinessProductList/AccordionDropdown.tsx +63 -0
  15. package/themes/business/src/components/BusinessProductList/IterateCategories.tsx +108 -0
  16. package/themes/business/src/components/BusinessProductList/ProductList.tsx +196 -0
  17. package/themes/business/src/components/BusinessProductList/index.tsx +196 -0
  18. package/themes/business/src/components/BusinessProductList/styles.tsx +10 -0
  19. package/themes/business/src/components/Chat/index.tsx +41 -13
  20. package/themes/business/src/components/DriverMap/index.tsx +4 -2
  21. package/themes/business/src/components/DriverSchedule/index.tsx +5 -5
  22. package/themes/business/src/components/FloatingButton/index.tsx +34 -31
  23. package/themes/business/src/components/Home/index.tsx +5 -1
  24. package/themes/business/src/components/MapView/index.tsx +11 -7
  25. package/themes/business/src/components/MessagesOption/index.tsx +22 -94
  26. package/themes/business/src/components/NewOrderNotification/index.tsx +161 -106
  27. package/themes/business/src/components/OrderDetails/Delivery.tsx +21 -11
  28. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +88 -51
  29. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +36 -16
  30. package/themes/business/src/components/OrderDetailsLogistic/index.tsx +6 -1
  31. package/themes/business/src/components/OrderSummary/index.tsx +42 -23
  32. package/themes/business/src/components/OrdersListManager/index.tsx +7 -2
  33. package/themes/business/src/components/OrdersListManager/utils.tsx +1 -1
  34. package/themes/business/src/components/OrdersOption/index.tsx +125 -48
  35. package/themes/business/src/components/PreviousMessages/FooterMessageComponent.tsx +103 -0
  36. package/themes/business/src/components/PreviousMessages/index.tsx +97 -55
  37. package/themes/business/src/components/PreviousOrders/OrderItem.tsx +27 -35
  38. package/themes/business/src/components/PreviousOrders/OrderList.tsx +93 -0
  39. package/themes/business/src/components/PreviousOrders/OrdersGroupedItem.tsx +1 -1
  40. package/themes/business/src/components/PreviousOrders/index.tsx +192 -220
  41. package/themes/business/src/components/PreviousOrders/styles.tsx +10 -0
  42. package/themes/business/src/components/ProductItemAccordion/index.tsx +2 -2
  43. package/themes/business/src/components/ReviewCustomer/index.tsx +2 -0
  44. package/themes/business/src/components/SearchBar/index.tsx +2 -1
  45. package/themes/business/src/components/Sessions/index.tsx +187 -0
  46. package/themes/business/src/components/Sessions/styles.tsx +20 -0
  47. package/themes/business/src/components/StoresList/index.tsx +5 -3
  48. package/themes/business/src/components/UserProfileForm/index.tsx +76 -41
  49. package/themes/business/src/components/WebsocketStatus/index.tsx +171 -0
  50. package/themes/business/src/components/WebsocketStatus/styles.tsx +28 -0
  51. package/themes/business/src/components/shared/OInput.tsx +2 -0
  52. package/themes/business/src/hooks/useLocation.tsx +5 -4
  53. package/themes/business/src/types/index.tsx +19 -0
  54. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  55. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  56. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  57. package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
  58. package/themes/kiosk/src/components/LoginForm/index.tsx +124 -96
  59. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  60. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  61. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
  62. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  63. package/themes/original/index.tsx +9 -4
  64. package/themes/original/src/components/AddressDetails/index.tsx +20 -10
  65. package/themes/original/src/components/AddressForm/index.tsx +2 -2
  66. package/themes/original/src/components/AddressForm/styles.tsx +1 -1
  67. package/themes/original/src/components/AddressList/index.tsx +4 -7
  68. package/themes/original/src/components/AddressList/styles.tsx +4 -4
  69. package/themes/original/src/components/AppleLogin/index.tsx +4 -4
  70. package/themes/original/src/components/BusinessBasicInformation/index.tsx +4 -4
  71. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +1 -1
  72. package/themes/original/src/components/BusinessController/index.tsx +18 -10
  73. package/themes/original/src/components/BusinessController/styles.tsx +8 -7
  74. package/themes/original/src/components/BusinessInformation/index.tsx +35 -3
  75. package/themes/original/src/components/BusinessInformation/styles.tsx +2 -2
  76. package/themes/original/src/components/BusinessItemAccordion/index.tsx +11 -7
  77. package/themes/original/src/components/BusinessListingSearch/BusinessSearchFooter.tsx +317 -0
  78. package/themes/original/src/components/BusinessListingSearch/BusinessSearchHeader.tsx +96 -0
  79. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/index.tsx +1 -1
  80. package/themes/original/src/components/BusinessListingSearch/index.tsx +56 -361
  81. package/themes/original/src/components/BusinessListingSearch/styles.tsx +1 -1
  82. package/themes/original/src/components/BusinessPreorder/index.tsx +3 -4
  83. package/themes/original/src/components/BusinessProductsCategories/index.tsx +1 -1
  84. package/themes/original/src/components/BusinessProductsList/index.tsx +3 -3
  85. package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
  86. package/themes/original/src/components/BusinessProductsListing/index.tsx +46 -22
  87. package/themes/original/src/components/BusinessProductsListing/styles.tsx +3 -4
  88. package/themes/original/src/components/BusinessReviews/index.tsx +1 -1
  89. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +1 -1
  90. package/themes/original/src/components/BusinessesListing/Layout/Appointment/styles.tsx +5 -5
  91. package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListFooter.tsx +69 -0
  92. package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListHeader.tsx +406 -0
  93. package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListing.tsx +76 -0
  94. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +29 -402
  95. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +1 -1
  96. package/themes/original/src/components/BusinessesListing/index.tsx +0 -1
  97. package/themes/original/src/components/Cart/index.tsx +32 -9
  98. package/themes/original/src/components/CartContent/index.tsx +98 -59
  99. package/themes/original/src/components/CartStoresListing/styles.tsx +2 -2
  100. package/themes/original/src/components/Checkout/index.tsx +219 -66
  101. package/themes/original/src/components/Checkout/styles.tsx +17 -0
  102. package/themes/original/src/components/CitiesControl/styles.tsx +1 -1
  103. package/themes/original/src/components/DatePicker/index.tsx +17 -0
  104. package/themes/original/src/components/DatePicker/styles.tsx +20 -0
  105. package/themes/original/src/components/Favorite/index.tsx +4 -9
  106. package/themes/original/src/components/Favorite/styles.tsx +0 -2
  107. package/themes/original/src/components/FloatingButton/styles.tsx +1 -1
  108. package/themes/original/src/components/GPSButton/index.tsx +1 -1
  109. package/themes/original/src/components/GiftCard/GiftCardOrdersList/index.tsx +64 -0
  110. package/themes/original/src/components/GiftCard/GiftCardOrdersList/styles.tsx +8 -0
  111. package/themes/original/src/components/GiftCard/GiftCardUI/index.tsx +8 -3
  112. package/themes/original/src/components/GiftCard/PurchaseGiftCard/index.tsx +36 -3
  113. package/themes/original/src/components/GiftCard/PurchaseGiftCard/styles.tsx +1 -1
  114. package/themes/original/src/components/GiftCard/RedeemGiftCard/index.tsx +67 -4
  115. package/themes/original/src/components/GiftCard/RedeemGiftCard/styles.tsx +1 -1
  116. package/themes/original/src/components/GiftCard/SendGiftCard/index.tsx +2 -2
  117. package/themes/original/src/components/GiftCard/SendGiftCard/styles.tsx +1 -1
  118. package/themes/original/src/components/GiftCard/SingleGiftCard/index.tsx +101 -0
  119. package/themes/original/src/components/GiftCard/SingleGiftCard/styles.tsx +4 -0
  120. package/themes/original/src/components/GiftCard/VerticalGiftCardOrdersLayout/index.tsx +83 -0
  121. package/themes/original/src/components/GiftCard/VerticalGiftCardOrdersLayout/styles.tsx +9 -0
  122. package/themes/original/src/components/GoogleMap/index.tsx +50 -5
  123. package/themes/original/src/components/HighestRatedBusinesses/index.tsx +2 -2
  124. package/themes/original/src/components/HighestRatedBusinesses/styles.tsx +1 -1
  125. package/themes/original/src/components/Home/index.tsx +1 -1
  126. package/themes/original/src/components/LastOrder/index.tsx +2 -1
  127. package/themes/original/src/components/LastOrders/index.tsx +2 -1
  128. package/themes/original/src/components/LoginForm/Otp/index.tsx +53 -47
  129. package/themes/original/src/components/LoginForm/index.tsx +6 -1
  130. package/themes/original/src/components/Messages/index.tsx +9 -4
  131. package/themes/original/src/components/Messages/styles.tsx +1 -1
  132. package/themes/original/src/components/MomentOption/index.tsx +4 -4
  133. package/themes/original/src/components/MomentSelector/index.tsx +1 -1
  134. package/themes/original/src/components/MultiCart/index.tsx +1 -1
  135. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +13 -4
  136. package/themes/original/src/components/MultiCheckout/index.tsx +251 -53
  137. package/themes/original/src/components/MultiCheckout/styles.tsx +17 -0
  138. package/themes/original/src/components/MultiOrdersDetails/index.tsx +20 -15
  139. package/themes/original/src/components/MyOrders/index.tsx +24 -29
  140. package/themes/original/src/components/NavBar/index.tsx +3 -1
  141. package/themes/original/src/components/NetworkError/index.tsx +2 -3
  142. package/themes/original/src/components/NetworkError/styles.tsx +2 -2
  143. package/themes/original/src/components/Notifications/index.tsx +4 -8
  144. package/themes/original/src/components/Notifications/styles.tsx +0 -1
  145. package/themes/original/src/components/OrderDetails/OrderHistory.tsx +7 -3
  146. package/themes/original/src/components/OrderDetails/index.tsx +716 -667
  147. package/themes/original/src/components/OrderDetails/styles.tsx +24 -8
  148. package/themes/original/src/components/OrderProgress/index.tsx +28 -9
  149. package/themes/original/src/components/OrderProgress/styles.tsx +1 -1
  150. package/themes/original/src/components/OrderSummary/index.tsx +5 -3
  151. package/themes/original/src/components/OrderTypeSelector/index.tsx +5 -6
  152. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/styles.tsx +1 -1
  153. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/styles.tsx +1 -1
  154. package/themes/original/src/components/OrdersOption/index.tsx +5 -3
  155. package/themes/original/src/components/OrdersOption/styles.tsx +1 -1
  156. package/themes/original/src/components/PageBanner/index.tsx +3 -0
  157. package/themes/original/src/components/PaymentOptionCard/index.tsx +4 -2
  158. package/themes/original/src/components/PaymentOptionStripe/styles.tsx +3 -0
  159. package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
  160. package/themes/original/src/components/PaymentOptions/index.tsx +81 -33
  161. package/themes/original/src/components/PhoneInputNumber/index.tsx +15 -1
  162. package/themes/original/src/components/ProductForm/ActionButton.tsx +120 -0
  163. package/themes/original/src/components/ProductForm/ExtraOptions.tsx +56 -0
  164. package/themes/original/src/components/ProductForm/index.tsx +79 -167
  165. package/themes/original/src/components/ProductForm/styles.tsx +1 -1
  166. package/themes/original/src/components/ProductItemAccordion/index.tsx +12 -8
  167. package/themes/original/src/components/ProductOptionSubOption/index.tsx +120 -79
  168. package/themes/original/src/components/ProductOptionSubOption/styles.tsx +10 -9
  169. package/themes/original/src/components/ProfessionalProfile/styles.tsx +3 -3
  170. package/themes/original/src/components/Promotions/index.tsx +4 -4
  171. package/themes/original/src/components/Promotions/styles.tsx +0 -2
  172. package/themes/original/src/components/ReviewDriver/styles.tsx +1 -1
  173. package/themes/original/src/components/ReviewOrder/styles.tsx +1 -1
  174. package/themes/original/src/components/ReviewProducts/styles.tsx +1 -1
  175. package/themes/original/src/components/ServiceForm/index.tsx +2 -2
  176. package/themes/original/src/components/ServiceForm/styles.tsx +4 -4
  177. package/themes/original/src/components/SingleOrderCard/index.tsx +5 -4
  178. package/themes/original/src/components/SingleProductCard/index.tsx +2 -2
  179. package/themes/original/src/components/SingleProductCard/styles.tsx +0 -3
  180. package/themes/original/src/components/StripeCardsList/index.tsx +23 -8
  181. package/themes/original/src/components/StripeElementsForm/index.tsx +9 -4
  182. package/themes/original/src/components/StripeElementsForm/naked.tsx +12 -1
  183. package/themes/original/src/components/UpsellingProducts/UpsellingContent.tsx +170 -0
  184. package/themes/original/src/components/UpsellingProducts/UpsellingLayout.tsx +86 -0
  185. package/themes/original/src/components/UpsellingProducts/index.tsx +15 -199
  186. package/themes/original/src/components/UpsellingProducts/styles.tsx +19 -0
  187. package/themes/original/src/components/UserFormDetails/index.tsx +53 -7
  188. package/themes/original/src/components/UserProfile/index.tsx +3 -2
  189. package/themes/original/src/components/UserProfileForm/index.tsx +30 -36
  190. package/themes/original/src/components/UserVerification/index.tsx +55 -50
  191. package/themes/original/src/components/WalletTransactions/styles.tsx +1 -0
  192. package/themes/original/src/components/Wallets/index.tsx +8 -9
  193. package/themes/original/src/components/Wallets/styles.tsx +1 -1
  194. package/themes/original/src/components/WebsocketStatus/index.tsx +172 -0
  195. package/themes/original/src/components/WebsocketStatus/styles.tsx +28 -0
  196. package/themes/original/src/components/shared/HeaderTitle.tsx +1 -1
  197. package/themes/original/src/components/shared/OButton.tsx +5 -5
  198. package/themes/original/src/components/shared/OInput.tsx +1 -4
  199. package/themes/original/src/components/shared/OModal.tsx +12 -14
  200. package/themes/original/src/layouts/Container.tsx +5 -3
  201. package/themes/original/src/types/index.tsx +10 -2
  202. package/themes/original/src/utils/index.tsx +124 -0
  203. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
  204. package/src/navigators/BottomNavigator.tsx +0 -117
  205. package/src/navigators/CheckoutNavigator.tsx +0 -66
  206. package/src/navigators/HomeNavigator.tsx +0 -202
  207. package/src/navigators/NavigationRef.tsx +0 -7
  208. package/src/navigators/RootNavigator.tsx +0 -269
  209. package/src/pages/Account.tsx +0 -34
  210. package/src/pages/AddressForm.tsx +0 -62
  211. package/src/pages/AddressList.tsx +0 -24
  212. package/src/pages/BusinessProductsList.tsx +0 -81
  213. package/src/pages/BusinessesListing.tsx +0 -43
  214. package/src/pages/CartList.tsx +0 -49
  215. package/src/pages/Checkout.tsx +0 -101
  216. package/src/pages/ForgotPassword.tsx +0 -24
  217. package/src/pages/Help.tsx +0 -23
  218. package/src/pages/HelpAccountAndPayment.tsx +0 -23
  219. package/src/pages/HelpGuide.tsx +0 -23
  220. package/src/pages/HelpOrder.tsx +0 -23
  221. package/src/pages/Home.tsx +0 -36
  222. package/src/pages/IntroductoryTutorial.tsx +0 -170
  223. package/src/pages/Login.tsx +0 -47
  224. package/src/pages/MomentOption.tsx +0 -30
  225. package/src/pages/MultiCheckout.tsx +0 -31
  226. package/src/pages/MultiOrdersDetails.tsx +0 -27
  227. package/src/pages/MyOrders.tsx +0 -40
  228. package/src/pages/NetworkError.tsx +0 -24
  229. package/src/pages/NotFound.tsx +0 -22
  230. package/src/pages/OrderDetails.tsx +0 -25
  231. package/src/pages/ProductDetails.tsx +0 -55
  232. package/src/pages/Profile.tsx +0 -36
  233. package/src/pages/ReviewDriver.tsx +0 -30
  234. package/src/pages/ReviewOrder.tsx +0 -32
  235. package/src/pages/ReviewProducts.tsx +0 -30
  236. package/src/pages/Sessions.tsx +0 -22
  237. package/src/pages/Signup.tsx +0 -53
  238. package/src/pages/SpinnerLoader.tsx +0 -10
  239. 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';
@@ -64,16 +65,23 @@ const PaymentOptionsUI = (props: any) => {
64
65
  handlePaymentMethodClickCustom,
65
66
  handlePlaceOrder,
66
67
  merchantId,
68
+ urlscheme,
67
69
  setMethodPaySupported,
68
70
  placeByMethodPay,
69
71
  methodPaySupported,
70
72
  setPlaceByMethodPay,
71
73
  setCardList,
72
- onPaymentChange
74
+ onPaymentChange,
75
+ requiredFields,
76
+ openUserModal,
77
+ paymethodClicked,
78
+ setPaymethodClicked,
79
+ androidAppId
73
80
  } = props
74
81
 
75
82
  const theme = useTheme();
76
83
  const [, { showToast }] = useToast();
84
+ const [{ user }] = useSession()
77
85
  const { confirmApplePayPayment } = useApplePay()
78
86
 
79
87
  const getPayIcon = (method: string) => {
@@ -94,6 +102,8 @@ const PaymentOptionsUI = (props: any) => {
94
102
  return theme.images.general.stripesb
95
103
  case 'apple_pay':
96
104
  return theme.images.general.applePayMark
105
+ case 'google_pay':
106
+ return theme.images.general.googlePayMark
97
107
  default:
98
108
  return theme.images.general.creditCard
99
109
  }
@@ -111,8 +121,18 @@ const PaymentOptionsUI = (props: any) => {
111
121
  // { name: t('SELECT_A_PAYMENT_METHOD', 'Select a payment method'), value: '-1' },
112
122
  // ]
113
123
 
124
+ const paymethodsFieldRequired = ['paypal', 'apple_pay', 'global_apple_pay']
125
+
114
126
  const handlePaymentMethodClick = (paymethod: any) => {
115
- if (cart?.balance > 0) {
127
+ if (cart?.balance > 0 || !!user?.guest_id) {
128
+ if (paymethodsFieldRequired.includes(paymethod?.gateway) && requiredFields.length > 0) {
129
+ openUserModal && openUserModal(true)
130
+ setPaymethodClicked({
131
+ confirmed: false,
132
+ paymethod
133
+ })
134
+ return
135
+ }
116
136
  const isPopupMethod = ['stripe', 'stripe_direct', 'stripe_connect', 'stripe_redirect', 'paypal'].includes(paymethod?.gateway)
117
137
  if (webViewPaymentGateway.includes(paymethod?.gateway)) {
118
138
  handlePaymentMethodClickCustom(paymethod)
@@ -158,10 +178,17 @@ const PaymentOptionsUI = (props: any) => {
158
178
  }
159
179
  }, [paymethodData, paymethodSelected])
160
180
 
181
+ useEffect(() => {
182
+ if (paymethodClicked?.confirmed) {
183
+ handlePaymentMethodClickCustom(paymethodClicked?.paymethod)
184
+ }
185
+ }, [paymethodClicked?.confirmed])
186
+
187
+
161
188
  const renderPaymethods = ({ item }: any) => {
162
189
  return (
163
190
  <>
164
- {item?.gateway === 'apple_pay' ? (
191
+ {methodsPay.includes(item?.gateway) ? (
165
192
  <TouchableOpacity
166
193
  onPress={() => handlePaymentMethodClick(item)}
167
194
  >
@@ -192,7 +219,7 @@ const PaymentOptionsUI = (props: any) => {
192
219
  style={{ margin: 0, marginTop: 4 }}
193
220
  color={paymethodSelected?.id === item.id ? theme.colors.white : '#000'}
194
221
  >
195
- {t(item.gateway.toUpperCase(), item.name)}
222
+ {t(item?.gateway?.toUpperCase(), item.name)}
196
223
  </OText>
197
224
  </PMItem>
198
225
  </TouchableOpacity>
@@ -262,7 +289,7 @@ const PaymentOptionsUI = (props: any) => {
262
289
  />
263
290
  )}
264
291
 
265
- {stripeOptions.includes(paymethodSelected?.gateway) &&
292
+ {/* {stripeOptions.includes(paymethodSelected?.gateway) &&
266
293
  (paymethodData?.brand || paymethodData?.card?.brand) &&
267
294
  (paymethodData?.last4 || paymethodData?.card?.last4) &&
268
295
  (
@@ -291,10 +318,10 @@ const PaymentOptionsUI = (props: any) => {
291
318
  </View>
292
319
  </PMCardItemContent>
293
320
  </PMCardSelected>
294
- )}
321
+ )} */}
295
322
 
296
323
  {/* Stripe */}
297
- {isOpenMethod?.paymethod?.gateway === 'stripe' && !paymethodData?.id && (
324
+ {isOpenMethod?.paymethod?.gateway === 'stripe' && (
298
325
  <View>
299
326
  <OButton
300
327
  text={t('ADD_PAYMENT_CARD', 'Add New Payment Card')}
@@ -312,8 +339,15 @@ const PaymentOptionsUI = (props: any) => {
312
339
  payType={paymethodsList?.name}
313
340
  onSelectCard={handlePaymethodDataChange}
314
341
  onNavigationRedirect={onNavigationRedirect}
342
+ paymethodCardId={paymethodData?.id}
315
343
  onCancel={() => handlePaymethodClick(null)}
316
- setAddCardOpen={() => setAddCardOpen({ ...addCardOpen, stripe: true })}
344
+ setAddCardOpen={setAddCardOpen}
345
+ addCardOpen={addCardOpen}
346
+ isOpenMethod={isOpenMethod}
347
+ handlePaymethodDataChange={handlePaymethodDataChange}
348
+ clientSecret={props.clientSecret}
349
+ businessId={props.businessId}
350
+ onPaymentChange={onPaymentChange}
317
351
  />
318
352
  </View>
319
353
  )}
@@ -328,10 +362,13 @@ const PaymentOptionsUI = (props: any) => {
328
362
  handleSource={handlePaymethodDataChange}
329
363
  onCancel={() => handlePaymethodClick(null)}
330
364
  merchantId={merchantId}
365
+ urlscheme={urlscheme}
366
+ androidAppId={androidAppId}
331
367
  setMethodPaySupported={setMethodPaySupported}
332
368
  methodPaySupported={methodPaySupported}
333
369
  placeByMethodPay={placeByMethodPay}
334
370
  setPlaceByMethodPay={setPlaceByMethodPay}
371
+ publicKeyAddCard={isOpenMethod?.paymethod?.credentials?.stripe?.publishable}
335
372
  />
336
373
  )}
337
374
 
@@ -353,29 +390,6 @@ const PaymentOptionsUI = (props: any) => {
353
390
  />
354
391
  )}
355
392
 
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
393
  {/* Stripe direct */}
380
394
  <OModal
381
395
  entireModal
@@ -397,6 +411,9 @@ const PaymentOptionsUI = (props: any) => {
397
411
  handleSource={handlePaymethodDataChange}
398
412
  onCancel={() => handlePaymethodClick(null)}
399
413
  merchantId={merchantId}
414
+ urlscheme={urlscheme}
415
+ androidAppId={androidAppId}
416
+ publicKeyAddCard={isOpenMethod?.paymethod?.credentials?.stripe?.publishable}
400
417
  />
401
418
  </KeyboardAvoidingView>
402
419
  </OModal>
@@ -416,15 +433,16 @@ const PaymentOptionsUI = (props: any) => {
416
433
  <StripeCardsList
417
434
  paymethod={isOpenMethod?.paymethod}
418
435
  businessId={props.businessId}
419
- publicKey={isOpenMethod?.paymethod?.credentials.publishable}
420
436
  payType={paymethodsList?.name}
421
437
  onSelectCard={handlePaymethodDataChange}
422
438
  onNavigationRedirect={onNavigationRedirect}
423
439
  onCancel={() => handlePaymethodClick(null)}
440
+ publicKey={isOpenMethod?.paymethod?.credentials.publishable}
441
+ publicKeyAddCard={isOpenMethod?.paymethod?.credentials?.stripe?.publishable}
424
442
  />
425
443
  </View>
426
444
  )}
427
-
445
+ {/** Stripe connect add cards */}
428
446
  <OModal
429
447
  entireModal
430
448
  title={t('ADD_CREDIT_OR_DEBIT_CARD', 'Add credit or debit card')}
@@ -437,6 +455,7 @@ const PaymentOptionsUI = (props: any) => {
437
455
  enabled={Platform.OS === 'ios' ? true : false}
438
456
  >
439
457
  <StripeElementsForm
458
+ openCarts={props.openCarts}
440
459
  toSave
441
460
  businessId={props.businessId}
442
461
  publicKey={isOpenMethod?.paymethod?.credentials?.stripe?.publishable}
@@ -444,6 +463,35 @@ const PaymentOptionsUI = (props: any) => {
444
463
  accountId={isOpenMethod?.paymethod?.credentials?.user}
445
464
  onSelectCard={handlePaymethodDataChange}
446
465
  onCancel={() => setAddCardOpen({ ...addCardOpen, stripeConnect: false })}
466
+ publicKeyAddCard={isOpenMethod?.paymethod?.credentials?.stripe?.publishable}
467
+ />
468
+ </KeyboardAvoidingView>
469
+ </OModal>
470
+
471
+ {/* Stripe Add card */}
472
+ <OModal
473
+ entireModal
474
+ title={t('ADD_CREDIT_OR_DEBIT_CARD', 'Add credit or debit card')}
475
+ open={addCardOpen?.stripe}
476
+ onClose={() => setAddCardOpen({ ...addCardOpen, stripe: false })}
477
+ style={{ backgroundColor: 'red' }}
478
+ >
479
+ <KeyboardAvoidingView
480
+ behavior={Platform.OS == 'ios' ? 'padding' : 'height'}
481
+ keyboardVerticalOffset={Platform.OS == 'ios' ? 0 : 0}
482
+ enabled={Platform.OS === 'ios' ? true : false}
483
+ >
484
+ <StripeElementsForm
485
+ openCarts={props.openCarts}
486
+ toSave
487
+ businessId={props.businessId}
488
+ businessIds={props.businessIds}
489
+ publicKey={props.publicKey || isOpenMethod?.paymethod?.credentials?.publishable}
490
+ setCardsList={setCardList}
491
+ requirements={props.clientSecret}
492
+ onSelectCard={handlePaymethodDataChange}
493
+ onCancel={() => setAddCardOpen({ ...addCardOpen, stripe: false })}
494
+ publicKeyAddCard={isOpenMethod?.paymethod?.credentials?.stripe?.publishable}
447
495
  />
448
496
  </KeyboardAvoidingView>
449
497
  </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
+ }