@bigbinary/neeto-commons-frontend 2.0.36 → 2.0.38

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,11 +2,11 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
+ var reactUtils = require('@bigbinary/neeto-commons-frontend/react-utils');
5
6
  var neetoui = require('@bigbinary/neetoui');
6
7
  var axios = require('axios');
7
8
  var i18next = require('i18next');
8
9
  var ramda = require('ramda');
9
- var require$$0 = require('react');
10
10
  var reactI18next = require('react-i18next');
11
11
  var Logger = require('js-logger');
12
12
  var mixpanel = require('mixpanel-browser');
@@ -15,7 +15,6 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
15
15
 
16
16
  var axios__default = /*#__PURE__*/_interopDefaultLegacy(axios);
17
17
  var i18next__default = /*#__PURE__*/_interopDefaultLegacy(i18next);
18
- var require$$0__default = /*#__PURE__*/_interopDefaultLegacy(require$$0);
19
18
  var Logger__default = /*#__PURE__*/_interopDefaultLegacy(Logger);
20
19
  var mixpanel__default = /*#__PURE__*/_interopDefaultLegacy(mixpanel);
21
20
 
@@ -226,568 +225,6 @@ var resetAuthTokens = function resetAuthTokens() {
226
225
  });
227
226
  };
228
227
 
229
- const createStoreImpl = (createState) => {
230
- let state;
231
- const listeners = /* @__PURE__ */ new Set();
232
- const setState = (partial, replace) => {
233
- const nextState = typeof partial === "function" ? partial(state) : partial;
234
- if (!Object.is(nextState, state)) {
235
- const previousState = state;
236
- state = (replace != null ? replace : typeof nextState !== "object") ? nextState : Object.assign({}, state, nextState);
237
- listeners.forEach((listener) => listener(state, previousState));
238
- }
239
- };
240
- const getState = () => state;
241
- const subscribe = (listener) => {
242
- listeners.add(listener);
243
- return () => listeners.delete(listener);
244
- };
245
- const destroy = () => {
246
- if ((undefined && undefined.MODE) !== "production") {
247
- console.warn(
248
- "[DEPRECATED] The destroy method will be unsupported in the future version. You should use unsubscribe function returned by subscribe. Everything will be garbage collected if store is garbage collected."
249
- );
250
- }
251
- listeners.clear();
252
- };
253
- const api = { setState, getState, subscribe, destroy };
254
- state = createState(setState, getState, api);
255
- return api;
256
- };
257
- const createStore = (createState) => createState ? createStoreImpl(createState) : createStoreImpl;
258
-
259
- function getDefaultExportFromCjs (x) {
260
- return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
261
- }
262
-
263
- var withSelector = {exports: {}};
264
-
265
- var withSelector_production_min = {};
266
-
267
- var shim = {exports: {}};
268
-
269
- var useSyncExternalStoreShim_production_min = {};
270
-
271
- /**
272
- * @license React
273
- * use-sync-external-store-shim.production.min.js
274
- *
275
- * Copyright (c) Facebook, Inc. and its affiliates.
276
- *
277
- * This source code is licensed under the MIT license found in the
278
- * LICENSE file in the root directory of this source tree.
279
- */
280
-
281
- var hasRequiredUseSyncExternalStoreShim_production_min;
282
-
283
- function requireUseSyncExternalStoreShim_production_min () {
284
- if (hasRequiredUseSyncExternalStoreShim_production_min) return useSyncExternalStoreShim_production_min;
285
- hasRequiredUseSyncExternalStoreShim_production_min = 1;
286
- var e=require$$0__default["default"];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}
287
- 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;
288
- return useSyncExternalStoreShim_production_min;
289
- }
290
-
291
- var useSyncExternalStoreShim_development = {};
292
-
293
- /**
294
- * @license React
295
- * use-sync-external-store-shim.development.js
296
- *
297
- * Copyright (c) Facebook, Inc. and its affiliates.
298
- *
299
- * This source code is licensed under the MIT license found in the
300
- * LICENSE file in the root directory of this source tree.
301
- */
302
-
303
- var hasRequiredUseSyncExternalStoreShim_development;
304
-
305
- function requireUseSyncExternalStoreShim_development () {
306
- if (hasRequiredUseSyncExternalStoreShim_development) return useSyncExternalStoreShim_development;
307
- hasRequiredUseSyncExternalStoreShim_development = 1;
308
-
309
- if (process.env.NODE_ENV !== "production") {
310
- (function() {
311
-
312
- /* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
313
- if (
314
- typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&
315
- typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart ===
316
- 'function'
317
- ) {
318
- __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
319
- }
320
- var React = require$$0__default["default"];
321
-
322
- var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
323
-
324
- function error(format) {
325
- {
326
- {
327
- for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
328
- args[_key2 - 1] = arguments[_key2];
329
- }
330
-
331
- printWarning('error', format, args);
332
- }
333
- }
334
- }
335
-
336
- function printWarning(level, format, args) {
337
- // When changing this logic, you might want to also
338
- // update consoleWithStackDev.www.js as well.
339
- {
340
- var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
341
- var stack = ReactDebugCurrentFrame.getStackAddendum();
342
-
343
- if (stack !== '') {
344
- format += '%s';
345
- args = args.concat([stack]);
346
- } // eslint-disable-next-line react-internal/safe-string-coercion
347
-
348
-
349
- var argsWithFormat = args.map(function (item) {
350
- return String(item);
351
- }); // Careful: RN currently depends on this prefix
352
-
353
- argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it
354
- // breaks IE9: https://github.com/facebook/react/issues/13610
355
- // eslint-disable-next-line react-internal/no-production-logging
356
-
357
- Function.prototype.apply.call(console[level], console, argsWithFormat);
358
- }
359
- }
360
-
361
- /**
362
- * inlined Object.is polyfill to avoid requiring consumers ship their own
363
- * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
364
- */
365
- function is(x, y) {
366
- return x === y && (x !== 0 || 1 / x === 1 / y) || x !== x && y !== y // eslint-disable-line no-self-compare
367
- ;
368
- }
369
-
370
- var objectIs = typeof Object.is === 'function' ? Object.is : is;
371
-
372
- // dispatch for CommonJS interop named imports.
373
-
374
- var useState = React.useState,
375
- useEffect = React.useEffect,
376
- useLayoutEffect = React.useLayoutEffect,
377
- useDebugValue = React.useDebugValue;
378
- var didWarnOld18Alpha = false;
379
- var didWarnUncachedGetSnapshot = false; // Disclaimer: This shim breaks many of the rules of React, and only works
380
- // because of a very particular set of implementation details and assumptions
381
- // -- change any one of them and it will break. The most important assumption
382
- // is that updates are always synchronous, because concurrent rendering is
383
- // only available in versions of React that also have a built-in
384
- // useSyncExternalStore API. And we only use this shim when the built-in API
385
- // does not exist.
386
- //
387
- // Do not assume that the clever hacks used by this hook also work in general.
388
- // The point of this shim is to replace the need for hacks by other libraries.
389
-
390
- function useSyncExternalStore(subscribe, getSnapshot, // Note: The shim does not use getServerSnapshot, because pre-18 versions of
391
- // React do not expose a way to check if we're hydrating. So users of the shim
392
- // will need to track that themselves and return the correct value
393
- // from `getSnapshot`.
394
- getServerSnapshot) {
395
- {
396
- if (!didWarnOld18Alpha) {
397
- if (React.startTransition !== undefined) {
398
- didWarnOld18Alpha = true;
399
-
400
- 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.');
401
- }
402
- }
403
- } // Read the current snapshot from the store on every render. Again, this
404
- // breaks the rules of React, and only works here because of specific
405
- // implementation details, most importantly that updates are
406
- // always synchronous.
407
-
408
-
409
- var value = getSnapshot();
410
-
411
- {
412
- if (!didWarnUncachedGetSnapshot) {
413
- var cachedValue = getSnapshot();
414
-
415
- if (!objectIs(value, cachedValue)) {
416
- error('The result of getSnapshot should be cached to avoid an infinite loop');
417
-
418
- didWarnUncachedGetSnapshot = true;
419
- }
420
- }
421
- } // Because updates are synchronous, we don't queue them. Instead we force a
422
- // re-render whenever the subscribed state changes by updating an some
423
- // arbitrary useState hook. Then, during render, we call getSnapshot to read
424
- // the current value.
425
- //
426
- // Because we don't actually use the state returned by the useState hook, we
427
- // can save a bit of memory by storing other stuff in that slot.
428
- //
429
- // To implement the early bailout, we need to track some things on a mutable
430
- // object. Usually, we would put that in a useRef hook, but we can stash it in
431
- // our useState hook instead.
432
- //
433
- // To force a re-render, we call forceUpdate({inst}). That works because the
434
- // new object always fails an equality check.
435
-
436
-
437
- var _useState = useState({
438
- inst: {
439
- value: value,
440
- getSnapshot: getSnapshot
441
- }
442
- }),
443
- inst = _useState[0].inst,
444
- forceUpdate = _useState[1]; // Track the latest getSnapshot function with a ref. This needs to be updated
445
- // in the layout phase so we can access it during the tearing check that
446
- // happens on subscribe.
447
-
448
-
449
- useLayoutEffect(function () {
450
- inst.value = value;
451
- inst.getSnapshot = getSnapshot; // Whenever getSnapshot or subscribe changes, we need to check in the
452
- // commit phase if there was an interleaved mutation. In concurrent mode
453
- // this can happen all the time, but even in synchronous mode, an earlier
454
- // effect may have mutated the store.
455
-
456
- if (checkIfSnapshotChanged(inst)) {
457
- // Force a re-render.
458
- forceUpdate({
459
- inst: inst
460
- });
461
- }
462
- }, [subscribe, value, getSnapshot]);
463
- useEffect(function () {
464
- // Check for changes right before subscribing. Subsequent changes will be
465
- // detected in the subscription handler.
466
- if (checkIfSnapshotChanged(inst)) {
467
- // Force a re-render.
468
- forceUpdate({
469
- inst: inst
470
- });
471
- }
472
-
473
- var handleStoreChange = function () {
474
- // TODO: Because there is no cross-renderer API for batching updates, it's
475
- // up to the consumer of this library to wrap their subscription event
476
- // with unstable_batchedUpdates. Should we try to detect when this isn't
477
- // the case and print a warning in development?
478
- // The store changed. Check if the snapshot changed since the last time we
479
- // read from the store.
480
- if (checkIfSnapshotChanged(inst)) {
481
- // Force a re-render.
482
- forceUpdate({
483
- inst: inst
484
- });
485
- }
486
- }; // Subscribe to the store and return a clean-up function.
487
-
488
-
489
- return subscribe(handleStoreChange);
490
- }, [subscribe]);
491
- useDebugValue(value);
492
- return value;
493
- }
494
-
495
- function checkIfSnapshotChanged(inst) {
496
- var latestGetSnapshot = inst.getSnapshot;
497
- var prevValue = inst.value;
498
-
499
- try {
500
- var nextValue = latestGetSnapshot();
501
- return !objectIs(prevValue, nextValue);
502
- } catch (error) {
503
- return true;
504
- }
505
- }
506
-
507
- function useSyncExternalStore$1(subscribe, getSnapshot, getServerSnapshot) {
508
- // Note: The shim does not use getServerSnapshot, because pre-18 versions of
509
- // React do not expose a way to check if we're hydrating. So users of the shim
510
- // will need to track that themselves and return the correct value
511
- // from `getSnapshot`.
512
- return getSnapshot();
513
- }
514
-
515
- var canUseDOM = !!(typeof window !== 'undefined' && typeof window.document !== 'undefined' && typeof window.document.createElement !== 'undefined');
516
-
517
- var isServerEnvironment = !canUseDOM;
518
-
519
- var shim = isServerEnvironment ? useSyncExternalStore$1 : useSyncExternalStore;
520
- var useSyncExternalStore$2 = React.useSyncExternalStore !== undefined ? React.useSyncExternalStore : shim;
521
-
522
- useSyncExternalStoreShim_development.useSyncExternalStore = useSyncExternalStore$2;
523
- /* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
524
- if (
525
- typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&
526
- typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop ===
527
- 'function'
528
- ) {
529
- __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
530
- }
531
-
532
- })();
533
- }
534
- return useSyncExternalStoreShim_development;
535
- }
536
-
537
- var hasRequiredShim;
538
-
539
- function requireShim () {
540
- if (hasRequiredShim) return shim.exports;
541
- hasRequiredShim = 1;
542
- (function (module) {
543
-
544
- if (process.env.NODE_ENV === 'production') {
545
- module.exports = requireUseSyncExternalStoreShim_production_min();
546
- } else {
547
- module.exports = requireUseSyncExternalStoreShim_development();
548
- }
549
- } (shim));
550
- return shim.exports;
551
- }
552
-
553
- /**
554
- * @license React
555
- * use-sync-external-store-shim/with-selector.production.min.js
556
- *
557
- * Copyright (c) Facebook, Inc. and its affiliates.
558
- *
559
- * This source code is licensed under the MIT license found in the
560
- * LICENSE file in the root directory of this source tree.
561
- */
562
-
563
- var hasRequiredWithSelector_production_min;
564
-
565
- function requireWithSelector_production_min () {
566
- if (hasRequiredWithSelector_production_min) return withSelector_production_min;
567
- hasRequiredWithSelector_production_min = 1;
568
- var h=require$$0__default["default"],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;
569
- 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]);
570
- u(function(){f.hasValue=!0;f.value=d;},[d]);w(d);return d};
571
- return withSelector_production_min;
572
- }
573
-
574
- var withSelector_development = {};
575
-
576
- /**
577
- * @license React
578
- * use-sync-external-store-shim/with-selector.development.js
579
- *
580
- * Copyright (c) Facebook, Inc. and its affiliates.
581
- *
582
- * This source code is licensed under the MIT license found in the
583
- * LICENSE file in the root directory of this source tree.
584
- */
585
-
586
- var hasRequiredWithSelector_development;
587
-
588
- function requireWithSelector_development () {
589
- if (hasRequiredWithSelector_development) return withSelector_development;
590
- hasRequiredWithSelector_development = 1;
591
-
592
- if (process.env.NODE_ENV !== "production") {
593
- (function() {
594
-
595
- /* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
596
- if (
597
- typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&
598
- typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart ===
599
- 'function'
600
- ) {
601
- __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
602
- }
603
- var React = require$$0__default["default"];
604
- var shim = requireShim();
605
-
606
- /**
607
- * inlined Object.is polyfill to avoid requiring consumers ship their own
608
- * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
609
- */
610
- function is(x, y) {
611
- return x === y && (x !== 0 || 1 / x === 1 / y) || x !== x && y !== y // eslint-disable-line no-self-compare
612
- ;
613
- }
614
-
615
- var objectIs = typeof Object.is === 'function' ? Object.is : is;
616
-
617
- var useSyncExternalStore = shim.useSyncExternalStore;
618
-
619
- // for CommonJS interop.
620
-
621
- var useRef = React.useRef,
622
- useEffect = React.useEffect,
623
- useMemo = React.useMemo,
624
- useDebugValue = React.useDebugValue; // Same as useSyncExternalStore, but supports selector and isEqual arguments.
625
-
626
- function useSyncExternalStoreWithSelector(subscribe, getSnapshot, getServerSnapshot, selector, isEqual) {
627
- // Use this to track the rendered snapshot.
628
- var instRef = useRef(null);
629
- var inst;
630
-
631
- if (instRef.current === null) {
632
- inst = {
633
- hasValue: false,
634
- value: null
635
- };
636
- instRef.current = inst;
637
- } else {
638
- inst = instRef.current;
639
- }
640
-
641
- var _useMemo = useMemo(function () {
642
- // Track the memoized state using closure variables that are local to this
643
- // memoized instance of a getSnapshot function. Intentionally not using a
644
- // useRef hook, because that state would be shared across all concurrent
645
- // copies of the hook/component.
646
- var hasMemo = false;
647
- var memoizedSnapshot;
648
- var memoizedSelection;
649
-
650
- var memoizedSelector = function (nextSnapshot) {
651
- if (!hasMemo) {
652
- // The first time the hook is called, there is no memoized result.
653
- hasMemo = true;
654
- memoizedSnapshot = nextSnapshot;
655
-
656
- var _nextSelection = selector(nextSnapshot);
657
-
658
- if (isEqual !== undefined) {
659
- // Even if the selector has changed, the currently rendered selection
660
- // may be equal to the new selection. We should attempt to reuse the
661
- // current value if possible, to preserve downstream memoizations.
662
- if (inst.hasValue) {
663
- var currentSelection = inst.value;
664
-
665
- if (isEqual(currentSelection, _nextSelection)) {
666
- memoizedSelection = currentSelection;
667
- return currentSelection;
668
- }
669
- }
670
- }
671
-
672
- memoizedSelection = _nextSelection;
673
- return _nextSelection;
674
- } // We may be able to reuse the previous invocation's result.
675
-
676
-
677
- // We may be able to reuse the previous invocation's result.
678
- var prevSnapshot = memoizedSnapshot;
679
- var prevSelection = memoizedSelection;
680
-
681
- if (objectIs(prevSnapshot, nextSnapshot)) {
682
- // The snapshot is the same as last time. Reuse the previous selection.
683
- return prevSelection;
684
- } // The snapshot has changed, so we need to compute a new selection.
685
-
686
-
687
- // The snapshot has changed, so we need to compute a new selection.
688
- var nextSelection = selector(nextSnapshot); // If a custom isEqual function is provided, use that to check if the data
689
- // has changed. If it hasn't, return the previous selection. That signals
690
- // to React that the selections are conceptually equal, and we can bail
691
- // out of rendering.
692
-
693
- // If a custom isEqual function is provided, use that to check if the data
694
- // has changed. If it hasn't, return the previous selection. That signals
695
- // to React that the selections are conceptually equal, and we can bail
696
- // out of rendering.
697
- if (isEqual !== undefined && isEqual(prevSelection, nextSelection)) {
698
- return prevSelection;
699
- }
700
-
701
- memoizedSnapshot = nextSnapshot;
702
- memoizedSelection = nextSelection;
703
- return nextSelection;
704
- }; // Assigning this to a constant so that Flow knows it can't change.
705
-
706
-
707
- // Assigning this to a constant so that Flow knows it can't change.
708
- var maybeGetServerSnapshot = getServerSnapshot === undefined ? null : getServerSnapshot;
709
-
710
- var getSnapshotWithSelector = function () {
711
- return memoizedSelector(getSnapshot());
712
- };
713
-
714
- var getServerSnapshotWithSelector = maybeGetServerSnapshot === null ? undefined : function () {
715
- return memoizedSelector(maybeGetServerSnapshot());
716
- };
717
- return [getSnapshotWithSelector, getServerSnapshotWithSelector];
718
- }, [getSnapshot, getServerSnapshot, selector, isEqual]),
719
- getSelection = _useMemo[0],
720
- getServerSelection = _useMemo[1];
721
-
722
- var value = useSyncExternalStore(subscribe, getSelection, getServerSelection);
723
- useEffect(function () {
724
- inst.hasValue = true;
725
- inst.value = value;
726
- }, [value]);
727
- useDebugValue(value);
728
- return value;
729
- }
730
-
731
- withSelector_development.useSyncExternalStoreWithSelector = useSyncExternalStoreWithSelector;
732
- /* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
733
- if (
734
- typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&
735
- typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop ===
736
- 'function'
737
- ) {
738
- __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
739
- }
740
-
741
- })();
742
- }
743
- return withSelector_development;
744
- }
745
-
746
- (function (module) {
747
-
748
- if (process.env.NODE_ENV === 'production') {
749
- module.exports = requireWithSelector_production_min();
750
- } else {
751
- module.exports = requireWithSelector_development();
752
- }
753
- } (withSelector));
754
-
755
- var useSyncExternalStoreExports = /*@__PURE__*/getDefaultExportFromCjs(withSelector.exports);
756
-
757
- const { useSyncExternalStoreWithSelector } = useSyncExternalStoreExports;
758
- function useStore(api, selector = api.getState, equalityFn) {
759
- const slice = useSyncExternalStoreWithSelector(
760
- api.subscribe,
761
- api.getState,
762
- api.getServerState || api.getState,
763
- selector,
764
- equalityFn
765
- );
766
- require$$0.useDebugValue(slice);
767
- return slice;
768
- }
769
- const createImpl = (createState) => {
770
- if ((undefined && undefined.MODE) !== "production" && typeof createState !== "function") {
771
- console.warn(
772
- '[DEPRECATED] Passing a vanilla store will be unsupported in the future version. Please use `import { useStore } from "zustand"` to use the vanilla store in React.'
773
- );
774
- }
775
- const api = typeof createState === "function" ? createStore(createState) : createState;
776
- const useBoundStore = (selector, equalityFn) => useStore(api, selector, equalityFn);
777
- Object.assign(useBoundStore, api);
778
- return useBoundStore;
779
- };
780
- const create = (createState) => createState ? createImpl(createState) : createImpl;
781
-
782
- var useDisplayErrorPage = function useDisplayErrorPage() {
783
- return useErrorDisplayStore(ramda.prop("show404Page"));
784
- };
785
- var useErrorDisplayStore = create(function () {
786
- return {
787
- show404Page: false
788
- };
789
- });
790
-
791
228
  var shouldNot = function shouldNot(skip) {
792
229
  return _typeof(skip) === "object" || !skip;
793
230
  };
@@ -878,7 +315,7 @@ var handleUnauthorizedErrorResponse = function handleUnauthorizedErrorResponse(e
878
315
  return error;
879
316
  };
880
317
  var showErrorToastr = function showErrorToastr(error) {
881
- var _error$config3;
318
+ var _error$config3, _error$response3;
882
319
  var _ref3 = (_error$config3 = error.config) !== null && _error$config3 !== void 0 ? _error$config3 : {},
883
320
  _ref3$showToastr = _ref3.showToastr,
884
321
  showToastr = _ref3$showToastr === void 0 ? true : _ref3$showToastr;
@@ -889,20 +326,24 @@ var showErrorToastr = function showErrorToastr(error) {
889
326
  } else if (error.message === "Network Error") {
890
327
  // @ts-ignore
891
328
  neetoui.Toastr.error(i18next__default["default"].t("neetoCommons.toastr.error.networkError"));
892
- } else {
329
+ } else if (![403, 404].includes((_error$response3 = error.response) === null || _error$response3 === void 0 ? void 0 : _error$response3.status)) {
330
+ // we already display a page in case of 403 & 404
893
331
  neetoui.Toastr.error(error);
894
332
  }
895
333
  return error;
896
334
  };
897
335
  var handle404ErrorResponse = function handle404ErrorResponse(error) {
898
- var _error$response3, _error$config4;
899
- if (((_error$response3 = error.response) === null || _error$response3 === void 0 ? void 0 : _error$response3.status) !== 404) return error;
336
+ var _error$config4, _error$response4;
900
337
  var _ref4 = (_error$config4 = error.config) !== null && _error$config4 !== void 0 ? _error$config4 : {},
901
338
  _ref4$show404ErrorPag = _ref4.show404ErrorPage,
902
- show404ErrorPage = _ref4$show404ErrorPag === void 0 ? true : _ref4$show404ErrorPag;
903
- if (show404ErrorPage) {
904
- useErrorDisplayStore.setState({
905
- show404Page: true
339
+ show404ErrorPage = _ref4$show404ErrorPag === void 0 ? true : _ref4$show404ErrorPag,
340
+ _ref4$show403ErrorPag = _ref4.show403ErrorPage,
341
+ show403ErrorPage = _ref4$show403ErrorPag === void 0 ? true : _ref4$show403ErrorPag;
342
+ var status = (_error$response4 = error.response) === null || _error$response4 === void 0 ? void 0 : _error$response4.status;
343
+ if (status === 404 && show404ErrorPage || status === 403 && show403ErrorPage) {
344
+ reactUtils.useErrorDisplayStore.setState({
345
+ showErrorPage: true,
346
+ statusCode: status
906
347
  });
907
348
  }
908
349
  return error;
@@ -1043,8 +484,14 @@ var github = {
1043
484
  var neetoCommons = {
1044
485
  errorPage: {
1045
486
  cantBeFound: "The page you're looking for <br /> can't be found.",
487
+ unauthorized: "You don't have permissions <br /> to access this page.",
1046
488
  internalServerError: "The server encountered an error and <br /> could not complete your request.",
1047
- backToHome: "Back to home"
489
+ backToHome: "Back to home",
490
+ title: {
491
+ cantBeFound: "Page not found",
492
+ unauthorized: "Unauthorized",
493
+ internalServerError: "Internal server error"
494
+ }
1048
495
  },
1049
496
  fallbackComponent: {
1050
497
  somethingWentWrong: "Sorry, something went wrong.",
@@ -1241,6 +688,34 @@ var neetoCommons = {
1241
688
  viewDraftVersion: "View draft version",
1242
689
  deleteDraftVersion: "Delete draft version. It'll not impact the published version",
1243
690
  viewPublishedVersion: "View published version"
691
+ },
692
+ shareViaLink: {
693
+ title: "Share via link",
694
+ description: "Your {{entity}} is securely published and ready to use at this address.",
695
+ copyLink: "Copy link",
696
+ open: "Open {{entity}}",
697
+ regenerateUrl: {
698
+ title: "Regenerate URL",
699
+ inputLabel: "Your current URL is given below",
700
+ description: "Once a new URL is generated then the current URL will stop working. You will see the new URL once you click on the 'Yes, regenerate' button.",
701
+ confirmation: "Are you sure that you want to generate a new URL?",
702
+ submitButtonLabel: "Yes, regenerate",
703
+ cancelButtonLabel: "No, cancel"
704
+ },
705
+ socialMediaShare: {
706
+ title: "Share via social media",
707
+ qrCode: "QR code",
708
+ qrCodeDownload: "Download QR code",
709
+ qrCodeInfo: "Scan the QR code to open your {{entity}}. You can use the QR code anywhere after downloading it."
710
+ }
711
+ },
712
+ keyboardShortcuts: {
713
+ title: "Keyboard shortcuts",
714
+ global: {
715
+ categoryName: "GLOBAL",
716
+ openKeyboardShortcutsPane: "Open the keyboard shortcuts pane",
717
+ close: "Close modals, panes"
718
+ }
1244
719
  }
1245
720
  };
1246
721
  var en = {
@@ -1314,5 +789,8 @@ function initializeApplication(_ref) {
1314
789
  if (!(skip !== null && skip !== void 0 && skip.logger)) initializeLogger();
1315
790
  }
1316
791
 
792
+ Object.defineProperty(exports, 'useDisplayErrorPage', {
793
+ enumerable: true,
794
+ get: function () { return reactUtils.useDisplayErrorPage; }
795
+ });
1317
796
  exports["default"] = initializeApplication;
1318
- exports.useDisplayErrorPage = useDisplayErrorPage;