@afosto/checkout-ui 0.0.14 → 0.0.15
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/dist/CheckoutAddressFields/CheckoutAddressFields.d.ts.map +1 -1
- package/dist/CheckoutAddressFields/CheckoutAddressFields.js +59 -57
- package/dist/CheckoutAgreementOptionCondition/CheckoutAgreementOptionCondition.d.ts +1 -1
- package/dist/CheckoutAgreementOptionCondition/CheckoutAgreementOptionCondition.js +23 -23
- package/dist/CheckoutAgreementsTimeline/CheckoutAgreementsTimeline.js +10 -10
- package/dist/CheckoutShippingMethodSection/CheckoutShippingMethodSection.d.ts +1 -1
- package/dist/CheckoutShippingMethodSection/CheckoutShippingMethodSection.d.ts.map +1 -1
- package/dist/CheckoutShippingMethodsField/CheckoutShippingMethodsField.d.ts +1 -1
- package/dist/CheckoutShippingMethodsField/CheckoutShippingMethodsField.d.ts.map +1 -1
- package/dist/CheckoutShippingMethodsField/CheckoutShippingMethodsField.js +78 -77
- package/dist/constants/paymentMethodIconMapping.d.ts +9 -0
- package/dist/constants/paymentMethodIconMapping.d.ts.map +1 -1
- package/dist/constants/paymentMethodIconMapping.js +76 -58
- package/dist/hooks/useCheckoutShippingMethods.d.ts +2 -1
- package/dist/hooks/useCheckoutShippingMethods.d.ts.map +1 -1
- package/dist/hooks/useCheckoutShippingMethods.js +110 -67
- package/dist/icons/index.js +178 -160
- package/dist/icons/paymentMethods/Alma.d.ts +3 -0
- package/dist/icons/paymentMethods/Alma.d.ts.map +1 -0
- package/dist/icons/paymentMethods/Alma.js +15 -0
- package/dist/icons/paymentMethods/Bancomat.d.ts +3 -0
- package/dist/icons/paymentMethods/Bancomat.d.ts.map +1 -0
- package/dist/icons/paymentMethods/Bancomat.js +15 -0
- package/dist/icons/paymentMethods/Bizum.d.ts +3 -0
- package/dist/icons/paymentMethods/Bizum.d.ts.map +1 -0
- package/dist/icons/paymentMethods/Bizum.js +28 -0
- package/dist/icons/paymentMethods/Blik.d.ts +3 -0
- package/dist/icons/paymentMethods/Blik.d.ts.map +1 -0
- package/dist/icons/paymentMethods/Blik.js +59 -0
- package/dist/icons/paymentMethods/ClickToPay.d.ts +3 -0
- package/dist/icons/paymentMethods/ClickToPay.d.ts.map +1 -0
- package/dist/icons/paymentMethods/ClickToPay.js +35 -0
- package/dist/icons/paymentMethods/MBWay.d.ts +3 -0
- package/dist/icons/paymentMethods/MBWay.d.ts.map +1 -0
- package/dist/icons/paymentMethods/MBWay.js +65 -0
- package/dist/icons/paymentMethods/MobilePay.d.ts +3 -0
- package/dist/icons/paymentMethods/MobilePay.d.ts.map +1 -0
- package/dist/icons/paymentMethods/MobilePay.js +103 -0
- package/dist/icons/paymentMethods/Satispay.d.ts +3 -0
- package/dist/icons/paymentMethods/Satispay.d.ts.map +1 -0
- package/dist/icons/paymentMethods/Satispay.js +15 -0
- package/dist/icons/paymentMethods/Vipps.d.ts +3 -0
- package/dist/icons/paymentMethods/Vipps.d.ts.map +1 -0
- package/dist/icons/paymentMethods/Vipps.js +15 -0
- package/dist/icons/paymentMethods/index.d.ts +9 -0
- package/dist/icons/paymentMethods/index.d.ts.map +1 -1
- package/dist/icons/paymentMethods/index.js +124 -106
- package/dist/index.js +356 -338
- package/dist/operations/cartOperations.d.ts.map +1 -1
- package/dist/operations/cartOperations.js +4 -6
- package/dist/operations/orderOperations.d.ts.map +1 -1
- package/dist/operations/orderOperations.js +4 -6
- package/dist/queries/getCartShippingMethodsQuery.d.ts +0 -1
- package/dist/queries/getCartShippingMethodsQuery.d.ts.map +1 -1
- package/dist/queries/getCartShippingMethodsQuery.js +6 -29
- package/dist/queries/getOrderShippingMethodsQuery.d.ts +0 -1
- package/dist/queries/getOrderShippingMethodsQuery.d.ts.map +1 -1
- package/dist/queries/getOrderShippingMethodsQuery.js +4 -27
- package/dist/types.d.ts +1 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +2 -2
|
@@ -1,103 +1,104 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useFormContext as
|
|
3
|
-
import { CheckoutCardRadioField as
|
|
4
|
-
import { CheckoutShippingMethodOption as
|
|
5
|
-
import { useCheckoutShippingMethods as
|
|
6
|
-
import { useCheckout as
|
|
7
|
-
import { getErrorMessage as
|
|
8
|
-
import { capitalize as
|
|
9
|
-
import { CheckoutMethodRadioSkeleton as
|
|
10
|
-
const
|
|
1
|
+
import { jsx as j } from "react/jsx-runtime";
|
|
2
|
+
import { useFormContext as D } from "@afosto/components";
|
|
3
|
+
import { CheckoutCardRadioField as L } from "../CheckoutCardRadioField/CheckoutCardRadioField.js";
|
|
4
|
+
import { CheckoutShippingMethodOption as q } from "../CheckoutShippingMethodOption/CheckoutShippingMethodOption.js";
|
|
5
|
+
import { useCheckoutShippingMethods as A } from "../hooks/useCheckoutShippingMethods.js";
|
|
6
|
+
import { useCheckout as B } from "../CheckoutStateProvider/CheckoutStateProvider.js";
|
|
7
|
+
import { getErrorMessage as G } from "../utils/getErrorMessage.js";
|
|
8
|
+
import { capitalize as H } from "@afosto/utils";
|
|
9
|
+
import { CheckoutMethodRadioSkeleton as J } from "../CheckoutMethodRadioSkeleton/CheckoutMethodRadioSkeleton.js";
|
|
10
|
+
const K = {
|
|
11
11
|
failedToSearchPickupPoints: "Pickup points search failed. Please try again.",
|
|
12
12
|
failedToSelectShippingMethodTitle: "Shipping method not selected",
|
|
13
13
|
failedToSelectShippingMethodDescription: "Something went wrong while selecting the shipping method. Choose another shipping method or try again."
|
|
14
|
-
},
|
|
14
|
+
}, oi = (S) => {
|
|
15
15
|
const {
|
|
16
|
-
countryCode:
|
|
17
|
-
currency:
|
|
16
|
+
countryCode: f,
|
|
17
|
+
currency: k,
|
|
18
18
|
locale: M,
|
|
19
|
-
name:
|
|
20
|
-
postalCode:
|
|
21
|
-
translations:
|
|
22
|
-
} =
|
|
23
|
-
activeStep:
|
|
24
|
-
addShippingMethod:
|
|
25
|
-
isProcessing:
|
|
26
|
-
setErrorMessage:
|
|
19
|
+
name: p = "methodId",
|
|
20
|
+
postalCode: r,
|
|
21
|
+
translations: C = {}
|
|
22
|
+
} = S || {}, {
|
|
23
|
+
activeStep: a,
|
|
24
|
+
addShippingMethod: T,
|
|
25
|
+
isProcessing: w,
|
|
26
|
+
setErrorMessage: c,
|
|
27
27
|
setIsProcessing: n,
|
|
28
|
-
translations:
|
|
29
|
-
} =
|
|
30
|
-
hasSearchPickupPointsError:
|
|
31
|
-
isInitializingShippingMethods:
|
|
32
|
-
isSearchingPickupPoints:
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
...
|
|
43
|
-
...
|
|
44
|
-
...
|
|
28
|
+
translations: d
|
|
29
|
+
} = B(), {
|
|
30
|
+
hasSearchPickupPointsError: y,
|
|
31
|
+
isInitializingShippingMethods: I,
|
|
32
|
+
isSearchingPickupPoints: v,
|
|
33
|
+
loadPickupPointsForShippingMethod: E,
|
|
34
|
+
pickupPoints: h,
|
|
35
|
+
searchPickupPoints: F,
|
|
36
|
+
setPickupPoints: V,
|
|
37
|
+
shippingMethods: l
|
|
38
|
+
} = A({
|
|
39
|
+
countryCode: f,
|
|
40
|
+
postalCode: r
|
|
41
|
+
}), { formProps: x, getValues: O, reset: u, watch: z } = D(), { setData: R } = x || {}, [g] = z([p]), s = {
|
|
42
|
+
...K,
|
|
43
|
+
...d?.shippingMethodsField || {},
|
|
44
|
+
...d?.feedback || {},
|
|
45
|
+
...C || {}
|
|
45
46
|
};
|
|
46
|
-
return /* @__PURE__ */
|
|
47
|
-
|
|
47
|
+
return /* @__PURE__ */ j(
|
|
48
|
+
L,
|
|
48
49
|
{
|
|
49
50
|
id: "field-radio-shipping-method",
|
|
50
|
-
name:
|
|
51
|
-
isLoading:
|
|
52
|
-
onChange: async (
|
|
53
|
-
const
|
|
51
|
+
name: p,
|
|
52
|
+
isLoading: I,
|
|
53
|
+
onChange: async (i) => {
|
|
54
|
+
const P = O(), b = [...h];
|
|
54
55
|
try {
|
|
55
|
-
|
|
56
|
-
const { value:
|
|
57
|
-
(t) => t.id ===
|
|
56
|
+
c(null), n(!0);
|
|
57
|
+
const { value: o } = i.target, e = l.find(
|
|
58
|
+
(t) => t.id === o
|
|
58
59
|
);
|
|
59
|
-
await
|
|
60
|
-
const
|
|
61
|
-
methodId:
|
|
62
|
-
isPickupPoint:
|
|
60
|
+
await T({ methodId: o }), E(e);
|
|
61
|
+
const m = {
|
|
62
|
+
methodId: o,
|
|
63
|
+
isPickupPoint: e?.isPickupPoint,
|
|
63
64
|
pickupPointId: ""
|
|
64
65
|
};
|
|
65
|
-
|
|
66
|
-
...
|
|
67
|
-
...
|
|
68
|
-
}),
|
|
69
|
-
...t[
|
|
70
|
-
...
|
|
66
|
+
u({
|
|
67
|
+
...P,
|
|
68
|
+
...m
|
|
69
|
+
}), R((t) => (t?.splice(a, 1, {
|
|
70
|
+
...t[a],
|
|
71
|
+
...m
|
|
71
72
|
}), t)), n(!1);
|
|
72
|
-
} catch (
|
|
73
|
-
const
|
|
74
|
-
|
|
75
|
-
title:
|
|
76
|
-
description:
|
|
77
|
-
}),
|
|
73
|
+
} catch (o) {
|
|
74
|
+
const e = G(o);
|
|
75
|
+
c({
|
|
76
|
+
title: s.failedToSelectShippingMethodTitle,
|
|
77
|
+
description: e ? H(e) : s.failedToSelectShippingMethodDescription
|
|
78
|
+
}), u(P), V(b), n(!1), window && typeof window < "u" && window.scrollTo(0, 0);
|
|
78
79
|
}
|
|
79
80
|
},
|
|
80
|
-
OptionComponent:
|
|
81
|
-
OptionSkeletonComponent:
|
|
82
|
-
options:
|
|
83
|
-
...
|
|
84
|
-
value:
|
|
85
|
-
...
|
|
86
|
-
pickupPoints:
|
|
81
|
+
OptionComponent: q,
|
|
82
|
+
OptionSkeletonComponent: J,
|
|
83
|
+
options: l.map((i) => ({
|
|
84
|
+
...i,
|
|
85
|
+
value: i.id,
|
|
86
|
+
...g === i.id ? {
|
|
87
|
+
pickupPoints: h
|
|
87
88
|
} : {}
|
|
88
89
|
})),
|
|
89
90
|
optionProps: {
|
|
90
|
-
currency:
|
|
91
|
-
defaultPickupPointSearchValue:
|
|
92
|
-
isSearchingPickupPoints:
|
|
91
|
+
currency: k,
|
|
92
|
+
defaultPickupPointSearchValue: r,
|
|
93
|
+
isSearchingPickupPoints: w || v,
|
|
93
94
|
locale: M,
|
|
94
|
-
onSearchPickupPoint:
|
|
95
|
-
searchPickupPointsErrorMessage:
|
|
95
|
+
onSearchPickupPoint: F,
|
|
96
|
+
searchPickupPointsErrorMessage: y ? s.failedToSearchPickupPoints : void 0
|
|
96
97
|
},
|
|
97
|
-
value:
|
|
98
|
+
value: g
|
|
98
99
|
}
|
|
99
100
|
);
|
|
100
101
|
};
|
|
101
102
|
export {
|
|
102
|
-
|
|
103
|
+
oi as CheckoutShippingMethodsField
|
|
103
104
|
};
|
|
@@ -47,5 +47,14 @@ export declare const CHECKOUT_PAYMENT_METHOD_ICON_MAPPING: {
|
|
|
47
47
|
twint: (props: import('@afosto/components').SvgIconProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
48
48
|
walley: (props: import('@afosto/components').SvgIconProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
49
49
|
zip: (props: import('@afosto/components').SvgIconProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
50
|
+
alma: (props: import('@afosto/components').SvgIconProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
51
|
+
bancomatPay: (props: import('@afosto/components').SvgIconProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
52
|
+
bizum: (props: import('@afosto/components').SvgIconProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
53
|
+
blik: (props: import('@afosto/components').SvgIconProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
54
|
+
clickToPay: (props: import('@afosto/components').SvgIconProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
55
|
+
mbWay: (props: import('@afosto/components').SvgIconProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
56
|
+
mobilepay: (props: import('@afosto/components').SvgIconProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
57
|
+
satispay: (props: import('@afosto/components').SvgIconProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
58
|
+
vipps: (props: import('@afosto/components').SvgIconProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
50
59
|
};
|
|
51
60
|
//# sourceMappingURL=paymentMethodIconMapping.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paymentMethodIconMapping.d.ts","sourceRoot":"","sources":["../../src/constants/paymentMethodIconMapping.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"paymentMethodIconMapping.d.ts","sourceRoot":"","sources":["../../src/constants/paymentMethodIconMapping.ts"],"names":[],"mappings":"AAsDA,eAAO,MAAM,oCAAoC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0DhD,CAAC"}
|
|
@@ -7,91 +7,109 @@ import { CashOnDelivery as f } from "../icons/paymentMethods/CashOnDelivery.js";
|
|
|
7
7
|
import { Spraypay as e } from "../icons/paymentMethods/Spraypay.js";
|
|
8
8
|
import { Klarna as r } from "../icons/paymentMethods/Klarna.js";
|
|
9
9
|
import { PayPal as o } from "../icons/paymentMethods/PayPal.js";
|
|
10
|
-
import { Bancontact as
|
|
11
|
-
import { Paysafe as
|
|
12
|
-
import { Giropay as
|
|
13
|
-
import { Postepay as
|
|
10
|
+
import { Bancontact as l } from "../icons/paymentMethods/Bancontact.js";
|
|
11
|
+
import { Paysafe as n } from "../icons/paymentMethods/Paysafe.js";
|
|
12
|
+
import { Giropay as y } from "../icons/paymentMethods/Giropay.js";
|
|
13
|
+
import { Postepay as c } from "../icons/paymentMethods/Postepay.js";
|
|
14
14
|
import { CarteBleue as s } from "../icons/paymentMethods/CarteBleue.js";
|
|
15
15
|
import { Afterpay as u } from "../icons/paymentMethods/Afterpay.js";
|
|
16
16
|
import { WebshopGiftcard as d } from "../icons/paymentMethods/WebshopGiftcard.js";
|
|
17
|
-
import { Fashioncheque as
|
|
18
|
-
import { PodiumCadeaukaart as
|
|
19
|
-
import { YourGift as
|
|
20
|
-
import { Giftcard as
|
|
21
|
-
import { GivaCard as
|
|
22
|
-
import { VVVCadeaukaart as
|
|
17
|
+
import { Fashioncheque as P } from "../icons/paymentMethods/Fashioncheque.js";
|
|
18
|
+
import { PodiumCadeaukaart as b } from "../icons/paymentMethods/PodiumCadeaukaart.js";
|
|
19
|
+
import { YourGift as C } from "../icons/paymentMethods/YourGift.js";
|
|
20
|
+
import { Giftcard as k } from "../icons/paymentMethods/Giftcard.js";
|
|
21
|
+
import { GivaCard as B } from "../icons/paymentMethods/GivaCard.js";
|
|
22
|
+
import { VVVCadeaukaart as h } from "../icons/paymentMethods/VVVCadeaukaart.js";
|
|
23
23
|
import { WeChat as g } from "../icons/paymentMethods/WeChat.js";
|
|
24
|
-
import { Alipay as
|
|
25
|
-
import { Payconiq as
|
|
24
|
+
import { Alipay as v } from "../icons/paymentMethods/Alipay.js";
|
|
25
|
+
import { Payconiq as w } from "../icons/paymentMethods/Payconiq.js";
|
|
26
26
|
import { Multibanco as G } from "../icons/paymentMethods/Multibanco.js";
|
|
27
|
-
import { EPSUberweisung as
|
|
28
|
-
import { Przelewy24 as
|
|
27
|
+
import { EPSUberweisung as T } from "../icons/paymentMethods/EPSUberweisung.js";
|
|
28
|
+
import { Przelewy24 as A } from "../icons/paymentMethods/Przelewy24.js";
|
|
29
29
|
import { Billink as M } from "../icons/paymentMethods/Billink.js";
|
|
30
30
|
import { In3 as O } from "../icons/paymentMethods/In3.js";
|
|
31
|
-
import { Interac as
|
|
32
|
-
import { Cash as
|
|
33
|
-
import { ManualGiftCard as
|
|
34
|
-
import { ManualCard as
|
|
35
|
-
import { Pin as
|
|
36
|
-
import { ApplePay as
|
|
37
|
-
import { GooglePay as
|
|
38
|
-
import { Bank as
|
|
39
|
-
import { Riverty as
|
|
40
|
-
import { Twint as
|
|
41
|
-
import { Walley as
|
|
42
|
-
import { Zip as
|
|
43
|
-
import { Belfius as
|
|
44
|
-
import { Kbc as
|
|
45
|
-
|
|
31
|
+
import { Interac as W } from "../icons/paymentMethods/Interac.js";
|
|
32
|
+
import { Cash as z } from "../icons/paymentMethods/Cash.js";
|
|
33
|
+
import { ManualGiftCard as E } from "../icons/paymentMethods/ManualGiftCard.js";
|
|
34
|
+
import { ManualCard as I } from "../icons/paymentMethods/ManualCard.js";
|
|
35
|
+
import { Pin as q } from "../icons/paymentMethods/Pin.js";
|
|
36
|
+
import { ApplePay as D } from "../icons/paymentMethods/ApplePay.js";
|
|
37
|
+
import { GooglePay as N } from "../icons/paymentMethods/GooglePay.js";
|
|
38
|
+
import { Bank as V } from "../icons/paymentMethods/Bank.js";
|
|
39
|
+
import { Riverty as _ } from "../icons/paymentMethods/Riverty.js";
|
|
40
|
+
import { Twint as K } from "../icons/paymentMethods/Twint.js";
|
|
41
|
+
import { Walley as S } from "../icons/paymentMethods/Walley.js";
|
|
42
|
+
import { Zip as U } from "../icons/paymentMethods/Zip.js";
|
|
43
|
+
import { Belfius as x } from "../icons/paymentMethods/Belfius.js";
|
|
44
|
+
import { Kbc as H } from "../icons/paymentMethods/Kbc.js";
|
|
45
|
+
import { Alma as Y } from "../icons/paymentMethods/Alma.js";
|
|
46
|
+
import { Bancomat as F } from "../icons/paymentMethods/Bancomat.js";
|
|
47
|
+
import { Bizum as R } from "../icons/paymentMethods/Bizum.js";
|
|
48
|
+
import { Blik as Z } from "../icons/paymentMethods/Blik.js";
|
|
49
|
+
import { ClickToPay as j } from "../icons/paymentMethods/ClickToPay.js";
|
|
50
|
+
import { MBWay as J } from "../icons/paymentMethods/MBWay.js";
|
|
51
|
+
import { MobilePay as L } from "../icons/paymentMethods/MobilePay.js";
|
|
52
|
+
import { Satispay as Q } from "../icons/paymentMethods/Satispay.js";
|
|
53
|
+
import { Vipps as X } from "../icons/paymentMethods/Vipps.js";
|
|
54
|
+
const Xr = {
|
|
46
55
|
ideal: m,
|
|
47
56
|
card: i,
|
|
48
57
|
bacsDirectDebit: a,
|
|
49
58
|
bankTransfer: t,
|
|
50
|
-
belfius:
|
|
51
|
-
kbc:
|
|
59
|
+
belfius: x,
|
|
60
|
+
kbc: H,
|
|
52
61
|
onAccount: p,
|
|
53
62
|
cod: f,
|
|
54
63
|
spraypay: e,
|
|
55
64
|
sofort: r,
|
|
56
65
|
paypalExpress: o,
|
|
57
66
|
paypal: o,
|
|
58
|
-
mistercashBancontact:
|
|
59
|
-
paysafecard:
|
|
60
|
-
giftCard:
|
|
61
|
-
giropay:
|
|
62
|
-
postepay:
|
|
67
|
+
mistercashBancontact: l,
|
|
68
|
+
paysafecard: n,
|
|
69
|
+
giftCard: k,
|
|
70
|
+
giropay: y,
|
|
71
|
+
postepay: c,
|
|
63
72
|
carteBleue: s,
|
|
64
73
|
afterpay: u,
|
|
65
74
|
webshopgiftcard: d,
|
|
66
|
-
fashioncheque:
|
|
67
|
-
podiumcadeaukaart:
|
|
68
|
-
yourgift:
|
|
69
|
-
givacard:
|
|
70
|
-
vvvCadeaukaart:
|
|
75
|
+
fashioncheque: P,
|
|
76
|
+
podiumcadeaukaart: b,
|
|
77
|
+
yourgift: C,
|
|
78
|
+
givacard: B,
|
|
79
|
+
vvvCadeaukaart: h,
|
|
71
80
|
wechatPay: g,
|
|
72
|
-
alipay:
|
|
73
|
-
payconiq:
|
|
81
|
+
alipay: v,
|
|
82
|
+
payconiq: w,
|
|
74
83
|
multibanco: G,
|
|
75
|
-
epsUberweisung:
|
|
76
|
-
przelewy24:
|
|
84
|
+
epsUberweisung: T,
|
|
85
|
+
przelewy24: A,
|
|
77
86
|
billink: M,
|
|
78
87
|
klarna: r,
|
|
79
88
|
klarnaNow: r,
|
|
80
89
|
klarnaOverTime: r,
|
|
81
90
|
in3: O,
|
|
82
|
-
interac:
|
|
83
|
-
cash:
|
|
84
|
-
manualGiftCard:
|
|
85
|
-
manualCard:
|
|
86
|
-
pin:
|
|
87
|
-
applePay:
|
|
88
|
-
googleWallet:
|
|
89
|
-
payByBank:
|
|
90
|
-
riverty:
|
|
91
|
-
twint:
|
|
92
|
-
walley:
|
|
93
|
-
zip:
|
|
91
|
+
interac: W,
|
|
92
|
+
cash: z,
|
|
93
|
+
manualGiftCard: E,
|
|
94
|
+
manualCard: I,
|
|
95
|
+
pin: q,
|
|
96
|
+
applePay: D,
|
|
97
|
+
googleWallet: N,
|
|
98
|
+
payByBank: V,
|
|
99
|
+
riverty: _,
|
|
100
|
+
twint: K,
|
|
101
|
+
walley: S,
|
|
102
|
+
zip: U,
|
|
103
|
+
alma: Y,
|
|
104
|
+
bancomatPay: F,
|
|
105
|
+
bizum: R,
|
|
106
|
+
blik: Z,
|
|
107
|
+
clickToPay: j,
|
|
108
|
+
mbWay: J,
|
|
109
|
+
mobilepay: L,
|
|
110
|
+
satispay: Q,
|
|
111
|
+
vipps: X
|
|
94
112
|
};
|
|
95
113
|
export {
|
|
96
|
-
|
|
114
|
+
Xr as CHECKOUT_PAYMENT_METHOD_ICON_MAPPING
|
|
97
115
|
};
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { CheckoutShippingMethodOptionType, CheckoutShippingMethodPickupPoint } from '../types';
|
|
2
2
|
export declare const useCheckoutShippingMethods: ({ countryCode, postalCode }: {
|
|
3
3
|
countryCode: string;
|
|
4
|
-
postalCode
|
|
4
|
+
postalCode?: string;
|
|
5
5
|
}) => {
|
|
6
6
|
hasSearchPickupPointsError: boolean;
|
|
7
7
|
isInitializingShippingMethods: boolean;
|
|
8
8
|
isSearchingPickupPoints: boolean;
|
|
9
|
+
loadPickupPointsForShippingMethod: (shippingMethod?: CheckoutShippingMethodOptionType) => void;
|
|
9
10
|
pickupPoints: CheckoutShippingMethodPickupPoint[];
|
|
10
11
|
searchPickupPoints: (...args: unknown[]) => Promise<void>;
|
|
11
12
|
setPickupPoints: import('react').Dispatch<import('react').SetStateAction<CheckoutShippingMethodPickupPoint[]>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCheckoutShippingMethods.d.ts","sourceRoot":"","sources":["../../src/hooks/useCheckoutShippingMethods.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useCheckoutShippingMethods.d.ts","sourceRoot":"","sources":["../../src/hooks/useCheckoutShippingMethods.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EACV,gCAAgC,EAChC,iCAAiC,EAClC,MAAM,UAAU,CAAC;AAGlB,eAAO,MAAM,0BAA0B,GAAI,6BAGxC;IACD,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;;;;yDA0FqB,gCAAgC;;;;;CAkIrD,CAAC"}
|
|
@@ -1,95 +1,138 @@
|
|
|
1
|
-
import { useState as
|
|
2
|
-
import { useCheckout as
|
|
3
|
-
import { useGetLatest as
|
|
4
|
-
import { isDefined as
|
|
5
|
-
import { useFormContext as
|
|
6
|
-
const
|
|
7
|
-
countryCode:
|
|
8
|
-
postalCode:
|
|
1
|
+
import { useState as p, useRef as O, useCallback as z, useEffect as Q } from "react";
|
|
2
|
+
import { useCheckout as T } from "../CheckoutStateProvider/CheckoutStateProvider.js";
|
|
3
|
+
import { useGetLatest as B, useAsyncDebounce as W } from "@afosto/hooks";
|
|
4
|
+
import { isDefined as x } from "@afosto/utils";
|
|
5
|
+
import { useFormContext as X } from "@afosto/components";
|
|
6
|
+
const et = ({
|
|
7
|
+
countryCode: o,
|
|
8
|
+
postalCode: u
|
|
9
9
|
}) => {
|
|
10
|
-
const [
|
|
10
|
+
const [C, f] = p(!1), [L, k] = p(!0), [R, a] = p(!1), [V, n] = p([]), [q, D] = p([]), S = O(0), {
|
|
11
11
|
activeStep: y,
|
|
12
12
|
addShippingMethod: A,
|
|
13
|
-
getPickupPoints:
|
|
14
|
-
getShippingMethods:
|
|
15
|
-
setSubmitButtonDisabled:
|
|
16
|
-
} =
|
|
13
|
+
getPickupPoints: E,
|
|
14
|
+
getShippingMethods: G,
|
|
15
|
+
setSubmitButtonDisabled: F
|
|
16
|
+
} = T(), h = B({
|
|
17
17
|
activeStep: y,
|
|
18
18
|
addShippingMethod: A,
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
19
|
+
getPickupPoints: E,
|
|
20
|
+
getShippingMethods: G,
|
|
21
|
+
setSubmitButtonDisabled: F
|
|
22
|
+
}), H = X(), r = B(H), M = z(
|
|
23
|
+
async ({
|
|
24
|
+
searchValue: e,
|
|
25
|
+
clearUnavailablePickupPoint: i = !1
|
|
26
|
+
} = {}) => {
|
|
27
|
+
const b = ++S.current, d = () => b === S.current;
|
|
28
|
+
try {
|
|
29
|
+
f(!1), a(!0);
|
|
30
|
+
const { getPickupPoints: P } = h(), g = await P({
|
|
31
|
+
countryCode: o,
|
|
32
|
+
postalCode: x(e) ? e : u ?? ""
|
|
33
|
+
}), { pickupPoints: l } = g || {};
|
|
34
|
+
if (!d())
|
|
35
|
+
return;
|
|
36
|
+
if (i) {
|
|
37
|
+
const { getValues: s, setValue: c } = r() || {}, { pickupPointId: t } = s() || {};
|
|
38
|
+
x(t) && !(l ?? []).some(
|
|
39
|
+
(I) => I.id === t
|
|
40
|
+
) && c("pickupPointId", "");
|
|
41
|
+
}
|
|
42
|
+
n(l ?? []), a(!1);
|
|
43
|
+
} catch {
|
|
44
|
+
if (!d())
|
|
45
|
+
return;
|
|
46
|
+
f(!0), n([]), a(!1);
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
[o, h, r, u]
|
|
50
|
+
), m = z(
|
|
51
|
+
(e) => {
|
|
52
|
+
if (n([]), e?.isPickupPoint) {
|
|
53
|
+
M();
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
S.current++, f(!1), a(!1);
|
|
57
|
+
},
|
|
58
|
+
[M]
|
|
59
|
+
);
|
|
60
|
+
Q(() => {
|
|
61
|
+
o && (async () => {
|
|
24
62
|
const {
|
|
25
|
-
activeStep:
|
|
26
|
-
addShippingMethod:
|
|
27
|
-
getShippingMethods:
|
|
28
|
-
setSubmitButtonDisabled:
|
|
29
|
-
} =
|
|
63
|
+
activeStep: i,
|
|
64
|
+
addShippingMethod: b,
|
|
65
|
+
getShippingMethods: d,
|
|
66
|
+
setSubmitButtonDisabled: P
|
|
67
|
+
} = h();
|
|
30
68
|
try {
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
|
|
69
|
+
const g = await d({
|
|
70
|
+
countryCode: o,
|
|
71
|
+
postalCode: u ?? ""
|
|
72
|
+
}), {
|
|
73
|
+
currentShippingMethod: l,
|
|
74
|
+
shippingMethods: s
|
|
75
|
+
} = g || {};
|
|
76
|
+
if (D(s), !s.length) {
|
|
77
|
+
P(!0), k(!1);
|
|
37
78
|
return;
|
|
38
79
|
}
|
|
39
|
-
let
|
|
40
|
-
(
|
|
80
|
+
let c = s.find(
|
|
81
|
+
(t) => t.id === l?.id
|
|
41
82
|
);
|
|
42
|
-
if (!
|
|
43
|
-
const [
|
|
83
|
+
if (!x(c)) {
|
|
84
|
+
const [t] = s;
|
|
44
85
|
try {
|
|
45
|
-
const
|
|
46
|
-
await
|
|
47
|
-
const
|
|
48
|
-
methodId:
|
|
49
|
-
isPickupPoint:
|
|
86
|
+
const I = r(), { formProps: j, getValues: J, reset: K } = I || {}, { setData: N } = j || {};
|
|
87
|
+
await b({ methodId: t.id }), c = t;
|
|
88
|
+
const w = {
|
|
89
|
+
methodId: t.id,
|
|
90
|
+
isPickupPoint: t.isPickupPoint,
|
|
50
91
|
pickupPointId: ""
|
|
51
92
|
};
|
|
52
|
-
|
|
53
|
-
...
|
|
54
|
-
...
|
|
55
|
-
}),
|
|
56
|
-
...
|
|
57
|
-
...
|
|
58
|
-
}),
|
|
93
|
+
K({
|
|
94
|
+
...J(),
|
|
95
|
+
...w
|
|
96
|
+
}), N((v) => (v.splice(i, 1, {
|
|
97
|
+
...v[i],
|
|
98
|
+
...w
|
|
99
|
+
}), v));
|
|
59
100
|
} catch {
|
|
60
101
|
}
|
|
61
102
|
}
|
|
62
|
-
|
|
103
|
+
m(c), k(!1);
|
|
63
104
|
} catch {
|
|
64
|
-
|
|
105
|
+
P(!0), n([]), D([]), k(!1);
|
|
65
106
|
}
|
|
66
107
|
})();
|
|
67
|
-
}, [
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
108
|
+
}, [
|
|
109
|
+
o,
|
|
110
|
+
h,
|
|
111
|
+
r,
|
|
112
|
+
m,
|
|
113
|
+
u
|
|
114
|
+
]);
|
|
115
|
+
const U = W(
|
|
116
|
+
async (e) => {
|
|
117
|
+
const { value: i } = e?.target || {};
|
|
118
|
+
await M({
|
|
119
|
+
searchValue: i,
|
|
120
|
+
clearUnavailablePickupPoint: !0
|
|
121
|
+
});
|
|
80
122
|
},
|
|
81
123
|
250
|
|
82
124
|
);
|
|
83
125
|
return {
|
|
84
|
-
hasSearchPickupPointsError:
|
|
85
|
-
isInitializingShippingMethods:
|
|
86
|
-
isSearchingPickupPoints:
|
|
126
|
+
hasSearchPickupPointsError: C,
|
|
127
|
+
isInitializingShippingMethods: L,
|
|
128
|
+
isSearchingPickupPoints: R,
|
|
129
|
+
loadPickupPointsForShippingMethod: m,
|
|
87
130
|
pickupPoints: V,
|
|
88
|
-
searchPickupPoints:
|
|
89
|
-
setPickupPoints:
|
|
90
|
-
shippingMethods:
|
|
131
|
+
searchPickupPoints: U,
|
|
132
|
+
setPickupPoints: n,
|
|
133
|
+
shippingMethods: q
|
|
91
134
|
};
|
|
92
135
|
};
|
|
93
136
|
export {
|
|
94
|
-
|
|
137
|
+
et as useCheckoutShippingMethods
|
|
95
138
|
};
|