@bigbinary/neeto-commons-frontend 4.13.92 → 4.13.94-beta.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/README.md +1 -0
- package/configs/esbuild/index.js +4 -0
- package/configs/esbuild/plugins/packageTranslations.js +16 -0
- package/configs/esbuild/plugins/preval.js +16 -6
- package/configs/esbuild/plugins/reactGiphy.js +1 -0
- package/configs/scripts/buildTranslationImports.js +21 -0
- package/configs/scripts/getEnglishTranslation.js +11 -0
- package/configs/utils/packageTranslations.js +90 -0
- package/configs/vite/index.js +5 -0
- package/configs/vite/plugins/packageTranslations.js +14 -0
- package/configs/vite/plugins/preval.js +17 -11
- package/dist/cjs/initializers/i18n.js +120 -183
- package/dist/cjs/initializers/i18n.js.map +1 -1
- package/dist/cjs/initializers/index.js +43 -19
- package/dist/cjs/initializers/index.js.map +1 -1
- package/dist/cjs/react-utils/PrivateRoute/PrivateRoute.js +17 -13
- package/dist/cjs/react-utils/PrivateRoute/PrivateRoute.js.map +1 -1
- package/dist/cjs/react-utils/PrivateRoute/constants.js +8 -0
- package/dist/cjs/react-utils/PrivateRoute/constants.js.map +1 -0
- package/dist/cjs/react-utils/PrivateRoute/index.js +2 -0
- package/dist/cjs/react-utils/PrivateRoute/index.js.map +1 -1
- package/dist/cjs/react-utils/PrivateRoute/utils.js +16 -0
- package/dist/cjs/react-utils/PrivateRoute/utils.js.map +1 -0
- package/dist/cjs/react-utils/index.js +5 -0
- package/dist/cjs/react-utils/index.js.map +1 -1
- package/dist/cjs/react-utils/mount/mount.js +68 -69
- package/dist/cjs/react-utils/mount/mount.js.map +1 -1
- package/dist/cjs/react-utils/usePrefersReducedMotion/constants.js +6 -0
- package/dist/cjs/react-utils/usePrefersReducedMotion/constants.js.map +1 -0
- package/dist/cjs/react-utils/usePrefersReducedMotion/index.js +12 -0
- package/dist/cjs/react-utils/usePrefersReducedMotion/index.js.map +1 -0
- package/dist/cjs/react-utils/usePrefersReducedMotion/usePrefersReducedMotion.js +46 -0
- package/dist/cjs/react-utils/usePrefersReducedMotion/usePrefersReducedMotion.js.map +1 -0
- package/dist/initializers/i18n.js +120 -183
- package/dist/initializers/i18n.js.map +1 -1
- package/dist/initializers/index.js +43 -19
- package/dist/initializers/index.js.map +1 -1
- package/dist/react-utils/PrivateRoute/PrivateRoute.js +17 -13
- package/dist/react-utils/PrivateRoute/PrivateRoute.js.map +1 -1
- package/dist/react-utils/PrivateRoute/constants.js +5 -0
- package/dist/react-utils/PrivateRoute/constants.js.map +1 -0
- package/dist/react-utils/PrivateRoute/index.js +2 -0
- package/dist/react-utils/PrivateRoute/index.js.map +1 -1
- package/dist/react-utils/PrivateRoute/utils.js +14 -0
- package/dist/react-utils/PrivateRoute/utils.js.map +1 -0
- package/dist/react-utils/index.js +4 -0
- package/dist/react-utils/index.js.map +1 -1
- package/dist/react-utils/mount/mount.js +68 -69
- package/dist/react-utils/mount/mount.js.map +1 -1
- package/dist/react-utils/usePrefersReducedMotion/constants.js +4 -0
- package/dist/react-utils/usePrefersReducedMotion/constants.js.map +1 -0
- package/dist/react-utils/usePrefersReducedMotion/index.js +6 -0
- package/dist/react-utils/usePrefersReducedMotion/index.js.map +1 -0
- package/dist/react-utils/usePrefersReducedMotion/usePrefersReducedMotion.js +44 -0
- package/dist/react-utils/usePrefersReducedMotion/usePrefersReducedMotion.js.map +1 -0
- package/initializers.d.ts +1 -1
- package/package.json +13 -7
- package/react-utils.d.ts +69 -3
- package/src/translations/ar.json +111 -0
- package/src/translations/bg.json +111 -0
- package/src/translations/ca.json +111 -0
- package/src/translations/cs.json +111 -0
- package/src/translations/da.json +111 -0
- package/src/translations/de.json +111 -0
- package/src/translations/en.json +111 -0
- package/src/translations/es-MX.json +111 -0
- package/src/translations/es.json +111 -0
- package/src/translations/et.json +111 -0
- package/src/translations/fi.json +111 -0
- package/src/translations/fil.json +111 -0
- package/src/translations/fr.json +111 -0
- package/src/translations/he.json +111 -0
- package/src/translations/hi.json +111 -0
- package/src/translations/hr.json +111 -0
- package/src/translations/id.json +111 -0
- package/src/translations/it.json +111 -0
- package/src/translations/ja.json +111 -0
- package/src/translations/ko.json +111 -0
- package/src/translations/nl.json +111 -0
- package/src/translations/pl.json +111 -0
- package/src/translations/pt-BR.json +111 -0
- package/src/translations/pt.json +111 -0
- package/src/translations/ro.json +111 -0
- package/src/translations/ru.json +111 -0
- package/src/translations/sk.json +111 -0
- package/src/translations/sl.json +111 -0
- package/src/translations/sv.json +111 -0
- package/src/translations/th.json +111 -0
- package/src/translations/tr.json +111 -0
- package/src/translations/uk.json +111 -0
- package/src/translations/vi.json +111 -0
- package/src/translations/zh-CN.json +111 -0
- package/src/translations/zh-TW.json +111 -0
- package/configs/scripts/getPkgTranslations.js +0 -45
|
@@ -1,10 +1,13 @@
|
|
|
1
|
+
import { _ as _asyncToGenerator, a as _regeneratorRuntime } from '../index-DbuxAQMD.js';
|
|
1
2
|
import i18next from 'i18next';
|
|
2
3
|
import { mergeDeepLeft } from 'ramda';
|
|
3
4
|
import { initReactI18next } from 'react-i18next';
|
|
5
|
+
import _retryImport from '../utils/retryImport.js';
|
|
4
6
|
import { LIST_FORMATS } from './constants.js';
|
|
5
7
|
import { listFormatter, lowerCaseDynamicTextFormatter } from './utils/customFormatters.js';
|
|
6
8
|
import { sentenceCaseProcessor } from './utils/customPostProcessors.js';
|
|
7
9
|
import { replaceNullValuesWithGetter as _replaceNullValuesWithGetter } from './utils/utils.js';
|
|
10
|
+
import '../_commonjsHelpers-BFTU3MAI.js';
|
|
8
11
|
import 'dompurify';
|
|
9
12
|
import '../typeof-D-UKOauR.js';
|
|
10
13
|
import '../slicedToArray-DmsZvA_9.js';
|
|
@@ -423,195 +426,129 @@ var Browser = /*#__PURE__*/function () {
|
|
|
423
426
|
}();
|
|
424
427
|
Browser.type = 'languageDetector';
|
|
425
428
|
|
|
426
|
-
var
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
sent: "{{entity}} sent successfully.",
|
|
454
|
-
merged: "{{entity}} have been successfully merged.",
|
|
455
|
-
disconnected: "{{entity}} has been successfully disconnected."
|
|
456
|
-
};
|
|
457
|
-
var otp = {
|
|
458
|
-
sent: "OTP has been sent successfully.",
|
|
459
|
-
invalid: "Invalid OTP",
|
|
460
|
-
verified: "OTP has been verified successfully."
|
|
461
|
-
};
|
|
462
|
-
var upload = {
|
|
463
|
-
error: "An error occurred while uploading the file"
|
|
464
|
-
};
|
|
465
|
-
var image = {
|
|
466
|
-
profile: {
|
|
467
|
-
removalFailed: "Failed to remove profile picture",
|
|
468
|
-
removalSuccess: "Profile picture successfully removed"
|
|
469
|
-
},
|
|
470
|
-
contentTypeInvalid: "Other than jpg, png, svg are not supported",
|
|
471
|
-
sizeOutOfRange: "Should not be more than {{maxSize, number}} MB"
|
|
472
|
-
};
|
|
473
|
-
var userRole = {
|
|
474
|
-
deactivateActiveAdmin: "You cannot deactivate active admin from the workspace!"
|
|
475
|
-
};
|
|
476
|
-
var activeRecord = {
|
|
477
|
-
error: {
|
|
478
|
-
blankName: "Name can't be blank",
|
|
479
|
-
blankDescription: "Description can't be blank",
|
|
480
|
-
blankValue: "Value can't be blank",
|
|
481
|
-
prefixType: "Prefix type {{value}} is not valid",
|
|
482
|
-
minimumEntryLimit: "Minimum entry limit must be less than or equal to {{maximumEntryLimit, number}}",
|
|
483
|
-
maximumEntryLimit: "Maximum entry limit must be greater than or equal to {{minimumEntryLimit, number}}"
|
|
484
|
-
}
|
|
485
|
-
};
|
|
486
|
-
var sessions = {
|
|
487
|
-
expiry: "Your session has expired. Please login again."
|
|
488
|
-
};
|
|
489
|
-
var payment = {
|
|
490
|
-
error: {
|
|
491
|
-
incomplete: "Your payment could not be completed"
|
|
492
|
-
}
|
|
493
|
-
};
|
|
494
|
-
var invitations = {
|
|
495
|
-
deleted_one: "Invitation has been deleted successfully",
|
|
496
|
-
deleted_other: "{{count, number}} Invitations have been deleted successfully",
|
|
497
|
-
sent_one: "Invitation has been sent successfully",
|
|
498
|
-
sent_other: "{{count, number}} Invitations have been sent successfully",
|
|
499
|
-
notFound: "{{email}} was not invited to test this website."
|
|
500
|
-
};
|
|
501
|
-
var github = {
|
|
502
|
-
error: {
|
|
503
|
-
webhookPermissionDenied: "Permission denied. Ensure you have permission to create webhooks for the repository.",
|
|
504
|
-
primaryNonDeletable: "Primary Github account cannot be deleted."
|
|
505
|
-
}
|
|
506
|
-
};
|
|
507
|
-
var neetoCommons = {
|
|
508
|
-
fallbackComponent: {
|
|
509
|
-
somethingWentWrong: "Sorry, something went wrong.",
|
|
510
|
-
description: "Please try <reloading>reloading</reloading> the page.<br> If the problem persists, <contactus>contact us</contactus>."
|
|
511
|
-
},
|
|
512
|
-
toastr: {
|
|
513
|
-
success: {
|
|
514
|
-
copiedToClipboard: "Copied to clipboard!"
|
|
515
|
-
},
|
|
516
|
-
error: {
|
|
517
|
-
noInternetConnection: "No Internet Connection.",
|
|
518
|
-
networkError: "Network error. Please check your connection and try again."
|
|
519
|
-
}
|
|
520
|
-
},
|
|
521
|
-
notice: {
|
|
522
|
-
errorOccurred: "Some error occurred."
|
|
523
|
-
},
|
|
524
|
-
validators: {
|
|
525
|
-
isRequired: "{{what}} is required.",
|
|
526
|
-
mustNotContainCapitalLetters: "{{what}} must not contain capital letters.",
|
|
527
|
-
mustNotContainSpaces: "{{what}} must not contain spaces.",
|
|
528
|
-
mustNotContainSpecialCharactersExceptHyphen: "{{what}} must not contain any special characters, except '-'",
|
|
529
|
-
mustNotStartOrEndWithSpecialCharacters: "{{what}} must not start or end with special characters."
|
|
530
|
-
},
|
|
531
|
-
copyToClipboard: {
|
|
532
|
-
failed: "Failed to copy to clipboard"
|
|
533
|
-
}
|
|
534
|
-
};
|
|
535
|
-
var commonsEn = {
|
|
536
|
-
generic: generic,
|
|
537
|
-
authentication: authentication,
|
|
538
|
-
authorization: authorization,
|
|
539
|
-
resource: resource,
|
|
540
|
-
otp: otp,
|
|
541
|
-
upload: upload,
|
|
542
|
-
image: image,
|
|
543
|
-
userRole: userRole,
|
|
544
|
-
activeRecord: activeRecord,
|
|
545
|
-
sessions: sessions,
|
|
546
|
-
payment: payment,
|
|
547
|
-
invitations: invitations,
|
|
548
|
-
github: github,
|
|
549
|
-
neetoCommons: neetoCommons
|
|
429
|
+
var resourcesToBackend = function resourcesToBackend(res) {
|
|
430
|
+
return {
|
|
431
|
+
type: 'backend',
|
|
432
|
+
init: function init(services, backendOptions, i18nextOptions) {},
|
|
433
|
+
read: function read(language, namespace, callback) {
|
|
434
|
+
if (typeof res === 'function') {
|
|
435
|
+
if (res.length < 3) {
|
|
436
|
+
try {
|
|
437
|
+
var r = res(language, namespace);
|
|
438
|
+
if (r && typeof r.then === 'function') {
|
|
439
|
+
r.then(function (data) {
|
|
440
|
+
return callback(null, data && data.default || data);
|
|
441
|
+
}).catch(callback);
|
|
442
|
+
} else {
|
|
443
|
+
callback(null, r);
|
|
444
|
+
}
|
|
445
|
+
} catch (err) {
|
|
446
|
+
callback(err);
|
|
447
|
+
}
|
|
448
|
+
return;
|
|
449
|
+
}
|
|
450
|
+
res(language, namespace, callback);
|
|
451
|
+
return;
|
|
452
|
+
}
|
|
453
|
+
callback(null, res && res[language] && res[language][namespace]);
|
|
454
|
+
}
|
|
455
|
+
};
|
|
550
456
|
};
|
|
551
457
|
|
|
552
458
|
// eslint-disable-next-line import/no-mutable-exports
|
|
553
459
|
var taxonomies = {};
|
|
554
|
-
var initializeI18n = function
|
|
555
|
-
var
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
460
|
+
var initializeI18n = /*#__PURE__*/function () {
|
|
461
|
+
var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
462
|
+
var _window$globalProps, _window$globalProps2;
|
|
463
|
+
var hostTranslations,
|
|
464
|
+
enableDirAttribute,
|
|
465
|
+
userLanguage,
|
|
466
|
+
translationImports,
|
|
467
|
+
englishTranslations,
|
|
468
|
+
englishResource,
|
|
469
|
+
resources,
|
|
470
|
+
defaultTaxonomyKeys,
|
|
471
|
+
defaultTaxonomies,
|
|
472
|
+
hostTaxonomies,
|
|
473
|
+
_args = arguments;
|
|
474
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
475
|
+
while (1) switch (_context.prev = _context.next) {
|
|
476
|
+
case 0:
|
|
477
|
+
hostTranslations = _args.length > 0 && _args[0] !== undefined ? _args[0] : {};
|
|
478
|
+
enableDirAttribute = _args.length > 1 && _args[1] !== undefined ? _args[1] : true;
|
|
479
|
+
document.documentElement.removeAttribute("lang");
|
|
480
|
+
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;
|
|
481
|
+
if (userLanguage) document.documentElement.setAttribute("lang", userLanguage);
|
|
482
|
+
translationImports = preval.require("../../configs/scripts/buildTranslationImports.js");
|
|
483
|
+
englishTranslations = preval.require("../../configs/scripts/getEnglishTranslation.js");
|
|
484
|
+
englishResource = {
|
|
485
|
+
en: {
|
|
486
|
+
translation: englishTranslations || {}
|
|
487
|
+
}
|
|
488
|
+
};
|
|
489
|
+
resources = mergeDeepLeft(hostTranslations, englishResource);
|
|
490
|
+
defaultTaxonomyKeys = Object.keys(resources.en.translation.taxonomyDefaultLabels || {});
|
|
491
|
+
defaultTaxonomies = Object.fromEntries(defaultTaxonomyKeys.map(function (key) {
|
|
492
|
+
return [key, {
|
|
493
|
+
singular: null,
|
|
494
|
+
plural: null
|
|
495
|
+
}];
|
|
496
|
+
}));
|
|
497
|
+
hostTaxonomies = ((_window$globalProps2 = window.globalProps) === null || _window$globalProps2 === void 0 ? void 0 : _window$globalProps2.taxonomies) || {};
|
|
498
|
+
taxonomies = _replaceNullValuesWithGetter(mergeDeepLeft(hostTaxonomies, defaultTaxonomies));
|
|
499
|
+
_context.next = 15;
|
|
500
|
+
return i18next.use(Browser).use(initReactI18next).use(sentenceCaseProcessor).use(resourcesToBackend(function (language) {
|
|
501
|
+
return _retryImport(translationImports === null || translationImports === void 0 ? void 0 : translationImports[language]);
|
|
502
|
+
})).init({
|
|
503
|
+
resources: resources,
|
|
504
|
+
partialBundledLanguages: true,
|
|
505
|
+
fallbackLng: "en",
|
|
506
|
+
interpolation: {
|
|
507
|
+
defaultVariables: {
|
|
508
|
+
taxonomies: taxonomies
|
|
509
|
+
},
|
|
510
|
+
escapeValue: false,
|
|
511
|
+
skipOnVariables: false,
|
|
512
|
+
alwaysFormat: true,
|
|
513
|
+
format: function format(value, _format, lng, options) {
|
|
514
|
+
var newValue = value;
|
|
515
|
+
if (LIST_FORMATS.includes(_format)) {
|
|
516
|
+
newValue = listFormatter({
|
|
517
|
+
value: newValue,
|
|
518
|
+
format: _format,
|
|
519
|
+
lng: lng,
|
|
520
|
+
options: options
|
|
521
|
+
});
|
|
522
|
+
return newValue;
|
|
523
|
+
}
|
|
524
|
+
return lowerCaseDynamicTextFormatter(newValue, _format);
|
|
525
|
+
}
|
|
526
|
+
},
|
|
527
|
+
postProcess: [sentenceCaseProcessor.name],
|
|
528
|
+
detection: {
|
|
529
|
+
order: ["querystring", "htmlTag", "navigator", "cookie"],
|
|
530
|
+
caches: ["cookie"],
|
|
531
|
+
lookupQuerystring: "lang",
|
|
532
|
+
lookupCookie: "lang"
|
|
533
|
+
}
|
|
594
534
|
});
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
535
|
+
case 15:
|
|
536
|
+
if (enableDirAttribute) {
|
|
537
|
+
document.documentElement.setAttribute("dir", i18next.dir() || "ltr");
|
|
538
|
+
}
|
|
539
|
+
if (!userLanguage) {
|
|
540
|
+
document.documentElement.setAttribute("lang", i18next.resolvedLanguage || "en");
|
|
541
|
+
}
|
|
542
|
+
case 17:
|
|
543
|
+
case "end":
|
|
544
|
+
return _context.stop();
|
|
598
545
|
}
|
|
599
|
-
},
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
lookupCookie: "lang"
|
|
606
|
-
}
|
|
607
|
-
});
|
|
608
|
-
if (enableDirAttribute) {
|
|
609
|
-
document.documentElement.setAttribute("dir", i18next.dir() || "ltr");
|
|
610
|
-
}
|
|
611
|
-
if (!userLanguage) {
|
|
612
|
-
document.documentElement.setAttribute("lang", i18next.resolvedLanguage || "en");
|
|
613
|
-
}
|
|
614
|
-
};
|
|
546
|
+
}, _callee);
|
|
547
|
+
}));
|
|
548
|
+
return function initializeI18n() {
|
|
549
|
+
return _ref.apply(this, arguments);
|
|
550
|
+
};
|
|
551
|
+
}();
|
|
615
552
|
|
|
616
553
|
export { initializeI18n as default, taxonomies };
|
|
617
554
|
//# sourceMappingURL=i18n.js.map
|