@numueg/theme-sdk 0.3.1 → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +13 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +13 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.mjs +13 -5
- package/dist/index.mjs.map +1 -1
- package/dist/v2-compat.cjs.map +1 -1
- package/dist/v2-compat.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -528,9 +528,8 @@ function toNavigationItem(raw, locale) {
|
|
|
528
528
|
url: raw.url || "/",
|
|
529
529
|
resource_type: mapResourceType(raw.type),
|
|
530
530
|
resource_handle: raw.resource_id ?? null,
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
)
|
|
531
|
+
target_visible: raw.target_visible !== false,
|
|
532
|
+
children: (raw.children ?? []).map((child) => toNavigationItem(child, locale)).filter((child) => child.target_visible)
|
|
534
533
|
};
|
|
535
534
|
}
|
|
536
535
|
function useNavigation(handle, options) {
|
|
@@ -540,7 +539,8 @@ function useNavigation(handle, options) {
|
|
|
540
539
|
const hostProvidedAny = !!navMap && Object.keys(navMap).length > 0;
|
|
541
540
|
const rawItems = handle ? navMap?.[handle] : void 0;
|
|
542
541
|
const hostItems = react.useMemo(() => {
|
|
543
|
-
if (rawItems)
|
|
542
|
+
if (rawItems)
|
|
543
|
+
return rawItems.map((it) => toNavigationItem(it, locale)).filter((it) => it.target_visible);
|
|
544
544
|
if (hostProvidedAny) return [];
|
|
545
545
|
return null;
|
|
546
546
|
}, [rawItems, hostProvidedAny, locale]);
|
|
@@ -1477,7 +1477,15 @@ function normalizeCartFromServer(cart) {
|
|
|
1477
1477
|
subtotal: toMajor(cart.subtotal),
|
|
1478
1478
|
total: toMajor(cart.total),
|
|
1479
1479
|
...cart.discount_amount != null ? { discount_amount: toMajor(cart.discount_amount) } : {},
|
|
1480
|
-
items: Array.isArray(cart.items) ? cart.items.map((it) =>
|
|
1480
|
+
items: Array.isArray(cart.items) ? cart.items.map((it) => {
|
|
1481
|
+
const raw = it;
|
|
1482
|
+
return {
|
|
1483
|
+
...it,
|
|
1484
|
+
name: raw.name || raw.product_name || "",
|
|
1485
|
+
price: toMajor(raw.price ?? raw.unit_price),
|
|
1486
|
+
variant_name: raw.variant_name ?? void 0
|
|
1487
|
+
};
|
|
1488
|
+
}) : []
|
|
1481
1489
|
};
|
|
1482
1490
|
}
|
|
1483
1491
|
function unwrapCart(json) {
|