@bcrumbs.net/bc-api 0.0.44 → 0.0.46

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
@@ -2128,6 +2128,28 @@ const appConfig = {
2128
2128
  path: 'assets/sw.js'
2129
2129
  }
2130
2130
  };
2131
+ /**
2132
+ * Gets the partner name from build-time configuration
2133
+ * The partner can be set via:
2134
+ * - window.__PARTNER__ (set at build time via webpack DefinePlugin or script tag)
2135
+ * - window._env_.PARTNER (if using env.sh script)
2136
+ * @returns Partner name if configured, undefined otherwise
2137
+ */
2138
+ function getPartner() {
2139
+ var _a;
2140
+ if (typeof window === 'undefined') {
2141
+ return undefined;
2142
+ }
2143
+ // Check window.__PARTNER__ first (can be set via webpack DefinePlugin)
2144
+ if (window.__PARTNER__) {
2145
+ return window.__PARTNER__;
2146
+ }
2147
+ // Check window._env_.PARTNER (if using env.sh script)
2148
+ if ((_a = window._env_) === null || _a === void 0 ? void 0 : _a.PARTNER) {
2149
+ return window._env_.PARTNER;
2150
+ }
2151
+ return undefined;
2152
+ }
2131
2153
 
2132
2154
  var wellKnownSymbol$b = wellKnownSymbol$h;
2133
2155
  var create$1 = objectCreate;
@@ -3807,23 +3829,29 @@ const getErrorHandler = () => currentErrorHandler;
3807
3829
  const handleHandler = (...args) => {
3808
3830
  return currentErrorHandler(...args);
3809
3831
  };
3832
+ // Get partner from build-time configuration
3810
3833
  const handleAuth = (operation_1, _a) => __awaiter(void 0, [operation_1, _a], void 0, function* (operation, {
3811
3834
  headers
3812
3835
  }) {
3813
3836
  const currentUsertoken = yield getUserToken();
3814
3837
  const isAPIKey = (currentUsertoken === null || currentUsertoken === void 0 ? void 0 : currentUsertoken.length) === 36;
3838
+ const partner = getPartner();
3815
3839
  if (headers === undefined) {
3816
3840
  headers = {};
3817
3841
  }
3842
+ const baseHeaders = Object.assign(Object.assign({}, headers), {
3843
+ Accept: 'application/json'
3844
+ });
3845
+ // Add partner header if domain matches a partner
3846
+ if (partner) {
3847
+ baseHeaders['partner'] = partner;
3848
+ }
3818
3849
  const resultHeaders = currentUsertoken ? {
3819
- headers: Object.assign(Object.assign({}, headers), {
3820
- Accept: 'application/json',
3850
+ headers: Object.assign(Object.assign({}, baseHeaders), {
3821
3851
  Authorization: isAPIKey ? currentUsertoken : `Bearer ${currentUsertoken}`
3822
3852
  })
3823
3853
  } : {
3824
- headers: Object.assign(Object.assign({}, headers), {
3825
- Accept: 'application/json'
3826
- })
3854
+ headers: baseHeaders
3827
3855
  };
3828
3856
  return resultHeaders;
3829
3857
  });
@@ -3864,9 +3892,9 @@ const redirectToLogin = () => {
3864
3892
  };
3865
3893
 
3866
3894
  const {
3867
- networkInterface: uri$5
3895
+ networkInterface: uri$6
3868
3896
  } = appConfig.dconfig;
3869
- const authLink$3 = context.setContext((operation_1, _a) => __awaiter(void 0, [operation_1, _a], void 0, function* (operation, {
3897
+ const authLink$4 = context.setContext((operation_1, _a) => __awaiter(void 0, [operation_1, _a], void 0, function* (operation, {
3870
3898
  headers
3871
3899
  }) {
3872
3900
  const currentUsertoken = yield getUserToken();
@@ -3890,8 +3918,8 @@ const authLink$3 = context.setContext((operation_1, _a) => __awaiter(void 0, [op
3890
3918
  };
3891
3919
  return resultHeaders;
3892
3920
  }));
3893
- const cache$5 = new client.InMemoryCache();
3894
- const errorLink$4 = error.onError(({
3921
+ const cache$6 = new client.InMemoryCache();
3922
+ const errorLink$5 = error.onError(({
3895
3923
  networkError
3896
3924
  }) => {
3897
3925
  if (networkError && networkError.statusCode === 401) {
@@ -3910,10 +3938,10 @@ const errorLink$4 = error.onError(({
3910
3938
  }
3911
3939
  });
3912
3940
  /* eslint-disable no-process-env */
3913
- const isDevEnv$5 = process.env['NODE_ENV'] !== 'production';
3941
+ const isDevEnv$6 = process.env['NODE_ENV'] !== 'production';
3914
3942
  /* eslint-enable no-process-env */
3915
3943
  const link_dconfig = new apolloLinkRest.RestLink({
3916
- uri: uri$5 || 'https://api.bcrumbs.net',
3944
+ uri: uri$6 || 'https://api.bcrumbs.net',
3917
3945
  bodySerializers: {
3918
3946
  fileEncode: (data, headers) => {
3919
3947
  const formData = new FormData();
@@ -3927,9 +3955,9 @@ const link_dconfig = new apolloLinkRest.RestLink({
3927
3955
  }
3928
3956
  });
3929
3957
  const dconfigClient = new client.ApolloClient({
3930
- link: client.from([authLink$3, errorLink$4, link_dconfig]),
3931
- cache: cache$5,
3932
- connectToDevTools: isDevEnv$5,
3958
+ link: client.from([authLink$4, errorLink$5, link_dconfig]),
3959
+ cache: cache$6,
3960
+ connectToDevTools: isDevEnv$6,
3933
3961
  queryDeduplication: true
3934
3962
  });
3935
3963
  const formSerializer = (data, headers) => {
@@ -3947,13 +3975,13 @@ const formSerializer = (data, headers) => {
3947
3975
  };
3948
3976
  };
3949
3977
  const link_dconfig_token = new apolloLinkRest.RestLink({
3950
- uri: uri$5 || 'https://api.bcrumbs.net',
3978
+ uri: uri$6 || 'https://api.bcrumbs.net',
3951
3979
  defaultSerializer: formSerializer
3952
3980
  });
3953
3981
  const tokenClient = new client.ApolloClient({
3954
- link: client.from([link_dconfig_token, errorLink$4]),
3955
- cache: cache$5,
3956
- connectToDevTools: isDevEnv$5
3982
+ link: client.from([link_dconfig_token, errorLink$5]),
3983
+ cache: cache$6,
3984
+ connectToDevTools: isDevEnv$6
3957
3985
  });
3958
3986
 
3959
3987
  let _$8 = t => t,
@@ -4056,23 +4084,23 @@ const useModelChildrenQuery = (parentId, templateId) => client.useQuery(viewType
4056
4084
  });
4057
4085
 
4058
4086
  const {
4059
- networkInterface: uri$4
4087
+ networkInterface: uri$5
4060
4088
  } = appConfig.dquery;
4061
- const cache$4 = new client.InMemoryCache();
4062
- const errorLink$3 = error.onError(handleHandler);
4089
+ const cache$5 = new client.InMemoryCache();
4090
+ const errorLink$4 = error.onError(handleHandler);
4063
4091
  /* eslint-disable no-process-env */
4064
- const isDevEnv$4 = process.env['NODE_ENV'] !== 'production';
4092
+ const isDevEnv$5 = process.env['NODE_ENV'] !== 'production';
4065
4093
  /* eslint-enable no-process-env */
4066
4094
  const link_dquery$1 = client.createHttpLink({
4067
- uri: uri$4,
4095
+ uri: uri$5,
4068
4096
  fetchOptions: {
4069
4097
  mode: 'cors'
4070
4098
  }
4071
4099
  });
4072
4100
  const dqueryClient = new client.ApolloClient({
4073
- link: client.from([errorLink$3, link_dquery$1]),
4074
- cache: cache$4,
4075
- connectToDevTools: isDevEnv$4,
4101
+ link: client.from([errorLink$4, link_dquery$1]),
4102
+ cache: cache$5,
4103
+ connectToDevTools: isDevEnv$5,
4076
4104
  queryDeduplication: true
4077
4105
  });
4078
4106
 
@@ -5394,19 +5422,19 @@ const useUpdateContentsOrderingMutation = () => client.useMutation(updateContent
5394
5422
  });
5395
5423
 
5396
5424
  const {
5397
- networkInterface: uri$3
5425
+ networkInterface: uri$4
5398
5426
  } = appConfig.showcase;
5399
- const cache$3 = new client.InMemoryCache();
5427
+ const cache$4 = new client.InMemoryCache();
5400
5428
  /* eslint-disable no-process-env */
5401
- const isDevEnv$3 = process.env['NODE_ENV'] !== 'production';
5429
+ const isDevEnv$4 = process.env['NODE_ENV'] !== 'production';
5402
5430
  /* eslint-enable no-process-env */
5403
5431
  const link$1 = new apolloLinkRest.RestLink({
5404
- uri: uri$3 || "https://api.bcrumbs.net"
5432
+ uri: uri$4 || "https://api.bcrumbs.net"
5405
5433
  });
5406
5434
  const showcaseRendererClient = new client.ApolloClient({
5407
5435
  link: link$1,
5408
- cache: cache$3,
5409
- connectToDevTools: isDevEnv$3,
5436
+ cache: cache$4,
5437
+ connectToDevTools: isDevEnv$4,
5410
5438
  queryDeduplication: true
5411
5439
  });
5412
5440
 
@@ -87446,22 +87474,22 @@ const showcaseClient = new client.ApolloClient({
87446
87474
  });
87447
87475
 
87448
87476
  const {
87449
- networkInterface: uri$2
87477
+ networkInterface: uri$3
87450
87478
  } = appConfig.core;
87451
- const authLink$2 = context.setContext(handleAuth);
87452
- const cache$2 = new client.InMemoryCache();
87453
- const errorLink$2 = error.onError(handleHandler);
87479
+ const authLink$3 = context.setContext(handleAuth);
87480
+ const cache$3 = new client.InMemoryCache();
87481
+ const errorLink$3 = error.onError(handleHandler);
87454
87482
  /* eslint-disable no-process-env */
87455
- const isDevEnv$2 = process.env['NODE_ENV'] !== 'production';
87483
+ const isDevEnv$3 = process.env['NODE_ENV'] !== 'production';
87456
87484
  /* eslint-enable no-process-env */
87457
- const httpLink = client.createHttpLink({
87458
- uri: `${uri$2}/gq`,
87485
+ const httpLink$1 = client.createHttpLink({
87486
+ uri: `${uri$3}/gq`,
87459
87487
  fetchOptions: {
87460
87488
  mode: 'cors'
87461
87489
  }
87462
87490
  });
87463
- const batchLink = new batchHttp.BatchHttpLink({
87464
- uri: `${uri$2}/gq`,
87491
+ const batchLink$1 = new batchHttp.BatchHttpLink({
87492
+ uri: `${uri$3}/gq`,
87465
87493
  batchMax: 5,
87466
87494
  // Max number of operations in a single batch
87467
87495
  batchInterval: 200,
@@ -87471,14 +87499,36 @@ const batchLink = new batchHttp.BatchHttpLink({
87471
87499
  }
87472
87500
  });
87473
87501
  // use batch link for queries and http link for mutations
87474
- const splitLink = client.split(({
87502
+ const splitLink$1 = client.split(({
87475
87503
  query
87476
87504
  }) => {
87477
87505
  const definition = utilities.getMainDefinition(query);
87478
87506
  return definition.kind === 'OperationDefinition' && definition.operation === 'query';
87479
- }, batchLink, httpLink);
87507
+ }, batchLink$1, httpLink$1);
87480
87508
  const coreClient = new client.ApolloClient({
87481
- link: client.from([authLink$2, errorLink$2, splitLink]),
87509
+ link: client.from([authLink$3, errorLink$3, splitLink$1]),
87510
+ cache: cache$3,
87511
+ connectToDevTools: isDevEnv$3,
87512
+ queryDeduplication: true
87513
+ });
87514
+
87515
+ const {
87516
+ networkInterface: uri$2
87517
+ } = appConfig.bot;
87518
+ const authLink$2 = context.setContext(handleAuth);
87519
+ const cache$2 = new client.InMemoryCache();
87520
+ const errorLink$2 = error.onError(handleHandler);
87521
+ /* eslint-disable no-process-env */
87522
+ const isDevEnv$2 = process.env['NODE_ENV'] !== 'production';
87523
+ /* eslint-enable no-process-env */
87524
+ const link_dquery = client.createHttpLink({
87525
+ uri: `${uri$2}/gq`,
87526
+ fetchOptions: {
87527
+ mode: 'cors'
87528
+ }
87529
+ });
87530
+ const botClient = new client.ApolloClient({
87531
+ link: client.from([authLink$2, errorLink$2, link_dquery]),
87482
87532
  cache: cache$2,
87483
87533
  connectToDevTools: isDevEnv$2,
87484
87534
  queryDeduplication: true
@@ -87486,21 +87536,21 @@ const coreClient = new client.ApolloClient({
87486
87536
 
87487
87537
  const {
87488
87538
  networkInterface: uri$1
87489
- } = appConfig.bot;
87539
+ } = appConfig.auth;
87490
87540
  const authLink$1 = context.setContext(handleAuth);
87491
87541
  const cache$1 = new client.InMemoryCache();
87492
87542
  const errorLink$1 = error.onError(handleHandler);
87493
87543
  /* eslint-disable no-process-env */
87494
87544
  const isDevEnv$1 = process.env['NODE_ENV'] !== 'production';
87495
87545
  /* eslint-enable no-process-env */
87496
- const link_dquery = client.createHttpLink({
87546
+ const link_auth = client.createHttpLink({
87497
87547
  uri: `${uri$1}/gq`,
87498
87548
  fetchOptions: {
87499
87549
  mode: 'cors'
87500
87550
  }
87501
87551
  });
87502
- const botClient = new client.ApolloClient({
87503
- link: client.from([authLink$1, errorLink$1, link_dquery]),
87552
+ const authClient = new client.ApolloClient({
87553
+ link: client.from([authLink$1, errorLink$1, link_auth]),
87504
87554
  cache: cache$1,
87505
87555
  connectToDevTools: isDevEnv$1,
87506
87556
  queryDeduplication: true
@@ -87508,21 +87558,35 @@ const botClient = new client.ApolloClient({
87508
87558
 
87509
87559
  const {
87510
87560
  networkInterface: uri
87511
- } = appConfig.auth;
87561
+ } = appConfig.billing;
87512
87562
  const authLink = context.setContext(handleAuth);
87513
87563
  const cache = new client.InMemoryCache();
87514
87564
  const errorLink = error.onError(handleHandler);
87515
87565
  /* eslint-disable no-process-env */
87516
87566
  const isDevEnv = process.env['NODE_ENV'] !== 'production';
87517
87567
  /* eslint-enable no-process-env */
87518
- const link_auth = client.createHttpLink({
87568
+ const httpLink = client.createHttpLink({
87519
87569
  uri: `${uri}/gq`,
87520
87570
  fetchOptions: {
87521
87571
  mode: 'cors'
87522
87572
  }
87523
87573
  });
87524
- const authClient = new client.ApolloClient({
87525
- link: client.from([authLink, errorLink, link_auth]),
87574
+ const batchLink = new batchHttp.BatchHttpLink({
87575
+ uri: `${uri}/gq`,
87576
+ batchMax: 5,
87577
+ batchInterval: 200,
87578
+ fetchOptions: {
87579
+ mode: 'cors'
87580
+ }
87581
+ });
87582
+ const splitLink = client.split(({
87583
+ query
87584
+ }) => {
87585
+ const definition = utilities.getMainDefinition(query);
87586
+ return definition.kind === 'OperationDefinition' && definition.operation === 'query';
87587
+ }, batchLink, httpLink);
87588
+ const billingClient = new client.ApolloClient({
87589
+ link: client.from([authLink, errorLink, splitLink]),
87526
87590
  cache,
87527
87591
  connectToDevTools: isDevEnv,
87528
87592
  queryDeduplication: true
@@ -87590,6 +87654,7 @@ exports.addDomain = addDomain;
87590
87654
  exports.addDomainOptions = addDomainOptions;
87591
87655
  exports.appConfig = appConfig;
87592
87656
  exports.authClient = authClient;
87657
+ exports.billingClient = billingClient;
87593
87658
  exports.botClient = botClient;
87594
87659
  exports.clearAuthData = clearAuthData;
87595
87660
  exports.companyUsersQuery = companyUsersQuery;
@@ -87611,6 +87676,7 @@ exports.foldersTreeQuery = foldersTreeQuery;
87611
87676
  exports.forgetPassword = forgetPassword;
87612
87677
  exports.forgetPasswordOptions = forgetPasswordOptions;
87613
87678
  exports.getErrorHandler = getErrorHandler;
87679
+ exports.getPartner = getPartner;
87614
87680
  exports.getUserContext = getUserContext;
87615
87681
  exports.getUserToken = getUserToken;
87616
87682
  exports.handleAuth = handleAuth;
package/index.esm.js CHANGED
@@ -2126,6 +2126,28 @@ const appConfig = {
2126
2126
  path: 'assets/sw.js'
2127
2127
  }
2128
2128
  };
2129
+ /**
2130
+ * Gets the partner name from build-time configuration
2131
+ * The partner can be set via:
2132
+ * - window.__PARTNER__ (set at build time via webpack DefinePlugin or script tag)
2133
+ * - window._env_.PARTNER (if using env.sh script)
2134
+ * @returns Partner name if configured, undefined otherwise
2135
+ */
2136
+ function getPartner() {
2137
+ var _a;
2138
+ if (typeof window === 'undefined') {
2139
+ return undefined;
2140
+ }
2141
+ // Check window.__PARTNER__ first (can be set via webpack DefinePlugin)
2142
+ if (window.__PARTNER__) {
2143
+ return window.__PARTNER__;
2144
+ }
2145
+ // Check window._env_.PARTNER (if using env.sh script)
2146
+ if ((_a = window._env_) === null || _a === void 0 ? void 0 : _a.PARTNER) {
2147
+ return window._env_.PARTNER;
2148
+ }
2149
+ return undefined;
2150
+ }
2129
2151
 
2130
2152
  var wellKnownSymbol$b = wellKnownSymbol$h;
2131
2153
  var create$1 = objectCreate;
@@ -3805,23 +3827,29 @@ const getErrorHandler = () => currentErrorHandler;
3805
3827
  const handleHandler = (...args) => {
3806
3828
  return currentErrorHandler(...args);
3807
3829
  };
3830
+ // Get partner from build-time configuration
3808
3831
  const handleAuth = (operation_1, _a) => __awaiter(void 0, [operation_1, _a], void 0, function* (operation, {
3809
3832
  headers
3810
3833
  }) {
3811
3834
  const currentUsertoken = yield getUserToken();
3812
3835
  const isAPIKey = (currentUsertoken === null || currentUsertoken === void 0 ? void 0 : currentUsertoken.length) === 36;
3836
+ const partner = getPartner();
3813
3837
  if (headers === undefined) {
3814
3838
  headers = {};
3815
3839
  }
3840
+ const baseHeaders = Object.assign(Object.assign({}, headers), {
3841
+ Accept: 'application/json'
3842
+ });
3843
+ // Add partner header if domain matches a partner
3844
+ if (partner) {
3845
+ baseHeaders['partner'] = partner;
3846
+ }
3816
3847
  const resultHeaders = currentUsertoken ? {
3817
- headers: Object.assign(Object.assign({}, headers), {
3818
- Accept: 'application/json',
3848
+ headers: Object.assign(Object.assign({}, baseHeaders), {
3819
3849
  Authorization: isAPIKey ? currentUsertoken : `Bearer ${currentUsertoken}`
3820
3850
  })
3821
3851
  } : {
3822
- headers: Object.assign(Object.assign({}, headers), {
3823
- Accept: 'application/json'
3824
- })
3852
+ headers: baseHeaders
3825
3853
  };
3826
3854
  return resultHeaders;
3827
3855
  });
@@ -3862,9 +3890,9 @@ const redirectToLogin = () => {
3862
3890
  };
3863
3891
 
3864
3892
  const {
3865
- networkInterface: uri$5
3893
+ networkInterface: uri$6
3866
3894
  } = appConfig.dconfig;
3867
- const authLink$3 = setContext((operation_1, _a) => __awaiter(void 0, [operation_1, _a], void 0, function* (operation, {
3895
+ const authLink$4 = setContext((operation_1, _a) => __awaiter(void 0, [operation_1, _a], void 0, function* (operation, {
3868
3896
  headers
3869
3897
  }) {
3870
3898
  const currentUsertoken = yield getUserToken();
@@ -3888,8 +3916,8 @@ const authLink$3 = setContext((operation_1, _a) => __awaiter(void 0, [operation_
3888
3916
  };
3889
3917
  return resultHeaders;
3890
3918
  }));
3891
- const cache$5 = new InMemoryCache();
3892
- const errorLink$4 = onError(({
3919
+ const cache$6 = new InMemoryCache();
3920
+ const errorLink$5 = onError(({
3893
3921
  networkError
3894
3922
  }) => {
3895
3923
  if (networkError && networkError.statusCode === 401) {
@@ -3908,10 +3936,10 @@ const errorLink$4 = onError(({
3908
3936
  }
3909
3937
  });
3910
3938
  /* eslint-disable no-process-env */
3911
- const isDevEnv$5 = process.env['NODE_ENV'] !== 'production';
3939
+ const isDevEnv$6 = process.env['NODE_ENV'] !== 'production';
3912
3940
  /* eslint-enable no-process-env */
3913
3941
  const link_dconfig = new RestLink({
3914
- uri: uri$5 || 'https://api.bcrumbs.net',
3942
+ uri: uri$6 || 'https://api.bcrumbs.net',
3915
3943
  bodySerializers: {
3916
3944
  fileEncode: (data, headers) => {
3917
3945
  const formData = new FormData();
@@ -3925,9 +3953,9 @@ const link_dconfig = new RestLink({
3925
3953
  }
3926
3954
  });
3927
3955
  const dconfigClient = new ApolloClient({
3928
- link: from([authLink$3, errorLink$4, link_dconfig]),
3929
- cache: cache$5,
3930
- connectToDevTools: isDevEnv$5,
3956
+ link: from([authLink$4, errorLink$5, link_dconfig]),
3957
+ cache: cache$6,
3958
+ connectToDevTools: isDevEnv$6,
3931
3959
  queryDeduplication: true
3932
3960
  });
3933
3961
  const formSerializer = (data, headers) => {
@@ -3945,13 +3973,13 @@ const formSerializer = (data, headers) => {
3945
3973
  };
3946
3974
  };
3947
3975
  const link_dconfig_token = new RestLink({
3948
- uri: uri$5 || 'https://api.bcrumbs.net',
3976
+ uri: uri$6 || 'https://api.bcrumbs.net',
3949
3977
  defaultSerializer: formSerializer
3950
3978
  });
3951
3979
  const tokenClient = new ApolloClient({
3952
- link: from([link_dconfig_token, errorLink$4]),
3953
- cache: cache$5,
3954
- connectToDevTools: isDevEnv$5
3980
+ link: from([link_dconfig_token, errorLink$5]),
3981
+ cache: cache$6,
3982
+ connectToDevTools: isDevEnv$6
3955
3983
  });
3956
3984
 
3957
3985
  let _$8 = t => t,
@@ -4054,23 +4082,23 @@ const useModelChildrenQuery = (parentId, templateId) => useQuery(viewTypeChildre
4054
4082
  });
4055
4083
 
4056
4084
  const {
4057
- networkInterface: uri$4
4085
+ networkInterface: uri$5
4058
4086
  } = appConfig.dquery;
4059
- const cache$4 = new InMemoryCache();
4060
- const errorLink$3 = onError(handleHandler);
4087
+ const cache$5 = new InMemoryCache();
4088
+ const errorLink$4 = onError(handleHandler);
4061
4089
  /* eslint-disable no-process-env */
4062
- const isDevEnv$4 = process.env['NODE_ENV'] !== 'production';
4090
+ const isDevEnv$5 = process.env['NODE_ENV'] !== 'production';
4063
4091
  /* eslint-enable no-process-env */
4064
4092
  const link_dquery$1 = createHttpLink({
4065
- uri: uri$4,
4093
+ uri: uri$5,
4066
4094
  fetchOptions: {
4067
4095
  mode: 'cors'
4068
4096
  }
4069
4097
  });
4070
4098
  const dqueryClient = new ApolloClient({
4071
- link: from([errorLink$3, link_dquery$1]),
4072
- cache: cache$4,
4073
- connectToDevTools: isDevEnv$4,
4099
+ link: from([errorLink$4, link_dquery$1]),
4100
+ cache: cache$5,
4101
+ connectToDevTools: isDevEnv$5,
4074
4102
  queryDeduplication: true
4075
4103
  });
4076
4104
 
@@ -5392,19 +5420,19 @@ const useUpdateContentsOrderingMutation = () => useMutation(updateContentsOrderi
5392
5420
  });
5393
5421
 
5394
5422
  const {
5395
- networkInterface: uri$3
5423
+ networkInterface: uri$4
5396
5424
  } = appConfig.showcase;
5397
- const cache$3 = new InMemoryCache();
5425
+ const cache$4 = new InMemoryCache();
5398
5426
  /* eslint-disable no-process-env */
5399
- const isDevEnv$3 = process.env['NODE_ENV'] !== 'production';
5427
+ const isDevEnv$4 = process.env['NODE_ENV'] !== 'production';
5400
5428
  /* eslint-enable no-process-env */
5401
5429
  const link$1 = new RestLink({
5402
- uri: uri$3 || "https://api.bcrumbs.net"
5430
+ uri: uri$4 || "https://api.bcrumbs.net"
5403
5431
  });
5404
5432
  const showcaseRendererClient = new ApolloClient({
5405
5433
  link: link$1,
5406
- cache: cache$3,
5407
- connectToDevTools: isDevEnv$3,
5434
+ cache: cache$4,
5435
+ connectToDevTools: isDevEnv$4,
5408
5436
  queryDeduplication: true
5409
5437
  });
5410
5438
 
@@ -87444,22 +87472,22 @@ const showcaseClient = new ApolloClient({
87444
87472
  });
87445
87473
 
87446
87474
  const {
87447
- networkInterface: uri$2
87475
+ networkInterface: uri$3
87448
87476
  } = appConfig.core;
87449
- const authLink$2 = setContext(handleAuth);
87450
- const cache$2 = new InMemoryCache();
87451
- const errorLink$2 = onError(handleHandler);
87477
+ const authLink$3 = setContext(handleAuth);
87478
+ const cache$3 = new InMemoryCache();
87479
+ const errorLink$3 = onError(handleHandler);
87452
87480
  /* eslint-disable no-process-env */
87453
- const isDevEnv$2 = process.env['NODE_ENV'] !== 'production';
87481
+ const isDevEnv$3 = process.env['NODE_ENV'] !== 'production';
87454
87482
  /* eslint-enable no-process-env */
87455
- const httpLink = createHttpLink({
87456
- uri: `${uri$2}/gq`,
87483
+ const httpLink$1 = createHttpLink({
87484
+ uri: `${uri$3}/gq`,
87457
87485
  fetchOptions: {
87458
87486
  mode: 'cors'
87459
87487
  }
87460
87488
  });
87461
- const batchLink = new BatchHttpLink({
87462
- uri: `${uri$2}/gq`,
87489
+ const batchLink$1 = new BatchHttpLink({
87490
+ uri: `${uri$3}/gq`,
87463
87491
  batchMax: 5,
87464
87492
  // Max number of operations in a single batch
87465
87493
  batchInterval: 200,
@@ -87469,14 +87497,36 @@ const batchLink = new BatchHttpLink({
87469
87497
  }
87470
87498
  });
87471
87499
  // use batch link for queries and http link for mutations
87472
- const splitLink = split$1(({
87500
+ const splitLink$1 = split$1(({
87473
87501
  query
87474
87502
  }) => {
87475
87503
  const definition = getMainDefinition(query);
87476
87504
  return definition.kind === 'OperationDefinition' && definition.operation === 'query';
87477
- }, batchLink, httpLink);
87505
+ }, batchLink$1, httpLink$1);
87478
87506
  const coreClient = new ApolloClient({
87479
- link: from([authLink$2, errorLink$2, splitLink]),
87507
+ link: from([authLink$3, errorLink$3, splitLink$1]),
87508
+ cache: cache$3,
87509
+ connectToDevTools: isDevEnv$3,
87510
+ queryDeduplication: true
87511
+ });
87512
+
87513
+ const {
87514
+ networkInterface: uri$2
87515
+ } = appConfig.bot;
87516
+ const authLink$2 = setContext(handleAuth);
87517
+ const cache$2 = new InMemoryCache();
87518
+ const errorLink$2 = onError(handleHandler);
87519
+ /* eslint-disable no-process-env */
87520
+ const isDevEnv$2 = process.env['NODE_ENV'] !== 'production';
87521
+ /* eslint-enable no-process-env */
87522
+ const link_dquery = createHttpLink({
87523
+ uri: `${uri$2}/gq`,
87524
+ fetchOptions: {
87525
+ mode: 'cors'
87526
+ }
87527
+ });
87528
+ const botClient = new ApolloClient({
87529
+ link: from([authLink$2, errorLink$2, link_dquery]),
87480
87530
  cache: cache$2,
87481
87531
  connectToDevTools: isDevEnv$2,
87482
87532
  queryDeduplication: true
@@ -87484,21 +87534,21 @@ const coreClient = new ApolloClient({
87484
87534
 
87485
87535
  const {
87486
87536
  networkInterface: uri$1
87487
- } = appConfig.bot;
87537
+ } = appConfig.auth;
87488
87538
  const authLink$1 = setContext(handleAuth);
87489
87539
  const cache$1 = new InMemoryCache();
87490
87540
  const errorLink$1 = onError(handleHandler);
87491
87541
  /* eslint-disable no-process-env */
87492
87542
  const isDevEnv$1 = process.env['NODE_ENV'] !== 'production';
87493
87543
  /* eslint-enable no-process-env */
87494
- const link_dquery = createHttpLink({
87544
+ const link_auth = createHttpLink({
87495
87545
  uri: `${uri$1}/gq`,
87496
87546
  fetchOptions: {
87497
87547
  mode: 'cors'
87498
87548
  }
87499
87549
  });
87500
- const botClient = new ApolloClient({
87501
- link: from([authLink$1, errorLink$1, link_dquery]),
87550
+ const authClient = new ApolloClient({
87551
+ link: from([authLink$1, errorLink$1, link_auth]),
87502
87552
  cache: cache$1,
87503
87553
  connectToDevTools: isDevEnv$1,
87504
87554
  queryDeduplication: true
@@ -87506,21 +87556,35 @@ const botClient = new ApolloClient({
87506
87556
 
87507
87557
  const {
87508
87558
  networkInterface: uri
87509
- } = appConfig.auth;
87559
+ } = appConfig.billing;
87510
87560
  const authLink = setContext(handleAuth);
87511
87561
  const cache = new InMemoryCache();
87512
87562
  const errorLink = onError(handleHandler);
87513
87563
  /* eslint-disable no-process-env */
87514
87564
  const isDevEnv = process.env['NODE_ENV'] !== 'production';
87515
87565
  /* eslint-enable no-process-env */
87516
- const link_auth = createHttpLink({
87566
+ const httpLink = createHttpLink({
87517
87567
  uri: `${uri}/gq`,
87518
87568
  fetchOptions: {
87519
87569
  mode: 'cors'
87520
87570
  }
87521
87571
  });
87522
- const authClient = new ApolloClient({
87523
- link: from([authLink, errorLink, link_auth]),
87572
+ const batchLink = new BatchHttpLink({
87573
+ uri: `${uri}/gq`,
87574
+ batchMax: 5,
87575
+ batchInterval: 200,
87576
+ fetchOptions: {
87577
+ mode: 'cors'
87578
+ }
87579
+ });
87580
+ const splitLink = split$1(({
87581
+ query
87582
+ }) => {
87583
+ const definition = getMainDefinition(query);
87584
+ return definition.kind === 'OperationDefinition' && definition.operation === 'query';
87585
+ }, batchLink, httpLink);
87586
+ const billingClient = new ApolloClient({
87587
+ link: from([authLink, errorLink, splitLink]),
87524
87588
  cache,
87525
87589
  connectToDevTools: isDevEnv,
87526
87590
  queryDeduplication: true
@@ -87580,4 +87644,4 @@ var ModelFieldsTypes;
87580
87644
  ModelFieldsTypes["JSON"] = "JSON";
87581
87645
  })(ModelFieldsTypes || (ModelFieldsTypes = {}));
87582
87646
 
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 };
87647
+ export { CreateCheckoutSessionUri, CreatePortalSessionUri, ModelFieldsTypes, ModelUtilities, VALIDATE_COMPANY_NAME, addDomain, addDomainOptions, apiBackend, apiV2Backend, appConfig, authClient, billingClient, botClient, clearAuthData, companyUsersQuery, contentInstancesQuery, coreClient, createCompany, createContentInstanceMutation, createContentInstanceMutationOptions, createContentMutation, createContentMutationOptions, createFileMutation, createFolderMutation, dconfigClient, deleteFileMutation, deleteFolderMutation, dqueryClient, filesQuery, foldersTreeQuery, forgetPassword, forgetPasswordOptions, frontend, getErrorHandler, getPartner, 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.44",
4
+ "version": "0.0.46",
5
5
  "keyword": [
6
6
  "bcrumbs",
7
7
  "bc-api",
package/src/index.d.ts CHANGED
@@ -14,6 +14,7 @@ export * from './lib/clients/showcaseClient';
14
14
  export * from './lib/clients/coreClient';
15
15
  export * from './lib/clients/botClient';
16
16
  export * from './lib/clients/authClient';
17
+ export * from './lib/clients/billingClient';
17
18
  export * from './lib/models/contentInstance';
18
19
  export * from './lib/models/model';
19
20
  export * from './lib/models/file';
@@ -0,0 +1,2 @@
1
+ import { ApolloClient } from '@apollo/client';
2
+ export declare const billingClient: ApolloClient<import("@apollo/client").NormalizedCacheObject>;
@@ -27,5 +27,13 @@ export declare const appConfig: {
27
27
  path: string;
28
28
  };
29
29
  };
30
+ /**
31
+ * Gets the partner name from build-time configuration
32
+ * The partner can be set via:
33
+ * - window.__PARTNER__ (set at build time via webpack DefinePlugin or script tag)
34
+ * - window._env_.PARTNER (if using env.sh script)
35
+ * @returns Partner name if configured, undefined otherwise
36
+ */
37
+ export declare function getPartner(): string | undefined;
30
38
  export default appConfig;
31
39
  export { frontend, apiBackend, apiV2Backend };