@ikas/code-components-mcp 2.8.0 → 2.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/data/framework.json +53 -26
- 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/utils/cartLimits.ts +4 -3
- 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/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 +9 -0
- 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 +9 -0
- 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 +52 -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 +9 -0
- 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/ProductDetailBackInStock/ikas-config-snippet.json +16 -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/ikas-config-snippet.json +52 -0
- package/data/section-templates/product-detail-section/index.tsx +5 -1
- package/data/section-templates/product-detail-section/utils/cartLimits.ts +4 -3
- 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 +301 -17
- package/data/storefront-types.json +221 -20
- package/dist/index.js +408 -26
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -34,6 +34,19 @@
|
|
|
34
34
|
"displayName": "Components",
|
|
35
35
|
"type": "COMPONENT_LIST",
|
|
36
36
|
"required": false,
|
|
37
|
+
"defaultValue": {
|
|
38
|
+
"components": [
|
|
39
|
+
{
|
|
40
|
+
"codeComponentId": "nb34u3yu-card-product-name"
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"codeComponentId": "nb34u3yu-card-product-variants"
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
"codeComponentId": "nb34u3yu-card-product-price"
|
|
47
|
+
}
|
|
48
|
+
]
|
|
49
|
+
},
|
|
37
50
|
"privateVarMap": {
|
|
38
51
|
"product": {
|
|
39
52
|
"id": "pvm_1772803530689_1",
|
|
@@ -50,6 +50,25 @@
|
|
|
50
50
|
"displayName": "Components",
|
|
51
51
|
"type": "COMPONENT_LIST",
|
|
52
52
|
"required": false,
|
|
53
|
+
"defaultValue": {
|
|
54
|
+
"components": [
|
|
55
|
+
{
|
|
56
|
+
"codeComponentId": "nb34u3yu-account-info-content"
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
"codeComponentId": "nb34u3yu-account-orders"
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
"codeComponentId": "nb34u3yu-account-addresses"
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
"codeComponentId": "nb34u3yu-account-favorites"
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
"codeComponentId": "nb34u3yu-account-order-detail"
|
|
69
|
+
}
|
|
70
|
+
]
|
|
71
|
+
},
|
|
53
72
|
"filteredComponentIds": [
|
|
54
73
|
"<id-of-AccountInfoContent>",
|
|
55
74
|
"<id-of-AccountOrders>",
|
|
@@ -40,6 +40,10 @@
|
|
|
40
40
|
"displayName": "Top Spacing",
|
|
41
41
|
"type": "TYPE",
|
|
42
42
|
"required": false,
|
|
43
|
+
"defaultValue": {
|
|
44
|
+
"value": 0,
|
|
45
|
+
"unit": "px"
|
|
46
|
+
},
|
|
43
47
|
"groupId": "mobile",
|
|
44
48
|
"typeId": "@ikas/bp-storefront-models-MarginTopStyleType"
|
|
45
49
|
},
|
|
@@ -48,6 +52,10 @@
|
|
|
48
52
|
"displayName": "Bottom Spacing",
|
|
49
53
|
"type": "TYPE",
|
|
50
54
|
"required": false,
|
|
55
|
+
"defaultValue": {
|
|
56
|
+
"value": 0,
|
|
57
|
+
"unit": "px"
|
|
58
|
+
},
|
|
51
59
|
"groupId": "mobile",
|
|
52
60
|
"typeId": "@ikas/bp-storefront-models-MarginBottomStyleType"
|
|
53
61
|
},
|
|
@@ -56,6 +64,10 @@
|
|
|
56
64
|
"displayName": "Top Spacing",
|
|
57
65
|
"type": "TYPE",
|
|
58
66
|
"required": false,
|
|
67
|
+
"defaultValue": {
|
|
68
|
+
"value": 0,
|
|
69
|
+
"unit": "px"
|
|
70
|
+
},
|
|
59
71
|
"groupId": "desktop",
|
|
60
72
|
"typeId": "@ikas/bp-storefront-models-MarginTopStyleType"
|
|
61
73
|
},
|
|
@@ -64,6 +76,10 @@
|
|
|
64
76
|
"displayName": "Bottom Spacing",
|
|
65
77
|
"type": "TYPE",
|
|
66
78
|
"required": false,
|
|
79
|
+
"defaultValue": {
|
|
80
|
+
"value": 0,
|
|
81
|
+
"unit": "px"
|
|
82
|
+
},
|
|
67
83
|
"groupId": "desktop",
|
|
68
84
|
"typeId": "@ikas/bp-storefront-models-MarginBottomStyleType"
|
|
69
85
|
},
|
|
@@ -72,6 +88,7 @@
|
|
|
72
88
|
"displayName": "Hide Quantity Selector",
|
|
73
89
|
"type": "BOOLEAN",
|
|
74
90
|
"required": false,
|
|
91
|
+
"defaultValue": false,
|
|
75
92
|
"groupId": "settings"
|
|
76
93
|
},
|
|
77
94
|
{
|
|
@@ -8,9 +8,10 @@ export interface CartQuantityLimits {
|
|
|
8
8
|
/**
|
|
9
9
|
* Resolve the per-cart quantity limits for a product from its active sales
|
|
10
10
|
* channel. Falls back to a minimum of 1 and no maximum when the channel or its
|
|
11
|
-
* limits are not set. `addItemToCart` clamps to the same limits internally
|
|
12
|
-
*
|
|
13
|
-
*
|
|
11
|
+
* limits are not set. `addItemToCart` clamps to the same limits internally only
|
|
12
|
+
* when it creates a NEW cart line — incrementing an existing line goes through
|
|
13
|
+
* `changeItemQuantity`, which never clamps — so enforcing these in the stepper
|
|
14
|
+
* is the only guard that covers both paths.
|
|
14
15
|
*/
|
|
15
16
|
export function getProductCartLimits(product: IkasProduct): CartQuantityLimits {
|
|
16
17
|
const channel = product.salesChannels?.find(
|
|
@@ -56,6 +56,7 @@
|
|
|
56
56
|
"displayName": "Aspect Ratio",
|
|
57
57
|
"type": "ENUM",
|
|
58
58
|
"required": false,
|
|
59
|
+
"defaultValue": "Square",
|
|
59
60
|
"groupId": "image-settings",
|
|
60
61
|
"enumTypeId": "{{ENUM_ID:AspectRatio}}"
|
|
61
62
|
},
|
|
@@ -64,6 +65,7 @@
|
|
|
64
65
|
"displayName": "Image Fit",
|
|
65
66
|
"type": "ENUM",
|
|
66
67
|
"required": false,
|
|
68
|
+
"defaultValue": "Cover",
|
|
67
69
|
"groupId": "image-settings",
|
|
68
70
|
"enumTypeId": "{{ENUM_ID:ObjectFit}}"
|
|
69
71
|
},
|
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
hasBlogListPrevPage,
|
|
7
7
|
hasBlogListNextPage,
|
|
8
8
|
getIkasBlogCategoryHref,
|
|
9
|
+
withRoutePrefix,
|
|
9
10
|
} from "@ikas/bp-storefront";
|
|
10
11
|
import { observer } from "@ikas/component-utils";
|
|
11
12
|
import { cx } from "../../utils/cx";
|
|
@@ -47,7 +48,7 @@ export function BlogHome({
|
|
|
47
48
|
{categories.length > 0 && (
|
|
48
49
|
<div className="kombos-blog-home__categories">
|
|
49
50
|
<a
|
|
50
|
-
href="/blog"
|
|
51
|
+
href={withRoutePrefix("/blog")}
|
|
51
52
|
className={cx(
|
|
52
53
|
"kombos-blog-home__cat-btn",
|
|
53
54
|
"text-sm-medium",
|
|
@@ -41,6 +41,7 @@
|
|
|
41
41
|
"displayName": "Aspect Ratio",
|
|
42
42
|
"type": "ENUM",
|
|
43
43
|
"required": false,
|
|
44
|
+
"defaultValue": "Square",
|
|
44
45
|
"groupId": "appearance",
|
|
45
46
|
"enumTypeId": "{{ENUM_ID:AspectRatio}}"
|
|
46
47
|
},
|
|
@@ -49,6 +50,7 @@
|
|
|
49
50
|
"displayName": "Image Fit",
|
|
50
51
|
"type": "ENUM",
|
|
51
52
|
"required": false,
|
|
53
|
+
"defaultValue": "Cover",
|
|
52
54
|
"groupId": "appearance",
|
|
53
55
|
"enumTypeId": "{{ENUM_ID:ObjectFit}}"
|
|
54
56
|
},
|
|
@@ -2,6 +2,7 @@ import {
|
|
|
2
2
|
getIkasBlogFormattedDate,
|
|
3
3
|
getIkasBlogCategoryHref,
|
|
4
4
|
getDefaultSrc,
|
|
5
|
+
withRoutePrefix,
|
|
5
6
|
} from "@ikas/bp-storefront";
|
|
6
7
|
|
|
7
8
|
import { Props } from "./types";
|
|
@@ -31,8 +32,8 @@ export function BlogPost({
|
|
|
31
32
|
const writerName = getFullName(blogPost.writer?.firstName, blogPost.writer?.lastName);
|
|
32
33
|
|
|
33
34
|
const breadcrumbItems: BreadcrumbItem[] = [
|
|
34
|
-
{ label: homeText, href: "/" },
|
|
35
|
-
{ label: blogText, href: "/blog" },
|
|
35
|
+
{ label: homeText, href: withRoutePrefix("/") },
|
|
36
|
+
{ label: blogText, href: withRoutePrefix("/blog") },
|
|
36
37
|
];
|
|
37
38
|
if (categoryName && categoryHref) {
|
|
38
39
|
breadcrumbItems.push({ label: categoryName, href: categoryHref });
|
|
@@ -16,6 +16,10 @@
|
|
|
16
16
|
"displayName": "Top Spacing",
|
|
17
17
|
"type": "TYPE",
|
|
18
18
|
"required": false,
|
|
19
|
+
"defaultValue": {
|
|
20
|
+
"value": 0,
|
|
21
|
+
"unit": "px"
|
|
22
|
+
},
|
|
19
23
|
"groupId": "mobile",
|
|
20
24
|
"typeId": "@ikas/bp-storefront-models-MarginTopStyleType"
|
|
21
25
|
},
|
|
@@ -24,6 +28,10 @@
|
|
|
24
28
|
"displayName": "Bottom Spacing",
|
|
25
29
|
"type": "TYPE",
|
|
26
30
|
"required": false,
|
|
31
|
+
"defaultValue": {
|
|
32
|
+
"value": 0,
|
|
33
|
+
"unit": "px"
|
|
34
|
+
},
|
|
27
35
|
"groupId": "mobile",
|
|
28
36
|
"typeId": "@ikas/bp-storefront-models-MarginBottomStyleType"
|
|
29
37
|
},
|
|
@@ -32,6 +40,10 @@
|
|
|
32
40
|
"displayName": "Top Spacing",
|
|
33
41
|
"type": "TYPE",
|
|
34
42
|
"required": false,
|
|
43
|
+
"defaultValue": {
|
|
44
|
+
"value": 0,
|
|
45
|
+
"unit": "px"
|
|
46
|
+
},
|
|
35
47
|
"groupId": "desktop",
|
|
36
48
|
"typeId": "@ikas/bp-storefront-models-MarginTopStyleType"
|
|
37
49
|
},
|
|
@@ -40,6 +52,10 @@
|
|
|
40
52
|
"displayName": "Bottom Spacing",
|
|
41
53
|
"type": "TYPE",
|
|
42
54
|
"required": false,
|
|
55
|
+
"defaultValue": {
|
|
56
|
+
"value": 0,
|
|
57
|
+
"unit": "px"
|
|
58
|
+
},
|
|
43
59
|
"groupId": "desktop",
|
|
44
60
|
"typeId": "@ikas/bp-storefront-models-MarginBottomStyleType"
|
|
45
61
|
},
|
|
@@ -48,6 +64,7 @@
|
|
|
48
64
|
"displayName": "Furniture Bundle Mode",
|
|
49
65
|
"type": "BOOLEAN",
|
|
50
66
|
"required": false,
|
|
67
|
+
"defaultValue": false,
|
|
51
68
|
"groupId": "settings"
|
|
52
69
|
},
|
|
53
70
|
{
|
|
@@ -55,6 +72,7 @@
|
|
|
55
72
|
"displayName": "Disable Product Link",
|
|
56
73
|
"type": "BOOLEAN",
|
|
57
74
|
"required": false,
|
|
75
|
+
"defaultValue": false,
|
|
58
76
|
"groupId": "settings"
|
|
59
77
|
},
|
|
60
78
|
{
|
|
@@ -86,6 +104,7 @@
|
|
|
86
104
|
"displayName": "Aspect Ratio",
|
|
87
105
|
"type": "ENUM",
|
|
88
106
|
"required": false,
|
|
107
|
+
"defaultValue": "Square",
|
|
89
108
|
"groupId": "appearance",
|
|
90
109
|
"enumTypeId": "{{ENUM_ID:AspectRatio}}"
|
|
91
110
|
},
|
|
@@ -94,6 +113,7 @@
|
|
|
94
113
|
"displayName": "Image Fit",
|
|
95
114
|
"type": "ENUM",
|
|
96
115
|
"required": false,
|
|
116
|
+
"defaultValue": "Cover",
|
|
97
117
|
"groupId": "appearance",
|
|
98
118
|
"enumTypeId": "{{ENUM_ID:ObjectFit}}"
|
|
99
119
|
}
|
|
@@ -19,6 +19,7 @@ import {
|
|
|
19
19
|
} from "@ikas/bp-storefront";
|
|
20
20
|
import { resolveAspectRatio, resolveObjectFit } from "../../utils/media";
|
|
21
21
|
import { cx } from "../../utils/cx";
|
|
22
|
+
import { useCartLineLimits } from "../../utils/cartLineLimits";
|
|
22
23
|
import type { AspectRatio, ObjectFit } from "../../global-types";
|
|
23
24
|
|
|
24
25
|
interface CartItemProps {
|
|
@@ -40,6 +41,10 @@ const CartItem = observer(function CartItem({
|
|
|
40
41
|
}: CartItemProps) {
|
|
41
42
|
const isPage = variant === "page";
|
|
42
43
|
|
|
44
|
+
// The line's IkasOrderLineVariant carries no salesChannels, so the per-cart
|
|
45
|
+
// quantity limits come from a batched product fetch shared across all lines.
|
|
46
|
+
const limits = useCartLineLimits(item.variant?.productId);
|
|
47
|
+
|
|
43
48
|
// Lines a campaign added automatically (e.g. a "buy 1 get 1" gift) cannot be
|
|
44
49
|
// edited or removed on their own, so render them read-only with a badge.
|
|
45
50
|
const isAutoCreated =
|
|
@@ -180,6 +185,8 @@ const CartItem = observer(function CartItem({
|
|
|
180
185
|
<QuantitySelector
|
|
181
186
|
size="sm"
|
|
182
187
|
value={item.quantity}
|
|
188
|
+
min={limits?.min ?? 1}
|
|
189
|
+
max={limits?.max}
|
|
183
190
|
onChange={(qty) => changeItemQuantity(item, qty)}
|
|
184
191
|
/>
|
|
185
192
|
)}
|
|
@@ -227,6 +234,8 @@ const CartItem = observer(function CartItem({
|
|
|
227
234
|
<QuantitySelector
|
|
228
235
|
size="sm"
|
|
229
236
|
value={item.quantity}
|
|
237
|
+
min={limits?.min ?? 1}
|
|
238
|
+
max={limits?.max}
|
|
230
239
|
onChange={(qty) => changeItemQuantity(item, qty)}
|
|
231
240
|
/>
|
|
232
241
|
<button
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { IkasProduct, IkasStorefrontConfig } from "@ikas/bp-storefront";
|
|
2
|
+
|
|
3
|
+
export interface CartQuantityLimits {
|
|
4
|
+
min: number;
|
|
5
|
+
max?: number;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Resolve the per-cart quantity limits for a product from its active sales
|
|
10
|
+
* channel. Falls back to a minimum of 1 and no maximum when the channel or its
|
|
11
|
+
* limits are not set. `addItemToCart` clamps to the same limits internally only
|
|
12
|
+
* when it creates a NEW cart line — incrementing an existing line goes through
|
|
13
|
+
* `changeItemQuantity`, which never clamps — so enforcing these in the stepper
|
|
14
|
+
* is the only guard that covers both paths.
|
|
15
|
+
*/
|
|
16
|
+
export function getProductCartLimits(product: IkasProduct): CartQuantityLimits {
|
|
17
|
+
const channel = product.salesChannels?.find(
|
|
18
|
+
(sc) => sc.id === IkasStorefrontConfig.salesChannelId,
|
|
19
|
+
);
|
|
20
|
+
return {
|
|
21
|
+
min: channel?.minQuantityPerCart ?? 1,
|
|
22
|
+
max: channel?.maxQuantityPerCart ?? undefined,
|
|
23
|
+
};
|
|
24
|
+
}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { useEffect, useState } from "preact/hooks";
|
|
2
|
+
import { baseStore, bs_searchProductsById } from "@ikas/bp-storefront";
|
|
3
|
+
import { CartQuantityLimits, getProductCartLimits } from "./cartLimits";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Per-cart quantity limits for cart lines.
|
|
7
|
+
*
|
|
8
|
+
* A cart line's `IkasOrderLineVariant` carries no `salesChannels`, so the
|
|
9
|
+
* min/max per-cart limits can only be read from the full `IkasProduct`. This
|
|
10
|
+
* store batch-fetches the line products with `bs_searchProductsById` (lines
|
|
11
|
+
* register their productId one by one; the ids are flushed as ONE request on
|
|
12
|
+
* the next tick) and maps the resolved limits by product id for the cart
|
|
13
|
+
* steppers to read. Each product is fetched at most once; results stay cached
|
|
14
|
+
* for the session.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
const limitsByProductId = new Map<string, CartQuantityLimits>();
|
|
18
|
+
const requestedProductIds = new Set<string>();
|
|
19
|
+
const listeners = new Set<() => void>();
|
|
20
|
+
|
|
21
|
+
let pendingProductIds: string[] = [];
|
|
22
|
+
let flushTimer: ReturnType<typeof setTimeout> | null = null;
|
|
23
|
+
|
|
24
|
+
function emit() {
|
|
25
|
+
for (const listener of listeners) listener();
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
async function flush() {
|
|
29
|
+
flushTimer = null;
|
|
30
|
+
const batch = pendingProductIds;
|
|
31
|
+
pendingProductIds = [];
|
|
32
|
+
|
|
33
|
+
// bs_searchProductsById never throws — API/network failures resolve with
|
|
34
|
+
// isSuccess: false — so the retry unmark must live on the result check.
|
|
35
|
+
const result = await bs_searchProductsById(baseStore, { productIds: batch }).catch(
|
|
36
|
+
() => null,
|
|
37
|
+
);
|
|
38
|
+
if (!result?.isSuccess || !result.products) {
|
|
39
|
+
// Limits stay unenforced for now; unmark the batch so a later
|
|
40
|
+
// ensureCartLineLimits call (e.g. the next cart open) can retry.
|
|
41
|
+
for (const id of batch) requestedProductIds.delete(id);
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
for (const product of result.products) {
|
|
46
|
+
limitsByProductId.set(product.id, getProductCartLimits(product));
|
|
47
|
+
}
|
|
48
|
+
emit();
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Register a cart line's productId for limit resolution. Ids already requested
|
|
53
|
+
* are skipped; new ids are collected and fetched in a single batched request
|
|
54
|
+
* on the next tick, so per-line calls do not fan out into per-line requests.
|
|
55
|
+
*/
|
|
56
|
+
export function ensureCartLineLimits(productId: string) {
|
|
57
|
+
if (requestedProductIds.has(productId)) return;
|
|
58
|
+
requestedProductIds.add(productId);
|
|
59
|
+
pendingProductIds.push(productId);
|
|
60
|
+
if (!flushTimer) flushTimer = setTimeout(flush, 0);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/** Resolved limits for a product — undefined until the batch fetch lands. */
|
|
64
|
+
export function getCartLineLimits(
|
|
65
|
+
productId: string | null | undefined,
|
|
66
|
+
): CartQuantityLimits | undefined {
|
|
67
|
+
return productId ? limitsByProductId.get(productId) : undefined;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/** Subscribe to limit resolutions; returns the unsubscribe function. */
|
|
71
|
+
export function subscribeCartLineLimits(listener: () => void) {
|
|
72
|
+
listeners.add(listener);
|
|
73
|
+
return () => {
|
|
74
|
+
listeners.delete(listener);
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Hook: resolved limits for one cart line's product — undefined until the
|
|
80
|
+
* batched fetch lands. Encapsulates the subscription protocol so components
|
|
81
|
+
* cannot get the ordering wrong.
|
|
82
|
+
*/
|
|
83
|
+
export function useCartLineLimits(
|
|
84
|
+
productId: string | null | undefined,
|
|
85
|
+
): CartQuantityLimits | undefined {
|
|
86
|
+
const [, setVersion] = useState(0);
|
|
87
|
+
const limits = getCartLineLimits(productId);
|
|
88
|
+
useEffect(() => {
|
|
89
|
+
if (!productId) return;
|
|
90
|
+
// Subscribe BEFORE registering the id: a batch already in flight can
|
|
91
|
+
// resolve between render and this effect, and its emit must not be missed.
|
|
92
|
+
const unsubscribe = subscribeCartLineLimits(() => setVersion((v) => v + 1));
|
|
93
|
+
ensureCartLineLimits(productId);
|
|
94
|
+
// Re-check once for a result that landed before the subscription armed —
|
|
95
|
+
// skipped when the arming render already saw it (no redundant re-render).
|
|
96
|
+
if (!limits && getCartLineLimits(productId)) setVersion((v) => v + 1);
|
|
97
|
+
return unsubscribe;
|
|
98
|
+
}, [productId]);
|
|
99
|
+
return limits;
|
|
100
|
+
}
|
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
"displayName": "Dark Overlay",
|
|
25
25
|
"type": "BOOLEAN",
|
|
26
26
|
"required": false,
|
|
27
|
+
"defaultValue": false,
|
|
27
28
|
"groupId": "desktop"
|
|
28
29
|
},
|
|
29
30
|
{
|
|
@@ -39,6 +40,7 @@
|
|
|
39
40
|
"displayName": "Image Fit",
|
|
40
41
|
"type": "ENUM",
|
|
41
42
|
"required": false,
|
|
43
|
+
"defaultValue": "Cover",
|
|
42
44
|
"groupId": "desktop",
|
|
43
45
|
"enumTypeId": "{{ENUM_ID:ObjectFit}}"
|
|
44
46
|
},
|
|
@@ -61,6 +63,7 @@
|
|
|
61
63
|
"displayName": "Dark Overlay",
|
|
62
64
|
"type": "BOOLEAN",
|
|
63
65
|
"required": false,
|
|
66
|
+
"defaultValue": false,
|
|
64
67
|
"groupId": "mobile"
|
|
65
68
|
},
|
|
66
69
|
{
|
|
@@ -76,6 +79,7 @@
|
|
|
76
79
|
"displayName": "Image Fit",
|
|
77
80
|
"type": "ENUM",
|
|
78
81
|
"required": false,
|
|
82
|
+
"defaultValue": "Cover",
|
|
79
83
|
"groupId": "mobile",
|
|
80
84
|
"enumTypeId": "{{ENUM_ID:ObjectFit}}"
|
|
81
85
|
}
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
"displayName": "Title Color",
|
|
19
19
|
"type": "COLOR",
|
|
20
20
|
"required": false,
|
|
21
|
+
"defaultValue": "#14141a",
|
|
21
22
|
"groupId": "content"
|
|
22
23
|
},
|
|
23
24
|
{
|
|
@@ -41,6 +42,7 @@
|
|
|
41
42
|
"displayName": "Mobile Column Count",
|
|
42
43
|
"type": "ENUM",
|
|
43
44
|
"required": false,
|
|
45
|
+
"defaultValue": "One",
|
|
44
46
|
"groupId": "appearance",
|
|
45
47
|
"enumTypeId": "{{ENUM_ID:NumberOfColumns}}"
|
|
46
48
|
},
|
|
@@ -49,6 +51,19 @@
|
|
|
49
51
|
"displayName": "Categories",
|
|
50
52
|
"type": "COMPONENT_LIST",
|
|
51
53
|
"required": false,
|
|
54
|
+
"defaultValue": {
|
|
55
|
+
"components": [
|
|
56
|
+
{
|
|
57
|
+
"codeComponentId": "nb34u3yu-category-image-item"
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
"codeComponentId": "nb34u3yu-category-image-item"
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
"codeComponentId": "nb34u3yu-category-image-item"
|
|
64
|
+
}
|
|
65
|
+
]
|
|
66
|
+
},
|
|
52
67
|
"filteredComponentIds": [
|
|
53
68
|
"<id-of-CategoryImageItem>"
|
|
54
69
|
]
|
|
@@ -111,6 +111,7 @@
|
|
|
111
111
|
"displayName": "Show Filters",
|
|
112
112
|
"type": "BOOLEAN",
|
|
113
113
|
"required": false,
|
|
114
|
+
"defaultValue": false,
|
|
114
115
|
"groupId": "filters"
|
|
115
116
|
},
|
|
116
117
|
{
|
|
@@ -118,6 +119,7 @@
|
|
|
118
119
|
"displayName": "Show Search",
|
|
119
120
|
"type": "BOOLEAN",
|
|
120
121
|
"required": false,
|
|
122
|
+
"defaultValue": false,
|
|
121
123
|
"groupId": "filters"
|
|
122
124
|
},
|
|
123
125
|
{
|
|
@@ -125,6 +127,7 @@
|
|
|
125
127
|
"displayName": "Image Aspect Ratio",
|
|
126
128
|
"type": "ENUM",
|
|
127
129
|
"required": false,
|
|
130
|
+
"defaultValue": "Square",
|
|
128
131
|
"groupId": "image-settings",
|
|
129
132
|
"enumTypeId": "{{ENUM_ID:AspectRatio}}"
|
|
130
133
|
},
|
|
@@ -133,6 +136,7 @@
|
|
|
133
136
|
"displayName": "Image Fit",
|
|
134
137
|
"type": "ENUM",
|
|
135
138
|
"required": false,
|
|
139
|
+
"defaultValue": "Cover",
|
|
136
140
|
"groupId": "image-settings",
|
|
137
141
|
"enumTypeId": "{{ENUM_ID:ObjectFit}}"
|
|
138
142
|
},
|
|
@@ -141,6 +145,7 @@
|
|
|
141
145
|
"displayName": "Infinite Scroll",
|
|
142
146
|
"type": "BOOLEAN",
|
|
143
147
|
"required": false,
|
|
148
|
+
"defaultValue": false,
|
|
144
149
|
"groupId": "pagination"
|
|
145
150
|
},
|
|
146
151
|
{
|
|
@@ -164,6 +169,7 @@
|
|
|
164
169
|
"displayName": "Hide Add to Cart Button",
|
|
165
170
|
"type": "BOOLEAN",
|
|
166
171
|
"required": false,
|
|
172
|
+
"defaultValue": false,
|
|
167
173
|
"groupId": "card-settings"
|
|
168
174
|
},
|
|
169
175
|
{
|
|
@@ -171,6 +177,19 @@
|
|
|
171
177
|
"displayName": "Components",
|
|
172
178
|
"type": "COMPONENT_LIST",
|
|
173
179
|
"required": false,
|
|
180
|
+
"defaultValue": {
|
|
181
|
+
"components": [
|
|
182
|
+
{
|
|
183
|
+
"codeComponentId": "nb34u3yu-card-product-name"
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
"codeComponentId": "nb34u3yu-card-product-variants"
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
"codeComponentId": "nb34u3yu-card-product-price"
|
|
190
|
+
}
|
|
191
|
+
]
|
|
192
|
+
},
|
|
174
193
|
"privateVarMap": {
|
|
175
194
|
"product": {
|
|
176
195
|
"id": "pvm_1772808304776_3",
|
|
@@ -188,6 +207,7 @@
|
|
|
188
207
|
"displayName": "Hide Breadcrumb",
|
|
189
208
|
"type": "BOOLEAN",
|
|
190
209
|
"required": false,
|
|
210
|
+
"defaultValue": false,
|
|
191
211
|
"groupId": "appearance"
|
|
192
212
|
},
|
|
193
213
|
{
|
|
@@ -195,6 +215,7 @@
|
|
|
195
215
|
"displayName": "Is This a Brand Page?",
|
|
196
216
|
"type": "BOOLEAN",
|
|
197
217
|
"required": false,
|
|
218
|
+
"defaultValue": false,
|
|
198
219
|
"groupId": "data"
|
|
199
220
|
},
|
|
200
221
|
{
|
|
@@ -21,6 +21,7 @@ import {
|
|
|
21
21
|
searchProductList,
|
|
22
22
|
getProductOptionSet,
|
|
23
23
|
IkasComponentRenderer,
|
|
24
|
+
withRoutePrefix,
|
|
24
25
|
} from "@ikas/bp-storefront";
|
|
25
26
|
import { Props } from "./types";
|
|
26
27
|
import ProductCard from "../../sub-components/ProductCard";
|
|
@@ -170,7 +171,7 @@ export function CategoryList(props: Props) {
|
|
|
170
171
|
const path = getCategoryPath(category);
|
|
171
172
|
if (path.length === 0) return [];
|
|
172
173
|
return [
|
|
173
|
-
{ label: homepageText, href: "/" } as BreadcrumbItem,
|
|
174
|
+
{ label: homepageText, href: withRoutePrefix("/") } as BreadcrumbItem,
|
|
174
175
|
...path.map(
|
|
175
176
|
(cat: any) =>
|
|
176
177
|
({
|
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
IkasImage,
|
|
7
7
|
isNotEmpty,
|
|
8
8
|
IkasComponentRenderer,
|
|
9
|
+
withRoutePrefix,
|
|
9
10
|
} from "@ikas/bp-storefront";
|
|
10
11
|
import { Props } from "./types";
|
|
11
12
|
import Breadcrumb from "../../sub-components/Breadcrumb";
|
|
@@ -42,7 +43,10 @@ export function ProductDetail(props: Props) {
|
|
|
42
43
|
<div className="kombos-container kombos-pd__container">
|
|
43
44
|
<Breadcrumb
|
|
44
45
|
items={[
|
|
45
|
-
{
|
|
46
|
+
{
|
|
47
|
+
label: homepageText,
|
|
48
|
+
href: withRoutePrefix("/"),
|
|
49
|
+
} as BreadcrumbItem,
|
|
46
50
|
...(isNotEmpty(categoryPath)
|
|
47
51
|
? categoryPath.map(
|
|
48
52
|
(pathItem: any) =>
|
|
@@ -10,6 +10,19 @@
|
|
|
10
10
|
"displayName": "Components",
|
|
11
11
|
"type": "COMPONENT_LIST",
|
|
12
12
|
"required": false,
|
|
13
|
+
"defaultValue": {
|
|
14
|
+
"components": [
|
|
15
|
+
{
|
|
16
|
+
"codeComponentId": "nb34u3yu-announcements"
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"codeComponentId": "nb34u3yu-navbar"
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"codeComponentId": "nb34u3yu-cookie-bar"
|
|
23
|
+
}
|
|
24
|
+
]
|
|
25
|
+
},
|
|
13
26
|
"filteredComponentIds": [
|
|
14
27
|
"<id-of-Navbar>",
|
|
15
28
|
"<id-of-Announcements>",
|