@bcrumbs.net/bc-api 0.0.43 → 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.cjs.js CHANGED
@@ -2040,6 +2040,7 @@ function initBackendsLocations() {
2040
2040
  exports.apiBackend = 'https://api.bcrumbs.net';
2041
2041
  exports.apiV2Backend = 'https://apiv2.bcrumbs.net';
2042
2042
  showcaseRenderer = 'https://test-showcase.bcrumbs.net';
2043
+ gateway = 'https://gateway.bcrumbs.net';
2043
2044
  break;
2044
2045
  case 'test':
2045
2046
  dBackend = 'https://query.bcrumbs.net';
@@ -2047,6 +2048,7 @@ function initBackendsLocations() {
2047
2048
  exports.apiBackend = 'https://api.bcrumbs.net';
2048
2049
  exports.apiV2Backend = 'apiv2-dev.bcrumbs.net';
2049
2050
  showcaseRenderer = 'https://test-showcase.bcrumbs.net';
2051
+ gateway = 'https://gateway.bcrumbs.net';
2050
2052
  break;
2051
2053
  case 'local':
2052
2054
  dBackend = 'https://localhost:44322';
@@ -2054,6 +2056,7 @@ function initBackendsLocations() {
2054
2056
  exports.apiBackend = 'http://localhost:6085';
2055
2057
  exports.apiV2Backend = 'https://apiv2-dev.bcrumbs.net';
2056
2058
  showcaseRenderer = 'https://test-showcase.bcrumbs.net';
2059
+ gateway = 'https://gateway.bcrumbs.net';
2057
2060
  break;
2058
2061
  default:
2059
2062
  if (currentUrl && currentUrl.indexOf('localhost') > -1) {
@@ -2062,24 +2065,28 @@ function initBackendsLocations() {
2062
2065
  exports.apiBackend = 'https://api.bcrumbs.net';
2063
2066
  exports.apiV2Backend = 'https://apiv2.bcrumbs.net';
2064
2067
  showcaseRenderer = 'https://test-showcase.bcrumbs.net';
2068
+ gateway = 'https://gateway.bcrumbs.net';
2065
2069
  } else if (currentUrl && currentUrl.indexOf('dconfig.com') > -1) {
2066
2070
  dBackend = 'https://query.bcrumbs.net';
2067
2071
  exports.frontend = 'https://app.bcrumbs.net';
2068
2072
  exports.apiBackend = 'https://api.bcrumbs.net';
2069
2073
  exports.apiV2Backend = 'https://apiv2.bcrumbs.net';
2070
2074
  showcaseRenderer = 'https://test-showcase.bcrumbs.net';
2075
+ gateway = 'https://gateway.bcrumbs.net';
2071
2076
  } else if (currentUrl && currentUrl.indexOf('dev.bcrumbs.net') > -1) {
2072
2077
  dBackend = 'https://query.bcrumbs.net';
2073
2078
  exports.frontend = 'https://dev.bcrumbs.net';
2074
2079
  exports.apiBackend = 'https://api.bcrumbs.net';
2075
2080
  exports.apiV2Backend = 'https://apiv2.bcrumbs.net';
2076
2081
  showcaseRenderer = 'https://test-showcase.bcrumbs.net';
2082
+ gateway = 'https://gateway.bcrumbs.net';
2077
2083
  } else {
2078
2084
  dBackend = 'https://query.bcrumbs.net';
2079
2085
  exports.frontend = 'https://app.bcrumbs.net';
2080
2086
  exports.apiBackend = 'https://api.bcrumbs.net';
2081
2087
  exports.apiV2Backend = 'https://apiv2.bcrumbs.net';
2082
2088
  showcaseRenderer = 'https://test-showcase.bcrumbs.net';
2089
+ gateway = 'https://gateway.bcrumbs.net';
2083
2090
  }
2084
2091
  break;
2085
2092
  }
@@ -2091,6 +2098,7 @@ let dBackend;
2091
2098
  exports.apiBackend = void 0;
2092
2099
  exports.apiV2Backend = void 0;
2093
2100
  let showcaseRenderer;
2101
+ let gateway;
2094
2102
  let api;
2095
2103
  initBackendsLocations();
2096
2104
  const appConfig = {
@@ -2104,13 +2112,16 @@ const appConfig = {
2104
2112
  networkInterface: showcaseRenderer
2105
2113
  },
2106
2114
  billing: {
2107
- networkInterface: exports.apiV2Backend + '/billing'
2115
+ networkInterface: gateway + '/billing'
2108
2116
  },
2109
2117
  core: {
2110
- networkInterface: exports.apiV2Backend + '/core'
2118
+ networkInterface: gateway + '/core'
2111
2119
  },
2112
2120
  bot: {
2113
- networkInterface: exports.apiV2Backend + '/bot'
2121
+ networkInterface: gateway + '/bot'
2122
+ },
2123
+ auth: {
2124
+ networkInterface: gateway + '/auth'
2114
2125
  },
2115
2126
  // sw path
2116
2127
  sw: {
@@ -3853,9 +3864,9 @@ const redirectToLogin = () => {
3853
3864
  };
3854
3865
 
3855
3866
  const {
3856
- networkInterface: uri$4
3867
+ networkInterface: uri$5
3857
3868
  } = appConfig.dconfig;
3858
- const authLink$2 = context.setContext((operation_1, _a) => __awaiter(void 0, [operation_1, _a], void 0, function* (operation, {
3869
+ const authLink$3 = context.setContext((operation_1, _a) => __awaiter(void 0, [operation_1, _a], void 0, function* (operation, {
3859
3870
  headers
3860
3871
  }) {
3861
3872
  const currentUsertoken = yield getUserToken();
@@ -3879,8 +3890,8 @@ const authLink$2 = context.setContext((operation_1, _a) => __awaiter(void 0, [op
3879
3890
  };
3880
3891
  return resultHeaders;
3881
3892
  }));
3882
- const cache$4 = new client.InMemoryCache();
3883
- const errorLink$3 = error.onError(({
3893
+ const cache$5 = new client.InMemoryCache();
3894
+ const errorLink$4 = error.onError(({
3884
3895
  networkError
3885
3896
  }) => {
3886
3897
  if (networkError && networkError.statusCode === 401) {
@@ -3899,10 +3910,10 @@ const errorLink$3 = error.onError(({
3899
3910
  }
3900
3911
  });
3901
3912
  /* eslint-disable no-process-env */
3902
- const isDevEnv$4 = process.env['NODE_ENV'] !== 'production';
3913
+ const isDevEnv$5 = process.env['NODE_ENV'] !== 'production';
3903
3914
  /* eslint-enable no-process-env */
3904
3915
  const link_dconfig = new apolloLinkRest.RestLink({
3905
- uri: uri$4 || 'https://api.bcrumbs.net',
3916
+ uri: uri$5 || 'https://api.bcrumbs.net',
3906
3917
  bodySerializers: {
3907
3918
  fileEncode: (data, headers) => {
3908
3919
  const formData = new FormData();
@@ -3916,9 +3927,9 @@ const link_dconfig = new apolloLinkRest.RestLink({
3916
3927
  }
3917
3928
  });
3918
3929
  const dconfigClient = new client.ApolloClient({
3919
- link: client.from([authLink$2, errorLink$3, link_dconfig]),
3920
- cache: cache$4,
3921
- connectToDevTools: isDevEnv$4,
3930
+ link: client.from([authLink$3, errorLink$4, link_dconfig]),
3931
+ cache: cache$5,
3932
+ connectToDevTools: isDevEnv$5,
3922
3933
  queryDeduplication: true
3923
3934
  });
3924
3935
  const formSerializer = (data, headers) => {
@@ -3936,13 +3947,13 @@ const formSerializer = (data, headers) => {
3936
3947
  };
3937
3948
  };
3938
3949
  const link_dconfig_token = new apolloLinkRest.RestLink({
3939
- uri: uri$4 || 'https://api.bcrumbs.net',
3950
+ uri: uri$5 || 'https://api.bcrumbs.net',
3940
3951
  defaultSerializer: formSerializer
3941
3952
  });
3942
3953
  const tokenClient = new client.ApolloClient({
3943
- link: client.from([link_dconfig_token, errorLink$3]),
3944
- cache: cache$4,
3945
- connectToDevTools: isDevEnv$4
3954
+ link: client.from([link_dconfig_token, errorLink$4]),
3955
+ cache: cache$5,
3956
+ connectToDevTools: isDevEnv$5
3946
3957
  });
3947
3958
 
3948
3959
  let _$8 = t => t,
@@ -4045,23 +4056,23 @@ const useModelChildrenQuery = (parentId, templateId) => client.useQuery(viewType
4045
4056
  });
4046
4057
 
4047
4058
  const {
4048
- networkInterface: uri$3
4059
+ networkInterface: uri$4
4049
4060
  } = appConfig.dquery;
4050
- const cache$3 = new client.InMemoryCache();
4051
- const errorLink$2 = error.onError(handleHandler);
4061
+ const cache$4 = new client.InMemoryCache();
4062
+ const errorLink$3 = error.onError(handleHandler);
4052
4063
  /* eslint-disable no-process-env */
4053
- const isDevEnv$3 = process.env['NODE_ENV'] !== 'production';
4064
+ const isDevEnv$4 = process.env['NODE_ENV'] !== 'production';
4054
4065
  /* eslint-enable no-process-env */
4055
4066
  const link_dquery$1 = client.createHttpLink({
4056
- uri: uri$3,
4067
+ uri: uri$4,
4057
4068
  fetchOptions: {
4058
4069
  mode: 'cors'
4059
4070
  }
4060
4071
  });
4061
4072
  const dqueryClient = new client.ApolloClient({
4062
- link: client.from([errorLink$2, link_dquery$1]),
4063
- cache: cache$3,
4064
- connectToDevTools: isDevEnv$3,
4073
+ link: client.from([errorLink$3, link_dquery$1]),
4074
+ cache: cache$4,
4075
+ connectToDevTools: isDevEnv$4,
4065
4076
  queryDeduplication: true
4066
4077
  });
4067
4078
 
@@ -4072,12 +4083,13 @@ const portalThemeConfig = gql(_t$7 || (_t$7 = _$7`
4072
4083
  configuration(type: "portalTheme", domain: $domain)
4073
4084
  }
4074
4085
  `));
4075
- const usePortalThemeConfig = domain => client.useQuery(portalThemeConfig, {
4086
+ const usePortalThemeConfig = (domain, skip = false) => client.useQuery(portalThemeConfig, {
4076
4087
  fetchPolicy: 'cache-first',
4077
4088
  client: dqueryClient,
4078
4089
  variables: {
4079
4090
  domain
4080
- }
4091
+ },
4092
+ skip
4081
4093
  });
4082
4094
 
4083
4095
  let _$6 = t => t,
@@ -5382,19 +5394,19 @@ const useUpdateContentsOrderingMutation = () => client.useMutation(updateContent
5382
5394
  });
5383
5395
 
5384
5396
  const {
5385
- networkInterface: uri$2
5397
+ networkInterface: uri$3
5386
5398
  } = appConfig.showcase;
5387
- const cache$2 = new client.InMemoryCache();
5399
+ const cache$3 = new client.InMemoryCache();
5388
5400
  /* eslint-disable no-process-env */
5389
- const isDevEnv$2 = process.env['NODE_ENV'] !== 'production';
5401
+ const isDevEnv$3 = process.env['NODE_ENV'] !== 'production';
5390
5402
  /* eslint-enable no-process-env */
5391
5403
  const link$1 = new apolloLinkRest.RestLink({
5392
- uri: uri$2 || "https://api.bcrumbs.net"
5404
+ uri: uri$3 || "https://api.bcrumbs.net"
5393
5405
  });
5394
5406
  const showcaseRendererClient = new client.ApolloClient({
5395
5407
  link: link$1,
5396
- cache: cache$2,
5397
- connectToDevTools: isDevEnv$2,
5408
+ cache: cache$3,
5409
+ connectToDevTools: isDevEnv$3,
5398
5410
  queryDeduplication: true
5399
5411
  });
5400
5412
 
@@ -5467,13 +5479,13 @@ const menuConfigurationQuery = gql(_t2$1 || (_t2$1 = _$1`
5467
5479
  )
5468
5480
  }
5469
5481
  `));
5470
- const useMenuConfigurationQuery = ContextId => client.useQuery(menuConfigurationQuery, {
5482
+ const useMenuConfigurationQuery = (ContextId, skip = false) => client.useQuery(menuConfigurationQuery, {
5471
5483
  fetchPolicy: 'cache-first',
5472
5484
  client: dconfigClient,
5473
5485
  variables: {
5474
5486
  ContextId
5475
5487
  },
5476
- skip: !ContextId
5488
+ skip: !ContextId || skip
5477
5489
  });
5478
5490
  const addDomain = gql(_t3$1 || (_t3$1 = _$1`
5479
5491
  mutation ($rootContent: String!, $body: JSON!) {
@@ -87434,22 +87446,22 @@ const showcaseClient = new client.ApolloClient({
87434
87446
  });
87435
87447
 
87436
87448
  const {
87437
- networkInterface: uri$1
87449
+ networkInterface: uri$2
87438
87450
  } = appConfig.core;
87439
- const authLink$1 = context.setContext(handleAuth);
87440
- const cache$1 = new client.InMemoryCache();
87441
- const errorLink$1 = error.onError(handleHandler);
87451
+ const authLink$2 = context.setContext(handleAuth);
87452
+ const cache$2 = new client.InMemoryCache();
87453
+ const errorLink$2 = error.onError(handleHandler);
87442
87454
  /* eslint-disable no-process-env */
87443
- const isDevEnv$1 = process.env['NODE_ENV'] !== 'production';
87455
+ const isDevEnv$2 = process.env['NODE_ENV'] !== 'production';
87444
87456
  /* eslint-enable no-process-env */
87445
87457
  const httpLink = client.createHttpLink({
87446
- uri: `${uri$1}/gq`,
87458
+ uri: `${uri$2}/gq`,
87447
87459
  fetchOptions: {
87448
87460
  mode: 'cors'
87449
87461
  }
87450
87462
  });
87451
87463
  const batchLink = new batchHttp.BatchHttpLink({
87452
- uri: `${uri$1}/gq`,
87464
+ uri: `${uri$2}/gq`,
87453
87465
  batchMax: 5,
87454
87466
  // Max number of operations in a single batch
87455
87467
  batchInterval: 200,
@@ -87466,7 +87478,29 @@ const splitLink = client.split(({
87466
87478
  return definition.kind === 'OperationDefinition' && definition.operation === 'query';
87467
87479
  }, batchLink, httpLink);
87468
87480
  const coreClient = new client.ApolloClient({
87469
- link: client.from([authLink$1, errorLink$1, splitLink]),
87481
+ link: client.from([authLink$2, errorLink$2, splitLink]),
87482
+ cache: cache$2,
87483
+ connectToDevTools: isDevEnv$2,
87484
+ queryDeduplication: true
87485
+ });
87486
+
87487
+ const {
87488
+ networkInterface: uri$1
87489
+ } = appConfig.bot;
87490
+ const authLink$1 = context.setContext(handleAuth);
87491
+ const cache$1 = new client.InMemoryCache();
87492
+ const errorLink$1 = error.onError(handleHandler);
87493
+ /* eslint-disable no-process-env */
87494
+ const isDevEnv$1 = process.env['NODE_ENV'] !== 'production';
87495
+ /* eslint-enable no-process-env */
87496
+ const link_dquery = client.createHttpLink({
87497
+ uri: `${uri$1}/gq`,
87498
+ fetchOptions: {
87499
+ mode: 'cors'
87500
+ }
87501
+ });
87502
+ const botClient = new client.ApolloClient({
87503
+ link: client.from([authLink$1, errorLink$1, link_dquery]),
87470
87504
  cache: cache$1,
87471
87505
  connectToDevTools: isDevEnv$1,
87472
87506
  queryDeduplication: true
@@ -87474,21 +87508,21 @@ const coreClient = new client.ApolloClient({
87474
87508
 
87475
87509
  const {
87476
87510
  networkInterface: uri
87477
- } = appConfig.bot;
87511
+ } = appConfig.auth;
87478
87512
  const authLink = context.setContext(handleAuth);
87479
87513
  const cache = new client.InMemoryCache();
87480
87514
  const errorLink = error.onError(handleHandler);
87481
87515
  /* eslint-disable no-process-env */
87482
87516
  const isDevEnv = process.env['NODE_ENV'] !== 'production';
87483
87517
  /* eslint-enable no-process-env */
87484
- const link_dquery = client.createHttpLink({
87518
+ const link_auth = client.createHttpLink({
87485
87519
  uri: `${uri}/gq`,
87486
87520
  fetchOptions: {
87487
87521
  mode: 'cors'
87488
87522
  }
87489
87523
  });
87490
- const botClient = new client.ApolloClient({
87491
- link: client.from([authLink, errorLink, link_dquery]),
87524
+ const authClient = new client.ApolloClient({
87525
+ link: client.from([authLink, errorLink, link_auth]),
87492
87526
  cache,
87493
87527
  connectToDevTools: isDevEnv,
87494
87528
  queryDeduplication: true
@@ -87555,6 +87589,7 @@ exports.VALIDATE_COMPANY_NAME = VALIDATE_COMPANY_NAME;
87555
87589
  exports.addDomain = addDomain;
87556
87590
  exports.addDomainOptions = addDomainOptions;
87557
87591
  exports.appConfig = appConfig;
87592
+ exports.authClient = authClient;
87558
87593
  exports.botClient = botClient;
87559
87594
  exports.clearAuthData = clearAuthData;
87560
87595
  exports.companyUsersQuery = companyUsersQuery;
package/index.esm.js CHANGED
@@ -2038,6 +2038,7 @@ function initBackendsLocations() {
2038
2038
  apiBackend = 'https://api.bcrumbs.net';
2039
2039
  apiV2Backend = 'https://apiv2.bcrumbs.net';
2040
2040
  showcaseRenderer = 'https://test-showcase.bcrumbs.net';
2041
+ gateway = 'https://gateway.bcrumbs.net';
2041
2042
  break;
2042
2043
  case 'test':
2043
2044
  dBackend = 'https://query.bcrumbs.net';
@@ -2045,6 +2046,7 @@ function initBackendsLocations() {
2045
2046
  apiBackend = 'https://api.bcrumbs.net';
2046
2047
  apiV2Backend = 'apiv2-dev.bcrumbs.net';
2047
2048
  showcaseRenderer = 'https://test-showcase.bcrumbs.net';
2049
+ gateway = 'https://gateway.bcrumbs.net';
2048
2050
  break;
2049
2051
  case 'local':
2050
2052
  dBackend = 'https://localhost:44322';
@@ -2052,6 +2054,7 @@ function initBackendsLocations() {
2052
2054
  apiBackend = 'http://localhost:6085';
2053
2055
  apiV2Backend = 'https://apiv2-dev.bcrumbs.net';
2054
2056
  showcaseRenderer = 'https://test-showcase.bcrumbs.net';
2057
+ gateway = 'https://gateway.bcrumbs.net';
2055
2058
  break;
2056
2059
  default:
2057
2060
  if (currentUrl && currentUrl.indexOf('localhost') > -1) {
@@ -2060,24 +2063,28 @@ function initBackendsLocations() {
2060
2063
  apiBackend = 'https://api.bcrumbs.net';
2061
2064
  apiV2Backend = 'https://apiv2.bcrumbs.net';
2062
2065
  showcaseRenderer = 'https://test-showcase.bcrumbs.net';
2066
+ gateway = 'https://gateway.bcrumbs.net';
2063
2067
  } else if (currentUrl && currentUrl.indexOf('dconfig.com') > -1) {
2064
2068
  dBackend = 'https://query.bcrumbs.net';
2065
2069
  frontend = 'https://app.bcrumbs.net';
2066
2070
  apiBackend = 'https://api.bcrumbs.net';
2067
2071
  apiV2Backend = 'https://apiv2.bcrumbs.net';
2068
2072
  showcaseRenderer = 'https://test-showcase.bcrumbs.net';
2073
+ gateway = 'https://gateway.bcrumbs.net';
2069
2074
  } else if (currentUrl && currentUrl.indexOf('dev.bcrumbs.net') > -1) {
2070
2075
  dBackend = 'https://query.bcrumbs.net';
2071
2076
  frontend = 'https://dev.bcrumbs.net';
2072
2077
  apiBackend = 'https://api.bcrumbs.net';
2073
2078
  apiV2Backend = 'https://apiv2.bcrumbs.net';
2074
2079
  showcaseRenderer = 'https://test-showcase.bcrumbs.net';
2080
+ gateway = 'https://gateway.bcrumbs.net';
2075
2081
  } else {
2076
2082
  dBackend = 'https://query.bcrumbs.net';
2077
2083
  frontend = 'https://app.bcrumbs.net';
2078
2084
  apiBackend = 'https://api.bcrumbs.net';
2079
2085
  apiV2Backend = 'https://apiv2.bcrumbs.net';
2080
2086
  showcaseRenderer = 'https://test-showcase.bcrumbs.net';
2087
+ gateway = 'https://gateway.bcrumbs.net';
2081
2088
  }
2082
2089
  break;
2083
2090
  }
@@ -2089,6 +2096,7 @@ let dBackend;
2089
2096
  let apiBackend;
2090
2097
  let apiV2Backend;
2091
2098
  let showcaseRenderer;
2099
+ let gateway;
2092
2100
  let api;
2093
2101
  initBackendsLocations();
2094
2102
  const appConfig = {
@@ -2102,13 +2110,16 @@ const appConfig = {
2102
2110
  networkInterface: showcaseRenderer
2103
2111
  },
2104
2112
  billing: {
2105
- networkInterface: apiV2Backend + '/billing'
2113
+ networkInterface: gateway + '/billing'
2106
2114
  },
2107
2115
  core: {
2108
- networkInterface: apiV2Backend + '/core'
2116
+ networkInterface: gateway + '/core'
2109
2117
  },
2110
2118
  bot: {
2111
- networkInterface: apiV2Backend + '/bot'
2119
+ networkInterface: gateway + '/bot'
2120
+ },
2121
+ auth: {
2122
+ networkInterface: gateway + '/auth'
2112
2123
  },
2113
2124
  // sw path
2114
2125
  sw: {
@@ -3851,9 +3862,9 @@ const redirectToLogin = () => {
3851
3862
  };
3852
3863
 
3853
3864
  const {
3854
- networkInterface: uri$4
3865
+ networkInterface: uri$5
3855
3866
  } = appConfig.dconfig;
3856
- 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, {
3857
3868
  headers
3858
3869
  }) {
3859
3870
  const currentUsertoken = yield getUserToken();
@@ -3877,8 +3888,8 @@ const authLink$2 = setContext((operation_1, _a) => __awaiter(void 0, [operation_
3877
3888
  };
3878
3889
  return resultHeaders;
3879
3890
  }));
3880
- const cache$4 = new InMemoryCache();
3881
- const errorLink$3 = onError(({
3891
+ const cache$5 = new InMemoryCache();
3892
+ const errorLink$4 = onError(({
3882
3893
  networkError
3883
3894
  }) => {
3884
3895
  if (networkError && networkError.statusCode === 401) {
@@ -3897,10 +3908,10 @@ const errorLink$3 = onError(({
3897
3908
  }
3898
3909
  });
3899
3910
  /* eslint-disable no-process-env */
3900
- const isDevEnv$4 = process.env['NODE_ENV'] !== 'production';
3911
+ const isDevEnv$5 = process.env['NODE_ENV'] !== 'production';
3901
3912
  /* eslint-enable no-process-env */
3902
3913
  const link_dconfig = new RestLink({
3903
- uri: uri$4 || 'https://api.bcrumbs.net',
3914
+ uri: uri$5 || 'https://api.bcrumbs.net',
3904
3915
  bodySerializers: {
3905
3916
  fileEncode: (data, headers) => {
3906
3917
  const formData = new FormData();
@@ -3914,9 +3925,9 @@ const link_dconfig = new RestLink({
3914
3925
  }
3915
3926
  });
3916
3927
  const dconfigClient = new ApolloClient({
3917
- link: from([authLink$2, errorLink$3, link_dconfig]),
3918
- cache: cache$4,
3919
- connectToDevTools: isDevEnv$4,
3928
+ link: from([authLink$3, errorLink$4, link_dconfig]),
3929
+ cache: cache$5,
3930
+ connectToDevTools: isDevEnv$5,
3920
3931
  queryDeduplication: true
3921
3932
  });
3922
3933
  const formSerializer = (data, headers) => {
@@ -3934,13 +3945,13 @@ const formSerializer = (data, headers) => {
3934
3945
  };
3935
3946
  };
3936
3947
  const link_dconfig_token = new RestLink({
3937
- uri: uri$4 || 'https://api.bcrumbs.net',
3948
+ uri: uri$5 || 'https://api.bcrumbs.net',
3938
3949
  defaultSerializer: formSerializer
3939
3950
  });
3940
3951
  const tokenClient = new ApolloClient({
3941
- link: from([link_dconfig_token, errorLink$3]),
3942
- cache: cache$4,
3943
- connectToDevTools: isDevEnv$4
3952
+ link: from([link_dconfig_token, errorLink$4]),
3953
+ cache: cache$5,
3954
+ connectToDevTools: isDevEnv$5
3944
3955
  });
3945
3956
 
3946
3957
  let _$8 = t => t,
@@ -4043,23 +4054,23 @@ const useModelChildrenQuery = (parentId, templateId) => useQuery(viewTypeChildre
4043
4054
  });
4044
4055
 
4045
4056
  const {
4046
- networkInterface: uri$3
4057
+ networkInterface: uri$4
4047
4058
  } = appConfig.dquery;
4048
- const cache$3 = new InMemoryCache();
4049
- const errorLink$2 = onError(handleHandler);
4059
+ const cache$4 = new InMemoryCache();
4060
+ const errorLink$3 = onError(handleHandler);
4050
4061
  /* eslint-disable no-process-env */
4051
- const isDevEnv$3 = process.env['NODE_ENV'] !== 'production';
4062
+ const isDevEnv$4 = process.env['NODE_ENV'] !== 'production';
4052
4063
  /* eslint-enable no-process-env */
4053
4064
  const link_dquery$1 = createHttpLink({
4054
- uri: uri$3,
4065
+ uri: uri$4,
4055
4066
  fetchOptions: {
4056
4067
  mode: 'cors'
4057
4068
  }
4058
4069
  });
4059
4070
  const dqueryClient = new ApolloClient({
4060
- link: from([errorLink$2, link_dquery$1]),
4061
- cache: cache$3,
4062
- connectToDevTools: isDevEnv$3,
4071
+ link: from([errorLink$3, link_dquery$1]),
4072
+ cache: cache$4,
4073
+ connectToDevTools: isDevEnv$4,
4063
4074
  queryDeduplication: true
4064
4075
  });
4065
4076
 
@@ -4070,12 +4081,13 @@ const portalThemeConfig = gql(_t$7 || (_t$7 = _$7`
4070
4081
  configuration(type: "portalTheme", domain: $domain)
4071
4082
  }
4072
4083
  `));
4073
- const usePortalThemeConfig = domain => useQuery(portalThemeConfig, {
4084
+ const usePortalThemeConfig = (domain, skip = false) => useQuery(portalThemeConfig, {
4074
4085
  fetchPolicy: 'cache-first',
4075
4086
  client: dqueryClient,
4076
4087
  variables: {
4077
4088
  domain
4078
- }
4089
+ },
4090
+ skip
4079
4091
  });
4080
4092
 
4081
4093
  let _$6 = t => t,
@@ -5380,19 +5392,19 @@ const useUpdateContentsOrderingMutation = () => useMutation(updateContentsOrderi
5380
5392
  });
5381
5393
 
5382
5394
  const {
5383
- networkInterface: uri$2
5395
+ networkInterface: uri$3
5384
5396
  } = appConfig.showcase;
5385
- const cache$2 = new InMemoryCache();
5397
+ const cache$3 = new InMemoryCache();
5386
5398
  /* eslint-disable no-process-env */
5387
- const isDevEnv$2 = process.env['NODE_ENV'] !== 'production';
5399
+ const isDevEnv$3 = process.env['NODE_ENV'] !== 'production';
5388
5400
  /* eslint-enable no-process-env */
5389
5401
  const link$1 = new RestLink({
5390
- uri: uri$2 || "https://api.bcrumbs.net"
5402
+ uri: uri$3 || "https://api.bcrumbs.net"
5391
5403
  });
5392
5404
  const showcaseRendererClient = new ApolloClient({
5393
5405
  link: link$1,
5394
- cache: cache$2,
5395
- connectToDevTools: isDevEnv$2,
5406
+ cache: cache$3,
5407
+ connectToDevTools: isDevEnv$3,
5396
5408
  queryDeduplication: true
5397
5409
  });
5398
5410
 
@@ -5465,13 +5477,13 @@ const menuConfigurationQuery = gql(_t2$1 || (_t2$1 = _$1`
5465
5477
  )
5466
5478
  }
5467
5479
  `));
5468
- const useMenuConfigurationQuery = ContextId => useQuery(menuConfigurationQuery, {
5480
+ const useMenuConfigurationQuery = (ContextId, skip = false) => useQuery(menuConfigurationQuery, {
5469
5481
  fetchPolicy: 'cache-first',
5470
5482
  client: dconfigClient,
5471
5483
  variables: {
5472
5484
  ContextId
5473
5485
  },
5474
- skip: !ContextId
5486
+ skip: !ContextId || skip
5475
5487
  });
5476
5488
  const addDomain = gql(_t3$1 || (_t3$1 = _$1`
5477
5489
  mutation ($rootContent: String!, $body: JSON!) {
@@ -87432,22 +87444,22 @@ const showcaseClient = new ApolloClient({
87432
87444
  });
87433
87445
 
87434
87446
  const {
87435
- networkInterface: uri$1
87447
+ networkInterface: uri$2
87436
87448
  } = appConfig.core;
87437
- const authLink$1 = setContext(handleAuth);
87438
- const cache$1 = new InMemoryCache();
87439
- const errorLink$1 = onError(handleHandler);
87449
+ const authLink$2 = setContext(handleAuth);
87450
+ const cache$2 = new InMemoryCache();
87451
+ const errorLink$2 = onError(handleHandler);
87440
87452
  /* eslint-disable no-process-env */
87441
- const isDevEnv$1 = process.env['NODE_ENV'] !== 'production';
87453
+ const isDevEnv$2 = process.env['NODE_ENV'] !== 'production';
87442
87454
  /* eslint-enable no-process-env */
87443
87455
  const httpLink = createHttpLink({
87444
- uri: `${uri$1}/gq`,
87456
+ uri: `${uri$2}/gq`,
87445
87457
  fetchOptions: {
87446
87458
  mode: 'cors'
87447
87459
  }
87448
87460
  });
87449
87461
  const batchLink = new BatchHttpLink({
87450
- uri: `${uri$1}/gq`,
87462
+ uri: `${uri$2}/gq`,
87451
87463
  batchMax: 5,
87452
87464
  // Max number of operations in a single batch
87453
87465
  batchInterval: 200,
@@ -87464,7 +87476,29 @@ const splitLink = split$1(({
87464
87476
  return definition.kind === 'OperationDefinition' && definition.operation === 'query';
87465
87477
  }, batchLink, httpLink);
87466
87478
  const coreClient = new ApolloClient({
87467
- link: from([authLink$1, errorLink$1, splitLink]),
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;
87488
+ const authLink$1 = setContext(handleAuth);
87489
+ const cache$1 = new InMemoryCache();
87490
+ const errorLink$1 = onError(handleHandler);
87491
+ /* eslint-disable no-process-env */
87492
+ const isDevEnv$1 = process.env['NODE_ENV'] !== 'production';
87493
+ /* eslint-enable no-process-env */
87494
+ const link_dquery = createHttpLink({
87495
+ uri: `${uri$1}/gq`,
87496
+ fetchOptions: {
87497
+ mode: 'cors'
87498
+ }
87499
+ });
87500
+ const botClient = new ApolloClient({
87501
+ link: from([authLink$1, errorLink$1, link_dquery]),
87468
87502
  cache: cache$1,
87469
87503
  connectToDevTools: isDevEnv$1,
87470
87504
  queryDeduplication: true
@@ -87472,21 +87506,21 @@ const coreClient = new ApolloClient({
87472
87506
 
87473
87507
  const {
87474
87508
  networkInterface: uri
87475
- } = appConfig.bot;
87509
+ } = appConfig.auth;
87476
87510
  const authLink = setContext(handleAuth);
87477
87511
  const cache = new InMemoryCache();
87478
87512
  const errorLink = onError(handleHandler);
87479
87513
  /* eslint-disable no-process-env */
87480
87514
  const isDevEnv = process.env['NODE_ENV'] !== 'production';
87481
87515
  /* eslint-enable no-process-env */
87482
- const link_dquery = createHttpLink({
87516
+ const link_auth = createHttpLink({
87483
87517
  uri: `${uri}/gq`,
87484
87518
  fetchOptions: {
87485
87519
  mode: 'cors'
87486
87520
  }
87487
87521
  });
87488
- const botClient = new ApolloClient({
87489
- link: from([authLink, errorLink, link_dquery]),
87522
+ const authClient = new ApolloClient({
87523
+ link: from([authLink, errorLink, link_auth]),
87490
87524
  cache,
87491
87525
  connectToDevTools: isDevEnv,
87492
87526
  queryDeduplication: true
@@ -87546,4 +87580,4 @@ var ModelFieldsTypes;
87546
87580
  ModelFieldsTypes["JSON"] = "JSON";
87547
87581
  })(ModelFieldsTypes || (ModelFieldsTypes = {}));
87548
87582
 
87549
- export { CreateCheckoutSessionUri, CreatePortalSessionUri, ModelFieldsTypes, ModelUtilities, VALIDATE_COMPANY_NAME, addDomain, addDomainOptions, apiBackend, apiV2Backend, appConfig, 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 };
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 };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@bcrumbs.net/bc-api",
3
3
  "description": "The SDK that helps to work with Bread Crumbs APIs",
4
- "version": "0.0.43",
4
+ "version": "0.0.44",
5
5
  "keyword": [
6
6
  "bcrumbs",
7
7
  "bc-api",
package/src/index.d.ts CHANGED
@@ -13,6 +13,7 @@ export * from './lib/clients/dqueryClient';
13
13
  export * from './lib/clients/showcaseClient';
14
14
  export * from './lib/clients/coreClient';
15
15
  export * from './lib/clients/botClient';
16
+ export * from './lib/clients/authClient';
16
17
  export * from './lib/models/contentInstance';
17
18
  export * from './lib/models/model';
18
19
  export * from './lib/models/file';
@@ -0,0 +1,2 @@
1
+ import { ApolloClient } from '@apollo/client';
2
+ export declare const authClient: ApolloClient<import("@apollo/client").NormalizedCacheObject>;
@@ -20,6 +20,9 @@ export declare const appConfig: {
20
20
  bot: {
21
21
  networkInterface: string;
22
22
  };
23
+ auth: {
24
+ networkInterface: string;
25
+ };
23
26
  sw: {
24
27
  path: string;
25
28
  };
@@ -1,2 +1,2 @@
1
1
  export declare const portalThemeConfig: import("@apollo/client").DocumentNode;
2
- export declare const usePortalThemeConfig: (domain: string) => import("@apollo/client").QueryResult<any, import("@apollo/client").OperationVariables>;
2
+ export declare const usePortalThemeConfig: (domain: string, skip?: boolean) => import("@apollo/client").QueryResult<any, import("@apollo/client").OperationVariables>;
@@ -3,7 +3,7 @@ export declare const showcaseConfigurationQuery: import("@apollo/client").Docume
3
3
  export declare const useShowcaseConfigurationQuery: (ContextId: number) => import("@apollo/client").QueryResult<any, import("@apollo/client").OperationVariables>;
4
4
  export declare const showcaseConfigurationQueryOptions: any;
5
5
  export declare const menuConfigurationQuery: import("@apollo/client").DocumentNode;
6
- export declare const useMenuConfigurationQuery: (ContextId?: number) => import("@apollo/client").QueryResult<any, import("@apollo/client").OperationVariables>;
6
+ export declare const useMenuConfigurationQuery: (ContextId?: number, skip?: boolean) => import("@apollo/client").QueryResult<any, import("@apollo/client").OperationVariables>;
7
7
  export declare const addDomain: import("@apollo/client").DocumentNode;
8
8
  export declare const addDomainOptions: any;
9
9
  export declare const removeDomain: import("@apollo/client").DocumentNode;