@websolutespa/bom-mixer-models 2.0.1-next.0 → 3.0.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 +36 -5
- package/dist/exports/proxy.d.ts +12 -0
- package/dist/exports/proxy.d.ts.map +1 -0
- package/dist/exports/proxy.js +174 -0
- package/dist/exports/proxy.js.map +1 -0
- package/dist/exports/server.d.ts +184 -0
- package/dist/exports/server.d.ts.map +1 -0
- package/dist/exports/server.js +951 -0
- package/dist/exports/server.js.map +1 -0
- package/dist/index.d.ts +251 -296
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +39 -107
- package/dist/index.js.map +1 -0
- package/dist/lazy-JamSYYoh.d.ts +84 -0
- package/dist/lazy-JamSYYoh.d.ts.map +1 -0
- package/dist/page-BLbZbnWg.js +12 -0
- package/dist/page-BLbZbnWg.js.map +1 -0
- package/dist/route-k0W3AKyo.js +53 -0
- package/dist/route-k0W3AKyo.js.map +1 -0
- package/package.json +27 -14
- package/src/app/app.service.ts +9 -0
- package/src/exports/proxy.ts +2 -0
- package/src/exports/server.ts +1 -1
- package/src/layout/layout.service.ts +5 -2
- package/src/lazy/lazy.service.ts +1 -4
- package/src/page/page.service.ts +37 -0
- package/src/route/route-revalidate.handler.ts +1 -1
- package/src/route/route.interceptor.ts +142 -3
- package/src/session/session.service.ts +12 -4
- package/src/sitemap/sitemap.service.ts +5 -6
- package/src/store/store.ts +2 -1
- package/dist/index.cjs +0 -160
- package/dist/index.d.cts +0 -375
package/CHANGELOG.md
CHANGED
|
@@ -1,16 +1,47 @@
|
|
|
1
1
|
# @websolutespa/bom-mixer-models
|
|
2
2
|
|
|
3
|
-
##
|
|
3
|
+
## 3.0.0
|
|
4
4
|
|
|
5
5
|
### Major Changes
|
|
6
6
|
|
|
7
|
-
-
|
|
7
|
+
- Release: Bom 3.0
|
|
8
|
+
|
|
9
|
+
## 1.10.4
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Modified: routeInterceptor autoDetection temporary redirect development
|
|
14
|
+
|
|
15
|
+
## 1.10.3
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- Added: IApp global
|
|
20
|
+
- Updated dependencies
|
|
21
|
+
- @websolutespa/bom-mixer-store@1.10.1
|
|
22
|
+
- @websolutespa/bom-core@1.8.24
|
|
23
|
+
|
|
24
|
+
## 1.10.2
|
|
8
25
|
|
|
9
26
|
### Patch Changes
|
|
10
27
|
|
|
11
|
-
-
|
|
12
|
-
|
|
13
|
-
|
|
28
|
+
- Modified: https to geoip
|
|
29
|
+
|
|
30
|
+
## 1.10.1
|
|
31
|
+
|
|
32
|
+
### Patch Changes
|
|
33
|
+
|
|
34
|
+
- 0c7f05f: Added: routeInterceptor routeAutoDetection
|
|
35
|
+
- Updated dependencies [0c7f05f]
|
|
36
|
+
- @websolutespa/bom-core@1.8.23
|
|
37
|
+
|
|
38
|
+
## 1.10.0
|
|
39
|
+
|
|
40
|
+
### Patch Changes
|
|
41
|
+
|
|
42
|
+
- Modified: getPage, Removed: preview.handler
|
|
43
|
+
- Updated dependencies
|
|
44
|
+
- @websolutespa/bom-mixer-store@1.8.14
|
|
14
45
|
|
|
15
46
|
## 1.9.6
|
|
16
47
|
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { NextFetchEvent, NextRequest, NextResponse } from "next/server";
|
|
2
|
+
|
|
3
|
+
//#region src/route/route.interceptor.d.ts
|
|
4
|
+
declare function detectLocale(request: NextRequest, defaultLocale?: string): Promise<string>;
|
|
5
|
+
declare function detectCountry(request: NextRequest, defaultMarket?: string): Promise<string | undefined>;
|
|
6
|
+
declare function routeAutoDetection(request: NextRequest, next: NextFetchEvent): Promise<string | undefined>;
|
|
7
|
+
declare function routeInterceptor(request: NextRequest, next: NextFetchEvent): Promise<NextResponse<unknown> | undefined>;
|
|
8
|
+
//# sourceMappingURL=route.interceptor.d.ts.map
|
|
9
|
+
|
|
10
|
+
//#endregion
|
|
11
|
+
export { detectCountry, detectLocale, routeAutoDetection, routeInterceptor };
|
|
12
|
+
//# sourceMappingURL=proxy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"proxy.d.ts","names":[],"sources":["../../src/route/route.interceptor.ts"],"sourcesContent":[],"mappings":";;;iBAMsB,YAAA,UAAsB,sCAAmC;iBAMzD,aAAA,UAAuB,sCAAmC;AAN1D,iBA+DA,kBAAA,CA/DY,OAAA,EA+DgB,WA/DhB,EAAA,IAAA,EA+DmC,cA/DnC,CAAA,EA+DoD,OA/DpD,CAAA,MAAA,GAAA,SAAA,CAAA;AAAA,iBA4HZ,gBAAA,CA5HY,OAAA,EA4Hc,WA5Hd,EAAA,IAAA,EA4HiC,cA5HjC,CAAA,EA4H+C,OA5H/C,CA4H+C,YA5H/C,CAAA,OAAA,CAAA,GAAA,SAAA,CAAA"}
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import { getPublicUrl, resolveHref } from "../page-BLbZbnWg.js";
|
|
2
|
+
import { resolveRoute } from "../route-k0W3AKyo.js";
|
|
3
|
+
import { asEquatable, defaultLocale, defaultMarket, getHost, isDevelopment } from "@websolutespa/bom-core";
|
|
4
|
+
import { StoreStrategy, localApiGet, localApiPost, storeApiGet, storeApiPost, storeStrategy } from "@websolutespa/bom-mixer-store";
|
|
5
|
+
import { NextResponse } from "next/server";
|
|
6
|
+
|
|
7
|
+
//#region src/route/route.interceptor.ts
|
|
8
|
+
async function detectLocale(request, defaultLocale$1) {
|
|
9
|
+
const acceptLanguage = request.headers.get("accept-language")?.split(",")[0];
|
|
10
|
+
const detectedLocale = request.cookies.get("NEXT_LOCALE")?.value || acceptLanguage || defaultLocale$1 || process.env.DEFAULT_LOCALE;
|
|
11
|
+
return detectedLocale;
|
|
12
|
+
}
|
|
13
|
+
async function detectCountry(request, defaultMarket$1) {
|
|
14
|
+
let ip = request.headers.get("x-forwarded-for") || request.headers.get("x-real-ip");
|
|
15
|
+
if (ip) ip = ip.split(",")[0];
|
|
16
|
+
const isValidIp = ip?.match(/^(\d+?)\.(\d+?)\.(\d+?)\.(\d+?)$/);
|
|
17
|
+
let detectedCountry = "";
|
|
18
|
+
try {
|
|
19
|
+
const token = process.env.IPINFO_TOKEN;
|
|
20
|
+
if (token) {
|
|
21
|
+
const url = isValidIp ? `https://api.ipinfo.io/lite/${ip}/country_code?token=${token}` : `https://api.ipinfo.io/lite/me/country_code?token=${token}`;
|
|
22
|
+
const response = await fetch(url);
|
|
23
|
+
if (response.ok) {
|
|
24
|
+
const data = await response.text();
|
|
25
|
+
detectedCountry = data.toLowerCase();
|
|
26
|
+
}
|
|
27
|
+
} else {
|
|
28
|
+
const url = `https://geoip.websolute.it/Ip2Location/get_info.aspx?ipaddress=${isValidIp ? ip : ""}`;
|
|
29
|
+
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
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return detectedCountry || defaultMarket$1 || process.env.DEFAULT_MARKET;
|
|
36
|
+
} catch (error) {
|
|
37
|
+
console.log("routeInterceptor.detectCountry.error", error);
|
|
38
|
+
}
|
|
39
|
+
return defaultMarket$1 || process.env.DEFAULT_MARKET;
|
|
40
|
+
}
|
|
41
|
+
async function getMarkets() {
|
|
42
|
+
let routes = [];
|
|
43
|
+
if (storeStrategy === StoreStrategy.DecoratedApi) routes = await localApiGet("/market?pagination=false");
|
|
44
|
+
else routes = await storeApiGet("/market?pagination=false");
|
|
45
|
+
return routes;
|
|
46
|
+
}
|
|
47
|
+
async function getRootRoutes() {
|
|
48
|
+
let routes = [];
|
|
49
|
+
if (storeStrategy === StoreStrategy.DecoratedApi) routes = await localApiGet("/route?where[isRoot][equals]=true");
|
|
50
|
+
else routes = await storeApiGet("/route?where[isRoot][equals]=true");
|
|
51
|
+
return routes;
|
|
52
|
+
}
|
|
53
|
+
async function routeAutoDetection(request, next) {
|
|
54
|
+
let route;
|
|
55
|
+
const url = request.nextUrl;
|
|
56
|
+
if (url.pathname === "/") {
|
|
57
|
+
const cookie = request.cookies.get("detectedRoute");
|
|
58
|
+
if (cookie?.value) return cookie.value;
|
|
59
|
+
const rootRoutes = await getRootRoutes();
|
|
60
|
+
const defaultRoute = rootRoutes.find((x) => x.id === "/");
|
|
61
|
+
if (defaultRoute) return;
|
|
62
|
+
const markets = await getMarkets();
|
|
63
|
+
const market = markets.find((x) => x.isDefault) || markets.find((x) => x.id === defaultMarket) || markets[0];
|
|
64
|
+
const detectedCountry = await detectCountry(request, market.id);
|
|
65
|
+
const detectedMarket = detectedCountry ? markets.filter((x) => Array.isArray(x.countries)).find((x) => {
|
|
66
|
+
const countries = (x.countries || []).map((x$1) => typeof x$1 === "string" ? x$1 : x$1.id);
|
|
67
|
+
return countries.includes(detectedCountry);
|
|
68
|
+
}) || markets.find((x) => !Array.isArray(x.countries)) : void 0;
|
|
69
|
+
let detectedMarketRoutes = rootRoutes.filter((x) => x.market === detectedMarket?.id);
|
|
70
|
+
if (detectedMarketRoutes.length === 0) detectedMarketRoutes = rootRoutes.filter((x) => x.market === market.id);
|
|
71
|
+
const defaultMarketLocale = market.defaultLanguage ? typeof market.defaultLanguage === "string" ? market.defaultLanguage : market.defaultLanguage.id : defaultLocale;
|
|
72
|
+
const detectedLocale = await detectLocale(request, defaultMarketLocale);
|
|
73
|
+
const detectedLocaleRoutes = detectedMarketRoutes.filter((x) => x.locale === detectedLocale);
|
|
74
|
+
const detectedRoute = detectedLocaleRoutes.length > 0 ? detectedLocaleRoutes[0] : detectedMarketRoutes.find((x) => {
|
|
75
|
+
const market$1 = markets.find((m) => m.id === x.market);
|
|
76
|
+
const marketLocale = market$1.defaultLanguage ? asEquatable(market$1.defaultLanguage) : defaultMarketLocale;
|
|
77
|
+
return x.locale === marketLocale;
|
|
78
|
+
});
|
|
79
|
+
if (detectedRoute && detectedRoute.id !== url.pathname) {
|
|
80
|
+
console.log("routeInterceptor.routeAutoDetection", detectedLocale, detectedCountry, detectedRoute.id);
|
|
81
|
+
route = detectedRoute.id;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
return route;
|
|
85
|
+
}
|
|
86
|
+
async function routeInterceptor(request, next) {
|
|
87
|
+
let route;
|
|
88
|
+
let url = request.nextUrl;
|
|
89
|
+
const hrefBeforeRedirect = getHrefBeforeRedirect(request);
|
|
90
|
+
try {
|
|
91
|
+
const redirectUrl = await routeAutoDetection(request, next);
|
|
92
|
+
if (redirectUrl) {
|
|
93
|
+
const response$1 = NextResponse.redirect(resolveHref(redirectUrl), isDevelopment ? 307 : 301);
|
|
94
|
+
response$1.cookies.set({
|
|
95
|
+
expires: new Date(Date.now() + 1440 * 60 * 1e3),
|
|
96
|
+
httpOnly: true,
|
|
97
|
+
name: "detectedRoute",
|
|
98
|
+
path: "/",
|
|
99
|
+
sameSite: "lax",
|
|
100
|
+
secure: true,
|
|
101
|
+
value: redirectUrl
|
|
102
|
+
});
|
|
103
|
+
return response$1;
|
|
104
|
+
}
|
|
105
|
+
if (storeStrategy === StoreStrategy.DecoratedApi) route = await localApiPost("/route", {
|
|
106
|
+
pathname: url.pathname,
|
|
107
|
+
href: url.href,
|
|
108
|
+
hrefBeforeRedirect
|
|
109
|
+
});
|
|
110
|
+
else route = await storeApiPost("/route", {
|
|
111
|
+
pathname: url.pathname,
|
|
112
|
+
href: url.href,
|
|
113
|
+
hrefBeforeRedirect
|
|
114
|
+
});
|
|
115
|
+
if (!route) {
|
|
116
|
+
console.log("routeInterceptor.route.notfound", url.pathname);
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
} catch (error) {
|
|
120
|
+
if (error.status >= 300 && error.status < 400) {
|
|
121
|
+
console.log("routeInterceptor.3xx", url.pathname, error.status, error.statusText);
|
|
122
|
+
try {
|
|
123
|
+
const { redirectUrl } = await error.json();
|
|
124
|
+
const response$1 = NextResponse.redirect(redirectUrl, error.status);
|
|
125
|
+
return response$1;
|
|
126
|
+
} catch (error$1) {
|
|
127
|
+
const publicUrl = getPublicUrl();
|
|
128
|
+
console.log("routeInterceptor.3xx.error", `cannot parse response, redirecting to ${publicUrl}`);
|
|
129
|
+
const response$1 = NextResponse.redirect(publicUrl, 307);
|
|
130
|
+
return response$1;
|
|
131
|
+
}
|
|
132
|
+
} else if (error.status === 410) {
|
|
133
|
+
console.log("routeInterceptor.410", url.pathname, error.status, error.statusText);
|
|
134
|
+
url = request.nextUrl.clone();
|
|
135
|
+
url.pathname = `/${error.status}`;
|
|
136
|
+
const response$1 = NextResponse.rewrite(url, {
|
|
137
|
+
status: error.status,
|
|
138
|
+
statusText: error.statusText,
|
|
139
|
+
request
|
|
140
|
+
});
|
|
141
|
+
return response$1;
|
|
142
|
+
} else if (error.status >= 400 && error.status < 500) {
|
|
143
|
+
console.log("routeInterceptor.4xx", url.pathname, error.status, error.statusText);
|
|
144
|
+
const response$1 = NextResponse.next({
|
|
145
|
+
status: error.status,
|
|
146
|
+
statusText: error.statusText,
|
|
147
|
+
request
|
|
148
|
+
});
|
|
149
|
+
return response$1;
|
|
150
|
+
}
|
|
151
|
+
console.log("routeInterceptor.error", url.pathname, error.url, error.status, error.statusText || error);
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
url = request.nextUrl.clone();
|
|
155
|
+
const resolvedPathname = resolveRoute(route);
|
|
156
|
+
url.pathname = resolvedPathname;
|
|
157
|
+
const response = NextResponse.rewrite(url);
|
|
158
|
+
return response;
|
|
159
|
+
}
|
|
160
|
+
function getHrefBeforeRedirect(request) {
|
|
161
|
+
let hrefBeforeRedirect = null;
|
|
162
|
+
const urlBeforeRedirect = request.nextUrl.clone();
|
|
163
|
+
const host = getHost(request.headers);
|
|
164
|
+
if (host) {
|
|
165
|
+
urlBeforeRedirect.host = host;
|
|
166
|
+
urlBeforeRedirect.port = host.split(":")[1] || "";
|
|
167
|
+
hrefBeforeRedirect = urlBeforeRedirect.href;
|
|
168
|
+
}
|
|
169
|
+
return hrefBeforeRedirect;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
//#endregion
|
|
173
|
+
export { detectCountry, detectLocale, routeAutoDetection, routeInterceptor };
|
|
174
|
+
//# sourceMappingURL=proxy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"proxy.js","names":["request: NextRequest","defaultLocale?: string","defaultLocale","defaultMarket?: string","defaultMarket","routes: 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, isDevelopment } 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 let routes: IMarket[] = [];\r\n if (storeStrategy === StoreStrategy.DecoratedApi) {\r\n routes = await localApiGet('/market?pagination=false');\r\n } else {\r\n routes = await storeApiGet('/market?pagination=false');\r\n }\r\n return routes;\r\n}\r\n\r\nasync function getRootRoutes() {\r\n let routes: IRoute[] = [];\r\n if (storeStrategy === StoreStrategy.DecoratedApi) {\r\n routes = await localApiGet('/route?where[isRoot][equals]=true');\r\n } else {\r\n routes = await storeApiGet('/route?where[isRoot][equals]=true');\r\n }\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 // console.log('routeInterceptor.routeAutoDetection', url);\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 const response = NextResponse.redirect(resolveHref(redirectUrl), isDevelopment ? 307 : 301);\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,EAA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AAqB,kBAAkB;CACxC;AACD,QAAO;AACR"}
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
import { IAddressOptions, IConsentPreference, ILazyStaticProps, ILazyStaticPropsFunc } from "../lazy-JamSYYoh.js";
|
|
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
|
+
import * as _websolutespa_bom_mixer_store_server0 from "@websolutespa/bom-mixer-store/server";
|
|
5
|
+
import { IronSession } from "iron-session";
|
|
6
|
+
import { GetServerSideProps, NextApiRequest, NextApiResponse, Redirect } from "next";
|
|
7
|
+
import { IncomingMessage, ServerResponse } from "http";
|
|
8
|
+
|
|
9
|
+
//#region src/address/address.service.d.ts
|
|
10
|
+
declare function getAddressOptions(locale: string): Promise<IAddressOptions>;
|
|
11
|
+
//# sourceMappingURL=address.service.d.ts.map
|
|
12
|
+
//#endregion
|
|
13
|
+
//#region src/app/app.service.d.ts
|
|
14
|
+
declare function getApp<T extends IAppExtended = IAppExtended>(params?: QueryParams): Promise<IApp<T> | undefined>;
|
|
15
|
+
//# sourceMappingURL=app.service.d.ts.map
|
|
16
|
+
//#endregion
|
|
17
|
+
//#region src/captions/captions.handler.d.ts
|
|
18
|
+
declare const getCaptionsVttProps: GetServerSideProps;
|
|
19
|
+
//# sourceMappingURL=captions.handler.d.ts.map
|
|
20
|
+
//#endregion
|
|
21
|
+
//#region src/category/category.service.d.ts
|
|
22
|
+
declare function getCategories(params?: QueryParams): Promise<ICategory[]>;
|
|
23
|
+
declare function getCategory(id: IEquatable, params?: QueryParams): Promise<ICategory | undefined>;
|
|
24
|
+
declare function getSegments(item: ICategorized, params?: QueryParams): Promise<ICategory[]>;
|
|
25
|
+
//# sourceMappingURL=category.service.d.ts.map
|
|
26
|
+
//#endregion
|
|
27
|
+
//#region src/consent_preference/consent_preference.service.d.ts
|
|
28
|
+
declare function getConsentPreference(id: IEquatable, params?: QueryParams): Promise<IConsentPreference | undefined>;
|
|
29
|
+
declare function getConsentPreferences(params?: QueryParams): Promise<IConsentPreference[]>;
|
|
30
|
+
declare function getConsentPreferencesPagination(params?: QueryParams): Promise<IPaginationResult<IConsentPreference>>;
|
|
31
|
+
//# sourceMappingURL=consent_preference.service.d.ts.map
|
|
32
|
+
//#endregion
|
|
33
|
+
//#region src/country/country.service.d.ts
|
|
34
|
+
declare function getCountries(locale?: string): Promise<INamedEntity[]>;
|
|
35
|
+
declare function getCountry(id: IEquatable, params?: QueryParams): Promise<INamedEntity | undefined>;
|
|
36
|
+
declare function getCountriesPagination(params?: QueryParams): Promise<IPaginationResult<INamedEntity>>;
|
|
37
|
+
//# sourceMappingURL=country.service.d.ts.map
|
|
38
|
+
//#endregion
|
|
39
|
+
//#region src/label/label.service.d.ts
|
|
40
|
+
declare function getLabels(params?: QueryParams): Promise<ILabel[]>;
|
|
41
|
+
declare function getLabel(id: IEquatable, params?: QueryParams): Promise<ILabel | undefined>;
|
|
42
|
+
declare function resolveLabel(labels: ILabel[], id: string): string;
|
|
43
|
+
//# sourceMappingURL=label.service.d.ts.map
|
|
44
|
+
//#endregion
|
|
45
|
+
//#region src/layout/layout.service.d.ts
|
|
46
|
+
declare function getLayout<T extends IAppExtended = IAppExtended>(market: string, locale: string): Promise<ILayout<T>>;
|
|
47
|
+
//# sourceMappingURL=layout.service.d.ts.map
|
|
48
|
+
//#endregion
|
|
49
|
+
//#region src/lazy/lazy.service.d.ts
|
|
50
|
+
declare const LAZY_PROPS: ILazyStaticProps;
|
|
51
|
+
declare function withLazyProps<T>(key: string, getComponentProps: ILazyStaticPropsFunc<T>): Promise<void>;
|
|
52
|
+
declare function getDecoratedComponents(props: PageProps, extraComponents?: IComponent[]): Promise<void>;
|
|
53
|
+
//# sourceMappingURL=lazy.service.d.ts.map
|
|
54
|
+
//#endregion
|
|
55
|
+
//#region src/locale/locale.service.d.ts
|
|
56
|
+
declare function getLocales(params?: QueryParams): Promise<ILocale[]>;
|
|
57
|
+
declare function getLocale(id: IEquatable, params?: QueryParams): Promise<ILocale | undefined>;
|
|
58
|
+
//# sourceMappingURL=locale.service.d.ts.map
|
|
59
|
+
//#endregion
|
|
60
|
+
//#region src/market/market.service.d.ts
|
|
61
|
+
declare function getMarkets(params?: QueryParams): Promise<IMarket[]>;
|
|
62
|
+
declare function getMarket(id: IEquatable, params?: QueryParams): Promise<IMarket | undefined>;
|
|
63
|
+
//# sourceMappingURL=market.service.d.ts.map
|
|
64
|
+
//#endregion
|
|
65
|
+
//#region src/menu/menu.service.d.ts
|
|
66
|
+
declare function getMenus(params?: QueryParams): Promise<IMenu[]>;
|
|
67
|
+
declare function getMenu(id: IEquatable, params?: QueryParams): Promise<IMenu | undefined>;
|
|
68
|
+
//# sourceMappingURL=menu.service.d.ts.map
|
|
69
|
+
//#endregion
|
|
70
|
+
//#region src/page/page.service.d.ts
|
|
71
|
+
declare function findOnePage<T extends ICategorized = ICategorized>(schema: string, id: IEquatable, params?: QueryParams): Promise<T | undefined>;
|
|
72
|
+
declare function findManyPages<T extends ICategorized = ICategorized>(schema: string, params?: QueryParams): Promise<T[]>;
|
|
73
|
+
declare function getPage<T extends ICategorized = ICategorized>(schema: string, id: IEquatable, market?: string, locale?: string, options?: {
|
|
74
|
+
depth?: number;
|
|
75
|
+
draftMode?: boolean;
|
|
76
|
+
preview?: boolean;
|
|
77
|
+
previewData?: any;
|
|
78
|
+
}): Promise<IPage<T> | undefined>;
|
|
79
|
+
declare function getSchemaRoutes(schema: string, market: string, locale: string): Promise<IRoute[]>;
|
|
80
|
+
declare function getNotFoundRoute(market: string, locale: string): Promise<IRoute | undefined>;
|
|
81
|
+
declare function NotFound(market: string, locale: string): Promise<{
|
|
82
|
+
redirect: Redirect;
|
|
83
|
+
} | void>;
|
|
84
|
+
declare function getPageRoutes(schema: string, id: IEquatable): Promise<IRoute[]>;
|
|
85
|
+
declare function getPageCategory<T extends ICategorized>(schema: string, page?: IPage, market?: string, locale?: string): Promise<T | undefined>;
|
|
86
|
+
declare function getErrorPageLayout(): Promise<{
|
|
87
|
+
layout: ILayout;
|
|
88
|
+
page: IPage;
|
|
89
|
+
}>;
|
|
90
|
+
type PartialPageProps<T extends ICategorized, B> = Omit<PageProps<T>, 'page'> & Partial<Pick<PageProps<T>, 'page'>> & B;
|
|
91
|
+
declare function getPageProps<T extends ICategorized, B = any>(props: PartialPageProps<T, B>, extraComponents?: IComponent[]): Promise<PageProps<T> & B>;
|
|
92
|
+
declare function getPublicUrl(): string;
|
|
93
|
+
declare function resolveHref(href?: string | null): string;
|
|
94
|
+
//# sourceMappingURL=page.service.d.ts.map
|
|
95
|
+
//#endregion
|
|
96
|
+
//#region src/province/province.service.d.ts
|
|
97
|
+
declare function getProvinces(locale?: string): Promise<INamedEntity[]>;
|
|
98
|
+
declare function getProvince(id: IEquatable, params?: QueryParams): Promise<INamedEntity | undefined>;
|
|
99
|
+
declare function getProvincesPagination(params?: QueryParams): Promise<IPaginationResult<INamedEntity>>;
|
|
100
|
+
//# sourceMappingURL=province.service.d.ts.map
|
|
101
|
+
//#endregion
|
|
102
|
+
//#region src/redirect/redirect.service.d.ts
|
|
103
|
+
declare function getRedirects(locale?: string): Promise<IRedirect[]>;
|
|
104
|
+
declare function getRedirect(id: IEquatable, params?: QueryParams): Promise<IRedirect | undefined>;
|
|
105
|
+
declare function getRedirectsPagination(params?: QueryParams): Promise<IPaginationResult<IRedirect>>;
|
|
106
|
+
declare function redirectTo(layout: ILayout, key?: string): {
|
|
107
|
+
redirect: {
|
|
108
|
+
permanent: boolean;
|
|
109
|
+
destination: string;
|
|
110
|
+
};
|
|
111
|
+
};
|
|
112
|
+
//# sourceMappingURL=redirect.service.d.ts.map
|
|
113
|
+
//#endregion
|
|
114
|
+
//#region src/region/region.service.d.ts
|
|
115
|
+
declare function getRegions(locale?: string): Promise<INamedEntity[]>;
|
|
116
|
+
declare function getRegion(id: IEquatable, params?: QueryParams): Promise<INamedEntity | undefined>;
|
|
117
|
+
declare function getRegionsPagination(params?: QueryParams): Promise<IPaginationResult<INamedEntity>>;
|
|
118
|
+
//# sourceMappingURL=region.service.d.ts.map
|
|
119
|
+
//#endregion
|
|
120
|
+
//#region src/route/route-revalidate.handler.d.ts
|
|
121
|
+
declare function routeRevalidateHandler(): _websolutespa_bom_mixer_store_server0.IHandler<any>;
|
|
122
|
+
//# sourceMappingURL=route-revalidate.handler.d.ts.map
|
|
123
|
+
//#endregion
|
|
124
|
+
//#region src/route/route.service.d.ts
|
|
125
|
+
type StaticPath = {
|
|
126
|
+
params: {
|
|
127
|
+
[key: string]: string;
|
|
128
|
+
};
|
|
129
|
+
};
|
|
130
|
+
declare function getRoutes(params?: QueryParams): Promise<IRoute[]>;
|
|
131
|
+
declare function getRoute(id: string): Promise<IRoute | undefined>;
|
|
132
|
+
declare function getRoutesForSchemas(schemas: string[], market?: string, locale?: string): Promise<{
|
|
133
|
+
[key: string]: string;
|
|
134
|
+
}>;
|
|
135
|
+
declare function getRoutesForTemplates(templates: string[], market?: string, locale?: string): Promise<{
|
|
136
|
+
[key: string]: string;
|
|
137
|
+
}>;
|
|
138
|
+
declare function getStaticPathsForSchema(schema: string, template?: string): Promise<StaticPath[]>;
|
|
139
|
+
declare function getStaticPathsForSchemaAndFallback(schema: string, fallback?: 'blocking' | true | false, template?: string): Promise<{
|
|
140
|
+
paths: StaticPath[];
|
|
141
|
+
fallback: boolean | "blocking";
|
|
142
|
+
}>;
|
|
143
|
+
declare function getBreadcrumbFromSegments(segments: ICategory[], route: IRoute): Promise<IRouteLink[]>;
|
|
144
|
+
declare function getRouteLinkTree(market: string, locale: string): Promise<IRouteLink | undefined>;
|
|
145
|
+
declare function getRouteLinkCategory(locale: string, routes: IRoute[], categories: ICategory[], rootCategory: ICategory, category: ICategory): IRouteLink | IRouteLink[] | undefined;
|
|
146
|
+
//# sourceMappingURL=route.service.d.ts.map
|
|
147
|
+
//#endregion
|
|
148
|
+
//#region src/session/session.service.d.ts
|
|
149
|
+
declare function getSession<T extends object = Record<string, any>>(request: NextRequest | NextApiRequest | (IncomingMessage & {
|
|
150
|
+
cookies: Partial<{
|
|
151
|
+
[key: string]: string;
|
|
152
|
+
}>;
|
|
153
|
+
}), response: NextResponse | NextApiResponse | ServerResponse<IncomingMessage>): Promise<IronSession<T>>;
|
|
154
|
+
type SessionWithToken<T extends object = Record<string, any>> = T & Partial<{
|
|
155
|
+
token: string;
|
|
156
|
+
exp: number;
|
|
157
|
+
}>;
|
|
158
|
+
declare function getSessionToken<T extends SessionWithToken>(request: NextRequest | NextApiRequest | (IncomingMessage & {
|
|
159
|
+
cookies: Partial<{
|
|
160
|
+
[key: string]: string;
|
|
161
|
+
}>;
|
|
162
|
+
}), response: NextResponse | NextApiResponse | ServerResponse<IncomingMessage>): Promise<string | undefined>;
|
|
163
|
+
//# sourceMappingURL=session.service.d.ts.map
|
|
164
|
+
//#endregion
|
|
165
|
+
//#region src/sitemap/sitemap.handler.d.ts
|
|
166
|
+
declare const getSiteMapIndexProps: GetServerSideProps;
|
|
167
|
+
declare const getSiteMapXMLProps: GetServerSideProps;
|
|
168
|
+
declare const getSiteMapXSLProps: GetServerSideProps;
|
|
169
|
+
//# sourceMappingURL=sitemap.handler.d.ts.map
|
|
170
|
+
//#endregion
|
|
171
|
+
//#region src/sitemap/sitemap.service.d.ts
|
|
172
|
+
type ISiteMap = {
|
|
173
|
+
id: string;
|
|
174
|
+
updatedAt?: Date;
|
|
175
|
+
};
|
|
176
|
+
declare function getSiteMapIndex(origin: string): Promise<string>;
|
|
177
|
+
declare function escapeHtml(string: string): string;
|
|
178
|
+
declare function getSiteMapXML(origin: string, marketId?: string, localeId?: string): Promise<string>;
|
|
179
|
+
declare function getSiteMapXSL(localeId?: string): Promise<string>;
|
|
180
|
+
//# sourceMappingURL=sitemap.service.d.ts.map
|
|
181
|
+
|
|
182
|
+
//#endregion
|
|
183
|
+
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
|
+
//# sourceMappingURL=server.d.ts.map
|
|
@@ -0,0 +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"],"sourcesContent":[],"mappings":";;;;;;;;;iBAMsB,iBAAA,kBAAmC,QAAQ;;;;iBCF3C,iBA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