@bigbinary/neeto-commons-frontend 2.0.19 → 2.0.21

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