ordering-ui-react-native 0.17.99 → 0.18.0-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 (257) hide show
  1. package/package.json +9 -7
  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/OrderCreating/index.tsx +0 -20
  6. package/src/components/PaymentOptionsWebView/index.tsx +29 -8
  7. package/src/components/PhoneInputNumber/index.tsx +6 -2
  8. package/src/components/StripeMethodForm/index.tsx +136 -102
  9. package/src/components/VerifyPhone/styles.tsx +1 -2
  10. package/src/components/shared/OToast.tsx +3 -2
  11. package/src/types/index.tsx +5 -0
  12. package/src/utils/index.tsx +7 -2
  13. package/themes/business/index.tsx +2 -0
  14. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +36 -26
  15. package/themes/business/src/components/BusinessController/index.tsx +0 -1
  16. package/themes/business/src/components/Chat/index.tsx +163 -123
  17. package/themes/business/src/components/DriverMap/index.tsx +17 -6
  18. package/themes/business/src/components/DriverSchedule/index.tsx +45 -8
  19. package/themes/business/src/components/FloatingButton/index.tsx +34 -31
  20. package/themes/business/src/components/GoogleMap/index.tsx +58 -57
  21. package/themes/business/src/components/LoginForm/index.tsx +5 -2
  22. package/themes/business/src/components/MapView/index.tsx +14 -10
  23. package/themes/business/src/components/MessagesOption/index.tsx +22 -94
  24. package/themes/business/src/components/NewOrderNotification/index.tsx +123 -96
  25. package/themes/business/src/components/NotFoundSource/index.tsx +2 -2
  26. package/themes/business/src/components/OrderDetails/Business.tsx +1 -1
  27. package/themes/business/src/components/OrderDetails/Delivery.tsx +209 -15
  28. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +91 -43
  29. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +87 -66
  30. package/themes/business/src/components/OrderDetailsLogistic/index.tsx +200 -0
  31. package/themes/business/src/components/OrderDetailsLogistic/styles.tsx +5 -0
  32. package/themes/business/src/components/OrderMessage/index.tsx +19 -18
  33. package/themes/business/src/components/OrderSummary/index.tsx +114 -123
  34. package/themes/business/src/components/OrdersListManager/index.tsx +7 -2
  35. package/themes/business/src/components/OrdersListManager/utils.tsx +1 -1
  36. package/themes/business/src/components/OrdersOption/index.tsx +60 -47
  37. package/themes/business/src/components/PreviousMessages/FooterMessageComponent.tsx +103 -0
  38. package/themes/business/src/components/PreviousMessages/index.tsx +97 -55
  39. package/themes/business/src/components/PreviousOrders/OrderItem.tsx +21 -29
  40. package/themes/business/src/components/PreviousOrders/OrderList.tsx +93 -0
  41. package/themes/business/src/components/PreviousOrders/OrdersGroupedItem.tsx +1 -1
  42. package/themes/business/src/components/PreviousOrders/index.tsx +198 -221
  43. package/themes/business/src/components/PreviousOrders/styles.tsx +10 -0
  44. package/themes/business/src/components/ProductItemAccordion/index.tsx +7 -1
  45. package/themes/business/src/components/ReviewCustomer/index.tsx +18 -13
  46. package/themes/business/src/components/StoresList/index.tsx +3 -4
  47. package/themes/business/src/components/UserProfileForm/index.tsx +14 -15
  48. package/themes/business/src/components/WebsocketStatus/index.tsx +171 -0
  49. package/themes/business/src/components/WebsocketStatus/styles.tsx +28 -0
  50. package/themes/business/src/components/shared/OModal.tsx +16 -9
  51. package/themes/business/src/types/index.tsx +24 -10
  52. package/themes/business/src/utils/index.tsx +29 -2
  53. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  54. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  55. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  56. package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
  57. package/themes/kiosk/src/components/Intro/index.tsx +16 -1
  58. package/themes/kiosk/src/components/LoginForm/index.tsx +7 -5
  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/PhoneInputNumber/index.tsx +2 -2
  63. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  64. package/themes/original/index.tsx +7 -3
  65. package/themes/original/src/components/AddressDetails/index.tsx +19 -3
  66. package/themes/original/src/components/AddressForm/index.tsx +33 -15
  67. package/themes/original/src/components/AddressForm/styles.tsx +1 -1
  68. package/themes/original/src/components/AddressList/index.tsx +5 -8
  69. package/themes/original/src/components/AddressList/styles.tsx +4 -4
  70. package/themes/original/src/components/AnalyticsSegment/index.tsx +193 -10
  71. package/themes/original/src/components/AppleLogin/index.tsx +4 -4
  72. package/themes/original/src/components/AppleLogin/styles.tsx +3 -1
  73. package/themes/original/src/components/BusinessBasicInformation/index.tsx +74 -38
  74. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +11 -13
  75. package/themes/original/src/components/BusinessController/index.tsx +35 -44
  76. package/themes/original/src/components/BusinessController/styles.tsx +12 -5
  77. package/themes/original/src/components/BusinessFeaturedController/index.tsx +21 -54
  78. package/themes/original/src/components/BusinessFeaturedController/styles.tsx +8 -0
  79. package/themes/original/src/components/BusinessInformation/index.tsx +140 -85
  80. package/themes/original/src/components/BusinessInformation/styles.tsx +2 -2
  81. package/themes/original/src/components/BusinessItemAccordion/index.tsx +25 -26
  82. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/index.tsx +1 -1
  83. package/themes/original/src/components/BusinessListingSearch/index.tsx +346 -341
  84. package/themes/original/src/components/BusinessListingSearch/styles.tsx +1 -19
  85. package/themes/original/src/components/BusinessPreorder/index.tsx +105 -22
  86. package/themes/original/src/components/BusinessPreorder/styles.tsx +14 -0
  87. package/themes/original/src/components/BusinessProductsCategories/index.tsx +2 -3
  88. package/themes/original/src/components/BusinessProductsList/index.tsx +15 -7
  89. package/themes/original/src/components/BusinessProductsList/styles.tsx +8 -3
  90. package/themes/original/src/components/BusinessProductsListing/UpsellingRedirect.tsx +1 -1
  91. package/themes/original/src/components/BusinessProductsListing/index.tsx +162 -39
  92. package/themes/original/src/components/BusinessProductsListing/styles.tsx +4 -5
  93. package/themes/original/src/components/BusinessReviews/index.tsx +4 -2
  94. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +1 -1
  95. package/themes/original/src/components/BusinessesListing/Layout/Appointment/styles.tsx +5 -5
  96. package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListFooter.tsx +69 -0
  97. package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListHeader.tsx +406 -0
  98. package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListing.tsx +76 -0
  99. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +37 -404
  100. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +1 -1
  101. package/themes/original/src/components/BusinessesListing/index.tsx +0 -1
  102. package/themes/original/src/components/Cart/index.tsx +49 -47
  103. package/themes/original/src/components/CartContent/index.tsx +99 -38
  104. package/themes/original/src/components/CartContent/styles.tsx +6 -6
  105. package/themes/original/src/components/CartStoresListing/styles.tsx +2 -2
  106. package/themes/original/src/components/Checkout/index.tsx +324 -43
  107. package/themes/original/src/components/Checkout/styles.tsx +17 -0
  108. package/themes/original/src/components/CitiesControl/index.tsx +1 -1
  109. package/themes/original/src/components/CitiesControl/styles.tsx +1 -1
  110. package/themes/original/src/components/CouponControl/index.tsx +10 -3
  111. package/themes/original/src/components/DatePicker/index.tsx +17 -0
  112. package/themes/original/src/components/DatePicker/styles.tsx +20 -0
  113. package/themes/original/src/components/DriverTips/index.tsx +12 -4
  114. package/themes/original/src/components/FacebookLogin/styles.tsx +3 -1
  115. package/themes/original/src/components/Favorite/index.tsx +4 -9
  116. package/themes/original/src/components/Favorite/styles.tsx +0 -2
  117. package/themes/original/src/components/FloatingButton/styles.tsx +1 -1
  118. package/themes/original/src/components/GPSButton/index.tsx +7 -5
  119. package/themes/original/src/components/GiftCard/GiftCardUI/index.tsx +8 -3
  120. package/themes/original/src/components/GiftCard/PurchaseGiftCard/index.tsx +42 -5
  121. package/themes/original/src/components/GiftCard/PurchaseGiftCard/styles.tsx +3 -1
  122. package/themes/original/src/components/GiftCard/RedeemGiftCard/index.tsx +84 -8
  123. package/themes/original/src/components/GiftCard/RedeemGiftCard/styles.tsx +1 -1
  124. package/themes/original/src/components/GiftCard/SendGiftCard/styles.tsx +1 -1
  125. package/themes/original/src/components/GoogleLogin/styles.tsx +1 -1
  126. package/themes/original/src/components/GoogleMap/index.tsx +63 -7
  127. package/themes/original/src/components/HighestRatedBusinesses/index.tsx +1 -1
  128. package/themes/original/src/components/HighestRatedBusinesses/styles.tsx +1 -1
  129. package/themes/original/src/components/Home/index.tsx +14 -5
  130. package/themes/original/src/components/LastOrder/index.tsx +2 -1
  131. package/themes/original/src/components/LastOrders/index.tsx +2 -1
  132. package/themes/original/src/components/LoginForm/Otp/index.tsx +91 -25
  133. package/themes/original/src/components/LoginForm/index.tsx +64 -34
  134. package/themes/original/src/components/LottieAnimation/index.tsx +88 -63
  135. package/themes/original/src/components/MessageListing/index.tsx +9 -2
  136. package/themes/original/src/components/Messages/index.tsx +15 -4
  137. package/themes/original/src/components/Messages/styles.tsx +1 -1
  138. package/themes/original/src/components/MomentOption/index.tsx +44 -39
  139. package/themes/original/src/components/MomentSelector/index.tsx +1 -1
  140. package/themes/original/src/components/MultiCart/index.tsx +1 -1
  141. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +161 -49
  142. package/themes/original/src/components/MultiCheckout/index.tsx +348 -70
  143. package/themes/original/src/components/MultiCheckout/styles.tsx +3 -1
  144. package/themes/original/src/components/MultiOrdersDetails/index.tsx +2 -2
  145. package/themes/original/src/components/MyOrders/index.tsx +16 -5
  146. package/themes/original/src/components/NavBar/index.tsx +20 -13
  147. package/themes/original/src/components/NetworkError/styles.tsx +2 -2
  148. package/themes/original/src/components/NotFoundSource/index.tsx +14 -10
  149. package/themes/original/src/components/Notifications/index.tsx +2 -4
  150. package/themes/original/src/components/Notifications/styles.tsx +0 -1
  151. package/themes/original/src/components/OrderDetails/OrderEta.tsx +76 -0
  152. package/themes/original/src/components/OrderDetails/OrderHistory.tsx +22 -6
  153. package/themes/original/src/components/OrderDetails/index.tsx +721 -670
  154. package/themes/original/src/components/OrderDetails/styles.tsx +24 -8
  155. package/themes/original/src/components/OrderItAgain/index.tsx +3 -1
  156. package/themes/original/src/components/OrderProgress/index.tsx +34 -25
  157. package/themes/original/src/components/OrderProgress/styles.tsx +1 -1
  158. package/themes/original/src/components/OrderSummary/index.tsx +62 -57
  159. package/themes/original/src/components/OrderTypeSelector/index.tsx +5 -6
  160. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/styles.tsx +1 -1
  161. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +13 -13
  162. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/styles.tsx +1 -1
  163. package/themes/original/src/components/OrdersOption/index.tsx +44 -21
  164. package/themes/original/src/components/OrdersOption/styles.tsx +2 -2
  165. package/themes/original/src/components/PageBanner/index.tsx +65 -29
  166. package/themes/original/src/components/PageBanner/styles.tsx +0 -3
  167. package/themes/original/src/components/PaymentOptionCard/index.tsx +180 -0
  168. package/themes/original/src/components/PaymentOptionStripe/styles.tsx +3 -0
  169. package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
  170. package/themes/original/src/components/PaymentOptions/index.tsx +100 -34
  171. package/themes/original/src/components/PhoneInputNumber/index.tsx +18 -4
  172. package/themes/original/src/components/ProductForm/ActionButton.tsx +120 -0
  173. package/themes/original/src/components/ProductForm/ExtraOptions.tsx +56 -0
  174. package/themes/original/src/components/ProductForm/index.tsx +106 -170
  175. package/themes/original/src/components/ProductForm/styles.tsx +3 -3
  176. package/themes/original/src/components/ProductItemAccordion/index.tsx +13 -6
  177. package/themes/original/src/components/ProductOptionSubOption/index.tsx +49 -20
  178. package/themes/original/src/components/ProductOptionSubOption/styles.tsx +10 -9
  179. package/themes/original/src/components/ProfessionalProfile/index.tsx +35 -6
  180. package/themes/original/src/components/ProfessionalProfile/styles.tsx +3 -3
  181. package/themes/original/src/components/Promotions/index.tsx +6 -6
  182. package/themes/original/src/components/Promotions/styles.tsx +3 -3
  183. package/themes/original/src/components/ReviewDriver/styles.tsx +1 -1
  184. package/themes/original/src/components/ReviewOrder/styles.tsx +1 -1
  185. package/themes/original/src/components/ReviewProducts/index.tsx +16 -7
  186. package/themes/original/src/components/ReviewProducts/styles.tsx +1 -1
  187. package/themes/original/src/components/ScheduleAccordion/index.tsx +3 -3
  188. package/themes/original/src/components/ServiceForm/index.tsx +36 -24
  189. package/themes/original/src/components/ServiceForm/styles.tsx +4 -4
  190. package/themes/original/src/components/SignupForm/index.tsx +27 -16
  191. package/themes/original/src/components/SingleOrderCard/index.tsx +44 -20
  192. package/themes/original/src/components/SingleOrderCard/styles.tsx +1 -1
  193. package/themes/original/src/components/SingleProductCard/index.tsx +13 -10
  194. package/themes/original/src/components/SingleProductCard/styles.tsx +8 -3
  195. package/themes/original/src/components/SingleProductReview/styles.tsx +1 -1
  196. package/themes/original/src/components/StripeCardsList/index.tsx +61 -5
  197. package/themes/original/src/components/StripeElementsForm/index.tsx +48 -34
  198. package/themes/original/src/components/StripeElementsForm/naked.tsx +12 -1
  199. package/themes/original/src/components/UpsellingProducts/UpsellingContent.tsx +170 -0
  200. package/themes/original/src/components/UpsellingProducts/UpsellingLayout.tsx +86 -0
  201. package/themes/original/src/components/UpsellingProducts/index.tsx +16 -205
  202. package/themes/original/src/components/UpsellingProducts/styles.tsx +19 -0
  203. package/themes/original/src/components/UserDetails/index.tsx +3 -1
  204. package/themes/original/src/components/UserFormDetails/index.tsx +100 -22
  205. package/themes/original/src/components/UserFormDetails/styles.tsx +1 -1
  206. package/themes/original/src/components/UserProfile/index.tsx +8 -26
  207. package/themes/original/src/components/UserProfileForm/index.tsx +30 -31
  208. package/themes/original/src/components/UserVerification/index.tsx +55 -50
  209. package/themes/original/src/components/WalletTransactionItem/index.tsx +2 -2
  210. package/themes/original/src/components/WalletTransactions/index.tsx +3 -3
  211. package/themes/original/src/components/WalletTransactions/styles.tsx +1 -0
  212. package/themes/original/src/components/Wallets/index.tsx +48 -60
  213. package/themes/original/src/components/Wallets/styles.tsx +3 -4
  214. package/themes/original/src/components/shared/HeaderTitle.tsx +1 -1
  215. package/themes/original/src/components/shared/OButton.tsx +3 -3
  216. package/themes/original/src/components/shared/OInput.tsx +4 -5
  217. package/themes/original/src/components/shared/OModal.tsx +15 -17
  218. package/themes/original/src/layouts/Container.tsx +1 -1
  219. package/themes/original/src/types/index.tsx +28 -6
  220. package/themes/original/src/utils/index.tsx +180 -13
  221. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
  222. package/src/navigators/BottomNavigator.tsx +0 -117
  223. package/src/navigators/CheckoutNavigator.tsx +0 -66
  224. package/src/navigators/HomeNavigator.tsx +0 -202
  225. package/src/navigators/NavigationRef.tsx +0 -7
  226. package/src/navigators/RootNavigator.tsx +0 -269
  227. package/src/pages/Account.tsx +0 -34
  228. package/src/pages/AddressForm.tsx +0 -62
  229. package/src/pages/AddressList.tsx +0 -24
  230. package/src/pages/BusinessProductsList.tsx +0 -81
  231. package/src/pages/BusinessesListing.tsx +0 -43
  232. package/src/pages/CartList.tsx +0 -49
  233. package/src/pages/Checkout.tsx +0 -101
  234. package/src/pages/ForgotPassword.tsx +0 -24
  235. package/src/pages/Help.tsx +0 -23
  236. package/src/pages/HelpAccountAndPayment.tsx +0 -23
  237. package/src/pages/HelpGuide.tsx +0 -23
  238. package/src/pages/HelpOrder.tsx +0 -23
  239. package/src/pages/Home.tsx +0 -36
  240. package/src/pages/IntroductoryTutorial.tsx +0 -170
  241. package/src/pages/Login.tsx +0 -47
  242. package/src/pages/MomentOption.tsx +0 -30
  243. package/src/pages/MultiCheckout.tsx +0 -31
  244. package/src/pages/MultiOrdersDetails.tsx +0 -27
  245. package/src/pages/MyOrders.tsx +0 -40
  246. package/src/pages/NetworkError.tsx +0 -24
  247. package/src/pages/NotFound.tsx +0 -22
  248. package/src/pages/OrderDetails.tsx +0 -25
  249. package/src/pages/ProductDetails.tsx +0 -55
  250. package/src/pages/Profile.tsx +0 -36
  251. package/src/pages/ReviewDriver.tsx +0 -30
  252. package/src/pages/ReviewOrder.tsx +0 -32
  253. package/src/pages/ReviewProducts.tsx +0 -30
  254. package/src/pages/Sessions.tsx +0 -22
  255. package/src/pages/Signup.tsx +0 -53
  256. package/src/pages/SpinnerLoader.tsx +0 -10
  257. package/src/pages/Splash.tsx +0 -21
@@ -11,11 +11,14 @@ 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';
17
18
  import { StripeElementsForm } from '../StripeElementsForm';
18
19
  import { StripeCardsList } from '../StripeCardsList';
20
+ import { PaymentOptionCard } from '../PaymentOptionCard'
21
+
19
22
  // import { PaymentOptionStripe } from '../PaymentOptionStripe';
20
23
  // import { StripeRedirectForm } from '../StripeRedirectForm';
21
24
  // import { PaymentOptionPaypal } from '../PaymentOptionPaypal'
@@ -34,7 +37,7 @@ import { useApplePay } from '@stripe/stripe-react-native';
34
37
 
35
38
  const stripeOptions: any = ['stripe_direct', 'stripe', 'stripe_connect']
36
39
  const methodsPay = ['google_pay', 'apple_pay']
37
- const stripeDirectMethods = ['stripe_direct', ...methodsPay]
40
+ const stripeDirectMethods = ['stripe_direct']
38
41
  // const stripeRedirectOptions = [
39
42
  // { name: 'Bancontact', value: 'bancontact' },
40
43
  // { name: 'Alipay', value: 'alipay' },
@@ -43,6 +46,8 @@ const stripeDirectMethods = ['stripe_direct', ...methodsPay]
43
46
  // ]
44
47
 
45
48
  const webViewPaymentGateway: any = ['paypal', 'square']
49
+ const multiCheckoutMethods = ['global_google_pay', 'global_apple_pay']
50
+ const cardsPaymethods = ['credomatic']
46
51
 
47
52
  const PaymentOptionsUI = (props: any) => {
48
53
  const {
@@ -59,11 +64,22 @@ const PaymentOptionsUI = (props: any) => {
59
64
  isOpenMethod,
60
65
  handlePaymentMethodClickCustom,
61
66
  handlePlaceOrder,
62
- merchantId
67
+ merchantId,
68
+ setMethodPaySupported,
69
+ placeByMethodPay,
70
+ methodPaySupported,
71
+ setPlaceByMethodPay,
72
+ setCardList,
73
+ onPaymentChange,
74
+ requiredFields,
75
+ openUserModal,
76
+ paymethodClicked,
77
+ setPaymethodClicked
63
78
  } = props
64
79
 
65
80
  const theme = useTheme();
66
81
  const [, { showToast }] = useToast();
82
+ const [{ user }] = useSession()
67
83
  const { confirmApplePayPayment } = useApplePay()
68
84
 
69
85
  const getPayIcon = (method: string) => {
@@ -75,7 +91,7 @@ const PaymentOptionsUI = (props: any) => {
75
91
  case 'paypal':
76
92
  return theme.images.general.paypal
77
93
  case 'stripe':
78
- return theme.images.general.stripe
94
+ return theme.images.general.creditCard
79
95
  case 'stripe_direct':
80
96
  return theme.images.general.stripecc
81
97
  case 'stripe_connect':
@@ -84,6 +100,8 @@ const PaymentOptionsUI = (props: any) => {
84
100
  return theme.images.general.stripesb
85
101
  case 'apple_pay':
86
102
  return theme.images.general.applePayMark
103
+ case 'google_pay':
104
+ return theme.images.general.googlePayMark
87
105
  default:
88
106
  return theme.images.general.creditCard
89
107
  }
@@ -91,7 +109,7 @@ const PaymentOptionsUI = (props: any) => {
91
109
 
92
110
  const [, t] = useLanguage();
93
111
 
94
- const [addCardOpen, setAddCardOpen] = useState({ stripe: false, stripeConnect: false });
112
+ const [addCardOpen, setAddCardOpen] = useState({ stripe: false, stripeConnect: false, card: false });
95
113
  const paymethodSelected = props.paySelected || props.paymethodSelected || isOpenMethod?.paymethod
96
114
  // const [{ token }] = useSession()
97
115
 
@@ -101,8 +119,18 @@ const PaymentOptionsUI = (props: any) => {
101
119
  // { name: t('SELECT_A_PAYMENT_METHOD', 'Select a payment method'), value: '-1' },
102
120
  // ]
103
121
 
122
+ const paymethodsFieldRequired = ['paypal', 'apple_pay', 'global_apple_pay']
123
+
104
124
  const handlePaymentMethodClick = (paymethod: any) => {
105
- 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
+ }
106
134
  const isPopupMethod = ['stripe', 'stripe_direct', 'stripe_connect', 'stripe_redirect', 'paypal'].includes(paymethod?.gateway)
107
135
  if (webViewPaymentGateway.includes(paymethod?.gateway)) {
108
136
  handlePaymentMethodClickCustom(paymethod)
@@ -116,6 +144,12 @@ const PaymentOptionsUI = (props: any) => {
116
144
  ;
117
145
  }
118
146
 
147
+ useEffect(() => {
148
+ if (cart?.balance === 0) {
149
+ handlePaymethodClick(null)
150
+ }
151
+ }, [cart?.balance])
152
+
119
153
  useEffect(() => {
120
154
  if (paymethodsList.paymethods.length === 1) {
121
155
  handlePaymethodClick && handlePaymethodClick(paymethodsList.paymethods[0])
@@ -142,10 +176,17 @@ const PaymentOptionsUI = (props: any) => {
142
176
  }
143
177
  }, [paymethodData, paymethodSelected])
144
178
 
179
+ useEffect(() => {
180
+ if (paymethodClicked?.confirmed) {
181
+ handlePaymentMethodClickCustom(paymethodClicked?.paymethod)
182
+ }
183
+ }, [paymethodClicked?.confirmed])
184
+
185
+
145
186
  const renderPaymethods = ({ item }: any) => {
146
187
  return (
147
188
  <>
148
- {item?.gateway === 'apple_pay' ? (
189
+ {methodsPay.includes(item?.gateway) ? (
149
190
  <TouchableOpacity
150
191
  onPress={() => handlePaymentMethodClick(item)}
151
192
  >
@@ -187,6 +228,7 @@ const PaymentOptionsUI = (props: any) => {
187
228
  }
188
229
 
189
230
  const excludeIds: any = [32]; //exclude paypal & connect & redirect
231
+ const filterMethodsPay = (gateway: string) => Platform.OS === 'ios' ? gateway !== 'google_pay' : gateway !== 'apple_pay'
190
232
 
191
233
  return (
192
234
  <PMContainer>
@@ -195,7 +237,11 @@ const PaymentOptionsUI = (props: any) => {
195
237
  horizontal
196
238
  showsHorizontalScrollIndicator={false}
197
239
  // data={paymethodsList.paymethods.sort((a: any, b: any) => a.id - b.id)}
198
- data={paymethodsList.paymethods.sort((a: any, b: any) => a.id - b.id).filter((p: any) => !excludeIds.includes(p.id))}
240
+ data={paymethodsList.paymethods.sort((a: any, b: any) => a.id - b.id)
241
+ .filter((p: any) =>
242
+ !multiCheckoutMethods.includes(p.gateway) &&
243
+ filterMethodsPay(p.gateway) &&
244
+ !excludeIds.includes(p.id))}
199
245
  renderItem={renderPaymethods}
200
246
  keyExtractor={(paymethod: any) => paymethod?.id?.toString?.()}
201
247
  />
@@ -241,7 +287,7 @@ const PaymentOptionsUI = (props: any) => {
241
287
  />
242
288
  )}
243
289
 
244
- {stripeOptions.includes(paymethodSelected?.gateway) &&
290
+ {/* {stripeOptions.includes(paymethodSelected?.gateway) &&
245
291
  (paymethodData?.brand || paymethodData?.card?.brand) &&
246
292
  (paymethodData?.last4 || paymethodData?.card?.last4) &&
247
293
  (
@@ -270,10 +316,10 @@ const PaymentOptionsUI = (props: any) => {
270
316
  </View>
271
317
  </PMCardItemContent>
272
318
  </PMCardSelected>
273
- )}
319
+ )} */}
274
320
 
275
321
  {/* Stripe */}
276
- {isOpenMethod?.paymethod?.gateway === 'stripe' && !paymethodData?.id && (
322
+ {isOpenMethod?.paymethod?.gateway === 'stripe' && (
277
323
  <View>
278
324
  <OButton
279
325
  text={t('ADD_PAYMENT_CARD', 'Add New Payment Card')}
@@ -291,35 +337,55 @@ const PaymentOptionsUI = (props: any) => {
291
337
  payType={paymethodsList?.name}
292
338
  onSelectCard={handlePaymethodDataChange}
293
339
  onNavigationRedirect={onNavigationRedirect}
340
+ paymethodCardId={paymethodData?.id}
294
341
  onCancel={() => handlePaymethodClick(null)}
342
+ setAddCardOpen={setAddCardOpen}
343
+ addCardOpen={addCardOpen}
344
+ isOpenMethod={isOpenMethod}
345
+ handlePaymethodDataChange={handlePaymethodDataChange}
346
+ clientSecret={props.clientSecret}
347
+ businessId={props.businessId}
348
+ onPaymentChange={onPaymentChange}
295
349
  />
296
350
  </View>
297
351
  )}
352
+ {/* Google pay, Apple pay */}
353
+ {methodsPay.includes(isOpenMethod?.paymethod?.gateway) && (
354
+ <StripeElementsForm
355
+ cart={cart}
356
+ paymethod={isOpenMethod?.paymethod?.gateway}
357
+ methodsPay={methodsPay}
358
+ businessId={props.businessId}
359
+ publicKey={isOpenMethod?.paymethod?.credentials?.publishable || isOpenMethod?.paymethod?.credentials?.publishable_key}
360
+ handleSource={handlePaymethodDataChange}
361
+ onCancel={() => handlePaymethodClick(null)}
362
+ merchantId={merchantId}
363
+ setMethodPaySupported={setMethodPaySupported}
364
+ methodPaySupported={methodPaySupported}
365
+ placeByMethodPay={placeByMethodPay}
366
+ setPlaceByMethodPay={setPlaceByMethodPay}
367
+ />
368
+ )}
298
369
 
299
- <OModal
300
- entireModal
301
- title={t('ADD_CREDIT_OR_DEBIT_CARD', 'Add credit or debit card')}
302
- open={addCardOpen.stripe}
303
- onClose={() => setAddCardOpen({ ...addCardOpen, stripe: false })}
304
- style={{ backgroundColor: 'red' }}
305
- >
306
- <KeyboardAvoidingView
307
- behavior={Platform.OS == 'ios' ? 'padding' : 'height'}
308
- keyboardVerticalOffset={Platform.OS == 'ios' ? 0 : 0}
309
- enabled={Platform.OS === 'ios' ? true : false}
310
- >
311
- <StripeElementsForm
312
- toSave
313
- businessId={props.businessId}
314
- publicKey={isOpenMethod?.paymethod?.credentials?.publishable}
315
- requirements={props.clientSecret}
316
- onSelectCard={handlePaymethodDataChange}
317
- onCancel={() => setAddCardOpen({ ...addCardOpen, stripe: false })}
318
- />
319
- </KeyboardAvoidingView>
320
- </OModal>
370
+ {(cardsPaymethods.includes(isOpenMethod?.paymethod?.gateway) || cardsPaymethods.includes(paymethodSelected?.gateway)) && (
371
+ <PaymentOptionCard
372
+ setCardList={setCardList}
373
+ paymethod={isOpenMethod?.paymethod}
374
+ businessId={props.businessId}
375
+ publicKey={isOpenMethod?.paymethod?.credentials?.publishable}
376
+ gateway={isOpenMethod?.paymethod?.gateway || paymethodSelected?.gateway}
377
+ onPaymentChange={onPaymentChange}
378
+ payType={isOpenMethod?.paymethod?.name}
379
+ onSelectCard={handlePaymethodDataChange}
380
+ addCardOpen={addCardOpen}
381
+ setAddCardOpen={setAddCardOpen}
382
+ onCancel={() => handlePaymethodClick(null)}
383
+ paymethodSelected={paymethodSelected?.data?.id}
384
+ handlePaymentMethodClick={handlePaymentMethodClick}
385
+ />
386
+ )}
321
387
 
322
- {/* Stripe direct, Google pay, Apple pay */}
388
+ {/* Stripe direct */}
323
389
  <OModal
324
390
  entireModal
325
391
  title={t('ADD_CREDIT_OR_DEBIT_CARD', 'Add credit or debit card')}
@@ -367,7 +433,7 @@ const PaymentOptionsUI = (props: any) => {
367
433
  />
368
434
  </View>
369
435
  )}
370
-
436
+ {/** Stripe connect add cards */}
371
437
  <OModal
372
438
  entireModal
373
439
  title={t('ADD_CREDIT_OR_DEBIT_CARD', 'Add credit or debit card')}
@@ -7,7 +7,7 @@ import { Wrapper } from './styles'
7
7
 
8
8
  import { PhoneInputParams } from '../../types';
9
9
  import { OIcon, OText } from '../shared';
10
- import { transformCountryCode } from '../../utils'
10
+ import { findExitingCode, transformCountryCode } from '../../utils'
11
11
 
12
12
  export const PhoneInputNumber = (props: PhoneInputParams) => {
13
13
  const {
@@ -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 === '') && (
@@ -112,8 +126,8 @@ export const PhoneInputNumber = (props: PhoneInputParams) => {
112
126
  defaultCode={defaultCode ?
113
127
  !isNaN(defaultCode)
114
128
  ? transformCountryCode(defaultCode)
115
- : defaultCode
116
- : configs?.default_country_code?.value}
129
+ : findExitingCode(defaultCode)
130
+ : findExitingCode(configs?.default_country_code?.value?.toUpperCase())}
117
131
  onChangeFormattedText={(text: string) => handleChangeNumber(text)}
118
132
  withDarkTheme
119
133
  onChangeCountry={(country) => changeCountry?.(country)}
@@ -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
+ }