@zonos/elements 1.3.284 → 1.3.286
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/cjs/{cart-94908542.js → cart-0cf8897b.js} +26 -3
- package/dist/cjs/{collect-0c05e2b4.js → collect-79131e52.js} +1 -1
- package/dist/cjs/{getMissingRequiredShippingFields-124b3f20.js → getMissingRequiredShippingFields-a8f04267.js} +1 -1
- package/dist/cjs/index.cjs.js +7 -7
- package/dist/cjs/{invoice-205fb5bc.js → invoice-254ae23b.js} +1 -1
- package/dist/cjs/{paypal-45ca5301.js → paypal-8ca67278.js} +1 -1
- package/dist/cjs/{placeTestOrder-302b6862.js → placeTestOrder-12b63822.js} +1 -1
- package/dist/cjs/{renderCheckoutCurrency-1b0cd5f2.js → renderCheckoutCurrency-a1f71587.js} +1 -1
- package/dist/cjs/zonos-address-completion-dialog_7.cjs.entry.js +2 -2
- package/dist/cjs/zonos-address_4.cjs.entry.js +1 -1
- package/dist/cjs/zonos-airwallex-payment.cjs.entry.js +2 -2
- package/dist/cjs/zonos-card_5.cjs.entry.js +2 -2
- package/dist/cjs/zonos-cart-items_12.cjs.entry.js +21 -9
- package/dist/cjs/zonos-checkout.cjs.entry.js +103 -5
- package/dist/cjs/zonos-collect-cart-items_3.cjs.entry.js +1 -1
- package/dist/cjs/zonos-collect-finish_6.cjs.entry.js +5 -5
- package/dist/cjs/zonos-collect.cjs.entry.js +3 -3
- package/dist/cjs/zonos-controller.cjs.entry.js +1 -1
- package/dist/cjs/zonos-invoice-cart-items_2.cjs.entry.js +3 -3
- package/dist/cjs/zonos-invoice-finish_5.cjs.entry.js +5 -5
- package/dist/cjs/zonos-invoice.cjs.entry.js +3 -3
- package/dist/cjs/zonos-policy-consent_2.cjs.entry.js +2 -2
- package/dist/collection/components/checkout/zonos-checkout/zonos-cart-subtotal/zonos-cart-subtotal.js +17 -5
- package/dist/collection/components/checkout/zonos-checkout/zonos-checkout.js +104 -5
- package/dist/collection/components/common/zonos-stripe-phone-input/zonos-stripe-phone-input.js +1 -1
- package/dist/collection/components/main/zonos-controller.js +1 -1
- package/dist/collection/components/store/checkout/cart.js +14 -1
- package/dist/collection/components/utils/validateCheckoutSession.js +11 -3
- package/dist/collection/types/generated/graphql.frontend.types.js +2 -0
- package/dist/collection/types/generated/graphql.internal.types.js +128 -6
- package/dist/esm/{cart-2e407f7b.js → cart-d04742f5.js} +25 -4
- package/dist/esm/{collect-19428e18.js → collect-4c310a16.js} +1 -1
- package/dist/esm/{getMissingRequiredShippingFields-719b206f.js → getMissingRequiredShippingFields-f0878e32.js} +1 -1
- package/dist/esm/index.js +7 -7
- package/dist/esm/{invoice-67a47785.js → invoice-86487dac.js} +1 -1
- package/dist/esm/{paypal-6dca6567.js → paypal-997935ab.js} +1 -1
- package/dist/esm/{placeTestOrder-9563c89a.js → placeTestOrder-a53f2056.js} +1 -1
- package/dist/esm/{renderCheckoutCurrency-282384f0.js → renderCheckoutCurrency-e0e16eb7.js} +1 -1
- package/dist/esm/zonos-address-completion-dialog_7.entry.js +2 -2
- package/dist/esm/zonos-address_4.entry.js +1 -1
- package/dist/esm/zonos-airwallex-payment.entry.js +2 -2
- package/dist/esm/zonos-card_5.entry.js +2 -2
- package/dist/esm/zonos-cart-items_12.entry.js +21 -9
- package/dist/esm/zonos-checkout.entry.js +103 -5
- package/dist/esm/zonos-collect-cart-items_3.entry.js +1 -1
- package/dist/esm/zonos-collect-finish_6.entry.js +5 -5
- package/dist/esm/zonos-collect.entry.js +3 -3
- package/dist/esm/zonos-controller.entry.js +1 -1
- package/dist/esm/zonos-invoice-cart-items_2.entry.js +3 -3
- package/dist/esm/zonos-invoice-finish_5.entry.js +5 -5
- package/dist/esm/zonos-invoice.entry.js +3 -3
- package/dist/esm/zonos-policy-consent_2.entry.js +2 -2
- package/dist/esm-es5/cart-d04742f5.js +1 -0
- package/dist/esm-es5/{collect-19428e18.js → collect-4c310a16.js} +1 -1
- package/dist/esm-es5/getMissingRequiredShippingFields-f0878e32.js +1 -0
- package/dist/esm-es5/index.js +1 -1
- package/dist/esm-es5/{invoice-67a47785.js → invoice-86487dac.js} +1 -1
- package/dist/esm-es5/{paypal-6dca6567.js → paypal-997935ab.js} +1 -1
- package/dist/esm-es5/{placeTestOrder-9563c89a.js → placeTestOrder-a53f2056.js} +1 -1
- package/dist/esm-es5/{renderCheckoutCurrency-282384f0.js → renderCheckoutCurrency-e0e16eb7.js} +1 -1
- package/dist/esm-es5/zonos-address-completion-dialog_7.entry.js +1 -1
- package/dist/esm-es5/zonos-address_4.entry.js +1 -1
- package/dist/esm-es5/zonos-airwallex-payment.entry.js +1 -1
- package/dist/esm-es5/zonos-card_5.entry.js +1 -1
- package/dist/esm-es5/zonos-cart-items_12.entry.js +1 -1
- package/dist/esm-es5/zonos-checkout.entry.js +1 -1
- package/dist/esm-es5/zonos-collect-cart-items_3.entry.js +1 -1
- package/dist/esm-es5/zonos-collect-finish_6.entry.js +1 -1
- package/dist/esm-es5/zonos-collect.entry.js +1 -1
- package/dist/esm-es5/zonos-controller.entry.js +1 -1
- package/dist/esm-es5/zonos-invoice-cart-items_2.entry.js +1 -1
- package/dist/esm-es5/zonos-invoice-finish_5.entry.js +1 -1
- package/dist/esm-es5/zonos-invoice.entry.js +1 -1
- package/dist/esm-es5/zonos-policy-consent_2.entry.js +1 -1
- package/dist/scripts/index.d.ts +4 -0
- package/dist/scripts/index.js +1 -1
- package/dist/scripts/loadZonos.js +1 -1
- package/dist/scripts/zonos.js +1 -1
- package/dist/types/components/checkout/zonos-checkout/zonos-checkout.d.ts +14 -0
- package/dist/types/components/store/checkout/cart.d.ts +10 -1
- package/dist/types/types/generated/graphql.frontend.types.d.ts +2 -0
- package/dist/types/types/generated/graphql.frontend.types.ts +2 -0
- package/dist/types/types/generated/graphql.internal.types.d.ts +162 -7
- package/dist/types/types/generated/graphql.internal.types.ts +201 -9
- package/dist/zonos-elements/index.esm.js +1 -1
- package/dist/zonos-elements/{p-dd3c00d6.system.entry.js → p-0c327a57.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-e32ee011.system.entry.js → p-117953db.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-260ad739.system.entry.js → p-1cfb5c2a.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-f4acce01.js → p-277b77e3.js} +1 -1
- package/dist/zonos-elements/{p-ae0de3e4.entry.js → p-278abdcf.entry.js} +1 -1
- package/dist/zonos-elements/p-29b60bf3.system.js +1 -1
- package/dist/zonos-elements/{p-e5c76a9b.js → p-344a6278.js} +2 -2
- package/dist/zonos-elements/{p-f59a0129.system.entry.js → p-3a26e5e7.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-94722bf6.system.entry.js → p-40af92a1.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-e8587f9f.system.entry.js → p-41f1697a.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-e2b4c082.system.entry.js → p-490d7fec.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-1277abac.system.entry.js → p-4941c096.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-d20fe2c2.system.entry.js → p-50d088f7.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-8311edc7.entry.js → p-5227aa69.entry.js} +1 -1
- package/dist/zonos-elements/{p-bced320e.entry.js → p-5d110c2b.entry.js} +1 -1
- package/dist/zonos-elements/{p-b1e95f95.entry.js → p-6de2f9c9.entry.js} +1 -1
- package/dist/zonos-elements/{p-6dde1e85.system.entry.js → p-6eaf7c9e.system.entry.js} +1 -1
- package/dist/zonos-elements/p-7352abe9.js +1 -0
- package/dist/zonos-elements/{p-fe5f05fc.system.js → p-74230da8.system.js} +1 -1
- package/dist/zonos-elements/{p-22e10b7d.entry.js → p-77993ba1.entry.js} +1 -1
- package/dist/zonos-elements/p-78f8e594.entry.js +1 -0
- package/dist/zonos-elements/p-7b525c75.system.js +1 -0
- package/dist/zonos-elements/p-7f688485.system.entry.js +1 -0
- package/dist/zonos-elements/p-8861d47e.js +1 -0
- package/dist/zonos-elements/p-8d14cb66.entry.js +1 -0
- package/dist/zonos-elements/{p-a07e5011.entry.js → p-944c1fb3.entry.js} +1 -1
- package/dist/zonos-elements/{p-cb49dcfe.entry.js → p-96ab529e.entry.js} +1 -1
- package/dist/zonos-elements/{p-eb5f3451.system.js → p-998975a3.system.js} +1 -1
- package/dist/zonos-elements/p-a4c7ee17.js +1 -0
- package/dist/zonos-elements/{p-3a13e58c.system.js → p-c0af11fe.system.js} +1 -1
- package/dist/zonos-elements/p-c112fa12.system.entry.js +1 -0
- package/dist/zonos-elements/{p-2b8c96e3.system.js → p-c4321a1a.system.js} +1 -1
- package/dist/zonos-elements/{p-aecb5d61.entry.js → p-c7329333.entry.js} +1 -1
- package/dist/zonos-elements/{p-2989da12.system.js → p-c756a59d.system.js} +1 -1
- package/dist/zonos-elements/p-d1a51fac.js +1 -0
- package/dist/zonos-elements/{p-d42bd250.system.entry.js → p-d75726e5.system.entry.js} +1 -1
- package/dist/zonos-elements/p-dd866ca3.system.entry.js +1 -0
- package/dist/zonos-elements/{p-8bfe5b2b.entry.js → p-dd8a7bf4.entry.js} +1 -1
- package/dist/zonos-elements/p-e4dc24e1.system.js +1 -0
- package/dist/zonos-elements/{p-60a6b71d.system.js → p-e5865ad9.system.js} +1 -1
- package/dist/zonos-elements/{p-65c1f51e.entry.js → p-e7d7afda.entry.js} +1 -1
- package/dist/zonos-elements/p-f9346f1c.entry.js +1 -0
- package/dist/zonos-elements/{p-0c9fec73.js → p-fc5f6113.js} +1 -1
- package/dist/zonos-elements/p-fe28dbe6.entry.js +1 -0
- package/dist/zonos-elements/zonos-elements.esm.js +1 -1
- package/package.json +1 -1
- package/dist/esm-es5/cart-2e407f7b.js +0 -1
- package/dist/esm-es5/getMissingRequiredShippingFields-719b206f.js +0 -1
- package/dist/zonos-elements/p-2c2afed4.entry.js +0 -1
- package/dist/zonos-elements/p-2cdd1b49.system.entry.js +0 -1
- package/dist/zonos-elements/p-46cd14e5.js +0 -1
- package/dist/zonos-elements/p-4a20893e.system.js +0 -1
- package/dist/zonos-elements/p-5a491f28.js +0 -1
- package/dist/zonos-elements/p-5ebb7ae6.entry.js +0 -1
- package/dist/zonos-elements/p-62f6a757.entry.js +0 -1
- package/dist/zonos-elements/p-8b298971.system.entry.js +0 -1
- package/dist/zonos-elements/p-a9ad74e5.system.entry.js +0 -1
- package/dist/zonos-elements/p-c1631c9c.js +0 -1
- package/dist/zonos-elements/p-cb4cb5a3.system.js +0 -1
- package/dist/zonos-elements/p-dc80cb87.js +0 -1
- package/dist/zonos-elements/p-ff4e6811.entry.js +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Fragment, h, Host } from "@stencil/core";
|
|
2
|
-
import { cartStore, cartStoreHasOneEligibleItem, } from "../../../store/checkout/cart";
|
|
2
|
+
import { cartStore, cartStoreHasOneEligibleItem, cartStoreIsOrderModificationPaymentOnlySession, } from "../../../store/checkout/cart";
|
|
3
3
|
import { stripeStore, stripeStoreApplyPromoCode, stripeStoreRemovePromoCode, } from "../../../store/checkout/stripe";
|
|
4
4
|
import { localizationStore } from "../../../store/hello/localization";
|
|
5
5
|
import { translate } from "../../../store/translationStore";
|
|
@@ -111,7 +111,14 @@ export class ZonosCartSubtotal {
|
|
|
111
111
|
const cartTotal = cartStore.step === 'customer-info'
|
|
112
112
|
? cartStore.subtotal + cartStore.adjustmentTotal
|
|
113
113
|
: cartStore.total;
|
|
114
|
-
|
|
114
|
+
// Order-modification payment-only sessions have no landedCost at all
|
|
115
|
+
// (see validateCheckoutSession) - they're paying a flat delta, not a
|
|
116
|
+
// shipment - so duty/tax/shipping figures here would just be
|
|
117
|
+
// meaningless zeros rather than real data.
|
|
118
|
+
const isOrderModificationPaymentOnlySession = cartStoreIsOrderModificationPaymentOnlySession();
|
|
119
|
+
const showDutyTaxesInfo = !isOrderModificationPaymentOnlySession &&
|
|
120
|
+
(cartStore.step === 'payment' || cartStore.step === 'shipping');
|
|
121
|
+
const showShippingRow = !isOrderModificationPaymentOnlySession;
|
|
115
122
|
// EU 3-EUR cutover (05CHECK-893): when we collect and remit taxes for an EU
|
|
116
123
|
// DAP quote, taxes and fees are included while duties are paid on delivery.
|
|
117
124
|
const euDapDetails = this.getEuDapDetails();
|
|
@@ -123,7 +130,12 @@ export class ZonosCartSubtotal {
|
|
|
123
130
|
// Store with no discount rules added in the dashboard, checkout would not display have promo code input
|
|
124
131
|
!cartStore.shouldHideDiscountInput &&
|
|
125
132
|
// Only show promo stuff if they are past customer info session in order to get landed cost with promo adjustment
|
|
126
|
-
cartStore.step !== 'customer-info'
|
|
133
|
+
cartStore.step !== 'customer-info' &&
|
|
134
|
+
// Order-modification payment-only sessions skip straight to the payment
|
|
135
|
+
// step with no customer-info/shipping step behind them — applying a
|
|
136
|
+
// promo code here would re-quote against a landed cost these sessions
|
|
137
|
+
// never went through, with no shipping step to return to.
|
|
138
|
+
!isOrderModificationPaymentOnlySession;
|
|
127
139
|
const appliedPromoCode = (_e = (_d = (_c = (_b = (_a = cartStore.landedCostData) === null || _a === void 0 ? void 0 : _a.find(Boolean)) === null || _b === void 0 ? void 0 : _b.landedCost.appliedAdjustments) === null || _c === void 0 ? void 0 : _c.find(x => { var _a; return ((_a = x.adjustment) === null || _a === void 0 ? void 0 : _a.source) === 'PROMO_CODE'; })) === null || _d === void 0 ? void 0 : _d.adjustment) === null || _e === void 0 ? void 0 : _e.name;
|
|
128
140
|
const applyPromoCode = async () => {
|
|
129
141
|
// Promo code apply button is clicked
|
|
@@ -208,12 +220,12 @@ export class ZonosCartSubtotal {
|
|
|
208
220
|
return (h(Host, { class: "zonos--cart-subtotal zonos--elements" }, h("table", { class: "zonos--cart-table" }, h("tr", { class: "zonos--row zonos--cart-subtotal" }, h("td", { class: "zonos--column" }), h("td", { class: "zonos--column zonos--cart-subtotal-title" }, h("zonos-text", { type: "semiBoldLabel" }, translate('Cart subtotal')), h("zonos-text", { class: "zonos--caption", type: "caption" }, this.getCartSubtotalSubtitle())), h("td", { class: "zonos--column zonos--cart-subtotal-price" }, h("zonos-text", { type: "semiBoldLabel" }, renderCheckoutCurrency({
|
|
209
221
|
amount: subtotal,
|
|
210
222
|
isForeign: true,
|
|
211
|
-
})))), h("tr", { class: "zonos--row zonos--cart-shipping" }, h("td", { class: "zonos--column" }), h("td", { class: "zonos--column zonos--cart-subtotal-title" }, renderShippingInfo()), h("td", { class: "zonos--column zonos--cart-subtotal-price" }, cartStore.shipping
|
|
223
|
+
})))), showShippingRow && (h("tr", { class: "zonos--row zonos--cart-shipping" }, h("td", { class: "zonos--column" }), h("td", { class: "zonos--column zonos--cart-subtotal-title" }, renderShippingInfo()), h("td", { class: "zonos--column zonos--cart-subtotal-price" }, cartStore.shipping
|
|
212
224
|
? renderCheckoutCurrency({
|
|
213
225
|
amount: cartStore.shipping,
|
|
214
226
|
isForeign: true,
|
|
215
227
|
})
|
|
216
|
-
: '-')), showDutyTaxesInfo &&
|
|
228
|
+
: '-'))), showDutyTaxesInfo &&
|
|
217
229
|
(euDapDetails ? (
|
|
218
230
|
// EU DAP remittance: taxes and fees are collected/included, duties
|
|
219
231
|
// are estimated and paid upon delivery — show them on two lines.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Fragment, h, Host, } from "@stencil/core";
|
|
2
|
-
import { cartStore, cartStoreClearCheckoutInterval, cartStoreNextStep, cartStoreOnChange, cartStoreReset, cartStoreResetTabItems, cartStoreSetCheckoutSession, cartStoreStartCheckoutInterval, cartStoreUpdateItems, cartStoreUpdateToErrorState, } from "../../store/checkout/cart";
|
|
2
|
+
import { cartStore, cartStoreClearCheckoutInterval, cartStoreIsOrderModificationPaymentOnlySession, cartStoreNextStep, cartStoreOnChange, cartStoreReset, cartStoreResetTabItems, cartStoreSetCheckoutSession, cartStoreStartCheckoutInterval, cartStoreUpdateItems, cartStoreUpdateToErrorState, } from "../../store/checkout/cart";
|
|
3
3
|
import { paypalInitScript, paypalStore, paypalStoreHasPaypalEnabled, } from "../../store/checkout/paypal";
|
|
4
4
|
import { isPolicyConsentRequired, policyConsentStore, policyConsentStoreReset, } from "../../store/checkout/policyConsent";
|
|
5
5
|
import { storeCreditStoreApplyCredit, storeCreditStoreCoversFullAmount, storeCreditStoreCreateOrder, storeCreditStoreGetEffectiveAmount, } from "../../store/checkout/storeCredit";
|
|
@@ -9,6 +9,7 @@ import { storageStore, storageStoreSetEnabledVariantTestKeys, VARIANT_TEST_KEY_E
|
|
|
9
9
|
import { translate } from "../../store/translationStore";
|
|
10
10
|
import { getZonosStoreTheme, zonosStore, } from "../../store/zonosStore";
|
|
11
11
|
import { buildCartItemsByTempCart } from "../../utils/api/buildCartItemsByTempCart";
|
|
12
|
+
import { getCheckoutSession } from "../../utils/api/getCheckoutSession";
|
|
12
13
|
import { isStoreDiscountEnabled } from "../../utils/api/isStoreDiscountEnabl";
|
|
13
14
|
import { selectVarianceTest } from "../../utils/api/selectVarianceTest";
|
|
14
15
|
import { trackConversionEvent } from "../../utils/api/trackConversionEvent";
|
|
@@ -232,6 +233,48 @@ export class ZonosCheckout {
|
|
|
232
233
|
log('Payment intent is not succeeded, proceed to order');
|
|
233
234
|
return { shouldAllowOrder: true };
|
|
234
235
|
};
|
|
236
|
+
/**
|
|
237
|
+
* Recover an order-modification payment-only session that was already
|
|
238
|
+
* completed (or already paid but not yet completed) by the time this cart
|
|
239
|
+
* link is opened/reopened — e.g. the shopper paid, closed the tab before
|
|
240
|
+
* the async order-creation webhook finished, then reopened the same
|
|
241
|
+
* payment link. Without this, re-rendering the payment form would let them
|
|
242
|
+
* attempt to pay again against an already-resolved session. Mirrors
|
|
243
|
+
* zonos-collect's recoverCompletedCollectSession for its own no-shipping
|
|
244
|
+
* flow, minus the Airwallex branch (this checkout only supports Stripe).
|
|
245
|
+
*
|
|
246
|
+
* @returns `true` when it routed to the finish step, `false` when the
|
|
247
|
+
* caller should proceed with a normal init.
|
|
248
|
+
*/
|
|
249
|
+
this.recoverCompletedOrderModificationSession = async (checkoutSessionId) => {
|
|
250
|
+
// getCheckoutSession() reads storageStore.checkoutSessionId internally.
|
|
251
|
+
storageStore.checkoutSessionId = checkoutSessionId;
|
|
252
|
+
const { errors, json } = await getCheckoutSession();
|
|
253
|
+
if (errors.length || !json) {
|
|
254
|
+
return false;
|
|
255
|
+
}
|
|
256
|
+
const { checkoutSession } = json;
|
|
257
|
+
// Session already finalized → straight to finish. An order-mod
|
|
258
|
+
// payment-only session always has `order` set *before* payment too (see
|
|
259
|
+
// isOrderModificationPaymentOnlySession) - checking `order` alone would
|
|
260
|
+
// treat every first-ever open as already paid, so both must be true.
|
|
261
|
+
if (checkoutSession.completedAt && checkoutSession.order) {
|
|
262
|
+
void this.setToFinishStep('succeeded');
|
|
263
|
+
return true;
|
|
264
|
+
}
|
|
265
|
+
// Not completed and no order yet — verify the live payment intent status.
|
|
266
|
+
if (checkoutSession.clientSecret) {
|
|
267
|
+
const { status } = await stripeStoreRetrievePayment({
|
|
268
|
+
clientSecret: checkoutSession.clientSecret,
|
|
269
|
+
});
|
|
270
|
+
if (status === 'processing' || status === 'succeeded') {
|
|
271
|
+
stripeStore.clientSecret = checkoutSession.clientSecret;
|
|
272
|
+
void this.setToFinishStep(status);
|
|
273
|
+
return true;
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
return false;
|
|
277
|
+
};
|
|
235
278
|
this.initializeTestKeys = () => {
|
|
236
279
|
// cleanup expired test keys
|
|
237
280
|
storageStore.enabledVariantTestKeys = filterExpiredTests(storageStore.enabledVariantTestKeys || []);
|
|
@@ -581,6 +624,7 @@ export class ZonosCheckout {
|
|
|
581
624
|
(_b = (_a = zonosStore.checkoutSettings).onClose) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
582
625
|
}
|
|
583
626
|
async buildCartAndInit() {
|
|
627
|
+
var _a;
|
|
584
628
|
// if createCartId is provided, use it to build cart. Merchant will provide create a cart from their server side and give the cart id to us.
|
|
585
629
|
if (typeof zonosStore.checkoutSettings.createCartId === 'function') {
|
|
586
630
|
log('"createCartId" is provided, start building cart');
|
|
@@ -620,6 +664,37 @@ export class ZonosCheckout {
|
|
|
620
664
|
// if tempCartUUID is provided, use it instead of buildCartDetail
|
|
621
665
|
else if (window.Zonos.cartData) {
|
|
622
666
|
log('tempCartUUID is provided, start building cart');
|
|
667
|
+
// A cart created against an already-existing checkout session (e.g. an
|
|
668
|
+
// order-modification payment request) must reuse that session instead
|
|
669
|
+
// of creating a fresh one — otherwise the reused cart's order/landedCost
|
|
670
|
+
// context (and, downstream, the payment-only step skip below) is lost.
|
|
671
|
+
// Mirrors the same reference lookup zonos-collect/zonos-invoice already
|
|
672
|
+
// do for their own cart types.
|
|
673
|
+
const cartCheckoutSessionId = (_a = window.Zonos.cartData.references) === null || _a === void 0 ? void 0 : _a.checkoutSessionId;
|
|
674
|
+
if (cartCheckoutSessionId) {
|
|
675
|
+
log('Setting checkout session id from cart reference', 'info', cartCheckoutSessionId);
|
|
676
|
+
// The shopper may be reopening this same payment link after already
|
|
677
|
+
// paying — e.g. they closed the tab before the async order-creation
|
|
678
|
+
// webhook finished. Check the session/payment-intent status before
|
|
679
|
+
// rendering the payment form again.
|
|
680
|
+
const recovered = await this.recoverCompletedOrderModificationSession(cartCheckoutSessionId);
|
|
681
|
+
if (recovered) {
|
|
682
|
+
// Recovery routes straight to the finish step, bypassing the
|
|
683
|
+
// cartStoreUpdateItems call below that would normally clear this -
|
|
684
|
+
// without it, the finish screen would spin forever (dialogLoading
|
|
685
|
+
// stays true while isFetchingSession is true).
|
|
686
|
+
stripeStore.isFetchingSession = false;
|
|
687
|
+
return true;
|
|
688
|
+
}
|
|
689
|
+
storageStore.checkoutSessionId = cartCheckoutSessionId;
|
|
690
|
+
}
|
|
691
|
+
else {
|
|
692
|
+
// Same as zonos-collect/zonos-invoice: without this, a checkout
|
|
693
|
+
// session id left over from a previous cart in this tab would leak
|
|
694
|
+
// into this unrelated one.
|
|
695
|
+
log('Clear checkout session id from storage so we start from a fresh session for this cart');
|
|
696
|
+
storageStore.checkoutSessionId = null;
|
|
697
|
+
}
|
|
623
698
|
const { adjustments, cartItems } = buildCartItemsByTempCart(window.Zonos.cartData);
|
|
624
699
|
await cartStoreUpdateItems({ adjustments, cartItems });
|
|
625
700
|
}
|
|
@@ -663,6 +738,17 @@ export class ZonosCheckout {
|
|
|
663
738
|
successBehavior === 'REDIRECT_TO_SUCCESS_PAGE' ||
|
|
664
739
|
(successBehavior === 'CLOSE_MODAL' && !!successRedirectUrl) ||
|
|
665
740
|
!!cartStore.externalConfirmationPageURL;
|
|
741
|
+
// A session tied to an order that hasn't completed yet is an
|
|
742
|
+
// order-modification/adjustment collection: the shopper is only paying a
|
|
743
|
+
// delta against an already-approved landed cost, so the address/shipping
|
|
744
|
+
// steps (which would re-quote against the synthetic delta line item
|
|
745
|
+
// instead of the real shipment) are skipped in favor of jumping straight
|
|
746
|
+
// to payment, same as the Collect flow does for its own cart type. Lives
|
|
747
|
+
// here (rather than at each buildCartAndInit call site) so every caller
|
|
748
|
+
// gets it, including the forceDialogOpen/preview init path.
|
|
749
|
+
if (cartStoreIsOrderModificationPaymentOnlySession()) {
|
|
750
|
+
cartStore.step = 'payment';
|
|
751
|
+
}
|
|
666
752
|
return true;
|
|
667
753
|
}
|
|
668
754
|
reloadCheckoutSession() {
|
|
@@ -1526,7 +1612,13 @@ export class ZonosCheckout {
|
|
|
1526
1612
|
return;
|
|
1527
1613
|
}
|
|
1528
1614
|
try {
|
|
1529
|
-
|
|
1615
|
+
// Order-modification payment-only sessions skip the shipping step,
|
|
1616
|
+
// so cartStore.selectedLandedCost is never populated — bypass the
|
|
1617
|
+
// landed-cost guard the same way zonos-collect does for its own
|
|
1618
|
+
// no-shipping-step flow.
|
|
1619
|
+
await stripeStoreConfirmPayment({
|
|
1620
|
+
noLandedCostCheck: cartStoreIsOrderModificationPaymentOnlySession(),
|
|
1621
|
+
});
|
|
1530
1622
|
cartStoreNextStep();
|
|
1531
1623
|
// clear the checkout session timeout timer when purchase is complete
|
|
1532
1624
|
cartStoreClearCheckoutInterval();
|
|
@@ -1793,6 +1885,13 @@ export class ZonosCheckout {
|
|
|
1793
1885
|
cartStore.step !== 'error' &&
|
|
1794
1886
|
!stripeStore.stripeElements) ||
|
|
1795
1887
|
stripeStore.isFetchingSession;
|
|
1888
|
+
// An order-modification/adjustment session (order attached, not yet
|
|
1889
|
+
// completed) skips straight to payment — see buildCartAndInit. The
|
|
1890
|
+
// customer-info/shipping steps never ran, so the progress tabs (which
|
|
1891
|
+
// track completion via cartStore.tabItems, only ever flipped by those
|
|
1892
|
+
// steps' own continue handlers) would otherwise show a stale, frozen
|
|
1893
|
+
// bar instead of reflecting that this is a single-step flow.
|
|
1894
|
+
const isPaymentOnlySession = cartStoreIsOrderModificationPaymentOnlySession();
|
|
1796
1895
|
const { colorPrimary, colorSecondary, logoUrl, style } = mergeConfig(zonosStore.appearance, this.appearanceSettingsOverride || null);
|
|
1797
1896
|
const hasFooter = zonosStore.appearance.zonosAttribution === 'ENABLED';
|
|
1798
1897
|
const rightSideTheme = zonosStore.appearance.theme;
|
|
@@ -1823,9 +1922,9 @@ export class ZonosCheckout {
|
|
|
1823
1922
|
const zonosDebug = urlParams.get('zonosDebug');
|
|
1824
1923
|
const zonosE2ETest = urlParams.get('zonosE2ETest');
|
|
1825
1924
|
const zonosStagingMode = this.overrideStagingMode || getIsStagingMode();
|
|
1826
|
-
return (h("zonos-v-stack", null, h("div", { class: "zonos--logo-wrapper" }, renderLogo(), isTestMode && (h("zonos-badge", { badgeColor: "orange", size: "small" }, translate('Test mode'))), zonosStagingMode && (h("zonos-badge", { badgeColor: "red", size: "small" }, translate('Staging mode'))), zonosDebug === '1' && (h("zonos-badge", { badgeColor: "cyan", size: "small" }, "debug")), zonosQaUrl && (h("zonos-badge", { badgeColor: "purple", size: "small" }, zonosQaUrl)), zonosE2ETest && (h("zonos-badge", { badgeColor: "gray", size: "small" }, "E2E Test"))), h("zonos-checkout-progress-tabs", { backgroundColor:
|
|
1925
|
+
return (h("zonos-v-stack", null, h("div", { class: "zonos--logo-wrapper" }, renderLogo(), isTestMode && (h("zonos-badge", { badgeColor: "orange", size: "small" }, translate('Test mode'))), zonosStagingMode && (h("zonos-badge", { badgeColor: "red", size: "small" }, translate('Staging mode'))), zonosDebug === '1' && (h("zonos-badge", { badgeColor: "cyan", size: "small" }, "debug")), zonosQaUrl && (h("zonos-badge", { badgeColor: "purple", size: "small" }, zonosQaUrl)), zonosE2ETest && (h("zonos-badge", { badgeColor: "gray", size: "small" }, "E2E Test"))), !isPaymentOnlySession && (h("zonos-checkout-progress-tabs", { backgroundColor:
|
|
1827
1926
|
// only use different contrast color when the secondary color is too off with the background in mobile
|
|
1828
|
-
this.isMobile ? '--zonos-elements-gray-0' : null }), filteredMessages.map(x => (h("zonos-custom-message", { icon: MessageIcon, message: x.message })))));
|
|
1927
|
+
this.isMobile ? '--zonos-elements-gray-0' : null })), filteredMessages.map(x => (h("zonos-custom-message", { icon: MessageIcon, message: x.message })))));
|
|
1829
1928
|
};
|
|
1830
1929
|
const renderContent = () => {
|
|
1831
1930
|
if (cartStore.checkoutSessionTimeoutShow) {
|
|
@@ -2191,7 +2290,7 @@ export class ZonosCheckout {
|
|
|
2191
2290
|
"signature": "(session: CheckoutSessionDetailsFragment) => Promise<void>",
|
|
2192
2291
|
"parameters": [{
|
|
2193
2292
|
"name": "session",
|
|
2194
|
-
"type": "{ cartId: string | null; clientSecret: string; completedAt: string | null; customerProfile: { email: string | null; locations: { administrativeArea: string; countryCode: CountryCode; email: string | null; line1: string; line2: string | null; locality: string; name: string | null; phone: string | null; postalCode: string; }[] | null; name: string | null; storeCreditBalance: number | null; } | null; customerSessionClientSecret: string | null; id: string; landedCost: { amountSubtotals: { discounts: number | null; duties: number; fees: number; items: number; landedCostTotal: number; shipping: number; taxes: number; } | null; appliedAdjustments: { adjustment: { name: string | null; source: AdjustmentSource | null; } | null; amount: number; item: { amount: number; } | null; type: LandedCostAdjustmentType | null; }[] | null; currencyCode: CurrencyCode; deMinimis: { formula: string; method: IncotermCode; note: string; threshold: DeMinimisThreshold; type: DeMinimisType; }[]; duties: { amount: number; currencyCode: CurrencyCode; }[]; fees: { amount: number; currencyCode: CurrencyCode; }[]; id: string; landedCostGuaranteeCode: LandedCostGuaranteeCode; method: IncotermCode; remittance: { amount: number; description: string; }[]; rootId: string; shipmentRating: { amount: number; currencyCode: CurrencyCode; displayName: string; id: string; shippingProfile: { serviceLevel: { code: string; deliveryType: DeliveryType | null; }; transitTime: { guaranteedDelivery: string | null; max: number | null; min: number | null; type: TransitTypeCode | null; } | null; } | null; }; taxes: { amount: number; currencyCode: CurrencyCode; }[]; } | null; metadata: ({ key: string; value: string; } | null)[] | null; organizationId: string; paymentProcessor: CheckoutPaymentProcessorType | null; references: { inclusivePriceConfigurationId: string | null; } | null; subtotals: { adjustments: number; duties: number; exchangeRate: { id: string; rate: number; sourceCurrencyCode: CurrencyCode; targetCurrencyCode: CurrencyCode; type: ExchangeRateType; }; fees: number; items: number; landedCostTotal: number; presentmentCurrencyCode: CurrencyCode; shipping: number; storeCredit: number; taxes: number; total: number; }; varianceTestResults: { selectedVariantKey: string; testKey: string; }[] | null; }",
|
|
2293
|
+
"type": "{ cartId: string | null; clientSecret: string; completedAt: string | null; customerProfile: { email: string | null; locations: { administrativeArea: string; countryCode: CountryCode; email: string | null; line1: string; line2: string | null; locality: string; name: string | null; phone: string | null; postalCode: string; }[] | null; name: string | null; storeCreditBalance: number | null; } | null; customerSessionClientSecret: string | null; id: string; landedCost: { amountSubtotals: { discounts: number | null; duties: number; fees: number; items: number; landedCostTotal: number; shipping: number; taxes: number; } | null; appliedAdjustments: { adjustment: { name: string | null; source: AdjustmentSource | null; } | null; amount: number; item: { amount: number; } | null; type: LandedCostAdjustmentType | null; }[] | null; currencyCode: CurrencyCode; deMinimis: { formula: string; method: IncotermCode; note: string; threshold: DeMinimisThreshold; type: DeMinimisType; }[]; duties: { amount: number; currencyCode: CurrencyCode; }[]; fees: { amount: number; currencyCode: CurrencyCode; }[]; id: string; landedCostGuaranteeCode: LandedCostGuaranteeCode; method: IncotermCode; remittance: { amount: number; description: string; }[]; rootId: string; shipmentRating: { amount: number; currencyCode: CurrencyCode; displayName: string; id: string; shippingProfile: { serviceLevel: { code: string; deliveryType: DeliveryType | null; }; transitTime: { guaranteedDelivery: string | null; max: number | null; min: number | null; type: TransitTypeCode | null; } | null; } | null; }; taxes: { amount: number; currencyCode: CurrencyCode; }[]; } | null; metadata: ({ key: string; value: string; } | null)[] | null; order: { id: string; } | null; organizationId: string; paymentProcessor: CheckoutPaymentProcessorType | null; references: { inclusivePriceConfigurationId: string | null; } | null; subtotals: { adjustments: number; duties: number; exchangeRate: { id: string; rate: number; sourceCurrencyCode: CurrencyCode; targetCurrencyCode: CurrencyCode; type: ExchangeRateType; }; fees: number; items: number; landedCostTotal: number; presentmentCurrencyCode: CurrencyCode; shipping: number; storeCredit: number; taxes: number; total: number; }; varianceTestResults: { selectedVariantKey: string; testKey: string; }[] | null; }",
|
|
2195
2294
|
"docs": ""
|
|
2196
2295
|
}],
|
|
2197
2296
|
"references": {
|
package/dist/collection/components/common/zonos-stripe-phone-input/zonos-stripe-phone-input.js
CHANGED
|
@@ -268,7 +268,7 @@ export class ZonosStripePhoneInput {
|
|
|
268
268
|
"mutable": false,
|
|
269
269
|
"complexType": {
|
|
270
270
|
"original": "GenericZonosSettings['countryFields'] | null",
|
|
271
|
-
"resolved": "null | undefined | { EG: CountryFields; MO: CountryFields; PN: CountryFields; KG: CountryFields; LB: CountryFields; BH: CountryFields; ML: CountryFields; NO: CountryFields; CG: CountryFields; CM: CountryFields; MM: CountryFields; AQ: CountryFields; AX: CountryFields; CC: CountryFields; ER: CountryFields; PF: CountryFields; SO: CountryFields; SX: CountryFields; TO: CountryFields; AD: CountryFields; AE: CountryFields; AF: CountryFields; AG: CountryFields; AI: CountryFields; AL: CountryFields; AM: CountryFields; AO: CountryFields; AR: CountryFields; AS: CountryFields; AT: CountryFields; AU: CountryFields; AW: CountryFields; AZ: CountryFields; BA: CountryFields; BB: CountryFields; BD: CountryFields; BE: CountryFields; BF: CountryFields; BG: CountryFields; BI: CountryFields; BJ: CountryFields; BL: CountryFields; BM: CountryFields; BN: CountryFields; BO: CountryFields; BQ: CountryFields; BR: CountryFields; BS: CountryFields; BT: CountryFields; BV: CountryFields; BW: CountryFields; BY: CountryFields; BZ: CountryFields; CA: CountryFields; CD: CountryFields; CF: CountryFields; CH: CountryFields; CI: CountryFields; CK: CountryFields; CL: CountryFields; CN: CountryFields; CO: CountryFields; CR: CountryFields; CU: CountryFields; CV: CountryFields; CW: CountryFields; CX: CountryFields; CY: CountryFields; CZ: CountryFields; DE: CountryFields; DJ: CountryFields; DK: CountryFields; DM: CountryFields; DO: CountryFields; DZ: CountryFields; EC: CountryFields; EE: CountryFields; EH: CountryFields; ES: CountryFields; ET: CountryFields; FI: CountryFields; FJ: CountryFields; FK: CountryFields; FM: CountryFields; FO: CountryFields; FR: CountryFields; GA: CountryFields; GB: CountryFields; GD: CountryFields; GE: CountryFields; GF: CountryFields; GG: CountryFields; GH: CountryFields; GI: CountryFields; GL: CountryFields; GM: CountryFields; GN: CountryFields; GP: CountryFields; GQ: CountryFields; GR: CountryFields; GS: CountryFields; GT: CountryFields; GU: CountryFields; GW: CountryFields; GY: CountryFields; HK: CountryFields; HM: CountryFields; HN: CountryFields; HR: CountryFields; HT: CountryFields; HU: CountryFields; IC: CountryFields; ID: CountryFields; IE: CountryFields; IL: CountryFields; IM: CountryFields; IN: CountryFields; IO: CountryFields; IQ: CountryFields; IR: CountryFields; IS: CountryFields; IT: CountryFields; JE: CountryFields; JM: CountryFields; JO: CountryFields; JP: CountryFields; KE: CountryFields; KH: CountryFields; KI: CountryFields; KM: CountryFields; KN: CountryFields; KP: CountryFields; KR: CountryFields; KW: CountryFields; KY: CountryFields; KZ: CountryFields; LA: CountryFields; LC: CountryFields; LI: CountryFields; LK: CountryFields; LR: CountryFields; LS: CountryFields; LT: CountryFields; LU: CountryFields; LV: CountryFields; LY: CountryFields; MA: CountryFields; MC: CountryFields; MD: CountryFields; ME: CountryFields; MF: CountryFields; MG: CountryFields; MH: CountryFields; MK: CountryFields; MN: CountryFields; MP: CountryFields; MQ: CountryFields; MR: CountryFields; MS: CountryFields; MT: CountryFields; MU: CountryFields; MV: CountryFields; MW: CountryFields; MX: CountryFields; MY: CountryFields; MZ: CountryFields; NA: CountryFields; NC: CountryFields; NE: CountryFields; NF: CountryFields; NG: CountryFields; NI: CountryFields; NL: CountryFields; NP: CountryFields; NR: CountryFields; NU: CountryFields; NZ: CountryFields; OM: CountryFields; PA: CountryFields; PE: CountryFields; PG: CountryFields; PH: CountryFields; PK: CountryFields; PL: CountryFields; PM: CountryFields; PR: CountryFields; PS: CountryFields; PT: CountryFields; PW: CountryFields; PY: CountryFields; QA: CountryFields; RE: CountryFields; RO: CountryFields; RS: CountryFields; RU: CountryFields; RW: CountryFields; SA: CountryFields; SB: CountryFields; SC: CountryFields; SD: CountryFields; SE: CountryFields; SG: CountryFields; SH: CountryFields; SI: CountryFields; SJ: CountryFields; SK: CountryFields; SL: CountryFields; SM: CountryFields; SN: CountryFields; SR: CountryFields; SS: CountryFields; ST: CountryFields; SV: CountryFields; SY: CountryFields; SZ: CountryFields; TC: CountryFields; TD: CountryFields; TF: CountryFields; TG: CountryFields; TH: CountryFields; TJ: CountryFields; TK: CountryFields; TL: CountryFields; TM: CountryFields; TN: CountryFields; TR: CountryFields; TT: CountryFields; TV: CountryFields; TW: CountryFields; TZ: CountryFields; UA: CountryFields; UG: CountryFields; UM: CountryFields; US: CountryFields; UY: CountryFields; UZ: CountryFields; VA: CountryFields; VC: CountryFields; VE: CountryFields; VG: CountryFields; VI: CountryFields; VN: CountryFields; VU: CountryFields; WF: CountryFields; WS: CountryFields; YE: CountryFields; YT: CountryFields; ZA: CountryFields; ZM: CountryFields; ZW: CountryFields; }",
|
|
271
|
+
"resolved": "null | undefined | { EG: CountryFields; MO: CountryFields; PN: CountryFields; KG: CountryFields; LB: CountryFields; BH: CountryFields; ML: CountryFields; NO: CountryFields; CG: CountryFields; CM: CountryFields; MM: CountryFields; AQ: CountryFields; AX: CountryFields; CC: CountryFields; ER: CountryFields; PF: CountryFields; SO: CountryFields; SX: CountryFields; TO: CountryFields; AD: CountryFields; AE: CountryFields; AF: CountryFields; AG: CountryFields; AI: CountryFields; AL: CountryFields; AM: CountryFields; AO: CountryFields; AR: CountryFields; AS: CountryFields; AT: CountryFields; AU: CountryFields; AW: CountryFields; AZ: CountryFields; BA: CountryFields; BB: CountryFields; BD: CountryFields; BE: CountryFields; BF: CountryFields; BG: CountryFields; BI: CountryFields; BJ: CountryFields; BL: CountryFields; BM: CountryFields; BN: CountryFields; BO: CountryFields; BQ: CountryFields; BR: CountryFields; BS: CountryFields; BT: CountryFields; BV: CountryFields; BW: CountryFields; BY: CountryFields; BZ: CountryFields; CA: CountryFields; CD: CountryFields; CF: CountryFields; CH: CountryFields; CI: CountryFields; CK: CountryFields; CL: CountryFields; CN: CountryFields; CO: CountryFields; CR: CountryFields; CU: CountryFields; CV: CountryFields; CW: CountryFields; CX: CountryFields; CY: CountryFields; CZ: CountryFields; DE: CountryFields; DJ: CountryFields; DK: CountryFields; DM: CountryFields; DO: CountryFields; DZ: CountryFields; EC: CountryFields; EE: CountryFields; EH: CountryFields; ES: CountryFields; ET: CountryFields; FI: CountryFields; FJ: CountryFields; FK: CountryFields; FM: CountryFields; FO: CountryFields; FR: CountryFields; GA: CountryFields; GB: CountryFields; GD: CountryFields; GE: CountryFields; GF: CountryFields; GG: CountryFields; GH: CountryFields; GI: CountryFields; GL: CountryFields; GM: CountryFields; GN: CountryFields; GP: CountryFields; GQ: CountryFields; GR: CountryFields; GS: CountryFields; GT: CountryFields; GU: CountryFields; GW: CountryFields; GY: CountryFields; HK: CountryFields; HM: CountryFields; HN: CountryFields; HR: CountryFields; HT: CountryFields; HU: CountryFields; IC: CountryFields; ID: CountryFields; IE: CountryFields; IL: CountryFields; IM: CountryFields; IN: CountryFields; IO: CountryFields; IQ: CountryFields; IR: CountryFields; IS: CountryFields; IT: CountryFields; JE: CountryFields; JM: CountryFields; JO: CountryFields; JP: CountryFields; KE: CountryFields; KH: CountryFields; KI: CountryFields; KM: CountryFields; KN: CountryFields; KP: CountryFields; KR: CountryFields; KW: CountryFields; KY: CountryFields; KZ: CountryFields; LA: CountryFields; LC: CountryFields; LI: CountryFields; LK: CountryFields; LR: CountryFields; LS: CountryFields; LT: CountryFields; LU: CountryFields; LV: CountryFields; LY: CountryFields; MA: CountryFields; MC: CountryFields; MD: CountryFields; ME: CountryFields; MF: CountryFields; MG: CountryFields; MH: CountryFields; MK: CountryFields; MN: CountryFields; MP: CountryFields; MQ: CountryFields; MR: CountryFields; MS: CountryFields; MT: CountryFields; MU: CountryFields; MV: CountryFields; MW: CountryFields; MX: CountryFields; MY: CountryFields; MZ: CountryFields; NA: CountryFields; NC: CountryFields; NE: CountryFields; NF: CountryFields; NG: CountryFields; NI: CountryFields; NL: CountryFields; NP: CountryFields; NR: CountryFields; NU: CountryFields; NZ: CountryFields; OM: CountryFields; PA: CountryFields; PE: CountryFields; PG: CountryFields; PH: CountryFields; PK: CountryFields; PL: CountryFields; PM: CountryFields; PR: CountryFields; PS: CountryFields; PT: CountryFields; PW: CountryFields; PY: CountryFields; QA: CountryFields; RE: CountryFields; RO: CountryFields; RS: CountryFields; RU: CountryFields; RW: CountryFields; SA: CountryFields; SB: CountryFields; SC: CountryFields; SD: CountryFields; SE: CountryFields; SG: CountryFields; SH: CountryFields; SI: CountryFields; SJ: CountryFields; SK: CountryFields; SL: CountryFields; SM: CountryFields; SN: CountryFields; SR: CountryFields; SS: CountryFields; ST: CountryFields; SV: CountryFields; SY: CountryFields; SZ: CountryFields; TC: CountryFields; TD: CountryFields; TF: CountryFields; TG: CountryFields; TH: CountryFields; TJ: CountryFields; TK: CountryFields; TL: CountryFields; TM: CountryFields; TN: CountryFields; TR: CountryFields; TT: CountryFields; TV: CountryFields; TW: CountryFields; TZ: CountryFields; UA: CountryFields; UG: CountryFields; UM: CountryFields; US: CountryFields; UY: CountryFields; UZ: CountryFields; VA: CountryFields; VC: CountryFields; VE: CountryFields; VG: CountryFields; VI: CountryFields; VN: CountryFields; VU: CountryFields; WF: CountryFields; WS: CountryFields; XK: CountryFields; YE: CountryFields; YT: CountryFields; ZA: CountryFields; ZM: CountryFields; ZW: CountryFields; }",
|
|
272
272
|
"references": {
|
|
273
273
|
"GenericZonosSettings": {
|
|
274
274
|
"location": "import",
|
|
@@ -619,7 +619,7 @@ export class ZonosController {
|
|
|
619
619
|
"signature": "(countryCode: CountryCode) => Promise<void>",
|
|
620
620
|
"parameters": [{
|
|
621
621
|
"name": "countryCode",
|
|
622
|
-
"type": "\"EG\" | \"MO\" | \"PN\" | \"KG\" | \"LB\" | \"BH\" | \"ML\" | \"NO\" | \"CG\" | \"CM\" | \"MM\" | \"AQ\" | \"AX\" | \"CC\" | \"ER\" | \"PF\" | \"SO\" | \"SX\" | \"TO\" | \"AD\" | \"AE\" | \"AF\" | \"AG\" | \"AI\" | \"AL\" | \"AM\" | \"AO\" | \"AR\" | \"AS\" | \"AT\" | \"AU\" | \"AW\" | \"AZ\" | \"BA\" | \"BB\" | \"BD\" | \"BE\" | \"BF\" | \"BG\" | \"BI\" | \"BJ\" | \"BL\" | \"BM\" | \"BN\" | \"BO\" | \"BQ\" | \"BR\" | \"BS\" | \"BT\" | \"BV\" | \"BW\" | \"BY\" | \"BZ\" | \"CA\" | \"CD\" | \"CF\" | \"CH\" | \"CI\" | \"CK\" | \"CL\" | \"CN\" | \"CO\" | \"CR\" | \"CU\" | \"CV\" | \"CW\" | \"CX\" | \"CY\" | \"CZ\" | \"DE\" | \"DJ\" | \"DK\" | \"DM\" | \"DO\" | \"DZ\" | \"EC\" | \"EE\" | \"EH\" | \"ES\" | \"ET\" | \"FI\" | \"FJ\" | \"FK\" | \"FM\" | \"FO\" | \"FR\" | \"GA\" | \"GB\" | \"GD\" | \"GE\" | \"GF\" | \"GG\" | \"GH\" | \"GI\" | \"GL\" | \"GM\" | \"GN\" | \"GP\" | \"GQ\" | \"GR\" | \"GS\" | \"GT\" | \"GU\" | \"GW\" | \"GY\" | \"HK\" | \"HM\" | \"HN\" | \"HR\" | \"HT\" | \"HU\" | \"IC\" | \"ID\" | \"IE\" | \"IL\" | \"IM\" | \"IN\" | \"IO\" | \"IQ\" | \"IR\" | \"IS\" | \"IT\" | \"JE\" | \"JM\" | \"JO\" | \"JP\" | \"KE\" | \"KH\" | \"KI\" | \"KM\" | \"KN\" | \"KP\" | \"KR\" | \"KW\" | \"KY\" | \"KZ\" | \"LA\" | \"LC\" | \"LI\" | \"LK\" | \"LR\" | \"LS\" | \"LT\" | \"LU\" | \"LV\" | \"LY\" | \"MA\" | \"MC\" | \"MD\" | \"ME\" | \"MF\" | \"MG\" | \"MH\" | \"MK\" | \"MN\" | \"MP\" | \"MQ\" | \"MR\" | \"MS\" | \"MT\" | \"MU\" | \"MV\" | \"MW\" | \"MX\" | \"MY\" | \"MZ\" | \"NA\" | \"NC\" | \"NE\" | \"NF\" | \"NG\" | \"NI\" | \"NL\" | \"NP\" | \"NR\" | \"NU\" | \"NZ\" | \"OM\" | \"PA\" | \"PE\" | \"PG\" | \"PH\" | \"PK\" | \"PL\" | \"PM\" | \"PR\" | \"PS\" | \"PT\" | \"PW\" | \"PY\" | \"QA\" | \"RE\" | \"RO\" | \"RS\" | \"RU\" | \"RW\" | \"SA\" | \"SB\" | \"SC\" | \"SD\" | \"SE\" | \"SG\" | \"SH\" | \"SI\" | \"SJ\" | \"SK\" | \"SL\" | \"SM\" | \"SN\" | \"SR\" | \"SS\" | \"ST\" | \"SV\" | \"SY\" | \"SZ\" | \"TC\" | \"TD\" | \"TF\" | \"TG\" | \"TH\" | \"TJ\" | \"TK\" | \"TL\" | \"TM\" | \"TN\" | \"TR\" | \"TT\" | \"TV\" | \"TW\" | \"TZ\" | \"UA\" | \"UG\" | \"UM\" | \"US\" | \"UY\" | \"UZ\" | \"VA\" | \"VC\" | \"VE\" | \"VG\" | \"VI\" | \"VN\" | \"VU\" | \"WF\" | \"WS\" | \"YE\" | \"YT\" | \"ZA\" | \"ZM\" | \"ZW\"",
|
|
622
|
+
"type": "\"EG\" | \"MO\" | \"PN\" | \"KG\" | \"LB\" | \"BH\" | \"ML\" | \"NO\" | \"CG\" | \"CM\" | \"MM\" | \"AQ\" | \"AX\" | \"CC\" | \"ER\" | \"PF\" | \"SO\" | \"SX\" | \"TO\" | \"AD\" | \"AE\" | \"AF\" | \"AG\" | \"AI\" | \"AL\" | \"AM\" | \"AO\" | \"AR\" | \"AS\" | \"AT\" | \"AU\" | \"AW\" | \"AZ\" | \"BA\" | \"BB\" | \"BD\" | \"BE\" | \"BF\" | \"BG\" | \"BI\" | \"BJ\" | \"BL\" | \"BM\" | \"BN\" | \"BO\" | \"BQ\" | \"BR\" | \"BS\" | \"BT\" | \"BV\" | \"BW\" | \"BY\" | \"BZ\" | \"CA\" | \"CD\" | \"CF\" | \"CH\" | \"CI\" | \"CK\" | \"CL\" | \"CN\" | \"CO\" | \"CR\" | \"CU\" | \"CV\" | \"CW\" | \"CX\" | \"CY\" | \"CZ\" | \"DE\" | \"DJ\" | \"DK\" | \"DM\" | \"DO\" | \"DZ\" | \"EC\" | \"EE\" | \"EH\" | \"ES\" | \"ET\" | \"FI\" | \"FJ\" | \"FK\" | \"FM\" | \"FO\" | \"FR\" | \"GA\" | \"GB\" | \"GD\" | \"GE\" | \"GF\" | \"GG\" | \"GH\" | \"GI\" | \"GL\" | \"GM\" | \"GN\" | \"GP\" | \"GQ\" | \"GR\" | \"GS\" | \"GT\" | \"GU\" | \"GW\" | \"GY\" | \"HK\" | \"HM\" | \"HN\" | \"HR\" | \"HT\" | \"HU\" | \"IC\" | \"ID\" | \"IE\" | \"IL\" | \"IM\" | \"IN\" | \"IO\" | \"IQ\" | \"IR\" | \"IS\" | \"IT\" | \"JE\" | \"JM\" | \"JO\" | \"JP\" | \"KE\" | \"KH\" | \"KI\" | \"KM\" | \"KN\" | \"KP\" | \"KR\" | \"KW\" | \"KY\" | \"KZ\" | \"LA\" | \"LC\" | \"LI\" | \"LK\" | \"LR\" | \"LS\" | \"LT\" | \"LU\" | \"LV\" | \"LY\" | \"MA\" | \"MC\" | \"MD\" | \"ME\" | \"MF\" | \"MG\" | \"MH\" | \"MK\" | \"MN\" | \"MP\" | \"MQ\" | \"MR\" | \"MS\" | \"MT\" | \"MU\" | \"MV\" | \"MW\" | \"MX\" | \"MY\" | \"MZ\" | \"NA\" | \"NC\" | \"NE\" | \"NF\" | \"NG\" | \"NI\" | \"NL\" | \"NP\" | \"NR\" | \"NU\" | \"NZ\" | \"OM\" | \"PA\" | \"PE\" | \"PG\" | \"PH\" | \"PK\" | \"PL\" | \"PM\" | \"PR\" | \"PS\" | \"PT\" | \"PW\" | \"PY\" | \"QA\" | \"RE\" | \"RO\" | \"RS\" | \"RU\" | \"RW\" | \"SA\" | \"SB\" | \"SC\" | \"SD\" | \"SE\" | \"SG\" | \"SH\" | \"SI\" | \"SJ\" | \"SK\" | \"SL\" | \"SM\" | \"SN\" | \"SR\" | \"SS\" | \"ST\" | \"SV\" | \"SY\" | \"SZ\" | \"TC\" | \"TD\" | \"TF\" | \"TG\" | \"TH\" | \"TJ\" | \"TK\" | \"TL\" | \"TM\" | \"TN\" | \"TR\" | \"TT\" | \"TV\" | \"TW\" | \"TZ\" | \"UA\" | \"UG\" | \"UM\" | \"US\" | \"UY\" | \"UZ\" | \"VA\" | \"VC\" | \"VE\" | \"VG\" | \"VI\" | \"VN\" | \"VU\" | \"WF\" | \"WS\" | \"XK\" | \"YE\" | \"YT\" | \"ZA\" | \"ZM\" | \"ZW\"",
|
|
623
623
|
"docs": ""
|
|
624
624
|
}],
|
|
625
625
|
"references": {
|
|
@@ -183,6 +183,19 @@ const cartStoreHasOneEligibleItem = () => {
|
|
|
183
183
|
// if there is no item restricted found => all items are restricted
|
|
184
184
|
return !!checkItems.find(item => !item.isRestricted);
|
|
185
185
|
};
|
|
186
|
+
/**
|
|
187
|
+
* An order-modification payment-only session (skip-to-payment, no shipping
|
|
188
|
+
* step): a session tied to an order that hasn't completed yet, meaning the
|
|
189
|
+
* shopper is only paying a delta against an already-approved landed cost.
|
|
190
|
+
* Single source of truth for this detection — previously duplicated inline
|
|
191
|
+
* at each call site, which let one of them (the forceDialogOpen/preview init
|
|
192
|
+
* path) miss it entirely.
|
|
193
|
+
*/
|
|
194
|
+
const cartStoreIsOrderModificationPaymentOnlySession = () => {
|
|
195
|
+
var _a, _b;
|
|
196
|
+
return !!(((_b = (_a = cartStore.checkoutSession) === null || _a === void 0 ? void 0 : _a.order) === null || _b === void 0 ? void 0 : _b.id) &&
|
|
197
|
+
!cartStore.checkoutSession.completedAt);
|
|
198
|
+
};
|
|
186
199
|
const cartStoreSetCheckoutSession = (checkoutSession) => {
|
|
187
200
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
188
201
|
// update stripe store with updated information
|
|
@@ -539,4 +552,4 @@ const cartStoreUpdateStoreCredit = () => {
|
|
|
539
552
|
void cartStoreUpdateStoreCreditImmediate();
|
|
540
553
|
}, 300);
|
|
541
554
|
};
|
|
542
|
-
export { cartStore, cartStoreApplySubtotals, cartStoreCheckItemRestrictions, cartStoreClearCheckoutInterval, cartStoreGetMethod, cartStoreGetShippingTransitInfo, cartStoreHasOneEligibleItem, cartStoreNextStep, cartStoreOnChange, cartStorePreviousStep, cartStoreReCalculateTotal, cartStoreReset, cartStoreResetCartItems, cartStoreResetTabItems, cartStoreSetCheckoutSession, cartStoreStartCheckoutInterval, cartStoreUpdateItems, cartStoreUpdateSelectedShippingOption, cartStoreUpdateStoreCredit, cartStoreUpdateToErrorState, };
|
|
555
|
+
export { cartStore, cartStoreApplySubtotals, cartStoreCheckItemRestrictions, cartStoreClearCheckoutInterval, cartStoreGetMethod, cartStoreGetShippingTransitInfo, cartStoreHasOneEligibleItem, cartStoreIsOrderModificationPaymentOnlySession, cartStoreNextStep, cartStoreOnChange, cartStorePreviousStep, cartStoreReCalculateTotal, cartStoreReset, cartStoreResetCartItems, cartStoreResetTabItems, cartStoreSetCheckoutSession, cartStoreStartCheckoutInterval, cartStoreUpdateItems, cartStoreUpdateSelectedShippingOption, cartStoreUpdateStoreCredit, cartStoreUpdateToErrorState, };
|
|
@@ -7,7 +7,7 @@ import { sendErrorLog } from "./logging/sendErrorLog";
|
|
|
7
7
|
* Validate checkout session before confirming payment
|
|
8
8
|
*/
|
|
9
9
|
export const validateCheckoutSession = async () => {
|
|
10
|
-
var _a;
|
|
10
|
+
var _a, _b;
|
|
11
11
|
// get checkout session info
|
|
12
12
|
const { errors, json } = await getCheckoutSession();
|
|
13
13
|
if (errors.length || !json) {
|
|
@@ -22,8 +22,16 @@ export const validateCheckoutSession = async () => {
|
|
|
22
22
|
valid: false,
|
|
23
23
|
};
|
|
24
24
|
}
|
|
25
|
-
// Make sure landed cost is found in the checkout session
|
|
26
|
-
|
|
25
|
+
// Make sure landed cost is found in the checkout session. Order-modification
|
|
26
|
+
// payment-only sessions (skip-to-payment, no shipping step) never carry a
|
|
27
|
+
// landedCost on the checkout session — same reason stripeStoreConfirmPayment
|
|
28
|
+
// skips its own selectedLandedCost guard for this flow. Inferred here from
|
|
29
|
+
// the session itself (order attached + not completed) rather than a
|
|
30
|
+
// caller-supplied flag, so every call site behaves consistently without
|
|
31
|
+
// needing to know about this special case.
|
|
32
|
+
const isOrderModificationPaymentOnlySession = !!(((_a = json.checkoutSession.order) === null || _a === void 0 ? void 0 : _a.id) && !json.checkoutSession.completedAt);
|
|
33
|
+
if (!isOrderModificationPaymentOnlySession &&
|
|
34
|
+
!((_b = json.checkoutSession.landedCost) === null || _b === void 0 ? void 0 : _b.id)) {
|
|
27
35
|
logError('Landed cost is not found in the checkout session before confirming payment.');
|
|
28
36
|
void sendErrorLog({
|
|
29
37
|
endpoint: 'validateCheckoutSession',
|
|
@@ -37,6 +37,7 @@ export const featureAspectKeyEnum = {
|
|
|
37
37
|
NewPayoutReport: 'new_payout_report',
|
|
38
38
|
NewRefundsUx: 'new_refunds_ux',
|
|
39
39
|
OnboardingBeta: 'onboarding_beta',
|
|
40
|
+
OrderModifications: 'order_modifications',
|
|
40
41
|
OrderReturns: 'order_returns',
|
|
41
42
|
PageAuditor: 'page_auditor',
|
|
42
43
|
PromptExplorer: 'prompt_explorer',
|
|
@@ -72,6 +73,7 @@ export const featureAudienceNameEnum = {
|
|
|
72
73
|
NewRefundsUxMerchant: 'new_refunds_ux_merchant',
|
|
73
74
|
Onboarding: 'onboarding',
|
|
74
75
|
OnboardingBetaMerchant: 'onboarding_beta_merchant',
|
|
76
|
+
OrderModificationsMerchant: 'order_modifications_merchant',
|
|
75
77
|
OrderReturnsMerchant: 'order_returns_merchant',
|
|
76
78
|
PrincipalEngineer: 'principal_engineer',
|
|
77
79
|
ProServeHead: 'pro_serve_head',
|