@ikas/code-components-mcp 1.4.0-beta.14 → 1.4.0-beta.140
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/data/framework.json +49 -9
- package/data/migration.json +2 -2
- package/data/storefront-api.json +203 -23
- package/data/storefront-types.json +9334 -6021
- package/dist/index.js +1885 -242
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/data/storefront-api.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"generatedAt": "2026-
|
|
2
|
+
"generatedAt": "2026-07-24T12:41:17.826Z",
|
|
3
3
|
"functions": [
|
|
4
4
|
{
|
|
5
5
|
"name": "apiListProductBrand",
|
|
@@ -2761,16 +2761,16 @@
|
|
|
2761
2761
|
{
|
|
2762
2762
|
"name": "getDefaultSrc",
|
|
2763
2763
|
"signature": "function getDefaultSrc(image: IkasImage): string",
|
|
2764
|
-
"description": "Returns the default source URL for an image at 1080px resolution.",
|
|
2764
|
+
"description": "Returns the default source URL for an image OR video at 1080px resolution.\n\nProduct media items (IkasProductImage) can be videos. ALWAYS check `item.isVideo`\nand render a `<video src={getDefaultSrc(item)}>` instead of an `<img>` when it is true.\nNever assume every media item is an image.",
|
|
2765
2765
|
"params": [
|
|
2766
2766
|
{
|
|
2767
2767
|
"name": "image",
|
|
2768
2768
|
"description": "- The image object to generate the default source URL for."
|
|
2769
2769
|
}
|
|
2770
2770
|
],
|
|
2771
|
-
"returns": "The CDN URL string for the image at 1080px size.",
|
|
2771
|
+
"returns": "The CDN URL string for the image or video at 1080px size.",
|
|
2772
2772
|
"returnType": "string",
|
|
2773
|
-
"example": "```typescript\nimport { getDefaultSrc } from \"@ikas/bp-storefront\";\n\
|
|
2773
|
+
"example": "```typescript\nimport { getDefaultSrc, createMediaSrcset } from \"@ikas/bp-storefront\";\n\n// Product images can be videos — ALWAYS branch on isVideo when mapping media:\n{product.images.map((item, i) =>\n item.isVideo ? (\n <video key={i} src={getDefaultSrc(item)} muted playsInline preload=\"metadata\">\n <track kind=\"captions\" />\n </video>\n ) : (\n <img key={i} src={getDefaultSrc(item)} srcSet={createMediaSrcset(item)} alt={`Product ${i + 1}`} />\n )\n)}\n```",
|
|
2774
2774
|
"categories": [
|
|
2775
2775
|
"Image"
|
|
2776
2776
|
],
|
|
@@ -2788,16 +2788,16 @@
|
|
|
2788
2788
|
{
|
|
2789
2789
|
"name": "getThumbnailSrc",
|
|
2790
2790
|
"signature": "function getThumbnailSrc(image: IkasImage): string",
|
|
2791
|
-
"description": "Returns the thumbnail source URL for an image at 180px resolution.",
|
|
2791
|
+
"description": "Returns the thumbnail source URL for an image OR video at 180px resolution.\n\nWhen mapping over product media (IkasProductImage[]), some items are videos:\ncheck `item.isVideo` and render a `<video>` thumbnail (typically with a play\noverlay) instead of an `<img>` when it is true.",
|
|
2792
2792
|
"params": [
|
|
2793
2793
|
{
|
|
2794
2794
|
"name": "image",
|
|
2795
2795
|
"description": "- The image object to generate the thumbnail source URL for."
|
|
2796
2796
|
}
|
|
2797
2797
|
],
|
|
2798
|
-
"returns": "The CDN URL string for the image at 180px size.",
|
|
2798
|
+
"returns": "The CDN URL string for the image or video at 180px size.",
|
|
2799
2799
|
"returnType": "string",
|
|
2800
|
-
"example": "```typescript\nimport { getThumbnailSrc } from \"@ikas/bp-storefront\";\n\
|
|
2800
|
+
"example": "```typescript\nimport { getThumbnailSrc, getDefaultSrc } from \"@ikas/bp-storefront\";\n\n// Thumbnail rail — branch on isVideo per item:\n{product.images.map((item, i) =>\n item.isVideo ? (\n <video key={i} src={getDefaultSrc(item)} muted preload=\"metadata\">\n <track kind=\"captions\" />\n </video>\n ) : (\n <img key={i} src={getThumbnailSrc(item)} sizes=\"112px\" alt={`Thumb ${i + 1}`} />\n )\n)}\n```",
|
|
2801
2801
|
"categories": [
|
|
2802
2802
|
"Image"
|
|
2803
2803
|
],
|
|
@@ -2815,7 +2815,7 @@
|
|
|
2815
2815
|
{
|
|
2816
2816
|
"name": "getSrc",
|
|
2817
2817
|
"signature": "function getSrc(image: IkasImage, size: number): string",
|
|
2818
|
-
"description": "Generates the full CDN source URL for an image or video at the specified size, handling both legacy path-based and merchant-scoped ID formats.",
|
|
2818
|
+
"description": "Generates the full CDN source URL for an image or video at the specified size, handling both legacy path-based and merchant-scoped ID formats.\n\nNOTE: For videos (`image.isVideo === true`) the `size` argument is IGNORED — the original .mp4 is always returned.\nSo `getSrc(item, 240)` and `getDefaultSrc(item)` produce the identical URL for a video. PREFER `getDefaultSrc(item)`\nfor video `src` (no size param) — do NOT pass an arbitrary size like `getSrc(item, 240)`, it is misleading.",
|
|
2819
2819
|
"params": [
|
|
2820
2820
|
{
|
|
2821
2821
|
"name": "image",
|
|
@@ -2823,12 +2823,12 @@
|
|
|
2823
2823
|
},
|
|
2824
2824
|
{
|
|
2825
2825
|
"name": "size",
|
|
2826
|
-
"description": "- The desired image width in pixels for
|
|
2826
|
+
"description": "- The desired image width in pixels. Ignored for videos."
|
|
2827
2827
|
}
|
|
2828
2828
|
],
|
|
2829
2829
|
"returns": "The full CDN URL string for the image or video.",
|
|
2830
2830
|
"returnType": "string",
|
|
2831
|
-
"example": "```typescript\nimport { getSrc } from \"@ikas/bp-storefront\";\n\nconst src = getSrc(image, 640);\nconsole.log(src); // \"https://cdn.example.com/images/.../640/image.webp\"\n```",
|
|
2831
|
+
"example": "```typescript\nimport { getSrc, getDefaultSrc } from \"@ikas/bp-storefront\";\n\nconst src = getSrc(image, 640);\nconsole.log(src); // \"https://cdn.example.com/images/.../640/image.webp\"\n\n// For a video, use getDefaultSrc (size is ignored anyway):\n<video src={getDefaultSrc(item)} muted playsInline preload=\"metadata\" />\n```",
|
|
2832
2832
|
"categories": [
|
|
2833
2833
|
"Image"
|
|
2834
2834
|
],
|
|
@@ -2846,7 +2846,7 @@
|
|
|
2846
2846
|
{
|
|
2847
2847
|
"name": "createMediaSrcset",
|
|
2848
2848
|
"signature": "function createMediaSrcset(image?: IkasImage | null): string",
|
|
2849
|
-
"description": "Generates a complete responsive `srcset` string for an image across all standard sizes (180–3840px).",
|
|
2849
|
+
"description": "Generates a complete responsive `srcset` string for an image across all standard sizes (180–3840px).\n\nsrcset applies to `<img>` only — video media (`item.isVideo === true`) has no srcset\nand must be rendered with `<video src={getDefaultSrc(item)}>`. When mapping product\nimages, branch on `item.isVideo` first, then only use createMediaSrcset on the image branch.",
|
|
2850
2850
|
"params": [
|
|
2851
2851
|
{
|
|
2852
2852
|
"name": "image",
|
|
@@ -2855,7 +2855,7 @@
|
|
|
2855
2855
|
],
|
|
2856
2856
|
"returns": "A srcset string like `\"url 180w, url 360w, ...\"`, or an empty string if no image is provided.",
|
|
2857
2857
|
"returnType": "string",
|
|
2858
|
-
"example": "```typescript\nimport { createMediaSrcset, getDefaultSrc } from \"@ikas/bp-storefront\";\n\n<img\n
|
|
2858
|
+
"example": "```typescript\nimport { createMediaSrcset, getDefaultSrc } from \"@ikas/bp-storefront\";\n\n// Product images can be videos — ALWAYS branch on isVideo when mapping media:\n{product.images.map((item, i) =>\n item.isVideo ? (\n <video key={i} src={getDefaultSrc(item)} muted playsInline preload=\"metadata\">\n <track kind=\"captions\" />\n </video>\n ) : (\n <img\n key={i}\n src={getDefaultSrc(item)}\n srcSet={createMediaSrcset(item)}\n sizes=\"(max-width: 768px) 100vw, 50vw\"\n alt={`Product ${i + 1}`}\n />\n )\n)}\n```",
|
|
2859
2859
|
"categories": [
|
|
2860
2860
|
"Image"
|
|
2861
2861
|
],
|
|
@@ -7310,16 +7310,16 @@
|
|
|
7310
7310
|
"name": "getProductVariantMainImage",
|
|
7311
7311
|
"displayName": "getMainImage",
|
|
7312
7312
|
"signature": "function getProductVariantMainImage(variant: IkasProductVariant): IkasProductImage | undefined",
|
|
7313
|
-
"description": "Get the main/primary
|
|
7313
|
+
"description": "Get the main/primary media item for a product variant.\n\nThe returned IkasProductImage may be a video (`isVideo === true`) — branch on it\nand render `<video>` instead of `<img>`.",
|
|
7314
7314
|
"params": [
|
|
7315
7315
|
{
|
|
7316
7316
|
"name": "variant",
|
|
7317
7317
|
"description": "- The product variant"
|
|
7318
7318
|
}
|
|
7319
7319
|
],
|
|
7320
|
-
"returns": "The first IkasProductImage of the variant, or undefined if no images.
|
|
7320
|
+
"returns": "The first IkasProductImage of the variant, or undefined if no images. Check `.isVideo` to decide between `<video>` and `<img>`, and access `.image` to get the IkasImage for CDN helpers.",
|
|
7321
7321
|
"returnType": "IkasProductImage | undefined",
|
|
7322
|
-
"example": "```typescript\nimport { getProductVariantMainImage, getSelectedProductVariant, getDefaultSrc } from \"@ikas/bp-storefront\";\nimport { IkasProduct } from \"@ikas/bp-storefront\";\n\nfunction ProductImage({ product }: { product: IkasProduct }) {\n const variant = getSelectedProductVariant(product);\n const productImage = getProductVariantMainImage(variant);\n const image = productImage?.image;\n\n if (!image) {\n return <div className=\"no-image\">No image available</div>;\n }\n\n return <img src={getDefaultSrc(image)} alt={product.name}
|
|
7322
|
+
"example": "```typescript\nimport { getProductVariantMainImage, getSelectedProductVariant, getDefaultSrc, createMediaSrcset } from \"@ikas/bp-storefront\";\nimport { IkasProduct } from \"@ikas/bp-storefront\";\n\nfunction ProductImage({ product }: { product: IkasProduct }) {\n const variant = getSelectedProductVariant(product);\n const productImage = getProductVariantMainImage(variant);\n const image = productImage?.image;\n\n if (!image) {\n return <div className=\"no-image\">No image available</div>;\n }\n\n // Media can be a video — branch on isVideo:\n return productImage.isVideo ? (\n <video src={getDefaultSrc(image)} muted playsInline loop>\n <track kind=\"captions\" />\n </video>\n ) : (\n <img src={getDefaultSrc(image)} srcSet={createMediaSrcset(image)} alt={product.name} />\n );\n}\n```",
|
|
7323
7323
|
"categories": [
|
|
7324
7324
|
"ProductDetail",
|
|
7325
7325
|
"ProductList"
|
|
@@ -7597,14 +7597,14 @@
|
|
|
7597
7597
|
"name": "getProductVariantAppliedCampaignAmount",
|
|
7598
7598
|
"displayName": "getAppliedCampaignAmount",
|
|
7599
7599
|
"signature": "function getProductVariantAppliedCampaignAmount(variant: IkasProductVariant): IkasAppliedCampaignAmount | null",
|
|
7600
|
-
"description": "Get the applied campaign discount amount details for a product variant, including type and formatted value.",
|
|
7600
|
+
"description": "Get the applied campaign discount amount details for a product variant, including type and formatted value.\n\nHow the discount value is interpreted depends on `campaign.type`:\n- `\"FIXED_AMOUNT\"` → the value is an absolute money amount, returned in `formattedPrice` (e.g. \"$10.00\"); `discountPercentage` stays null.\n- `\"RATIO\"` → the value is a percentage, returned in `discountPercentage` (e.g. \"10\" for 10% off); `formattedPrice` stays null.\n\nBoth fixed and tiered campaigns are supported. For a tiered-discount campaign\n(`campaign.fixedDiscount` is null and the discount lives in `campaign.tieredDiscount.rules`),\nthe first tier's amount (`campaign.tieredDiscount.rules[0].amount`) is used, matching the storefront runtime.",
|
|
7601
7601
|
"params": [
|
|
7602
7602
|
{
|
|
7603
7603
|
"name": "variant",
|
|
7604
7604
|
"description": "- The product variant to check for applied campaigns"
|
|
7605
7605
|
}
|
|
7606
7606
|
],
|
|
7607
|
-
"returns": "An object
|
|
7607
|
+
"returns": "An object `{ type, formattedPrice, discountPercentage }` — `formattedPrice` is set for FIXED_AMOUNT campaigns, `discountPercentage` for RATIO campaigns (fixed and tiered alike); the other field stays null. Returns null if no campaign is applied.",
|
|
7608
7608
|
"returnType": "IkasAppliedCampaignAmount | null",
|
|
7609
7609
|
"example": "```typescript\nimport { getProductVariantAppliedCampaignAmount, getSelectedProductVariant } from \"@ikas/bp-storefront\";\nimport { IkasProduct } from \"@ikas/bp-storefront\";\n\nfunction CampaignInfo({ product }: { product: IkasProduct }) {\n const variant = getSelectedProductVariant(product);\n const campaignAmount = getProductVariantAppliedCampaignAmount(variant);\n\n if (!campaignAmount) return null;\n\n return (\n <div>\n {campaignAmount.type === \"RATIO\"\n ? `${campaignAmount.discountPercentage}% off`\n : `${campaignAmount.formattedPrice} off`}\n </div>\n );\n}\n```",
|
|
7610
7610
|
"categories": [
|
|
@@ -7999,6 +7999,36 @@
|
|
|
7999
7999
|
"IkasProductVariant"
|
|
8000
8000
|
]
|
|
8001
8001
|
},
|
|
8002
|
+
{
|
|
8003
|
+
"name": "getProductVariantTieredDiscountProducts",
|
|
8004
|
+
"displayName": "getTieredDiscountProducts",
|
|
8005
|
+
"signature": "function getProductVariantTieredDiscountProducts(variant: IkasProductVariant): IkasTieredDiscountProduct[]",
|
|
8006
|
+
"description": "Get the tiered-discount breakdown for a product variant, one entry per discount tier.\n\nA tiered discount defines multiple quantity tiers (`campaign.tieredDiscount.rules`), each with its own\namount and quantity range. This resolves every tier against the variant's price and returns the\nper-tier sell/final prices (both raw numbers and formatted strings), matching the storefront runtime.\nThe raw rules are `IkasProductTieredDiscountRule` (ranges may be null); this function returns the\nresolved `IkasTieredDiscountProduct` with normalized `{ min, max }` — use the resolved shape, not the raw rule.\n\n`sellPrice`/`finalPrice` (and their `formatted*` variants) are PER UNIT; the `*WithQuantity` fields are the\ntier total for buying the minimum quantity. A `\"FIXED_AMOUNT\"` discount is applied only to that total, so\nper-unit `finalPrice` equals `sellPrice` and the saving shows only in `finalPriceWithQuantity`.\n\nThe discount `amount` is interpreted by `campaign.type`: `\"RATIO\"` treats it as a percentage,\n`\"FIXED_AMOUNT\"` as an absolute money amount subtracted from the tier total. `amount`/`type` are\ninformational — the discount is already applied in the resolved `*Price` fields, so prefer those over\nrecomputing it yourself.\n\n`lineItemQuantityRange.min`/`max` are normalized numbers where `0` means \"unbounded\". In particular\n`max === 0` marks an open-ended top tier (e.g. \"6+\" with no upper limit) — render it as \"min+\" rather\nthan \"min–max\", and never treat `max` as a real quantity when it is `0`.\n\nEach tier's `salesChannelIds` lists the channels it targets (empty/null = all channels). Filter tiers\nagainst `IkasStorefrontConfig.salesChannelId` so only those valid for the current storefront are shown.\n\nReturns an empty array when the variant has no tiered-discount campaign, when a\n`PRODUCT_AND_VARIANT` filter excludes this variant, or when no tier defines a quantity range.",
|
|
8007
|
+
"params": [
|
|
8008
|
+
{
|
|
8009
|
+
"name": "variant",
|
|
8010
|
+
"description": "- The product variant to resolve tiered discounts for"
|
|
8011
|
+
}
|
|
8012
|
+
],
|
|
8013
|
+
"returns": "An array of tier objects (`amount`, `lineItemQuantityRange`, `type`, sell/final prices with their formatted variants, `salesChannelIds`), or an empty array if no tiered discount applies",
|
|
8014
|
+
"returnType": "IkasTieredDiscountProduct[]",
|
|
8015
|
+
"example": "```typescript\nimport {\n getProductVariantTieredDiscountProducts,\n getSelectedProductVariant,\n IkasStorefrontConfig,\n} from \"@ikas/bp-storefront\";\nimport { IkasProduct } from \"@ikas/bp-storefront\";\n\nfunction TieredDiscountTable({ product }: { product: IkasProduct }) {\n const variant = getSelectedProductVariant(product);\n const tiers = getProductVariantTieredDiscountProducts(variant);\n const salesChannelId = IkasStorefrontConfig.salesChannelId;\n\n if (!tiers.length) return null;\n\n return (\n <ul>\n {tiers.map((tier, i) => {\n // A tier applies when it targets no channels or includes the current one\n const scoped =\n !tier.salesChannelIds?.length ||\n (!!salesChannelId && tier.salesChannelIds.includes(salesChannelId));\n if (!scoped) return null;\n\n return (\n <li key={i}>\n Buy {tier.lineItemQuantityRange.min}+ → {tier.formattedFinalPriceWithQuantity}{\" \"}\n <s>{tier.formattedSellPriceWithQuantity}</s>\n </li>\n );\n })}\n </ul>\n );\n}\n```",
|
|
8016
|
+
"categories": [
|
|
8017
|
+
"Pricing",
|
|
8018
|
+
"ProductVariant"
|
|
8019
|
+
],
|
|
8020
|
+
"related": [
|
|
8021
|
+
"getProductVariantAppliedCampaignAmount",
|
|
8022
|
+
"getProductVariantCampaignOffersDiscountPercentage",
|
|
8023
|
+
"getProductVariantFinalPrice"
|
|
8024
|
+
],
|
|
8025
|
+
"isAsync": false,
|
|
8026
|
+
"isClass": false,
|
|
8027
|
+
"parameterTypes": [
|
|
8028
|
+
"IkasProductVariant",
|
|
8029
|
+
"IkasTieredDiscountProduct"
|
|
8030
|
+
]
|
|
8031
|
+
},
|
|
8002
8032
|
{
|
|
8003
8033
|
"name": "getProductVariantIsBackInStockEnabled",
|
|
8004
8034
|
"displayName": "isBackInStockEnabled",
|
|
@@ -9556,7 +9586,7 @@
|
|
|
9556
9586
|
"name": "initAddressForm",
|
|
9557
9587
|
"displayName": "init",
|
|
9558
9588
|
"signature": "async function initAddressForm(addressForm: AddressForm, address?: IkasCustomerAddress): Promise<void>",
|
|
9559
|
-
"description": "Initializes an address form with default or existing address values, loads location data, and configures field settings.",
|
|
9589
|
+
"description": "Initializes an address form with default or existing address values, loads location data, and configures field settings.\n\nAlso resolves `addressForm.addressFormat` for the selected country. That is an\n`AddressFormItem[][]` describing which fields the country uses and how they group into rows\n(outer array = rows, inner array = fields sharing a row), and it is the only correct source\nfor laying out an address form -- a hardcoded field list will be wrong for most countries.\nIt is empty until this promise resolves, and `setAddressFormCountry` re-resolves it, so\nrender from it rather than copying it into local state.",
|
|
9560
9590
|
"params": [
|
|
9561
9591
|
{
|
|
9562
9592
|
"name": "addressForm",
|
|
@@ -9569,7 +9599,7 @@
|
|
|
9569
9599
|
],
|
|
9570
9600
|
"returns": "A promise that resolves once the form is fully initialized, including country/state/city lists, field settings, checkout settings, and shipping zones.",
|
|
9571
9601
|
"returnType": "Promise<void>",
|
|
9572
|
-
"example": "```
|
|
9602
|
+
"example": "```tsx\nimport { useEffect, useState } from \"preact/hooks\";\nimport {\n type AddressForm,\n type AddressFormItem,\n initAddressForm,\n setAddressFormFirstName,\n setAddressFormLastName,\n setAddressFormIdentityNumber,\n setAddressFormAddressLine1,\n setAddressFormAddressLine2,\n setAddressFormPostalCode,\n setAddressFormPhone,\n} from \"@ikas/bp-storefront\";\n\n// Initialize an empty address form\nawait initAddressForm(addressForm);\n\n// Initialize with an existing customer address for editing\nawait initAddressForm(addressForm, existingAddress);\n\n// addressFormat is empty until init resolves, so gate the render on it.\nconst [isLoading, setIsLoading] = useState(true);\nuseEffect(() => {\n initAddressForm(addressForm, address).then(() => setIsLoading(false));\n}, []);\n\n// Every addressFormat key has a matching setter, each taking (addressForm, value).\n// The location keys (country, state, city, district, region) are omitted here: they\n// render as selects fed by addressForm.countryOptions / stateOptions / cityOptions /\n// districtOptions / regionOptions, and must fall back to a text input when the field\n// isFreeText or has no options.\nconst SETTERS: Partial<Record<AddressFormItem, (form: AddressForm, value: string) => void>> = {\n firstName: setAddressFormFirstName,\n lastName: setAddressFormLastName,\n identityNumber: setAddressFormIdentityNumber,\n addressLine1: setAddressFormAddressLine1,\n addressLine2: setAddressFormAddressLine2,\n postalCode: setAddressFormPostalCode,\n phone: setAddressFormPhone,\n};\n\n// Render the country's own layout: outer array = rows, inner array = fields in that row.\n(addressForm.addressFormat ?? []).map((row) => {\n // A field the country does not use is absent from the form object entirely.\n const keys = row.filter((key) => addressForm[key] != null);\n if (!keys.length) return null;\n\n return (\n <div className=\"address-row\" key={keys.join(\"-\")}>\n {keys.map((key) => {\n // Each entry is an IkasFormItem: value, label, placeholder, hasError, message.\n const field = addressForm[key];\n if (!field) return null; // already guaranteed by the filter above; narrows the type\n return (\n <label key={key}>\n {field.label}\n <input\n value={field.value ?? \"\"}\n placeholder={field.placeholder}\n onInput={(e) => SETTERS[key]?.(addressForm, e.currentTarget.value)}\n />\n {field.hasError && <small>{field.message}</small>}\n </label>\n );\n })}\n </div>\n );\n})\n```",
|
|
9573
9603
|
"categories": [
|
|
9574
9604
|
"Address",
|
|
9575
9605
|
"Form",
|
|
@@ -14862,7 +14892,7 @@
|
|
|
14862
14892
|
{
|
|
14863
14893
|
"name": "getEmptyAddressForm",
|
|
14864
14894
|
"signature": "function getEmptyAddressForm(customerStore: IkasCustomerStore): AddressForm",
|
|
14865
|
-
"description": "Create and return a new, empty address form with validation, wrapped in MobX observability.",
|
|
14895
|
+
"description": "Create and return a new, empty address form with validation, wrapped in MobX observability.\n\nUse this to create an address; use `getIkasCustomerAddressForm(address)` to edit an existing\none. It starts `initAddressForm` internally but does not await it, so await `initAddressForm`\nyourself when you need to know that the country layout (`addressFormat`) and the country/state/\ncity lists are ready to render.",
|
|
14866
14896
|
"params": [
|
|
14867
14897
|
{
|
|
14868
14898
|
"name": "customerStore",
|
|
@@ -14871,14 +14901,16 @@
|
|
|
14871
14901
|
],
|
|
14872
14902
|
"returns": "A new observable address form object with validated fields",
|
|
14873
14903
|
"returnType": "AddressForm",
|
|
14874
|
-
"example": "```
|
|
14904
|
+
"example": "```tsx\nimport {\n customerStore,\n getEmptyAddressForm,\n initAddressForm,\n setAddressFormAddressLine1,\n submitAddressForm,\n} from \"@ikas/bp-storefront\";\n\n// Create the form once, then await init before rendering the country-driven layout.\nconst [form] = useState(() => getEmptyAddressForm(customerStore));\nconst [isLoading, setIsLoading] = useState(true);\nuseEffect(() => {\n initAddressForm(form).then(() => setIsLoading(false));\n}, []);\n\n// Always go through the setters. Assigning `form.addressLine1.value` directly skips\n// re-validation and the dependent-field resets the location setters perform.\nsetAddressFormAddressLine1(form, \"123 Main Street\");\n\n// submitAddressForm validates and saves the address onto the customer itself --\n// do not hand-build a customer object and call saveCustomer for this.\nconst ok = await submitAddressForm(form);\n```",
|
|
14875
14905
|
"categories": [
|
|
14876
14906
|
"Customer",
|
|
14877
14907
|
"Address"
|
|
14878
14908
|
],
|
|
14879
14909
|
"related": [
|
|
14880
|
-
"
|
|
14881
|
-
"
|
|
14910
|
+
"initAddressForm",
|
|
14911
|
+
"submitAddressForm",
|
|
14912
|
+
"getIkasCustomerAddressForm",
|
|
14913
|
+
"deleteCustomerAddress"
|
|
14882
14914
|
],
|
|
14883
14915
|
"isAsync": false,
|
|
14884
14916
|
"isClass": false,
|
|
@@ -15116,6 +15148,105 @@
|
|
|
15116
15148
|
"isClass": true,
|
|
15117
15149
|
"className": "Router"
|
|
15118
15150
|
},
|
|
15151
|
+
{
|
|
15152
|
+
"name": "registerThemeSettingValues",
|
|
15153
|
+
"signature": "function registerThemeSettingValues(values: Record<string, any> | null): void",
|
|
15154
|
+
"description": "Register the live global-variable object (`_g_`) so `getThemeSetting`/`getThemeSettings`\nreturn actual runtime values (constants, computed getters, and in-editor edits) instead\nof the serialized design-time defaults. Called by generated code, not by component authors.",
|
|
15155
|
+
"params": [],
|
|
15156
|
+
"returnType": "void",
|
|
15157
|
+
"categories": [],
|
|
15158
|
+
"related": [],
|
|
15159
|
+
"isAsync": false,
|
|
15160
|
+
"isClass": false
|
|
15161
|
+
},
|
|
15162
|
+
{
|
|
15163
|
+
"name": "getThemeSettings",
|
|
15164
|
+
"signature": "function getThemeSettings(): ThemeSetting[]",
|
|
15165
|
+
"description": "All global variables (Theme Settings) defined for the theme.",
|
|
15166
|
+
"params": [],
|
|
15167
|
+
"returnType": "ThemeSetting[]",
|
|
15168
|
+
"categories": [],
|
|
15169
|
+
"related": [],
|
|
15170
|
+
"isAsync": false,
|
|
15171
|
+
"isClass": false
|
|
15172
|
+
},
|
|
15173
|
+
{
|
|
15174
|
+
"name": "getThemeSetting",
|
|
15175
|
+
"signature": "function getThemeSetting(name: string): ThemeSetting | undefined",
|
|
15176
|
+
"description": "A single global variable by its stable key (`variableName`, e.g. `_6Q0KV7VGGM`).\nDiscover keys via (each item carries a human `displayName`).\nThe returned `value` is the live blueprint value when available, else the default.\nIts shape is discriminated by `type` (see ); note an\nIMAGE setting's value is an image REFERENCE (no `.url`) — resolve with\n`getDefaultSrc`/`getSrc`.",
|
|
15177
|
+
"params": [],
|
|
15178
|
+
"returnType": "ThemeSetting | undefined",
|
|
15179
|
+
"categories": [],
|
|
15180
|
+
"related": [],
|
|
15181
|
+
"isAsync": false,
|
|
15182
|
+
"isClass": false
|
|
15183
|
+
},
|
|
15184
|
+
{
|
|
15185
|
+
"name": "getThemeSettingValue",
|
|
15186
|
+
"signature": "function getThemeSettingValue(name: string): any",
|
|
15187
|
+
"description": "Convenience: the resolved value of a global variable, or `undefined` if not found.",
|
|
15188
|
+
"params": [],
|
|
15189
|
+
"returnType": "any",
|
|
15190
|
+
"categories": [],
|
|
15191
|
+
"related": [],
|
|
15192
|
+
"isAsync": false,
|
|
15193
|
+
"isClass": false
|
|
15194
|
+
},
|
|
15195
|
+
{
|
|
15196
|
+
"name": "getThemeColors",
|
|
15197
|
+
"signature": "function getThemeColors(): RuntimeDesignToken[]",
|
|
15198
|
+
"description": "Theme color tokens. Each carries a resolved value and a `var(--id)` CSS reference.",
|
|
15199
|
+
"params": [],
|
|
15200
|
+
"returnType": "RuntimeDesignToken[]",
|
|
15201
|
+
"categories": [],
|
|
15202
|
+
"related": [],
|
|
15203
|
+
"isAsync": false,
|
|
15204
|
+
"isClass": false
|
|
15205
|
+
},
|
|
15206
|
+
{
|
|
15207
|
+
"name": "getThemeTypography",
|
|
15208
|
+
"signature": "function getThemeTypography(): RuntimeTypographyToken[]",
|
|
15209
|
+
"description": "Theme typography tokens (text styles). Apply `className` or read `resolved` CSS values.",
|
|
15210
|
+
"params": [],
|
|
15211
|
+
"returnType": "RuntimeTypographyToken[]",
|
|
15212
|
+
"categories": [],
|
|
15213
|
+
"related": [],
|
|
15214
|
+
"isAsync": false,
|
|
15215
|
+
"isClass": false
|
|
15216
|
+
},
|
|
15217
|
+
{
|
|
15218
|
+
"name": "getThemeBreakpoints",
|
|
15219
|
+
"signature": "function getThemeBreakpoints(): RuntimeBreakpointToken[]",
|
|
15220
|
+
"description": "Theme responsive breakpoints (`{ id, width }`).",
|
|
15221
|
+
"params": [],
|
|
15222
|
+
"returnType": "RuntimeBreakpointToken[]",
|
|
15223
|
+
"categories": [],
|
|
15224
|
+
"related": [],
|
|
15225
|
+
"isAsync": false,
|
|
15226
|
+
"isClass": false
|
|
15227
|
+
},
|
|
15228
|
+
{
|
|
15229
|
+
"name": "getThemeKeyframes",
|
|
15230
|
+
"signature": "function getThemeKeyframes(): RuntimeKeyframeToken[]",
|
|
15231
|
+
"description": "Theme keyframe/transition animations. Use `ref` as the CSS animation name.",
|
|
15232
|
+
"params": [],
|
|
15233
|
+
"returnType": "RuntimeKeyframeToken[]",
|
|
15234
|
+
"categories": [],
|
|
15235
|
+
"related": [],
|
|
15236
|
+
"isAsync": false,
|
|
15237
|
+
"isClass": false
|
|
15238
|
+
},
|
|
15239
|
+
{
|
|
15240
|
+
"name": "getThemeColorSchemes",
|
|
15241
|
+
"signature": "function getThemeColorSchemes(): RuntimeThemeColorSchemes",
|
|
15242
|
+
"description": "Theme color schemes (palettes). Returns two PARALLEL lists with different jobs:\n- `schemes`: the color SLOTS as `{ id }` only — no colors and no display label live here at\n runtime. A slot's human name is authoring-only (read it via the CLI/MCP `list-theme-globals`\n or the editor); at runtime identify a slot solely by its `id`.\n- `values`: the actual palettes. A palette's colors live in its `colorsByScheme`\n map, keyed by slot id → `{ resolved, cssVar }`.\n\nTo render swatches, iterate `values[].colorsByScheme` (the source of truth for\ncolors), NOT the top-level `schemes` array — `schemes` carries slot ids only, so\niterating it renders empty:\n\n const { values } = getThemeColorSchemes();\n values.forEach(palette =>\n Object.entries(palette.colorsByScheme).forEach(([slotId, { resolved, cssVar }]) => {\n // slotId → stable slot key, cssVar → live var() ref (prefer this), resolved → hex snapshot\n })\n );",
|
|
15243
|
+
"params": [],
|
|
15244
|
+
"returnType": "RuntimeThemeColorSchemes",
|
|
15245
|
+
"categories": [],
|
|
15246
|
+
"related": [],
|
|
15247
|
+
"isAsync": false,
|
|
15248
|
+
"isClass": false
|
|
15249
|
+
},
|
|
15119
15250
|
{
|
|
15120
15251
|
"name": "isBrowser",
|
|
15121
15252
|
"signature": "function isBrowser(yes?: () => void, no?: () => void): void",
|
|
@@ -15196,6 +15327,55 @@
|
|
|
15196
15327
|
"related": [],
|
|
15197
15328
|
"isAsync": false,
|
|
15198
15329
|
"isClass": false
|
|
15330
|
+
},
|
|
15331
|
+
{
|
|
15332
|
+
"name": "PayWithIkas",
|
|
15333
|
+
"signature": "function PayWithIkas({ product, quantity = 1, className, style }: PayWithIkasProps): VNode<ClassAttributes<HTMLIFrameElement> & { ref: MutableRef<HTMLIFrameElement | null>; title: string; ... 4 more ...; style: { ...; }; }> | null",
|
|
15334
|
+
"description": "\"Pay with ikas\" (Hızlı Öde) fast-checkout button for the product detail page.\nDrop-in Preact component that renders the pay-with-ikas checkout iframe and\nwires up its whole message protocol, so a theme gets the one-click \"Hızlı Öde\"\nflow without owning any of the plumbing. Use it next to the add-to-cart button\non the product detail page.\n\nThe pay-with-ikas URL is read from `IkasStorefrontConfig.getPayWithIkasUrl()`;\nwhen the merchant has not enabled Pay with ikas the component renders nothing.\nThe add-to-cart-enabled state is tracked reactively via mobx `autorun`, so the\niframe stays in sync as the product's availability changes (e.g. variant\nselection). Clicking \"Hızlı Öde\" creates a temporary cart via\n`createPayWithIkasSession` and redirects to the returned pay URL.",
|
|
15335
|
+
"params": [
|
|
15336
|
+
{
|
|
15337
|
+
"name": "product",
|
|
15338
|
+
"description": "- The product to fast-checkout via Pay with ikas"
|
|
15339
|
+
},
|
|
15340
|
+
{
|
|
15341
|
+
"name": "quantity",
|
|
15342
|
+
"description": "- Quantity to purchase (defaults to 1)"
|
|
15343
|
+
},
|
|
15344
|
+
{
|
|
15345
|
+
"name": "className",
|
|
15346
|
+
"description": "- Optional CSS class applied to the iframe"
|
|
15347
|
+
},
|
|
15348
|
+
{
|
|
15349
|
+
"name": "style",
|
|
15350
|
+
"description": "- Optional inline styles applied to the iframe"
|
|
15351
|
+
}
|
|
15352
|
+
],
|
|
15353
|
+
"returnType": "VNode<ClassAttributes<HTMLIFrameElement> & { ref: MutableRef<HTMLIFrameElement | null>; title: string; ... 4 more ...; style: { ...; }; }> | null",
|
|
15354
|
+
"example": "```tsx\nimport { PayWithIkas } from \"@ikas/bp-storefront\";\n\n// On the product detail page, alongside the add-to-cart button:\n<PayWithIkas product={product} quantity={quantity} />\n```",
|
|
15355
|
+
"categories": [
|
|
15356
|
+
"ProductDetail",
|
|
15357
|
+
"Checkout"
|
|
15358
|
+
],
|
|
15359
|
+
"related": [
|
|
15360
|
+
"createPayWithIkasSession",
|
|
15361
|
+
"isAddToCartEnabled"
|
|
15362
|
+
],
|
|
15363
|
+
"isAsync": false,
|
|
15364
|
+
"isClass": false,
|
|
15365
|
+
"parameterTypes": [
|
|
15366
|
+
"IkasProps"
|
|
15367
|
+
]
|
|
15368
|
+
},
|
|
15369
|
+
{
|
|
15370
|
+
"name": "normalizeSvg",
|
|
15371
|
+
"signature": "function normalizeSvg(svg: string, options: NormalizeSvgOptions): string",
|
|
15372
|
+
"description": "Isomorphic, DOM-free normalization of a raw SVG markup string for render.\nSafe to call in SSR, browser, and node — pure string transforms only.",
|
|
15373
|
+
"params": [],
|
|
15374
|
+
"returnType": "string",
|
|
15375
|
+
"categories": [],
|
|
15376
|
+
"related": [],
|
|
15377
|
+
"isAsync": false,
|
|
15378
|
+
"isClass": false
|
|
15199
15379
|
}
|
|
15200
15380
|
],
|
|
15201
15381
|
"codeExamples": []
|