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.
- package/package.json +7 -6
- package/src/DeliveryApp.tsx +43 -1
- package/src/components/BusinessesListing/index.tsx +1 -1
- package/src/components/PaymentOptionsWebView/index.tsx +1 -0
- package/src/components/StripeMethodForm/index.tsx +4 -4
- package/src/components/VerifyPhone/styles.tsx +1 -2
- package/src/types/index.tsx +2 -1
- package/src/utils/index.tsx +2 -2
- package/themes/business/index.tsx +4 -0
- package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +9 -2
- package/themes/business/src/components/BusinessController/index.tsx +19 -17
- package/themes/business/src/components/BusinessProductList/AccordionDropdown.tsx +63 -0
- package/themes/business/src/components/BusinessProductList/IterateCategories.tsx +108 -0
- package/themes/business/src/components/BusinessProductList/ProductList.tsx +196 -0
- package/themes/business/src/components/BusinessProductList/index.tsx +196 -0
- package/themes/business/src/components/BusinessProductList/styles.tsx +10 -0
- package/themes/business/src/components/Chat/index.tsx +23 -14
- package/themes/business/src/components/DriverMap/index.tsx +4 -3
- package/themes/business/src/components/FloatingButton/index.tsx +34 -31
- package/themes/business/src/components/Home/index.tsx +5 -1
- package/themes/business/src/components/LanguageSelector/index.tsx +4 -2
- package/themes/business/src/components/LanguageSelector/lang_country.json +515 -70
- package/themes/business/src/components/MapView/index.tsx +11 -7
- package/themes/business/src/components/MessagesOption/index.tsx +2 -1
- package/themes/business/src/components/NewOrderNotification/index.tsx +163 -113
- package/themes/business/src/components/OrderDetails/Business.tsx +50 -2
- package/themes/business/src/components/OrderDetails/Delivery.tsx +23 -11
- package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +60 -53
- package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +54 -23
- package/themes/business/src/components/OrderDetails/usePrinterCommands.tsx +220 -0
- package/themes/business/src/components/OrderDetailsLogistic/index.tsx +6 -1
- package/themes/business/src/components/OrderSummary/index.tsx +240 -76
- package/themes/business/src/components/OrdersListManager/index.tsx +7 -2
- package/themes/business/src/components/OrdersListManager/utils.tsx +1 -1
- package/themes/business/src/components/OrdersOption/index.tsx +125 -48
- package/themes/business/src/components/PhoneInputNumber/index.tsx +8 -5
- package/themes/business/src/components/PreviousOrders/OrderItem.tsx +33 -36
- package/themes/business/src/components/PreviousOrders/OrderList.tsx +18 -13
- package/themes/business/src/components/PreviousOrders/index.tsx +80 -66
- package/themes/business/src/components/PreviousOrders/styles.tsx +10 -0
- package/themes/business/src/components/PrinterSettings/index.tsx +279 -0
- package/themes/business/src/components/PrinterSettings/styles.tsx +17 -0
- package/themes/business/src/components/ProductItemAccordion/index.tsx +2 -2
- package/themes/business/src/components/ReviewCustomer/index.tsx +2 -0
- package/themes/business/src/components/SearchBar/index.tsx +2 -1
- package/themes/business/src/components/Sessions/index.tsx +187 -0
- package/themes/business/src/components/Sessions/styles.tsx +20 -0
- package/themes/business/src/components/StoresList/index.tsx +5 -3
- package/themes/business/src/components/UserFormDetails/index.tsx +111 -107
- package/themes/business/src/components/UserProfileForm/index.tsx +98 -44
- package/themes/business/src/components/WebsocketStatus/index.tsx +171 -0
- package/themes/business/src/components/WebsocketStatus/styles.tsx +28 -0
- package/themes/business/src/components/shared/OInput.tsx +2 -0
- package/themes/business/src/hooks/useLocation.tsx +5 -4
- package/themes/business/src/types/index.tsx +15 -2
- package/themes/business/src/utils/index.tsx +5 -0
- package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
- package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
- package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
- package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
- package/themes/kiosk/src/components/LoginForm/index.tsx +7 -4
- package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
- package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
- package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
- package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
- package/themes/original/index.tsx +9 -4
- package/themes/original/src/components/AddressDetails/index.tsx +20 -10
- package/themes/original/src/components/AddressForm/index.tsx +10 -6
- package/themes/original/src/components/AddressForm/styles.tsx +1 -1
- package/themes/original/src/components/AddressList/index.tsx +4 -7
- package/themes/original/src/components/AddressList/styles.tsx +4 -4
- package/themes/original/src/components/AnalyticsSegment/index.tsx +6 -6
- package/themes/original/src/components/AppleLogin/index.tsx +4 -4
- package/themes/original/src/components/BusinessBasicInformation/index.tsx +4 -4
- package/themes/original/src/components/BusinessBasicInformation/styles.tsx +1 -1
- package/themes/original/src/components/BusinessController/index.tsx +20 -12
- package/themes/original/src/components/BusinessController/styles.tsx +8 -7
- package/themes/original/src/components/BusinessInformation/styles.tsx +2 -2
- package/themes/original/src/components/BusinessItemAccordion/index.tsx +11 -7
- package/themes/original/src/components/BusinessListingSearch/BusinessSearchFooter.tsx +317 -0
- package/themes/original/src/components/BusinessListingSearch/BusinessSearchHeader.tsx +96 -0
- package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/index.tsx +1 -1
- package/themes/original/src/components/BusinessListingSearch/index.tsx +56 -361
- package/themes/original/src/components/BusinessListingSearch/styles.tsx +1 -1
- package/themes/original/src/components/BusinessPreorder/index.tsx +2 -3
- package/themes/original/src/components/BusinessProductsCategories/index.tsx +1 -1
- package/themes/original/src/components/BusinessProductsList/index.tsx +3 -3
- package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
- package/themes/original/src/components/BusinessProductsListing/index.tsx +51 -20
- package/themes/original/src/components/BusinessProductsListing/styles.tsx +3 -4
- package/themes/original/src/components/BusinessReviews/index.tsx +1 -1
- package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +1 -1
- package/themes/original/src/components/BusinessesListing/Layout/Appointment/styles.tsx +5 -5
- package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListFooter.tsx +69 -0
- package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListHeader.tsx +406 -0
- package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListing.tsx +76 -0
- package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +24 -404
- package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +1 -1
- package/themes/original/src/components/BusinessesListing/index.tsx +0 -1
- package/themes/original/src/components/Cart/index.tsx +32 -9
- package/themes/original/src/components/CartContent/index.tsx +96 -58
- package/themes/original/src/components/CartStoresListing/styles.tsx +2 -2
- package/themes/original/src/components/Checkout/index.tsx +190 -66
- package/themes/original/src/components/Checkout/styles.tsx +17 -0
- package/themes/original/src/components/CitiesControl/styles.tsx +1 -1
- package/themes/original/src/components/DatePicker/index.tsx +33 -0
- package/themes/original/src/components/DatePicker/styles.tsx +20 -0
- package/themes/original/src/components/Favorite/index.tsx +4 -9
- package/themes/original/src/components/Favorite/styles.tsx +0 -2
- package/themes/original/src/components/FloatingButton/styles.tsx +1 -1
- package/themes/original/src/components/GPSButton/index.tsx +1 -1
- package/themes/original/src/components/GiftCard/GiftCardOrdersList/index.tsx +64 -0
- package/themes/original/src/components/GiftCard/GiftCardOrdersList/styles.tsx +8 -0
- package/themes/original/src/components/GiftCard/GiftCardUI/index.tsx +8 -3
- package/themes/original/src/components/GiftCard/PurchaseGiftCard/index.tsx +36 -3
- package/themes/original/src/components/GiftCard/PurchaseGiftCard/styles.tsx +1 -1
- package/themes/original/src/components/GiftCard/RedeemGiftCard/index.tsx +67 -4
- package/themes/original/src/components/GiftCard/RedeemGiftCard/styles.tsx +1 -1
- package/themes/original/src/components/GiftCard/SendGiftCard/index.tsx +2 -2
- package/themes/original/src/components/GiftCard/SendGiftCard/styles.tsx +1 -1
- package/themes/original/src/components/GiftCard/SingleGiftCard/index.tsx +101 -0
- package/themes/original/src/components/GiftCard/SingleGiftCard/styles.tsx +4 -0
- package/themes/original/src/components/GiftCard/VerticalGiftCardOrdersLayout/index.tsx +83 -0
- package/themes/original/src/components/GiftCard/VerticalGiftCardOrdersLayout/styles.tsx +9 -0
- package/themes/original/src/components/GoogleMap/index.tsx +6 -5
- package/themes/original/src/components/HighestRatedBusinesses/index.tsx +2 -2
- package/themes/original/src/components/HighestRatedBusinesses/styles.tsx +1 -1
- package/themes/original/src/components/Home/index.tsx +2 -1
- package/themes/original/src/components/LastOrder/index.tsx +2 -1
- package/themes/original/src/components/LastOrders/index.tsx +2 -1
- package/themes/original/src/components/LoginForm/Otp/index.tsx +4 -16
- package/themes/original/src/components/Messages/index.tsx +9 -4
- package/themes/original/src/components/Messages/styles.tsx +1 -1
- package/themes/original/src/components/MomentOption/index.tsx +4 -3
- package/themes/original/src/components/MultiCart/index.tsx +1 -1
- package/themes/original/src/components/MultiCheckout/index.tsx +208 -21
- package/themes/original/src/components/MultiCheckout/styles.tsx +17 -0
- package/themes/original/src/components/MultiOrdersDetails/index.tsx +20 -15
- package/themes/original/src/components/MyOrders/index.tsx +24 -29
- package/themes/original/src/components/NavBar/index.tsx +3 -1
- package/themes/original/src/components/NetworkError/index.tsx +2 -3
- package/themes/original/src/components/NetworkError/styles.tsx +2 -2
- package/themes/original/src/components/Notifications/index.tsx +4 -8
- package/themes/original/src/components/Notifications/styles.tsx +0 -1
- package/themes/original/src/components/OrderDetails/OrderHistory.tsx +1 -1
- package/themes/original/src/components/OrderDetails/index.tsx +716 -668
- package/themes/original/src/components/OrderDetails/styles.tsx +24 -8
- package/themes/original/src/components/OrderProgress/index.tsx +28 -6
- package/themes/original/src/components/OrderProgress/styles.tsx +1 -1
- package/themes/original/src/components/OrderSummary/index.tsx +3 -1
- package/themes/original/src/components/OrderTypeSelector/index.tsx +5 -6
- package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/styles.tsx +1 -1
- package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/styles.tsx +1 -1
- package/themes/original/src/components/OrdersOption/index.tsx +3 -5
- package/themes/original/src/components/OrdersOption/styles.tsx +1 -1
- package/themes/original/src/components/PageBanner/index.tsx +3 -0
- package/themes/original/src/components/PaymentOptionCard/index.tsx +4 -2
- package/themes/original/src/components/PaymentOptionStripe/styles.tsx +3 -0
- package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
- package/themes/original/src/components/PaymentOptions/index.tsx +72 -6
- package/themes/original/src/components/ProductForm/ActionButton.tsx +120 -0
- package/themes/original/src/components/ProductForm/ExtraOptions.tsx +56 -0
- package/themes/original/src/components/ProductForm/index.tsx +74 -165
- package/themes/original/src/components/ProductItemAccordion/index.tsx +54 -44
- package/themes/original/src/components/ProductItemAccordion/styles.tsx +3 -4
- package/themes/original/src/components/ProductOptionSubOption/index.tsx +123 -82
- package/themes/original/src/components/ProductOptionSubOption/styles.tsx +6 -1
- package/themes/original/src/components/ProfessionalProfile/styles.tsx +3 -3
- package/themes/original/src/components/Promotions/index.tsx +4 -4
- package/themes/original/src/components/Promotions/styles.tsx +0 -2
- package/themes/original/src/components/ReviewDriver/styles.tsx +1 -1
- package/themes/original/src/components/ReviewOrder/styles.tsx +1 -1
- package/themes/original/src/components/ReviewProducts/styles.tsx +1 -1
- package/themes/original/src/components/ServiceForm/index.tsx +2 -2
- package/themes/original/src/components/ServiceForm/styles.tsx +4 -4
- package/themes/original/src/components/SignupForm/index.tsx +60 -58
- package/themes/original/src/components/SingleOrderCard/index.tsx +3 -2
- package/themes/original/src/components/SingleProductCard/index.tsx +2 -2
- package/themes/original/src/components/SingleProductCard/styles.tsx +0 -3
- package/themes/original/src/components/StripeCardsList/index.tsx +17 -36
- package/themes/original/src/components/StripeElementsForm/index.tsx +72 -59
- package/themes/original/src/components/StripeElementsForm/naked.tsx +47 -0
- package/themes/original/src/components/UpsellingProducts/UpsellingContent.tsx +170 -0
- package/themes/original/src/components/UpsellingProducts/UpsellingLayout.tsx +86 -0
- package/themes/original/src/components/UpsellingProducts/index.tsx +15 -199
- package/themes/original/src/components/UpsellingProducts/styles.tsx +19 -0
- package/themes/original/src/components/UserFormDetails/index.tsx +125 -77
- package/themes/original/src/components/UserFormDetails/styles.tsx +7 -0
- package/themes/original/src/components/UserProfile/index.tsx +3 -2
- package/themes/original/src/components/UserProfileForm/index.tsx +30 -36
- package/themes/original/src/components/WalletTransactions/styles.tsx +1 -0
- package/themes/original/src/components/Wallets/index.tsx +8 -9
- package/themes/original/src/components/Wallets/styles.tsx +1 -1
- package/themes/original/src/components/WebsocketStatus/index.tsx +172 -0
- package/themes/original/src/components/WebsocketStatus/styles.tsx +28 -0
- package/themes/original/src/components/shared/HeaderTitle.tsx +1 -1
- package/themes/original/src/components/shared/OButton.tsx +5 -5
- package/themes/original/src/components/shared/OInput.tsx +1 -4
- package/themes/original/src/components/shared/OModal.tsx +12 -14
- package/themes/original/src/layouts/Container.tsx +5 -3
- package/themes/original/src/types/index.tsx +1 -0
- package/themes/original/src/utils/index.tsx +125 -1
- package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
- package/src/navigators/BottomNavigator.tsx +0 -117
- package/src/navigators/CheckoutNavigator.tsx +0 -66
- package/src/navigators/HomeNavigator.tsx +0 -202
- package/src/navigators/NavigationRef.tsx +0 -7
- package/src/navigators/RootNavigator.tsx +0 -269
- package/src/pages/Account.tsx +0 -34
- package/src/pages/AddressForm.tsx +0 -62
- package/src/pages/AddressList.tsx +0 -24
- package/src/pages/BusinessProductsList.tsx +0 -81
- package/src/pages/BusinessesListing.tsx +0 -43
- package/src/pages/CartList.tsx +0 -49
- package/src/pages/Checkout.tsx +0 -101
- package/src/pages/ForgotPassword.tsx +0 -24
- package/src/pages/Help.tsx +0 -23
- package/src/pages/HelpAccountAndPayment.tsx +0 -23
- package/src/pages/HelpGuide.tsx +0 -23
- package/src/pages/HelpOrder.tsx +0 -23
- package/src/pages/Home.tsx +0 -36
- package/src/pages/IntroductoryTutorial.tsx +0 -170
- package/src/pages/Login.tsx +0 -47
- package/src/pages/MomentOption.tsx +0 -30
- package/src/pages/MultiCheckout.tsx +0 -31
- package/src/pages/MultiOrdersDetails.tsx +0 -27
- package/src/pages/MyOrders.tsx +0 -40
- package/src/pages/NetworkError.tsx +0 -24
- package/src/pages/NotFound.tsx +0 -22
- package/src/pages/OrderDetails.tsx +0 -25
- package/src/pages/ProductDetails.tsx +0 -55
- package/src/pages/Profile.tsx +0 -36
- package/src/pages/ReviewDriver.tsx +0 -30
- package/src/pages/ReviewOrder.tsx +0 -32
- package/src/pages/ReviewProducts.tsx +0 -30
- package/src/pages/Sessions.tsx +0 -22
- package/src/pages/Signup.tsx +0 -53
- package/src/pages/SpinnerLoader.tsx +0 -10
- 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
|
-
(
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
(signUpTab === '
|
|
592
|
-
|
|
593
|
-
{
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
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
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
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?.
|
|
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
|
-
<
|
|
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
|
-
</
|
|
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
|
-
|
|
32
|
+
onOpen,
|
|
32
33
|
gateway,
|
|
33
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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:
|
|
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
|
-
{
|
|
201
|
-
<
|
|
202
|
-
<
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
{
|
|
208
|
-
<
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
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
|
|
269
|
+
style={{ marginTop: 20 }}
|
|
247
270
|
>
|
|
248
|
-
{
|
|
271
|
+
{t('SOMETHING_WRONG', 'Something is wrong!')}
|
|
249
272
|
</OText>
|
|
250
273
|
</ErrorMessage>
|
|
251
274
|
)}
|
|
252
|
-
|
|
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
|
}
|