@wix/stores 1.0.977 → 1.0.978

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.
Files changed (31) hide show
  1. package/_sdk-exports/context-category-by-id/runtime.js +2 -2
  2. package/_sdk-exports/context-category-by-slug/runtime.js +2 -2
  3. package/_sdk-exports/context-category-info/runtime.js +2 -2
  4. package/_sdk-exports/context-product-by-id/runtime.js +2 -2
  5. package/_sdk-exports/context-product-by-slug/runtime.js +2 -2
  6. package/_sdk-exports/context-product-item/runtime.js +2 -2
  7. package/build/cjs/context-category-by-id.js +218 -207
  8. package/build/cjs/context-category-by-id.js.map +1 -1
  9. package/build/cjs/context-category-by-slug.js +1202 -1191
  10. package/build/cjs/context-category-by-slug.js.map +1 -1
  11. package/build/cjs/context-category-info.js +258 -248
  12. package/build/cjs/context-category-info.js.map +1 -1
  13. package/build/cjs/context-product-by-id.js +39 -31
  14. package/build/cjs/context-product-by-id.js.map +1 -1
  15. package/build/cjs/context-product-by-slug.js +48 -40
  16. package/build/cjs/context-product-by-slug.js.map +1 -1
  17. package/build/cjs/context-product-item.js +1042 -1034
  18. package/build/cjs/context-product-item.js.map +1 -1
  19. package/build/es/context-category-by-id.mjs +218 -207
  20. package/build/es/context-category-by-id.mjs.map +1 -1
  21. package/build/es/context-category-by-slug.mjs +1202 -1191
  22. package/build/es/context-category-by-slug.mjs.map +1 -1
  23. package/build/es/context-category-info.mjs +262 -252
  24. package/build/es/context-category-info.mjs.map +1 -1
  25. package/build/es/context-product-by-id.mjs +39 -31
  26. package/build/es/context-product-by-id.mjs.map +1 -1
  27. package/build/es/context-product-by-slug.mjs +48 -40
  28. package/build/es/context-product-by-slug.mjs.map +1 -1
  29. package/build/es/context-product-item.mjs +1042 -1034
  30. package/build/es/context-product-item.mjs.map +1 -1
  31. package/package.json +2 -2
@@ -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
- async function Vl(e2, t2, n2) {
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 Hl(e2, t2) {
3377
- let n2 = s(), [r2] = i(() => {
3378
- let r3;
3384
+ function Ul(e2, t2) {
3385
+ let r2 = s(), i2 = Vl();
3386
+ return n(() => {
3387
+ let n2;
3379
3388
  try {
3380
- r3 = n2(Bl);
3389
+ n2 = r2(Bl);
3381
3390
  } catch {
3382
- r3 = null;
3391
+ n2 = null;
3383
3392
  }
3384
- return Vl(r3, e2, t2);
3385
- });
3386
- return r2;
3393
+ return Hl(n2, `${e2}:${i2}`, t2);
3394
+ }, [i2]);
3387
3395
  }
3388
- async function Ul() {
3396
+ async function Wl() {
3389
3397
  return (await si().eq(`defaultLocation`, true).find()).items?.[0]?._id ?? void 0;
3390
3398
  }
3391
- async function Wl() {
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 Gl(e2) {
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 Kl(e2, t2) {
3402
- return Gl((await kr().eq(`productId`, e2).eq(`locationId`, t2).find()).items ?? []);
3409
+ async function ql(e2, t2) {
3410
+ return Kl((await kr().eq(`productId`, e2).eq(`locationId`, t2).find()).items ?? []);
3403
3411
  }
3404
- async function ql(e2) {
3405
- let [t2, n2, r2] = await Promise.all([e2(), Ul(), Wl()]), { product: i2 } = t2;
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([Kl(i2.id, n2), i2.productGroupId ? Dl(i2.productGroupId) : void 0]);
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 Jl(e2, t2) {
3411
- return Hl(`wixstores-storefront-builder:product-data:${e2}`, () => ql(t2));
3418
+ function Yl(e2, t2) {
3419
+ return Ul(`wixstores-storefront-builder:product-data:${e2}`, () => Jl(t2));
3412
3420
  }
3413
- var Yl = function(e2) {
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 Xl() {
3424
+ function Zl() {
3417
3425
  let e2 = c(ja);
3418
- return Zl(new URL(e2.currentUrl));
3426
+ return Ql(new URL(e2.currentUrl));
3419
3427
  }
3420
- function Zl(e2) {
3428
+ function Ql(e2) {
3421
3429
  return e2.pathname.split(`/`).filter(Boolean).at(-1) || void 0;
3422
3430
  }
3423
- var Ql = q(`seo/seo-service`);
3424
- var $l = q(`@wix/site-service-rendering-context`);
3425
- function eu(e2) {
3426
- let t2 = c(Ql), { SSR: n2 } = c($l), i2 = r(false);
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 tu = `No product slug is available for the product context`;
3431
- function nu() {
3438
+ var nu = `No product slug is available for the product context`;
3439
+ function ru() {
3432
3440
  return o();
3433
3441
  }
3434
- function ru({ productPromise: e2 }) {
3442
+ function iu({ productPromise: e2 }) {
3435
3443
  let { seoProduct: t2 } = kn(e2);
3436
- return eu(t2), null;
3444
+ return tu(t2), null;
3437
3445
  }
3438
- function iu({ children: e2 }) {
3439
- let t2 = Xl(), n2 = Jl(`slug:${t2}`, () => t2 ? Gi(t2) : Promise.reject(Error(tu)));
3440
- return u(zl, { productPromise: n2, source: Yl.PRODUCT_BY_SLUG, children: [l(ru, { productPromise: n2 }), e2] });
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 au = On(`b276b552-68b9-4936-98d5-fbe43c0bd257`);
3450
+ var ou = On(`b276b552-68b9-4936-98d5-fbe43c0bd257`);
3443
3451
  export {
3444
- tu as NO_PRODUCT_SLUG_ERROR,
3445
- iu as ProductBySlugContextProvider,
3446
- iu as default,
3447
- au as injectAccessTokenGetter,
3448
- nu as useProductBySlugContext
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