ordering-ui-react-native 0.21.50 → 0.21.51-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 (198) hide show
  1. package/package.json +8 -8
  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 +6 -4
  6. package/src/components/VerifyPhone/styles.tsx +1 -2
  7. package/src/types/index.tsx +3 -1
  8. package/themes/business/index.tsx +4 -0
  9. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +4 -3
  10. package/themes/business/src/components/BusinessController/index.tsx +19 -17
  11. package/themes/business/src/components/BusinessProductList/ProductList.tsx +72 -27
  12. package/themes/business/src/components/BusinessProductList/index.tsx +57 -25
  13. package/themes/business/src/components/DriverMap/index.tsx +36 -23
  14. package/themes/business/src/components/GoogleMap/index.tsx +15 -8
  15. package/themes/business/src/components/Home/index.tsx +5 -1
  16. package/themes/business/src/components/LanguageSelector/index.tsx +1 -2
  17. package/themes/business/src/components/LanguageSelector/lang_country.json +515 -70
  18. package/themes/business/src/components/LogoutButton/index.tsx +1 -1
  19. package/themes/business/src/components/MapView/index.tsx +30 -15
  20. package/themes/business/src/components/NewOrderNotification/index.tsx +66 -26
  21. package/themes/business/src/components/OrderDetails/Business.tsx +52 -2
  22. package/themes/business/src/components/OrderDetails/Delivery.tsx +42 -23
  23. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +68 -61
  24. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +40 -20
  25. package/themes/business/src/components/OrderDetails/usePrinterCommands.tsx +220 -0
  26. package/themes/business/src/components/OrderSummary/index.tsx +240 -76
  27. package/themes/business/src/components/OrdersOption/index.tsx +263 -135
  28. package/themes/business/src/components/PhoneInputNumber/index.tsx +8 -5
  29. package/themes/business/src/components/PreviousOrders/OrderItem.tsx +37 -40
  30. package/themes/business/src/components/PreviousOrders/OrderList.tsx +1 -1
  31. package/themes/business/src/components/PreviousOrders/index.tsx +5 -3
  32. package/themes/business/src/components/PreviousOrders/styles.tsx +10 -0
  33. package/themes/business/src/components/PrinterEdition/index.tsx +363 -0
  34. package/themes/business/src/components/PrinterEdition/styles.tsx +61 -0
  35. package/themes/business/src/components/PrinterSettings/index.tsx +267 -0
  36. package/themes/business/src/components/PrinterSettings/styles.tsx +30 -0
  37. package/themes/business/src/components/ProductItemAccordion/index.tsx +2 -2
  38. package/themes/business/src/components/ReviewCustomer/index.tsx +2 -0
  39. package/themes/business/src/components/SearchBar/index.tsx +2 -1
  40. package/themes/business/src/components/Sessions/index.tsx +187 -0
  41. package/themes/business/src/components/Sessions/styles.tsx +20 -0
  42. package/themes/business/src/components/StoresList/index.tsx +5 -3
  43. package/themes/business/src/components/UserFormDetails/index.tsx +111 -107
  44. package/themes/business/src/components/UserProfileForm/index.tsx +106 -54
  45. package/themes/business/src/components/WebsocketStatus/index.tsx +2 -2
  46. package/themes/business/src/components/shared/OInput.tsx +2 -0
  47. package/themes/business/src/components/shared/OTextarea.tsx +8 -9
  48. package/themes/business/src/hooks/useLocation.tsx +5 -4
  49. package/themes/business/src/types/index.tsx +23 -5
  50. package/themes/business/src/utils/index.tsx +5 -0
  51. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  52. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  53. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  54. package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
  55. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  56. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  57. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
  58. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  59. package/themes/original/index.tsx +6 -2
  60. package/themes/original/src/components/AddressDetails/index.tsx +20 -10
  61. package/themes/original/src/components/AddressForm/index.tsx +41 -15
  62. package/themes/original/src/components/AddressForm/styles.tsx +1 -1
  63. package/themes/original/src/components/AddressList/index.tsx +18 -4
  64. package/themes/original/src/components/AddressList/styles.tsx +4 -4
  65. package/themes/original/src/components/AnalyticsSegment/index.tsx +6 -6
  66. package/themes/original/src/components/AppleLogin/index.tsx +4 -4
  67. package/themes/original/src/components/BusinessBasicInformation/index.tsx +7 -10
  68. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +1 -1
  69. package/themes/original/src/components/BusinessController/index.tsx +18 -10
  70. package/themes/original/src/components/BusinessController/styles.tsx +8 -7
  71. package/themes/original/src/components/BusinessInformation/styles.tsx +2 -2
  72. package/themes/original/src/components/BusinessItemAccordion/index.tsx +4 -3
  73. package/themes/original/src/components/BusinessListingSearch/BusinessSearchFooter.tsx +317 -0
  74. package/themes/original/src/components/BusinessListingSearch/BusinessSearchHeader.tsx +96 -0
  75. package/themes/original/src/components/BusinessListingSearch/index.tsx +47 -358
  76. package/themes/original/src/components/BusinessListingSearch/styles.tsx +1 -1
  77. package/themes/original/src/components/BusinessPreorder/index.tsx +4 -3
  78. package/themes/original/src/components/BusinessProductsCategories/index.tsx +1 -1
  79. package/themes/original/src/components/BusinessProductsList/index.tsx +1 -1
  80. package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
  81. package/themes/original/src/components/BusinessProductsListing/index.tsx +30 -18
  82. package/themes/original/src/components/BusinessProductsListing/styles.tsx +2 -2
  83. package/themes/original/src/components/BusinessReviews/index.tsx +1 -1
  84. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +1 -1
  85. package/themes/original/src/components/BusinessesListing/Layout/Appointment/styles.tsx +5 -5
  86. package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListFooter.tsx +1 -1
  87. package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListHeader.tsx +7 -7
  88. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +2 -2
  89. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +1 -1
  90. package/themes/original/src/components/BusinessesListing/index.tsx +0 -1
  91. package/themes/original/src/components/Cart/index.tsx +30 -9
  92. package/themes/original/src/components/CartContent/index.tsx +96 -58
  93. package/themes/original/src/components/CartStoresListing/styles.tsx +2 -2
  94. package/themes/original/src/components/Checkout/index.tsx +144 -62
  95. package/themes/original/src/components/Checkout/styles.tsx +17 -0
  96. package/themes/original/src/components/CitiesControl/styles.tsx +1 -1
  97. package/themes/original/src/components/DatePicker/index.tsx +18 -2
  98. package/themes/original/src/components/Favorite/index.tsx +9 -9
  99. package/themes/original/src/components/Favorite/styles.tsx +0 -2
  100. package/themes/original/src/components/FloatingButton/styles.tsx +1 -1
  101. package/themes/original/src/components/ForgotPasswordForm/index.tsx +5 -0
  102. package/themes/original/src/components/GPSButton/index.tsx +1 -1
  103. package/themes/original/src/components/GiftCard/GiftCardOrdersList/index.tsx +64 -0
  104. package/themes/original/src/components/GiftCard/GiftCardOrdersList/styles.tsx +8 -0
  105. package/themes/original/src/components/GiftCard/PurchaseGiftCard/styles.tsx +1 -1
  106. package/themes/original/src/components/GiftCard/RedeemGiftCard/styles.tsx +1 -1
  107. package/themes/original/src/components/GiftCard/SendGiftCard/index.tsx +2 -2
  108. package/themes/original/src/components/GiftCard/SendGiftCard/styles.tsx +1 -1
  109. package/themes/original/src/components/GiftCard/SingleGiftCard/index.tsx +101 -0
  110. package/themes/original/src/components/GiftCard/SingleGiftCard/styles.tsx +4 -0
  111. package/themes/original/src/components/GiftCard/VerticalGiftCardOrdersLayout/index.tsx +83 -0
  112. package/themes/original/src/components/GiftCard/VerticalGiftCardOrdersLayout/styles.tsx +9 -0
  113. package/themes/original/src/components/GoogleMap/index.tsx +39 -18
  114. package/themes/original/src/components/Help/index.tsx +7 -0
  115. package/themes/original/src/components/HelpAccountAndPayment/index.tsx +5 -0
  116. package/themes/original/src/components/HelpGuide/index.tsx +5 -0
  117. package/themes/original/src/components/HelpOrder/index.tsx +5 -0
  118. package/themes/original/src/components/HighestRatedBusinesses/index.tsx +2 -2
  119. package/themes/original/src/components/HighestRatedBusinesses/styles.tsx +1 -1
  120. package/themes/original/src/components/Home/index.tsx +3 -8
  121. package/themes/original/src/components/LoginForm/Otp/index.tsx +4 -16
  122. package/themes/original/src/components/LoginForm/index.tsx +9 -3
  123. package/themes/original/src/components/MessageListing/index.tsx +6 -0
  124. package/themes/original/src/components/Messages/index.tsx +8 -7
  125. package/themes/original/src/components/Messages/styles.tsx +1 -1
  126. package/themes/original/src/components/MomentOption/index.tsx +19 -4
  127. package/themes/original/src/components/MultiCart/index.tsx +1 -1
  128. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +7 -3
  129. package/themes/original/src/components/MultiCheckout/index.tsx +126 -61
  130. package/themes/original/src/components/MultiCheckout/styles.tsx +17 -0
  131. package/themes/original/src/components/MultiOrdersDetails/index.tsx +20 -15
  132. package/themes/original/src/components/MyOrders/index.tsx +28 -28
  133. package/themes/original/src/components/NavBar/index.tsx +5 -0
  134. package/themes/original/src/components/NetworkError/index.tsx +2 -3
  135. package/themes/original/src/components/NetworkError/styles.tsx +2 -2
  136. package/themes/original/src/components/Notifications/index.tsx +9 -8
  137. package/themes/original/src/components/Notifications/styles.tsx +0 -1
  138. package/themes/original/src/components/OrderDetails/OrderHistory.tsx +1 -1
  139. package/themes/original/src/components/OrderDetails/index.tsx +701 -662
  140. package/themes/original/src/components/OrderDetails/styles.tsx +24 -8
  141. package/themes/original/src/components/OrderProgress/index.tsx +22 -3
  142. package/themes/original/src/components/OrderProgress/styles.tsx +1 -1
  143. package/themes/original/src/components/OrderSummary/index.tsx +3 -1
  144. package/themes/original/src/components/OrderTypeSelector/index.tsx +10 -6
  145. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/styles.tsx +1 -1
  146. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/styles.tsx +1 -1
  147. package/themes/original/src/components/OrdersOption/index.tsx +3 -5
  148. package/themes/original/src/components/OrdersOption/styles.tsx +1 -1
  149. package/themes/original/src/components/PaymentOptionCard/index.tsx +4 -2
  150. package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
  151. package/themes/original/src/components/PaymentOptions/index.tsx +47 -4
  152. package/themes/original/src/components/PreviousOrders/index.tsx +2 -0
  153. package/themes/original/src/components/ProductForm/ActionButton.tsx +122 -0
  154. package/themes/original/src/components/ProductForm/ExtraOptions.tsx +56 -0
  155. package/themes/original/src/components/ProductForm/index.tsx +170 -252
  156. package/themes/original/src/components/ProductItemAccordion/index.tsx +55 -44
  157. package/themes/original/src/components/ProductItemAccordion/styles.tsx +3 -4
  158. package/themes/original/src/components/ProductOptionSubOption/index.tsx +112 -91
  159. package/themes/original/src/components/ProfessionalProfile/styles.tsx +3 -3
  160. package/themes/original/src/components/Promotions/index.tsx +13 -11
  161. package/themes/original/src/components/Promotions/styles.tsx +0 -2
  162. package/themes/original/src/components/ReviewDriver/index.tsx +5 -0
  163. package/themes/original/src/components/ReviewDriver/styles.tsx +1 -1
  164. package/themes/original/src/components/ReviewOrder/index.tsx +5 -0
  165. package/themes/original/src/components/ReviewOrder/styles.tsx +1 -1
  166. package/themes/original/src/components/ReviewProducts/index.tsx +5 -0
  167. package/themes/original/src/components/ReviewProducts/styles.tsx +1 -1
  168. package/themes/original/src/components/ServiceForm/index.tsx +1 -1
  169. package/themes/original/src/components/ServiceForm/styles.tsx +4 -4
  170. package/themes/original/src/components/Sessions/index.tsx +5 -0
  171. package/themes/original/src/components/SignupForm/index.tsx +67 -59
  172. package/themes/original/src/components/SingleOrderCard/index.tsx +1 -1
  173. package/themes/original/src/components/SingleProductCard/index.tsx +4 -3
  174. package/themes/original/src/components/SingleProductCard/styles.tsx +0 -3
  175. package/themes/original/src/components/StripeCardsList/index.tsx +12 -35
  176. package/themes/original/src/components/StripeElementsForm/index.tsx +79 -59
  177. package/themes/original/src/components/StripeElementsForm/naked.tsx +48 -1
  178. package/themes/original/src/components/UpsellingProducts/UpsellingContent.tsx +170 -0
  179. package/themes/original/src/components/UpsellingProducts/UpsellingLayout.tsx +91 -0
  180. package/themes/original/src/components/UpsellingProducts/index.tsx +15 -199
  181. package/themes/original/src/components/UpsellingProducts/styles.tsx +19 -0
  182. package/themes/original/src/components/UserFormDetails/index.tsx +100 -86
  183. package/themes/original/src/components/UserFormDetails/styles.tsx +7 -0
  184. package/themes/original/src/components/UserProfile/index.tsx +3 -2
  185. package/themes/original/src/components/UserProfileForm/index.tsx +5 -0
  186. package/themes/original/src/components/WalletTransactions/styles.tsx +1 -0
  187. package/themes/original/src/components/Wallets/index.tsx +7 -4
  188. package/themes/original/src/components/Wallets/styles.tsx +2 -1
  189. package/themes/original/src/components/WebsocketStatus/index.tsx +172 -0
  190. package/themes/original/src/components/WebsocketStatus/styles.tsx +28 -0
  191. package/themes/original/src/components/shared/HeaderTitle.tsx +1 -1
  192. package/themes/original/src/components/shared/OButton.tsx +5 -5
  193. package/themes/original/src/components/shared/OInput.tsx +1 -4
  194. package/themes/original/src/components/shared/OModal.tsx +12 -14
  195. package/themes/original/src/layouts/Container.tsx +5 -3
  196. package/themes/original/src/types/index.tsx +6 -1
  197. package/themes/original/src/utils/index.tsx +12 -1
  198. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
@@ -72,6 +72,11 @@ export const SessionsUI = (props: SessionsParams) => {
72
72
  showCall={false}
73
73
  paddingTop={10}
74
74
  btnStyle={{ paddingLeft: 0 }}
75
+ buttonProps={{
76
+ bgColor: theme.colors.white,
77
+ borderColor: theme.colors.white,
78
+ textStyle: { color: theme.colors.btnFont }
79
+ }}
75
80
  />
76
81
  {user?.session_strategy === 'jwt_session' ? (
77
82
  <>
@@ -155,7 +155,7 @@ const SignupFormUI = (props: SignupParams) => {
155
155
  const showInputPhoneNumber = (validationFields?.fields?.checkout?.cellphone?.enabled ?? false) || configs?.verification_phone_required?.value === '1'
156
156
  const googleLoginEnabled = configs?.google_login_enabled?.value === '1' || !configs?.google_login_enabled?.enabled
157
157
  const facebookLoginEnabled = configs?.facebook_login_enabled?.value === '1' || !configs?.facebook_login_enabled?.enabled
158
- const appleLoginEnabled = configs?.apple_login_enabled?.value === '1' || !configs?.apple_login_enabled?.enabled
158
+ const appleLoginEnabled = Platform.OS === 'ios' && (configs?.apple_login_enabled?.value === '1' || !configs?.apple_login_enabled?.enabled)
159
159
 
160
160
  const closeAlert = () => {
161
161
  setAlertState({
@@ -488,6 +488,11 @@ const SignupFormUI = (props: SignupParams) => {
488
488
  btnStyle={{ paddingLeft: 0 }}
489
489
  titleWrapStyle={{ paddingHorizontal: 0 }}
490
490
  titleStyle={{ marginLeft: 0, marginRight: 0 }}
491
+ buttonProps={{
492
+ bgColor: theme.colors.white,
493
+ borderColor: theme.colors.white,
494
+ textStyle: { color: theme.colors.btnFont }
495
+ }}
491
496
  />
492
497
  )}
493
498
  <FormSide>
@@ -583,65 +588,67 @@ const SignupFormUI = (props: SignupParams) => {
583
588
  {sortInputFields({
584
589
  values: validationFields?.fields?.checkout,
585
590
  }).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
- />
591
+ (item: any, i: number) => {
592
+ const field = item?.validation_field || item
593
+ return (!notValidationFields.includes(field.code) &&
594
+ showField &&
595
+ showField(field.code) &&
596
+ (signUpTab === 'default' ||
597
+ (signUpTab === 'otpEmail' && field.code === 'email')) && (
598
+ <React.Fragment key={field.id}>
599
+ {errors?.[`${field.code}`] && (
600
+ <OText
601
+ size={14}
602
+ color={theme.colors.danger5}
603
+ weight={'normal'}>
604
+ {errors?.[`${field.code}`]?.message} {errors?.[`${field.code}`]?.type === 'required' && '*'}
605
+ </OText>
638
606
  )}
639
- name={field.code}
640
- rules={getInputRules(field)}
641
- defaultValue=""
642
- />
643
- </React.Fragment>
644
- ),
607
+ <Controller
608
+ control={control}
609
+ render={({ onChange, value }: any) => (
610
+ <OInput
611
+ placeholder={t(field.name?.replace(/\s/g, '_')?.toUpperCase(), field.name)}
612
+ style={style.inputStyle}
613
+ icon={
614
+ field.code === 'email'
615
+ ? theme.images.general.email
616
+ : theme.images.general.user
617
+ }
618
+ value={value}
619
+ onChange={(val: any) =>
620
+ field.code !== 'email'
621
+ ? (onChange(val))
622
+ : handleChangeInputEmail(val, onChange)
623
+ }
624
+ autoCapitalize={
625
+ field.code === 'email' ? 'none' : 'sentences'
626
+ }
627
+ autoCorrect={field.code === 'email' && false}
628
+ type={
629
+ field.code === 'email' ? 'email-address' : 'default'
630
+ }
631
+ autoCompleteType={
632
+ field.code === 'email' ? 'email' : 'off'
633
+ }
634
+ returnKeyType="next"
635
+ blurOnSubmit={false}
636
+ forwardRef={(ref: any) => handleRefs(ref, field.code)}
637
+ onSubmitEditing={() =>
638
+ field.code === 'email'
639
+ ? phoneRef?.current?.focus?.()
640
+ : handleFocusRef(getNextFieldCode(i))
641
+ }
642
+ borderColor={errors?.[`${field.code}`] ? theme.colors.danger5 : theme.colors.border}
643
+ />
644
+ )}
645
+ name={field.code}
646
+ rules={getInputRules(field)}
647
+ defaultValue=""
648
+ />
649
+ </React.Fragment>
650
+ ))
651
+ }
645
652
  )}
646
653
 
647
654
  {(!!showInputPhoneNumber && (signUpTab === 'default' || signUpTab === 'otpCellphone')) && (
@@ -833,6 +840,7 @@ const SignupFormUI = (props: SignupParams) => {
833
840
  />
834
841
  )
835
842
  }
843
+ autoCapitalize='none'
836
844
  value={value}
837
845
  onChange={(val: any) => onChange(val)}
838
846
  returnKeyType="done"
@@ -285,7 +285,7 @@ const SingleOrderCardUI = (props: SingleOrderCardParams) => {
285
285
  ) : (
286
286
  <Price>
287
287
  <OText size={12} lineHeight={18}>
288
- {parsePrice(order?.summary?.total || order?.total)}
288
+ {parsePrice(order?.total)}
289
289
  </OText>
290
290
  </Price>
291
291
  )}
@@ -48,6 +48,7 @@ const SingleProductCardUI = React.memo((props: SingleProductCardParams) => {
48
48
  const hideAddButton = theme?.business_view?.components?.products?.components?.add_to_cart_button?.hidden ?? true
49
49
  const isChewLayout = theme?.header?.components?.layout?.type?.toLowerCase() === 'chew'
50
50
  const hideProductDescription = theme?.business_view?.components?.products?.components?.product?.components?.description?.hidden
51
+ const hideProductDummyLogo = theme?.business_view?.components?.products?.components?.product?.components?.dummy?.hidden
51
52
  const hideProductLogo = viewString
52
53
  ? theme?.[viewString]?.components?.cart?.components?.products?.image?.hidden
53
54
  : theme?.business_view?.components?.products?.components?.product?.components?.image?.hidden
@@ -169,7 +170,7 @@ const SingleProductCardUI = React.memo((props: SingleProductCardParams) => {
169
170
  }
170
171
 
171
172
  return (
172
- <InView style={{ minHeight: hideAddButton ? 125 : 190, marginLeft: logoPosition === 'left' ? 12.5 : 0 }} triggerOnce={true} onChange={(inView: boolean) => handleChangeIntersection()}>
173
+ <View style={{ minHeight: hideAddButton ? 125 : 190, marginLeft: logoPosition === 'left' ? 12.5 : 0 }}>
173
174
  {isIntersectionObserver ? (
174
175
  <CardAnimation
175
176
  onClick={() => handleClickproduct()}
@@ -283,7 +284,7 @@ const SingleProductCardUI = React.memo((props: SingleProductCardParams) => {
283
284
  </OText>
284
285
  </RibbonBox>
285
286
  )}
286
- {!hideProductLogo && (
287
+ {(!hideProductLogo && (product?.images || !hideProductDummyLogo)) && (
287
288
  <FastImage
288
289
  style={styles.productStyle}
289
290
  source={product?.images ? {
@@ -340,7 +341,7 @@ const SingleProductCardUI = React.memo((props: SingleProductCardParams) => {
340
341
  </Placeholder>
341
342
  </View>
342
343
  )}
343
- </InView>
344
+ </View>
344
345
  );
345
346
  }, SingleProductCardPropsAreEqual);
346
347
 
@@ -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
  `}
@@ -29,12 +29,11 @@ export const StripeCardsListUI = (props: any) => {
29
29
  cardSelected,
30
30
  cardsList,
31
31
  handleCardClick,
32
- setAddCardOpen,
32
+ onOpen,
33
33
  gateway,
34
- setCardsList,
35
- addCardOpen,
36
- isOpenMethod,
37
- handlePaymethodDataChange
34
+ paySelected,
35
+ newCardAdded,
36
+ addNewCardAsDefault
38
37
  } = props;
39
38
 
40
39
  const theme = useTheme();
@@ -54,10 +53,16 @@ export const StripeCardsListUI = (props: any) => {
54
53
 
55
54
  useEffect(() => {
56
55
  if (!cardsList?.loading && cardsList?.cards?.length === 0 && !paymethodsWithoutSaveCards.includes(gateway)) {
57
- setAddCardOpen({ ...addCardOpen, stripe: true })
56
+ onOpen && onOpen();
58
57
  }
59
58
  }, [cardsList?.loading])
60
59
 
60
+ useEffect(() => {
61
+ if (newCardAdded && addNewCardAsDefault){
62
+ handleCardSelected(newCardAdded)
63
+ }
64
+ }, [JSON.stringify(newCardAdded)])
65
+
61
66
  return (
62
67
  <>
63
68
  {token && !cardsList.loading && cardsList.cards && cardsList.cards.length === 0 && (
@@ -97,10 +102,9 @@ export const StripeCardsListUI = (props: any) => {
97
102
  >
98
103
  {cardsList.cards.map((card: any) => (
99
104
  <OSItem key={card.id} isUnique={cardsList.cards.length} isInvalid={!card?.zipcode && validateZipcodeCard}>
100
- {console.log(card?.zipcode && validateZipcodeCard)}
101
105
  <OSItemContent onPress={() => handleCardSelected(card)}>
102
106
  <View style={styles.viewStyle}>
103
- {card.id === cardSelected?.id ? (
107
+ {(card.id === cardSelected?.id || card.id === paySelected?.data?.id) ? (
104
108
  <OIcon
105
109
  src={theme.images.general.radio_act}
106
110
  width={16}
@@ -147,33 +151,6 @@ export const StripeCardsListUI = (props: any) => {
147
151
  ))}
148
152
  </ScrollView>
149
153
  )}
150
- <OModal
151
- entireModal
152
- title={t('ADD_CREDIT_OR_DEBIT_CARD', 'Add credit or debit card')}
153
- open={addCardOpen.stripe}
154
- onClose={() => setAddCardOpen({ ...addCardOpen, stripe: false })}
155
- style={{ backgroundColor: 'red' }}
156
- >
157
- <KeyboardAvoidingView
158
- behavior={Platform.OS == 'ios' ? 'padding' : 'height'}
159
- keyboardVerticalOffset={Platform.OS == 'ios' ? 0 : 0}
160
- enabled={Platform.OS === 'ios' ? true : false}
161
- >
162
- <StripeElementsForm
163
- openCarts={props.openCarts}
164
- toSave
165
- businessId={props.businessId}
166
- businessIds={props.businessIds}
167
- publicKey={props.publicKey || isOpenMethod?.paymethod?.credentials?.publishable}
168
- setCardsList={setCardsList}
169
- cardsList={cardsList}
170
- requirements={props.clientSecret}
171
- handleCardClick={handleCardClick}
172
- onSelectCard={handlePaymethodDataChange}
173
- onCancel={() => setAddCardOpen({ ...addCardOpen, stripe: false })}
174
- />
175
- </KeyboardAvoidingView>
176
- </OModal>
177
154
  </>
178
155
  )
179
156
  }
@@ -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,12 @@ const StripeElementsFormUI = (props: any) => {
33
33
  placeByMethodPay,
34
34
  methodPaySupported,
35
35
  setPlaceByMethodPay,
36
- cartTotal
36
+ cartTotal,
37
+ publicKeyAddCard,
38
+ urlScheme,
39
+ androidAppId,
40
+ businessNames,
41
+ setNewCardAdded
37
42
  } = props;
38
43
 
39
44
  const theme = useTheme();
@@ -52,10 +57,11 @@ const StripeElementsFormUI = (props: any) => {
52
57
  const [isKeyboardShow, setIsKeyboardShow] = useState(false);
53
58
  const zipCodeEnabled = validationFields?.fields?.card?.zipcode?.enabled
54
59
  const zipCodeRequired = validationFields?.fields?.card?.zipcode?.required
60
+ const isToSave = methodsPay?.includes(paymethod) ? publicKeyState?.key : (publicKeyAddCard || publicKeyState?.key)
55
61
  const styles = StyleSheet.create({
56
62
  container: {
57
63
  width: '100%',
58
- paddingHorizontal: 40,
64
+ paddingHorizontal: 20,
59
65
  justifyContent: 'space-between',
60
66
  paddingBottom: 12
61
67
  },
@@ -145,6 +151,10 @@ const StripeElementsFormUI = (props: any) => {
145
151
  const _isNewCard = index === 0
146
152
  stripeTokenHandler(setupIntent?.paymentMethodId, user, businessId, _isNewCard);
147
153
  })
154
+ setNewCardAdded?.({
155
+ ...card,
156
+ id: setupIntent?.paymentMethodId
157
+ })
148
158
  } else {
149
159
  stripeTokenHandler(setupIntent?.paymentMethodId, user, businessId);
150
160
  }
@@ -197,69 +207,79 @@ const StripeElementsFormUI = (props: any) => {
197
207
 
198
208
  return (
199
209
  <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 && (
210
+ {publicKeyState.loading ? (
211
+ <Placeholder Animation={Fade}>
212
+ <PlaceholderLine height={50} style={{ marginTop: 20 }} />
213
+ </Placeholder>
214
+ ) : (
215
+ <>
216
+ {publicKeyState?.key ? (
217
+ <View style={{ flex: 1 }}>
218
+ <StripeProvider
219
+ publishableKey={isToSave}
220
+ merchantIdentifier={merchantId}
221
+ urlScheme={`${urlScheme}://checkout/${cart?.uuid}`}
222
+ >
223
+ {methodsPay?.includes(paymethod) ? (
224
+ <StripeMethodForm
225
+ handleSource={handleSource}
226
+ onCancel={onCancel}
227
+ cart={cart}
228
+ cartTotal={cartTotal}
229
+ setErrors={setErrors}
230
+ paymethod={paymethod}
231
+ devMode={publicKeyState?.key?.includes('test')}
232
+ setMethodPaySupported={setMethodPaySupported}
233
+ placeByMethodPay={placeByMethodPay}
234
+ methodPaySupported={methodPaySupported}
235
+ setPlaceByMethodPay={setPlaceByMethodPay}
236
+ androidAppId={androidAppId}
237
+ businessNames={businessNames}
238
+ />
239
+ ) : (
240
+ <CardField
241
+ postalCodeEnabled={zipCodeEnabled}
242
+ cardStyle={{
243
+ backgroundColor: '#FFFFFF',
244
+ textColor: '#000000',
245
+ borderWidth: 1,
246
+ borderRadius: 8,
247
+ borderColor: theme.colors.border
248
+ }}
249
+ style={{
250
+ width: '100%',
251
+ height: 50,
252
+ marginVertical: 30,
253
+ zIndex: 9999,
254
+ }}
255
+ onCardChange={(cardDetails: any) => setCard(cardDetails)}
256
+ />
257
+ )}
258
+ </StripeProvider>
259
+ {!!errors && (
260
+ <ErrorMessage>
261
+ <OText
262
+ size={20}
263
+ color={theme.colors.error}
264
+ style={{ marginTop: 20, textAlign: 'center' }}
265
+ >
266
+ {errors}
267
+ </OText>
268
+ </ErrorMessage>
269
+ )}
270
+ </View>
271
+ ) : (
242
272
  <ErrorMessage>
243
273
  <OText
244
274
  size={20}
245
275
  color={theme.colors.error}
246
- style={{ marginTop: 20, textAlign: 'center' }}
276
+ style={{ marginTop: 20 }}
247
277
  >
248
- {errors}
278
+ {t('SOMETHING_WRONG', 'Something is wrong!')}
249
279
  </OText>
250
280
  </ErrorMessage>
251
281
  )}
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>
282
+ </>
263
283
  )}
264
284
  {!methodsPay?.includes(paymethod) && (
265
285
  <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 {
@@ -52,7 +53,7 @@ export const StripeElementsForm = (props: any) => {
52
53
  const result = await fetch(`${ordering.root}/payments/stripe/cards`, {
53
54
  method: 'POST',
54
55
  headers: {
55
- Authorization: `Bearer ${user?.session?.access_token}`,
56
+ Authorization: `Bearer ${token}`,
56
57
  'Content-Type': 'application/json'
57
58
  },
58
59
  body: JSON.stringify({
@@ -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
  }