@wix/stores 1.0.973 → 1.0.974
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/_sdk-exports/context-category-by-id/runtime.d.ts +33 -4
- package/_sdk-exports/context-category-by-id/runtime.js +2 -2
- package/_sdk-exports/context-category-by-slug/runtime.d.ts +33 -4
- package/_sdk-exports/context-category-by-slug/runtime.js +2 -2
- package/_sdk-exports/context-category-info/runtime.d.ts +6 -1
- package/_sdk-exports/context-category-list/runtime.d.ts +5 -1
- package/_sdk-exports/context-product/runtime.d.ts +13 -13
- package/_sdk-exports/context-product-by-id/runtime.d.ts +19 -11
- package/_sdk-exports/context-product-by-id/runtime.js +2 -2
- package/_sdk-exports/context-product-by-slug/runtime.d.ts +17 -11
- package/_sdk-exports/context-product-by-slug/runtime.js +2 -2
- package/_sdk-exports/context-product-item/runtime.d.ts +35 -2
- package/_sdk-exports/context-product-item/runtime.js +2 -2
- package/_sdk-exports/context-product-list/runtime.d.ts +29 -1
- package/_sdk-exports/context-promotion-item/runtime.d.ts +5 -1
- package/build/cjs/context-category-by-id.d.ts +33 -4
- package/build/cjs/context-category-by-id.js +1187 -822
- package/build/cjs/context-category-by-id.js.map +1 -1
- package/build/cjs/context-category-by-slug.d.ts +33 -4
- package/build/cjs/context-category-by-slug.js +1382 -1017
- package/build/cjs/context-category-by-slug.js.map +1 -1
- package/build/cjs/context-category-info.d.ts +6 -1
- package/build/cjs/context-category-list.d.ts +5 -1
- package/build/cjs/context-product-by-id.d.ts +19 -11
- package/build/cjs/context-product-by-id.js +39 -36
- package/build/cjs/context-product-by-id.js.map +1 -1
- package/build/cjs/context-product-by-slug.d.ts +17 -11
- package/build/cjs/context-product-by-slug.js +37 -34
- package/build/cjs/context-product-by-slug.js.map +1 -1
- package/build/cjs/context-product-item.d.ts +35 -2
- package/build/cjs/context-product-item.js +287 -287
- package/build/cjs/context-product-item.js.map +1 -1
- package/build/cjs/context-product-list.d.ts +29 -1
- package/build/cjs/context-product.d.ts +13 -13
- package/build/cjs/context-promotion-item.d.ts +5 -1
- package/build/es/context-category-by-id.d.mts +33 -4
- package/build/es/context-category-by-id.mjs +1194 -829
- package/build/es/context-category-by-id.mjs.map +1 -1
- package/build/es/context-category-by-slug.d.mts +33 -4
- package/build/es/context-category-by-slug.mjs +1382 -1017
- package/build/es/context-category-by-slug.mjs.map +1 -1
- package/build/es/context-category-info.d.mts +6 -1
- package/build/es/context-category-list.d.mts +5 -1
- package/build/es/context-product-by-id.d.mts +19 -11
- package/build/es/context-product-by-id.mjs +39 -36
- package/build/es/context-product-by-id.mjs.map +1 -1
- package/build/es/context-product-by-slug.d.mts +17 -11
- package/build/es/context-product-by-slug.mjs +37 -34
- package/build/es/context-product-by-slug.mjs.map +1 -1
- package/build/es/context-product-item.d.mts +35 -2
- package/build/es/context-product-item.mjs +287 -287
- package/build/es/context-product-item.mjs.map +1 -1
- package/build/es/context-product-list.d.mts +29 -1
- package/build/es/context-product.d.mts +13 -13
- package/build/es/context-promotion-item.d.mts +5 -1
- package/build/internal/cjs/context-category-by-id.d.ts +33 -4
- package/build/internal/cjs/context-category-by-slug.d.ts +33 -4
- package/build/internal/cjs/context-category-info.d.ts +6 -1
- package/build/internal/cjs/context-category-list.d.ts +5 -1
- package/build/internal/cjs/context-product-by-id.d.ts +19 -11
- package/build/internal/cjs/context-product-by-slug.d.ts +17 -11
- package/build/internal/cjs/context-product-item.d.ts +35 -2
- package/build/internal/cjs/context-product-list.d.ts +29 -1
- package/build/internal/cjs/context-product.d.ts +13 -13
- package/build/internal/cjs/context-promotion-item.d.ts +5 -1
- package/build/internal/es/context-category-by-id.d.mts +33 -4
- package/build/internal/es/context-category-by-slug.d.mts +33 -4
- package/build/internal/es/context-category-info.d.mts +6 -1
- package/build/internal/es/context-category-list.d.mts +5 -1
- package/build/internal/es/context-product-by-id.d.mts +19 -11
- package/build/internal/es/context-product-by-slug.d.mts +17 -11
- package/build/internal/es/context-product-item.d.mts +35 -2
- package/build/internal/es/context-product-list.d.mts +29 -1
- package/build/internal/es/context-product.d.mts +13 -13
- package/build/internal/es/context-promotion-item.d.mts +5 -1
- package/package.json +2 -2
|
@@ -4010,16 +4010,7 @@ interface Price {
|
|
|
4010
4010
|
formattedAmount: string;
|
|
4011
4011
|
}
|
|
4012
4012
|
//#endregion
|
|
4013
|
-
//#region src/
|
|
4014
|
-
interface InventoryItem {
|
|
4015
|
-
variantId: string;
|
|
4016
|
-
availabilityStatus?: AvailabilityStatusWithLiterals;
|
|
4017
|
-
quantity?: number;
|
|
4018
|
-
trackQuantity: boolean;
|
|
4019
|
-
preorderInfo?: PreorderInfo;
|
|
4020
|
-
}
|
|
4021
|
-
//#endregion
|
|
4022
|
-
//#region src/extensions/product/providers/api/product-groups/product-groups.d.ts
|
|
4013
|
+
//#region src/api/product-groups/product-groups.d.ts
|
|
4023
4014
|
declare enum ProductGroupCustomizationType {
|
|
4024
4015
|
PRODUCT_OPTION = "PRODUCT_OPTION",
|
|
4025
4016
|
MODIFIER = "MODIFIER"
|
|
@@ -4036,6 +4027,15 @@ interface ProductGroupMember {
|
|
|
4036
4027
|
inventoryAvailabilityStatus?: AvailabilityStatus;
|
|
4037
4028
|
}
|
|
4038
4029
|
//#endregion
|
|
4030
|
+
//#region src/domain/inventory/inventory.d.ts
|
|
4031
|
+
interface InventoryItem {
|
|
4032
|
+
variantId: string;
|
|
4033
|
+
availabilityStatus?: AvailabilityStatusWithLiterals;
|
|
4034
|
+
quantity?: number;
|
|
4035
|
+
trackQuantity: boolean;
|
|
4036
|
+
preorderInfo?: PreorderInfo;
|
|
4037
|
+
}
|
|
4038
|
+
//#endregion
|
|
4039
4039
|
//#region src/extensions/product/providers/hooks/use-price/use-price.d.ts
|
|
4040
4040
|
/** Way to buy a subscription product, either one of its subscription plans or a one-time purchase. */
|
|
4041
4041
|
interface SubscriptionPlan {
|
|
@@ -4210,7 +4210,13 @@ declare function useStandaloneProductContextValue({
|
|
|
4210
4210
|
//#region src/extensions/product/providers/product-by-slug-context/product-by-slug-context-provider.d.ts
|
|
4211
4211
|
declare const NO_PRODUCT_SLUG_ERROR = "No product slug is available for the product context";
|
|
4212
4212
|
type ProductBySlugContextImplementation = ReturnType<typeof useStandaloneProductContextValue>;
|
|
4213
|
-
/**
|
|
4213
|
+
/**
|
|
4214
|
+
* The `useProductBySlugContext()` hook provides access to the store product that a product page
|
|
4215
|
+
* shows: its details, prices, media, and stock, and the visitor's selection of options, modifiers,
|
|
4216
|
+
* subscription plan, and quantity. Use it to build a product page's components: show the product,
|
|
4217
|
+
* let visitors choose what to buy, and let them add their selection to the cart, start a checkout,
|
|
4218
|
+
* or sign up for a back-in-stock email.
|
|
4219
|
+
*/
|
|
4214
4220
|
declare function useProductBySlugContext(): ProductContextValue;
|
|
4215
4221
|
/** Loads the product identified by the page URL and supplies its product context. */
|
|
4216
4222
|
declare function ProductBySlugContextProvider({
|
|
@@ -3097,8 +3097,8 @@ function Yc(e2, t2, r2, i2 = false) {
|
|
|
3097
3097
|
return t3 ? { href: t3 } : void 0;
|
|
3098
3098
|
}, [e2.slug, u2]);
|
|
3099
3099
|
return n(() => {
|
|
3100
|
-
let { selectedVariant: e3, setHasAttemptedSubmit: n2, isSelectionValid: a3, selectedOptions: u3, selectedModifiers: f2, selectedSubscriptionPlanId: p2, quantity: m2,
|
|
3101
|
-
return { ...o2, link: d2, ...r2, ...
|
|
3100
|
+
let { selectedVariant: e3, setHasAttemptedSubmit: n2, isSelectionValid: a3, selectedOptions: u3, selectedModifiers: f2, selectedSubscriptionPlanId: p2, quantity: m2, productGrouping: h2, ...g2 } = t2;
|
|
3101
|
+
return { ...o2, link: d2, ...r2, ...g2, buyerSelections: { options: qc(u3), modifiers: Jc(f2), subscriptionPlanId: p2, quantity: m2 }, ...s2, ...c2, ...l2, isBackInStockEnabled: i2 };
|
|
3102
3102
|
}, [o2, d2, r2, t2, s2, c2, l2, i2]);
|
|
3103
3103
|
}
|
|
3104
3104
|
var Xc = q(`@wix/site-service-locale`);
|
|
@@ -3293,58 +3293,61 @@ function Nl(e2, t2) {
|
|
|
3293
3293
|
return { ...e2, [t2.groupingCustomizationId]: { ...n2, ...e2[t2.groupingCustomizationId] } };
|
|
3294
3294
|
}
|
|
3295
3295
|
function Pl(e2, r2) {
|
|
3296
|
-
let
|
|
3297
|
-
return { productGrouping:
|
|
3298
|
-
if (!
|
|
3299
|
-
let t2 = Ol(
|
|
3300
|
-
t2 &&
|
|
3301
|
-
}, [
|
|
3302
|
-
if (!
|
|
3303
|
-
let { customizationType: t2, groupingCustomizationId: n2, currentProductChoiceId: r3 } =
|
|
3296
|
+
let i2 = n(() => Dl(e2, r2?.productGroup), [e2, r2?.productGroup]);
|
|
3297
|
+
return { productGrouping: i2, selectGroupSiblingChoice: t((e3) => {
|
|
3298
|
+
if (!i2 || e3 === i2.currentProductChoiceId) return;
|
|
3299
|
+
let t2 = Ol(i2, e3);
|
|
3300
|
+
t2 && r2?.selectProductGroupMember(t2.productId);
|
|
3301
|
+
}, [i2, r2?.selectProductGroupMember]), productCustomizations: n(() => Al(e2, i2), [e2, i2]), addGroupChoicesAvailability: t((e3) => Nl(e3, i2), [i2]), initialSelection: n(() => {
|
|
3302
|
+
if (!i2) return { options: {}, modifiers: {} };
|
|
3303
|
+
let { customizationType: t2, groupingCustomizationId: n2, currentProductChoiceId: r3 } = i2;
|
|
3304
3304
|
if (t2 === $.MODIFIER && e2.modifiers[n2].mandatory === false) return { options: {}, modifiers: {} };
|
|
3305
|
-
let
|
|
3306
|
-
return t2 === $.PRODUCT_OPTION ? { options:
|
|
3307
|
-
}, [
|
|
3305
|
+
let a2 = { [n2]: r3 };
|
|
3306
|
+
return t2 === $.PRODUCT_OPTION ? { options: a2, modifiers: {} } : { options: {}, modifiers: a2 };
|
|
3307
|
+
}, [i2, e2.modifiers]) };
|
|
3308
3308
|
}
|
|
3309
|
-
function Fl(e2, r2, a2) {
|
|
3310
|
-
let
|
|
3309
|
+
function Fl({ product: e2, inventoryItems: r2, productGroupData: a2, hasLoadedVariants: o2 = true }) {
|
|
3310
|
+
let s2 = Pl(e2, a2), { productGrouping: c2, selectGroupSiblingChoice: l2, addGroupChoicesAvailability: u2 } = s2, [d2, f2] = i(() => s2.initialSelection.options), [p2, m2] = i(() => s2.initialSelection.modifiers), [h2, g2] = i(void 0), [_2, v2] = i(1), [y2, b2] = i(false), x2 = n(() => ul(pl(e2.variants, r2)), [e2.variants, r2]), S2 = n(() => {
|
|
3311
3311
|
let t2 = /* @__PURE__ */ new Map();
|
|
3312
3312
|
return (n2) => {
|
|
3313
3313
|
let r3 = ll(n2), i2 = t2.get(r3);
|
|
3314
3314
|
if (i2) return i2;
|
|
3315
|
-
let a3 =
|
|
3315
|
+
let a3 = u2(dl(e2.options, x2, n2));
|
|
3316
3316
|
return t2.set(r3, a3), a3;
|
|
3317
3317
|
};
|
|
3318
|
-
}, [
|
|
3319
|
-
if (
|
|
3320
|
-
if (kl(
|
|
3321
|
-
|
|
3318
|
+
}, [x2, e2.options, u2])(o2 ? d2 : {}), C2 = n(() => Object.keys(d2).length === e2.options.length ? x2.get(ll(d2)) ?? null : null, [x2, d2, e2.options.length]), w2 = t((e3, t2) => {
|
|
3319
|
+
if (d2[e3] !== t2) {
|
|
3320
|
+
if (kl(c2, e3, t2)) {
|
|
3321
|
+
l2(t2);
|
|
3322
3322
|
return;
|
|
3323
3323
|
}
|
|
3324
|
-
|
|
3324
|
+
f2((n2) => ({ ...n2, [e3]: t2 })), v2(1);
|
|
3325
3325
|
}
|
|
3326
|
-
}, [
|
|
3327
|
-
if (kl(
|
|
3328
|
-
|
|
3326
|
+
}, [d2, c2, l2]), T2 = t((e3, t2) => {
|
|
3327
|
+
if (kl(c2, e3, t2)) {
|
|
3328
|
+
l2(t2);
|
|
3329
3329
|
return;
|
|
3330
3330
|
}
|
|
3331
|
-
|
|
3332
|
-
}, [
|
|
3333
|
-
|
|
3331
|
+
m2((n2) => n2[e3] === t2 ? n2 : { ...n2, [e3]: t2 });
|
|
3332
|
+
}, [c2, l2]), E2 = t((e3) => {
|
|
3333
|
+
m2((t2) => {
|
|
3334
3334
|
if (!(e3 in t2)) return t2;
|
|
3335
3335
|
let { [e3]: n2, ...r3 } = t2;
|
|
3336
3336
|
return r3;
|
|
3337
3337
|
});
|
|
3338
3338
|
}, []), D2 = t((e3) => {
|
|
3339
|
-
|
|
3340
|
-
}, []), O2 = n(() => Ja(C2), [C2]), k2 = n(() => Ya(
|
|
3341
|
-
|
|
3342
|
-
}, []), te2 = n(() => hl({ product: e2, selections: { selectedOptions:
|
|
3343
|
-
return n(() => ({ options: ne2, modifiers: re2, quantity: k2, selectedOptions:
|
|
3339
|
+
g2(e3);
|
|
3340
|
+
}, []), O2 = n(() => Ja(C2), [C2]), k2 = n(() => Ya(_2, O2), [_2, O2]), ee2 = t((e3) => {
|
|
3341
|
+
v2(e3);
|
|
3342
|
+
}, []), te2 = n(() => hl({ product: e2, selections: { selectedOptions: d2, selectedModifiers: p2, selectedSubscriptionPlanId: h2, quantity: k2 }, selectedVariant: C2 }), [e2, d2, p2, h2, k2, C2]), ne2 = s2.productCustomizations?.options ?? e2.options, re2 = s2.productCustomizations?.modifiers ?? e2.modifiers;
|
|
3343
|
+
return n(() => ({ options: ne2, modifiers: re2, quantity: k2, selectedOptions: d2, selectedModifiers: p2, selectedSubscriptionPlanId: h2, selectedVariant: C2, selectedVariantId: C2?.id ?? null, selectionsAvailability: S2, maxPurchasableQuantity: O2, isSelectionValid: te2.valid, selectionValidationErrors: te2.fields, hasAttemptedSubmit: y2, setHasAttemptedSubmit: b2, selectOption: w2, selectModifier: T2, clearModifierSelection: E2, selectSubscriptionPlan: D2, selectQuantity: ee2, productGrouping: c2 }), [ne2, re2, k2, d2, p2, h2, C2, S2, O2, te2, y2, w2, T2, E2, D2, ee2, c2]);
|
|
3344
3344
|
}
|
|
3345
3345
|
function Il({ product: e2, productGroup: t2, inventoryItems: r2, isBackInStockEnabled: i2, source: a2 }) {
|
|
3346
|
-
let o2 =
|
|
3347
|
-
|
|
3346
|
+
let { navigateToProductPage: o2 } = Ia(), s2 = Fl({ product: e2, inventoryItems: r2, productGroupData: t2 && { productGroup: t2, selectProductGroupMember: (e3) => {
|
|
3347
|
+
let n2 = t2.members.find((t3) => t3.productId === e3);
|
|
3348
|
+
n2 && o2(n2.slug);
|
|
3349
|
+
} } }), c2 = qa(e2, s2, $a(e2, s2.selectedVariant)), l2 = Yc(e2, s2, cl({ product: e2, userInputs: s2, hasLoadedVariants: true }), i2);
|
|
3350
|
+
return n(() => ({ ...l2, ...c2, source: a2 }), [l2, c2, a2]);
|
|
3348
3351
|
}
|
|
3349
3352
|
function Ll({ productPromise: e2, source: t2, children: n2 }) {
|
|
3350
3353
|
let { product: r2, productGroup: i2, inventoryItems: o2, isBackInStockEnabled: s2 } = kn(e2), c2 = Il({ product: r2, productGroup: i2, inventoryItems: o2, isBackInStockEnabled: s2, source: t2 });
|