@enonic/nextjs-adapter 3.0.0-RC5 → 3.0.1
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@enonic/nextjs-adapter",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.1",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"author": "Pavel Milkevich <pmi@enonic.com>",
|
|
@@ -53,8 +53,8 @@
|
|
|
53
53
|
"@formatjs/intl-localematcher": "^0.5.4",
|
|
54
54
|
"html-react-parser": "^5.1.10",
|
|
55
55
|
"negotiator": "^0.6.3",
|
|
56
|
-
"next": "^14.2.
|
|
57
|
-
"react": "18.
|
|
56
|
+
"next": "^14.2.3",
|
|
57
|
+
"react": "18.3.1",
|
|
58
58
|
"react-dom": "18.2.0",
|
|
59
59
|
"unescape": "^1.0.1"
|
|
60
60
|
},
|
|
@@ -63,13 +63,13 @@
|
|
|
63
63
|
"@enonic-types/core": "^7.14.1",
|
|
64
64
|
"@enonic/eslint-config": "^1.2.1",
|
|
65
65
|
"@testing-library/jest-dom": "^6.4.2",
|
|
66
|
-
"@testing-library/react": "^15.0.
|
|
66
|
+
"@testing-library/react": "^15.0.5",
|
|
67
67
|
"@types/negotiator": "^0.6.3",
|
|
68
68
|
"@types/node": "^20.12.7",
|
|
69
|
-
"@types/react": "^18.
|
|
69
|
+
"@types/react": "^18.3.1",
|
|
70
70
|
"@types/react-dom": "^18.2.25",
|
|
71
|
-
"@typescript-eslint/eslint-plugin": "^7.7.
|
|
72
|
-
"@typescript-eslint/parser": "^7.7.
|
|
71
|
+
"@typescript-eslint/eslint-plugin": "^7.7.1",
|
|
72
|
+
"@typescript-eslint/parser": "^7.7.1",
|
|
73
73
|
"concurrently": "^8.2.2",
|
|
74
74
|
"cpy-cli": "^5.0.0",
|
|
75
75
|
"del-cli": "^5.1.0",
|
|
@@ -1,8 +1,4 @@
|
|
|
1
1
|
import type {Context} from '../types';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import Negotiator from 'negotiator';
|
|
5
|
-
import {match as localeMatcher} from '@formatjs/intl-localematcher';
|
|
6
2
|
import {PROJECT_ID_HEADER} from '../common/constants';
|
|
7
3
|
import {getLocaleMappings} from './getLocaleMappings';
|
|
8
4
|
import {getLocaleMappingByProjectId} from './getLocaleMappingByProjectId';
|
|
@@ -19,10 +15,15 @@ export function getRequestLocaleInfo(context: Context) {
|
|
|
19
15
|
|
|
20
16
|
} else {
|
|
21
17
|
locale = context.locale;
|
|
18
|
+
/* Disabled to prevent situation when www.site.com redirects to www.site.com/no when accept-header is set to 'no'
|
|
19
|
+
|
|
22
20
|
if (!locale) {
|
|
23
21
|
const acceptLang = context.headers?.get('accept-language') || '';
|
|
24
22
|
const langs = new Negotiator({headers: {'accept-language': acceptLang}}).languages();
|
|
25
23
|
locale = localeMatcher(langs, locales, defaultLocale);
|
|
24
|
+
}*/
|
|
25
|
+
if (!locale) {
|
|
26
|
+
locale = defaultLocale;
|
|
26
27
|
}
|
|
27
28
|
}
|
|
28
29
|
return {locale, locales, defaultLocale};
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import Negotiator from 'negotiator';
|
|
2
|
-
import { match as localeMatcher } from '@formatjs/intl-localematcher';
|
|
3
1
|
import { PROJECT_ID_HEADER } from '../common/constants';
|
|
4
2
|
import { getLocaleMappings } from './getLocaleMappings';
|
|
5
3
|
import { getLocaleMappingByProjectId } from './getLocaleMappingByProjectId';
|
|
6
4
|
export function getRequestLocaleInfo(context) {
|
|
7
|
-
var _a, _b
|
|
5
|
+
var _a, _b;
|
|
8
6
|
let locale;
|
|
9
7
|
const configs = getLocaleMappings();
|
|
10
8
|
const locales = Object.keys(configs);
|
|
@@ -15,10 +13,15 @@ export function getRequestLocaleInfo(context) {
|
|
|
15
13
|
}
|
|
16
14
|
else {
|
|
17
15
|
locale = context.locale;
|
|
16
|
+
/* Disabled to prevent situation when www.site.com redirects to www.site.com/no when accept-header is set to 'no'
|
|
17
|
+
|
|
18
18
|
if (!locale) {
|
|
19
|
-
const acceptLang =
|
|
20
|
-
const langs = new Negotiator({
|
|
19
|
+
const acceptLang = context.headers?.get('accept-language') || '';
|
|
20
|
+
const langs = new Negotiator({headers: {'accept-language': acceptLang}}).languages();
|
|
21
21
|
locale = localeMatcher(langs, locales, defaultLocale);
|
|
22
|
+
}*/
|
|
23
|
+
if (!locale) {
|
|
24
|
+
locale = defaultLocale;
|
|
22
25
|
}
|
|
23
26
|
}
|
|
24
27
|
return { locale, locales, defaultLocale };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getRequestLocaleInfo.js","sourceRoot":"","sources":["../src/utils/getRequestLocaleInfo.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"getRequestLocaleInfo.js","sourceRoot":"","sources":["../src/utils/getRequestLocaleInfo.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,iBAAiB,EAAC,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAC,iBAAiB,EAAC,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAC,2BAA2B,EAAC,MAAM,+BAA+B,CAAC;AAG1E,MAAM,UAAU,oBAAoB,CAAC,OAAgB;;IACjD,IAAI,MAAc,CAAC;IACnB,MAAM,OAAO,GAAG,iBAAiB,EAAE,CAAC;IACpC,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACrC,MAAM,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC;IACxE,MAAM,SAAS,GAAG,MAAA,OAAO,CAAC,OAAO,0CAAE,GAAG,CAAC,iBAAiB,CAAC,CAAC;IAC1D,IAAI,SAAS,EAAE,CAAC;QACZ,MAAM,GAAG,MAAA,2BAA2B,CAAC,SAAS,EAAE,KAAK,CAAC,0CAAE,MAAM,CAAC;IAEnE,CAAC;SAAM,CAAC;QACJ,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;QACxB;;;;;;WAMG;QACH,IAAI,CAAC,MAAM,EAAE,CAAC;YACV,MAAM,GAAG,aAAa,CAAC;QAC3B,CAAC;IACL,CAAC;IACD,OAAO,EAAC,MAAM,EAAE,OAAO,EAAE,aAAa,EAAC,CAAC;AAC5C,CAAC"}
|