@ikas/code-components-mcp 1.4.0-beta.21 → 1.4.0-beta.210
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 +191 -78
- package/data/migration.json +10 -4
- package/data/section-templates/account-info-section/children/AccountFavorites/ikas-config-snippet.json +13 -0
- package/data/section-templates/account-info-section/children/AccountOrders/index.tsx +1 -1
- package/data/section-templates/account-info-section/ikas-config-snippet.json +19 -0
- package/data/section-templates/add-to-cart/ikas-config-snippet.json +17 -0
- package/data/section-templates/add-to-cart/index.tsx +16 -2
- package/data/section-templates/add-to-cart/sub-components/QuantitySelector/index.tsx +11 -3
- package/data/section-templates/add-to-cart/utils/cartLimits.ts +24 -0
- package/data/section-templates/blog-home-section/ikas-config-snippet.json +2 -0
- package/data/section-templates/blog-home-section/index.tsx +2 -1
- package/data/section-templates/blog-post-section/ikas-config-snippet.json +2 -0
- package/data/section-templates/blog-post-section/index.tsx +3 -2
- package/data/section-templates/bundle-products/hooks/useBundleProducts.ts +7 -6
- package/data/section-templates/bundle-products/ikas-config-snippet.json +20 -0
- package/data/section-templates/cart-section/components/EmptyState/index.tsx +1 -1
- package/data/section-templates/cart-section/sub-components/CartItem/index.tsx +66 -24
- package/data/section-templates/cart-section/sub-components/CartItem/styles.css +14 -0
- package/data/section-templates/cart-section/sub-components/QuantitySelector/index.tsx +11 -3
- package/data/section-templates/cart-section/utils/cartLimits.ts +24 -0
- package/data/section-templates/cart-section/utils/cartLineLimits.ts +100 -0
- package/data/section-templates/category-images-section/children/CategoryImageItem/ikas-config-snippet.json +4 -0
- package/data/section-templates/category-images-section/ikas-config-snippet.json +15 -0
- package/data/section-templates/category-list-section/children/CardProductName/ikas-config-snippet.json +2 -1
- package/data/section-templates/category-list-section/ikas-config-snippet.json +21 -0
- package/data/section-templates/category-list-section/index.tsx +2 -1
- package/data/section-templates/component-renderer/additional/ProductDetail/index.tsx +5 -1
- package/data/section-templates/component-renderer/ikas-config-snippet.json +13 -0
- package/data/section-templates/favorites/ikas-config-snippet.json +18 -1
- package/data/section-templates/features-section/ikas-config-snippet.json +13 -0
- package/data/section-templates/footer-section/ikas-config-snippet.json +15 -0
- package/data/section-templates/forgot-password-section/components/ForgotPasswordForm/index.tsx +1 -1
- package/data/section-templates/header-section/children/Announcements/ikas-config-snippet.json +7 -0
- package/data/section-templates/header-section/children/CookieBar/ikas-config-snippet.json +3 -0
- package/data/section-templates/header-section/children/Navbar/components/CartSidebar/index.tsx +2 -1
- package/data/section-templates/header-section/children/Navbar/components/SearchModal/index.tsx +2 -1
- package/data/section-templates/header-section/children/Navbar/ikas-config-snippet.json +27 -0
- package/data/section-templates/header-section/children/Navbar/index.tsx +6 -5
- package/data/section-templates/header-section/ikas-config-snippet.json +13 -0
- package/data/section-templates/header-section/sub-components/CartItem/index.tsx +66 -24
- package/data/section-templates/header-section/sub-components/CartItem/styles.css +14 -0
- package/data/section-templates/header-section/sub-components/QuantitySelector/index.tsx +11 -3
- package/data/section-templates/header-section/utils/cartLimits.ts +24 -0
- package/data/section-templates/header-section/utils/cartLineLimits.ts +100 -0
- package/data/section-templates/hero-slider-section/children/HeroSliderItem/ikas-config-snippet.json +18 -0
- package/data/section-templates/hero-slider-section/children/HeroSliderItem/index.tsx +12 -7
- package/data/section-templates/hero-slider-section/ikas-config-snippet.json +13 -0
- package/data/section-templates/image-handling/ikas-config-snippet.json +53 -0
- package/data/section-templates/image-handling/index.tsx +5 -1
- package/data/section-templates/login-section/ikas-config-snippet.json +2 -0
- package/data/section-templates/navigation/components/CartSidebar/index.tsx +2 -1
- package/data/section-templates/navigation/components/SearchModal/index.tsx +2 -1
- package/data/section-templates/navigation/ikas-config-snippet.json +27 -0
- package/data/section-templates/navigation/index.tsx +6 -5
- package/data/section-templates/navigation/sub-components/CartItem/index.tsx +66 -24
- package/data/section-templates/navigation/sub-components/CartItem/styles.css +14 -0
- package/data/section-templates/navigation/sub-components/QuantitySelector/index.tsx +11 -3
- package/data/section-templates/navigation/utils/cartLimits.ts +24 -0
- package/data/section-templates/navigation/utils/cartLineLimits.ts +100 -0
- package/data/section-templates/product-detail-section/children/ProductDetailAddToCart/ikas-config-snippet.json +17 -0
- package/data/section-templates/product-detail-section/children/ProductDetailAddToCart/index.tsx +16 -2
- package/data/section-templates/product-detail-section/children/ProductDetailBackInStock/components/BackInStockForm/index.tsx +92 -0
- package/data/section-templates/product-detail-section/children/ProductDetailBackInStock/ikas-config-snippet.json +175 -0
- package/data/section-templates/product-detail-section/children/ProductDetailBackInStock/index.tsx +141 -0
- package/data/section-templates/product-detail-section/children/ProductDetailBackInStock/styles.css +47 -0
- package/data/section-templates/product-detail-section/children/ProductDetailBackInStock/types.ts +25 -0
- package/data/section-templates/product-detail-section/children/ProductDetailBundleFurniture/ikas-config-snippet.json +18 -0
- package/data/section-templates/product-detail-section/children/ProductDetailBundleProduct/ikas-config-snippet.json +20 -0
- package/data/section-templates/product-detail-section/children/ProductDetailDescription/ikas-config-snippet.json +27 -0
- package/data/section-templates/product-detail-section/children/ProductDetailFeatures/ikas-config-snippet.json +29 -0
- package/data/section-templates/product-detail-section/children/ProductDetailNameFavorite/ikas-config-snippet.json +18 -1
- package/data/section-templates/product-detail-section/children/ProductDetailOffer/ikas-config-snippet.json +20 -0
- package/data/section-templates/product-detail-section/children/ProductDetailOptionSet/ikas-config-snippet.json +16 -0
- package/data/section-templates/product-detail-section/children/ProductDetailPrices/ikas-config-snippet.json +16 -0
- package/data/section-templates/product-detail-section/children/ProductDetailProductGroup/ikas-config-snippet.json +16 -0
- package/data/section-templates/product-detail-section/children/ProductDetailSku/ikas-config-snippet.json +16 -0
- package/data/section-templates/product-detail-section/children/ProductDetailVariant/ikas-config-snippet.json +17 -0
- package/data/section-templates/product-detail-section/hooks/useBundleProducts.ts +7 -6
- package/data/section-templates/product-detail-section/ikas-config-snippet.json +53 -0
- package/data/section-templates/product-detail-section/index.tsx +5 -1
- package/data/section-templates/product-detail-section/sub-components/Modal/index.tsx +120 -0
- package/data/section-templates/product-detail-section/sub-components/Modal/styles.css +70 -0
- package/data/section-templates/product-detail-section/sub-components/QuantitySelector/index.tsx +11 -3
- package/data/section-templates/product-detail-section/utils/cartLimits.ts +24 -0
- package/data/section-templates/product-pricing/ikas-config-snippet.json +16 -0
- package/data/section-templates/product-slider-section/children/CardProductName/ikas-config-snippet.json +2 -1
- package/data/section-templates/product-slider-section/ikas-config-snippet.json +17 -0
- package/data/section-templates/register-section/ikas-config-snippet.json +2 -0
- package/data/section-templates/variant-selection/ikas-config-snippet.json +17 -0
- package/data/storefront-api.json +682 -39
- package/data/storefront-types.json +9694 -6047
- package/dist/index.js +1575 -42
- 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-10-07T08:06:49.018Z",
|
|
3
3
|
"functions": [
|
|
4
4
|
{
|
|
5
5
|
"name": "apiListProductBrand",
|
|
@@ -43,6 +43,20 @@
|
|
|
43
43
|
"IkasStorefrontWidgetSettings"
|
|
44
44
|
]
|
|
45
45
|
},
|
|
46
|
+
{
|
|
47
|
+
"name": "apiGetLoyaltyProgram",
|
|
48
|
+
"signature": "async function apiGetLoyaltyProgram(): Promise<APIResponse<IkasLoyaltyProgram>>",
|
|
49
|
+
"description": "",
|
|
50
|
+
"params": [],
|
|
51
|
+
"returnType": "Promise<APIResponse<IkasLoyaltyProgram>>",
|
|
52
|
+
"categories": [],
|
|
53
|
+
"related": [],
|
|
54
|
+
"isAsync": true,
|
|
55
|
+
"isClass": false,
|
|
56
|
+
"parameterTypes": [
|
|
57
|
+
"IkasLoyaltyProgram"
|
|
58
|
+
]
|
|
59
|
+
},
|
|
46
60
|
{
|
|
47
61
|
"name": "apiListEarningMethods",
|
|
48
62
|
"signature": "async function apiListEarningMethods(): Promise<APIResponse<IkasLoyaltyProgramEarningMethod[]>>",
|
|
@@ -167,7 +181,7 @@
|
|
|
167
181
|
"name": "getAttributeDetailValues",
|
|
168
182
|
"displayName": "getValues",
|
|
169
183
|
"signature": "function getAttributeDetailValues(attributeDetail: IkasProductAttributeDetail): IkasProductAttributeValue[]",
|
|
170
|
-
"description": "Retrieves the attribute values for a product attribute detail, merging variant and product-level attributes.",
|
|
184
|
+
"description": "Retrieves the attribute values for a product attribute detail, merging variant and product-level attributes.\nThis is how a PRODUCT_ATTRIBUTE code-component prop is consumed: that prop hands you the\nIkasProductAttributeDetail wrapper ({ product, attributePropValue }), never the attribute value itself, so\nreading `prop.value` silently yields nothing — call this function instead.",
|
|
171
185
|
"params": [
|
|
172
186
|
{
|
|
173
187
|
"name": "attributeDetail",
|
|
@@ -195,7 +209,7 @@
|
|
|
195
209
|
"name": "getAttributeListValues",
|
|
196
210
|
"displayName": "getValues",
|
|
197
211
|
"signature": "function getAttributeListValues(list: IkasProductAttributeList): IkasProductAttributeMap[]",
|
|
198
|
-
"description": "Retrieves grouped attribute values for a product attribute list, combining variant and product-level attributes.",
|
|
212
|
+
"description": "Retrieves grouped attribute values for a product attribute list, combining variant and product-level attributes.\nThis is how a PRODUCT_ATTRIBUTE_LIST code-component prop is consumed: that prop hands you a single\nIkasProductAttributeList wrapper ({ product, attributeListPropValue }) — never an array — so mapping over the\nprop is a runtime error; call this function and iterate the returned { attribute, values } maps instead.",
|
|
199
213
|
"params": [
|
|
200
214
|
{
|
|
201
215
|
"name": "list",
|
|
@@ -2761,16 +2775,16 @@
|
|
|
2761
2775
|
{
|
|
2762
2776
|
"name": "getDefaultSrc",
|
|
2763
2777
|
"signature": "function getDefaultSrc(image: IkasImage): string",
|
|
2764
|
-
"description": "Returns the default source URL for an image at 1080px resolution.",
|
|
2778
|
+
"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
2779
|
"params": [
|
|
2766
2780
|
{
|
|
2767
2781
|
"name": "image",
|
|
2768
2782
|
"description": "- The image object to generate the default source URL for."
|
|
2769
2783
|
}
|
|
2770
2784
|
],
|
|
2771
|
-
"returns": "The CDN URL string for the image at 1080px size.",
|
|
2785
|
+
"returns": "The CDN URL string for the image or video at 1080px size.",
|
|
2772
2786
|
"returnType": "string",
|
|
2773
|
-
"example": "```typescript\nimport { getDefaultSrc } from \"@ikas/bp-storefront\";\n\
|
|
2787
|
+
"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
2788
|
"categories": [
|
|
2775
2789
|
"Image"
|
|
2776
2790
|
],
|
|
@@ -2788,16 +2802,16 @@
|
|
|
2788
2802
|
{
|
|
2789
2803
|
"name": "getThumbnailSrc",
|
|
2790
2804
|
"signature": "function getThumbnailSrc(image: IkasImage): string",
|
|
2791
|
-
"description": "Returns the thumbnail source URL for an
|
|
2805
|
+
"description": "Returns the thumbnail source URL for an IMAGE at 180px resolution.\n\nVIDEOS HAVE NO 180px THUMBNAIL and no poster URL. When `image.isVideo === true` the size is\nIGNORED and this returns the same full-size .mp4 as `getDefaultSrc(image)` — so using it in a\nthumbnail-sized box (swatch, cart line, order line) downloads the whole video instead of a\n180px webp. Nothing looks broken, which makes it a silent performance regression.\n\nBranch on `item.isVideo` first and only pass images here. For the video branch in a small,\nstatic context render `<video src={getDefaultSrc(item)} preload=\"metadata\" muted playsInline>`\nwith no `autoPlay`: the browser fetches only the first frame and holds it as a stand-in poster.",
|
|
2792
2806
|
"params": [
|
|
2793
2807
|
{
|
|
2794
2808
|
"name": "image",
|
|
2795
|
-
"description": "- The image object to generate the thumbnail source URL for."
|
|
2809
|
+
"description": "- The image object to generate the thumbnail source URL for. Videos ignore the size."
|
|
2796
2810
|
}
|
|
2797
2811
|
],
|
|
2798
|
-
"returns": "The CDN URL string
|
|
2812
|
+
"returns": "The CDN URL string: a 180px image, or — for `isVideo` items — the original .mp4.",
|
|
2799
2813
|
"returnType": "string",
|
|
2800
|
-
"example": "```typescript\nimport { getThumbnailSrc } from \"@ikas/bp-storefront\";\n\
|
|
2814
|
+
"example": "```typescript\nimport { getThumbnailSrc, getDefaultSrc } from \"@ikas/bp-storefront\";\n\n// Thumbnail rail — branch on isVideo per item (no autoPlay: first frame acts as the poster):\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={getThumbnailSrc(item)} sizes=\"112px\" alt={`Thumb ${i + 1}`} />\n )\n)}\n```",
|
|
2801
2815
|
"categories": [
|
|
2802
2816
|
"Image"
|
|
2803
2817
|
],
|
|
@@ -2815,7 +2829,7 @@
|
|
|
2815
2829
|
{
|
|
2816
2830
|
"name": "getSrc",
|
|
2817
2831
|
"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.",
|
|
2832
|
+
"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
2833
|
"params": [
|
|
2820
2834
|
{
|
|
2821
2835
|
"name": "image",
|
|
@@ -2823,12 +2837,12 @@
|
|
|
2823
2837
|
},
|
|
2824
2838
|
{
|
|
2825
2839
|
"name": "size",
|
|
2826
|
-
"description": "- The desired image width in pixels for
|
|
2840
|
+
"description": "- The desired image width in pixels. Ignored for videos."
|
|
2827
2841
|
}
|
|
2828
2842
|
],
|
|
2829
2843
|
"returns": "The full CDN URL string for the image or video.",
|
|
2830
2844
|
"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```",
|
|
2845
|
+
"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
2846
|
"categories": [
|
|
2833
2847
|
"Image"
|
|
2834
2848
|
],
|
|
@@ -2846,7 +2860,7 @@
|
|
|
2846
2860
|
{
|
|
2847
2861
|
"name": "createMediaSrcset",
|
|
2848
2862
|
"signature": "function createMediaSrcset(image?: IkasImage | null): string",
|
|
2849
|
-
"description": "Generates a complete responsive `srcset` string for an image across all standard sizes (180–3840px).",
|
|
2863
|
+
"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
2864
|
"params": [
|
|
2851
2865
|
{
|
|
2852
2866
|
"name": "image",
|
|
@@ -2855,7 +2869,7 @@
|
|
|
2855
2869
|
],
|
|
2856
2870
|
"returns": "A srcset string like `\"url 180w, url 360w, ...\"`, or an empty string if no image is provided.",
|
|
2857
2871
|
"returnType": "string",
|
|
2858
|
-
"example": "```typescript\nimport { createMediaSrcset, getDefaultSrc } from \"@ikas/bp-storefront\";\n\n<img\n
|
|
2872
|
+
"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
2873
|
"categories": [
|
|
2860
2874
|
"Image"
|
|
2861
2875
|
],
|
|
@@ -3085,6 +3099,35 @@
|
|
|
3085
3099
|
"IkasOrderGiftPackageLine"
|
|
3086
3100
|
]
|
|
3087
3101
|
},
|
|
3102
|
+
{
|
|
3103
|
+
"name": "getIkasOrderGiftCardTotalPrice",
|
|
3104
|
+
"displayName": "getGiftCardTotalPrice",
|
|
3105
|
+
"signature": "function getIkasOrderGiftCardTotalPrice(order: IkasOrder): number",
|
|
3106
|
+
"description": "Returns the total amount covered by the gift cards (and store credits) applied to the order or cart.\n\nThis is a derived value, the API does not return it: it sums `amount` over `order.giftCardLines`.\nSubtract it from `order.totalFinalPrice` to get the amount still due.",
|
|
3107
|
+
"params": [
|
|
3108
|
+
{
|
|
3109
|
+
"name": "order",
|
|
3110
|
+
"description": "- The IkasOrder or IkasCart holding the gift card lines"
|
|
3111
|
+
}
|
|
3112
|
+
],
|
|
3113
|
+
"returns": "The summed gift card amount, or 0 when no gift card is applied",
|
|
3114
|
+
"returnType": "number",
|
|
3115
|
+
"example": "```typescript\nimport { getIkasOrderGiftCardTotalPrice } from \"@ikas/bp-storefront\";\n\nconst giftCardTotal = getIkasOrderGiftCardTotalPrice(cart);\nconst remainingPrice = cart.totalFinalPrice - giftCardTotal;\n```",
|
|
3116
|
+
"categories": [
|
|
3117
|
+
"Order",
|
|
3118
|
+
"Cart"
|
|
3119
|
+
],
|
|
3120
|
+
"related": [
|
|
3121
|
+
"removeGiftCardLine",
|
|
3122
|
+
"saveCouponCode"
|
|
3123
|
+
],
|
|
3124
|
+
"isAsync": false,
|
|
3125
|
+
"isClass": false,
|
|
3126
|
+
"parameterTypes": [
|
|
3127
|
+
"IkasOrderGiftCardTotalPrice",
|
|
3128
|
+
"IkasOrder"
|
|
3129
|
+
]
|
|
3130
|
+
},
|
|
3088
3131
|
{
|
|
3089
3132
|
"name": "getIkasOrderDistinctItemCount",
|
|
3090
3133
|
"displayName": "getDistinctItemCount",
|
|
@@ -4628,7 +4671,7 @@
|
|
|
4628
4671
|
"name": "getIkasProductAttrributeProductIds",
|
|
4629
4672
|
"displayName": "getProductIds",
|
|
4630
4673
|
"signature": "function getIkasProductAttrributeProductIds(value: IkasProductAttributeValue): string[]",
|
|
4631
|
-
"description": "Extracts and returns the product IDs from a PRODUCT-type attribute value's JSON string.",
|
|
4674
|
+
"description": "Extracts and returns the product IDs from a PRODUCT-type attribute value's JSON string.\nNOTE: the export name really is misspelled — \"Attrribute\" with a double r. It is kept as-is because\nrenaming a published export would break every theme that imports it, so import it VERBATIM; the\ncorrectly spelled `getIkasProductAttributeProductIds` does not exist and will not compile. This is\nnot a documentation typo to report or \"fix\". In the blueprint editor the display alias is\n`getProductIds`, which hides the misspelling; only direct TypeScript imports see it.",
|
|
4632
4675
|
"params": [
|
|
4633
4676
|
{
|
|
4634
4677
|
"name": "value",
|
|
@@ -7310,16 +7353,16 @@
|
|
|
7310
7353
|
"name": "getProductVariantMainImage",
|
|
7311
7354
|
"displayName": "getMainImage",
|
|
7312
7355
|
"signature": "function getProductVariantMainImage(variant: IkasProductVariant): IkasProductImage | undefined",
|
|
7313
|
-
"description": "Get the main/primary
|
|
7356
|
+
"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
7357
|
"params": [
|
|
7315
7358
|
{
|
|
7316
7359
|
"name": "variant",
|
|
7317
7360
|
"description": "- The product variant"
|
|
7318
7361
|
}
|
|
7319
7362
|
],
|
|
7320
|
-
"returns": "The first IkasProductImage of the variant, or undefined if no images.
|
|
7363
|
+
"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
7364
|
"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}
|
|
7365
|
+
"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
7366
|
"categories": [
|
|
7324
7367
|
"ProductDetail",
|
|
7325
7368
|
"ProductList"
|
|
@@ -7597,14 +7640,14 @@
|
|
|
7597
7640
|
"name": "getProductVariantAppliedCampaignAmount",
|
|
7598
7641
|
"displayName": "getAppliedCampaignAmount",
|
|
7599
7642
|
"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.",
|
|
7643
|
+
"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
7644
|
"params": [
|
|
7602
7645
|
{
|
|
7603
7646
|
"name": "variant",
|
|
7604
7647
|
"description": "- The product variant to check for applied campaigns"
|
|
7605
7648
|
}
|
|
7606
7649
|
],
|
|
7607
|
-
"returns": "An object
|
|
7650
|
+
"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
7651
|
"returnType": "IkasAppliedCampaignAmount | null",
|
|
7609
7652
|
"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
7653
|
"categories": [
|
|
@@ -7999,6 +8042,36 @@
|
|
|
7999
8042
|
"IkasProductVariant"
|
|
8000
8043
|
]
|
|
8001
8044
|
},
|
|
8045
|
+
{
|
|
8046
|
+
"name": "getProductVariantTieredDiscountProducts",
|
|
8047
|
+
"displayName": "getTieredDiscountProducts",
|
|
8048
|
+
"signature": "function getProductVariantTieredDiscountProducts(variant: IkasProductVariant): IkasTieredDiscountProduct[]",
|
|
8049
|
+
"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.",
|
|
8050
|
+
"params": [
|
|
8051
|
+
{
|
|
8052
|
+
"name": "variant",
|
|
8053
|
+
"description": "- The product variant to resolve tiered discounts for"
|
|
8054
|
+
}
|
|
8055
|
+
],
|
|
8056
|
+
"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",
|
|
8057
|
+
"returnType": "IkasTieredDiscountProduct[]",
|
|
8058
|
+
"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```",
|
|
8059
|
+
"categories": [
|
|
8060
|
+
"Pricing",
|
|
8061
|
+
"ProductVariant"
|
|
8062
|
+
],
|
|
8063
|
+
"related": [
|
|
8064
|
+
"getProductVariantAppliedCampaignAmount",
|
|
8065
|
+
"getProductVariantCampaignOffersDiscountPercentage",
|
|
8066
|
+
"getProductVariantFinalPrice"
|
|
8067
|
+
],
|
|
8068
|
+
"isAsync": false,
|
|
8069
|
+
"isClass": false,
|
|
8070
|
+
"parameterTypes": [
|
|
8071
|
+
"IkasProductVariant",
|
|
8072
|
+
"IkasTieredDiscountProduct"
|
|
8073
|
+
]
|
|
8074
|
+
},
|
|
8002
8075
|
{
|
|
8003
8076
|
"name": "getProductVariantIsBackInStockEnabled",
|
|
8004
8077
|
"displayName": "isBackInStockEnabled",
|
|
@@ -9556,7 +9629,7 @@
|
|
|
9556
9629
|
"name": "initAddressForm",
|
|
9557
9630
|
"displayName": "init",
|
|
9558
9631
|
"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.",
|
|
9632
|
+
"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
9633
|
"params": [
|
|
9561
9634
|
{
|
|
9562
9635
|
"name": "addressForm",
|
|
@@ -9569,7 +9642,7 @@
|
|
|
9569
9642
|
],
|
|
9570
9643
|
"returns": "A promise that resolves once the form is fully initialized, including country/state/city lists, field settings, checkout settings, and shipping zones.",
|
|
9571
9644
|
"returnType": "Promise<void>",
|
|
9572
|
-
"example": "```
|
|
9645
|
+
"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
9646
|
"categories": [
|
|
9574
9647
|
"Address",
|
|
9575
9648
|
"Form",
|
|
@@ -10716,6 +10789,88 @@
|
|
|
10716
10789
|
"isAsync": true,
|
|
10717
10790
|
"isClass": false
|
|
10718
10791
|
},
|
|
10792
|
+
{
|
|
10793
|
+
"name": "initDeactivateCustomerForm",
|
|
10794
|
+
"displayName": "init",
|
|
10795
|
+
"signature": "function initDeactivateCustomerForm(deactivateCustomerForm: DeactivateCustomerForm): void",
|
|
10796
|
+
"description": "Initializes the deactivate customer form with default password field values, labels, and placeholders.",
|
|
10797
|
+
"params": [
|
|
10798
|
+
{
|
|
10799
|
+
"name": "deactivateCustomerForm",
|
|
10800
|
+
"description": "- The deactivate customer form model to initialize"
|
|
10801
|
+
}
|
|
10802
|
+
],
|
|
10803
|
+
"returns": "void",
|
|
10804
|
+
"returnType": "void",
|
|
10805
|
+
"example": "```typescript\nimport { initDeactivateCustomerForm } from \"@ikas/bp-storefront\";\ninitDeactivateCustomerForm(deactivateCustomerForm);\n```",
|
|
10806
|
+
"categories": [
|
|
10807
|
+
"Validation",
|
|
10808
|
+
"DeactivateCustomer",
|
|
10809
|
+
"Form"
|
|
10810
|
+
],
|
|
10811
|
+
"related": [
|
|
10812
|
+
"setDeactivateCustomerFormPassword",
|
|
10813
|
+
"submitDeactivateCustomerForm"
|
|
10814
|
+
],
|
|
10815
|
+
"isAsync": false,
|
|
10816
|
+
"isClass": false
|
|
10817
|
+
},
|
|
10818
|
+
{
|
|
10819
|
+
"name": "setDeactivateCustomerFormPassword",
|
|
10820
|
+
"displayName": "setPassword",
|
|
10821
|
+
"signature": "function setDeactivateCustomerFormPassword(deactivateCustomerForm: DeactivateCustomerForm, value: string): void",
|
|
10822
|
+
"description": "Sets the password value on the deactivate customer form and re-validates if the form has already been submitted.",
|
|
10823
|
+
"params": [
|
|
10824
|
+
{
|
|
10825
|
+
"name": "deactivateCustomerForm",
|
|
10826
|
+
"description": "- The deactivate customer form model to update"
|
|
10827
|
+
},
|
|
10828
|
+
{
|
|
10829
|
+
"name": "value",
|
|
10830
|
+
"description": "- The new password string to set"
|
|
10831
|
+
}
|
|
10832
|
+
],
|
|
10833
|
+
"returns": "void",
|
|
10834
|
+
"returnType": "void",
|
|
10835
|
+
"example": "```typescript\nimport { setDeactivateCustomerFormPassword } from \"@ikas/bp-storefront\";\nsetDeactivateCustomerFormPassword(deactivateCustomerForm, \"mySecurePassword123\");\n```",
|
|
10836
|
+
"categories": [
|
|
10837
|
+
"Validation",
|
|
10838
|
+
"DeactivateCustomer",
|
|
10839
|
+
"Form"
|
|
10840
|
+
],
|
|
10841
|
+
"related": [
|
|
10842
|
+
"initDeactivateCustomerForm",
|
|
10843
|
+
"submitDeactivateCustomerForm"
|
|
10844
|
+
],
|
|
10845
|
+
"isAsync": false,
|
|
10846
|
+
"isClass": false
|
|
10847
|
+
},
|
|
10848
|
+
{
|
|
10849
|
+
"name": "submitDeactivateCustomerForm",
|
|
10850
|
+
"displayName": "submit",
|
|
10851
|
+
"signature": "async function submitDeactivateCustomerForm(deactivateCustomerForm: DeactivateCustomerForm): Promise<boolean>",
|
|
10852
|
+
"description": "Validates and submits the deactivate customer form, deleting the current customer's account after password verification.\nThe customer session is not cleared automatically, call `logout` after a successful submission.",
|
|
10853
|
+
"params": [
|
|
10854
|
+
{
|
|
10855
|
+
"name": "deactivateCustomerForm",
|
|
10856
|
+
"description": "- The deactivate customer form model to submit"
|
|
10857
|
+
}
|
|
10858
|
+
],
|
|
10859
|
+
"returns": "A promise that resolves to true if the account was deactivated successfully, or false on validation error or API failure",
|
|
10860
|
+
"returnType": "Promise<boolean>",
|
|
10861
|
+
"example": "```typescript\nimport { customerStore, logout, submitDeactivateCustomerForm } from \"@ikas/bp-storefront\";\nconst success = await submitDeactivateCustomerForm(deactivateCustomerForm);\nif (success) {\n await logout(customerStore);\n}\n```",
|
|
10862
|
+
"categories": [
|
|
10863
|
+
"Validation",
|
|
10864
|
+
"DeactivateCustomer",
|
|
10865
|
+
"Form"
|
|
10866
|
+
],
|
|
10867
|
+
"related": [
|
|
10868
|
+
"initDeactivateCustomerForm",
|
|
10869
|
+
"setDeactivateCustomerFormPassword"
|
|
10870
|
+
],
|
|
10871
|
+
"isAsync": true,
|
|
10872
|
+
"isClass": false
|
|
10873
|
+
},
|
|
10719
10874
|
{
|
|
10720
10875
|
"name": "initForgotPasswordForm",
|
|
10721
10876
|
"displayName": "init",
|
|
@@ -12559,11 +12714,27 @@
|
|
|
12559
12714
|
"name": "bs_searchProductById",
|
|
12560
12715
|
"displayName": "searchProductById",
|
|
12561
12716
|
"signature": "async function bs_searchProductById(baseStore: BaseStore, params: { productId: string }): Promise<{\n isSuccess: boolean;\n product: IkasProduct | null;\n}>",
|
|
12562
|
-
"description": "",
|
|
12563
|
-
"params": [
|
|
12717
|
+
"description": "Fetches a single product by id and returns it as a full `IkasProduct`.\n\nUse this when a lightweight reference (e.g. a cart line's `IkasOrderLineVariant`, which carries\nneither `salesChannels` nor `stock`) needs product-level data: the returned product includes\n`salesChannels` filtered to the active sales channel (with `minQuantityPerCart` /\n`maxQuantityPerCart`) and per-variant `stock` (summed over the sales channel's configured\nstock locations). `selectedVariantValues` is seeded from the first active variant (or the\nfirst variant when none is active). For multiple ids, prefer `bs_searchProductsById` — one\nbatched request.",
|
|
12718
|
+
"params": [
|
|
12719
|
+
{
|
|
12720
|
+
"name": "baseStore",
|
|
12721
|
+
"description": "- The base store instance"
|
|
12722
|
+
},
|
|
12723
|
+
{
|
|
12724
|
+
"name": "params",
|
|
12725
|
+
"description": "- `{ productId }` — id of the product to fetch"
|
|
12726
|
+
}
|
|
12727
|
+
],
|
|
12728
|
+
"returns": "`{ isSuccess, product }` — `product` is null when not found or on failure",
|
|
12564
12729
|
"returnType": "Promise<{\n isSuccess: boolean;\n product: IkasProduct | null;\n}>",
|
|
12565
|
-
"
|
|
12566
|
-
"
|
|
12730
|
+
"example": "```tsx\nimport { baseStore, bs_searchProductById, IkasStorefrontConfig } from \"@ikas/bp-storefront\";\n\nconst { isSuccess, product } = await bs_searchProductById(baseStore, { productId });\nif (isSuccess && product) {\n const channel = product.salesChannels?.find(sc => sc.id === IkasStorefrontConfig.salesChannelId);\n console.log(channel?.maxQuantityPerCart);\n}\n```",
|
|
12731
|
+
"categories": [
|
|
12732
|
+
"Product",
|
|
12733
|
+
"Search"
|
|
12734
|
+
],
|
|
12735
|
+
"related": [
|
|
12736
|
+
"bs_searchProductsById"
|
|
12737
|
+
],
|
|
12567
12738
|
"isAsync": true,
|
|
12568
12739
|
"isClass": false,
|
|
12569
12740
|
"parameterTypes": [
|
|
@@ -12574,11 +12745,29 @@
|
|
|
12574
12745
|
"name": "bs_searchProductsById",
|
|
12575
12746
|
"displayName": "searchProductsById",
|
|
12576
12747
|
"signature": "async function bs_searchProductsById(baseStore: BaseStore, params: { productIds: string[] }): Promise<{\n isSuccess: boolean;\n products: IkasProduct[] | null;\n}>",
|
|
12577
|
-
"description": "",
|
|
12578
|
-
"params": [
|
|
12748
|
+
"description": "Batch-fetches products by id in a single request and returns them as full `IkasProduct` objects.\n\nThe go-to function when cart lines (or any lightweight reference) need product-level data they\ndo not carry: `IkasOrderLineVariant` has neither `salesChannels` nor `stock`, while the products\nreturned here include `salesChannels` filtered to the active sales channel (with\n`minQuantityPerCart` / `maxQuantityPerCart`) and per-variant `stock` (summed over the sales\nchannel's configured stock locations). Collect the distinct `productId`s of the lines and\nfetch them in ONE call instead of one request per line. Called with an empty `productIds`,\nit returns `{ isSuccess: true, products: [] }` without a network request.",
|
|
12749
|
+
"params": [
|
|
12750
|
+
{
|
|
12751
|
+
"name": "baseStore",
|
|
12752
|
+
"description": "- The base store instance"
|
|
12753
|
+
},
|
|
12754
|
+
{
|
|
12755
|
+
"name": "params",
|
|
12756
|
+
"description": "- `{ productIds }` — product ids to fetch (deduplicate before calling)"
|
|
12757
|
+
}
|
|
12758
|
+
],
|
|
12759
|
+
"returns": "`{ isSuccess, products }` — `products` is null on failure",
|
|
12579
12760
|
"returnType": "Promise<{\n isSuccess: boolean;\n products: IkasProduct[] | null;\n}>",
|
|
12580
|
-
"
|
|
12581
|
-
"
|
|
12761
|
+
"example": "```tsx\nimport { baseStore, bs_searchProductsById, cartStore, IkasStorefrontConfig } from \"@ikas/bp-storefront\";\n\n// Enforce per-cart quantity limits on cart lines:\nconst productIds = [\n ...new Set(\n (cartStore.cart?.orderLineItems ?? [])\n .map(item => item.variant.productId)\n .filter((id): id is string => !!id)\n ),\n];\nconst { products } = await bs_searchProductsById(baseStore, { productIds });\nconst maxByProductId = new Map<string, number | null>();\nfor (const p of products ?? []) {\n const channel = p.salesChannels?.find(sc => sc.id === IkasStorefrontConfig.salesChannelId);\n maxByProductId.set(p.id, channel?.maxQuantityPerCart ?? null);\n}\n```",
|
|
12762
|
+
"categories": [
|
|
12763
|
+
"Product",
|
|
12764
|
+
"Cart",
|
|
12765
|
+
"Search"
|
|
12766
|
+
],
|
|
12767
|
+
"related": [
|
|
12768
|
+
"bs_searchProductById",
|
|
12769
|
+
"changeItemQuantity"
|
|
12770
|
+
],
|
|
12582
12771
|
"isAsync": true,
|
|
12583
12772
|
"isClass": false,
|
|
12584
12773
|
"parameterTypes": [
|
|
@@ -12616,7 +12805,7 @@
|
|
|
12616
12805
|
"name": "addItemToCart",
|
|
12617
12806
|
"displayName": "addVariantToCart",
|
|
12618
12807
|
"signature": "async function addItemToCart(variant: IkasProductVariant, product: IkasProduct, initialQuantity: number = 1, options?: AddItemOptions): Promise<IkasCartOperationResult>",
|
|
12619
|
-
"description": "Add a product variant to the shopping cart.",
|
|
12808
|
+
"description": "Add a product variant to the shopping cart.\n\nClamps the quantity to the sales channel's `minQuantityPerCart`/`maxQuantityPerCart` only\nwhen it creates a new cart line. When the variant already has a line in the cart, the add\nis delegated to `changeItemQuantity` (existing quantity + `initialQuantity`) with no\nclient-side clamp — a quantity past `maxQuantityPerCart` is then rejected by the API with\nthe `MAX_QUANTITY_PER_CART_LIMIT_REACHED` code in `result.response.errorCodes`, never as a\n`validationError`. See `changeItemQuantity` for the handling pattern.",
|
|
12620
12809
|
"params": [
|
|
12621
12810
|
{
|
|
12622
12811
|
"name": "variant",
|
|
@@ -12692,7 +12881,7 @@
|
|
|
12692
12881
|
"name": "changeItemQuantity",
|
|
12693
12882
|
"displayName": "changeQuantityOnCart",
|
|
12694
12883
|
"signature": "async function changeItemQuantity(item: IkasOrderLineItem, quantity: number, offers?: IkasProductOffer[], product?: IkasProduct): Promise<IkasCartOperationResult>",
|
|
12695
|
-
"description": "Change the quantity of an item in the cart.\nUse quantity=0 to remove the item.",
|
|
12884
|
+
"description": "Change the quantity of an item in the cart.\nUse quantity=0 to remove the item.\n\nPerforms no client-side clamping or validation: a quantity above the sales channel's\n`maxQuantityPerCart` is rejected by the API with the `MAX_QUANTITY_PER_CART_LIMIT_REACHED`\ncode in `result.response.errorCodes` (never as a `validationError`). Prevent violations in\nthe stepper and treat the error code as the fallback.",
|
|
12696
12885
|
"params": [
|
|
12697
12886
|
{
|
|
12698
12887
|
"name": "item",
|
|
@@ -12713,7 +12902,7 @@
|
|
|
12713
12902
|
],
|
|
12714
12903
|
"returns": "Result with success flag",
|
|
12715
12904
|
"returnType": "Promise<IkasCartOperationResult>",
|
|
12716
|
-
"example": "```typescript\nimport { cartStore, changeItemQuantity } from \"@ikas/bp-storefront\";\n\n// Increment quantity\nasync function handleIncrement(itemId: string) {\n const item = cartStore.cart?.orderLineItems.find(i => i.id === itemId);\n if (item) {\n const result = await changeItemQuantity(item, item.quantity + 1);\n if (!result.success) {\n showToast(\"Failed to update quantity\");\n }\n }\n}\n\n// Decrement quantity\nasync function handleDecrement(itemId: string) {\n const item = cartStore.cart?.orderLineItems.find(i => i.id === itemId);\n if (item && item.quantity > 1) {\n await changeItemQuantity(item, item.quantity - 1);\n }\n}\n```",
|
|
12905
|
+
"example": "```typescript\nimport { APIErrorCode, cartStore, changeItemQuantity } from \"@ikas/bp-storefront\";\n\n// Increment quantity\nasync function handleIncrement(itemId: string) {\n const item = cartStore.cart?.orderLineItems.find(i => i.id === itemId);\n if (item) {\n const result = await changeItemQuantity(item, item.quantity + 1);\n if (!result.success) {\n const limitHit = result.response?.errorCodes?.includes(\n APIErrorCode.MAX_QUANTITY_PER_CART_LIMIT_REACHED\n );\n showToast(limitHit ? \"Per-cart quantity limit reached\" : \"Failed to update quantity\");\n }\n }\n}\n\n// Decrement quantity\nasync function handleDecrement(itemId: string) {\n const item = cartStore.cart?.orderLineItems.find(i => i.id === itemId);\n if (item && item.quantity > 1) {\n await changeItemQuantity(item, item.quantity - 1);\n }\n}\n```",
|
|
12717
12906
|
"categories": [
|
|
12718
12907
|
"Cart"
|
|
12719
12908
|
],
|
|
@@ -13022,6 +13211,37 @@
|
|
|
13022
13211
|
"IkasCartOperationResult"
|
|
13023
13212
|
]
|
|
13024
13213
|
},
|
|
13214
|
+
{
|
|
13215
|
+
"name": "removeGiftCardLine",
|
|
13216
|
+
"signature": "async function removeGiftCardLine(cart: IkasCart, giftCardId?: string | null): Promise<IkasCartOperationResult>",
|
|
13217
|
+
"description": "Remove a gift card (or store credit) line from the cart.\n\nGift cards are applied through `saveCouponCode` with the gift card code, and the applied\ncards are listed on `cart.giftCardLines`. Pass the `giftCardId` of the line to remove; when\nomitted, every gift card line is removed from the cart.",
|
|
13218
|
+
"params": [
|
|
13219
|
+
{
|
|
13220
|
+
"name": "cart",
|
|
13221
|
+
"description": "- The cart object"
|
|
13222
|
+
},
|
|
13223
|
+
{
|
|
13224
|
+
"name": "giftCardId",
|
|
13225
|
+
"description": "- The gift card to remove, or null/undefined to remove all of them"
|
|
13226
|
+
}
|
|
13227
|
+
],
|
|
13228
|
+
"returns": "Result with success flag",
|
|
13229
|
+
"returnType": "Promise<IkasCartOperationResult>",
|
|
13230
|
+
"example": "```typescript\nimport { cartStore, removeGiftCardLine } from \"@ikas/bp-storefront\";\n\nasync function handleRemoveGiftCard(giftCardId: string) {\n if (!cartStore.cart) return;\n\n const result = await removeGiftCardLine(cartStore.cart, giftCardId);\n if (result.success) {\n showToast(\"Gift card removed\");\n }\n}\n```",
|
|
13231
|
+
"categories": [
|
|
13232
|
+
"Cart"
|
|
13233
|
+
],
|
|
13234
|
+
"related": [
|
|
13235
|
+
"saveCouponCode",
|
|
13236
|
+
"getIkasOrderGiftCardTotalPrice"
|
|
13237
|
+
],
|
|
13238
|
+
"isAsync": true,
|
|
13239
|
+
"isClass": false,
|
|
13240
|
+
"parameterTypes": [
|
|
13241
|
+
"IkasCart",
|
|
13242
|
+
"IkasCartOperationResult"
|
|
13243
|
+
]
|
|
13244
|
+
},
|
|
13025
13245
|
{
|
|
13026
13246
|
"name": "getCart",
|
|
13027
13247
|
"signature": "async function getCart(): Promise<void>",
|
|
@@ -13301,6 +13521,171 @@
|
|
|
13301
13521
|
"IkasCustomerStore"
|
|
13302
13522
|
]
|
|
13303
13523
|
},
|
|
13524
|
+
{
|
|
13525
|
+
"name": "milesSmilesBind",
|
|
13526
|
+
"signature": "async function milesSmilesBind(customerStore: IkasCustomerStore, redirect?: string | null): Promise<MilesSmilesBindResult>",
|
|
13527
|
+
"description": "Start the Turkish Airlines Miles&Smiles account bind flow for the logged-in customer.\nOpens the THY login page in a popup; once THY confirms, the browser is sent to the\nikas bind callback and lands back on `redirect` with `milesSmilesStatus` query params\n(see handleMilesSmilesBind). Binding is required before miles can be spent at checkout.",
|
|
13528
|
+
"params": [
|
|
13529
|
+
{
|
|
13530
|
+
"name": "customerStore",
|
|
13531
|
+
"description": "- The customer store instance (customer must be logged in)"
|
|
13532
|
+
},
|
|
13533
|
+
{
|
|
13534
|
+
"name": "redirect",
|
|
13535
|
+
"description": "- Relative store path to land on after bind, e.g. \"/account\" or \"/checkout?id=...&step=payment\""
|
|
13536
|
+
}
|
|
13537
|
+
],
|
|
13538
|
+
"returns": "`isSuccess: true` when the bind hand-off started; otherwise an `errorCode`\nsuch as \"AUTHORIZATION_REQUIRED\" or \"MILES_SMILES_LOGIN_CANCELLED_OR_FAILED\"",
|
|
13539
|
+
"returnType": "Promise<MilesSmilesBindResult>",
|
|
13540
|
+
"example": "```typescript\nimport { customerStore, milesSmilesBind } from \"@ikas/bp-storefront\";\n\nasync function onLinkClick() {\n const result = await milesSmilesBind(customerStore, \"/account\");\n if (!result.isSuccess) showToast(result.errorCode || \"UNEXPECTED_ERROR\");\n}\n```",
|
|
13541
|
+
"categories": [
|
|
13542
|
+
"Customer",
|
|
13543
|
+
"Miles&Smiles"
|
|
13544
|
+
],
|
|
13545
|
+
"related": [
|
|
13546
|
+
"handleMilesSmilesBind",
|
|
13547
|
+
"getMilesSmilesLink",
|
|
13548
|
+
"unlinkMilesSmiles",
|
|
13549
|
+
"getMilesSmilesDetails"
|
|
13550
|
+
],
|
|
13551
|
+
"isAsync": true,
|
|
13552
|
+
"isClass": false,
|
|
13553
|
+
"parameterTypes": [
|
|
13554
|
+
"IkasCustomerStore"
|
|
13555
|
+
]
|
|
13556
|
+
},
|
|
13557
|
+
{
|
|
13558
|
+
"name": "handleMilesSmilesBind",
|
|
13559
|
+
"signature": "function handleMilesSmilesBind(clear: boolean = true): HandleMilesSmilesBindReturnType | null",
|
|
13560
|
+
"description": "Read the Miles&Smiles bind result from the current URL after THY redirects back\n(`?milesSmilesStatus=success` or `?milesSmilesStatus=fail&milesSmilesError=CODE`).\nCall this on the landing page (account or checkout). The params are removed from the\nURL so a refresh does not repeat the same message.",
|
|
13561
|
+
"params": [
|
|
13562
|
+
{
|
|
13563
|
+
"name": "clear",
|
|
13564
|
+
"description": "- Remove the params from the URL with history.replaceState (default: true)"
|
|
13565
|
+
}
|
|
13566
|
+
],
|
|
13567
|
+
"returns": "The landing result, or null when the URL carries no bind result",
|
|
13568
|
+
"returnType": "HandleMilesSmilesBindReturnType | null",
|
|
13569
|
+
"example": "```typescript\nimport { handleMilesSmilesBind } from \"@ikas/bp-storefront\";\n\nuseEffect(() => {\n const result = handleMilesSmilesBind();\n if (result?.status === \"success\") showToast(\"Miles&Smiles account linked\");\n if (result?.status === \"fail\") showToast(result.errorCode || \"Bind failed\");\n}, []);\n```",
|
|
13570
|
+
"categories": [
|
|
13571
|
+
"Customer",
|
|
13572
|
+
"Miles&Smiles"
|
|
13573
|
+
],
|
|
13574
|
+
"related": [
|
|
13575
|
+
"milesSmilesBind",
|
|
13576
|
+
"getMilesSmilesLink"
|
|
13577
|
+
],
|
|
13578
|
+
"isAsync": false,
|
|
13579
|
+
"isClass": false
|
|
13580
|
+
},
|
|
13581
|
+
{
|
|
13582
|
+
"name": "getMilesSmilesLink",
|
|
13583
|
+
"signature": "async function getMilesSmilesLink(customerStore: IkasCustomerStore): Promise<APIResponse<ExternalAccountLink | null>>",
|
|
13584
|
+
"description": "Get the customer's durable Miles&Smiles link (TK membership number and link date).\nA link does not guarantee a live checkout session; when getMilesSmilesDetails returns\nMILES_SMILES_LOGIN_REQUIRED, run milesSmilesBind again.",
|
|
13585
|
+
"params": [
|
|
13586
|
+
{
|
|
13587
|
+
"name": "customerStore",
|
|
13588
|
+
"description": "- The customer store instance"
|
|
13589
|
+
}
|
|
13590
|
+
],
|
|
13591
|
+
"returns": "API response whose data is the link, or null when not linked",
|
|
13592
|
+
"returnType": "Promise<APIResponse<ExternalAccountLink | null>>",
|
|
13593
|
+
"example": "```typescript\nimport { customerStore, getMilesSmilesLink } from \"@ikas/bp-storefront\";\n\nconst response = await getMilesSmilesLink(customerStore);\nconst tkNumber = response.data?.externalId;\n```",
|
|
13594
|
+
"categories": [
|
|
13595
|
+
"Customer",
|
|
13596
|
+
"Miles&Smiles"
|
|
13597
|
+
],
|
|
13598
|
+
"related": [
|
|
13599
|
+
"milesSmilesBind",
|
|
13600
|
+
"unlinkMilesSmiles"
|
|
13601
|
+
],
|
|
13602
|
+
"isAsync": true,
|
|
13603
|
+
"isClass": false,
|
|
13604
|
+
"parameterTypes": [
|
|
13605
|
+
"IkasCustomerStore"
|
|
13606
|
+
]
|
|
13607
|
+
},
|
|
13608
|
+
{
|
|
13609
|
+
"name": "unlinkMilesSmiles",
|
|
13610
|
+
"signature": "async function unlinkMilesSmiles(customerStore: IkasCustomerStore): Promise<APIResponse<boolean>>",
|
|
13611
|
+
"description": "Remove the customer's Miles&Smiles link. Also clears the server-side checkout\nsession token, so miles cannot be spent until the customer binds again.",
|
|
13612
|
+
"params": [
|
|
13613
|
+
{
|
|
13614
|
+
"name": "customerStore",
|
|
13615
|
+
"description": "- The customer store instance"
|
|
13616
|
+
}
|
|
13617
|
+
],
|
|
13618
|
+
"returns": "API response whose data is true on success",
|
|
13619
|
+
"returnType": "Promise<APIResponse<boolean>>",
|
|
13620
|
+
"example": "```typescript\nimport { customerStore, unlinkMilesSmiles } from \"@ikas/bp-storefront\";\n\nconst response = await unlinkMilesSmiles(customerStore);\nif (response.isSuccess) showToast(\"Miles&Smiles link removed\");\n```",
|
|
13621
|
+
"categories": [
|
|
13622
|
+
"Customer",
|
|
13623
|
+
"Miles&Smiles"
|
|
13624
|
+
],
|
|
13625
|
+
"related": [
|
|
13626
|
+
"milesSmilesBind",
|
|
13627
|
+
"getMilesSmilesLink"
|
|
13628
|
+
],
|
|
13629
|
+
"isAsync": true,
|
|
13630
|
+
"isClass": false,
|
|
13631
|
+
"parameterTypes": [
|
|
13632
|
+
"IkasCustomerStore"
|
|
13633
|
+
]
|
|
13634
|
+
},
|
|
13635
|
+
{
|
|
13636
|
+
"name": "getMilesSmilesDetails",
|
|
13637
|
+
"signature": "async function getMilesSmilesDetails(customerStore: IkasCustomerStore): Promise<APIResponse<MilesSmilesDetailsResponse | undefined>>",
|
|
13638
|
+
"description": "Get the Miles&Smiles balance and member details for the payment step.\nRequires a recent bind; MILES_SMILES_LOGIN_REQUIRED means the short-lived session\nexpired and milesSmilesBind should be run again. MILES_SMILES_NOT_ENABLED and\nPAYMENT_GATEWAY_NOT_FOUND mean the Miles UI should be hidden.",
|
|
13639
|
+
"params": [
|
|
13640
|
+
{
|
|
13641
|
+
"name": "customerStore",
|
|
13642
|
+
"description": "- The customer store instance"
|
|
13643
|
+
}
|
|
13644
|
+
],
|
|
13645
|
+
"returns": "API response whose data holds availableMiles, memberId, firstName and lastName",
|
|
13646
|
+
"returnType": "Promise<APIResponse<MilesSmilesDetailsResponse | undefined>>",
|
|
13647
|
+
"example": "```typescript\nimport { customerStore, getMilesSmilesDetails } from \"@ikas/bp-storefront\";\n\nconst response = await getMilesSmilesDetails(customerStore);\nif (response.errorCodes.includes(\"MILES_SMILES_LOGIN_REQUIRED\")) {\n await milesSmilesBind(customerStore, window.location.pathname + window.location.search);\n} else if (response.data) {\n console.log(\"Available miles:\", response.data.availableMiles);\n}\n```",
|
|
13648
|
+
"categories": [
|
|
13649
|
+
"Customer",
|
|
13650
|
+
"Miles&Smiles"
|
|
13651
|
+
],
|
|
13652
|
+
"related": [
|
|
13653
|
+
"milesSmilesBind",
|
|
13654
|
+
"getMilesSmilesLink"
|
|
13655
|
+
],
|
|
13656
|
+
"isAsync": true,
|
|
13657
|
+
"isClass": false,
|
|
13658
|
+
"parameterTypes": [
|
|
13659
|
+
"IkasCustomerStore"
|
|
13660
|
+
]
|
|
13661
|
+
},
|
|
13662
|
+
{
|
|
13663
|
+
"name": "isMilesSmilesTransaction",
|
|
13664
|
+
"signature": "function isMilesSmilesTransaction(transaction: IkasOrderTransaction): boolean",
|
|
13665
|
+
"description": "Check whether an order transaction is the Miles&Smiles leg of a multi-tender payment.\nSuch rows are written on the synthetic MILES_SMILES gateway and are not refundable from the storefront.",
|
|
13666
|
+
"params": [
|
|
13667
|
+
{
|
|
13668
|
+
"name": "transaction",
|
|
13669
|
+
"description": "- The order transaction to check"
|
|
13670
|
+
}
|
|
13671
|
+
],
|
|
13672
|
+
"returns": "True when the transaction is a Miles&Smiles SALE",
|
|
13673
|
+
"returnType": "boolean",
|
|
13674
|
+
"example": "```typescript\nimport { isMilesSmilesTransaction } from \"@ikas/bp-storefront\";\n\nconst label = isMilesSmilesTransaction(tx) ? \"Miles&Smiles\" : tx.paymentGatewayName;\n```",
|
|
13675
|
+
"categories": [
|
|
13676
|
+
"Customer",
|
|
13677
|
+
"Orders",
|
|
13678
|
+
"Miles&Smiles"
|
|
13679
|
+
],
|
|
13680
|
+
"related": [
|
|
13681
|
+
"getOrderTransactions"
|
|
13682
|
+
],
|
|
13683
|
+
"isAsync": false,
|
|
13684
|
+
"isClass": false,
|
|
13685
|
+
"parameterTypes": [
|
|
13686
|
+
"IkasOrderTransaction"
|
|
13687
|
+
]
|
|
13688
|
+
},
|
|
13304
13689
|
{
|
|
13305
13690
|
"name": "deleteCustomerAddress",
|
|
13306
13691
|
"signature": "async function deleteCustomerAddress(customerStore: IkasCustomerStore, address: IkasCustomerAddress): Promise<boolean>",
|
|
@@ -13922,7 +14307,8 @@
|
|
|
13922
14307
|
],
|
|
13923
14308
|
"related": [
|
|
13924
14309
|
"hasCustomer",
|
|
13925
|
-
"logout"
|
|
14310
|
+
"logout",
|
|
14311
|
+
"getDeactivateCustomerForm"
|
|
13926
14312
|
],
|
|
13927
14313
|
"isAsync": true,
|
|
13928
14314
|
"isClass": false,
|
|
@@ -14493,6 +14879,58 @@
|
|
|
14493
14879
|
"IkasCustomerStore"
|
|
14494
14880
|
]
|
|
14495
14881
|
},
|
|
14882
|
+
{
|
|
14883
|
+
"name": "getDeactivateCustomerForm",
|
|
14884
|
+
"signature": "function getDeactivateCustomerForm(customerStore: IkasCustomerStore): DeactivateCustomerForm",
|
|
14885
|
+
"description": "Get or initialize the deactivate customer form with validation for deleting the current customer's account.",
|
|
14886
|
+
"params": [
|
|
14887
|
+
{
|
|
14888
|
+
"name": "customerStore",
|
|
14889
|
+
"description": "- The customer store instance"
|
|
14890
|
+
}
|
|
14891
|
+
],
|
|
14892
|
+
"returns": "The deactivate customer form object with validated fields",
|
|
14893
|
+
"returnType": "DeactivateCustomerForm",
|
|
14894
|
+
"example": "```typescript\nimport {\n customerStore,\n getDeactivateCustomerForm,\n setDeactivateCustomerFormPassword,\n submitDeactivateCustomerForm,\n logout,\n} from \"@ikas/bp-storefront\";\n\nfunction DeleteAccountPage() {\n const form = getDeactivateCustomerForm(customerStore);\n\n const handleSubmit = async () => {\n const isSuccess = await submitDeactivateCustomerForm(form);\n if (isSuccess) {\n await logout(customerStore);\n Router.navigateToPage(\"INDEX\");\n }\n };\n\n return (\n <form>\n <input\n type=\"password\"\n value={form.password.value}\n onChange={e => setDeactivateCustomerFormPassword(form, e.target.value)}\n />\n <button onClick={handleSubmit}>Delete Account</button>\n </form>\n );\n}\n```",
|
|
14895
|
+
"categories": [
|
|
14896
|
+
"Customer",
|
|
14897
|
+
"Account"
|
|
14898
|
+
],
|
|
14899
|
+
"related": [
|
|
14900
|
+
"clearDeactivateCustomerForm",
|
|
14901
|
+
"deactivateCustomer"
|
|
14902
|
+
],
|
|
14903
|
+
"isAsync": false,
|
|
14904
|
+
"isClass": false,
|
|
14905
|
+
"parameterTypes": [
|
|
14906
|
+
"IkasCustomerStore"
|
|
14907
|
+
]
|
|
14908
|
+
},
|
|
14909
|
+
{
|
|
14910
|
+
"name": "clearDeactivateCustomerForm",
|
|
14911
|
+
"signature": "function clearDeactivateCustomerForm(customerStore: IkasCustomerStore): void",
|
|
14912
|
+
"description": "Clear the cached deactivate customer form, forcing a fresh form on next retrieval.",
|
|
14913
|
+
"params": [
|
|
14914
|
+
{
|
|
14915
|
+
"name": "customerStore",
|
|
14916
|
+
"description": "- The customer store instance"
|
|
14917
|
+
}
|
|
14918
|
+
],
|
|
14919
|
+
"returnType": "void",
|
|
14920
|
+
"example": "```typescript\nimport { customerStore, clearDeactivateCustomerForm } from \"@ikas/bp-storefront\";\n\nfunction handleDeactivateCustomerReset() {\n clearDeactivateCustomerForm(customerStore);\n}\n```",
|
|
14921
|
+
"categories": [
|
|
14922
|
+
"Customer",
|
|
14923
|
+
"Account"
|
|
14924
|
+
],
|
|
14925
|
+
"related": [
|
|
14926
|
+
"getDeactivateCustomerForm"
|
|
14927
|
+
],
|
|
14928
|
+
"isAsync": false,
|
|
14929
|
+
"isClass": false,
|
|
14930
|
+
"parameterTypes": [
|
|
14931
|
+
"IkasCustomerStore"
|
|
14932
|
+
]
|
|
14933
|
+
},
|
|
14496
14934
|
{
|
|
14497
14935
|
"name": "getForgotPasswordForm",
|
|
14498
14936
|
"signature": "function getForgotPasswordForm(customerStore: IkasCustomerStore): ForgotPasswordForm",
|
|
@@ -14862,7 +15300,7 @@
|
|
|
14862
15300
|
{
|
|
14863
15301
|
"name": "getEmptyAddressForm",
|
|
14864
15302
|
"signature": "function getEmptyAddressForm(customerStore: IkasCustomerStore): AddressForm",
|
|
14865
|
-
"description": "Create and return a new, empty address form with validation, wrapped in MobX observability.",
|
|
15303
|
+
"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
15304
|
"params": [
|
|
14867
15305
|
{
|
|
14868
15306
|
"name": "customerStore",
|
|
@@ -14871,14 +15309,16 @@
|
|
|
14871
15309
|
],
|
|
14872
15310
|
"returns": "A new observable address form object with validated fields",
|
|
14873
15311
|
"returnType": "AddressForm",
|
|
14874
|
-
"example": "```
|
|
15312
|
+
"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
15313
|
"categories": [
|
|
14876
15314
|
"Customer",
|
|
14877
15315
|
"Address"
|
|
14878
15316
|
],
|
|
14879
15317
|
"related": [
|
|
14880
|
-
"
|
|
14881
|
-
"
|
|
15318
|
+
"initAddressForm",
|
|
15319
|
+
"submitAddressForm",
|
|
15320
|
+
"getIkasCustomerAddressForm",
|
|
15321
|
+
"deleteCustomerAddress"
|
|
14882
15322
|
],
|
|
14883
15323
|
"isAsync": false,
|
|
14884
15324
|
"isClass": false,
|
|
@@ -15116,6 +15556,128 @@
|
|
|
15116
15556
|
"isClass": true,
|
|
15117
15557
|
"className": "Router"
|
|
15118
15558
|
},
|
|
15559
|
+
{
|
|
15560
|
+
"name": "withRoutePrefix",
|
|
15561
|
+
"signature": "function withRoutePrefix(path: string): string",
|
|
15562
|
+
"description": "Put the visitor's storefront routing in front of a path you wrote yourself.\n\nEntity links (`getProductHref`, `getIkasOrderHref`, …) and LINK props already carry the prefix.\nA literal path in your own markup does not: `href=\"/cart\"` sends a visitor browsing `/en` to the\ndefault language. Wrap it, and a store with no extra routings gets the path back unchanged.\n\nIdempotent — a path that already starts with a supported routing segment is returned as-is.\nAnything that is not a path on this storefront — an absolute URL, `mailto:`, `tel:` — is returned\nuntouched, so a merchant-authored prop can be wrapped without checking it first.",
|
|
15563
|
+
"params": [
|
|
15564
|
+
{
|
|
15565
|
+
"name": "path",
|
|
15566
|
+
"description": "- A path on this storefront, starting with `/`"
|
|
15567
|
+
}
|
|
15568
|
+
],
|
|
15569
|
+
"returns": "The path under the current routing (e.g. `/cart` → `/en/cart`)",
|
|
15570
|
+
"returnType": "string",
|
|
15571
|
+
"example": "```tsx\nimport { Router, withRoutePrefix } from \"@ikas/bp-storefront\";\n\n// Correct href for crawlers, middle-click and open-in-new-tab...\n<a href={withRoutePrefix(\"/cart\")} onClick={e => {\n e.preventDefault();\n Router.navigateToPage(\"CART\"); // ...and this prefixes on its own.\n}}>Cart</a>\n```",
|
|
15572
|
+
"categories": [
|
|
15573
|
+
"Navigation"
|
|
15574
|
+
],
|
|
15575
|
+
"related": [
|
|
15576
|
+
"navigate",
|
|
15577
|
+
"navigateToPage"
|
|
15578
|
+
],
|
|
15579
|
+
"isAsync": false,
|
|
15580
|
+
"isClass": false
|
|
15581
|
+
},
|
|
15582
|
+
{
|
|
15583
|
+
"name": "registerThemeSettingValues",
|
|
15584
|
+
"signature": "function registerThemeSettingValues(values: Record<string, any> | null): void",
|
|
15585
|
+
"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.",
|
|
15586
|
+
"params": [],
|
|
15587
|
+
"returnType": "void",
|
|
15588
|
+
"categories": [],
|
|
15589
|
+
"related": [],
|
|
15590
|
+
"isAsync": false,
|
|
15591
|
+
"isClass": false
|
|
15592
|
+
},
|
|
15593
|
+
{
|
|
15594
|
+
"name": "getThemeSettings",
|
|
15595
|
+
"signature": "function getThemeSettings(): ThemeSetting[]",
|
|
15596
|
+
"description": "All global variables (Theme Settings) defined for the theme.",
|
|
15597
|
+
"params": [],
|
|
15598
|
+
"returnType": "ThemeSetting[]",
|
|
15599
|
+
"categories": [],
|
|
15600
|
+
"related": [],
|
|
15601
|
+
"isAsync": false,
|
|
15602
|
+
"isClass": false
|
|
15603
|
+
},
|
|
15604
|
+
{
|
|
15605
|
+
"name": "getThemeSetting",
|
|
15606
|
+
"signature": "function getThemeSetting(name: string): ThemeSetting | undefined",
|
|
15607
|
+
"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`. An ENUM setting's `value` is one of its enum's option VALUES\n(or null) and the setting also carries `enumTypeId` and `options` (`{ label: value }`);\nin a code component prefer the typed `themeValue(\"_key\")` from `./global-types`, which\nnarrows the value to the enum's union.",
|
|
15608
|
+
"params": [],
|
|
15609
|
+
"returnType": "ThemeSetting | undefined",
|
|
15610
|
+
"categories": [],
|
|
15611
|
+
"related": [],
|
|
15612
|
+
"isAsync": false,
|
|
15613
|
+
"isClass": false
|
|
15614
|
+
},
|
|
15615
|
+
{
|
|
15616
|
+
"name": "getThemeSettingValue",
|
|
15617
|
+
"signature": "function getThemeSettingValue(name: string): any",
|
|
15618
|
+
"description": "Convenience: the resolved value of a global variable, or `undefined` if not found.",
|
|
15619
|
+
"params": [],
|
|
15620
|
+
"returnType": "any",
|
|
15621
|
+
"categories": [],
|
|
15622
|
+
"related": [],
|
|
15623
|
+
"isAsync": false,
|
|
15624
|
+
"isClass": false
|
|
15625
|
+
},
|
|
15626
|
+
{
|
|
15627
|
+
"name": "getThemeColors",
|
|
15628
|
+
"signature": "function getThemeColors(): RuntimeDesignToken[]",
|
|
15629
|
+
"description": "Theme color tokens. Each carries a resolved value and a `var(--id)` CSS reference.",
|
|
15630
|
+
"params": [],
|
|
15631
|
+
"returnType": "RuntimeDesignToken[]",
|
|
15632
|
+
"categories": [],
|
|
15633
|
+
"related": [],
|
|
15634
|
+
"isAsync": false,
|
|
15635
|
+
"isClass": false
|
|
15636
|
+
},
|
|
15637
|
+
{
|
|
15638
|
+
"name": "getThemeTypography",
|
|
15639
|
+
"signature": "function getThemeTypography(): RuntimeTypographyToken[]",
|
|
15640
|
+
"description": "Theme typography tokens (text styles). Apply `className` or read `resolved` CSS values.",
|
|
15641
|
+
"params": [],
|
|
15642
|
+
"returnType": "RuntimeTypographyToken[]",
|
|
15643
|
+
"categories": [],
|
|
15644
|
+
"related": [],
|
|
15645
|
+
"isAsync": false,
|
|
15646
|
+
"isClass": false
|
|
15647
|
+
},
|
|
15648
|
+
{
|
|
15649
|
+
"name": "getThemeBreakpoints",
|
|
15650
|
+
"signature": "function getThemeBreakpoints(): RuntimeBreakpointToken[]",
|
|
15651
|
+
"description": "Theme responsive breakpoints (`{ id, width }`).",
|
|
15652
|
+
"params": [],
|
|
15653
|
+
"returnType": "RuntimeBreakpointToken[]",
|
|
15654
|
+
"categories": [],
|
|
15655
|
+
"related": [],
|
|
15656
|
+
"isAsync": false,
|
|
15657
|
+
"isClass": false
|
|
15658
|
+
},
|
|
15659
|
+
{
|
|
15660
|
+
"name": "getThemeKeyframes",
|
|
15661
|
+
"signature": "function getThemeKeyframes(): RuntimeKeyframeToken[]",
|
|
15662
|
+
"description": "Theme keyframe/transition animations. Use `ref` as the CSS animation name.",
|
|
15663
|
+
"params": [],
|
|
15664
|
+
"returnType": "RuntimeKeyframeToken[]",
|
|
15665
|
+
"categories": [],
|
|
15666
|
+
"related": [],
|
|
15667
|
+
"isAsync": false,
|
|
15668
|
+
"isClass": false
|
|
15669
|
+
},
|
|
15670
|
+
{
|
|
15671
|
+
"name": "getThemeColorSchemes",
|
|
15672
|
+
"signature": "function getThemeColorSchemes(): RuntimeThemeColorSchemes",
|
|
15673
|
+
"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 );",
|
|
15674
|
+
"params": [],
|
|
15675
|
+
"returnType": "RuntimeThemeColorSchemes",
|
|
15676
|
+
"categories": [],
|
|
15677
|
+
"related": [],
|
|
15678
|
+
"isAsync": false,
|
|
15679
|
+
"isClass": false
|
|
15680
|
+
},
|
|
15119
15681
|
{
|
|
15120
15682
|
"name": "isBrowser",
|
|
15121
15683
|
"signature": "function isBrowser(yes?: () => void, no?: () => void): void",
|
|
@@ -15142,6 +15704,38 @@
|
|
|
15142
15704
|
"IkasComponentRendererProps"
|
|
15143
15705
|
]
|
|
15144
15706
|
},
|
|
15707
|
+
{
|
|
15708
|
+
"name": "formatCurrency",
|
|
15709
|
+
"signature": "function formatCurrency(price: number, currencyCode: string, currencySymbol: string | null): string",
|
|
15710
|
+
"description": "Format a free-standing amount with the merchant's currency format settings. Use this for\namounts that are NOT tied to a model (remaining amount to free shipping, gift wrap threshold,\nbulk discount limits, cart limit warnings). For model-bound prices, prefer the\n`get*FormattedPrice` helpers — they call this function internally.\n\nApplies the merchant's `currencyFormats` entry for the given currency code (symbol,\nsymbolPosition, thousandSeparator, decimalSeparator, omitZeroDecimal). Behavior details:\nalways two decimal places, and a space between the symbol and the number. `omitZeroDecimal`\ndrops the fraction only when it is exactly `00`.\n\nDo NOT use `Intl.NumberFormat` for currency — it falls back to the browser locale and\nproduces a format that conflicts with platform-formatted prices on the same screen.",
|
|
15711
|
+
"params": [
|
|
15712
|
+
{
|
|
15713
|
+
"name": "price",
|
|
15714
|
+
"description": "- The amount to format"
|
|
15715
|
+
},
|
|
15716
|
+
{
|
|
15717
|
+
"name": "currencyCode",
|
|
15718
|
+
"description": "- Currency code used to look up the merchant format settings (e.g. \"TRY\", \"USD\")"
|
|
15719
|
+
},
|
|
15720
|
+
{
|
|
15721
|
+
"name": "currencySymbol",
|
|
15722
|
+
"description": "- Fallback symbol used when the merchant has no format entry for the code.\nAlways pass the symbol from the model you took the amount from (e.g. `cart.currencySymbol`) —\npassing `null` can render the amount with no symbol at all."
|
|
15723
|
+
}
|
|
15724
|
+
],
|
|
15725
|
+
"returns": "The amount formatted with the merchant's currency format (e.g. \"₺ 1,950.00\")",
|
|
15726
|
+
"returnType": "string",
|
|
15727
|
+
"example": "```typescript\nimport { cartStore, formatCurrency } from \"@ikas/bp-storefront\";\n\nfunction FreeShippingBar({ threshold }: { threshold: number }) {\n const cart = cartStore.cart;\n if (!cart) return null;\n\n const remaining = threshold - cart.totalFinalPrice;\n if (remaining <= 0) return <span>Free shipping unlocked!</span>;\n\n return <span>Add {formatCurrency(remaining, cart.currencyCode, cart.currencySymbol)} more for free shipping</span>;\n}\n```",
|
|
15728
|
+
"categories": [
|
|
15729
|
+
"Pricing"
|
|
15730
|
+
],
|
|
15731
|
+
"related": [
|
|
15732
|
+
"getProductVariantFormattedFinalPrice",
|
|
15733
|
+
"getOrderLineItemFormattedFinalPrice",
|
|
15734
|
+
"getIkasOrderFormattedTotalFinalPrice"
|
|
15735
|
+
],
|
|
15736
|
+
"isAsync": false,
|
|
15737
|
+
"isClass": false
|
|
15738
|
+
},
|
|
15145
15739
|
{
|
|
15146
15740
|
"name": "httpRequest",
|
|
15147
15741
|
"signature": "async function httpRequest(url: string, method: HttpMethod, body?: Record<string, any>, headers?: Record<string, string>): Promise<FetchResponse>",
|
|
@@ -15196,6 +15790,55 @@
|
|
|
15196
15790
|
"related": [],
|
|
15197
15791
|
"isAsync": false,
|
|
15198
15792
|
"isClass": false
|
|
15793
|
+
},
|
|
15794
|
+
{
|
|
15795
|
+
"name": "PayWithIkas",
|
|
15796
|
+
"signature": "function PayWithIkas({ product, quantity = 1, className, style }: PayWithIkasProps): VNode<ClassAttributes<HTMLIFrameElement> & { ref: MutableRef<HTMLIFrameElement | null>; title: string; ... 4 more ...; style: { ...; }; }> | null",
|
|
15797
|
+
"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.",
|
|
15798
|
+
"params": [
|
|
15799
|
+
{
|
|
15800
|
+
"name": "product",
|
|
15801
|
+
"description": "- The product to fast-checkout via Pay with ikas"
|
|
15802
|
+
},
|
|
15803
|
+
{
|
|
15804
|
+
"name": "quantity",
|
|
15805
|
+
"description": "- Quantity to purchase (defaults to 1)"
|
|
15806
|
+
},
|
|
15807
|
+
{
|
|
15808
|
+
"name": "className",
|
|
15809
|
+
"description": "- Optional CSS class applied to the iframe"
|
|
15810
|
+
},
|
|
15811
|
+
{
|
|
15812
|
+
"name": "style",
|
|
15813
|
+
"description": "- Optional inline styles applied to the iframe"
|
|
15814
|
+
}
|
|
15815
|
+
],
|
|
15816
|
+
"returnType": "VNode<ClassAttributes<HTMLIFrameElement> & { ref: MutableRef<HTMLIFrameElement | null>; title: string; ... 4 more ...; style: { ...; }; }> | null",
|
|
15817
|
+
"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```",
|
|
15818
|
+
"categories": [
|
|
15819
|
+
"ProductDetail",
|
|
15820
|
+
"Checkout"
|
|
15821
|
+
],
|
|
15822
|
+
"related": [
|
|
15823
|
+
"createPayWithIkasSession",
|
|
15824
|
+
"isAddToCartEnabled"
|
|
15825
|
+
],
|
|
15826
|
+
"isAsync": false,
|
|
15827
|
+
"isClass": false,
|
|
15828
|
+
"parameterTypes": [
|
|
15829
|
+
"IkasProps"
|
|
15830
|
+
]
|
|
15831
|
+
},
|
|
15832
|
+
{
|
|
15833
|
+
"name": "normalizeSvg",
|
|
15834
|
+
"signature": "function normalizeSvg(svg: string, options: NormalizeSvgOptions): string",
|
|
15835
|
+
"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.",
|
|
15836
|
+
"params": [],
|
|
15837
|
+
"returnType": "string",
|
|
15838
|
+
"categories": [],
|
|
15839
|
+
"related": [],
|
|
15840
|
+
"isAsync": false,
|
|
15841
|
+
"isClass": false
|
|
15199
15842
|
}
|
|
15200
15843
|
],
|
|
15201
15844
|
"codeExamples": []
|