ordering-ui-react-native 0.18.55-test1 → 0.18.56-crash-driver-1

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 (266) hide show
  1. package/package.json +6 -5
  2. package/src/components/BusinessInformation/index.tsx +10 -9
  3. package/src/components/PaymentOptionsWebView/index.tsx +30 -8
  4. package/src/components/PhoneInputNumber/index.tsx +6 -2
  5. package/src/components/StripeMethodForm/index.tsx +60 -55
  6. package/src/components/shared/OToast.tsx +3 -2
  7. package/src/types/index.tsx +3 -1
  8. package/src/utils/index.tsx +2 -2
  9. package/themes/business/index.tsx +6 -0
  10. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +15 -8
  11. package/themes/business/src/components/BusinessController/index.tsx +19 -17
  12. package/themes/business/src/components/BusinessProductList/AccordionDropdown.tsx +63 -0
  13. package/themes/business/src/components/BusinessProductList/IterateCategories.tsx +108 -0
  14. package/themes/business/src/components/BusinessProductList/ProductList.tsx +196 -0
  15. package/themes/business/src/components/BusinessProductList/index.tsx +196 -0
  16. package/themes/business/src/components/BusinessProductList/styles.tsx +10 -0
  17. package/themes/business/src/components/Chat/index.tsx +48 -19
  18. package/themes/business/src/components/DriverMap/index.tsx +36 -23
  19. package/themes/business/src/components/DriverSchedule/index.tsx +45 -8
  20. package/themes/business/src/components/FloatingButton/index.tsx +34 -31
  21. package/themes/business/src/components/GoogleMap/index.tsx +15 -8
  22. package/themes/business/src/components/Home/index.tsx +5 -1
  23. package/themes/business/src/components/LanguageSelector/index.tsx +1 -2
  24. package/themes/business/src/components/LanguageSelector/lang_country.json +515 -70
  25. package/themes/business/src/components/LoginForm/index.tsx +2 -2
  26. package/themes/business/src/components/LogoutButton/index.tsx +1 -1
  27. package/themes/business/src/components/MapView/index.tsx +28 -17
  28. package/themes/business/src/components/MessagesOption/index.tsx +22 -94
  29. package/themes/business/src/components/NewOrderNotification/index.tsx +162 -106
  30. package/themes/business/src/components/NotFoundSource/index.tsx +2 -2
  31. package/themes/business/src/components/OrderDetails/Business.tsx +53 -3
  32. package/themes/business/src/components/OrderDetails/Delivery.tsx +209 -13
  33. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +107 -75
  34. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +79 -41
  35. package/themes/business/src/components/OrderDetails/usePrinterCommands.tsx +220 -0
  36. package/themes/business/src/components/OrderDetailsLogistic/index.tsx +7 -2
  37. package/themes/business/src/components/OrderMessage/index.tsx +1 -1
  38. package/themes/business/src/components/OrderSummary/index.tsx +245 -82
  39. package/themes/business/src/components/OrdersListManager/index.tsx +7 -2
  40. package/themes/business/src/components/OrdersListManager/utils.tsx +1 -1
  41. package/themes/business/src/components/OrdersOption/index.tsx +125 -48
  42. package/themes/business/src/components/PhoneInputNumber/index.tsx +8 -5
  43. package/themes/business/src/components/PreviousMessages/FooterMessageComponent.tsx +103 -0
  44. package/themes/business/src/components/PreviousMessages/index.tsx +97 -55
  45. package/themes/business/src/components/PreviousOrders/OrderItem.tsx +43 -41
  46. package/themes/business/src/components/PreviousOrders/OrderList.tsx +93 -0
  47. package/themes/business/src/components/PreviousOrders/OrdersGroupedItem.tsx +1 -1
  48. package/themes/business/src/components/PreviousOrders/index.tsx +195 -221
  49. package/themes/business/src/components/PreviousOrders/styles.tsx +10 -0
  50. package/themes/business/src/components/PrinterEdition/index.tsx +363 -0
  51. package/themes/business/src/components/PrinterEdition/styles.tsx +61 -0
  52. package/themes/business/src/components/PrinterSettings/index.tsx +267 -0
  53. package/themes/business/src/components/PrinterSettings/styles.tsx +30 -0
  54. package/themes/business/src/components/ProductItemAccordion/index.tsx +2 -2
  55. package/themes/business/src/components/ReviewCustomer/index.tsx +1 -1
  56. package/themes/business/src/components/SearchBar/index.tsx +2 -1
  57. package/themes/business/src/components/Sessions/index.tsx +187 -0
  58. package/themes/business/src/components/Sessions/styles.tsx +20 -0
  59. package/themes/business/src/components/StoresList/index.tsx +4 -3
  60. package/themes/business/src/components/UserFormDetails/index.tsx +111 -107
  61. package/themes/business/src/components/UserProfileForm/index.tsx +103 -53
  62. package/themes/business/src/components/WebsocketStatus/index.tsx +171 -0
  63. package/themes/business/src/components/WebsocketStatus/styles.tsx +28 -0
  64. package/themes/business/src/components/shared/OInput.tsx +2 -0
  65. package/themes/business/src/hooks/useLocation.tsx +5 -4
  66. package/themes/business/src/types/index.tsx +21 -1
  67. package/themes/business/src/utils/index.tsx +5 -0
  68. package/themes/kiosk/src/components/Checkout/index.tsx +5 -3
  69. package/themes/kiosk/src/components/CustomerName/index.tsx +1 -1
  70. package/themes/kiosk/src/components/Intro/index.tsx +16 -1
  71. package/themes/kiosk/src/components/LoginForm/index.tsx +131 -101
  72. package/themes/kiosk/src/components/PaymentOptions/index.tsx +57 -121
  73. package/themes/original/index.tsx +11 -3
  74. package/themes/original/src/components/AddressDetails/index.tsx +20 -10
  75. package/themes/original/src/components/AddressForm/index.tsx +41 -20
  76. package/themes/original/src/components/AddressForm/styles.tsx +1 -1
  77. package/themes/original/src/components/AddressList/index.tsx +22 -11
  78. package/themes/original/src/components/AddressList/styles.tsx +4 -4
  79. package/themes/original/src/components/AnalyticsSegment/index.tsx +10 -7
  80. package/themes/original/src/components/AppleLogin/styles.tsx +3 -1
  81. package/themes/original/src/components/BusinessBasicInformation/index.tsx +8 -11
  82. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +1 -1
  83. package/themes/original/src/components/BusinessController/index.tsx +40 -43
  84. package/themes/original/src/components/BusinessController/styles.tsx +12 -12
  85. package/themes/original/src/components/BusinessInformation/index.tsx +45 -17
  86. package/themes/original/src/components/BusinessInformation/styles.tsx +2 -2
  87. package/themes/original/src/components/BusinessItemAccordion/index.tsx +11 -7
  88. package/themes/original/src/components/BusinessListingSearch/BusinessSearchFooter.tsx +317 -0
  89. package/themes/original/src/components/BusinessListingSearch/BusinessSearchHeader.tsx +96 -0
  90. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/index.tsx +1 -1
  91. package/themes/original/src/components/BusinessListingSearch/index.tsx +57 -361
  92. package/themes/original/src/components/BusinessListingSearch/styles.tsx +1 -1
  93. package/themes/original/src/components/BusinessPreorder/index.tsx +9 -7
  94. package/themes/original/src/components/BusinessProductsCategories/index.tsx +2 -3
  95. package/themes/original/src/components/BusinessProductsList/index.tsx +5 -4
  96. package/themes/original/src/components/BusinessProductsListing/index.tsx +67 -28
  97. package/themes/original/src/components/BusinessProductsListing/styles.tsx +3 -4
  98. package/themes/original/src/components/BusinessReviews/index.tsx +1 -1
  99. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +1 -1
  100. package/themes/original/src/components/BusinessesListing/Layout/Appointment/styles.tsx +5 -5
  101. package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListFooter.tsx +69 -0
  102. package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListHeader.tsx +406 -0
  103. package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListing.tsx +76 -0
  104. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +30 -404
  105. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +2 -2
  106. package/themes/original/src/components/Cart/index.tsx +51 -40
  107. package/themes/original/src/components/CartContent/index.tsx +98 -54
  108. package/themes/original/src/components/CartStoresListing/styles.tsx +2 -2
  109. package/themes/original/src/components/Checkout/index.tsx +308 -75
  110. package/themes/original/src/components/Checkout/styles.tsx +17 -0
  111. package/themes/original/src/components/CitiesControl/styles.tsx +1 -1
  112. package/themes/original/src/components/DatePicker/index.tsx +33 -0
  113. package/themes/original/src/components/DatePicker/styles.tsx +20 -0
  114. package/themes/original/src/components/DriverTips/index.tsx +6 -3
  115. package/themes/original/src/components/FacebookLogin/styles.tsx +3 -1
  116. package/themes/original/src/components/Favorite/index.tsx +8 -4
  117. package/themes/original/src/components/Favorite/styles.tsx +0 -2
  118. package/themes/original/src/components/FloatingButton/styles.tsx +1 -1
  119. package/themes/original/src/components/ForgotPasswordForm/index.tsx +5 -0
  120. package/themes/original/src/components/GPSButton/index.tsx +7 -5
  121. package/themes/original/src/components/GiftCard/GiftCardOrdersList/index.tsx +64 -0
  122. package/themes/original/src/components/GiftCard/GiftCardOrdersList/styles.tsx +8 -0
  123. package/themes/original/src/components/GiftCard/GiftCardUI/index.tsx +8 -3
  124. package/themes/original/src/components/GiftCard/PurchaseGiftCard/index.tsx +36 -3
  125. package/themes/original/src/components/GiftCard/PurchaseGiftCard/styles.tsx +1 -1
  126. package/themes/original/src/components/GiftCard/RedeemGiftCard/index.tsx +84 -8
  127. package/themes/original/src/components/GiftCard/RedeemGiftCard/styles.tsx +1 -1
  128. package/themes/original/src/components/GiftCard/SendGiftCard/index.tsx +2 -2
  129. package/themes/original/src/components/GiftCard/SendGiftCard/styles.tsx +1 -1
  130. package/themes/original/src/components/GiftCard/SingleGiftCard/index.tsx +101 -0
  131. package/themes/original/src/components/GiftCard/SingleGiftCard/styles.tsx +4 -0
  132. package/themes/original/src/components/GiftCard/VerticalGiftCardOrdersLayout/index.tsx +83 -0
  133. package/themes/original/src/components/GiftCard/VerticalGiftCardOrdersLayout/styles.tsx +9 -0
  134. package/themes/original/src/components/GoogleLogin/styles.tsx +1 -1
  135. package/themes/original/src/components/GoogleMap/index.tsx +52 -5
  136. package/themes/original/src/components/Help/index.tsx +7 -0
  137. package/themes/original/src/components/HelpAccountAndPayment/index.tsx +5 -0
  138. package/themes/original/src/components/HelpGuide/index.tsx +5 -0
  139. package/themes/original/src/components/HelpOrder/index.tsx +5 -0
  140. package/themes/original/src/components/HighestRatedBusinesses/index.tsx +1 -1
  141. package/themes/original/src/components/HighestRatedBusinesses/styles.tsx +1 -1
  142. package/themes/original/src/components/Home/index.tsx +3 -2
  143. package/themes/original/src/components/LastOrder/index.tsx +2 -1
  144. package/themes/original/src/components/LastOrders/index.tsx +2 -1
  145. package/themes/original/src/components/LoginForm/Otp/index.tsx +79 -25
  146. package/themes/original/src/components/LoginForm/index.tsx +38 -14
  147. package/themes/original/src/components/MessageListing/index.tsx +6 -0
  148. package/themes/original/src/components/Messages/index.tsx +9 -3
  149. package/themes/original/src/components/Messages/styles.tsx +1 -1
  150. package/themes/original/src/components/MomentOption/index.tsx +20 -5
  151. package/themes/original/src/components/MomentSelector/index.tsx +1 -1
  152. package/themes/original/src/components/MultiCart/index.tsx +1 -1
  153. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +48 -15
  154. package/themes/original/src/components/MultiCheckout/index.tsx +295 -56
  155. package/themes/original/src/components/MultiCheckout/styles.tsx +20 -1
  156. package/themes/original/src/components/MultiOrdersDetails/index.tsx +21 -16
  157. package/themes/original/src/components/MyOrders/index.tsx +37 -39
  158. package/themes/original/src/components/NavBar/index.tsx +15 -14
  159. package/themes/original/src/components/NetworkError/index.tsx +2 -3
  160. package/themes/original/src/components/NetworkError/styles.tsx +2 -2
  161. package/themes/original/src/components/Notifications/index.tsx +9 -8
  162. package/themes/original/src/components/Notifications/styles.tsx +0 -1
  163. package/themes/original/src/components/OrderDetails/OrderEta.tsx +21 -6
  164. package/themes/original/src/components/OrderDetails/OrderHistory.tsx +14 -5
  165. package/themes/original/src/components/OrderDetails/index.tsx +718 -667
  166. package/themes/original/src/components/OrderDetails/styles.tsx +24 -7
  167. package/themes/original/src/components/OrderProgress/index.tsx +50 -14
  168. package/themes/original/src/components/OrderProgress/styles.tsx +1 -1
  169. package/themes/original/src/components/OrderSummary/index.tsx +26 -34
  170. package/themes/original/src/components/OrderTypeSelector/index.tsx +5 -0
  171. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/styles.tsx +1 -1
  172. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/styles.tsx +1 -1
  173. package/themes/original/src/components/OrdersOption/index.tsx +14 -6
  174. package/themes/original/src/components/OrdersOption/styles.tsx +1 -1
  175. package/themes/original/src/components/PageBanner/index.tsx +3 -0
  176. package/themes/original/src/components/PaymentOptionCard/index.tsx +182 -0
  177. package/themes/original/src/components/PaymentOptionStripe/styles.tsx +3 -0
  178. package/themes/original/src/components/PaymentOptions/index.tsx +118 -37
  179. package/themes/original/src/components/PhoneInputNumber/index.tsx +15 -1
  180. package/themes/original/src/components/PreviousOrders/index.tsx +2 -0
  181. package/themes/original/src/components/ProductForm/ActionButton.tsx +122 -0
  182. package/themes/original/src/components/ProductForm/ExtraOptions.tsx +56 -0
  183. package/themes/original/src/components/ProductForm/index.tsx +193 -267
  184. package/themes/original/src/components/ProductForm/styles.tsx +1 -1
  185. package/themes/original/src/components/ProductItemAccordion/index.tsx +55 -42
  186. package/themes/original/src/components/ProductItemAccordion/styles.tsx +3 -4
  187. package/themes/original/src/components/ProductOptionSubOption/index.tsx +120 -79
  188. package/themes/original/src/components/ProductOptionSubOption/styles.tsx +10 -9
  189. package/themes/original/src/components/ProfessionalProfile/styles.tsx +3 -3
  190. package/themes/original/src/components/Promotions/index.tsx +13 -11
  191. package/themes/original/src/components/Promotions/styles.tsx +0 -2
  192. package/themes/original/src/components/ReviewDriver/index.tsx +5 -0
  193. package/themes/original/src/components/ReviewDriver/styles.tsx +1 -1
  194. package/themes/original/src/components/ReviewOrder/index.tsx +5 -0
  195. package/themes/original/src/components/ReviewOrder/styles.tsx +1 -1
  196. package/themes/original/src/components/ReviewProducts/index.tsx +5 -0
  197. package/themes/original/src/components/ReviewProducts/styles.tsx +1 -1
  198. package/themes/original/src/components/ScheduleAccordion/index.tsx +3 -3
  199. package/themes/original/src/components/ServiceForm/index.tsx +2 -2
  200. package/themes/original/src/components/ServiceForm/styles.tsx +4 -4
  201. package/themes/original/src/components/Sessions/index.tsx +5 -0
  202. package/themes/original/src/components/SignupForm/index.tsx +76 -60
  203. package/themes/original/src/components/SingleOrderCard/index.tsx +6 -5
  204. package/themes/original/src/components/SingleProductCard/index.tsx +5 -4
  205. package/themes/original/src/components/SingleProductCard/styles.tsx +0 -5
  206. package/themes/original/src/components/StripeCardsList/index.tsx +26 -8
  207. package/themes/original/src/components/StripeElementsForm/index.tsx +80 -62
  208. package/themes/original/src/components/StripeElementsForm/naked.tsx +59 -1
  209. package/themes/original/src/components/UpsellingProducts/UpsellingContent.tsx +170 -0
  210. package/themes/original/src/components/UpsellingProducts/UpsellingLayout.tsx +91 -0
  211. package/themes/original/src/components/UpsellingProducts/index.tsx +15 -199
  212. package/themes/original/src/components/UpsellingProducts/styles.tsx +19 -0
  213. package/themes/original/src/components/UserFormDetails/index.tsx +128 -79
  214. package/themes/original/src/components/UserFormDetails/styles.tsx +8 -1
  215. package/themes/original/src/components/UserProfile/index.tsx +5 -4
  216. package/themes/original/src/components/UserProfileForm/index.tsx +35 -36
  217. package/themes/original/src/components/UserVerification/index.tsx +55 -50
  218. package/themes/original/src/components/WalletTransactionItem/index.tsx +2 -2
  219. package/themes/original/src/components/WalletTransactions/styles.tsx +1 -0
  220. package/themes/original/src/components/Wallets/index.tsx +35 -49
  221. package/themes/original/src/components/Wallets/styles.tsx +3 -4
  222. package/themes/original/src/components/WebsocketStatus/index.tsx +172 -0
  223. package/themes/original/src/components/WebsocketStatus/styles.tsx +28 -0
  224. package/themes/original/src/components/shared/HeaderTitle.tsx +1 -1
  225. package/themes/original/src/components/shared/OButton.tsx +5 -5
  226. package/themes/original/src/components/shared/OInput.tsx +7 -4
  227. package/themes/original/src/components/shared/OModal.tsx +12 -14
  228. package/themes/original/src/layouts/Container.tsx +5 -3
  229. package/themes/original/src/types/index.tsx +13 -2
  230. package/themes/original/src/utils/index.tsx +124 -22
  231. package/src/navigators/BottomNavigator.tsx +0 -117
  232. package/src/navigators/CheckoutNavigator.tsx +0 -66
  233. package/src/navigators/HomeNavigator.tsx +0 -202
  234. package/src/navigators/NavigationRef.tsx +0 -7
  235. package/src/navigators/RootNavigator.tsx +0 -269
  236. package/src/pages/Account.tsx +0 -34
  237. package/src/pages/AddressForm.tsx +0 -62
  238. package/src/pages/AddressList.tsx +0 -24
  239. package/src/pages/BusinessProductsList.tsx +0 -81
  240. package/src/pages/BusinessesListing.tsx +0 -43
  241. package/src/pages/CartList.tsx +0 -49
  242. package/src/pages/Checkout.tsx +0 -101
  243. package/src/pages/ForgotPassword.tsx +0 -24
  244. package/src/pages/Help.tsx +0 -23
  245. package/src/pages/HelpAccountAndPayment.tsx +0 -23
  246. package/src/pages/HelpGuide.tsx +0 -23
  247. package/src/pages/HelpOrder.tsx +0 -23
  248. package/src/pages/Home.tsx +0 -36
  249. package/src/pages/IntroductoryTutorial.tsx +0 -170
  250. package/src/pages/Login.tsx +0 -47
  251. package/src/pages/MomentOption.tsx +0 -30
  252. package/src/pages/MultiCheckout.tsx +0 -31
  253. package/src/pages/MultiOrdersDetails.tsx +0 -27
  254. package/src/pages/MyOrders.tsx +0 -40
  255. package/src/pages/NetworkError.tsx +0 -24
  256. package/src/pages/NotFound.tsx +0 -22
  257. package/src/pages/OrderDetails.tsx +0 -25
  258. package/src/pages/ProductDetails.tsx +0 -55
  259. package/src/pages/Profile.tsx +0 -36
  260. package/src/pages/ReviewDriver.tsx +0 -30
  261. package/src/pages/ReviewOrder.tsx +0 -32
  262. package/src/pages/ReviewProducts.tsx +0 -30
  263. package/src/pages/Sessions.tsx +0 -22
  264. package/src/pages/Signup.tsx +0 -53
  265. package/src/pages/SpinnerLoader.tsx +0 -10
  266. package/src/pages/Splash.tsx +0 -21
@@ -40,6 +40,9 @@ export const OSItem = styled.View`
40
40
  justify-content: space-between;
41
41
  align-items: center;
42
42
  padding: 10px 0px;
43
+ ${({ isInvalid } : any) => isInvalid && css`
44
+ opacity: 0.7;
45
+ `}
43
46
  `;
44
47
 
45
48
  export const OSItemContent = styled.TouchableOpacity`
@@ -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'
@@ -44,6 +47,7 @@ const stripeDirectMethods = ['stripe_direct']
44
47
 
45
48
  const webViewPaymentGateway: any = ['paypal', 'square']
46
49
  const multiCheckoutMethods = ['global_google_pay', 'global_apple_pay']
50
+ const cardsPaymethods = ['credomatic']
47
51
 
48
52
  const PaymentOptionsUI = (props: any) => {
49
53
  const {
@@ -61,14 +65,23 @@ const PaymentOptionsUI = (props: any) => {
61
65
  handlePaymentMethodClickCustom,
62
66
  handlePlaceOrder,
63
67
  merchantId,
68
+ urlscheme,
64
69
  setMethodPaySupported,
65
70
  placeByMethodPay,
66
71
  methodPaySupported,
67
- setPlaceByMethodPay
72
+ setPlaceByMethodPay,
73
+ setCardList,
74
+ onPaymentChange,
75
+ requiredFields,
76
+ openUserModal,
77
+ paymethodClicked,
78
+ setPaymethodClicked,
79
+ androidAppId
68
80
  } = props
69
81
 
70
82
  const theme = useTheme();
71
83
  const [, { showToast }] = useToast();
84
+ const [{ user }] = useSession()
72
85
  const { confirmApplePayPayment } = useApplePay()
73
86
 
74
87
  const getPayIcon = (method: string) => {
@@ -89,6 +102,8 @@ const PaymentOptionsUI = (props: any) => {
89
102
  return theme.images.general.stripesb
90
103
  case 'apple_pay':
91
104
  return theme.images.general.applePayMark
105
+ case 'google_pay':
106
+ return theme.images.general.googlePayMark
92
107
  default:
93
108
  return theme.images.general.creditCard
94
109
  }
@@ -96,7 +111,7 @@ const PaymentOptionsUI = (props: any) => {
96
111
 
97
112
  const [, t] = useLanguage();
98
113
 
99
- const [addCardOpen, setAddCardOpen] = useState({ stripe: false, stripeConnect: false });
114
+ const [addCardOpen, setAddCardOpen] = useState({ stripe: false, stripeConnect: false, card: false });
100
115
  const paymethodSelected = props.paySelected || props.paymethodSelected || isOpenMethod?.paymethod
101
116
  // const [{ token }] = useSession()
102
117
 
@@ -106,8 +121,18 @@ const PaymentOptionsUI = (props: any) => {
106
121
  // { name: t('SELECT_A_PAYMENT_METHOD', 'Select a payment method'), value: '-1' },
107
122
  // ]
108
123
 
124
+ const paymethodsFieldRequired = ['paypal', 'apple_pay', 'global_apple_pay']
125
+
109
126
  const handlePaymentMethodClick = (paymethod: any) => {
110
- 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
+ }
111
136
  const isPopupMethod = ['stripe', 'stripe_direct', 'stripe_connect', 'stripe_redirect', 'paypal'].includes(paymethod?.gateway)
112
137
  if (webViewPaymentGateway.includes(paymethod?.gateway)) {
113
138
  handlePaymentMethodClickCustom(paymethod)
@@ -121,6 +146,12 @@ const PaymentOptionsUI = (props: any) => {
121
146
  ;
122
147
  }
123
148
 
149
+ useEffect(() => {
150
+ if (cart?.balance === 0) {
151
+ handlePaymethodClick(null)
152
+ }
153
+ }, [cart?.balance])
154
+
124
155
  useEffect(() => {
125
156
  if (paymethodsList.paymethods.length === 1) {
126
157
  handlePaymethodClick && handlePaymethodClick(paymethodsList.paymethods[0])
@@ -147,10 +178,17 @@ const PaymentOptionsUI = (props: any) => {
147
178
  }
148
179
  }, [paymethodData, paymethodSelected])
149
180
 
181
+ useEffect(() => {
182
+ if (paymethodClicked?.confirmed) {
183
+ handlePaymentMethodClickCustom(paymethodClicked?.paymethod)
184
+ }
185
+ }, [paymethodClicked?.confirmed])
186
+
187
+
150
188
  const renderPaymethods = ({ item }: any) => {
151
189
  return (
152
190
  <>
153
- {item?.gateway === 'apple_pay' ? (
191
+ {methodsPay.includes(item?.gateway) ? (
154
192
  <TouchableOpacity
155
193
  onPress={() => handlePaymentMethodClick(item)}
156
194
  >
@@ -181,7 +219,7 @@ const PaymentOptionsUI = (props: any) => {
181
219
  style={{ margin: 0, marginTop: 4 }}
182
220
  color={paymethodSelected?.id === item.id ? theme.colors.white : '#000'}
183
221
  >
184
- {t(item.gateway.toUpperCase(), item.name)}
222
+ {t(item?.gateway?.toUpperCase(), item.name)}
185
223
  </OText>
186
224
  </PMItem>
187
225
  </TouchableOpacity>
@@ -192,7 +230,7 @@ const PaymentOptionsUI = (props: any) => {
192
230
  }
193
231
 
194
232
  const excludeIds: any = [32]; //exclude paypal & connect & redirect
195
- const filterMethodsPay = (gateway : string) => Platform.OS === 'ios' ? gateway !== 'google_pay' : gateway !== 'apple_pay'
233
+ const filterMethodsPay = (gateway: string) => Platform.OS === 'ios' ? gateway !== 'google_pay' : gateway !== 'apple_pay'
196
234
 
197
235
  return (
198
236
  <PMContainer>
@@ -202,9 +240,9 @@ const PaymentOptionsUI = (props: any) => {
202
240
  showsHorizontalScrollIndicator={false}
203
241
  // data={paymethodsList.paymethods.sort((a: any, b: any) => a.id - b.id)}
204
242
  data={paymethodsList.paymethods.sort((a: any, b: any) => a.id - b.id)
205
- .filter((p: any) =>
206
- !multiCheckoutMethods.includes(p.gateway) &&
207
- filterMethodsPay(p.gateway) &&
243
+ .filter((p: any) =>
244
+ !multiCheckoutMethods.includes(p.gateway) &&
245
+ filterMethodsPay(p.gateway) &&
208
246
  !excludeIds.includes(p.id))}
209
247
  renderItem={renderPaymethods}
210
248
  keyExtractor={(paymethod: any) => paymethod?.id?.toString?.()}
@@ -251,7 +289,7 @@ const PaymentOptionsUI = (props: any) => {
251
289
  />
252
290
  )}
253
291
 
254
- {stripeOptions.includes(paymethodSelected?.gateway) &&
292
+ {/* {stripeOptions.includes(paymethodSelected?.gateway) &&
255
293
  (paymethodData?.brand || paymethodData?.card?.brand) &&
256
294
  (paymethodData?.last4 || paymethodData?.card?.last4) &&
257
295
  (
@@ -280,10 +318,10 @@ const PaymentOptionsUI = (props: any) => {
280
318
  </View>
281
319
  </PMCardItemContent>
282
320
  </PMCardSelected>
283
- )}
321
+ )} */}
284
322
 
285
323
  {/* Stripe */}
286
- {isOpenMethod?.paymethod?.gateway === 'stripe' && !paymethodData?.id && (
324
+ {isOpenMethod?.paymethod?.gateway === 'stripe' && (
287
325
  <View>
288
326
  <OButton
289
327
  text={t('ADD_PAYMENT_CARD', 'Add New Payment Card')}
@@ -301,8 +339,16 @@ const PaymentOptionsUI = (props: any) => {
301
339
  payType={paymethodsList?.name}
302
340
  onSelectCard={handlePaymethodDataChange}
303
341
  onNavigationRedirect={onNavigationRedirect}
342
+ paymethodCardId={paymethodData?.id}
304
343
  onCancel={() => handlePaymethodClick(null)}
305
- setAddCardOpen={() => setAddCardOpen({ ...addCardOpen, stripe: true })}
344
+ setAddCardOpen={setAddCardOpen}
345
+ addCardOpen={addCardOpen}
346
+ isOpenMethod={isOpenMethod}
347
+ handleSource={handlePaymethodDataChange}
348
+ clientSecret={props.clientSecret}
349
+ businessId={props.businessId}
350
+ onPaymentChange={onPaymentChange}
351
+ paySelected={props.paySelected}
306
352
  />
307
353
  </View>
308
354
  )}
@@ -317,35 +363,33 @@ const PaymentOptionsUI = (props: any) => {
317
363
  handleSource={handlePaymethodDataChange}
318
364
  onCancel={() => handlePaymethodClick(null)}
319
365
  merchantId={merchantId}
366
+ urlscheme={urlscheme}
367
+ androidAppId={androidAppId}
320
368
  setMethodPaySupported={setMethodPaySupported}
321
369
  methodPaySupported={methodPaySupported}
322
370
  placeByMethodPay={placeByMethodPay}
323
371
  setPlaceByMethodPay={setPlaceByMethodPay}
372
+ publicKeyAddCard={isOpenMethod?.paymethod?.credentials?.stripe?.publishable || isOpenMethod?.paymethod?.credentials?.publishable}
324
373
  />
325
374
  )}
326
375
 
327
- <OModal
328
- entireModal
329
- title={t('ADD_CREDIT_OR_DEBIT_CARD', 'Add credit or debit card')}
330
- open={addCardOpen.stripe}
331
- onClose={() => setAddCardOpen({ ...addCardOpen, stripe: false })}
332
- style={{ backgroundColor: 'red' }}
333
- >
334
- <KeyboardAvoidingView
335
- behavior={Platform.OS == 'ios' ? 'padding' : 'height'}
336
- keyboardVerticalOffset={Platform.OS == 'ios' ? 0 : 0}
337
- enabled={Platform.OS === 'ios' ? true : false}
338
- >
339
- <StripeElementsForm
340
- toSave
341
- businessId={props.businessId}
342
- publicKey={isOpenMethod?.paymethod?.credentials?.publishable}
343
- requirements={props.clientSecret}
344
- onSelectCard={handlePaymethodDataChange}
345
- onCancel={() => setAddCardOpen({ ...addCardOpen, stripe: false })}
346
- />
347
- </KeyboardAvoidingView>
348
- </OModal>
376
+ {(cardsPaymethods.includes(isOpenMethod?.paymethod?.gateway) || cardsPaymethods.includes(paymethodSelected?.gateway)) && (
377
+ <PaymentOptionCard
378
+ setCardList={setCardList}
379
+ paymethod={isOpenMethod?.paymethod}
380
+ businessId={props.businessId}
381
+ publicKey={isOpenMethod?.paymethod?.credentials?.publishable}
382
+ gateway={isOpenMethod?.paymethod?.gateway || paymethodSelected?.gateway}
383
+ onPaymentChange={onPaymentChange}
384
+ payType={isOpenMethod?.paymethod?.name}
385
+ onSelectCard={handlePaymethodDataChange}
386
+ addCardOpen={addCardOpen}
387
+ setAddCardOpen={setAddCardOpen}
388
+ onCancel={() => handlePaymethodClick(null)}
389
+ paymethodSelected={paymethodSelected?.data?.id}
390
+ handlePaymentMethodClick={handlePaymentMethodClick}
391
+ />
392
+ )}
349
393
 
350
394
  {/* Stripe direct */}
351
395
  <OModal
@@ -368,6 +412,10 @@ const PaymentOptionsUI = (props: any) => {
368
412
  handleSource={handlePaymethodDataChange}
369
413
  onCancel={() => handlePaymethodClick(null)}
370
414
  merchantId={merchantId}
415
+ urlscheme={urlscheme}
416
+ androidAppId={androidAppId}
417
+ publicKeyAddCard={isOpenMethod?.paymethod?.credentials?.stripe?.publishable || isOpenMethod?.paymethod?.credentials?.publishable}
418
+ paySelected={props.paySelected}
371
419
  />
372
420
  </KeyboardAvoidingView>
373
421
  </OModal>
@@ -387,15 +435,17 @@ const PaymentOptionsUI = (props: any) => {
387
435
  <StripeCardsList
388
436
  paymethod={isOpenMethod?.paymethod}
389
437
  businessId={props.businessId}
390
- publicKey={isOpenMethod?.paymethod?.credentials.publishable}
391
438
  payType={paymethodsList?.name}
392
439
  onSelectCard={handlePaymethodDataChange}
393
440
  onNavigationRedirect={onNavigationRedirect}
394
441
  onCancel={() => handlePaymethodClick(null)}
442
+ publicKey={isOpenMethod?.paymethod?.credentials.publishable}
443
+ publicKeyAddCard={isOpenMethod?.paymethod?.credentials?.stripe?.publishable || isOpenMethod?.paymethod?.credentials?.publishable}
444
+ paySelected={props.paySelected}
395
445
  />
396
446
  </View>
397
447
  )}
398
-
448
+ {/** Stripe connect add cards */}
399
449
  <OModal
400
450
  entireModal
401
451
  title={t('ADD_CREDIT_OR_DEBIT_CARD', 'Add credit or debit card')}
@@ -408,6 +458,7 @@ const PaymentOptionsUI = (props: any) => {
408
458
  enabled={Platform.OS === 'ios' ? true : false}
409
459
  >
410
460
  <StripeElementsForm
461
+ openCarts={props.openCarts}
411
462
  toSave
412
463
  businessId={props.businessId}
413
464
  publicKey={isOpenMethod?.paymethod?.credentials?.stripe?.publishable}
@@ -415,6 +466,36 @@ const PaymentOptionsUI = (props: any) => {
415
466
  accountId={isOpenMethod?.paymethod?.credentials?.user}
416
467
  onSelectCard={handlePaymethodDataChange}
417
468
  onCancel={() => setAddCardOpen({ ...addCardOpen, stripeConnect: false })}
469
+ publicKeyAddCard={isOpenMethod?.paymethod?.credentials?.stripe?.publishable || isOpenMethod?.paymethod?.credentials?.publishable}
470
+ />
471
+ </KeyboardAvoidingView>
472
+ </OModal>
473
+
474
+ {/* Stripe Add card */}
475
+ <OModal
476
+ entireModal
477
+ title={t('ADD_CREDIT_OR_DEBIT_CARD', 'Add credit or debit card')}
478
+ open={addCardOpen?.stripe}
479
+ onClose={() => setAddCardOpen({ ...addCardOpen, stripe: false })}
480
+ style={{ backgroundColor: 'red' }}
481
+ >
482
+ <KeyboardAvoidingView
483
+ behavior={Platform.OS == 'ios' ? 'padding' : 'height'}
484
+ keyboardVerticalOffset={Platform.OS == 'ios' ? 0 : 0}
485
+ enabled={Platform.OS === 'ios' ? true : false}
486
+ >
487
+ <StripeElementsForm
488
+ openCarts={props.openCarts}
489
+ toSave
490
+ businessId={props.businessId}
491
+ businessIds={props.businessIds}
492
+ publicKey={props.publicKey || isOpenMethod?.paymethod?.credentials?.publishable}
493
+ setCardsList={setCardList}
494
+ requirements={props.clientSecret}
495
+ handleSource={handlePaymethodDataChange}
496
+ onSelectCard={handlePaymethodDataChange}
497
+ onCancel={() => setAddCardOpen({ ...addCardOpen, stripe: false })}
498
+ publicKeyAddCard={isOpenMethod?.paymethod?.credentials?.stripe?.publishable || isOpenMethod?.paymethod?.credentials?.publishable}
418
499
  />
419
500
  </KeyboardAvoidingView>
420
501
  </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 === '') && (
@@ -49,6 +49,8 @@ export const PreviousOrders = (props: PreviousOrdersParams) => {
49
49
  onClick={loadMoreOrders}
50
50
  text={t('LOAD_MORE_ORDERS', 'Load more orders')}
51
51
  imgRightSrc={null}
52
+ bgColor={theme.colors.primary}
53
+ borderColor={theme.colors.primary}
52
54
  textStyle={{ color: theme.colors.white }}
53
55
  style={{ borderRadius: 7.6, shadowOpacity: 0, marginTop: 20 }}
54
56
  />
@@ -0,0 +1,122 @@
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
+ const saveErrors =
34
+ orderState.loading ||
35
+ maxProductQuantity === 0 ||
36
+ Object.keys(errors)?.length > 0;
37
+ const buttonColor = 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))
38
+
39
+
40
+
41
+ return (
42
+ <View
43
+ style={{
44
+ width: isHaveWeight ? '100%' : ((isSoldOut || maxProductQuantity <= 0) ? '60%' : '40%'),
45
+ }}>
46
+ {((productCart &&
47
+ auth &&
48
+ (orderState.options?.address_id || isAllowUnaddressOrderType)) || (isSoldOut || maxProductQuantity <= 0)) && (
49
+ <OButton
50
+ onClick={() => handleSaveProduct()}
51
+ imgRightSrc=""
52
+ text={`${orderState.loading
53
+ ? t('LOADING', 'Loading')
54
+ : (isSoldOut || maxProductQuantity <= 0)
55
+ ? t('SOLD_OUT', 'Sold out')
56
+ : editMode
57
+ ? t('UPDATE', 'Update')
58
+ : t('ADD', 'Add')
59
+ }`}
60
+ 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))}
61
+ textStyle={{
62
+ color: saveErrors || isSoldOut || maxProductQuantity <= 0 ? theme.colors.primary : theme.colors.white,
63
+ fontSize: orderState.loading || editMode ? 10 : 14
64
+ }}
65
+ bgColor={buttonColor ? theme.colors.lightGray : theme.colors.primary}
66
+ borderColor={!buttonColor ? theme.colors.white : theme.colors.primary}
67
+ style={{
68
+ opacity: saveErrors || isSoldOut || maxProductQuantity <= 0 ? 0.3 : 1,
69
+ borderRadius: 7.6,
70
+ height: 44,
71
+ shadowOpacity: 0,
72
+ borderWidth: 1,
73
+ marginTop: isHaveWeight ? 10 : 0
74
+ }}
75
+ />
76
+ )}
77
+ {auth &&
78
+ !orderState.options?.address_id && !isAllowUnaddressOrderType &&
79
+ (orderState.loading ? (
80
+ <OButton
81
+ isDisabled
82
+ text={t('LOADING', 'Loading')}
83
+ imgRightSrc=""
84
+ textStyle={{ fontSize: 10 }}
85
+ />
86
+ ) : (
87
+ <OButton onClick={navigation.navigate('AddressList')} />
88
+ ))}
89
+ {!auth && (
90
+ <OButton
91
+ isDisabled={isSoldOut || maxProductQuantity <= 0}
92
+ onClick={() => handleRedirectLogin()}
93
+ text={
94
+ isSoldOut || maxProductQuantity <= 0
95
+ ? t('SOLD_OUT', 'Sold out')
96
+ : t('LOGIN_SIGNUP', 'Login / Sign Up')
97
+ }
98
+ imgRightSrc=""
99
+ textStyle={{ color: theme.colors.primary, fontSize: 13, textAlign: 'center' }}
100
+ style={{
101
+ height: 42,
102
+ borderColor: theme.colors.primary,
103
+ backgroundColor: theme.colors.white,
104
+ paddingLeft: 0,
105
+ paddingRight: 0
106
+ }}
107
+ />
108
+ )}
109
+ {!auth && guestCheckoutEnabled && orderTypeEnabled && (
110
+ <TouchableOpacity style={{ marginTop: 10 }} onPress={handleUpdateGuest}>
111
+ {actionStatus?.loading ? (
112
+ <Placeholder Animation={Fade}>
113
+ <PlaceholderLine height={20} />
114
+ </Placeholder>
115
+ ) : (
116
+ <OText color={theme.colors.primary} size={13} style={{ textAlign: 'center' }}>{t('AS_GUEST_USER', 'As guest user')}</OText>
117
+ )}
118
+ </TouchableOpacity>
119
+ )}
120
+ </View>
121
+ )
122
+ }
@@ -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
+ }