@websolutespa/bom-mixer-models 3.0.5 → 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/CHANGELOG.md +16 -0
- package/dist/exports/proxy.d.ts +0 -2
- package/dist/exports/proxy.d.ts.map +1 -1
- package/dist/exports/proxy.js +25 -44
- package/dist/exports/proxy.js.map +1 -1
- package/dist/exports/server.d.ts +2 -24
- package/dist/exports/server.d.ts.map +1 -1
- package/dist/exports/server.js +96 -205
- package/dist/exports/server.js.map +1 -1
- package/dist/index.d.ts +12031 -20
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -9
- package/dist/index.js.map +1 -1
- package/dist/{lazy-JamSYYoh.d.ts → lazy-CoUsrocX.d.ts} +2 -6
- package/dist/lazy-CoUsrocX.d.ts.map +1 -0
- package/dist/page-DUrzmLyV.js +11 -0
- package/dist/page-DUrzmLyV.js.map +1 -0
- package/dist/{route-k0W3AKyo.js → route-BV0T142s.js} +7 -11
- package/dist/route-BV0T142s.js.map +1 -0
- package/package.json +15 -14
- package/dist/lazy-JamSYYoh.d.ts.map +0 -1
- package/dist/page-BLbZbnWg.js +0 -12
- package/dist/page-BLbZbnWg.js.map +0 -1
- package/dist/route-k0W3AKyo.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @websolutespa/bom-mixer-models
|
|
2
2
|
|
|
3
|
+
## 3.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 3f7c21b: - Payload 3.91.0 and Next.js 16.4.2 (React 19.2.9): peer dependencies are now ranges, `payload` / `@payloadcms/*` `^3.91.0`, `next` `^16.3.3`, `react` / `react-dom` `^19.2.1`
|
|
8
|
+
- payload-plugin-bowl: the mixer context is built only for reads by an authenticated user (payload 3.90+ resolves the jwt user with the request query, populating tenants before `req.user` is set); email options typed with payload `SendEmailOptions`, no direct nodemailer dependency
|
|
9
|
+
- payload-plugin-storage: `AZURE_STORAGE_CONTAINER_ACCESS` (`private` default since payload 3.90, `blob`, `container`) for containers created by the plugin
|
|
10
|
+
- mixer web: `images.qualities` includes `IMAGE_QUALITY` (next 16 defaults to `[75]`)
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- d88019f: - library majors: uuid 14, marked 18 (llm text renderer ported to token renderers), mime 4, mime-types 3, iron-session 9, node-cron 4, html-to-text 10, react-error-boundary 6, react-dropzone 20 (import modal accepts `text/csv` `.csv`), fast-equals 6, schema-dts 2, json-schema-typed 9, dotenv 18 (quiet), chalk 6, giget 3, @clack/prompts 1, keeper secrets manager 17
|
|
15
|
+
- 12b6e2f: - test: replace the jest presets with shared vitest configurations, `@websolutespa/test/vitest` (`defineNodeConfig`, `defineDomConfig`, `definePayloadConfig`); drop jest dependencies
|
|
16
|
+
- declare every imported package and script binary in the package that uses it (no more reliance on hoisting), drop unused dependencies
|
|
17
|
+
- bom-mixer-checkout: `useCart.add` no longer mutates the previous cart state
|
|
18
|
+
|
|
3
19
|
## 3.0.5
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
package/dist/exports/proxy.d.ts
CHANGED
|
@@ -5,8 +5,6 @@ declare function detectLocale(request: NextRequest, defaultLocale?: string): Pro
|
|
|
5
5
|
declare function detectCountry(request: NextRequest, defaultMarket?: string): Promise<string | undefined>;
|
|
6
6
|
declare function routeAutoDetection(request: NextRequest, next: NextFetchEvent): Promise<string | undefined>;
|
|
7
7
|
declare function routeInterceptor(request: NextRequest, next: NextFetchEvent): Promise<NextResponse<unknown> | undefined>;
|
|
8
|
-
//# sourceMappingURL=route.interceptor.d.ts.map
|
|
9
|
-
|
|
10
8
|
//#endregion
|
|
11
9
|
export { detectCountry, detectLocale, routeAutoDetection, routeInterceptor };
|
|
12
10
|
//# sourceMappingURL=proxy.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"proxy.d.ts","names":[],"sources":["../../src/route/route.interceptor.ts"],"
|
|
1
|
+
{"version":3,"file":"proxy.d.ts","names":[],"sources":["../../src/route/route.interceptor.ts"],"mappings":";;;iBAMsB,YAAA,CAAa,OAAA,EAAS,WAAA,EAAa,aAAA,YAAsB,OAAA;AAAA,iBAMzD,aAAA,CAAc,OAAA,EAAS,WAAA,EAAa,aAAA,YAAsB,OAAA;AAAA,iBAiD1D,kBAAA,CAAmB,OAAA,EAAS,WAAA,EAAa,IAAA,EAAM,cAAA,GAAiB,OAAA;AAAA,iBA4DhE,gBAAA,CAAiB,OAAA,EAAS,WAAA,EAAa,IAAA,EAAM,cAAA,GAAc,OAAA,CAAA,YAAA"}
|
package/dist/exports/proxy.js
CHANGED
|
@@ -1,16 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { resolveRoute } from "../route-
|
|
1
|
+
import { n as resolveHref, t as getPublicUrl } from "../page-DUrzmLyV.js";
|
|
2
|
+
import { r as resolveRoute } from "../route-BV0T142s.js";
|
|
3
3
|
import { asEquatable, defaultLocale, defaultMarket, getHost } from "@websolutespa/bom-core";
|
|
4
4
|
import { StoreStrategy, localApiGet, localApiPost, storeApiGet, storeApiPost, storeStrategy } from "@websolutespa/bom-mixer-store";
|
|
5
5
|
import { NextResponse } from "next/server";
|
|
6
|
-
|
|
7
6
|
//#region src/route/route.interceptor.ts
|
|
8
|
-
async function detectLocale(request, defaultLocale
|
|
7
|
+
async function detectLocale(request, defaultLocale) {
|
|
9
8
|
const acceptLanguage = request.headers.get("accept-language")?.split(",")[0];
|
|
10
|
-
|
|
11
|
-
return detectedLocale;
|
|
9
|
+
return request.cookies.get("NEXT_LOCALE")?.value || acceptLanguage || defaultLocale || process.env.DEFAULT_LOCALE;
|
|
12
10
|
}
|
|
13
|
-
async function detectCountry(request, defaultMarket
|
|
11
|
+
async function detectCountry(request, defaultMarket) {
|
|
14
12
|
let ip = request.headers.get("x-forwarded-for") || request.headers.get("x-real-ip");
|
|
15
13
|
if (ip) ip = ip.split(",")[0];
|
|
16
14
|
const isValidIp = ip?.match(/^(\d+?)\.(\d+?)\.(\d+?)\.(\d+?)$/);
|
|
@@ -20,33 +18,23 @@ async function detectCountry(request, defaultMarket$1) {
|
|
|
20
18
|
if (token) {
|
|
21
19
|
const url = isValidIp ? `https://api.ipinfo.io/lite/${ip}/country_code?token=${token}` : `https://api.ipinfo.io/lite/me/country_code?token=${token}`;
|
|
22
20
|
const response = await fetch(url);
|
|
23
|
-
if (response.ok)
|
|
24
|
-
const data = await response.text();
|
|
25
|
-
detectedCountry = data.toLowerCase();
|
|
26
|
-
}
|
|
21
|
+
if (response.ok) detectedCountry = (await response.text()).toLowerCase();
|
|
27
22
|
} else {
|
|
28
23
|
const url = `https://geoip.websolute.it/Ip2Location/get_info.aspx?ipaddress=${isValidIp ? ip : ""}`;
|
|
29
24
|
const response = await fetch(url);
|
|
30
|
-
if (response.ok)
|
|
31
|
-
const xml = await response.text();
|
|
32
|
-
detectedCountry = ((xml.split("<CountryCode><![CDATA[")[1] || "").split("]]></CountryCode>")[0] || "").replace("-", "").toLowerCase();
|
|
33
|
-
}
|
|
25
|
+
if (response.ok) detectedCountry = (((await response.text()).split("<CountryCode><![CDATA[")[1] || "").split("]]></CountryCode>")[0] || "").replace("-", "").toLowerCase();
|
|
34
26
|
}
|
|
35
|
-
return detectedCountry || defaultMarket
|
|
27
|
+
return detectedCountry || defaultMarket || process.env.DEFAULT_MARKET;
|
|
36
28
|
} catch (error) {
|
|
37
29
|
console.log("routeInterceptor.detectCountry.error", error);
|
|
38
30
|
}
|
|
39
|
-
return defaultMarket
|
|
31
|
+
return defaultMarket || process.env.DEFAULT_MARKET;
|
|
40
32
|
}
|
|
41
33
|
async function getMarkets() {
|
|
42
|
-
|
|
43
|
-
const markets = await apiGet("/market?pagination=false");
|
|
44
|
-
return markets;
|
|
34
|
+
return await (storeStrategy === StoreStrategy.DecoratedApi ? localApiGet : storeApiGet)("/market?pagination=false");
|
|
45
35
|
}
|
|
46
36
|
async function getRootRoutes() {
|
|
47
|
-
|
|
48
|
-
const routes = await apiGet("/route?where[isRoot][equals]=true");
|
|
49
|
-
return routes;
|
|
37
|
+
return await (storeStrategy === StoreStrategy.DecoratedApi ? localApiGet : storeApiGet)("/route?where[isRoot][equals]=true");
|
|
50
38
|
}
|
|
51
39
|
async function routeAutoDetection(request, next) {
|
|
52
40
|
let route;
|
|
@@ -55,14 +43,12 @@ async function routeAutoDetection(request, next) {
|
|
|
55
43
|
const cookie = request.cookies.get("detectedRoute");
|
|
56
44
|
if (cookie?.value) return cookie.value;
|
|
57
45
|
const rootRoutes = await getRootRoutes();
|
|
58
|
-
|
|
59
|
-
if (defaultRoute) return;
|
|
46
|
+
if (rootRoutes.find((x) => x.id === "/")) return;
|
|
60
47
|
const markets = await getMarkets();
|
|
61
48
|
const market = markets.find((x) => x.isDefault) || markets.find((x) => x.id === defaultMarket) || markets[0];
|
|
62
49
|
const detectedCountry = await detectCountry(request, market.id);
|
|
63
50
|
const detectedMarket = detectedCountry ? markets.filter((x) => Array.isArray(x.countries)).find((x) => {
|
|
64
|
-
|
|
65
|
-
return countries.includes(detectedCountry);
|
|
51
|
+
return (x.countries || []).map((x) => typeof x === "string" ? x : x.id).includes(detectedCountry);
|
|
66
52
|
}) || markets.find((x) => !Array.isArray(x.countries)) : void 0;
|
|
67
53
|
let detectedMarketRoutes = rootRoutes.filter((x) => x.market === detectedMarket?.id);
|
|
68
54
|
if (detectedMarketRoutes.length === 0) detectedMarketRoutes = rootRoutes.filter((x) => x.market === market.id);
|
|
@@ -70,8 +56,8 @@ async function routeAutoDetection(request, next) {
|
|
|
70
56
|
const detectedLocale = await detectLocale(request, defaultMarketLocale);
|
|
71
57
|
const detectedLocaleRoutes = detectedMarketRoutes.filter((x) => x.locale === detectedLocale);
|
|
72
58
|
const detectedRoute = detectedLocaleRoutes.length > 0 ? detectedLocaleRoutes[0] : detectedMarketRoutes.find((x) => {
|
|
73
|
-
const market
|
|
74
|
-
const marketLocale = market
|
|
59
|
+
const market = markets.find((m) => m.id === x.market);
|
|
60
|
+
const marketLocale = market.defaultLanguage ? asEquatable(market.defaultLanguage) : defaultMarketLocale;
|
|
75
61
|
return x.locale === marketLocale;
|
|
76
62
|
});
|
|
77
63
|
if (detectedRoute && detectedRoute.id !== url.pathname) {
|
|
@@ -90,8 +76,8 @@ async function routeInterceptor(request, next) {
|
|
|
90
76
|
if (redirectUrl) {
|
|
91
77
|
const resolvedUrl = resolveHref(redirectUrl);
|
|
92
78
|
const search = request.nextUrl.search;
|
|
93
|
-
const response
|
|
94
|
-
response
|
|
79
|
+
const response = NextResponse.redirect(resolvedUrl + search, { status: 307 });
|
|
80
|
+
response.cookies.set({
|
|
95
81
|
expires: new Date(Date.now() + 1440 * 60 * 1e3),
|
|
96
82
|
httpOnly: true,
|
|
97
83
|
name: "detectedRoute",
|
|
@@ -100,7 +86,7 @@ async function routeInterceptor(request, next) {
|
|
|
100
86
|
secure: true,
|
|
101
87
|
value: redirectUrl
|
|
102
88
|
});
|
|
103
|
-
return response
|
|
89
|
+
return response;
|
|
104
90
|
}
|
|
105
91
|
if (storeStrategy === StoreStrategy.DecoratedApi) route = await localApiPost("/route", {
|
|
106
92
|
pathname: url.pathname,
|
|
@@ -121,32 +107,28 @@ async function routeInterceptor(request, next) {
|
|
|
121
107
|
console.log("routeInterceptor.3xx", url.pathname, error.status, error.statusText);
|
|
122
108
|
try {
|
|
123
109
|
const { redirectUrl } = await error.json();
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
} catch (error$1) {
|
|
110
|
+
return NextResponse.redirect(redirectUrl, error.status);
|
|
111
|
+
} catch (error) {
|
|
127
112
|
const publicUrl = getPublicUrl();
|
|
128
113
|
console.log("routeInterceptor.3xx.error", `cannot parse response, redirecting to ${publicUrl}`);
|
|
129
|
-
|
|
130
|
-
return response$1;
|
|
114
|
+
return NextResponse.redirect(publicUrl, 307);
|
|
131
115
|
}
|
|
132
116
|
} else if (error.status === 410) {
|
|
133
117
|
console.log("routeInterceptor.410", url.pathname, error.status, error.statusText);
|
|
134
118
|
url = request.nextUrl.clone();
|
|
135
119
|
url.pathname = `/${error.status}`;
|
|
136
|
-
|
|
120
|
+
return NextResponse.rewrite(url, {
|
|
137
121
|
status: error.status,
|
|
138
122
|
statusText: error.statusText,
|
|
139
123
|
request
|
|
140
124
|
});
|
|
141
|
-
return response$1;
|
|
142
125
|
} else if (error.status >= 400 && error.status < 500) {
|
|
143
126
|
console.log("routeInterceptor.4xx", url.pathname, error.status, error.statusText);
|
|
144
|
-
|
|
127
|
+
return NextResponse.next({
|
|
145
128
|
status: error.status,
|
|
146
129
|
statusText: error.statusText,
|
|
147
130
|
request
|
|
148
131
|
});
|
|
149
|
-
return response$1;
|
|
150
132
|
}
|
|
151
133
|
console.log("routeInterceptor.error", url.pathname, error.url, error.status, error.statusText || error);
|
|
152
134
|
return;
|
|
@@ -154,8 +136,7 @@ async function routeInterceptor(request, next) {
|
|
|
154
136
|
url = request.nextUrl.clone();
|
|
155
137
|
const resolvedPathname = resolveRoute(route);
|
|
156
138
|
url.pathname = resolvedPathname;
|
|
157
|
-
|
|
158
|
-
return response;
|
|
139
|
+
return NextResponse.rewrite(url);
|
|
159
140
|
}
|
|
160
141
|
function getHrefBeforeRedirect(request) {
|
|
161
142
|
let hrefBeforeRedirect = null;
|
|
@@ -168,7 +149,7 @@ function getHrefBeforeRedirect(request) {
|
|
|
168
149
|
}
|
|
169
150
|
return hrefBeforeRedirect;
|
|
170
151
|
}
|
|
171
|
-
|
|
172
152
|
//#endregion
|
|
173
153
|
export { detectCountry, detectLocale, routeAutoDetection, routeInterceptor };
|
|
154
|
+
|
|
174
155
|
//# sourceMappingURL=proxy.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"proxy.js","names":["request: NextRequest","defaultLocale?: string","defaultLocale","defaultMarket?: string","defaultMarket","markets: IMarket[]","routes: IRoute[]","next: NextFetchEvent","route: string | undefined","countries: string[]","x","market","route: IRoute | undefined","response","error: any","error","hrefBeforeRedirect: string | null"],"sources":["../../src/route/route.interceptor.ts"],"sourcesContent":["import { IMarket, IRoute, asEquatable, defaultLocale, defaultMarket, getHost } from '@websolutespa/bom-core';\r\nimport { StoreStrategy, localApiGet, localApiPost, storeApiGet, storeApiPost, storeStrategy } from '@websolutespa/bom-mixer-store';\r\nimport { NextFetchEvent, NextRequest, NextResponse } from 'next/server';\r\nimport { getPublicUrl, resolveHref } from '../page/page';\r\nimport { resolveRoute } from './route';\r\n\r\nexport async function detectLocale(request: NextRequest, defaultLocale?: string) {\r\n const acceptLanguage = request.headers.get('accept-language')?.split(',')[0];\r\n const detectedLocale = request.cookies.get('NEXT_LOCALE')?.value || acceptLanguage || defaultLocale || process.env.DEFAULT_LOCALE;\r\n return detectedLocale as string;\r\n}\r\n\r\nexport async function detectCountry(request: NextRequest, defaultMarket?: string) {\r\n let ip = request.headers.get('x-forwarded-for') || request.headers.get('x-real-ip');\r\n if (ip) {\r\n ip = ip.split(',')[0];\r\n }\r\n const isValidIp = ip?.match(/^(\\d+?)\\.(\\d+?)\\.(\\d+?)\\.(\\d+?)$/);\r\n let detectedCountry = '';\r\n try {\r\n const token = process.env.IPINFO_TOKEN;\r\n if (token) {\r\n const url = isValidIp ?\r\n `https://api.ipinfo.io/lite/${ip}/country_code?token=${token}` :\r\n `https://api.ipinfo.io/lite/me/country_code?token=${token}`;\r\n const response = await fetch(url);\r\n if (response.ok) {\r\n const data = await response.text();\r\n detectedCountry = data.toLowerCase();\r\n }\r\n } else {\r\n const url = `https://geoip.websolute.it/Ip2Location/get_info.aspx?ipaddress=${isValidIp ? ip : ''}`;\r\n const response = await fetch(url);\r\n if (response.ok) {\r\n const xml = await response.text();\r\n detectedCountry = (\r\n ((xml.split('<CountryCode><![CDATA[')[1] || '').split(']]></CountryCode>')[0] || '')\r\n ).replace('-', '').toLowerCase();\r\n // console.log('detectedCountry', detectedCountry);\r\n }\r\n }\r\n // console.log('routeInterceptor.detectCountry', detectedCountry);\r\n return detectedCountry || defaultMarket || process.env.DEFAULT_MARKET;\r\n } catch (error) {\r\n console.log('routeInterceptor.detectCountry.error', error);\r\n }\r\n return (defaultMarket || process.env.DEFAULT_MARKET) as string;\r\n}\r\n\r\nasync function getMarkets() {\r\n const apiGet = storeStrategy === StoreStrategy.DecoratedApi ? localApiGet : storeApiGet;\r\n const markets: IMarket[] = await apiGet('/market?pagination=false');\r\n return markets;\r\n}\r\n\r\nasync function getRootRoutes() {\r\n const apiGet = storeStrategy === StoreStrategy.DecoratedApi ? localApiGet : storeApiGet;\r\n const routes: IRoute[] = await apiGet('/route?where[isRoot][equals]=true');\r\n return routes;\r\n}\r\n\r\nexport async function routeAutoDetection(request: NextRequest, next: NextFetchEvent): Promise<string | undefined> {\r\n let route: string | undefined;\r\n const url = request.nextUrl;\r\n if (url.pathname === '/') {\r\n const cookie = request.cookies.get('detectedRoute');\r\n if (cookie?.value) {\r\n return cookie.value;\r\n }\r\n // console.log('routeInterceptor.routeAutoDetection', url.pathname);\r\n const rootRoutes = await getRootRoutes();\r\n // console.log('routeInterceptor.routeAutoDetection.rootRoutes', rootRoutes);\r\n const defaultRoute = rootRoutes.find(x => x.id === '/');\r\n // console.log('routeInterceptor.routeAutoDetection.defaultRoute', defaultRoute);\r\n if (defaultRoute) {\r\n return;\r\n }\r\n const markets = await getMarkets();\r\n // console.log('routeInterceptor.routeAutoDetection.markets', markets);\r\n const market = markets.find(x => x.isDefault) || markets.find(x => x.id === defaultMarket) || markets[0];\r\n // console.log('routeInterceptor.routeAutoDetection.market', market);\r\n const detectedCountry = await detectCountry(request, market.id);\r\n // console.log('routeInterceptor.routeAutoDetection.detectedCountry', detectedCountry);\r\n const detectedMarket = detectedCountry ? (\r\n markets.filter(x => Array.isArray(x.countries)).find(x => {\r\n const countries: string[] = (x.countries || []).map(x => typeof x === 'string' ? x : x.id as string);\r\n return countries.includes(detectedCountry);\r\n }) ||\r\n markets.find(x => !Array.isArray(x.countries))\r\n ) : undefined;\r\n // console.log('routeInterceptor.routeAutoDetection.detectedMarket', detectedMarket);\r\n let detectedMarketRoutes = rootRoutes.filter(x => x.market === detectedMarket?.id);\r\n if (detectedMarketRoutes.length === 0) {\r\n detectedMarketRoutes = rootRoutes.filter(x => x.market === market.id);\r\n }\r\n // console.log('routeInterceptor.routeAutoDetection.detectedMarketRoutes', detectedMarketRoutes);\r\n const defaultMarketLocale = market.defaultLanguage ? (\r\n typeof market.defaultLanguage === 'string' ? market.defaultLanguage : market.defaultLanguage.id\r\n ) as string : defaultLocale;\r\n // console.log('routeInterceptor.routeAutoDetection.defaultMarketLocale', defaultMarketLocale);\r\n const detectedLocale = await detectLocale(request, defaultMarketLocale);\r\n // console.log('routeInterceptor.routeAutoDetection.detectedLocale', detectedLocale);\r\n const detectedLocaleRoutes = detectedMarketRoutes.filter(x => x.locale === detectedLocale);\r\n const detectedRoute =\r\n detectedLocaleRoutes.length > 0 ?\r\n detectedLocaleRoutes[0]! :\r\n detectedMarketRoutes.find(x => {\r\n const market = markets.find(m => m.id === x.market)!;\r\n const marketLocale = (market.defaultLanguage ? asEquatable(market.defaultLanguage as string) : defaultMarketLocale);\r\n return x.locale === marketLocale;\r\n })!;\r\n // console.log('routeInterceptor.routeAutoDetection.detectedRoute', detectedRoute);\r\n if (detectedRoute && detectedRoute.id !== url.pathname) {\r\n console.log('routeInterceptor.routeAutoDetection', detectedLocale, detectedCountry, detectedRoute.id);\r\n route = detectedRoute.id;\r\n }\r\n // console.log('routeInterceptor.routeAutoDetection', locale, detectedCountry, rootRoutes);\r\n }\r\n return route;\r\n}\r\n\r\nexport async function routeInterceptor(request: NextRequest, next: NextFetchEvent) {\r\n let route: IRoute | undefined;\r\n let url = request.nextUrl;\r\n const hrefBeforeRedirect = getHrefBeforeRedirect(request);\r\n // console.log('routeInterceptor._live', request.nextUrl.searchParams.get('_live'));\r\n try {\r\n const redirectUrl = await routeAutoDetection(request, next);\r\n // console.log('routeInterceptor.routeAutoDetection', redirectUrl);\r\n if (redirectUrl) {\r\n // console.log('routeInterceptor', 'redirectUrl', redirectUrl);\r\n const resolvedUrl = resolveHref(redirectUrl);\r\n // console.log('routeInterceptor', 'resolvedUrl', resolvedUrl);\r\n const search = request.nextUrl.search;\r\n /*\r\n // !!! always return a temporary redirect\r\n const isTemporaryRedirect = isDevelopment || search;\r\n const response = NextResponse.redirect(resolvedUrl + search, { status: isTemporaryRedirect ? 307 : 308 });\r\n */\r\n const response = NextResponse.redirect(resolvedUrl + search, { status: 307 });\r\n response.cookies.set({\r\n expires: new Date(Date.now() + 1 * 24 * 60 * 60 * 1000),\r\n httpOnly: true,\r\n name: 'detectedRoute',\r\n path: '/',\r\n sameSite: 'lax',\r\n secure: true,\r\n value: redirectUrl,\r\n });\r\n return response;\r\n }\r\n // console.log('routeInterceptor request.cookies', request.cookies);\r\n // console.log('routeInterceptor', url.pathname);\r\n if (storeStrategy === StoreStrategy.DecoratedApi) {\r\n route = await localApiPost('/route', { pathname: url.pathname, href: url.href, hrefBeforeRedirect });\r\n } else {\r\n route = await storeApiPost('/route', { pathname: url.pathname, href: url.href, hrefBeforeRedirect });\r\n }\r\n // console.log('route', route);\r\n if (!route) {\r\n console.log('routeInterceptor.route.notfound', url.pathname);\r\n return;\r\n }\r\n } catch (error: any) {\r\n if (error.status >= 300 && error.status < 400) {\r\n console.log('routeInterceptor.3xx', url.pathname, error.status, error.statusText);\r\n try {\r\n const { redirectUrl } = await error.json();\r\n // console.log('redirectUrl', redirectUrl);\r\n const response = NextResponse.redirect(redirectUrl, error.status);\r\n return response;\r\n } catch (error) {\r\n const publicUrl = getPublicUrl();\r\n console.log('routeInterceptor.3xx.error', `cannot parse response, redirecting to ${publicUrl}`);\r\n const response = NextResponse.redirect(publicUrl, 307);\r\n return response;\r\n }\r\n } else if (error.status === 410) {\r\n console.log('routeInterceptor.410', url.pathname, error.status, error.statusText);\r\n url = request.nextUrl.clone();\r\n url.pathname = `/${error.status}`;\r\n const response = NextResponse.rewrite(url, {\r\n status: error.status,\r\n statusText: error.statusText,\r\n request,\r\n });\r\n return response;\r\n } else if (error.status >= 400 && error.status < 500) {\r\n console.log('routeInterceptor.4xx', url.pathname, error.status, error.statusText);\r\n const response = NextResponse.next({\r\n status: error.status,\r\n statusText: error.statusText,\r\n request,\r\n });\r\n return response;\r\n }\r\n console.log('routeInterceptor.error', url.pathname, error.url, error.status, error.statusText || error);\r\n return;\r\n }\r\n // console.log('routeInterceptor.route.found', url.pathname, '->', route);\r\n url = request.nextUrl.clone();\r\n const resolvedPathname = resolveRoute(route);\r\n // console.log('resolvedPathname', resolvedPathname);\r\n url.pathname = resolvedPathname;\r\n // console.log('routeInterceptor.route', route.schema, route.page, route.market, route.locale);\r\n const response = NextResponse.rewrite(url);\r\n // const response = NextResponse.redirect(url);\r\n return response;\r\n}\r\n\r\nfunction getHrefBeforeRedirect(request: NextRequest): string | null {\r\n let hrefBeforeRedirect: string | null = null;\r\n const urlBeforeRedirect = request.nextUrl.clone();\r\n const host = getHost(request.headers);\r\n if (host) {\r\n urlBeforeRedirect.host = host;\r\n urlBeforeRedirect.port = host.split(':')[1] || '';\r\n hrefBeforeRedirect = urlBeforeRedirect.href;\r\n }\r\n return hrefBeforeRedirect;\r\n}\r\n"],"mappings":";;;;;;;AAMA,eAAsB,aAAaA,SAAsBC,iBAAwB;CAC/E,MAAM,iBAAiB,QAAQ,QAAQ,IAAI,kBAAkB,EAAE,MAAM,IAAI,CAAC;CAC1E,MAAM,iBAAiB,QAAQ,QAAQ,IAAI,cAAc,EAAE,SAAS,kBAAkBC,mBAAiB,QAAQ,IAAI;AACnH,QAAO;AACR;AAED,eAAsB,cAAcF,SAAsBG,iBAAwB;CAChF,IAAI,KAAK,QAAQ,QAAQ,IAAI,kBAAkB,IAAI,QAAQ,QAAQ,IAAI,YAAY;AACnF,KAAI,IACF,KAAK,GAAG,MAAM,IAAI,CAAC;CAErB,MAAM,YAAY,IAAI,MAAM,mCAAmC;CAC/D,IAAI,kBAAkB;AACtB,KAAI;EACF,MAAM,QA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GAC/B,QAAQ,IAAI,wBAAwB,IAAI,UAAU,MAAM,QAAQ,MAAM,WAAW;GACjF,MAAM,QAAQ,QAAQ,OAAO;GAC7B,IAAI,WAAW,CAAC,CAAC,EAAE,MAAM,QAAQ;GACjC,MAAMA,aAAW,aAAa,QAAQ,KAAK;IACzC,QAAQ,MAAM;IACd,YAAY,MAAM;IAClB;GACD,EAAC;AACF,UAAOA;EACR,WAAU,MAAM,UAAU,OAAO,MAAM,SAAS,KAAK;GACpD,QAAQ,IAAI,wBAAwB,IAAI,UAAU,MAAM,QAAQ,MAAM,WAAW;GACjF,MAAMA,aAAW,aAAa,KAAK;IACjC,QAAQ,MAAM;IACd,YAAY,MAAM;IAClB;GACD,EAAC;AACF,UAAOA;EACR;EACD,QAAQ,IAAI,0BAA0B,IAAI,UAAU,MAAM,KAAK,MAAM,QAAQ,MAAM,cAAc,MAAM;AACvG;CACD;CAED,MAAM,QAAQ,QAAQ,OAAO;CAC7B,MAAM,mBAAmB,aAAa,MAAM;CAE5C,IAAI,WAAW;CAEf,MAAM,WAAW,aAAa,QAAQ,IAAI;AAE1C,QAAO;AACR;AAED,SAAS,sBAAsBb,SAAqC;CAClE,IAAIgB,qBAAoC;CACxC,MAAM,oBAAoB,QAAQ,QAAQ,OAAO;CACjD,MAAM,OAAO,QAAQ,QAAQ,QAAQ;AACrC,KAAI,MAAM;EACR,kBAAkB,OAAO;EACzB,kBAAkB,OAAO,KAAK,MAAM,IAAI,CAAC,MAAM;EAC/C,qBAAqB,kBAAkB;CACxC;AACD,QAAO;AACR"}
|
|
1
|
+
{"version":3,"file":"proxy.js","names":[],"sources":["../../src/route/route.interceptor.ts"],"sourcesContent":["import { IMarket, IRoute, asEquatable, defaultLocale, defaultMarket, getHost } from '@websolutespa/bom-core';\r\nimport { StoreStrategy, localApiGet, localApiPost, storeApiGet, storeApiPost, storeStrategy } from '@websolutespa/bom-mixer-store';\r\nimport { NextFetchEvent, NextRequest, NextResponse } from 'next/server';\r\nimport { getPublicUrl, resolveHref } from '../page/page';\r\nimport { resolveRoute } from './route';\r\n\r\nexport async function detectLocale(request: NextRequest, defaultLocale?: string) {\r\n const acceptLanguage = request.headers.get('accept-language')?.split(',')[0];\r\n const detectedLocale = request.cookies.get('NEXT_LOCALE')?.value || acceptLanguage || defaultLocale || process.env.DEFAULT_LOCALE;\r\n return detectedLocale as string;\r\n}\r\n\r\nexport async function detectCountry(request: NextRequest, defaultMarket?: string) {\r\n let ip = request.headers.get('x-forwarded-for') || request.headers.get('x-real-ip');\r\n if (ip) {\r\n ip = ip.split(',')[0];\r\n }\r\n const isValidIp = ip?.match(/^(\\d+?)\\.(\\d+?)\\.(\\d+?)\\.(\\d+?)$/);\r\n let detectedCountry = '';\r\n try {\r\n const token = process.env.IPINFO_TOKEN;\r\n if (token) {\r\n const url = isValidIp ?\r\n `https://api.ipinfo.io/lite/${ip}/country_code?token=${token}` :\r\n `https://api.ipinfo.io/lite/me/country_code?token=${token}`;\r\n const response = await fetch(url);\r\n if (response.ok) {\r\n const data = await response.text();\r\n detectedCountry = data.toLowerCase();\r\n }\r\n } else {\r\n const url = `https://geoip.websolute.it/Ip2Location/get_info.aspx?ipaddress=${isValidIp ? ip : ''}`;\r\n const response = await fetch(url);\r\n if (response.ok) {\r\n const xml = await response.text();\r\n detectedCountry = (\r\n ((xml.split('<CountryCode><![CDATA[')[1] || '').split(']]></CountryCode>')[0] || '')\r\n ).replace('-', '').toLowerCase();\r\n // console.log('detectedCountry', detectedCountry);\r\n }\r\n }\r\n // console.log('routeInterceptor.detectCountry', detectedCountry);\r\n return detectedCountry || defaultMarket || process.env.DEFAULT_MARKET;\r\n } catch (error) {\r\n console.log('routeInterceptor.detectCountry.error', error);\r\n }\r\n return (defaultMarket || process.env.DEFAULT_MARKET) as string;\r\n}\r\n\r\nasync function getMarkets() {\r\n const apiGet = storeStrategy === StoreStrategy.DecoratedApi ? localApiGet : storeApiGet;\r\n const markets: IMarket[] = await apiGet('/market?pagination=false');\r\n return markets;\r\n}\r\n\r\nasync function getRootRoutes() {\r\n const apiGet = storeStrategy === StoreStrategy.DecoratedApi ? localApiGet : storeApiGet;\r\n const routes: IRoute[] = await apiGet('/route?where[isRoot][equals]=true');\r\n return routes;\r\n}\r\n\r\nexport async function routeAutoDetection(request: NextRequest, next: NextFetchEvent): Promise<string | undefined> {\r\n let route: string | undefined;\r\n const url = request.nextUrl;\r\n if (url.pathname === '/') {\r\n const cookie = request.cookies.get('detectedRoute');\r\n if (cookie?.value) {\r\n return cookie.value;\r\n }\r\n // console.log('routeInterceptor.routeAutoDetection', url.pathname);\r\n const rootRoutes = await getRootRoutes();\r\n // console.log('routeInterceptor.routeAutoDetection.rootRoutes', rootRoutes);\r\n const defaultRoute = rootRoutes.find(x => x.id === '/');\r\n // console.log('routeInterceptor.routeAutoDetection.defaultRoute', defaultRoute);\r\n if (defaultRoute) {\r\n return;\r\n }\r\n const markets = await getMarkets();\r\n // console.log('routeInterceptor.routeAutoDetection.markets', markets);\r\n const market = markets.find(x => x.isDefault) || markets.find(x => x.id === defaultMarket) || markets[0];\r\n // console.log('routeInterceptor.routeAutoDetection.market', market);\r\n const detectedCountry = await detectCountry(request, market.id);\r\n // console.log('routeInterceptor.routeAutoDetection.detectedCountry', detectedCountry);\r\n const detectedMarket = detectedCountry ? (\r\n markets.filter(x => Array.isArray(x.countries)).find(x => {\r\n const countries: string[] = (x.countries || []).map(x => typeof x === 'string' ? x : x.id as string);\r\n return countries.includes(detectedCountry);\r\n }) ||\r\n markets.find(x => !Array.isArray(x.countries))\r\n ) : undefined;\r\n // console.log('routeInterceptor.routeAutoDetection.detectedMarket', detectedMarket);\r\n let detectedMarketRoutes = rootRoutes.filter(x => x.market === detectedMarket?.id);\r\n if (detectedMarketRoutes.length === 0) {\r\n detectedMarketRoutes = rootRoutes.filter(x => x.market === market.id);\r\n }\r\n // console.log('routeInterceptor.routeAutoDetection.detectedMarketRoutes', detectedMarketRoutes);\r\n const defaultMarketLocale = market.defaultLanguage ? (\r\n typeof market.defaultLanguage === 'string' ? market.defaultLanguage : market.defaultLanguage.id\r\n ) as string : defaultLocale;\r\n // console.log('routeInterceptor.routeAutoDetection.defaultMarketLocale', defaultMarketLocale);\r\n const detectedLocale = await detectLocale(request, defaultMarketLocale);\r\n // console.log('routeInterceptor.routeAutoDetection.detectedLocale', detectedLocale);\r\n const detectedLocaleRoutes = detectedMarketRoutes.filter(x => x.locale === detectedLocale);\r\n const detectedRoute =\r\n detectedLocaleRoutes.length > 0 ?\r\n detectedLocaleRoutes[0]! :\r\n detectedMarketRoutes.find(x => {\r\n const market = markets.find(m => m.id === x.market)!;\r\n const marketLocale = (market.defaultLanguage ? asEquatable(market.defaultLanguage as string) : defaultMarketLocale);\r\n return x.locale === marketLocale;\r\n })!;\r\n // console.log('routeInterceptor.routeAutoDetection.detectedRoute', detectedRoute);\r\n if (detectedRoute && detectedRoute.id !== url.pathname) {\r\n console.log('routeInterceptor.routeAutoDetection', detectedLocale, detectedCountry, detectedRoute.id);\r\n route = detectedRoute.id;\r\n }\r\n // console.log('routeInterceptor.routeAutoDetection', locale, detectedCountry, rootRoutes);\r\n }\r\n return route;\r\n}\r\n\r\nexport async function routeInterceptor(request: NextRequest, next: NextFetchEvent) {\r\n let route: IRoute | undefined;\r\n let url = request.nextUrl;\r\n const hrefBeforeRedirect = getHrefBeforeRedirect(request);\r\n // console.log('routeInterceptor._live', request.nextUrl.searchParams.get('_live'));\r\n try {\r\n const redirectUrl = await routeAutoDetection(request, next);\r\n // console.log('routeInterceptor.routeAutoDetection', redirectUrl);\r\n if (redirectUrl) {\r\n // console.log('routeInterceptor', 'redirectUrl', redirectUrl);\r\n const resolvedUrl = resolveHref(redirectUrl);\r\n // console.log('routeInterceptor', 'resolvedUrl', resolvedUrl);\r\n const search = request.nextUrl.search;\r\n /*\r\n // !!! always return a temporary redirect\r\n const isTemporaryRedirect = isDevelopment || search;\r\n const response = NextResponse.redirect(resolvedUrl + search, { status: isTemporaryRedirect ? 307 : 308 });\r\n */\r\n const response = NextResponse.redirect(resolvedUrl + search, { status: 307 });\r\n response.cookies.set({\r\n expires: new Date(Date.now() + 1 * 24 * 60 * 60 * 1000),\r\n httpOnly: true,\r\n name: 'detectedRoute',\r\n path: '/',\r\n sameSite: 'lax',\r\n secure: true,\r\n value: redirectUrl,\r\n });\r\n return response;\r\n }\r\n // console.log('routeInterceptor request.cookies', request.cookies);\r\n // console.log('routeInterceptor', url.pathname);\r\n if (storeStrategy === StoreStrategy.DecoratedApi) {\r\n route = await localApiPost('/route', { pathname: url.pathname, href: url.href, hrefBeforeRedirect });\r\n } else {\r\n route = await storeApiPost('/route', { pathname: url.pathname, href: url.href, hrefBeforeRedirect });\r\n }\r\n // console.log('route', route);\r\n if (!route) {\r\n console.log('routeInterceptor.route.notfound', url.pathname);\r\n return;\r\n }\r\n } catch (error: any) {\r\n if (error.status >= 300 && error.status < 400) {\r\n console.log('routeInterceptor.3xx', url.pathname, error.status, error.statusText);\r\n try {\r\n const { redirectUrl } = await error.json();\r\n // console.log('redirectUrl', redirectUrl);\r\n const response = NextResponse.redirect(redirectUrl, error.status);\r\n return response;\r\n } catch (error) {\r\n const publicUrl = getPublicUrl();\r\n console.log('routeInterceptor.3xx.error', `cannot parse response, redirecting to ${publicUrl}`);\r\n const response = NextResponse.redirect(publicUrl, 307);\r\n return response;\r\n }\r\n } else if (error.status === 410) {\r\n console.log('routeInterceptor.410', url.pathname, error.status, error.statusText);\r\n url = request.nextUrl.clone();\r\n url.pathname = `/${error.status}`;\r\n const response = NextResponse.rewrite(url, {\r\n status: error.status,\r\n statusText: error.statusText,\r\n request,\r\n });\r\n return response;\r\n } else if (error.status >= 400 && error.status < 500) {\r\n console.log('routeInterceptor.4xx', url.pathname, error.status, error.statusText);\r\n const response = NextResponse.next({\r\n status: error.status,\r\n statusText: error.statusText,\r\n request,\r\n });\r\n return response;\r\n }\r\n console.log('routeInterceptor.error', url.pathname, error.url, error.status, error.statusText || error);\r\n return;\r\n }\r\n // console.log('routeInterceptor.route.found', url.pathname, '->', route);\r\n url = request.nextUrl.clone();\r\n const resolvedPathname = resolveRoute(route);\r\n // console.log('resolvedPathname', resolvedPathname);\r\n url.pathname = resolvedPathname;\r\n // console.log('routeInterceptor.route', route.schema, route.page, route.market, route.locale);\r\n const response = NextResponse.rewrite(url);\r\n // const response = NextResponse.redirect(url);\r\n return response;\r\n}\r\n\r\nfunction getHrefBeforeRedirect(request: NextRequest): string | null {\r\n let hrefBeforeRedirect: string | null = null;\r\n const urlBeforeRedirect = request.nextUrl.clone();\r\n const host = getHost(request.headers);\r\n if (host) {\r\n urlBeforeRedirect.host = host;\r\n urlBeforeRedirect.port = host.split(':')[1] || '';\r\n hrefBeforeRedirect = urlBeforeRedirect.href;\r\n }\r\n return hrefBeforeRedirect;\r\n}\r\n"],"mappings":";;;;;;AAMA,eAAsB,aAAa,SAAsB,eAAwB;CAC/E,MAAM,iBAAiB,QAAQ,QAAQ,IAAI,kBAAkB,EAAE,MAAM,IAAI,CAAC;AAE1E,QADuB,QAAQ,QAAQ,IAAI,cAAc,EAAE,SAAS,kBAAkB,iBAAiB,QAAQ,IAAI;;AAIrH,eAAsB,cAAc,SAAsB,eAAwB;CAChF,IAAI,KAAK,QAAQ,QAAQ,IAAI,kBAAkB,IAAI,QAAQ,QAAQ,IAAI,YAAY;AACnF,KAAI,GACF,MAAK,GAAG,MAAM,IAAI,CAAC;CAErB,MAAM,YAAY,IAAI,MAAM,mCAAmC;CAC/D,IAAI,kBAAkB;AACtB,KAAI;EACF,MAAM,QAAQ,QAAQ,IAAI;AAC1B,MAAI,OAAO;GACT,MAAM,MAAM,YACV,8BAA8B,GAAG,sBAAsB,UACvD,oDAAoD;GACtD,MAAM,WAAW,MAAM,MAAM,IAAI;AACjC,OAAI,SAAS,GAEX,oBADa,MAAM,SAAS,MAAM,EACX,aAAa;SAEjC;GACL,MAAM,MAAM,kEAAkE,YAAY,KAAK;GAC/F,MAAM,WAAW,MAAM,MAAM,IAAI;AACjC,OAAI,SAA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ACxC,MAAM,oBAAoB,QAAQ,QAAQ,OAAO;CACjD,MAAM,OAAO,QAAQ,QAAQ,QAAQ;AACrC,KAAI,MAAM;AACR,oBAAkB,OAAO;AACzB,oBAAkB,OAAO,KAAK,MAAM,IAAI,CAAC,MAAM;AAC/C,uBAAqB,kBAAkB;;AAEzC,QAAO"}
|
package/dist/exports/server.d.ts
CHANGED
|
@@ -1,71 +1,59 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { c as ILazyStaticPropsFunc, f as IConsentPreference, h as IAddressOptions, s as ILazyStaticProps } from "../lazy-CoUsrocX.js";
|
|
2
2
|
import { IApp, IAppExtended, ICategorized, ICategory, IComponent, IEquatable, ILabel, ILayout, ILocale, IMarket, IMenu, INamedEntity, IPage, IPaginationResult, IRedirect, IRoute, IRouteLink, PageProps, QueryParams } from "@websolutespa/bom-core";
|
|
3
|
-
import { NextRequest, NextResponse } from "next/server";
|
|
4
3
|
import * as _websolutespa_bom_mixer_store_server0 from "@websolutespa/bom-mixer-store/server";
|
|
5
4
|
import { IronSession } from "iron-session";
|
|
5
|
+
import { NextRequest, NextResponse } from "next/server";
|
|
6
6
|
import { GetServerSideProps, NextApiRequest, NextApiResponse, Redirect } from "next";
|
|
7
7
|
import { IncomingMessage, ServerResponse } from "http";
|
|
8
8
|
|
|
9
9
|
//#region src/address/address.service.d.ts
|
|
10
10
|
declare function getAddressOptions(locale: string): Promise<IAddressOptions>;
|
|
11
|
-
//# sourceMappingURL=address.service.d.ts.map
|
|
12
11
|
//#endregion
|
|
13
12
|
//#region src/app/app.service.d.ts
|
|
14
13
|
declare function getApp<T extends IAppExtended = IAppExtended>(params?: QueryParams): Promise<IApp<T> | undefined>;
|
|
15
|
-
//# sourceMappingURL=app.service.d.ts.map
|
|
16
14
|
//#endregion
|
|
17
15
|
//#region src/captions/captions.handler.d.ts
|
|
18
16
|
declare const getCaptionsVttProps: GetServerSideProps;
|
|
19
|
-
//# sourceMappingURL=captions.handler.d.ts.map
|
|
20
17
|
//#endregion
|
|
21
18
|
//#region src/category/category.service.d.ts
|
|
22
19
|
declare function getCategories(params?: QueryParams): Promise<ICategory[]>;
|
|
23
20
|
declare function getCategory(id: IEquatable, params?: QueryParams): Promise<ICategory | undefined>;
|
|
24
21
|
declare function getSegments(item: ICategorized, params?: QueryParams): Promise<ICategory[]>;
|
|
25
|
-
//# sourceMappingURL=category.service.d.ts.map
|
|
26
22
|
//#endregion
|
|
27
23
|
//#region src/consent_preference/consent_preference.service.d.ts
|
|
28
24
|
declare function getConsentPreference(id: IEquatable, params?: QueryParams): Promise<IConsentPreference | undefined>;
|
|
29
25
|
declare function getConsentPreferences(params?: QueryParams): Promise<IConsentPreference[]>;
|
|
30
26
|
declare function getConsentPreferencesPagination(params?: QueryParams): Promise<IPaginationResult<IConsentPreference>>;
|
|
31
|
-
//# sourceMappingURL=consent_preference.service.d.ts.map
|
|
32
27
|
//#endregion
|
|
33
28
|
//#region src/country/country.service.d.ts
|
|
34
29
|
declare function getCountries(locale?: string): Promise<INamedEntity[]>;
|
|
35
30
|
declare function getCountry(id: IEquatable, params?: QueryParams): Promise<INamedEntity | undefined>;
|
|
36
31
|
declare function getCountriesPagination(params?: QueryParams): Promise<IPaginationResult<INamedEntity>>;
|
|
37
|
-
//# sourceMappingURL=country.service.d.ts.map
|
|
38
32
|
//#endregion
|
|
39
33
|
//#region src/label/label.service.d.ts
|
|
40
34
|
declare function getLabels(params?: QueryParams): Promise<ILabel[]>;
|
|
41
35
|
declare function getLabel(id: IEquatable, params?: QueryParams): Promise<ILabel | undefined>;
|
|
42
36
|
declare function resolveLabel(labels: ILabel[], id: string): string;
|
|
43
|
-
//# sourceMappingURL=label.service.d.ts.map
|
|
44
37
|
//#endregion
|
|
45
38
|
//#region src/layout/layout.service.d.ts
|
|
46
39
|
declare function getLayout<T extends IAppExtended = IAppExtended>(market: string, locale: string): Promise<ILayout<T>>;
|
|
47
|
-
//# sourceMappingURL=layout.service.d.ts.map
|
|
48
40
|
//#endregion
|
|
49
41
|
//#region src/lazy/lazy.service.d.ts
|
|
50
42
|
declare const LAZY_PROPS: ILazyStaticProps;
|
|
51
43
|
declare function withLazyProps<T>(key: string, getComponentProps: ILazyStaticPropsFunc<T>): Promise<void>;
|
|
52
44
|
declare function getDecoratedComponents(props: PageProps, extraComponents?: IComponent[]): Promise<void>;
|
|
53
|
-
//# sourceMappingURL=lazy.service.d.ts.map
|
|
54
45
|
//#endregion
|
|
55
46
|
//#region src/locale/locale.service.d.ts
|
|
56
47
|
declare function getLocales(params?: QueryParams): Promise<ILocale[]>;
|
|
57
48
|
declare function getLocale(id: IEquatable, params?: QueryParams): Promise<ILocale | undefined>;
|
|
58
|
-
//# sourceMappingURL=locale.service.d.ts.map
|
|
59
49
|
//#endregion
|
|
60
50
|
//#region src/market/market.service.d.ts
|
|
61
51
|
declare function getMarkets(params?: QueryParams): Promise<IMarket[]>;
|
|
62
52
|
declare function getMarket(id: IEquatable, params?: QueryParams): Promise<IMarket | undefined>;
|
|
63
|
-
//# sourceMappingURL=market.service.d.ts.map
|
|
64
53
|
//#endregion
|
|
65
54
|
//#region src/menu/menu.service.d.ts
|
|
66
55
|
declare function getMenus(params?: QueryParams): Promise<IMenu[]>;
|
|
67
56
|
declare function getMenu(id: IEquatable, params?: QueryParams): Promise<IMenu | undefined>;
|
|
68
|
-
//# sourceMappingURL=menu.service.d.ts.map
|
|
69
57
|
//#endregion
|
|
70
58
|
//#region src/page/page.service.d.ts
|
|
71
59
|
declare function findOnePage<T extends ICategorized = ICategorized>(schema: string, id: IEquatable, params?: QueryParams): Promise<T | undefined>;
|
|
@@ -91,13 +79,11 @@ type PartialPageProps<T extends ICategorized, B> = Omit<PageProps<T>, 'page'> &
|
|
|
91
79
|
declare function getPageProps<T extends ICategorized, B = any>(props: PartialPageProps<T, B>, extraComponents?: IComponent[]): Promise<PageProps<T> & B>;
|
|
92
80
|
declare function getPublicUrl(): string;
|
|
93
81
|
declare function resolveHref(href?: string): string;
|
|
94
|
-
//# sourceMappingURL=page.service.d.ts.map
|
|
95
82
|
//#endregion
|
|
96
83
|
//#region src/province/province.service.d.ts
|
|
97
84
|
declare function getProvinces(locale?: string): Promise<INamedEntity[]>;
|
|
98
85
|
declare function getProvince(id: IEquatable, params?: QueryParams): Promise<INamedEntity | undefined>;
|
|
99
86
|
declare function getProvincesPagination(params?: QueryParams): Promise<IPaginationResult<INamedEntity>>;
|
|
100
|
-
//# sourceMappingURL=province.service.d.ts.map
|
|
101
87
|
//#endregion
|
|
102
88
|
//#region src/redirect/redirect.service.d.ts
|
|
103
89
|
declare function getRedirects(locale?: string): Promise<IRedirect[]>;
|
|
@@ -109,17 +95,14 @@ declare function redirectTo(layout: ILayout, key?: string): {
|
|
|
109
95
|
destination: string;
|
|
110
96
|
};
|
|
111
97
|
};
|
|
112
|
-
//# sourceMappingURL=redirect.service.d.ts.map
|
|
113
98
|
//#endregion
|
|
114
99
|
//#region src/region/region.service.d.ts
|
|
115
100
|
declare function getRegions(locale?: string): Promise<INamedEntity[]>;
|
|
116
101
|
declare function getRegion(id: IEquatable, params?: QueryParams): Promise<INamedEntity | undefined>;
|
|
117
102
|
declare function getRegionsPagination(params?: QueryParams): Promise<IPaginationResult<INamedEntity>>;
|
|
118
|
-
//# sourceMappingURL=region.service.d.ts.map
|
|
119
103
|
//#endregion
|
|
120
104
|
//#region src/route/route-revalidate.handler.d.ts
|
|
121
105
|
declare function routeRevalidateHandler(): _websolutespa_bom_mixer_store_server0.IHandler<any>;
|
|
122
|
-
//# sourceMappingURL=route-revalidate.handler.d.ts.map
|
|
123
106
|
//#endregion
|
|
124
107
|
//#region src/route/route.service.d.ts
|
|
125
108
|
type StaticPath = {
|
|
@@ -143,7 +126,6 @@ declare function getStaticPathsForSchemaAndFallback(schema: string, fallback?: '
|
|
|
143
126
|
declare function getBreadcrumbFromSegments(segments: ICategory[], route: IRoute): Promise<IRouteLink[]>;
|
|
144
127
|
declare function getRouteLinkTree(market: string, locale: string): Promise<IRouteLink | undefined>;
|
|
145
128
|
declare function getRouteLinkCategory(locale: string, routes: IRoute[], categories: ICategory[], rootCategory: ICategory, category: ICategory): IRouteLink | IRouteLink[] | undefined;
|
|
146
|
-
//# sourceMappingURL=route.service.d.ts.map
|
|
147
129
|
//#endregion
|
|
148
130
|
//#region src/session/session.service.d.ts
|
|
149
131
|
declare function getSession<T extends object = Record<string, any>>(request: NextRequest | NextApiRequest | (IncomingMessage & {
|
|
@@ -160,13 +142,11 @@ declare function getSessionToken<T extends SessionWithToken>(request: NextReques
|
|
|
160
142
|
[key: string]: string;
|
|
161
143
|
}>;
|
|
162
144
|
}), response: NextResponse | NextApiResponse | ServerResponse<IncomingMessage>): Promise<string | undefined>;
|
|
163
|
-
//# sourceMappingURL=session.service.d.ts.map
|
|
164
145
|
//#endregion
|
|
165
146
|
//#region src/sitemap/sitemap.handler.d.ts
|
|
166
147
|
declare const getSiteMapIndexProps: GetServerSideProps;
|
|
167
148
|
declare const getSiteMapXMLProps: GetServerSideProps;
|
|
168
149
|
declare const getSiteMapXSLProps: GetServerSideProps;
|
|
169
|
-
//# sourceMappingURL=sitemap.handler.d.ts.map
|
|
170
150
|
//#endregion
|
|
171
151
|
//#region src/sitemap/sitemap.service.d.ts
|
|
172
152
|
type ISiteMap = {
|
|
@@ -177,8 +157,6 @@ declare function getSiteMapIndex(origin: string): Promise<string>;
|
|
|
177
157
|
declare function escapeHtml(string: string): string;
|
|
178
158
|
declare function getSiteMapXML(origin: string, marketId?: string, localeId?: string): Promise<string>;
|
|
179
159
|
declare function getSiteMapXSL(localeId?: string): Promise<string>;
|
|
180
|
-
//# sourceMappingURL=sitemap.service.d.ts.map
|
|
181
|
-
|
|
182
160
|
//#endregion
|
|
183
161
|
export { ISiteMap, LAZY_PROPS, NotFound, PartialPageProps, SessionWithToken, StaticPath, escapeHtml, findManyPages, findOnePage, getAddressOptions, getApp, getBreadcrumbFromSegments, getCaptionsVttProps, getCategories, getCategory, getConsentPreference, getConsentPreferences, getConsentPreferencesPagination, getCountries, getCountriesPagination, getCountry, getDecoratedComponents, getErrorPageLayout, getLabel, getLabels, getLayout, getLocale, getLocales, getMarket, getMarkets, getMenu, getMenus, getNotFoundRoute, getPage, getPageCategory, getPageProps, getPageRoutes, getProvince, getProvinces, getProvincesPagination, getPublicUrl, getRedirect, getRedirects, getRedirectsPagination, getRegion, getRegions, getRegionsPagination, getRoute, getRouteLinkCategory, getRouteLinkTree, getRoutes, getRoutesForSchemas, getRoutesForTemplates, getSchemaRoutes, getSegments, getSession, getSessionToken, getSiteMapIndex, getSiteMapIndexProps, getSiteMapXML, getSiteMapXMLProps, getSiteMapXSL, getSiteMapXSLProps, getStaticPathsForSchema, getStaticPathsForSchemaAndFallback, redirectTo, resolveHref, resolveLabel, routeRevalidateHandler, withLazyProps };
|
|
184
162
|
//# sourceMappingURL=server.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","names":[],"sources":["../../src/address/address.service.ts","../../src/app/app.service.ts","../../src/captions/captions.handler.ts","../../src/category/category.service.ts","../../src/consent_preference/consent_preference.service.ts","../../src/country/country.service.ts","../../src/label/label.service.ts","../../src/layout/layout.service.ts","../../src/lazy/lazy.service.ts","../../src/locale/locale.service.ts","../../src/market/market.service.ts","../../src/menu/menu.service.ts","../../src/page/page.service.ts","../../src/province/province.service.ts","../../src/redirect/redirect.service.ts","../../src/region/region.service.ts","../../src/route/route-revalidate.handler.ts","../../src/route/route.service.ts","../../src/session/session.service.ts","../../src/sitemap/sitemap.handler.ts","../../src/sitemap/sitemap.service.ts"],"
|
|
1
|
+
{"version":3,"file":"server.d.ts","names":[],"sources":["../../src/address/address.service.ts","../../src/app/app.service.ts","../../src/captions/captions.handler.ts","../../src/category/category.service.ts","../../src/consent_preference/consent_preference.service.ts","../../src/country/country.service.ts","../../src/label/label.service.ts","../../src/layout/layout.service.ts","../../src/lazy/lazy.service.ts","../../src/locale/locale.service.ts","../../src/market/market.service.ts","../../src/menu/menu.service.ts","../../src/page/page.service.ts","../../src/province/province.service.ts","../../src/redirect/redirect.service.ts","../../src/region/region.service.ts","../../src/route/route-revalidate.handler.ts","../../src/route/route.service.ts","../../src/session/session.service.ts","../../src/sitemap/sitemap.handler.ts","../../src/sitemap/sitemap.service.ts"],"mappings":";;;;;;;;;iBAMsB,iBAAA,CAAkB,MAAA,WAAiB,OAAA,CAAQ,eAAA;;;iBCF3C,MAAA,WAAiB,YAAA,GAAe,YAAA,CAAA,CAAc,MAAA,GAAQ,WAAA,GAAmB,OAAA,CAAQ,IAAA,CAAK,CAAA;;;cCA/F,mBAAA,EAAqB,kBAAA;;;iBCAZ,aAAA,CAAc,MAAA,GAAQ,WAAA,GAAmB,OAAA,CAAQ,SAAA;AAAA,iBAMjD,WAAA,CAAY,EAAA,EAAI,UAAA,EAAY,MAAA,GAAQ,WAAA,GAAmB,OAAA,CAAQ,SAAA;AAAA,iBAM/D,WAAA,CAAY,IAAA,EAAM,YAAA,EAAc,MAAA,GAAQ,WAAA,GAAmB,OAAA,CAAQ,SAAA;;;iBCXnE,oBAAA,CAAqB,EAAA,EAAI,UAAA,EAAY,MAAA,GAAQ,WAAA,GAAmB,OAAA,CAAQ,kBAAA;AAAA,iBAMxE,qBAAA,CAAsB,MAAA,GAAQ,WAAA,GAAmB,OAAA,CAAQ,kBAAA;AAAA,iBAMzD,+BAAA,CAAgC,MAAA,GAAQ,WAAA,GAAmB,OAAA,CAAQ,iBAAA,CAAkB,kBAAA;;;iBCbrF,YAAA,CAAa,MAAA,YAAkB,OAAA,CAAQ,YAAA;AAAA,iBAMvC,UAAA,CAAW,EAAA,EAAI,UAAA,EAAY,MAAA,GAAQ,WAAA,GAAmB,OAAA,CAAQ,YAAA;AAAA,iBAM9D,sBAAA,CAAuB,MAAA,GAAQ,WAAA,GAAmB,OAAA,CAAQ,iBAAA,CAAkB,YAAA;;;iBCZ5E,SAAA,CAAU,MAAA,GAAQ,WAAA,GAAmB,OAAA,CAAQ,MAAA;AAAA,iBAM7C,QAAA,CAAS,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