@wix/form-public 0.115.0 → 0.117.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.
@@ -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
@@ -21485,6 +21485,7 @@ var require_messages_en = __commonJS({
21485
21485
  "dext-checkbox.input.error.message.required-error": "Check the box to continue.",
21486
21486
  "url-input.input.error.message.format-error": "Enter a web URL like https://www.example.com.",
21487
21487
  "file-upload.file.uploading-spinner.aria-label": "Loading file",
21488
+ "field.phone.country-code.aria-label": "Country code",
21488
21489
  "add-other.default-other-option-label": "Other",
21489
21490
  "dext-checkbox.input.error.message.not-allowed-value": "Check the box to continue.",
21490
21491
  "field.date.placeholder.year": "Year",
@@ -31828,6 +31829,13 @@ async function loadFieldViewerTranslations(locale) {
31828
31829
  }
31829
31830
  }
31830
31831
  }
31832
+ var getLocaleDatasetTranslationsUrl = (locale = "en") => `https://static.parastorage.com/services/locale-dataset-data/1.4213.0/translations/messages_${locale}.json`;
31833
+ var fetchLocaleDatasetTranslations = async (locale) => {
31834
+ const url = getLocaleDatasetTranslationsUrl(locale);
31835
+ const fallbackUrl = getLocaleDatasetTranslationsUrl();
31836
+ const response = await fetch(url).catch(() => fetch(fallbackUrl));
31837
+ return response?.json() ?? {};
31838
+ };
31831
31839
  async function createI18n(locale) {
31832
31840
  const i18nInstance = i18next__default.default.createInstance();
31833
31841
  await i18nInstance.use(reactI18next.initReactI18next).init({
@@ -31844,14 +31852,12 @@ async function createI18n(locale) {
31844
31852
  ns: ["translation", FORM_VIEWER_NAMESPACE],
31845
31853
  resources: {}
31846
31854
  });
31847
- const fieldTranslations = await loadFieldViewerTranslations(locale);
31848
- i18nInstance.addResourceBundle(
31849
- locale,
31850
- FORM_VIEWER_NAMESPACE,
31851
- fieldTranslations,
31852
- true,
31853
- true
31854
- );
31855
+ const [fieldTranslations, localeDataset3] = await Promise.all([
31856
+ loadFieldViewerTranslations(locale),
31857
+ fetchLocaleDatasetTranslations(locale)
31858
+ ]);
31859
+ i18nInstance.addResources(locale, FORM_VIEWER_NAMESPACE, fieldTranslations);
31860
+ i18nInstance.addResources(locale, FORM_VIEWER_NAMESPACE, localeDataset3);
31855
31861
  return i18nInstance;
31856
31862
  }
31857
31863
  var FormProvider = ({