@wix/form-public 0.115.0 → 0.116.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_tsup-dts-rollup.d.cts +2 -0
- package/dist/_tsup-dts-rollup.d.ts +2 -0
- package/dist/index.cjs +13 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +13 -8
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
|
@@ -84,6 +84,8 @@ export { DateTimeInput }
|
|
|
84
84
|
|
|
85
85
|
export { Dropdown }
|
|
86
86
|
|
|
87
|
+
export declare const fetchLocaleDatasetTranslations: (locale: string) => Promise<Record<string, string>>;
|
|
88
|
+
|
|
87
89
|
export declare const FIELD_TYPE_MAP: Record<SchemaFieldType, FieldType>;
|
|
88
90
|
|
|
89
91
|
declare type FieldMap = {
|
|
@@ -84,6 +84,8 @@ export { DateTimeInput }
|
|
|
84
84
|
|
|
85
85
|
export { Dropdown }
|
|
86
86
|
|
|
87
|
+
export declare const fetchLocaleDatasetTranslations: (locale: string) => Promise<Record<string, string>>;
|
|
88
|
+
|
|
87
89
|
export declare const FIELD_TYPE_MAP: Record<SchemaFieldType, FieldType>;
|
|
88
90
|
|
|
89
91
|
declare type FieldMap = {
|
package/dist/index.cjs
CHANGED
|
@@ -31828,6 +31828,13 @@ async function loadFieldViewerTranslations(locale) {
|
|
|
31828
31828
|
}
|
|
31829
31829
|
}
|
|
31830
31830
|
}
|
|
31831
|
+
var getLocaleDatasetTranslationsUrl = (locale = "en") => `https://static.parastorage.com/services/locale-dataset-data/1.4213.0/translations/messages_${locale}.json`;
|
|
31832
|
+
var fetchLocaleDatasetTranslations = async (locale) => {
|
|
31833
|
+
const url = getLocaleDatasetTranslationsUrl(locale);
|
|
31834
|
+
const fallbackUrl = getLocaleDatasetTranslationsUrl();
|
|
31835
|
+
const response = await fetch(url).catch(() => fetch(fallbackUrl));
|
|
31836
|
+
return response?.json() ?? {};
|
|
31837
|
+
};
|
|
31831
31838
|
async function createI18n(locale) {
|
|
31832
31839
|
const i18nInstance = i18next__default.default.createInstance();
|
|
31833
31840
|
await i18nInstance.use(reactI18next.initReactI18next).init({
|
|
@@ -31844,14 +31851,12 @@ async function createI18n(locale) {
|
|
|
31844
31851
|
ns: ["translation", FORM_VIEWER_NAMESPACE],
|
|
31845
31852
|
resources: {}
|
|
31846
31853
|
});
|
|
31847
|
-
const fieldTranslations = await
|
|
31848
|
-
|
|
31849
|
-
locale
|
|
31850
|
-
|
|
31851
|
-
|
|
31852
|
-
|
|
31853
|
-
true
|
|
31854
|
-
);
|
|
31854
|
+
const [fieldTranslations, localeDataset3] = await Promise.all([
|
|
31855
|
+
loadFieldViewerTranslations(locale),
|
|
31856
|
+
fetchLocaleDatasetTranslations(locale)
|
|
31857
|
+
]);
|
|
31858
|
+
i18nInstance.addResources(locale, FORM_VIEWER_NAMESPACE, fieldTranslations);
|
|
31859
|
+
i18nInstance.addResources(locale, FORM_VIEWER_NAMESPACE, localeDataset3);
|
|
31855
31860
|
return i18nInstance;
|
|
31856
31861
|
}
|
|
31857
31862
|
var FormProvider = ({
|