@bigbinary/neeto-commons-frontend 4.13.92-beta.2 → 4.13.92-beta.4

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.
@@ -2,6 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
+ var index = require('../index-bFmfHzbL.js');
5
6
  var i18next = require('i18next');
6
7
  var ramda = require('ramda');
7
8
  var reactI18next = require('react-i18next');
@@ -10,6 +11,7 @@ var initializers_constants = require('./constants.js');
10
11
  var initializers_utils_customFormatters = require('./utils/customFormatters.js');
11
12
  var initializers_utils_customPostProcessors = require('./utils/customPostProcessors.js');
12
13
  var initializers_utils_utils = require('./utils/utils.js');
14
+ require('../_commonjsHelpers-BJu3ubxk.js');
13
15
  require('dompurify');
14
16
  require('../typeof-D4ZZ_FlZ.js');
15
17
  require('../slicedToArray-BcL7fKuL.js');
@@ -459,72 +461,98 @@ var resourcesToBackend = function resourcesToBackend(res) {
459
461
 
460
462
  // eslint-disable-next-line import/no-mutable-exports
461
463
  exports.taxonomies = {};
462
- var initializeI18n = function initializeI18n() {
463
- var _window$globalProps, _window$globalProps2;
464
- var hostTranslations = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
465
- var enableDirAttribute = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
466
- document.documentElement.removeAttribute("lang");
467
- var userLanguage = (_window$globalProps = window.globalProps) === null || _window$globalProps === void 0 || (_window$globalProps = _window$globalProps.user) === null || _window$globalProps === void 0 ? void 0 : _window$globalProps.language;
468
- if (userLanguage) document.documentElement.setAttribute("lang", userLanguage);
469
- var translationImports = preval.require("../../../configs/scripts/buildTranslationImports.js");
470
- var englishTranslations = preval.require("../../../configs/scripts/getEnglishTranslation.js");
471
- var englishResource = {
472
- en: {
473
- translation: englishTranslations || {}
474
- }
475
- };
476
- var resources = ramda.mergeDeepLeft(hostTranslations, englishResource);
477
- var defaultTaxonomyKeys = Object.keys(resources.en.translation.taxonomyDefaultLabels || {});
478
- var defaultTaxonomies = Object.fromEntries(defaultTaxonomyKeys.map(function (key) {
479
- return [key, {
480
- singular: null,
481
- plural: null
482
- }];
483
- }));
484
- var hostTaxonomies = ((_window$globalProps2 = window.globalProps) === null || _window$globalProps2 === void 0 ? void 0 : _window$globalProps2.taxonomies) || {};
485
- exports.taxonomies = initializers_utils_utils.replaceNullValuesWithGetter(ramda.mergeDeepLeft(hostTaxonomies, defaultTaxonomies));
486
- i18next.use(Browser).use(reactI18next.initReactI18next).use(initializers_utils_customPostProcessors.sentenceCaseProcessor).use(resourcesToBackend(function (language) {
487
- return utils_retryImport(translationImports === null || translationImports === void 0 ? void 0 : translationImports[language]);
488
- })).init({
489
- resources: resources,
490
- partialBundledLanguages: true,
491
- fallbackLng: "en",
492
- interpolation: {
493
- defaultVariables: {
494
- taxonomies: exports.taxonomies
495
- },
496
- escapeValue: false,
497
- skipOnVariables: false,
498
- alwaysFormat: true,
499
- format: function format(value, _format, lng, options) {
500
- var newValue = value;
501
- if (initializers_constants.LIST_FORMATS.includes(_format)) {
502
- newValue = initializers_utils_customFormatters.listFormatter({
503
- value: newValue,
504
- format: _format,
505
- lng: lng,
506
- options: options
464
+ var initializeI18n = /*#__PURE__*/function () {
465
+ var _ref = index._asyncToGenerator(/*#__PURE__*/index._regeneratorRuntime.mark(function _callee() {
466
+ var _window$globalProps, _window$globalProps2;
467
+ var hostTranslations,
468
+ enableDirAttribute,
469
+ userLanguage,
470
+ translationImports,
471
+ englishTranslations,
472
+ englishResource,
473
+ resources,
474
+ defaultTaxonomyKeys,
475
+ defaultTaxonomies,
476
+ hostTaxonomies,
477
+ _args = arguments;
478
+ return index._regeneratorRuntime.wrap(function _callee$(_context) {
479
+ while (1) switch (_context.prev = _context.next) {
480
+ case 0:
481
+ hostTranslations = _args.length > 0 && _args[0] !== undefined ? _args[0] : {};
482
+ enableDirAttribute = _args.length > 1 && _args[1] !== undefined ? _args[1] : true;
483
+ document.documentElement.removeAttribute("lang");
484
+ userLanguage = (_window$globalProps = window.globalProps) === null || _window$globalProps === void 0 || (_window$globalProps = _window$globalProps.user) === null || _window$globalProps === void 0 ? void 0 : _window$globalProps.language;
485
+ if (userLanguage) document.documentElement.setAttribute("lang", userLanguage);
486
+ translationImports = preval.require("../../../configs/scripts/buildTranslationImports.js");
487
+ englishTranslations = preval.require("../../../configs/scripts/getEnglishTranslation.js");
488
+ englishResource = {
489
+ en: {
490
+ translation: englishTranslations || {}
491
+ }
492
+ };
493
+ resources = ramda.mergeDeepLeft(hostTranslations, englishResource);
494
+ defaultTaxonomyKeys = Object.keys(resources.en.translation.taxonomyDefaultLabels || {});
495
+ defaultTaxonomies = Object.fromEntries(defaultTaxonomyKeys.map(function (key) {
496
+ return [key, {
497
+ singular: null,
498
+ plural: null
499
+ }];
500
+ }));
501
+ hostTaxonomies = ((_window$globalProps2 = window.globalProps) === null || _window$globalProps2 === void 0 ? void 0 : _window$globalProps2.taxonomies) || {};
502
+ exports.taxonomies = initializers_utils_utils.replaceNullValuesWithGetter(ramda.mergeDeepLeft(hostTaxonomies, defaultTaxonomies));
503
+ _context.next = 15;
504
+ return i18next.use(Browser).use(reactI18next.initReactI18next).use(initializers_utils_customPostProcessors.sentenceCaseProcessor).use(resourcesToBackend(function (language) {
505
+ return utils_retryImport(translationImports === null || translationImports === void 0 ? void 0 : translationImports[language]);
506
+ })).init({
507
+ resources: resources,
508
+ partialBundledLanguages: true,
509
+ fallbackLng: "en",
510
+ interpolation: {
511
+ defaultVariables: {
512
+ taxonomies: exports.taxonomies
513
+ },
514
+ escapeValue: false,
515
+ skipOnVariables: false,
516
+ alwaysFormat: true,
517
+ format: function format(value, _format, lng, options) {
518
+ var newValue = value;
519
+ if (initializers_constants.LIST_FORMATS.includes(_format)) {
520
+ newValue = initializers_utils_customFormatters.listFormatter({
521
+ value: newValue,
522
+ format: _format,
523
+ lng: lng,
524
+ options: options
525
+ });
526
+ return newValue;
527
+ }
528
+ return initializers_utils_customFormatters.lowerCaseDynamicTextFormatter(newValue, _format);
529
+ }
530
+ },
531
+ postProcess: [initializers_utils_customPostProcessors.sentenceCaseProcessor.name],
532
+ detection: {
533
+ order: ["querystring", "htmlTag", "navigator", "cookie"],
534
+ caches: ["cookie"],
535
+ lookupQuerystring: "lang",
536
+ lookupCookie: "lang"
537
+ }
507
538
  });
508
- return newValue;
509
- }
510
- return initializers_utils_customFormatters.lowerCaseDynamicTextFormatter(newValue, _format);
539
+ case 15:
540
+ if (enableDirAttribute) {
541
+ document.documentElement.setAttribute("dir", i18next.dir() || "ltr");
542
+ }
543
+ if (!userLanguage) {
544
+ document.documentElement.setAttribute("lang", i18next.resolvedLanguage || "en");
545
+ }
546
+ case 17:
547
+ case "end":
548
+ return _context.stop();
511
549
  }
512
- },
513
- postProcess: [initializers_utils_customPostProcessors.sentenceCaseProcessor.name],
514
- detection: {
515
- order: ["querystring", "htmlTag", "navigator", "cookie"],
516
- caches: ["cookie"],
517
- lookupQuerystring: "lang",
518
- lookupCookie: "lang"
519
- }
520
- });
521
- if (enableDirAttribute) {
522
- document.documentElement.setAttribute("dir", i18next.dir() || "ltr");
523
- }
524
- if (!userLanguage) {
525
- document.documentElement.setAttribute("lang", i18next.resolvedLanguage || "en");
526
- }
527
- };
550
+ }, _callee);
551
+ }));
552
+ return function initializeI18n() {
553
+ return _ref.apply(this, arguments);
554
+ };
555
+ }();
528
556
 
529
557
  exports.default = initializeI18n;
530
558
  //# sourceMappingURL=i18n.js.map