ordering-ui-react-native 0.22.47-map → 0.22.47-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 (1361) hide show
  1. package/README.md +3 -3
  2. package/package.json +162 -164
  3. package/src/AppContainer.tsx +96 -96
  4. package/src/DeliveryApp.tsx +152 -152
  5. package/src/assets/json/order.json +204 -204
  6. package/src/assets/json/orders.json +3591 -3591
  7. package/src/components/Account/index.tsx +200 -200
  8. package/src/components/Account/styles.tsx +21 -21
  9. package/src/components/ActiveOrders/index.tsx +169 -169
  10. package/src/components/ActiveOrders/styles.tsx +45 -45
  11. package/src/components/AddressDetails/index.tsx +74 -74
  12. package/src/components/AddressDetails/styles.tsx +26 -26
  13. package/src/components/AddressForm/index.tsx +750 -750
  14. package/src/components/AddressForm/styles.tsx +29 -29
  15. package/src/components/AddressList/index.tsx +336 -336
  16. package/src/components/AddressList/styles.tsx +20 -20
  17. package/src/components/Analytics/index.tsx +83 -83
  18. package/src/components/AppleLogin/index.tsx +148 -148
  19. package/src/components/AppleLogin/styles.tsx +22 -22
  20. package/src/components/BusinessBasicInformation/index.tsx +251 -251
  21. package/src/components/BusinessBasicInformation/styles.tsx +38 -38
  22. package/src/components/BusinessController/index.tsx +227 -227
  23. package/src/components/BusinessController/styles.tsx +52 -52
  24. package/src/components/BusinessInformation/index.tsx +143 -143
  25. package/src/components/BusinessInformation/styles.tsx +37 -37
  26. package/src/components/BusinessItemAccordion/index.tsx +148 -148
  27. package/src/components/BusinessItemAccordion/styles.tsx +61 -61
  28. package/src/components/BusinessProductsCategories/index.tsx +73 -73
  29. package/src/components/BusinessProductsCategories/styles.tsx +7 -7
  30. package/src/components/BusinessProductsList/index.tsx +149 -149
  31. package/src/components/BusinessProductsList/styles.tsx +13 -13
  32. package/src/components/BusinessProductsListing/index.tsx +318 -318
  33. package/src/components/BusinessProductsListing/styles.tsx +33 -33
  34. package/src/components/BusinessReviews/index.tsx +121 -121
  35. package/src/components/BusinessReviews/styles.tsx +33 -33
  36. package/src/components/BusinessTypeFilter/index.tsx +210 -210
  37. package/src/components/BusinessTypeFilter/styles.tsx +32 -32
  38. package/src/components/BusinessesListing/index.tsx +254 -254
  39. package/src/components/BusinessesListing/styles.tsx +60 -60
  40. package/src/components/Cart/index.tsx +420 -420
  41. package/src/components/Cart/styles.tsx +35 -35
  42. package/src/components/CartContent/index.tsx +50 -50
  43. package/src/components/CartContent/styles.tsx +19 -19
  44. package/src/components/Checkout/index.tsx +852 -851
  45. package/src/components/Checkout/styles.tsx +111 -111
  46. package/src/components/CouponControl/index.tsx +133 -133
  47. package/src/components/CouponControl/styles.tsx +22 -22
  48. package/src/components/DriverTips/index.tsx +158 -158
  49. package/src/components/DriverTips/styles.tsx +62 -62
  50. package/src/components/FacebookLogin/index.tsx +123 -123
  51. package/src/components/FacebookLogin/styles.tsx +23 -23
  52. package/src/components/FacebookPixel/index.tsx +81 -81
  53. package/src/components/FloatingButton/index.tsx +74 -74
  54. package/src/components/FloatingButton/styles.tsx +32 -32
  55. package/src/components/ForgotPasswordForm/index.tsx +150 -150
  56. package/src/components/ForgotPasswordForm/styles.tsx +11 -11
  57. package/src/components/GoogleLogin/index.tsx +133 -133
  58. package/src/components/GoogleLogin/styles.tsx +23 -23
  59. package/src/components/GoogleMap/index.tsx +247 -247
  60. package/src/components/Help/index.tsx +54 -54
  61. package/src/components/Help/styles.tsx +11 -11
  62. package/src/components/HelpAccountAndPayment/index.tsx +67 -67
  63. package/src/components/HelpAccountAndPayment/styles.tsx +6 -6
  64. package/src/components/HelpGuide/index.tsx +66 -66
  65. package/src/components/HelpGuide/styles.tsx +6 -6
  66. package/src/components/HelpOrder/index.tsx +78 -78
  67. package/src/components/HelpOrder/styles.tsx +5 -5
  68. package/src/components/Home/index.tsx +114 -114
  69. package/src/components/Home/styles.tsx +18 -18
  70. package/src/components/LanguageSelector/index.tsx +127 -127
  71. package/src/components/LanguageSelector/styles.tsx +10 -10
  72. package/src/components/LastOrders/index.tsx +104 -104
  73. package/src/components/LastOrders/styles.tsx +17 -17
  74. package/src/components/LoginForm/index.tsx +535 -535
  75. package/src/components/LoginForm/styles.tsx +74 -74
  76. package/src/components/LogoutButton/index.tsx +74 -74
  77. package/src/components/Messages/index.tsx +443 -443
  78. package/src/components/Messages/styles.tsx +24 -24
  79. package/src/components/MomentOption/index.tsx +238 -238
  80. package/src/components/MomentOption/styles.tsx +61 -61
  81. package/src/components/NavBar/index.tsx +122 -122
  82. package/src/components/NotFoundSource/index.tsx +56 -56
  83. package/src/components/NotFoundSource/styles.tsx +16 -16
  84. package/src/components/NotificationSetting/index.tsx +85 -85
  85. package/src/components/OrderCreating/index.tsx +158 -158
  86. package/src/components/OrderCreating/styles.tsx +22 -22
  87. package/src/components/OrderDetails/index.tsx +714 -714
  88. package/src/components/OrderDetails/styles.tsx +128 -128
  89. package/src/components/OrderSuccess/index.tsx +89 -89
  90. package/src/components/OrderSuccess/styles.tsx +22 -22
  91. package/src/components/OrderSummary/index.tsx +351 -351
  92. package/src/components/OrderSummary/styles.tsx +45 -45
  93. package/src/components/OrderTypeSelector/index.tsx +159 -159
  94. package/src/components/OrderTypeSelector/styles.tsx +22 -22
  95. package/src/components/OrdersOption/index.tsx +228 -228
  96. package/src/components/OrdersOption/styles.tsx +5 -5
  97. package/src/components/PaymentOptionCash/index.tsx +102 -102
  98. package/src/components/PaymentOptionCash/styles.tsx +18 -18
  99. package/src/components/PaymentOptionStripe/index.tsx +244 -244
  100. package/src/components/PaymentOptionStripe/styles.tsx +62 -62
  101. package/src/components/PaymentOptions/index.tsx +415 -415
  102. package/src/components/PaymentOptions/styles.tsx +52 -52
  103. package/src/components/PaymentOptionsWebView/index.tsx +173 -173
  104. package/src/components/PhoneInputNumber/index.tsx +115 -115
  105. package/src/components/PhoneInputNumber/styles.tsx +3 -3
  106. package/src/components/PreviousOrders/index.tsx +167 -167
  107. package/src/components/PreviousOrders/styles.tsx +34 -34
  108. package/src/components/ProductForm/index.tsx +442 -442
  109. package/src/components/ProductForm/styles.tsx +85 -85
  110. package/src/components/ProductIngredient/index.tsx +44 -44
  111. package/src/components/ProductIngredient/styles.tsx +7 -7
  112. package/src/components/ProductItemAccordion/index.tsx +315 -315
  113. package/src/components/ProductItemAccordion/styles.tsx +81 -81
  114. package/src/components/ProductOption/index.tsx +49 -49
  115. package/src/components/ProductOption/styles.tsx +14 -14
  116. package/src/components/ProductOptionSubOption/index.tsx +146 -146
  117. package/src/components/ProductOptionSubOption/styles.tsx +33 -33
  118. package/src/components/ReviewDriver/index.tsx +313 -313
  119. package/src/components/ReviewDriver/styles.tsx +38 -38
  120. package/src/components/ReviewOrder/index.tsx +339 -339
  121. package/src/components/ReviewOrder/styles.tsx +44 -44
  122. package/src/components/ReviewProducts/index.tsx +124 -124
  123. package/src/components/ReviewProducts/styles.tsx +16 -16
  124. package/src/components/SearchBar/index.tsx +99 -99
  125. package/src/components/ShareComponent/index.tsx +32 -32
  126. package/src/components/SignupForm/index.tsx +676 -676
  127. package/src/components/SignupForm/styles.tsx +27 -27
  128. package/src/components/SingleProductCard/index.tsx +114 -114
  129. package/src/components/SingleProductCard/styles.tsx +27 -27
  130. package/src/components/SingleProductReview/index.tsx +169 -169
  131. package/src/components/SingleProductReview/styles.tsx +26 -26
  132. package/src/components/StripeCardForm/index.tsx +97 -97
  133. package/src/components/StripeCardForm/naked.tsx +128 -128
  134. package/src/components/StripeCardForm/styles.tsx +27 -27
  135. package/src/components/StripeCardsList/index.tsx +158 -158
  136. package/src/components/StripeElementsForm/index.tsx +233 -233
  137. package/src/components/StripeElementsForm/naked.tsx +90 -90
  138. package/src/components/StripeElementsForm/styles.tsx +9 -9
  139. package/src/components/StripeMethodForm/index.tsx +209 -209
  140. package/src/components/StripeRedirectForm/index.tsx +159 -159
  141. package/src/components/StripeRedirectForm/styles.tsx +23 -23
  142. package/src/components/TaxInformation/index.tsx +83 -83
  143. package/src/components/TaxInformation/styles.tsx +9 -9
  144. package/src/components/UpsellingProducts/index.tsx +167 -167
  145. package/src/components/UpsellingProducts/styles.tsx +31 -31
  146. package/src/components/UserDetails/index.tsx +139 -139
  147. package/src/components/UserDetails/styles.tsx +21 -21
  148. package/src/components/UserFormDetails/index.tsx +302 -302
  149. package/src/components/UserFormDetails/styles.tsx +38 -38
  150. package/src/components/UserProfileForm/index.tsx +197 -197
  151. package/src/components/UserProfileForm/styles.tsx +45 -45
  152. package/src/components/VerifyPhone/index.tsx +255 -255
  153. package/src/components/VerifyPhone/styles.tsx +43 -44
  154. package/src/components/shared/OAlert.tsx +48 -48
  155. package/src/components/shared/OBottomPopup.tsx +74 -74
  156. package/src/components/shared/OButton.tsx +134 -134
  157. package/src/components/shared/ODropDown.tsx +167 -167
  158. package/src/components/shared/OIcon.tsx +55 -55
  159. package/src/components/shared/OIconButton.tsx +134 -134
  160. package/src/components/shared/OInput.tsx +122 -122
  161. package/src/components/shared/OModal.tsx +168 -168
  162. package/src/components/shared/OText.tsx +52 -52
  163. package/src/components/shared/OToast.tsx +95 -95
  164. package/src/components/shared/index.tsx +23 -23
  165. package/src/config/constants.tsx +73 -73
  166. package/src/config.json +16 -16
  167. package/src/context/OfflineActions/index.tsx +236 -0
  168. package/src/context/Theme/index.tsx +25 -25
  169. package/src/hooks/DeviceOrientation.tsx +40 -40
  170. package/src/hooks/useCountdownTimer.tsx +26 -26
  171. package/src/index.tsx +197 -197
  172. package/src/layouts/Container.tsx +27 -27
  173. package/src/layouts/FloatingBottomContainer.tsx +26 -26
  174. package/src/layouts/SafeAreaContainer.tsx +6 -6
  175. package/src/providers/AlertProvider.tsx +48 -46
  176. package/src/providers/StoreUtil.tsx +54 -54
  177. package/src/theme.json +135 -135
  178. package/src/types/@fatnlazycat/react-native-recaptcha-v3/index.d.ts +1 -1
  179. package/src/types/@stripe/stripe-react-native/index.d.ts +1 -1
  180. package/src/types/index.tsx +500 -500
  181. package/src/types/ordering-api-sdk/index.d.ts +1 -1
  182. package/src/types/ordering-components/index.d.ts +1 -1
  183. package/src/types/react-hook-form/index.d.ts +1 -1
  184. package/src/types/react-native-background-timer/index.d.ts +1 -1
  185. package/src/types/react-native-color-matrix-image-filters/index.d.ts +1 -1
  186. package/src/types/react-native-country-picker-modal/index.d.ts +1 -1
  187. package/src/types/react-native-credit-card-input/index.d.ts +1 -1
  188. package/src/types/react-native-fbsdk-next/index.d.ts +1 -1
  189. package/src/types/react-native-gesture-handler/index.d.ts +1 -1
  190. package/src/types/react-native-gifted-chat/index.d.ts +1 -1
  191. package/src/types/react-native-image-picker/index.d.ts +1 -1
  192. package/src/types/react-native-restart/index.d.ts +1 -1
  193. package/src/types/styled-components/index.d.ts +1 -1
  194. package/src/utils/index.tsx +462 -462
  195. package/themes/business/.prettierrc.js +9 -9
  196. package/themes/business/index.tsx +139 -139
  197. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +542 -539
  198. package/themes/business/src/components/AcceptOrRejectOrder/styles.tsx +46 -45
  199. package/themes/business/src/components/BusinessController/index.tsx +163 -158
  200. package/themes/business/src/components/BusinessController/styles.tsx +19 -19
  201. package/themes/business/src/components/BusinessProductList/AccordionDropdown.tsx +62 -62
  202. package/themes/business/src/components/BusinessProductList/IterateCategories.tsx +107 -107
  203. package/themes/business/src/components/BusinessProductList/ProductList.tsx +196 -196
  204. package/themes/business/src/components/BusinessProductList/index.tsx +197 -196
  205. package/themes/business/src/components/BusinessProductList/styles.tsx +10 -10
  206. package/themes/business/src/components/Chat/index.tsx +1228 -1216
  207. package/themes/business/src/components/Chat/styles.tsx +15 -15
  208. package/themes/business/src/components/Contacts/index.tsx +299 -299
  209. package/themes/business/src/components/Contacts/styles.tsx +42 -42
  210. package/themes/business/src/components/DriverMap/index.tsx +581 -570
  211. package/themes/business/src/components/DriverSchedule/index.tsx +108 -108
  212. package/themes/business/src/components/DriverSchedule/styles.tsx +6 -6
  213. package/themes/business/src/components/FloatingButton/index.tsx +145 -144
  214. package/themes/business/src/components/FloatingButton/styles.tsx +35 -35
  215. package/themes/business/src/components/ForgotPasswordForm/index.tsx +204 -204
  216. package/themes/business/src/components/ForgotPasswordForm/styles.tsx +11 -11
  217. package/themes/business/src/components/GoogleMap/index.tsx +429 -429
  218. package/themes/business/src/components/Home/index.tsx +188 -188
  219. package/themes/business/src/components/Home/styles.tsx +34 -34
  220. package/themes/business/src/components/LanguageSelector/index.tsx +123 -123
  221. package/themes/business/src/components/LanguageSelector/lang_country.json +597 -597
  222. package/themes/business/src/components/LanguageSelector/styles.tsx +17 -17
  223. package/themes/business/src/components/LoginForm/Otp/index.tsx +120 -120
  224. package/themes/business/src/components/LoginForm/Otp/styles.tsx +7 -7
  225. package/themes/business/src/components/LoginForm/index.tsx +971 -946
  226. package/themes/business/src/components/LoginForm/styles.tsx +64 -64
  227. package/themes/business/src/components/LogoutButton/index.tsx +72 -63
  228. package/themes/business/src/components/MapView/index.tsx +354 -349
  229. package/themes/business/src/components/MessagesOption/index.tsx +274 -274
  230. package/themes/business/src/components/MessagesOption/styles.tsx +27 -27
  231. package/themes/business/src/components/NetworkError/index.tsx +61 -61
  232. package/themes/business/src/components/NetworkError/styles.tsx +10 -10
  233. package/themes/business/src/components/NewOrderNotification/index.tsx +257 -246
  234. package/themes/business/src/components/NewOrderNotification/styles.tsx +8 -8
  235. package/themes/business/src/components/NotFoundSource/index.tsx +52 -52
  236. package/themes/business/src/components/NotFoundSource/styles.tsx +17 -17
  237. package/themes/business/src/components/OrderDetails/Business.tsx +88 -20
  238. package/themes/business/src/components/OrderDetails/Delivery.tsx +134 -53
  239. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +787 -677
  240. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +358 -335
  241. package/themes/business/src/components/OrderDetails/styles.tsx +39 -3
  242. package/themes/business/src/components/OrderDetails/usePrinterCommands.tsx +221 -220
  243. package/themes/business/src/components/OrderDetailsLogistic/index.tsx +201 -200
  244. package/themes/business/src/components/OrderDetailsLogistic/styles.tsx +5 -5
  245. package/themes/business/src/components/OrderMessage/index.tsx +345 -345
  246. package/themes/business/src/components/OrderMessage/styles.tsx +5 -5
  247. package/themes/business/src/components/OrderSummary/index.tsx +876 -855
  248. package/themes/business/src/components/OrderSummary/styles.tsx +61 -61
  249. package/themes/business/src/components/OrdersListManager/index.tsx +898 -886
  250. package/themes/business/src/components/OrdersListManager/styles.tsx +123 -123
  251. package/themes/business/src/components/OrdersListManager/utils.tsx +216 -216
  252. package/themes/business/src/components/OrdersOption/index.tsx +1231 -1130
  253. package/themes/business/src/components/OrdersOption/styles.tsx +170 -156
  254. package/themes/business/src/components/OrdersOptionBusiness/index.tsx +65 -65
  255. package/themes/business/src/components/OrdersOptionBusiness/styles.tsx +8 -8
  256. package/themes/business/src/components/OrdersOptionCity/index.tsx +66 -66
  257. package/themes/business/src/components/OrdersOptionCity/styles.tsx +8 -8
  258. package/themes/business/src/components/OrdersOptionDate/index.tsx +66 -66
  259. package/themes/business/src/components/OrdersOptionDate/styles.tsx +8 -8
  260. package/themes/business/src/components/OrdersOptionDelivery/index.tsx +49 -49
  261. package/themes/business/src/components/OrdersOptionDelivery/styles.tsx +8 -8
  262. package/themes/business/src/components/OrdersOptionDriver/index.tsx +64 -64
  263. package/themes/business/src/components/OrdersOptionDriver/styles.tsx +8 -8
  264. package/themes/business/src/components/OrdersOptionPaymethod/index.tsx +63 -63
  265. package/themes/business/src/components/OrdersOptionPaymethod/styles.tsx +8 -8
  266. package/themes/business/src/components/OrdersOptionStatus/index.tsx +55 -55
  267. package/themes/business/src/components/OrdersOptionStatus/styles.tsx +8 -8
  268. package/themes/business/src/components/PhoneInputNumber/index.tsx +163 -163
  269. package/themes/business/src/components/PhoneInputNumber/styles.tsx +3 -3
  270. package/themes/business/src/components/PreviousMessages/FooterMessageComponent.tsx +103 -103
  271. package/themes/business/src/components/PreviousMessages/index.tsx +380 -357
  272. package/themes/business/src/components/PreviousMessages/styles.tsx +32 -32
  273. package/themes/business/src/components/PreviousOrders/OrderItem.tsx +264 -252
  274. package/themes/business/src/components/PreviousOrders/OrderList.tsx +93 -93
  275. package/themes/business/src/components/PreviousOrders/OrdersGroupedItem.tsx +115 -115
  276. package/themes/business/src/components/PreviousOrders/index.tsx +490 -482
  277. package/themes/business/src/components/PreviousOrders/styles.tsx +84 -83
  278. package/themes/business/src/components/PrinterEdition/MessageAlert.tsx +33 -0
  279. package/themes/business/src/components/PrinterEdition/index.tsx +431 -363
  280. package/themes/business/src/components/PrinterEdition/printerList.tsx +23 -0
  281. package/themes/business/src/components/PrinterEdition/styles.tsx +61 -61
  282. package/themes/business/src/components/PrinterSettings/index.tsx +267 -267
  283. package/themes/business/src/components/PrinterSettings/styles.tsx +30 -30
  284. package/themes/business/src/components/ProductItemAccordion/index.tsx +326 -325
  285. package/themes/business/src/components/ProductItemAccordion/styles.tsx +61 -61
  286. package/themes/business/src/components/ReviewCustomer/index.tsx +344 -342
  287. package/themes/business/src/components/ReviewCustomer/styles.tsx +28 -28
  288. package/themes/business/src/components/ScheduleBlocked/index.tsx +53 -53
  289. package/themes/business/src/components/SearchBar/index.tsx +113 -113
  290. package/themes/business/src/components/Sessions/index.tsx +187 -187
  291. package/themes/business/src/components/Sessions/styles.tsx +20 -20
  292. package/themes/business/src/components/SignupForm/index.tsx +530 -530
  293. package/themes/business/src/components/SignupForm/styles.tsx +16 -16
  294. package/themes/business/src/components/StoresList/index.tsx +225 -225
  295. package/themes/business/src/components/StoresList/styles.tsx +26 -26
  296. package/themes/business/src/components/UserFormDetails/index.tsx +520 -520
  297. package/themes/business/src/components/UserFormDetails/styles.tsx +40 -40
  298. package/themes/business/src/components/UserProfileForm/index.tsx +608 -570
  299. package/themes/business/src/components/UserProfileForm/styles.tsx +43 -36
  300. package/themes/business/src/components/VerifyPhone/index.tsx +201 -201
  301. package/themes/business/src/components/VerifyPhone/styles.tsx +43 -43
  302. package/themes/business/src/components/WebsocketStatus/index.tsx +171 -171
  303. package/themes/business/src/components/WebsocketStatus/styles.tsx +28 -28
  304. package/themes/business/src/components/shared/OAlert.tsx +52 -52
  305. package/themes/business/src/components/shared/OButton.tsx +148 -148
  306. package/themes/business/src/components/shared/OChatBubble.tsx +100 -100
  307. package/themes/business/src/components/shared/ODropDown.tsx +229 -229
  308. package/themes/business/src/components/shared/ODropDownCalendar.tsx +359 -359
  309. package/themes/business/src/components/shared/OFab.tsx +54 -54
  310. package/themes/business/src/components/shared/OIcon.tsx +67 -67
  311. package/themes/business/src/components/shared/OIconButton.tsx +127 -127
  312. package/themes/business/src/components/shared/OInput.tsx +146 -146
  313. package/themes/business/src/components/shared/OLink.tsx +96 -96
  314. package/themes/business/src/components/shared/OSegment.tsx +86 -86
  315. package/themes/business/src/components/shared/OText.tsx +61 -61
  316. package/themes/business/src/components/shared/OTextarea.tsx +46 -46
  317. package/themes/business/src/components/shared/OToast.tsx +92 -92
  318. package/themes/business/src/components/shared/index.tsx +27 -27
  319. package/themes/business/src/config/constants.tsx +10 -10
  320. package/themes/business/src/config/currency.tsx +1010 -0
  321. package/themes/business/src/hooks/useLocation.tsx +114 -110
  322. package/themes/business/src/layouts/Container.tsx +56 -56
  323. package/themes/business/src/layouts/SafeAreaContainer.tsx +65 -49
  324. package/themes/business/src/providers/AlertProvider.tsx +38 -38
  325. package/themes/business/src/providers/Responsive.tsx +15 -15
  326. package/themes/business/src/providers/StoreUtil.tsx +54 -54
  327. package/themes/business/src/types/@react-navigation/material-bottom-tabs/index.d.ts +1 -1
  328. package/themes/business/src/types/index.tsx +656 -641
  329. package/themes/business/src/types/ordering-api-sdk/index.d.ts +1 -1
  330. package/themes/business/src/types/ordering-components/index.d.ts +1 -1
  331. package/themes/business/src/types/react-hook-form/index.d.ts +1 -1
  332. package/themes/business/src/types/react-native-credit-card-input/index.d.ts +1 -1
  333. package/themes/business/src/types/react-native-fbsdk/index.d.ts +1 -1
  334. package/themes/business/src/types/react-native-gesture-handler/index.d.ts +1 -1
  335. package/themes/business/src/types/react-native-html-to-pdf/index.d.ts +1 -1
  336. package/themes/business/src/types/react-native-loading-spinner-overlay/index.d.ts +1 -1
  337. package/themes/business/src/types/react-native-vector-icons/index.d.ts +5 -5
  338. package/themes/business/src/types/styled-components/index.d.ts +1 -1
  339. package/themes/business/src/types/toggle-switch-react-native/index.d.ts +1 -1
  340. package/themes/business/src/utils/index.tsx +428 -403
  341. package/themes/doordash/index.tsx +103 -103
  342. package/themes/doordash/src/components/ActiveOrders/index.tsx +120 -120
  343. package/themes/doordash/src/components/ActiveOrders/styles.tsx +43 -43
  344. package/themes/doordash/src/components/AddressDetails/index.tsx +72 -72
  345. package/themes/doordash/src/components/AddressDetails/styles.tsx +26 -26
  346. package/themes/doordash/src/components/AddressForm/index.tsx +669 -669
  347. package/themes/doordash/src/components/AddressForm/styles.tsx +38 -38
  348. package/themes/doordash/src/components/AddressList/index.tsx +332 -332
  349. package/themes/doordash/src/components/AddressList/styles.tsx +22 -22
  350. package/themes/doordash/src/components/AppleLogin/index.tsx +130 -130
  351. package/themes/doordash/src/components/AppleLogin/styles.tsx +5 -5
  352. package/themes/doordash/src/components/BusinessBasicInformation/index.tsx +221 -221
  353. package/themes/doordash/src/components/BusinessBasicInformation/styles.tsx +35 -35
  354. package/themes/doordash/src/components/BusinessController/index.tsx +183 -183
  355. package/themes/doordash/src/components/BusinessController/styles.tsx +49 -49
  356. package/themes/doordash/src/components/BusinessInformation/index.tsx +113 -113
  357. package/themes/doordash/src/components/BusinessInformation/styles.tsx +36 -36
  358. package/themes/doordash/src/components/BusinessItemAccordion/index.tsx +126 -126
  359. package/themes/doordash/src/components/BusinessItemAccordion/styles.tsx +62 -62
  360. package/themes/doordash/src/components/BusinessProductsCategories/index.tsx +139 -139
  361. package/themes/doordash/src/components/BusinessProductsCategories/styles.tsx +7 -7
  362. package/themes/doordash/src/components/BusinessProductsList/index.tsx +221 -221
  363. package/themes/doordash/src/components/BusinessProductsList/styles.tsx +13 -13
  364. package/themes/doordash/src/components/BusinessProductsListing/index.tsx +425 -425
  365. package/themes/doordash/src/components/BusinessProductsListing/styles.tsx +61 -61
  366. package/themes/doordash/src/components/BusinessReviews/index.tsx +122 -122
  367. package/themes/doordash/src/components/BusinessReviews/styles.tsx +34 -34
  368. package/themes/doordash/src/components/BusinessTypeFilter/index.tsx +130 -130
  369. package/themes/doordash/src/components/BusinessTypeFilter/styles.tsx +42 -42
  370. package/themes/doordash/src/components/BusinessesListing/index.tsx +304 -304
  371. package/themes/doordash/src/components/BusinessesListing/styles.tsx +68 -68
  372. package/themes/doordash/src/components/BusinessesSortBy/index.tsx +25 -25
  373. package/themes/doordash/src/components/BusinessesSortBy/styles.ts +19 -19
  374. package/themes/doordash/src/components/Cart/index.tsx +333 -333
  375. package/themes/doordash/src/components/Cart/styles.tsx +28 -28
  376. package/themes/doordash/src/components/CartContent/index.tsx +56 -56
  377. package/themes/doordash/src/components/CartContent/styles.tsx +19 -19
  378. package/themes/doordash/src/components/Checkout/index.tsx +643 -643
  379. package/themes/doordash/src/components/Checkout/styles.tsx +95 -95
  380. package/themes/doordash/src/components/CouponControl/index.tsx +122 -122
  381. package/themes/doordash/src/components/CouponControl/styles.tsx +23 -23
  382. package/themes/doordash/src/components/DriverTips/index.tsx +171 -171
  383. package/themes/doordash/src/components/DriverTips/styles.tsx +62 -62
  384. package/themes/doordash/src/components/FacebookLogin/index.tsx +124 -124
  385. package/themes/doordash/src/components/FacebookLogin/styles.tsx +21 -21
  386. package/themes/doordash/src/components/FloatingButton/index.tsx +72 -72
  387. package/themes/doordash/src/components/FloatingButton/styles.tsx +28 -28
  388. package/themes/doordash/src/components/ForgotPasswordForm/index.tsx +151 -151
  389. package/themes/doordash/src/components/ForgotPasswordForm/styles.tsx +17 -17
  390. package/themes/doordash/src/components/GoogleLogin/index.tsx +117 -117
  391. package/themes/doordash/src/components/GoogleLogin/styles.tsx +21 -21
  392. package/themes/doordash/src/components/GoogleMap/index.tsx +233 -233
  393. package/themes/doordash/src/components/Help/index.tsx +54 -54
  394. package/themes/doordash/src/components/Help/styles.tsx +11 -11
  395. package/themes/doordash/src/components/HelpAccountAndPayment/index.tsx +67 -67
  396. package/themes/doordash/src/components/HelpAccountAndPayment/styles.tsx +6 -6
  397. package/themes/doordash/src/components/HelpGuide/index.tsx +66 -66
  398. package/themes/doordash/src/components/HelpGuide/styles.tsx +6 -6
  399. package/themes/doordash/src/components/HelpOrder/index.tsx +78 -78
  400. package/themes/doordash/src/components/HelpOrder/styles.tsx +5 -5
  401. package/themes/doordash/src/components/Home/index.tsx +211 -211
  402. package/themes/doordash/src/components/Home/styles.tsx +21 -21
  403. package/themes/doordash/src/components/LanguageSelector/index.tsx +109 -109
  404. package/themes/doordash/src/components/LanguageSelector/styles.tsx +7 -7
  405. package/themes/doordash/src/components/LastOrders/index.tsx +102 -102
  406. package/themes/doordash/src/components/LastOrders/styles.tsx +17 -17
  407. package/themes/doordash/src/components/LoginForm/index.tsx +514 -515
  408. package/themes/doordash/src/components/LoginForm/styles.tsx +78 -78
  409. package/themes/doordash/src/components/LogoutButton/index.tsx +57 -57
  410. package/themes/doordash/src/components/Messages/index.tsx +461 -461
  411. package/themes/doordash/src/components/Messages/styles.tsx +24 -24
  412. package/themes/doordash/src/components/MomentOption/index.tsx +237 -237
  413. package/themes/doordash/src/components/MomentOption/styles.tsx +62 -62
  414. package/themes/doordash/src/components/NavBar/index.tsx +125 -125
  415. package/themes/doordash/src/components/NotFoundSource/index.tsx +51 -51
  416. package/themes/doordash/src/components/NotFoundSource/styles.tsx +16 -16
  417. package/themes/doordash/src/components/OrderDetails/index.tsx +491 -491
  418. package/themes/doordash/src/components/OrderDetails/styles.tsx +128 -128
  419. package/themes/doordash/src/components/OrderSummary/index.tsx +318 -318
  420. package/themes/doordash/src/components/OrderSummary/styles.tsx +37 -37
  421. package/themes/doordash/src/components/OrderTypeSelector/index.tsx +122 -122
  422. package/themes/doordash/src/components/OrderTypeSelector/styles.tsx +6 -6
  423. package/themes/doordash/src/components/OrdersOption/index.tsx +225 -225
  424. package/themes/doordash/src/components/OrdersOption/styles.tsx +4 -4
  425. package/themes/doordash/src/components/PaymentOptionCash/index.tsx +102 -102
  426. package/themes/doordash/src/components/PaymentOptionCash/styles.tsx +18 -18
  427. package/themes/doordash/src/components/PaymentOptionStripe/index.tsx +232 -232
  428. package/themes/doordash/src/components/PaymentOptionStripe/styles.tsx +73 -73
  429. package/themes/doordash/src/components/PaymentOptions/index.tsx +511 -511
  430. package/themes/doordash/src/components/PaymentOptions/styles.tsx +51 -51
  431. package/themes/doordash/src/components/PaypalPaymethod/index.tsx +38 -38
  432. package/themes/doordash/src/components/PhoneInputNumber/index.tsx +113 -113
  433. package/themes/doordash/src/components/PhoneInputNumber/styles.tsx +5 -5
  434. package/themes/doordash/src/components/PreviousOrders/index.tsx +135 -135
  435. package/themes/doordash/src/components/PreviousOrders/styles.tsx +36 -36
  436. package/themes/doordash/src/components/ProductForm/index.tsx +439 -439
  437. package/themes/doordash/src/components/ProductForm/styles.tsx +76 -76
  438. package/themes/doordash/src/components/ProductIngredient/index.tsx +44 -44
  439. package/themes/doordash/src/components/ProductIngredient/styles.tsx +7 -7
  440. package/themes/doordash/src/components/ProductItemAccordion/index.tsx +294 -294
  441. package/themes/doordash/src/components/ProductItemAccordion/styles.tsx +56 -56
  442. package/themes/doordash/src/components/ProductOption/index.tsx +55 -55
  443. package/themes/doordash/src/components/ProductOption/styles.tsx +13 -13
  444. package/themes/doordash/src/components/ProductOptionSubOption/index.tsx +137 -137
  445. package/themes/doordash/src/components/ProductOptionSubOption/styles.tsx +34 -34
  446. package/themes/doordash/src/components/ReviewOrder/index.tsx +202 -202
  447. package/themes/doordash/src/components/ReviewOrder/styles.tsx +36 -36
  448. package/themes/doordash/src/components/SearchBar/index.tsx +105 -105
  449. package/themes/doordash/src/components/SignupForm/index.tsx +580 -580
  450. package/themes/doordash/src/components/SignupForm/styles.tsx +32 -32
  451. package/themes/doordash/src/components/SingleProductCard/index.tsx +96 -96
  452. package/themes/doordash/src/components/SingleProductCard/styles.tsx +22 -22
  453. package/themes/doordash/src/components/SocialShare/index.tsx +160 -160
  454. package/themes/doordash/src/components/SocialShare/styles.ts +20 -20
  455. package/themes/doordash/src/components/StripeCardForm/index.tsx +97 -97
  456. package/themes/doordash/src/components/StripeCardForm/naked.tsx +128 -128
  457. package/themes/doordash/src/components/StripeCardForm/styles.tsx +32 -32
  458. package/themes/doordash/src/components/StripeCardsList/index.tsx +130 -130
  459. package/themes/doordash/src/components/StripeElementsForm/index.tsx +195 -195
  460. package/themes/doordash/src/components/StripeElementsForm/naked.tsx +90 -90
  461. package/themes/doordash/src/components/StripeElementsForm/styles.tsx +13 -13
  462. package/themes/doordash/src/components/StripeRedirectForm/index.tsx +157 -157
  463. package/themes/doordash/src/components/StripeRedirectForm/styles.tsx +23 -23
  464. package/themes/doordash/src/components/TaxInformation/index.tsx +51 -51
  465. package/themes/doordash/src/components/TaxInformation/styles.tsx +9 -9
  466. package/themes/doordash/src/components/UpsellingProducts/index.tsx +184 -184
  467. package/themes/doordash/src/components/UpsellingProducts/styles.tsx +39 -39
  468. package/themes/doordash/src/components/UserDetails/index.tsx +124 -124
  469. package/themes/doordash/src/components/UserDetails/styles.tsx +24 -24
  470. package/themes/doordash/src/components/UserFormDetails/index.tsx +268 -268
  471. package/themes/doordash/src/components/UserFormDetails/styles.tsx +37 -37
  472. package/themes/doordash/src/components/UserProfileForm/index.tsx +354 -354
  473. package/themes/doordash/src/components/UserProfileForm/styles.tsx +40 -40
  474. package/themes/doordash/src/components/VerifyPhone/index.tsx +185 -185
  475. package/themes/doordash/src/components/VerifyPhone/styles.tsx +43 -43
  476. package/themes/doordash/src/components/shared/OAlert.tsx +55 -55
  477. package/themes/doordash/src/components/shared/OBottomPopup.tsx +75 -75
  478. package/themes/doordash/src/components/shared/OButton.tsx +139 -139
  479. package/themes/doordash/src/components/shared/OButtonGroup.tsx +53 -53
  480. package/themes/doordash/src/components/shared/OChatBubble.tsx +53 -53
  481. package/themes/doordash/src/components/shared/OCheckbox.tsx +79 -79
  482. package/themes/doordash/src/components/shared/ODropDown.tsx +167 -167
  483. package/themes/doordash/src/components/shared/OIcon.tsx +54 -54
  484. package/themes/doordash/src/components/shared/OIconButton.tsx +135 -135
  485. package/themes/doordash/src/components/shared/OIconText.tsx +53 -53
  486. package/themes/doordash/src/components/shared/OInput.tsx +126 -126
  487. package/themes/doordash/src/components/shared/OKeyButton.tsx +34 -34
  488. package/themes/doordash/src/components/shared/OModal.tsx +173 -173
  489. package/themes/doordash/src/components/shared/OText.tsx +52 -52
  490. package/themes/doordash/src/components/shared/OTextarea.tsx +35 -35
  491. package/themes/doordash/src/components/shared/OToast.tsx +93 -93
  492. package/themes/doordash/src/components/shared/OToggle.tsx +157 -157
  493. package/themes/doordash/src/components/shared/index.tsx +37 -37
  494. package/themes/doordash/src/config/constants.tsx +14 -14
  495. package/themes/doordash/src/layouts/Container.tsx +26 -26
  496. package/themes/doordash/src/layouts/SafeAreaContainer.tsx +6 -6
  497. package/themes/doordash/src/providers/AlertProvider.tsx +49 -49
  498. package/themes/doordash/src/providers/StoreUtil.tsx +50 -50
  499. package/themes/doordash/src/types/index.tsx +435 -435
  500. package/themes/doordash/src/utils/index.tsx +192 -192
  501. package/themes/instacart/index.tsx +88 -88
  502. package/themes/instacart/src/components/ActiveOrders/index.tsx +135 -135
  503. package/themes/instacart/src/components/ActiveOrders/styles.tsx +51 -51
  504. package/themes/instacart/src/components/AddressDetails/index.tsx +69 -69
  505. package/themes/instacart/src/components/AddressDetails/styles.tsx +22 -22
  506. package/themes/instacart/src/components/AddressForm/index.tsx +664 -664
  507. package/themes/instacart/src/components/AddressForm/styles.tsx +33 -33
  508. package/themes/instacart/src/components/AddressList/index.tsx +326 -326
  509. package/themes/instacart/src/components/AddressList/styles.tsx +20 -20
  510. package/themes/instacart/src/components/BusinessBasicInformation/index.tsx +261 -261
  511. package/themes/instacart/src/components/BusinessBasicInformation/styles.tsx +43 -43
  512. package/themes/instacart/src/components/BusinessController/index.tsx +205 -205
  513. package/themes/instacart/src/components/BusinessController/styles.tsx +53 -53
  514. package/themes/instacart/src/components/BusinessInformation/index.tsx +101 -101
  515. package/themes/instacart/src/components/BusinessInformation/styles.tsx +35 -35
  516. package/themes/instacart/src/components/BusinessItemAccordion/index.tsx +112 -112
  517. package/themes/instacart/src/components/BusinessItemAccordion/styles.tsx +59 -59
  518. package/themes/instacart/src/components/BusinessProductsCategories/index.tsx +71 -71
  519. package/themes/instacart/src/components/BusinessProductsCategories/styles.tsx +7 -7
  520. package/themes/instacart/src/components/BusinessProductsList/index.tsx +181 -181
  521. package/themes/instacart/src/components/BusinessProductsList/styles.tsx +19 -19
  522. package/themes/instacart/src/components/BusinessProductsListing/index.tsx +372 -372
  523. package/themes/instacart/src/components/BusinessProductsListing/styles.tsx +35 -35
  524. package/themes/instacart/src/components/BusinessReviews/index.tsx +121 -121
  525. package/themes/instacart/src/components/BusinessReviews/styles.tsx +33 -33
  526. package/themes/instacart/src/components/BusinessTypeFilter/index.tsx +135 -135
  527. package/themes/instacart/src/components/BusinessTypeFilter/styles.tsx +30 -30
  528. package/themes/instacart/src/components/BusinessesListing/index.tsx +254 -254
  529. package/themes/instacart/src/components/BusinessesListing/styles.tsx +62 -62
  530. package/themes/instacart/src/components/Cart/index.tsx +357 -357
  531. package/themes/instacart/src/components/Cart/styles.tsx +39 -39
  532. package/themes/instacart/src/components/CartContent/index.tsx +51 -51
  533. package/themes/instacart/src/components/CartContent/styles.tsx +19 -19
  534. package/themes/instacart/src/components/CartSingle/index.tsx +194 -194
  535. package/themes/instacart/src/components/CartSingle/styles.tsx +55 -55
  536. package/themes/instacart/src/components/Checkout/index.tsx +632 -632
  537. package/themes/instacart/src/components/Checkout/styles.tsx +105 -105
  538. package/themes/instacart/src/components/CouponControl/index.tsx +121 -121
  539. package/themes/instacart/src/components/CouponControl/styles.tsx +23 -23
  540. package/themes/instacart/src/components/DriverTips/index.tsx +153 -153
  541. package/themes/instacart/src/components/DriverTips/styles.tsx +58 -58
  542. package/themes/instacart/src/components/FacebookLogin/index.tsx +117 -117
  543. package/themes/instacart/src/components/FacebookLogin/styles.tsx +16 -16
  544. package/themes/instacart/src/components/FloatingButton/index.tsx +81 -81
  545. package/themes/instacart/src/components/FloatingButton/styles.tsx +30 -30
  546. package/themes/instacart/src/components/ForgotPasswordForm/index.tsx +155 -155
  547. package/themes/instacart/src/components/ForgotPasswordForm/styles.tsx +11 -11
  548. package/themes/instacart/src/components/GoogleMap/index.tsx +236 -236
  549. package/themes/instacart/src/components/Home/index.tsx +337 -337
  550. package/themes/instacart/src/components/Home/styles.tsx +24 -24
  551. package/themes/instacart/src/components/LanguageSelector/index.tsx +109 -109
  552. package/themes/instacart/src/components/LanguageSelector/styles.tsx +7 -7
  553. package/themes/instacart/src/components/LoginForm/index.tsx +445 -445
  554. package/themes/instacart/src/components/LoginForm/styles.tsx +69 -69
  555. package/themes/instacart/src/components/LogoutButton/index.tsx +61 -61
  556. package/themes/instacart/src/components/Messages/index.tsx +430 -430
  557. package/themes/instacart/src/components/Messages/styles.tsx +23 -23
  558. package/themes/instacart/src/components/MomentOption/index.tsx +320 -320
  559. package/themes/instacart/src/components/MomentOption/styles.tsx +71 -71
  560. package/themes/instacart/src/components/NavBar/index.tsx +131 -131
  561. package/themes/instacart/src/components/NotFoundSource/index.tsx +55 -55
  562. package/themes/instacart/src/components/NotFoundSource/styles.tsx +16 -16
  563. package/themes/instacart/src/components/OrderDetails/index.tsx +531 -531
  564. package/themes/instacart/src/components/OrderDetails/styles.tsx +146 -146
  565. package/themes/instacart/src/components/OrderSummary/index.tsx +297 -297
  566. package/themes/instacart/src/components/OrderSummary/styles.tsx +41 -41
  567. package/themes/instacart/src/components/OrderTypeSelector/index.tsx +130 -130
  568. package/themes/instacart/src/components/OrderTypeSelector/styles.tsx +6 -6
  569. package/themes/instacart/src/components/OrdersOption/index.tsx +222 -222
  570. package/themes/instacart/src/components/OrdersOption/styles.tsx +3 -3
  571. package/themes/instacart/src/components/PaymentOptionCash/index.tsx +102 -102
  572. package/themes/instacart/src/components/PaymentOptionCash/styles.tsx +15 -15
  573. package/themes/instacart/src/components/PaymentOptionStripe/index.tsx +232 -232
  574. package/themes/instacart/src/components/PaymentOptionStripe/styles.tsx +62 -62
  575. package/themes/instacart/src/components/PaymentOptions/index.tsx +496 -496
  576. package/themes/instacart/src/components/PaymentOptions/styles.tsx +43 -43
  577. package/themes/instacart/src/components/PaypalPaymethod/index.tsx +38 -38
  578. package/themes/instacart/src/components/PhoneInputNumber/index.tsx +112 -112
  579. package/themes/instacart/src/components/PhoneInputNumber/styles.tsx +5 -5
  580. package/themes/instacart/src/components/PreviousOrders/index.tsx +134 -134
  581. package/themes/instacart/src/components/PreviousOrders/styles.tsx +38 -38
  582. package/themes/instacart/src/components/ProductForm/index.tsx +444 -444
  583. package/themes/instacart/src/components/ProductForm/styles.tsx +73 -73
  584. package/themes/instacart/src/components/ProductIngredient/index.tsx +44 -44
  585. package/themes/instacart/src/components/ProductIngredient/styles.tsx +7 -7
  586. package/themes/instacart/src/components/ProductItemAccordion/index.tsx +285 -285
  587. package/themes/instacart/src/components/ProductItemAccordion/styles.tsx +52 -52
  588. package/themes/instacart/src/components/ProductOption/index.tsx +49 -49
  589. package/themes/instacart/src/components/ProductOption/styles.tsx +12 -12
  590. package/themes/instacart/src/components/ProductOptionSubOption/index.tsx +146 -146
  591. package/themes/instacart/src/components/ProductOptionSubOption/styles.tsx +33 -33
  592. package/themes/instacart/src/components/ReviewDriver/index.tsx +221 -221
  593. package/themes/instacart/src/components/ReviewDriver/styles.tsx +45 -45
  594. package/themes/instacart/src/components/ReviewOrder/index.tsx +325 -325
  595. package/themes/instacart/src/components/ReviewOrder/styles.tsx +45 -45
  596. package/themes/instacart/src/components/ReviewProduct/index.tsx +275 -275
  597. package/themes/instacart/src/components/ReviewProduct/styles.tsx +52 -52
  598. package/themes/instacart/src/components/SearchBar/index.tsx +104 -104
  599. package/themes/instacart/src/components/SearchList/index.tsx +357 -357
  600. package/themes/instacart/src/components/SearchList/styles.tsx +61 -61
  601. package/themes/instacart/src/components/SignupForm/index.tsx +587 -587
  602. package/themes/instacart/src/components/SignupForm/styles.tsx +39 -39
  603. package/themes/instacart/src/components/SingleProductCard/index.tsx +104 -104
  604. package/themes/instacart/src/components/SingleProductCard/styles.tsx +19 -19
  605. package/themes/instacart/src/components/SocialShare/index.tsx +160 -160
  606. package/themes/instacart/src/components/SocialShare/styles.ts +20 -20
  607. package/themes/instacart/src/components/StripeCardForm/index.tsx +97 -97
  608. package/themes/instacart/src/components/StripeCardForm/naked.tsx +128 -128
  609. package/themes/instacart/src/components/StripeCardForm/styles.tsx +27 -27
  610. package/themes/instacart/src/components/StripeCardsList/index.tsx +144 -144
  611. package/themes/instacart/src/components/StripeElementsForm/index.tsx +192 -192
  612. package/themes/instacart/src/components/StripeElementsForm/naked.tsx +90 -90
  613. package/themes/instacart/src/components/StripeElementsForm/styles.tsx +9 -9
  614. package/themes/instacart/src/components/StripeRedirectForm/index.tsx +159 -159
  615. package/themes/instacart/src/components/StripeRedirectForm/styles.tsx +23 -23
  616. package/themes/instacart/src/components/TagSelector/index.tsx +94 -94
  617. package/themes/instacart/src/components/TaxInformation/index.tsx +51 -51
  618. package/themes/instacart/src/components/TaxInformation/styles.tsx +9 -9
  619. package/themes/instacart/src/components/UpsellingProducts/index.tsx +230 -230
  620. package/themes/instacart/src/components/UpsellingProducts/styles.tsx +31 -31
  621. package/themes/instacart/src/components/UserDetails/index.tsx +135 -135
  622. package/themes/instacart/src/components/UserDetails/styles.tsx +21 -21
  623. package/themes/instacart/src/components/UserFormDetails/index.tsx +307 -307
  624. package/themes/instacart/src/components/UserFormDetails/styles.tsx +38 -38
  625. package/themes/instacart/src/components/UserProfileForm/index.tsx +106 -106
  626. package/themes/instacart/src/components/UserProfileForm/styles.tsx +37 -37
  627. package/themes/instacart/src/components/VerifyPhone/index.tsx +187 -187
  628. package/themes/instacart/src/components/VerifyPhone/styles.tsx +43 -43
  629. package/themes/instacart/src/components/shared/OAlert.tsx +53 -53
  630. package/themes/instacart/src/components/shared/OBottomPopup.tsx +118 -118
  631. package/themes/instacart/src/components/shared/OBottomStickBar.tsx +62 -62
  632. package/themes/instacart/src/components/shared/OButton.tsx +133 -133
  633. package/themes/instacart/src/components/shared/ODropDown.tsx +170 -170
  634. package/themes/instacart/src/components/shared/OIcon.tsx +53 -53
  635. package/themes/instacart/src/components/shared/OIconButton.tsx +134 -134
  636. package/themes/instacart/src/components/shared/OInput.tsx +122 -122
  637. package/themes/instacart/src/components/shared/OModal.tsx +156 -156
  638. package/themes/instacart/src/components/shared/OText.tsx +58 -58
  639. package/themes/instacart/src/components/shared/OToast.tsx +92 -92
  640. package/themes/instacart/src/components/shared/index.tsx +23 -23
  641. package/themes/instacart/src/config/constants.tsx +28 -28
  642. package/themes/instacart/src/layouts/Container.tsx +29 -29
  643. package/themes/instacart/src/layouts/SafeAreaContainer.tsx +6 -6
  644. package/themes/instacart/src/providers/AlertProvider.tsx +43 -43
  645. package/themes/instacart/src/providers/CartBottomSheetProvider.tsx +37 -37
  646. package/themes/instacart/src/providers/StoreUtil.tsx +50 -50
  647. package/themes/instacart/src/types/index.tsx +458 -458
  648. package/themes/instacart/src/utils/index.tsx +192 -192
  649. package/themes/kiosk/index.tsx +130 -130
  650. package/themes/kiosk/src/components/BusinessController/index.tsx +88 -88
  651. package/themes/kiosk/src/components/BusinessController/styles.tsx +23 -23
  652. package/themes/kiosk/src/components/BusinessItemAccordion/index.tsx +137 -137
  653. package/themes/kiosk/src/components/BusinessItemAccordion/styles.tsx +60 -60
  654. package/themes/kiosk/src/components/BusinessMenu/index.tsx +174 -174
  655. package/themes/kiosk/src/components/BusinessProductsListing/index.tsx +254 -254
  656. package/themes/kiosk/src/components/BusinessProductsListing/styles.tsx +35 -35
  657. package/themes/kiosk/src/components/BusinessesListing/index.tsx +119 -119
  658. package/themes/kiosk/src/components/BusinessesListing/styles.tsx +24 -24
  659. package/themes/kiosk/src/components/Cart/index.tsx +489 -489
  660. package/themes/kiosk/src/components/Cart/styles.tsx +76 -76
  661. package/themes/kiosk/src/components/CartBottomSheet/index.tsx +281 -281
  662. package/themes/kiosk/src/components/CartBottomSheet/styles.tsx +53 -53
  663. package/themes/kiosk/src/components/CartContent/index.tsx +75 -75
  664. package/themes/kiosk/src/components/CartContent/styles.tsx +15 -15
  665. package/themes/kiosk/src/components/CartItem/index.tsx +222 -222
  666. package/themes/kiosk/src/components/CartItem/styles.tsx +33 -33
  667. package/themes/kiosk/src/components/CategoriesMenu/index.tsx +281 -281
  668. package/themes/kiosk/src/components/Checkout/index.tsx +175 -171
  669. package/themes/kiosk/src/components/Checkout/styles.tsx +94 -94
  670. package/themes/kiosk/src/components/CouponControl/index.tsx +138 -138
  671. package/themes/kiosk/src/components/CouponControl/styles.tsx +22 -22
  672. package/themes/kiosk/src/components/CustomerName/index.tsx +175 -175
  673. package/themes/kiosk/src/components/CustomerName/styles.tsx +10 -10
  674. package/themes/kiosk/src/components/DrawerView/index.tsx +58 -58
  675. package/themes/kiosk/src/components/DrawerView/styles.tsx +30 -30
  676. package/themes/kiosk/src/components/Intro/index.tsx +165 -165
  677. package/themes/kiosk/src/components/LanguageSelector/index.tsx +131 -131
  678. package/themes/kiosk/src/components/LanguageSelector/lang_country.json +140 -140
  679. package/themes/kiosk/src/components/LanguageSelector/styles.tsx +12 -12
  680. package/themes/kiosk/src/components/LoginForm/Otp/index.tsx +92 -92
  681. package/themes/kiosk/src/components/LoginForm/Otp/styles.tsx +7 -7
  682. package/themes/kiosk/src/components/LoginForm/index.tsx +795 -795
  683. package/themes/kiosk/src/components/LoginForm/styles.tsx +27 -27
  684. package/themes/kiosk/src/components/LogoutButton/index.tsx +74 -74
  685. package/themes/kiosk/src/components/LogoutPopup/index.tsx +185 -185
  686. package/themes/kiosk/src/components/LogoutPopup/styles.tsx +26 -26
  687. package/themes/kiosk/src/components/NavBar/index.tsx +147 -147
  688. package/themes/kiosk/src/components/NetworkError/index.tsx +60 -60
  689. package/themes/kiosk/src/components/NetworkError/styles.tsx +10 -10
  690. package/themes/kiosk/src/components/NotFoundSource/index.tsx +51 -51
  691. package/themes/kiosk/src/components/NotFoundSource/styles.tsx +16 -16
  692. package/themes/kiosk/src/components/OptionCard/index.tsx +107 -107
  693. package/themes/kiosk/src/components/OptionCard/styles.tsx +22 -22
  694. package/themes/kiosk/src/components/OrderDetails/index.tsx +693 -693
  695. package/themes/kiosk/src/components/OrderDetails/styles.tsx +58 -58
  696. package/themes/kiosk/src/components/OrderSummary/index.tsx +195 -195
  697. package/themes/kiosk/src/components/OrderSummary/styles.tsx +33 -33
  698. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +151 -153
  699. package/themes/kiosk/src/components/OrderTypeCardSelector/styles.tsx +6 -6
  700. package/themes/kiosk/src/components/OrderTypeSelector/index.tsx +98 -98
  701. package/themes/kiosk/src/components/OrderTypeSelector/styles.tsx +6 -6
  702. package/themes/kiosk/src/components/PaymentOptionCash/index.tsx +100 -100
  703. package/themes/kiosk/src/components/PaymentOptionCash/styles.tsx +18 -18
  704. package/themes/kiosk/src/components/PaymentOptionStripe/index.tsx +70 -70
  705. package/themes/kiosk/src/components/PaymentOptionStripe/styles.tsx +7 -7
  706. package/themes/kiosk/src/components/PaymentOptions/index.tsx +281 -217
  707. package/themes/kiosk/src/components/PaymentOptions/styles.tsx +55 -55
  708. package/themes/kiosk/src/components/PhoneInputNumber/index.tsx +113 -113
  709. package/themes/kiosk/src/components/PhoneInputNumber/styles.tsx +3 -3
  710. package/themes/kiosk/src/components/ProductForm/index.tsx +588 -588
  711. package/themes/kiosk/src/components/ProductForm/styles.tsx +83 -83
  712. package/themes/kiosk/src/components/ProductIngredient/index.tsx +44 -44
  713. package/themes/kiosk/src/components/ProductIngredient/styles.tsx +7 -7
  714. package/themes/kiosk/src/components/ProductItemAccordion/index.tsx +244 -244
  715. package/themes/kiosk/src/components/ProductItemAccordion/styles.tsx +71 -71
  716. package/themes/kiosk/src/components/ProductOption/index.tsx +55 -55
  717. package/themes/kiosk/src/components/ProductOption/styles.tsx +16 -16
  718. package/themes/kiosk/src/components/ProductOptionSubOption/index.tsx +176 -176
  719. package/themes/kiosk/src/components/ProductOptionSubOption/styles.tsx +42 -42
  720. package/themes/kiosk/src/components/PromoCard/index.tsx +117 -117
  721. package/themes/kiosk/src/components/QuantityControl/index.tsx +92 -92
  722. package/themes/kiosk/src/components/QuantityControl/styles.tsx +9 -9
  723. package/themes/kiosk/src/components/UpsellingProducts/index.tsx +364 -364
  724. package/themes/kiosk/src/components/UpsellingProducts/styles.tsx +26 -26
  725. package/themes/kiosk/src/components/shared/OAlert.tsx +55 -55
  726. package/themes/kiosk/src/components/shared/OBottomPopup.tsx +77 -77
  727. package/themes/kiosk/src/components/shared/OButton.tsx +132 -145
  728. package/themes/kiosk/src/components/shared/OCard.tsx +144 -144
  729. package/themes/kiosk/src/components/shared/OChatBubble.tsx +52 -52
  730. package/themes/kiosk/src/components/shared/OCheckbox.tsx +77 -77
  731. package/themes/kiosk/src/components/shared/ODropDown.tsx +161 -161
  732. package/themes/kiosk/src/components/shared/OIcon.tsx +51 -51
  733. package/themes/kiosk/src/components/shared/OIconButton.tsx +134 -134
  734. package/themes/kiosk/src/components/shared/OIconText.tsx +53 -53
  735. package/themes/kiosk/src/components/shared/OImage.tsx +31 -31
  736. package/themes/kiosk/src/components/shared/OInput.tsx +121 -121
  737. package/themes/kiosk/src/components/shared/OKeyButton.tsx +34 -34
  738. package/themes/kiosk/src/components/shared/OModal.tsx +162 -162
  739. package/themes/kiosk/src/components/shared/OOptionToggle.tsx +130 -130
  740. package/themes/kiosk/src/components/shared/OSegment.tsx +66 -66
  741. package/themes/kiosk/src/components/shared/OText.tsx +51 -51
  742. package/themes/kiosk/src/components/shared/OTextarea.tsx +36 -36
  743. package/themes/kiosk/src/components/shared/OToast.tsx +94 -94
  744. package/themes/kiosk/src/components/shared/OToggle.tsx +157 -157
  745. package/themes/kiosk/src/components/shared/index.tsx +37 -37
  746. package/themes/kiosk/src/layouts/Container.tsx +45 -45
  747. package/themes/kiosk/src/layouts/GridContainer.tsx +25 -25
  748. package/themes/kiosk/src/layouts/SafeAreaContainer.tsx +6 -6
  749. package/themes/kiosk/src/providers/CartBottomSheetProvider.tsx +35 -35
  750. package/themes/kiosk/src/types/index.d.ts +497 -497
  751. package/themes/kiosk/src/utils/index.tsx +15 -15
  752. package/themes/original/index.tsx +360 -352
  753. package/themes/original/src/components/ActiveOrders/index.tsx +52 -52
  754. package/themes/original/src/components/ActiveOrders/styles.tsx +5 -5
  755. package/themes/original/src/components/AddressDetails/index.tsx +105 -105
  756. package/themes/original/src/components/AddressDetails/styles.tsx +21 -21
  757. package/themes/original/src/components/AddressForm/index.tsx +919 -919
  758. package/themes/original/src/components/AddressForm/styles.tsx +28 -28
  759. package/themes/original/src/components/AddressList/index.tsx +361 -374
  760. package/themes/original/src/components/AddressList/styles.tsx +21 -21
  761. package/themes/original/src/components/AnalyticsSegment/index.tsx +310 -310
  762. package/themes/original/src/components/AppleLogin/index.tsx +188 -188
  763. package/themes/original/src/components/AppleLogin/styles.tsx +23 -23
  764. package/themes/original/src/components/BottomWrapper/index.tsx +29 -29
  765. package/themes/original/src/components/BusinessBasicInformation/index.tsx +536 -536
  766. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +72 -72
  767. package/themes/original/src/components/BusinessCart/index.tsx +182 -182
  768. package/themes/original/src/components/BusinessCart/styles.tsx +46 -46
  769. package/themes/original/src/components/BusinessController/index.tsx +395 -395
  770. package/themes/original/src/components/BusinessController/styles.tsx +95 -95
  771. package/themes/original/src/components/BusinessFeaturedController/index.tsx +175 -175
  772. package/themes/original/src/components/BusinessFeaturedController/styles.tsx +81 -81
  773. package/themes/original/src/components/BusinessInformation/index.tsx +241 -241
  774. package/themes/original/src/components/BusinessInformation/styles.tsx +39 -39
  775. package/themes/original/src/components/BusinessItemAccordion/index.tsx +180 -172
  776. package/themes/original/src/components/BusinessItemAccordion/styles.tsx +64 -64
  777. package/themes/original/src/components/BusinessListingSearch/BusinessControllerSkeletons/index.tsx +57 -57
  778. package/themes/original/src/components/BusinessListingSearch/BusinessSearchFooter.tsx +328 -317
  779. package/themes/original/src/components/BusinessListingSearch/BusinessSearchHeader.tsx +98 -96
  780. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/index.tsx +59 -59
  781. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/styles.tsx +13 -13
  782. package/themes/original/src/components/BusinessListingSearch/index.tsx +285 -286
  783. package/themes/original/src/components/BusinessListingSearch/styles.tsx +76 -76
  784. package/themes/original/src/components/BusinessMenuList/index.tsx +135 -135
  785. package/themes/original/src/components/BusinessPreorder/index.tsx +602 -586
  786. package/themes/original/src/components/BusinessPreorder/styles.tsx +58 -58
  787. package/themes/original/src/components/BusinessProductsCategories/index.tsx +151 -151
  788. package/themes/original/src/components/BusinessProductsCategories/styles.tsx +7 -7
  789. package/themes/original/src/components/BusinessProductsList/CategoryDescription/index.tsx +44 -44
  790. package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/index.tsx +90 -87
  791. package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/styles.tsx +12 -12
  792. package/themes/original/src/components/BusinessProductsList/index.tsx +367 -368
  793. package/themes/original/src/components/BusinessProductsList/styles.tsx +49 -52
  794. package/themes/original/src/components/BusinessProductsListing/UpsellingRedirect.tsx +35 -35
  795. package/themes/original/src/components/BusinessProductsListing/index.tsx +754 -750
  796. package/themes/original/src/components/BusinessProductsListing/styles.tsx +68 -68
  797. package/themes/original/src/components/BusinessReviews/index.tsx +241 -241
  798. package/themes/original/src/components/BusinessReviews/styles.tsx +59 -59
  799. package/themes/original/src/components/BusinessTypeFilter/index.tsx +281 -280
  800. package/themes/original/src/components/BusinessTypeFilter/styles.tsx +43 -43
  801. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +562 -561
  802. package/themes/original/src/components/BusinessesListing/Layout/Appointment/styles.tsx +107 -107
  803. package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListFooter.tsx +69 -69
  804. package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListHeader.tsx +406 -406
  805. package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListing.tsx +76 -76
  806. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +329 -329
  807. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +129 -129
  808. package/themes/original/src/components/BusinessesListing/index.tsx +105 -106
  809. package/themes/original/src/components/Cart/index.tsx +660 -626
  810. package/themes/original/src/components/Cart/styles.tsx +39 -39
  811. package/themes/original/src/components/CartContent/index.tsx +203 -205
  812. package/themes/original/src/components/CartContent/styles.tsx +29 -29
  813. package/themes/original/src/components/CartStoresListing/index.tsx +98 -98
  814. package/themes/original/src/components/CartStoresListing/styles.tsx +30 -30
  815. package/themes/original/src/components/Checkout/index.tsx +1362 -1341
  816. package/themes/original/src/components/Checkout/styles.tsx +132 -132
  817. package/themes/original/src/components/CitiesControl/index.tsx +86 -89
  818. package/themes/original/src/components/CitiesControl/styles.tsx +17 -17
  819. package/themes/original/src/components/CouponControl/index.tsx +125 -127
  820. package/themes/original/src/components/CouponControl/styles.tsx +22 -22
  821. package/themes/original/src/components/DatePicker/index.tsx +33 -33
  822. package/themes/original/src/components/DatePicker/styles.tsx +20 -20
  823. package/themes/original/src/components/DriverTips/index.tsx +162 -164
  824. package/themes/original/src/components/DriverTips/styles.tsx +67 -67
  825. package/themes/original/src/components/FacebookLogin/index.tsx +122 -122
  826. package/themes/original/src/components/FacebookLogin/styles.tsx +23 -23
  827. package/themes/original/src/components/Favorite/index.tsx +94 -103
  828. package/themes/original/src/components/Favorite/styles.tsx +20 -20
  829. package/themes/original/src/components/FavoriteList/index.tsx +287 -288
  830. package/themes/original/src/components/FavoriteList/styles.tsx +5 -5
  831. package/themes/original/src/components/FloatingButton/index.tsx +100 -100
  832. package/themes/original/src/components/FloatingButton/styles.tsx +26 -26
  833. package/themes/original/src/components/ForgotPasswordForm/index.tsx +230 -237
  834. package/themes/original/src/components/ForgotPasswordForm/styles.tsx +11 -11
  835. package/themes/original/src/components/GPSButton/index.tsx +94 -94
  836. package/themes/original/src/components/GPSButton/styles.ts +6 -6
  837. package/themes/original/src/components/GiftCard/GiftCardOrdersList/index.tsx +63 -63
  838. package/themes/original/src/components/GiftCard/GiftCardOrdersList/styles.tsx +7 -7
  839. package/themes/original/src/components/GiftCard/GiftCardUI/index.tsx +99 -101
  840. package/themes/original/src/components/GiftCard/GiftCardUI/styles.tsx +5 -5
  841. package/themes/original/src/components/GiftCard/PurchaseGiftCard/index.tsx +129 -133
  842. package/themes/original/src/components/GiftCard/PurchaseGiftCard/styles.tsx +8 -8
  843. package/themes/original/src/components/GiftCard/RedeemGiftCard/index.tsx +246 -254
  844. package/themes/original/src/components/GiftCard/RedeemGiftCard/styles.tsx +8 -8
  845. package/themes/original/src/components/GiftCard/SendGiftCard/index.tsx +163 -165
  846. package/themes/original/src/components/GiftCard/SendGiftCard/styles.tsx +9 -9
  847. package/themes/original/src/components/GiftCard/SingleGiftCard/index.tsx +101 -101
  848. package/themes/original/src/components/GiftCard/SingleGiftCard/styles.tsx +4 -4
  849. package/themes/original/src/components/GiftCard/VerticalGiftCardOrdersLayout/index.tsx +82 -83
  850. package/themes/original/src/components/GiftCard/VerticalGiftCardOrdersLayout/styles.tsx +9 -9
  851. package/themes/original/src/components/GoogleLogin/index.tsx +119 -119
  852. package/themes/original/src/components/GoogleLogin/styles.tsx +23 -23
  853. package/themes/original/src/components/GoogleMap/index.tsx +315 -294
  854. package/themes/original/src/components/Help/index.tsx +74 -79
  855. package/themes/original/src/components/Help/styles.tsx +11 -11
  856. package/themes/original/src/components/HelpAccountAndPayment/index.tsx +62 -67
  857. package/themes/original/src/components/HelpAccountAndPayment/styles.tsx +12 -12
  858. package/themes/original/src/components/HelpGuide/index.tsx +68 -73
  859. package/themes/original/src/components/HelpGuide/styles.tsx +12 -12
  860. package/themes/original/src/components/HelpOrder/index.tsx +71 -76
  861. package/themes/original/src/components/HelpOrder/styles.tsx +13 -13
  862. package/themes/original/src/components/HighestRatedBusinesses/index.tsx +165 -165
  863. package/themes/original/src/components/HighestRatedBusinesses/styles.tsx +7 -7
  864. package/themes/original/src/components/Home/index.tsx +130 -114
  865. package/themes/original/src/components/Home/styles.tsx +18 -18
  866. package/themes/original/src/components/LanguageSelector/index.tsx +97 -97
  867. package/themes/original/src/components/LanguageSelector/styles.tsx +10 -10
  868. package/themes/original/src/components/LastOrder/index.tsx +138 -138
  869. package/themes/original/src/components/LastOrder/styles.tsx +16 -16
  870. package/themes/original/src/components/LastOrders/index.tsx +124 -124
  871. package/themes/original/src/components/LastOrders/styles.tsx +17 -17
  872. package/themes/original/src/components/LoginForm/Otp/index.tsx +158 -161
  873. package/themes/original/src/components/LoginForm/Otp/styles.tsx +6 -6
  874. package/themes/original/src/components/LoginForm/index.tsx +893 -895
  875. package/themes/original/src/components/LoginForm/styles.tsx +85 -85
  876. package/themes/original/src/components/LogoutButton/index.tsx +42 -42
  877. package/themes/original/src/components/LottieAnimation/index.tsx +103 -103
  878. package/themes/original/src/components/MessageListing/index.tsx +295 -300
  879. package/themes/original/src/components/MessageListing/styles.tsx +16 -16
  880. package/themes/original/src/components/Messages/index.tsx +593 -586
  881. package/themes/original/src/components/Messages/styles.tsx +40 -40
  882. package/themes/original/src/components/MomentOption/TimeListItem.tsx +56 -0
  883. package/themes/original/src/components/MomentOption/index.tsx +513 -499
  884. package/themes/original/src/components/MomentOption/styles.tsx +57 -57
  885. package/themes/original/src/components/MomentSelector/index.tsx +200 -197
  886. package/themes/original/src/components/MomentSelector/styles.tsx +6 -6
  887. package/themes/original/src/components/MultiCart/index.tsx +50 -50
  888. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +358 -357
  889. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/styles.tsx +46 -46
  890. package/themes/original/src/components/MultiCheckout/index.tsx +750 -722
  891. package/themes/original/src/components/MultiCheckout/styles.tsx +78 -78
  892. package/themes/original/src/components/MultiOrdersDetails/SingleOrderCard.tsx +185 -185
  893. package/themes/original/src/components/MultiOrdersDetails/index.tsx +315 -314
  894. package/themes/original/src/components/MultiOrdersDetails/styles.tsx +50 -50
  895. package/themes/original/src/components/MyOrders/index.tsx +216 -221
  896. package/themes/original/src/components/MyOrders/styles.tsx +13 -13
  897. package/themes/original/src/components/NavBar/index.tsx +142 -141
  898. package/themes/original/src/components/NetworkError/index.tsx +57 -62
  899. package/themes/original/src/components/NetworkError/styles.tsx +11 -11
  900. package/themes/original/src/components/NotFoundSource/index.tsx +52 -55
  901. package/themes/original/src/components/NotFoundSource/styles.tsx +16 -16
  902. package/themes/original/src/components/Notifications/index.tsx +140 -145
  903. package/themes/original/src/components/Notifications/styles.tsx +19 -19
  904. package/themes/original/src/components/OrderDetails/OrderEta.tsx +77 -76
  905. package/themes/original/src/components/OrderDetails/OrderHistory.tsx +188 -183
  906. package/themes/original/src/components/OrderDetails/index.tsx +1162 -1139
  907. package/themes/original/src/components/OrderDetails/styles.tsx +160 -161
  908. package/themes/original/src/components/OrderItAgain/index.tsx +77 -77
  909. package/themes/original/src/components/OrderItAgain/styles.tsx +10 -10
  910. package/themes/original/src/components/OrderProgress/index.tsx +237 -236
  911. package/themes/original/src/components/OrderProgress/styles.tsx +36 -36
  912. package/themes/original/src/components/OrderSummary/index.tsx +427 -406
  913. package/themes/original/src/components/OrderSummary/styles.tsx +48 -48
  914. package/themes/original/src/components/OrderTypeSelector/index.tsx +146 -150
  915. package/themes/original/src/components/OrderTypeSelector/styles.tsx +45 -45
  916. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/index.tsx +149 -149
  917. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/styles.tsx +6 -6
  918. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +56 -56
  919. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/styles.tsx +6 -6
  920. package/themes/original/src/components/OrdersOption/index.tsx +369 -372
  921. package/themes/original/src/components/OrdersOption/styles.tsx +14 -14
  922. package/themes/original/src/components/PageBanner/index.tsx +182 -182
  923. package/themes/original/src/components/PageBanner/styles.tsx +8 -8
  924. package/themes/original/src/components/PaymentOptionCard/index.tsx +182 -182
  925. package/themes/original/src/components/PaymentOptionCash/index.tsx +102 -102
  926. package/themes/original/src/components/PaymentOptionCash/styles.tsx +18 -18
  927. package/themes/original/src/components/PaymentOptionStripe/index.tsx +229 -234
  928. package/themes/original/src/components/PaymentOptionStripe/styles.tsx +72 -72
  929. package/themes/original/src/components/PaymentOptionWallet/index.tsx +174 -174
  930. package/themes/original/src/components/PaymentOptionWallet/styles.tsx +39 -39
  931. package/themes/original/src/components/PaymentOptions/index.tsx +578 -577
  932. package/themes/original/src/components/PaymentOptions/styles.tsx +55 -55
  933. package/themes/original/src/components/PhoneInputNumber/index.tsx +241 -156
  934. package/themes/original/src/components/PhoneInputNumber/styles.tsx +3 -3
  935. package/themes/original/src/components/PlaceSpot/index.tsx +314 -316
  936. package/themes/original/src/components/PlaceSpot/styles.tsx +9 -9
  937. package/themes/original/src/components/PreviousOrders/index.tsx +58 -61
  938. package/themes/original/src/components/PreviousOrders/styles.tsx +34 -34
  939. package/themes/original/src/components/ProductForm/ActionButton.tsx +117 -122
  940. package/themes/original/src/components/ProductForm/ExtraOptions.tsx +56 -56
  941. package/themes/original/src/components/ProductForm/index.tsx +1034 -1034
  942. package/themes/original/src/components/ProductForm/styles.tsx +101 -101
  943. package/themes/original/src/components/ProductIngredient/index.tsx +44 -44
  944. package/themes/original/src/components/ProductIngredient/styles.tsx +7 -7
  945. package/themes/original/src/components/ProductItemAccordion/index.tsx +353 -362
  946. package/themes/original/src/components/ProductItemAccordion/styles.tsx +56 -56
  947. package/themes/original/src/components/ProductOption/index.tsx +50 -50
  948. package/themes/original/src/components/ProductOption/styles.tsx +11 -11
  949. package/themes/original/src/components/ProductOptionSubOption/index.tsx +223 -215
  950. package/themes/original/src/components/ProductOptionSubOption/styles.tsx +39 -39
  951. package/themes/original/src/components/ProfessionalFilter/SingleProfessionalCard/index.tsx +108 -108
  952. package/themes/original/src/components/ProfessionalFilter/index.tsx +99 -99
  953. package/themes/original/src/components/ProfessionalProfile/index.tsx +337 -338
  954. package/themes/original/src/components/ProfessionalProfile/styles.tsx +46 -46
  955. package/themes/original/src/components/Promotions/index.tsx +261 -266
  956. package/themes/original/src/components/Promotions/styles.tsx +65 -65
  957. package/themes/original/src/components/ReviewDriver/index.tsx +315 -320
  958. package/themes/original/src/components/ReviewDriver/styles.tsx +38 -38
  959. package/themes/original/src/components/ReviewOrder/index.tsx +356 -361
  960. package/themes/original/src/components/ReviewOrder/styles.tsx +51 -51
  961. package/themes/original/src/components/ReviewProducts/index.tsx +128 -133
  962. package/themes/original/src/components/ReviewProducts/styles.tsx +16 -16
  963. package/themes/original/src/components/ReviewTrigger/index.tsx +136 -136
  964. package/themes/original/src/components/ReviewTrigger/styles.tsx +41 -41
  965. package/themes/original/src/components/ScheduleAccordion/index.tsx +68 -68
  966. package/themes/original/src/components/ScheduleAccordion/styles.tsx +14 -14
  967. package/themes/original/src/components/SearchBar/index.tsx +124 -124
  968. package/themes/original/src/components/ServiceForm/index.tsx +684 -686
  969. package/themes/original/src/components/ServiceForm/styles.tsx +50 -50
  970. package/themes/original/src/components/Sessions/index.tsx +163 -168
  971. package/themes/original/src/components/Sessions/styles.tsx +20 -20
  972. package/themes/original/src/components/SignupForm/index.tsx +1024 -1017
  973. package/themes/original/src/components/SignupForm/styles.tsx +27 -27
  974. package/themes/original/src/components/SingleOrderCard/index.tsx +411 -409
  975. package/themes/original/src/components/SingleOrderCard/styles.tsx +56 -56
  976. package/themes/original/src/components/SingleProductCard/index.tsx +353 -354
  977. package/themes/original/src/components/SingleProductCard/styles.tsx +69 -72
  978. package/themes/original/src/components/SingleProductReview/index.tsx +199 -199
  979. package/themes/original/src/components/SingleProductReview/styles.tsx +39 -39
  980. package/themes/original/src/components/StripeCardForm/index.tsx +94 -97
  981. package/themes/original/src/components/StripeCardForm/naked.tsx +128 -128
  982. package/themes/original/src/components/StripeCardForm/styles.tsx +32 -32
  983. package/themes/original/src/components/StripeCardsList/index.tsx +181 -168
  984. package/themes/original/src/components/StripeElementsForm/index.tsx +312 -310
  985. package/themes/original/src/components/StripeElementsForm/naked.tsx +148 -148
  986. package/themes/original/src/components/StripeElementsForm/styles.tsx +13 -13
  987. package/themes/original/src/components/StripeRedirectForm/index.tsx +156 -159
  988. package/themes/original/src/components/StripeRedirectForm/styles.tsx +23 -23
  989. package/themes/original/src/components/TaxInformation/index.tsx +94 -93
  990. package/themes/original/src/components/TaxInformation/styles.tsx +9 -9
  991. package/themes/original/src/components/UpsellingProducts/UpsellingContent.tsx +173 -170
  992. package/themes/original/src/components/UpsellingProducts/UpsellingLayout.tsx +91 -91
  993. package/themes/original/src/components/UpsellingProducts/index.tsx +82 -82
  994. package/themes/original/src/components/UpsellingProducts/styles.tsx +80 -80
  995. package/themes/original/src/components/UserDetails/index.tsx +245 -244
  996. package/themes/original/src/components/UserDetails/styles.tsx +25 -25
  997. package/themes/original/src/components/UserFormDetails/index.tsx +599 -559
  998. package/themes/original/src/components/UserFormDetails/styles.tsx +41 -41
  999. package/themes/original/src/components/UserProfile/index.tsx +300 -292
  1000. package/themes/original/src/components/UserProfile/styles.ts +58 -58
  1001. package/themes/original/src/components/UserProfileForm/index.tsx +348 -353
  1002. package/themes/original/src/components/UserProfileForm/styles.tsx +36 -36
  1003. package/themes/original/src/components/UserVerification/index.tsx +518 -505
  1004. package/themes/original/src/components/UserVerification/styles.tsx +83 -83
  1005. package/themes/original/src/components/VerifyPhone/index.tsx +195 -195
  1006. package/themes/original/src/components/VerifyPhone/styles.tsx +42 -42
  1007. package/themes/original/src/components/WalletTransactionItem/index.tsx +69 -69
  1008. package/themes/original/src/components/WalletTransactionItem/styles.tsx +37 -37
  1009. package/themes/original/src/components/WalletTransactions/index.tsx +76 -76
  1010. package/themes/original/src/components/WalletTransactions/styles.tsx +14 -14
  1011. package/themes/original/src/components/Wallets/index.tsx +350 -352
  1012. package/themes/original/src/components/Wallets/styles.tsx +67 -67
  1013. package/themes/original/src/components/WebsocketStatus/index.tsx +169 -172
  1014. package/themes/original/src/components/WebsocketStatus/styles.tsx +28 -28
  1015. package/themes/original/src/components/shared/CardAnimation.tsx +47 -47
  1016. package/themes/original/src/components/shared/HeaderTitle.tsx +26 -26
  1017. package/themes/original/src/components/shared/OAlert.tsx +56 -55
  1018. package/themes/original/src/components/shared/OBottomPopup.tsx +109 -109
  1019. package/themes/original/src/components/shared/OButton.tsx +150 -149
  1020. package/themes/original/src/components/shared/ODropDown.tsx +168 -168
  1021. package/themes/original/src/components/shared/OIcon.tsx +66 -66
  1022. package/themes/original/src/components/shared/OIconButton.tsx +127 -127
  1023. package/themes/original/src/components/shared/OIconText.tsx +53 -53
  1024. package/themes/original/src/components/shared/OInput.tsx +133 -137
  1025. package/themes/original/src/components/shared/OKeyButton.tsx +34 -34
  1026. package/themes/original/src/components/shared/OModal.tsx +194 -189
  1027. package/themes/original/src/components/shared/OText.tsx +52 -52
  1028. package/themes/original/src/components/shared/OTextarea.tsx +36 -36
  1029. package/themes/original/src/components/shared/OToast.tsx +93 -93
  1030. package/themes/original/src/components/shared/OToggle.tsx +157 -157
  1031. package/themes/original/src/components/shared/index.tsx +31 -31
  1032. package/themes/original/src/config/constants.tsx +43 -43
  1033. package/themes/original/src/layouts/Container.tsx +32 -32
  1034. package/themes/original/src/layouts/FloatingBottomContainer.tsx +30 -30
  1035. package/themes/original/src/layouts/SafeAreaContainer.tsx +6 -6
  1036. package/themes/original/src/providers/AlertProvider.tsx +43 -43
  1037. package/themes/original/src/providers/StoreUtil.tsx +50 -50
  1038. package/themes/original/src/types/index.tsx +838 -830
  1039. package/themes/original/src/utils/index.tsx +756 -727
  1040. package/themes/single-business/index.tsx +207 -207
  1041. package/themes/single-business/src/components/ActiveOrders/index.tsx +135 -135
  1042. package/themes/single-business/src/components/ActiveOrders/styles.tsx +44 -44
  1043. package/themes/single-business/src/components/AddressDetails/index.tsx +77 -77
  1044. package/themes/single-business/src/components/AddressDetails/styles.tsx +21 -21
  1045. package/themes/single-business/src/components/AddressForm/index.tsx +856 -856
  1046. package/themes/single-business/src/components/AddressForm/styles.tsx +27 -27
  1047. package/themes/single-business/src/components/AddressList/index.tsx +338 -338
  1048. package/themes/single-business/src/components/AddressList/styles.tsx +20 -20
  1049. package/themes/single-business/src/components/AppleLogin/index.tsx +108 -108
  1050. package/themes/single-business/src/components/AppleLogin/styles.tsx +21 -21
  1051. package/themes/single-business/src/components/BottomWrapper/index.tsx +29 -29
  1052. package/themes/single-business/src/components/BusinessBasicInformation/index.tsx +315 -315
  1053. package/themes/single-business/src/components/BusinessBasicInformation/styles.tsx +65 -65
  1054. package/themes/single-business/src/components/BusinessController/index.tsx +186 -186
  1055. package/themes/single-business/src/components/BusinessController/styles.tsx +56 -56
  1056. package/themes/single-business/src/components/BusinessFeaturedController/index.tsx +189 -189
  1057. package/themes/single-business/src/components/BusinessFeaturedController/styles.tsx +50 -50
  1058. package/themes/single-business/src/components/BusinessInformation/index.tsx +244 -244
  1059. package/themes/single-business/src/components/BusinessInformation/styles.tsx +39 -39
  1060. package/themes/single-business/src/components/BusinessItemAccordion/index.tsx +125 -125
  1061. package/themes/single-business/src/components/BusinessItemAccordion/styles.tsx +54 -54
  1062. package/themes/single-business/src/components/BusinessProductsCategories/index.tsx +160 -160
  1063. package/themes/single-business/src/components/BusinessProductsCategories/styles.tsx +7 -7
  1064. package/themes/single-business/src/components/BusinessProductsList/index.tsx +213 -213
  1065. package/themes/single-business/src/components/BusinessProductsList/styles.tsx +14 -14
  1066. package/themes/single-business/src/components/BusinessProductsListing/index.tsx +338 -338
  1067. package/themes/single-business/src/components/BusinessProductsListing/styles.tsx +30 -30
  1068. package/themes/single-business/src/components/BusinessReviews/index.tsx +255 -255
  1069. package/themes/single-business/src/components/BusinessReviews/styles.tsx +59 -59
  1070. package/themes/single-business/src/components/BusinessTypeFilter/index.tsx +127 -127
  1071. package/themes/single-business/src/components/BusinessTypeFilter/styles.tsx +40 -40
  1072. package/themes/single-business/src/components/BusinessesListing/index.tsx +384 -384
  1073. package/themes/single-business/src/components/BusinessesListing/styles.tsx +108 -108
  1074. package/themes/single-business/src/components/Cart/index.tsx +490 -490
  1075. package/themes/single-business/src/components/Cart/styles.tsx +111 -111
  1076. package/themes/single-business/src/components/CartContent/index.tsx +64 -64
  1077. package/themes/single-business/src/components/CartContent/styles.tsx +5 -5
  1078. package/themes/single-business/src/components/Checkout/index.tsx +662 -662
  1079. package/themes/single-business/src/components/Checkout/styles.tsx +89 -89
  1080. package/themes/single-business/src/components/CouponControl/index.tsx +119 -119
  1081. package/themes/single-business/src/components/CouponControl/styles.tsx +22 -22
  1082. package/themes/single-business/src/components/DriverTips/index.tsx +163 -163
  1083. package/themes/single-business/src/components/DriverTips/styles.tsx +63 -63
  1084. package/themes/single-business/src/components/FacebookLogin/index.tsx +107 -107
  1085. package/themes/single-business/src/components/FacebookLogin/styles.tsx +21 -21
  1086. package/themes/single-business/src/components/FloatingButton/index.tsx +100 -100
  1087. package/themes/single-business/src/components/FloatingButton/styles.tsx +26 -26
  1088. package/themes/single-business/src/components/ForgotPasswordForm/index.tsx +156 -156
  1089. package/themes/single-business/src/components/ForgotPasswordForm/styles.tsx +11 -11
  1090. package/themes/single-business/src/components/GPSButton/index.tsx +84 -84
  1091. package/themes/single-business/src/components/GPSButton/styles.ts +5 -5
  1092. package/themes/single-business/src/components/GoogleLogin/index.tsx +114 -114
  1093. package/themes/single-business/src/components/GoogleLogin/styles.tsx +23 -23
  1094. package/themes/single-business/src/components/GoogleMap/index.tsx +229 -229
  1095. package/themes/single-business/src/components/Help/index.tsx +55 -55
  1096. package/themes/single-business/src/components/Help/styles.tsx +11 -11
  1097. package/themes/single-business/src/components/HelpAccountAndPayment/index.tsx +69 -69
  1098. package/themes/single-business/src/components/HelpAccountAndPayment/styles.tsx +6 -6
  1099. package/themes/single-business/src/components/HelpGuide/index.tsx +68 -68
  1100. package/themes/single-business/src/components/HelpGuide/styles.tsx +6 -6
  1101. package/themes/single-business/src/components/HelpOrder/index.tsx +80 -80
  1102. package/themes/single-business/src/components/HelpOrder/styles.tsx +5 -5
  1103. package/themes/single-business/src/components/Home/index.tsx +102 -102
  1104. package/themes/single-business/src/components/Home/styles.tsx +18 -18
  1105. package/themes/single-business/src/components/LanguageSelector/index.tsx +109 -109
  1106. package/themes/single-business/src/components/LanguageSelector/styles.tsx +7 -7
  1107. package/themes/single-business/src/components/LastOrder/index.tsx +170 -170
  1108. package/themes/single-business/src/components/LastOrder/styles.tsx +16 -16
  1109. package/themes/single-business/src/components/LastOrders/index.tsx +104 -104
  1110. package/themes/single-business/src/components/LastOrders/styles.tsx +17 -17
  1111. package/themes/single-business/src/components/LoginForm/index.tsx +587 -587
  1112. package/themes/single-business/src/components/LoginForm/styles.tsx +82 -82
  1113. package/themes/single-business/src/components/LogoutButton/index.tsx +36 -36
  1114. package/themes/single-business/src/components/Messages/index.tsx +350 -350
  1115. package/themes/single-business/src/components/Messages/styles.tsx +20 -20
  1116. package/themes/single-business/src/components/MomentOption/index.tsx +290 -290
  1117. package/themes/single-business/src/components/MomentOption/styles.tsx +65 -65
  1118. package/themes/single-business/src/components/NavBar/index.tsx +129 -129
  1119. package/themes/single-business/src/components/NotFoundSource/index.tsx +50 -50
  1120. package/themes/single-business/src/components/NotFoundSource/styles.tsx +16 -16
  1121. package/themes/single-business/src/components/Notifications/index.tsx +120 -120
  1122. package/themes/single-business/src/components/Notifications/styles.ts +20 -20
  1123. package/themes/single-business/src/components/OrderDetails/index.tsx +871 -871
  1124. package/themes/single-business/src/components/OrderDetails/styles.tsx +120 -120
  1125. package/themes/single-business/src/components/OrderListOption/index.tsx +231 -231
  1126. package/themes/single-business/src/components/OrderListOption/styles.tsx +62 -62
  1127. package/themes/single-business/src/components/OrderSummary/index.tsx +267 -267
  1128. package/themes/single-business/src/components/OrderSummary/styles.tsx +40 -40
  1129. package/themes/single-business/src/components/OrderTypeSelector/index.tsx +126 -126
  1130. package/themes/single-business/src/components/OrderTypeSelector/styles.tsx +26 -26
  1131. package/themes/single-business/src/components/OrdersListing/index.tsx +112 -112
  1132. package/themes/single-business/src/components/OrdersOption/index.tsx +245 -245
  1133. package/themes/single-business/src/components/OrdersOption/styles.tsx +5 -5
  1134. package/themes/single-business/src/components/PaymentOptionCash/index.tsx +102 -102
  1135. package/themes/single-business/src/components/PaymentOptionCash/styles.tsx +18 -18
  1136. package/themes/single-business/src/components/PaymentOptionStripe/index.tsx +234 -234
  1137. package/themes/single-business/src/components/PaymentOptionStripe/styles.tsx +69 -69
  1138. package/themes/single-business/src/components/PaymentOptions/index.tsx +431 -431
  1139. package/themes/single-business/src/components/PaymentOptions/styles.tsx +74 -74
  1140. package/themes/single-business/src/components/PhoneInputNumber/index.tsx +118 -118
  1141. package/themes/single-business/src/components/PhoneInputNumber/styles.tsx +3 -3
  1142. package/themes/single-business/src/components/PreviousOrders/index.tsx +195 -195
  1143. package/themes/single-business/src/components/PreviousOrders/styles.tsx +33 -33
  1144. package/themes/single-business/src/components/ProductForm/index.tsx +694 -694
  1145. package/themes/single-business/src/components/ProductForm/styles.tsx +82 -82
  1146. package/themes/single-business/src/components/ProductIngredient/index.tsx +43 -43
  1147. package/themes/single-business/src/components/ProductIngredient/styles.tsx +7 -7
  1148. package/themes/single-business/src/components/ProductItemAccordion/index.tsx +276 -276
  1149. package/themes/single-business/src/components/ProductItemAccordion/styles.tsx +57 -57
  1150. package/themes/single-business/src/components/ProductOption/index.tsx +50 -50
  1151. package/themes/single-business/src/components/ProductOption/styles.tsx +11 -11
  1152. package/themes/single-business/src/components/ProductOptionSubOption/index.tsx +146 -146
  1153. package/themes/single-business/src/components/ProductOptionSubOption/styles.tsx +32 -32
  1154. package/themes/single-business/src/components/PromotionCard/index.tsx +103 -103
  1155. package/themes/single-business/src/components/PromotionCard/styles.tsx +28 -28
  1156. package/themes/single-business/src/components/Promotions/index.tsx +78 -78
  1157. package/themes/single-business/src/components/Promotions/styles.tsx +3 -3
  1158. package/themes/single-business/src/components/ReviewOrder/index.tsx +346 -346
  1159. package/themes/single-business/src/components/ReviewOrder/styles.tsx +44 -44
  1160. package/themes/single-business/src/components/SearchBar/index.tsx +108 -108
  1161. package/themes/single-business/src/components/SignupForm/index.tsx +642 -642
  1162. package/themes/single-business/src/components/SignupForm/styles.tsx +27 -27
  1163. package/themes/single-business/src/components/SingleProductCard/index.tsx +124 -124
  1164. package/themes/single-business/src/components/SingleProductCard/styles.tsx +23 -23
  1165. package/themes/single-business/src/components/StripeCardForm/index.tsx +97 -97
  1166. package/themes/single-business/src/components/StripeCardForm/naked.tsx +128 -128
  1167. package/themes/single-business/src/components/StripeCardForm/styles.tsx +32 -32
  1168. package/themes/single-business/src/components/StripeCardsList/index.tsx +143 -143
  1169. package/themes/single-business/src/components/StripeElementsForm/index.tsx +204 -204
  1170. package/themes/single-business/src/components/StripeElementsForm/naked.tsx +90 -90
  1171. package/themes/single-business/src/components/StripeElementsForm/styles.tsx +13 -13
  1172. package/themes/single-business/src/components/StripeRedirectForm/index.tsx +159 -159
  1173. package/themes/single-business/src/components/StripeRedirectForm/styles.tsx +23 -23
  1174. package/themes/single-business/src/components/TagSelector/index.tsx +94 -94
  1175. package/themes/single-business/src/components/TaxInformation/index.tsx +56 -56
  1176. package/themes/single-business/src/components/TaxInformation/styles.tsx +10 -10
  1177. package/themes/single-business/src/components/UpsellingProducts/index.tsx +259 -259
  1178. package/themes/single-business/src/components/UpsellingProducts/styles.tsx +57 -57
  1179. package/themes/single-business/src/components/UserDetails/index.tsx +130 -130
  1180. package/themes/single-business/src/components/UserDetails/styles.tsx +21 -21
  1181. package/themes/single-business/src/components/UserFormDetails/index.tsx +304 -304
  1182. package/themes/single-business/src/components/UserFormDetails/styles.tsx +37 -37
  1183. package/themes/single-business/src/components/UserProfile/index.tsx +185 -185
  1184. package/themes/single-business/src/components/UserProfile/styles.ts +42 -42
  1185. package/themes/single-business/src/components/UserProfileForm/index.tsx +254 -254
  1186. package/themes/single-business/src/components/UserProfileForm/styles.tsx +29 -29
  1187. package/themes/single-business/src/components/VerifyPhone/index.tsx +188 -188
  1188. package/themes/single-business/src/components/VerifyPhone/styles.tsx +43 -43
  1189. package/themes/single-business/src/components/shared/OAlert.tsx +55 -55
  1190. package/themes/single-business/src/components/shared/OBottomPopup.tsx +73 -73
  1191. package/themes/single-business/src/components/shared/OButton.tsx +132 -132
  1192. package/themes/single-business/src/components/shared/ODropDown.tsx +169 -169
  1193. package/themes/single-business/src/components/shared/OIcon.tsx +53 -53
  1194. package/themes/single-business/src/components/shared/OIconButton.tsx +127 -127
  1195. package/themes/single-business/src/components/shared/OIconText.tsx +53 -53
  1196. package/themes/single-business/src/components/shared/OInput.tsx +114 -114
  1197. package/themes/single-business/src/components/shared/OKeyButton.tsx +34 -34
  1198. package/themes/single-business/src/components/shared/OLink.tsx +80 -80
  1199. package/themes/single-business/src/components/shared/OModal.tsx +172 -172
  1200. package/themes/single-business/src/components/shared/OText.tsx +52 -52
  1201. package/themes/single-business/src/components/shared/OTextarea.tsx +36 -36
  1202. package/themes/single-business/src/components/shared/OToast.tsx +93 -93
  1203. package/themes/single-business/src/components/shared/OToggle.tsx +157 -157
  1204. package/themes/single-business/src/components/shared/index.tsx +33 -33
  1205. package/themes/single-business/src/config/constants.tsx +41 -41
  1206. package/themes/single-business/src/layouts/Container.tsx +23 -23
  1207. package/themes/single-business/src/layouts/SafeAreaContainer.tsx +6 -6
  1208. package/themes/single-business/src/providers/AlertProvider.tsx +43 -43
  1209. package/themes/single-business/src/providers/StoreUtil.tsx +50 -50
  1210. package/themes/single-business/src/types/index.tsx +445 -445
  1211. package/themes/single-business/src/utils/index.tsx +286 -286
  1212. package/themes/uber-eats/index.tsx +127 -127
  1213. package/themes/uber-eats/src/components/Account/index.tsx +201 -201
  1214. package/themes/uber-eats/src/components/Account/styles.tsx +21 -21
  1215. package/themes/uber-eats/src/components/ActiveOrders/index.tsx +135 -135
  1216. package/themes/uber-eats/src/components/ActiveOrders/styles.tsx +50 -50
  1217. package/themes/uber-eats/src/components/AddressDetails/index.tsx +71 -71
  1218. package/themes/uber-eats/src/components/AddressDetails/styles.tsx +13 -13
  1219. package/themes/uber-eats/src/components/AddressForm/index.tsx +715 -715
  1220. package/themes/uber-eats/src/components/AddressForm/styles.tsx +31 -31
  1221. package/themes/uber-eats/src/components/AddressList/index.tsx +315 -315
  1222. package/themes/uber-eats/src/components/AddressList/styles.tsx +23 -23
  1223. package/themes/uber-eats/src/components/BusinessBasicInformation/index.tsx +226 -226
  1224. package/themes/uber-eats/src/components/BusinessBasicInformation/styles.tsx +41 -41
  1225. package/themes/uber-eats/src/components/BusinessController/index.tsx +201 -201
  1226. package/themes/uber-eats/src/components/BusinessController/styles.tsx +58 -58
  1227. package/themes/uber-eats/src/components/BusinessInformation/index.tsx +101 -101
  1228. package/themes/uber-eats/src/components/BusinessInformation/styles.tsx +36 -36
  1229. package/themes/uber-eats/src/components/BusinessItemAccordion/index.tsx +145 -145
  1230. package/themes/uber-eats/src/components/BusinessItemAccordion/styles.tsx +61 -61
  1231. package/themes/uber-eats/src/components/BusinessProductsCategories/index.tsx +141 -141
  1232. package/themes/uber-eats/src/components/BusinessProductsCategories/styles.tsx +7 -7
  1233. package/themes/uber-eats/src/components/BusinessProductsList/index.tsx +195 -195
  1234. package/themes/uber-eats/src/components/BusinessProductsList/styles.tsx +13 -13
  1235. package/themes/uber-eats/src/components/BusinessProductsListing/index.tsx +411 -411
  1236. package/themes/uber-eats/src/components/BusinessProductsListing/styles.tsx +52 -52
  1237. package/themes/uber-eats/src/components/BusinessReviews/index.tsx +121 -121
  1238. package/themes/uber-eats/src/components/BusinessReviews/styles.tsx +33 -33
  1239. package/themes/uber-eats/src/components/BusinessTypeFilter/index.tsx +194 -194
  1240. package/themes/uber-eats/src/components/BusinessTypeFilter/styles.tsx +28 -28
  1241. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +247 -247
  1242. package/themes/uber-eats/src/components/BusinessesListing/styles.tsx +62 -62
  1243. package/themes/uber-eats/src/components/Cart/index.tsx +346 -346
  1244. package/themes/uber-eats/src/components/Cart/styles.tsx +26 -26
  1245. package/themes/uber-eats/src/components/CartContent/index.tsx +50 -50
  1246. package/themes/uber-eats/src/components/CartContent/styles.tsx +19 -19
  1247. package/themes/uber-eats/src/components/Checkout/index.tsx +709 -709
  1248. package/themes/uber-eats/src/components/Checkout/styles.tsx +72 -72
  1249. package/themes/uber-eats/src/components/CouponControl/index.tsx +120 -120
  1250. package/themes/uber-eats/src/components/CouponControl/styles.tsx +22 -22
  1251. package/themes/uber-eats/src/components/DriverTips/index.tsx +167 -167
  1252. package/themes/uber-eats/src/components/DriverTips/styles.tsx +47 -47
  1253. package/themes/uber-eats/src/components/FacebookLogin/index.tsx +124 -124
  1254. package/themes/uber-eats/src/components/FacebookLogin/styles.tsx +21 -21
  1255. package/themes/uber-eats/src/components/FloatingButton/index.tsx +74 -74
  1256. package/themes/uber-eats/src/components/FloatingButton/styles.tsx +31 -31
  1257. package/themes/uber-eats/src/components/GoogleMap/index.tsx +236 -236
  1258. package/themes/uber-eats/src/components/Help/index.tsx +54 -54
  1259. package/themes/uber-eats/src/components/Help/styles.tsx +11 -11
  1260. package/themes/uber-eats/src/components/HelpAccountAndPayment/index.tsx +67 -67
  1261. package/themes/uber-eats/src/components/HelpAccountAndPayment/styles.tsx +6 -6
  1262. package/themes/uber-eats/src/components/HelpGuide/index.tsx +66 -66
  1263. package/themes/uber-eats/src/components/HelpGuide/styles.tsx +6 -6
  1264. package/themes/uber-eats/src/components/HelpOrder/index.tsx +78 -78
  1265. package/themes/uber-eats/src/components/HelpOrder/styles.tsx +5 -5
  1266. package/themes/uber-eats/src/components/HighestRatedBusinesses/index.tsx +132 -132
  1267. package/themes/uber-eats/src/components/HighestRatedBusinesses/styles.tsx +6 -6
  1268. package/themes/uber-eats/src/components/Home/index.tsx +117 -117
  1269. package/themes/uber-eats/src/components/Home/styles.tsx +13 -13
  1270. package/themes/uber-eats/src/components/LanguageSelector/index.tsx +154 -154
  1271. package/themes/uber-eats/src/components/LanguageSelector/styles.tsx +18 -18
  1272. package/themes/uber-eats/src/components/LastOrders/index.tsx +104 -104
  1273. package/themes/uber-eats/src/components/LastOrders/styles.tsx +17 -17
  1274. package/themes/uber-eats/src/components/LoginForm/index.tsx +440 -440
  1275. package/themes/uber-eats/src/components/LoginForm/styles.tsx +65 -65
  1276. package/themes/uber-eats/src/components/LogoutButton/index.tsx +67 -67
  1277. package/themes/uber-eats/src/components/Messages/index.tsx +422 -422
  1278. package/themes/uber-eats/src/components/Messages/styles.tsx +23 -23
  1279. package/themes/uber-eats/src/components/MomentOption/index.tsx +211 -211
  1280. package/themes/uber-eats/src/components/MomentOption/styles.tsx +66 -66
  1281. package/themes/uber-eats/src/components/NavBar/index.tsx +122 -122
  1282. package/themes/uber-eats/src/components/NotFoundSource/index.tsx +55 -55
  1283. package/themes/uber-eats/src/components/NotFoundSource/styles.tsx +16 -16
  1284. package/themes/uber-eats/src/components/OrderDetails/index.tsx +513 -513
  1285. package/themes/uber-eats/src/components/OrderDetails/styles.tsx +140 -140
  1286. package/themes/uber-eats/src/components/OrderSummary/index.tsx +266 -266
  1287. package/themes/uber-eats/src/components/OrderSummary/styles.tsx +36 -36
  1288. package/themes/uber-eats/src/components/OrderTypeSelector/index.tsx +130 -130
  1289. package/themes/uber-eats/src/components/OrderTypeSelector/styles.tsx +6 -6
  1290. package/themes/uber-eats/src/components/OrdersOption/index.tsx +225 -225
  1291. package/themes/uber-eats/src/components/OrdersOption/styles.tsx +3 -3
  1292. package/themes/uber-eats/src/components/PaymentOptionCash/index.tsx +102 -102
  1293. package/themes/uber-eats/src/components/PaymentOptionCash/styles.tsx +18 -18
  1294. package/themes/uber-eats/src/components/PaymentOptionStripe/index.tsx +232 -232
  1295. package/themes/uber-eats/src/components/PaymentOptionStripe/styles.tsx +62 -62
  1296. package/themes/uber-eats/src/components/PaymentOptions/index.tsx +547 -547
  1297. package/themes/uber-eats/src/components/PaymentOptions/styles.tsx +41 -41
  1298. package/themes/uber-eats/src/components/PhoneInputNumber/index.tsx +108 -108
  1299. package/themes/uber-eats/src/components/PhoneInputNumber/styles.tsx +4 -4
  1300. package/themes/uber-eats/src/components/PreviousOrders/index.tsx +149 -149
  1301. package/themes/uber-eats/src/components/PreviousOrders/styles.tsx +34 -34
  1302. package/themes/uber-eats/src/components/ProductForm/index.tsx +480 -480
  1303. package/themes/uber-eats/src/components/ProductForm/styles.tsx +91 -91
  1304. package/themes/uber-eats/src/components/ProductIngredient/index.tsx +44 -44
  1305. package/themes/uber-eats/src/components/ProductIngredient/styles.tsx +7 -7
  1306. package/themes/uber-eats/src/components/ProductItemAccordion/index.tsx +252 -252
  1307. package/themes/uber-eats/src/components/ProductItemAccordion/styles.tsx +61 -61
  1308. package/themes/uber-eats/src/components/ProductOption/index.tsx +109 -109
  1309. package/themes/uber-eats/src/components/ProductOption/styles.tsx +27 -27
  1310. package/themes/uber-eats/src/components/ProductOptionSubOption/index.tsx +159 -159
  1311. package/themes/uber-eats/src/components/ProductOptionSubOption/styles.tsx +32 -32
  1312. package/themes/uber-eats/src/components/SearchBar/index.tsx +106 -106
  1313. package/themes/uber-eats/src/components/SignupForm/index.tsx +574 -574
  1314. package/themes/uber-eats/src/components/SignupForm/styles.tsx +29 -29
  1315. package/themes/uber-eats/src/components/SingleProductCard/index.tsx +88 -88
  1316. package/themes/uber-eats/src/components/SingleProductCard/styles.tsx +26 -26
  1317. package/themes/uber-eats/src/components/StripeCardsList/index.tsx +144 -144
  1318. package/themes/uber-eats/src/components/StripeElementsForm/index.tsx +188 -188
  1319. package/themes/uber-eats/src/components/StripeElementsForm/naked.tsx +90 -90
  1320. package/themes/uber-eats/src/components/StripeElementsForm/styles.tsx +9 -9
  1321. package/themes/uber-eats/src/components/TaxInformation/index.tsx +51 -51
  1322. package/themes/uber-eats/src/components/TaxInformation/styles.tsx +9 -9
  1323. package/themes/uber-eats/src/components/UpsellingProducts/index.tsx +189 -189
  1324. package/themes/uber-eats/src/components/UpsellingProducts/styles.tsx +37 -37
  1325. package/themes/uber-eats/src/components/UserDetails/index.tsx +125 -125
  1326. package/themes/uber-eats/src/components/UserDetails/styles.tsx +21 -21
  1327. package/themes/uber-eats/src/components/UserFormDetails/index.tsx +304 -304
  1328. package/themes/uber-eats/src/components/UserFormDetails/styles.tsx +38 -38
  1329. package/themes/uber-eats/src/components/UserProfileForm/index.tsx +106 -106
  1330. package/themes/uber-eats/src/components/UserProfileForm/styles.tsx +37 -37
  1331. package/themes/uber-eats/src/components/VerifyPhone/index.tsx +187 -187
  1332. package/themes/uber-eats/src/components/VerifyPhone/styles.tsx +43 -43
  1333. package/themes/uber-eats/src/components/shared/OAlert.tsx +53 -53
  1334. package/themes/uber-eats/src/components/shared/OBottomPopup.tsx +118 -118
  1335. package/themes/uber-eats/src/components/shared/OButton.tsx +133 -133
  1336. package/themes/uber-eats/src/components/shared/ODropDown.tsx +168 -168
  1337. package/themes/uber-eats/src/components/shared/OIcon.tsx +53 -53
  1338. package/themes/uber-eats/src/components/shared/OIconButton.tsx +134 -134
  1339. package/themes/uber-eats/src/components/shared/OInput.tsx +122 -122
  1340. package/themes/uber-eats/src/components/shared/OModal.tsx +151 -151
  1341. package/themes/uber-eats/src/components/shared/OText.tsx +52 -52
  1342. package/themes/uber-eats/src/components/shared/OToast.tsx +94 -94
  1343. package/themes/uber-eats/src/components/shared/index.tsx +22 -22
  1344. package/themes/uber-eats/src/config/constants.tsx +10 -10
  1345. package/themes/uber-eats/src/layouts/Container.tsx +26 -26
  1346. package/themes/uber-eats/src/layouts/SafeAreaContainer.tsx +6 -6
  1347. package/themes/uber-eats/src/providers/AlertProvider.tsx +43 -43
  1348. package/themes/uber-eats/src/providers/StoreUtil.tsx +58 -58
  1349. package/themes/uber-eats/src/types/@stripe/stripe-react-native/index.d.ts +1 -1
  1350. package/themes/uber-eats/src/types/index.tsx +451 -451
  1351. package/themes/uber-eats/src/types/ordering-api-sdk/index.d.ts +1 -1
  1352. package/themes/uber-eats/src/types/ordering-components/index.d.ts +1 -1
  1353. package/themes/uber-eats/src/types/react-hook-form/index.d.ts +1 -1
  1354. package/themes/uber-eats/src/types/react-native-credit-card-input/index.d.ts +1 -1
  1355. package/themes/uber-eats/src/types/react-native-fbsdk/index.d.ts +1 -1
  1356. package/themes/uber-eats/src/types/react-native-gesture-handler/index.d.ts +1 -1
  1357. package/themes/uber-eats/src/types/react-native-gifted-chat/index.d.ts +1 -1
  1358. package/themes/uber-eats/src/types/react-native-image-picker/index.d.ts +1 -1
  1359. package/themes/uber-eats/src/types/react-native-restart/index.d.ts +1 -1
  1360. package/themes/uber-eats/src/types/styled-components/index.d.ts +1 -1
  1361. package/themes/uber-eats/src/utils/index.tsx +191 -191
@@ -1,1341 +1,1362 @@
1
- import React, { useState, useEffect, useCallback, useRef } from 'react';
2
- import { View, StyleSheet, TouchableOpacity, Platform, I18nManager, ScrollView, Keyboard, BackHandler, SafeAreaView } from 'react-native';
3
- import { initStripe, useConfirmPayment } from '@stripe/stripe-react-native';
4
- import NativeStripeSdk from '@stripe/stripe-react-native/src/NativeStripeSdk'
5
- import Picker from 'react-native-country-picker-modal';
6
- import MaterialIcons from 'react-native-vector-icons/MaterialIcons'
7
- import IconAntDesign from 'react-native-vector-icons/AntDesign';
8
- import { useIsFocused } from '@react-navigation/native';
9
-
10
- import ReactNativeHapticFeedback from "react-native-haptic-feedback";
11
- import {
12
- Checkout as CheckoutController,
13
- useOrder,
14
- useSession,
15
- useApi,
16
- useLanguage,
17
- useUtils,
18
- useValidationFields,
19
- useConfig,
20
- useToast,
21
- ToastType,
22
- useEvent
23
- } from 'ordering-components/native';
24
- import { useTheme } from 'styled-components/native';
25
- import { OText, OIcon, OModal, OButton } from '../shared';
26
-
27
- import { AddressDetails } from '../AddressDetails';
28
- import { PaymentOptions } from '../PaymentOptions';
29
- import { DriverTips } from '../DriverTips';
30
- import { NotFoundSource } from '../NotFoundSource';
31
- import { UserDetails } from '../UserDetails';
32
- import { PaymentOptionWallet } from '../PaymentOptionWallet';
33
- import { PlaceSpot } from '../PlaceSpot'
34
- import { SignupForm } from '../SignupForm'
35
- import { LoginForm } from '../LoginForm'
36
-
37
- import {
38
- ChContainer,
39
- ChSection,
40
- ChHeader,
41
- ChAddress,
42
- CHMomentWrapper,
43
- ChPaymethods,
44
- ChDriverTips,
45
- ChErrors,
46
- ChBusinessDetails,
47
- ChUserDetails,
48
- ChCart,
49
- DeliveryOptionsContainer,
50
- DeliveryOptionItem,
51
- WalletPaymentOptionContainer,
52
- CartHeader,
53
- TopHeader,
54
- TopActions
55
- } from './styles';
56
- import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder';
57
- import { FloatingButton } from '../FloatingButton';
58
- import { Container } from '../../layouts/Container';
59
- import NavBar from '../NavBar';
60
- import { OrderSummary } from '../OrderSummary';
61
- import { getTypesText } from '../../utils';
62
- import { CartStoresListing } from '../CartStoresListing';
63
- import { PaymentOptionsWebView } from '../../../../../src/components/PaymentOptionsWebView';
64
- import { DeviceOrientationMethods } from '../../../../../src/hooks/DeviceOrientation'
65
- const { useDeviceOrientation } = DeviceOrientationMethods
66
-
67
- const mapConfigs = {
68
- mapZoom: 16,
69
- mapSize: {
70
- width: 640,
71
- height: 190
72
- }
73
- };
74
-
75
- const manageErrorsToShow = (array = []) => {
76
- let stringError = ''
77
- const list = Array.isArray(array) ? array : Object.values(array)
78
- list.map((item: any, i: number) => {
79
- stringError += (i + 1) === array.length ? `- ${item?.message || item}` : `- ${item?.message || item}\n`
80
- })
81
- return stringError;
82
- }
83
-
84
- const CheckoutUI = (props: any) => {
85
- const {
86
- navigation,
87
- cart,
88
- errors,
89
- placing,
90
- cartState,
91
- cartUuid,
92
- loyaltyPlansState,
93
- businessDetails,
94
- paymethodSelected,
95
- handlePaymethodChange,
96
- handlerClickPlaceOrder,
97
- onNavigationRedirect,
98
- deliveryOptionSelected,
99
- instructionsOptions,
100
- handleChangeDeliveryOption,
101
- currency,
102
- merchantId,
103
- setPlaceSpotNumber,
104
- maxDate,
105
- androidAppId,
106
- urlscheme,
107
- checkoutFieldsState
108
- } = props
109
-
110
- const theme = useTheme();
111
- const isFocused = useIsFocused();
112
-
113
- const styles = StyleSheet.create({
114
- btnBackArrow: {
115
- borderWidth: 0,
116
- backgroundColor: theme.colors.white,
117
- borderColor: theme.colors.white,
118
- shadowColor: theme.colors.white,
119
- display: 'flex',
120
- justifyContent: 'flex-start',
121
- paddingLeft: 0,
122
- },
123
- paddSection: {
124
- padding: 20
125
- },
126
- pagePadding: {
127
- paddingHorizontal: 20
128
- },
129
- icon: {
130
- top: 15,
131
- right: Platform.OS === 'ios' ? 5 : (I18nManager.isRTL ? 30 : 0),
132
- position: 'absolute',
133
- fontSize: 20
134
- },
135
- detailWrapper: {
136
- paddingHorizontal: 20,
137
- width: '100%'
138
- },
139
- wrapperNavbar: {
140
- paddingVertical: 2,
141
- paddingHorizontal: 20,
142
- backgroundColor: theme?.colors?.white,
143
- borderWidth: 0
144
- }
145
- })
146
-
147
- const [, { showToast }] = useToast();
148
- const [, t] = useLanguage();
149
- const [{ user, token }, { login }] = useSession();
150
- const [ordering] = useApi()
151
- const [{ configs }] = useConfig();
152
- const [{ parsePrice, parseDate }] = useUtils();
153
- const [{ options, carts, loading }, { confirmCart }] = useOrder();
154
- const [validationFields] = useValidationFields();
155
- const [events] = useEvent()
156
- const [orientationState] = useDeviceOrientation();
157
- const [isReadMore, setIsReadMore] = useState(false)
158
- const [lengthMore, setLengthMore] = useState(false)
159
- const WIDTH_SCREEN = orientationState?.dimensions?.width
160
-
161
- const [errorCash, setErrorCash] = useState(false);
162
- const [userErrors, setUserErrors] = useState<any>([]);
163
- const [isUserDetailsEdit, setIsUserDetailsEdit] = useState(false);
164
- const [phoneUpdate, setPhoneUpdate] = useState(false);
165
- const [openChangeStore, setOpenChangeStore] = useState(false)
166
- const [isDeliveryOptionModalVisible, setIsDeliveryOptionModalVisible] = useState(false)
167
- const [showGateway, setShowGateway] = useState<any>({ closedByUser: false, open: false });
168
- const [webviewPaymethod, setWebviewPaymethod] = useState<any>(null)
169
- const [isOpen, setIsOpen] = useState(false)
170
- const [requiredFields, setRequiredFields] = useState<any>([])
171
- const [openModal, setOpenModal] = useState({ login: false, signup: false, isGuest: false })
172
- const [allowedGuest, setAllowedGuest] = useState(false)
173
- const [placeByMethodPay, setPlaceByMethodPay] = useState(false)
174
- const [methodPaySupported, setMethodPaySupported] = useState({ enabled: false, message: null, loading: true })
175
- const [paymethodClicked, setPaymethodClicked] = useState<any>(null)
176
- const [showTitle, setShowTitle] = useState(false)
177
- const [cardList, setCardList] = useState<any>({ cards: [], loading: false, error: null })
178
- const [isGiftCardCart, setIsGiftCardCart] = useState(!cart?.business_id)
179
- const containerRef = useRef<any>()
180
- const cardsMethods = ['credomatic']
181
- const stripePaymethods: any = ['stripe', 'stripe_direct', 'stripe_connect', 'stripe_redirect']
182
- const notFields = ['coupon', 'driver_tip', 'mobile_phone', 'address', 'zipcode', 'address_notes', 'comments']
183
- const placeSpotTypes = [3, 4, 5]
184
- const placeSpotsEnabled = placeSpotTypes.includes(options?.type)
185
- const businessConfigs = businessDetails?.business?.configs ?? []
186
- const isWalletCashEnabled = businessConfigs.find((config: any) => config.key === 'wallet_cash_enabled')?.value === '1'
187
- const isWalletCreditPointsEnabled = businessConfigs.find((config: any) => config.key === 'wallet_credit_point_enabled')?.value === '1'
188
- const isWalletEnabled = configs?.cash_wallet?.value && configs?.wallet_enabled?.value === '1' && (isWalletCashEnabled || isWalletCreditPointsEnabled)
189
- const isBusinessChangeEnabled = configs?.cart_change_business_validation?.value === '1'
190
- const isChewLayout = theme?.header?.components?.layout?.type?.toLowerCase() === 'chew'
191
- const hideBusinessAddress = theme?.checkout?.components?.business?.components?.address?.hidden
192
- const hideBusinessDetails = theme?.checkout?.components?.business?.hidden
193
- const hideBusinessMap = theme?.checkout?.components?.business?.components?.map?.hidden
194
- const hideCustomerDetails = theme?.checkout?.components?.customer?.hidden
195
-
196
- const creditPointPlan = loyaltyPlansState?.result?.find((loyal: any) => loyal.type === 'credit_point')
197
- const creditPointPlanOnBusiness = creditPointPlan?.businesses?.find((b: any) => b.business_id === cart?.business_id && b.accumulates)
198
- const methodsPay = ['google_pay', 'apple_pay']
199
-
200
- const isPreOrder = configs?.preorder_status_enabled?.value === '1'
201
- const subtotalWithTaxes = cart?.taxes?.reduce((acc: any, item: any) => {
202
- if (item?.type === 1)
203
- return acc = acc + item?.summary?.tax
204
- return acc = acc
205
- }, cart?.subtotal)
206
-
207
- const validateCommentsCartField = validationFields?.fields?.checkout?.comments?.enabled && validationFields?.fields?.checkout?.comments?.required && (cart?.comment === null || cart?.comment?.trim().length === 0)
208
- const validateZipcodeCard = validationFields?.fields?.card?.zipcode?.enabled &&
209
- validationFields?.fields?.card?.zipcode?.required &&
210
- paymethodSelected?.data?.card &&
211
- !paymethodSelected?.data?.card?.zipcode &&
212
- paymethodSelected?.gateway === 'stripe'
213
-
214
- const isDisabledButtonPlace = loading || !cart?.valid || (!paymethodSelected && cart?.balance > 0) ||
215
- placing || errorCash || subtotalWithTaxes < cart?.minimum ||
216
- (cardsMethods.includes(paymethodSelected?.gateway) && cardList?.cards?.length === 0) ||
217
- (options.type === 1 && !isGiftCardCart &&
218
- validationFields?.fields?.checkout?.driver_tip?.enabled &&
219
- validationFields?.fields?.checkout?.driver_tip?.required &&
220
- (Number(cart?.driver_tip) <= 0)) ||
221
- (validateCommentsCartField) ||
222
- (validateZipcodeCard)
223
- || (methodsPay.includes(paymethodSelected?.gateway) && (!methodPaySupported.enabled || methodPaySupported.loading))
224
-
225
- const driverTipsOptions = typeof configs?.driver_tip_options?.value === 'string'
226
- ? JSON.parse(configs?.driver_tip_options?.value) || []
227
- : configs?.driver_tip_options?.value || []
228
-
229
- const configTypes = configs?.order_types_allowed?.value.split('|').map((value: any) => Number(value)) || []
230
-
231
- const cartsWithProducts = carts && Object.values(carts).filter((cart: any) => cart.products.length) || null
232
-
233
- const isSandboxCredomatic = configs?.credomatic_integration_sandbox?.value === '1'
234
- const credomaticKeyId = isSandboxCredomatic ? configs?.credomatic_integration_public_sandbox_key?.value : configs?.credomatic_integration_public_production_key?.value
235
- const credomaticUrl = `https://integrations.ordering.co/credomatic/front/auth_mobile.html?title=${t('CREDOMATIC_PAYMENT', 'Credomatic payment')}&body=${t('CREDOMATIC_PROCESSING', 'Processing transaction')}`
236
- const deliveryOptions = instructionsOptions?.result && instructionsOptions?.result?.filter((option: any) => option?.enabled)?.map((option: any) => {
237
- return {
238
- value: option?.id, key: option?.id, label: t(option?.name.toUpperCase().replace(/\s/g, '_'), option?.name)
239
- }
240
- })
241
-
242
- const handleMomentClick = () => {
243
- if (isPreOrder) {
244
- navigation.navigate('MomentOption')
245
- }
246
- }
247
-
248
- const vibrateApp = (impact?: string) => {
249
- const options = {
250
- enableVibrateFallback: true,
251
- ignoreAndroidSystemSettings: false
252
- };
253
- ReactNativeHapticFeedback.trigger(impact || "impactLight", options);
254
- }
255
-
256
- const handleSuccessSignup = (user: any) => {
257
- login({
258
- user,
259
- token: user?.session?.access_token
260
- })
261
- openModal?.isGuest && handlePlaceOrderAsGuest()
262
- setOpenModal({ ...openModal, signup: false, isGuest: false })
263
- }
264
-
265
- const handleSuccessLogin = (user: any) => {
266
- if (user) setOpenModal({ ...openModal, login: false })
267
- }
268
-
269
- const handlePlaceOrder = (confirmPayment: any, forcePlace: boolean = false) => {
270
- if (stripePaymethods.includes(paymethodSelected?.gateway) && user?.guest_id) {
271
- setOpenModal({ ...openModal, signup: true, isGuest: true })
272
- return
273
- }
274
-
275
- if (!userErrors.length && (!requiredFields?.length) || forcePlace) {
276
- vibrateApp()
277
- handlerClickPlaceOrder && handlerClickPlaceOrder(null, { isNative: true }, confirmPayment, NativeStripeSdk?.dismissPlatformPay)
278
- return
279
- }
280
- if (requiredFields?.length) {
281
- setIsOpen(true)
282
- return
283
- }
284
- let stringError = ''
285
- Object.values(userErrors).map((item: any, i: number) => {
286
- stringError += (i + 1) === userErrors.length ? `- ${item?.message || item}` : `- ${item?.message || item}\n`
287
- })
288
- showToast(ToastType.Error, stringError)
289
- setIsUserDetailsEdit(true)
290
- }
291
-
292
- const handlePlaceOrderAsGuest = () => {
293
- setIsOpen(false)
294
- handlerClickPlaceOrder && handlerClickPlaceOrder()
295
- }
296
-
297
- const handlePaymentMethodClick = (paymethod: any) => {
298
- setShowGateway({ closedByUser: false, open: true })
299
- setWebviewPaymethod(paymethod)
300
- }
301
-
302
- const onFailPaypal = async () => {
303
- if (showGateway.closedByUser === true) {
304
- await confirmCart(cart.uuid)
305
- }
306
- }
307
- const changeDeliveryOption = (option: any) => {
308
- handleChangeDeliveryOption(option)
309
- setIsDeliveryOptionModalVisible(false)
310
- }
311
-
312
- const checkValidationFields = () => {
313
- setUserErrors([])
314
- const errors = []
315
- const _requiredFields: any = []
316
-
317
- Object.values(validationFields?.fields?.checkout).map((field: any) => {
318
- if (field?.required && !notFields.includes(field.code) && field?.enabled) {
319
- if (!user[field?.code]) {
320
- _requiredFields.push(field?.code)
321
- }
322
- }
323
- })
324
-
325
- if (
326
- !user?.cellphone &&
327
- ((validationFields?.fields?.checkout?.cellphone?.enabled &&
328
- validationFields?.fields?.checkout?.cellphone?.required) ||
329
- configs?.verification_phone_required?.value === '1')
330
- ) {
331
- _requiredFields.push('cellphone')
332
- }
333
- setRequiredFields(_requiredFields)
334
-
335
- if (phoneUpdate) {
336
- errors.push(t('NECESSARY_UPDATE_COUNTRY_PHONE_CODE', 'It is necessary to update your phone number'))
337
- }
338
-
339
- setUserErrors(errors)
340
- }
341
-
342
- const checkGuestValidationFields = () => {
343
- const userSelected = user
344
- const _requiredFields = checkoutFieldsState?.fields
345
- .filter((field: any) => (field?.order_type_id === options?.type) && field?.enabled && field?.required &&
346
- !notFields.includes(field?.validation_field?.code) &&
347
- userSelected && !userSelected[field?.validation_field?.code])
348
- .map((item: any) => item?.validation_field?.code)
349
- const guestCheckoutCellPhone = checkoutFieldsState?.fields?.find((field: any) => field.order_type_id === options?.type && field?.validation_field?.code === 'mobile_phone')
350
-
351
- if (
352
- userSelected &&
353
- !userSelected?.cellphone &&
354
- ((guestCheckoutCellPhone?.enabled &&
355
- guestCheckoutCellPhone?.required) ||
356
- configs?.verification_phone_required?.value === '1')
357
- ) {
358
- _requiredFields.push('cellphone')
359
- }
360
- setRequiredFields(_requiredFields)
361
- }
362
-
363
- const togglePhoneUpdate = (val: boolean) => {
364
- setPhoneUpdate(val)
365
- }
366
-
367
- const handleScroll = ({ nativeEvent: { contentOffset } }: any) => {
368
- setShowTitle(contentOffset.y > 30)
369
- }
370
-
371
- useEffect(() => {
372
- if (validationFields && validationFields?.fields?.checkout && !user?.guest_id) {
373
- checkValidationFields()
374
- }
375
- }, [validationFields, user])
376
-
377
- useEffect(() => {
378
- if (checkoutFieldsState?.loading || !user?.guest_id) return
379
- checkGuestValidationFields()
380
- }, [user, checkoutFieldsState])
381
-
382
- useEffect(() => {
383
- if (errors) {
384
- const errorText = manageErrorsToShow(errors)
385
- showToast(ToastType.Error, errorText)
386
- }
387
- }, [errors])
388
-
389
- useEffect(() => {
390
- if (cart?.products?.length === 0) {
391
- if (cart?.business_id !== null) {
392
- onNavigationRedirect('Business', { store: cart?.business?.slug, header: null, logo: null, fromMulti: props.fromMulti })
393
- } else if (isGiftCardCart) {
394
- onNavigationRedirect('Wallets')
395
- }
396
- }
397
- }, [cart?.products?.length])
398
-
399
- useEffect(() => {
400
- if (cart?.products?.length > 0) {
401
- if (cart?.uuid && cart?.business_id === null) {
402
- setIsGiftCardCart(true)
403
- } else {
404
- setIsGiftCardCart(false)
405
- }
406
- }
407
- }, [cart?.uuid, cart?.products?.length])
408
-
409
- useEffect(() => {
410
- onFailPaypal()
411
- }, [showGateway.closedByUser])
412
-
413
- const HeaderTitle = (props: any) => {
414
- const { text } = props
415
- return (
416
- <OText
417
- size={16}
418
- lineHeight={24}
419
- weight={'500'}
420
- mBottom={props.mb ?? 10}
421
- color={theme.colors.textNormal}
422
- >
423
- {text}
424
- </OText>
425
- )
426
- }
427
-
428
- useEffect(() => {
429
- cart && events.emit('checkout_started', cart)
430
- }, [])
431
-
432
- useEffect(() => {
433
- if (cart?.paymethod_data?.gateway === 'credomatic') {
434
- if (cart?.paymethod_data?.status === 2) {
435
- setShowGateway({ ...showGateway, open: true })
436
- } else if (cart?.paymethod_data?.gateway === 'credomatic' && cart?.paymethod_data?.status === 4) {
437
- setShowGateway({ ...showGateway, open: false })
438
- }
439
- }
440
- }, [cart?.paymethod_data])
441
-
442
- const onTextLayout = useCallback((e: any) => {
443
- setLengthMore((e.nativeEvent.lines.length == 3 && e.nativeEvent.lines[2].width > WIDTH_SCREEN * .76) || e.nativeEvent.lines.length > 3)
444
- }, [])
445
-
446
- useEffect(() => {
447
- if (!isFocused) return
448
- if (!cartState?.loading && (cartState?.error || typeof cartState?.cart === 'string')) {
449
- const error = cartState?.error || typeof cartState.cart === 'string' && cartState.cart
450
- if (error) {
451
- showToast(ToastType.Error, cartState?.error || cartState.cart)
452
- navigation.navigate('BusinessList')
453
- }
454
- }
455
- }, [cartState?.error, cartState?.cart, cartState?.loading, isFocused])
456
-
457
- useEffect(() => {
458
- const keyboardDidShowListener = Keyboard.addListener('keyboardDidShow', () => {
459
- containerRef?.current?.scrollToEnd && containerRef.current.scrollToEnd({ animated: true })
460
- })
461
- return () => {
462
- keyboardDidShowListener.remove()
463
- }
464
- }, [])
465
-
466
- useEffect(() => {
467
- const onBackFunction = () => {
468
- if (webviewPaymethod?.gateway === 'paypal' && showGateway.open) {
469
- setShowGateway({ open: false, closedByUser: true })
470
- return true
471
- } else {
472
- return false
473
- }
474
- }
475
- BackHandler.addEventListener('hardwareBackPress', onBackFunction)
476
- return () => {
477
- BackHandler.removeEventListener('hardwareBackPress', onBackFunction)
478
- }
479
- }, [BackHandler, webviewPaymethod?.gateway, showGateway.open])
480
-
481
- return (
482
- <>
483
- <SafeAreaView style={{ backgroundColor: theme.colors.backgroundPage }}>
484
- <View style={styles.wrapperNavbar}>
485
- <TopHeader>
486
- <TopActions onPress={() => onNavigationRedirect('BottomTab', { screen: 'Cart' }, !props.fromMulti)}>
487
- <IconAntDesign
488
- name='arrowleft'
489
- size={26}
490
- />
491
- </TopActions>
492
- {showTitle && (
493
- <OText
494
- size={16}
495
- style={{ flex: 1, textAlign: 'center', right: 15 }}
496
- weight={Platform.OS === 'ios' ? '600' : 'bold'}
497
- numberOfLines={2}
498
- ellipsizeMode='tail'
499
- >
500
- {t('CHECKOUT', 'Checkout')}
501
- </OText>
502
- )}
503
- </TopHeader>
504
- </View>
505
- </SafeAreaView>
506
- <Container pt={0} forwardRef={containerRef} showsVerticalScrollIndicator={false} noPadding onScroll={handleScroll}>
507
- <View style={styles.wrapperNavbar}>
508
- <NavBar
509
- hideArrowLeft
510
- title={t('CHECKOUT', 'Checkout')}
511
- titleAlign={'center'}
512
- onActionLeft={() => onNavigationRedirect('BottomTab', { screen: 'Cart' }, !props.fromMulti)}
513
- showCall={false}
514
- btnStyle={{ paddingLeft: 0, paddingTop: Platform.OS == 'ios' ? 0 : 2 }}
515
- titleWrapStyle={{ paddingHorizontal: 0 }}
516
- titleStyle={{ marginRight: 0, marginLeft: 0 }}
517
- style={{ marginTop: 20 }}
518
- />
519
- </View>
520
- <ChContainer style={styles.pagePadding}>
521
- {!isGiftCardCart && (
522
- <ChSection style={{ paddingTop: 0 }}>
523
- <ChHeader>
524
- <CHMomentWrapper isCustomColor={isChewLayout} onPress={() => navigation.navigate('OrderTypes', { configTypes: configTypes })}>
525
- <OText
526
- size={12}
527
- numberOfLines={1}
528
- ellipsizeMode={'tail'}
529
- color={theme.colors?.[isChewLayout ? 'white' : 'textSecondary']}
530
- >
531
- {t(getTypesText(options?.type || 1), 'Delivery')}
532
- </OText>
533
- <OIcon
534
- src={theme.images.general.arrow_down}
535
- width={10}
536
- style={{ marginStart: 8 }}
537
- {...(isChewLayout && { color: 'white' })}
538
- />
539
- </CHMomentWrapper>
540
- <CHMomentWrapper
541
- onPress={() => handleMomentClick()}
542
- disabled={loading}
543
- >
544
- <OText size={12} numberOfLines={1} ellipsizeMode='tail' color={theme.colors.textSecondary}>
545
- {options?.moment
546
- ? parseDate(options?.moment, { outputFormat: configs?.dates_moment_format?.value })
547
- : t('ASAP_ABBREVIATION', 'ASAP')}
548
- </OText>
549
- {isPreOrder && (
550
- <OIcon
551
- src={theme.images.general.arrow_down}
552
- width={10}
553
- style={{ marginStart: 8 }}
554
- />
555
- )}
556
- </CHMomentWrapper>
557
- </ChHeader>
558
- <View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginTop: 18, marginHorizontal: -40 }} />
559
- </ChSection>
560
- )}
561
-
562
- {!isGiftCardCart && !hideBusinessDetails && (
563
- <ChSection>
564
- <ChBusinessDetails>
565
- {
566
- (businessDetails?.loading || cartState.loading || !businessDetails?.business || Object.values(businessDetails?.business).length === 0) &&
567
- !businessDetails?.error &&
568
- (
569
- <Placeholder Animation={Fade}>
570
- <PlaceholderLine height={20} />
571
- <PlaceholderLine height={12} />
572
- <PlaceholderLine height={12} />
573
- <PlaceholderLine height={12} style={{ marginBottom: 20 }} />
574
- </Placeholder>
575
- )}
576
- {
577
- !cartState.loading &&
578
- businessDetails?.business &&
579
- Object.values(businessDetails?.business).length > 0 &&
580
- (
581
- <>
582
- <HeaderTitle text={t('BUSINESS_DETAILS', 'Business Details')} />
583
- <View>
584
- <OText size={12} lineHeight={18} weight={'400'}>
585
- {businessDetails?.business?.name}
586
- </OText>
587
- <OText size={12} lineHeight={18} weight={'400'}>
588
- {businessDetails?.business?.email}
589
- </OText>
590
- <OText size={12} lineHeight={18} weight={'400'}>
591
- {businessDetails?.business?.cellphone}
592
- </OText>
593
- {!hideBusinessAddress && (
594
- <OText size={12} lineHeight={18} weight={'400'}>
595
- {businessDetails?.business?.address}
596
- </OText>
597
- )}
598
- {businessDetails?.business?.address_notes && (
599
- <>
600
- <OText
601
- size={12}
602
- lineHeight={18}
603
- numberOfLines={isReadMore ? 20 : 3}
604
- onTextLayout={onTextLayout}
605
- >
606
- {businessDetails?.business?.address_notes}
607
- </OText>
608
- {lengthMore && (
609
- <TouchableOpacity
610
- onPress={() => setIsReadMore(!isReadMore)}
611
- >
612
- <OText size={12} color={theme.colors.primary}>{isReadMore ? t('SHOW_LESS', 'Show less') : t('READ_MORE', 'Read more')}</OText>
613
- </TouchableOpacity>
614
- )}
615
- </>
616
- )}
617
- </View>
618
- </>
619
- )}
620
- {businessDetails?.error && businessDetails?.error?.length > 0 && (
621
- <View>
622
- <HeaderTitle text={t('BUSINESS_DETAILS', 'Business Details')} />
623
- <NotFoundSource
624
- content={businessDetails?.error[0]?.message || businessDetails?.error[0]}
625
- />
626
- </View>
627
- )}
628
- </ChBusinessDetails>
629
- <View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginHorizontal: -40 }} />
630
- </ChSection>
631
- )}
632
- {!hideCustomerDetails && (
633
-
634
- <ChSection>
635
- <ChUserDetails>
636
- {cartState.loading ? (
637
- <Placeholder Animation={Fade}>
638
- <PlaceholderLine height={20} />
639
- <PlaceholderLine height={12} />
640
- <PlaceholderLine height={12} />
641
- <PlaceholderLine height={12} style={{ marginBottom: 20 }} />
642
- </Placeholder>
643
- ) : (
644
- (user?.guest_id && !allowedGuest) ? (
645
- <View>
646
- <HeaderTitle text={t('CUSTOMER_DETAILS', 'Customer details')} />
647
- <OButton
648
- text={t('SIGN_UP', 'Sign up')}
649
- textStyle={{ color: theme.colors.white }}
650
- bgColor={theme.colors.primary}
651
- borderColor={theme.colors.primary}
652
- style={{ borderRadius: 7.6, marginTop: 20 }}
653
- onClick={() => setOpenModal({ ...openModal, signup: true })}
654
- />
655
- <OButton
656
- text={t('LOGIN', 'Login')}
657
- textStyle={{ color: theme.colors.white }}
658
- bgColor={theme.colors.primary}
659
- borderColor={theme.colors.primary}
660
- style={{ borderRadius: 7.6, marginTop: 20 }}
661
- onClick={() => setOpenModal({ ...openModal, login: true })}
662
- />
663
- <OButton
664
- text={t('CONTINUE_AS_GUEST', 'Continue as guest')}
665
- textStyle={{ color: theme.colors.black }}
666
- bgColor={theme.colors.white}
667
- borderColor={theme.colors.black}
668
- style={{ borderRadius: 7.6, marginTop: 20 }}
669
- onClick={() => setAllowedGuest(true)}
670
- />
671
- </View>
672
- ) : (
673
- <UserDetails
674
- isUserDetailsEdit={isUserDetailsEdit}
675
- HeaderTitle={<HeaderTitle text={t('CUSTOMER_DETAILS', 'Customer Details')} mb={0} />}
676
- cartStatus={cart?.status}
677
- businessId={cart?.business_id}
678
- useValidationFields
679
- useDefualtSessionManager
680
- useSessionUser
681
- isCheckout
682
- phoneUpdate={phoneUpdate}
683
- togglePhoneUpdate={togglePhoneUpdate}
684
- />
685
- )
686
- )}
687
- </ChUserDetails>
688
- <View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginHorizontal: -40 }} />
689
- </ChSection>
690
- )}
691
-
692
- {options?.type === 1 && !isGiftCardCart && (
693
- <DeliveryOptionsContainer>
694
- {cartState.loading || deliveryOptionSelected === undefined ? (
695
- <View style={{ height: 110 }}>
696
- <Placeholder Animation={Fade}>
697
- <PlaceholderLine height={20} />
698
- <PlaceholderLine height={40} />
699
- </Placeholder>
700
- </View>
701
- ) : (
702
- <ChSection>
703
- <HeaderTitle text={t('DELIVERY_OPTIONS', 'Delivery options')} />
704
- <View
705
- style={{
706
- backgroundColor: theme.colors.inputDisabled,
707
- borderRadius: 7.5,
708
- marginBottom: 20,
709
- flex: 1
710
- }}>
711
- <Picker
712
- countryCode={undefined}
713
- visible={isDeliveryOptionModalVisible}
714
- onClose={() => setIsDeliveryOptionModalVisible(false)}
715
- withCountryNameButton
716
- renderFlagButton={() => (
717
- <TouchableOpacity onPress={() => setIsDeliveryOptionModalVisible(true)}>
718
- <DeliveryOptionItem backgroundColor={theme?.colors?.inputDisabled}>
719
- <OText
720
- size={14}
721
- >
722
- {deliveryOptions.find((option: any) => option.value === deliveryOptionSelected)?.label}
723
- </OText>
724
- <MaterialIcons name='keyboard-arrow-down' style={styles.icon} />
725
- </DeliveryOptionItem>
726
- </TouchableOpacity>
727
- )}
728
- flatListProps={{
729
- keyExtractor: (item: any) => item.value,
730
- data: deliveryOptions || [],
731
- renderItem: ({ item }: any) => (
732
- <TouchableOpacity
733
- onPress={() => !!cart?.uuid && changeDeliveryOption(item.value)}
734
- disabled={
735
- deliveryOptionSelected === item.value
736
- }
737
- >
738
- <DeliveryOptionItem backgroundColor={deliveryOptionSelected === item.value ? theme.colors.inputDisabled : 'white'}>
739
- <OText>
740
- {item.label}
741
- </OText>
742
- </DeliveryOptionItem>
743
- </TouchableOpacity>
744
- )
745
- }}
746
- />
747
- </View>
748
- <View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginHorizontal: -40 }} />
749
- </ChSection>
750
- )}
751
-
752
- </DeliveryOptionsContainer>
753
- )}
754
-
755
- {!cartState.loading && (cart?.status === 2 || cart?.status === 4) && (
756
- <ChSection style={{ paddingBottom: 20 }}>
757
- <ChErrors>
758
- {!cartState.loading && cart?.status === 2 && (
759
- <OText
760
- style={{ textAlign: 'center' }}
761
- color={theme.colors.error}
762
- size={17}
763
- >
764
- {t('CART_STATUS_PENDING_MESSAGE_APP', 'Your order is being processed, please wait a little more. if you\'ve been waiting too long, please reload the app')}
765
- </OText>
766
- )}
767
- </ChErrors>
768
- </ChSection>
769
- )}
770
-
771
- {!isGiftCardCart && !hideBusinessMap && (
772
- <ChSection>
773
- <ChAddress>
774
- {(businessDetails?.loading || cartState.loading) ? (
775
- <Placeholder Animation={Fade}>
776
- <PlaceholderLine height={20} style={{ marginBottom: 50 }} />
777
- <PlaceholderLine height={100} />
778
- </Placeholder>
779
- ) : (
780
- <AddressDetails
781
- navigation={navigation}
782
- location={options?.address?.location}
783
- businessLogo={businessDetails?.business?.logo}
784
- isCartPending={cart?.status === 2}
785
- uuid={cartUuid}
786
- apiKey={configs?.google_maps_api_key?.value}
787
- mapConfigs={mapConfigs}
788
- HeaderTitle={<HeaderTitle text={t('DELIVERY_ADDRESS', 'Delivery address')} mb={0} />}
789
- />
790
- )}
791
- </ChAddress>
792
- <View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginTop: 13, marginHorizontal: -40 }} />
793
- </ChSection>
794
- )}
795
-
796
- {!cartState.loading &&
797
- cart &&
798
- cart?.valid &&
799
- options.type === 1 &&
800
- cart?.status !== 2 &&
801
- validationFields?.fields?.checkout?.driver_tip?.enabled &&
802
- driverTipsOptions && driverTipsOptions?.length > 0 &&
803
- cart?.business_id &&
804
- (
805
- <ChSection>
806
- <ChDriverTips>
807
- <HeaderTitle text={t('DRIVER_TIPS', 'Driver Tips')} mb={0} />
808
- <DriverTips
809
- uuid={cartUuid}
810
- businessId={cart?.business_id}
811
- driverTipsOptions={!driverTipsOptions.includes(0) ? [0, ...driverTipsOptions] : driverTipsOptions}
812
- isFixedPrice={parseInt(configs?.driver_tip_type?.value, 10) === 1}
813
- isDriverTipUseCustom={!!parseInt(configs?.driver_tip_use_custom?.value, 10)}
814
- driverTip={parseInt(configs?.driver_tip_type?.value, 10) === 1
815
- ? cart?.driver_tip
816
- : cart?.driver_tip_rate}
817
- useOrderContext
818
- cart={cart}
819
- />
820
- </ChDriverTips>
821
- </ChSection>
822
- )}
823
-
824
- {!cartState.loading && cart && cart?.status !== 2 && cart?.valid && (
825
- <ChSection>
826
- <ChPaymethods>
827
- <HeaderTitle text={t('PAYMENT_METHOD', 'Payment Method')} mb={0} />
828
- {!cartState.loading && cart?.status === 4 && (
829
- <OText
830
- style={{ textAlign: 'center', marginTop: 20 }}
831
- color={theme.colors.error}
832
- size={17}
833
- >
834
- {t('CART_STATUS_CANCEL_MESSAGE', 'The payment has not been successful, please try again')}
835
- </OText>
836
- )}
837
- <PaymentOptions
838
- cart={cart}
839
- isDisabled={cart?.status === 2}
840
- businessId={!isGiftCardCart ? businessDetails?.business?.id : -1}
841
- isLoading={!isGiftCardCart ? businessDetails.loading : false}
842
- paymethods={businessDetails?.business?.paymethods}
843
- onPaymentChange={handlePaymethodChange}
844
- errorCash={errorCash}
845
- setErrorCash={setErrorCash}
846
- onNavigationRedirect={onNavigationRedirect}
847
- paySelected={paymethodSelected}
848
- handlePaymentMethodClickCustom={handlePaymentMethodClick}
849
- handlePlaceOrder={handlePlaceOrder}
850
- merchantId={merchantId}
851
- urlscheme={urlscheme}
852
- androidAppId={androidAppId}
853
- setMethodPaySupported={setMethodPaySupported}
854
- methodPaySupported={methodPaySupported}
855
- placeByMethodPay={placeByMethodPay}
856
- setPlaceByMethodPay={setPlaceByMethodPay}
857
- cardList={cardList}
858
- setCardList={setCardList}
859
- requiredFields={requiredFields}
860
- openUserModal={setIsOpen}
861
- paymethodClicked={paymethodClicked}
862
- setPaymethodClicked={setPaymethodClicked}
863
- />
864
- </ChPaymethods>
865
- </ChSection>
866
- )}
867
-
868
- {!cartState.loading && cart && isWalletEnabled && businessDetails?.business?.configs && (
869
- <WalletPaymentOptionContainer>
870
- <PaymentOptionWallet
871
- cart={cart}
872
- loyaltyPlansState={loyaltyPlansState}
873
- businessId={cart?.business_id}
874
- businessConfigs={businessDetails?.business?.configs}
875
- />
876
- </WalletPaymentOptionContainer>
877
- )}
878
-
879
-
880
- {!cartState.loading && placeSpotsEnabled && !isGiftCardCart && (
881
- <>
882
- <View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginTop: 30, marginHorizontal: -40 }} />
883
- <PlaceSpot
884
- isCheckout
885
- isInputMode
886
- cart={cart}
887
- spotNumberDefault={cartState?.cart?.spot_number ?? cart?.spot_number}
888
- setPlaceSpotNumber={setPlaceSpotNumber}
889
- vehicleDefault={cart?.vehicle}
890
- />
891
- <View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginHorizontal: -40 }} />
892
- </>
893
- )}
894
-
895
- {!cartState.loading && cart && (
896
- <ChSection>
897
- <ChCart>
898
- {cartsWithProducts?.length > 0 && cart?.products?.length === 0 ? (
899
- <NotFoundSource
900
- content={t('NOT_FOUND_CARTS', 'Sorry, You don\'t seem to have any carts.')}
901
- btnTitle={t('SEARCH_REDIRECT', 'Go to Businesses')}
902
- />
903
- ) : (
904
- <>
905
- <CartHeader>
906
- <HeaderTitle text={t('MOBILE_FRONT_YOUR_ORDER', 'Your order')} mb={0} />
907
- {!isGiftCardCart && (
908
- <TouchableOpacity
909
- onPress={() => onNavigationRedirect('Business', { store: cart?.business?.slug })}
910
- >
911
- <OText
912
- size={12}
913
- lineHeight={15}
914
- color={theme.colors.primary}
915
- style={{ textDecorationLine: 'underline' }}
916
- >
917
- {t('ADD_PRODUCTS', 'Add products')}
918
- </OText>
919
- </TouchableOpacity>
920
- )}
921
- </CartHeader>
922
- {isBusinessChangeEnabled && (
923
- <TouchableOpacity
924
- onPress={() => setOpenChangeStore(true)}
925
- style={{ alignSelf: 'flex-start' }}
926
- >
927
- <OText
928
- size={12}
929
- lineHeight={18}
930
- color={theme.colors.primary}
931
- style={{ textDecorationLine: 'underline' }}
932
- >
933
- {t('CHANGE_STORE', 'Change store')}
934
- </OText>
935
- </TouchableOpacity>
936
- )}
937
- <OrderSummary
938
- cart={cart}
939
- isCartPending={cart?.status === 2}
940
- onNavigationRedirect={onNavigationRedirect}
941
- placeSpotTypes={placeSpotTypes}
942
- businessConfigs={businessConfigs}
943
- maxDate={maxDate}
944
- loyaltyRewardRate={
945
- creditPointPlanOnBusiness?.accumulation_rate ??
946
- (!!creditPointPlanOnBusiness && creditPointPlan?.accumulation_rate) ?? 0
947
- }
948
- />
949
- </>
950
- )}
951
- </ChCart>
952
- </ChSection>
953
- )}
954
-
955
- {!cartState.loading && cart && (
956
- <View>
957
- <ChErrors style={{ marginBottom: Platform.OS === 'ios' ? 35 : 10 }}>
958
- {!cart?.valid_address && cart?.status !== 2 && (
959
- <OText
960
- color={theme.colors.error}
961
- size={12}
962
- >
963
- {t('INVALID_CART_ADDRESS', 'Selected address is invalid, please select a closer address.')}
964
- </OText>
965
- )}
966
-
967
- {(!paymethodSelected && cart?.balance > 0) && cart?.status !== 2 && cart?.valid && (
968
- <OText
969
- color={theme.colors.error}
970
- size={12}
971
- >
972
- {t('WARNING_NOT_PAYMENT_SELECTED', 'Please, select a payment method to place order.')}
973
- </OText>
974
- )}
975
-
976
- {!cart?.valid_products && cart?.status !== 2 && cart?.total !== 0 && (
977
- <>
978
- <OText
979
- color={theme.colors.error}
980
- size={12}
981
- >
982
- {t('WARNING_INVALID_PRODUCTS_CHECKOUT', 'To continue with your checkout, please remove from your cart the products that are not available.')}
983
- </OText>
984
- </>
985
- )}
986
- {cart?.valid_preorder !== undefined && !cart?.valid_preorder && (
987
- <OText
988
- color={theme.colors.error}
989
- size={12}
990
- >
991
- {t('INVALID_CART_MOMENT', 'Selected schedule time is invalid, please select a schedule into the business schedule interval.')}
992
- </OText>
993
- )}
994
- {options.type === 1 && !isGiftCardCart &&
995
- validationFields?.fields?.checkout?.driver_tip?.enabled &&
996
- validationFields?.fields?.checkout?.driver_tip?.required &&
997
- (Number(cart?.driver_tip) <= 0) && (
998
- <OText
999
- color={theme.colors.error}
1000
- size={12}
1001
- >
1002
- {t('WARNING_INVALID_DRIVER_TIP', 'Driver Tip is required.')}
1003
- </OText>
1004
- )}
1005
-
1006
- {validateCommentsCartField && (
1007
- <OText
1008
- color={theme.colors.error}
1009
- size={12}
1010
- >
1011
- {t('WARNING_INVALID_CART_COMMENTS', 'Cart comments is required.')}
1012
- </OText>
1013
- )}
1014
-
1015
- {validateZipcodeCard && (
1016
- <OText
1017
- color={theme.colors.error}
1018
- size={12}
1019
- >
1020
- {t('WARNING_CARD_ZIPCODE_REQUIRED', 'Your card selected has not zipcode')}
1021
- </OText>
1022
- )}
1023
- </ChErrors>
1024
- </View>
1025
- )}
1026
- <OModal
1027
- open={openChangeStore}
1028
- entireModal
1029
- customClose
1030
- onClose={() => setOpenChangeStore(false)}
1031
- >
1032
- <CartStoresListing
1033
- cartuuid={cart?.uuid}
1034
- onClose={() => setOpenChangeStore(false)}
1035
- />
1036
- </OModal>
1037
- <OModal
1038
- open={isOpen}
1039
- onClose={() => setIsOpen(false)}
1040
- >
1041
- <View style={styles.detailWrapper}>
1042
- <UserDetails
1043
- isUserDetailsEdit
1044
- cartStatus={cart?.status}
1045
- businessId={cart?.business_id}
1046
- useValidationFields
1047
- useDefualtSessionManager
1048
- useSessionUser
1049
- isCheckout
1050
- isEdit
1051
- phoneUpdate={phoneUpdate}
1052
- togglePhoneUpdate={togglePhoneUpdate}
1053
- requiredFields={requiredFields}
1054
- hideUpdateButton
1055
- handlePlaceOrderAsGuest={handlePlaceOrderAsGuest}
1056
- onClose={() => {
1057
- setIsOpen(false)
1058
- if (paymethodClicked) {
1059
- setPaymethodClicked({
1060
- ...paymethodClicked,
1061
- confirmed: true
1062
- })
1063
- } else {
1064
- handlePlaceOrder(null, true)
1065
- }
1066
- }}
1067
- setIsOpen={setIsOpen}
1068
- />
1069
- </View>
1070
- </OModal>
1071
- <OModal
1072
- open={openModal.signup}
1073
- onClose={() => setOpenModal({ ...openModal, signup: false, isGuest: false })}
1074
- >
1075
- <ScrollView style={{ paddingHorizontal: 20, width: '100%' }}>
1076
- <SignupForm
1077
- handleSuccessSignup={handleSuccessSignup}
1078
- isGuest
1079
- signupButtonText={t('SIGNUP', 'Signup')}
1080
- useSignupByEmail
1081
- useChekoutFileds
1082
- />
1083
- </ScrollView>
1084
- </OModal>
1085
- <OModal
1086
- open={openModal.login}
1087
- onClose={() => setOpenModal({ ...openModal, login: false })}
1088
- >
1089
- <ScrollView style={{ paddingHorizontal: 20, width: '100%' }}>
1090
- <LoginForm
1091
- handleSuccessLogin={handleSuccessLogin}
1092
- isGuest
1093
- loginButtonText={t('LOGIN', 'Login')}
1094
- loginButtonBackground={theme.colors.primary}
1095
- />
1096
- </ScrollView>
1097
- </OModal>
1098
- </ChContainer>
1099
- </Container>
1100
- {!cartState.loading && cart && cart?.status !== 2 && (
1101
- <FloatingButton
1102
- handleClick={
1103
- isDisabledButtonPlace
1104
- ? () => vibrateApp()
1105
- : methodsPay.includes(paymethodSelected?.gateway)
1106
- ? () => setPlaceByMethodPay(true)
1107
- : () => handlePlaceOrder(null)}
1108
- isSecondaryBtn={isDisabledButtonPlace}
1109
- disabled={isDisabledButtonPlace}
1110
- btnText={subtotalWithTaxes >= cart?.minimum
1111
- ? (
1112
- placing
1113
- ? t('PLACING', 'Placing')
1114
- : loading
1115
- ? t('LOADING', 'Loading')
1116
- : t('PLACE_ORDER', 'Place Order')
1117
- )
1118
- : (`${t('MINIMUN_SUBTOTAL_ORDER', 'Minimum subtotal order:')} ${parsePrice(cart?.minimum)}`)
1119
- }
1120
- btnRightValueShow
1121
- btnRightValue={parsePrice(cart?.balance)}
1122
- iosBottom={30}
1123
- />
1124
- )}
1125
- {webviewPaymethod?.gateway === 'paypal' && showGateway.open && (
1126
- <PaymentOptionsWebView
1127
- onNavigationRedirect={onNavigationRedirect}
1128
- uri={`${ordering.root}/html/paypal_react_native`}
1129
- user={user}
1130
- token={token}
1131
- cart={cart}
1132
- currency={currency}
1133
- webviewPaymethod={webviewPaymethod}
1134
- setShowGateway={setShowGateway}
1135
- />
1136
- )}
1137
- {webviewPaymethod?.gateway === 'square' && showGateway.open && (
1138
- <PaymentOptionsWebView
1139
- onNavigationRedirect={onNavigationRedirect}
1140
- uri={`https://test-square-f50f7.web.app`}
1141
- user={user}
1142
- token={token}
1143
- cart={cart}
1144
- currency={currency}
1145
- webviewPaymethod={webviewPaymethod}
1146
- setShowGateway={setShowGateway}
1147
- locationId={'L1NGAY5M6KJRX'}
1148
- />
1149
- )}
1150
- {cart?.paymethod_data?.gateway === 'credomatic' && cart?.paymethod_data?.status === 2 && showGateway.open && (
1151
- <PaymentOptionsWebView
1152
- title={t('CREDOMATIC_PAYMENT', 'Credomatic payment')}
1153
- onNavigationRedirect={onNavigationRedirect}
1154
- uri={credomaticUrl}
1155
- user={user}
1156
- cart={cart}
1157
- additionalParams={{
1158
- type: 'auth',
1159
- key_id: credomaticKeyId,
1160
- hash: cart?.paymethod_data?.result?.hash,
1161
- time: cart?.paymethod_data?.result?.time,
1162
- amount: cart?.total,
1163
- orderid: cart?.uuid,
1164
- ccnumber: cardList?.cards?.[0]?.number,
1165
- ccexp: cardList?.cards?.[0]?.expiryString,
1166
- cvv: cardList?.cards?.[0]?.cvc,
1167
- redirect: credomaticUrl
1168
- }}
1169
- webviewPaymethod={webviewPaymethod}
1170
- setShowGateway={setShowGateway}
1171
- />
1172
- )}
1173
- </>
1174
- )
1175
- }
1176
-
1177
- export const Checkout = (props: any) => {
1178
- const {
1179
- errors,
1180
- clearErrors,
1181
- cartUuid,
1182
- stripePaymentOptions,
1183
- onNavigationRedirect,
1184
- } = props
1185
-
1186
- const [, { showToast }] = useToast();
1187
- const [, t] = useLanguage();
1188
- const [{ token }] = useSession();
1189
- const [ordering] = useApi();
1190
- const [, { confirmCart }] = useOrder();
1191
- const { confirmPayment, loading: confirmPaymentLoading } = useConfirmPayment();
1192
-
1193
- const [cartState, setCartState] = useState<any>({ loading: true, error: [], cart: null });
1194
- const [orderState] = useOrder()
1195
-
1196
- const getOrder = async (cartId: any) => {
1197
- try {
1198
- let result: any = {}
1199
- const cartsWithProducts = orderState?.carts && (Object.values(orderState?.carts)?.filter(cart => cart?.products && cart?.products?.length) || null)
1200
- const cart = cartsWithProducts?.find((cart: any) => cart.uuid === cartId)
1201
- if (cart) {
1202
- result = { ...cart }
1203
- } else {
1204
- setCartState({ ...cartState, loading: true })
1205
- const url = `${ordering.root}/carts/${cartId}`
1206
- const response = await fetch(url, {
1207
- method: 'GET',
1208
- headers: {
1209
- 'Content-Type': 'application/json',
1210
- Authorization: `Bearer ${token}`
1211
- }
1212
- })
1213
- const content = await response.json();
1214
- result = content.result
1215
- }
1216
-
1217
- let publicKey = null
1218
- try {
1219
- const { content } = await ordering.setAccessToken(token).paymentCards().getCredentials();
1220
- if (!content.error) {
1221
- publicKey = content.result.publishable;
1222
- }
1223
- } catch (error) {
1224
- publicKey = null
1225
- }
1226
-
1227
- if (result.status === 1 && result.order?.uuid) {
1228
- onNavigationRedirect('OrderDetails', { orderId: result.order.uuid })
1229
- setCartState({ ...cartState, loading: false })
1230
- } else if (result.status === 2 && result.paymethod_data?.gateway === 'stripe_redirect') {
1231
- try {
1232
- const confirmCartRes = await confirmCart(cartUuid)
1233
- if (confirmCartRes.error) {
1234
- showToast(ToastType.Error, confirmCartRes.error.message)
1235
- }
1236
- if (confirmCartRes.result.order?.uuid) {
1237
- onNavigationRedirect('OrderDetails', { orderId: confirmCartRes.result.order.uuid, isFromCheckout: true })
1238
- }
1239
- setCartState({
1240
- ...cartState,
1241
- loading: false,
1242
- cart: result
1243
- })
1244
- } catch (err: any) {
1245
- showToast(ToastType.Error, err?.toString() || err.message)
1246
- }
1247
- } else if (result.status === 2 && stripePaymentOptions.includes(result.paymethod_data?.gateway)) {
1248
- const clientSecret = result.paymethod_data?.result?.client_secret
1249
- const paymentMethodId = result.paymethod_data?.data?.source_id;
1250
-
1251
- initStripe({ publishableKey: publicKey });
1252
-
1253
- try {
1254
- const { paymentIntent, error } = await confirmPayment(clientSecret, {
1255
- type: 'Card',
1256
- paymentMethodId
1257
- });
1258
-
1259
- try {
1260
- const confirmCartRes = await confirmCart(cartUuid)
1261
- if (confirmCartRes.error) {
1262
- showToast(ToastType.Error, confirmCartRes.error.message)
1263
- setCartState({
1264
- ...cartState,
1265
- loading: false,
1266
- cart: result
1267
- })
1268
- return
1269
- }
1270
- if (confirmCartRes.result.order?.uuid) {
1271
- onNavigationRedirect('OrderDetails', { orderId: confirmCartRes.result.order.uuid, isFromCheckout: true })
1272
- setCartState({ ...cartState, loading: false })
1273
- } else {
1274
- showToast(ToastType.Error, t('FAILED_PAYMENT', 'The payment has failed'));
1275
- const cart = Array.isArray(result) ? null : result
1276
- setCartState({
1277
- ...cartState,
1278
- loading: false,
1279
- cart,
1280
- error: cart ? null : result
1281
- })
1282
- return
1283
- }
1284
- } catch (error: any) {
1285
- showToast(ToastType.Error, error?.toString() || error.message)
1286
- }
1287
- } catch (error) {
1288
- showToast(ToastType.Error, t('FAILED_PAYMENT', 'The payment has failed'));
1289
- const cart = Array.isArray(result) ? null : result
1290
- setCartState({
1291
- ...cartState,
1292
- loading: false,
1293
- cart,
1294
- error: cart ? null : result
1295
- })
1296
- }
1297
- } else {
1298
- const cart = Array.isArray(result) ? null : result
1299
- setCartState({
1300
- ...cartState,
1301
- loading: false,
1302
- cart,
1303
- error: cart ? null : result
1304
- })
1305
- }
1306
- } catch (e: any) {
1307
- setCartState({
1308
- ...cartState,
1309
- loading: false,
1310
- error: [e.toString()]
1311
- })
1312
- }
1313
- }
1314
-
1315
- useEffect(() => {
1316
- if (errors) {
1317
- const errorText = manageErrorsToShow(errors)
1318
- showToast(ToastType.Error, errorText)
1319
- clearErrors && clearErrors()
1320
- }
1321
- }, [errors])
1322
-
1323
- useEffect(() => {
1324
- if (token && cartUuid) {
1325
- getOrder(cartUuid)
1326
- }
1327
- }, [token, cartUuid])
1328
-
1329
- const checkoutProps = {
1330
- ...props,
1331
- UIComponent: CheckoutUI,
1332
- cartState,
1333
- uuid: cartUuid
1334
- }
1335
-
1336
- return (
1337
- <>
1338
- <CheckoutController {...checkoutProps} />
1339
- </>
1340
- )
1341
- }
1
+ import React, { useState, useEffect, useCallback, useRef, useMemo } from 'react';
2
+ import { View, StyleSheet, TouchableOpacity, Platform, I18nManager, ScrollView, Keyboard, BackHandler, SafeAreaView } from 'react-native';
3
+ import { initStripe, useConfirmPayment } from '@stripe/stripe-react-native';
4
+ import NativeStripeSdk from '@stripe/stripe-react-native/src/NativeStripeSdk'
5
+ import Picker from 'react-native-country-picker-modal';
6
+ import MaterialIcons from 'react-native-vector-icons/MaterialIcons'
7
+ import IconAntDesign from 'react-native-vector-icons/AntDesign';
8
+ import { useIsFocused } from '@react-navigation/native';
9
+
10
+ import ReactNativeHapticFeedback, { HapticFeedbackTypes } from "react-native-haptic-feedback";
11
+ import {
12
+ Checkout as CheckoutController,
13
+ useOrder,
14
+ useSession,
15
+ useApi,
16
+ useLanguage,
17
+ useUtils,
18
+ useConfig,
19
+ useToast,
20
+ ToastType,
21
+ useEvent
22
+ } from 'ordering-components/native';
23
+ import { useTheme } from 'styled-components/native';
24
+ import { OText, OIcon, OModal, OButton } from '../shared';
25
+
26
+ import { AddressDetails } from '../AddressDetails';
27
+ import { PaymentOptions } from '../PaymentOptions';
28
+ import { DriverTips } from '../DriverTips';
29
+ import { NotFoundSource } from '../NotFoundSource';
30
+ import { UserDetails } from '../UserDetails';
31
+ import { PaymentOptionWallet } from '../PaymentOptionWallet';
32
+ import { PlaceSpot } from '../PlaceSpot'
33
+ import { SignupForm } from '../SignupForm'
34
+ import { LoginForm } from '../LoginForm'
35
+
36
+ import {
37
+ ChContainer,
38
+ ChSection,
39
+ ChHeader,
40
+ ChAddress,
41
+ CHMomentWrapper,
42
+ ChPaymethods,
43
+ ChDriverTips,
44
+ ChErrors,
45
+ ChBusinessDetails,
46
+ ChUserDetails,
47
+ ChCart,
48
+ DeliveryOptionsContainer,
49
+ DeliveryOptionItem,
50
+ WalletPaymentOptionContainer,
51
+ CartHeader,
52
+ TopHeader,
53
+ TopActions
54
+ } from './styles';
55
+ import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder';
56
+ import { FloatingButton } from '../FloatingButton';
57
+ import { Container } from '../../layouts/Container';
58
+ import NavBar from '../NavBar';
59
+ import { OrderSummary } from '../OrderSummary';
60
+ import { getTypesText } from '../../utils';
61
+ import { CartStoresListing } from '../CartStoresListing';
62
+ import { PaymentOptionsWebView } from '../../../../../src/components/PaymentOptionsWebView';
63
+ import { DeviceOrientationMethods } from '../../../../../src/hooks/DeviceOrientation'
64
+ const { useDeviceOrientation } = DeviceOrientationMethods
65
+
66
+ const mapConfigs = {
67
+ mapZoom: 16,
68
+ mapSize: {
69
+ width: 640,
70
+ height: 190
71
+ }
72
+ };
73
+
74
+ const manageErrorsToShow = (array = []) => {
75
+ let stringError = ''
76
+ const list = Array.isArray(array) ? array : Object.values(array)
77
+ list.map((item: any, i: number) => {
78
+ stringError += (i + 1) === array.length ? `- ${item?.message || item}` : `- ${item?.message || item}\n`
79
+ })
80
+ return stringError;
81
+ }
82
+
83
+ const CheckoutUI = (props: any) => {
84
+ const {
85
+ navigation,
86
+ cart,
87
+ errors,
88
+ placing,
89
+ cartState,
90
+ cartUuid,
91
+ loyaltyPlansState,
92
+ businessDetails,
93
+ paymethodSelected,
94
+ handlePaymethodChange,
95
+ handlerClickPlaceOrder,
96
+ onNavigationRedirect,
97
+ deliveryOptionSelected,
98
+ instructionsOptions,
99
+ handleChangeDeliveryOption,
100
+ currency,
101
+ merchantId,
102
+ setPlaceSpotNumber,
103
+ maxDate,
104
+ androidAppId,
105
+ urlscheme,
106
+ checkoutFieldsState
107
+ } = props
108
+
109
+ const theme = useTheme();
110
+ const isFocused = useIsFocused();
111
+
112
+ const styles = StyleSheet.create({
113
+ btnBackArrow: {
114
+ borderWidth: 0,
115
+ backgroundColor: theme.colors.white,
116
+ borderColor: theme.colors.white,
117
+ shadowColor: theme.colors.white,
118
+ display: 'flex',
119
+ justifyContent: 'flex-start',
120
+ paddingLeft: 0,
121
+ },
122
+ paddSection: {
123
+ padding: 20
124
+ },
125
+ pagePadding: {
126
+ paddingHorizontal: 20
127
+ },
128
+ icon: {
129
+ top: 15,
130
+ right: Platform.OS === 'ios' ? 5 : (I18nManager.isRTL ? 30 : 0),
131
+ position: 'absolute',
132
+ fontSize: 20
133
+ },
134
+ detailWrapper: {
135
+ paddingHorizontal: 20,
136
+ width: '100%'
137
+ },
138
+ wrapperNavbar: {
139
+ paddingVertical: 2,
140
+ paddingHorizontal: 20,
141
+ backgroundColor: theme?.colors?.white,
142
+ borderWidth: 0
143
+ }
144
+ })
145
+
146
+ const [, { showToast }] = useToast();
147
+ const [, t] = useLanguage();
148
+ const [{ user, token, loading: userLoading }, { login }] = useSession();
149
+ const [ordering] = useApi()
150
+ const [{ configs }] = useConfig();
151
+ const [{ parsePrice, parseDate }] = useUtils();
152
+ const [{ options, carts, loading }, { confirmCart }] = useOrder();
153
+ const [events] = useEvent()
154
+ const [orientationState] = useDeviceOrientation();
155
+ const [isReadMore, setIsReadMore] = useState(false)
156
+ const [lengthMore, setLengthMore] = useState(false)
157
+ const WIDTH_SCREEN = orientationState?.dimensions?.width
158
+
159
+ const [errorCash, setErrorCash] = useState(false);
160
+ const [userErrors, setUserErrors] = useState<any>([]);
161
+ const [isUserDetailsEdit, setIsUserDetailsEdit] = useState(false);
162
+ const [phoneUpdate, setPhoneUpdate] = useState(false);
163
+ const [openChangeStore, setOpenChangeStore] = useState(false)
164
+ const [isDeliveryOptionModalVisible, setIsDeliveryOptionModalVisible] = useState(false)
165
+ const [showGateway, setShowGateway] = useState<any>({ closedByUser: false, open: false });
166
+ const [webviewPaymethod, setWebviewPaymethod] = useState<any>(null)
167
+ const [isOpen, setIsOpen] = useState(false)
168
+ const [requiredFields, setRequiredFields] = useState<any>([])
169
+ const [orderTypeValidationFields, setOrderTypeValidationFields] = useState<any>([])
170
+ const [openModal, setOpenModal] = useState({ login: false, signup: false, isGuest: false })
171
+ const [allowedGuest, setAllowedGuest] = useState(false)
172
+ const [placeByMethodPay, setPlaceByMethodPay] = useState(false)
173
+ const [methodPaySupported, setMethodPaySupported] = useState({ enabled: false, message: null, loading: true })
174
+ const [paymethodClicked, setPaymethodClicked] = useState<any>(null)
175
+ const [showTitle, setShowTitle] = useState(false)
176
+ const [cardList, setCardList] = useState<any>({ cards: [], loading: false, error: null })
177
+ const [isGiftCardCart, setIsGiftCardCart] = useState(!cart?.business_id)
178
+ const [userHasCards, setUserHasCards] = useState(false)
179
+ const containerRef = useRef<any>()
180
+ const cardsMethods = ['credomatic']
181
+ const stripePaymethods: any = ['stripe', 'stripe_connect', 'stripe_redirect']
182
+ const cardsPaymethods: any = ['stripe', 'stripe_connect']
183
+
184
+ const notFields = ['coupon', 'driver_tip', 'mobile_phone', 'address', 'zipcode', 'address_notes', 'comments']
185
+
186
+ const checkoutFields = useMemo(() => checkoutFieldsState?.fields?.filter((field: any) => field.order_type_id === options?.type), [checkoutFieldsState, options])
187
+ const guestCheckoutDriveTip = useMemo(() => checkoutFields?.find((field: any) => field.order_type_id === 1 && field?.validation_field?.code === 'driver_tip'), [JSON.stringify(checkoutFields), options])
188
+ const guestCheckoutComment = useMemo(() => checkoutFields?.find((field: any) => field.order_type_id === options?.type && field?.validation_field?.code === 'comments'), [JSON.stringify(checkoutFields), options])
189
+ const guestCheckoutCoupon = useMemo(() => checkoutFields?.find((field: any) => field.order_type_id === options?.type && field?.validation_field?.code === 'coupon'), [JSON.stringify(checkoutFields), options])
190
+ const guestCheckoutZipcode = useMemo(() => checkoutFields?.find((field: any) => field.order_type_id === options?.type && field?.validation_field?.code === 'zipcode'), [JSON.stringify(checkoutFields), options])
191
+
192
+ const placeSpotTypes = [3, 4, 5]
193
+ const placeSpotsEnabled = placeSpotTypes.includes(options?.type)
194
+ const businessConfigs = businessDetails?.business?.configs ?? []
195
+ const isWalletCashEnabled = businessConfigs.find((config: any) => config.key === 'wallet_cash_enabled')?.value === '1'
196
+ const isWalletCreditPointsEnabled = businessConfigs.find((config: any) => config.key === 'wallet_credit_point_enabled')?.value === '1'
197
+ const isWalletEnabled = configs?.cash_wallet?.value && configs?.wallet_enabled?.value === '1' && (isWalletCashEnabled || isWalletCreditPointsEnabled)
198
+ const isBusinessChangeEnabled = configs?.cart_change_business_validation?.value === '1'
199
+ const isChewLayout = theme?.header?.components?.layout?.type?.toLowerCase() === 'chew'
200
+ const hideBusinessAddress = theme?.checkout?.components?.business?.components?.address?.hidden
201
+ const hideBusinessDetails = theme?.checkout?.components?.business?.hidden
202
+ const hideBusinessMap = theme?.checkout?.components?.business?.components?.map?.hidden
203
+ const hideCustomerDetails = theme?.checkout?.components?.customer?.hidden
204
+
205
+ const creditPointPlan = loyaltyPlansState?.result?.find((loyal: any) => loyal.type === 'credit_point')
206
+ const creditPointPlanOnBusiness = creditPointPlan?.businesses?.find((b: any) => b.business_id === cart?.business_id && b.accumulates)
207
+ const methodsPay = ['google_pay', 'apple_pay']
208
+
209
+ const commentDelayTime = 1500
210
+ const isPreOrder = configs?.preorder_status_enabled?.value === '1'
211
+ const subtotalWithTaxes = cart?.taxes?.reduce((acc: any, item: any) => {
212
+ if (item?.type === 1)
213
+ return acc = acc + item?.summary?.tax
214
+ return acc = acc
215
+ }, cart?.subtotal)
216
+
217
+ const validateCommentsCartField = (guestCheckoutComment?.enabled && (user?.guest_id ? guestCheckoutComment?.required_with_guest : guestCheckoutComment?.required)) && (cart?.comment === null || cart?.comment?.trim().length === 0)
218
+ const validateDriverTipField = options.type === 1 && (guestCheckoutDriveTip?.enabled && (user?.guest_id ? guestCheckoutDriveTip?.required_with_guest : guestCheckoutDriveTip?.required)) && (Number(cart?.driver_tip) <= 0)
219
+ const validateCouponField = (guestCheckoutCoupon?.enabled && (user?.guest_id ? guestCheckoutCoupon?.required_with_guest : guestCheckoutCoupon?.required)) && !cart?.offers?.some((offer: any) => offer?.type === 2)
220
+ const validateZipcodeCard = (guestCheckoutZipcode?.enabled && (user?.guest_id ? guestCheckoutZipcode?.required_with_guest : guestCheckoutZipcode?.required)) && paymethodSelected?.gateway === 'stripe' && paymethodSelected?.data?.card && !paymethodSelected?.data?.card?.zipcode
221
+
222
+ const isDisabledButtonPlace = loading || !cart?.valid || (!paymethodSelected && cart?.balance > 0) ||
223
+ placing || errorCash || subtotalWithTaxes < cart?.minimum ||
224
+ (cardsMethods.includes(paymethodSelected?.gateway) && cardList?.cards?.length === 0) ||
225
+ (validateCommentsCartField) ||
226
+ (validateDriverTipField && !isGiftCardCart) ||
227
+ (validateZipcodeCard) ||
228
+ (methodsPay.includes(paymethodSelected?.gateway) && (!methodPaySupported.enabled || methodPaySupported.loading)) ||
229
+ validateCommentsCartField ||
230
+ validateDriverTipField ||
231
+ validateCouponField ||
232
+ validateZipcodeCard ||
233
+ (!userHasCards && cardsPaymethods.includes(paymethodSelected?.gateway))
234
+
235
+ const driverTipsOptions = typeof configs?.driver_tip_options?.value === 'string'
236
+ ? JSON.parse(configs?.driver_tip_options?.value) || []
237
+ : configs?.driver_tip_options?.value || []
238
+ const driverTipsField = !cartState.loading && cart && cart?.business_id && options.type === 1 && cart?.status !== 2 && (guestCheckoutDriveTip?.enabled) && driverTipsOptions.length > 0
239
+
240
+ const configTypes = configs?.order_types_allowed?.value.split('|').map((value: any) => Number(value)) || []
241
+
242
+ const cartsWithProducts = carts && Object.values(carts).filter((cart: any) => cart.products.length) || null
243
+
244
+ const isSandboxCredomatic = configs?.credomatic_integration_sandbox?.value === '1'
245
+ const credomaticKeyId = isSandboxCredomatic ? configs?.credomatic_integration_public_sandbox_key?.value : configs?.credomatic_integration_public_production_key?.value
246
+ const credomaticUrl = `https://integrations.ordering.co/credomatic/front/auth_mobile.html?title=${t('CREDOMATIC_PAYMENT', 'Credomatic payment')}&body=${t('CREDOMATIC_PROCESSING', 'Processing transaction')}`
247
+ const deliveryOptions = instructionsOptions?.result && instructionsOptions?.result?.filter((option: any) => option?.enabled)?.map((option: any) => {
248
+ return {
249
+ value: option?.id, key: option?.id, label: t(option?.name.toUpperCase().replace(/\s/g, '_'), option?.name)
250
+ }
251
+ })
252
+
253
+ const handleMomentClick = () => {
254
+ if (isPreOrder) {
255
+ navigation.navigate('MomentOption')
256
+ }
257
+ }
258
+
259
+ const vibrateApp = (impact?: HapticFeedbackTypes) => {
260
+ const options = {
261
+ enableVibrateFallback: true,
262
+ ignoreAndroidSystemSettings: false
263
+ };
264
+ ReactNativeHapticFeedback.trigger(impact || "impactLight", options);
265
+ }
266
+
267
+ const handleSuccessSignup = async (user: any) => {
268
+ await login({
269
+ user,
270
+ token: user?.session?.access_token
271
+ })
272
+ setOpenModal({ ...openModal, signup: false, isGuest: false })
273
+ }
274
+
275
+ const handleSuccessLogin = (user: any) => {
276
+ if (user) setOpenModal({ ...openModal, login: false })
277
+ }
278
+
279
+ const handlePlaceOrder = (confirmPayment: any, forcePlace: boolean = false) => {
280
+ if (stripePaymethods.includes(paymethodSelected?.gateway) && user?.guest_id) {
281
+ setOpenModal({ ...openModal, signup: true, isGuest: true })
282
+ return
283
+ }
284
+
285
+ if (!userErrors.length && (!requiredFields?.length) || forcePlace) {
286
+ vibrateApp()
287
+ handlerClickPlaceOrder && handlerClickPlaceOrder(null, { isNative: true }, confirmPayment, NativeStripeSdk?.dismissPlatformPay)
288
+ return
289
+ }
290
+ if (requiredFields?.length) {
291
+ setIsOpen(true)
292
+ return
293
+ }
294
+ let stringError = ''
295
+ Object.values(userErrors).map((item: any, i: number) => {
296
+ stringError += (i + 1) === userErrors.length ? `- ${item?.message || item}` : `- ${item?.message || item}\n`
297
+ })
298
+ showToast(ToastType.Error, stringError)
299
+ setIsUserDetailsEdit(true)
300
+ }
301
+
302
+ const handlePlaceOrderAsGuest = () => {
303
+ setIsOpen(false)
304
+ handlerClickPlaceOrder && handlerClickPlaceOrder()
305
+ }
306
+
307
+ const handlePaymentMethodClick = (paymethod: any) => {
308
+ setShowGateway({ closedByUser: false, open: true })
309
+ setWebviewPaymethod(paymethod)
310
+ }
311
+
312
+ const onFailPaypal = async () => {
313
+ if (showGateway.closedByUser === true) {
314
+ await confirmCart(cart.uuid)
315
+ }
316
+ }
317
+ const changeDeliveryOption = (option: any) => {
318
+ handleChangeDeliveryOption(option)
319
+ setIsDeliveryOptionModalVisible(false)
320
+ }
321
+
322
+ const checkValidationFields = () => {
323
+ setUserErrors([])
324
+ const errors: Array<string> = []
325
+ const userSelected = user
326
+ const _requiredFields: Array<string> = []
327
+ Object.values(checkoutFieldsState?.fields).map((field: any) => {
328
+ if (options?.type === field?.order_type_id &&
329
+ field?.enabled &&
330
+ field?.required &&
331
+ !notFields.includes(field?.validation_field?.code)
332
+ ) {
333
+ if (userSelected && !userSelected[field?.validation_field?.code]) {
334
+ _requiredFields.push(field?.validation_field?.code)
335
+ }
336
+ }
337
+ })
338
+ const mobilePhoneField: any = Object.values(checkoutFieldsState?.fields)?.find((field: any) => field?.order_type_id === options?.type && field?.validation_field?.code === 'mobile_phone')
339
+ if (
340
+ userSelected &&
341
+ !userSelected?.cellphone &&
342
+ ((mobilePhoneField?.enabled &&
343
+ mobilePhoneField?.required) ||
344
+ configs?.verification_phone_required?.value === '1')
345
+ ) {
346
+ _requiredFields.push('cellphone')
347
+ }
348
+ setRequiredFields(_requiredFields)
349
+
350
+ setUserErrors(errors)
351
+ }
352
+
353
+ const checkGuestValidationFields = () => {
354
+ const userSelected = user
355
+ const _requiredFields = checkoutFieldsState?.fields
356
+ .filter((field: any) => (field?.order_type_id === options?.type) && field?.enabled && field?.required_with_guest &&
357
+ !notFields.includes(field?.validation_field?.code) &&
358
+ field?.validation_field?.code !== 'email' &&
359
+ userSelected && !userSelected[field?.validation_field?.code])
360
+ const requiredFieldsCode = _requiredFields.map((item: any) => item?.validation_field?.code)
361
+ const guestCheckoutCellPhone = checkoutFieldsState?.fields?.find((field: any) => field.order_type_id === options?.type && field?.validation_field?.code === 'mobile_phone')
362
+ const guestCheckoutEmail = checkoutFieldsState?.fields?.find((field: any) => field.order_type_id === options?.type && field?.validation_field?.code === 'email')
363
+ if (
364
+ userSelected &&
365
+ !userSelected?.guest_cellphone &&
366
+ ((guestCheckoutCellPhone?.enabled &&
367
+ guestCheckoutCellPhone?.required_with_guest) ||
368
+ configs?.verification_phone_required?.value === '1')
369
+ ) {
370
+ requiredFieldsCode.push('cellphone')
371
+ }
372
+ if (
373
+ userSelected &&
374
+ !userSelected?.guest_email &&
375
+ guestCheckoutEmail?.enabled &&
376
+ guestCheckoutEmail?.required_with_guest
377
+ ) {
378
+ requiredFieldsCode.push('email')
379
+ }
380
+ setRequiredFields(requiredFieldsCode)
381
+ }
382
+
383
+ const togglePhoneUpdate = (val: boolean) => {
384
+ setPhoneUpdate(val)
385
+ }
386
+
387
+ const handleScroll = ({ nativeEvent: { contentOffset } }: any) => {
388
+ setShowTitle(contentOffset.y > 30)
389
+ }
390
+
391
+ const handleRedirect = () => {
392
+ props.fromProductsList
393
+ ? navigation?.goBack()
394
+ : onNavigationRedirect('BottomTab', { screen: 'Cart' }, !props.fromMulti)
395
+ }
396
+
397
+ useEffect(() => {
398
+ if (checkoutFieldsState?.loading || userLoading) return
399
+ if (user?.guest_id) {
400
+ checkGuestValidationFields()
401
+ } else {
402
+ checkValidationFields()
403
+ }
404
+ }, [checkoutFieldsState, user, options?.type])
405
+
406
+ useEffect(() => {
407
+ if (errors) {
408
+ const errorText = manageErrorsToShow(errors)
409
+ showToast(ToastType.Error, errorText)
410
+ }
411
+ }, [errors])
412
+
413
+ useEffect(() => {
414
+ if (cart?.products?.length === 0 || !userLoading) return
415
+ if (cart?.business_id !== null) {
416
+ onNavigationRedirect('Business', { store: cart?.business?.slug, header: null, logo: null, fromMulti: props.fromMulti })
417
+ return
418
+ }
419
+ if (isGiftCardCart) {
420
+ onNavigationRedirect('Wallets')
421
+ return
422
+ }
423
+ }, [cart?.products?.length])
424
+
425
+ useEffect(() => {
426
+ if (cart?.products?.length > 0) {
427
+ if (cart?.uuid && cart?.business_id === null) {
428
+ setIsGiftCardCart(true)
429
+ } else {
430
+ setIsGiftCardCart(false)
431
+ }
432
+ }
433
+ }, [cart?.uuid, cart?.products?.length])
434
+
435
+ useEffect(() => {
436
+ onFailPaypal()
437
+ }, [showGateway.closedByUser])
438
+
439
+ const HeaderTitle = (props: any) => {
440
+ const { text } = props
441
+ return (
442
+ <OText
443
+ size={16}
444
+ lineHeight={24}
445
+ weight={'500'}
446
+ mBottom={props.mb ?? 10}
447
+ color={theme.colors.textNormal}
448
+ >
449
+ {text}
450
+ </OText>
451
+ )
452
+ }
453
+
454
+ useEffect(() => {
455
+ cart && events.emit('checkout_started', cart)
456
+ }, [])
457
+
458
+ useEffect(() => {
459
+ if (cart?.paymethod_data?.gateway === 'credomatic') {
460
+ if (cart?.paymethod_data?.status === 2) {
461
+ setShowGateway({ ...showGateway, open: true })
462
+ } else if (cart?.paymethod_data?.gateway === 'credomatic' && cart?.paymethod_data?.status === 4) {
463
+ setShowGateway({ ...showGateway, open: false })
464
+ }
465
+ }
466
+ }, [cart?.paymethod_data])
467
+
468
+ const onTextLayout = useCallback((e: any) => {
469
+ setLengthMore((e.nativeEvent.lines.length == 3 && e.nativeEvent.lines[2].width > WIDTH_SCREEN * .76) || e.nativeEvent.lines.length > 3)
470
+ }, [])
471
+
472
+ useEffect(() => {
473
+ if (!isFocused) return
474
+ if (!cartState?.loading && (cartState?.error || typeof cartState?.cart === 'string')) {
475
+ const error = cartState?.error || typeof cartState.cart === 'string' && cartState.cart
476
+ if (error) {
477
+ showToast(ToastType.Error, cartState?.error || cartState.cart)
478
+ navigation.navigate('BusinessList')
479
+ }
480
+ }
481
+ }, [cartState?.error, cartState?.cart, cartState?.loading, isFocused])
482
+
483
+ useEffect(() => {
484
+ const onBackFunction = () => {
485
+ if (webviewPaymethod?.gateway === 'paypal' && showGateway.open) {
486
+ setShowGateway({ open: false, closedByUser: true })
487
+ return true
488
+ } else {
489
+ return false
490
+ }
491
+ }
492
+ BackHandler.addEventListener('hardwareBackPress', onBackFunction)
493
+ return () => {
494
+ BackHandler.removeEventListener('hardwareBackPress', onBackFunction)
495
+ }
496
+ }, [BackHandler, webviewPaymethod?.gateway, showGateway.open])
497
+
498
+ return (
499
+ <>
500
+ <SafeAreaView style={{ backgroundColor: theme.colors.backgroundPage }}>
501
+ <View style={styles.wrapperNavbar}>
502
+ <TopHeader>
503
+ <TopActions onPress={() => handleRedirect()}>
504
+ <IconAntDesign
505
+ name='arrowleft'
506
+ size={26}
507
+ />
508
+ </TopActions>
509
+ {showTitle && (
510
+ <OText
511
+ size={16}
512
+ style={{ flex: 1, textAlign: 'center', right: 15 }}
513
+ weight={Platform.OS === 'ios' ? '600' : 'bold'}
514
+ numberOfLines={2}
515
+ ellipsizeMode='tail'
516
+ >
517
+ {t('CHECKOUT', 'Checkout')}
518
+ </OText>
519
+ )}
520
+ </TopHeader>
521
+ </View>
522
+ </SafeAreaView>
523
+ <Container pt={0} forwardRef={containerRef} showsVerticalScrollIndicator={false} noPadding onScroll={handleScroll}>
524
+ <View style={styles.wrapperNavbar}>
525
+ <NavBar
526
+ hideArrowLeft
527
+ title={t('CHECKOUT', 'Checkout')}
528
+ titleAlign={'center'}
529
+ onActionLeft={() => handleRedirect()}
530
+ showCall={false}
531
+ btnStyle={{ paddingLeft: 0, paddingTop: Platform.OS == 'ios' ? 0 : 2 }}
532
+ titleWrapStyle={{ paddingHorizontal: 0 }}
533
+ titleStyle={{ marginRight: 0, marginLeft: 0 }}
534
+ style={{ marginTop: 20 }}
535
+ />
536
+ </View>
537
+ <ChContainer style={styles.pagePadding}>
538
+ {!isGiftCardCart && (
539
+ <ChSection style={{ paddingTop: 0 }}>
540
+ <ChHeader>
541
+ <CHMomentWrapper isCustomColor={isChewLayout} onPress={() => navigation.navigate('OrderTypes', { configTypes: configTypes })}>
542
+ <OText
543
+ size={12}
544
+ numberOfLines={1}
545
+ ellipsizeMode={'tail'}
546
+ color={theme.colors?.[isChewLayout ? 'white' : 'textSecondary']}
547
+ >
548
+ {t(getTypesText(options?.type || 1), 'Delivery')}
549
+ </OText>
550
+ <OIcon
551
+ src={theme.images.general.arrow_down}
552
+ width={10}
553
+ style={{ marginStart: 8 }}
554
+ {...(isChewLayout && { color: 'white' })}
555
+ />
556
+ </CHMomentWrapper>
557
+ <CHMomentWrapper
558
+ onPress={() => handleMomentClick()}
559
+ disabled={loading}
560
+ >
561
+ <OText size={12} numberOfLines={1} ellipsizeMode='tail' color={theme.colors.textSecondary}>
562
+ {options?.moment
563
+ ? parseDate(options?.moment, { outputFormat: configs?.dates_moment_format?.value })
564
+ : t('ASAP_ABBREVIATION', 'ASAP')}
565
+ </OText>
566
+ {isPreOrder && (
567
+ <OIcon
568
+ src={theme.images.general.arrow_down}
569
+ width={10}
570
+ style={{ marginStart: 8 }}
571
+ />
572
+ )}
573
+ </CHMomentWrapper>
574
+ </ChHeader>
575
+ <View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginTop: 18, marginHorizontal: -40 }} />
576
+ </ChSection>
577
+ )}
578
+
579
+ {!isGiftCardCart && !hideBusinessDetails && (
580
+ <ChSection>
581
+ <ChBusinessDetails>
582
+ {
583
+ (businessDetails?.loading || cartState.loading || !businessDetails?.business || Object.values(businessDetails?.business).length === 0) &&
584
+ !businessDetails?.error &&
585
+ (
586
+ <Placeholder Animation={Fade}>
587
+ <PlaceholderLine height={20} />
588
+ <PlaceholderLine height={12} />
589
+ <PlaceholderLine height={12} />
590
+ <PlaceholderLine height={12} style={{ marginBottom: 20 }} />
591
+ </Placeholder>
592
+ )}
593
+ {
594
+ !cartState.loading &&
595
+ businessDetails?.business &&
596
+ Object.values(businessDetails?.business).length > 0 &&
597
+ (
598
+ <>
599
+ <HeaderTitle text={t('BUSINESS_DETAILS', 'Business Details')} />
600
+ <View>
601
+ <OText size={12} lineHeight={18} weight={'400'}>
602
+ {businessDetails?.business?.name}
603
+ </OText>
604
+ <OText size={12} lineHeight={18} weight={'400'}>
605
+ {businessDetails?.business?.email}
606
+ </OText>
607
+ <OText size={12} lineHeight={18} weight={'400'}>
608
+ {businessDetails?.business?.cellphone}
609
+ </OText>
610
+ {!hideBusinessAddress && (
611
+ <OText size={12} lineHeight={18} weight={'400'}>
612
+ {businessDetails?.business?.address}
613
+ </OText>
614
+ )}
615
+ {businessDetails?.business?.address_notes && (
616
+ <>
617
+ <OText
618
+ size={12}
619
+ lineHeight={18}
620
+ numberOfLines={isReadMore ? 20 : 3}
621
+ onTextLayout={onTextLayout}
622
+ >
623
+ {businessDetails?.business?.address_notes}
624
+ </OText>
625
+ {lengthMore && (
626
+ <TouchableOpacity
627
+ onPress={() => setIsReadMore(!isReadMore)}
628
+ >
629
+ <OText size={12} color={theme.colors.primary}>{isReadMore ? t('SHOW_LESS', 'Show less') : t('READ_MORE', 'Read more')}</OText>
630
+ </TouchableOpacity>
631
+ )}
632
+ </>
633
+ )}
634
+ </View>
635
+ </>
636
+ )}
637
+ {businessDetails?.error && businessDetails?.error?.length > 0 && (
638
+ <View>
639
+ <HeaderTitle text={t('BUSINESS_DETAILS', 'Business Details')} />
640
+ <NotFoundSource
641
+ content={businessDetails?.error[0]?.message || businessDetails?.error[0]}
642
+ />
643
+ </View>
644
+ )}
645
+ </ChBusinessDetails>
646
+ <View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginHorizontal: -40 }} />
647
+ </ChSection>
648
+ )}
649
+ {!hideCustomerDetails && (
650
+
651
+ <ChSection>
652
+ <ChUserDetails>
653
+ {cartState.loading ? (
654
+ <Placeholder Animation={Fade}>
655
+ <PlaceholderLine height={20} />
656
+ <PlaceholderLine height={12} />
657
+ <PlaceholderLine height={12} />
658
+ <PlaceholderLine height={12} style={{ marginBottom: 20 }} />
659
+ </Placeholder>
660
+ ) : (
661
+ (user?.guest_id && !allowedGuest) ? (
662
+ <View>
663
+ <HeaderTitle text={t('CUSTOMER_DETAILS', 'Customer details')} />
664
+ <OButton
665
+ text={t('SIGN_UP', 'Sign up')}
666
+ style={{ borderRadius: 7.6, marginTop: 20 }}
667
+ onClick={() => setOpenModal({ ...openModal, signup: true })}
668
+ />
669
+ <OButton
670
+ text={t('LOGIN', 'Login')}
671
+ style={{ borderRadius: 7.6, marginTop: 20 }}
672
+ onClick={() => setOpenModal({ ...openModal, login: true })}
673
+ />
674
+ <OButton
675
+ text={t('CONTINUE_AS_GUEST', 'Continue as guest')}
676
+ textStyle={{ color: theme.colors.black }}
677
+ bgColor={theme.colors.white}
678
+ borderColor={theme.colors.black}
679
+ style={{ borderRadius: 7.6, marginTop: 20 }}
680
+ onClick={() => setAllowedGuest(true)}
681
+ />
682
+ </View>
683
+ ) : (
684
+ <UserDetails
685
+ isUserDetailsEdit={isUserDetailsEdit}
686
+ HeaderTitle={<HeaderTitle text={t('CUSTOMER_DETAILS', 'Customer Details')} mb={0} />}
687
+ cartStatus={cart?.status}
688
+ businessId={cart?.business_id}
689
+ useValidationFields
690
+ useDefualtSessionManager
691
+ useSessionUser
692
+ isCheckout
693
+ phoneUpdate={phoneUpdate}
694
+ togglePhoneUpdate={togglePhoneUpdate}
695
+ isOrderTypeValidationField
696
+ requiredFields={requiredFields}
697
+ checkoutFields={checkoutFields}
698
+ />
699
+ )
700
+ )}
701
+ </ChUserDetails>
702
+ <View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginHorizontal: -40 }} />
703
+ </ChSection>
704
+ )}
705
+
706
+ {options?.type === 1 && !isGiftCardCart && (
707
+ <DeliveryOptionsContainer>
708
+ {cartState.loading || deliveryOptionSelected === undefined ? (
709
+ <View style={{ height: 110 }}>
710
+ <Placeholder Animation={Fade}>
711
+ <PlaceholderLine height={20} />
712
+ <PlaceholderLine height={40} />
713
+ </Placeholder>
714
+ </View>
715
+ ) : (
716
+ <ChSection>
717
+ <HeaderTitle text={t('DELIVERY_OPTIONS', 'Delivery options')} />
718
+ <View
719
+ style={{
720
+ backgroundColor: theme.colors.inputDisabled,
721
+ borderRadius: 7.5,
722
+ marginBottom: 20,
723
+ flex: 1
724
+ }}>
725
+ <Picker
726
+ countryCode={undefined}
727
+ visible={isDeliveryOptionModalVisible}
728
+ onClose={() => setIsDeliveryOptionModalVisible(false)}
729
+ withCountryNameButton
730
+ renderFlagButton={() => (
731
+ <TouchableOpacity onPress={() => setIsDeliveryOptionModalVisible(true)}>
732
+ <DeliveryOptionItem backgroundColor={theme?.colors?.inputDisabled}>
733
+ <OText
734
+ size={14}
735
+ >
736
+ {deliveryOptions.find((option: any) => option.value === deliveryOptionSelected)?.label}
737
+ </OText>
738
+ <MaterialIcons name='keyboard-arrow-down' style={styles.icon} />
739
+ </DeliveryOptionItem>
740
+ </TouchableOpacity>
741
+ )}
742
+ flatListProps={{
743
+ keyExtractor: (item: any) => item.value,
744
+ data: deliveryOptions || [],
745
+ renderItem: ({ item }: any) => (
746
+ <TouchableOpacity
747
+ onPress={() => !!cart?.uuid && changeDeliveryOption(item.value)}
748
+ disabled={
749
+ deliveryOptionSelected === item.value
750
+ }
751
+ >
752
+ <DeliveryOptionItem backgroundColor={deliveryOptionSelected === item.value ? theme.colors.inputDisabled : 'white'}>
753
+ <OText>
754
+ {item.label}
755
+ </OText>
756
+ </DeliveryOptionItem>
757
+ </TouchableOpacity>
758
+ )
759
+ }}
760
+ />
761
+ </View>
762
+ <View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginHorizontal: -40 }} />
763
+ </ChSection>
764
+ )}
765
+
766
+ </DeliveryOptionsContainer>
767
+ )}
768
+
769
+ {!cartState.loading && (cart?.status === 2 || cart?.status === 4) && (
770
+ <ChSection style={{ paddingBottom: 20 }}>
771
+ <ChErrors>
772
+ {!cartState.loading && cart?.status === 2 && (
773
+ <OText
774
+ style={{ textAlign: 'center' }}
775
+ color={theme.colors.error}
776
+ size={17}
777
+ >
778
+ {t('CART_STATUS_PENDING_MESSAGE_APP', 'Your order is being processed, please wait a little more. if you\'ve been waiting too long, please reload the app')}
779
+ </OText>
780
+ )}
781
+ </ChErrors>
782
+ </ChSection>
783
+ )}
784
+
785
+ {!isGiftCardCart && !hideBusinessMap && (
786
+ <ChSection>
787
+ <ChAddress>
788
+ {(businessDetails?.loading || cartState.loading) ? (
789
+ <Placeholder Animation={Fade}>
790
+ <PlaceholderLine height={20} style={{ marginBottom: 50 }} />
791
+ <PlaceholderLine height={100} />
792
+ </Placeholder>
793
+ ) : (
794
+ <AddressDetails
795
+ cart={cart}
796
+ navigation={navigation}
797
+ location={options?.address?.location}
798
+ businessLogo={businessDetails?.business?.logo}
799
+ isCartPending={cart?.status === 2}
800
+ uuid={cartUuid}
801
+ apiKey={configs?.google_maps_api_key?.value}
802
+ mapConfigs={mapConfigs}
803
+ HeaderTitle={<HeaderTitle text={t('DELIVERY_ADDRESS', 'Delivery address')} mb={0} />}
804
+ />
805
+ )}
806
+ </ChAddress>
807
+ <View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginTop: 13, marginHorizontal: -40 }} />
808
+ </ChSection>
809
+ )}
810
+
811
+ {driverTipsField &&
812
+ (
813
+ <ChSection>
814
+ <ChDriverTips>
815
+ <HeaderTitle text={t('DRIVER_TIPS', 'Driver Tips')} mb={0} />
816
+ <DriverTips
817
+ uuid={cartUuid}
818
+ businessId={cart?.business_id}
819
+ driverTipsOptions={!driverTipsOptions.includes(0) ? [0, ...driverTipsOptions] : driverTipsOptions}
820
+ isFixedPrice={parseInt(configs?.driver_tip_type?.value, 10) === 1}
821
+ isDriverTipUseCustom={!!parseInt(configs?.driver_tip_use_custom?.value, 10)}
822
+ driverTip={parseInt(configs?.driver_tip_type?.value, 10) === 1
823
+ ? cart?.driver_tip
824
+ : cart?.driver_tip_rate}
825
+ useOrderContext
826
+ cart={cart}
827
+ />
828
+ </ChDriverTips>
829
+ </ChSection>
830
+ )}
831
+
832
+ {!cartState.loading && cart && cart?.status !== 2 && cart?.valid && (
833
+ <ChSection>
834
+ <ChPaymethods>
835
+ <HeaderTitle text={t('PAYMENT_METHOD', 'Payment Method')} mb={0} />
836
+ {!cartState.loading && cart?.status === 4 && (
837
+ <OText
838
+ style={{ textAlign: 'center', marginTop: 20 }}
839
+ color={theme.colors.error}
840
+ size={17}
841
+ >
842
+ {t('CART_STATUS_CANCEL_MESSAGE', 'The payment has not been successful, please try again')}
843
+ </OText>
844
+ )}
845
+ <PaymentOptions
846
+ cart={cart}
847
+ isDisabled={cart?.status === 2}
848
+ businessId={!isGiftCardCart ? businessDetails?.business?.id : -1}
849
+ isLoading={!isGiftCardCart ? businessDetails.loading : false}
850
+ paymethods={businessDetails?.business?.paymethods}
851
+ onPaymentChange={handlePaymethodChange}
852
+ errorCash={errorCash}
853
+ setErrorCash={setErrorCash}
854
+ onNavigationRedirect={onNavigationRedirect}
855
+ paySelected={paymethodSelected}
856
+ handlePaymentMethodClickCustom={handlePaymentMethodClick}
857
+ handlePlaceOrder={handlePlaceOrder}
858
+ merchantId={merchantId}
859
+ urlscheme={urlscheme}
860
+ androidAppId={androidAppId}
861
+ setMethodPaySupported={setMethodPaySupported}
862
+ methodPaySupported={methodPaySupported}
863
+ placeByMethodPay={placeByMethodPay}
864
+ setPlaceByMethodPay={setPlaceByMethodPay}
865
+ cardList={cardList}
866
+ setCardList={setCardList}
867
+ requiredFields={requiredFields}
868
+ openUserModal={setIsOpen}
869
+ paymethodClicked={paymethodClicked}
870
+ setPaymethodClicked={setPaymethodClicked}
871
+ setUserHasCards={setUserHasCards}
872
+ />
873
+ </ChPaymethods>
874
+ </ChSection>
875
+ )}
876
+
877
+ {!cartState.loading && cart && isWalletEnabled && businessDetails?.business?.configs && (
878
+ <WalletPaymentOptionContainer>
879
+ <PaymentOptionWallet
880
+ cart={cart}
881
+ loyaltyPlansState={loyaltyPlansState}
882
+ businessId={cart?.business_id}
883
+ businessConfigs={businessDetails?.business?.configs}
884
+ />
885
+ </WalletPaymentOptionContainer>
886
+ )}
887
+
888
+
889
+ {!cartState.loading && placeSpotsEnabled && !isGiftCardCart && (
890
+ <>
891
+ <View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginTop: 30, marginHorizontal: -40 }} />
892
+ <PlaceSpot
893
+ isCheckout
894
+ isInputMode
895
+ cart={cart}
896
+ spotNumberDefault={cartState?.cart?.spot_number ?? cart?.spot_number}
897
+ setPlaceSpotNumber={setPlaceSpotNumber}
898
+ vehicleDefault={cart?.vehicle}
899
+ />
900
+ <View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginHorizontal: -40 }} />
901
+ </>
902
+ )}
903
+
904
+ {!cartState.loading && cart && (
905
+ <ChSection>
906
+ <ChCart>
907
+ {cartsWithProducts?.length > 0 && cart?.products?.length === 0 ? (
908
+ <NotFoundSource
909
+ content={t('NOT_FOUND_CARTS', 'Sorry, You don\'t seem to have any carts.')}
910
+ btnTitle={t('SEARCH_REDIRECT', 'Go to Businesses')}
911
+ />
912
+ ) : (
913
+ <>
914
+ <CartHeader>
915
+ <HeaderTitle text={t('MOBILE_FRONT_YOUR_ORDER', 'Your order')} mb={0} />
916
+ {!isGiftCardCart && (
917
+ <TouchableOpacity
918
+ onPress={() => onNavigationRedirect('Business', { store: cart?.business?.slug })}
919
+ >
920
+ <OText
921
+ size={12}
922
+ lineHeight={15}
923
+ color={theme.colors.primary}
924
+ style={{ textDecorationLine: 'underline' }}
925
+ >
926
+ {t('ADD_PRODUCTS', 'Add products')}
927
+ </OText>
928
+ </TouchableOpacity>
929
+ )}
930
+ </CartHeader>
931
+ {isBusinessChangeEnabled && (
932
+ <TouchableOpacity
933
+ onPress={() => setOpenChangeStore(true)}
934
+ style={{ alignSelf: 'flex-start' }}
935
+ >
936
+ <OText
937
+ size={12}
938
+ lineHeight={18}
939
+ color={theme.colors.primary}
940
+ style={{ textDecorationLine: 'underline' }}
941
+ >
942
+ {t('CHANGE_STORE', 'Change store')}
943
+ </OText>
944
+ </TouchableOpacity>
945
+ )}
946
+ <OrderSummary
947
+ cart={cart}
948
+ isCartPending={cart?.status === 2}
949
+ onNavigationRedirect={onNavigationRedirect}
950
+ commentDelayTime={commentDelayTime}
951
+ placeSpotTypes={placeSpotTypes}
952
+ businessConfigs={businessConfigs}
953
+ maxDate={maxDate}
954
+ loyaltyRewardRate={
955
+ creditPointPlanOnBusiness?.accumulation_rate ??
956
+ (!!creditPointPlanOnBusiness && creditPointPlan?.accumulation_rate) ?? 0
957
+ }
958
+ hideCommentsByValidationCheckout={!guestCheckoutComment?.enabled}
959
+ hideCouponByValidationCheckout={!guestCheckoutCoupon?.enabled}
960
+ />
961
+ </>
962
+ )}
963
+ </ChCart>
964
+ </ChSection>
965
+ )}
966
+
967
+ {!cartState.loading && cart && (
968
+ <View>
969
+ <ChErrors style={{ marginBottom: Platform.OS === 'ios' ? 35 : 10 }}>
970
+ {!cart?.valid_address && cart?.status !== 2 && (
971
+ <OText
972
+ color={theme.colors.error}
973
+ size={12}
974
+ >
975
+ {t('INVALID_CART_ADDRESS', 'Selected address is invalid, please select a closer address.')}
976
+ </OText>
977
+ )}
978
+
979
+ {(!paymethodSelected && cart?.balance > 0) && cart?.status !== 2 && cart?.valid && (
980
+ <OText
981
+ color={theme.colors.error}
982
+ size={12}
983
+ >
984
+ {t('WARNING_NOT_PAYMENT_SELECTED', 'Please, select a payment method to place order.')}
985
+ </OText>
986
+ )}
987
+
988
+ {!cart?.valid_products && cart?.status !== 2 && cart?.total !== 0 && (
989
+ <>
990
+ <OText
991
+ color={theme.colors.error}
992
+ size={12}
993
+ >
994
+ {t('WARNING_INVALID_PRODUCTS_CHECKOUT', 'To continue with your checkout, please remove from your cart the products that are not available.')}
995
+ </OText>
996
+ </>
997
+ )}
998
+ {cart?.valid_preorder !== undefined && !cart?.valid_preorder && (
999
+ <OText
1000
+ color={theme.colors.error}
1001
+ size={12}
1002
+ >
1003
+ {t('INVALID_CART_MOMENT', 'Selected schedule time is invalid, please select a schedule into the business schedule interval.')}
1004
+ </OText>
1005
+ )}
1006
+ {validateDriverTipField && !isGiftCardCart &&
1007
+ (
1008
+ <OText
1009
+ color={theme.colors.error}
1010
+ size={12}
1011
+ >
1012
+ {t('WARNING_INVALID_DRIVER_TIP', 'Driver Tip is required.')}
1013
+ </OText>
1014
+ )}
1015
+ {validateCommentsCartField && (
1016
+ <OText
1017
+ color={theme.colors.error}
1018
+ size={12}
1019
+ >
1020
+ {t('WARNING_INVALID_CART_COMMENTS', 'Cart comments is required.')}
1021
+ </OText>
1022
+ )}
1023
+
1024
+ {validateZipcodeCard && (
1025
+ <OText
1026
+ color={theme.colors.error}
1027
+ size={12}
1028
+ >
1029
+ {t('WARNING_CARD_ZIPCODE_REQUIRED', 'Your card selected has not zipcode')}
1030
+ </OText>
1031
+ )}
1032
+ {validateCouponField &&
1033
+ (
1034
+ <OText
1035
+ color={theme.colors.error}
1036
+ size={12}
1037
+ >
1038
+ {t('WARNING_INVALID_COUPON_FIELD', 'Coupon is required.')}
1039
+ </OText>
1040
+ )}
1041
+ </ChErrors>
1042
+ </View>
1043
+ )}
1044
+ <OModal
1045
+ open={openChangeStore}
1046
+ entireModal
1047
+ customClose
1048
+ onClose={() => setOpenChangeStore(false)}
1049
+ >
1050
+ <CartStoresListing
1051
+ cartuuid={cart?.uuid}
1052
+ onClose={() => setOpenChangeStore(false)}
1053
+ />
1054
+ </OModal>
1055
+ <OModal
1056
+ open={isOpen}
1057
+ onClose={() => setIsOpen(false)}
1058
+ showToastInsideModal
1059
+ >
1060
+ <View style={styles.detailWrapper}>
1061
+ <UserDetails
1062
+ isUserDetailsEdit
1063
+ cartStatus={cart?.status}
1064
+ businessId={cart?.business_id}
1065
+ useDefualtSessionManager
1066
+ useSessionUser
1067
+ isCheckout
1068
+ isEdit
1069
+ phoneUpdate={phoneUpdate}
1070
+ togglePhoneUpdate={togglePhoneUpdate}
1071
+ isOrderTypeValidationField
1072
+ requiredFields={requiredFields}
1073
+ checkoutFields={checkoutFields}
1074
+ isCheckoutPlace
1075
+ hideUpdateButton
1076
+ handlePlaceOrderAsGuest={handlePlaceOrderAsGuest}
1077
+ onClose={() => {
1078
+ setIsOpen(false)
1079
+ if (paymethodClicked) {
1080
+ setPaymethodClicked({
1081
+ ...paymethodClicked,
1082
+ confirmed: true
1083
+ })
1084
+ } else {
1085
+ handlePlaceOrder(null, true)
1086
+ }
1087
+ }}
1088
+ setIsOpen={setIsOpen}
1089
+ />
1090
+ </View>
1091
+ </OModal>
1092
+ <OModal
1093
+ open={openModal.signup}
1094
+ onClose={() => setOpenModal({ ...openModal, signup: false, isGuest: false })}
1095
+ >
1096
+ <ScrollView style={{ paddingHorizontal: 20, width: '100%' }}>
1097
+ <SignupForm
1098
+ handleSuccessSignup={handleSuccessSignup}
1099
+ isGuest
1100
+ signupButtonText={t('SIGNUP', 'Signup')}
1101
+ useSignupByEmail
1102
+ useChekoutFileds
1103
+ />
1104
+ </ScrollView>
1105
+ </OModal>
1106
+ <OModal
1107
+ open={openModal.login}
1108
+ onClose={() => setOpenModal({ ...openModal, login: false })}
1109
+ >
1110
+ <ScrollView style={{ paddingHorizontal: 20, width: '100%' }}>
1111
+ <LoginForm
1112
+ handleSuccessLogin={handleSuccessLogin}
1113
+ isGuest
1114
+ loginButtonText={t('LOGIN', 'Login')}
1115
+ loginButtonBackground={theme.colors.primary}
1116
+ />
1117
+ </ScrollView>
1118
+ </OModal>
1119
+ </ChContainer>
1120
+ </Container>
1121
+ {!cartState.loading && cart && cart?.status !== 2 && (
1122
+ <FloatingButton
1123
+ handleClick={
1124
+ isDisabledButtonPlace
1125
+ ? () => vibrateApp()
1126
+ : methodsPay.includes(paymethodSelected?.gateway)
1127
+ ? () => setPlaceByMethodPay(true)
1128
+ : () => handlePlaceOrder(null)}
1129
+ isSecondaryBtn={isDisabledButtonPlace}
1130
+ disabled={isDisabledButtonPlace}
1131
+ btnText={subtotalWithTaxes >= cart?.minimum
1132
+ ? (
1133
+ placing
1134
+ ? t('PLACING', 'Placing')
1135
+ : loading
1136
+ ? t('LOADING', 'Loading')
1137
+ : t('PLACE_ORDER', 'Place Order')
1138
+ )
1139
+ : (`${t('MINIMUN_SUBTOTAL_ORDER', 'Minimum subtotal order:')} ${parsePrice(cart?.minimum)}`)
1140
+ }
1141
+ btnRightValueShow
1142
+ btnRightValue={parsePrice(cart?.balance)}
1143
+ iosBottom={30}
1144
+ />
1145
+ )}
1146
+ {webviewPaymethod?.gateway === 'paypal' && showGateway.open && (
1147
+ <PaymentOptionsWebView
1148
+ onNavigationRedirect={onNavigationRedirect}
1149
+ uri={`${ordering.root}/html/paypal_react_native`}
1150
+ user={user}
1151
+ token={token}
1152
+ cart={cart}
1153
+ currency={currency}
1154
+ webviewPaymethod={webviewPaymethod}
1155
+ setShowGateway={setShowGateway}
1156
+ />
1157
+ )}
1158
+ {webviewPaymethod?.gateway === 'square' && showGateway.open && (
1159
+ <PaymentOptionsWebView
1160
+ onNavigationRedirect={onNavigationRedirect}
1161
+ uri={`https://test-square-f50f7.web.app`}
1162
+ user={user}
1163
+ token={token}
1164
+ cart={cart}
1165
+ currency={currency}
1166
+ webviewPaymethod={webviewPaymethod}
1167
+ setShowGateway={setShowGateway}
1168
+ locationId={'L1NGAY5M6KJRX'}
1169
+ />
1170
+ )}
1171
+ {cart?.paymethod_data?.gateway === 'credomatic' && cart?.paymethod_data?.status === 2 && showGateway.open && (
1172
+ <PaymentOptionsWebView
1173
+ title={t('CREDOMATIC_PAYMENT', 'Credomatic payment')}
1174
+ onNavigationRedirect={onNavigationRedirect}
1175
+ uri={credomaticUrl}
1176
+ user={user}
1177
+ cart={cart}
1178
+ additionalParams={{
1179
+ type: 'auth',
1180
+ key_id: credomaticKeyId,
1181
+ hash: cart?.paymethod_data?.result?.hash,
1182
+ time: cart?.paymethod_data?.result?.time,
1183
+ amount: cart?.total,
1184
+ orderid: cart?.uuid,
1185
+ ccnumber: cardList?.cards?.[0]?.number,
1186
+ ccexp: cardList?.cards?.[0]?.expiryString,
1187
+ cvv: cardList?.cards?.[0]?.cvc,
1188
+ redirect: credomaticUrl
1189
+ }}
1190
+ webviewPaymethod={webviewPaymethod}
1191
+ setShowGateway={setShowGateway}
1192
+ />
1193
+ )}
1194
+ </>
1195
+ )
1196
+ }
1197
+
1198
+ export const Checkout = (props: any) => {
1199
+ const {
1200
+ errors,
1201
+ clearErrors,
1202
+ cartUuid,
1203
+ stripePaymentOptions,
1204
+ onNavigationRedirect,
1205
+ } = props
1206
+
1207
+ const [, { showToast }] = useToast();
1208
+ const [, t] = useLanguage();
1209
+ const [{ token }] = useSession();
1210
+ const [ordering] = useApi();
1211
+ const [, { confirmCart }] = useOrder();
1212
+ const { confirmPayment, loading: confirmPaymentLoading } = useConfirmPayment();
1213
+
1214
+ const [cartState, setCartState] = useState<any>({ loading: true, error: [], cart: null });
1215
+ const [orderState] = useOrder()
1216
+
1217
+ const getOrder = async (cartId: any) => {
1218
+ try {
1219
+ let result: any = {}
1220
+ const cartsWithProducts = orderState?.carts && (Object.values(orderState?.carts)?.filter(cart => cart?.products && cart?.products?.length) || null)
1221
+ const cart = cartsWithProducts?.find((cart: any) => cart.uuid === cartId)
1222
+ if (cart) {
1223
+ result = { ...cart }
1224
+ } else {
1225
+ setCartState({ ...cartState, loading: true })
1226
+ const url = `${ordering.root}/carts/${cartId}`
1227
+ const response = await fetch(url, {
1228
+ method: 'GET',
1229
+ headers: {
1230
+ 'Content-Type': 'application/json',
1231
+ Authorization: `Bearer ${token}`
1232
+ }
1233
+ })
1234
+ const content = await response.json();
1235
+ result = content.result
1236
+ }
1237
+
1238
+ let publicKey = null
1239
+ try {
1240
+ const { content } = await ordering.setAccessToken(token).paymentCards().getCredentials();
1241
+ if (!content.error) {
1242
+ publicKey = content.result.publishable;
1243
+ }
1244
+ } catch (error) {
1245
+ publicKey = null
1246
+ }
1247
+
1248
+ if (result.status === 1 && result.order?.uuid) {
1249
+ onNavigationRedirect('OrderDetails', { orderId: result.order.uuid })
1250
+ setCartState({ ...cartState, loading: false })
1251
+ } else if (result.status === 2 && result.paymethod_data?.gateway === 'stripe_redirect') {
1252
+ try {
1253
+ const confirmCartRes = await confirmCart(cartUuid)
1254
+ if (confirmCartRes.error) {
1255
+ showToast(ToastType.Error, confirmCartRes.error.message)
1256
+ }
1257
+ if (confirmCartRes.result.order?.uuid) {
1258
+ onNavigationRedirect('OrderDetails', { orderId: confirmCartRes.result.order.uuid, isFromCheckout: true })
1259
+ }
1260
+ setCartState({
1261
+ ...cartState,
1262
+ loading: false,
1263
+ cart: result
1264
+ })
1265
+ } catch (err: any) {
1266
+ showToast(ToastType.Error, err?.toString() || err.message)
1267
+ }
1268
+ } else if (result.status === 2 && stripePaymentOptions.includes(result.paymethod_data?.gateway)) {
1269
+ const clientSecret = result.paymethod_data?.result?.client_secret
1270
+ const paymentMethodId = result.paymethod_data?.data?.source_id;
1271
+
1272
+ initStripe({ publishableKey: publicKey });
1273
+
1274
+ try {
1275
+ const { paymentIntent, error } = await confirmPayment(clientSecret, {
1276
+ type: 'Card',
1277
+ paymentMethodId
1278
+ });
1279
+
1280
+ try {
1281
+ const confirmCartRes = await confirmCart(cartUuid)
1282
+ if (confirmCartRes.error) {
1283
+ showToast(ToastType.Error, confirmCartRes.error.message)
1284
+ setCartState({
1285
+ ...cartState,
1286
+ loading: false,
1287
+ cart: result
1288
+ })
1289
+ return
1290
+ }
1291
+ if (confirmCartRes.result.order?.uuid) {
1292
+ onNavigationRedirect('OrderDetails', { orderId: confirmCartRes.result.order.uuid, isFromCheckout: true })
1293
+ setCartState({ ...cartState, loading: false })
1294
+ } else {
1295
+ showToast(ToastType.Error, t('FAILED_PAYMENT', 'The payment has failed'));
1296
+ const cart = Array.isArray(result) ? null : result
1297
+ setCartState({
1298
+ ...cartState,
1299
+ loading: false,
1300
+ cart,
1301
+ error: cart ? null : result
1302
+ })
1303
+ return
1304
+ }
1305
+ } catch (error: any) {
1306
+ showToast(ToastType.Error, error?.toString() || error.message)
1307
+ }
1308
+ } catch (error) {
1309
+ showToast(ToastType.Error, t('FAILED_PAYMENT', 'The payment has failed'));
1310
+ const cart = Array.isArray(result) ? null : result
1311
+ setCartState({
1312
+ ...cartState,
1313
+ loading: false,
1314
+ cart,
1315
+ error: cart ? null : result
1316
+ })
1317
+ }
1318
+ } else {
1319
+ const cart = Array.isArray(result) ? null : result
1320
+ setCartState({
1321
+ ...cartState,
1322
+ loading: false,
1323
+ cart,
1324
+ error: cart ? null : result
1325
+ })
1326
+ }
1327
+ } catch (e: any) {
1328
+ setCartState({
1329
+ ...cartState,
1330
+ loading: false,
1331
+ error: [e.toString()]
1332
+ })
1333
+ }
1334
+ }
1335
+
1336
+ useEffect(() => {
1337
+ if (errors) {
1338
+ const errorText = manageErrorsToShow(errors)
1339
+ showToast(ToastType.Error, errorText)
1340
+ clearErrors && clearErrors()
1341
+ }
1342
+ }, [errors])
1343
+
1344
+ useEffect(() => {
1345
+ if (token && cartUuid) {
1346
+ getOrder(cartUuid)
1347
+ }
1348
+ }, [token, cartUuid])
1349
+
1350
+ const checkoutProps = {
1351
+ ...props,
1352
+ UIComponent: CheckoutUI,
1353
+ cartState,
1354
+ uuid: cartUuid
1355
+ }
1356
+
1357
+ return (
1358
+ <>
1359
+ <CheckoutController {...checkoutProps} />
1360
+ </>
1361
+ )
1362
+ }