@afosto/checkout-ui 0.0.17 → 0.0.19
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/CheckoutAgreementOptionCondition/CheckoutAgreementOptionCondition.d.ts.map +1 -1
- package/dist/CheckoutAgreementOptionCondition/CheckoutAgreementOptionCondition.js +26 -22
- package/dist/CheckoutAgreementOptionsField/CheckoutAgreementOptionsField.d.ts.map +1 -1
- package/dist/CheckoutAgreementOptionsField/CheckoutAgreementOptionsField.js +18 -17
- package/dist/CheckoutContactInformationSection/CheckoutContactInformationSection.d.ts.map +1 -1
- package/dist/CheckoutContactInformationSection/CheckoutContactInformationSection.js +0 -1
- package/dist/CheckoutCurrency/CheckoutCurrency.d.ts.map +1 -1
- package/dist/CheckoutCurrency/CheckoutCurrency.js +11 -11
- package/dist/CheckoutIssuersField/CheckoutIssuersField.js +15 -14
- package/dist/CheckoutNotFoundFeedback/CheckoutNotFoundFeedback.d.ts +1 -1
- package/dist/CheckoutNotFoundFeedback/CheckoutNotFoundFeedback.d.ts.map +1 -1
- package/dist/CheckoutPaymentMethodsField/CheckoutPaymentMethodsField.js +6 -6
- package/dist/CheckoutPickupPointsField/CheckoutPickupPointsField.d.ts.map +1 -1
- package/dist/CheckoutPickupPointsField/CheckoutPickupPointsField.js +13 -12
- package/dist/CheckoutShippingMethodsField/CheckoutShippingMethodsField.js +12 -12
- package/dist/CheckoutShippingStep/CheckoutShippingStep.d.ts.map +1 -1
- package/dist/CheckoutShippingStep/CheckoutShippingStep.js +11 -11
- package/dist/CheckoutSubmitButton/CheckoutSubmitButton.d.ts.map +1 -1
- package/dist/CheckoutSubmitButton/CheckoutSubmitButton.js +11 -10
- package/dist/CheckoutSummary/CheckoutSummary.d.ts.map +1 -1
- package/dist/CheckoutSummary/CheckoutSummary.js +6 -7
- package/dist/CheckoutSummary/components/CheckoutSummaryAgreements/CheckoutSummaryAgreements.js +12 -12
- package/dist/CheckoutSummary/components/CheckoutSummarySubtotal/CheckoutSummarySubtotal.d.ts +0 -2
- package/dist/CheckoutSummary/components/CheckoutSummarySubtotal/CheckoutSummarySubtotal.d.ts.map +1 -1
- package/dist/CheckoutSummary/components/CheckoutSummarySubtotal/CheckoutSummarySubtotal.js +16 -18
- package/dist/CheckoutSummary/components/CheckoutSummaryVat/CheckoutSummaryVat.d.ts +1 -1
- package/dist/CheckoutSummary/components/CheckoutSummaryVat/CheckoutSummaryVat.d.ts.map +1 -1
- package/dist/CheckoutSummary/components/CheckoutSummaryVat/CheckoutSummaryVat.js +49 -35
- package/dist/CheckoutTerminalsField/CheckoutTerminalsField.js +15 -14
- package/dist/constants/analyticsEvents.d.ts +79 -11
- package/dist/constants/analyticsEvents.d.ts.map +1 -1
- package/dist/constants/analyticsEvents.js +30 -30
- package/dist/constants/paymentMethodIconMapping.d.ts +4 -0
- package/dist/constants/paymentMethodIconMapping.d.ts.map +1 -1
- package/dist/constants/paymentMethodIconMapping.js +55 -47
- package/dist/fragments/CoreCartInitialCheckoutFields.d.ts +4 -0
- package/dist/fragments/CoreCartInitialCheckoutFields.d.ts.map +1 -1
- package/dist/hooks/useCheckoutAnalytics.d.ts.map +1 -1
- package/dist/hooks/useCheckoutAnalytics.js +13 -17
- package/dist/hooks/useCheckoutCart.d.ts +2 -2
- package/dist/hooks/useCheckoutCart.d.ts.map +1 -1
- package/dist/hooks/useCheckoutForm.d.ts +3 -3
- package/dist/hooks/useCheckoutForm.d.ts.map +1 -1
- package/dist/hooks/useCheckoutFormContext.d.ts +3 -0
- package/dist/hooks/useCheckoutFormContext.d.ts.map +1 -0
- package/dist/hooks/useCheckoutFormContext.js +5 -0
- package/dist/hooks/useCheckoutOrder.d.ts +2 -2
- package/dist/hooks/useCheckoutOrder.d.ts.map +1 -1
- package/dist/hooks/useCheckoutPaymentMethods.js +8 -8
- package/dist/hooks/useCheckoutPaymentStep.js +6 -6
- package/dist/hooks/useCheckoutShippingMethods.js +14 -14
- package/dist/icons/index.js +160 -152
- package/dist/icons/paymentMethods/Dankort.d.ts +3 -0
- package/dist/icons/paymentMethods/Dankort.d.ts.map +1 -0
- package/dist/icons/paymentMethods/Dankort.js +18 -0
- package/dist/icons/paymentMethods/Nexi.d.ts +3 -0
- package/dist/icons/paymentMethods/Nexi.d.ts.map +1 -0
- package/dist/icons/paymentMethods/Nexi.js +17 -0
- package/dist/icons/paymentMethods/Swish.d.ts +3 -0
- package/dist/icons/paymentMethods/Swish.d.ts.map +1 -0
- package/dist/icons/paymentMethods/Swish.js +127 -0
- package/dist/icons/paymentMethods/Wero.d.ts +3 -0
- package/dist/icons/paymentMethods/Wero.d.ts.map +1 -0
- package/dist/icons/paymentMethods/Wero.js +15 -0
- package/dist/icons/paymentMethods/index.d.ts +4 -0
- package/dist/icons/paymentMethods/index.d.ts.map +1 -1
- package/dist/icons/paymentMethods/index.js +112 -104
- package/dist/index.js +412 -404
- package/dist/mutations/addInformationToCart.d.ts +2 -5
- package/dist/mutations/addInformationToCart.d.ts.map +1 -1
- package/dist/mutations/addInformationToOrder.d.ts +2 -5
- package/dist/mutations/addInformationToOrder.d.ts.map +1 -1
- package/dist/steps/informationStep.d.ts +1 -0
- package/dist/steps/informationStep.d.ts.map +1 -1
- package/dist/steps/informationStep.js +271 -245
- package/dist/steps/paymentStep.d.ts.map +1 -1
- package/dist/steps/paymentStep.js +23 -23
- package/dist/steps/reviewStep.d.ts.map +1 -1
- package/dist/steps/reviewStep.js +13 -12
- package/dist/steps/shippingStep.d.ts.map +1 -1
- package/dist/steps/shippingStep.js +19 -19
- package/dist/types.d.ts +39 -11
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/formatAddressPayload.d.ts +5 -2
- package/dist/utils/formatAddressPayload.d.ts.map +1 -1
- package/dist/utils/formatAddressPayload.js +24 -24
- package/dist/utils/formatAddressResponse.d.ts +1 -0
- package/dist/utils/formatAddressResponse.d.ts.map +1 -1
- package/dist/utils/formatInformationStepPayload.d.ts +2 -2
- package/dist/utils/formatInformationStepPayload.d.ts.map +1 -1
- package/dist/utils/formatUpdateAccountInformationPayload.d.ts +7 -2
- package/dist/utils/formatUpdateAccountInformationPayload.d.ts.map +1 -1
- package/dist/utils/formatUpdateAccountInformationPayload.js +3 -1
- package/dist/utils/formatUpdateOrganisationOnAccountPayload.d.ts +16 -3
- package/dist/utils/formatUpdateOrganisationOnAccountPayload.d.ts.map +1 -1
- package/dist/utils/formatUpdateOrganisationOnAccountPayload.js +7 -5
- package/dist/utils/setupCustomValidationRules.d.ts.map +1 -1
- package/dist/utils/setupCustomValidationRules.js +15 -15
- package/package.json +2 -2
- package/dist/modules.d.js +0 -1
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
import { CheckoutInformationStep as
|
|
1
|
+
import { CheckoutInformationStep as si } from "../CheckoutInformationStep/CheckoutInformationStep.js";
|
|
2
2
|
import { addressDefaultValues as q } from "../constants/addressDefaultValues.js";
|
|
3
|
-
import { formatAddressResponse as
|
|
4
|
-
import { getErrorMessage as
|
|
5
|
-
import { capitalize as
|
|
3
|
+
import { formatAddressResponse as F } from "../utils/formatAddressResponse.js";
|
|
4
|
+
import { getErrorMessage as X } from "../utils/getErrorMessage.js";
|
|
5
|
+
import { capitalize as Y, isDefined as D } from "@afosto/utils";
|
|
6
6
|
import * as u from "yup";
|
|
7
|
-
import { formatUpdateAccountInformationPayload as
|
|
8
|
-
import { formatUpdateOrganisationOnAccountPayload as
|
|
9
|
-
import { setupCustomValidationRules as
|
|
10
|
-
import { formatInformationStepPayload as
|
|
11
|
-
|
|
12
|
-
const
|
|
7
|
+
import { formatUpdateAccountInformationPayload as ri } from "../utils/formatUpdateAccountInformationPayload.js";
|
|
8
|
+
import { formatUpdateOrganisationOnAccountPayload as ti } from "../utils/formatUpdateOrganisationOnAccountPayload.js";
|
|
9
|
+
import { setupCustomValidationRules as oi } from "../utils/setupCustomValidationRules.js";
|
|
10
|
+
import { formatInformationStepPayload as ai } from "../utils/formatInformationStepPayload.js";
|
|
11
|
+
oi();
|
|
12
|
+
const P = (y, r) => r ? y(r) : null, di = {
|
|
13
13
|
signUpFailedTitle: "Sign up failed",
|
|
14
14
|
signUpFailedDescription: "Failed to create an account. Try again or continue as guest.",
|
|
15
15
|
signUpFailedActionLabel: "Continue as guest",
|
|
16
16
|
informationStepErrorTitle: "Could not process information",
|
|
17
17
|
informationStepErrorDescription: "Something went wrong while processing the contact and address information. Please check your input and try again."
|
|
18
|
-
},
|
|
18
|
+
}, fi = {
|
|
19
19
|
key: "information",
|
|
20
20
|
label: "Information",
|
|
21
|
-
component:
|
|
21
|
+
component: si,
|
|
22
22
|
reviewTargets: [
|
|
23
23
|
"contactDetails",
|
|
24
24
|
"businessDetails",
|
|
25
25
|
"shippingAddress",
|
|
26
26
|
"billingAddress"
|
|
27
27
|
],
|
|
28
|
-
defaultValues: (
|
|
29
|
-
const { defaultCountry:
|
|
28
|
+
defaultValues: (y) => {
|
|
29
|
+
const { defaultCountry: r, formatCountryAsOption: v, settings: O } = y || {}, { isB2cExcluded: f, isSharedOrganisationRequired: s } = O || {};
|
|
30
30
|
return {
|
|
31
|
-
type:
|
|
31
|
+
type: f ? "business" : "private",
|
|
32
32
|
contact: null,
|
|
33
33
|
email: "",
|
|
34
34
|
emailOptIn: !1,
|
|
@@ -38,115 +38,122 @@ const ai = {
|
|
|
38
38
|
cocNumber: "",
|
|
39
39
|
type: s ? "SHARED" : "DEFAULT",
|
|
40
40
|
vatNumber: "",
|
|
41
|
-
vatNumberCountry:
|
|
41
|
+
vatNumberCountry: f && r ? v(r) : null
|
|
42
42
|
},
|
|
43
43
|
password: "",
|
|
44
44
|
passwordConfirm: "",
|
|
45
45
|
phoneNumber: "",
|
|
46
|
-
phoneNumberCountry:
|
|
46
|
+
phoneNumberCountry: r ? v(r) : null,
|
|
47
47
|
phoneNumberId: "",
|
|
48
48
|
phoneNumberIsDirty: !1,
|
|
49
49
|
sameBillingAsShippingAddress: !0,
|
|
50
50
|
shipping: {
|
|
51
51
|
...q,
|
|
52
|
-
country:
|
|
53
|
-
countryCode:
|
|
52
|
+
country: r ? v(r) : null,
|
|
53
|
+
countryCode: r ? r.alpha2Code : ""
|
|
54
54
|
},
|
|
55
55
|
shippingAddressId: "",
|
|
56
56
|
billing: {
|
|
57
57
|
...q,
|
|
58
|
-
country:
|
|
59
|
-
countryCode:
|
|
58
|
+
country: r ? v(r) : null,
|
|
59
|
+
countryCode: r ? r.alpha2Code : ""
|
|
60
60
|
},
|
|
61
61
|
billingAddressId: "",
|
|
62
62
|
shouldCreateAccount: !1
|
|
63
63
|
};
|
|
64
64
|
},
|
|
65
|
-
initialize: (
|
|
65
|
+
initialize: (y, r, v) => {
|
|
66
66
|
const {
|
|
67
67
|
defaultCountry: O,
|
|
68
|
-
formatCountryAsOption:
|
|
68
|
+
formatCountryAsOption: f,
|
|
69
69
|
getCountryByCode: s,
|
|
70
|
-
settings:
|
|
70
|
+
settings: C,
|
|
71
71
|
step: g
|
|
72
|
-
} = v || {}, { defaultValues:
|
|
73
|
-
billing:
|
|
72
|
+
} = v || {}, { defaultValues: N } = g || {}, { addressOptions: B } = r || {}, { countryCode: A } = B || {}, { isB2bExcluded: T, isB2cExcluded: z } = C || {}, n = typeof N == "function" ? N(v) : N, {
|
|
73
|
+
billing: H,
|
|
74
74
|
customer: e,
|
|
75
75
|
delivery: m,
|
|
76
76
|
expressPayment: b,
|
|
77
77
|
options: i,
|
|
78
|
-
phoneNumber:
|
|
79
|
-
} =
|
|
80
|
-
contact:
|
|
78
|
+
phoneNumber: a
|
|
79
|
+
} = y || {}, {
|
|
80
|
+
contact: o,
|
|
81
81
|
countryCode: d,
|
|
82
|
-
organisation:
|
|
83
|
-
} = e || {}, { address:
|
|
84
|
-
|
|
85
|
-
) || R ||
|
|
86
|
-
|
|
82
|
+
organisation: t
|
|
83
|
+
} = e || {}, { address: I } = H || {}, { address: _ } = m || {}, { address: x, customer: p } = b?.details?.express || {}, { shipping: U } = i || {}, { countries: V } = U || {}, S = s(A) || O, R = s(d), c = !!t?.id && !T || z, w = c ? t?.phoneNumbers?.primary : o?.phoneNumbers?.primary, L = s(
|
|
84
|
+
a?.countryCode || w?.countryCode
|
|
85
|
+
) || R || S || null, [E] = L?.callingCodes || [], j = (D(a?.number) ? a.number : w?.number || n.phoneNumber).replace(`+${E}`, ""), k = c ? t?.addressing?.shipping?.primary : o?.addressing?.shipping?.primary, l = F(
|
|
86
|
+
_?.addressLine1 ? _ : x || k || {}
|
|
87
87
|
);
|
|
88
|
-
let
|
|
88
|
+
let M = null;
|
|
89
89
|
if (R && V?.includes(R?.alpha2Code))
|
|
90
|
-
|
|
91
|
-
else if (
|
|
92
|
-
|
|
90
|
+
M = R;
|
|
91
|
+
else if (S && V?.includes(S?.alpha2Code))
|
|
92
|
+
M = S;
|
|
93
93
|
else {
|
|
94
|
-
const [
|
|
95
|
-
|
|
94
|
+
const [ni] = V || [];
|
|
95
|
+
M = s(ni);
|
|
96
96
|
}
|
|
97
|
-
const
|
|
98
|
-
code:
|
|
99
|
-
label:
|
|
100
|
-
value:
|
|
101
|
-
} :
|
|
102
|
-
|
|
103
|
-
),
|
|
104
|
-
code:
|
|
105
|
-
label:
|
|
106
|
-
value:
|
|
107
|
-
} :
|
|
97
|
+
const G = s(l?.countryCode ?? "") || M, $ = D(G) ? f(G) : n.shipping.country, J = l?.administrativeArea || n.shipping.administrativeArea, Z = typeof J == "string" ? {
|
|
98
|
+
code: J,
|
|
99
|
+
label: J,
|
|
100
|
+
value: J
|
|
101
|
+
} : J, ii = c ? t?.addressing?.billing?.primary : o?.addressing?.billing?.primary, h = F(
|
|
102
|
+
I?.addressLine1 ? I : ii || {}
|
|
103
|
+
), Q = s(h?.countryCode ?? "") || S, W = D(Q) ? f(Q) : n.billing.country, K = h?.administrativeArea || n.billing.administrativeArea, ei = typeof K == "string" ? {
|
|
104
|
+
code: K,
|
|
105
|
+
label: K,
|
|
106
|
+
value: K
|
|
107
|
+
} : K;
|
|
108
108
|
return {
|
|
109
109
|
...n,
|
|
110
|
-
defaultCountry:
|
|
110
|
+
defaultCountry: P(
|
|
111
|
+
f,
|
|
112
|
+
S
|
|
113
|
+
),
|
|
111
114
|
type: c ? "business" : "private",
|
|
112
|
-
contact:
|
|
113
|
-
email: c ?
|
|
115
|
+
contact: o || null,
|
|
116
|
+
email: c ? t?.administration?.email || o?.email || p?.email || n.email : o?.email || p?.email || n.email,
|
|
114
117
|
organisation: {
|
|
115
118
|
...n.organisation,
|
|
116
119
|
...c ? {
|
|
117
|
-
id:
|
|
118
|
-
name:
|
|
119
|
-
cocNumber:
|
|
120
|
-
type:
|
|
121
|
-
vatNumber:
|
|
122
|
-
vatNumberCountry:
|
|
123
|
-
|
|
120
|
+
id: t?.id || n.organisation.id,
|
|
121
|
+
name: t?.name || n.organisation.name,
|
|
122
|
+
cocNumber: t?.cocNumber || n.organisation.cocNumber,
|
|
123
|
+
type: t?.type || n.organisation.type,
|
|
124
|
+
vatNumber: t?.vatNumber || n.organisation.vatNumber,
|
|
125
|
+
vatNumberCountry: P(
|
|
126
|
+
f,
|
|
127
|
+
s(t?.registration?.countryCode) || S
|
|
124
128
|
)
|
|
125
129
|
} : {
|
|
126
|
-
vatNumberCountry:
|
|
130
|
+
vatNumberCountry: P(
|
|
131
|
+
f,
|
|
132
|
+
S
|
|
133
|
+
)
|
|
127
134
|
}
|
|
128
135
|
},
|
|
129
|
-
phoneNumber:
|
|
130
|
-
phoneNumberCountry: D(
|
|
131
|
-
phoneNumberId:
|
|
136
|
+
phoneNumber: j,
|
|
137
|
+
phoneNumberCountry: D(L) ? f(L) : n.phoneNumberCountry,
|
|
138
|
+
phoneNumberId: a?.id || w?.id || n.phoneNumberId,
|
|
132
139
|
shipping: {
|
|
133
140
|
...n.shipping,
|
|
134
|
-
givenName: l?.givenName || (c ? void 0 :
|
|
135
|
-
additionalName: l?.additionalName || (c ? void 0 :
|
|
136
|
-
familyName: l?.familyName || (c ? void 0 :
|
|
141
|
+
givenName: l?.givenName || (c ? void 0 : o?.givenName) || n.shipping.givenName,
|
|
142
|
+
additionalName: l?.additionalName || (c ? void 0 : o?.additionalName) || n.shipping.additionalName,
|
|
143
|
+
familyName: l?.familyName || (c ? void 0 : o?.familyName) || n.shipping.familyName,
|
|
137
144
|
address_line_1: l?.address_line_1 || n.shipping.address_line_1,
|
|
138
145
|
address_line_2: l?.address_line_2 || n.shipping.address_line_2,
|
|
139
146
|
addressLine1: l?.addressLine1 || n.shipping.addressLine1,
|
|
140
147
|
addressLine2: l?.addressLine2 || n.shipping.addressLine2,
|
|
141
|
-
country:
|
|
142
|
-
countryCode:
|
|
148
|
+
country: $,
|
|
149
|
+
countryCode: $?.value || n.shipping.countryCode,
|
|
143
150
|
organisation: l?.organisation || n.shipping.organisation,
|
|
144
151
|
postalCode: l?.postalCode || n.shipping.postalCode,
|
|
145
152
|
premiseNumber: l?.premiseNumber || n.shipping.premiseNumber,
|
|
146
153
|
premiseNumberSuffix: l?.premiseNumberSuffix || n.shipping.premiseNumberSuffix,
|
|
147
154
|
thoroughfare: l?.thoroughfare || n.shipping.thoroughfare,
|
|
148
155
|
locality: l?.locality || n.shipping.locality,
|
|
149
|
-
administrativeArea:
|
|
156
|
+
administrativeArea: Z
|
|
150
157
|
},
|
|
151
158
|
shippingAddressId: l?.id || n.shippingAddressId,
|
|
152
159
|
billing: {
|
|
@@ -158,78 +165,85 @@ const ai = {
|
|
|
158
165
|
address_line_2: h?.address_line_2 || n.billing.address_line_2,
|
|
159
166
|
addressLine1: h?.addressLine1 || n.billing.addressLine1,
|
|
160
167
|
addressLine2: h?.addressLine2 || n.billing.addressLine2,
|
|
161
|
-
country:
|
|
162
|
-
countryCode:
|
|
168
|
+
country: W,
|
|
169
|
+
countryCode: W?.value || n.billing.countryCode,
|
|
163
170
|
organisation: h?.organisation || n.billing.organisation,
|
|
164
171
|
postalCode: h?.postalCode || n.billing.postalCode,
|
|
165
172
|
premiseNumber: h?.premiseNumber || n.billing.premiseNumber,
|
|
166
173
|
premiseNumberSuffix: h?.premiseNumberSuffix || n.billing.premiseNumberSuffix,
|
|
167
174
|
thoroughfare: h?.thoroughfare || n.billing.thoroughfare,
|
|
168
175
|
locality: h?.locality || n.billing.locality,
|
|
169
|
-
administrativeArea:
|
|
176
|
+
administrativeArea: ei
|
|
170
177
|
},
|
|
171
178
|
billingAddressId: h?.id || n.billingAddressId,
|
|
172
179
|
sameBillingAsShippingAddress: D(h?.id) && D(l?.id) ? h?.id === l?.id : n.sameBillingAsShippingAddress
|
|
173
180
|
};
|
|
174
181
|
},
|
|
175
|
-
isComplete: (
|
|
176
|
-
const { step: v } =
|
|
177
|
-
return v.validationSchema(
|
|
182
|
+
isComplete: (y, r) => {
|
|
183
|
+
const { step: v } = r || {};
|
|
184
|
+
return v.validationSchema(r).isValidSync(y);
|
|
178
185
|
},
|
|
179
|
-
onEvent: async (
|
|
180
|
-
const { step:
|
|
181
|
-
activeStep:
|
|
186
|
+
onEvent: async (y, r, v, O) => {
|
|
187
|
+
const { step: f, stepIndex: s } = v || {}, {
|
|
188
|
+
activeStep: C,
|
|
182
189
|
addCustomer: g,
|
|
183
|
-
formRef:
|
|
190
|
+
formRef: N,
|
|
184
191
|
formatCountryAsOption: B,
|
|
185
|
-
getCountryByCode:
|
|
186
|
-
settings:
|
|
187
|
-
} = O || {}, { isB2bExcluded:
|
|
188
|
-
if (
|
|
189
|
-
const { user: b, account: i } =
|
|
190
|
-
let
|
|
191
|
-
b?.id && e?.contact?.id !== b?.id && (
|
|
192
|
+
getCountryByCode: A,
|
|
193
|
+
settings: T
|
|
194
|
+
} = O || {}, { isB2bExcluded: z, isB2cExcluded: n } = T || {}, H = N.current?.formProps?.data || [], e = (C === s ? N.current?.getValues() : H[s]) ?? {}, m = typeof f.defaultValues == "function" ? f.defaultValues(O) : f.defaultValues;
|
|
195
|
+
if (y === "signedIn") {
|
|
196
|
+
const { user: b, account: i } = r;
|
|
197
|
+
let a = e?.contact;
|
|
198
|
+
b?.id && e?.contact?.id !== b?.id && (a = (await g({
|
|
192
199
|
customer: {
|
|
193
200
|
contactId: b.id
|
|
194
201
|
}
|
|
195
202
|
}))?.customer?.contact);
|
|
196
|
-
const [
|
|
197
|
-
id:
|
|
203
|
+
const [o] = i?.billing || [], [d] = i?.shipping || [], [t] = i?.organisations || [], [I] = i?.phoneNumbers || [], _ = A(I?.countryCode) || e?.defaultCountry, [x] = _?.callingCodes || [], p = d ? F(d) : {}, {
|
|
204
|
+
id: U,
|
|
198
205
|
isValid: V,
|
|
199
|
-
...
|
|
200
|
-
} = p
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
206
|
+
...S
|
|
207
|
+
} = p, R = S?.countryCode ? P(
|
|
208
|
+
B,
|
|
209
|
+
A(S.countryCode)
|
|
210
|
+
) : e?.defaultCountry, c = o ? F(o) : {}, {
|
|
211
|
+
id: w,
|
|
212
|
+
isValid: L,
|
|
213
|
+
...E
|
|
214
|
+
} = c, j = E?.countryCode ? P(
|
|
215
|
+
B,
|
|
216
|
+
A(E.countryCode)
|
|
217
|
+
) : e?.defaultCountry, k = !z && t?.id || n, l = k && t?.administration?.email || i?.email, G = {
|
|
205
218
|
...e,
|
|
206
219
|
...m || {},
|
|
207
|
-
contact:
|
|
220
|
+
contact: a,
|
|
208
221
|
email: l,
|
|
209
|
-
type:
|
|
210
|
-
...
|
|
211
|
-
phoneNumber:
|
|
212
|
-
`+${
|
|
222
|
+
type: k ? "business" : "private",
|
|
223
|
+
...I ? {
|
|
224
|
+
phoneNumber: I.number?.replace(
|
|
225
|
+
`+${x}`,
|
|
213
226
|
""
|
|
214
227
|
),
|
|
215
|
-
phoneNumberCountry:
|
|
216
|
-
phoneNumberId:
|
|
228
|
+
phoneNumberCountry: _,
|
|
229
|
+
phoneNumberId: I?.id || ""
|
|
217
230
|
} : {
|
|
218
231
|
phoneNumberCountry: e.defaultCountry
|
|
219
232
|
},
|
|
220
|
-
organisation:
|
|
233
|
+
organisation: k ? {
|
|
221
234
|
...e?.organisation || {},
|
|
222
235
|
...m?.organisation || {},
|
|
223
|
-
id:
|
|
224
|
-
name:
|
|
225
|
-
cocNumber:
|
|
236
|
+
id: t?.id || "",
|
|
237
|
+
name: t?.name || "",
|
|
238
|
+
cocNumber: t?.cocNumber || "",
|
|
226
239
|
isCocNumberRequired: e?.organisation?.isCocNumberRequired ?? !1,
|
|
227
240
|
isVatNumberRequired: e?.organisation?.isVatNumberRequired ?? !1,
|
|
228
|
-
type:
|
|
229
|
-
vatNumber:
|
|
230
|
-
vatNumberCountry:
|
|
231
|
-
|
|
232
|
-
|
|
241
|
+
type: t?.type || "DEFAULT",
|
|
242
|
+
vatNumber: t?.registration?.number || "",
|
|
243
|
+
vatNumberCountry: P(
|
|
244
|
+
B,
|
|
245
|
+
A(
|
|
246
|
+
t?.registration?.countryCode
|
|
233
247
|
) || e?.defaultCountry
|
|
234
248
|
)
|
|
235
249
|
} : {
|
|
@@ -239,85 +253,91 @@ const ai = {
|
|
|
239
253
|
isVatNumberRequired: e?.organisation?.isVatNumberRequired ?? !1,
|
|
240
254
|
vatNumberCountry: e.defaultCountry
|
|
241
255
|
},
|
|
242
|
-
billing:
|
|
256
|
+
billing: o ? {
|
|
243
257
|
...e.billing,
|
|
244
258
|
...q,
|
|
245
|
-
...
|
|
246
|
-
country:
|
|
259
|
+
...E,
|
|
260
|
+
country: j
|
|
247
261
|
} : {
|
|
248
262
|
...e.billing,
|
|
249
263
|
...q,
|
|
250
264
|
country: e.defaultCountry
|
|
251
265
|
},
|
|
252
|
-
billingAddressId:
|
|
266
|
+
billingAddressId: w || "",
|
|
253
267
|
shipping: d ? {
|
|
254
268
|
...e.shipping,
|
|
255
269
|
...q,
|
|
256
|
-
...
|
|
270
|
+
...S,
|
|
257
271
|
country: R
|
|
258
272
|
} : {
|
|
259
273
|
...e.shipping,
|
|
260
274
|
...q,
|
|
261
275
|
country: e.defaultCountry
|
|
262
276
|
},
|
|
263
|
-
shippingAddressId:
|
|
264
|
-
sameBillingAsShippingAddress: D(
|
|
277
|
+
shippingAddressId: U || "",
|
|
278
|
+
sameBillingAsShippingAddress: D(w) || D(w) && w === U
|
|
265
279
|
};
|
|
266
|
-
i && (
|
|
280
|
+
i && (C === s && N.current?.reset({
|
|
267
281
|
...e,
|
|
268
|
-
...
|
|
269
|
-
}),
|
|
270
|
-
|
|
271
|
-
...
|
|
272
|
-
}),
|
|
282
|
+
...G
|
|
283
|
+
}), N.current?.formProps?.setData(($) => ($.splice(s, 1, {
|
|
284
|
+
...$[s],
|
|
285
|
+
...G
|
|
286
|
+
}), $)));
|
|
273
287
|
}
|
|
274
|
-
if (
|
|
275
|
-
const { sessionExpired: b, shouldCreateAccount: i } =
|
|
288
|
+
if (y === "clearSession") {
|
|
289
|
+
const { sessionExpired: b, shouldCreateAccount: i } = r, a = {
|
|
276
290
|
...e,
|
|
277
291
|
...b ? m || {} : {},
|
|
278
292
|
shouldCreateAccount: i ?? !1
|
|
279
293
|
};
|
|
280
|
-
|
|
294
|
+
C === s && N.current?.reset({
|
|
281
295
|
...e,
|
|
282
|
-
...
|
|
283
|
-
}),
|
|
284
|
-
...
|
|
285
|
-
...
|
|
286
|
-
}),
|
|
296
|
+
...a
|
|
297
|
+
}), N.current?.formProps?.setData((o) => (o.splice(s, 1, {
|
|
298
|
+
...o[s],
|
|
299
|
+
...a
|
|
300
|
+
}), o));
|
|
287
301
|
}
|
|
288
|
-
if (
|
|
289
|
-
const { account: b, user: i } =
|
|
302
|
+
if (y === "accountSelected") {
|
|
303
|
+
const { account: b, user: i } = r, [a] = b?.billing || [], [o] = b?.shipping || [], [d] = b?.organisations || [], [t] = b?.phoneNumbers || [], I = A(t?.countryCode) || e?.defaultCountry, [_] = I?.callingCodes || [], x = o ? F(o) : {}, {
|
|
290
304
|
id: p,
|
|
291
|
-
isValid:
|
|
305
|
+
isValid: U,
|
|
292
306
|
...V
|
|
293
|
-
} =
|
|
307
|
+
} = x, S = V?.countryCode ? P(
|
|
308
|
+
B,
|
|
309
|
+
A(V.countryCode)
|
|
310
|
+
) : e?.defaultCountry, R = a ? F(a) : {}, {
|
|
294
311
|
id: c,
|
|
295
|
-
isValid:
|
|
296
|
-
...
|
|
297
|
-
} = R
|
|
312
|
+
isValid: w,
|
|
313
|
+
...L
|
|
314
|
+
} = R, E = L?.countryCode ? P(
|
|
315
|
+
B,
|
|
316
|
+
A(L.countryCode)
|
|
317
|
+
) : e?.defaultCountry, j = !z && d?.id || n;
|
|
298
318
|
await g({
|
|
299
319
|
customer: {
|
|
300
320
|
contactId: i.id,
|
|
301
|
-
...
|
|
321
|
+
...j && d?.id ? { organisationId: d?.id } : {}
|
|
302
322
|
}
|
|
303
323
|
});
|
|
304
|
-
const
|
|
324
|
+
const k = {
|
|
305
325
|
...e,
|
|
306
326
|
...m || {},
|
|
307
327
|
contact: e?.contact,
|
|
308
|
-
email:
|
|
309
|
-
type:
|
|
310
|
-
...
|
|
311
|
-
phoneNumber:
|
|
312
|
-
`+${
|
|
328
|
+
email: j && d?.administration?.email || b?.email,
|
|
329
|
+
type: j ? "business" : "private",
|
|
330
|
+
...t ? {
|
|
331
|
+
phoneNumber: t.number?.replace(
|
|
332
|
+
`+${_}`,
|
|
313
333
|
""
|
|
314
334
|
),
|
|
315
|
-
phoneNumberCountry:
|
|
316
|
-
phoneNumberId:
|
|
335
|
+
phoneNumberCountry: I,
|
|
336
|
+
phoneNumberId: t?.id || ""
|
|
317
337
|
} : {
|
|
318
338
|
phoneNumberCountry: e.defaultCountry
|
|
319
339
|
},
|
|
320
|
-
organisation:
|
|
340
|
+
organisation: j ? {
|
|
321
341
|
...e?.organisation || {},
|
|
322
342
|
...m?.organisation || {},
|
|
323
343
|
id: d?.id || "",
|
|
@@ -327,8 +347,9 @@ const ai = {
|
|
|
327
347
|
isVatNumberRequired: e?.organisation?.isVatNumberRequired ?? !1,
|
|
328
348
|
type: d?.type || "DEFAULT",
|
|
329
349
|
vatNumber: d?.registration?.number || "",
|
|
330
|
-
vatNumberCountry:
|
|
331
|
-
|
|
350
|
+
vatNumberCountry: P(
|
|
351
|
+
B,
|
|
352
|
+
A(
|
|
332
353
|
d?.registration?.countryCode
|
|
333
354
|
) || e?.defaultCountry
|
|
334
355
|
)
|
|
@@ -339,22 +360,22 @@ const ai = {
|
|
|
339
360
|
isVatNumberRequired: e?.organisation?.isVatNumberRequired ?? !1,
|
|
340
361
|
vatNumberCountry: e.defaultCountry
|
|
341
362
|
},
|
|
342
|
-
billing:
|
|
363
|
+
billing: a ? {
|
|
343
364
|
...e.billing,
|
|
344
365
|
...q,
|
|
345
|
-
...
|
|
346
|
-
country:
|
|
366
|
+
...L,
|
|
367
|
+
country: E
|
|
347
368
|
} : {
|
|
348
369
|
...e.billing,
|
|
349
370
|
...q,
|
|
350
371
|
country: e.defaultCountry
|
|
351
372
|
},
|
|
352
373
|
billingAddressId: c || "",
|
|
353
|
-
shipping:
|
|
374
|
+
shipping: o ? {
|
|
354
375
|
...e.shipping,
|
|
355
376
|
...q,
|
|
356
377
|
...V,
|
|
357
|
-
country:
|
|
378
|
+
country: S
|
|
358
379
|
} : {
|
|
359
380
|
...e.shipping,
|
|
360
381
|
...q,
|
|
@@ -363,47 +384,49 @@ const ai = {
|
|
|
363
384
|
shippingAddressId: p || "",
|
|
364
385
|
sameBillingAsShippingAddress: !D(c) || D(c) && c === p
|
|
365
386
|
};
|
|
366
|
-
|
|
387
|
+
C === s && N.current?.reset({
|
|
367
388
|
...e,
|
|
368
|
-
...
|
|
369
|
-
}),
|
|
389
|
+
...k
|
|
390
|
+
}), N.current?.formProps?.setData((l) => (l.splice(s, 1, {
|
|
370
391
|
...l[s],
|
|
371
|
-
...
|
|
392
|
+
...k
|
|
372
393
|
}), l));
|
|
373
394
|
}
|
|
374
|
-
if (
|
|
375
|
-
const { account: b, organisation: i, user:
|
|
395
|
+
if (y === "businessAccountSelected") {
|
|
396
|
+
const { account: b, organisation: i, user: a } = r;
|
|
376
397
|
await g({
|
|
377
398
|
customer: {
|
|
378
|
-
contactId:
|
|
399
|
+
contactId: a.id,
|
|
379
400
|
organisationId: i?.id
|
|
380
401
|
}
|
|
381
402
|
});
|
|
382
|
-
const
|
|
403
|
+
const o = i?.addressing?.billing?.primary ? F(i?.addressing?.billing?.primary) : {}, {
|
|
383
404
|
id: d,
|
|
384
|
-
isValid:
|
|
385
|
-
...
|
|
386
|
-
} =
|
|
387
|
-
|
|
388
|
-
|
|
405
|
+
isValid: t,
|
|
406
|
+
...I
|
|
407
|
+
} = o, _ = I?.countryCode ? P(
|
|
408
|
+
B,
|
|
409
|
+
A(I.countryCode)
|
|
410
|
+
) : e?.defaultCountry, x = i?.addressing?.shipping?.primary ? F(i?.addressing?.shipping?.primary) : {}, {
|
|
389
411
|
id: p,
|
|
390
|
-
isValid:
|
|
412
|
+
isValid: U,
|
|
391
413
|
...V
|
|
392
|
-
} =
|
|
393
|
-
|
|
394
|
-
|
|
414
|
+
} = x, S = V?.countryCode ? P(
|
|
415
|
+
B,
|
|
416
|
+
A(V.countryCode)
|
|
417
|
+
) : e?.defaultCountry, R = i?.phoneNumbers?.primary, c = A(R?.countryCode) || e?.defaultCountry, [w] = c?.callingCodes || [], L = {
|
|
395
418
|
...e,
|
|
396
419
|
...m || {}
|
|
397
420
|
};
|
|
398
|
-
|
|
421
|
+
C === s && N.current?.reset({
|
|
399
422
|
...e,
|
|
400
|
-
...
|
|
423
|
+
...L,
|
|
401
424
|
contact: e?.contact,
|
|
402
425
|
email: i?.administration?.email || b?.email || "",
|
|
403
426
|
type: "business",
|
|
404
427
|
...R ? {
|
|
405
428
|
phoneNumber: R?.number?.replace(
|
|
406
|
-
`+${
|
|
429
|
+
`+${w}`,
|
|
407
430
|
""
|
|
408
431
|
),
|
|
409
432
|
phoneNumberCountry: c,
|
|
@@ -421,8 +444,9 @@ const ai = {
|
|
|
421
444
|
isVatNumberRequired: e?.organisation?.isVatNumberRequired ?? !1,
|
|
422
445
|
type: i?.type || "SHARED",
|
|
423
446
|
vatNumber: i?.registration?.number || "",
|
|
424
|
-
vatNumberCountry:
|
|
425
|
-
|
|
447
|
+
vatNumberCountry: P(
|
|
448
|
+
B,
|
|
449
|
+
A(i?.registration?.countryCode) || e?.defaultCountry
|
|
426
450
|
)
|
|
427
451
|
} : {
|
|
428
452
|
...e?.organisation || {},
|
|
@@ -431,22 +455,22 @@ const ai = {
|
|
|
431
455
|
isVatNumberRequired: e?.organisation?.isVatNumberRequired ?? !1,
|
|
432
456
|
vatNumberCountry: e.defaultCountry
|
|
433
457
|
},
|
|
434
|
-
billing:
|
|
458
|
+
billing: o ? {
|
|
435
459
|
...e.billing,
|
|
436
460
|
...q,
|
|
437
|
-
...
|
|
438
|
-
country:
|
|
461
|
+
...I,
|
|
462
|
+
country: _
|
|
439
463
|
} : {
|
|
440
464
|
...e.billing,
|
|
441
465
|
...q,
|
|
442
466
|
country: e.defaultCountry
|
|
443
467
|
},
|
|
444
468
|
billingAddressId: d || "",
|
|
445
|
-
shipping:
|
|
469
|
+
shipping: x ? {
|
|
446
470
|
...e.shipping,
|
|
447
471
|
...q,
|
|
448
472
|
...V,
|
|
449
|
-
country:
|
|
473
|
+
country: S
|
|
450
474
|
} : {
|
|
451
475
|
...e.shipping,
|
|
452
476
|
...q,
|
|
@@ -454,39 +478,39 @@ const ai = {
|
|
|
454
478
|
},
|
|
455
479
|
shippingAddressId: p || "",
|
|
456
480
|
sameBillingAsShippingAddress: !D(d) || D(d) && d === p
|
|
457
|
-
}),
|
|
458
|
-
...
|
|
459
|
-
...
|
|
460
|
-
}),
|
|
481
|
+
}), N.current?.formProps?.setData((E) => (E.splice(s, 1, {
|
|
482
|
+
...E[s],
|
|
483
|
+
...L
|
|
484
|
+
}), E));
|
|
461
485
|
}
|
|
462
486
|
},
|
|
463
|
-
submit: async (
|
|
487
|
+
submit: async (y, r, v) => {
|
|
464
488
|
const {
|
|
465
489
|
activeStep: O,
|
|
466
|
-
addInformation:
|
|
490
|
+
addInformation: f,
|
|
467
491
|
currentOrganisation: s,
|
|
468
|
-
formRef:
|
|
492
|
+
formRef: C,
|
|
469
493
|
getCountryByCode: g,
|
|
470
|
-
getUser:
|
|
494
|
+
getUser: N,
|
|
471
495
|
isSignedIn: B,
|
|
472
|
-
setCurrentOrganisation:
|
|
473
|
-
setErrorMessage:
|
|
474
|
-
signUp:
|
|
496
|
+
setCurrentOrganisation: A,
|
|
497
|
+
setErrorMessage: T,
|
|
498
|
+
signUp: z,
|
|
475
499
|
translations: n = {},
|
|
476
|
-
updateAccountInformation:
|
|
500
|
+
updateAccountInformation: H,
|
|
477
501
|
updateOrganisationOnAccount: e
|
|
478
502
|
} = v || {}, m = {
|
|
479
|
-
...
|
|
503
|
+
...di,
|
|
480
504
|
...n.feedback || {}
|
|
481
|
-
}, { shouldCreateAccount: b } =
|
|
505
|
+
}, { shouldCreateAccount: b } = y || {};
|
|
482
506
|
try {
|
|
483
|
-
|
|
484
|
-
const i =
|
|
507
|
+
T(null);
|
|
508
|
+
const i = ai(y, {
|
|
485
509
|
currentOrganisation: s,
|
|
486
510
|
isSignedIn: B
|
|
487
|
-
}),
|
|
511
|
+
}), a = N();
|
|
488
512
|
if (b) {
|
|
489
|
-
const p = await
|
|
513
|
+
const p = await z({
|
|
490
514
|
givenName: i?.shipping?.givenName,
|
|
491
515
|
additionalName: i?.shipping?.additionalName,
|
|
492
516
|
familyName: i?.shipping?.familyName,
|
|
@@ -497,28 +521,28 @@ const ai = {
|
|
|
497
521
|
shipping: i?.shippingAddress ? [i.shippingAddress] : []
|
|
498
522
|
},
|
|
499
523
|
...i?.phoneNumber ? { phoneNumber: i?.phoneNumber } : {}
|
|
500
|
-
}).catch((
|
|
501
|
-
const V =
|
|
502
|
-
return
|
|
503
|
-
title: m.
|
|
504
|
-
description: V ?
|
|
524
|
+
}).catch((U) => {
|
|
525
|
+
const V = X(U);
|
|
526
|
+
return T({
|
|
527
|
+
title: m.signUpFailedTitle,
|
|
528
|
+
description: V ? Y(V) : m.signUpFailedDescription,
|
|
505
529
|
action: {
|
|
506
|
-
label: m.
|
|
530
|
+
label: m.signUpFailedActionLabel,
|
|
507
531
|
onClick: () => {
|
|
508
|
-
|
|
509
|
-
...
|
|
532
|
+
T(null), C.current?.reset({
|
|
533
|
+
...C.current?.getValues() || {},
|
|
510
534
|
shouldCreateAccount: !1
|
|
511
|
-
}),
|
|
535
|
+
}), C.current?.submitForm();
|
|
512
536
|
}
|
|
513
537
|
}
|
|
514
|
-
}), Promise.reject(
|
|
538
|
+
}), Promise.reject(U);
|
|
515
539
|
});
|
|
516
540
|
if (!p)
|
|
517
541
|
return Promise.reject();
|
|
518
|
-
delete i.customer.contact, i.customer.contactId = p.id,
|
|
542
|
+
delete i.customer.contact, i.customer.contactId = p.id, C.current?.setValue("shouldCreateAccount", !1);
|
|
519
543
|
}
|
|
520
|
-
if (
|
|
521
|
-
const p =
|
|
544
|
+
if (a && !a?.organisation?.id) {
|
|
545
|
+
const p = ri(
|
|
522
546
|
{
|
|
523
547
|
billingAddress: i.billingAddress,
|
|
524
548
|
billingAddressId: i.billingAddressId,
|
|
@@ -532,17 +556,19 @@ const ai = {
|
|
|
532
556
|
shippingAddress: i.shippingAddress,
|
|
533
557
|
shippingAddressId: i.shippingAddressId,
|
|
534
558
|
type: i.type,
|
|
535
|
-
user:
|
|
559
|
+
user: a
|
|
536
560
|
},
|
|
537
561
|
{
|
|
538
562
|
getCountryByCode: g
|
|
539
563
|
}
|
|
540
564
|
);
|
|
541
|
-
p && await
|
|
565
|
+
p && await H(
|
|
566
|
+
p
|
|
567
|
+
).catch(() => {
|
|
542
568
|
});
|
|
543
569
|
}
|
|
544
|
-
if (
|
|
545
|
-
const p =
|
|
570
|
+
if (a?.organisation?.id && a?.organisation?.role?.toLowerCase() === "admin") {
|
|
571
|
+
const p = ti(
|
|
546
572
|
{
|
|
547
573
|
billingAddress: i.billingAddress,
|
|
548
574
|
billingAddressId: i.billingAddressId,
|
|
@@ -556,48 +582,48 @@ const ai = {
|
|
|
556
582
|
shippingAddress: i.shippingAddress,
|
|
557
583
|
shippingAddressId: i.shippingAddressId,
|
|
558
584
|
type: i.type,
|
|
559
|
-
user:
|
|
585
|
+
user: a
|
|
560
586
|
},
|
|
561
587
|
{
|
|
562
588
|
getCountryByCode: g
|
|
563
589
|
}
|
|
564
590
|
);
|
|
565
|
-
p && await e(
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
);
|
|
591
|
+
p && await e(
|
|
592
|
+
p
|
|
593
|
+
).catch(() => {
|
|
594
|
+
});
|
|
569
595
|
}
|
|
570
|
-
const
|
|
596
|
+
const o = await f({
|
|
571
597
|
billingAddress: i.billingAddress,
|
|
572
598
|
customer: i.customer,
|
|
573
599
|
phoneNumber: i.phoneNumber,
|
|
574
600
|
shippingAddress: i.shippingAddress
|
|
575
|
-
}), { customer: d, billing:
|
|
576
|
-
return
|
|
601
|
+
}), { customer: d, billing: t, delivery: I, phoneNumber: _ } = o || {}, { organisation: x } = d || {};
|
|
602
|
+
return C.current?.formProps?.setData((p) => (p.splice(O, 1, {
|
|
577
603
|
...p[O],
|
|
578
604
|
contact: d?.contact,
|
|
579
|
-
billingAddressId:
|
|
580
|
-
shippingAddressId:
|
|
581
|
-
phoneNumberId:
|
|
605
|
+
billingAddressId: t?.address?.id,
|
|
606
|
+
shippingAddressId: I?.address?.id,
|
|
607
|
+
phoneNumberId: _?.id,
|
|
582
608
|
phoneNumberIsDirty: !1
|
|
583
|
-
}), p)),
|
|
609
|
+
}), p)), A(x), o;
|
|
584
610
|
} catch (i) {
|
|
585
|
-
const
|
|
586
|
-
return
|
|
587
|
-
title: m.
|
|
588
|
-
description:
|
|
611
|
+
const a = X(i);
|
|
612
|
+
return T({
|
|
613
|
+
title: m.informationStepErrorTitle,
|
|
614
|
+
description: a ? Y(a) : m.informationStepErrorDescription
|
|
589
615
|
}), Promise.reject(i);
|
|
590
616
|
}
|
|
591
617
|
},
|
|
592
|
-
validationSchema: (
|
|
618
|
+
validationSchema: (y) => {
|
|
593
619
|
const {
|
|
594
|
-
billingAddressValidationSchema:
|
|
620
|
+
billingAddressValidationSchema: r,
|
|
595
621
|
shippingAddressValidationSchema: v,
|
|
596
622
|
settings: O
|
|
597
|
-
} =
|
|
598
|
-
isCocNumberRequired:
|
|
623
|
+
} = y || {}, {
|
|
624
|
+
isCocNumberRequired: f,
|
|
599
625
|
isPhoneNumberRequired: s,
|
|
600
|
-
isVatNumberRequired:
|
|
626
|
+
isVatNumberRequired: C
|
|
601
627
|
} = O || {};
|
|
602
628
|
return u.object().shape({
|
|
603
629
|
type: u.string().oneOf(["business", "private"]).required(),
|
|
@@ -620,20 +646,20 @@ const ai = {
|
|
|
620
646
|
then: (g) => g.shape({
|
|
621
647
|
id: u.string().nullable(),
|
|
622
648
|
name: u.string().required(),
|
|
623
|
-
cocNumber:
|
|
624
|
-
vatNumber:
|
|
625
|
-
vatNumberCountry:
|
|
649
|
+
cocNumber: f ? u.string().trim().required() : u.string().trim().nullable(),
|
|
650
|
+
vatNumber: C ? u.string().trim().required() : u.string().trim().nullable(),
|
|
651
|
+
vatNumberCountry: C ? u.object().nullable().required() : u.object().nullable()
|
|
626
652
|
})
|
|
627
653
|
}),
|
|
628
654
|
sameBillingAsShippingAddress: u.boolean().nullable(),
|
|
629
655
|
shipping: u.object().nullable().shape(v),
|
|
630
656
|
billing: u.object().nullable().when("sameBillingAsShippingAddress", {
|
|
631
657
|
is: !1,
|
|
632
|
-
then: (g) => g.shape(
|
|
658
|
+
then: (g) => g.shape(r)
|
|
633
659
|
})
|
|
634
660
|
});
|
|
635
661
|
}
|
|
636
662
|
};
|
|
637
663
|
export {
|
|
638
|
-
|
|
664
|
+
fi as informationStep
|
|
639
665
|
};
|