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