@cimplify/sdk 0.38.4 → 0.39.0

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.
@@ -939,86 +939,4 @@ function createCimplifyClient(config = {}) {
939
939
  return new CimplifyClient(config);
940
940
  }
941
941
 
942
- // src/utils/variant.ts
943
- function stripProductPrefix(variantName, productName) {
944
- if (!variantName || !productName) return variantName || productName;
945
- const lower = variantName.toLowerCase().trim();
946
- if (lower === "default" || lower === "standard") return productName;
947
- if (lower.endsWith("-default") || lower.endsWith("-standard")) return productName;
948
- if (variantName.startsWith(productName)) {
949
- const rest = variantName.slice(productName.length);
950
- const match = rest.match(/^\s*[-–—]\s*(.*)/);
951
- if (match && match[1].length > 0) return match[1];
952
- }
953
- const lowerProduct = productName.toLowerCase().trim();
954
- if (lower.startsWith(lowerProduct)) {
955
- const rest = variantName.slice(productName.length);
956
- const match = rest.match(/^\s*[-–—]\s*(.*)/);
957
- if (match && match[1].length > 0) return match[1];
958
- }
959
- const lastDash = variantName.lastIndexOf("-");
960
- if (lastDash > 0 && lastDash < variantName.length - 1) {
961
- const prefix = variantName.slice(0, lastDash).trim();
962
- const suffix = variantName.slice(lastDash + 1).trim();
963
- if (suffix.length > 0 && prefix.length > suffix.length * 2) {
964
- return suffix;
965
- }
966
- }
967
- return variantName;
968
- }
969
- function getVariantDisplayName(variant, productName) {
970
- if (variant.display_attributes?.length) {
971
- return variant.display_attributes.map((a) => a.value_name).join(" / ");
972
- }
973
- if (variant.name) {
974
- return productName ? stripProductPrefix(variant.name, productName) : variant.name;
975
- }
976
- return productName || (variant.is_default ? "Default" : "Option");
977
- }
978
-
979
- // src/types/product.ts
980
- var PRODUCT_TYPE = {
981
- Product: "product",
982
- Service: "service",
983
- Digital: "digital",
984
- Bundle: "bundle",
985
- Composite: "composite"
986
- };
987
- var RENDER_HINT = {
988
- Food: "food",
989
- Physical: "physical",
990
- General: "general"
991
- };
992
- var DURATION_UNIT = {
993
- Minutes: "minutes",
994
- Hours: "hours",
995
- Days: "days",
996
- Nights: "nights",
997
- Weeks: "weeks",
998
- Months: "months",
999
- Years: "years"
1000
- };
1001
- var INPUT_FIELD_TYPE = {
1002
- Text: "text",
1003
- Textarea: "textarea",
1004
- Number: "number",
1005
- Select: "select",
1006
- Radio: "radio",
1007
- Checkbox: "checkbox",
1008
- Color: "color",
1009
- Date: "date",
1010
- File: "file",
1011
- Image: "image",
1012
- Url: "url",
1013
- Address: "address",
1014
- Phone: "phone",
1015
- Email: "email",
1016
- DateTime: "date_time",
1017
- Time: "time",
1018
- Signature: "signature",
1019
- MultiSelect: "multi_select",
1020
- DateRange: "date_range",
1021
- Location: "location"
1022
- };
1023
-
1024
- export { ActivityService, CimplifyClient, DURATION_UNIT, DeliveryService, INPUT_FIELD_TYPE, PRODUCT_TYPE, PlacesService, RENDER_HINT, SubscriptionService, SupportService, UploadService, createCimplifyClient, getVariantDisplayName };
942
+ export { ActivityService, CimplifyClient, DeliveryService, PlacesService, SubscriptionService, SupportService, UploadService, createCimplifyClient };
@@ -0,0 +1,89 @@
1
+ 'use strict';
2
+
3
+ // src/utils/variant.ts
4
+ function stripProductPrefix(variantName, productName) {
5
+ if (!variantName || !productName) return variantName || productName;
6
+ const lower = variantName.toLowerCase().trim();
7
+ if (lower === "default" || lower === "standard") return productName;
8
+ if (lower.endsWith("-default") || lower.endsWith("-standard")) return productName;
9
+ if (variantName.startsWith(productName)) {
10
+ const rest = variantName.slice(productName.length);
11
+ const match = rest.match(/^\s*[-–—]\s*(.*)/);
12
+ if (match && match[1].length > 0) return match[1];
13
+ }
14
+ const lowerProduct = productName.toLowerCase().trim();
15
+ if (lower.startsWith(lowerProduct)) {
16
+ const rest = variantName.slice(productName.length);
17
+ const match = rest.match(/^\s*[-–—]\s*(.*)/);
18
+ if (match && match[1].length > 0) return match[1];
19
+ }
20
+ const lastDash = variantName.lastIndexOf("-");
21
+ if (lastDash > 0 && lastDash < variantName.length - 1) {
22
+ const prefix = variantName.slice(0, lastDash).trim();
23
+ const suffix = variantName.slice(lastDash + 1).trim();
24
+ if (suffix.length > 0 && prefix.length > suffix.length * 2) {
25
+ return suffix;
26
+ }
27
+ }
28
+ return variantName;
29
+ }
30
+ function getVariantDisplayName(variant, productName) {
31
+ if (variant.display_attributes?.length) {
32
+ return variant.display_attributes.map((a) => a.value_name).join(" / ");
33
+ }
34
+ if (variant.name) {
35
+ return productName ? stripProductPrefix(variant.name, productName) : variant.name;
36
+ }
37
+ return productName || (variant.is_default ? "Default" : "Option");
38
+ }
39
+
40
+ // src/types/product.ts
41
+ var PRODUCT_TYPE = {
42
+ Product: "product",
43
+ Service: "service",
44
+ Digital: "digital",
45
+ Bundle: "bundle",
46
+ Composite: "composite"
47
+ };
48
+ var RENDER_HINT = {
49
+ Food: "food",
50
+ Physical: "physical",
51
+ General: "general"
52
+ };
53
+ var DURATION_UNIT = {
54
+ Minutes: "minutes",
55
+ Hours: "hours",
56
+ Days: "days",
57
+ Nights: "nights",
58
+ Weeks: "weeks",
59
+ Months: "months",
60
+ Years: "years"
61
+ };
62
+ var INPUT_FIELD_TYPE = {
63
+ Text: "text",
64
+ Textarea: "textarea",
65
+ Number: "number",
66
+ Select: "select",
67
+ Radio: "radio",
68
+ Checkbox: "checkbox",
69
+ Color: "color",
70
+ Date: "date",
71
+ File: "file",
72
+ Image: "image",
73
+ Url: "url",
74
+ Address: "address",
75
+ Phone: "phone",
76
+ Email: "email",
77
+ DateTime: "date_time",
78
+ Time: "time",
79
+ Signature: "signature",
80
+ MultiSelect: "multi_select",
81
+ DateRange: "date_range",
82
+ Location: "location"
83
+ };
84
+
85
+ exports.DURATION_UNIT = DURATION_UNIT;
86
+ exports.INPUT_FIELD_TYPE = INPUT_FIELD_TYPE;
87
+ exports.PRODUCT_TYPE = PRODUCT_TYPE;
88
+ exports.RENDER_HINT = RENDER_HINT;
89
+ exports.getVariantDisplayName = getVariantDisplayName;
@@ -0,0 +1,83 @@
1
+ // src/utils/variant.ts
2
+ function stripProductPrefix(variantName, productName) {
3
+ if (!variantName || !productName) return variantName || productName;
4
+ const lower = variantName.toLowerCase().trim();
5
+ if (lower === "default" || lower === "standard") return productName;
6
+ if (lower.endsWith("-default") || lower.endsWith("-standard")) return productName;
7
+ if (variantName.startsWith(productName)) {
8
+ const rest = variantName.slice(productName.length);
9
+ const match = rest.match(/^\s*[-–—]\s*(.*)/);
10
+ if (match && match[1].length > 0) return match[1];
11
+ }
12
+ const lowerProduct = productName.toLowerCase().trim();
13
+ if (lower.startsWith(lowerProduct)) {
14
+ const rest = variantName.slice(productName.length);
15
+ const match = rest.match(/^\s*[-–—]\s*(.*)/);
16
+ if (match && match[1].length > 0) return match[1];
17
+ }
18
+ const lastDash = variantName.lastIndexOf("-");
19
+ if (lastDash > 0 && lastDash < variantName.length - 1) {
20
+ const prefix = variantName.slice(0, lastDash).trim();
21
+ const suffix = variantName.slice(lastDash + 1).trim();
22
+ if (suffix.length > 0 && prefix.length > suffix.length * 2) {
23
+ return suffix;
24
+ }
25
+ }
26
+ return variantName;
27
+ }
28
+ function getVariantDisplayName(variant, productName) {
29
+ if (variant.display_attributes?.length) {
30
+ return variant.display_attributes.map((a) => a.value_name).join(" / ");
31
+ }
32
+ if (variant.name) {
33
+ return productName ? stripProductPrefix(variant.name, productName) : variant.name;
34
+ }
35
+ return productName || (variant.is_default ? "Default" : "Option");
36
+ }
37
+
38
+ // src/types/product.ts
39
+ var PRODUCT_TYPE = {
40
+ Product: "product",
41
+ Service: "service",
42
+ Digital: "digital",
43
+ Bundle: "bundle",
44
+ Composite: "composite"
45
+ };
46
+ var RENDER_HINT = {
47
+ Food: "food",
48
+ Physical: "physical",
49
+ General: "general"
50
+ };
51
+ var DURATION_UNIT = {
52
+ Minutes: "minutes",
53
+ Hours: "hours",
54
+ Days: "days",
55
+ Nights: "nights",
56
+ Weeks: "weeks",
57
+ Months: "months",
58
+ Years: "years"
59
+ };
60
+ var INPUT_FIELD_TYPE = {
61
+ Text: "text",
62
+ Textarea: "textarea",
63
+ Number: "number",
64
+ Select: "select",
65
+ Radio: "radio",
66
+ Checkbox: "checkbox",
67
+ Color: "color",
68
+ Date: "date",
69
+ File: "file",
70
+ Image: "image",
71
+ Url: "url",
72
+ Address: "address",
73
+ Phone: "phone",
74
+ Email: "email",
75
+ DateTime: "date_time",
76
+ Time: "time",
77
+ Signature: "signature",
78
+ MultiSelect: "multi_select",
79
+ DateRange: "date_range",
80
+ Location: "location"
81
+ };
82
+
83
+ export { DURATION_UNIT, INPUT_FIELD_TYPE, PRODUCT_TYPE, RENDER_HINT, getVariantDisplayName };
@@ -941,98 +941,11 @@ function createCimplifyClient(config = {}) {
941
941
  return new CimplifyClient(config);
942
942
  }
943
943
 
944
- // src/utils/variant.ts
945
- function stripProductPrefix(variantName, productName) {
946
- if (!variantName || !productName) return variantName || productName;
947
- const lower = variantName.toLowerCase().trim();
948
- if (lower === "default" || lower === "standard") return productName;
949
- if (lower.endsWith("-default") || lower.endsWith("-standard")) return productName;
950
- if (variantName.startsWith(productName)) {
951
- const rest = variantName.slice(productName.length);
952
- const match = rest.match(/^\s*[-–—]\s*(.*)/);
953
- if (match && match[1].length > 0) return match[1];
954
- }
955
- const lowerProduct = productName.toLowerCase().trim();
956
- if (lower.startsWith(lowerProduct)) {
957
- const rest = variantName.slice(productName.length);
958
- const match = rest.match(/^\s*[-–—]\s*(.*)/);
959
- if (match && match[1].length > 0) return match[1];
960
- }
961
- const lastDash = variantName.lastIndexOf("-");
962
- if (lastDash > 0 && lastDash < variantName.length - 1) {
963
- const prefix = variantName.slice(0, lastDash).trim();
964
- const suffix = variantName.slice(lastDash + 1).trim();
965
- if (suffix.length > 0 && prefix.length > suffix.length * 2) {
966
- return suffix;
967
- }
968
- }
969
- return variantName;
970
- }
971
- function getVariantDisplayName(variant, productName) {
972
- if (variant.display_attributes?.length) {
973
- return variant.display_attributes.map((a) => a.value_name).join(" / ");
974
- }
975
- if (variant.name) {
976
- return productName ? stripProductPrefix(variant.name, productName) : variant.name;
977
- }
978
- return productName || (variant.is_default ? "Default" : "Option");
979
- }
980
-
981
- // src/types/product.ts
982
- var PRODUCT_TYPE = {
983
- Product: "product",
984
- Service: "service",
985
- Digital: "digital",
986
- Bundle: "bundle",
987
- Composite: "composite"
988
- };
989
- var RENDER_HINT = {
990
- Food: "food",
991
- Physical: "physical",
992
- General: "general"
993
- };
994
- var DURATION_UNIT = {
995
- Minutes: "minutes",
996
- Hours: "hours",
997
- Days: "days",
998
- Nights: "nights",
999
- Weeks: "weeks",
1000
- Months: "months",
1001
- Years: "years"
1002
- };
1003
- var INPUT_FIELD_TYPE = {
1004
- Text: "text",
1005
- Textarea: "textarea",
1006
- Number: "number",
1007
- Select: "select",
1008
- Radio: "radio",
1009
- Checkbox: "checkbox",
1010
- Color: "color",
1011
- Date: "date",
1012
- File: "file",
1013
- Image: "image",
1014
- Url: "url",
1015
- Address: "address",
1016
- Phone: "phone",
1017
- Email: "email",
1018
- DateTime: "date_time",
1019
- Time: "time",
1020
- Signature: "signature",
1021
- MultiSelect: "multi_select",
1022
- DateRange: "date_range",
1023
- Location: "location"
1024
- };
1025
-
1026
944
  exports.ActivityService = ActivityService;
1027
945
  exports.CimplifyClient = CimplifyClient;
1028
- exports.DURATION_UNIT = DURATION_UNIT;
1029
946
  exports.DeliveryService = DeliveryService;
1030
- exports.INPUT_FIELD_TYPE = INPUT_FIELD_TYPE;
1031
- exports.PRODUCT_TYPE = PRODUCT_TYPE;
1032
947
  exports.PlacesService = PlacesService;
1033
- exports.RENDER_HINT = RENDER_HINT;
1034
948
  exports.SubscriptionService = SubscriptionService;
1035
949
  exports.SupportService = SupportService;
1036
950
  exports.UploadService = UploadService;
1037
951
  exports.createCimplifyClient = createCimplifyClient;
1038
- exports.getVariantDisplayName = getVariantDisplayName;
package/dist/index.js CHANGED
@@ -1,75 +1,76 @@
1
1
  'use strict';
2
2
 
3
- var chunk5VHKZTFJ_js = require('./chunk-5VHKZTFJ.js');
3
+ var chunkBGCEKFLA_js = require('./chunk-BGCEKFLA.js');
4
4
  var chunkL5GKVQVJ_js = require('./chunk-L5GKVQVJ.js');
5
+ var chunkOMAP327U_js = require('./chunk-OMAP327U.js');
5
6
  var chunkBAWKQRIB_js = require('./chunk-BAWKQRIB.js');
6
7
  var chunkV2O5AO7I_js = require('./chunk-V2O5AO7I.js');
7
8
 
8
9
 
9
10
 
10
- Object.defineProperty(exports, "ActivityService", {
11
+ Object.defineProperty(exports, "DURATION_UNIT", {
11
12
  enumerable: true,
12
- get: function () { return chunk5VHKZTFJ_js.ActivityService; }
13
+ get: function () { return chunkBGCEKFLA_js.DURATION_UNIT; }
13
14
  });
14
- Object.defineProperty(exports, "CimplifyClient", {
15
+ Object.defineProperty(exports, "INPUT_FIELD_TYPE", {
15
16
  enumerable: true,
16
- get: function () { return chunk5VHKZTFJ_js.CimplifyClient; }
17
+ get: function () { return chunkBGCEKFLA_js.INPUT_FIELD_TYPE; }
17
18
  });
18
- Object.defineProperty(exports, "DURATION_UNIT", {
19
+ Object.defineProperty(exports, "PRODUCT_TYPE", {
19
20
  enumerable: true,
20
- get: function () { return chunk5VHKZTFJ_js.DURATION_UNIT; }
21
+ get: function () { return chunkBGCEKFLA_js.PRODUCT_TYPE; }
21
22
  });
22
- Object.defineProperty(exports, "DeliveryService", {
23
+ Object.defineProperty(exports, "RENDER_HINT", {
23
24
  enumerable: true,
24
- get: function () { return chunk5VHKZTFJ_js.DeliveryService; }
25
+ get: function () { return chunkBGCEKFLA_js.RENDER_HINT; }
25
26
  });
26
- Object.defineProperty(exports, "INPUT_FIELD_TYPE", {
27
+ Object.defineProperty(exports, "getVariantDisplayName", {
27
28
  enumerable: true,
28
- get: function () { return chunk5VHKZTFJ_js.INPUT_FIELD_TYPE; }
29
+ get: function () { return chunkBGCEKFLA_js.getVariantDisplayName; }
29
30
  });
30
- Object.defineProperty(exports, "PRODUCT_TYPE", {
31
+ Object.defineProperty(exports, "isValidPhoneForContext", {
31
32
  enumerable: true,
32
- get: function () { return chunk5VHKZTFJ_js.PRODUCT_TYPE; }
33
+ get: function () { return chunkL5GKVQVJ_js.isValidPhoneForContext; }
33
34
  });
34
- Object.defineProperty(exports, "PlacesService", {
35
+ Object.defineProperty(exports, "normalizePhoneToE164", {
35
36
  enumerable: true,
36
- get: function () { return chunk5VHKZTFJ_js.PlacesService; }
37
+ get: function () { return chunkL5GKVQVJ_js.normalizePhoneToE164; }
37
38
  });
38
- Object.defineProperty(exports, "RENDER_HINT", {
39
+ Object.defineProperty(exports, "resolvePhoneCountryCode", {
39
40
  enumerable: true,
40
- get: function () { return chunk5VHKZTFJ_js.RENDER_HINT; }
41
+ get: function () { return chunkL5GKVQVJ_js.resolvePhoneCountryCode; }
41
42
  });
42
- Object.defineProperty(exports, "SubscriptionService", {
43
+ Object.defineProperty(exports, "ActivityService", {
43
44
  enumerable: true,
44
- get: function () { return chunk5VHKZTFJ_js.SubscriptionService; }
45
+ get: function () { return chunkOMAP327U_js.ActivityService; }
45
46
  });
46
- Object.defineProperty(exports, "SupportService", {
47
+ Object.defineProperty(exports, "CimplifyClient", {
47
48
  enumerable: true,
48
- get: function () { return chunk5VHKZTFJ_js.SupportService; }
49
+ get: function () { return chunkOMAP327U_js.CimplifyClient; }
49
50
  });
50
- Object.defineProperty(exports, "UploadService", {
51
+ Object.defineProperty(exports, "DeliveryService", {
51
52
  enumerable: true,
52
- get: function () { return chunk5VHKZTFJ_js.UploadService; }
53
+ get: function () { return chunkOMAP327U_js.DeliveryService; }
53
54
  });
54
- Object.defineProperty(exports, "createCimplifyClient", {
55
+ Object.defineProperty(exports, "PlacesService", {
55
56
  enumerable: true,
56
- get: function () { return chunk5VHKZTFJ_js.createCimplifyClient; }
57
+ get: function () { return chunkOMAP327U_js.PlacesService; }
57
58
  });
58
- Object.defineProperty(exports, "getVariantDisplayName", {
59
+ Object.defineProperty(exports, "SubscriptionService", {
59
60
  enumerable: true,
60
- get: function () { return chunk5VHKZTFJ_js.getVariantDisplayName; }
61
+ get: function () { return chunkOMAP327U_js.SubscriptionService; }
61
62
  });
62
- Object.defineProperty(exports, "isValidPhoneForContext", {
63
+ Object.defineProperty(exports, "SupportService", {
63
64
  enumerable: true,
64
- get: function () { return chunkL5GKVQVJ_js.isValidPhoneForContext; }
65
+ get: function () { return chunkOMAP327U_js.SupportService; }
65
66
  });
66
- Object.defineProperty(exports, "normalizePhoneToE164", {
67
+ Object.defineProperty(exports, "UploadService", {
67
68
  enumerable: true,
68
- get: function () { return chunkL5GKVQVJ_js.normalizePhoneToE164; }
69
+ get: function () { return chunkOMAP327U_js.UploadService; }
69
70
  });
70
- Object.defineProperty(exports, "resolvePhoneCountryCode", {
71
+ Object.defineProperty(exports, "createCimplifyClient", {
71
72
  enumerable: true,
72
- get: function () { return chunkL5GKVQVJ_js.resolvePhoneCountryCode; }
73
+ get: function () { return chunkOMAP327U_js.createCimplifyClient; }
73
74
  });
74
75
  Object.defineProperty(exports, "AUTHORIZATION_TYPE", {
75
76
  enumerable: true,
package/dist/index.mjs CHANGED
@@ -1,4 +1,5 @@
1
- export { ActivityService, CimplifyClient, DURATION_UNIT, DeliveryService, INPUT_FIELD_TYPE, PRODUCT_TYPE, PlacesService, RENDER_HINT, SubscriptionService, SupportService, UploadService, createCimplifyClient, getVariantDisplayName } from './chunk-JTU5P6GM.mjs';
1
+ export { DURATION_UNIT, INPUT_FIELD_TYPE, PRODUCT_TYPE, RENDER_HINT, getVariantDisplayName } from './chunk-IRJFDKFV.mjs';
2
2
  export { isValidPhoneForContext, normalizePhoneToE164, resolvePhoneCountryCode } from './chunk-YOIVZ6OA.mjs';
3
+ export { ActivityService, CimplifyClient, DeliveryService, PlacesService, SubscriptionService, SupportService, UploadService, createCimplifyClient } from './chunk-3WD6U5RD.mjs';
3
4
  export { AUTHORIZATION_TYPE, AUTH_MUTATION, AuthService, BusinessService, CHECKOUT_MODE, CHECKOUT_MUTATION, CHECKOUT_STEP, CONTACT_TYPE, CartOperations, CatalogueQueries, CheckoutService as CheckoutOperations, CheckoutService, CimplifyElement, CimplifyElements, DEFAULT_COUNTRY, DEFAULT_CURRENCY, DEVICE_TYPE, ELEMENT_TYPES, EVENT_TYPES, FxService, InventoryService, LINK_MUTATION, LINK_QUERY, LinkService, LiteService, MESSAGE_TYPES, MOBILE_MONEY_PROVIDER, ORDER_MUTATION, ORDER_TYPE, OrderQueries, PAYMENT_METHOD, PAYMENT_MUTATION, PAYMENT_STATE, PICKUP_TIME_TYPE, SchedulingService, combine, combineObject, createElements, err, flatMap, fromPromise, generateIdempotencyKey, getOrElse, isErr, isOk, mapError, mapResult, ok, toNullable, tryCatch, unwrap } from './chunk-EZK2FXTM.mjs';
4
5
  export { CURRENCY_SYMBOLS, CimplifyError, ERROR_HINTS, ErrorCode, IdempotencyMismatchError, MOBILE_MONEY_PROVIDERS, ZERO, categorizePaymentError, currencyCode, detectMobileMoneyProvider, enrichError, formatMoney, formatNumberCompact, formatPrice, formatPriceAdjustment, formatPriceCompact, formatPriceRange, formatPriceWithTax, formatProductPrice, getBasePrice, getCurrencySymbol, getDiscountPercentage, getDisplayPrice, getErrorHint, getMarkupPercentage, getPriceRange, getProductCurrency, getTaxAmount, getUnitPriceAtQuantity, hasTaxInfo, isCimplifyError, isIdempotencyMismatchError, isOnSale, isPaymentStatusFailure, isPaymentStatusRequiresAction, isPaymentStatusSuccess, isRetryableError, isSupportedCurrency, isTaxInclusive, money, moneyFromNumber, normalizePaymentResponse, normalizeStatusResponse, parsePrice } from './chunk-6TVQQYQ5.mjs';
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,