@wix/stores 1.0.972 → 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 +3 -3
|
@@ -3513,7 +3513,12 @@ declare function useCategoryInfo(category: Category): {
|
|
|
3513
3513
|
//#endregion
|
|
3514
3514
|
//#region src/extensions/gallery/providers/category-info-context/category-info-context-provider.d.ts
|
|
3515
3515
|
type CategoryInfoContextImplementation = ReturnType<typeof useCategoryInfo>;
|
|
3516
|
-
/**
|
|
3516
|
+
/**
|
|
3517
|
+
* The `useCategoryInfoContext()` hook provides access to a store category's name, descriptions,
|
|
3518
|
+
* image, page link, and the categories it's nested under. Use it to show a category's details, for
|
|
3519
|
+
* example in the header of a category page, and to link to the category and to the categories it's
|
|
3520
|
+
* nested under.
|
|
3521
|
+
*/
|
|
3517
3522
|
declare function useCategoryInfoContext(): CategoryInfoContextValue;
|
|
3518
3523
|
/** Props accepted by {@link CategoryInfoContextProvider}. */
|
|
3519
3524
|
interface CategoryInfoContextProviderProps extends React.PropsWithChildren {
|
|
@@ -86,7 +86,11 @@ interface CategoryListContextValue {
|
|
|
86
86
|
}
|
|
87
87
|
//#endregion
|
|
88
88
|
//#region src/extensions/gallery/providers/category-list-context/category-list-context-provider.d.ts
|
|
89
|
-
/**
|
|
89
|
+
/**
|
|
90
|
+
* The `useCategoryListContext()` hook provides access to the store's visible categories and to the
|
|
91
|
+
* ID of the category whose page the component is on. Use it to build category navigation, such as
|
|
92
|
+
* links to the current category's child categories or to its parent category.
|
|
93
|
+
*/
|
|
90
94
|
declare function useCategoryListContext(): CategoryListContextValue;
|
|
91
95
|
/** Props accepted by {@link CategoryListContextProvider}. */
|
|
92
96
|
interface CategoryListContextProviderProps extends React.PropsWithChildren {
|
|
@@ -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 {
|
|
@@ -4213,7 +4213,15 @@ interface ProductByIdContextProviderProps extends React.PropsWithChildren {
|
|
|
4213
4213
|
productId?: string;
|
|
4214
4214
|
}
|
|
4215
4215
|
type ProductByIdContextImplementation = ReturnType<typeof useStandaloneProductContextValue>;
|
|
4216
|
-
/**
|
|
4216
|
+
/**
|
|
4217
|
+
* The `useProductByIdContext()` hook provides access to the store product chosen in the settings of
|
|
4218
|
+
* a **Product**
|
|
4219
|
+
* [Data Source](https://dev.wix.com/docs/studio-two/code-your-site/code-model/data-sources/about-data-sources):
|
|
4220
|
+
* its details, prices, media, and stock, and the visitor's selection of options, modifiers,
|
|
4221
|
+
* subscription plan, and quantity. Use it to feature a product anywhere on a site, let visitors
|
|
4222
|
+
* choose what to buy, and let them add their selection to the cart, start a checkout, or sign up
|
|
4223
|
+
* for a back-in-stock email.
|
|
4224
|
+
*/
|
|
4217
4225
|
declare function useProductByIdContext(): ProductContextValue;
|
|
4218
4226
|
/** Loads a product by ID and supplies its details and purchase actions to descendants. */
|
|
4219
4227
|
declare function ProductByIdContextProvider({
|
|
@@ -1661,8 +1661,8 @@ function zi(e2) {
|
|
|
1661
1661
|
var Bi = (e2) => Number.parseFloat(e2?.amount);
|
|
1662
1662
|
var G = (e2) => e2?.amount == null ? void 0 : Bi(e2);
|
|
1663
1663
|
var Vi = [W.URL, W.DESCRIPTION, W.PLAIN_DESCRIPTION, W.MEDIA_ITEMS_INFO, W.INFO_SECTION, W.INFO_SECTION_DESCRIPTION, W.CURRENCY, W.DISCOUNT_INFO, W.SUBSCRIPTION_PRICES_INFO, W.BREADCRUMBS_INFO, W.DIRECT_CATEGORIES_INFO, W.PRODUCT_CHOICES_MEDIA_REFERENCES, W.PRODUCT_CHOICES_DISPLAY_IMAGE];
|
|
1664
|
-
async function Hi(e2) {
|
|
1665
|
-
return { product: Ti(await Br(e2, { fields:
|
|
1664
|
+
async function Hi(e2, t2 = Vi) {
|
|
1665
|
+
return { product: Ti(await Br(e2, { fields: t2 })) };
|
|
1666
1666
|
}
|
|
1667
1667
|
function Ui(e2) {
|
|
1668
1668
|
if (e2.status === `fulfilled`) return e2.value;
|
|
@@ -3130,8 +3130,8 @@ function Kc(e2, t2, r2, i2 = false) {
|
|
|
3130
3130
|
return t3 ? { href: t3 } : void 0;
|
|
3131
3131
|
}, [e2.slug, u2]);
|
|
3132
3132
|
return (0, import_react.useMemo)(() => {
|
|
3133
|
-
let { selectedVariant: e3, setHasAttemptedSubmit: n2, isSelectionValid: a3, selectedOptions: u3, selectedModifiers: f2, selectedSubscriptionPlanId: p2, quantity: m2,
|
|
3134
|
-
return { ...o2, link: d2, ...r2, ...
|
|
3133
|
+
let { selectedVariant: e3, setHasAttemptedSubmit: n2, isSelectionValid: a3, selectedOptions: u3, selectedModifiers: f2, selectedSubscriptionPlanId: p2, quantity: m2, productGrouping: h2, ...g2 } = t2;
|
|
3134
|
+
return { ...o2, link: d2, ...r2, ...g2, buyerSelections: { options: Wc(u3), modifiers: Gc(f2), subscriptionPlanId: p2, quantity: m2 }, ...s2, ...c2, ...l2, isBackInStockEnabled: i2 };
|
|
3135
3135
|
}, [o2, d2, r2, t2, s2, c2, l2, i2]);
|
|
3136
3136
|
}
|
|
3137
3137
|
var qc = K(`@wix/site-service-locale`);
|
|
@@ -3326,58 +3326,61 @@ function Al(e2, t2) {
|
|
|
3326
3326
|
return { ...e2, [t2.groupingCustomizationId]: { ...n2, ...e2[t2.groupingCustomizationId] } };
|
|
3327
3327
|
}
|
|
3328
3328
|
function jl(e2, r2) {
|
|
3329
|
-
let
|
|
3330
|
-
return { productGrouping:
|
|
3331
|
-
if (!
|
|
3332
|
-
let t2 = Tl(
|
|
3333
|
-
t2 &&
|
|
3334
|
-
}, [
|
|
3335
|
-
if (!
|
|
3336
|
-
let { customizationType: t2, groupingCustomizationId: n2, currentProductChoiceId: r3 } =
|
|
3329
|
+
let i2 = (0, import_react.useMemo)(() => wl(e2, r2?.productGroup), [e2, r2?.productGroup]);
|
|
3330
|
+
return { productGrouping: i2, selectGroupSiblingChoice: (0, import_react.useCallback)((e3) => {
|
|
3331
|
+
if (!i2 || e3 === i2.currentProductChoiceId) return;
|
|
3332
|
+
let t2 = Tl(i2, e3);
|
|
3333
|
+
t2 && r2?.selectProductGroupMember(t2.productId);
|
|
3334
|
+
}, [i2, r2?.selectProductGroupMember]), productCustomizations: (0, import_react.useMemo)(() => Dl(e2, i2), [e2, i2]), addGroupChoicesAvailability: (0, import_react.useCallback)((e3) => Al(e3, i2), [i2]), initialSelection: (0, import_react.useMemo)(() => {
|
|
3335
|
+
if (!i2) return { options: {}, modifiers: {} };
|
|
3336
|
+
let { customizationType: t2, groupingCustomizationId: n2, currentProductChoiceId: r3 } = i2;
|
|
3337
3337
|
if (t2 === $.MODIFIER && e2.modifiers[n2].mandatory === false) return { options: {}, modifiers: {} };
|
|
3338
|
-
let
|
|
3339
|
-
return t2 === $.PRODUCT_OPTION ? { options:
|
|
3340
|
-
}, [
|
|
3338
|
+
let a2 = { [n2]: r3 };
|
|
3339
|
+
return t2 === $.PRODUCT_OPTION ? { options: a2, modifiers: {} } : { options: {}, modifiers: a2 };
|
|
3340
|
+
}, [i2, e2.modifiers]) };
|
|
3341
3341
|
}
|
|
3342
|
-
function Ml(e2, i2, a2) {
|
|
3343
|
-
let
|
|
3342
|
+
function Ml({ product: e2, inventoryItems: i2, productGroupData: a2, hasLoadedVariants: o2 = true }) {
|
|
3343
|
+
let s2 = jl(e2, a2), { productGrouping: c2, selectGroupSiblingChoice: l2, addGroupChoicesAvailability: u2 } = s2, [d2, f2] = (0, import_react.useState)(() => s2.initialSelection.options), [p2, m2] = (0, import_react.useState)(() => s2.initialSelection.modifiers), [h2, g2] = (0, import_react.useState)(void 0), [_2, v2] = (0, import_react.useState)(1), [y2, b2] = (0, import_react.useState)(false), x2 = (0, import_react.useMemo)(() => sl(ul(e2.variants, i2)), [e2.variants, i2]), S2 = (0, import_react.useMemo)(() => {
|
|
3344
3344
|
let t2 = /* @__PURE__ */ new Map();
|
|
3345
3345
|
return (n2) => {
|
|
3346
3346
|
let r2 = ol(n2), i3 = t2.get(r2);
|
|
3347
3347
|
if (i3) return i3;
|
|
3348
|
-
let a3 =
|
|
3348
|
+
let a3 = u2(cl(e2.options, x2, n2));
|
|
3349
3349
|
return t2.set(r2, a3), a3;
|
|
3350
3350
|
};
|
|
3351
|
-
}, [
|
|
3352
|
-
if (
|
|
3353
|
-
if (El(
|
|
3354
|
-
|
|
3351
|
+
}, [x2, e2.options, u2])(o2 ? d2 : {}), C2 = (0, import_react.useMemo)(() => Object.keys(d2).length === e2.options.length ? x2.get(ol(d2)) ?? null : null, [x2, d2, e2.options.length]), w2 = (0, import_react.useCallback)((e3, t2) => {
|
|
3352
|
+
if (d2[e3] !== t2) {
|
|
3353
|
+
if (El(c2, e3, t2)) {
|
|
3354
|
+
l2(t2);
|
|
3355
3355
|
return;
|
|
3356
3356
|
}
|
|
3357
|
-
|
|
3357
|
+
f2((n2) => ({ ...n2, [e3]: t2 })), v2(1);
|
|
3358
3358
|
}
|
|
3359
|
-
}, [
|
|
3360
|
-
if (El(
|
|
3361
|
-
|
|
3359
|
+
}, [d2, c2, l2]), T2 = (0, import_react.useCallback)((e3, t2) => {
|
|
3360
|
+
if (El(c2, e3, t2)) {
|
|
3361
|
+
l2(t2);
|
|
3362
3362
|
return;
|
|
3363
3363
|
}
|
|
3364
|
-
|
|
3365
|
-
}, [
|
|
3366
|
-
|
|
3364
|
+
m2((n2) => n2[e3] === t2 ? n2 : { ...n2, [e3]: t2 });
|
|
3365
|
+
}, [c2, l2]), E2 = (0, import_react.useCallback)((e3) => {
|
|
3366
|
+
m2((t2) => {
|
|
3367
3367
|
if (!(e3 in t2)) return t2;
|
|
3368
3368
|
let { [e3]: n2, ...r2 } = t2;
|
|
3369
3369
|
return r2;
|
|
3370
3370
|
});
|
|
3371
3371
|
}, []), D2 = (0, import_react.useCallback)((e3) => {
|
|
3372
|
-
|
|
3373
|
-
}, []), O2 = (0, import_react.useMemo)(() => Ka(C2), [C2]), k2 = (0, import_react.useMemo)(() => qa(
|
|
3374
|
-
|
|
3375
|
-
}, []), te2 = (0, import_react.useMemo)(() => fl({ product: e2, selections: { selectedOptions:
|
|
3376
|
-
return (0, import_react.useMemo)(() => ({ options: ne2, modifiers: re2, quantity: k2, selectedOptions:
|
|
3372
|
+
g2(e3);
|
|
3373
|
+
}, []), O2 = (0, import_react.useMemo)(() => Ka(C2), [C2]), k2 = (0, import_react.useMemo)(() => qa(_2, O2), [_2, O2]), ee2 = (0, import_react.useCallback)((e3) => {
|
|
3374
|
+
v2(e3);
|
|
3375
|
+
}, []), te2 = (0, import_react.useMemo)(() => fl({ 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;
|
|
3376
|
+
return (0, import_react.useMemo)(() => ({ 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]);
|
|
3377
3377
|
}
|
|
3378
3378
|
function Nl({ product: e2, productGroup: t2, inventoryItems: r2, isBackInStockEnabled: i2, source: a2 }) {
|
|
3379
|
-
let o2 =
|
|
3380
|
-
|
|
3379
|
+
let { navigateToProductPage: o2 } = Pa(), s2 = Ml({ product: e2, inventoryItems: r2, productGroupData: t2 && { productGroup: t2, selectProductGroupMember: (e3) => {
|
|
3380
|
+
let n2 = t2.members.find((t3) => t3.productId === e3);
|
|
3381
|
+
n2 && o2(n2.slug);
|
|
3382
|
+
} } }), c2 = Ga(e2, s2, Za(e2, s2.selectedVariant)), l2 = Kc(e2, s2, al({ product: e2, userInputs: s2, hasLoadedVariants: true }), i2);
|
|
3383
|
+
return (0, import_react.useMemo)(() => ({ ...l2, ...c2, source: a2 }), [l2, c2, a2]);
|
|
3381
3384
|
}
|
|
3382
3385
|
function Pl({ productPromise: e2, source: t2, children: n2 }) {
|
|
3383
3386
|
let { product: r2, productGroup: a2, inventoryItems: o2, isBackInStockEnabled: s2 } = Ui(e2), l2 = Nl({ product: r2, productGroup: a2, inventoryItems: o2, isBackInStockEnabled: s2, source: t2 });
|