@asstio-dev/storefront 0.52.0 → 0.54.0

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/README.md CHANGED
@@ -244,6 +244,74 @@ export function buyBox(offer: OfferDto) {
244
244
  freshness, sellability and a complete price, so a partial price can be visible and still not buyable. Never decide it
245
245
  from `stock`: the API sends no public stock quantity, and zero stock is buyable on a backorder site.
246
246
 
247
+ #### Sales, the 30-day price and the RRP
248
+
249
+ While a sale applies, an offer carries `regular`, `sale` (`{ price, validFrom, validTo, label, extendedFrom }`),
250
+ `reference` (the lowest price of the 30 days before the reduction) and, when the shop may say so, a `claim`
251
+ (`{ labelKey, percent, amountOff, since, endsAt, claimEndsAt }`). **Render every price through `priceDisplay`, on the
252
+ request, with the request's time**, instead of reading these fields:
253
+
254
+ ```tsx
255
+ import { priceDisplay } from "@asstio-dev/storefront";
256
+
257
+ const d = priceDisplay(variant.offer, { now: new Date(), locale: "sv" });
258
+ // endsAt is exclusive: show the date of its last second in the site's time zone.
259
+ const lastDay = (endsAt: string) =>
260
+ new Date(Date.parse(endsAt) - 1000).toLocaleDateString("sv-SE", { timeZone: "Europe/Stockholm" });
261
+ <span data-price-part={d.parts.price}>{d.price?.amount}</span>
262
+ {d.struck && <span>{d.struck.label} <s data-price-part={d.parts.struck} title={d.struck.longLabel}>{d.struck.amount}</s></span>}
263
+ {d.badge && <span data-price-part={d.parts.badge}>{d.badge}</span>} {/* "−20 %", a no-break space before % */}
264
+ {d.rrp && <span data-price-part={d.parts.rrp}>Rek. pris {d.rrp.amount}</span>}
265
+ {d.endsAt && <time data-price-part={d.parts["ends-at"]} dateTime={d.endsAt}>t.o.m. {lastDay(d.endsAt)}</time>}
266
+ ```
267
+
268
+ - A page may be served from a cache past a sale's end. `priceDisplay` drops a `sale` whose `validTo` ≤ `now` (it shows
269
+ `regular`) and the offer's `claim` with it, and drops a `claim` whose `endsAt` or `claimEndsAt` ≤ `now`. An open-ended
270
+ sale (`validTo` null) is never dropped by `now`, and `endsAt` is then null: show no end.
271
+ - `endsAt` is the **exclusive** end (the first second the sale no longer applies). Show the date of `endsAt − 1 s` in
272
+ the site's time zone (`lastDay` above), as `productJsonLd` does for `priceValidUntil`; a sale ending at midnight
273
+ ends "t.o.m." the day before.
274
+ - **Only `struck` is struck**: the claim's `reference`, with the claim's label (`priorLowest`: "Tidigare lägsta pris",
275
+ long form "Lägsta pris de senaste 30 dagarna före prissänkningen"; English for other locales; override with
276
+ `texts`). Never strike `regular`, `compareAt` or `unitPriceBeforePromotions`. A `reference` without a `claim` shows
277
+ nothing.
278
+ - **The RRP (`compareAt`) is never shown while a sale applies**, with or without a claim. With no sale and no claim it
279
+ shows as before. It is never struck.
280
+ - Two places can disagree: a listing card whose price segment has two sale owners carries `sale: null`, so its RRP can
281
+ show on the card while the variant page shows a sale and hides it. That is expected; the card has no sale to show.
282
+ - The optional members (`reference`, `claim`, `sale.label`, `sale.extendedFrom`) may be absent from a response: read
283
+ them as `x ?? null`, as `priceDisplay` does.
284
+
285
+ **Lines.** `linePriceDisplay(line, { now, currency })` does the same for a cart, checkout or order line's unit price: a
286
+ line's `claim` strikes its `reference` whether or not the product is on sale (a code that beats the sale still shows a
287
+ true percent). Cart lines are live (a claim past its end drops); checkout and order lines carry the order's evidence and
288
+ are never dropped by `now`. `currency` (the checkout's or order's) is required for checkout and order lines, whose unit
289
+ price is an inc string; without it the line shows no price. An `item` promotion effect in `cart.promotions` (`stage: "item"`) is data: **never render it as a discount
290
+ row**, and never show `subtotalBeforePromotions` while one is present; the struck price comes only from a line's
291
+ `claim`. A code line with no claim shows the code's reduction as a discount row, as before.
292
+
293
+ **Revalidation.** A cached page that shows prices must not outlive the next price change.
294
+ `nextRevalidateSeconds(site, now)` is the seconds until `site.nextPriceBoundary`, at most 60 and at least 1. It is
295
+ **not** a value for Next's `export const revalidate` or `fetch(…, { next: { revalidate } })`: the Data Cache can serve
296
+ an expired entry of any age (C10). Use it for a cache you control, such as the memo below:
297
+
298
+ ```ts
299
+ const { data: site } = await storefront.GET("/v1/site", {});
300
+ const seconds = nextRevalidateSeconds(site!, new Date()); // the lifetime of your own memo entry
301
+ ```
302
+
303
+ Catalog answers of a site with an item promotion carry `X-Price-Valid-Until`. A frontend never shows a catalog answer
304
+ more than 60 s after it fetched it, nor past that header. Next's Data Cache (`fetch` with `revalidate`) can serve an
305
+ entry of any age to the first reader after expiry, so read catalog endpoints with `cache: "no-store"` behind your own
306
+ memo with the lifetime `min(fetchedAt + 60 s, X-Price-Valid-Until)`, and never store a response whose `Cache-Control`
307
+ holds `private` or `no-store`.
308
+
309
+ **JSON-LD.** Pass `now` to `productJsonLd`: each offer's price is then the price charged at `now`, and a live sale with
310
+ an end adds `priceValidUntil` (the date of its last second in `timeZone`, default `Europe/Stockholm`).
311
+
312
+ **Code reasons.** `codeReasonText(code.reason, locale)` gives a default text for a code that does not apply, e.g.
313
+ `superseded` → "Ett bättre erbjudande gäller redan".
314
+
247
315
  ### Variant names
248
316
 
249
317
  `variant.name` (on `VariantDto`, cart lines' `variant` and checkout/order lines' `variant`) is the variant's own name from
@@ -36,3 +36,6 @@ export type LineUnitPrices = {
36
36
  };
37
37
  /** The unit prices of a cart line: `single` when every unit costs the same (no segments, or one), else the segments. Cart lines only. */
38
38
  export declare function lineUnitPrices(line: CartLineDto): LineUnitPrices;
39
+ /** The default text of a discount code's reason (`PromotionCodeReasonDto`): `sv` or English. An unknown reason reads as
40
+ * `unavailable`. */
41
+ export declare function codeReasonText(reason: string, locale: string): string;
@@ -1,4 +1,5 @@
1
1
  import { localProblem, retryAfterSeconds } from "./checkout/types.js";
2
+ import { language } from "./price-display.js";
2
3
  function headers(cartToken, opts) {
3
4
  const h = { "X-Cart-Token": cartToken, "Idempotency-Key": opts.idempotencyKey ?? crypto.randomUUID() };
4
5
  if (opts.ifMatch !== undefined)
@@ -26,3 +27,27 @@ export function lineUnitPrices(line) {
26
27
  return { kind: "single", unitPrice: line.unitPrice };
27
28
  return { kind: "segments", segments };
28
29
  }
30
+ const CODE_REASONS = {
31
+ sv: {
32
+ expired: "Koden har gått ut",
33
+ notForAccount: "Koden gäller inte för ditt konto",
34
+ notInMarket: "Koden gäller inte här",
35
+ notStarted: "Koden gäller inte än",
36
+ superseded: "Ett bättre erbjudande gäller redan",
37
+ unavailable: "Koden kan inte användas",
38
+ },
39
+ en: {
40
+ expired: "The code has expired",
41
+ notForAccount: "The code is not valid for your account",
42
+ notInMarket: "The code is not valid here",
43
+ notStarted: "The code is not valid yet",
44
+ superseded: "A better offer already applies",
45
+ unavailable: "The code cannot be used",
46
+ },
47
+ };
48
+ /** The default text of a discount code's reason (`PromotionCodeReasonDto`): `sv` or English. An unknown reason reads as
49
+ * `unavailable`. */
50
+ export function codeReasonText(reason, locale) {
51
+ const texts = CODE_REASONS[language(locale)];
52
+ return Object.hasOwn(texts, reason) ? texts[reason] : texts.unavailable;
53
+ }
package/dist/index.d.ts CHANGED
@@ -51,6 +51,8 @@ export { isCheckoutContextMismatch, retryAfterSeconds, type CheckoutContextMisma
51
51
  export { mountCheckout, type CheckoutHandle, type MountOptions, type MinimalDocument, type MinimalElement, type MinimalScript } from "./checkout/browser.js";
52
52
  export { controllers, type CheckoutController, type ProviderWindow } from "./checkout/controllers.js";
53
53
  export { displayPrice, isBuyable, isPriceVisible, type DisplayPrice, type OfferDto } from "./offer.js";
54
+ export { linePriceDisplay, priceDisplay, type LinePriceDisplayOptions, type PriceDisplay, type PriceDisplayOptions, type PriceLabel, type PricePart, type PriceTexts, } from "./price-display.js";
55
+ export { nextRevalidateSeconds } from "./site.js";
54
56
  export { breadcrumbJsonLd } from "./seo/breadcrumb.js";
55
57
  export { brandHead, collectionHead, productHead, toNextMetadata } from "./seo/head.js";
56
58
  export { gtinJsonLd } from "./gtin.js";
@@ -68,4 +70,4 @@ export { AnalyticsError, type Ga4Ecommerce, type Ga4Item, type Ga4ItemOptions, t
68
70
  export { SeoError, type BreadcrumbLink, type CollectionHeadOptions, type HeadOptions, type JsonLd, type NextMetadataLike, type ProductJsonLdOptions, type SchemaProperty, type SeoContext, type SeoHead, type SeoMeta, type VariantAvailability, } from "./seo/types.js";
69
71
  export { readVariantParam, redirectTarget, VARIANT_PARAM, variantQueryForApi, variantUrl, type QueryInput, type VariantParam, } from "./variant.js";
70
72
  export { sortOptions, type SortOption } from "./sort.js";
71
- export { applyCode, removeCode, lineUnitPrices, type CartCodeOptions, type CartCodeResult, type LineUnitPrices } from "./cart-codes.js";
73
+ export { applyCode, codeReasonText, removeCode, lineUnitPrices, type CartCodeOptions, type CartCodeResult, type LineUnitPrices } from "./cart-codes.js";
package/dist/index.js CHANGED
@@ -44,6 +44,8 @@ export { isCheckoutContextMismatch, retryAfterSeconds } from "./checkout/types.j
44
44
  export { mountCheckout } from "./checkout/browser.js";
45
45
  export { controllers } from "./checkout/controllers.js";
46
46
  export { displayPrice, isBuyable, isPriceVisible } from "./offer.js";
47
+ export { linePriceDisplay, priceDisplay, } from "./price-display.js";
48
+ export { nextRevalidateSeconds } from "./site.js";
47
49
  export { breadcrumbJsonLd } from "./seo/breadcrumb.js";
48
50
  export { brandHead, collectionHead, productHead, toNextMetadata } from "./seo/head.js";
49
51
  export { gtinJsonLd } from "./gtin.js";
@@ -60,4 +62,4 @@ export { AnalyticsError, } from "./analytics/types.js";
60
62
  export { SeoError, } from "./seo/types.js";
61
63
  export { readVariantParam, redirectTarget, VARIANT_PARAM, variantQueryForApi, variantUrl, } from "./variant.js";
62
64
  export { sortOptions } from "./sort.js";
63
- export { applyCode, removeCode, lineUnitPrices } from "./cart-codes.js";
65
+ export { applyCode, codeReasonText, removeCode, lineUnitPrices } from "./cart-codes.js";
@@ -0,0 +1,87 @@
1
+ import type { components } from "./schema";
2
+ type OfferDto = components["schemas"]["OfferDto"];
3
+ type PricePairDto = components["schemas"]["PricePairDto"];
4
+ type SalePriceDto = components["schemas"]["SalePriceDto"];
5
+ type CartLineDto = components["schemas"]["CartLineDto"];
6
+ type CheckoutCartLineDto = components["schemas"]["CheckoutCartLineDto"];
7
+ type OrderLineDto = components["schemas"]["OrderLineDto"];
8
+ /** One amount to show, on one side of a pair. */
9
+ export type PricePart = {
10
+ amount: string;
11
+ basis: "inc" | "ex";
12
+ currency: string;
13
+ };
14
+ /** The parts of a price, never markup (site campaigns spec §9.6, contract C8). Every part except `price` is null when it must not
15
+ * show; render exactly what is here. */
16
+ export type PriceDisplay = {
17
+ /** What is charged now; null when the offer shows no price. */
18
+ price: PricePart | null;
19
+ /** The legal reference (the lowest price of the 30 days before the reduction), only with a live claim. Never `regular`, never the RRP. */
20
+ struck: (PricePart & {
21
+ label: string;
22
+ labelKey: string;
23
+ longLabel: string;
24
+ }) | null;
25
+ /** "−20 %", only with a live claim. */
26
+ badge: string | null;
27
+ /** The claim's amount off, only with a live claim. */
28
+ saving: PricePart | null;
29
+ /** The recommended price (`compareAt`): only with no live sale and no claim shown (Kristoffer 2026-11-13). Never struck. */
30
+ rrp: PricePart | null;
31
+ /** The live sale's exclusive end (RFC 3339); null for an open-ended sale and for no sale. */
32
+ endsAt: string | null;
33
+ /** The live sale was extended (`sale.extendedFrom` set and passed). */
34
+ extended: boolean;
35
+ /** The `data-price-part` attribute value of each part. */
36
+ parts: Record<"price" | "struck" | "badge" | "saving" | "rrp" | "ends-at", string>;
37
+ };
38
+ /** The wording of a claim label key. */
39
+ export type PriceLabel = {
40
+ label: string;
41
+ longLabel: string;
42
+ };
43
+ export type PriceTexts = {
44
+ /** Per claim `labelKey`. A claim whose key has no text here is not shown. */
45
+ labels: Record<string, PriceLabel>;
46
+ /** The badge for a claim's percent. */
47
+ badge: (percent: number) => string;
48
+ };
49
+ export type PriceDisplayOptions = {
50
+ /** The request's instant: a sale or claim that has ended by then is not shown (a page may be served from a cache). */
51
+ now: Date;
52
+ /** BCP 47; the language picks the default texts (`sv`, else English). Default `sv`. */
53
+ locale?: string;
54
+ texts?: Partial<PriceTexts>;
55
+ };
56
+ export type LinePriceDisplayOptions = PriceDisplayOptions & {
57
+ /** The side of a cart line's pairs to show. Default `inc`. Checkout and order lines are always `inc`. */
58
+ basis?: "inc" | "ex";
59
+ /** The cart's or order's currency: required for checkout and order lines, which carry none of their own. */
60
+ currency?: string;
61
+ };
62
+ /** The language of the default texts: `sv`, else English. */
63
+ export declare const language: (locale: string | undefined) => "sv" | "en";
64
+ /** The sale that applies at `now`, or null: a sale whose exclusive `validTo` has passed is dropped (C8). */
65
+ export declare function liveSale(offer: OfferDto, now: Date): SalePriceDto | null;
66
+ /** The pair charged at `now`: the offer's price, or `regular` once its sale has ended (a page served from a cache past the
67
+ * end). Null when the offer is not `available`. */
68
+ export declare function currentPair(offer: OfferDto, now: Date): PricePairDto | null;
69
+ /**
70
+ * The price of an offer as parts (C8). Render every price through this on the request, with the request's `now`:
71
+ * - a `sale` whose `validTo` ≤ now is dropped, and with it the offer's `claim`: `price` is then `regular`;
72
+ * - a `claim` whose `endsAt` or `claimEndsAt` ≤ now is dropped; a live claim strikes `reference`, sale or not;
73
+ * - `rrp` (`compareAt`) shows only with no live sale and no claim shown: never beside a sale, claim or not
74
+ * (Kristoffer 2026-11-13).
75
+ * - `endsAt` is the exclusive end: show the date of `endsAt − 1 s` in the site's time zone.
76
+ */
77
+ export declare function priceDisplay(offer: OfferDto, opts: PriceDisplayOptions): PriceDisplay;
78
+ /**
79
+ * A line's unit price as parts (C8): the unit price charged, and its `claim` striking its `reference` (never
80
+ * `unitPriceBeforePromotions`). A cart line is live: its claim drops once `endsAt` or `claimEndsAt` ≤ now. A checkout or
81
+ * order line carries frozen evidence and is never dropped by `now`. Lines have no RRP and no sale end.
82
+ */
83
+ export declare function linePriceDisplay(line: CartLineDto, opts: LinePriceDisplayOptions): PriceDisplay;
84
+ export declare function linePriceDisplay(line: CheckoutCartLineDto | OrderLineDto, opts: LinePriceDisplayOptions & {
85
+ currency: string;
86
+ }): PriceDisplay;
87
+ export {};
@@ -0,0 +1,102 @@
1
+ const PARTS = { price: "price", struck: "struck", badge: "badge", saving: "saving", rrp: "rrp", "ends-at": "ends-at" };
2
+ const DEFAULT_TEXTS = {
3
+ sv: {
4
+ labels: { priorLowest: { label: "Tidigare lägsta pris", longLabel: "Lägsta pris de senaste 30 dagarna före prissänkningen" } },
5
+ badge: (p) => `−${p}\u00a0%`, // a no-break space: the badge never wraps
6
+ },
7
+ en: {
8
+ labels: { priorLowest: { label: "Previous lowest price", longLabel: "Lowest price in the 30 days before the reduction" } },
9
+ badge: (p) => `−${p}%`,
10
+ },
11
+ };
12
+ /** The language of the default texts: `sv`, else English. */
13
+ export const language = (locale) => ((locale ?? "sv").toLowerCase().split(/[-_]/)[0] === "sv" ? "sv" : "en");
14
+ function textsFor(opts) {
15
+ const base = DEFAULT_TEXTS[language(opts.locale)];
16
+ return { labels: { ...base.labels, ...opts.texts?.labels }, badge: opts.texts?.badge ?? base.badge };
17
+ }
18
+ /** Whether an exclusive end has not passed; null = no end. */
19
+ const before = (end, now) => end == null || now.getTime() < Date.parse(end);
20
+ const part = (pair, basis) => {
21
+ const amount = pair?.[basis];
22
+ return amount ? { amount, basis, currency: pair.currency } : null;
23
+ };
24
+ /** The sale that applies at `now`, or null: a sale whose exclusive `validTo` has passed is dropped (C8). */
25
+ export function liveSale(offer, now) {
26
+ const sale = offer.sale ?? null;
27
+ return sale !== null && before(sale.validTo, now) ? sale : null;
28
+ }
29
+ /** The pair charged at `now`: the offer's price, or `regular` once its sale has ended (a page served from a cache past the
30
+ * end). Null when the offer is not `available`. */
31
+ export function currentPair(offer, now) {
32
+ if (offer.offerStatus !== "available")
33
+ return null;
34
+ if (offer.sale != null && liveSale(offer, now) === null)
35
+ return offer.regular ?? null;
36
+ return offer.price ?? null;
37
+ }
38
+ const NO_CLAIM = { struck: null, badge: null, saving: null };
39
+ /** A claim strikes its `reference`, never anything else; without the reference amount or a label text it shows nothing. */
40
+ function claimParts(claim, reference, basis, texts) {
41
+ if (claim === null)
42
+ return NO_CLAIM;
43
+ const struck = part(reference, basis);
44
+ const label = Object.hasOwn(texts.labels, claim.labelKey) ? texts.labels[claim.labelKey] : undefined;
45
+ if (struck === null || label === undefined)
46
+ return NO_CLAIM;
47
+ return {
48
+ struck: { ...struck, labelKey: claim.labelKey, label: label.label, longLabel: label.longLabel },
49
+ badge: texts.badge(claim.percent),
50
+ saving: part(claim.amountOff, basis),
51
+ };
52
+ }
53
+ const empty = () => ({ price: null, ...NO_CLAIM, rrp: null, endsAt: null, extended: false, parts: { ...PARTS } });
54
+ /**
55
+ * The price of an offer as parts (C8). Render every price through this on the request, with the request's `now`:
56
+ * - a `sale` whose `validTo` ≤ now is dropped, and with it the offer's `claim`: `price` is then `regular`;
57
+ * - a `claim` whose `endsAt` or `claimEndsAt` ≤ now is dropped; a live claim strikes `reference`, sale or not;
58
+ * - `rrp` (`compareAt`) shows only with no live sale and no claim shown: never beside a sale, claim or not
59
+ * (Kristoffer 2026-11-13).
60
+ * - `endsAt` is the exclusive end: show the date of `endsAt − 1 s` in the site's time zone.
61
+ */
62
+ export function priceDisplay(offer, opts) {
63
+ const out = empty();
64
+ const basis = offer.displayBasis;
65
+ out.price = part(currentPair(offer, opts.now), basis);
66
+ if (out.price === null)
67
+ return out;
68
+ const sale = liveSale(offer, opts.now);
69
+ const saleEnded = offer.sale != null && sale === null;
70
+ const rawClaim = offer.claim ?? null;
71
+ const claim = rawClaim !== null && !saleEnded && before(rawClaim.endsAt, opts.now) && before(rawClaim.claimEndsAt, opts.now) ? rawClaim : null;
72
+ Object.assign(out, claimParts(claim, offer.reference ?? null, basis, textsFor(opts)));
73
+ if (sale === null && out.struck === null)
74
+ out.rrp = part(offer.compareAt, basis);
75
+ if (sale !== null) {
76
+ out.endsAt = sale.validTo ?? null;
77
+ const from = sale.extendedFrom ?? null;
78
+ out.extended = from !== null && opts.now.getTime() >= Date.parse(from);
79
+ }
80
+ return out;
81
+ }
82
+ const isCartLine = (line) => line.unitPrice !== undefined;
83
+ export function linePriceDisplay(line, opts) {
84
+ const out = empty();
85
+ const texts = textsFor(opts);
86
+ const reference = line.reference ?? null;
87
+ const rawClaim = line.claim ?? null;
88
+ if (isCartLine(line)) {
89
+ const basis = opts.basis ?? "inc";
90
+ out.price = part(line.unitPrice, basis);
91
+ if (out.price === null)
92
+ return out;
93
+ const claim = rawClaim !== null && before(rawClaim.endsAt, opts.now) && before(rawClaim.claimEndsAt, opts.now) ? rawClaim : null;
94
+ return Object.assign(out, claimParts(claim, reference, basis, texts));
95
+ }
96
+ // No currency known (a caller outside TypeScript's overloads): show no price rather than an unformattable one.
97
+ const currency = opts.currency ?? "";
98
+ out.price = line.unitPriceInc && currency !== "" ? { amount: line.unitPriceInc, basis: "inc", currency } : null;
99
+ if (out.price === null)
100
+ return out;
101
+ return Object.assign(out, claimParts(rawClaim, reference, "inc", texts));
102
+ }
package/dist/schema.d.ts CHANGED
@@ -1100,6 +1100,7 @@ export interface components {
1100
1100
  };
1101
1101
  CartLineDto: {
1102
1102
  availability: components["schemas"]["LineAvailability"];
1103
+ claim?: null | components["schemas"]["PriceClaimDto"];
1103
1104
  delivery: null | components["schemas"]["DeliveryRangeDto"];
1104
1105
  id: string;
1105
1106
  image: null | components["schemas"]["MediaDescriptorDto"];
@@ -1109,6 +1110,7 @@ export interface components {
1109
1110
  promotions: components["schemas"]["LinePromotionDto"][];
1110
1111
  /** Format: int32 */
1111
1112
  quantity: number | string;
1113
+ reference?: null | components["schemas"]["PricePairDto"];
1112
1114
  /** @description At least one. One segment: every unit costs unitPrice. Several: the units differ; unitPrice is the largest segment's (ties: the higher price) and linePrice the exact line amount. */
1113
1115
  segments: components["schemas"]["CartLineSegmentDto"][];
1114
1116
  sku: string;
@@ -1150,6 +1152,7 @@ export interface components {
1150
1152
  /** Format: int32 */
1151
1153
  promotionId: number | string;
1152
1154
  scope: components["schemas"]["PromotionScopeDto"];
1155
+ stage: components["schemas"]["PromotionStageDto"];
1153
1156
  };
1154
1157
  CartTokenDto: {
1155
1158
  token: string;
@@ -1189,6 +1192,7 @@ export interface components {
1189
1192
  };
1190
1193
  CheckoutCartLineDto: {
1191
1194
  availability: null | components["schemas"]["LineAvailability"];
1195
+ claim?: null | components["schemas"]["PriceClaimDto"];
1192
1196
  delivery: null | components["schemas"]["DeliveryRangeDto"];
1193
1197
  image: null | components["schemas"]["MediaDescriptorDto"];
1194
1198
  lineKey: null | string;
@@ -1203,6 +1207,7 @@ export interface components {
1203
1207
  promotions: components["schemas"]["LinePromotionDto"][];
1204
1208
  /** Format: int32 */
1205
1209
  quantity: number | string;
1210
+ reference?: null | components["schemas"]["PricePairDto"];
1206
1211
  segmentId: null | string;
1207
1212
  sku: string;
1208
1213
  unitPriceBeforePromotionsInc: null | string;
@@ -1642,12 +1647,14 @@ export interface components {
1642
1647
  role: string;
1643
1648
  };
1644
1649
  OfferDto: {
1650
+ claim?: null | components["schemas"]["PriceClaimDto"];
1645
1651
  compareAt: null | components["schemas"]["PricePairDto"];
1646
1652
  displayBasis: components["schemas"]["DisplayBasisDto"];
1647
1653
  listPrice: null | components["schemas"]["PricePairDto"];
1648
1654
  offerStatus: components["schemas"]["OfferStatusDto"];
1649
1655
  price: null | components["schemas"]["PricePairDto"];
1650
1656
  purchaseStatus: components["schemas"]["PurchaseStatusDto"];
1657
+ reference?: null | components["schemas"]["PricePairDto"];
1651
1658
  regular: null | components["schemas"]["PricePairDto"];
1652
1659
  sale: null | components["schemas"]["SalePriceDto"];
1653
1660
  stock: components["schemas"]["StockDto"];
@@ -1685,6 +1692,7 @@ export interface components {
1685
1692
  tracking: components["schemas"]["TrackingDto"][];
1686
1693
  };
1687
1694
  OrderLineDto: {
1695
+ claim?: null | components["schemas"]["PriceClaimDto"];
1688
1696
  id: string;
1689
1697
  lineKey: null | string;
1690
1698
  lineTotalBeforePromotionsInc: null | string;
@@ -1698,6 +1706,7 @@ export interface components {
1698
1706
  promotions: components["schemas"]["LinePromotionDto"][];
1699
1707
  /** Format: int32 */
1700
1708
  quantity: number | string;
1709
+ reference?: null | components["schemas"]["PricePairDto"];
1701
1710
  segmentId: null | string;
1702
1711
  sku: string;
1703
1712
  type: string;
@@ -1774,6 +1783,18 @@ export interface components {
1774
1783
  source: string;
1775
1784
  tax: components["schemas"]["DisplayBasisDto"];
1776
1785
  };
1786
+ PriceClaimDto: {
1787
+ amountOff: components["schemas"]["PricePairDto"];
1788
+ /** Format: date-time */
1789
+ claimEndsAt: null | string;
1790
+ /** Format: date-time */
1791
+ endsAt: null | string;
1792
+ labelKey: string;
1793
+ /** Format: int32 */
1794
+ percent: number;
1795
+ /** Format: date-time */
1796
+ since: string;
1797
+ };
1777
1798
  PriceFromDto: {
1778
1799
  price: components["schemas"]["PricePairDto"];
1779
1800
  variantId: string;
@@ -1864,7 +1885,7 @@ export interface components {
1864
1885
  variants: components["schemas"]["VariantDto"][] | null;
1865
1886
  };
1866
1887
  /** @enum {unknown} */
1867
- PromotionCodeReasonDto: "expired" | "notForAccount" | "notInMarket" | "notStarted" | "unavailable";
1888
+ PromotionCodeReasonDto: "expired" | "notForAccount" | "notInMarket" | "notStarted" | "superseded" | "unavailable";
1868
1889
  /** @enum {unknown} */
1869
1890
  PromotionCodeStatusDto: "applied" | "notApplicable";
1870
1891
  PromotionRefDto: {
@@ -1875,6 +1896,8 @@ export interface components {
1875
1896
  /** @enum {unknown} */
1876
1897
  PromotionScopeDto: "merchandise" | "shipping";
1877
1898
  /** @enum {unknown} */
1899
+ PromotionStageDto: "cart" | "item";
1900
+ /** @enum {unknown} */
1878
1901
  PurchaseStatusDto: "available" | "unavailable";
1879
1902
  /** @enum {unknown} */
1880
1903
  QuoteStatusDto: "complete" | "partial" | "unavailable";
@@ -1978,6 +2001,9 @@ export interface components {
1978
2001
  manufacturer: null | components["schemas"]["PartyDto"];
1979
2002
  };
1980
2003
  SalePriceDto: {
2004
+ /** Format: date-time */
2005
+ extendedFrom?: null | string;
2006
+ label?: null | string;
1981
2007
  price: components["schemas"]["PricePairDto"];
1982
2008
  /** Format: date-time */
1983
2009
  validFrom: null | string;
@@ -2164,6 +2190,8 @@ export interface components {
2164
2190
  markets: components["schemas"]["MarketDto"][];
2165
2191
  media: components["schemas"]["MediaDto"];
2166
2192
  name: string;
2193
+ /** Format: date-time */
2194
+ nextPriceBoundary?: null | string;
2167
2195
  offerPolicy: components["schemas"]["OfferPolicyDto"];
2168
2196
  preview: boolean;
2169
2197
  sellability: components["schemas"]["SellabilityDto"];
@@ -4426,9 +4454,9 @@ export interface operations {
4426
4454
  page?: number;
4427
4455
  /** @description Items per page, 1–100. Out of range is a 400 with code INVALID_PAGE. */
4428
4456
  pageSize?: number;
4429
- /** @description Sort key. An unknown one is not refused: it falls back to relevance with a SORT_UNKNOWN warning, because it usually comes from a stale bookmark. */
4430
- sort?: "name_asc" | "newest" | "popular" | "price_asc" | "price_desc" | "recommended" | "relevance";
4431
- /** @description Facet selection, sent as filter[key]=value. Several values for one facet are comma-separated; price is "min-max" and a boolean facet is "true". An unknown key is dropped with a FILTER_IGNORED warning. */
4457
+ /** @description Sort key. An unknown one is not refused: it falls back to relevance with a SORT_UNKNOWN warning, because it usually comes from a stale bookmark. discount (biggest discount first, then price ascending) is accepted on every site and offered in sort.available only on a site with item sales. */
4458
+ sort?: "discount" | "name_asc" | "newest" | "popular" | "price_asc" | "price_desc" | "recommended" | "relevance";
4459
+ /** @description Facet selection, sent as filter[key]=value. Several values for one facet are comma-separated; price is "min-max" and a boolean facet is "true". An unknown key is dropped with a FILTER_IGNORED warning. The key sale is reserved: filter[sale]=true lists only the products on sale in the request's market and country (never echoed in appliedFilters; any other value is dropped with FILTER_IGNORED). On a site with item sales the price sorts order by the sale-aware from-price first; a company context has no sale key, so the filter matches nothing there. */
4432
4460
  filter?: {
4433
4461
  [key: string]: string;
4434
4462
  };
@@ -6140,9 +6168,9 @@ export interface operations {
6140
6168
  page?: number;
6141
6169
  /** @description Items per page, 1–100. Out of range is a 400 with code INVALID_PAGE. */
6142
6170
  pageSize?: number;
6143
- /** @description Sort key. An unknown one is not refused: it falls back to relevance with a SORT_UNKNOWN warning, because it usually comes from a stale bookmark. */
6144
- sort?: "name_asc" | "newest" | "popular" | "price_asc" | "price_desc" | "recommended" | "relevance";
6145
- /** @description Facet selection, sent as filter[key]=value. Several values for one facet are comma-separated; price is "min-max" and a boolean facet is "true". An unknown key is dropped with a FILTER_IGNORED warning. */
6171
+ /** @description Sort key. An unknown one is not refused: it falls back to relevance with a SORT_UNKNOWN warning, because it usually comes from a stale bookmark. discount (biggest discount first, then price ascending) is accepted on every site and offered in sort.available only on a site with item sales. */
6172
+ sort?: "discount" | "name_asc" | "newest" | "popular" | "price_asc" | "price_desc" | "recommended" | "relevance";
6173
+ /** @description Facet selection, sent as filter[key]=value. Several values for one facet are comma-separated; price is "min-max" and a boolean facet is "true". An unknown key is dropped with a FILTER_IGNORED warning. The key sale is reserved: filter[sale]=true lists only the products on sale in the request's market and country (never echoed in appliedFilters; any other value is dropped with FILTER_IGNORED). On a site with item sales the price sorts order by the sale-aware from-price first; a company context has no sale key, so the filter matches nothing there. */
6146
6174
  filter?: {
6147
6175
  [key: string]: string;
6148
6176
  };
@@ -1,4 +1,5 @@
1
1
  import { gtinJsonLd } from "../gtin.js";
2
+ import { currentPair, liveSale } from "../price-display.js";
2
3
  import { jsonLdDescription, pickImages, productDescription, rejectRedirect, requireBinding } from "./shared.js";
3
4
  import { SeoError } from "./types.js";
4
5
  const PROPERTIES = ["size", "color", "material", "pattern"];
@@ -16,8 +17,20 @@ function availabilityOf(v, ctx) {
16
17
  }
17
18
  /** The variant's gross price (`inc`), whatever the page's display basis: schema.org offers carry the consumer price (SEO helper spec,
18
19
  * market model Google = inc-only). Null when the pair has no gross — the variant then gets no offer. */
19
- function offerAmount(v) {
20
- return v.offer.price?.inc ?? null;
20
+ function offerAmount(v, now) {
21
+ return (now === undefined ? v.offer.price : currentPair(v.offer, now))?.inc ?? null;
22
+ }
23
+ /** C8: the calendar date, in `timeZone`, of the last second of a live sale with an end (`validTo` is exclusive). */
24
+ function priceValidUntil(v, now, timeZone) {
25
+ if (now === undefined)
26
+ return {};
27
+ const end = liveSale(v.offer, now)?.validTo ?? null;
28
+ if (end === null)
29
+ return {};
30
+ const last = new Date(Date.parse(end) - 1000);
31
+ const parts = new Intl.DateTimeFormat("en-US", { timeZone, year: "numeric", month: "2-digit", day: "2-digit" }).formatToParts(last);
32
+ const get = (t) => parts.find((p) => p.type === t).value;
33
+ return { priceValidUntil: `${get("year")}-${get("month")}-${get("day")}` };
21
34
  }
22
35
  const brandNode = (label) => ({ "@type": "Brand", name: label });
23
36
  /** Spec §4.12: absolute http(s), distinct per variant; checked for every emitted variant, single path included. The
@@ -86,7 +99,7 @@ export function productJsonLd(p, ctx) {
86
99
  const list = p.variants ?? ctx.variants ?? null;
87
100
  const complete = p.variants !== null;
88
101
  const publicOffers = p.context?.customerKind === "anonymous";
89
- const offered = (v) => publicOffers && v.offer.offerStatus === "available" && offerAmount(v) !== null;
102
+ const offered = (v) => publicOffers && v.offer.offerStatus === "available" && offerAmount(v, ctx.now) !== null;
90
103
  // Variant URLs spec §6: a priced selection is always emitted, exactly once (deduplicated by id against the list).
91
104
  const sel = p.selectedVariant != null && offered(p.selectedVariant) ? p.selectedVariant : null;
92
105
  const merged = sel !== null && !(list ?? []).some((v) => v.id === sel.id) ? [...(list ?? []), sel] : (list ?? []);
@@ -105,8 +118,9 @@ export function productJsonLd(p, ctx) {
105
118
  });
106
119
  const offer = (v, url) => ({
107
120
  "@type": "Offer",
108
- price: offerAmount(v),
121
+ price: offerAmount(v, ctx.now),
109
122
  priceCurrency: v.offer.price.currency,
123
+ ...priceValidUntil(v, ctx.now, ctx.timeZone ?? "Europe/Stockholm"),
110
124
  availability: availabilityOf(v, ctx),
111
125
  url,
112
126
  ...offerExtras(ctx),
@@ -59,6 +59,12 @@ export type ProductJsonLdOptions = SeoContext & {
59
59
  itemCondition?: string;
60
60
  shippingDetails?: unknown;
61
61
  hasMerchantReturnPolicy?: unknown;
62
+ /** Site campaigns C8: the request's instant. Each offer's price is then the one charged at `now` (`priceDisplay`): a sale
63
+ * that has ended by then gives the regular price, and a live sale with an end sets `priceValidUntil`. Without it the
64
+ * offer's price is printed as sent, with no `priceValidUntil`. */
65
+ now?: Date;
66
+ /** The site's time zone for `priceValidUntil` (the calendar date of the sale's last second). Default `Europe/Stockholm`. */
67
+ timeZone?: string;
62
68
  };
63
69
  export type BreadcrumbLink = {
64
70
  name: string;
package/dist/site.d.ts ADDED
@@ -0,0 +1,8 @@
1
+ /**
2
+ * The revalidation interval of a page that shows prices (site campaigns C8, C10): the seconds until the site's
3
+ * `nextPriceBoundary` (the next instant a price, sale or claim changes), at most `max` (the 60 s frontend contract) and at
4
+ * least 1. No boundary (or an unreadable one) gives `max`.
5
+ */
6
+ export declare function nextRevalidateSeconds(site: {
7
+ nextPriceBoundary?: string | null;
8
+ }, now: Date, max?: number): number;
package/dist/site.js ADDED
@@ -0,0 +1,12 @@
1
+ /**
2
+ * The revalidation interval of a page that shows prices (site campaigns C8, C10): the seconds until the site's
3
+ * `nextPriceBoundary` (the next instant a price, sale or claim changes), at most `max` (the 60 s frontend contract) and at
4
+ * least 1. No boundary (or an unreadable one) gives `max`.
5
+ */
6
+ export function nextRevalidateSeconds(site, now, max = 60) {
7
+ const boundary = site.nextPriceBoundary ?? null;
8
+ const at = boundary === null ? Number.NaN : Date.parse(boundary);
9
+ if (Number.isNaN(at))
10
+ return Math.max(1, max);
11
+ return Math.max(1, Math.min(max, Math.ceil((at - now.getTime()) / 1000)));
12
+ }
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "0.52.0";
1
+ export declare const SDK_VERSION = "0.54.0";
package/dist/version.js CHANGED
@@ -1,2 +1,2 @@
1
1
  // Generated by scripts/version-file.mjs from package.json; do not edit or commit.
2
- export const SDK_VERSION = "0.52.0";
2
+ export const SDK_VERSION = "0.54.0";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@asstio-dev/storefront",
3
- "version": "0.52.0",
3
+ "version": "0.54.0",
4
4
  "description": "Typed client for the Asstio Storefront API (generated from OpenAPI).",
5
5
  "repository": {
6
6
  "type": "git",
@@ -54,7 +54,7 @@
54
54
  "test": "vitest run",
55
55
  "test:browser": "playwright test -c browser/playwright.config.ts",
56
56
  "check": "npm run version-file && npm run generate && npm run typecheck-examples && npm test && git diff --exit-code -- src/schema.d.ts && test -z \"$(git status --porcelain -- src/schema.d.ts)\"",
57
- "smoke": "node --input-type=module -e \"import(\\\"./dist/index.js\\\").then(m => { for (const f of [\\\"createStorefrontClient\\\", \\\"filterQuery\\\", \\\"encodeFilterValues\\\", \\\"decodeFilterValues\\\", \\\"pictureSources\\\", \\\"mediaUrl\\\", \\\"formatImage\\\", \\\"styleToCss\\\", \\\"startCheckout\\\", \\\"syncCheckout\\\", \\\"completeCheckout\\\", \\\"getCheckoutStatus\\\", \\\"liveShippingFor\\\", \\\"getOrder\\\", \\\"awaitCompletion\\\", \\\"mountCheckout\\\", \\\"productJsonLd\\\", \\\"gtinJsonLd\\\", \\\"breadcrumbJsonLd\\\", \\\"productHead\\\", \\\"collectionHead\\\", \\\"brandHead\\\", \\\"toNextMetadata\\\", \\\"sitemapEntries\\\", \\\"toNextSitemap\\\", \\\"jsonLdScript\\\", \\\"SeoError\\\", \\\"productFacts\\\", \\\"toGa4Item\\\", \\\"toGa4Ecommerce\\\", \\\"longestCategory\\\", \\\"AnalyticsError\\\", \\\"trackSearchEvents\\\", \\\"variantUrl\\\", \\\"readVariantParam\\\", \\\"variantQueryForApi\\\", \\\"redirectTarget\\\", \\\"displayPrice\\\", \\\"isPriceVisible\\\", \\\"isBuyable\\\", \\\"requireBinding\\\", \\\"hreflangFor\\\", \\\"isCheckoutContextMismatch\\\", \\\"consentNotice\\\"]) if (typeof m[f] !== \\\"function\\\") throw new Error(\\\"missing export \\\" + f) })\" && npm run smoke:account && npm run smoke:consent && npm run smoke:shopper",
57
+ "smoke": "node --input-type=module -e \"import(\\\"./dist/index.js\\\").then(m => { for (const f of [\\\"createStorefrontClient\\\", \\\"filterQuery\\\", \\\"encodeFilterValues\\\", \\\"decodeFilterValues\\\", \\\"pictureSources\\\", \\\"mediaUrl\\\", \\\"formatImage\\\", \\\"styleToCss\\\", \\\"startCheckout\\\", \\\"syncCheckout\\\", \\\"completeCheckout\\\", \\\"getCheckoutStatus\\\", \\\"liveShippingFor\\\", \\\"getOrder\\\", \\\"awaitCompletion\\\", \\\"mountCheckout\\\", \\\"productJsonLd\\\", \\\"gtinJsonLd\\\", \\\"breadcrumbJsonLd\\\", \\\"productHead\\\", \\\"collectionHead\\\", \\\"brandHead\\\", \\\"toNextMetadata\\\", \\\"sitemapEntries\\\", \\\"toNextSitemap\\\", \\\"jsonLdScript\\\", \\\"SeoError\\\", \\\"productFacts\\\", \\\"toGa4Item\\\", \\\"toGa4Ecommerce\\\", \\\"longestCategory\\\", \\\"AnalyticsError\\\", \\\"trackSearchEvents\\\", \\\"variantUrl\\\", \\\"readVariantParam\\\", \\\"variantQueryForApi\\\", \\\"redirectTarget\\\", \\\"displayPrice\\\", \\\"priceDisplay\\\", \\\"linePriceDisplay\\\", \\\"isPriceVisible\\\", \\\"isBuyable\\\", \\\"requireBinding\\\", \\\"hreflangFor\\\", \\\"isCheckoutContextMismatch\\\", \\\"consentNotice\\\"]) if (typeof m[f] !== \\\"function\\\") throw new Error(\\\"missing export \\\" + f) })\" && npm run smoke:account && npm run smoke:consent && npm run smoke:shopper",
58
58
  "smoke:consent": "node --input-type=module -e \"const checks = { \\\"./dist/consent/index.js\\\": [\\\"parseConsent\\\", \\\"parseRefusal\\\", \\\"serializeConsent\\\", \\\"serializeRefusal\\\", \\\"ConsentCookieTooLarge\\\", \\\"withEntry\\\", \\\"withoutEntries\\\", \\\"withoutOwner\\\", \\\"grantedFor\\\", \\\"fold\\\", \\\"refusalBlocks\\\", \\\"refusalMark\\\", \\\"isFallback\\\", \\\"consentCookieNames\\\", \\\"consentNotice\\\", \\\"createConsentCoordinator\\\"], \\\"./dist/consent/server.js\\\": [\\\"readConsentCookie\\\", \\\"consentOwner\\\", \\\"tokenOwner\\\", \\\"accountOwner\\\"] }; for (const [file, names] of Object.entries(checks)) { const m = await import(file); for (const f of names) if (typeof m[f] !== \\\"function\\\") throw new Error(\\\"missing export \\\" + f + \\\" in \\\" + file); } const c = await import(\\\"./dist/consent/index.js\\\"); for (const n of [\\\"MAX_UNSYNCED\\\", \\\"MAX_UNSYNCED_READ\\\", \\\"PENDING_TTL_MS\\\", \\\"PUT_TIMEOUT_MS\\\"]) if (typeof c[n] !== \\\"number\\\") throw new Error(\\\"missing constant \\\" + n);\"",
59
59
  "smoke:shopper": "node --input-type=module -e \"import(\\\"./dist/shopper/index.js\\\").then(m => { if (typeof m.cancelWatchByToken !== \\\"function\\\") throw new Error(\\\"missing export cancelWatchByToken\\\") })\"",
60
60
  "smoke:account": "node --input-type=module -e \"const checks = { \\\"./dist/account/index.js\\\": [\\\"createShopperClient\\\", \\\"startSignIn\\\", \\\"verifySignIn\\\", \\\"signOut\\\", \\\"switchPrincipal\\\", \\\"getSession\\\", \\\"getMe\\\", \\\"getMyCompany\\\", \\\"linkChallengeId\\\", \\\"linkToken\\\", \\\"sessionCookie\\\", \\\"signInCookie\\\", \\\"cartCookie\\\", \\\"browserCartCookie\\\", \\\"copyBrowserCart\\\", \\\"CopyBrowserCartError\\\", \\\"cookieSecurity\\\", \\\"readSignInCookie\\\", \\\"serializeCookie\\\", \\\"shopperCookie\\\", \\\"accountResult\\\", \\\"shopperIpFrom\\\", \\\"assertSameOrigin\\\", \\\"safeReturnPath\\\", \\\"CrossOriginError\\\"], \\\"./dist/account/browser.js\\\": [\\\"readLinkFragment\\\", \\\"withShopperLock\\\"], \\\"./dist/account/next.js\\\": [\\\"startSignInAction\\\", \\\"verifySignInAction\\\", \\\"signOutAction\\\", \\\"switchPrincipalAction\\\", \\\"shopperClient\\\", \\\"copyBrowserCartAction\\\", \\\"shopperActions\\\"] }; for (const [file, names] of Object.entries(checks)) { const m = await import(file); for (const f of names) if (typeof m[f] !== \\\"function\\\") throw new Error(\\\"missing export \\\" + f + \\\" in \\\" + file); }\""
package/src/schema.d.ts CHANGED
@@ -1100,6 +1100,7 @@ export interface components {
1100
1100
  };
1101
1101
  CartLineDto: {
1102
1102
  availability: components["schemas"]["LineAvailability"];
1103
+ claim?: null | components["schemas"]["PriceClaimDto"];
1103
1104
  delivery: null | components["schemas"]["DeliveryRangeDto"];
1104
1105
  id: string;
1105
1106
  image: null | components["schemas"]["MediaDescriptorDto"];
@@ -1109,6 +1110,7 @@ export interface components {
1109
1110
  promotions: components["schemas"]["LinePromotionDto"][];
1110
1111
  /** Format: int32 */
1111
1112
  quantity: number | string;
1113
+ reference?: null | components["schemas"]["PricePairDto"];
1112
1114
  /** @description At least one. One segment: every unit costs unitPrice. Several: the units differ; unitPrice is the largest segment's (ties: the higher price) and linePrice the exact line amount. */
1113
1115
  segments: components["schemas"]["CartLineSegmentDto"][];
1114
1116
  sku: string;
@@ -1150,6 +1152,7 @@ export interface components {
1150
1152
  /** Format: int32 */
1151
1153
  promotionId: number | string;
1152
1154
  scope: components["schemas"]["PromotionScopeDto"];
1155
+ stage: components["schemas"]["PromotionStageDto"];
1153
1156
  };
1154
1157
  CartTokenDto: {
1155
1158
  token: string;
@@ -1189,6 +1192,7 @@ export interface components {
1189
1192
  };
1190
1193
  CheckoutCartLineDto: {
1191
1194
  availability: null | components["schemas"]["LineAvailability"];
1195
+ claim?: null | components["schemas"]["PriceClaimDto"];
1192
1196
  delivery: null | components["schemas"]["DeliveryRangeDto"];
1193
1197
  image: null | components["schemas"]["MediaDescriptorDto"];
1194
1198
  lineKey: null | string;
@@ -1203,6 +1207,7 @@ export interface components {
1203
1207
  promotions: components["schemas"]["LinePromotionDto"][];
1204
1208
  /** Format: int32 */
1205
1209
  quantity: number | string;
1210
+ reference?: null | components["schemas"]["PricePairDto"];
1206
1211
  segmentId: null | string;
1207
1212
  sku: string;
1208
1213
  unitPriceBeforePromotionsInc: null | string;
@@ -1642,12 +1647,14 @@ export interface components {
1642
1647
  role: string;
1643
1648
  };
1644
1649
  OfferDto: {
1650
+ claim?: null | components["schemas"]["PriceClaimDto"];
1645
1651
  compareAt: null | components["schemas"]["PricePairDto"];
1646
1652
  displayBasis: components["schemas"]["DisplayBasisDto"];
1647
1653
  listPrice: null | components["schemas"]["PricePairDto"];
1648
1654
  offerStatus: components["schemas"]["OfferStatusDto"];
1649
1655
  price: null | components["schemas"]["PricePairDto"];
1650
1656
  purchaseStatus: components["schemas"]["PurchaseStatusDto"];
1657
+ reference?: null | components["schemas"]["PricePairDto"];
1651
1658
  regular: null | components["schemas"]["PricePairDto"];
1652
1659
  sale: null | components["schemas"]["SalePriceDto"];
1653
1660
  stock: components["schemas"]["StockDto"];
@@ -1685,6 +1692,7 @@ export interface components {
1685
1692
  tracking: components["schemas"]["TrackingDto"][];
1686
1693
  };
1687
1694
  OrderLineDto: {
1695
+ claim?: null | components["schemas"]["PriceClaimDto"];
1688
1696
  id: string;
1689
1697
  lineKey: null | string;
1690
1698
  lineTotalBeforePromotionsInc: null | string;
@@ -1698,6 +1706,7 @@ export interface components {
1698
1706
  promotions: components["schemas"]["LinePromotionDto"][];
1699
1707
  /** Format: int32 */
1700
1708
  quantity: number | string;
1709
+ reference?: null | components["schemas"]["PricePairDto"];
1701
1710
  segmentId: null | string;
1702
1711
  sku: string;
1703
1712
  type: string;
@@ -1774,6 +1783,18 @@ export interface components {
1774
1783
  source: string;
1775
1784
  tax: components["schemas"]["DisplayBasisDto"];
1776
1785
  };
1786
+ PriceClaimDto: {
1787
+ amountOff: components["schemas"]["PricePairDto"];
1788
+ /** Format: date-time */
1789
+ claimEndsAt: null | string;
1790
+ /** Format: date-time */
1791
+ endsAt: null | string;
1792
+ labelKey: string;
1793
+ /** Format: int32 */
1794
+ percent: number;
1795
+ /** Format: date-time */
1796
+ since: string;
1797
+ };
1777
1798
  PriceFromDto: {
1778
1799
  price: components["schemas"]["PricePairDto"];
1779
1800
  variantId: string;
@@ -1864,7 +1885,7 @@ export interface components {
1864
1885
  variants: components["schemas"]["VariantDto"][] | null;
1865
1886
  };
1866
1887
  /** @enum {unknown} */
1867
- PromotionCodeReasonDto: "expired" | "notForAccount" | "notInMarket" | "notStarted" | "unavailable";
1888
+ PromotionCodeReasonDto: "expired" | "notForAccount" | "notInMarket" | "notStarted" | "superseded" | "unavailable";
1868
1889
  /** @enum {unknown} */
1869
1890
  PromotionCodeStatusDto: "applied" | "notApplicable";
1870
1891
  PromotionRefDto: {
@@ -1875,6 +1896,8 @@ export interface components {
1875
1896
  /** @enum {unknown} */
1876
1897
  PromotionScopeDto: "merchandise" | "shipping";
1877
1898
  /** @enum {unknown} */
1899
+ PromotionStageDto: "cart" | "item";
1900
+ /** @enum {unknown} */
1878
1901
  PurchaseStatusDto: "available" | "unavailable";
1879
1902
  /** @enum {unknown} */
1880
1903
  QuoteStatusDto: "complete" | "partial" | "unavailable";
@@ -1978,6 +2001,9 @@ export interface components {
1978
2001
  manufacturer: null | components["schemas"]["PartyDto"];
1979
2002
  };
1980
2003
  SalePriceDto: {
2004
+ /** Format: date-time */
2005
+ extendedFrom?: null | string;
2006
+ label?: null | string;
1981
2007
  price: components["schemas"]["PricePairDto"];
1982
2008
  /** Format: date-time */
1983
2009
  validFrom: null | string;
@@ -2164,6 +2190,8 @@ export interface components {
2164
2190
  markets: components["schemas"]["MarketDto"][];
2165
2191
  media: components["schemas"]["MediaDto"];
2166
2192
  name: string;
2193
+ /** Format: date-time */
2194
+ nextPriceBoundary?: null | string;
2167
2195
  offerPolicy: components["schemas"]["OfferPolicyDto"];
2168
2196
  preview: boolean;
2169
2197
  sellability: components["schemas"]["SellabilityDto"];
@@ -4426,9 +4454,9 @@ export interface operations {
4426
4454
  page?: number;
4427
4455
  /** @description Items per page, 1–100. Out of range is a 400 with code INVALID_PAGE. */
4428
4456
  pageSize?: number;
4429
- /** @description Sort key. An unknown one is not refused: it falls back to relevance with a SORT_UNKNOWN warning, because it usually comes from a stale bookmark. */
4430
- sort?: "name_asc" | "newest" | "popular" | "price_asc" | "price_desc" | "recommended" | "relevance";
4431
- /** @description Facet selection, sent as filter[key]=value. Several values for one facet are comma-separated; price is "min-max" and a boolean facet is "true". An unknown key is dropped with a FILTER_IGNORED warning. */
4457
+ /** @description Sort key. An unknown one is not refused: it falls back to relevance with a SORT_UNKNOWN warning, because it usually comes from a stale bookmark. discount (biggest discount first, then price ascending) is accepted on every site and offered in sort.available only on a site with item sales. */
4458
+ sort?: "discount" | "name_asc" | "newest" | "popular" | "price_asc" | "price_desc" | "recommended" | "relevance";
4459
+ /** @description Facet selection, sent as filter[key]=value. Several values for one facet are comma-separated; price is "min-max" and a boolean facet is "true". An unknown key is dropped with a FILTER_IGNORED warning. The key sale is reserved: filter[sale]=true lists only the products on sale in the request's market and country (never echoed in appliedFilters; any other value is dropped with FILTER_IGNORED). On a site with item sales the price sorts order by the sale-aware from-price first; a company context has no sale key, so the filter matches nothing there. */
4432
4460
  filter?: {
4433
4461
  [key: string]: string;
4434
4462
  };
@@ -6140,9 +6168,9 @@ export interface operations {
6140
6168
  page?: number;
6141
6169
  /** @description Items per page, 1–100. Out of range is a 400 with code INVALID_PAGE. */
6142
6170
  pageSize?: number;
6143
- /** @description Sort key. An unknown one is not refused: it falls back to relevance with a SORT_UNKNOWN warning, because it usually comes from a stale bookmark. */
6144
- sort?: "name_asc" | "newest" | "popular" | "price_asc" | "price_desc" | "recommended" | "relevance";
6145
- /** @description Facet selection, sent as filter[key]=value. Several values for one facet are comma-separated; price is "min-max" and a boolean facet is "true". An unknown key is dropped with a FILTER_IGNORED warning. */
6171
+ /** @description Sort key. An unknown one is not refused: it falls back to relevance with a SORT_UNKNOWN warning, because it usually comes from a stale bookmark. discount (biggest discount first, then price ascending) is accepted on every site and offered in sort.available only on a site with item sales. */
6172
+ sort?: "discount" | "name_asc" | "newest" | "popular" | "price_asc" | "price_desc" | "recommended" | "relevance";
6173
+ /** @description Facet selection, sent as filter[key]=value. Several values for one facet are comma-separated; price is "min-max" and a boolean facet is "true". An unknown key is dropped with a FILTER_IGNORED warning. The key sale is reserved: filter[sale]=true lists only the products on sale in the request's market and country (never echoed in appliedFilters; any other value is dropped with FILTER_IGNORED). On a site with item sales the price sorts order by the sale-aware from-price first; a company context has no sale key, so the filter matches nothing there. */
6146
6174
  filter?: {
6147
6175
  [key: string]: string;
6148
6176
  };