@wix/stores 1.0.976 → 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 +5 -5
@@ -30,10 +30,10 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
30
30
  // context-product-by-id.ts
31
31
  var context_product_by_id_exports = {};
32
32
  __export(context_product_by_id_exports, {
33
- ProductByIdContextProvider: () => Yl,
34
- default: () => Yl,
35
- injectAccessTokenGetter: () => Xl,
36
- useProductByIdContext: () => ql
33
+ ProductByIdContextProvider: () => Xl,
34
+ default: () => Xl,
35
+ injectAccessTokenGetter: () => Zl,
36
+ useProductByIdContext: () => Jl
37
37
  });
38
38
  module.exports = __toCommonJS(context_product_by_id_exports);
39
39
 
@@ -3392,7 +3392,15 @@ function Il(t2) {
3392
3392
  }
3393
3393
  Il.displayName = `StandaloneProductContextProvider`;
3394
3394
  var Ll = K(`@wix/site-service-warmup-data`);
3395
- async function Rl(e2, t2, n2) {
3395
+ function Rl() {
3396
+ let e2 = (0, import_services_manager_react.useGetService)(), t2 = (0, import_services_manager_react.useService)(Jc), n2;
3397
+ try {
3398
+ n2 = e2(Yc);
3399
+ } catch {
3400
+ }
3401
+ return n2?.multilingualEnabled && n2.currentLocale?.languageCode || t2.language;
3402
+ }
3403
+ async function zl(e2, t2, n2) {
3396
3404
  let r2 = typeof window > `u`;
3397
3405
  if (!r2 && e2) try {
3398
3406
  let n3 = await e2.get(t2);
@@ -3406,57 +3414,57 @@ async function Rl(e2, t2, n2) {
3406
3414
  }
3407
3415
  return i2;
3408
3416
  }
3409
- function zl(e2, t2) {
3410
- let n2 = (0, import_services_manager_react.useGetService)(), [i2] = (0, import_react.useState)(() => {
3411
- let r2;
3417
+ function Bl(e2, t2) {
3418
+ let r2 = (0, import_services_manager_react.useGetService)(), i2 = Rl();
3419
+ return (0, import_react.useMemo)(() => {
3420
+ let n2;
3412
3421
  try {
3413
- r2 = n2(Ll);
3422
+ n2 = r2(Ll);
3414
3423
  } catch {
3415
- r2 = null;
3424
+ n2 = null;
3416
3425
  }
3417
- return Rl(r2, e2, t2);
3418
- });
3419
- return i2;
3426
+ return zl(n2, `${e2}:${i2}`, t2);
3427
+ }, [i2]);
3420
3428
  }
3421
- async function Bl() {
3429
+ async function Vl() {
3422
3430
  return (await ai().eq(`defaultLocation`, true).find()).items?.[0]?._id ?? void 0;
3423
3431
  }
3424
- async function Vl() {
3432
+ async function Hl() {
3425
3433
  try {
3426
3434
  return (await ia()).settings?.collectionStates?.some((e2) => e2.appId === `215238eb-22a5-4c36-9e7b-e7c08025e04e` && e2.collectingRequests) ?? false;
3427
3435
  } catch {
3428
3436
  return false;
3429
3437
  }
3430
3438
  }
3431
- function Hl(e2) {
3439
+ function Ul(e2) {
3432
3440
  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 }));
3433
3441
  }
3434
- async function Ul(e2, t2) {
3435
- return Hl((await Dr().eq(`productId`, e2).eq(`locationId`, t2).find()).items ?? []);
3442
+ async function Wl(e2, t2) {
3443
+ return Ul((await Dr().eq(`productId`, e2).eq(`locationId`, t2).find()).items ?? []);
3436
3444
  }
3437
- async function Wl(e2) {
3438
- let [t2, n2, r2] = await Promise.all([e2(), Bl(), Vl()]), { product: i2 } = t2;
3445
+ async function Gl(e2) {
3446
+ let [t2, n2, r2] = await Promise.all([e2(), Vl(), Hl()]), { product: i2 } = t2;
3439
3447
  if (!n2) throw Error(`Location not found`);
3440
- let [a2, o2] = await Promise.all([Ul(i2.id, n2), i2.productGroupId ? wl(i2.productGroupId) : void 0]);
3448
+ let [a2, o2] = await Promise.all([Wl(i2.id, n2), i2.productGroupId ? wl(i2.productGroupId) : void 0]);
3441
3449
  return { ...t2, productGroup: o2, inventoryItems: a2, isBackInStockEnabled: r2 };
3442
3450
  }
3443
- function Gl(e2, t2) {
3444
- return zl(`wixstores-storefront-builder:product-data:${e2}`, () => Wl(t2));
3451
+ function Kl(e2, t2) {
3452
+ return Bl(`wixstores-storefront-builder:product-data:${e2}`, () => Gl(t2));
3445
3453
  }
3446
- var Kl = function(e2) {
3454
+ var ql = function(e2) {
3447
3455
  return e2.PRODUCT_BY_SLUG = `product-by-slug`, e2.PRODUCT_BY_ID = `product-by-id`, e2.PRODUCT_ITEM = `product-item`, e2;
3448
3456
  }({});
3449
- function ql() {
3457
+ function Jl() {
3450
3458
  return (0, import_product_context_provider.useProductContext)();
3451
3459
  }
3452
- function Jl({ productId: e2, children: t2 }) {
3453
- let n2 = Gl(`id:${e2}`, () => Hi(e2));
3454
- return (0, import_jsx_runtime.jsx)(Il, { productPromise: n2, source: Kl.PRODUCT_BY_ID, children: t2 });
3455
- }
3456
3460
  function Yl({ productId: e2, children: t2 }) {
3457
- return e2 ? (0, import_jsx_runtime.jsx)(Jl, { productId: e2, children: t2 }, e2) : null;
3461
+ let n2 = Kl(`id:${e2}`, () => Hi(e2));
3462
+ return (0, import_jsx_runtime.jsx)(Il, { productPromise: n2, source: ql.PRODUCT_BY_ID, children: t2 });
3463
+ }
3464
+ function Xl({ productId: e2, children: t2 }) {
3465
+ return e2 ? (0, import_jsx_runtime.jsx)(Yl, { productId: e2, children: t2 }, e2) : null;
3458
3466
  }
3459
- var Xl = Dn(`213f32a8-6f88-4024-a54b-f1264433e878`);
3467
+ var Zl = Dn(`213f32a8-6f88-4024-a54b-f1264433e878`);
3460
3468
  // Annotate the CommonJS export names for ESM import in node:
3461
3469
  0 && (module.exports = {
3462
3470
  ProductByIdContextProvider,