@ikas/bp-storefront 2.6.1 → 2.8.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.
@@ -45,6 +45,8 @@ export type TypographyToken = {
45
45
  resolved: Record<string, string>;
46
46
  /** Class selector the editor emits for this text style, e.g. `_<id>`. */
47
47
  className: string;
48
+ /** True when this is the theme's default/global text style (the editor's "Make Default Style"). */
49
+ isDefault: boolean;
48
50
  };
49
51
  export type BreakpointToken = {
50
52
  id: string;
@@ -118,29 +120,24 @@ export type ThemeGlobals = {
118
120
  };
119
121
  };
120
122
  /**
121
- * Stamps a theme-token type as its RUNTIME view returned by the `@ikas/bp-storefront` getters
122
- * (`getThemeColors` / `getThemeTypography` / ...). `name` is removed, then re-added as a
123
- * DEPRECATED `never`. Plainly `Omit`-ing it would only ever surface a bare "Property 'name' does
124
- * not exist on type" — re-adding it as a documented `@deprecated never` instead means a developer
125
- * who reaches for `.name` at runtime sees the strikethrough + the explanation below on hover, and
126
- * any actual use of the value is a type error (`never`). The agent is steered the same way.
123
+ * Stamps a theme-token type as its RUNTIME view (what the `@ikas/bp-storefront` getters return).
124
+ * `name` is authoring-only: it is non-unique (two design assets can ship the same one) and
125
+ * non-stable (renaming must not break references), so matching a token by name is unsafe.
126
+ * Identify one by its STABLE `id` instead — color → `cssVar` (`var(--<id>)`), typography &
127
+ * keyframe → `className` / `ref` (`_<id>`), color-scheme slot → a `colorsByScheme` key. Need a
128
+ * human-readable label? Read `list_theme_globals` (MCP/CLI) or the editor's Styles panel.
129
+ *
130
+ * `name` is REMOVED outright rather than re-added as a documented `@deprecated never`: that was
131
+ * tried first and only yields a soft strikethrough, so `getThemeTypography().find(t => t.name ===
132
+ * "…")` still compiled and agents wrote it anyway. A hard `Omit` makes it a compile error, and
133
+ * `ikas-component build` runs `tsc --noEmit` and exits non-zero on it — so such a component cannot
134
+ * be built or shipped at all.
127
135
  *
128
- * The full types above (with a real `name: string`) are still produced in the serialized
129
- * {@link ThemeGlobals} payload and surfaced by the CLI/MCP `list-theme-globals` AUTHORING read, so
130
- * the agent/editor can still discover and reuse existing tokens by name. `name` is hidden ONLY at
131
- * the runtime getter return types (the getters cast the live payload to these views).
136
+ * The full {@link ThemeGlobals} (with real names) is still what the config holds and what the
137
+ * CLI/MCP `list-theme-globals` AUTHORING read returns — that is how an agent resolves "the token
138
+ * named X" to its id. `name` is hidden only at these runtime getter return types.
132
139
  */
133
- type RuntimeView<T> = Omit<T, "name"> & {
134
- /**
135
- * @deprecated `name` is authoring-only and is NOT exposed at runtime. Identify this token by its
136
- * STABLE `id` instead — color → `cssVar` (`var(--<id>)`), typography & keyframe → `className` /
137
- * `ref` (`_<id>`), color-scheme slot → a `colorsByScheme` key. Token names are non-unique (two
138
- * design assets can ship the same name) and renaming one must not break references, so matching
139
- * by name is unsafe. Need a human-readable label? Read it from `list_theme_globals` (MCP/CLI) or
140
- * the editor's Styles panel — not from the runtime getters.
141
- */
142
- name?: never;
143
- };
140
+ type RuntimeView<T> = Omit<T, "name">;
144
141
  export type RuntimeDesignToken = RuntimeView<DesignToken>;
145
142
  export type RuntimeTypographyToken = RuntimeView<TypographyToken>;
146
143
  export type RuntimeBreakpointToken = RuntimeView<BreakpointToken>;
@@ -180,6 +177,7 @@ type PatternElementLike = {
180
177
  id: string;
181
178
  name?: string;
182
179
  styles?: ElementStyleLike[];
180
+ isDefault?: boolean;
183
181
  };
184
182
  type ColorSchemeLike = {
185
183
  id: string;
@@ -273,6 +271,18 @@ export declare const toResolverBreakpoints: (breakpoints: {
273
271
  * (code-generator, editor canvas). Unknown ids are left untouched (the partner dependency
274
272
  * collector ships referenced breakpoints into the target theme, so a real token always resolves).
275
273
  * The `bp(<id>)` literal carries its own `)` boundary, so one id is never matched inside another.
274
+ *
275
+ * A `calc()` containing a bp token (e.g. the documented exclusive boundary
276
+ * `calc(bp(<id>) + 1px)`, but any pure px arithmetic: `calc(bp(a) * 2 + 10px)`,
277
+ * `calc(bp(a) - bp(b))`, `-webkit-calc(...)`, …) is folded to a single computed `<width>px`
278
+ * literal, never emitted as `calc()`: csso — the code-generator's minifier for inline/base
279
+ * page styles — silently drops a media block whose condition contains `calc()`, and older
280
+ * browsers (e.g. Safari < 16.4) don't evaluate `calc()` in media conditions either.
281
+ *
282
+ * Folding limits (an out-of-limit calc degrades to plain token substitution, keeping its
283
+ * `calc()` form — which csso will still drop from a media condition): bodies longer than
284
+ * CALC_SCAN_LIMIT chars; an uppercase `CALC(` keyword (the scan is lowercase, matching every
285
+ * compiled-CSS emitter); `calc(` inside a string/comment can confuse the plain-text scan.
276
286
  */
277
287
  export declare function resolveBreakpointMediaTokens(css: string, breakpoints: {
278
288
  id: string;
@@ -157,6 +157,7 @@ export * from "./models/product/campaign/filter";
157
157
  export * from "./models/product/campaign/product-buyx-then-gety";
158
158
  export * from "./models/product/campaign/product-campaign-date-range-field";
159
159
  export * from "./models/product/campaign/product-fixed-discount";
160
+ export * from "./models/product/campaign/product-tiered-discount";
160
161
  export * from "./models/product/campaign-offer";
161
162
  export * from "./models/product/filter";
162
163
  export * from "./models/product/group";
@@ -10,4 +10,9 @@ export type IkasProductAttribute = {
10
10
  tableTemplate: IkasProductAttributeTableTemplate | null;
11
11
  translations?: IkasProductAttributeTranslation[] | null;
12
12
  };
13
- export type IkasProductAttributeType = "CHOICE" | "MULTIPLE_CHOICE" | "TEXT" | "BOOLEAN" | "NUMERIC" | "DATETIME" | "HTML" | "TABLE" | "IMAGE" | "PRODUCT";
13
+ /**
14
+ * Mirror of the API's `ProductAttributeTypeEnum` (see storefront-api `__api/types`). The API value is
15
+ * force-cast into this union when products are mapped (`functions/api/product`), so a value missing
16
+ * here still arrives at runtime — it just stops being visible to the compiler. Keep both lists in sync.
17
+ */
18
+ export type IkasProductAttributeType = "CHOICE" | "MULTIPLE_CHOICE" | "COLOR_THUMBNAIL_MULTIPLE_CHOICE" | "TEXT" | "BOOLEAN" | "NUMERIC" | "DATE" | "DATETIME" | "HTML" | "TABLE" | "IMAGE" | "PRODUCT";
@@ -1,6 +1,7 @@
1
1
  import { IkasProductBuyXThenGetY } from "../product-buyx-then-gety";
2
2
  import { IkasProductCampaignDateRangeField } from "../product-campaign-date-range-field";
3
3
  import { IkasProductFixedDiscount } from "../product-fixed-discount";
4
+ import { IkasProductTieredDiscount } from "../product-tiered-discount";
4
5
  export type IkasProductCampaignData = {
5
6
  applicableCustomerGroupIds: string[] | null;
6
7
  applicableCustomerIds: string[] | null;
@@ -21,6 +22,7 @@ export type IkasProductCampaignData = {
21
22
  usageCount: number;
22
23
  usageLimit: number | null;
23
24
  usageLimitPerCustomer: number | null;
25
+ tieredDiscount: IkasProductTieredDiscount | null;
24
26
  };
25
27
  export type IkasCampaignApplicablePrice = "DISCOUNT_PRICE" | "SELL_PRICE";
26
28
  export type IkasCampaignCreatedFor = "ABANDONED_CHECKOUT" | "CART" | "CUSTOMER_REVIEW";
@@ -2,4 +2,4 @@ export type IkasProductCampaignFilter = {
2
2
  idList: string[];
3
3
  type: IkasCampaignFilterType;
4
4
  };
5
- export type IkasCampaignFilterType = "CATEGORY" | "PRODUCT" | "PRODUCT_BRAND" | "PRODUCT_TAG" | "VARIANT";
5
+ export type IkasCampaignFilterType = "CATEGORY" | "PRODUCT" | "PRODUCT_BRAND" | "PRODUCT_TAG" | "VARIANT" | "PRODUCT_AND_VARIANT";
@@ -0,0 +1,13 @@
1
+ import { IkasProductCampaignFilter } from "../filter";
2
+ import { IkasCampaignMinMaxRangeField } from "../product-fixed-discount";
3
+ export type IkasProductTieredDiscountRule = {
4
+ amount: number | null;
5
+ lineItemQuantityRange: IkasCampaignMinMaxRangeField | null;
6
+ priceRange: IkasCampaignMinMaxRangeField | null;
7
+ };
8
+ export type IkasProductTieredDiscount = {
9
+ filters: IkasProductCampaignFilter[] | null;
10
+ isApplyByCartAmount: boolean | null;
11
+ rules: IkasProductTieredDiscountRule[];
12
+ shouldMatchAllConditions: boolean | null;
13
+ };
@@ -29,3 +29,20 @@ export type IkasAppliedCampaignAmount = {
29
29
  formattedPrice: string | null;
30
30
  discountPercentage: string | null;
31
31
  };
32
+ export type IkasTieredDiscountProduct = {
33
+ amount: number | null;
34
+ lineItemQuantityRange: {
35
+ min: number;
36
+ max: number;
37
+ };
38
+ type: IkasCampaignType;
39
+ sellPrice: number;
40
+ finalPrice: number;
41
+ sellPriceWithQuantity: number;
42
+ finalPriceWithQuantity: number;
43
+ formattedSellPrice: string;
44
+ formattedSellPriceWithQuantity: string;
45
+ formattedFinalPrice: string;
46
+ formattedFinalPriceWithQuantity: string;
47
+ salesChannelIds: string[] | null;
48
+ };
@@ -1 +1 @@
1
- import{__assign as r}from'./../ext/tslib/tslib.es6.mjs.js';import{createElement as t}from'./../ext/preact/dist/preact.mjs.js';import{useRef as n,useMemo as e,useEffect as o}from'./../ext/preact/hooks/dist/hooks.mjs.js';var c={};function a(r,t){for(var n=[],e=r;e;){var o=e.getAttribute("id");o&&n.unshift(o),e=e.parentElement}var c=n.map(function(r){return'[id="'.concat(r,'"]')}).join(" ");return c?"".concat(c,' [id="').concat(t,'"]'):'[id="'.concat(t,'"]')}function u(u){var i=u.id,s=u.components,f=u.style,l=u.className,m=u.parentProps,d=void 0===m?c:m,p=u.map,v=void 0===p?c:p,h=n([]),y=n(d),j=n(v),g=n(null);y.current=d,j.current=v;var E=e(function(){return(Array.isArray(s)?s:s?[s]:[]).flat().filter(Boolean)},[s]);o(function(){if(0!==E.length){h.current.forEach(function(r){return r()}),h.current=[];for(var t=0;t<E.length;t++){var n=E[t];if(n.l){var e="".concat(i,"-").concat(t),o=a(g.current,e),c=n.l(o,r(r({},y.current),j.current),{},{id:e,key:e});"function"==typeof c&&h.current.push(c)}}return function(){h.current.forEach(function(r){return r()}),h.current=[]}}},[E,i]);var _=e(function(){return 0===E.length?"":E.map(function(t,n){var e="".concat(i,"-").concat(n);return t.r(r(r({},y.current),j.current),{},{id:e,key:e})}).join("")},[E,i]);return 0===E.length?null:t("div",{id:i,ref:g,dangerouslySetInnerHTML:{__html:_},style:r({display:"contents"},f),className:l})}export{u as IkasComponentRenderer};
1
+ import{__assign as t}from'./../ext/tslib/tslib.es6.mjs.js';import{createElement as r}from'./../ext/preact/dist/preact.mjs.js';import{useRef as n,useMemo as e,useEffect as c}from'./../ext/preact/hooks/dist/hooks.mjs.js';var o={},a="data-ikas-ccr",u=0;function i(t,r){if(!t)return function(t,r){for(var n=[],e=t;e;){var c=e.getAttribute("id");c&&n.unshift(c),e=e.parentElement}var o=n.map(function(t){return'[id="'.concat(t,'"]')}).join(" ");return o?"".concat(o,' [id="').concat(r,'"]'):'[id="'.concat(r,'"]')}(t,r);var n=t.getAttribute(a);return n||(n="r".concat(++u),t.setAttribute(a,n)),"[".concat(a,'="').concat(n,'"] > [id="').concat(r,'"]')}function s(a){var u=a.id,s=a.components,f=a.style,l=a.className,d=a.parentProps,m=void 0===d?o:d,p=a.map,v=void 0===p?o:p,h=n([]),y=n(m),j=n(v),g=n(null);y.current=m,j.current=v;var b=e(function(){return(Array.isArray(s)?s:s?[s]:[]).flat().filter(Boolean)},[s]);c(function(){if(0!==b.length){h.current.forEach(function(t){return t()}),h.current=[];for(var r=0;r<b.length;r++){var n=b[r];if(n.l){var e="".concat(u,"-").concat(r),c=i(g.current,e),o=n.l(c,t(t({},y.current),j.current),{},{id:e,key:e});"function"==typeof o&&h.current.push(o)}}return function(){h.current.forEach(function(t){return t()}),h.current=[]}}},[b,u]);var k=e(function(){return 0===b.length?"":b.map(function(r,n){var e="".concat(u,"-").concat(n);return r.r(t(t({},y.current),j.current),{},{id:e,key:e})}).join("")},[b,u]);return 0===b.length?null:r("div",{id:u,ref:g,dangerouslySetInnerHTML:{__html:k},style:t({display:"contents"},f),className:l})}export{s as IkasComponentRenderer};