@websolutespa/bom-core 1.7.11 → 1.7.13

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/index.mjs CHANGED
@@ -1,174 +1,77 @@
1
- // src/category/category.ts
2
- function isCategory(value) {
3
- return Boolean(value) && typeof value === "object";
4
- }
5
- function asCategoryId(value) {
6
- return isCategory(value) ? value.id : value;
7
- }
8
- var ROOT_CATEGORY = process.env.ROOT_CATEGORY || "";
9
- function getRootCategory(categories) {
10
- const rootCategory = ROOT_CATEGORY && categories.find((x) => x.id == ROOT_CATEGORY);
11
- if (rootCategory) {
12
- return rootCategory;
13
- } else {
14
- return categories.find((x) => x.category == null);
15
- }
1
+ // src/utils/typeGuards.ts
2
+ function isNumber(item) {
3
+ return typeof item === "number";
16
4
  }
17
- function getParentCategoriesById(id, categories) {
18
- const rootCategory = getRootCategory(categories);
19
- const routeCategories = [];
20
- const segments = [];
21
- let parentId = id || null;
22
- while (parentId != null) {
23
- const parentCategory = categories.find((c) => c.id === parentId);
24
- if (parentCategory) {
25
- if (parentCategory.slug || parentCategory.id === rootCategory?.id) {
26
- const segment = { ...parentCategory };
27
- segments.unshift(segment);
28
- }
29
- parentId = parentCategory.category ? asCategoryId(parentCategory.category) : null;
30
- if (parentId) {
31
- if (routeCategories.includes(parentId)) {
32
- console.log("ICategory.getParentCategoriesById", "circular reference found", parentId);
33
- parentId = null;
34
- } else {
35
- routeCategories.push(parentId);
36
- }
37
- }
38
- } else {
39
- parentId = null;
40
- }
41
- }
42
- return segments;
5
+ function isString(item) {
6
+ return typeof item === "string";
43
7
  }
44
- function getCategorySegments(item, categories) {
45
- const categoryId = asCategoryId(item.category);
46
- const segments = getParentCategoriesById(categoryId, categories);
47
- return segments;
8
+ function isValidString(item) {
9
+ return typeof item === "string" && item.length > 0;
48
10
  }
49
- function getCategorySegmentsByCategory(item, categories) {
50
- const categoryId = item.category ? asCategoryId(item.category) : null;
51
- const segments = categoryId ? getParentCategoriesById(categoryId, categories) : [];
52
- segments.push(item);
53
- return segments;
11
+ function isArray(item) {
12
+ return Array.isArray(item);
54
13
  }
55
-
56
- // src/classNames/classNames.ts
57
- function isClassNameCollection(value) {
58
- return typeof value === "object" && !Array.isArray(value);
14
+ function isObject(item) {
15
+ return item != null && typeof item === "object" && !isArray(item);
59
16
  }
60
- function classNameCollectionToString(className) {
61
- const keys = Object.keys(className);
62
- const total = keys.length;
63
- let classNames = "";
64
- for (let i = 0; i < total; i++) {
65
- const key = keys[i];
66
- const value = className[keys[i]];
67
- if (!value) {
68
- continue;
69
- }
70
- classNames = classNames ? `${classNames} ${String(key)}` : String(key);
71
- }
72
- return classNames;
17
+ function isPromise(result) {
18
+ return isObject(result) && typeof result.then === "function";
73
19
  }
74
- function getClassNames(...props) {
75
- const total = props.length;
76
- let classNames = "";
77
- if (total === 0) {
78
- return classNames;
79
- }
80
- for (let i = 0; i < total; i++) {
81
- const value = props[i];
82
- if (!value) {
83
- continue;
84
- }
85
- if (isClassNameCollection(value)) {
86
- classNames += ` ${classNameCollectionToString(value)}`;
87
- } else {
88
- classNames += ` ${String(value).trim()}`;
89
- }
90
- }
91
- return classNames.trim();
20
+ function isNotNullString(item) {
21
+ return typeof item === "string" && Boolean(item);
92
22
  }
93
-
94
- // src/collection/collection.ts
95
- import pluralize from "pluralize";
96
- function getCollectionDescription(text) {
97
- text = toValidCollectionName(text);
98
- const displayName = toDisplayName(text);
99
- const pluralName = toPluralName(text);
100
- const pluralDisplayName = toDisplayName(pluralName);
101
- const singularName = text;
102
- const title = toTitleCase(text);
103
- return {
104
- displayName,
105
- pluralName,
106
- pluralDisplayName,
107
- singularName,
108
- title
109
- };
23
+ function isEquatable(item) {
24
+ return typeof item === "number" || isNotNullString(item);
110
25
  }
111
- function camelToSnakeCase(text) {
112
- return text.replace(/[A-Z]/g, (letter, index) => {
113
- return index > 0 ? `_${letter.toLowerCase()}` : letter.toLowerCase();
114
- });
26
+ function isEntity(item) {
27
+ return isObject(item) && isEquatable(item.id);
115
28
  }
116
- function isValidCollectionDescription(description) {
117
- return description.singularName !== description.pluralName;
29
+ function isUnresolvedRelation(item) {
30
+ return isObject(item) && isNotNullString(item.relationTo) && (isEquatable(item.value) || isArray(item.value));
118
31
  }
119
- function isReservedCollectionDescription(description) {
120
- return [
121
- "category",
122
- "label",
123
- "locale",
124
- "market",
125
- "menu",
126
- "redirect",
127
- "route",
128
- "template"
129
- ].includes(description.singularName);
32
+ function isRelation(item) {
33
+ return isObject(item) && isNotNullString(item.relationTo) && isEntity(item.value);
130
34
  }
131
- function toDisplayName(text) {
132
- return toTitleCase(text).replace(/\s/g, "");
35
+ function isUndecoratedMenuItem(item) {
36
+ return isObject(item) && (item.type === "category" && isEquatable(item.category) || item.type === "page" && isEquatable(item.page.value));
133
37
  }
134
- function toPluralName(text) {
135
- const plural = pluralize.plural(text);
136
- return plural === text ? `${plural}es` : plural;
38
+ function isUndecoratedNav(item) {
39
+ return isObject(item) && isUndecoratedMenuPage(item.nav);
137
40
  }
138
- function toTitleCase(text) {
139
- return text.replace(/^[-_]*(.)/, (_, c) => c.toUpperCase()).replace(/[-_]+(.)/g, (_, c) => " " + c.toUpperCase());
41
+ function isUndecoratedMenuCategory(item) {
42
+ return isObject(item) && item.type === "category" && isNotNullString(item.category) && item.id === void 0 && item.href === void 0;
140
43
  }
141
- function toValidCollectionName(text) {
142
- text = text.trim().replace(/\W/g, "_").replace(/^[_]*(.)/, (_, c) => c);
143
- text = camelToSnakeCase(text);
144
- text = text.replace(/__/g, "_");
145
- return text.toLowerCase();
44
+ function isUndecoratedMenuPage(item) {
45
+ return isObject(item) && item.type === "page" && isObject(item.page) && isNotNullString(item.page.relationTo) && isEquatable(item.page.value);
146
46
  }
147
47
 
148
- // src/consoleWarn/consoleWarn.ts
149
- var warningStack = {};
150
- function consoleWarn(message, component) {
151
- if (typeof console === "undefined") {
152
- return;
153
- }
154
- const tag = component ? ` [${component}]` : " ";
155
- const log = `[DesignSystem]${tag}: ${message}`;
156
- if (warningStack[log]) {
157
- return;
48
+ // src/utils/asEquatable.ts
49
+ function asEquatable(value) {
50
+ const id = isEntity(value) ? value.id : value;
51
+ if (typeof id === "string") {
52
+ if (String(parseInt(id)) === id) {
53
+ return Number(id);
54
+ }
158
55
  }
159
- warningStack[log] = true;
160
- if (process.env.NODE_ENV !== "production") {
161
- return console.error(log);
56
+ return id;
57
+ }
58
+ function asEquatableString(value) {
59
+ const id = isEntity(value) ? value.id : value;
60
+ if (typeof id !== "undefined") {
61
+ return String(id);
162
62
  }
163
- console.warn(log);
63
+ return id;
164
64
  }
165
-
166
- // src/utils/asEquatable.ts
167
- function asEquatable(value) {
168
- if (String(parseInt(value)) === value) {
169
- return Number(value);
65
+ function asEquatableNumber(value) {
66
+ const id = isEntity(value) ? value.id : value;
67
+ if (typeof id === "string") {
68
+ if (String(parseInt(id)) === id) {
69
+ return Number(id);
70
+ } else {
71
+ return void 0;
72
+ }
170
73
  }
171
- return value;
74
+ return id;
172
75
  }
173
76
 
174
77
  // src/utils/asSortedOptions.ts
@@ -231,53 +134,6 @@ function toSnakeCase(unknownCase) {
231
134
  return snakeCase;
232
135
  }
233
136
 
234
- // src/utils/typeGuards.ts
235
- function isNumber(item) {
236
- return typeof item === "number";
237
- }
238
- function isString(item) {
239
- return typeof item === "string";
240
- }
241
- function isValidString(item) {
242
- return typeof item === "string" && item.length > 0;
243
- }
244
- function isArray(item) {
245
- return Array.isArray(item);
246
- }
247
- function isObject(item) {
248
- return item != null && typeof item === "object" && !isArray(item);
249
- }
250
- function isPromise(result) {
251
- return isObject(result) && typeof result.then === "function";
252
- }
253
- function isNotNullString(item) {
254
- return typeof item === "string" && Boolean(item);
255
- }
256
- function isEquatable(item) {
257
- return typeof item === "number" || isNotNullString(item);
258
- }
259
- function isEntity(item) {
260
- return isObject(item) && isEquatable(item.id);
261
- }
262
- function isUnresolvedRelation(item) {
263
- return isObject(item) && isNotNullString(item.relationTo) && (isEquatable(item.value) || isArray(item.value));
264
- }
265
- function isRelation(item) {
266
- return isObject(item) && isNotNullString(item.relationTo) && isEntity(item.value);
267
- }
268
- function isUndecoratedMenuItem(item) {
269
- return isObject(item) && (item.type === "category" && isEquatable(item.category) || item.type === "page" && isEquatable(item.page.value));
270
- }
271
- function isUndecoratedNav(item) {
272
- return isObject(item) && isUndecoratedMenuPage(item.nav);
273
- }
274
- function isUndecoratedMenuCategory(item) {
275
- return isObject(item) && item.type === "category" && isNotNullString(item.category) && item.id === void 0 && item.href === void 0;
276
- }
277
- function isUndecoratedMenuPage(item) {
278
- return isObject(item) && item.type === "page" && isObject(item.page) && isNotNullString(item.page.relationTo) && isEquatable(item.page.value);
279
- }
280
-
281
137
  // src/utils/cloneItem.ts
282
138
  function cloneItem(item) {
283
139
  if (isArray(item)) {
@@ -378,6 +234,14 @@ function enumToList(enumeration, separatorRegex = /_/g) {
378
234
  }));
379
235
  }
380
236
 
237
+ // src/utils/uuid.ts
238
+ function uuidv4() {
239
+ return "10000000-1000-4000-8000-100000000000".replace(
240
+ /[018]/g,
241
+ (c) => (+c ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> +c / 4).toString(16)
242
+ );
243
+ }
244
+
381
245
  // src/utils/index.ts
382
246
  function getIsDevelopment() {
383
247
  return process && (!process.env.NODE_ENV || process.env.NODE_ENV === "development");
@@ -431,6 +295,177 @@ function merge(target, source) {
431
295
  return target;
432
296
  }
433
297
 
298
+ // src/category/category.ts
299
+ var ROOT_CATEGORY = process.env.ROOT_CATEGORY || "";
300
+ function getRootCategory(categories) {
301
+ const rootCategory = ROOT_CATEGORY && categories.find((x) => x.id == ROOT_CATEGORY);
302
+ if (rootCategory) {
303
+ return rootCategory;
304
+ } else {
305
+ return categories.find((x) => x.category == null);
306
+ }
307
+ }
308
+ function getParentCategory(categories, item) {
309
+ const parentCategoryId = asCategoryId(item.category);
310
+ const parentCategory = parentCategoryId ? categories.find((x) => x.id === parentCategoryId) : void 0;
311
+ return parentCategory;
312
+ }
313
+ function getParentCategoriesById(categories, id) {
314
+ const routeCategories = [];
315
+ const segments = [];
316
+ let parentId = id;
317
+ while (parentId != null) {
318
+ const parentCategory = categories.find((c) => c.id === parentId);
319
+ if (parentCategory) {
320
+ const segment = { ...parentCategory };
321
+ segments.unshift(segment);
322
+ routeCategories.push(parentId);
323
+ parentId = asCategoryId(parentCategory.category);
324
+ if (parentId) {
325
+ if (routeCategories.includes(parentId)) {
326
+ console.log("ICategory.getParentCategoriesById", "circular reference found", parentId);
327
+ parentId = void 0;
328
+ }
329
+ }
330
+ } else {
331
+ parentId = void 0;
332
+ }
333
+ }
334
+ return segments;
335
+ }
336
+ function getCategorySegments(categories, item) {
337
+ const parentCategoryId = asCategoryId(item.category);
338
+ const segments = getParentCategoriesById(categories, parentCategoryId);
339
+ return segments;
340
+ }
341
+ function getCategorySegmentsByCategory(categories, item) {
342
+ const parentCategoryId = asCategoryId(item.category);
343
+ const segments = parentCategoryId ? getParentCategoriesById(categories, parentCategoryId) : [];
344
+ segments.push(item);
345
+ return segments;
346
+ }
347
+ function asCategoryId(value) {
348
+ return isEntity(value) ? String(value.id) : value ? String(value) : void 0;
349
+ }
350
+ function findCategoryInCategories(categories, item) {
351
+ const categoryId = asCategoryId(item);
352
+ return categoryId ? categories.find((x) => x.id === categoryId) : void 0;
353
+ }
354
+ function findChildCategories(categories, item) {
355
+ const categoryId = asCategoryId(item);
356
+ return categoryId ? categories.filter((x) => asCategoryId(x.category) === categoryId) : [];
357
+ }
358
+
359
+ // src/classNames/classNames.ts
360
+ function isClassNameCollection(value) {
361
+ return typeof value === "object" && !Array.isArray(value);
362
+ }
363
+ function classNameCollectionToString(className) {
364
+ const keys = Object.keys(className);
365
+ const total = keys.length;
366
+ let classNames = "";
367
+ for (let i = 0; i < total; i++) {
368
+ const key = keys[i];
369
+ const value = className[keys[i]];
370
+ if (!value) {
371
+ continue;
372
+ }
373
+ classNames = classNames ? `${classNames} ${String(key)}` : String(key);
374
+ }
375
+ return classNames;
376
+ }
377
+ function getClassNames(...props) {
378
+ const total = props.length;
379
+ let classNames = "";
380
+ if (total === 0) {
381
+ return classNames;
382
+ }
383
+ for (let i = 0; i < total; i++) {
384
+ const value = props[i];
385
+ if (!value) {
386
+ continue;
387
+ }
388
+ if (isClassNameCollection(value)) {
389
+ classNames += ` ${classNameCollectionToString(value)}`;
390
+ } else {
391
+ classNames += ` ${String(value).trim()}`;
392
+ }
393
+ }
394
+ return classNames.trim();
395
+ }
396
+
397
+ // src/collection/collection.ts
398
+ import pluralize from "pluralize";
399
+ function getCollectionDescription(text) {
400
+ text = toValidCollectionName(text);
401
+ const displayName = toDisplayName(text);
402
+ const pluralName = toPluralName(text);
403
+ const pluralDisplayName = toDisplayName(pluralName);
404
+ const singularName = text;
405
+ const title = toTitleCase(text);
406
+ return {
407
+ displayName,
408
+ pluralName,
409
+ pluralDisplayName,
410
+ singularName,
411
+ title
412
+ };
413
+ }
414
+ function camelToSnakeCase(text) {
415
+ return text.replace(/[A-Z]/g, (letter, index) => {
416
+ return index > 0 ? `_${letter.toLowerCase()}` : letter.toLowerCase();
417
+ });
418
+ }
419
+ function isValidCollectionDescription(description) {
420
+ return description.singularName !== description.pluralName;
421
+ }
422
+ function isReservedCollectionDescription(description) {
423
+ return [
424
+ "category",
425
+ "label",
426
+ "locale",
427
+ "market",
428
+ "menu",
429
+ "redirect",
430
+ "route",
431
+ "template"
432
+ ].includes(description.singularName);
433
+ }
434
+ function toDisplayName(text) {
435
+ return toTitleCase(text).replace(/\s/g, "");
436
+ }
437
+ function toPluralName(text) {
438
+ const plural = pluralize.plural(text);
439
+ return plural === text ? `${plural}es` : plural;
440
+ }
441
+ function toTitleCase(text) {
442
+ return text.replace(/^[-_]*(.)/, (_, c) => c.toUpperCase()).replace(/[-_]+(.)/g, (_, c) => " " + c.toUpperCase());
443
+ }
444
+ function toValidCollectionName(text) {
445
+ text = text.trim().replace(/\W/g, "_").replace(/^[_]*(.)/, (_, c) => c);
446
+ text = camelToSnakeCase(text);
447
+ text = text.replace(/__/g, "_");
448
+ return text.toLowerCase();
449
+ }
450
+
451
+ // src/consoleWarn/consoleWarn.ts
452
+ var warningStack = {};
453
+ function consoleWarn(message, component) {
454
+ if (typeof console === "undefined") {
455
+ return;
456
+ }
457
+ const tag = component ? ` [${component}]` : " ";
458
+ const log = `[DesignSystem]${tag}: ${message}`;
459
+ if (warningStack[log]) {
460
+ return;
461
+ }
462
+ warningStack[log] = true;
463
+ if (process.env.NODE_ENV !== "production") {
464
+ return console.error(log);
465
+ }
466
+ console.warn(log);
467
+ }
468
+
434
469
  // src/http/http.service.ts
435
470
  var defaultOptions = {
436
471
  // method: 'POST', // *GET, POST, PUT, DELETE, etc.
@@ -1079,58 +1114,74 @@ function getOrigin(headers) {
1079
1114
  }
1080
1115
 
1081
1116
  // src/route/route.ts
1117
+ var RouteStrategy = /* @__PURE__ */ ((RouteStrategy2) => {
1118
+ RouteStrategy2["Auto"] = "auto";
1119
+ RouteStrategy2["Default"] = "default";
1120
+ RouteStrategy2["Manual"] = "manual";
1121
+ return RouteStrategy2;
1122
+ })(RouteStrategy || {});
1123
+ var ROUTE_STRATEGY = process.env.ROUTE_STRATEGY || "auto" /* Auto */;
1124
+ function getPickedProps(item) {
1125
+ const pickedProps = Object.fromEntries(Object.entries(item).filter(([k, v]) => [
1126
+ "category",
1127
+ "isDefault",
1128
+ "media",
1129
+ "order",
1130
+ "template",
1131
+ "updatedAt",
1132
+ "useSplat"
1133
+ ].includes(k)));
1134
+ return pickedProps;
1135
+ }
1082
1136
  function collectRoutes(store, categories, markets, locales) {
1083
1137
  const routes = [];
1084
1138
  if (locales.length > 0 && markets.length > 0) {
1085
1139
  const rootCategory = getRootCategory(categories);
1086
1140
  eachCategorized(store, (item, key) => {
1087
- const segments = getCategorySegments(item, categories);
1088
- const slugs = segments.map((x) => ({ slug: x.slug }));
1089
- if (!item.isDefault) {
1090
- slugs.push({ slug: item.slug });
1091
- }
1092
- eachMarketLocale(markets, locales, (market, locale, markets2, locales2) => {
1093
- if (!item.markets || item.markets.includes(market.id)) {
1094
- const title = localize(item.title, locale.id);
1095
- const id = getRouteHref(slugs, market, locale, markets2, locales2);
1141
+ const segments = getCategorySegments(categories, item);
1142
+ const visibleSegments = segments.filter((x) => Boolean(x.isHidden) === false);
1143
+ const visibleCategory = visibleSegments.length > 0 ? visibleSegments[visibleSegments.length - 1] : rootCategory;
1144
+ if (visibleCategory) {
1145
+ const slugs = visibleSegments.map((x) => ({ slug: x.slug }));
1146
+ if (Boolean(item.isDefault) === false) {
1147
+ slugs.push({ slug: item.slug });
1148
+ }
1149
+ if (rootCategory && item.category === rootCategory.id) {
1150
+ const defaultLocale2 = locales.find((x) => x.isDefault) || locales[0];
1151
+ const defaultMarket2 = markets.find((x) => x.isDefault) || markets[0];
1152
+ const defaultMarketLocale = defaultMarket2 && defaultMarket2.defaultLanguage ? defaultMarket2.defaultLanguage : defaultLocale2.id;
1153
+ const title = localize(item.title, defaultMarketLocale);
1154
+ const pickedProps = getPickedProps(item);
1096
1155
  const route = {
1097
- category: item.category,
1098
- id,
1099
- isDefault: item.isDefault,
1100
- locale: locale.id,
1101
- market: market.id,
1102
- media: item.media,
1103
- order: item.order,
1156
+ ...pickedProps,
1157
+ resolvedCategory: rootCategory.id,
1158
+ id: "/",
1159
+ market: defaultMarket2.id,
1160
+ locale: defaultMarketLocale,
1104
1161
  page: item.id,
1105
1162
  schema: key,
1106
- template: item.template,
1107
- title,
1108
- updatedAt: item.updatedAt,
1109
- useSplat: item.useSplat
1163
+ title
1110
1164
  };
1111
1165
  routes.push(route);
1112
1166
  }
1113
- });
1114
- if (rootCategory && item.category === rootCategory.id) {
1115
- const defaultLocale2 = locales.find((x) => x.isDefault) || locales[0];
1116
- const defaultMarket2 = markets.find((x) => x.isDefault) || markets[0];
1117
- const defaultMarketLocale = defaultMarket2 && defaultMarket2.defaultLanguage ? defaultMarket2.defaultLanguage : defaultLocale2.id;
1118
- const title = localize(item.title, defaultMarketLocale);
1119
- const route = {
1120
- id: "/",
1121
- market: defaultMarket2.id,
1122
- locale: defaultMarketLocale,
1123
- category: item.category,
1124
- page: item.id,
1125
- schema: key,
1126
- template: item.template,
1127
- title,
1128
- isDefault: item.isDefault,
1129
- order: item.order,
1130
- useSplat: item.useSplat,
1131
- updatedAt: item.updatedAt
1132
- };
1133
- routes.push(route);
1167
+ eachMarketLocale(markets, locales, (market, locale, markets2, locales2) => {
1168
+ if (!item.markets || item.markets.includes(market.id)) {
1169
+ const title = localize(item.title, locale.id);
1170
+ const id = getRouteHref(slugs, market, locale, markets2, locales2);
1171
+ const pickedProps = getPickedProps(item);
1172
+ const route = {
1173
+ ...pickedProps,
1174
+ resolvedCategory: visibleCategory.id,
1175
+ id,
1176
+ locale: locale.id,
1177
+ market: market.id,
1178
+ page: item.id,
1179
+ schema: key,
1180
+ title
1181
+ };
1182
+ routes.push(route);
1183
+ }
1184
+ });
1134
1185
  }
1135
1186
  });
1136
1187
  }
@@ -1155,13 +1206,17 @@ function eachCategorized(store, callback) {
1155
1206
  }
1156
1207
  }
1157
1208
  }
1158
- var RouteStrategy = /* @__PURE__ */ ((RouteStrategy2) => {
1159
- RouteStrategy2["Auto"] = "auto";
1160
- RouteStrategy2["Default"] = "default";
1161
- RouteStrategy2["Manual"] = "manual";
1162
- return RouteStrategy2;
1163
- })(RouteStrategy || {});
1164
- var ROUTE_STRATEGY = process.env.ROUTE_STRATEGY || "auto" /* Auto */;
1209
+ function findRouteOfCategory(routes, categoryId, market, locale) {
1210
+ const findRoute = market && locale ? (route2) => route2.isDefault && route2.resolvedCategory === categoryId && route2.market === market && route2.locale === locale : (route2) => route2.isDefault && route2.resolvedCategory === categoryId;
1211
+ const route = routes.find(findRoute);
1212
+ return route;
1213
+ }
1214
+ function findRoutesOfCategory(routes, categoryId, isDefault = true) {
1215
+ const filteredRoutes = routes.filter(
1216
+ (route) => route.resolvedCategory === categoryId && Boolean(route.isDefault) === isDefault
1217
+ );
1218
+ return filteredRoutes;
1219
+ }
1165
1220
  function getRouteHref(segments, market, locale, markets, locales) {
1166
1221
  const href = segments.reduce((p, c, i) => {
1167
1222
  let slug = localize(c.slug || "", locale.id);
@@ -1199,11 +1254,6 @@ function getRouteHref(segments, market, locale, markets, locales) {
1199
1254
  return `${prefix}${href}`;
1200
1255
  }
1201
1256
 
1202
- // src/slug/slug.ts
1203
- function textToSlug(title) {
1204
- return title.toString().normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase().replace(/\s+/g, "-").replace(/&/g, "-and-").replace(/[^\w-]+/g, "").replace(/--+/g, "-").replace(/^-+/, "").replace(/-+$/, "");
1205
- }
1206
-
1207
1257
  // src/types/media.ts
1208
1258
  function resolveMediaType(media) {
1209
1259
  if (typeof media.type === "string" && media.type.length > 0) {
@@ -1279,6 +1329,8 @@ export {
1279
1329
  RouteStrategy,
1280
1330
  asCategoryId,
1281
1331
  asEquatable,
1332
+ asEquatableNumber,
1333
+ asEquatableString,
1282
1334
  asServerProps,
1283
1335
  asSortedOptions,
1284
1336
  awaitAll,
@@ -1294,6 +1346,10 @@ export {
1294
1346
  eachCategorized,
1295
1347
  eachMarketLocale,
1296
1348
  enumToList,
1349
+ findCategoryInCategories,
1350
+ findChildCategories,
1351
+ findRouteOfCategory,
1352
+ findRoutesOfCategory,
1297
1353
  getCategorySegments,
1298
1354
  getCategorySegmentsByCategory,
1299
1355
  getClassNames,
@@ -1304,6 +1360,7 @@ export {
1304
1360
  getIsProduction,
1305
1361
  getOrigin,
1306
1362
  getParentCategoriesById,
1363
+ getParentCategory,
1307
1364
  getProto,
1308
1365
  getRootCategory,
1309
1366
  getRouteHref,
@@ -1315,7 +1372,6 @@ export {
1315
1372
  httpPut,
1316
1373
  isArray,
1317
1374
  isBrowser,
1318
- isCategory,
1319
1375
  isDevelopment,
1320
1376
  isEntity,
1321
1377
  isEquatable,
@@ -1357,7 +1413,6 @@ export {
1357
1413
  qsSerialize,
1358
1414
  qsSerializeRaw,
1359
1415
  resolveMediaType,
1360
- textToSlug,
1361
1416
  toCamelCase,
1362
1417
  toCharCase,
1363
1418
  toDisplayName,
@@ -1369,5 +1424,6 @@ export {
1369
1424
  toTitleCase,
1370
1425
  toValidCollectionName,
1371
1426
  unknownCaseToPascalCase,
1427
+ uuidv4,
1372
1428
  withSchema
1373
1429
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@websolutespa/bom-core",
3
- "version": "1.7.11",
3
+ "version": "1.7.13",
4
4
  "description": "Core module of the BOM Repository",
5
5
  "keywords": [
6
6
  "bom",