ordering-ui-react-native 0.21.21 → 0.21.22-release

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (239) hide show
  1. package/package.json +7 -6
  2. package/src/DeliveryApp.tsx +43 -1
  3. package/src/components/BusinessesListing/index.tsx +1 -1
  4. package/src/components/PaymentOptionsWebView/index.tsx +1 -0
  5. package/src/components/StripeMethodForm/index.tsx +4 -4
  6. package/src/components/VerifyPhone/styles.tsx +1 -2
  7. package/src/types/index.tsx +2 -1
  8. package/src/utils/index.tsx +2 -2
  9. package/themes/business/index.tsx +4 -0
  10. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +9 -2
  11. package/themes/business/src/components/BusinessController/index.tsx +19 -17
  12. package/themes/business/src/components/BusinessProductList/AccordionDropdown.tsx +63 -0
  13. package/themes/business/src/components/BusinessProductList/IterateCategories.tsx +108 -0
  14. package/themes/business/src/components/BusinessProductList/ProductList.tsx +196 -0
  15. package/themes/business/src/components/BusinessProductList/index.tsx +196 -0
  16. package/themes/business/src/components/BusinessProductList/styles.tsx +10 -0
  17. package/themes/business/src/components/Chat/index.tsx +23 -14
  18. package/themes/business/src/components/DriverMap/index.tsx +4 -3
  19. package/themes/business/src/components/FloatingButton/index.tsx +34 -31
  20. package/themes/business/src/components/Home/index.tsx +5 -1
  21. package/themes/business/src/components/LanguageSelector/index.tsx +4 -2
  22. package/themes/business/src/components/LanguageSelector/lang_country.json +515 -70
  23. package/themes/business/src/components/MapView/index.tsx +11 -7
  24. package/themes/business/src/components/MessagesOption/index.tsx +2 -1
  25. package/themes/business/src/components/NewOrderNotification/index.tsx +163 -113
  26. package/themes/business/src/components/OrderDetails/Business.tsx +50 -2
  27. package/themes/business/src/components/OrderDetails/Delivery.tsx +23 -11
  28. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +60 -53
  29. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +54 -23
  30. package/themes/business/src/components/OrderDetails/usePrinterCommands.tsx +220 -0
  31. package/themes/business/src/components/OrderDetailsLogistic/index.tsx +6 -1
  32. package/themes/business/src/components/OrderSummary/index.tsx +240 -76
  33. package/themes/business/src/components/OrdersListManager/index.tsx +7 -2
  34. package/themes/business/src/components/OrdersListManager/utils.tsx +1 -1
  35. package/themes/business/src/components/OrdersOption/index.tsx +125 -48
  36. package/themes/business/src/components/PhoneInputNumber/index.tsx +8 -5
  37. package/themes/business/src/components/PreviousOrders/OrderItem.tsx +33 -36
  38. package/themes/business/src/components/PreviousOrders/OrderList.tsx +18 -13
  39. package/themes/business/src/components/PreviousOrders/index.tsx +80 -66
  40. package/themes/business/src/components/PreviousOrders/styles.tsx +10 -0
  41. package/themes/business/src/components/PrinterSettings/index.tsx +279 -0
  42. package/themes/business/src/components/PrinterSettings/styles.tsx +17 -0
  43. package/themes/business/src/components/ProductItemAccordion/index.tsx +2 -2
  44. package/themes/business/src/components/ReviewCustomer/index.tsx +2 -0
  45. package/themes/business/src/components/SearchBar/index.tsx +2 -1
  46. package/themes/business/src/components/Sessions/index.tsx +187 -0
  47. package/themes/business/src/components/Sessions/styles.tsx +20 -0
  48. package/themes/business/src/components/StoresList/index.tsx +5 -3
  49. package/themes/business/src/components/UserFormDetails/index.tsx +111 -107
  50. package/themes/business/src/components/UserProfileForm/index.tsx +98 -44
  51. package/themes/business/src/components/WebsocketStatus/index.tsx +171 -0
  52. package/themes/business/src/components/WebsocketStatus/styles.tsx +28 -0
  53. package/themes/business/src/components/shared/OInput.tsx +2 -0
  54. package/themes/business/src/hooks/useLocation.tsx +5 -4
  55. package/themes/business/src/types/index.tsx +15 -2
  56. package/themes/business/src/utils/index.tsx +5 -0
  57. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  58. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  59. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  60. package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
  61. package/themes/kiosk/src/components/LoginForm/index.tsx +7 -4
  62. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  63. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  64. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
  65. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  66. package/themes/original/index.tsx +9 -4
  67. package/themes/original/src/components/AddressDetails/index.tsx +20 -10
  68. package/themes/original/src/components/AddressForm/index.tsx +10 -6
  69. package/themes/original/src/components/AddressForm/styles.tsx +1 -1
  70. package/themes/original/src/components/AddressList/index.tsx +4 -7
  71. package/themes/original/src/components/AddressList/styles.tsx +4 -4
  72. package/themes/original/src/components/AnalyticsSegment/index.tsx +6 -6
  73. package/themes/original/src/components/AppleLogin/index.tsx +4 -4
  74. package/themes/original/src/components/BusinessBasicInformation/index.tsx +4 -4
  75. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +1 -1
  76. package/themes/original/src/components/BusinessController/index.tsx +20 -12
  77. package/themes/original/src/components/BusinessController/styles.tsx +8 -7
  78. package/themes/original/src/components/BusinessInformation/styles.tsx +2 -2
  79. package/themes/original/src/components/BusinessItemAccordion/index.tsx +11 -7
  80. package/themes/original/src/components/BusinessListingSearch/BusinessSearchFooter.tsx +317 -0
  81. package/themes/original/src/components/BusinessListingSearch/BusinessSearchHeader.tsx +96 -0
  82. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/index.tsx +1 -1
  83. package/themes/original/src/components/BusinessListingSearch/index.tsx +56 -361
  84. package/themes/original/src/components/BusinessListingSearch/styles.tsx +1 -1
  85. package/themes/original/src/components/BusinessPreorder/index.tsx +2 -3
  86. package/themes/original/src/components/BusinessProductsCategories/index.tsx +1 -1
  87. package/themes/original/src/components/BusinessProductsList/index.tsx +3 -3
  88. package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
  89. package/themes/original/src/components/BusinessProductsListing/index.tsx +51 -20
  90. package/themes/original/src/components/BusinessProductsListing/styles.tsx +3 -4
  91. package/themes/original/src/components/BusinessReviews/index.tsx +1 -1
  92. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +1 -1
  93. package/themes/original/src/components/BusinessesListing/Layout/Appointment/styles.tsx +5 -5
  94. package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListFooter.tsx +69 -0
  95. package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListHeader.tsx +406 -0
  96. package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListing.tsx +76 -0
  97. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +24 -404
  98. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +1 -1
  99. package/themes/original/src/components/BusinessesListing/index.tsx +0 -1
  100. package/themes/original/src/components/Cart/index.tsx +32 -9
  101. package/themes/original/src/components/CartContent/index.tsx +96 -58
  102. package/themes/original/src/components/CartStoresListing/styles.tsx +2 -2
  103. package/themes/original/src/components/Checkout/index.tsx +190 -66
  104. package/themes/original/src/components/Checkout/styles.tsx +17 -0
  105. package/themes/original/src/components/CitiesControl/styles.tsx +1 -1
  106. package/themes/original/src/components/DatePicker/index.tsx +33 -0
  107. package/themes/original/src/components/DatePicker/styles.tsx +20 -0
  108. package/themes/original/src/components/Favorite/index.tsx +4 -9
  109. package/themes/original/src/components/Favorite/styles.tsx +0 -2
  110. package/themes/original/src/components/FloatingButton/styles.tsx +1 -1
  111. package/themes/original/src/components/GPSButton/index.tsx +1 -1
  112. package/themes/original/src/components/GiftCard/GiftCardOrdersList/index.tsx +64 -0
  113. package/themes/original/src/components/GiftCard/GiftCardOrdersList/styles.tsx +8 -0
  114. package/themes/original/src/components/GiftCard/GiftCardUI/index.tsx +8 -3
  115. package/themes/original/src/components/GiftCard/PurchaseGiftCard/index.tsx +36 -3
  116. package/themes/original/src/components/GiftCard/PurchaseGiftCard/styles.tsx +1 -1
  117. package/themes/original/src/components/GiftCard/RedeemGiftCard/index.tsx +67 -4
  118. package/themes/original/src/components/GiftCard/RedeemGiftCard/styles.tsx +1 -1
  119. package/themes/original/src/components/GiftCard/SendGiftCard/index.tsx +2 -2
  120. package/themes/original/src/components/GiftCard/SendGiftCard/styles.tsx +1 -1
  121. package/themes/original/src/components/GiftCard/SingleGiftCard/index.tsx +101 -0
  122. package/themes/original/src/components/GiftCard/SingleGiftCard/styles.tsx +4 -0
  123. package/themes/original/src/components/GiftCard/VerticalGiftCardOrdersLayout/index.tsx +83 -0
  124. package/themes/original/src/components/GiftCard/VerticalGiftCardOrdersLayout/styles.tsx +9 -0
  125. package/themes/original/src/components/GoogleMap/index.tsx +6 -5
  126. package/themes/original/src/components/HighestRatedBusinesses/index.tsx +2 -2
  127. package/themes/original/src/components/HighestRatedBusinesses/styles.tsx +1 -1
  128. package/themes/original/src/components/Home/index.tsx +2 -1
  129. package/themes/original/src/components/LastOrder/index.tsx +2 -1
  130. package/themes/original/src/components/LastOrders/index.tsx +2 -1
  131. package/themes/original/src/components/LoginForm/Otp/index.tsx +4 -16
  132. package/themes/original/src/components/Messages/index.tsx +9 -4
  133. package/themes/original/src/components/Messages/styles.tsx +1 -1
  134. package/themes/original/src/components/MomentOption/index.tsx +4 -3
  135. package/themes/original/src/components/MultiCart/index.tsx +1 -1
  136. package/themes/original/src/components/MultiCheckout/index.tsx +208 -21
  137. package/themes/original/src/components/MultiCheckout/styles.tsx +17 -0
  138. package/themes/original/src/components/MultiOrdersDetails/index.tsx +20 -15
  139. package/themes/original/src/components/MyOrders/index.tsx +24 -29
  140. package/themes/original/src/components/NavBar/index.tsx +3 -1
  141. package/themes/original/src/components/NetworkError/index.tsx +2 -3
  142. package/themes/original/src/components/NetworkError/styles.tsx +2 -2
  143. package/themes/original/src/components/Notifications/index.tsx +4 -8
  144. package/themes/original/src/components/Notifications/styles.tsx +0 -1
  145. package/themes/original/src/components/OrderDetails/OrderHistory.tsx +1 -1
  146. package/themes/original/src/components/OrderDetails/index.tsx +716 -668
  147. package/themes/original/src/components/OrderDetails/styles.tsx +24 -8
  148. package/themes/original/src/components/OrderProgress/index.tsx +28 -6
  149. package/themes/original/src/components/OrderProgress/styles.tsx +1 -1
  150. package/themes/original/src/components/OrderSummary/index.tsx +3 -1
  151. package/themes/original/src/components/OrderTypeSelector/index.tsx +5 -6
  152. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/styles.tsx +1 -1
  153. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/styles.tsx +1 -1
  154. package/themes/original/src/components/OrdersOption/index.tsx +3 -5
  155. package/themes/original/src/components/OrdersOption/styles.tsx +1 -1
  156. package/themes/original/src/components/PageBanner/index.tsx +3 -0
  157. package/themes/original/src/components/PaymentOptionCard/index.tsx +4 -2
  158. package/themes/original/src/components/PaymentOptionStripe/styles.tsx +3 -0
  159. package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
  160. package/themes/original/src/components/PaymentOptions/index.tsx +72 -6
  161. package/themes/original/src/components/ProductForm/ActionButton.tsx +120 -0
  162. package/themes/original/src/components/ProductForm/ExtraOptions.tsx +56 -0
  163. package/themes/original/src/components/ProductForm/index.tsx +74 -165
  164. package/themes/original/src/components/ProductItemAccordion/index.tsx +54 -44
  165. package/themes/original/src/components/ProductItemAccordion/styles.tsx +3 -4
  166. package/themes/original/src/components/ProductOptionSubOption/index.tsx +123 -82
  167. package/themes/original/src/components/ProductOptionSubOption/styles.tsx +6 -1
  168. package/themes/original/src/components/ProfessionalProfile/styles.tsx +3 -3
  169. package/themes/original/src/components/Promotions/index.tsx +4 -4
  170. package/themes/original/src/components/Promotions/styles.tsx +0 -2
  171. package/themes/original/src/components/ReviewDriver/styles.tsx +1 -1
  172. package/themes/original/src/components/ReviewOrder/styles.tsx +1 -1
  173. package/themes/original/src/components/ReviewProducts/styles.tsx +1 -1
  174. package/themes/original/src/components/ServiceForm/index.tsx +2 -2
  175. package/themes/original/src/components/ServiceForm/styles.tsx +4 -4
  176. package/themes/original/src/components/SignupForm/index.tsx +60 -58
  177. package/themes/original/src/components/SingleOrderCard/index.tsx +3 -2
  178. package/themes/original/src/components/SingleProductCard/index.tsx +2 -2
  179. package/themes/original/src/components/SingleProductCard/styles.tsx +0 -3
  180. package/themes/original/src/components/StripeCardsList/index.tsx +17 -36
  181. package/themes/original/src/components/StripeElementsForm/index.tsx +72 -59
  182. package/themes/original/src/components/StripeElementsForm/naked.tsx +47 -0
  183. package/themes/original/src/components/UpsellingProducts/UpsellingContent.tsx +170 -0
  184. package/themes/original/src/components/UpsellingProducts/UpsellingLayout.tsx +86 -0
  185. package/themes/original/src/components/UpsellingProducts/index.tsx +15 -199
  186. package/themes/original/src/components/UpsellingProducts/styles.tsx +19 -0
  187. package/themes/original/src/components/UserFormDetails/index.tsx +125 -77
  188. package/themes/original/src/components/UserFormDetails/styles.tsx +7 -0
  189. package/themes/original/src/components/UserProfile/index.tsx +3 -2
  190. package/themes/original/src/components/UserProfileForm/index.tsx +30 -36
  191. package/themes/original/src/components/WalletTransactions/styles.tsx +1 -0
  192. package/themes/original/src/components/Wallets/index.tsx +8 -9
  193. package/themes/original/src/components/Wallets/styles.tsx +1 -1
  194. package/themes/original/src/components/WebsocketStatus/index.tsx +172 -0
  195. package/themes/original/src/components/WebsocketStatus/styles.tsx +28 -0
  196. package/themes/original/src/components/shared/HeaderTitle.tsx +1 -1
  197. package/themes/original/src/components/shared/OButton.tsx +5 -5
  198. package/themes/original/src/components/shared/OInput.tsx +1 -4
  199. package/themes/original/src/components/shared/OModal.tsx +12 -14
  200. package/themes/original/src/layouts/Container.tsx +5 -3
  201. package/themes/original/src/types/index.tsx +1 -0
  202. package/themes/original/src/utils/index.tsx +125 -1
  203. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
  204. package/src/navigators/BottomNavigator.tsx +0 -117
  205. package/src/navigators/CheckoutNavigator.tsx +0 -66
  206. package/src/navigators/HomeNavigator.tsx +0 -202
  207. package/src/navigators/NavigationRef.tsx +0 -7
  208. package/src/navigators/RootNavigator.tsx +0 -269
  209. package/src/pages/Account.tsx +0 -34
  210. package/src/pages/AddressForm.tsx +0 -62
  211. package/src/pages/AddressList.tsx +0 -24
  212. package/src/pages/BusinessProductsList.tsx +0 -81
  213. package/src/pages/BusinessesListing.tsx +0 -43
  214. package/src/pages/CartList.tsx +0 -49
  215. package/src/pages/Checkout.tsx +0 -101
  216. package/src/pages/ForgotPassword.tsx +0 -24
  217. package/src/pages/Help.tsx +0 -23
  218. package/src/pages/HelpAccountAndPayment.tsx +0 -23
  219. package/src/pages/HelpGuide.tsx +0 -23
  220. package/src/pages/HelpOrder.tsx +0 -23
  221. package/src/pages/Home.tsx +0 -36
  222. package/src/pages/IntroductoryTutorial.tsx +0 -170
  223. package/src/pages/Login.tsx +0 -47
  224. package/src/pages/MomentOption.tsx +0 -30
  225. package/src/pages/MultiCheckout.tsx +0 -31
  226. package/src/pages/MultiOrdersDetails.tsx +0 -27
  227. package/src/pages/MyOrders.tsx +0 -40
  228. package/src/pages/NetworkError.tsx +0 -24
  229. package/src/pages/NotFound.tsx +0 -22
  230. package/src/pages/OrderDetails.tsx +0 -25
  231. package/src/pages/ProductDetails.tsx +0 -55
  232. package/src/pages/Profile.tsx +0 -36
  233. package/src/pages/ReviewDriver.tsx +0 -30
  234. package/src/pages/ReviewOrder.tsx +0 -32
  235. package/src/pages/ReviewProducts.tsx +0 -30
  236. package/src/pages/Sessions.tsx +0 -22
  237. package/src/pages/Signup.tsx +0 -53
  238. package/src/pages/SpinnerLoader.tsx +0 -10
  239. package/src/pages/Splash.tsx +0 -21
@@ -583,65 +583,67 @@ const SignupFormUI = (props: SignupParams) => {
583
583
  {sortInputFields({
584
584
  values: validationFields?.fields?.checkout,
585
585
  }).map(
586
- (field: any, i: number) =>
587
- !notValidationFields.includes(field.code) &&
588
- showField &&
589
- showField(field.code) &&
590
- (signUpTab === 'default' ||
591
- (signUpTab === 'otpEmail' && field.code === 'email')) && (
592
- <React.Fragment key={field.id}>
593
- {errors?.[`${field.code}`] && (
594
- <OText
595
- size={14}
596
- color={theme.colors.danger5}
597
- weight={'normal'}>
598
- {errors?.[`${field.code}`]?.message} {errors?.[`${field.code}`]?.type === 'required' && '*'}
599
- </OText>
600
- )}
601
- <Controller
602
- control={control}
603
- render={({ onChange, value }: any) => (
604
- <OInput
605
- placeholder={t(field.name?.replace(/\s/g, '_')?.toUpperCase(), field.name)}
606
- style={style.inputStyle}
607
- icon={
608
- field.code === 'email'
609
- ? theme.images.general.email
610
- : theme.images.general.user
611
- }
612
- value={value}
613
- onChange={(val: any) =>
614
- field.code !== 'email'
615
- ? (onChange(val))
616
- : handleChangeInputEmail(val, onChange)
617
- }
618
- autoCapitalize={
619
- field.code === 'email' ? 'none' : 'sentences'
620
- }
621
- autoCorrect={field.code === 'email' && false}
622
- type={
623
- field.code === 'email' ? 'email-address' : 'default'
624
- }
625
- autoCompleteType={
626
- field.code === 'email' ? 'email' : 'off'
627
- }
628
- returnKeyType="next"
629
- blurOnSubmit={false}
630
- forwardRef={(ref: any) => handleRefs(ref, field.code)}
631
- onSubmitEditing={() =>
632
- field.code === 'email'
633
- ? phoneRef?.current?.focus?.()
634
- : handleFocusRef(getNextFieldCode(i))
635
- }
636
- borderColor={errors?.[`${field.code}`] ? theme.colors.danger5 : theme.colors.border}
637
- />
586
+ (item: any, i: number) => {
587
+ const field = item?.validation_field || item
588
+ return (!notValidationFields.includes(field.code) &&
589
+ showField &&
590
+ showField(field.code) &&
591
+ (signUpTab === 'default' ||
592
+ (signUpTab === 'otpEmail' && field.code === 'email')) && (
593
+ <React.Fragment key={field.id}>
594
+ {errors?.[`${field.code}`] && (
595
+ <OText
596
+ size={14}
597
+ color={theme.colors.danger5}
598
+ weight={'normal'}>
599
+ {errors?.[`${field.code}`]?.message} {errors?.[`${field.code}`]?.type === 'required' && '*'}
600
+ </OText>
638
601
  )}
639
- name={field.code}
640
- rules={getInputRules(field)}
641
- defaultValue=""
642
- />
643
- </React.Fragment>
644
- ),
602
+ <Controller
603
+ control={control}
604
+ render={({ onChange, value }: any) => (
605
+ <OInput
606
+ placeholder={t(field.name?.replace(/\s/g, '_')?.toUpperCase(), field.name)}
607
+ style={style.inputStyle}
608
+ icon={
609
+ field.code === 'email'
610
+ ? theme.images.general.email
611
+ : theme.images.general.user
612
+ }
613
+ value={value}
614
+ onChange={(val: any) =>
615
+ field.code !== 'email'
616
+ ? (onChange(val))
617
+ : handleChangeInputEmail(val, onChange)
618
+ }
619
+ autoCapitalize={
620
+ field.code === 'email' ? 'none' : 'sentences'
621
+ }
622
+ autoCorrect={field.code === 'email' && false}
623
+ type={
624
+ field.code === 'email' ? 'email-address' : 'default'
625
+ }
626
+ autoCompleteType={
627
+ field.code === 'email' ? 'email' : 'off'
628
+ }
629
+ returnKeyType="next"
630
+ blurOnSubmit={false}
631
+ forwardRef={(ref: any) => handleRefs(ref, field.code)}
632
+ onSubmitEditing={() =>
633
+ field.code === 'email'
634
+ ? phoneRef?.current?.focus?.()
635
+ : handleFocusRef(getNextFieldCode(i))
636
+ }
637
+ borderColor={errors?.[`${field.code}`] ? theme.colors.danger5 : theme.colors.border}
638
+ />
639
+ )}
640
+ name={field.code}
641
+ rules={getInputRules(field)}
642
+ defaultValue=""
643
+ />
644
+ </React.Fragment>
645
+ ))
646
+ }
645
647
  )}
646
648
 
647
649
  {(!!showInputPhoneNumber && (signUpTab === 'default' || signUpTab === 'otpCellphone')) && (
@@ -53,6 +53,7 @@ const SingleOrderCardUI = (props: SingleOrderCardParams) => {
53
53
  const [isPressed, setIsPressed] = useState(false)
54
54
 
55
55
  const allowedOrderStatus = [1, 2, 5, 6, 10, 11, 12, 15];
56
+ const isGiftCardOrder = !order?.business_id
56
57
 
57
58
  const styles = StyleSheet.create({
58
59
  container: {
@@ -284,13 +285,13 @@ const SingleOrderCardUI = (props: SingleOrderCardParams) => {
284
285
  ) : (
285
286
  <Price>
286
287
  <OText size={12} lineHeight={18}>
287
- {parsePrice(order?.summary?.total || order?.total)}
288
+ {parsePrice(order?.total)}
288
289
  </OText>
289
290
  </Price>
290
291
  )}
291
292
  </>
292
293
  )}
293
- {!!pastOrders && (
294
+ {!!pastOrders && !isGiftCardOrder && (
294
295
  <ButtonWrapper>
295
296
  {!hideReviewOrderButton &&
296
297
  allowedOrderStatus.includes(parseInt(order?.status)) &&
@@ -169,7 +169,7 @@ const SingleProductCardUI = React.memo((props: SingleProductCardParams) => {
169
169
  }
170
170
 
171
171
  return (
172
- <InView style={{ minHeight: hideAddButton ? 125 : 190, marginLeft: logoPosition === 'left' ? 12.5 : 0 }} triggerOnce={true} onChange={(inView: boolean) => handleChangeIntersection()}>
172
+ <View style={{ minHeight: hideAddButton ? 125 : 190, marginLeft: logoPosition === 'left' ? 12.5 : 0 }}>
173
173
  {isIntersectionObserver ? (
174
174
  <CardAnimation
175
175
  onClick={() => handleClickproduct()}
@@ -340,7 +340,7 @@ const SingleProductCardUI = React.memo((props: SingleProductCardParams) => {
340
340
  </Placeholder>
341
341
  </View>
342
342
  )}
343
- </InView>
343
+ </View>
344
344
  );
345
345
  }, SingleProductCardPropsAreEqual);
346
346
 
@@ -49,15 +49,12 @@ export const RibbonBox = styled.View`
49
49
  background-color: ${(props: any) => props.theme.colors.primary};
50
50
  padding: 1px 8px;
51
51
  max-width: 60px;
52
-
53
52
  ${(props: any) => props.bgColor && css`
54
53
  background-color: ${props.bgColor};
55
54
  `}
56
-
57
55
  ${(props: any) => props.isRoundRect && css`
58
56
  border-radius: 7.6px;
59
57
  `}
60
-
61
58
  ${(props: any) => props.isCapsule && css`
62
59
  border-radius: 50px;
63
60
  `}
@@ -4,6 +4,7 @@ import {
4
4
  PaymentOptionStripe,
5
5
  useSession,
6
6
  useLanguage,
7
+ useValidationFields
7
8
  } from 'ordering-components/native';
8
9
  import { PlaceholderLine } from 'rn-placeholder';
9
10
  import { useTheme } from 'styled-components/native';
@@ -28,29 +29,29 @@ export const StripeCardsListUI = (props: any) => {
28
29
  cardSelected,
29
30
  cardsList,
30
31
  handleCardClick,
31
- setAddCardOpen,
32
+ onOpen,
32
33
  gateway,
33
- setCardsList,
34
- addCardOpen,
35
- isOpenMethod,
36
- handlePaymethodDataChange
34
+ paySelected
37
35
  } = props;
38
36
 
39
37
  const theme = useTheme();
40
38
 
41
39
  const [{ token }] = useSession();
42
40
  const [, t] = useLanguage();
43
-
41
+ const [validationFields] = useValidationFields()
42
+ const validateZipcodeCard =
43
+ validationFields?.fields?.card?.zipcode?.enabled && validationFields?.fields?.card?.zipcode?.required
44
44
  const paymethodsWithoutSaveCards = ['credomatic']
45
45
 
46
46
  const handleCardSelected = (card: any) => {
47
+ if (!card?.zipcode && validateZipcodeCard) return
47
48
  handleCardClick(card);
48
49
  onSelectCard(card);
49
50
  }
50
51
 
51
52
  useEffect(() => {
52
53
  if (!cardsList?.loading && cardsList?.cards?.length === 0 && !paymethodsWithoutSaveCards.includes(gateway)) {
53
- setAddCardOpen({ ...addCardOpen, stripe: true })
54
+ onOpen && onOpen();
54
55
  }
55
56
  }, [cardsList?.loading])
56
57
 
@@ -92,10 +93,10 @@ export const StripeCardsListUI = (props: any) => {
92
93
  style={styles.cardsList}
93
94
  >
94
95
  {cardsList.cards.map((card: any) => (
95
- <OSItem key={card.id} isUnique={cardsList.cards.length}>
96
+ <OSItem key={card.id} isUnique={cardsList.cards.length} isInvalid={!card?.zipcode && validateZipcodeCard}>
96
97
  <OSItemContent onPress={() => handleCardSelected(card)}>
97
98
  <View style={styles.viewStyle}>
98
- {card.id === cardSelected?.id ? (
99
+ {(card.id === cardSelected?.id || card.id === paySelected?.data?.id) ? (
99
100
  <OIcon
100
101
  src={theme.images.general.radio_act}
101
102
  width={16}
@@ -117,6 +118,13 @@ export const StripeCardsListUI = (props: any) => {
117
118
  XXXX-XXXX-XXXX-{card.last4}
118
119
  </OText>
119
120
  </View>
121
+ {!card?.zipcode && validateZipcodeCard && (
122
+ <View style={styles.viewStyle}>
123
+ <OText size={10} color={theme?.colors?.danger5}>
124
+ ({t('MISSING_ZIPCODE', 'Missing zipcode')})
125
+ </OText>
126
+ </View>
127
+ )}
120
128
  </OSItemContent>
121
129
  <OSItemActions>
122
130
  <OAlert
@@ -135,33 +143,6 @@ export const StripeCardsListUI = (props: any) => {
135
143
  ))}
136
144
  </ScrollView>
137
145
  )}
138
- <OModal
139
- entireModal
140
- title={t('ADD_CREDIT_OR_DEBIT_CARD', 'Add credit or debit card')}
141
- open={addCardOpen.stripe}
142
- onClose={() => setAddCardOpen({ ...addCardOpen, stripe: false })}
143
- style={{ backgroundColor: 'red' }}
144
- >
145
- <KeyboardAvoidingView
146
- behavior={Platform.OS == 'ios' ? 'padding' : 'height'}
147
- keyboardVerticalOffset={Platform.OS == 'ios' ? 0 : 0}
148
- enabled={Platform.OS === 'ios' ? true : false}
149
- >
150
- <StripeElementsForm
151
- openCarts={props.openCarts}
152
- toSave
153
- businessId={props.businessId}
154
- businessIds={props.businessIds}
155
- publicKey={props.publicKey || isOpenMethod?.paymethod?.credentials?.publishable}
156
- setCardsList={setCardsList}
157
- cardsList={cardsList}
158
- requirements={props.clientSecret}
159
- handleCardClick={handleCardClick}
160
- onSelectCard={handlePaymethodDataChange}
161
- onCancel={() => setAddCardOpen({ ...addCardOpen, stripe: false })}
162
- />
163
- </KeyboardAvoidingView>
164
- </OModal>
165
146
  </>
166
147
  )
167
148
  }
@@ -9,7 +9,7 @@ import {
9
9
  } from '@stripe/stripe-react-native';
10
10
  import { useTheme } from 'styled-components/native';
11
11
  import { ErrorMessage } from './styles';
12
-
12
+ import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder';
13
13
  import { StripeElementsForm as StripeFormController } from './naked';
14
14
  import { OButton, OText } from '../shared';
15
15
  import { useSafeAreaInsets } from 'react-native-safe-area-context';
@@ -17,7 +17,7 @@ import { StripeMethodForm } from '../../../../../src/components/StripeMethodForm
17
17
 
18
18
  const StripeElementsFormUI = (props: any) => {
19
19
  const {
20
- publicKey,
20
+ publicKeyState,
21
21
  handleSource,
22
22
  values,
23
23
  businessId,
@@ -33,7 +33,10 @@ const StripeElementsFormUI = (props: any) => {
33
33
  placeByMethodPay,
34
34
  methodPaySupported,
35
35
  setPlaceByMethodPay,
36
- cartTotal
36
+ cartTotal,
37
+ publicKeyAddCard,
38
+ urlScheme,
39
+ androidAppId
37
40
  } = props;
38
41
 
39
42
  const theme = useTheme();
@@ -52,10 +55,11 @@ const StripeElementsFormUI = (props: any) => {
52
55
  const [isKeyboardShow, setIsKeyboardShow] = useState(false);
53
56
  const zipCodeEnabled = validationFields?.fields?.card?.zipcode?.enabled
54
57
  const zipCodeRequired = validationFields?.fields?.card?.zipcode?.required
58
+ const isToSave = methodsPay?.includes(paymethod) ? publicKeyState?.key : (publicKeyAddCard || publicKeyState?.key)
55
59
  const styles = StyleSheet.create({
56
60
  container: {
57
61
  width: '100%',
58
- paddingHorizontal: 40,
62
+ paddingHorizontal: 20,
59
63
  justifyContent: 'space-between',
60
64
  paddingBottom: 12
61
65
  },
@@ -197,69 +201,78 @@ const StripeElementsFormUI = (props: any) => {
197
201
 
198
202
  return (
199
203
  <View style={{ ...styles.container, height: methodsPay?.includes(paymethod) ? 'auto' : height - top - bottom - 60 - (isKeyboardShow ? 250 : 0) }}>
200
- {publicKey ? (
201
- <View style={{ flex: 1 }}>
202
- <StripeProvider
203
- publishableKey={publicKey}
204
- merchantIdentifier={merchantId}
205
- urlScheme={merchantId}
206
- >
207
- {methodsPay?.includes(paymethod) ? (
208
- <StripeMethodForm
209
- handleSource={handleSource}
210
- onCancel={onCancel}
211
- cart={cart}
212
- cartTotal={cartTotal}
213
- setErrors={setErrors}
214
- paymethod={paymethod}
215
- devMode={publicKey?.includes('test')}
216
- setMethodPaySupported={setMethodPaySupported}
217
- placeByMethodPay={placeByMethodPay}
218
- methodPaySupported={methodPaySupported}
219
- setPlaceByMethodPay={setPlaceByMethodPay}
220
- />
221
- ) : (
222
- <CardField
223
- postalCodeEnabled={zipCodeEnabled}
224
- cardStyle={{
225
- backgroundColor: '#FFFFFF',
226
- textColor: '#000000',
227
- borderWidth: 1,
228
- borderRadius: 8,
229
- borderColor: theme.colors.border
230
- }}
231
- style={{
232
- width: '100%',
233
- height: 50,
234
- marginVertical: 30,
235
- zIndex: 9999,
236
- }}
237
- onCardChange={(cardDetails: any) => setCard(cardDetails)}
238
- />
239
- )}
240
- </StripeProvider>
241
- {!!errors && (
204
+ {publicKeyState.loading ? (
205
+ <Placeholder Animation={Fade}>
206
+ <PlaceholderLine height={50} style={{ marginTop: 20 }} />
207
+ </Placeholder>
208
+ ) : (
209
+ <>
210
+ {publicKeyState?.key ? (
211
+ <View style={{ flex: 1 }}>
212
+ <StripeProvider
213
+ publishableKey={isToSave}
214
+ merchantIdentifier={merchantId}
215
+ urlScheme={`${urlScheme}://checkout/${cart?.uuid}`}
216
+ >
217
+ {methodsPay?.includes(paymethod) ? (
218
+ <StripeMethodForm
219
+ handleSource={handleSource}
220
+ onCancel={onCancel}
221
+ cart={cart}
222
+ cartTotal={cartTotal}
223
+ setErrors={setErrors}
224
+ paymethod={paymethod}
225
+ devMode={publicKeyState?.key?.includes('test')}
226
+ setMethodPaySupported={setMethodPaySupported}
227
+ placeByMethodPay={placeByMethodPay}
228
+ methodPaySupported={methodPaySupported}
229
+ setPlaceByMethodPay={setPlaceByMethodPay}
230
+ androidAppId={androidAppId}
231
+ />
232
+ ) : (
233
+ <CardField
234
+ postalCodeEnabled={zipCodeEnabled}
235
+ cardStyle={{
236
+ backgroundColor: '#FFFFFF',
237
+ textColor: '#000000',
238
+ borderWidth: 1,
239
+ borderRadius: 8,
240
+ borderColor: theme.colors.border
241
+ }}
242
+ style={{
243
+ width: '100%',
244
+ height: 50,
245
+ marginVertical: 30,
246
+ zIndex: 9999,
247
+ }}
248
+ onCardChange={(cardDetails: any) => setCard(cardDetails)}
249
+ />
250
+ )}
251
+ </StripeProvider>
252
+ {!!errors && (
253
+ <ErrorMessage>
254
+ <OText
255
+ size={20}
256
+ color={theme.colors.error}
257
+ style={{ marginTop: 20, textAlign: 'center' }}
258
+ >
259
+ {errors}
260
+ </OText>
261
+ </ErrorMessage>
262
+ )}
263
+ </View>
264
+ ) : (
242
265
  <ErrorMessage>
243
266
  <OText
244
267
  size={20}
245
268
  color={theme.colors.error}
246
- style={{ marginTop: 20, textAlign: 'center' }}
269
+ style={{ marginTop: 20 }}
247
270
  >
248
- {errors}
271
+ {t('SOMETHING_WRONG', 'Something is wrong!')}
249
272
  </OText>
250
273
  </ErrorMessage>
251
274
  )}
252
- </View>
253
- ) : (
254
- <ErrorMessage>
255
- <OText
256
- size={20}
257
- color={theme.colors.error}
258
- style={{ marginTop: 20 }}
259
- >
260
- {t('SOMETHING_WRONG', 'Something is wrong!')}
261
- </OText>
262
- </ErrorMessage>
275
+ </>
263
276
  )}
264
277
  {!methodsPay?.includes(paymethod) && (
265
278
  <OButton
@@ -13,6 +13,7 @@ export const StripeElementsForm = (props: any) => {
13
13
  const [ordering] = useApi();
14
14
  const [{ token }] = useSession();
15
15
  const [state, setState] = useState({ loading: false, loadingAdd: false, error: null, requirements: null });
16
+ const [publicKeyState, setPublicKeyState] = useState({ key: props.publicKey, loading: true, error: null })
16
17
 
17
18
  const getRequirements = async () => {
18
19
  try {
@@ -85,6 +86,51 @@ export const StripeElementsForm = (props: any) => {
85
86
  }
86
87
  }
87
88
 
89
+ /**
90
+ * Method to get stripe credentials from API
91
+ */
92
+ const getCredentials = async () => {
93
+ try {
94
+ setPublicKeyState({
95
+ ...publicKeyState,
96
+ loading: true
97
+ })
98
+ const { content: { result, error } } = await ordering.setAccessToken(token).paymentCards().getCredentials()
99
+ if (!error) {
100
+ setPublicKeyState({
101
+ loading: false,
102
+ key: result.publishable,
103
+ error: null
104
+ })
105
+ } else {
106
+ setPublicKeyState({
107
+ ...publicKeyState,
108
+ loading: false,
109
+ error: result
110
+ })
111
+ }
112
+ } catch (error) {
113
+ setPublicKeyState({
114
+ ...publicKeyState,
115
+ loading: false,
116
+ error: error.message
117
+ })
118
+ }
119
+ }
120
+
121
+ useEffect(() => {
122
+ if (!token) return
123
+ if (props.publicKey) {
124
+ setPublicKeyState({
125
+ loading: false,
126
+ key: props.publicKey,
127
+ error: null
128
+ })
129
+ } else {
130
+ getCredentials()
131
+ }
132
+ }, [token, props.publicKey])
133
+
88
134
  useEffect(() => {
89
135
  if (!token || state.requirements) return
90
136
  toSave && getRequirements()
@@ -96,6 +142,7 @@ export const StripeElementsForm = (props: any) => {
96
142
  values={state}
97
143
  requirements={state.requirements}
98
144
  stripeTokenHandler={stripeTokenHandler}
145
+ publicKeyState={publicKeyState}
99
146
  />
100
147
  )
101
148
  }