@cimplify/sdk 0.38.4 → 0.38.5

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/dist/mock/cli.mjs CHANGED
@@ -4170,14 +4170,21 @@ function toCanonicalProductSummary(p) {
4170
4170
  updated_at: p.updated_at
4171
4171
  };
4172
4172
  }
4173
- function deriveRenderHint(p) {
4173
+ var FOOD_REGEX = /food|drink|cake|bread|pastry|dessert|coffee|tea|juice|spice|sweet|breakfast|baked/i;
4174
+ function deriveRenderHint(p, registry) {
4174
4175
  if (p.render_hint) return p.render_hint;
4175
4176
  if (p.product_type === "service") return "general";
4176
4177
  if (p.product_type === "digital") return "general";
4177
- const foodish = (p.tags ?? []).some(
4178
- (t) => /food|drink|cake|bread|pastry|dessert|coffee|tea|juice|spice/i.test(t)
4179
- );
4180
- return foodish ? "food" : "general";
4178
+ if ((p.tags ?? []).some((t) => FOOD_REGEX.test(t))) return "food";
4179
+ if (registry) {
4180
+ for (const cid of p.category_ids) {
4181
+ const cat = registry.categories.get(cid);
4182
+ if (cat && (FOOD_REGEX.test(cat.name) || FOOD_REGEX.test(cat.slug))) {
4183
+ return "food";
4184
+ }
4185
+ }
4186
+ }
4187
+ return "general";
4181
4188
  }
4182
4189
  function toApiProduct(p, ctx) {
4183
4190
  const { registry, priceInfo, groups, components, composite, bundle } = ctx;
@@ -4193,7 +4200,7 @@ function toApiProduct(p, ctx) {
4193
4200
  images: p.images,
4194
4201
  default_price: p.base_price,
4195
4202
  type: p.product_type,
4196
- render_hint: deriveRenderHint(p),
4203
+ render_hint: deriveRenderHint(p, registry),
4197
4204
  inventory_type: "none",
4198
4205
  variant_strategy: p.variant_ids.length > 0 ? "use_axes" : "fetch_all",
4199
4206
  is_active: p.is_available,
@@ -3538,14 +3538,21 @@ function toCanonicalProductSummary(p) {
3538
3538
  updated_at: p.updated_at
3539
3539
  };
3540
3540
  }
3541
- function deriveRenderHint(p) {
3541
+ var FOOD_REGEX = /food|drink|cake|bread|pastry|dessert|coffee|tea|juice|spice|sweet|breakfast|baked/i;
3542
+ function deriveRenderHint(p, registry) {
3542
3543
  if (p.render_hint) return p.render_hint;
3543
3544
  if (p.product_type === "service") return "general";
3544
3545
  if (p.product_type === "digital") return "general";
3545
- const foodish = (p.tags ?? []).some(
3546
- (t) => /food|drink|cake|bread|pastry|dessert|coffee|tea|juice|spice/i.test(t)
3547
- );
3548
- return foodish ? "food" : "general";
3546
+ if ((p.tags ?? []).some((t) => FOOD_REGEX.test(t))) return "food";
3547
+ if (registry) {
3548
+ for (const cid of p.category_ids) {
3549
+ const cat = registry.categories.get(cid);
3550
+ if (cat && (FOOD_REGEX.test(cat.name) || FOOD_REGEX.test(cat.slug))) {
3551
+ return "food";
3552
+ }
3553
+ }
3554
+ }
3555
+ return "general";
3549
3556
  }
3550
3557
  function toApiProduct(p, ctx) {
3551
3558
  const { registry, priceInfo, groups, components, composite, bundle } = ctx;
@@ -3561,7 +3568,7 @@ function toApiProduct(p, ctx) {
3561
3568
  images: p.images,
3562
3569
  default_price: p.base_price,
3563
3570
  type: p.product_type,
3564
- render_hint: deriveRenderHint(p),
3571
+ render_hint: deriveRenderHint(p, registry),
3565
3572
  inventory_type: "none",
3566
3573
  variant_strategy: p.variant_ids.length > 0 ? "use_axes" : "fetch_all",
3567
3574
  is_active: p.is_available,
@@ -3536,14 +3536,21 @@ function toCanonicalProductSummary(p) {
3536
3536
  updated_at: p.updated_at
3537
3537
  };
3538
3538
  }
3539
- function deriveRenderHint(p) {
3539
+ var FOOD_REGEX = /food|drink|cake|bread|pastry|dessert|coffee|tea|juice|spice|sweet|breakfast|baked/i;
3540
+ function deriveRenderHint(p, registry) {
3540
3541
  if (p.render_hint) return p.render_hint;
3541
3542
  if (p.product_type === "service") return "general";
3542
3543
  if (p.product_type === "digital") return "general";
3543
- const foodish = (p.tags ?? []).some(
3544
- (t) => /food|drink|cake|bread|pastry|dessert|coffee|tea|juice|spice/i.test(t)
3545
- );
3546
- return foodish ? "food" : "general";
3544
+ if ((p.tags ?? []).some((t) => FOOD_REGEX.test(t))) return "food";
3545
+ if (registry) {
3546
+ for (const cid of p.category_ids) {
3547
+ const cat = registry.categories.get(cid);
3548
+ if (cat && (FOOD_REGEX.test(cat.name) || FOOD_REGEX.test(cat.slug))) {
3549
+ return "food";
3550
+ }
3551
+ }
3552
+ }
3553
+ return "general";
3547
3554
  }
3548
3555
  function toApiProduct(p, ctx) {
3549
3556
  const { registry, priceInfo, groups, components, composite, bundle } = ctx;
@@ -3559,7 +3566,7 @@ function toApiProduct(p, ctx) {
3559
3566
  images: p.images,
3560
3567
  default_price: p.base_price,
3561
3568
  type: p.product_type,
3562
- render_hint: deriveRenderHint(p),
3569
+ render_hint: deriveRenderHint(p, registry),
3563
3570
  inventory_type: "none",
3564
3571
  variant_strategy: p.variant_ids.length > 0 ? "use_axes" : "fetch_all",
3565
3572
  is_active: p.is_available,
package/dist/mock/msw.js CHANGED
@@ -3536,14 +3536,21 @@ function toCanonicalProductSummary(p) {
3536
3536
  updated_at: p.updated_at
3537
3537
  };
3538
3538
  }
3539
- function deriveRenderHint(p) {
3539
+ var FOOD_REGEX = /food|drink|cake|bread|pastry|dessert|coffee|tea|juice|spice|sweet|breakfast|baked/i;
3540
+ function deriveRenderHint(p, registry) {
3540
3541
  if (p.render_hint) return p.render_hint;
3541
3542
  if (p.product_type === "service") return "general";
3542
3543
  if (p.product_type === "digital") return "general";
3543
- const foodish = (p.tags ?? []).some(
3544
- (t) => /food|drink|cake|bread|pastry|dessert|coffee|tea|juice|spice/i.test(t)
3545
- );
3546
- return foodish ? "food" : "general";
3544
+ if ((p.tags ?? []).some((t) => FOOD_REGEX.test(t))) return "food";
3545
+ if (registry) {
3546
+ for (const cid of p.category_ids) {
3547
+ const cat = registry.categories.get(cid);
3548
+ if (cat && (FOOD_REGEX.test(cat.name) || FOOD_REGEX.test(cat.slug))) {
3549
+ return "food";
3550
+ }
3551
+ }
3552
+ }
3553
+ return "general";
3547
3554
  }
3548
3555
  function toApiProduct(p, ctx) {
3549
3556
  const { registry, priceInfo, groups, components, composite, bundle } = ctx;
@@ -3559,7 +3566,7 @@ function toApiProduct(p, ctx) {
3559
3566
  images: p.images,
3560
3567
  default_price: p.base_price,
3561
3568
  type: p.product_type,
3562
- render_hint: deriveRenderHint(p),
3569
+ render_hint: deriveRenderHint(p, registry),
3563
3570
  inventory_type: "none",
3564
3571
  variant_strategy: p.variant_ids.length > 0 ? "use_axes" : "fetch_all",
3565
3572
  is_active: p.is_available,
package/dist/mock/msw.mjs CHANGED
@@ -3534,14 +3534,21 @@ function toCanonicalProductSummary(p) {
3534
3534
  updated_at: p.updated_at
3535
3535
  };
3536
3536
  }
3537
- function deriveRenderHint(p) {
3537
+ var FOOD_REGEX = /food|drink|cake|bread|pastry|dessert|coffee|tea|juice|spice|sweet|breakfast|baked/i;
3538
+ function deriveRenderHint(p, registry) {
3538
3539
  if (p.render_hint) return p.render_hint;
3539
3540
  if (p.product_type === "service") return "general";
3540
3541
  if (p.product_type === "digital") return "general";
3541
- const foodish = (p.tags ?? []).some(
3542
- (t) => /food|drink|cake|bread|pastry|dessert|coffee|tea|juice|spice/i.test(t)
3543
- );
3544
- return foodish ? "food" : "general";
3542
+ if ((p.tags ?? []).some((t) => FOOD_REGEX.test(t))) return "food";
3543
+ if (registry) {
3544
+ for (const cid of p.category_ids) {
3545
+ const cat = registry.categories.get(cid);
3546
+ if (cat && (FOOD_REGEX.test(cat.name) || FOOD_REGEX.test(cat.slug))) {
3547
+ return "food";
3548
+ }
3549
+ }
3550
+ }
3551
+ return "general";
3545
3552
  }
3546
3553
  function toApiProduct(p, ctx) {
3547
3554
  const { registry, priceInfo, groups, components, composite, bundle } = ctx;
@@ -3557,7 +3564,7 @@ function toApiProduct(p, ctx) {
3557
3564
  images: p.images,
3558
3565
  default_price: p.base_price,
3559
3566
  type: p.product_type,
3560
- render_hint: deriveRenderHint(p),
3567
+ render_hint: deriveRenderHint(p, registry),
3561
3568
  inventory_type: "none",
3562
3569
  variant_strategy: p.variant_ids.length > 0 ? "use_axes" : "fetch_all",
3563
3570
  is_active: p.is_available,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cimplify/sdk",
3
- "version": "0.38.4",
3
+ "version": "0.38.5",
4
4
  "description": "Cimplify Commerce SDK for storefronts",
5
5
  "keywords": [
6
6
  "cimplify",