@bigbinary/neeto-commons-frontend 4.13.113 → 4.13.115

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.
Files changed (132) hide show
  1. package/configs/vite/index.js +8 -1
  2. package/dist/.ready +1 -1
  3. package/dist/asyncToGenerator-CPKhuIh2.js +28 -0
  4. package/dist/asyncToGenerator-CPKhuIh2.js.map +1 -0
  5. package/dist/cjs/asyncToGenerator-8vhqAwJl.js +30 -0
  6. package/dist/cjs/asyncToGenerator-8vhqAwJl.js.map +1 -0
  7. package/dist/cjs/initializers/dayjs.js +1 -2
  8. package/dist/cjs/initializers/dayjs.js.map +1 -1
  9. package/dist/cjs/initializers/i18n.js +279 -250
  10. package/dist/cjs/initializers/i18n.js.map +1 -1
  11. package/dist/cjs/initializers/index.js +12 -11
  12. package/dist/cjs/initializers/index.js.map +1 -1
  13. package/dist/cjs/{lodash-Cj5Dn9eh.js → lodash-D5cnLa2T.js} +4 -4
  14. package/dist/cjs/{lodash-Cj5Dn9eh.js.map → lodash-D5cnLa2T.js.map} +1 -1
  15. package/dist/cjs/react-utils/BrowserPushNotifications/index.js +1 -2
  16. package/dist/cjs/react-utils/BrowserPushNotifications/index.js.map +1 -1
  17. package/dist/cjs/react-utils/BrowserPushNotifications/pushHelper.js +48 -50
  18. package/dist/cjs/react-utils/BrowserPushNotifications/pushHelper.js.map +1 -1
  19. package/dist/cjs/react-utils/BrowserPushNotifications/registerServiceWorker.js +64 -70
  20. package/dist/cjs/react-utils/BrowserPushNotifications/registerServiceWorker.js.map +1 -1
  21. package/dist/cjs/react-utils/index.js +2 -3
  22. package/dist/cjs/react-utils/index.js.map +1 -1
  23. package/dist/cjs/react-utils/mount/index.js +1 -2
  24. package/dist/cjs/react-utils/mount/index.js.map +1 -1
  25. package/dist/cjs/react-utils/mount/mount.js +31 -31
  26. package/dist/cjs/react-utils/mount/mount.js.map +1 -1
  27. package/dist/cjs/react-utils/useFetchNeetoApps/index.js +1 -2
  28. package/dist/cjs/react-utils/useFetchNeetoApps/index.js.map +1 -1
  29. package/dist/cjs/react-utils/useFetchNeetoApps/useFetchNeetoApps.js +1 -2
  30. package/dist/cjs/react-utils/useFetchNeetoApps/useFetchNeetoApps.js.map +1 -1
  31. package/dist/cjs/react-utils/useLocalStorage/index.js +2 -3
  32. package/dist/cjs/react-utils/useLocalStorage/index.js.map +1 -1
  33. package/dist/cjs/react-utils/useLocalStorage/useLocalStorage.js +2 -3
  34. package/dist/cjs/react-utils/useLocalStorage/useLocalStorage.js.map +1 -1
  35. package/dist/cjs/react-utils/usePersistedQuery/index.js +1 -2
  36. package/dist/cjs/react-utils/usePersistedQuery/index.js.map +1 -1
  37. package/dist/cjs/react-utils/usePersistedQuery/usePersistedQuery.js +1 -2
  38. package/dist/cjs/react-utils/usePersistedQuery/usePersistedQuery.js.map +1 -1
  39. package/dist/cjs/react-utils/useQueryParams/index.js +1 -2
  40. package/dist/cjs/react-utils/useQueryParams/index.js.map +1 -1
  41. package/dist/cjs/react-utils/useQueryParams/useQueryParams.js +1 -2
  42. package/dist/cjs/react-utils/useQueryParams/useQueryParams.js.map +1 -1
  43. package/dist/cjs/react-utils/useRegisterNavigationCheckpoint/index.js +1 -2
  44. package/dist/cjs/react-utils/useRegisterNavigationCheckpoint/index.js.map +1 -1
  45. package/dist/cjs/react-utils/useRegisterNavigationCheckpoint/useRegisterNavigationCheckpoint.js +1 -2
  46. package/dist/cjs/react-utils/useRegisterNavigationCheckpoint/useRegisterNavigationCheckpoint.js.map +1 -1
  47. package/dist/cjs/utils/captureAnalyticsEvent.js +1 -2
  48. package/dist/cjs/utils/captureAnalyticsEvent.js.map +1 -1
  49. package/dist/cjs/utils/captureAnalyticsPageView.js +1 -2
  50. package/dist/cjs/utils/captureAnalyticsPageView.js.map +1 -1
  51. package/dist/cjs/utils/createSubscription.js +1 -2
  52. package/dist/cjs/utils/createSubscription.js.map +1 -1
  53. package/dist/cjs/utils/datetime.js +1 -2
  54. package/dist/cjs/utils/datetime.js.map +1 -1
  55. package/dist/cjs/utils/dayjsFormatOverrides/default.js +8 -8
  56. package/dist/cjs/utils/dayjsFormatOverrides/default.js.map +1 -1
  57. package/dist/cjs/utils/deviceInformation.js +42 -50
  58. package/dist/cjs/utils/deviceInformation.js.map +1 -1
  59. package/dist/cjs/utils/general.js +26 -25
  60. package/dist/cjs/utils/general.js.map +1 -1
  61. package/dist/cjs/utils/index.js +2 -3
  62. package/dist/cjs/utils/index.js.map +1 -1
  63. package/dist/cjs/utils/localePlugin.js +26 -26
  64. package/dist/cjs/utils/localePlugin.js.map +1 -1
  65. package/dist/initializers/dayjs.js +1 -2
  66. package/dist/initializers/dayjs.js.map +1 -1
  67. package/dist/initializers/i18n.js +279 -250
  68. package/dist/initializers/i18n.js.map +1 -1
  69. package/dist/initializers/index.js +12 -11
  70. package/dist/initializers/index.js.map +1 -1
  71. package/dist/{lodash-DLwQ1MG1.js → lodash-DUiF2pG-.js} +2 -2
  72. package/dist/{lodash-DLwQ1MG1.js.map → lodash-DUiF2pG-.js.map} +1 -1
  73. package/dist/react-utils/BrowserPushNotifications/index.js +1 -2
  74. package/dist/react-utils/BrowserPushNotifications/index.js.map +1 -1
  75. package/dist/react-utils/BrowserPushNotifications/pushHelper.js +48 -50
  76. package/dist/react-utils/BrowserPushNotifications/pushHelper.js.map +1 -1
  77. package/dist/react-utils/BrowserPushNotifications/registerServiceWorker.js +64 -70
  78. package/dist/react-utils/BrowserPushNotifications/registerServiceWorker.js.map +1 -1
  79. package/dist/react-utils/index.js +2 -3
  80. package/dist/react-utils/index.js.map +1 -1
  81. package/dist/react-utils/mount/index.js +1 -2
  82. package/dist/react-utils/mount/index.js.map +1 -1
  83. package/dist/react-utils/mount/mount.js +31 -31
  84. package/dist/react-utils/mount/mount.js.map +1 -1
  85. package/dist/react-utils/useFetchNeetoApps/index.js +1 -2
  86. package/dist/react-utils/useFetchNeetoApps/index.js.map +1 -1
  87. package/dist/react-utils/useFetchNeetoApps/useFetchNeetoApps.js +1 -2
  88. package/dist/react-utils/useFetchNeetoApps/useFetchNeetoApps.js.map +1 -1
  89. package/dist/react-utils/useLocalStorage/index.js +2 -3
  90. package/dist/react-utils/useLocalStorage/index.js.map +1 -1
  91. package/dist/react-utils/useLocalStorage/useLocalStorage.js +2 -3
  92. package/dist/react-utils/useLocalStorage/useLocalStorage.js.map +1 -1
  93. package/dist/react-utils/usePersistedQuery/index.js +1 -2
  94. package/dist/react-utils/usePersistedQuery/index.js.map +1 -1
  95. package/dist/react-utils/usePersistedQuery/usePersistedQuery.js +1 -2
  96. package/dist/react-utils/usePersistedQuery/usePersistedQuery.js.map +1 -1
  97. package/dist/react-utils/useQueryParams/index.js +1 -2
  98. package/dist/react-utils/useQueryParams/index.js.map +1 -1
  99. package/dist/react-utils/useQueryParams/useQueryParams.js +1 -2
  100. package/dist/react-utils/useQueryParams/useQueryParams.js.map +1 -1
  101. package/dist/react-utils/useRegisterNavigationCheckpoint/index.js +1 -2
  102. package/dist/react-utils/useRegisterNavigationCheckpoint/index.js.map +1 -1
  103. package/dist/react-utils/useRegisterNavigationCheckpoint/useRegisterNavigationCheckpoint.js +1 -2
  104. package/dist/react-utils/useRegisterNavigationCheckpoint/useRegisterNavigationCheckpoint.js.map +1 -1
  105. package/dist/utils/captureAnalyticsEvent.js +1 -2
  106. package/dist/utils/captureAnalyticsEvent.js.map +1 -1
  107. package/dist/utils/captureAnalyticsPageView.js +1 -2
  108. package/dist/utils/captureAnalyticsPageView.js.map +1 -1
  109. package/dist/utils/createSubscription.js +1 -2
  110. package/dist/utils/createSubscription.js.map +1 -1
  111. package/dist/utils/datetime.js +1 -2
  112. package/dist/utils/datetime.js.map +1 -1
  113. package/dist/utils/dayjsFormatOverrides/default.js +8 -8
  114. package/dist/utils/dayjsFormatOverrides/default.js.map +1 -1
  115. package/dist/utils/deviceInformation.js +42 -50
  116. package/dist/utils/deviceInformation.js.map +1 -1
  117. package/dist/utils/general.js +26 -25
  118. package/dist/utils/general.js.map +1 -1
  119. package/dist/utils/index.js +2 -3
  120. package/dist/utils/index.js.map +1 -1
  121. package/dist/utils/localePlugin.js +26 -26
  122. package/dist/utils/localePlugin.js.map +1 -1
  123. package/package.json +29 -28
  124. package/utils.d.ts +12 -12
  125. package/dist/_commonjsHelpers-BFTU3MAI.js +0 -8
  126. package/dist/_commonjsHelpers-BFTU3MAI.js.map +0 -1
  127. package/dist/cjs/_commonjsHelpers-BJu3ubxk.js +0 -11
  128. package/dist/cjs/_commonjsHelpers-BJu3ubxk.js.map +0 -1
  129. package/dist/cjs/index-bFmfHzbL.js +0 -378
  130. package/dist/cjs/index-bFmfHzbL.js.map +0 -1
  131. package/dist/index-DbuxAQMD.js +0 -375
  132. package/dist/index-DbuxAQMD.js.map +0 -1
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var toConsumableArray = require('../toConsumableArray-tBKHqzE3.js');
6
- var index = require('../index-bFmfHzbL.js');
6
+ var asyncToGenerator = require('../asyncToGenerator-8vhqAwJl.js');
7
7
  var i18next = require('i18next');
8
8
  var ramda = require('ramda');
9
9
  var reactI18next = require('react-i18next');
@@ -13,101 +13,68 @@ var initializers_utils_index = require('./utils/index.js');
13
13
  var initializers_utils_customFormatters = require('./utils/customFormatters.js');
14
14
  var initializers_utils_customPostProcessors = require('./utils/customPostProcessors.js');
15
15
  require('../unsupportedIterableToArray-BoHMiKNA.js');
16
- require('../_commonjsHelpers-BJu3ubxk.js');
17
16
  require('../typeof-D4ZZ_FlZ.js');
18
17
  require('../slicedToArray-BcL7fKuL.js');
19
18
  require('dompurify');
20
19
 
21
- function _classCallCheck(a, n) {
22
- if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
23
- }
24
-
25
- function _typeof(o) {
26
- "@babel/helpers - typeof";
27
-
28
- return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
29
- return typeof o;
30
- } : function (o) {
31
- return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
32
- }, _typeof(o);
33
- }
34
-
35
- function toPrimitive(t, r) {
36
- if ("object" != _typeof(t) || !t) return t;
37
- var e = t[Symbol.toPrimitive];
38
- if (void 0 !== e) {
39
- var i = e.call(t, r);
40
- if ("object" != _typeof(i)) return i;
41
- throw new TypeError("@@toPrimitive must return a primitive value.");
42
- }
43
- return (String )(t);
44
- }
45
-
46
- function toPropertyKey(t) {
47
- var i = toPrimitive(t, "string");
48
- return "symbol" == _typeof(i) ? i : i + "";
49
- }
50
-
51
- function _defineProperties(e, r) {
52
- for (var t = 0; t < r.length; t++) {
53
- var o = r[t];
54
- o.enumerable = o.enumerable || false, o.configurable = true, "value" in o && (o.writable = true), Object.defineProperty(e, toPropertyKey(o.key), o);
55
- }
56
- }
57
- function _createClass(e, r, t) {
58
- return r && _defineProperties(e.prototype, r), Object.defineProperty(e, "prototype", {
59
- writable: false
60
- }), e;
61
- }
62
-
63
- var arr = [];
64
- var each = arr.forEach;
65
- var slice = arr.slice;
20
+ const {
21
+ slice,
22
+ forEach
23
+ } = [];
66
24
  function defaults(obj) {
67
- each.call(slice.call(arguments, 1), function (source) {
25
+ forEach.call(slice.call(arguments, 1), source => {
68
26
  if (source) {
69
- for (var prop in source) {
27
+ for (const prop in source) {
70
28
  if (obj[prop] === undefined) obj[prop] = source[prop];
71
29
  }
72
30
  }
73
31
  });
74
32
  return obj;
75
33
  }
34
+ function hasXSS(input) {
35
+ if (typeof input !== 'string') return false;
36
+
37
+ // Common XSS attack patterns
38
+ const xssPatterns = [/<\s*script.*?>/i, /<\s*\/\s*script\s*>/i, /<\s*img.*?on\w+\s*=/i, /<\s*\w+\s*on\w+\s*=.*?>/i, /javascript\s*:/i, /vbscript\s*:/i, /expression\s*\(/i, /eval\s*\(/i, /alert\s*\(/i, /document\.cookie/i, /document\.write\s*\(/i, /window\.location/i, /innerHTML/i];
39
+ return xssPatterns.some(pattern => pattern.test(input));
40
+ }
76
41
 
77
42
  // eslint-disable-next-line no-control-regex
78
- var fieldContentRegExp = /^[\u0009\u0020-\u007e\u0080-\u00ff]+$/;
79
- var serializeCookie = function serializeCookie(name, val, options) {
80
- var opt = options || {};
81
- opt.path = opt.path || '/';
82
- var value = encodeURIComponent(val);
83
- var str = "".concat(name, "=").concat(value);
43
+ const fieldContentRegExp = /^[\u0009\u0020-\u007e\u0080-\u00ff]+$/;
44
+ const serializeCookie = function (name, val) {
45
+ let options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {
46
+ path: '/'
47
+ };
48
+ const opt = options;
49
+ const value = encodeURIComponent(val);
50
+ let str = `${name}=${value}`;
84
51
  if (opt.maxAge > 0) {
85
- var maxAge = opt.maxAge - 0;
52
+ const maxAge = opt.maxAge - 0;
86
53
  if (Number.isNaN(maxAge)) throw new Error('maxAge should be a Number');
87
- str += "; Max-Age=".concat(Math.floor(maxAge));
54
+ str += `; Max-Age=${Math.floor(maxAge)}`;
88
55
  }
89
56
  if (opt.domain) {
90
57
  if (!fieldContentRegExp.test(opt.domain)) {
91
58
  throw new TypeError('option domain is invalid');
92
59
  }
93
- str += "; Domain=".concat(opt.domain);
60
+ str += `; Domain=${opt.domain}`;
94
61
  }
95
62
  if (opt.path) {
96
63
  if (!fieldContentRegExp.test(opt.path)) {
97
64
  throw new TypeError('option path is invalid');
98
65
  }
99
- str += "; Path=".concat(opt.path);
66
+ str += `; Path=${opt.path}`;
100
67
  }
101
68
  if (opt.expires) {
102
69
  if (typeof opt.expires.toUTCString !== 'function') {
103
70
  throw new TypeError('option expires is invalid');
104
71
  }
105
- str += "; Expires=".concat(opt.expires.toUTCString());
72
+ str += `; Expires=${opt.expires.toUTCString()}`;
106
73
  }
107
74
  if (opt.httpOnly) str += '; HttpOnly';
108
75
  if (opt.secure) str += '; Secure';
109
76
  if (opt.sameSite) {
110
- var sameSite = typeof opt.sameSite === 'string' ? opt.sameSite.toLowerCase() : opt.sameSite;
77
+ const sameSite = typeof opt.sameSite === 'string' ? opt.sameSite.toLowerCase() : opt.sameSite;
111
78
  switch (sameSite) {
112
79
  case true:
113
80
  str += '; SameSite=Strict';
@@ -125,11 +92,12 @@ var serializeCookie = function serializeCookie(name, val, options) {
125
92
  throw new TypeError('option sameSite is invalid');
126
93
  }
127
94
  }
95
+ if (opt.partitioned) str += '; Partitioned';
128
96
  return str;
129
97
  };
130
- var cookie = {
131
- create: function create(name, value, minutes, domain) {
132
- var cookieOptions = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {
98
+ const cookie = {
99
+ create(name, value, minutes, domain) {
100
+ let cookieOptions = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {
133
101
  path: '/',
134
102
  sameSite: 'strict'
135
103
  };
@@ -138,55 +106,70 @@ var cookie = {
138
106
  cookieOptions.expires.setTime(cookieOptions.expires.getTime() + minutes * 60 * 1000);
139
107
  }
140
108
  if (domain) cookieOptions.domain = domain;
141
- document.cookie = serializeCookie(name, encodeURIComponent(value), cookieOptions);
109
+ document.cookie = serializeCookie(name, value, cookieOptions);
142
110
  },
143
- read: function read(name) {
144
- var nameEQ = "".concat(name, "=");
145
- var ca = document.cookie.split(';');
146
- for (var i = 0; i < ca.length; i++) {
147
- var c = ca[i];
111
+ read(name) {
112
+ const nameEQ = `${name}=`;
113
+ const ca = document.cookie.split(';');
114
+ for (let i = 0; i < ca.length; i++) {
115
+ let c = ca[i];
148
116
  while (c.charAt(0) === ' ') c = c.substring(1, c.length);
149
117
  if (c.indexOf(nameEQ) === 0) return c.substring(nameEQ.length, c.length);
150
118
  }
151
119
  return null;
152
120
  },
153
- remove: function remove(name) {
154
- this.create(name, '', -1);
121
+ remove(name, domain) {
122
+ this.create(name, '', -1, domain);
155
123
  }
156
124
  };
157
125
  var cookie$1 = {
158
126
  name: 'cookie',
159
- lookup: function lookup(options) {
160
- var found;
161
- if (options.lookupCookie && typeof document !== 'undefined') {
162
- var c = cookie.read(options.lookupCookie);
163
- if (c) found = c;
127
+ // Deconstruct the options object and extract the lookupCookie property
128
+ lookup(_ref) {
129
+ let {
130
+ lookupCookie
131
+ } = _ref;
132
+ if (lookupCookie && typeof document !== 'undefined') {
133
+ return cookie.read(lookupCookie) || undefined;
164
134
  }
165
- return found;
135
+ return undefined;
166
136
  },
167
- cacheUserLanguage: function cacheUserLanguage(lng, options) {
168
- if (options.lookupCookie && typeof document !== 'undefined') {
169
- cookie.create(options.lookupCookie, lng, options.cookieMinutes, options.cookieDomain, options.cookieOptions);
137
+ // Deconstruct the options object and extract the lookupCookie, cookieMinutes, cookieDomain, and cookieOptions properties
138
+ cacheUserLanguage(lng, _ref2) {
139
+ let {
140
+ lookupCookie,
141
+ cookieMinutes,
142
+ cookieDomain,
143
+ cookieOptions
144
+ } = _ref2;
145
+ if (lookupCookie && typeof document !== 'undefined') {
146
+ cookie.create(lookupCookie, lng, cookieMinutes, cookieDomain, cookieOptions);
170
147
  }
171
148
  }
172
149
  };
173
150
 
174
151
  var querystring = {
175
152
  name: 'querystring',
176
- lookup: function lookup(options) {
177
- var found;
153
+ // Deconstruct the options object and extract the lookupQuerystring property
154
+ lookup(_ref) {
155
+ let {
156
+ lookupQuerystring
157
+ } = _ref;
158
+ let found;
178
159
  if (typeof window !== 'undefined') {
179
- var search = window.location.search;
180
- if (!window.location.search && window.location.hash && window.location.hash.indexOf('?') > -1) {
160
+ let {
161
+ search
162
+ } = window.location;
163
+ if (!window.location.search && window.location.hash?.indexOf('?') > -1) {
181
164
  search = window.location.hash.substring(window.location.hash.indexOf('?'));
182
165
  }
183
- var query = search.substring(1);
184
- var params = query.split('&');
185
- for (var i = 0; i < params.length; i++) {
186
- var pos = params[i].indexOf('=');
166
+ const query = search.substring(1);
167
+ const params = query.split('&');
168
+ for (let i = 0; i < params.length; i++) {
169
+ const pos = params[i].indexOf('=');
187
170
  if (pos > 0) {
188
- var key = params[i].substring(0, pos);
189
- if (key === options.lookupQuerystring) {
171
+ const key = params[i].substring(0, pos);
172
+ if (key === lookupQuerystring) {
190
173
  found = params[i].substring(pos + 1);
191
174
  }
192
175
  }
@@ -196,12 +179,55 @@ var querystring = {
196
179
  }
197
180
  };
198
181
 
199
- var hasLocalStorageSupport = null;
200
- var localStorageAvailable = function localStorageAvailable() {
182
+ var hash = {
183
+ name: 'hash',
184
+ // Deconstruct the options object and extract the lookupHash property and the lookupFromHashIndex property
185
+ lookup(_ref) {
186
+ let {
187
+ lookupHash,
188
+ lookupFromHashIndex
189
+ } = _ref;
190
+ let found;
191
+ if (typeof window !== 'undefined') {
192
+ const {
193
+ hash
194
+ } = window.location;
195
+ if (hash && hash.length > 2) {
196
+ const query = hash.substring(1);
197
+ if (lookupHash) {
198
+ const params = query.split('&');
199
+ for (let i = 0; i < params.length; i++) {
200
+ const pos = params[i].indexOf('=');
201
+ if (pos > 0) {
202
+ const key = params[i].substring(0, pos);
203
+ if (key === lookupHash) {
204
+ found = params[i].substring(pos + 1);
205
+ }
206
+ }
207
+ }
208
+ }
209
+ if (found) return found;
210
+ if (!found && lookupFromHashIndex > -1) {
211
+ const language = hash.match(/\/([a-zA-Z-]*)/g);
212
+ if (!Array.isArray(language)) return undefined;
213
+ const index = typeof lookupFromHashIndex === 'number' ? lookupFromHashIndex : 0;
214
+ return language[index]?.replace('/', '');
215
+ }
216
+ }
217
+ }
218
+ return found;
219
+ }
220
+ };
221
+
222
+ let hasLocalStorageSupport = null;
223
+ const localStorageAvailable = () => {
201
224
  if (hasLocalStorageSupport !== null) return hasLocalStorageSupport;
202
225
  try {
203
- hasLocalStorageSupport = window !== 'undefined' && window.localStorage !== null;
204
- var testKey = 'i18next.translate.boo';
226
+ hasLocalStorageSupport = typeof window !== 'undefined' && window.localStorage !== null;
227
+ if (!hasLocalStorageSupport) {
228
+ return false;
229
+ }
230
+ const testKey = 'i18next.translate.boo';
205
231
  window.localStorage.setItem(testKey, 'foo');
206
232
  window.localStorage.removeItem(testKey);
207
233
  } catch (e) {
@@ -211,27 +237,36 @@ var localStorageAvailable = function localStorageAvailable() {
211
237
  };
212
238
  var localStorage = {
213
239
  name: 'localStorage',
214
- lookup: function lookup(options) {
215
- var found;
216
- if (options.lookupLocalStorage && localStorageAvailable()) {
217
- var lng = window.localStorage.getItem(options.lookupLocalStorage);
218
- if (lng) found = lng;
240
+ // Deconstruct the options object and extract the lookupLocalStorage property
241
+ lookup(_ref) {
242
+ let {
243
+ lookupLocalStorage
244
+ } = _ref;
245
+ if (lookupLocalStorage && localStorageAvailable()) {
246
+ return window.localStorage.getItem(lookupLocalStorage) || undefined; // Undefined ensures type consistency with the previous version of this function
219
247
  }
220
- return found;
248
+ return undefined;
221
249
  },
222
- cacheUserLanguage: function cacheUserLanguage(lng, options) {
223
- if (options.lookupLocalStorage && localStorageAvailable()) {
224
- window.localStorage.setItem(options.lookupLocalStorage, lng);
250
+ // Deconstruct the options object and extract the lookupLocalStorage property
251
+ cacheUserLanguage(lng, _ref2) {
252
+ let {
253
+ lookupLocalStorage
254
+ } = _ref2;
255
+ if (lookupLocalStorage && localStorageAvailable()) {
256
+ window.localStorage.setItem(lookupLocalStorage, lng);
225
257
  }
226
258
  }
227
259
  };
228
260
 
229
- var hasSessionStorageSupport = null;
230
- var sessionStorageAvailable = function sessionStorageAvailable() {
261
+ let hasSessionStorageSupport = null;
262
+ const sessionStorageAvailable = () => {
231
263
  if (hasSessionStorageSupport !== null) return hasSessionStorageSupport;
232
264
  try {
233
- hasSessionStorageSupport = window !== 'undefined' && window.sessionStorage !== null;
234
- var testKey = 'i18next.translate.boo';
265
+ hasSessionStorageSupport = typeof window !== 'undefined' && window.sessionStorage !== null;
266
+ if (!hasSessionStorageSupport) {
267
+ return false;
268
+ }
269
+ const testKey = 'i18next.translate.boo';
235
270
  window.sessionStorage.setItem(testKey, 'foo');
236
271
  window.sessionStorage.removeItem(testKey);
237
272
  } catch (e) {
@@ -241,37 +276,46 @@ var sessionStorageAvailable = function sessionStorageAvailable() {
241
276
  };
242
277
  var sessionStorage = {
243
278
  name: 'sessionStorage',
244
- lookup: function lookup(options) {
245
- var found;
246
- if (options.lookupSessionStorage && sessionStorageAvailable()) {
247
- var lng = window.sessionStorage.getItem(options.lookupSessionStorage);
248
- if (lng) found = lng;
279
+ lookup(_ref) {
280
+ let {
281
+ lookupSessionStorage
282
+ } = _ref;
283
+ if (lookupSessionStorage && sessionStorageAvailable()) {
284
+ return window.sessionStorage.getItem(lookupSessionStorage) || undefined;
249
285
  }
250
- return found;
286
+ return undefined;
251
287
  },
252
- cacheUserLanguage: function cacheUserLanguage(lng, options) {
253
- if (options.lookupSessionStorage && sessionStorageAvailable()) {
254
- window.sessionStorage.setItem(options.lookupSessionStorage, lng);
288
+ cacheUserLanguage(lng, _ref2) {
289
+ let {
290
+ lookupSessionStorage
291
+ } = _ref2;
292
+ if (lookupSessionStorage && sessionStorageAvailable()) {
293
+ window.sessionStorage.setItem(lookupSessionStorage, lng);
255
294
  }
256
295
  }
257
296
  };
258
297
 
259
298
  var navigator$1 = {
260
299
  name: 'navigator',
261
- lookup: function lookup(options) {
262
- var found = [];
300
+ lookup(options) {
301
+ const found = [];
263
302
  if (typeof navigator !== 'undefined') {
264
- if (navigator.languages) {
303
+ const {
304
+ languages,
305
+ userLanguage,
306
+ language
307
+ } = navigator;
308
+ if (languages) {
265
309
  // chrome only; not an array, so can't use .push.apply instead of iterating
266
- for (var i = 0; i < navigator.languages.length; i++) {
267
- found.push(navigator.languages[i]);
310
+ for (let i = 0; i < languages.length; i++) {
311
+ found.push(languages[i]);
268
312
  }
269
313
  }
270
- if (navigator.userLanguage) {
271
- found.push(navigator.userLanguage);
314
+ if (userLanguage) {
315
+ found.push(userLanguage);
272
316
  }
273
- if (navigator.language) {
274
- found.push(navigator.language);
317
+ if (language) {
318
+ found.push(language);
275
319
  }
276
320
  }
277
321
  return found.length > 0 ? found : undefined;
@@ -280,11 +324,15 @@ var navigator$1 = {
280
324
 
281
325
  var htmlTag = {
282
326
  name: 'htmlTag',
283
- lookup: function lookup(options) {
284
- var found;
285
- var htmlTag = options.htmlTag || (typeof document !== 'undefined' ? document.documentElement : null);
286
- if (htmlTag && typeof htmlTag.getAttribute === 'function') {
287
- found = htmlTag.getAttribute('lang');
327
+ // Deconstruct the options object and extract the htmlTag property
328
+ lookup(_ref) {
329
+ let {
330
+ htmlTag
331
+ } = _ref;
332
+ let found;
333
+ const internalHtmlTag = htmlTag || (typeof document !== 'undefined' ? document.documentElement : null);
334
+ if (internalHtmlTag && typeof internalHtmlTag.getAttribute === 'function') {
335
+ found = internalHtmlTag.getAttribute('lang');
288
336
  }
289
337
  return found;
290
338
  }
@@ -292,143 +340,122 @@ var htmlTag = {
292
340
 
293
341
  var path = {
294
342
  name: 'path',
295
- lookup: function lookup(options) {
296
- var found;
297
- if (typeof window !== 'undefined') {
298
- var language = window.location.pathname.match(/\/([a-zA-Z-]*)/g);
299
- if (language instanceof Array) {
300
- if (typeof options.lookupFromPathIndex === 'number') {
301
- if (typeof language[options.lookupFromPathIndex] !== 'string') {
302
- return undefined;
303
- }
304
- found = language[options.lookupFromPathIndex].replace('/', '');
305
- } else {
306
- found = language[0].replace('/', '');
307
- }
308
- }
309
- }
310
- return found;
343
+ // Deconstruct the options object and extract the lookupFromPathIndex property
344
+ lookup(_ref) {
345
+ let {
346
+ lookupFromPathIndex
347
+ } = _ref;
348
+ if (typeof window === 'undefined') return undefined;
349
+ const language = window.location.pathname.match(/\/([a-zA-Z-]*)/g);
350
+ if (!Array.isArray(language)) return undefined;
351
+ const index = typeof lookupFromPathIndex === 'number' ? lookupFromPathIndex : 0;
352
+ return language[index]?.replace('/', '');
311
353
  }
312
354
  };
313
355
 
314
356
  var subdomain = {
315
357
  name: 'subdomain',
316
- lookup: function lookup(options) {
358
+ lookup(_ref) {
359
+ let {
360
+ lookupFromSubdomainIndex
361
+ } = _ref;
317
362
  // If given get the subdomain index else 1
318
- var lookupFromSubdomainIndex = typeof options.lookupFromSubdomainIndex === 'number' ? options.lookupFromSubdomainIndex + 1 : 1;
363
+ const internalLookupFromSubdomainIndex = typeof lookupFromSubdomainIndex === 'number' ? lookupFromSubdomainIndex + 1 : 1;
319
364
  // get all matches if window.location. is existing
320
- // first item of match is the match itself and the second is the first group macht which sould be the first subdomain match
365
+ // first item of match is the match itself and the second is the first group match which should be the first subdomain match
321
366
  // is the hostname no public domain get the or option of localhost
322
- var language = typeof window !== 'undefined' && window.location && window.location.hostname && window.location.hostname.match(/^(\w{2,5})\.(([a-z0-9-]{1,63}\.[a-z]{2,6})|localhost)/i);
367
+ const language = typeof window !== 'undefined' && window.location?.hostname?.match(/^(\w{2,5})\.(([a-z0-9-]{1,63}\.[a-z]{2,6})|localhost)/i);
323
368
 
324
369
  // if there is no match (null) return undefined
325
370
  if (!language) return undefined;
326
371
  // return the given group match
327
- return language[lookupFromSubdomainIndex];
372
+ return language[internalLookupFromSubdomainIndex];
328
373
  }
329
374
  };
330
375
 
331
376
  // some environments, throws when accessing document.cookie
332
- var canCookies = false;
377
+ let canCookies = false;
333
378
  try {
334
379
  // eslint-disable-next-line no-unused-expressions
335
380
  document.cookie;
336
381
  canCookies = true;
337
382
  // eslint-disable-next-line no-empty
338
383
  } catch (e) {}
339
- var order = ['querystring', 'cookie', 'localStorage', 'sessionStorage', 'navigator', 'htmlTag'];
384
+ const order = ['querystring', 'cookie', 'localStorage', 'sessionStorage', 'navigator', 'htmlTag'];
340
385
  if (!canCookies) order.splice(1, 1);
341
- function getDefaults() {
342
- return {
343
- order: order,
344
- lookupQuerystring: 'lng',
345
- lookupCookie: 'i18next',
346
- lookupLocalStorage: 'i18nextLng',
347
- lookupSessionStorage: 'i18nextLng',
348
- // cache user language
349
- caches: ['localStorage'],
350
- excludeCacheFor: ['cimode'],
351
- // cookieMinutes: 10,
352
- // cookieDomain: 'myDomain'
386
+ const getDefaults = () => ({
387
+ order,
388
+ lookupQuerystring: 'lng',
389
+ lookupCookie: 'i18next',
390
+ lookupLocalStorage: 'i18nextLng',
391
+ lookupSessionStorage: 'i18nextLng',
392
+ // cache user language
393
+ caches: ['localStorage'],
394
+ excludeCacheFor: ['cimode'],
395
+ // cookieMinutes: 10,
396
+ // cookieDomain: 'myDomain'
353
397
 
354
- convertDetectedLanguage: function convertDetectedLanguage(l) {
355
- return l;
356
- }
357
- };
358
- }
359
- var Browser = /*#__PURE__*/function () {
360
- function Browser(services) {
361
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
362
- _classCallCheck(this, Browser);
398
+ convertDetectedLanguage: l => l
399
+ });
400
+ class Browser {
401
+ constructor(services) {
402
+ let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
363
403
  this.type = 'languageDetector';
364
404
  this.detectors = {};
365
405
  this.init(services, options);
366
406
  }
367
- return _createClass(Browser, [{
368
- key: "init",
369
- value: function init(services) {
370
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
371
- var i18nOptions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
372
- this.services = services || {
373
- languageUtils: {}
374
- }; // this way the language detector can be used without i18next
375
- this.options = defaults(options, this.options || {}, getDefaults());
376
- if (typeof this.options.convertDetectedLanguage === 'string' && this.options.convertDetectedLanguage.indexOf('15897') > -1) {
377
- this.options.convertDetectedLanguage = function (l) {
378
- return l.replace('-', '_');
379
- };
380
- }
381
-
382
- // backwards compatibility
383
- if (this.options.lookupFromUrlIndex) this.options.lookupFromPathIndex = this.options.lookupFromUrlIndex;
384
- this.i18nOptions = i18nOptions;
385
- this.addDetector(cookie$1);
386
- this.addDetector(querystring);
387
- this.addDetector(localStorage);
388
- this.addDetector(sessionStorage);
389
- this.addDetector(navigator$1);
390
- this.addDetector(htmlTag);
391
- this.addDetector(path);
392
- this.addDetector(subdomain);
393
- }
394
- }, {
395
- key: "addDetector",
396
- value: function addDetector(detector) {
397
- this.detectors[detector.name] = detector;
398
- return this;
399
- }
400
- }, {
401
- key: "detect",
402
- value: function detect(detectionOrder) {
403
- var _this = this;
404
- if (!detectionOrder) detectionOrder = this.options.order;
405
- var detected = [];
406
- detectionOrder.forEach(function (detectorName) {
407
- if (_this.detectors[detectorName]) {
408
- var lookup = _this.detectors[detectorName].lookup(_this.options);
409
- if (lookup && typeof lookup === 'string') lookup = [lookup];
410
- if (lookup) detected = detected.concat(lookup);
411
- }
412
- });
413
- detected = detected.map(function (d) {
414
- return _this.options.convertDetectedLanguage(d);
415
- });
416
- if (this.services.languageUtils.getBestMatchFromCodes) return detected; // new i18next v19.5.0
417
- return detected.length > 0 ? detected[0] : null; // a little backward compatibility
418
- }
419
- }, {
420
- key: "cacheUserLanguage",
421
- value: function cacheUserLanguage(lng, caches) {
422
- var _this2 = this;
423
- if (!caches) caches = this.options.caches;
424
- if (!caches) return;
425
- if (this.options.excludeCacheFor && this.options.excludeCacheFor.indexOf(lng) > -1) return;
426
- caches.forEach(function (cacheName) {
427
- if (_this2.detectors[cacheName]) _this2.detectors[cacheName].cacheUserLanguage(lng, _this2.options);
428
- });
407
+ init() {
408
+ let services = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
409
+ languageUtils: {}
410
+ };
411
+ let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
412
+ let i18nOptions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
413
+ this.services = services;
414
+ this.options = defaults(options, this.options || {}, getDefaults());
415
+ if (typeof this.options.convertDetectedLanguage === 'string' && this.options.convertDetectedLanguage.indexOf('15897') > -1) {
416
+ this.options.convertDetectedLanguage = l => l.replace('-', '_');
429
417
  }
430
- }]);
431
- }();
418
+
419
+ // backwards compatibility
420
+ if (this.options.lookupFromUrlIndex) this.options.lookupFromPathIndex = this.options.lookupFromUrlIndex;
421
+ this.i18nOptions = i18nOptions;
422
+ this.addDetector(cookie$1);
423
+ this.addDetector(querystring);
424
+ this.addDetector(localStorage);
425
+ this.addDetector(sessionStorage);
426
+ this.addDetector(navigator$1);
427
+ this.addDetector(htmlTag);
428
+ this.addDetector(path);
429
+ this.addDetector(subdomain);
430
+ this.addDetector(hash);
431
+ }
432
+ addDetector(detector) {
433
+ this.detectors[detector.name] = detector;
434
+ return this;
435
+ }
436
+ detect() {
437
+ let detectionOrder = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.options.order;
438
+ let detected = [];
439
+ detectionOrder.forEach(detectorName => {
440
+ if (this.detectors[detectorName]) {
441
+ let lookup = this.detectors[detectorName].lookup(this.options);
442
+ if (lookup && typeof lookup === 'string') lookup = [lookup];
443
+ if (lookup) detected = detected.concat(lookup);
444
+ }
445
+ });
446
+ detected = detected.filter(d => d !== undefined && d !== null && !hasXSS(d)).map(d => this.options.convertDetectedLanguage(d));
447
+ if (this.services && this.services.languageUtils && this.services.languageUtils.getBestMatchFromCodes) return detected; // new i18next v19.5.0
448
+ return detected.length > 0 ? detected[0] : null; // a little backward compatibility
449
+ }
450
+ cacheUserLanguage(lng) {
451
+ let caches = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.options.caches;
452
+ if (!caches) return;
453
+ if (this.options.excludeCacheFor && this.options.excludeCacheFor.indexOf(lng) > -1) return;
454
+ caches.forEach(cacheName => {
455
+ if (this.detectors[cacheName]) this.detectors[cacheName].cacheUserLanguage(lng, this.options);
456
+ });
457
+ }
458
+ }
432
459
  Browser.type = 'languageDetector';
433
460
 
434
461
  var resourcesToBackend = function resourcesToBackend(res) {
@@ -460,14 +487,17 @@ var resourcesToBackend = function resourcesToBackend(res) {
460
487
  };
461
488
  };
462
489
 
490
+ function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = false, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = true, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), true), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
491
+ function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2(e, r, n, t); }
492
+
463
493
  // eslint-disable-next-line import/no-mutable-exports
464
494
  exports.taxonomies = {};
465
495
  var initializeI18n = /*#__PURE__*/function () {
466
- var _ref = index._asyncToGenerator(/*#__PURE__*/index._regeneratorRuntime.mark(function _callee(hostTranslations) {
496
+ var _ref = asyncToGenerator._asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(hostTranslations) {
467
497
  var _window$globalProps, _window$globalProps2;
468
498
  var userLanguage, translationImports, englishTranslations, englishResource, resources, defaultTaxonomyKeys, defaultTaxonomies, hostTaxonomies;
469
- return index._regeneratorRuntime.wrap(function _callee$(_context) {
470
- while (1) switch (_context.prev = _context.next) {
499
+ return _regenerator().w(function (_context) {
500
+ while (1) switch (_context.n) {
471
501
  case 0:
472
502
  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;
473
503
  if (!initializers_constants.IS_CHROME_EXTENSION) {
@@ -493,7 +523,7 @@ var initializeI18n = /*#__PURE__*/function () {
493
523
  }));
494
524
  hostTaxonomies = ((_window$globalProps2 = window.globalProps) === null || _window$globalProps2 === void 0 ? void 0 : _window$globalProps2.taxonomies) || {};
495
525
  exports.taxonomies = initializers_utils_index.replaceNullValuesWithGetter(ramda.mergeDeepLeft(hostTaxonomies, defaultTaxonomies));
496
- _context.next = 12;
526
+ _context.n = 1;
497
527
  return i18next.use(Browser).use(reactI18next.initReactI18next).use(initializers_utils_customPostProcessors.sentenceCaseProcessor).use(resourcesToBackend(function (language) {
498
528
  return utils_retryImport(translationImports === null || translationImports === void 0 ? void 0 : translationImports[language]);
499
529
  })).init({
@@ -529,18 +559,17 @@ var initializeI18n = /*#__PURE__*/function () {
529
559
  lookupCookie: "lang"
530
560
  }
531
561
  });
532
- case 12:
562
+ case 1:
533
563
  if (!initializers_constants.IS_CHROME_EXTENSION) {
534
- _context.next = 14;
564
+ _context.n = 2;
535
565
  break;
536
566
  }
537
- return _context.abrupt("return");
538
- case 14:
567
+ return _context.a(2);
568
+ case 2:
539
569
  document.documentElement.setAttribute("dir", i18next.dir() || "ltr");
540
570
  document.documentElement.setAttribute("lang", i18next.resolvedLanguage || "en");
541
- case 16:
542
- case "end":
543
- return _context.stop();
571
+ case 3:
572
+ return _context.a(2);
544
573
  }
545
574
  }, _callee);
546
575
  }));