@23blocks/angular 4.4.0 → 5.0.0
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/dist/index.esm.js
CHANGED
|
@@ -112,9 +112,9 @@ import { createUniversityBlock } from '@23blocks/block-university';
|
|
|
112
112
|
*/ const PROVIDER_CONFIG = new InjectionToken('23blocks.provider-config');
|
|
113
113
|
/** @deprecated Use PROVIDER_CONFIG instead */ const SIMPLE_CONFIG = PROVIDER_CONFIG;
|
|
114
114
|
/**
|
|
115
|
-
* Generate storage key scoped to
|
|
116
|
-
*/ function getStorageKey(type,
|
|
117
|
-
const scope = tenantId ? `${
|
|
115
|
+
* Generate storage key scoped to API key and tenant
|
|
116
|
+
*/ function getStorageKey(type, apiKey, tenantId) {
|
|
117
|
+
const scope = tenantId ? `${apiKey}_${tenantId}` : apiKey;
|
|
118
118
|
return `23blocks_${scope}_${type}_token`;
|
|
119
119
|
}
|
|
120
120
|
/**
|
|
@@ -136,10 +136,10 @@ import { createUniversityBlock } from '@23blocks/block-university';
|
|
|
136
136
|
};
|
|
137
137
|
/**
|
|
138
138
|
* Create a token manager with scoped storage keys and cross-tab sync
|
|
139
|
-
*/ function createTokenManager(
|
|
139
|
+
*/ function createTokenManager(apiKey, storageType, tenantId) {
|
|
140
140
|
const isBrowser = typeof window !== 'undefined' && typeof window.localStorage !== 'undefined';
|
|
141
|
-
const accessTokenKey = getStorageKey('access',
|
|
142
|
-
const refreshTokenKey = getStorageKey('refresh',
|
|
141
|
+
const accessTokenKey = getStorageKey('access', apiKey, tenantId);
|
|
142
|
+
const refreshTokenKey = getStorageKey('refresh', apiKey, tenantId);
|
|
143
143
|
let storage;
|
|
144
144
|
if (!isBrowser) {
|
|
145
145
|
storage = new MemoryStorage();
|
|
@@ -217,7 +217,7 @@ import { createUniversityBlock } from '@23blocks/block-university';
|
|
|
217
217
|
credentials: config.authMode === 'cookie' ? 'include' : undefined,
|
|
218
218
|
headers: ()=>{
|
|
219
219
|
const headers = _({}, config.headers, {
|
|
220
|
-
'
|
|
220
|
+
'api-key': config.apiKey
|
|
221
221
|
});
|
|
222
222
|
if (config.tenantId) {
|
|
223
223
|
headers['tenant-id'] = config.tenantId;
|
|
@@ -251,7 +251,7 @@ import { createUniversityBlock } from '@23blocks/block-university';
|
|
|
251
251
|
* export const appConfig: ApplicationConfig = {
|
|
252
252
|
* providers: [
|
|
253
253
|
* provideBlocks23({
|
|
254
|
-
*
|
|
254
|
+
* apiKey: 'your-api-key',
|
|
255
255
|
* urls: {
|
|
256
256
|
* authentication: 'https://gateway.23blocks.com',
|
|
257
257
|
* crm: 'https://crm.23blocks.com',
|
|
@@ -267,7 +267,7 @@ import { createUniversityBlock } from '@23blocks/block-university';
|
|
|
267
267
|
* export const appConfig: ApplicationConfig = {
|
|
268
268
|
* providers: [
|
|
269
269
|
* provideBlocks23({
|
|
270
|
-
*
|
|
270
|
+
* apiKey: 'your-api-key',
|
|
271
271
|
* authMode: 'cookie',
|
|
272
272
|
* urls: {
|
|
273
273
|
* authentication: 'https://gateway.23blocks.com',
|
|
@@ -280,7 +280,7 @@ import { createUniversityBlock } from '@23blocks/block-university';
|
|
|
280
280
|
*/ function provideBlocks23(config) {
|
|
281
281
|
// Block config for all services
|
|
282
282
|
const blockConfig = {
|
|
283
|
-
|
|
283
|
+
apiKey: config.apiKey,
|
|
284
284
|
tenantId: config.tenantId
|
|
285
285
|
};
|
|
286
286
|
// Helper to create transport provider for a service URL
|
|
@@ -306,7 +306,7 @@ import { createUniversityBlock } from '@23blocks/block-university';
|
|
|
306
306
|
useFactory: ()=>{
|
|
307
307
|
var _config_storage;
|
|
308
308
|
const storage = (_config_storage = config.storage) != null ? _config_storage : 'localStorage';
|
|
309
|
-
return createTokenManager(config.
|
|
309
|
+
return createTokenManager(config.apiKey, storage, config.tenantId);
|
|
310
310
|
}
|
|
311
311
|
},
|
|
312
312
|
// Per-service transport factories (null if URL not configured)
|
|
@@ -440,7 +440,7 @@ import { createUniversityBlock } from '@23blocks/block-university';
|
|
|
440
440
|
* @NgModule({
|
|
441
441
|
* providers: [
|
|
442
442
|
* ...getBlocks23Providers({
|
|
443
|
-
*
|
|
443
|
+
* apiKey: 'your-api-key',
|
|
444
444
|
* urls: {
|
|
445
445
|
* authentication: 'https://gateway.23blocks.com',
|
|
446
446
|
* crm: 'https://crm.23blocks.com',
|
|
@@ -453,7 +453,7 @@ import { createUniversityBlock } from '@23blocks/block-university';
|
|
|
453
453
|
*/ function getBlocks23Providers(config) {
|
|
454
454
|
// Block config for all services
|
|
455
455
|
const blockConfig = {
|
|
456
|
-
|
|
456
|
+
apiKey: config.apiKey,
|
|
457
457
|
tenantId: config.tenantId
|
|
458
458
|
};
|
|
459
459
|
// Helper to create transport provider for a service URL
|
|
@@ -479,7 +479,7 @@ import { createUniversityBlock } from '@23blocks/block-university';
|
|
|
479
479
|
useFactory: ()=>{
|
|
480
480
|
var _config_storage;
|
|
481
481
|
const storage = (_config_storage = config.storage) != null ? _config_storage : 'localStorage';
|
|
482
|
-
return createTokenManager(config.
|
|
482
|
+
return createTokenManager(config.apiKey, storage, config.tenantId);
|
|
483
483
|
}
|
|
484
484
|
},
|
|
485
485
|
// Per-service transport factories (null if URL not configured)
|
|
@@ -616,10 +616,10 @@ import { createUniversityBlock } from '@23blocks/block-university';
|
|
|
616
616
|
* providers: [
|
|
617
617
|
* provide23Blocks({
|
|
618
618
|
* transport,
|
|
619
|
-
* authentication: {
|
|
620
|
-
* search: {
|
|
621
|
-
* products: {
|
|
622
|
-
* crm: {
|
|
619
|
+
* authentication: { apiKey: 'my-api-key' },
|
|
620
|
+
* search: { apiKey: 'my-api-key' },
|
|
621
|
+
* products: { apiKey: 'my-api-key' },
|
|
622
|
+
* crm: { apiKey: 'my-api-key' },
|
|
623
623
|
* }),
|
|
624
624
|
* ],
|
|
625
625
|
* };
|
|
@@ -754,7 +754,7 @@ import { createUniversityBlock } from '@23blocks/block-university';
|
|
|
754
754
|
* providers: [
|
|
755
755
|
* ...get23BlocksProviders({
|
|
756
756
|
* transport,
|
|
757
|
-
* authentication: {
|
|
757
|
+
* authentication: { apiKey: 'my-api-key' },
|
|
758
758
|
* }),
|
|
759
759
|
* ],
|
|
760
760
|
* })
|
|
@@ -63,10 +63,10 @@ export interface Provide23BlocksConfig {
|
|
|
63
63
|
* providers: [
|
|
64
64
|
* provide23Blocks({
|
|
65
65
|
* transport,
|
|
66
|
-
* authentication: {
|
|
67
|
-
* search: {
|
|
68
|
-
* products: {
|
|
69
|
-
* crm: {
|
|
66
|
+
* authentication: { apiKey: 'my-api-key' },
|
|
67
|
+
* search: { apiKey: 'my-api-key' },
|
|
68
|
+
* products: { apiKey: 'my-api-key' },
|
|
69
|
+
* crm: { apiKey: 'my-api-key' },
|
|
70
70
|
* }),
|
|
71
71
|
* ],
|
|
72
72
|
* };
|
|
@@ -86,7 +86,7 @@ export declare function provide23Blocks(config: Provide23BlocksConfig): Environm
|
|
|
86
86
|
* providers: [
|
|
87
87
|
* ...get23BlocksProviders({
|
|
88
88
|
* transport,
|
|
89
|
-
* authentication: {
|
|
89
|
+
* authentication: { apiKey: 'my-api-key' },
|
|
90
90
|
* }),
|
|
91
91
|
* ],
|
|
92
92
|
* })
|
|
@@ -61,7 +61,7 @@ export interface ProviderConfig {
|
|
|
61
61
|
* @example
|
|
62
62
|
* ```typescript
|
|
63
63
|
* provideBlocks23({
|
|
64
|
-
*
|
|
64
|
+
* apiKey: 'your-api-key',
|
|
65
65
|
* urls: {
|
|
66
66
|
* authentication: 'https://gateway.23blocks.com',
|
|
67
67
|
* crm: 'https://crm.23blocks.com',
|
|
@@ -72,9 +72,9 @@ export interface ProviderConfig {
|
|
|
72
72
|
*/
|
|
73
73
|
urls: ServiceUrls;
|
|
74
74
|
/**
|
|
75
|
-
*
|
|
75
|
+
* API Key for authenticating with 23blocks services
|
|
76
76
|
*/
|
|
77
|
-
|
|
77
|
+
apiKey: string;
|
|
78
78
|
/**
|
|
79
79
|
* Tenant ID (optional, for multi-tenant setups)
|
|
80
80
|
*/
|
|
@@ -142,7 +142,7 @@ export interface TokenManagerService {
|
|
|
142
142
|
* export const appConfig: ApplicationConfig = {
|
|
143
143
|
* providers: [
|
|
144
144
|
* provideBlocks23({
|
|
145
|
-
*
|
|
145
|
+
* apiKey: 'your-api-key',
|
|
146
146
|
* urls: {
|
|
147
147
|
* authentication: 'https://gateway.23blocks.com',
|
|
148
148
|
* crm: 'https://crm.23blocks.com',
|
|
@@ -158,7 +158,7 @@ export interface TokenManagerService {
|
|
|
158
158
|
* export const appConfig: ApplicationConfig = {
|
|
159
159
|
* providers: [
|
|
160
160
|
* provideBlocks23({
|
|
161
|
-
*
|
|
161
|
+
* apiKey: 'your-api-key',
|
|
162
162
|
* authMode: 'cookie',
|
|
163
163
|
* urls: {
|
|
164
164
|
* authentication: 'https://gateway.23blocks.com',
|
|
@@ -185,7 +185,7 @@ export declare function provideBlocks23(config: ProviderConfig): EnvironmentProv
|
|
|
185
185
|
* @NgModule({
|
|
186
186
|
* providers: [
|
|
187
187
|
* ...getBlocks23Providers({
|
|
188
|
-
*
|
|
188
|
+
* apiKey: 'your-api-key',
|
|
189
189
|
* urls: {
|
|
190
190
|
* authentication: 'https://gateway.23blocks.com',
|
|
191
191
|
* crm: 'https://crm.23blocks.com',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"simple-providers.d.ts","sourceRoot":"","sources":["../../../src/lib/simple-providers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AA8CpE;;GAEG;AACH,MAAM,MAAM,QAAQ,GAAG,OAAO,GAAG,QAAQ,CAAC;AAE1C;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,cAAc,GAAG,gBAAgB,GAAG,QAAQ,CAAC;AAEvE;;;GAGG;AACH,MAAM,WAAW,WAAW;IAC1B,iCAAiC;IACjC,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,yB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