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