@wix/astro 1.0.36 → 1.0.37
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.
|
@@ -772,9 +772,57 @@ var getCommonConfigHeader = () => {
|
|
|
772
772
|
};
|
|
773
773
|
};
|
|
774
774
|
|
|
775
|
+
// ../../node_modules/@wix/headless-site/dist/esm/utils/multilingual-utils.js
|
|
776
|
+
function getLanguageLocale(language) {
|
|
777
|
+
var _language$locale;
|
|
778
|
+
if (!(language != null && language.languageCode)) {
|
|
779
|
+
return void 0;
|
|
780
|
+
}
|
|
781
|
+
return [language.languageCode, (_language$locale = language.locale) == null ? void 0 : _language$locale.country].filter(Boolean).join("-");
|
|
782
|
+
}
|
|
783
|
+
var getCurrentLocale = (essentials) => {
|
|
784
|
+
var _document, _window$essentials;
|
|
785
|
+
let locale = essentials == null ? void 0 : essentials.locale;
|
|
786
|
+
if (typeof document !== "undefined" && (_document = document) != null && (_document = _document.location) != null && _document.href) {
|
|
787
|
+
try {
|
|
788
|
+
var _document2;
|
|
789
|
+
const url = new URL((_document2 = document) == null || (_document2 = _document2.location) == null ? void 0 : _document2.href);
|
|
790
|
+
const localeSearchParam = url.searchParams.get("lang");
|
|
791
|
+
if (localeSearchParam) {
|
|
792
|
+
var _essentials$multiling;
|
|
793
|
+
const language = essentials == null || (_essentials$multiling = essentials.multilingual) == null || (_essentials$multiling = _essentials$multiling.supportedLanguages) == null ? void 0 : _essentials$multiling.find((lang) => lang.languageCode === localeSearchParam);
|
|
794
|
+
if (language != null && language.languageCode) {
|
|
795
|
+
locale = getLanguageLocale(language);
|
|
796
|
+
}
|
|
797
|
+
}
|
|
798
|
+
} catch {
|
|
799
|
+
}
|
|
800
|
+
}
|
|
801
|
+
return locale ?? ((_window$essentials = window.essentials) == null ? void 0 : _window$essentials.locale) ?? "en-US";
|
|
802
|
+
};
|
|
803
|
+
|
|
804
|
+
// ../../node_modules/@wix/headless-site/dist/esm/headers/multilingual-header.js
|
|
805
|
+
var MULTILINGUAL_HEADER_KEY = "x-wix-linguist";
|
|
806
|
+
var DUMMY_INSTANCE_ID = "00000000-0000-0000-0000-000000000000";
|
|
807
|
+
var getMultilingualHeader = (essentials) => {
|
|
808
|
+
var _multilingual$support;
|
|
809
|
+
const currentLocale = getCurrentLocale(essentials);
|
|
810
|
+
const multilingual = essentials == null ? void 0 : essentials.multilingual;
|
|
811
|
+
if (currentLocale && multilingual != null && (_multilingual$support = multilingual.supportedLanguages) != null && _multilingual$support.length) {
|
|
812
|
+
var _multilingual$support2;
|
|
813
|
+
const language = multilingual == null || (_multilingual$support2 = multilingual.supportedLanguages) == null ? void 0 : _multilingual$support2.find((lang) => getLanguageLocale(lang) === currentLocale);
|
|
814
|
+
if (language) {
|
|
815
|
+
return {
|
|
816
|
+
[MULTILINGUAL_HEADER_KEY]: `${language.languageCode}|${currentLocale.toLowerCase()}|${!!language.isPrimary}|${DUMMY_INSTANCE_ID}`
|
|
817
|
+
};
|
|
818
|
+
}
|
|
819
|
+
}
|
|
820
|
+
return {};
|
|
821
|
+
};
|
|
822
|
+
|
|
775
823
|
// ../../node_modules/@wix/headless-site/dist/esm/headers/index.js
|
|
776
|
-
var getPassThroughHeaders = () => {
|
|
777
|
-
const headers = [getCommonConfigHeader()];
|
|
824
|
+
var getPassThroughHeaders = (essentials) => {
|
|
825
|
+
const headers = [getCommonConfigHeader(), getMultilingualHeader(essentials)];
|
|
778
826
|
return headers.reduce((res, header) => {
|
|
779
827
|
const entries = Object.entries(header).filter((_ref) => {
|
|
780
828
|
let [_, value] = _ref;
|
|
@@ -892,22 +940,22 @@ var createHostModule = () => {
|
|
|
892
940
|
let {
|
|
893
941
|
essentials
|
|
894
942
|
} = _temp === void 0 ? {} : _temp;
|
|
943
|
+
const currentLocale = getCurrentLocale(essentials);
|
|
895
944
|
return {
|
|
896
945
|
essentials: {
|
|
897
946
|
get passThroughHeaders() {
|
|
898
|
-
return getPassThroughHeaders();
|
|
947
|
+
return getPassThroughHeaders(essentials);
|
|
899
948
|
},
|
|
900
949
|
get language() {
|
|
901
950
|
var _window$essentials;
|
|
902
951
|
return (essentials == null ? void 0 : essentials.language) ?? ((_window$essentials = window.essentials) == null ? void 0 : _window$essentials.language) ?? "en";
|
|
903
952
|
},
|
|
904
953
|
get locale() {
|
|
905
|
-
|
|
906
|
-
return (essentials == null ? void 0 : essentials.locale) ?? ((_window$essentials2 = window.essentials) == null ? void 0 : _window$essentials2.locale) ?? "en-US";
|
|
954
|
+
return currentLocale;
|
|
907
955
|
},
|
|
908
956
|
get timezone() {
|
|
909
|
-
var _window$
|
|
910
|
-
return (essentials == null ? void 0 : essentials.timezone) ?? ((_window$
|
|
957
|
+
var _window$essentials2;
|
|
958
|
+
return (essentials == null ? void 0 : essentials.timezone) ?? ((_window$essentials2 = window.essentials) == null ? void 0 : _window$essentials2.timeZone) ?? "UTC";
|
|
911
959
|
}
|
|
912
960
|
},
|
|
913
961
|
getMonitoringClient: () => {
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wix/astro",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.37",
|
|
4
4
|
"devDependencies": {
|
|
5
5
|
"@wix/auth-management": "^1.0.70",
|
|
6
6
|
"@wix/dashboard": "^1.3.35",
|
|
7
7
|
"@wix/essentials": "^0.1.23",
|
|
8
8
|
"@wix/headless-node": "^1.11.0",
|
|
9
|
-
"@wix/headless-site": "^1.
|
|
9
|
+
"@wix/headless-site": "^1.12.0",
|
|
10
10
|
"@wix/headless-site-assets": "^1.0.2",
|
|
11
11
|
"@wix/sdk": "^1.15.23",
|
|
12
12
|
"@wix/sdk-context": "^0.0.1",
|
|
@@ -51,5 +51,5 @@
|
|
|
51
51
|
"artifactId": "wix-astro"
|
|
52
52
|
}
|
|
53
53
|
},
|
|
54
|
-
"falconPackageHash": "
|
|
54
|
+
"falconPackageHash": "14664b0e7cbee39422ca6efe31588cfa43125e73e4d3306f7e5c65c0"
|
|
55
55
|
}
|