@wix/stores 1.0.977 → 1.0.979
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/build/cjs/context-category-by-id.js +219 -208
- package/build/cjs/context-category-by-id.js.map +1 -1
- package/build/cjs/context-category-by-slug.js +1203 -1192
- package/build/cjs/context-category-by-slug.js.map +1 -1
- package/build/cjs/context-category-info.js +259 -249
- package/build/cjs/context-category-info.js.map +1 -1
- package/build/cjs/context-category-list.js +1 -1
- package/build/cjs/context-category-list.js.map +1 -1
- package/build/cjs/context-product-by-id.js +40 -32
- package/build/cjs/context-product-by-id.js.map +1 -1
- package/build/cjs/context-product-by-slug.js +49 -41
- package/build/cjs/context-product-by-slug.js.map +1 -1
- package/build/cjs/context-product-item.js +1043 -1035
- package/build/cjs/context-product-item.js.map +1 -1
- package/build/cjs/context-product-list.js +1 -1
- package/build/cjs/context-product-list.js.map +1 -1
- package/build/cjs/context-product.js +1 -1
- package/build/cjs/context-product.js.map +1 -1
- package/build/cjs/context-promotion-item.js +1 -1
- package/build/cjs/context-promotion-item.js.map +1 -1
- package/build/es/context-category-by-id.mjs +219 -208
- package/build/es/context-category-by-id.mjs.map +1 -1
- package/build/es/context-category-by-slug.mjs +1203 -1192
- package/build/es/context-category-by-slug.mjs.map +1 -1
- package/build/es/context-category-info.mjs +263 -253
- package/build/es/context-category-info.mjs.map +1 -1
- package/build/es/context-category-list.mjs +1 -1
- package/build/es/context-category-list.mjs.map +1 -1
- package/build/es/context-product-by-id.mjs +40 -32
- package/build/es/context-product-by-id.mjs.map +1 -1
- package/build/es/context-product-by-slug.mjs +49 -41
- package/build/es/context-product-by-slug.mjs.map +1 -1
- package/build/es/context-product-item.mjs +1043 -1035
- package/build/es/context-product-item.mjs.map +1 -1
- package/build/es/context-product-list.mjs +1 -1
- package/build/es/context-product-list.mjs.map +1 -1
- package/build/es/context-product.mjs +1 -1
- package/build/es/context-product.mjs.map +1 -1
- package/build/es/context-promotion-item.mjs +1 -1
- package/build/es/context-promotion-item.mjs.map +1 -1
- package/{_sdk-exports → context-runtime}/context-category-by-id/runtime.js +2 -2
- package/context-runtime/context-category-by-slug/runtime.js +2 -0
- package/context-runtime/context-category-info/runtime.js +2 -0
- package/{_sdk-exports → context-runtime}/context-product-by-id/runtime.js +2 -2
- package/{_sdk-exports → context-runtime}/context-product-by-slug/runtime.js +2 -2
- package/context-runtime/context-product-item/runtime.js +2 -0
- package/package.json +4 -4
- package/_sdk-exports/context-category-by-slug/runtime.js +0 -2
- package/_sdk-exports/context-category-info/runtime.js +0 -2
- package/_sdk-exports/context-product-item/runtime.js +0 -2
- /package/{_sdk-exports → context-runtime}/context-category-by-id/runtime.d.ts +0 -0
- /package/{_sdk-exports → context-runtime}/context-category-by-slug/runtime.d.ts +0 -0
- /package/{_sdk-exports → context-runtime}/context-category-info/runtime.d.ts +0 -0
- /package/{_sdk-exports → context-runtime}/context-category-list/runtime.d.ts +0 -0
- /package/{_sdk-exports → context-runtime}/context-category-list/runtime.js +0 -0
- /package/{_sdk-exports → context-runtime}/context-product/runtime.d.ts +0 -0
- /package/{_sdk-exports → context-runtime}/context-product/runtime.js +0 -0
- /package/{_sdk-exports → context-runtime}/context-product-by-id/runtime.d.ts +0 -0
- /package/{_sdk-exports → context-runtime}/context-product-by-slug/runtime.d.ts +0 -0
- /package/{_sdk-exports → context-runtime}/context-product-item/runtime.d.ts +0 -0
- /package/{_sdk-exports → context-runtime}/context-product-list/runtime.d.ts +0 -0
- /package/{_sdk-exports → context-runtime}/context-product-list/runtime.js +0 -0
- /package/{_sdk-exports → context-runtime}/context-promotion-item/runtime.d.ts +0 -0
- /package/{_sdk-exports → context-runtime}/context-promotion-item/runtime.js +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//
|
|
1
|
+
// context-runtime/context-product-by-slug/runtime.js
|
|
2
2
|
import { Suspense as e, useCallback as t, useMemo as n, useRef as r, useState as i } from "react";
|
|
3
3
|
import a, { useProductContext as o } from "@wix/stores/product-context-provider";
|
|
4
4
|
import { useGetService as s, useService as c } from "@wix/services-manager-react";
|
|
@@ -3359,7 +3359,15 @@ function zl(t2) {
|
|
|
3359
3359
|
}
|
|
3360
3360
|
zl.displayName = `StandaloneProductContextProvider`;
|
|
3361
3361
|
var Bl = q(`@wix/site-service-warmup-data`);
|
|
3362
|
-
|
|
3362
|
+
function Vl() {
|
|
3363
|
+
let e2 = s(), t2 = c(Zc), n2;
|
|
3364
|
+
try {
|
|
3365
|
+
n2 = e2(Qc);
|
|
3366
|
+
} catch {
|
|
3367
|
+
}
|
|
3368
|
+
return n2?.multilingualEnabled && n2.currentLocale?.languageCode || t2.language;
|
|
3369
|
+
}
|
|
3370
|
+
async function Hl(e2, t2, n2) {
|
|
3363
3371
|
let r2 = typeof window > `u`;
|
|
3364
3372
|
if (!r2 && e2) try {
|
|
3365
3373
|
let n3 = await e2.get(t2);
|
|
@@ -3373,78 +3381,78 @@ async function Vl(e2, t2, n2) {
|
|
|
3373
3381
|
}
|
|
3374
3382
|
return i2;
|
|
3375
3383
|
}
|
|
3376
|
-
function
|
|
3377
|
-
let
|
|
3378
|
-
|
|
3384
|
+
function Ul(e2, t2) {
|
|
3385
|
+
let r2 = s(), i2 = Vl();
|
|
3386
|
+
return n(() => {
|
|
3387
|
+
let n2;
|
|
3379
3388
|
try {
|
|
3380
|
-
|
|
3389
|
+
n2 = r2(Bl);
|
|
3381
3390
|
} catch {
|
|
3382
|
-
|
|
3391
|
+
n2 = null;
|
|
3383
3392
|
}
|
|
3384
|
-
return
|
|
3385
|
-
});
|
|
3386
|
-
return r2;
|
|
3393
|
+
return Hl(n2, `${e2}:${i2}`, t2);
|
|
3394
|
+
}, [i2]);
|
|
3387
3395
|
}
|
|
3388
|
-
async function
|
|
3396
|
+
async function Wl() {
|
|
3389
3397
|
return (await si().eq(`defaultLocation`, true).find()).items?.[0]?._id ?? void 0;
|
|
3390
3398
|
}
|
|
3391
|
-
async function
|
|
3399
|
+
async function Gl() {
|
|
3392
3400
|
try {
|
|
3393
3401
|
return (await oa()).settings?.collectionStates?.some((e2) => e2.appId === `215238eb-22a5-4c36-9e7b-e7c08025e04e` && e2.collectingRequests) ?? false;
|
|
3394
3402
|
} catch {
|
|
3395
3403
|
return false;
|
|
3396
3404
|
}
|
|
3397
3405
|
}
|
|
3398
|
-
function
|
|
3406
|
+
function Kl(e2) {
|
|
3399
3407
|
return e2.map((e3) => ({ variantId: e3.variantId ?? ``, availabilityStatus: e3.availabilityStatus, quantity: e3.quantity ?? void 0, trackQuantity: e3.trackQuantity ?? false, preorderInfo: e3.preorderInfo ? { message: e3.preorderInfo.message ?? void 0, quantity: e3.preorderInfo.quantity ?? void 0 } : void 0 }));
|
|
3400
3408
|
}
|
|
3401
|
-
async function
|
|
3402
|
-
return
|
|
3409
|
+
async function ql(e2, t2) {
|
|
3410
|
+
return Kl((await kr().eq(`productId`, e2).eq(`locationId`, t2).find()).items ?? []);
|
|
3403
3411
|
}
|
|
3404
|
-
async function
|
|
3405
|
-
let [t2, n2, r2] = await Promise.all([e2(),
|
|
3412
|
+
async function Jl(e2) {
|
|
3413
|
+
let [t2, n2, r2] = await Promise.all([e2(), Wl(), Gl()]), { product: i2 } = t2;
|
|
3406
3414
|
if (!n2) throw Error(`Location not found`);
|
|
3407
|
-
let [a2, o2] = await Promise.all([
|
|
3415
|
+
let [a2, o2] = await Promise.all([ql(i2.id, n2), i2.productGroupId ? Dl(i2.productGroupId) : void 0]);
|
|
3408
3416
|
return { ...t2, productGroup: o2, inventoryItems: a2, isBackInStockEnabled: r2 };
|
|
3409
3417
|
}
|
|
3410
|
-
function
|
|
3411
|
-
return
|
|
3418
|
+
function Yl(e2, t2) {
|
|
3419
|
+
return Ul(`wixstores-storefront-builder:product-data:${e2}`, () => Jl(t2));
|
|
3412
3420
|
}
|
|
3413
|
-
var
|
|
3421
|
+
var Xl = function(e2) {
|
|
3414
3422
|
return e2.PRODUCT_BY_SLUG = `product-by-slug`, e2.PRODUCT_BY_ID = `product-by-id`, e2.PRODUCT_ITEM = `product-item`, e2;
|
|
3415
3423
|
}({});
|
|
3416
|
-
function
|
|
3424
|
+
function Zl() {
|
|
3417
3425
|
let e2 = c(ja);
|
|
3418
|
-
return
|
|
3426
|
+
return Ql(new URL(e2.currentUrl));
|
|
3419
3427
|
}
|
|
3420
|
-
function
|
|
3428
|
+
function Ql(e2) {
|
|
3421
3429
|
return e2.pathname.split(`/`).filter(Boolean).at(-1) || void 0;
|
|
3422
3430
|
}
|
|
3423
|
-
var
|
|
3424
|
-
var
|
|
3425
|
-
function
|
|
3426
|
-
let t2 = c(
|
|
3431
|
+
var $l = q(`seo/seo-service`);
|
|
3432
|
+
var eu = q(`@wix/site-service-rendering-context`);
|
|
3433
|
+
function tu(e2) {
|
|
3434
|
+
let t2 = c($l), { SSR: n2 } = c(eu), i2 = r(false);
|
|
3427
3435
|
!i2.current && e2.id && n2 && (i2.current = true, t2.setSeoEntity({ itemType: `STORES_PRODUCT`, seoData: e2.seoData ?? {}, itemData: { product: e2 } }).catch(() => {
|
|
3428
3436
|
}));
|
|
3429
3437
|
}
|
|
3430
|
-
var
|
|
3431
|
-
function
|
|
3438
|
+
var nu = `No product slug is available for the product context`;
|
|
3439
|
+
function ru() {
|
|
3432
3440
|
return o();
|
|
3433
3441
|
}
|
|
3434
|
-
function
|
|
3442
|
+
function iu({ productPromise: e2 }) {
|
|
3435
3443
|
let { seoProduct: t2 } = kn(e2);
|
|
3436
|
-
return
|
|
3444
|
+
return tu(t2), null;
|
|
3437
3445
|
}
|
|
3438
|
-
function
|
|
3439
|
-
let t2 =
|
|
3440
|
-
return u(zl, { productPromise: n2, source:
|
|
3446
|
+
function au({ children: e2 }) {
|
|
3447
|
+
let t2 = Zl(), n2 = Yl(`slug:${t2}`, () => t2 ? Gi(t2) : Promise.reject(Error(nu)));
|
|
3448
|
+
return u(zl, { productPromise: n2, source: Xl.PRODUCT_BY_SLUG, children: [l(iu, { productPromise: n2 }), e2] });
|
|
3441
3449
|
}
|
|
3442
|
-
var
|
|
3450
|
+
var ou = On(`b276b552-68b9-4936-98d5-fbe43c0bd257`);
|
|
3443
3451
|
export {
|
|
3444
|
-
|
|
3445
|
-
|
|
3446
|
-
|
|
3447
|
-
|
|
3448
|
-
|
|
3452
|
+
nu as NO_PRODUCT_SLUG_ERROR,
|
|
3453
|
+
au as ProductBySlugContextProvider,
|
|
3454
|
+
au as default,
|
|
3455
|
+
ou as injectAccessTokenGetter,
|
|
3456
|
+
ru as useProductBySlugContext
|
|
3449
3457
|
};
|
|
3450
3458
|
//# sourceMappingURL=context-product-by-slug.mjs.map
|