@websolutespa/bom-mixer-models 3.0.4 → 3.1.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.
package/dist/index.js CHANGED
@@ -1,12 +1,10 @@
1
- import { getPublicUrl, resolveHref } from "./page-BLbZbnWg.js";
2
- import { categoryToRouteLink, newRouteLink, resolveRoute, routeToRouteLink } from "./route-k0W3AKyo.js";
1
+ import { n as resolveHref, t as getPublicUrl } from "./page-DUrzmLyV.js";
2
+ import { i as routeToRouteLink, n as newRouteLink, r as resolveRoute, t as categoryToRouteLink } from "./route-BV0T142s.js";
3
3
  import { isBrowser } from "@websolutespa/bom-core";
4
-
5
4
  //#region src/gtm/gtm.service.ts
6
5
  function pushDataLayer(record) {
7
6
  if (isBrowser) window.dataLayer?.push(record);
8
7
  }
9
-
10
8
  //#endregion
11
9
  //#region src/link/link.service.ts
12
10
  function getLink_(category, routeLink) {
@@ -16,18 +14,15 @@ function getLink_(category, routeLink) {
16
14
  return getLink_(category, c) || p;
17
15
  }, void 0);
18
16
  }
19
- return void 0;
20
17
  }
21
18
  function getLink(category, layout) {
22
19
  return getLink_(category, layout.tree);
23
20
  }
24
-
25
21
  //#endregion
26
22
  //#region src/locale/locale.ts
27
23
  function getLocaleFromProps(props) {
28
24
  return props?.__NEXT_DATA__?.query?.locale;
29
25
  }
30
-
31
26
  //#endregion
32
27
  //#region src/seo/seo.service.ts
33
28
  const getSeoWeight = (index = 0, seoWeight) => {
@@ -37,7 +32,6 @@ const getSeoWeight = (index = 0, seoWeight) => {
37
32
  };
38
33
  return getter;
39
34
  };
40
-
41
35
  //#endregion
42
36
  //#region src/utmz/utmz.service.ts
43
37
  function getUtmz(request) {
@@ -49,7 +43,7 @@ function getUtmz(request) {
49
43
  }
50
44
  return utmz;
51
45
  }
52
-
53
46
  //#endregion
54
47
  export { categoryToRouteLink, getLink, getLocaleFromProps, getPublicUrl, getSeoWeight, getUtmz, newRouteLink, pushDataLayer, resolveHref, resolveRoute, routeToRouteLink };
48
+
55
49
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["record: Record<string, any>","category: string","routeLink: IRouteLink | undefined","p: string | undefined","layout: ILayout","props?: {\r\n __NEXT_DATA__?: {\r\n query?: {\r\n locale?: string;\r\n }\r\n }\r\n}","index: number","seoWeight?: SeoWeight","subIndex: number","request: NextApiRequest"],"sources":["../src/gtm/gtm.service.ts","../src/link/link.service.ts","../src/locale/locale.ts","../src/seo/seo.service.ts","../src/utmz/utmz.service.ts"],"sourcesContent":["import { isBrowser } from '@websolutespa/bom-core';\r\n\r\ndeclare global {\r\n interface Window {\r\n dataLayer?: Record<string, any>[];\r\n }\r\n}\r\n\r\nexport function pushDataLayer(record: Record<string, any>) {\r\n if (isBrowser) {\r\n window.dataLayer?.push(record);\r\n }\r\n}\r\n","import { ILayout, IRouteLink } from '@websolutespa/bom-core';\r\n\r\nfunction getLink_(category: string, routeLink: IRouteLink | undefined): string | undefined {\r\n if (routeLink) {\r\n if (routeLink.category === category) {\r\n return routeLink.href;\r\n }\r\n if (routeLink.items) {\r\n return routeLink.items.reduce((p: string | undefined, c) => {\r\n return getLink_(category, c) || p;\r\n }, undefined);\r\n }\r\n }\r\n return undefined;\r\n}\r\n\r\nexport function getLink(category: string, layout: ILayout) {\r\n return getLink_(category, layout.tree);\r\n}\r\n","export function getLocaleFromProps(props?: {\r\n __NEXT_DATA__?: {\r\n query?: {\r\n locale?: string;\r\n }\r\n }\r\n}): string | undefined {\r\n return props?.__NEXT_DATA__?.query?.locale as string;\r\n}\r\n","\r\nexport type SeoWeight = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';\r\n\r\nexport const getSeoWeight = (index: number = 0, seoWeight?: SeoWeight) => {\r\n const getter = (subIndex: number = 0) => {\r\n const i = seoWeight ?\r\n parseInt(seoWeight.replace(/\\D/g, '')) :\r\n (index === 0 ? 1 : 2);\r\n return `h${Math.min(i + subIndex, 6)}` as SeoWeight;\r\n };\r\n return getter;\r\n};\r\n","import { NextApiRequest } from 'next';\r\n\r\nexport function getUtmz(request: NextApiRequest): string {\r\n let utmz = 'N/A';\r\n if (typeof request.cookies.__utmz === 'string') {\r\n utmz = request.cookies.__utmz;\r\n const i = utmz.indexOf('utmcsr');\r\n utmz = utmz.substring(i === -1 ? 0 : i);\r\n }\r\n return utmz;\r\n}\r\n"],"mappings":";;;;;AAQA,SAAgB,cAAcA,QAA6B;AACzD,KAAI,WACF,OAAO,WAAW,KAAK,OAAO;AAEjC;;;;ACVD,SAAS,SAASC,UAAkBC,WAAuD;AACzF,KAAI,WAAW;AACb,MAAI,UAAU,aAAa,SACzB,QAAO,UAAU;AAEnB,MAAI,UAAU,MACZ,QAAO,UAAU,MAAM,OAAO,CAACC,GAAuB,MAAM;AAC1D,UAAO,SAAS,UAAU,EAAE,IAAI;EACjC,GAAE,OAAU;CAEhB;AACD,QAAO;AACR;AAED,SAAgB,QAAQF,UAAkBG,QAAiB;AACzD,QAAO,SAAS,UAAU,OAAO,KAAK;AACvC;;;;AClBD,SAAgB,mBAAmBC,OAMZ;AACrB,QAAO,OAAO,eAAe,OAAO;AACrC;;;;ACLD,MAAa,eAAe,CAACC,QAAgB,GAAGC,cAA0B;CACxE,MAAM,SAAS,CAACC,WAAmB,MAAM;EACvC,MAAM,IAAI,YACR,SAAS,UAAU,QAAQ,OAAO,GAAG,CAAC,GACrC,UAAU,IAAI,IAAI;AACrB,SAAO,CAAC,CAAC,EAAE,KAAK,IAAI,IAAI,UAAU,EAAE,EAAE;CACvC;AACD,QAAO;AACR;;;;ACTD,SAAgB,QAAQC,SAAiC;CACvD,IAAI,OAAO;AACX,KAAI,OAAO,QAAQ,QAAQ,WAAW,UAAU;EAC9C,OAAO,QAAQ,QAAQ;EACvB,MAAM,IAAI,KAAK,QAAQ,SAAS;EAChC,OAAO,KAAK,UAAU,MAAM,KAAK,IAAI,EAAE;CACxC;AACD,QAAO;AACR"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../src/gtm/gtm.service.ts","../src/link/link.service.ts","../src/locale/locale.ts","../src/seo/seo.service.ts","../src/utmz/utmz.service.ts"],"sourcesContent":["import { isBrowser } from '@websolutespa/bom-core';\r\n\r\ndeclare global {\r\n interface Window {\r\n dataLayer?: Record<string, any>[];\r\n }\r\n}\r\n\r\nexport function pushDataLayer(record: Record<string, any>) {\r\n if (isBrowser) {\r\n window.dataLayer?.push(record);\r\n }\r\n}\r\n","import { ILayout, IRouteLink } from '@websolutespa/bom-core';\r\n\r\nfunction getLink_(category: string, routeLink: IRouteLink | undefined): string | undefined {\r\n if (routeLink) {\r\n if (routeLink.category === category) {\r\n return routeLink.href;\r\n }\r\n if (routeLink.items) {\r\n return routeLink.items.reduce((p: string | undefined, c) => {\r\n return getLink_(category, c) || p;\r\n }, undefined);\r\n }\r\n }\r\n return undefined;\r\n}\r\n\r\nexport function getLink(category: string, layout: ILayout) {\r\n return getLink_(category, layout.tree);\r\n}\r\n","export function getLocaleFromProps(props?: {\r\n __NEXT_DATA__?: {\r\n query?: {\r\n locale?: string;\r\n }\r\n }\r\n}): string | undefined {\r\n return props?.__NEXT_DATA__?.query?.locale as string;\r\n}\r\n","\r\nexport type SeoWeight = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';\r\n\r\nexport const getSeoWeight = (index: number = 0, seoWeight?: SeoWeight) => {\r\n const getter = (subIndex: number = 0) => {\r\n const i = seoWeight ?\r\n parseInt(seoWeight.replace(/\\D/g, '')) :\r\n (index === 0 ? 1 : 2);\r\n return `h${Math.min(i + subIndex, 6)}` as SeoWeight;\r\n };\r\n return getter;\r\n};\r\n","import { NextApiRequest } from 'next';\r\n\r\nexport function getUtmz(request: NextApiRequest): string {\r\n let utmz = 'N/A';\r\n if (typeof request.cookies.__utmz === 'string') {\r\n utmz = request.cookies.__utmz;\r\n const i = utmz.indexOf('utmcsr');\r\n utmz = utmz.substring(i === -1 ? 0 : i);\r\n }\r\n return utmz;\r\n}\r\n"],"mappings":";;;;AAQA,SAAgB,cAAc,QAA6B;AACzD,KAAI,UACF,QAAO,WAAW,KAAK,OAAO;;;;ACRlC,SAAS,SAAS,UAAkB,WAAuD;AACzF,KAAI,WAAW;AACb,MAAI,UAAU,aAAa,SACzB,QAAO,UAAU;AAEnB,MAAI,UAAU,MACZ,QAAO,UAAU,MAAM,QAAQ,GAAuB,MAAM;AAC1D,UAAO,SAAS,UAAU,EAAE,IAAI;KAC/B,KAAA,EAAU;;;AAMnB,SAAgB,QAAQ,UAAkB,QAAiB;AACzD,QAAO,SAAS,UAAU,OAAO,KAAK;;;;ACjBxC,SAAgB,mBAAmB,OAMZ;AACrB,QAAO,OAAO,eAAe,OAAO;;;;ACJtC,MAAa,gBAAgB,QAAgB,GAAG,cAA0B;CACxE,MAAM,UAAU,WAAmB,MAAM;EACvC,MAAM,IAAI,YACR,SAAS,UAAU,QAAQ,OAAO,GAAG,CAAC,GACrC,UAAU,IAAI,IAAI;AACrB,SAAO,IAAI,KAAK,IAAI,IAAI,UAAU,EAAE;;AAEtC,QAAO;;;;ACRT,SAAgB,QAAQ,SAAiC;CACvD,IAAI,OAAO;AACX,KAAI,OAAO,QAAQ,QAAQ,WAAW,UAAU;AAC9C,SAAO,QAAQ,QAAQ;EACvB,MAAM,IAAI,KAAK,QAAQ,SAAS;AAChC,SAAO,KAAK,UAAU,MAAM,KAAK,IAAI,EAAE;;AAEzC,QAAO"}
@@ -32,7 +32,6 @@ type ICompanyAddress = IAddress & {
32
32
  email: string;
33
33
  websiteUrl?: string;
34
34
  };
35
- //# sourceMappingURL=address.d.ts.map
36
35
  //#endregion
37
36
  //#region src/consent_preference/consent_preference.d.ts
38
37
  type ILegalNotice = IEntity & {
@@ -46,7 +45,6 @@ type IConsentPreference = IEntity & {
46
45
  createdAt?: Date | string;
47
46
  updatedAt?: Date | string;
48
47
  };
49
- //# sourceMappingURL=consent_preference.d.ts.map
50
48
  //#endregion
51
49
  //#region src/lazy/lazy.d.ts
52
50
  type ILazyComponent = IComponent;
@@ -77,8 +75,6 @@ type ILazyFuncProps<T> = PageProps & {
77
75
  };
78
76
  type ILazyStaticPropsFunc<T = any> = (props: ILazyFuncProps<T>) => Promise<T & ILazyComponent>;
79
77
  type ILazyStaticProps = Record<string, ILazyStaticPropsFunc>;
80
- //# sourceMappingURL=lazy.d.ts.map
81
-
82
78
  //#endregion
83
- export { IAddress, IAddressOptions, ICompanyAddress, IConsentPreference, ILazyComponent, ILazyComponentFunc, ILazyComponentProps, ILazyFuncProps, ILazyModules, ILazyProps, ILazyStaticProps, ILazyStaticPropsFunc, ILazyableProps, ILazyedProps, ILegalNotice, INullableLazyableProps };
84
- //# sourceMappingURL=lazy-JamSYYoh.d.ts.map
79
+ export { ILazyModules as a, ILazyStaticPropsFunc as c, INullableLazyableProps as d, IConsentPreference as f, ICompanyAddress as g, IAddressOptions as h, ILazyFuncProps as i, ILazyableProps as l, IAddress as m, ILazyComponentFunc as n, ILazyProps as o, ILegalNotice as p, ILazyComponentProps as r, ILazyStaticProps as s, ILazyComponent as t, ILazyedProps as u };
80
+ //# sourceMappingURL=lazy-CoUsrocX.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lazy-CoUsrocX.d.ts","names":[],"sources":["../src/address/address.ts","../src/consent_preference/consent_preference.ts","../src/lazy/lazy.ts"],"mappings":";;;;;KAEY,eAAA;EACV,SAAA,EAAW,OAAA;EACX,OAAA,EAAS,OAAA;EACT,SAAA,EAAW,OAAA;AAAA;AAAA,KAGD,QAAA;EACV,OAAA;EACA,YAAA;EACA,IAAA;EACA,WAAA;EACA,OAAA,EAAS,OAAA;EACT,KAAA;EACA,SAAA;EACA,QAAA;EACA,WAAA;EACA,SAAA;EACA,QAAA,GAAW,OAAA;EACX,MAAA,GAAS,OAAA;EACT,YAAA;EACA,KAAA;EACA,UAAA;EACA,OAAA;AAAA;AAAA,KAGU,eAAA,GAAkB,QAAA;EAC5B,IAAA;EACA,WAAA;EACA,KAAA;EACA,UAAA;AAAA;;;KC7BU,YAAA,GAAe,OAAA;EACzB,EAAA;EACA,IAAA;AAAA;AAAA,KAGU,kBAAA,GAAqB,OAAA;EAC/B,EAAA;EACA,WAAA;EACA,WAAA,EAAa,YAAA;EACb,SAAA,GAAY,IAAA;EACZ,SAAA,GAAY,IAAA;AAAA;;;KCRF,cAAA,GAAiB,UAAA;AAAA,KAEjB,UAAA;EACV,IAAA,EAAM,CAAA,GAAI,cAAA;EACV,KAAA;EACA,QAAA,GAAW,SAAA;AAAA;AAAA,KAGD,cAAA;EACV,IAAA,EAAM,CAAA,GAAI,OAAA,CAAQ,cAAA;EAClB,KAAA;EACA,QAAA,GAAW,SAAA;AAAA;AAAA,KAGD,sBAAA;EACV,IAAA,GAAO,CAAA,GAAI,OAAA,CAAQ,cAAA;EACnB,KAAA;EACA,QAAA,GAAW,SAAA;AAAA;AAAA,KAGD,YAAA,MAAkB,IAAA,CAAK,UAAA,CAAW,CAAA;AAAA,KAElC,mBAAA;EACV,IAAA,EAAM,cAAA;EACN,KAAA;AAAA;AAAA,KAGU,YAAA,GAAe,MAAA,SAAe,aAAA,CAAc,UAAA;AAAA,KAE5C,kBAAA,WAA6B,cAAA,CAAe,CAAA,IAAK,MAAA,CAAO,CAAA;AAAA,KAExD,cAAA,MAAoB,SAAA;EAAc,SAAA,EAAW,CAAA,GAAI,cAAA;AAAA;AAAA,KAEjD,oBAAA,aAAiC,KAAA,EAAO,cAAA,CAAe,CAAA,MAAO,OAAA,CAAQ,CAAA,GAAI,cAAA;AAAA,KAE1E,gBAAA,GAAmB,MAAA,SAAe,oBAAA"}
@@ -0,0 +1,11 @@
1
+ //#region src/page/page.ts
2
+ function getPublicUrl() {
3
+ return process.env && process.env.NEXT_PUBLIC_URL ? process.env.NEXT_PUBLIC_URL : "";
4
+ }
5
+ function resolveHref(href = "") {
6
+ return href.startsWith("http") ? href : `${getPublicUrl()}${href}`;
7
+ }
8
+ //#endregion
9
+ export { resolveHref as n, getPublicUrl as t };
10
+
11
+ //# sourceMappingURL=page-DUrzmLyV.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"page-DUrzmLyV.js","names":[],"sources":["../src/page/page.ts"],"sourcesContent":["\r\nexport function getPublicUrl() {\r\n const publicUrl = process.env && process.env.NEXT_PUBLIC_URL ? process.env.NEXT_PUBLIC_URL : '';\r\n return publicUrl;\r\n}\r\n\r\nexport function resolveHref(href: string = '') {\r\n return href.startsWith('http') ? href : `${getPublicUrl()}${href}`;\r\n}\r\n"],"mappings":";AACA,SAAgB,eAAe;AAE7B,QADkB,QAAQ,OAAO,QAAQ,IAAI,kBAAkB,QAAQ,IAAI,kBAAkB;;AAI/F,SAAgB,YAAY,OAAe,IAAI;AAC7C,QAAO,KAAK,WAAW,OAAO,GAAG,OAAO,GAAG,cAAc,GAAG"}
@@ -1,9 +1,8 @@
1
1
  import { asCategoryId, findRouteOfCategory, getRootCategory, localize } from "@websolutespa/bom-core";
2
-
3
2
  //#region src/route/route.ts
4
3
  function categoryToRouteLink(routes, categories, category, locale) {
5
4
  const route = findRouteOfCategory(routes, category.id);
6
- if (!route) return void 0;
5
+ if (!route) return;
7
6
  const rootCategory = getRootCategory(categories);
8
7
  const childCategories = categories.filter((x) => {
9
8
  const parentId = asCategoryId(x.category);
@@ -19,7 +18,7 @@ function newRouteLink(category, route, locale) {
19
18
  const media = category.media || route?.media;
20
19
  const schema = route?.template || route?.schema || category?.schema || "unknown";
21
20
  const title = localize(category.title || route?.title || "untitled", locale);
22
- const routeLink = {
21
+ return {
23
22
  category: category.id,
24
23
  href,
25
24
  id,
@@ -28,10 +27,9 @@ function newRouteLink(category, route, locale) {
28
27
  schema,
29
28
  title
30
29
  };
31
- return routeLink;
32
30
  }
33
31
  function routeToRouteLink(route) {
34
- const routeLink = {
32
+ return {
35
33
  category: asCategoryId(route.category),
36
34
  href: route.id,
37
35
  id: route.page,
@@ -40,14 +38,12 @@ function routeToRouteLink(route) {
40
38
  schema: route.schema,
41
39
  title: route.title
42
40
  };
43
- return routeLink;
44
41
  }
45
42
  function resolveRoute(route) {
46
43
  const routepath = route.template || route.schema;
47
- const resolvedPathname = `/${route.market}/${route.locale}/${routepath}/${route.page}${route.splat || ""}`;
48
- return resolvedPathname;
44
+ return `/${route.market}/${route.locale}/${routepath}/${route.page}${route.splat || ""}`;
49
45
  }
50
-
51
46
  //#endregion
52
- export { categoryToRouteLink, newRouteLink, resolveRoute, routeToRouteLink };
53
- //# sourceMappingURL=route-k0W3AKyo.js.map
47
+ export { routeToRouteLink as i, newRouteLink as n, resolveRoute as r, categoryToRouteLink as t };
48
+
49
+ //# sourceMappingURL=route-BV0T142s.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"route-BV0T142s.js","names":[],"sources":["../src/route/route.ts"],"sourcesContent":["import { asCategoryId, findRouteOfCategory, getRootCategory, ICategory, IRoute, IRouteLink, localize } from '@websolutespa/bom-core';\r\n\r\nexport type StaticPath = { params: { [key: string]: string } };\r\n\r\nexport function categoryToRouteLink(routes: IRoute[], categories: ICategory[], category: ICategory, locale: string): IRouteLink | undefined {\r\n const route = findRouteOfCategory(routes, category.id);\r\n if (!route) {\r\n return undefined;\r\n }\r\n const rootCategory = getRootCategory(categories);\r\n const childCategories = categories.filter(x => {\r\n const parentId = asCategoryId(x.category);\r\n return rootCategory && rootCategory.id === category.id ?\r\n (x.id !== rootCategory.id && (parentId === category.id || !parentId)) :\r\n parentId === category.id;\r\n });\r\n // console.log('childCategories', category.id, childCategories);\r\n const routeLink = newRouteLink(category, route, locale);\r\n // console.log('categoryToRouteLink', href, category.id, route);\r\n routeLink.items = childCategories\r\n .map(x => categoryToRouteLink(routes, categories, x, locale))\r\n .filter(x => x !== undefined) as IRouteLink[];\r\n return routeLink;\r\n}\r\n\r\nexport function newRouteLink(category: ICategory, route: IRoute | undefined, locale: string): IRouteLink {\r\n const href = (route && route.id) ? route.id.toString() : '/';\r\n const id = route?.page || category.id;\r\n const media = category.media || route?.media;\r\n const schema = route?.template || route?.schema || category?.schema || 'unknown';\r\n const title = localize(category.title || route?.title || 'untitled', locale);\r\n const routeLink = {\r\n category: category.id,\r\n href,\r\n id,\r\n items: [],\r\n media,\r\n schema,\r\n title,\r\n };\r\n return routeLink;\r\n}\r\n\r\nexport function routeToRouteLink(route: IRoute): IRouteLink {\r\n const routeLink: IRouteLink = {\r\n category: asCategoryId(route.category),\r\n href: route.id,\r\n id: route.page,\r\n items: [],\r\n media: route.media,\r\n schema: route.schema,\r\n title: route.title,\r\n };\r\n return routeLink;\r\n}\r\n\r\nexport function resolveRoute(route: IRoute & { splat?: string }) {\r\n // console.log('resolveRoute', route);\r\n const routepath: string = route.template || route.schema;\r\n // convert route to next.js pages folder schema\r\n const resolvedPathname = `/${route.market}/${route.locale}/${routepath}/${route.page}${route.splat || ''}`;\r\n // console.log('resolveRoute', route.schema, resolvedPathname);\r\n return resolvedPathname;\r\n}\r\n"],"mappings":";;AAIA,SAAgB,oBAAoB,QAAkB,YAAyB,UAAqB,QAAwC;CAC1I,MAAM,QAAQ,oBAAoB,QAAQ,SAAS,GAAG;AACtD,KAAI,CAAC,MACH;CAEF,MAAM,eAAe,gBAAgB,WAAW;CAChD,MAAM,kBAAkB,WAAW,QAAO,MAAK;EAC7C,MAAM,WAAW,aAAa,EAAE,SAAS;AACzC,SAAO,gBAAgB,aAAa,OAAO,SAAS,KACjD,EAAE,OAAO,aAAa,OAAO,aAAa,SAAS,MAAM,CAAC,YAC3D,aAAa,SAAS;GACxB;CAEF,MAAM,YAAY,aAAa,UAAU,OAAO,OAAO;AAEvD,WAAU,QAAQ,gBACf,KAAI,MAAK,oBAAoB,QAAQ,YAAY,GAAG,OAAO,CAAC,CAC5D,QAAO,MAAK,MAAM,KAAA,EAAU;AAC/B,QAAO;;AAGT,SAAgB,aAAa,UAAqB,OAA2B,QAA4B;CACvG,MAAM,OAAQ,SAAS,MAAM,KAAM,MAAM,GAAG,UAAU,GAAG;CACzD,MAAM,KAAK,OAAO,QAAQ,SAAS;CACnC,MAAM,QAAQ,SAAS,SAAS,OAAO;CACvC,MAAM,SAAS,OAAO,YAAY,OAAO,UAAU,UAAU,UAAU;CACvE,MAAM,QAAQ,SAAS,SAAS,SAAS,OAAO,SAAS,YAAY,OAAO;AAU5E,QATkB;EAChB,UAAU,SAAS;EACnB;EACA;EACA,OAAO,EAAE;EACT;EACA;EACA;EACD;;AAIH,SAAgB,iBAAiB,OAA2B;AAU1D,QAT8B;EAC5B,UAAU,aAAa,MAAM,SAAS;EACtC,MAAM,MAAM;EACZ,IAAI,MAAM;EACV,OAAO,EAAE;EACT,OAAO,MAAM;EACb,QAAQ,MAAM;EACd,OAAO,MAAM;EACd;;AAIH,SAAgB,aAAa,OAAoC;CAE/D,MAAM,YAAoB,MAAM,YAAY,MAAM;AAIlD,QAFyB,IAAI,MAAM,OAAO,GAAG,MAAM,OAAO,GAAG,UAAU,GAAG,MAAM,OAAO,MAAM,SAAS"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@websolutespa/bom-mixer-models",
3
- "version": "3.0.4",
3
+ "version": "3.1.0",
4
4
  "description": "Mixer Models module of the BOM Repository",
5
5
  "keywords": [
6
6
  "bom",
@@ -13,7 +13,7 @@
13
13
  "url": "git://github.com/websolutespa/bom.git"
14
14
  },
15
15
  "scripts": {
16
- "lint": "eslint *.ts*",
16
+ "lint": "eslint .",
17
17
  "compile": "tsdown",
18
18
  "prepack": "bom prepack",
19
19
  "postpack": "bom postpack",
@@ -23,21 +23,22 @@
23
23
  "peerDependencies": {
24
24
  "@websolutespa/bom-core": "^3.0.3",
25
25
  "@websolutespa/bom-mixer-store": "^3.0.1",
26
- "iron-session": "8.0.4",
27
- "next": "16.1.6"
26
+ "iron-session": "^9.0.1",
27
+ "next": "^16.3.3"
28
28
  },
29
29
  "devDependencies": {
30
- "@types/react-dom": "19.2.3",
31
- "@types/react": "19.2.10",
32
- "@websolutespa/bom-cli": "^3.0.2",
33
- "@websolutespa/eslint-config": "^3.0.0",
34
- "@websolutespa/test": "^3.0.1",
35
- "@websolutespa/tsconfig": "^3.0.0",
36
- "eslint": "9.31.0",
30
+ "@types/react": "19.2.18",
31
+ "@types/react-dom": "19.2.7",
32
+ "@websolutespa/bom-cli": "^3.1.0",
33
+ "@websolutespa/eslint-config": "^3.1.0",
34
+ "@websolutespa/test": "^3.1.0",
35
+ "@websolutespa/tsconfig": "^3.1.0",
36
+ "eslint": "10.13.0",
37
37
  "npm-run-all": "4.1.5",
38
- "react": "19.2.3",
39
- "schema-dts": "1.1.5",
40
- "typescript": "5.8.3"
38
+ "react": "19.2.9",
39
+ "schema-dts": "2.1.0",
40
+ "tsdown": "0.21.0",
41
+ "typescript": "6.0.3"
41
42
  },
42
43
  "publishConfig": {
43
44
  "access": "public"
@@ -1,4 +1,4 @@
1
- import { IMarket, IRoute, asEquatable, defaultLocale, defaultMarket, getHost, isDevelopment } from '@websolutespa/bom-core';
1
+ import { IMarket, IRoute, asEquatable, defaultLocale, defaultMarket, getHost } from '@websolutespa/bom-core';
2
2
  import { StoreStrategy, localApiGet, localApiPost, storeApiGet, storeApiPost, storeStrategy } from '@websolutespa/bom-mixer-store';
3
3
  import { NextFetchEvent, NextRequest, NextResponse } from 'next/server';
4
4
  import { getPublicUrl, resolveHref } from '../page/page';
@@ -132,8 +132,12 @@ export async function routeInterceptor(request: NextRequest, next: NextFetchEven
132
132
  const resolvedUrl = resolveHref(redirectUrl);
133
133
  // console.log('routeInterceptor', 'resolvedUrl', resolvedUrl);
134
134
  const search = request.nextUrl.search;
135
+ /*
136
+ // !!! always return a temporary redirect
135
137
  const isTemporaryRedirect = isDevelopment || search;
136
- const response = NextResponse.redirect(resolvedUrl + search, { status: isTemporaryRedirect ? 303 : 301 });
138
+ const response = NextResponse.redirect(resolvedUrl + search, { status: isTemporaryRedirect ? 307 : 308 });
139
+ */
140
+ const response = NextResponse.redirect(resolvedUrl + search, { status: 307 });
137
141
  response.cookies.set({
138
142
  expires: new Date(Date.now() + 1 * 24 * 60 * 60 * 1000),
139
143
  httpOnly: true,
@@ -1 +0,0 @@
1
- {"version":3,"file":"lazy-JamSYYoh.d.ts","names":[],"sources":["../src/address/address.ts","../src/consent_preference/consent_preference.ts","../src/lazy/lazy.ts"],"sourcesContent":[],"mappings":";;;;;KAEY,eAAA;aACC;WACF;aACE;AAHb,CAAA;AAA2B,KAMf,QAAA,GANe;EAAA,OACd,EAAA,MAAA;EAAO,YACT,CAAA,EAAA,MAAA;EAAO,IACL,EAAA,MAAA;EAAO,WAAA,CAAA,EAAA,MAAA;EAGR,OAAA,EAKD,OALS;EAAA,KAAA,CAAA,EAAA,MAAA;EAAA,SAKT,CAAA,EAAA,MAAA;EAAO,QAML,CAAA,EAAA,MAAA;EAAO,WACT,CAAA,EAAA,MAAA;EAAO,SAAA,CAAA,EAAA,MAAA;EAON,QAAA,CAAA,EARC,OAQc;WAPhB;;;EClBC,UAAA,CAAA,EAAA,MAAY;EAKZ,OAAA,EAAA,MAAA;CAAkB;AAAG,KDoBrB,eAAA,GAAkB,QCpBG,GAAA;EAAO,IAGzB,EAAA,MAAA;EAAY,WACb,EAAA,MAAA;EAAI,KACJ,EAAA,MAAA;EAAI,UAAA,CAAA,EAAA,MAAA;;;;;KAVN,YAAA,GAAe;;;;ADAf,KCKA,kBAAA,GAAqB,ODLN,GAAA;EAAA,EAAA,EAAA,MAAA;EAAA,WACd,EAAA,MAAA;EAAO,WACT,ECMI,YDNJ;EAAO,SACL,CAAA,ECMC,IDND,GAAA,MAAA;EAAO,SAAA,CAAA,ECON,IDPM,GAAA,MAAA;AAGpB,CAAA;;;;KEJY,cAAA,GAAiB;KAEjB;EFJA,IAAA,EEKJ,CFLI,GEKA,cFLe;EAAA,KAAA,EAAA,MAAA;EAAA,QACd,CAAA,EEMA,SFNA;CAAO;AAEP,KEOD,cFPC,CAAA,CAAA,CAAA,GAAA;EAAO,IAAA,EEQZ,CFRY,GEQR,OFRQ,CEQA,cFRA,CAAA;EAGR,KAAA,CAAA,EAAA,MAAQ;EAAA,QAAA,CAAA,EEOP,SFPO;CAAA;AAWP,KEDD,sBFCC,CAAA,CAAA,CAAA,GAAA;EAAO,IACT,CAAA,EEDF,CFCE,GEDE,OFCF,CEDU,cFCV,CAAA;EAAO,KAAA,CAAA,EAAA,MAAA;EAON,QAAA,CAAA,EENC,SFMc;;KEHf,kBAAkB,KAAK,WAAW;KAElC,mBAAA;EDxBA,IAAA,ECyBJ,cDzBgB;EAKZ,KAAA,EAAA,MAAA;CAAkB;AAAG,KCwBrB,YAAA,GAAe,MDxBM,CAAA,MAAA,ECwBS,aDxBT,CCwBuB,UDxBvB,CAAA,GAAA,CAAA,CAAA,CAAA;AAGlB,KCuBH,kBDvBG,CAAA,IAAA,CAAA,CAAA,CAAA,GCuB0B,cDvB1B,CCuByC,CDvBzC,CAAA,GCuB8C,MDvB9C,CCuBqD,CDvBrD,CAAA;AACD,KCwBF,cDxBE,CAAA,CAAA,CAAA,GCwBkB,SDxBlB,GAAA;EAAI,SACJ,ECuB2C,CDvB3C,GCuB+C,cDvB/C;AAAI,CAAA;KCyBN,wCAAwC,eAAe,OAAO,QAAQ,IAAI;KAE1E,gBAAA,GAAmB,eAAe"}
@@ -1,12 +0,0 @@
1
- //#region src/page/page.ts
2
- function getPublicUrl() {
3
- const publicUrl = process.env && process.env.NEXT_PUBLIC_URL ? process.env.NEXT_PUBLIC_URL : "";
4
- return publicUrl;
5
- }
6
- function resolveHref(href = "") {
7
- return href.startsWith("http") ? href : `${getPublicUrl()}${href}`;
8
- }
9
-
10
- //#endregion
11
- export { getPublicUrl, resolveHref };
12
- //# sourceMappingURL=page-BLbZbnWg.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"page-BLbZbnWg.js","names":["href: string"],"sources":["../src/page/page.ts"],"sourcesContent":["\r\nexport function getPublicUrl() {\r\n const publicUrl = process.env && process.env.NEXT_PUBLIC_URL ? process.env.NEXT_PUBLIC_URL : '';\r\n return publicUrl;\r\n}\r\n\r\nexport function resolveHref(href: string = '') {\r\n return href.startsWith('http') ? href : `${getPublicUrl()}${href}`;\r\n}\r\n"],"mappings":";AACA,SAAgB,eAAe;CAC7B,MAAM,YAAY,QAAQ,OAAO,QAAQ,IAAI,kBAAkB,QAAQ,IAAI,kBAAkB;AAC7F,QAAO;AACR;AAED,SAAgB,YAAYA,OAAe,IAAI;AAC7C,QAAO,KAAK,WAAW,OAAO,GAAG,OAAO,GAAG,cAAc,GAAG,MAAM;AACnE"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"route-k0W3AKyo.js","names":["routes: IRoute[]","categories: ICategory[]","category: ICategory","locale: string","route: IRoute | undefined","route: IRoute","routeLink: IRouteLink","route: IRoute & { splat?: string }","routepath: string"],"sources":["../src/route/route.ts"],"sourcesContent":["import { asCategoryId, findRouteOfCategory, getRootCategory, ICategory, IRoute, IRouteLink, localize } from '@websolutespa/bom-core';\r\n\r\nexport type StaticPath = { params: { [key: string]: string } };\r\n\r\nexport function categoryToRouteLink(routes: IRoute[], categories: ICategory[], category: ICategory, locale: string): IRouteLink | undefined {\r\n const route = findRouteOfCategory(routes, category.id);\r\n if (!route) {\r\n return undefined;\r\n }\r\n const rootCategory = getRootCategory(categories);\r\n const childCategories = categories.filter(x => {\r\n const parentId = asCategoryId(x.category);\r\n return rootCategory && rootCategory.id === category.id ?\r\n (x.id !== rootCategory.id && (parentId === category.id || !parentId)) :\r\n parentId === category.id;\r\n });\r\n // console.log('childCategories', category.id, childCategories);\r\n const routeLink = newRouteLink(category, route, locale);\r\n // console.log('categoryToRouteLink', href, category.id, route);\r\n routeLink.items = childCategories\r\n .map(x => categoryToRouteLink(routes, categories, x, locale))\r\n .filter(x => x !== undefined) as IRouteLink[];\r\n return routeLink;\r\n}\r\n\r\nexport function newRouteLink(category: ICategory, route: IRoute | undefined, locale: string): IRouteLink {\r\n const href = (route && route.id) ? route.id.toString() : '/';\r\n const id = route?.page || category.id;\r\n const media = category.media || route?.media;\r\n const schema = route?.template || route?.schema || category?.schema || 'unknown';\r\n const title = localize(category.title || route?.title || 'untitled', locale);\r\n const routeLink = {\r\n category: category.id,\r\n href,\r\n id,\r\n items: [],\r\n media,\r\n schema,\r\n title,\r\n };\r\n return routeLink;\r\n}\r\n\r\nexport function routeToRouteLink(route: IRoute): IRouteLink {\r\n const routeLink: IRouteLink = {\r\n category: asCategoryId(route.category),\r\n href: route.id,\r\n id: route.page,\r\n items: [],\r\n media: route.media,\r\n schema: route.schema,\r\n title: route.title,\r\n };\r\n return routeLink;\r\n}\r\n\r\nexport function resolveRoute(route: IRoute & { splat?: string }) {\r\n // console.log('resolveRoute', route);\r\n const routepath: string = route.template || route.schema;\r\n // convert route to next.js pages folder schema\r\n const resolvedPathname = `/${route.market}/${route.locale}/${routepath}/${route.page}${route.splat || ''}`;\r\n // console.log('resolveRoute', route.schema, resolvedPathname);\r\n return resolvedPathname;\r\n}\r\n"],"mappings":";;;AAIA,SAAgB,oBAAoBA,QAAkBC,YAAyBC,UAAqBC,QAAwC;CAC1I,MAAM,QAAQ,oBAAoB,QAAQ,SAAS,GAAG;AACtD,KAAI,CAAC,MACH,QAAO;CAET,MAAM,eAAe,gBAAgB,WAAW;CAChD,MAAM,kBAAkB,WAAW,OAAO,OAAK;EAC7C,MAAM,WAAW,aAAa,EAAE,SAAS;AACzC,SAAO,gBAAgB,aAAa,OAAO,SAAS,KACjD,EAAE,OAAO,aAAa,OAAO,aAAa,SAAS,MAAM,CAAC,YAC3D,aAAa,SAAS;CACzB,EAAC;CAEF,MAAM,YAAY,aAAa,UAAU,OAAO,OAAO;CAEvD,UAAU,QAAQ,gBACf,IAAI,OAAK,oBAAoB,QAAQ,YAAY,GAAG,OAAO,CAAC,CAC5D,OAAO,OAAK,MAAM,OAAU;AAC/B,QAAO;AACR;AAED,SAAgB,aAAaD,UAAqBE,OAA2BD,QAA4B;CACvG,MAAM,OAAQ,SAAS,MAAM,KAAM,MAAM,GAAG,UAAU,GAAG;CACzD,MAAM,KAAK,OAAO,QAAQ,SAAS;CACnC,MAAM,QAAQ,SAAS,SAAS,OAAO;CACvC,MAAM,SAAS,OAAO,YAAY,OAAO,UAAU,UAAU,UAAU;CACvE,MAAM,QAAQ,SAAS,SAAS,SAAS,OAAO,SAAS,YAAY,OAAO;CAC5E,MAAM,YAAY;EAChB,UAAU,SAAS;EACnB;EACA;EACA,OAAO,CAAE;EACT;EACA;EACA;CACD;AACD,QAAO;AACR;AAED,SAAgB,iBAAiBE,OAA2B;CAC1D,MAAMC,YAAwB;EAC5B,UAAU,aAAa,MAAM,SAAS;EACtC,MAAM,MAAM;EACZ,IAAI,MAAM;EACV,OAAO,CAAE;EACT,OAAO,MAAM;EACb,QAAQ,MAAM;EACd,OAAO,MAAM;CACd;AACD,QAAO;AACR;AAED,SAAgB,aAAaC,OAAoC;CAE/D,MAAMC,YAAoB,MAAM,YAAY,MAAM;CAElD,MAAM,mBAAmB,CAAC,CAAC,EAAE,MAAM,OAAO,CAAC,EAAE,MAAM,OAAO,CAAC,EAAE,UAAU,CAAC,EAAE,MAAM,OAAO,MAAM,SAAS,IAAI;AAE1G,QAAO;AACR"}