@shoppexio/storefront 1.0.110 → 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 CHANGED
@@ -1,5 +1,13 @@
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
+
7
+ ## 1.0.111
8
+
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).
10
+
3
11
  ## 1.0.110
4
12
 
5
13
  - `getShopReviewsPage()`: `ShopReviewsSummary` declares `verified` (the reviews among `total` written on a delivered order, the entries with `verified: true`) and `verified_average_score` (their own average, null when none is). A product's `feedback` (`ProductFeedback`) declares the same pair as `verified` and `verified_average`. All optional: absent until the API that sends them is deployed.
package/dist/index.cjs CHANGED
@@ -2082,17 +2082,25 @@ function clearLatestQuoteToken() {
2082
2082
  latestQuoteToken = null;
2083
2083
  quoteSequence += 1;
2084
2084
  }
2085
- async function quoteCart(coupon, currency) {
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 response = await post("/v1/storefront/cart/quote", {
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;