@shoppexio/storefront 1.0.111 → 1.0.112
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/CHANGELOG.md +4 -0
- package/dist/index.cjs +11 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +19 -2
- package/dist/index.d.ts +19 -2
- package/dist/index.js +11 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.0.112
|
|
4
|
+
|
|
5
|
+
- `quoteCart(coupon, currency, options)` takes `options.customerQuotePath` (`'/dashboard/api/cart-quote'`): on a storefront Shoppex serves, the quote goes to the page's own origin, where the storefront worker adds the signed-in buyer's session so the quote prices their spend-tier discount (`spend_tier_discount`, an `applied_discounts` row with source `SPEND_TIER`). Pair it with `checkout({ customerCheckoutPath: '/dashboard/api/checkout' })`; a tier quote followed by a guest checkout is refused as `price_increased_since_quote`. Without the option nothing changes. `QuoteCartOptions` is exported as a type.
|
|
6
|
+
|
|
3
7
|
## 1.0.111
|
|
4
8
|
|
|
5
9
|
- Breaking: storefront add-on looks (`StorefrontAddon` in the bootstrap). The fixed colour presets and the scrolling announcement are retired: `theme_preset` gives way to `look` (`'theme' | 'accent' | 'custom'` on the announcement and countdown bars, `'theme' | 'custom'` on the promo card and coupon popup). `background_color`, `text_color` and `accent_color` stay and apply only when `look` is `'custom'`; otherwise paint the add-on from your theme. The announcement drops `display_mode` and `animation_speed_seconds`, the countdown drops `density`, `cta_style` and `timer_style`, and the promo card drops `density` and `icon_visibility`; its `cta_style` is `'link' | 'button'` and `icon` no longer offers `'sparkles'` (`'none'` hides the icon).
|
package/dist/index.cjs
CHANGED
|
@@ -2082,17 +2082,25 @@ function clearLatestQuoteToken() {
|
|
|
2082
2082
|
latestQuoteToken = null;
|
|
2083
2083
|
quoteSequence += 1;
|
|
2084
2084
|
}
|
|
2085
|
-
|
|
2085
|
+
var CUSTOMER_CART_QUOTE_PATH = "/dashboard/api/cart-quote";
|
|
2086
|
+
function resolveCartQuoteRequestTarget(options) {
|
|
2087
|
+
if (options?.customerQuotePath === CUSTOMER_CART_QUOTE_PATH && typeof window !== "undefined" && typeof window.location?.origin === "string") {
|
|
2088
|
+
return { endpoint: options.customerQuotePath, baseUrl: window.location.origin };
|
|
2089
|
+
}
|
|
2090
|
+
return { endpoint: "/v1/storefront/cart/quote" };
|
|
2091
|
+
}
|
|
2092
|
+
async function quoteCart(coupon, currency, options) {
|
|
2086
2093
|
const sequence = quoteSequence += 1;
|
|
2087
2094
|
const payload = getCartPayload(coupon);
|
|
2088
2095
|
const normalizedCurrency = normalizeRequestedCurrency(currency) ?? resolveBuyerCurrency(getConfig().currency);
|
|
2089
|
-
const
|
|
2096
|
+
const target = resolveCartQuoteRequestTarget(options);
|
|
2097
|
+
const response = await post(target.endpoint, {
|
|
2090
2098
|
shop_slug: payload.store_slug,
|
|
2091
2099
|
cart: payload.items,
|
|
2092
2100
|
coupon: payload.coupon,
|
|
2093
2101
|
affiliate_code: getAmbientAffiliateCodeForQuote() ?? void 0,
|
|
2094
2102
|
currency: normalizedCurrency ?? void 0
|
|
2095
|
-
});
|
|
2103
|
+
}, target.baseUrl ? { baseUrl: target.baseUrl } : void 0);
|
|
2096
2104
|
if (sequence !== quoteSequence) return response;
|
|
2097
2105
|
if (response.success) {
|
|
2098
2106
|
latestQuoteToken = typeof response.data?.quote_token === "string" ? response.data.quote_token : null;
|