@bigbinary/neeto-commons-frontend 2.0.19 → 2.0.21
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 -1
- package/initializers.cjs.js +645 -28
- package/initializers.d.ts +3 -1
- package/initializers.js +645 -30
- package/package.json +3 -2
- package/react-utils.cjs.js +3633 -1516
- package/react-utils.d.ts +17 -0
- package/react-utils.js +3619 -1504
- package/utils.cjs.js +7 -0
- package/utils.d.ts +23 -0
- package/utils.js +7 -1
package/initializers.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { Toastr } from '@bigbinary/neetoui';
|
|
2
2
|
import axios from 'axios';
|
|
3
3
|
import i18next from 'i18next';
|
|
4
|
-
import { curryN, isNil, values, evolve, omit,
|
|
4
|
+
import { curryN, isNil, values, prop, evolve, omit, mergeDeepLeft, either, isEmpty } from 'ramda';
|
|
5
|
+
import require$$0, { useDebugValue } from 'react';
|
|
5
6
|
import { initReactI18next } from 'react-i18next';
|
|
6
7
|
import Logger from 'js-logger';
|
|
7
8
|
import mixpanel from 'mixpanel-browser';
|
|
@@ -217,6 +218,561 @@ var resetAuthTokens = function resetAuthTokens() {
|
|
|
217
218
|
});
|
|
218
219
|
};
|
|
219
220
|
|
|
221
|
+
const createStoreImpl = (createState) => {
|
|
222
|
+
let state;
|
|
223
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
224
|
+
const setState = (partial, replace) => {
|
|
225
|
+
const nextState = typeof partial === "function" ? partial(state) : partial;
|
|
226
|
+
if (!Object.is(nextState, state)) {
|
|
227
|
+
const previousState = state;
|
|
228
|
+
state = (replace != null ? replace : typeof nextState !== "object") ? nextState : Object.assign({}, state, nextState);
|
|
229
|
+
listeners.forEach((listener) => listener(state, previousState));
|
|
230
|
+
}
|
|
231
|
+
};
|
|
232
|
+
const getState = () => state;
|
|
233
|
+
const subscribe = (listener) => {
|
|
234
|
+
listeners.add(listener);
|
|
235
|
+
return () => listeners.delete(listener);
|
|
236
|
+
};
|
|
237
|
+
const destroy = () => listeners.clear();
|
|
238
|
+
const api = { setState, getState, subscribe, destroy };
|
|
239
|
+
state = createState(
|
|
240
|
+
setState,
|
|
241
|
+
getState,
|
|
242
|
+
api
|
|
243
|
+
);
|
|
244
|
+
return api;
|
|
245
|
+
};
|
|
246
|
+
const createStore = (createState) => createState ? createStoreImpl(createState) : createStoreImpl;
|
|
247
|
+
|
|
248
|
+
function getDefaultExportFromCjs (x) {
|
|
249
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
var withSelector = {exports: {}};
|
|
253
|
+
|
|
254
|
+
var withSelector_production_min = {};
|
|
255
|
+
|
|
256
|
+
var shim = {exports: {}};
|
|
257
|
+
|
|
258
|
+
var useSyncExternalStoreShim_production_min = {};
|
|
259
|
+
|
|
260
|
+
/**
|
|
261
|
+
* @license React
|
|
262
|
+
* use-sync-external-store-shim.production.min.js
|
|
263
|
+
*
|
|
264
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
265
|
+
*
|
|
266
|
+
* This source code is licensed under the MIT license found in the
|
|
267
|
+
* LICENSE file in the root directory of this source tree.
|
|
268
|
+
*/
|
|
269
|
+
|
|
270
|
+
var hasRequiredUseSyncExternalStoreShim_production_min;
|
|
271
|
+
|
|
272
|
+
function requireUseSyncExternalStoreShim_production_min () {
|
|
273
|
+
if (hasRequiredUseSyncExternalStoreShim_production_min) return useSyncExternalStoreShim_production_min;
|
|
274
|
+
hasRequiredUseSyncExternalStoreShim_production_min = 1;
|
|
275
|
+
var e=require$$0;function h(a,b){return a===b&&(0!==a||1/a===1/b)||a!==a&&b!==b}var k="function"===typeof Object.is?Object.is:h,l=e.useState,m=e.useEffect,n=e.useLayoutEffect,p=e.useDebugValue;function q(a,b){var d=b(),f=l({inst:{value:d,getSnapshot:b}}),c=f[0].inst,g=f[1];n(function(){c.value=d;c.getSnapshot=b;r(c)&&g({inst:c});},[a,d,b]);m(function(){r(c)&&g({inst:c});return a(function(){r(c)&&g({inst:c});})},[a]);p(d);return d}
|
|
276
|
+
function r(a){var b=a.getSnapshot;a=a.value;try{var d=b();return !k(a,d)}catch(f){return !0}}function t(a,b){return b()}var u="undefined"===typeof window||"undefined"===typeof window.document||"undefined"===typeof window.document.createElement?t:q;useSyncExternalStoreShim_production_min.useSyncExternalStore=void 0!==e.useSyncExternalStore?e.useSyncExternalStore:u;
|
|
277
|
+
return useSyncExternalStoreShim_production_min;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
var useSyncExternalStoreShim_development = {};
|
|
281
|
+
|
|
282
|
+
/**
|
|
283
|
+
* @license React
|
|
284
|
+
* use-sync-external-store-shim.development.js
|
|
285
|
+
*
|
|
286
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
287
|
+
*
|
|
288
|
+
* This source code is licensed under the MIT license found in the
|
|
289
|
+
* LICENSE file in the root directory of this source tree.
|
|
290
|
+
*/
|
|
291
|
+
|
|
292
|
+
var hasRequiredUseSyncExternalStoreShim_development;
|
|
293
|
+
|
|
294
|
+
function requireUseSyncExternalStoreShim_development () {
|
|
295
|
+
if (hasRequiredUseSyncExternalStoreShim_development) return useSyncExternalStoreShim_development;
|
|
296
|
+
hasRequiredUseSyncExternalStoreShim_development = 1;
|
|
297
|
+
|
|
298
|
+
if (process.env.NODE_ENV !== "production") {
|
|
299
|
+
(function() {
|
|
300
|
+
|
|
301
|
+
/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
|
|
302
|
+
if (
|
|
303
|
+
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&
|
|
304
|
+
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart ===
|
|
305
|
+
'function'
|
|
306
|
+
) {
|
|
307
|
+
__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
|
|
308
|
+
}
|
|
309
|
+
var React = require$$0;
|
|
310
|
+
|
|
311
|
+
var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
312
|
+
|
|
313
|
+
function error(format) {
|
|
314
|
+
{
|
|
315
|
+
{
|
|
316
|
+
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
317
|
+
args[_key2 - 1] = arguments[_key2];
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
printWarning('error', format, args);
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
function printWarning(level, format, args) {
|
|
326
|
+
// When changing this logic, you might want to also
|
|
327
|
+
// update consoleWithStackDev.www.js as well.
|
|
328
|
+
{
|
|
329
|
+
var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
|
|
330
|
+
var stack = ReactDebugCurrentFrame.getStackAddendum();
|
|
331
|
+
|
|
332
|
+
if (stack !== '') {
|
|
333
|
+
format += '%s';
|
|
334
|
+
args = args.concat([stack]);
|
|
335
|
+
} // eslint-disable-next-line react-internal/safe-string-coercion
|
|
336
|
+
|
|
337
|
+
|
|
338
|
+
var argsWithFormat = args.map(function (item) {
|
|
339
|
+
return String(item);
|
|
340
|
+
}); // Careful: RN currently depends on this prefix
|
|
341
|
+
|
|
342
|
+
argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it
|
|
343
|
+
// breaks IE9: https://github.com/facebook/react/issues/13610
|
|
344
|
+
// eslint-disable-next-line react-internal/no-production-logging
|
|
345
|
+
|
|
346
|
+
Function.prototype.apply.call(console[level], console, argsWithFormat);
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
/**
|
|
351
|
+
* inlined Object.is polyfill to avoid requiring consumers ship their own
|
|
352
|
+
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
|
|
353
|
+
*/
|
|
354
|
+
function is(x, y) {
|
|
355
|
+
return x === y && (x !== 0 || 1 / x === 1 / y) || x !== x && y !== y // eslint-disable-line no-self-compare
|
|
356
|
+
;
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
var objectIs = typeof Object.is === 'function' ? Object.is : is;
|
|
360
|
+
|
|
361
|
+
// dispatch for CommonJS interop named imports.
|
|
362
|
+
|
|
363
|
+
var useState = React.useState,
|
|
364
|
+
useEffect = React.useEffect,
|
|
365
|
+
useLayoutEffect = React.useLayoutEffect,
|
|
366
|
+
useDebugValue = React.useDebugValue;
|
|
367
|
+
var didWarnOld18Alpha = false;
|
|
368
|
+
var didWarnUncachedGetSnapshot = false; // Disclaimer: This shim breaks many of the rules of React, and only works
|
|
369
|
+
// because of a very particular set of implementation details and assumptions
|
|
370
|
+
// -- change any one of them and it will break. The most important assumption
|
|
371
|
+
// is that updates are always synchronous, because concurrent rendering is
|
|
372
|
+
// only available in versions of React that also have a built-in
|
|
373
|
+
// useSyncExternalStore API. And we only use this shim when the built-in API
|
|
374
|
+
// does not exist.
|
|
375
|
+
//
|
|
376
|
+
// Do not assume that the clever hacks used by this hook also work in general.
|
|
377
|
+
// The point of this shim is to replace the need for hacks by other libraries.
|
|
378
|
+
|
|
379
|
+
function useSyncExternalStore(subscribe, getSnapshot, // Note: The shim does not use getServerSnapshot, because pre-18 versions of
|
|
380
|
+
// React do not expose a way to check if we're hydrating. So users of the shim
|
|
381
|
+
// will need to track that themselves and return the correct value
|
|
382
|
+
// from `getSnapshot`.
|
|
383
|
+
getServerSnapshot) {
|
|
384
|
+
{
|
|
385
|
+
if (!didWarnOld18Alpha) {
|
|
386
|
+
if (React.startTransition !== undefined) {
|
|
387
|
+
didWarnOld18Alpha = true;
|
|
388
|
+
|
|
389
|
+
error('You are using an outdated, pre-release alpha of React 18 that ' + 'does not support useSyncExternalStore. The ' + 'use-sync-external-store shim will not work correctly. Upgrade ' + 'to a newer pre-release.');
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
} // Read the current snapshot from the store on every render. Again, this
|
|
393
|
+
// breaks the rules of React, and only works here because of specific
|
|
394
|
+
// implementation details, most importantly that updates are
|
|
395
|
+
// always synchronous.
|
|
396
|
+
|
|
397
|
+
|
|
398
|
+
var value = getSnapshot();
|
|
399
|
+
|
|
400
|
+
{
|
|
401
|
+
if (!didWarnUncachedGetSnapshot) {
|
|
402
|
+
var cachedValue = getSnapshot();
|
|
403
|
+
|
|
404
|
+
if (!objectIs(value, cachedValue)) {
|
|
405
|
+
error('The result of getSnapshot should be cached to avoid an infinite loop');
|
|
406
|
+
|
|
407
|
+
didWarnUncachedGetSnapshot = true;
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
} // Because updates are synchronous, we don't queue them. Instead we force a
|
|
411
|
+
// re-render whenever the subscribed state changes by updating an some
|
|
412
|
+
// arbitrary useState hook. Then, during render, we call getSnapshot to read
|
|
413
|
+
// the current value.
|
|
414
|
+
//
|
|
415
|
+
// Because we don't actually use the state returned by the useState hook, we
|
|
416
|
+
// can save a bit of memory by storing other stuff in that slot.
|
|
417
|
+
//
|
|
418
|
+
// To implement the early bailout, we need to track some things on a mutable
|
|
419
|
+
// object. Usually, we would put that in a useRef hook, but we can stash it in
|
|
420
|
+
// our useState hook instead.
|
|
421
|
+
//
|
|
422
|
+
// To force a re-render, we call forceUpdate({inst}). That works because the
|
|
423
|
+
// new object always fails an equality check.
|
|
424
|
+
|
|
425
|
+
|
|
426
|
+
var _useState = useState({
|
|
427
|
+
inst: {
|
|
428
|
+
value: value,
|
|
429
|
+
getSnapshot: getSnapshot
|
|
430
|
+
}
|
|
431
|
+
}),
|
|
432
|
+
inst = _useState[0].inst,
|
|
433
|
+
forceUpdate = _useState[1]; // Track the latest getSnapshot function with a ref. This needs to be updated
|
|
434
|
+
// in the layout phase so we can access it during the tearing check that
|
|
435
|
+
// happens on subscribe.
|
|
436
|
+
|
|
437
|
+
|
|
438
|
+
useLayoutEffect(function () {
|
|
439
|
+
inst.value = value;
|
|
440
|
+
inst.getSnapshot = getSnapshot; // Whenever getSnapshot or subscribe changes, we need to check in the
|
|
441
|
+
// commit phase if there was an interleaved mutation. In concurrent mode
|
|
442
|
+
// this can happen all the time, but even in synchronous mode, an earlier
|
|
443
|
+
// effect may have mutated the store.
|
|
444
|
+
|
|
445
|
+
if (checkIfSnapshotChanged(inst)) {
|
|
446
|
+
// Force a re-render.
|
|
447
|
+
forceUpdate({
|
|
448
|
+
inst: inst
|
|
449
|
+
});
|
|
450
|
+
}
|
|
451
|
+
}, [subscribe, value, getSnapshot]);
|
|
452
|
+
useEffect(function () {
|
|
453
|
+
// Check for changes right before subscribing. Subsequent changes will be
|
|
454
|
+
// detected in the subscription handler.
|
|
455
|
+
if (checkIfSnapshotChanged(inst)) {
|
|
456
|
+
// Force a re-render.
|
|
457
|
+
forceUpdate({
|
|
458
|
+
inst: inst
|
|
459
|
+
});
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
var handleStoreChange = function () {
|
|
463
|
+
// TODO: Because there is no cross-renderer API for batching updates, it's
|
|
464
|
+
// up to the consumer of this library to wrap their subscription event
|
|
465
|
+
// with unstable_batchedUpdates. Should we try to detect when this isn't
|
|
466
|
+
// the case and print a warning in development?
|
|
467
|
+
// The store changed. Check if the snapshot changed since the last time we
|
|
468
|
+
// read from the store.
|
|
469
|
+
if (checkIfSnapshotChanged(inst)) {
|
|
470
|
+
// Force a re-render.
|
|
471
|
+
forceUpdate({
|
|
472
|
+
inst: inst
|
|
473
|
+
});
|
|
474
|
+
}
|
|
475
|
+
}; // Subscribe to the store and return a clean-up function.
|
|
476
|
+
|
|
477
|
+
|
|
478
|
+
return subscribe(handleStoreChange);
|
|
479
|
+
}, [subscribe]);
|
|
480
|
+
useDebugValue(value);
|
|
481
|
+
return value;
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
function checkIfSnapshotChanged(inst) {
|
|
485
|
+
var latestGetSnapshot = inst.getSnapshot;
|
|
486
|
+
var prevValue = inst.value;
|
|
487
|
+
|
|
488
|
+
try {
|
|
489
|
+
var nextValue = latestGetSnapshot();
|
|
490
|
+
return !objectIs(prevValue, nextValue);
|
|
491
|
+
} catch (error) {
|
|
492
|
+
return true;
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
function useSyncExternalStore$1(subscribe, getSnapshot, getServerSnapshot) {
|
|
497
|
+
// Note: The shim does not use getServerSnapshot, because pre-18 versions of
|
|
498
|
+
// React do not expose a way to check if we're hydrating. So users of the shim
|
|
499
|
+
// will need to track that themselves and return the correct value
|
|
500
|
+
// from `getSnapshot`.
|
|
501
|
+
return getSnapshot();
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
var canUseDOM = !!(typeof window !== 'undefined' && typeof window.document !== 'undefined' && typeof window.document.createElement !== 'undefined');
|
|
505
|
+
|
|
506
|
+
var isServerEnvironment = !canUseDOM;
|
|
507
|
+
|
|
508
|
+
var shim = isServerEnvironment ? useSyncExternalStore$1 : useSyncExternalStore;
|
|
509
|
+
var useSyncExternalStore$2 = React.useSyncExternalStore !== undefined ? React.useSyncExternalStore : shim;
|
|
510
|
+
|
|
511
|
+
useSyncExternalStoreShim_development.useSyncExternalStore = useSyncExternalStore$2;
|
|
512
|
+
/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
|
|
513
|
+
if (
|
|
514
|
+
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&
|
|
515
|
+
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop ===
|
|
516
|
+
'function'
|
|
517
|
+
) {
|
|
518
|
+
__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
})();
|
|
522
|
+
}
|
|
523
|
+
return useSyncExternalStoreShim_development;
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
var hasRequiredShim;
|
|
527
|
+
|
|
528
|
+
function requireShim () {
|
|
529
|
+
if (hasRequiredShim) return shim.exports;
|
|
530
|
+
hasRequiredShim = 1;
|
|
531
|
+
(function (module) {
|
|
532
|
+
|
|
533
|
+
if (process.env.NODE_ENV === 'production') {
|
|
534
|
+
module.exports = requireUseSyncExternalStoreShim_production_min();
|
|
535
|
+
} else {
|
|
536
|
+
module.exports = requireUseSyncExternalStoreShim_development();
|
|
537
|
+
}
|
|
538
|
+
} (shim));
|
|
539
|
+
return shim.exports;
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
/**
|
|
543
|
+
* @license React
|
|
544
|
+
* use-sync-external-store-shim/with-selector.production.min.js
|
|
545
|
+
*
|
|
546
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
547
|
+
*
|
|
548
|
+
* This source code is licensed under the MIT license found in the
|
|
549
|
+
* LICENSE file in the root directory of this source tree.
|
|
550
|
+
*/
|
|
551
|
+
|
|
552
|
+
var hasRequiredWithSelector_production_min;
|
|
553
|
+
|
|
554
|
+
function requireWithSelector_production_min () {
|
|
555
|
+
if (hasRequiredWithSelector_production_min) return withSelector_production_min;
|
|
556
|
+
hasRequiredWithSelector_production_min = 1;
|
|
557
|
+
var h=require$$0,n=requireShim();function p(a,b){return a===b&&(0!==a||1/a===1/b)||a!==a&&b!==b}var q="function"===typeof Object.is?Object.is:p,r=n.useSyncExternalStore,t=h.useRef,u=h.useEffect,v=h.useMemo,w=h.useDebugValue;
|
|
558
|
+
withSelector_production_min.useSyncExternalStoreWithSelector=function(a,b,e,l,g){var c=t(null);if(null===c.current){var f={hasValue:!1,value:null};c.current=f;}else f=c.current;c=v(function(){function a(a){if(!c){c=!0;d=a;a=l(a);if(void 0!==g&&f.hasValue){var b=f.value;if(g(b,a))return k=b}return k=a}b=k;if(q(d,a))return b;var e=l(a);if(void 0!==g&&g(b,e))return b;d=a;return k=e}var c=!1,d,k,m=void 0===e?null:e;return [function(){return a(b())},null===m?void 0:function(){return a(m())}]},[b,e,l,g]);var d=r(a,c[0],c[1]);
|
|
559
|
+
u(function(){f.hasValue=!0;f.value=d;},[d]);w(d);return d};
|
|
560
|
+
return withSelector_production_min;
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
var withSelector_development = {};
|
|
564
|
+
|
|
565
|
+
/**
|
|
566
|
+
* @license React
|
|
567
|
+
* use-sync-external-store-shim/with-selector.development.js
|
|
568
|
+
*
|
|
569
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
570
|
+
*
|
|
571
|
+
* This source code is licensed under the MIT license found in the
|
|
572
|
+
* LICENSE file in the root directory of this source tree.
|
|
573
|
+
*/
|
|
574
|
+
|
|
575
|
+
var hasRequiredWithSelector_development;
|
|
576
|
+
|
|
577
|
+
function requireWithSelector_development () {
|
|
578
|
+
if (hasRequiredWithSelector_development) return withSelector_development;
|
|
579
|
+
hasRequiredWithSelector_development = 1;
|
|
580
|
+
|
|
581
|
+
if (process.env.NODE_ENV !== "production") {
|
|
582
|
+
(function() {
|
|
583
|
+
|
|
584
|
+
/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
|
|
585
|
+
if (
|
|
586
|
+
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&
|
|
587
|
+
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart ===
|
|
588
|
+
'function'
|
|
589
|
+
) {
|
|
590
|
+
__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
|
|
591
|
+
}
|
|
592
|
+
var React = require$$0;
|
|
593
|
+
var shim = requireShim();
|
|
594
|
+
|
|
595
|
+
/**
|
|
596
|
+
* inlined Object.is polyfill to avoid requiring consumers ship their own
|
|
597
|
+
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
|
|
598
|
+
*/
|
|
599
|
+
function is(x, y) {
|
|
600
|
+
return x === y && (x !== 0 || 1 / x === 1 / y) || x !== x && y !== y // eslint-disable-line no-self-compare
|
|
601
|
+
;
|
|
602
|
+
}
|
|
603
|
+
|
|
604
|
+
var objectIs = typeof Object.is === 'function' ? Object.is : is;
|
|
605
|
+
|
|
606
|
+
var useSyncExternalStore = shim.useSyncExternalStore;
|
|
607
|
+
|
|
608
|
+
// for CommonJS interop.
|
|
609
|
+
|
|
610
|
+
var useRef = React.useRef,
|
|
611
|
+
useEffect = React.useEffect,
|
|
612
|
+
useMemo = React.useMemo,
|
|
613
|
+
useDebugValue = React.useDebugValue; // Same as useSyncExternalStore, but supports selector and isEqual arguments.
|
|
614
|
+
|
|
615
|
+
function useSyncExternalStoreWithSelector(subscribe, getSnapshot, getServerSnapshot, selector, isEqual) {
|
|
616
|
+
// Use this to track the rendered snapshot.
|
|
617
|
+
var instRef = useRef(null);
|
|
618
|
+
var inst;
|
|
619
|
+
|
|
620
|
+
if (instRef.current === null) {
|
|
621
|
+
inst = {
|
|
622
|
+
hasValue: false,
|
|
623
|
+
value: null
|
|
624
|
+
};
|
|
625
|
+
instRef.current = inst;
|
|
626
|
+
} else {
|
|
627
|
+
inst = instRef.current;
|
|
628
|
+
}
|
|
629
|
+
|
|
630
|
+
var _useMemo = useMemo(function () {
|
|
631
|
+
// Track the memoized state using closure variables that are local to this
|
|
632
|
+
// memoized instance of a getSnapshot function. Intentionally not using a
|
|
633
|
+
// useRef hook, because that state would be shared across all concurrent
|
|
634
|
+
// copies of the hook/component.
|
|
635
|
+
var hasMemo = false;
|
|
636
|
+
var memoizedSnapshot;
|
|
637
|
+
var memoizedSelection;
|
|
638
|
+
|
|
639
|
+
var memoizedSelector = function (nextSnapshot) {
|
|
640
|
+
if (!hasMemo) {
|
|
641
|
+
// The first time the hook is called, there is no memoized result.
|
|
642
|
+
hasMemo = true;
|
|
643
|
+
memoizedSnapshot = nextSnapshot;
|
|
644
|
+
|
|
645
|
+
var _nextSelection = selector(nextSnapshot);
|
|
646
|
+
|
|
647
|
+
if (isEqual !== undefined) {
|
|
648
|
+
// Even if the selector has changed, the currently rendered selection
|
|
649
|
+
// may be equal to the new selection. We should attempt to reuse the
|
|
650
|
+
// current value if possible, to preserve downstream memoizations.
|
|
651
|
+
if (inst.hasValue) {
|
|
652
|
+
var currentSelection = inst.value;
|
|
653
|
+
|
|
654
|
+
if (isEqual(currentSelection, _nextSelection)) {
|
|
655
|
+
memoizedSelection = currentSelection;
|
|
656
|
+
return currentSelection;
|
|
657
|
+
}
|
|
658
|
+
}
|
|
659
|
+
}
|
|
660
|
+
|
|
661
|
+
memoizedSelection = _nextSelection;
|
|
662
|
+
return _nextSelection;
|
|
663
|
+
} // We may be able to reuse the previous invocation's result.
|
|
664
|
+
|
|
665
|
+
|
|
666
|
+
// We may be able to reuse the previous invocation's result.
|
|
667
|
+
var prevSnapshot = memoizedSnapshot;
|
|
668
|
+
var prevSelection = memoizedSelection;
|
|
669
|
+
|
|
670
|
+
if (objectIs(prevSnapshot, nextSnapshot)) {
|
|
671
|
+
// The snapshot is the same as last time. Reuse the previous selection.
|
|
672
|
+
return prevSelection;
|
|
673
|
+
} // The snapshot has changed, so we need to compute a new selection.
|
|
674
|
+
|
|
675
|
+
|
|
676
|
+
// The snapshot has changed, so we need to compute a new selection.
|
|
677
|
+
var nextSelection = selector(nextSnapshot); // If a custom isEqual function is provided, use that to check if the data
|
|
678
|
+
// has changed. If it hasn't, return the previous selection. That signals
|
|
679
|
+
// to React that the selections are conceptually equal, and we can bail
|
|
680
|
+
// out of rendering.
|
|
681
|
+
|
|
682
|
+
// If a custom isEqual function is provided, use that to check if the data
|
|
683
|
+
// has changed. If it hasn't, return the previous selection. That signals
|
|
684
|
+
// to React that the selections are conceptually equal, and we can bail
|
|
685
|
+
// out of rendering.
|
|
686
|
+
if (isEqual !== undefined && isEqual(prevSelection, nextSelection)) {
|
|
687
|
+
return prevSelection;
|
|
688
|
+
}
|
|
689
|
+
|
|
690
|
+
memoizedSnapshot = nextSnapshot;
|
|
691
|
+
memoizedSelection = nextSelection;
|
|
692
|
+
return nextSelection;
|
|
693
|
+
}; // Assigning this to a constant so that Flow knows it can't change.
|
|
694
|
+
|
|
695
|
+
|
|
696
|
+
// Assigning this to a constant so that Flow knows it can't change.
|
|
697
|
+
var maybeGetServerSnapshot = getServerSnapshot === undefined ? null : getServerSnapshot;
|
|
698
|
+
|
|
699
|
+
var getSnapshotWithSelector = function () {
|
|
700
|
+
return memoizedSelector(getSnapshot());
|
|
701
|
+
};
|
|
702
|
+
|
|
703
|
+
var getServerSnapshotWithSelector = maybeGetServerSnapshot === null ? undefined : function () {
|
|
704
|
+
return memoizedSelector(maybeGetServerSnapshot());
|
|
705
|
+
};
|
|
706
|
+
return [getSnapshotWithSelector, getServerSnapshotWithSelector];
|
|
707
|
+
}, [getSnapshot, getServerSnapshot, selector, isEqual]),
|
|
708
|
+
getSelection = _useMemo[0],
|
|
709
|
+
getServerSelection = _useMemo[1];
|
|
710
|
+
|
|
711
|
+
var value = useSyncExternalStore(subscribe, getSelection, getServerSelection);
|
|
712
|
+
useEffect(function () {
|
|
713
|
+
inst.hasValue = true;
|
|
714
|
+
inst.value = value;
|
|
715
|
+
}, [value]);
|
|
716
|
+
useDebugValue(value);
|
|
717
|
+
return value;
|
|
718
|
+
}
|
|
719
|
+
|
|
720
|
+
withSelector_development.useSyncExternalStoreWithSelector = useSyncExternalStoreWithSelector;
|
|
721
|
+
/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
|
|
722
|
+
if (
|
|
723
|
+
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&
|
|
724
|
+
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop ===
|
|
725
|
+
'function'
|
|
726
|
+
) {
|
|
727
|
+
__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
|
|
728
|
+
}
|
|
729
|
+
|
|
730
|
+
})();
|
|
731
|
+
}
|
|
732
|
+
return withSelector_development;
|
|
733
|
+
}
|
|
734
|
+
|
|
735
|
+
(function (module) {
|
|
736
|
+
|
|
737
|
+
if (process.env.NODE_ENV === 'production') {
|
|
738
|
+
module.exports = requireWithSelector_production_min();
|
|
739
|
+
} else {
|
|
740
|
+
module.exports = requireWithSelector_development();
|
|
741
|
+
}
|
|
742
|
+
} (withSelector));
|
|
743
|
+
|
|
744
|
+
var useSyncExternalStoreExports = /*@__PURE__*/getDefaultExportFromCjs(withSelector.exports);
|
|
745
|
+
|
|
746
|
+
const { useSyncExternalStoreWithSelector } = useSyncExternalStoreExports;
|
|
747
|
+
function useStore(api, selector = api.getState, equalityFn) {
|
|
748
|
+
const slice = useSyncExternalStoreWithSelector(
|
|
749
|
+
api.subscribe,
|
|
750
|
+
api.getState,
|
|
751
|
+
api.getServerState || api.getState,
|
|
752
|
+
selector,
|
|
753
|
+
equalityFn
|
|
754
|
+
);
|
|
755
|
+
useDebugValue(slice);
|
|
756
|
+
return slice;
|
|
757
|
+
}
|
|
758
|
+
const createImpl = (createState) => {
|
|
759
|
+
const api = typeof createState === "function" ? createStore(createState) : createState;
|
|
760
|
+
const useBoundStore = (selector, equalityFn) => useStore(api, selector, equalityFn);
|
|
761
|
+
Object.assign(useBoundStore, api);
|
|
762
|
+
return useBoundStore;
|
|
763
|
+
};
|
|
764
|
+
const create = (createState) => createState ? createImpl(createState) : createImpl;
|
|
765
|
+
|
|
766
|
+
var useDisplayErrorPage = function useDisplayErrorPage() {
|
|
767
|
+
return useErrorDisplayStore(prop("show404Page"));
|
|
768
|
+
};
|
|
769
|
+
|
|
770
|
+
var useErrorDisplayStore = create(function () {
|
|
771
|
+
return {
|
|
772
|
+
show404Page: false
|
|
773
|
+
};
|
|
774
|
+
});
|
|
775
|
+
|
|
220
776
|
var shouldNot = function shouldNot(skip) {
|
|
221
777
|
return _typeof(skip) === "object" || !skip;
|
|
222
778
|
};
|
|
@@ -244,7 +800,7 @@ var createPipe = function createPipe(functions) {
|
|
|
244
800
|
};
|
|
245
801
|
};
|
|
246
802
|
|
|
247
|
-
var
|
|
803
|
+
var transformResponseKeysToCamelCase = function transformResponseKeysToCamelCase(response) {
|
|
248
804
|
var _response$config$tran = response.config.transformResponseCase,
|
|
249
805
|
transformResponseCase = _response$config$tran === void 0 ? true : _response$config$tran;
|
|
250
806
|
|
|
@@ -255,6 +811,20 @@ var transformKeysToCamelCase = function transformKeysToCamelCase(response) {
|
|
|
255
811
|
return response;
|
|
256
812
|
};
|
|
257
813
|
|
|
814
|
+
var transformErrorKeysToCamelCase = function transformErrorKeysToCamelCase(error) {
|
|
815
|
+
var _error$config, _error$response;
|
|
816
|
+
|
|
817
|
+
var _ref = (_error$config = error.config) !== null && _error$config !== void 0 ? _error$config : {},
|
|
818
|
+
_ref$transformRespons = _ref.transformResponseCase,
|
|
819
|
+
transformResponseCase = _ref$transformRespons === void 0 ? true : _ref$transformRespons;
|
|
820
|
+
|
|
821
|
+
if ((_error$response = error.response) !== null && _error$response !== void 0 && _error$response.data && transformResponseCase) {
|
|
822
|
+
error.response.data = keysToCamelCase(error.response.data);
|
|
823
|
+
}
|
|
824
|
+
|
|
825
|
+
return error;
|
|
826
|
+
};
|
|
827
|
+
|
|
258
828
|
var showSuccessToastr = function showSuccessToastr(response) {
|
|
259
829
|
var _response$config$show = response.config.showToastr,
|
|
260
830
|
showToastr = _response$config$show === void 0 ? true : _response$config$show;
|
|
@@ -274,19 +844,21 @@ var pullDataFromResponse = function pullDataFromResponse(response) {
|
|
|
274
844
|
|
|
275
845
|
var buildSuccessResponseHandler = function buildSuccessResponseHandler(skip) {
|
|
276
846
|
var interceptors = [];
|
|
277
|
-
if (!(skip !== null && skip !== void 0 && skip.transformCase)) interceptors.push(
|
|
847
|
+
if (!(skip !== null && skip !== void 0 && skip.transformCase)) interceptors.push(transformResponseKeysToCamelCase);
|
|
278
848
|
if (!(skip !== null && skip !== void 0 && skip.showToastr)) interceptors.push(showSuccessToastr);
|
|
279
849
|
if (!(skip !== null && skip !== void 0 && skip.pullDataFromResponse)) interceptors.push(pullDataFromResponse);
|
|
280
850
|
return createPipe(interceptors);
|
|
281
851
|
};
|
|
282
852
|
|
|
283
853
|
var handleUnauthorizedErrorResponse = function handleUnauthorizedErrorResponse(error) {
|
|
284
|
-
var _error$
|
|
854
|
+
var _error$response2, _error$config2;
|
|
285
855
|
|
|
286
|
-
if (((_error$
|
|
856
|
+
if (((_error$response2 = error.response) === null || _error$response2 === void 0 ? void 0 : _error$response2.status) !== 401) return error;
|
|
287
857
|
resetAuthTokens();
|
|
288
|
-
|
|
289
|
-
|
|
858
|
+
|
|
859
|
+
var _ref2 = (_error$config2 = error.config) !== null && _error$config2 !== void 0 ? _error$config2 : {},
|
|
860
|
+
_ref2$redirectOnError = _ref2.redirectOnError,
|
|
861
|
+
redirectOnError = _ref2$redirectOnError === void 0 ? true : _ref2$redirectOnError;
|
|
290
862
|
|
|
291
863
|
if (redirectOnError) {
|
|
292
864
|
setTimeout(function () {
|
|
@@ -299,8 +871,12 @@ var handleUnauthorizedErrorResponse = function handleUnauthorizedErrorResponse(e
|
|
|
299
871
|
};
|
|
300
872
|
|
|
301
873
|
var showErrorToastr = function showErrorToastr(error) {
|
|
302
|
-
var _error$
|
|
303
|
-
|
|
874
|
+
var _error$config3;
|
|
875
|
+
|
|
876
|
+
var _ref3 = (_error$config3 = error.config) !== null && _error$config3 !== void 0 ? _error$config3 : {},
|
|
877
|
+
_ref3$showToastr = _ref3.showToastr,
|
|
878
|
+
showToastr = _ref3$showToastr === void 0 ? true : _ref3$showToastr;
|
|
879
|
+
|
|
304
880
|
if (!showToastr) return error;
|
|
305
881
|
|
|
306
882
|
if (axios.isCancel(error)) {
|
|
@@ -314,14 +890,19 @@ var showErrorToastr = function showErrorToastr(error) {
|
|
|
314
890
|
return error;
|
|
315
891
|
};
|
|
316
892
|
|
|
317
|
-
var
|
|
318
|
-
var _error$
|
|
893
|
+
var handle404ErrorResponse = function handle404ErrorResponse(error) {
|
|
894
|
+
var _error$response3, _error$config4;
|
|
895
|
+
|
|
896
|
+
if (((_error$response3 = error.response) === null || _error$response3 === void 0 ? void 0 : _error$response3.status) !== 404) return error;
|
|
319
897
|
|
|
320
|
-
var _error$
|
|
321
|
-
|
|
898
|
+
var _ref4 = (_error$config4 = error.config) !== null && _error$config4 !== void 0 ? _error$config4 : {},
|
|
899
|
+
_ref4$show404ErrorPag = _ref4.show404ErrorPage,
|
|
900
|
+
show404ErrorPage = _ref4$show404ErrorPag === void 0 ? true : _ref4$show404ErrorPag;
|
|
322
901
|
|
|
323
|
-
if (
|
|
324
|
-
|
|
902
|
+
if (show404ErrorPage) {
|
|
903
|
+
useErrorDisplayStore.setState({
|
|
904
|
+
show404Page: true
|
|
905
|
+
});
|
|
325
906
|
}
|
|
326
907
|
|
|
327
908
|
return error;
|
|
@@ -329,7 +910,8 @@ var redirect404 = function redirect404(error) {
|
|
|
329
910
|
|
|
330
911
|
var buildErrorResponseHandler = function buildErrorResponseHandler(skip) {
|
|
331
912
|
var interceptors = [];
|
|
332
|
-
if (!(skip !== null && skip !== void 0 && skip.
|
|
913
|
+
if (!(skip !== null && skip !== void 0 && skip.transformCase)) interceptors.push(transformErrorKeysToCamelCase);
|
|
914
|
+
if (!(skip !== null && skip !== void 0 && skip.show404ErrorPage)) interceptors.push(handle404ErrorResponse);
|
|
333
915
|
if (!(skip !== null && skip !== void 0 && skip.logoutOn401)) interceptors.push(handleUnauthorizedErrorResponse);
|
|
334
916
|
if (!(skip !== null && skip !== void 0 && skip.showToastr)) interceptors.push(showErrorToastr);
|
|
335
917
|
interceptors.push(Promise.reject.bind(Promise));
|
|
@@ -347,8 +929,11 @@ var cleanupCredentialsForCrossOrigin = function cleanupCredentialsForCrossOrigin
|
|
|
347
929
|
var transformDataToSnakeCase = function transformDataToSnakeCase(request) {
|
|
348
930
|
var _request$transformReq = request.transformRequestCase,
|
|
349
931
|
transformRequestCase = _request$transformReq === void 0 ? true : _request$transformReq;
|
|
350
|
-
if (!transformRequestCase
|
|
351
|
-
return
|
|
932
|
+
if (!transformRequestCase) return request;
|
|
933
|
+
return evolve({
|
|
934
|
+
data: serializeKeysToSnakeCase,
|
|
935
|
+
params: serializeKeysToSnakeCase
|
|
936
|
+
}, request);
|
|
352
937
|
};
|
|
353
938
|
|
|
354
939
|
var addRequestInterceptors = function addRequestInterceptors(skip) {
|
|
@@ -394,8 +979,8 @@ var neetoCommons = {
|
|
|
394
979
|
reload: "Reload"
|
|
395
980
|
},
|
|
396
981
|
sidebar: {
|
|
397
|
-
myProfile: "My
|
|
398
|
-
myOrganization: "My
|
|
982
|
+
myProfile: "My profile",
|
|
983
|
+
myOrganization: "My organization",
|
|
399
984
|
logout: "Logout",
|
|
400
985
|
help: "Help"
|
|
401
986
|
},
|
|
@@ -452,7 +1037,7 @@ var neetoCommons = {
|
|
|
452
1037
|
}
|
|
453
1038
|
},
|
|
454
1039
|
email: {
|
|
455
|
-
title: "Widget installation
|
|
1040
|
+
title: "Widget installation instructions",
|
|
456
1041
|
fields: {
|
|
457
1042
|
emails: {
|
|
458
1043
|
label: "Emails",
|
|
@@ -462,7 +1047,7 @@ var neetoCommons = {
|
|
|
462
1047
|
subject: {
|
|
463
1048
|
label: "Subject",
|
|
464
1049
|
values: {
|
|
465
|
-
embedCode: "
|
|
1050
|
+
embedCode: "Widget installation instructions",
|
|
466
1051
|
userIdentity: "neetoWidget user identity object to specify user details",
|
|
467
1052
|
sessionContext: "neetoReplay session context object to save contextual information"
|
|
468
1053
|
}
|
|
@@ -470,7 +1055,7 @@ var neetoCommons = {
|
|
|
470
1055
|
},
|
|
471
1056
|
body: {
|
|
472
1057
|
values: {
|
|
473
|
-
embedCode: "
|
|
1058
|
+
embedCode: "<p>Hi,</p> <p>We are going to use {{selectedWidgets}}. Please find the code snippet for the installation of the {{selectedWidgets}} widget. You can find the documentation regarding this at <configureLink>{{neetoKbUrl}}</configureLink>.</p> <p>If you still need help then send an email to <mail>{{helpEmail}}</mail>.</p>",
|
|
474
1059
|
userIdentity: "Hey there. This is the object structure that you can use to specify the user identity for neetoWidget. You can find the documentation at - {{userIdentityKbUrl}}.",
|
|
475
1060
|
sessionContext: "Hey there. This is the object structure that you can use to specify the contextual values for neetoReplay sessions. You can find the documentation at - {{sessionContextKbUrl}}."
|
|
476
1061
|
}
|
|
@@ -482,19 +1067,37 @@ var neetoCommons = {
|
|
|
482
1067
|
}
|
|
483
1068
|
},
|
|
484
1069
|
customDomain: {
|
|
485
|
-
customDomain_one: "
|
|
486
|
-
customDomain_other: "
|
|
1070
|
+
customDomain_one: "Custom domain",
|
|
1071
|
+
customDomain_other: "Custom domains",
|
|
487
1072
|
customDomainWithCount_one: "{{count}} custom domain",
|
|
488
1073
|
customDomainWithCount_other: "{{count}} custom domains",
|
|
489
1074
|
placeholder: "Type domain here...",
|
|
1075
|
+
label: "Enter Custom domain",
|
|
490
1076
|
validation: {
|
|
491
|
-
buttonLabel:
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
1077
|
+
buttonLabel: {
|
|
1078
|
+
txt: "Validate TXT record entries",
|
|
1079
|
+
cnameAdded: "I’ve added CNAME records",
|
|
1080
|
+
cnameCheck: "Validate CNAME record"
|
|
495
1081
|
},
|
|
1082
|
+
desc: "Please add following {{record}} record in your domain’s DNS dashboard and then request for {{record}} validation.",
|
|
496
1083
|
record: "{{record}} record {{type}}"
|
|
497
1084
|
},
|
|
1085
|
+
status: {
|
|
1086
|
+
txt: {
|
|
1087
|
+
active: "TXT record validated",
|
|
1088
|
+
pendingCnameValidation: "TXT record validated",
|
|
1089
|
+
pendingTxtValidation: "TXT record validation pending"
|
|
1090
|
+
},
|
|
1091
|
+
cname: {
|
|
1092
|
+
active: "CNAME record validated",
|
|
1093
|
+
pendingCnameValidation: "CNAME record validation pending"
|
|
1094
|
+
},
|
|
1095
|
+
failed: "Failed"
|
|
1096
|
+
},
|
|
1097
|
+
messageBlock: {
|
|
1098
|
+
dnsStatus: "<p>Typically, it will take 2 hours to 24 hours for the new custom domain to start working.</p><br><p> An email will be sent when the custom domain starts working.</p><br>If, after 24 hours, your custom domain is still not working, then please send an email to ",
|
|
1099
|
+
cnameAddedTime: " You added CNAME records {{time}}"
|
|
1100
|
+
},
|
|
498
1101
|
alertMessage: "You're about to delete the custom domain <strong>{{hostname}}</strong>. This action will permanently delete the domain and <strong>{{hostname}}</strong> will no longer point to your default domain.",
|
|
499
1102
|
formikValidation: {
|
|
500
1103
|
required: "Custom domain is required",
|
|
@@ -527,6 +1130,18 @@ var neetoCommons = {
|
|
|
527
1130
|
sameTime: "Periods start and end time cannot be same"
|
|
528
1131
|
}
|
|
529
1132
|
}
|
|
1133
|
+
},
|
|
1134
|
+
browserSupport: {
|
|
1135
|
+
unsupportedBrowserVersion: "You are using {{browserName}} {{browserVersion}}. neeto requires {{browserName}} {{requiredMinBrowserVersion}} or later to perform reliably. <downloadLink></downloadLink><contactUs></contactUs>",
|
|
1136
|
+
unsupportedBrowser: "You are using {{browserName}} {{browserVersion}}. neeto requires a modern browser to perform reliably. <contactUs></contactUs>",
|
|
1137
|
+
downloadLink: {
|
|
1138
|
+
main: "Please <button></button> the latest browser.",
|
|
1139
|
+
buttonLabel: "download and install"
|
|
1140
|
+
},
|
|
1141
|
+
contactUs: {
|
|
1142
|
+
main: "<button></button> if you need any help.",
|
|
1143
|
+
buttonLabel: "Contact us"
|
|
1144
|
+
}
|
|
530
1145
|
}
|
|
531
1146
|
};
|
|
532
1147
|
var en = {
|
|
@@ -592,4 +1207,4 @@ function initializeApplication(_ref) {
|
|
|
592
1207
|
if (!(skip !== null && skip !== void 0 && skip.logger)) initializeLogger();
|
|
593
1208
|
}
|
|
594
1209
|
|
|
595
|
-
export { initializeApplication as default, globalProps$1 as globalProps };
|
|
1210
|
+
export { initializeApplication as default, globalProps$1 as globalProps, useDisplayErrorPage };
|