@bigbinary/neeto-commons-frontend 2.0.35 → 2.0.37

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.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';
@@ -119,20 +120,6 @@ var nullSafe = function nullSafe(func) {
119
120
  );
120
121
  };
121
122
 
122
- var slugify = function slugify(string) {
123
- return string.toString().toLowerCase().replace(/\s+/g, "-") // Replace spaces with -
124
- .replace(/&/g, "-and-") // Replace & with 'and'
125
- .replace(/[^\w-]+/g, "") // Remove all non-word characters
126
- .replace(/--+/g, "-") // Replace multiple - with single -
127
- .replace(/^-+/, "") // Trim - from start of text
128
- .replace(/-+$/, "");
129
- }; // Trim - from end of text
130
-
131
- var humanize = function humanize(string) {
132
- string = string.replace(/[_-]+/g, " ").replace(/\s{2,}/g, " ").replace(/([a-z\d])([A-Z])/g, "$1" + " " + "$2").replace(/([A-Z]+)([A-Z][a-z\d]+)/g, "$1" + " " + "$2").toLowerCase().trim();
133
- string = string.charAt(0).toUpperCase() + string.slice(1);
134
- return string;
135
- };
136
123
  var snakeToCamelCase = function snakeToCamelCase(string) {
137
124
  return string.replace(/(_\w)/g, function (letter) {
138
125
  return letter[1].toUpperCase();
@@ -143,14 +130,6 @@ var camelToSnakeCase = function camelToSnakeCase(string) {
143
130
  return "_".concat(letter.toLowerCase());
144
131
  });
145
132
  };
146
- var capitalize = function capitalize(string) {
147
- return string.charAt(0).toUpperCase() + string.slice(1);
148
- };
149
- nullSafe(slugify);
150
- nullSafe(humanize);
151
- nullSafe(snakeToCamelCase);
152
- nullSafe(camelToSnakeCase);
153
- nullSafe(capitalize);
154
133
 
155
134
  var matchesImpl = function matchesImpl(pattern, object) {
156
135
  var __parent = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : object;
@@ -236,576 +215,6 @@ var resetAuthTokens = function resetAuthTokens() {
236
215
  });
237
216
  };
238
217
 
239
- const createStoreImpl = (createState) => {
240
- let state;
241
- const listeners = /* @__PURE__ */ new Set();
242
- const setState = (partial, replace) => {
243
- const nextState = typeof partial === "function" ? partial(state) : partial;
244
- if (!Object.is(nextState, state)) {
245
- const previousState = state;
246
- state = (replace != null ? replace : typeof nextState !== "object") ? nextState : Object.assign({}, state, nextState);
247
- listeners.forEach((listener) => listener(state, previousState));
248
- }
249
- };
250
- const getState = () => state;
251
- const subscribe = (listener) => {
252
- listeners.add(listener);
253
- return () => listeners.delete(listener);
254
- };
255
- const destroy = () => {
256
- if ((import.meta.env && import.meta.env.MODE) !== "production") {
257
- console.warn(
258
- "[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."
259
- );
260
- }
261
- listeners.clear();
262
- };
263
- const api = { setState, getState, subscribe, destroy };
264
- state = createState(setState, getState, api);
265
- return api;
266
- };
267
- const createStore = (createState) => createState ? createStoreImpl(createState) : createStoreImpl;
268
-
269
- function getDefaultExportFromCjs (x) {
270
- return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
271
- }
272
-
273
- var withSelector = {exports: {}};
274
-
275
- var withSelector_production_min = {};
276
-
277
- var shim = {exports: {}};
278
-
279
- var useSyncExternalStoreShim_production_min = {};
280
-
281
- /**
282
- * @license React
283
- * use-sync-external-store-shim.production.min.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_production_min;
292
-
293
- function requireUseSyncExternalStoreShim_production_min () {
294
- if (hasRequiredUseSyncExternalStoreShim_production_min) return useSyncExternalStoreShim_production_min;
295
- hasRequiredUseSyncExternalStoreShim_production_min = 1;
296
- 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}
297
- 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;
298
- return useSyncExternalStoreShim_production_min;
299
- }
300
-
301
- var useSyncExternalStoreShim_development = {};
302
-
303
- /**
304
- * @license React
305
- * use-sync-external-store-shim.development.js
306
- *
307
- * Copyright (c) Facebook, Inc. and its affiliates.
308
- *
309
- * This source code is licensed under the MIT license found in the
310
- * LICENSE file in the root directory of this source tree.
311
- */
312
-
313
- var hasRequiredUseSyncExternalStoreShim_development;
314
-
315
- function requireUseSyncExternalStoreShim_development () {
316
- if (hasRequiredUseSyncExternalStoreShim_development) return useSyncExternalStoreShim_development;
317
- hasRequiredUseSyncExternalStoreShim_development = 1;
318
-
319
- if (process.env.NODE_ENV !== "production") {
320
- (function() {
321
-
322
- /* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
323
- if (
324
- typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&
325
- typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart ===
326
- 'function'
327
- ) {
328
- __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
329
- }
330
- var React = require$$0;
331
-
332
- var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
333
-
334
- function error(format) {
335
- {
336
- {
337
- for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
338
- args[_key2 - 1] = arguments[_key2];
339
- }
340
-
341
- printWarning('error', format, args);
342
- }
343
- }
344
- }
345
-
346
- function printWarning(level, format, args) {
347
- // When changing this logic, you might want to also
348
- // update consoleWithStackDev.www.js as well.
349
- {
350
- var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
351
- var stack = ReactDebugCurrentFrame.getStackAddendum();
352
-
353
- if (stack !== '') {
354
- format += '%s';
355
- args = args.concat([stack]);
356
- } // eslint-disable-next-line react-internal/safe-string-coercion
357
-
358
-
359
- var argsWithFormat = args.map(function (item) {
360
- return String(item);
361
- }); // Careful: RN currently depends on this prefix
362
-
363
- argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it
364
- // breaks IE9: https://github.com/facebook/react/issues/13610
365
- // eslint-disable-next-line react-internal/no-production-logging
366
-
367
- Function.prototype.apply.call(console[level], console, argsWithFormat);
368
- }
369
- }
370
-
371
- /**
372
- * inlined Object.is polyfill to avoid requiring consumers ship their own
373
- * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
374
- */
375
- function is(x, y) {
376
- return x === y && (x !== 0 || 1 / x === 1 / y) || x !== x && y !== y // eslint-disable-line no-self-compare
377
- ;
378
- }
379
-
380
- var objectIs = typeof Object.is === 'function' ? Object.is : is;
381
-
382
- // dispatch for CommonJS interop named imports.
383
-
384
- var useState = React.useState,
385
- useEffect = React.useEffect,
386
- useLayoutEffect = React.useLayoutEffect,
387
- useDebugValue = React.useDebugValue;
388
- var didWarnOld18Alpha = false;
389
- var didWarnUncachedGetSnapshot = false; // Disclaimer: This shim breaks many of the rules of React, and only works
390
- // because of a very particular set of implementation details and assumptions
391
- // -- change any one of them and it will break. The most important assumption
392
- // is that updates are always synchronous, because concurrent rendering is
393
- // only available in versions of React that also have a built-in
394
- // useSyncExternalStore API. And we only use this shim when the built-in API
395
- // does not exist.
396
- //
397
- // Do not assume that the clever hacks used by this hook also work in general.
398
- // The point of this shim is to replace the need for hacks by other libraries.
399
-
400
- function useSyncExternalStore(subscribe, getSnapshot, // Note: The shim does not use getServerSnapshot, because pre-18 versions of
401
- // React do not expose a way to check if we're hydrating. So users of the shim
402
- // will need to track that themselves and return the correct value
403
- // from `getSnapshot`.
404
- getServerSnapshot) {
405
- {
406
- if (!didWarnOld18Alpha) {
407
- if (React.startTransition !== undefined) {
408
- didWarnOld18Alpha = true;
409
-
410
- 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.');
411
- }
412
- }
413
- } // Read the current snapshot from the store on every render. Again, this
414
- // breaks the rules of React, and only works here because of specific
415
- // implementation details, most importantly that updates are
416
- // always synchronous.
417
-
418
-
419
- var value = getSnapshot();
420
-
421
- {
422
- if (!didWarnUncachedGetSnapshot) {
423
- var cachedValue = getSnapshot();
424
-
425
- if (!objectIs(value, cachedValue)) {
426
- error('The result of getSnapshot should be cached to avoid an infinite loop');
427
-
428
- didWarnUncachedGetSnapshot = true;
429
- }
430
- }
431
- } // Because updates are synchronous, we don't queue them. Instead we force a
432
- // re-render whenever the subscribed state changes by updating an some
433
- // arbitrary useState hook. Then, during render, we call getSnapshot to read
434
- // the current value.
435
- //
436
- // Because we don't actually use the state returned by the useState hook, we
437
- // can save a bit of memory by storing other stuff in that slot.
438
- //
439
- // To implement the early bailout, we need to track some things on a mutable
440
- // object. Usually, we would put that in a useRef hook, but we can stash it in
441
- // our useState hook instead.
442
- //
443
- // To force a re-render, we call forceUpdate({inst}). That works because the
444
- // new object always fails an equality check.
445
-
446
-
447
- var _useState = useState({
448
- inst: {
449
- value: value,
450
- getSnapshot: getSnapshot
451
- }
452
- }),
453
- inst = _useState[0].inst,
454
- forceUpdate = _useState[1]; // Track the latest getSnapshot function with a ref. This needs to be updated
455
- // in the layout phase so we can access it during the tearing check that
456
- // happens on subscribe.
457
-
458
-
459
- useLayoutEffect(function () {
460
- inst.value = value;
461
- inst.getSnapshot = getSnapshot; // Whenever getSnapshot or subscribe changes, we need to check in the
462
- // commit phase if there was an interleaved mutation. In concurrent mode
463
- // this can happen all the time, but even in synchronous mode, an earlier
464
- // effect may have mutated the store.
465
-
466
- if (checkIfSnapshotChanged(inst)) {
467
- // Force a re-render.
468
- forceUpdate({
469
- inst: inst
470
- });
471
- }
472
- }, [subscribe, value, getSnapshot]);
473
- useEffect(function () {
474
- // Check for changes right before subscribing. Subsequent changes will be
475
- // detected in the subscription handler.
476
- if (checkIfSnapshotChanged(inst)) {
477
- // Force a re-render.
478
- forceUpdate({
479
- inst: inst
480
- });
481
- }
482
-
483
- var handleStoreChange = function () {
484
- // TODO: Because there is no cross-renderer API for batching updates, it's
485
- // up to the consumer of this library to wrap their subscription event
486
- // with unstable_batchedUpdates. Should we try to detect when this isn't
487
- // the case and print a warning in development?
488
- // The store changed. Check if the snapshot changed since the last time we
489
- // read from the store.
490
- if (checkIfSnapshotChanged(inst)) {
491
- // Force a re-render.
492
- forceUpdate({
493
- inst: inst
494
- });
495
- }
496
- }; // Subscribe to the store and return a clean-up function.
497
-
498
-
499
- return subscribe(handleStoreChange);
500
- }, [subscribe]);
501
- useDebugValue(value);
502
- return value;
503
- }
504
-
505
- function checkIfSnapshotChanged(inst) {
506
- var latestGetSnapshot = inst.getSnapshot;
507
- var prevValue = inst.value;
508
-
509
- try {
510
- var nextValue = latestGetSnapshot();
511
- return !objectIs(prevValue, nextValue);
512
- } catch (error) {
513
- return true;
514
- }
515
- }
516
-
517
- function useSyncExternalStore$1(subscribe, getSnapshot, getServerSnapshot) {
518
- // Note: The shim does not use getServerSnapshot, because pre-18 versions of
519
- // React do not expose a way to check if we're hydrating. So users of the shim
520
- // will need to track that themselves and return the correct value
521
- // from `getSnapshot`.
522
- return getSnapshot();
523
- }
524
-
525
- var canUseDOM = !!(typeof window !== 'undefined' && typeof window.document !== 'undefined' && typeof window.document.createElement !== 'undefined');
526
-
527
- var isServerEnvironment = !canUseDOM;
528
-
529
- var shim = isServerEnvironment ? useSyncExternalStore$1 : useSyncExternalStore;
530
- var useSyncExternalStore$2 = React.useSyncExternalStore !== undefined ? React.useSyncExternalStore : shim;
531
-
532
- useSyncExternalStoreShim_development.useSyncExternalStore = useSyncExternalStore$2;
533
- /* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
534
- if (
535
- typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&
536
- typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop ===
537
- 'function'
538
- ) {
539
- __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
540
- }
541
-
542
- })();
543
- }
544
- return useSyncExternalStoreShim_development;
545
- }
546
-
547
- var hasRequiredShim;
548
-
549
- function requireShim () {
550
- if (hasRequiredShim) return shim.exports;
551
- hasRequiredShim = 1;
552
- (function (module) {
553
-
554
- if (process.env.NODE_ENV === 'production') {
555
- module.exports = requireUseSyncExternalStoreShim_production_min();
556
- } else {
557
- module.exports = requireUseSyncExternalStoreShim_development();
558
- }
559
- } (shim));
560
- return shim.exports;
561
- }
562
-
563
- /**
564
- * @license React
565
- * use-sync-external-store-shim/with-selector.production.min.js
566
- *
567
- * Copyright (c) Facebook, Inc. and its affiliates.
568
- *
569
- * This source code is licensed under the MIT license found in the
570
- * LICENSE file in the root directory of this source tree.
571
- */
572
-
573
- var hasRequiredWithSelector_production_min;
574
-
575
- function requireWithSelector_production_min () {
576
- if (hasRequiredWithSelector_production_min) return withSelector_production_min;
577
- hasRequiredWithSelector_production_min = 1;
578
- 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;
579
- 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]);
580
- u(function(){f.hasValue=!0;f.value=d;},[d]);w(d);return d};
581
- return withSelector_production_min;
582
- }
583
-
584
- var withSelector_development = {};
585
-
586
- /**
587
- * @license React
588
- * use-sync-external-store-shim/with-selector.development.js
589
- *
590
- * Copyright (c) Facebook, Inc. and its affiliates.
591
- *
592
- * This source code is licensed under the MIT license found in the
593
- * LICENSE file in the root directory of this source tree.
594
- */
595
-
596
- var hasRequiredWithSelector_development;
597
-
598
- function requireWithSelector_development () {
599
- if (hasRequiredWithSelector_development) return withSelector_development;
600
- hasRequiredWithSelector_development = 1;
601
-
602
- if (process.env.NODE_ENV !== "production") {
603
- (function() {
604
-
605
- /* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
606
- if (
607
- typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&
608
- typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart ===
609
- 'function'
610
- ) {
611
- __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
612
- }
613
- var React = require$$0;
614
- var shim = requireShim();
615
-
616
- /**
617
- * inlined Object.is polyfill to avoid requiring consumers ship their own
618
- * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
619
- */
620
- function is(x, y) {
621
- return x === y && (x !== 0 || 1 / x === 1 / y) || x !== x && y !== y // eslint-disable-line no-self-compare
622
- ;
623
- }
624
-
625
- var objectIs = typeof Object.is === 'function' ? Object.is : is;
626
-
627
- var useSyncExternalStore = shim.useSyncExternalStore;
628
-
629
- // for CommonJS interop.
630
-
631
- var useRef = React.useRef,
632
- useEffect = React.useEffect,
633
- useMemo = React.useMemo,
634
- useDebugValue = React.useDebugValue; // Same as useSyncExternalStore, but supports selector and isEqual arguments.
635
-
636
- function useSyncExternalStoreWithSelector(subscribe, getSnapshot, getServerSnapshot, selector, isEqual) {
637
- // Use this to track the rendered snapshot.
638
- var instRef = useRef(null);
639
- var inst;
640
-
641
- if (instRef.current === null) {
642
- inst = {
643
- hasValue: false,
644
- value: null
645
- };
646
- instRef.current = inst;
647
- } else {
648
- inst = instRef.current;
649
- }
650
-
651
- var _useMemo = useMemo(function () {
652
- // Track the memoized state using closure variables that are local to this
653
- // memoized instance of a getSnapshot function. Intentionally not using a
654
- // useRef hook, because that state would be shared across all concurrent
655
- // copies of the hook/component.
656
- var hasMemo = false;
657
- var memoizedSnapshot;
658
- var memoizedSelection;
659
-
660
- var memoizedSelector = function (nextSnapshot) {
661
- if (!hasMemo) {
662
- // The first time the hook is called, there is no memoized result.
663
- hasMemo = true;
664
- memoizedSnapshot = nextSnapshot;
665
-
666
- var _nextSelection = selector(nextSnapshot);
667
-
668
- if (isEqual !== undefined) {
669
- // Even if the selector has changed, the currently rendered selection
670
- // may be equal to the new selection. We should attempt to reuse the
671
- // current value if possible, to preserve downstream memoizations.
672
- if (inst.hasValue) {
673
- var currentSelection = inst.value;
674
-
675
- if (isEqual(currentSelection, _nextSelection)) {
676
- memoizedSelection = currentSelection;
677
- return currentSelection;
678
- }
679
- }
680
- }
681
-
682
- memoizedSelection = _nextSelection;
683
- return _nextSelection;
684
- } // We may be able to reuse the previous invocation's result.
685
-
686
-
687
- // We may be able to reuse the previous invocation's result.
688
- var prevSnapshot = memoizedSnapshot;
689
- var prevSelection = memoizedSelection;
690
-
691
- if (objectIs(prevSnapshot, nextSnapshot)) {
692
- // The snapshot is the same as last time. Reuse the previous selection.
693
- return prevSelection;
694
- } // The snapshot has changed, so we need to compute a new selection.
695
-
696
-
697
- // The snapshot has changed, so we need to compute a new selection.
698
- var nextSelection = selector(nextSnapshot); // If a custom isEqual function is provided, use that to check if the data
699
- // has changed. If it hasn't, return the previous selection. That signals
700
- // to React that the selections are conceptually equal, and we can bail
701
- // out of rendering.
702
-
703
- // If a custom isEqual function is provided, use that to check if the data
704
- // has changed. If it hasn't, return the previous selection. That signals
705
- // to React that the selections are conceptually equal, and we can bail
706
- // out of rendering.
707
- if (isEqual !== undefined && isEqual(prevSelection, nextSelection)) {
708
- return prevSelection;
709
- }
710
-
711
- memoizedSnapshot = nextSnapshot;
712
- memoizedSelection = nextSelection;
713
- return nextSelection;
714
- }; // Assigning this to a constant so that Flow knows it can't change.
715
-
716
-
717
- // Assigning this to a constant so that Flow knows it can't change.
718
- var maybeGetServerSnapshot = getServerSnapshot === undefined ? null : getServerSnapshot;
719
-
720
- var getSnapshotWithSelector = function () {
721
- return memoizedSelector(getSnapshot());
722
- };
723
-
724
- var getServerSnapshotWithSelector = maybeGetServerSnapshot === null ? undefined : function () {
725
- return memoizedSelector(maybeGetServerSnapshot());
726
- };
727
- return [getSnapshotWithSelector, getServerSnapshotWithSelector];
728
- }, [getSnapshot, getServerSnapshot, selector, isEqual]),
729
- getSelection = _useMemo[0],
730
- getServerSelection = _useMemo[1];
731
-
732
- var value = useSyncExternalStore(subscribe, getSelection, getServerSelection);
733
- useEffect(function () {
734
- inst.hasValue = true;
735
- inst.value = value;
736
- }, [value]);
737
- useDebugValue(value);
738
- return value;
739
- }
740
-
741
- withSelector_development.useSyncExternalStoreWithSelector = useSyncExternalStoreWithSelector;
742
- /* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
743
- if (
744
- typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&
745
- typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop ===
746
- 'function'
747
- ) {
748
- __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
749
- }
750
-
751
- })();
752
- }
753
- return withSelector_development;
754
- }
755
-
756
- (function (module) {
757
-
758
- if (process.env.NODE_ENV === 'production') {
759
- module.exports = requireWithSelector_production_min();
760
- } else {
761
- module.exports = requireWithSelector_development();
762
- }
763
- } (withSelector));
764
-
765
- var useSyncExternalStoreExports = /*@__PURE__*/getDefaultExportFromCjs(withSelector.exports);
766
-
767
- const { useSyncExternalStoreWithSelector } = useSyncExternalStoreExports;
768
- function useStore(api, selector = api.getState, equalityFn) {
769
- const slice = useSyncExternalStoreWithSelector(
770
- api.subscribe,
771
- api.getState,
772
- api.getServerState || api.getState,
773
- selector,
774
- equalityFn
775
- );
776
- useDebugValue(slice);
777
- return slice;
778
- }
779
- const createImpl = (createState) => {
780
- if ((import.meta.env && import.meta.env.MODE) !== "production" && typeof createState !== "function") {
781
- console.warn(
782
- '[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.'
783
- );
784
- }
785
- const api = typeof createState === "function" ? createStore(createState) : createState;
786
- const useBoundStore = (selector, equalityFn) => useStore(api, selector, equalityFn);
787
- Object.assign(useBoundStore, api);
788
- return useBoundStore;
789
- };
790
- const create = (createState) => createState ? createImpl(createState) : createImpl;
791
- var react = (createState) => {
792
- if ((import.meta.env && import.meta.env.MODE) !== "production") {
793
- console.warn(
794
- "[DEPRECATED] default export is deprecated, instead import { create } from'zustand'"
795
- );
796
- }
797
- return create(createState);
798
- };
799
-
800
- var useDisplayErrorPage = function useDisplayErrorPage() {
801
- return useErrorDisplayStore(prop("show404Page"));
802
- };
803
- var useErrorDisplayStore = react(function () {
804
- return {
805
- show404Page: false
806
- };
807
- });
808
-
809
218
  var shouldNot = function shouldNot(skip) {
810
219
  return _typeof(skip) === "object" || !skip;
811
220
  };
@@ -896,7 +305,7 @@ var handleUnauthorizedErrorResponse = function handleUnauthorizedErrorResponse(e
896
305
  return error;
897
306
  };
898
307
  var showErrorToastr = function showErrorToastr(error) {
899
- var _error$config3;
308
+ var _error$config3, _error$response3;
900
309
  var _ref3 = (_error$config3 = error.config) !== null && _error$config3 !== void 0 ? _error$config3 : {},
901
310
  _ref3$showToastr = _ref3.showToastr,
902
311
  showToastr = _ref3$showToastr === void 0 ? true : _ref3$showToastr;
@@ -907,20 +316,24 @@ var showErrorToastr = function showErrorToastr(error) {
907
316
  } else if (error.message === "Network Error") {
908
317
  // @ts-ignore
909
318
  Toastr.error(i18next.t("neetoCommons.toastr.error.networkError"));
910
- } 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
911
321
  Toastr.error(error);
912
322
  }
913
323
  return error;
914
324
  };
915
325
  var handle404ErrorResponse = function handle404ErrorResponse(error) {
916
- var _error$response3, _error$config4;
917
- if (((_error$response3 = error.response) === null || _error$response3 === void 0 ? void 0 : _error$response3.status) !== 404) return error;
326
+ var _error$config4, _error$response4;
918
327
  var _ref4 = (_error$config4 = error.config) !== null && _error$config4 !== void 0 ? _error$config4 : {},
919
328
  _ref4$show404ErrorPag = _ref4.show404ErrorPage,
920
- show404ErrorPage = _ref4$show404ErrorPag === void 0 ? true : _ref4$show404ErrorPag;
921
- 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) {
922
334
  useErrorDisplayStore.setState({
923
- show404Page: true
335
+ showErrorPage: true,
336
+ statusCode: status
924
337
  });
925
338
  }
926
339
  return error;
@@ -1061,8 +474,14 @@ var github = {
1061
474
  var neetoCommons = {
1062
475
  errorPage: {
1063
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.",
1064
478
  internalServerError: "The server encountered an error and <br /> could not complete your request.",
1065
- 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
+ }
1066
485
  },
1067
486
  fallbackComponent: {
1068
487
  somethingWentWrong: "Sorry, something went wrong.",
@@ -1087,7 +506,9 @@ var neetoCommons = {
1087
506
  editTitle: "Edit {{entity}}",
1088
507
  addNew: "Add new {{entity}}",
1089
508
  reset: "Reset",
1090
- saveChanges: "Save changes"
509
+ saveChanges: "Save changes",
510
+ publish: "Publish",
511
+ draft: "Draft"
1091
512
  },
1092
513
  andSentence: "{{first}} {{and}} {{last}}",
1093
514
  and: "and",
@@ -1252,6 +673,39 @@ var neetoCommons = {
1252
673
  },
1253
674
  currentIpTitle: "Your current IP is",
1254
675
  currentIpDescription: "Your current IP will be added to the allowed IP range by default. You will not be able to save the IP settings without your current IP address on the list"
676
+ },
677
+ publishBlock: {
678
+ viewDraftVersion: "View draft version",
679
+ deleteDraftVersion: "Delete draft version. It'll not impact the published version",
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
+ }
1255
709
  }
1256
710
  };
1257
711
  var en = {
@@ -1325,4 +779,4 @@ function initializeApplication(_ref) {
1325
779
  if (!(skip !== null && skip !== void 0 && skip.logger)) initializeLogger();
1326
780
  }
1327
781
 
1328
- export { initializeApplication as default, globalProps$1 as globalProps, useDisplayErrorPage };
782
+ export { initializeApplication as default, globalProps$1 as globalProps };