@bcrumbs.net/bc-api 0.0.42 → 0.0.44

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/index.esm.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { parse } from 'graphql';
2
- import { InMemoryCache, ApolloClient, from, useQuery, createHttpLink, useLazyQuery, useMutation } from '@apollo/client';
2
+ import { InMemoryCache, ApolloClient, from, useQuery, createHttpLink, useLazyQuery, useMutation, split as split$1 } from '@apollo/client';
3
3
  import { onError } from '@apollo/client/link/error';
4
4
  import { setContext } from '@apollo/client/link/context';
5
5
  import { RestLink } from 'apollo-link-rest';
@@ -9,6 +9,8 @@ import Url from 'url';
9
9
  import require$$0$1 from 'punycode';
10
10
  import https from 'https';
11
11
  import zlib from 'zlib';
12
+ import { BatchHttpLink } from '@apollo/client/link/batch-http';
13
+ import { getMainDefinition } from '@apollo/client/utilities';
12
14
 
13
15
  /******************************************************************************
14
16
  Copyright (c) Microsoft Corporation.
@@ -459,19 +461,19 @@ var tryToString$3 = tryToString$4;
459
461
  var $TypeError$d = TypeError;
460
462
 
461
463
  // `Assert: IsCallable(argument) is true`
462
- var aCallable$9 = function (argument) {
464
+ var aCallable$a = function (argument) {
463
465
  if (isCallable$i(argument)) return argument;
464
466
  throw new $TypeError$d(tryToString$3(argument) + ' is not a function');
465
467
  };
466
468
 
467
- var aCallable$8 = aCallable$9;
469
+ var aCallable$9 = aCallable$a;
468
470
  var isNullOrUndefined$4 = isNullOrUndefined$6;
469
471
 
470
472
  // `GetMethod` abstract operation
471
473
  // https://tc39.es/ecma262/#sec-getmethod
472
474
  var getMethod$5 = function (V, P) {
473
475
  var func = V[P];
474
- return isNullOrUndefined$4(func) ? undefined : aCallable$8(func);
476
+ return isNullOrUndefined$4(func) ? undefined : aCallable$9(func);
475
477
  };
476
478
 
477
479
  var call$g = functionCall;
@@ -681,7 +683,7 @@ var $String$3 = String;
681
683
  var $TypeError$a = TypeError;
682
684
 
683
685
  // `Assert: Type(argument) is Object`
684
- var anObject$f = function (argument) {
686
+ var anObject$g = function (argument) {
685
687
  if (isObject$6(argument)) return argument;
686
688
  throw new $TypeError$a($String$3(argument) + ' is not an object');
687
689
  };
@@ -689,7 +691,7 @@ var anObject$f = function (argument) {
689
691
  var DESCRIPTORS$a = descriptors;
690
692
  var IE8_DOM_DEFINE = ie8DomDefine;
691
693
  var V8_PROTOTYPE_DEFINE_BUG$1 = v8PrototypeDefineBug;
692
- var anObject$e = anObject$f;
694
+ var anObject$f = anObject$g;
693
695
  var toPropertyKey = toPropertyKey$2;
694
696
 
695
697
  var $TypeError$9 = TypeError;
@@ -704,9 +706,9 @@ var WRITABLE = 'writable';
704
706
  // `Object.defineProperty` method
705
707
  // https://tc39.es/ecma262/#sec-object.defineproperty
706
708
  objectDefineProperty.f = DESCRIPTORS$a ? V8_PROTOTYPE_DEFINE_BUG$1 ? function defineProperty(O, P, Attributes) {
707
- anObject$e(O);
709
+ anObject$f(O);
708
710
  P = toPropertyKey(P);
709
- anObject$e(Attributes);
711
+ anObject$f(Attributes);
710
712
  if (typeof O === 'function' && P === 'prototype' && 'value' in Attributes && WRITABLE in Attributes && !Attributes[WRITABLE]) {
711
713
  var current = $getOwnPropertyDescriptor(O, P);
712
714
  if (current && current[WRITABLE]) {
@@ -719,9 +721,9 @@ objectDefineProperty.f = DESCRIPTORS$a ? V8_PROTOTYPE_DEFINE_BUG$1 ? function de
719
721
  }
720
722
  } return $defineProperty(O, P, Attributes);
721
723
  } : $defineProperty : function defineProperty(O, P, Attributes) {
722
- anObject$e(O);
724
+ anObject$f(O);
723
725
  P = toPropertyKey(P);
724
- anObject$e(Attributes);
726
+ anObject$f(Attributes);
725
727
  if (IE8_DOM_DEFINE) try {
726
728
  return $defineProperty(O, P, Attributes);
727
729
  } catch (error) { /* empty */ }
@@ -1088,13 +1090,13 @@ var getBuiltIn$5 = getBuiltIn$7;
1088
1090
  var uncurryThis$a = functionUncurryThis;
1089
1091
  var getOwnPropertyNamesModule = objectGetOwnPropertyNames;
1090
1092
  var getOwnPropertySymbolsModule$1 = objectGetOwnPropertySymbols;
1091
- var anObject$d = anObject$f;
1093
+ var anObject$e = anObject$g;
1092
1094
 
1093
1095
  var concat$2 = uncurryThis$a([].concat);
1094
1096
 
1095
1097
  // all object keys, includes non-enumerable and symbols
1096
1098
  var ownKeys$1 = getBuiltIn$5('Reflect', 'ownKeys') || function ownKeys(it) {
1097
- var keys = getOwnPropertyNamesModule.f(anObject$d(it));
1099
+ var keys = getOwnPropertyNamesModule.f(anObject$e(it));
1098
1100
  var getOwnPropertySymbols = getOwnPropertySymbolsModule$1.f;
1099
1101
  return getOwnPropertySymbols ? concat$2(keys, getOwnPropertySymbols(it)) : keys;
1100
1102
  };
@@ -1261,13 +1263,13 @@ var objectAssign = !$assign || fails$a(function () {
1261
1263
  } return T;
1262
1264
  } : $assign;
1263
1265
 
1264
- var $$a = _export;
1266
+ var $$b = _export;
1265
1267
  var assign = objectAssign;
1266
1268
 
1267
1269
  // `Object.assign` method
1268
1270
  // https://tc39.es/ecma262/#sec-object.assign
1269
1271
  // eslint-disable-next-line es/no-object-assign -- required for testing
1270
- $$a({ target: 'Object', stat: true, arity: 2, forced: Object.assign !== assign }, {
1272
+ $$b({ target: 'Object', stat: true, arity: 2, forced: Object.assign !== assign }, {
1271
1273
  assign: assign
1272
1274
  });
1273
1275
 
@@ -1319,12 +1321,12 @@ var toString$4 = function (argument) {
1319
1321
  return $String$1(argument);
1320
1322
  };
1321
1323
 
1322
- var anObject$c = anObject$f;
1324
+ var anObject$d = anObject$g;
1323
1325
 
1324
1326
  // `RegExp.prototype.flags` getter implementation
1325
1327
  // https://tc39.es/ecma262/#sec-get-regexp.prototype.flags
1326
1328
  var regexpFlags$1 = function () {
1327
- var that = anObject$c(this);
1329
+ var that = anObject$d(this);
1328
1330
  var result = '';
1329
1331
  if (that.hasIndices) result += 'd';
1330
1332
  if (that.global) result += 'g';
@@ -1370,7 +1372,7 @@ var objectDefineProperties = {};
1370
1372
  var DESCRIPTORS$5 = descriptors;
1371
1373
  var V8_PROTOTYPE_DEFINE_BUG = v8PrototypeDefineBug;
1372
1374
  var definePropertyModule$1 = objectDefineProperty;
1373
- var anObject$b = anObject$f;
1375
+ var anObject$c = anObject$g;
1374
1376
  var toIndexedObject$1 = toIndexedObject$5;
1375
1377
  var objectKeys = objectKeys$2;
1376
1378
 
@@ -1378,7 +1380,7 @@ var objectKeys = objectKeys$2;
1378
1380
  // https://tc39.es/ecma262/#sec-object.defineproperties
1379
1381
  // eslint-disable-next-line es/no-object-defineproperties -- safe
1380
1382
  objectDefineProperties.f = DESCRIPTORS$5 && !V8_PROTOTYPE_DEFINE_BUG ? Object.defineProperties : function defineProperties(O, Properties) {
1381
- anObject$b(O);
1383
+ anObject$c(O);
1382
1384
  var props = toIndexedObject$1(Properties);
1383
1385
  var keys = objectKeys(Properties);
1384
1386
  var length = keys.length;
@@ -1393,7 +1395,7 @@ var getBuiltIn$4 = getBuiltIn$7;
1393
1395
  var html$2 = getBuiltIn$4('document', 'documentElement');
1394
1396
 
1395
1397
  /* global ActiveXObject -- old IE, WSH */
1396
- var anObject$a = anObject$f;
1398
+ var anObject$b = anObject$g;
1397
1399
  var definePropertiesModule = objectDefineProperties;
1398
1400
  var enumBugKeys = enumBugKeys$3;
1399
1401
  var hiddenKeys = hiddenKeys$4;
@@ -1467,7 +1469,7 @@ hiddenKeys[IE_PROTO$1] = true;
1467
1469
  var objectCreate = Object.create || function create(O, Properties) {
1468
1470
  var result;
1469
1471
  if (O !== null) {
1470
- EmptyConstructor[PROTOTYPE] = anObject$a(O);
1472
+ EmptyConstructor[PROTOTYPE] = anObject$b(O);
1471
1473
  result = new EmptyConstructor();
1472
1474
  EmptyConstructor[PROTOTYPE] = null;
1473
1475
  // add "__proto__" for Object.getPrototypeOf polyfill
@@ -1616,12 +1618,12 @@ if (PATCH) {
1616
1618
 
1617
1619
  var regexpExec$2 = patchedExec;
1618
1620
 
1619
- var $$9 = _export;
1621
+ var $$a = _export;
1620
1622
  var exec$1 = regexpExec$2;
1621
1623
 
1622
1624
  // `RegExp.prototype.exec` method
1623
1625
  // https://tc39.es/ecma262/#sec-regexp.prototype.exec
1624
- $$9({ target: 'RegExp', proto: true, forced: /./.exec !== exec$1 }, {
1626
+ $$a({ target: 'RegExp', proto: true, forced: /./.exec !== exec$1 }, {
1625
1627
  exec: exec$1
1626
1628
  });
1627
1629
 
@@ -1801,7 +1803,7 @@ var getSubstitution$1 = function (matched, str, position, captures, namedCapture
1801
1803
  };
1802
1804
 
1803
1805
  var call$9 = functionCall;
1804
- var anObject$9 = anObject$f;
1806
+ var anObject$a = anObject$g;
1805
1807
  var isCallable$a = isCallable$m;
1806
1808
  var classof$3 = classofRaw$2;
1807
1809
  var regexpExec = regexpExec$2;
@@ -1814,7 +1816,7 @@ var regexpExecAbstract = function (R, S) {
1814
1816
  var exec = R.exec;
1815
1817
  if (isCallable$a(exec)) {
1816
1818
  var result = call$9(exec, R, S);
1817
- if (result !== null) anObject$9(result);
1819
+ if (result !== null) anObject$a(result);
1818
1820
  return result;
1819
1821
  }
1820
1822
  if (classof$3(R) === 'RegExp') return call$9(regexpExec, R, S);
@@ -1826,7 +1828,7 @@ var call$8 = functionCall;
1826
1828
  var uncurryThis$5 = functionUncurryThis;
1827
1829
  var fixRegExpWellKnownSymbolLogic$1 = fixRegexpWellKnownSymbolLogic;
1828
1830
  var fails$5 = fails$j;
1829
- var anObject$8 = anObject$f;
1831
+ var anObject$9 = anObject$g;
1830
1832
  var isCallable$9 = isCallable$m;
1831
1833
  var isNullOrUndefined$3 = isNullOrUndefined$6;
1832
1834
  var toIntegerOrInfinity = toIntegerOrInfinity$4;
@@ -1894,7 +1896,7 @@ fixRegExpWellKnownSymbolLogic$1('replace', function (_, nativeReplace, maybeCall
1894
1896
  // `RegExp.prototype[@@replace]` method
1895
1897
  // https://tc39.es/ecma262/#sec-regexp.prototype-@@replace
1896
1898
  function (string, replaceValue) {
1897
- var rx = anObject$8(this);
1899
+ var rx = anObject$9(this);
1898
1900
  var S = toString$1(string);
1899
1901
 
1900
1902
  if (
@@ -1973,7 +1975,7 @@ var sameValue$1 = Object.is || function is(x, y) {
1973
1975
 
1974
1976
  var call$7 = functionCall;
1975
1977
  var fixRegExpWellKnownSymbolLogic = fixRegexpWellKnownSymbolLogic;
1976
- var anObject$7 = anObject$f;
1978
+ var anObject$8 = anObject$g;
1977
1979
  var isNullOrUndefined$2 = isNullOrUndefined$6;
1978
1980
  var requireObjectCoercible$1 = requireObjectCoercible$6;
1979
1981
  var sameValue = sameValue$1;
@@ -1994,7 +1996,7 @@ fixRegExpWellKnownSymbolLogic('search', function (SEARCH, nativeSearch, maybeCal
1994
1996
  // `RegExp.prototype[@@search]` method
1995
1997
  // https://tc39.es/ecma262/#sec-regexp.prototype-@@search
1996
1998
  function (string) {
1997
- var rx = anObject$7(this);
1999
+ var rx = anObject$8(this);
1998
2000
  var S = toString(string);
1999
2001
  var res = maybeCallNative(nativeSearch, rx, S);
2000
2002
 
@@ -2036,6 +2038,7 @@ function initBackendsLocations() {
2036
2038
  apiBackend = 'https://api.bcrumbs.net';
2037
2039
  apiV2Backend = 'https://apiv2.bcrumbs.net';
2038
2040
  showcaseRenderer = 'https://test-showcase.bcrumbs.net';
2041
+ gateway = 'https://gateway.bcrumbs.net';
2039
2042
  break;
2040
2043
  case 'test':
2041
2044
  dBackend = 'https://query.bcrumbs.net';
@@ -2043,6 +2046,7 @@ function initBackendsLocations() {
2043
2046
  apiBackend = 'https://api.bcrumbs.net';
2044
2047
  apiV2Backend = 'apiv2-dev.bcrumbs.net';
2045
2048
  showcaseRenderer = 'https://test-showcase.bcrumbs.net';
2049
+ gateway = 'https://gateway.bcrumbs.net';
2046
2050
  break;
2047
2051
  case 'local':
2048
2052
  dBackend = 'https://localhost:44322';
@@ -2050,6 +2054,7 @@ function initBackendsLocations() {
2050
2054
  apiBackend = 'http://localhost:6085';
2051
2055
  apiV2Backend = 'https://apiv2-dev.bcrumbs.net';
2052
2056
  showcaseRenderer = 'https://test-showcase.bcrumbs.net';
2057
+ gateway = 'https://gateway.bcrumbs.net';
2053
2058
  break;
2054
2059
  default:
2055
2060
  if (currentUrl && currentUrl.indexOf('localhost') > -1) {
@@ -2058,24 +2063,28 @@ function initBackendsLocations() {
2058
2063
  apiBackend = 'https://api.bcrumbs.net';
2059
2064
  apiV2Backend = 'https://apiv2.bcrumbs.net';
2060
2065
  showcaseRenderer = 'https://test-showcase.bcrumbs.net';
2066
+ gateway = 'https://gateway.bcrumbs.net';
2061
2067
  } else if (currentUrl && currentUrl.indexOf('dconfig.com') > -1) {
2062
2068
  dBackend = 'https://query.bcrumbs.net';
2063
2069
  frontend = 'https://app.bcrumbs.net';
2064
2070
  apiBackend = 'https://api.bcrumbs.net';
2065
2071
  apiV2Backend = 'https://apiv2.bcrumbs.net';
2066
2072
  showcaseRenderer = 'https://test-showcase.bcrumbs.net';
2073
+ gateway = 'https://gateway.bcrumbs.net';
2067
2074
  } else if (currentUrl && currentUrl.indexOf('dev.bcrumbs.net') > -1) {
2068
2075
  dBackend = 'https://query.bcrumbs.net';
2069
2076
  frontend = 'https://dev.bcrumbs.net';
2070
2077
  apiBackend = 'https://api.bcrumbs.net';
2071
2078
  apiV2Backend = 'https://apiv2.bcrumbs.net';
2072
2079
  showcaseRenderer = 'https://test-showcase.bcrumbs.net';
2080
+ gateway = 'https://gateway.bcrumbs.net';
2073
2081
  } else {
2074
2082
  dBackend = 'https://query.bcrumbs.net';
2075
2083
  frontend = 'https://app.bcrumbs.net';
2076
2084
  apiBackend = 'https://api.bcrumbs.net';
2077
2085
  apiV2Backend = 'https://apiv2.bcrumbs.net';
2078
2086
  showcaseRenderer = 'https://test-showcase.bcrumbs.net';
2087
+ gateway = 'https://gateway.bcrumbs.net';
2079
2088
  }
2080
2089
  break;
2081
2090
  }
@@ -2087,6 +2096,7 @@ let dBackend;
2087
2096
  let apiBackend;
2088
2097
  let apiV2Backend;
2089
2098
  let showcaseRenderer;
2099
+ let gateway;
2090
2100
  let api;
2091
2101
  initBackendsLocations();
2092
2102
  const appConfig = {
@@ -2100,13 +2110,16 @@ const appConfig = {
2100
2110
  networkInterface: showcaseRenderer
2101
2111
  },
2102
2112
  billing: {
2103
- networkInterface: apiV2Backend + '/billing'
2113
+ networkInterface: gateway + '/billing'
2104
2114
  },
2105
2115
  core: {
2106
- networkInterface: apiV2Backend + '/core'
2116
+ networkInterface: gateway + '/core'
2107
2117
  },
2108
2118
  bot: {
2109
- networkInterface: apiV2Backend + '/bot'
2119
+ networkInterface: gateway + '/bot'
2120
+ },
2121
+ auth: {
2122
+ networkInterface: gateway + '/auth'
2110
2123
  },
2111
2124
  // sw path
2112
2125
  sw: {
@@ -2244,12 +2257,12 @@ var iteratorCreateConstructor = function (IteratorConstructor, NAME, next, ENUME
2244
2257
  };
2245
2258
 
2246
2259
  var uncurryThis$4 = functionUncurryThis;
2247
- var aCallable$7 = aCallable$9;
2260
+ var aCallable$8 = aCallable$a;
2248
2261
 
2249
2262
  var functionUncurryThisAccessor = function (object, key, method) {
2250
2263
  try {
2251
2264
  // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
2252
- return uncurryThis$4(aCallable$7(Object.getOwnPropertyDescriptor(object, key)[method]));
2265
+ return uncurryThis$4(aCallable$8(Object.getOwnPropertyDescriptor(object, key)[method]));
2253
2266
  } catch (error) { /* empty */ }
2254
2267
  };
2255
2268
 
@@ -2298,7 +2311,7 @@ var objectSetPrototypeOf = Object.setPrototypeOf || ('__proto__' in {} ? functio
2298
2311
  };
2299
2312
  }() : undefined);
2300
2313
 
2301
- var $$8 = _export;
2314
+ var $$9 = _export;
2302
2315
  var call$6 = functionCall;
2303
2316
  var FunctionName = functionName;
2304
2317
  var isCallable$6 = isCallable$m;
@@ -2386,7 +2399,7 @@ var iteratorDefine = function (Iterable, NAME, IteratorConstructor, next, DEFAUL
2386
2399
  if (BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME || !(KEY in IterablePrototype)) {
2387
2400
  defineBuiltIn$2(IterablePrototype, KEY, methods[KEY]);
2388
2401
  }
2389
- } else $$8({ target: NAME, proto: true, forced: BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME }, methods);
2402
+ } else $$9({ target: NAME, proto: true, forced: BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME }, methods);
2390
2403
  }
2391
2404
 
2392
2405
  // define iterator
@@ -2569,7 +2582,7 @@ var aConstructor$1 = function (argument) {
2569
2582
  throw new $TypeError$5(tryToString$2(argument) + ' is not a constructor');
2570
2583
  };
2571
2584
 
2572
- var anObject$6 = anObject$f;
2585
+ var anObject$7 = anObject$g;
2573
2586
  var aConstructor = aConstructor$1;
2574
2587
  var isNullOrUndefined$1 = isNullOrUndefined$6;
2575
2588
  var wellKnownSymbol$6 = wellKnownSymbol$h;
@@ -2579,9 +2592,9 @@ var SPECIES$1 = wellKnownSymbol$6('species');
2579
2592
  // `SpeciesConstructor` abstract operation
2580
2593
  // https://tc39.es/ecma262/#sec-speciesconstructor
2581
2594
  var speciesConstructor$1 = function (O, defaultConstructor) {
2582
- var C = anObject$6(O).constructor;
2595
+ var C = anObject$7(O).constructor;
2583
2596
  var S;
2584
- return C === undefined || isNullOrUndefined$1(S = anObject$6(C)[SPECIES$1]) ? defaultConstructor : aConstructor(S);
2597
+ return C === undefined || isNullOrUndefined$1(S = anObject$7(C)[SPECIES$1]) ? defaultConstructor : aConstructor(S);
2585
2598
  };
2586
2599
 
2587
2600
  var classofRaw = classofRaw$2;
@@ -2595,14 +2608,14 @@ var functionUncurryThisClause = function (fn) {
2595
2608
  };
2596
2609
 
2597
2610
  var uncurryThis$1 = functionUncurryThisClause;
2598
- var aCallable$6 = aCallable$9;
2611
+ var aCallable$7 = aCallable$a;
2599
2612
  var NATIVE_BIND = functionBindNative;
2600
2613
 
2601
2614
  var bind$4 = uncurryThis$1(uncurryThis$1.bind);
2602
2615
 
2603
2616
  // optional / simple context binding
2604
2617
  var functionBindContext = function (fn, that) {
2605
- aCallable$6(fn);
2618
+ aCallable$7(fn);
2606
2619
  return that === undefined ? fn : NATIVE_BIND ? bind$4(fn, that) : function (/* ...args */) {
2607
2620
  return fn.apply(that, arguments);
2608
2621
  };
@@ -2940,7 +2953,7 @@ var promiseConstructorDetection = {
2940
2953
 
2941
2954
  var newPromiseCapability$2 = {};
2942
2955
 
2943
- var aCallable$5 = aCallable$9;
2956
+ var aCallable$6 = aCallable$a;
2944
2957
 
2945
2958
  var $TypeError$3 = TypeError;
2946
2959
 
@@ -2951,8 +2964,8 @@ var PromiseCapability = function (C) {
2951
2964
  resolve = $$resolve;
2952
2965
  reject = $$reject;
2953
2966
  });
2954
- this.resolve = aCallable$5(resolve);
2955
- this.reject = aCallable$5(reject);
2967
+ this.resolve = aCallable$6(resolve);
2968
+ this.reject = aCallable$6(reject);
2956
2969
  };
2957
2970
 
2958
2971
  // `NewPromiseCapability` abstract operation
@@ -2961,7 +2974,7 @@ newPromiseCapability$2.f = function (C) {
2961
2974
  return new PromiseCapability(C);
2962
2975
  };
2963
2976
 
2964
- var $$7 = _export;
2977
+ var $$8 = _export;
2965
2978
  var IS_NODE = engineIsNode;
2966
2979
  var global$3 = global$m;
2967
2980
  var call$5 = functionCall;
@@ -2969,7 +2982,7 @@ var defineBuiltIn$1 = defineBuiltIn$6;
2969
2982
  var setPrototypeOf = objectSetPrototypeOf;
2970
2983
  var setToStringTag$1 = setToStringTag$4;
2971
2984
  var setSpecies = setSpecies$1;
2972
- var aCallable$4 = aCallable$9;
2985
+ var aCallable$5 = aCallable$a;
2973
2986
  var isCallable$2 = isCallable$m;
2974
2987
  var isObject$1 = isObject$a;
2975
2988
  var anInstance$1 = anInstance$2;
@@ -3159,7 +3172,7 @@ if (FORCED_PROMISE_CONSTRUCTOR$4) {
3159
3172
  // 25.4.3.1 Promise(executor)
3160
3173
  PromiseConstructor = function Promise(executor) {
3161
3174
  anInstance$1(this, PromisePrototype);
3162
- aCallable$4(executor);
3175
+ aCallable$5(executor);
3163
3176
  call$5(Internal, this);
3164
3177
  var state = getInternalPromiseState(this);
3165
3178
  try {
@@ -3241,7 +3254,7 @@ if (FORCED_PROMISE_CONSTRUCTOR$4) {
3241
3254
  }
3242
3255
  }
3243
3256
 
3244
- $$7({ global: true, constructor: true, wrap: true, forced: FORCED_PROMISE_CONSTRUCTOR$4 }, {
3257
+ $$8({ global: true, constructor: true, wrap: true, forced: FORCED_PROMISE_CONSTRUCTOR$4 }, {
3245
3258
  Promise: PromiseConstructor
3246
3259
  });
3247
3260
 
@@ -3274,8 +3287,8 @@ var getIteratorMethod$2 = function (it) {
3274
3287
  };
3275
3288
 
3276
3289
  var call$4 = functionCall;
3277
- var aCallable$3 = aCallable$9;
3278
- var anObject$5 = anObject$f;
3290
+ var aCallable$4 = aCallable$a;
3291
+ var anObject$6 = anObject$g;
3279
3292
  var tryToString$1 = tryToString$4;
3280
3293
  var getIteratorMethod$1 = getIteratorMethod$2;
3281
3294
 
@@ -3283,17 +3296,17 @@ var $TypeError$2 = TypeError;
3283
3296
 
3284
3297
  var getIterator$1 = function (argument, usingIterator) {
3285
3298
  var iteratorMethod = arguments.length < 2 ? getIteratorMethod$1(argument) : usingIterator;
3286
- if (aCallable$3(iteratorMethod)) return anObject$5(call$4(iteratorMethod, argument));
3299
+ if (aCallable$4(iteratorMethod)) return anObject$6(call$4(iteratorMethod, argument));
3287
3300
  throw new $TypeError$2(tryToString$1(argument) + ' is not iterable');
3288
3301
  };
3289
3302
 
3290
3303
  var call$3 = functionCall;
3291
- var anObject$4 = anObject$f;
3304
+ var anObject$5 = anObject$g;
3292
3305
  var getMethod = getMethod$5;
3293
3306
 
3294
3307
  var iteratorClose$1 = function (iterator, kind, value) {
3295
3308
  var innerResult, innerError;
3296
- anObject$4(iterator);
3309
+ anObject$5(iterator);
3297
3310
  try {
3298
3311
  innerResult = getMethod(iterator, 'return');
3299
3312
  if (!innerResult) {
@@ -3307,13 +3320,13 @@ var iteratorClose$1 = function (iterator, kind, value) {
3307
3320
  }
3308
3321
  if (kind === 'throw') throw value;
3309
3322
  if (innerError) throw innerResult;
3310
- anObject$4(innerResult);
3323
+ anObject$5(innerResult);
3311
3324
  return value;
3312
3325
  };
3313
3326
 
3314
3327
  var bind = functionBindContext;
3315
3328
  var call$2 = functionCall;
3316
- var anObject$3 = anObject$f;
3329
+ var anObject$4 = anObject$g;
3317
3330
  var tryToString = tryToString$4;
3318
3331
  var isArrayIteratorMethod = isArrayIteratorMethod$1;
3319
3332
  var lengthOfArrayLike = lengthOfArrayLike$2;
@@ -3331,7 +3344,7 @@ var Result = function (stopped, result) {
3331
3344
 
3332
3345
  var ResultPrototype = Result.prototype;
3333
3346
 
3334
- var iterate$3 = function (iterable, unboundFunction, options) {
3347
+ var iterate$4 = function (iterable, unboundFunction, options) {
3335
3348
  var that = options && options.that;
3336
3349
  var AS_ENTRIES = !!(options && options.AS_ENTRIES);
3337
3350
  var IS_RECORD = !!(options && options.IS_RECORD);
@@ -3347,7 +3360,7 @@ var iterate$3 = function (iterable, unboundFunction, options) {
3347
3360
 
3348
3361
  var callFn = function (value) {
3349
3362
  if (AS_ENTRIES) {
3350
- anObject$3(value);
3363
+ anObject$4(value);
3351
3364
  return INTERRUPTED ? fn(value[0], value[1], stop) : fn(value[0], value[1]);
3352
3365
  } return INTERRUPTED ? fn(value, stop) : fn(value);
3353
3366
  };
@@ -3429,28 +3442,28 @@ var promiseStaticsIncorrectIteration = FORCED_PROMISE_CONSTRUCTOR$3 || !checkCor
3429
3442
  NativePromiseConstructor$1.all(iterable).then(undefined, function () { /* empty */ });
3430
3443
  });
3431
3444
 
3432
- var $$6 = _export;
3445
+ var $$7 = _export;
3433
3446
  var call$1 = functionCall;
3434
- var aCallable$2 = aCallable$9;
3447
+ var aCallable$3 = aCallable$a;
3435
3448
  var newPromiseCapabilityModule$2 = newPromiseCapability$2;
3436
3449
  var perform$1 = perform$3;
3437
- var iterate$2 = iterate$3;
3450
+ var iterate$3 = iterate$4;
3438
3451
  var PROMISE_STATICS_INCORRECT_ITERATION$1 = promiseStaticsIncorrectIteration;
3439
3452
 
3440
3453
  // `Promise.all` method
3441
3454
  // https://tc39.es/ecma262/#sec-promise.all
3442
- $$6({ target: 'Promise', stat: true, forced: PROMISE_STATICS_INCORRECT_ITERATION$1 }, {
3455
+ $$7({ target: 'Promise', stat: true, forced: PROMISE_STATICS_INCORRECT_ITERATION$1 }, {
3443
3456
  all: function all(iterable) {
3444
3457
  var C = this;
3445
3458
  var capability = newPromiseCapabilityModule$2.f(C);
3446
3459
  var resolve = capability.resolve;
3447
3460
  var reject = capability.reject;
3448
3461
  var result = perform$1(function () {
3449
- var $promiseResolve = aCallable$2(C.resolve);
3462
+ var $promiseResolve = aCallable$3(C.resolve);
3450
3463
  var values = [];
3451
3464
  var counter = 0;
3452
3465
  var remaining = 1;
3453
- iterate$2(iterable, function (promise) {
3466
+ iterate$3(iterable, function (promise) {
3454
3467
  var index = counter++;
3455
3468
  var alreadyCalled = false;
3456
3469
  remaining++;
@@ -3468,7 +3481,7 @@ $$6({ target: 'Promise', stat: true, forced: PROMISE_STATICS_INCORRECT_ITERATION
3468
3481
  }
3469
3482
  });
3470
3483
 
3471
- var $$5 = _export;
3484
+ var $$6 = _export;
3472
3485
  var FORCED_PROMISE_CONSTRUCTOR$2 = promiseConstructorDetection.CONSTRUCTOR;
3473
3486
  var NativePromiseConstructor = promiseNativeConstructor;
3474
3487
  var getBuiltIn$1 = getBuiltIn$7;
@@ -3479,7 +3492,7 @@ var NativePromisePrototype = NativePromiseConstructor && NativePromiseConstructo
3479
3492
 
3480
3493
  // `Promise.prototype.catch` method
3481
3494
  // https://tc39.es/ecma262/#sec-promise.prototype.catch
3482
- $$5({ target: 'Promise', proto: true, forced: FORCED_PROMISE_CONSTRUCTOR$2, real: true }, {
3495
+ $$6({ target: 'Promise', proto: true, forced: FORCED_PROMISE_CONSTRUCTOR$2, real: true }, {
3483
3496
  'catch': function (onRejected) {
3484
3497
  return this.then(undefined, onRejected);
3485
3498
  }
@@ -3493,24 +3506,24 @@ if (isCallable$1(NativePromiseConstructor)) {
3493
3506
  }
3494
3507
  }
3495
3508
 
3496
- var $$4 = _export;
3509
+ var $$5 = _export;
3497
3510
  var call = functionCall;
3498
- var aCallable$1 = aCallable$9;
3511
+ var aCallable$2 = aCallable$a;
3499
3512
  var newPromiseCapabilityModule$1 = newPromiseCapability$2;
3500
3513
  var perform = perform$3;
3501
- var iterate$1 = iterate$3;
3514
+ var iterate$2 = iterate$4;
3502
3515
  var PROMISE_STATICS_INCORRECT_ITERATION = promiseStaticsIncorrectIteration;
3503
3516
 
3504
3517
  // `Promise.race` method
3505
3518
  // https://tc39.es/ecma262/#sec-promise.race
3506
- $$4({ target: 'Promise', stat: true, forced: PROMISE_STATICS_INCORRECT_ITERATION }, {
3519
+ $$5({ target: 'Promise', stat: true, forced: PROMISE_STATICS_INCORRECT_ITERATION }, {
3507
3520
  race: function race(iterable) {
3508
3521
  var C = this;
3509
3522
  var capability = newPromiseCapabilityModule$1.f(C);
3510
3523
  var reject = capability.reject;
3511
3524
  var result = perform(function () {
3512
- var $promiseResolve = aCallable$1(C.resolve);
3513
- iterate$1(iterable, function (promise) {
3525
+ var $promiseResolve = aCallable$2(C.resolve);
3526
+ iterate$2(iterable, function (promise) {
3514
3527
  call($promiseResolve, C, promise).then(capability.resolve, reject);
3515
3528
  });
3516
3529
  });
@@ -3519,13 +3532,13 @@ $$4({ target: 'Promise', stat: true, forced: PROMISE_STATICS_INCORRECT_ITERATION
3519
3532
  }
3520
3533
  });
3521
3534
 
3522
- var $$3 = _export;
3535
+ var $$4 = _export;
3523
3536
  var newPromiseCapabilityModule = newPromiseCapability$2;
3524
3537
  var FORCED_PROMISE_CONSTRUCTOR$1 = promiseConstructorDetection.CONSTRUCTOR;
3525
3538
 
3526
3539
  // `Promise.reject` method
3527
3540
  // https://tc39.es/ecma262/#sec-promise.reject
3528
- $$3({ target: 'Promise', stat: true, forced: FORCED_PROMISE_CONSTRUCTOR$1 }, {
3541
+ $$4({ target: 'Promise', stat: true, forced: FORCED_PROMISE_CONSTRUCTOR$1 }, {
3529
3542
  reject: function reject(r) {
3530
3543
  var capability = newPromiseCapabilityModule.f(this);
3531
3544
  var capabilityReject = capability.reject;
@@ -3534,12 +3547,12 @@ $$3({ target: 'Promise', stat: true, forced: FORCED_PROMISE_CONSTRUCTOR$1 }, {
3534
3547
  }
3535
3548
  });
3536
3549
 
3537
- var anObject$2 = anObject$f;
3550
+ var anObject$3 = anObject$g;
3538
3551
  var isObject = isObject$a;
3539
3552
  var newPromiseCapability = newPromiseCapability$2;
3540
3553
 
3541
3554
  var promiseResolve$1 = function (C, x) {
3542
- anObject$2(C);
3555
+ anObject$3(C);
3543
3556
  if (isObject(x) && x.constructor === C) return x;
3544
3557
  var promiseCapability = newPromiseCapability.f(C);
3545
3558
  var resolve = promiseCapability.resolve;
@@ -3547,7 +3560,7 @@ var promiseResolve$1 = function (C, x) {
3547
3560
  return promiseCapability.promise;
3548
3561
  };
3549
3562
 
3550
- var $$2 = _export;
3563
+ var $$3 = _export;
3551
3564
  var getBuiltIn = getBuiltIn$7;
3552
3565
  var FORCED_PROMISE_CONSTRUCTOR = promiseConstructorDetection.CONSTRUCTOR;
3553
3566
  var promiseResolve = promiseResolve$1;
@@ -3556,12 +3569,114 @@ getBuiltIn('Promise');
3556
3569
 
3557
3570
  // `Promise.resolve` method
3558
3571
  // https://tc39.es/ecma262/#sec-promise.resolve
3559
- $$2({ target: 'Promise', stat: true, forced: FORCED_PROMISE_CONSTRUCTOR }, {
3572
+ $$3({ target: 'Promise', stat: true, forced: FORCED_PROMISE_CONSTRUCTOR }, {
3560
3573
  resolve: function resolve(x) {
3561
3574
  return promiseResolve(this, x);
3562
3575
  }
3563
3576
  });
3564
3577
 
3578
+ var DESCRIPTORS$1 = descriptors;
3579
+ var definePropertyModule = objectDefineProperty;
3580
+ var createPropertyDescriptor = createPropertyDescriptor$4;
3581
+
3582
+ var createProperty$1 = function (object, key, value) {
3583
+ if (DESCRIPTORS$1) definePropertyModule.f(object, key, createPropertyDescriptor(0, value));
3584
+ else object[key] = value;
3585
+ };
3586
+
3587
+ var $$2 = _export;
3588
+ var global$2 = global$m;
3589
+ var anInstance = anInstance$2;
3590
+ var anObject$2 = anObject$g;
3591
+ var isCallable = isCallable$m;
3592
+ var getPrototypeOf = objectGetPrototypeOf;
3593
+ var defineBuiltInAccessor = defineBuiltInAccessor$2;
3594
+ var createProperty = createProperty$1;
3595
+ var fails = fails$j;
3596
+ var hasOwn = hasOwnProperty_1;
3597
+ var wellKnownSymbol$1 = wellKnownSymbol$h;
3598
+ var IteratorPrototype = iteratorsCore.IteratorPrototype;
3599
+ var DESCRIPTORS = descriptors;
3600
+
3601
+ var CONSTRUCTOR = 'constructor';
3602
+ var ITERATOR$1 = 'Iterator';
3603
+ var TO_STRING_TAG = wellKnownSymbol$1('toStringTag');
3604
+
3605
+ var $TypeError = TypeError;
3606
+ var NativeIterator = global$2[ITERATOR$1];
3607
+
3608
+ // FF56- have non-standard global helper `Iterator`
3609
+ var FORCED = !isCallable(NativeIterator)
3610
+ || NativeIterator.prototype !== IteratorPrototype
3611
+ // FF44- non-standard `Iterator` passes previous tests
3612
+ || !fails(function () { NativeIterator({}); });
3613
+
3614
+ var IteratorConstructor = function Iterator() {
3615
+ anInstance(this, IteratorPrototype);
3616
+ if (getPrototypeOf(this) === IteratorPrototype) throw new $TypeError('Abstract class Iterator not directly constructable');
3617
+ };
3618
+
3619
+ var defineIteratorPrototypeAccessor = function (key, value) {
3620
+ if (DESCRIPTORS) {
3621
+ defineBuiltInAccessor(IteratorPrototype, key, {
3622
+ configurable: true,
3623
+ get: function () {
3624
+ return value;
3625
+ },
3626
+ set: function (replacement) {
3627
+ anObject$2(this);
3628
+ if (this === IteratorPrototype) throw new $TypeError("You can't redefine this property");
3629
+ if (hasOwn(this, key)) this[key] = replacement;
3630
+ else createProperty(this, key, replacement);
3631
+ }
3632
+ });
3633
+ } else IteratorPrototype[key] = value;
3634
+ };
3635
+
3636
+ if (!hasOwn(IteratorPrototype, TO_STRING_TAG)) defineIteratorPrototypeAccessor(TO_STRING_TAG, ITERATOR$1);
3637
+
3638
+ if (FORCED || !hasOwn(IteratorPrototype, CONSTRUCTOR) || IteratorPrototype[CONSTRUCTOR] === Object) {
3639
+ defineIteratorPrototypeAccessor(CONSTRUCTOR, IteratorConstructor);
3640
+ }
3641
+
3642
+ IteratorConstructor.prototype = IteratorPrototype;
3643
+
3644
+ // `Iterator` constructor
3645
+ // https://github.com/tc39/proposal-iterator-helpers
3646
+ $$2({ global: true, constructor: true, forced: FORCED }, {
3647
+ Iterator: IteratorConstructor
3648
+ });
3649
+
3650
+ // `GetIteratorDirect(obj)` abstract operation
3651
+ // https://tc39.es/proposal-iterator-helpers/#sec-getiteratordirect
3652
+ var getIteratorDirect$2 = function (obj) {
3653
+ return {
3654
+ iterator: obj,
3655
+ next: obj.next,
3656
+ done: false
3657
+ };
3658
+ };
3659
+
3660
+ var $$1 = _export;
3661
+ var iterate$1 = iterate$4;
3662
+ var aCallable$1 = aCallable$a;
3663
+ var anObject$1 = anObject$g;
3664
+ var getIteratorDirect$1 = getIteratorDirect$2;
3665
+
3666
+ // `Iterator.prototype.find` method
3667
+ // https://github.com/tc39/proposal-iterator-helpers
3668
+ $$1({ target: 'Iterator', proto: true, real: true }, {
3669
+ find: function find(predicate) {
3670
+ anObject$1(this);
3671
+ aCallable$1(predicate);
3672
+ var record = getIteratorDirect$1(this);
3673
+ var counter = 0;
3674
+ return iterate$1(record, function (value, stop) {
3675
+ if (predicate(value, counter++)) return stop(value);
3676
+ }, { IS_RECORD: true, INTERRUPTED: true }).result;
3677
+ }
3678
+ });
3679
+
3565
3680
  // iterable DOM collections
3566
3681
  // flag - `iterable` interface - 'entries', 'keys', 'values', 'forEach' methods
3567
3682
  var domIterables = {
@@ -3606,24 +3721,24 @@ var DOMTokenListPrototype$1 = classList && classList.constructor && classList.co
3606
3721
 
3607
3722
  var domTokenListPrototype = DOMTokenListPrototype$1 === Object.prototype ? undefined : DOMTokenListPrototype$1;
3608
3723
 
3609
- var global$2 = global$m;
3724
+ var global$1 = global$m;
3610
3725
  var DOMIterables = domIterables;
3611
3726
  var DOMTokenListPrototype = domTokenListPrototype;
3612
3727
  var ArrayIteratorMethods = es_array_iterator;
3613
3728
  var createNonEnumerableProperty = createNonEnumerableProperty$5;
3614
3729
  var setToStringTag = setToStringTag$4;
3615
- var wellKnownSymbol$1 = wellKnownSymbol$h;
3730
+ var wellKnownSymbol = wellKnownSymbol$h;
3616
3731
 
3617
- var ITERATOR$1 = wellKnownSymbol$1('iterator');
3732
+ var ITERATOR = wellKnownSymbol('iterator');
3618
3733
  var ArrayValues = ArrayIteratorMethods.values;
3619
3734
 
3620
3735
  var handlePrototype = function (CollectionPrototype, COLLECTION_NAME) {
3621
3736
  if (CollectionPrototype) {
3622
3737
  // some Chrome versions have non-configurable methods on DOMTokenList
3623
- if (CollectionPrototype[ITERATOR$1] !== ArrayValues) try {
3624
- createNonEnumerableProperty(CollectionPrototype, ITERATOR$1, ArrayValues);
3738
+ if (CollectionPrototype[ITERATOR] !== ArrayValues) try {
3739
+ createNonEnumerableProperty(CollectionPrototype, ITERATOR, ArrayValues);
3625
3740
  } catch (error) {
3626
- CollectionPrototype[ITERATOR$1] = ArrayValues;
3741
+ CollectionPrototype[ITERATOR] = ArrayValues;
3627
3742
  }
3628
3743
  setToStringTag(CollectionPrototype, COLLECTION_NAME, true);
3629
3744
  if (DOMIterables[COLLECTION_NAME]) for (var METHOD_NAME in ArrayIteratorMethods) {
@@ -3638,7 +3753,7 @@ var handlePrototype = function (CollectionPrototype, COLLECTION_NAME) {
3638
3753
  };
3639
3754
 
3640
3755
  for (var COLLECTION_NAME in DOMIterables) {
3641
- handlePrototype(global$2[COLLECTION_NAME] && global$2[COLLECTION_NAME].prototype, COLLECTION_NAME);
3756
+ handlePrototype(global$1[COLLECTION_NAME] && global$1[COLLECTION_NAME].prototype, COLLECTION_NAME);
3642
3757
  }
3643
3758
 
3644
3759
  handlePrototype(DOMTokenListPrototype, 'DOMTokenList');
@@ -3649,16 +3764,25 @@ const defaultErrorHandler = ({
3649
3764
  graphQLErrors
3650
3765
  }) => {
3651
3766
  if (networkError && networkError.statusCode === 401) {
3652
- // redirect to login page
3653
- if (typeof window !== 'undefined' && window.location.pathname !== '/account/login') {
3654
- return window.location.replace('/account/login');
3767
+ redirectToLogin();
3768
+ return;
3769
+ }
3770
+ if (graphQLErrors && graphQLErrors.length > 0) {
3771
+ const unauthenticatedError = graphQLErrors.find(error => {
3772
+ var _a;
3773
+ return ((_a = error === null || error === void 0 ? void 0 : error.extensions) === null || _a === void 0 ? void 0 : _a['code']) === 'UNAUTHENTICATED';
3774
+ });
3775
+ if (unauthenticatedError) {
3776
+ redirectToLogin();
3777
+ return;
3655
3778
  }
3656
- } else if (networkError && networkError.statusCode > 500 && networkError.statusCode !== 503) {
3779
+ }
3780
+ if (networkError && networkError.statusCode > 500 && networkError.statusCode !== 503) {
3657
3781
  if (typeof window !== 'undefined' && window.location.pathname !== '/error') {
3658
3782
  return window.location.replace('/error?message=' + networkError.message);
3659
3783
  }
3660
3784
  }
3661
- // TODO: Uncomment this and fix when we have a proper way to handle 403 errors
3785
+ // TODO: Uncomment this and fix when we have a proper way to handle 403 errors, if needed
3662
3786
  // if (
3663
3787
  // graphQLErrors &&
3664
3788
  // graphQLErrors.find((error) => error?.extensions?.['code'] === 'FORBIDDEN')
@@ -3723,11 +3847,24 @@ function getUserContext() {
3723
3847
  });
3724
3848
  });
3725
3849
  }
3850
+ const clearAuthData = () => {
3851
+ if (typeof window !== 'undefined') {
3852
+ window.localStorage.removeItem('token');
3853
+ window.localStorage.removeItem('ContextId');
3854
+ window.localStorage.removeItem('userInfo');
3855
+ }
3856
+ };
3857
+ const redirectToLogin = () => {
3858
+ if (typeof window !== 'undefined' && window.location.pathname !== '/account/login') {
3859
+ clearAuthData();
3860
+ window.location.href = '/account/login';
3861
+ }
3862
+ };
3726
3863
 
3727
3864
  const {
3728
- networkInterface: uri$4
3865
+ networkInterface: uri$5
3729
3866
  } = appConfig.dconfig;
3730
- const authLink$2 = setContext((operation_1, _a) => __awaiter(void 0, [operation_1, _a], void 0, function* (operation, {
3867
+ const authLink$3 = setContext((operation_1, _a) => __awaiter(void 0, [operation_1, _a], void 0, function* (operation, {
3731
3868
  headers
3732
3869
  }) {
3733
3870
  const currentUsertoken = yield getUserToken();
@@ -3751,8 +3888,8 @@ const authLink$2 = setContext((operation_1, _a) => __awaiter(void 0, [operation_
3751
3888
  };
3752
3889
  return resultHeaders;
3753
3890
  }));
3754
- const cache$4 = new InMemoryCache();
3755
- const errorLink$3 = onError(({
3891
+ const cache$5 = new InMemoryCache();
3892
+ const errorLink$4 = onError(({
3756
3893
  networkError
3757
3894
  }) => {
3758
3895
  if (networkError && networkError.statusCode === 401) {
@@ -3762,19 +3899,19 @@ const errorLink$3 = onError(({
3762
3899
  }
3763
3900
  } else if (networkError && networkError.statusCode > 500 && networkError.statusCode !== 503) {
3764
3901
  if (typeof window !== 'undefined' && window.location.pathname !== '/error') {
3765
- return window.location.replace('/account/error?message=' + networkError.message);
3902
+ return window.location.replace('/error?message=' + networkError.message);
3766
3903
  }
3767
3904
  } else {
3768
3905
  if (typeof window !== 'undefined' && window.location.pathname !== '/error') {
3769
- return window.location.replace('/account/error?message=Cannot connect to the server, please make sure you have an active internet connection');
3906
+ return window.location.replace('/error?message=Cannot connect to the server, please make sure you have an active internet connection');
3770
3907
  }
3771
3908
  }
3772
3909
  });
3773
3910
  /* eslint-disable no-process-env */
3774
- const isDevEnv$4 = process.env['NODE_ENV'] !== 'production';
3911
+ const isDevEnv$5 = process.env['NODE_ENV'] !== 'production';
3775
3912
  /* eslint-enable no-process-env */
3776
3913
  const link_dconfig = new RestLink({
3777
- uri: uri$4 || 'https://api.bcrumbs.net',
3914
+ uri: uri$5 || 'https://api.bcrumbs.net',
3778
3915
  bodySerializers: {
3779
3916
  fileEncode: (data, headers) => {
3780
3917
  const formData = new FormData();
@@ -3788,9 +3925,9 @@ const link_dconfig = new RestLink({
3788
3925
  }
3789
3926
  });
3790
3927
  const dconfigClient = new ApolloClient({
3791
- link: from([authLink$2, errorLink$3, link_dconfig]),
3792
- cache: cache$4,
3793
- connectToDevTools: isDevEnv$4,
3928
+ link: from([authLink$3, errorLink$4, link_dconfig]),
3929
+ cache: cache$5,
3930
+ connectToDevTools: isDevEnv$5,
3794
3931
  queryDeduplication: true
3795
3932
  });
3796
3933
  const formSerializer = (data, headers) => {
@@ -3808,13 +3945,13 @@ const formSerializer = (data, headers) => {
3808
3945
  };
3809
3946
  };
3810
3947
  const link_dconfig_token = new RestLink({
3811
- uri: uri$4 || 'https://api.bcrumbs.net',
3948
+ uri: uri$5 || 'https://api.bcrumbs.net',
3812
3949
  defaultSerializer: formSerializer
3813
3950
  });
3814
3951
  const tokenClient = new ApolloClient({
3815
- link: from([link_dconfig_token, errorLink$3]),
3816
- cache: cache$4,
3817
- connectToDevTools: isDevEnv$4
3952
+ link: from([link_dconfig_token, errorLink$4]),
3953
+ cache: cache$5,
3954
+ connectToDevTools: isDevEnv$5
3818
3955
  });
3819
3956
 
3820
3957
  let _$8 = t => t,
@@ -3917,23 +4054,23 @@ const useModelChildrenQuery = (parentId, templateId) => useQuery(viewTypeChildre
3917
4054
  });
3918
4055
 
3919
4056
  const {
3920
- networkInterface: uri$3
4057
+ networkInterface: uri$4
3921
4058
  } = appConfig.dquery;
3922
- const cache$3 = new InMemoryCache();
3923
- const errorLink$2 = onError(handleHandler);
4059
+ const cache$4 = new InMemoryCache();
4060
+ const errorLink$3 = onError(handleHandler);
3924
4061
  /* eslint-disable no-process-env */
3925
- const isDevEnv$3 = process.env['NODE_ENV'] !== 'production';
4062
+ const isDevEnv$4 = process.env['NODE_ENV'] !== 'production';
3926
4063
  /* eslint-enable no-process-env */
3927
- const link_dquery$2 = createHttpLink({
3928
- uri: uri$3,
4064
+ const link_dquery$1 = createHttpLink({
4065
+ uri: uri$4,
3929
4066
  fetchOptions: {
3930
4067
  mode: 'cors'
3931
4068
  }
3932
4069
  });
3933
4070
  const dqueryClient = new ApolloClient({
3934
- link: from([errorLink$2, link_dquery$2]),
3935
- cache: cache$3,
3936
- connectToDevTools: isDevEnv$3,
4071
+ link: from([errorLink$3, link_dquery$1]),
4072
+ cache: cache$4,
4073
+ connectToDevTools: isDevEnv$4,
3937
4074
  queryDeduplication: true
3938
4075
  });
3939
4076
 
@@ -3944,12 +4081,13 @@ const portalThemeConfig = gql(_t$7 || (_t$7 = _$7`
3944
4081
  configuration(type: "portalTheme", domain: $domain)
3945
4082
  }
3946
4083
  `));
3947
- const usePortalThemeConfig = domain => useQuery(portalThemeConfig, {
4084
+ const usePortalThemeConfig = (domain, skip = false) => useQuery(portalThemeConfig, {
3948
4085
  fetchPolicy: 'cache-first',
3949
4086
  client: dqueryClient,
3950
4087
  variables: {
3951
4088
  domain
3952
- }
4089
+ },
4090
+ skip
3953
4091
  });
3954
4092
 
3955
4093
  let _$6 = t => t,
@@ -5254,19 +5392,19 @@ const useUpdateContentsOrderingMutation = () => useMutation(updateContentsOrderi
5254
5392
  });
5255
5393
 
5256
5394
  const {
5257
- networkInterface: uri$2
5395
+ networkInterface: uri$3
5258
5396
  } = appConfig.showcase;
5259
- const cache$2 = new InMemoryCache();
5397
+ const cache$3 = new InMemoryCache();
5260
5398
  /* eslint-disable no-process-env */
5261
- const isDevEnv$2 = process.env['NODE_ENV'] !== 'production';
5399
+ const isDevEnv$3 = process.env['NODE_ENV'] !== 'production';
5262
5400
  /* eslint-enable no-process-env */
5263
5401
  const link$1 = new RestLink({
5264
- uri: uri$2 || "https://api.bcrumbs.net"
5402
+ uri: uri$3 || "https://api.bcrumbs.net"
5265
5403
  });
5266
5404
  const showcaseRendererClient = new ApolloClient({
5267
5405
  link: link$1,
5268
- cache: cache$2,
5269
- connectToDevTools: isDevEnv$2,
5406
+ cache: cache$3,
5407
+ connectToDevTools: isDevEnv$3,
5270
5408
  queryDeduplication: true
5271
5409
  });
5272
5410
 
@@ -5339,13 +5477,13 @@ const menuConfigurationQuery = gql(_t2$1 || (_t2$1 = _$1`
5339
5477
  )
5340
5478
  }
5341
5479
  `));
5342
- const useMenuConfigurationQuery = ContextId => useQuery(menuConfigurationQuery, {
5480
+ const useMenuConfigurationQuery = (ContextId, skip = false) => useQuery(menuConfigurationQuery, {
5343
5481
  fetchPolicy: 'cache-first',
5344
5482
  client: dconfigClient,
5345
5483
  variables: {
5346
5484
  ContextId
5347
5485
  },
5348
- skip: !ContextId
5486
+ skip: !ContextId || skip
5349
5487
  });
5350
5488
  const addDomain = gql(_t3$1 || (_t3$1 = _$1`
5351
5489
  mutation ($rootContent: String!, $body: JSON!) {
@@ -87306,22 +87444,61 @@ const showcaseClient = new ApolloClient({
87306
87444
  });
87307
87445
 
87308
87446
  const {
87309
- networkInterface: uri$1
87447
+ networkInterface: uri$2
87310
87448
  } = appConfig.core;
87449
+ const authLink$2 = setContext(handleAuth);
87450
+ const cache$2 = new InMemoryCache();
87451
+ const errorLink$2 = onError(handleHandler);
87452
+ /* eslint-disable no-process-env */
87453
+ const isDevEnv$2 = process.env['NODE_ENV'] !== 'production';
87454
+ /* eslint-enable no-process-env */
87455
+ const httpLink = createHttpLink({
87456
+ uri: `${uri$2}/gq`,
87457
+ fetchOptions: {
87458
+ mode: 'cors'
87459
+ }
87460
+ });
87461
+ const batchLink = new BatchHttpLink({
87462
+ uri: `${uri$2}/gq`,
87463
+ batchMax: 5,
87464
+ // Max number of operations in a single batch
87465
+ batchInterval: 200,
87466
+ // Time in ms to wait for operations to accumulate
87467
+ fetchOptions: {
87468
+ mode: 'cors'
87469
+ }
87470
+ });
87471
+ // use batch link for queries and http link for mutations
87472
+ const splitLink = split$1(({
87473
+ query
87474
+ }) => {
87475
+ const definition = getMainDefinition(query);
87476
+ return definition.kind === 'OperationDefinition' && definition.operation === 'query';
87477
+ }, batchLink, httpLink);
87478
+ const coreClient = new ApolloClient({
87479
+ link: from([authLink$2, errorLink$2, splitLink]),
87480
+ cache: cache$2,
87481
+ connectToDevTools: isDevEnv$2,
87482
+ queryDeduplication: true
87483
+ });
87484
+
87485
+ const {
87486
+ networkInterface: uri$1
87487
+ } = appConfig.bot;
87311
87488
  const authLink$1 = setContext(handleAuth);
87312
87489
  const cache$1 = new InMemoryCache();
87313
87490
  const errorLink$1 = onError(handleHandler);
87314
87491
  /* eslint-disable no-process-env */
87315
87492
  const isDevEnv$1 = process.env['NODE_ENV'] !== 'production';
87316
87493
  /* eslint-enable no-process-env */
87317
- const link_dquery$1 = createHttpLink({
87494
+ const link_dquery = createHttpLink({
87318
87495
  uri: `${uri$1}/gq`,
87319
87496
  fetchOptions: {
87320
87497
  mode: 'cors'
87321
87498
  }
87322
87499
  });
87323
- const coreClient = new ApolloClient({
87324
- link: from([authLink$1, errorLink$1, link_dquery$1]),
87500
+ const botClient = new ApolloClient({
87501
+ link: from([authLink$1, errorLink$1, link_dquery]),
87325
87502
  cache: cache$1,
87326
87503
  connectToDevTools: isDevEnv$1,
87327
87504
  queryDeduplication: true
@@ -87329,113 +87506,31 @@ const coreClient = new ApolloClient({
87329
87506
 
87330
87507
  const {
87331
87508
  networkInterface: uri
87332
- } = appConfig.bot;
87509
+ } = appConfig.auth;
87333
87510
  const authLink = setContext(handleAuth);
87334
87511
  const cache = new InMemoryCache();
87335
87512
  const errorLink = onError(handleHandler);
87336
87513
  /* eslint-disable no-process-env */
87337
87514
  const isDevEnv = process.env['NODE_ENV'] !== 'production';
87338
87515
  /* eslint-enable no-process-env */
87339
- const link_dquery = createHttpLink({
87516
+ const link_auth = createHttpLink({
87340
87517
  uri: `${uri}/gq`,
87341
87518
  fetchOptions: {
87342
87519
  mode: 'cors'
87343
87520
  }
87344
87521
  });
87345
- const botClient = new ApolloClient({
87346
- link: from([authLink, errorLink, link_dquery]),
87522
+ const authClient = new ApolloClient({
87523
+ link: from([authLink, errorLink, link_auth]),
87347
87524
  cache,
87348
87525
  connectToDevTools: isDevEnv,
87349
87526
  queryDeduplication: true
87350
87527
  });
87351
87528
 
87352
- var DESCRIPTORS$1 = descriptors;
87353
- var definePropertyModule = objectDefineProperty;
87354
- var createPropertyDescriptor = createPropertyDescriptor$4;
87355
-
87356
- var createProperty$1 = function (object, key, value) {
87357
- if (DESCRIPTORS$1) definePropertyModule.f(object, key, createPropertyDescriptor(0, value));
87358
- else object[key] = value;
87359
- };
87360
-
87361
- var $$1 = _export;
87362
- var global$1 = global$m;
87363
- var anInstance = anInstance$2;
87364
- var anObject$1 = anObject$f;
87365
- var isCallable = isCallable$m;
87366
- var getPrototypeOf = objectGetPrototypeOf;
87367
- var defineBuiltInAccessor = defineBuiltInAccessor$2;
87368
- var createProperty = createProperty$1;
87369
- var fails = fails$j;
87370
- var hasOwn = hasOwnProperty_1;
87371
- var wellKnownSymbol = wellKnownSymbol$h;
87372
- var IteratorPrototype = iteratorsCore.IteratorPrototype;
87373
- var DESCRIPTORS = descriptors;
87374
-
87375
- var CONSTRUCTOR = 'constructor';
87376
- var ITERATOR = 'Iterator';
87377
- var TO_STRING_TAG = wellKnownSymbol('toStringTag');
87378
-
87379
- var $TypeError = TypeError;
87380
- var NativeIterator = global$1[ITERATOR];
87381
-
87382
- // FF56- have non-standard global helper `Iterator`
87383
- var FORCED = !isCallable(NativeIterator)
87384
- || NativeIterator.prototype !== IteratorPrototype
87385
- // FF44- non-standard `Iterator` passes previous tests
87386
- || !fails(function () { NativeIterator({}); });
87387
-
87388
- var IteratorConstructor = function Iterator() {
87389
- anInstance(this, IteratorPrototype);
87390
- if (getPrototypeOf(this) === IteratorPrototype) throw new $TypeError('Abstract class Iterator not directly constructable');
87391
- };
87392
-
87393
- var defineIteratorPrototypeAccessor = function (key, value) {
87394
- if (DESCRIPTORS) {
87395
- defineBuiltInAccessor(IteratorPrototype, key, {
87396
- configurable: true,
87397
- get: function () {
87398
- return value;
87399
- },
87400
- set: function (replacement) {
87401
- anObject$1(this);
87402
- if (this === IteratorPrototype) throw new $TypeError("You can't redefine this property");
87403
- if (hasOwn(this, key)) this[key] = replacement;
87404
- else createProperty(this, key, replacement);
87405
- }
87406
- });
87407
- } else IteratorPrototype[key] = value;
87408
- };
87409
-
87410
- if (!hasOwn(IteratorPrototype, TO_STRING_TAG)) defineIteratorPrototypeAccessor(TO_STRING_TAG, ITERATOR);
87411
-
87412
- if (FORCED || !hasOwn(IteratorPrototype, CONSTRUCTOR) || IteratorPrototype[CONSTRUCTOR] === Object) {
87413
- defineIteratorPrototypeAccessor(CONSTRUCTOR, IteratorConstructor);
87414
- }
87415
-
87416
- IteratorConstructor.prototype = IteratorPrototype;
87417
-
87418
- // `Iterator` constructor
87419
- // https://github.com/tc39/proposal-iterator-helpers
87420
- $$1({ global: true, constructor: true, forced: FORCED }, {
87421
- Iterator: IteratorConstructor
87422
- });
87423
-
87424
- // `GetIteratorDirect(obj)` abstract operation
87425
- // https://tc39.es/proposal-iterator-helpers/#sec-getiteratordirect
87426
- var getIteratorDirect$1 = function (obj) {
87427
- return {
87428
- iterator: obj,
87429
- next: obj.next,
87430
- done: false
87431
- };
87432
- };
87433
-
87434
87529
  var $ = _export;
87435
- var iterate = iterate$3;
87436
- var aCallable = aCallable$9;
87437
- var anObject = anObject$f;
87438
- var getIteratorDirect = getIteratorDirect$1;
87530
+ var iterate = iterate$4;
87531
+ var aCallable = aCallable$a;
87532
+ var anObject = anObject$g;
87533
+ var getIteratorDirect = getIteratorDirect$2;
87439
87534
 
87440
87535
  // `Iterator.prototype.forEach` method
87441
87536
  // https://github.com/tc39/proposal-iterator-helpers
@@ -87485,4 +87580,4 @@ var ModelFieldsTypes;
87485
87580
  ModelFieldsTypes["JSON"] = "JSON";
87486
87581
  })(ModelFieldsTypes || (ModelFieldsTypes = {}));
87487
87582
 
87488
- export { CreateCheckoutSessionUri, CreatePortalSessionUri, ModelFieldsTypes, ModelUtilities, VALIDATE_COMPANY_NAME, addDomain, addDomainOptions, apiBackend, apiV2Backend, appConfig, botClient, companyUsersQuery, contentInstancesQuery, coreClient, createCompany, createContentInstanceMutation, createContentInstanceMutationOptions, createContentMutation, createContentMutationOptions, createFileMutation, createFolderMutation, dconfigClient, deleteFileMutation, deleteFolderMutation, dqueryClient, filesQuery, foldersTreeQuery, forgetPassword, forgetPasswordOptions, frontend, getErrorHandler, inviteUser, inviteUserOptions, login, loginOptions, menuConfigurationQuery, portalThemeConfig, querySectionThumb, queryUsage, registeUsage, register, registerOptions, removeContentMutation, removeDomain, removeDomainOptions, removeUserFromCompany, removeUserFromCompanyOptions, resetPassword, resetPasswordOptions, setErrorHandler, showcaseClient, showcaseConfig, showcaseConfigById, showcaseConfigurationQuery, showcaseConfigurationQueryOptions, showcaseContentsQuery, showcaseContext, showcaseDomainsQuery, showcasePagesQuery, showcaseSectionQuery, showcaseSectionsQuery, showcaseTemplateSectionsThumbsMap, showcaseTemplatesQuery, showcaseTemplatesQueryOptions, subscriptionConfigurationQuery, subscriptionConfigurationQueryOptions, tokenClient, updateCompany, updateCompanyOptions, updateContentInstanceFieldValuesMutation, updateContentInstanceFieldValuesMutationOptions, updateContentsOrderingMutation, updateContentsOrderingMutationOptions, updateTemplateSectionThumb, updateUserPassword, updateUserPasswordOptions, updateUserProfile, updateUserProfileOptions, useContentInstancesQuery, useCreateCompanyMutation, useCreateContentInstanceMutation, useCreateContentMutation, useCreateFileMutation, useCreateFolderMutation, useDeleteContentMutation, useDeleteFileMutation, useDeleteFolderMutation, useDomainsQuery, useFilesQuery, useFoldersTreeQuery, useMenuConfigurationQuery, useModelChildrenQuery, useModelsQuery, usePortalThemeConfig, useQuerySectionThumb, useQueryUsage, useRegisterUsage, useShowcaseConfig, useShowcaseConfigById, useShowcaseConfigurationQuery, useShowcaseContentsQuery, useShowcaseContext, useShowcasePagesQuery, useShowcaseSectionQuery, useShowcaseSectionsQuery, useShowcaseTemplate, useShowcaseTemplateOptions, useShowcaseTemplateProgress, useShowcaseTemplateProgressQuery, useTemplateSectionsThumbsMap, useUpdateContentInstanceFieldValuesMutation, useUpdateContentsOrderingMutation, useUserCompaniesQuery, useValidateCompanyName, userCompaniesQuery, userCompaniesQueryOptions, userInfoQuery, userInfoQueryOptions, viewTypeChildrenQuery, viewTypeChildrenQueryOptions, viewTypesQuery, viewTypesQueryOptions };
87583
+ export { CreateCheckoutSessionUri, CreatePortalSessionUri, ModelFieldsTypes, ModelUtilities, VALIDATE_COMPANY_NAME, addDomain, addDomainOptions, apiBackend, apiV2Backend, appConfig, authClient, botClient, clearAuthData, companyUsersQuery, contentInstancesQuery, coreClient, createCompany, createContentInstanceMutation, createContentInstanceMutationOptions, createContentMutation, createContentMutationOptions, createFileMutation, createFolderMutation, dconfigClient, deleteFileMutation, deleteFolderMutation, dqueryClient, filesQuery, foldersTreeQuery, forgetPassword, forgetPasswordOptions, frontend, getErrorHandler, getUserContext, getUserToken, handleAuth, handleHandler, inviteUser, inviteUserOptions, login, loginOptions, menuConfigurationQuery, portalThemeConfig, querySectionThumb, queryUsage, redirectToLogin, registeUsage, register, registerOptions, removeContentMutation, removeDomain, removeDomainOptions, removeUserFromCompany, removeUserFromCompanyOptions, resetPassword, resetPasswordOptions, setErrorHandler, showcaseClient, showcaseConfig, showcaseConfigById, showcaseConfigurationQuery, showcaseConfigurationQueryOptions, showcaseContentsQuery, showcaseContext, showcaseDomainsQuery, showcasePagesQuery, showcaseSectionQuery, showcaseSectionsQuery, showcaseTemplateSectionsThumbsMap, showcaseTemplatesQuery, showcaseTemplatesQueryOptions, subscriptionConfigurationQuery, subscriptionConfigurationQueryOptions, tokenClient, updateCompany, updateCompanyOptions, updateContentInstanceFieldValuesMutation, updateContentInstanceFieldValuesMutationOptions, updateContentsOrderingMutation, updateContentsOrderingMutationOptions, updateTemplateSectionThumb, updateUserPassword, updateUserPasswordOptions, updateUserProfile, updateUserProfileOptions, useContentInstancesQuery, useCreateCompanyMutation, useCreateContentInstanceMutation, useCreateContentMutation, useCreateFileMutation, useCreateFolderMutation, useDeleteContentMutation, useDeleteFileMutation, useDeleteFolderMutation, useDomainsQuery, useFilesQuery, useFoldersTreeQuery, useMenuConfigurationQuery, useModelChildrenQuery, useModelsQuery, usePortalThemeConfig, useQuerySectionThumb, useQueryUsage, useRegisterUsage, useShowcaseConfig, useShowcaseConfigById, useShowcaseConfigurationQuery, useShowcaseContentsQuery, useShowcaseContext, useShowcasePagesQuery, useShowcaseSectionQuery, useShowcaseSectionsQuery, useShowcaseTemplate, useShowcaseTemplateOptions, useShowcaseTemplateProgress, useShowcaseTemplateProgressQuery, useTemplateSectionsThumbsMap, useUpdateContentInstanceFieldValuesMutation, useUpdateContentsOrderingMutation, useUserCompaniesQuery, useValidateCompanyName, userCompaniesQuery, userCompaniesQueryOptions, userInfoQuery, userInfoQueryOptions, viewTypeChildrenQuery, viewTypeChildrenQueryOptions, viewTypesQuery, viewTypesQueryOptions };