@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
@@ -30,11 +30,11 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
30
30
  // context-product-by-slug.ts
31
31
  var context_product_by_slug_exports = {};
32
32
  __export(context_product_by_slug_exports, {
33
- NO_PRODUCT_SLUG_ERROR: () => tu,
34
- ProductBySlugContextProvider: () => iu,
35
- default: () => iu,
36
- injectAccessTokenGetter: () => au,
37
- useProductBySlugContext: () => nu
33
+ NO_PRODUCT_SLUG_ERROR: () => nu,
34
+ ProductBySlugContextProvider: () => au,
35
+ default: () => au,
36
+ injectAccessTokenGetter: () => ou,
37
+ useProductBySlugContext: () => ru
38
38
  });
39
39
  module.exports = __toCommonJS(context_product_by_slug_exports);
40
40
 
@@ -3399,7 +3399,15 @@ function zl(t2) {
3399
3399
  }
3400
3400
  zl.displayName = `StandaloneProductContextProvider`;
3401
3401
  var Bl = q(`@wix/site-service-warmup-data`);
3402
- async function Vl(e2, t2, n2) {
3402
+ function Vl() {
3403
+ let e2 = (0, import_services_manager_react.useGetService)(), t2 = (0, import_services_manager_react.useService)(Zc), n2;
3404
+ try {
3405
+ n2 = e2(Qc);
3406
+ } catch {
3407
+ }
3408
+ return n2?.multilingualEnabled && n2.currentLocale?.languageCode || t2.language;
3409
+ }
3410
+ async function Hl(e2, t2, n2) {
3403
3411
  let r2 = typeof window > `u`;
3404
3412
  if (!r2 && e2) try {
3405
3413
  let n3 = await e2.get(t2);
@@ -3413,73 +3421,73 @@ async function Vl(e2, t2, n2) {
3413
3421
  }
3414
3422
  return i2;
3415
3423
  }
3416
- function Hl(e2, t2) {
3417
- let n2 = (0, import_services_manager_react.useGetService)(), [r2] = (0, import_react.useState)(() => {
3418
- let r3;
3424
+ function Ul(e2, t2) {
3425
+ let r2 = (0, import_services_manager_react.useGetService)(), i2 = Vl();
3426
+ return (0, import_react.useMemo)(() => {
3427
+ let n2;
3419
3428
  try {
3420
- r3 = n2(Bl);
3429
+ n2 = r2(Bl);
3421
3430
  } catch {
3422
- r3 = null;
3431
+ n2 = null;
3423
3432
  }
3424
- return Vl(r3, e2, t2);
3425
- });
3426
- return r2;
3433
+ return Hl(n2, `${e2}:${i2}`, t2);
3434
+ }, [i2]);
3427
3435
  }
3428
- async function Ul() {
3436
+ async function Wl() {
3429
3437
  return (await si().eq(`defaultLocation`, true).find()).items?.[0]?._id ?? void 0;
3430
3438
  }
3431
- async function Wl() {
3439
+ async function Gl() {
3432
3440
  try {
3433
3441
  return (await oa()).settings?.collectionStates?.some((e2) => e2.appId === `215238eb-22a5-4c36-9e7b-e7c08025e04e` && e2.collectingRequests) ?? false;
3434
3442
  } catch {
3435
3443
  return false;
3436
3444
  }
3437
3445
  }
3438
- function Gl(e2) {
3446
+ function Kl(e2) {
3439
3447
  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 }));
3440
3448
  }
3441
- async function Kl(e2, t2) {
3442
- return Gl((await kr().eq(`productId`, e2).eq(`locationId`, t2).find()).items ?? []);
3449
+ async function ql(e2, t2) {
3450
+ return Kl((await kr().eq(`productId`, e2).eq(`locationId`, t2).find()).items ?? []);
3443
3451
  }
3444
- async function ql(e2) {
3445
- let [t2, n2, r2] = await Promise.all([e2(), Ul(), Wl()]), { product: i2 } = t2;
3452
+ async function Jl(e2) {
3453
+ let [t2, n2, r2] = await Promise.all([e2(), Wl(), Gl()]), { product: i2 } = t2;
3446
3454
  if (!n2) throw Error(`Location not found`);
3447
- let [a2, o2] = await Promise.all([Kl(i2.id, n2), i2.productGroupId ? Dl(i2.productGroupId) : void 0]);
3455
+ let [a2, o2] = await Promise.all([ql(i2.id, n2), i2.productGroupId ? Dl(i2.productGroupId) : void 0]);
3448
3456
  return { ...t2, productGroup: o2, inventoryItems: a2, isBackInStockEnabled: r2 };
3449
3457
  }
3450
- function Jl(e2, t2) {
3451
- return Hl(`wixstores-storefront-builder:product-data:${e2}`, () => ql(t2));
3458
+ function Yl(e2, t2) {
3459
+ return Ul(`wixstores-storefront-builder:product-data:${e2}`, () => Jl(t2));
3452
3460
  }
3453
- var Yl = function(e2) {
3461
+ var Xl = function(e2) {
3454
3462
  return e2.PRODUCT_BY_SLUG = `product-by-slug`, e2.PRODUCT_BY_ID = `product-by-id`, e2.PRODUCT_ITEM = `product-item`, e2;
3455
3463
  }({});
3456
- function Xl() {
3464
+ function Zl() {
3457
3465
  let e2 = (0, import_services_manager_react.useService)(ja);
3458
- return Zl(new URL(e2.currentUrl));
3466
+ return Ql(new URL(e2.currentUrl));
3459
3467
  }
3460
- function Zl(e2) {
3468
+ function Ql(e2) {
3461
3469
  return e2.pathname.split(`/`).filter(Boolean).at(-1) || void 0;
3462
3470
  }
3463
- var Ql = q(`seo/seo-service`);
3464
- var $l = q(`@wix/site-service-rendering-context`);
3465
- function eu(e2) {
3466
- let t2 = (0, import_services_manager_react.useService)(Ql), { SSR: n2 } = (0, import_services_manager_react.useService)($l), i2 = (0, import_react.useRef)(false);
3471
+ var $l = q(`seo/seo-service`);
3472
+ var eu = q(`@wix/site-service-rendering-context`);
3473
+ function tu(e2) {
3474
+ let t2 = (0, import_services_manager_react.useService)($l), { SSR: n2 } = (0, import_services_manager_react.useService)(eu), i2 = (0, import_react.useRef)(false);
3467
3475
  !i2.current && e2.id && n2 && (i2.current = true, t2.setSeoEntity({ itemType: `STORES_PRODUCT`, seoData: e2.seoData ?? {}, itemData: { product: e2 } }).catch(() => {
3468
3476
  }));
3469
3477
  }
3470
- var tu = `No product slug is available for the product context`;
3471
- function nu() {
3478
+ var nu = `No product slug is available for the product context`;
3479
+ function ru() {
3472
3480
  return (0, import_product_context_provider.useProductContext)();
3473
3481
  }
3474
- function ru({ productPromise: e2 }) {
3482
+ function iu({ productPromise: e2 }) {
3475
3483
  let { seoProduct: t2 } = kn(e2);
3476
- return eu(t2), null;
3484
+ return tu(t2), null;
3477
3485
  }
3478
- function iu({ children: e2 }) {
3479
- let t2 = Xl(), n2 = Jl(`slug:${t2}`, () => t2 ? Gi(t2) : Promise.reject(Error(tu)));
3480
- return (0, import_jsx_runtime.jsxs)(zl, { productPromise: n2, source: Yl.PRODUCT_BY_SLUG, children: [(0, import_jsx_runtime.jsx)(ru, { productPromise: n2 }), e2] });
3486
+ function au({ children: e2 }) {
3487
+ let t2 = Zl(), n2 = Yl(`slug:${t2}`, () => t2 ? Gi(t2) : Promise.reject(Error(nu)));
3488
+ return (0, import_jsx_runtime.jsxs)(zl, { productPromise: n2, source: Xl.PRODUCT_BY_SLUG, children: [(0, import_jsx_runtime.jsx)(iu, { productPromise: n2 }), e2] });
3481
3489
  }
3482
- var au = On(`b276b552-68b9-4936-98d5-fbe43c0bd257`);
3490
+ var ou = On(`b276b552-68b9-4936-98d5-fbe43c0bd257`);
3483
3491
  // Annotate the CommonJS export names for ESM import in node:
3484
3492
  0 && (module.exports = {
3485
3493
  NO_PRODUCT_SLUG_ERROR,