@ikas/bp-storefront 1.4.0-beta.17 → 1.4.0-beta.171
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/analytics/analytics-functions/addToCart.js +1 -1
- package/dist/analytics/analytics-functions/addToWishlist.js +1 -1
- package/dist/analytics/analytics-functions/completeRegistration.js +1 -1
- package/dist/analytics/analytics-functions/contactForm.js +1 -1
- package/dist/analytics/analytics-functions/createEmailSubscription.js +1 -1
- package/dist/analytics/analytics-functions/customerLogin.js +1 -1
- package/dist/analytics/analytics-functions/customerLogout.js +1 -1
- package/dist/analytics/analytics-functions/customerVisit.js +1 -1
- package/dist/analytics/analytics-functions/pageView.js +1 -1
- package/dist/analytics/analytics-functions/productView.js +1 -1
- package/dist/analytics/analytics-functions/removeFromCart.js +1 -1
- package/dist/analytics/analytics-functions/search.js +1 -1
- package/dist/analytics/analytics-functions/viewBrand.js +1 -1
- package/dist/analytics/analytics-functions/viewCart.js +1 -1
- package/dist/analytics/analytics-functions/viewCategory.js +1 -1
- package/dist/analytics/analytics-functions/viewListing.js +1 -1
- package/dist/analytics/analytics-functions/viewSearchResults.js +1 -1
- package/dist/analytics/analytics-functions/viewStorefrontPopup.js +1 -1
- package/dist/analytics/events.d.ts +8 -0
- package/dist/analytics/events.js +1 -1
- package/dist/analytics/ikas/analytics.js +1 -1
- package/dist/functions/api/product/index.js +1 -1
- package/dist/functions/models/attribute-detail/index.d.ts +3 -0
- package/dist/functions/models/attribute-list/index.d.ts +3 -0
- package/dist/functions/models/image/index.d.ts +71 -21
- package/dist/functions/models/image/index.js +1 -1
- package/dist/functions/models/product/attribute-value/index.d.ts +5 -0
- package/dist/functions/models/product/variant/index.d.ts +96 -6
- package/dist/functions/models/product/variant/index.js +1 -1
- package/dist/functions/models/product-list/index.js +1 -1
- package/dist/functions/models/validator/address/index.d.ts +70 -2
- package/dist/functions/stores/base/index.d.ts +67 -0
- package/dist/functions/stores/base/index.js +1 -1
- package/dist/functions/stores/cart/index.d.ts +17 -2
- package/dist/functions/stores/cart/index.js +1 -1
- package/dist/functions/stores/customer/index.d.ts +65 -23
- package/dist/functions/stores/customer/index.js +1 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.js +1 -1
- package/dist/packages/storefront-api-client/src/utils/api.js +1 -1
- package/dist/packages/storefront-config/src/index.js +1 -1
- package/dist/packages/storefront-config/src/theme-globals.js +1 -0
- package/dist/router/index.d.ts +28 -0
- package/dist/router/index.js +1 -1
- package/dist/storefront-api/src/__api/types/index.d.ts +1 -1
- package/dist/storefront-api-client/src/utils/api.d.ts +7 -0
- package/dist/storefront-config/src/index.d.ts +4 -0
- package/dist/storefront-config/src/theme-globals.d.ts +305 -0
- package/dist/storefront-models/src/index.d.ts +1 -0
- package/dist/storefront-models/src/models/blueprint/prop-value/attribute-list.d.ts +2 -0
- package/dist/storefront-models/src/models/blueprint/prop-value/attribute.d.ts +2 -0
- package/dist/storefront-models/src/models/blueprint/prop-value/color.d.ts +2 -0
- package/dist/storefront-models/src/models/blueprint/prop-value/index.d.ts +1 -0
- package/dist/storefront-models/src/models/blueprint/prop-value/variable-binding.d.ts +16 -0
- package/dist/storefront-models/src/models/image/index.d.ts +7 -0
- package/dist/storefront-models/src/models/product/attribute/index.d.ts +6 -1
- package/dist/storefront-models/src/models/product/campaign/data/index.d.ts +2 -0
- package/dist/storefront-models/src/models/product/campaign/filter/index.d.ts +1 -1
- package/dist/storefront-models/src/models/product/campaign/product-tiered-discount/index.d.ts +13 -0
- package/dist/storefront-models/src/models/product/image/index.d.ts +5 -0
- package/dist/storefront-models/src/models/product/variant/index.d.ts +17 -0
- package/dist/theme/settings/index.d.ts +48 -0
- package/dist/theme/settings/index.js +1 -0
- package/dist/utils/component-renderer.js +1 -1
- package/dist/utils/currency.d.ts +36 -3
- package/dist/utils/pay-with-ikas.d.ts +552 -0
- package/dist/utils/pay-with-ikas.js +1 -0
- package/dist/utils/svg.d.ts +15 -0
- package/dist/utils/svg.js +1 -0
- package/package.json +1 -1
package/dist/router/index.d.ts
CHANGED
|
@@ -181,4 +181,32 @@ export declare class Router {
|
|
|
181
181
|
private static ensurePathPrefix;
|
|
182
182
|
}
|
|
183
183
|
export declare const router: Router;
|
|
184
|
+
/**
|
|
185
|
+
* Put the visitor's storefront routing in front of a path you wrote yourself.
|
|
186
|
+
*
|
|
187
|
+
* Entity links (`getProductHref`, `getIkasOrderHref`, …) and LINK props already carry the prefix.
|
|
188
|
+
* A literal path in your own markup does not: `href="/cart"` sends a visitor browsing `/en` to the
|
|
189
|
+
* default language. Wrap it, and a store with no extra routings gets the path back unchanged.
|
|
190
|
+
*
|
|
191
|
+
* Idempotent — a path that already starts with a supported routing segment is returned as-is.
|
|
192
|
+
* Anything that is not a path on this storefront — an absolute URL, `mailto:`, `tel:` — is returned
|
|
193
|
+
* untouched, so a merchant-authored prop can be wrapped without checking it first.
|
|
194
|
+
*
|
|
195
|
+
* @ai-category Navigation
|
|
196
|
+
* @ai-related navigate, navigateToPage
|
|
197
|
+
*
|
|
198
|
+
* @param path - A path on this storefront, starting with `/`
|
|
199
|
+
* @returns The path under the current routing (e.g. `/cart` → `/en/cart`)
|
|
200
|
+
*
|
|
201
|
+
* @example
|
|
202
|
+
* ```tsx
|
|
203
|
+
* import { Router, withRoutePrefix } from "@ikas/bp-storefront";
|
|
204
|
+
*
|
|
205
|
+
* // Correct href for crawlers, middle-click and open-in-new-tab...
|
|
206
|
+
* <a href={withRoutePrefix("/cart")} onClick={e => {
|
|
207
|
+
* e.preventDefault();
|
|
208
|
+
* Router.navigateToPage("CART"); // ...and this prefixes on its own.
|
|
209
|
+
* }}>Cart</a>
|
|
210
|
+
* ```
|
|
211
|
+
*/
|
|
184
212
|
export declare function withRoutePrefix(path: string): string;
|
package/dist/router/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{IkasStorefrontConfig as e}from"../packages/storefront-config/src/index.js";import{getCheckoutUrlFromCartStore as t}from"../functions/stores/cart/index.js";import{cartStore as a}from"../stores/cart/index.js";var r=function(){function r(){}return r.initialize=function(e,t){var a=this;this.window=t||window,this.currentPath=void 0!==this.window?this.window.location.pathname:"/",void 0!==this.window&&(r.pageParams=e,this.window.addEventListener("popstate",r.handlePopState),r.interceptAnchorClicks(),this.window.addEventListener("pageshow",function(e){return a.isFromBFCache=e.persisted}))},r.navigate=function(t,a,n){if(void 0===a&&(a=!1),void 0===n&&(n=!1),void 0!==this.window){var o=r.ensurePathPrefix(t);e.getIsPreview()||(a?this.window.history.replaceState({},"",o):n?this.window.open(o,"_blank"):this.window.location.href=o),r.handleRouteChange(o)}},r.navigateToPage=function(e,n,i,c,s){void 0===c&&(c=!1),void 0===s&&(s=!1);var u=Object.entries(i||{}).map(function(e){var t=e[0],a=e[1];return"".concat(t,"=").concat(encodeURIComponent(a))}).join("&"),h="";switch(e){case"INDEX":h="/";break;case"ACCOUNT":h="/account";break;case"ACTIVATE_CUSTOMER":h="/account/activate";break;case"ADDRESSES":h="/account/addresses";break;case"FAVORITE_PRODUCTS":h="/account/favorite-products";break;case"FORGOT_PASSWORD":h="/account/forgot-password";break;case"LOGIN":h="/account/login";break;case"RAFFLE_ACCOUNT":h="/account/raffles";break;case"RECOVER_PASSWORD":h="/account/recover-password";break;case"REGISTER":h="/account/register";break;case"ORDERS":h="/account/orders";break;case"ORDER_DETAIL":h="/account/orders/".concat(n);break;case"BLOG_INDEX":h="/blog";break;case"BLOG":case"BLOG_CATEGORY":h="/blog/".concat(n);break;case"CART":h="/cart";break;case"CHECKOUT":h=t(a);break;case"CUSTOM":h="/pages/".concat(n);break;case"RAFFLE":h="/raffle";break;case"RAFFLE_DETAIL":h="/raffle/".concat(n);break;case"SEARCH":h="/search";break;case"NOT_FOUND":h="/404"}u&&(h+="?".concat(u)),r.navigate(o(h),c,s)},r.addObserver=function(e){r.observers.push(e)},r.removeObserver=function(e){r.observers=r.observers.filter(function(t){return t!==e})},r.goBack=function(){this.window.history.back()},r.getCurrentPath=function(){return r.currentPath},r.getPageParams=function(){return r.pageParams},r.router_getQueryParams=function(){if(void 0===this.window)return{};var e={};return new URLSearchParams(this.window.location.search).forEach(function(t,a){e[a]=t}),e},r.handleRouteChange=function(e){r.currentPath=e,r.notifyObservers()},r.handlePopState=function(){void 0!==this.window&&r.handleRouteChange(this.window.location.pathname)},r.interceptAnchorClicks=function(){void 0!==this.window&&this.window.addEventListener("click",function(e){var t=e.target.closest("a");if(t&&"A"===t.tagName&&t.getAttribute("href")){var a=t.getAttribute("href");if(e.metaKey||e.ctrlKey)return;if(/^(mailto|tel|sms|javascript):/i.test(a))return;e.preventDefault();var n="_blank"===t.getAttribute("target");r.navigate(a,!1,n)}})},r.notifyObservers=function(){r.observers.forEach(function(e){return e(r.currentPath)})},r.ensurePathPrefix=function(e){return e.startsWith("http")||e.startsWith("/")?e:"/".concat(e)},r.currentPath="undefined"!=typeof window?window.location.pathname:"/",r.observers=[],r.pageParams={},r.isFromBFCache=!1,r}(),n=r;function o(t){var a=e.getCurrentPath(),r=t.split("/").filter(function(e){return""!==e})[0];return r&&e.getSupportedPaths().includes(r)?t:"".concat(a?"/".concat(a):"").concat(t).replace("//","/")}export{r as Router,n as router,o as withRoutePrefix};
|
|
1
|
+
import{IkasStorefrontConfig as e}from"../packages/storefront-config/src/index.js";import{getCheckoutUrlFromCartStore as t}from"../functions/stores/cart/index.js";import{cartStore as a}from"../stores/cart/index.js";var r=function(){function r(){}return r.initialize=function(e,t){var a=this;this.window=t||window,this.currentPath=void 0!==this.window?this.window.location.pathname:"/",void 0!==this.window&&(r.pageParams=e,this.window.addEventListener("popstate",r.handlePopState),r.interceptAnchorClicks(),this.window.addEventListener("pageshow",function(e){return a.isFromBFCache=e.persisted}))},r.navigate=function(t,a,n){if(void 0===a&&(a=!1),void 0===n&&(n=!1),void 0!==this.window){var o=r.ensurePathPrefix(t);e.getIsPreview()||(a?this.window.history.replaceState({},"",o):n?this.window.open(o,"_blank"):this.window.location.href=o),r.handleRouteChange(o)}},r.navigateToPage=function(e,n,i,c,s){void 0===c&&(c=!1),void 0===s&&(s=!1);var u=Object.entries(i||{}).map(function(e){var t=e[0],a=e[1];return"".concat(t,"=").concat(encodeURIComponent(a))}).join("&"),h="";switch(e){case"INDEX":h="/";break;case"ACCOUNT":h="/account";break;case"ACTIVATE_CUSTOMER":h="/account/activate";break;case"ADDRESSES":h="/account/addresses";break;case"FAVORITE_PRODUCTS":h="/account/favorite-products";break;case"FORGOT_PASSWORD":h="/account/forgot-password";break;case"LOGIN":h="/account/login";break;case"RAFFLE_ACCOUNT":h="/account/raffles";break;case"RECOVER_PASSWORD":h="/account/recover-password";break;case"REGISTER":h="/account/register";break;case"ORDERS":h="/account/orders";break;case"ORDER_DETAIL":h="/account/orders/".concat(n);break;case"BLOG_INDEX":h="/blog";break;case"BLOG":case"BLOG_CATEGORY":h="/blog/".concat(n);break;case"CART":h="/cart";break;case"CHECKOUT":h=t(a);break;case"CUSTOM":h="/pages/".concat(n);break;case"RAFFLE":h="/raffle";break;case"RAFFLE_DETAIL":h="/raffle/".concat(n);break;case"SEARCH":h="/search";break;case"NOT_FOUND":h="/404"}u&&(h+="?".concat(u)),r.navigate(o(h),c,s)},r.addObserver=function(e){r.observers.push(e)},r.removeObserver=function(e){r.observers=r.observers.filter(function(t){return t!==e})},r.goBack=function(){this.window.history.back()},r.getCurrentPath=function(){return r.currentPath},r.getPageParams=function(){return r.pageParams},r.router_getQueryParams=function(){if(void 0===this.window)return{};var e={};return new URLSearchParams(this.window.location.search).forEach(function(t,a){e[a]=t}),e},r.handleRouteChange=function(e){r.currentPath=e,r.notifyObservers()},r.handlePopState=function(){void 0!==this.window&&r.handleRouteChange(this.window.location.pathname)},r.interceptAnchorClicks=function(){void 0!==this.window&&this.window.addEventListener("click",function(e){var t=e.target.closest("a");if(t&&"A"===t.tagName&&t.getAttribute("href")){var a=t.getAttribute("href");if(e.metaKey||e.ctrlKey)return;if(/^(mailto|tel|sms|javascript):/i.test(a))return;e.preventDefault();var n="_blank"===t.getAttribute("target");r.navigate(a,!1,n)}})},r.notifyObservers=function(){r.observers.forEach(function(e){return e(r.currentPath)})},r.ensurePathPrefix=function(e){return e.startsWith("http")||e.startsWith("/")?e:"/".concat(e)},r.currentPath="undefined"!=typeof window?window.location.pathname:"/",r.observers=[],r.pageParams={},r.isFromBFCache=!1,r}(),n=r;function o(t){if(/^[a-z][a-z\d+.-]*:/i.test(t)||t.startsWith("//"))return t;var a=e.getCurrentPath(),r=t.split("/").filter(function(e){return""!==e})[0];return r&&e.getSupportedPaths().includes(r)?t:"".concat(a?"/".concat(a):"").concat(t).replace("//","/")}export{r as Router,n as router,o as withRoutePrefix};
|
|
@@ -49,7 +49,7 @@ export type LoyaltyProgramFilterTypeEnum = "LoyaltyProgramFilterTypeEnum" | "CAT
|
|
|
49
49
|
export type LoyaltyProgramMethodSpendingTypeEnum = "LoyaltyProgramMethodSpendingTypeEnum" | "FIXED_AMOUNT" | "FREE_PRODUCT" | "FREE_SHIPPING" | "RATIO";
|
|
50
50
|
export type LoyaltyProgramOrderStatusToWinPointsEnum = "LoyaltyProgramOrderStatusToWinPointsEnum" | "ORDER_CREATED" | "ORDER_DELIVERED" | "PAYMENT_COMPLETED";
|
|
51
51
|
export type LoyaltyProgramPointEarningTypeEnum = "LoyaltyProgramPointEarningTypeEnum" | "DYNAMIC_ORDER_AMOUNT" | "DYNAMIC_ORDER_QUANTITY" | "STATIC";
|
|
52
|
-
export type LoyaltyProgramPointHistoryTypeEnum = "LoyaltyProgramPointHistoryTypeEnum" | "EARN" | "SPEND" | "REFUND" | "REFILL";
|
|
52
|
+
export type LoyaltyProgramPointHistoryTypeEnum = "LoyaltyProgramPointHistoryTypeEnum" | "EARN" | "SPEND" | "REFUND" | "REFILL" | "MANUAL_EARN" | "MANUAL_DEDUCT";
|
|
53
53
|
export type MasterPassOperationTypeEnum = "MasterPassOperationTypeEnum" | "CHECK_MASTER_PASS_USER" | "DELETE_CARD" | "DIRECT_PURCHASE" | "FORGOT_PASSWORD" | "LIST_CARDS" | "PURCHASE" | "REGISTER_CARD";
|
|
54
54
|
export type MerchantSettingsAddressTypeEnum = "MerchantSettingsAddressTypeEnum" | "CORPORATE" | "INDIVIDUAL";
|
|
55
55
|
export type OrderAdjustmentEnum = "OrderAdjustmentEnum" | "DECREMENT" | "INCREMENT";
|
|
@@ -5,6 +5,12 @@ export default interface API<T> {
|
|
|
5
5
|
saveBulk?: (models: T[]) => Promise<APIResponse<any>>;
|
|
6
6
|
delete?: (idList: string[]) => Promise<APIResponse<any>>;
|
|
7
7
|
}
|
|
8
|
+
/**
|
|
9
|
+
* Error codes the SDK itself distinguishes. NOT exhaustive: the APIResponse
|
|
10
|
+
* constructor copies `extensions.code` from GraphQL errors verbatim, so
|
|
11
|
+
* `errorCodes` can carry backend codes that are not listed here (e.g.
|
|
12
|
+
* VARIANT_NOT_FOUND). Never build an exhaustive switch over this enum.
|
|
13
|
+
*/
|
|
8
14
|
export declare enum APIErrorCode {
|
|
9
15
|
ARGUMENT_VALIDATION_ERROR = "ARGUMENT_VALIDATION_ERROR",
|
|
10
16
|
UNAUTHENTICATED = "UNAUTHENTICATED",
|
|
@@ -15,6 +21,7 @@ export declare enum APIErrorCode {
|
|
|
15
21
|
REQUEST_CANCELLED = "REQUEST_CANCELLED",
|
|
16
22
|
DUPLICATE_KEY_ERROR = "DUPLICATE_KEY_ERROR",
|
|
17
23
|
CUSTOMER_ALREADY_SUBSCRIBED = "CUSTOMER_ALREADY_SUBSCRIBED",
|
|
24
|
+
MAX_QUANTITY_PER_CART_LIMIT_REACHED = "MAX_QUANTITY_PER_CART_LIMIT_REACHED",
|
|
18
25
|
UNKNOWN = "UNKNOWN"
|
|
19
26
|
}
|
|
20
27
|
export declare class APIResponse<T> {
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { IkasCustomerReviewSettings, IkasCustomerSettings, IkasIndexPageSeoSetting, IkasLoyaltyProgram, IkasMerchantSettings, IkasProductBackInStockSettings, IkasSalesChannelPaymentGateway, IkasStorefontMetaTemplates, IkasStorefrontB2BSettings, IkasStorefrontPopup, IkasStorefrontRouting, IkasStorefrontType, IkasThemeStockPreference } from "../../storefront-models/src";
|
|
2
|
+
import { ThemeGlobals } from "./theme-globals";
|
|
3
|
+
export * from "./theme-globals";
|
|
2
4
|
export declare class IkasStorefrontConfig {
|
|
3
5
|
static themeId?: string;
|
|
4
6
|
static apiUrl?: string;
|
|
@@ -27,6 +29,7 @@ export declare class IkasStorefrontConfig {
|
|
|
27
29
|
static tiktokPixelId?: string;
|
|
28
30
|
static stockPreference?: IkasThemeStockPreference;
|
|
29
31
|
static translations: Record<string, any>;
|
|
32
|
+
static themeGlobals: ThemeGlobals;
|
|
30
33
|
static storefrontJSScripts: string[];
|
|
31
34
|
static highPriorityStoreFrontJSScripts: string[];
|
|
32
35
|
static customerReviewSettings?: IkasCustomerReviewSettings | null;
|
|
@@ -100,6 +103,7 @@ export type IkasStorefrontConfigParams = {
|
|
|
100
103
|
tiktokPixelId?: string;
|
|
101
104
|
stockPreference?: IkasThemeStockPreference;
|
|
102
105
|
translations: Record<string, any>;
|
|
106
|
+
themeGlobals: ThemeGlobals;
|
|
103
107
|
storefrontJSScripts: string[];
|
|
104
108
|
highPriorityStoreFrontJSScripts: string[];
|
|
105
109
|
customerReviewSettings?: IkasCustomerReviewSettings | null;
|
|
@@ -0,0 +1,305 @@
|
|
|
1
|
+
export declare function cssVarCamelCase(str: string): string;
|
|
2
|
+
/**
|
|
3
|
+
* Shared "theme globals" contract — the serialized, runtime-readable form of the editor's
|
|
4
|
+
* global theme settings (the left "Styles" panel): global variables + design tokens
|
|
5
|
+
* (colors, typography, breakpoints, keyframes, color schemes).
|
|
6
|
+
*
|
|
7
|
+
* This is packed into `IkasStorefrontConfig.themeGlobals` and read by the
|
|
8
|
+
* `@ikas/bp-storefront` runtime API (getThemeSetting / getThemeColors / ...). The same
|
|
9
|
+
* payload is produced for SSR, client hydration, and the editor canvas via
|
|
10
|
+
* {@link serializeThemeGlobals}, and returned by the CLI/MCP `list-theme-globals` reader.
|
|
11
|
+
*/
|
|
12
|
+
/** Global-variable value kinds, mirrored from the editor sidebar `GlobalVariableType`. */
|
|
13
|
+
export type GlobalVariableType = "TEXT" | "RICH_TEXT" | "IMAGE" | "COLOR" | "NUMBER" | "BOOLEAN" | "BORDER" | "SHADOW";
|
|
14
|
+
/** A theme "global variable" (Theme Settings panel). `name` is the stable runtime key. */
|
|
15
|
+
export type ThemeSetting = {
|
|
16
|
+
/** Stable runtime key — the variable's `variableName` (e.g. `_6Q0KV7VGGM`). */
|
|
17
|
+
name: string;
|
|
18
|
+
/** Human-facing label. */
|
|
19
|
+
displayName: string;
|
|
20
|
+
type: GlobalVariableType;
|
|
21
|
+
/**
|
|
22
|
+
* Concrete value, discriminated by `type`:
|
|
23
|
+
* - TEXT/RICH_TEXT → string · NUMBER → number · BOOLEAN → boolean · COLOR → hex string.
|
|
24
|
+
* - IMAGE → an IkasImage REFERENCE, e.g. `{ id: "theme-images/<uuid>" }`. It has NO
|
|
25
|
+
* `.url` field — resolve to a URL with `getDefaultSrc(value)` / `getSrc(value, size)`
|
|
26
|
+
* from `@ikas/bp-storefront`, never read `value.url`.
|
|
27
|
+
* - BORDER/SHADOW → object, or `null` when unset.
|
|
28
|
+
*/
|
|
29
|
+
value: any;
|
|
30
|
+
};
|
|
31
|
+
/** A single-value design token (color). `cssVar` resolves the live, scheme-aware value. */
|
|
32
|
+
export type DesignToken = {
|
|
33
|
+
id: string;
|
|
34
|
+
name: string;
|
|
35
|
+
/** Resolved base/default value (e.g. a hex string), or null when unset. */
|
|
36
|
+
resolved: string | null;
|
|
37
|
+
/** CSS custom-property reference, e.g. `var(--primaryColor)`. */
|
|
38
|
+
cssVar: string;
|
|
39
|
+
};
|
|
40
|
+
/** A typography token (text style). Apply `className` to an element to use it. */
|
|
41
|
+
export type TypographyToken = {
|
|
42
|
+
id: string;
|
|
43
|
+
name: string;
|
|
44
|
+
/** Resolved CSS values keyed by camelCased CSS property (e.g. `fontSize`, `fontWeight`). */
|
|
45
|
+
resolved: Record<string, string>;
|
|
46
|
+
/** Class selector the editor emits for this text style, e.g. `_<id>`. */
|
|
47
|
+
className: string;
|
|
48
|
+
/** True when this is the theme's default/global text style (the editor's "Make Default Style"). */
|
|
49
|
+
isDefault: boolean;
|
|
50
|
+
};
|
|
51
|
+
export type BreakpointToken = {
|
|
52
|
+
id: string;
|
|
53
|
+
name: string;
|
|
54
|
+
width: number;
|
|
55
|
+
};
|
|
56
|
+
/** A resolved CSS style entry, e.g. { property: "animation-duration", value: "1.4s" }. */
|
|
57
|
+
export type StyleEntry = {
|
|
58
|
+
property: string;
|
|
59
|
+
value: string;
|
|
60
|
+
};
|
|
61
|
+
export type KeyframeToken = {
|
|
62
|
+
id: string;
|
|
63
|
+
name: string;
|
|
64
|
+
type: string;
|
|
65
|
+
/** CSS reference — the animation name / class the editor emits, e.g. `_<id>`. */
|
|
66
|
+
ref: string;
|
|
67
|
+
/**
|
|
68
|
+
* Keyframe-level animation "settings" (the editor's Settings popover). These are CSS
|
|
69
|
+
* animation/transition properties and DIFFER BY TYPE: a `keyframe` carries
|
|
70
|
+
* animation-duration/-iteration-count/-play-state/-delay/-timing-function/-direction/
|
|
71
|
+
* -fill-mode/-timeline/-range + transform-origin; a `transition` carries `transition`.
|
|
72
|
+
* Both may carry backface-visibility. Empty when none are set.
|
|
73
|
+
*/
|
|
74
|
+
settings?: StyleEntry[];
|
|
75
|
+
/** Animation points; each point may carry its own resolved styles. */
|
|
76
|
+
points?: {
|
|
77
|
+
point: string;
|
|
78
|
+
styles?: StyleEntry[];
|
|
79
|
+
}[];
|
|
80
|
+
};
|
|
81
|
+
/**
|
|
82
|
+
* A color SLOT — one entry of the top-level `getThemeColorSchemes().schemes` list. It is a
|
|
83
|
+
* label only (`id` + display `name`); the actual colors for the slot live in each palette's
|
|
84
|
+
* `colorsByScheme[id]`.
|
|
85
|
+
*/
|
|
86
|
+
export type ColorSchemeSlot = {
|
|
87
|
+
id: string;
|
|
88
|
+
name: string;
|
|
89
|
+
};
|
|
90
|
+
/**
|
|
91
|
+
* A color palette (one entry of `getThemeColorSchemes().values`). Its colors live in
|
|
92
|
+
* `colorsByScheme` — the top-level `schemes` list holds only slot id→name labels.
|
|
93
|
+
*/
|
|
94
|
+
export type ColorSchemeToken = {
|
|
95
|
+
id: string;
|
|
96
|
+
name: string;
|
|
97
|
+
isDefault: boolean;
|
|
98
|
+
/** Class selector to activate this scheme value, e.g. `_<id>`. */
|
|
99
|
+
className: string;
|
|
100
|
+
/**
|
|
101
|
+
* This palette's colors, keyed by color-SLOT id (the ids in
|
|
102
|
+
* `getThemeColorSchemes().schemes`). THIS — not the top-level `schemes` array — is
|
|
103
|
+
* the source of truth for swatch colors; iterate it to render a palette. Prefer
|
|
104
|
+
* `cssVar` for live, in-editor reactivity; `resolved` is a render-time snapshot.
|
|
105
|
+
*/
|
|
106
|
+
colorsByScheme: Record<string, {
|
|
107
|
+
resolved: string | null;
|
|
108
|
+
cssVar: string;
|
|
109
|
+
}>;
|
|
110
|
+
};
|
|
111
|
+
export type ThemeGlobals = {
|
|
112
|
+
settings: Record<string, ThemeSetting>;
|
|
113
|
+
colors: DesignToken[];
|
|
114
|
+
typography: TypographyToken[];
|
|
115
|
+
breakpoints: BreakpointToken[];
|
|
116
|
+
keyframes: KeyframeToken[];
|
|
117
|
+
colorSchemes: {
|
|
118
|
+
schemes: ColorSchemeSlot[];
|
|
119
|
+
values: ColorSchemeToken[];
|
|
120
|
+
};
|
|
121
|
+
};
|
|
122
|
+
/**
|
|
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.
|
|
135
|
+
*
|
|
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.
|
|
139
|
+
*/
|
|
140
|
+
type RuntimeView<T> = Omit<T, "name">;
|
|
141
|
+
export type RuntimeDesignToken = RuntimeView<DesignToken>;
|
|
142
|
+
export type RuntimeTypographyToken = RuntimeView<TypographyToken>;
|
|
143
|
+
export type RuntimeBreakpointToken = RuntimeView<BreakpointToken>;
|
|
144
|
+
export type RuntimeKeyframeToken = RuntimeView<KeyframeToken>;
|
|
145
|
+
export type RuntimeColorSchemeToken = RuntimeView<ColorSchemeToken>;
|
|
146
|
+
export type RuntimeColorSchemeSlot = RuntimeView<ColorSchemeSlot>;
|
|
147
|
+
/**
|
|
148
|
+
* Runtime view of {@link ThemeGlobals.colorSchemes} (returned by `getThemeColorSchemes`). The
|
|
149
|
+
* slot list carries only `{ id }`: slot display LABELS (the slot `name`) are authoring-only —
|
|
150
|
+
* read them via the CLI/MCP `list-theme-globals` or the editor, not at runtime. Render a palette
|
|
151
|
+
* by iterating each value's `colorsByScheme`, keyed by slot id.
|
|
152
|
+
*/
|
|
153
|
+
export type RuntimeThemeColorSchemes = {
|
|
154
|
+
schemes: RuntimeColorSchemeSlot[];
|
|
155
|
+
values: RuntimeColorSchemeToken[];
|
|
156
|
+
};
|
|
157
|
+
export declare const EMPTY_THEME_GLOBALS: ThemeGlobals;
|
|
158
|
+
type StyleValueLike = {
|
|
159
|
+
value?: any;
|
|
160
|
+
patternValueId?: string;
|
|
161
|
+
keyframeValueId?: string;
|
|
162
|
+
colorSchemeId?: string;
|
|
163
|
+
};
|
|
164
|
+
type StyleConditionLike = {
|
|
165
|
+
value?: StyleValueLike;
|
|
166
|
+
};
|
|
167
|
+
type ElementStyleLike = {
|
|
168
|
+
property: string;
|
|
169
|
+
value?: StyleValueLike | StyleConditionLike[];
|
|
170
|
+
};
|
|
171
|
+
type PatternValueLike = {
|
|
172
|
+
id: string;
|
|
173
|
+
name?: string;
|
|
174
|
+
style?: ElementStyleLike;
|
|
175
|
+
};
|
|
176
|
+
type PatternElementLike = {
|
|
177
|
+
id: string;
|
|
178
|
+
name?: string;
|
|
179
|
+
styles?: ElementStyleLike[];
|
|
180
|
+
isDefault?: boolean;
|
|
181
|
+
};
|
|
182
|
+
type ColorSchemeLike = {
|
|
183
|
+
id: string;
|
|
184
|
+
name?: string;
|
|
185
|
+
};
|
|
186
|
+
type ColorSchemeValueColorLike = {
|
|
187
|
+
colorSchemeId: string;
|
|
188
|
+
style?: StyleValueLike;
|
|
189
|
+
};
|
|
190
|
+
type ColorSchemeValueLike = {
|
|
191
|
+
id: string;
|
|
192
|
+
name?: string;
|
|
193
|
+
isDefault?: boolean;
|
|
194
|
+
/** Set when this scheme belongs to an installed design asset; groups the default fallback. */
|
|
195
|
+
designAssetId?: string;
|
|
196
|
+
colors?: ColorSchemeValueColorLike[];
|
|
197
|
+
};
|
|
198
|
+
type BreakpointLike = {
|
|
199
|
+
id: string;
|
|
200
|
+
name?: string;
|
|
201
|
+
width?: number;
|
|
202
|
+
};
|
|
203
|
+
type KeyframePointLike = {
|
|
204
|
+
point: string;
|
|
205
|
+
styles?: ElementStyleLike[];
|
|
206
|
+
};
|
|
207
|
+
type KeyframeLike = {
|
|
208
|
+
id: string;
|
|
209
|
+
name?: string;
|
|
210
|
+
type?: string;
|
|
211
|
+
styles?: ElementStyleLike[];
|
|
212
|
+
points?: KeyframePointLike[];
|
|
213
|
+
};
|
|
214
|
+
type VariableLike = {
|
|
215
|
+
id?: string;
|
|
216
|
+
variableName?: string;
|
|
217
|
+
displayName?: string;
|
|
218
|
+
variableType?: string;
|
|
219
|
+
defaultValue?: any;
|
|
220
|
+
isGlobal?: boolean;
|
|
221
|
+
};
|
|
222
|
+
export type SerializableProject = {
|
|
223
|
+
globalsBlueprint?: {
|
|
224
|
+
module?: {
|
|
225
|
+
variables?: VariableLike[];
|
|
226
|
+
};
|
|
227
|
+
};
|
|
228
|
+
theme?: {
|
|
229
|
+
breakpoints?: BreakpointLike[];
|
|
230
|
+
keyframes?: KeyframeLike[];
|
|
231
|
+
pattern?: {
|
|
232
|
+
values?: PatternValueLike[];
|
|
233
|
+
elements?: PatternElementLike[];
|
|
234
|
+
colorSchemes?: ColorSchemeLike[];
|
|
235
|
+
colorSchemeValues?: ColorSchemeValueLike[];
|
|
236
|
+
};
|
|
237
|
+
};
|
|
238
|
+
};
|
|
239
|
+
export declare const cssVarRef: (id: string, fallback?: string) => string;
|
|
240
|
+
export declare const rawClassRef: (id: string) => string;
|
|
241
|
+
/**
|
|
242
|
+
* CSS function-style token a code component writes to reference a theme breakpoint's width.
|
|
243
|
+
* Breakpoints can't ship as `var(--…)` because the CSS spec forbids `var()` in a media-query
|
|
244
|
+
* condition — and a `var()` there fails SILENTLY (it parses as valid-looking CSS but the whole
|
|
245
|
+
* query is dropped). So a code component writes a deliberately non-standard `bp(<breakpointId>)`
|
|
246
|
+
* token inside its OWN `min-width` / `max-width` condition; it resolves to a concrete `<width>px`
|
|
247
|
+
* at render time against the LIVE theme (see {@link resolveBreakpointMediaTokens}). The author
|
|
248
|
+
* picks the direction, so there is no implicit boundary magic:
|
|
249
|
+
* `@media (max-width: bp(_mob))` -> `@media (max-width: 767px)`
|
|
250
|
+
* `@media (min-width: bp(_mob))` -> `@media (min-width: 767px)`
|
|
251
|
+
* id-based, never a human name (the id is stable across renames). The id comes from
|
|
252
|
+
* `list-theme-globals` / `getThemeBreakpoints()`.
|
|
253
|
+
*/
|
|
254
|
+
export declare const breakpointCssToken: (id: string) => string;
|
|
255
|
+
/**
|
|
256
|
+
* Coerce a theme's breakpoint list into the `{ id, width }` shape {@link resolveBreakpointMediaTokens}
|
|
257
|
+
* needs, defaulting a missing/non-numeric width to 0. Shared by both render sites so the coercion
|
|
258
|
+
* rule lives in one place; the editor passes `breakpoints.map(b => b.toJSON())` (Yjs → plain) first.
|
|
259
|
+
*/
|
|
260
|
+
export declare const toResolverBreakpoints: (breakpoints: {
|
|
261
|
+
id: string;
|
|
262
|
+
width?: number | string;
|
|
263
|
+
}[]) => {
|
|
264
|
+
id: string;
|
|
265
|
+
width: number;
|
|
266
|
+
}[];
|
|
267
|
+
/**
|
|
268
|
+
* Replace breakpoint width tokens (`bp(<id>)`) in a CSS string with the breakpoint's concrete
|
|
269
|
+
* `<width>px`, using the given theme breakpoints. Pure text substitution — the single place
|
|
270
|
+
* breakpoint resolution lives, called at every render-time CC-CSS composition site
|
|
271
|
+
* (code-generator, editor canvas). Unknown ids are left untouched (the partner dependency
|
|
272
|
+
* collector ships referenced breakpoints into the target theme, so a real token always resolves).
|
|
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.
|
|
286
|
+
*/
|
|
287
|
+
export declare function resolveBreakpointMediaTokens(css: string, breakpoints: {
|
|
288
|
+
id: string;
|
|
289
|
+
width: number;
|
|
290
|
+
}[]): string;
|
|
291
|
+
/**
|
|
292
|
+
* True for system/reserved global variables (e.g. `__breakpointsVar__`) — internal
|
|
293
|
+
* constructs that live in `module.variables` but are NOT user-facing theme settings.
|
|
294
|
+
* Single source of truth for the `__name__` reserved-id convention; consumers (theme
|
|
295
|
+
* serialization here, partner publish dependency collection) share it so a new
|
|
296
|
+
* synthetic var is excluded everywhere at once.
|
|
297
|
+
*/
|
|
298
|
+
export declare const isReservedVariableId: (id?: string | null) => boolean;
|
|
299
|
+
/**
|
|
300
|
+
* Build the {@link ThemeGlobals} payload from a project's theme. Pure and dependency-free
|
|
301
|
+
* (works on plain JSON), so the same function serves SSR (`IProject`) and the editor canvas
|
|
302
|
+
* (`YjsProject.toJSON()`).
|
|
303
|
+
*/
|
|
304
|
+
export declare function serializeThemeGlobals(project?: SerializableProject | null): ThemeGlobals;
|
|
305
|
+
export {};
|
|
@@ -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";
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import { IBlueprintPropValueVariableBinding } from "./variable-binding";
|
|
1
2
|
export interface IBlueprintAttributeListPropValue {
|
|
2
3
|
productId?: string | null;
|
|
3
4
|
variantId?: string | null;
|
|
4
5
|
attributeIds?: string[] | null;
|
|
5
6
|
usePageData?: boolean | null;
|
|
7
|
+
productVariable?: IBlueprintPropValueVariableBinding | null;
|
|
6
8
|
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import { IBlueprintPropValueVariableBinding } from "./variable-binding";
|
|
1
2
|
export interface IBlueprintAttributePropValue {
|
|
2
3
|
productId?: string | null;
|
|
3
4
|
variantId?: string | null;
|
|
4
5
|
attributeId?: string | null;
|
|
5
6
|
usePageData?: boolean | null;
|
|
7
|
+
productVariable?: IBlueprintPropValueVariableBinding | null;
|
|
6
8
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A theme data binding stored INSIDE a prop value, so a single field of that value can follow a
|
|
3
|
+
* bound variable while the rest of the value stays statically authored (see
|
|
4
|
+
* `IBlueprintAttributePropValue.productVariable`). `key`/`variableId`/`path` mirror the editor's
|
|
5
|
+
* `IThemeVariableBinding` and `refId`/`componentId` mirror the surrounding `IThemeDynamicValueValue`
|
|
6
|
+
* context a COMPONENT_LIST child needs to resolve an ancestor's variable; duplicated here because
|
|
7
|
+
* storefront-models must not depend on editor-models. Only the editor and the code generators
|
|
8
|
+
* interpret it — the storefront runtime carries it through untouched.
|
|
9
|
+
*/
|
|
10
|
+
export interface IBlueprintPropValueVariableBinding {
|
|
11
|
+
key?: string | null;
|
|
12
|
+
variableId?: string | null;
|
|
13
|
+
path?: string[] | null;
|
|
14
|
+
refId?: string | null;
|
|
15
|
+
componentId?: string | null;
|
|
16
|
+
}
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
export type IkasImage = {
|
|
2
2
|
id: string;
|
|
3
|
+
/**
|
|
4
|
+
* True when this media item is a VIDEO, not an image. Product media sets routinely mix both.
|
|
5
|
+
* getDefaultSrc/getSrc/getThumbnailSrc then return an .mp4 URL, so rendering it in an <img>
|
|
6
|
+
* produces broken media — branch on this flag and render <video src={getDefaultSrc(item)}>.
|
|
7
|
+
* Videos have no resized variant and no poster URL: the size argument is ignored, and
|
|
8
|
+
* createMediaSrcset does not apply.
|
|
9
|
+
*/
|
|
3
10
|
isVideo?: boolean | null;
|
|
4
11
|
altText?: string | null;
|
|
5
12
|
fileName?: string | null;
|
|
@@ -10,4 +10,9 @@ export type IkasProductAttribute = {
|
|
|
10
10
|
tableTemplate: IkasProductAttributeTableTemplate | null;
|
|
11
11
|
translations?: IkasProductAttributeTranslation[] | null;
|
|
12
12
|
};
|
|
13
|
-
|
|
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
|
+
};
|
|
@@ -3,6 +3,11 @@ export type IkasProductImage = {
|
|
|
3
3
|
fileName: string | null;
|
|
4
4
|
imageId: string | null;
|
|
5
5
|
isMain: boolean;
|
|
6
|
+
/**
|
|
7
|
+
* True when this media item is a VIDEO, not an image. Product galleries, cards, swatches and
|
|
8
|
+
* line items must branch on it: render <video src={getDefaultSrc(item.image)}> instead of an
|
|
9
|
+
* <img>, otherwise the .mp4 URL lands in an <img> and the media breaks.
|
|
10
|
+
*/
|
|
6
11
|
isVideo: boolean | null;
|
|
7
12
|
order: number;
|
|
8
13
|
image?: IkasImage | null;
|
|
@@ -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
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { RuntimeBreakpointToken, RuntimeDesignToken, RuntimeKeyframeToken, RuntimeThemeColorSchemes, RuntimeTypographyToken, ThemeSetting } from "../../storefront-config/src";
|
|
2
|
+
/**
|
|
3
|
+
* Register the live global-variable object (`_g_`) so `getThemeSetting`/`getThemeSettings`
|
|
4
|
+
* return actual runtime values (constants, computed getters, and in-editor edits) instead
|
|
5
|
+
* of the serialized design-time defaults. Called by generated code, not by component authors.
|
|
6
|
+
*/
|
|
7
|
+
export declare function registerThemeSettingValues(values: Record<string, any> | null): void;
|
|
8
|
+
/** All global variables (Theme Settings) defined for the theme. */
|
|
9
|
+
export declare function getThemeSettings(): ThemeSetting[];
|
|
10
|
+
/**
|
|
11
|
+
* A single global variable by its stable key (`variableName`, e.g. `_6Q0KV7VGGM`).
|
|
12
|
+
* Discover keys via {@link getThemeSettings} (each item carries a human `displayName`).
|
|
13
|
+
* The returned `value` is the live blueprint value when available, else the default.
|
|
14
|
+
* Its shape is discriminated by `type` (see {@link ThemeSetting.value}); note an
|
|
15
|
+
* IMAGE setting's value is an image REFERENCE (no `.url`) — resolve with
|
|
16
|
+
* `getDefaultSrc`/`getSrc`.
|
|
17
|
+
*/
|
|
18
|
+
export declare function getThemeSetting(name: string): ThemeSetting | undefined;
|
|
19
|
+
/** Convenience: the resolved value of a global variable, or `undefined` if not found. */
|
|
20
|
+
export declare function getThemeSettingValue(name: string): any;
|
|
21
|
+
/** Theme color tokens. Each carries a resolved value and a `var(--id)` CSS reference. */
|
|
22
|
+
export declare function getThemeColors(): RuntimeDesignToken[];
|
|
23
|
+
/** Theme typography tokens (text styles). Apply `className` or read `resolved` CSS values. */
|
|
24
|
+
export declare function getThemeTypography(): RuntimeTypographyToken[];
|
|
25
|
+
/** Theme responsive breakpoints (`{ id, width }`). */
|
|
26
|
+
export declare function getThemeBreakpoints(): RuntimeBreakpointToken[];
|
|
27
|
+
/** Theme keyframe/transition animations. Use `ref` as the CSS animation name. */
|
|
28
|
+
export declare function getThemeKeyframes(): RuntimeKeyframeToken[];
|
|
29
|
+
/**
|
|
30
|
+
* Theme color schemes (palettes). Returns two PARALLEL lists with different jobs:
|
|
31
|
+
* - `schemes`: the color SLOTS as `{ id }` only — no colors and no display label live here at
|
|
32
|
+
* runtime. A slot's human name is authoring-only (read it via the CLI/MCP `list-theme-globals`
|
|
33
|
+
* or the editor); at runtime identify a slot solely by its `id`.
|
|
34
|
+
* - `values`: the actual palettes. A palette's colors live in its `colorsByScheme`
|
|
35
|
+
* map, keyed by slot id → `{ resolved, cssVar }`.
|
|
36
|
+
*
|
|
37
|
+
* To render swatches, iterate `values[].colorsByScheme` (the source of truth for
|
|
38
|
+
* colors), NOT the top-level `schemes` array — `schemes` carries slot ids only, so
|
|
39
|
+
* iterating it renders empty:
|
|
40
|
+
*
|
|
41
|
+
* const { values } = getThemeColorSchemes();
|
|
42
|
+
* values.forEach(palette =>
|
|
43
|
+
* Object.entries(palette.colorsByScheme).forEach(([slotId, { resolved, cssVar }]) => {
|
|
44
|
+
* // slotId → stable slot key, cssVar → live var() ref (prefer this), resolved → hex snapshot
|
|
45
|
+
* })
|
|
46
|
+
* );
|
|
47
|
+
*/
|
|
48
|
+
export declare function getThemeColorSchemes(): RuntimeThemeColorSchemes;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{__assign as o}from'./../../ext/tslib/tslib.es6.mjs.js';import{IkasStorefrontConfig as l}from"../../packages/storefront-config/src/index.js";var n=null;function e(o){n=o}function i(l){return n&&l.name in n?o(o({},l),{value:n[l.name]}):l}function r(){var o,n;return Object.values(null!==(n=null===(o=l.themeGlobals)||void 0===o?void 0:o.settings)&&void 0!==n?n:{}).map(i)}function t(o){var n,e,r=null===(e=null===(n=l.themeGlobals)||void 0===n?void 0:n.settings)||void 0===e?void 0:e[o];return r?i(r):void 0}function u(o){var l;return null===(l=t(o))||void 0===l?void 0:l.value}function v(){var o,n;return null!==(n=null===(o=l.themeGlobals)||void 0===o?void 0:o.colors)&&void 0!==n?n:[]}function s(){var o,n;return null!==(n=null===(o=l.themeGlobals)||void 0===o?void 0:o.typography)&&void 0!==n?n:[]}function a(){var o,n;return null!==(n=null===(o=l.themeGlobals)||void 0===o?void 0:o.breakpoints)&&void 0!==n?n:[]}function d(){var o,n;return null!==(n=null===(o=l.themeGlobals)||void 0===o?void 0:o.keyframes)&&void 0!==n?n:[]}function m(){var o,n;return null!==(n=null===(o=l.themeGlobals)||void 0===o?void 0:o.colorSchemes)&&void 0!==n?n:{schemes:[],values:[]}}export{a as getThemeBreakpoints,m as getThemeColorSchemes,v as getThemeColors,d as getThemeKeyframes,t as getThemeSetting,u as getThemeSettingValue,r as getThemeSettings,s as getThemeTypography,e as registerThemeSettingValues};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__assign as
|
|
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};
|