@descope/angular-sdk 0.0.0-next-82470644-20240801 → 0.0.0-next-88a7f420-20250415

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.
Files changed (43) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +711 -11
  3. package/package.json +74 -25
  4. package/environment.d.ts +0 -3
  5. package/esm2022/descope-angular-sdk.mjs +0 -5
  6. package/esm2022/environment.mjs +0 -4
  7. package/esm2022/lib/components/access-key-management/access-key-management.component.mjs +0 -61
  8. package/esm2022/lib/components/audit-management/audit-management.component.mjs +0 -61
  9. package/esm2022/lib/components/descope/descope.component.mjs +0 -156
  10. package/esm2022/lib/components/role-management/role-management.component.mjs +0 -61
  11. package/esm2022/lib/components/sign-in-flow/sign-in-flow.component.mjs +0 -44
  12. package/esm2022/lib/components/sign-up-flow/sign-up-flow.component.mjs +0 -44
  13. package/esm2022/lib/components/sign-up-or-in-flow/sign-up-or-in-flow.component.mjs +0 -44
  14. package/esm2022/lib/components/user-management/user-management.component.mjs +0 -61
  15. package/esm2022/lib/components/user-profile/user-profile.component.mjs +0 -66
  16. package/esm2022/lib/descope-auth.module.mjs +0 -77
  17. package/esm2022/lib/services/descope-auth.guard.mjs +0 -15
  18. package/esm2022/lib/services/descope-auth.service.mjs +0 -154
  19. package/esm2022/lib/services/descope.interceptor.mjs +0 -51
  20. package/esm2022/lib/types/types.mjs +0 -6
  21. package/esm2022/lib/utils/constants.mjs +0 -7
  22. package/esm2022/lib/utils/helpers.mjs +0 -27
  23. package/esm2022/public-api.mjs +0 -18
  24. package/fesm2022/descope-angular-sdk.mjs +0 -892
  25. package/fesm2022/descope-angular-sdk.mjs.map +0 -1
  26. package/index.d.ts +0 -5
  27. package/lib/components/access-key-management/access-key-management.component.d.ts +0 -22
  28. package/lib/components/audit-management/audit-management.component.d.ts +0 -22
  29. package/lib/components/descope/descope.component.d.ts +0 -38
  30. package/lib/components/role-management/role-management.component.d.ts +0 -22
  31. package/lib/components/sign-in-flow/sign-in-flow.component.d.ts +0 -26
  32. package/lib/components/sign-up-flow/sign-up-flow.component.d.ts +0 -26
  33. package/lib/components/sign-up-or-in-flow/sign-up-or-in-flow.component.d.ts +0 -26
  34. package/lib/components/user-management/user-management.component.d.ts +0 -22
  35. package/lib/components/user-profile/user-profile.component.d.ts +0 -22
  36. package/lib/descope-auth.module.d.ts +0 -19
  37. package/lib/services/descope-auth.guard.d.ts +0 -2
  38. package/lib/services/descope-auth.service.d.ts +0 -40
  39. package/lib/services/descope.interceptor.d.ts +0 -2
  40. package/lib/types/types.d.ts +0 -11
  41. package/lib/utils/constants.d.ts +0 -5
  42. package/lib/utils/helpers.d.ts +0 -5
  43. package/public-api.d.ts +0 -14
@@ -1,892 +0,0 @@
1
- import * as i0 from '@angular/core';
2
- import { Injectable, inject, EventEmitter, Component, Input, Output, NgModule, CUSTOM_ELEMENTS_SCHEMA, Optional, SkipSelf } from '@angular/core';
3
- import createSdk from '@descope/web-js-sdk';
4
- import { from, BehaviorSubject, tap, finalize, of, throwError } from 'rxjs';
5
- import { Router } from '@angular/router';
6
- import { switchMap, catchError } from 'rxjs/operators';
7
- import DescopeWebComponent from '@descope/web-component';
8
- import DescopeUserManagementWidget from '@descope/user-management-widget';
9
- import DescopeRoleManagementWidget from '@descope/role-management-widget';
10
- import DescopeAccessKeyManagementWidget from '@descope/access-key-management-widget';
11
- import DescopeAuditManagementWidget from '@descope/audit-management-widget';
12
- import DescopeUserProfileWidget from '@descope/user-profile-widget';
13
-
14
- function observabilify(value) {
15
- /* eslint-disable @typescript-eslint/no-explicit-any */
16
- const observableValue = {};
17
- for (const key in value) {
18
- if (typeof value[key] === 'function') {
19
- const fn = value[key];
20
- observableValue[key] = (...args) => {
21
- const fnResult = fn(...args);
22
- if (fnResult instanceof Promise) {
23
- return from(fnResult);
24
- }
25
- else {
26
- return fnResult;
27
- }
28
- };
29
- }
30
- else if (typeof value[key] === 'object' && value[key] !== null) {
31
- observableValue[key] = observabilify(value[key]);
32
- }
33
- else {
34
- observableValue[key] = value[key];
35
- }
36
- }
37
- return observableValue;
38
- }
39
-
40
- const environment = {
41
- buildVersion: '0.0.0-next-82470644-20240801'
42
- };
43
-
44
- const baseHeaders = {
45
- 'x-descope-sdk-name': 'angular',
46
- 'x-descope-sdk-version': environment.buildVersion
47
- };
48
- const isBrowser = () => typeof window !== 'undefined';
49
-
50
- class DescopeAuthConfig {
51
- constructor() {
52
- this.projectId = '';
53
- }
54
- }
55
-
56
- class DescopeAuthService {
57
- constructor(config) {
58
- this.descopeSdk = observabilify(createSdk({
59
- persistTokens: isBrowser(),
60
- ...config,
61
- storeLastAuthenticatedUser: isBrowser(),
62
- autoRefresh: isBrowser(),
63
- baseHeaders
64
- }));
65
- this.sessionSubject = new BehaviorSubject({
66
- isAuthenticated: false,
67
- isSessionLoading: false,
68
- sessionToken: ''
69
- });
70
- this.session$ = this.sessionSubject.asObservable();
71
- this.userSubject = new BehaviorSubject({
72
- isUserLoading: false
73
- });
74
- this.user$ = this.userSubject.asObservable();
75
- this.descopeSdk.onSessionTokenChange(this.setSession.bind(this));
76
- this.descopeSdk.onUserChange(this.setUser.bind(this));
77
- }
78
- refreshSession() {
79
- const beforeRefreshSession = this.sessionSubject.value;
80
- this.sessionSubject.next({
81
- ...beforeRefreshSession,
82
- isSessionLoading: true
83
- });
84
- return this.descopeSdk.refresh().pipe(tap((data) => {
85
- const afterRequestSession = this.sessionSubject.value;
86
- if (data.ok && data.data) {
87
- this.sessionSubject.next({
88
- ...afterRequestSession,
89
- sessionToken: data.data.sessionJwt,
90
- isAuthenticated: !!data.data.sessionJwt
91
- });
92
- }
93
- else {
94
- this.sessionSubject.next({
95
- ...afterRequestSession,
96
- sessionToken: '',
97
- isAuthenticated: false
98
- });
99
- }
100
- }), finalize(() => {
101
- const afterRefreshSession = this.sessionSubject.value;
102
- this.sessionSubject.next({
103
- ...afterRefreshSession,
104
- isSessionLoading: false
105
- });
106
- }));
107
- }
108
- refreshUser() {
109
- const beforeRefreshUser = this.userSubject.value;
110
- this.userSubject.next({
111
- ...beforeRefreshUser,
112
- isUserLoading: true
113
- });
114
- return this.descopeSdk.me().pipe(tap((data) => {
115
- const afterRequestUser = this.userSubject.value;
116
- if (data.data) {
117
- this.userSubject.next({
118
- ...afterRequestUser,
119
- user: {
120
- ...data.data
121
- }
122
- });
123
- }
124
- }), finalize(() => {
125
- const afterRefreshUser = this.userSubject.value;
126
- this.userSubject.next({
127
- ...afterRefreshUser,
128
- isUserLoading: false
129
- });
130
- }));
131
- }
132
- getSessionToken() {
133
- if (isBrowser()) {
134
- return this.descopeSdk.getSessionToken();
135
- }
136
- console.warn('Get session token is not supported in SSR');
137
- return '';
138
- }
139
- getRefreshToken() {
140
- if (isBrowser()) {
141
- return this.descopeSdk.getRefreshToken();
142
- }
143
- this.descopeSdk.getJwtPermissions;
144
- console.warn('Get refresh token is not supported in SSR');
145
- return '';
146
- }
147
- isSessionTokenExpired(token = this.getSessionToken()) {
148
- if (isBrowser()) {
149
- return this.descopeSdk.isJwtExpired(token ?? '');
150
- }
151
- console.warn('isSessionTokenExpired is not supported in SSR');
152
- return true;
153
- }
154
- isRefreshTokenExpired(token = this.getRefreshToken()) {
155
- if (isBrowser()) {
156
- return this.descopeSdk.isJwtExpired(token ?? '');
157
- }
158
- console.warn('isRefreshTokenExpired is not supported in SSR');
159
- return true;
160
- }
161
- getJwtPermissions(token = this.getSessionToken(), tenant) {
162
- if (token === null) {
163
- console.error('Could not get JWT Permissions - not authenticated');
164
- return [];
165
- }
166
- return this.descopeSdk.getJwtPermissions(token, tenant);
167
- }
168
- getJwtRoles(token = this.getSessionToken(), tenant) {
169
- if (token === null) {
170
- console.error('Could not get JWT Roles - not authenticated');
171
- return [];
172
- }
173
- return this.descopeSdk.getJwtRoles(token, tenant);
174
- }
175
- isAuthenticated() {
176
- return this.sessionSubject.value.isAuthenticated;
177
- }
178
- setSession(sessionToken) {
179
- const currentSession = this.sessionSubject.value;
180
- this.sessionSubject.next({
181
- sessionToken,
182
- isAuthenticated: !!sessionToken,
183
- isSessionLoading: currentSession.isSessionLoading
184
- });
185
- }
186
- setUser(user) {
187
- const currentUser = this.userSubject.value;
188
- this.userSubject.next({
189
- isUserLoading: currentUser.isUserLoading,
190
- user
191
- });
192
- }
193
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.9", ngImport: i0, type: DescopeAuthService, deps: [{ token: DescopeAuthConfig }], target: i0.ɵɵFactoryTarget.Injectable }); }
194
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.9", ngImport: i0, type: DescopeAuthService, providedIn: 'root' }); }
195
- }
196
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.9", ngImport: i0, type: DescopeAuthService, decorators: [{
197
- type: Injectable,
198
- args: [{
199
- providedIn: 'root'
200
- }]
201
- }], ctorParameters: function () { return [{ type: DescopeAuthConfig }]; } });
202
-
203
- const descopeAuthGuard = (route) => {
204
- const authService = inject(DescopeAuthService);
205
- const router = inject(Router);
206
- const fallbackUrl = route.data['descopeFallbackUrl'];
207
- const isAuthenticated = authService.isAuthenticated();
208
- if (!isAuthenticated && !!fallbackUrl) {
209
- return from(router.navigate([fallbackUrl]));
210
- }
211
- return of(isAuthenticated);
212
- };
213
-
214
- const descopeInterceptor = (request, next) => {
215
- const config = inject(DescopeAuthConfig);
216
- const authService = inject(DescopeAuthService);
217
- function refreshAndRetry(request, next, error) {
218
- return authService.refreshSession().pipe(switchMap((refreshed) => {
219
- if (refreshed.ok && refreshed.data) {
220
- const requestWithRefreshedToken = addTokenToRequest(request, refreshed.data?.sessionJwt);
221
- return next(requestWithRefreshedToken);
222
- }
223
- else {
224
- return throwError(() => error ?? new Error('Could not refresh session!'));
225
- }
226
- }));
227
- }
228
- function shouldIntercept(request) {
229
- return ((config.pathsToIntercept?.length === 0 ||
230
- config.pathsToIntercept?.some((path) => request.url.includes(path))) ??
231
- true);
232
- }
233
- function addTokenToRequest(request, token) {
234
- return request.clone({
235
- setHeaders: {
236
- Authorization: `Bearer ${token}`
237
- }
238
- });
239
- }
240
- if (shouldIntercept(request)) {
241
- const token = authService.getSessionToken();
242
- if (!token) {
243
- return refreshAndRetry(request, next);
244
- }
245
- const requestWithToken = addTokenToRequest(request, token);
246
- return next(requestWithToken).pipe(catchError((error) => {
247
- if (error.status === 401 || error.status === 403) {
248
- return refreshAndRetry(request, next, error);
249
- }
250
- else {
251
- return throwError(() => error);
252
- }
253
- }));
254
- }
255
- else {
256
- return next(request);
257
- }
258
- };
259
-
260
- class DescopeComponent {
261
- constructor(elementRef, authService, descopeConfig) {
262
- this.elementRef = elementRef;
263
- this.authService = authService;
264
- this.success = new EventEmitter();
265
- this.error = new EventEmitter();
266
- this.ready = new EventEmitter();
267
- this.webComponent = new DescopeWebComponent();
268
- this.projectId = descopeConfig.projectId;
269
- this.baseUrl = descopeConfig.baseUrl;
270
- this.baseStaticUrl = descopeConfig.baseStaticUrl;
271
- this.storeLastAuthenticatedUser = descopeConfig.storeLastAuthenticatedUser;
272
- }
273
- ngOnInit() {
274
- const sdk = this.authService.descopeSdk; // Capture the class context in a variable
275
- DescopeWebComponent.sdkConfigOverrides = {
276
- // Overrides the web-component's base headers to indicate usage via the React SDK
277
- baseHeaders,
278
- // Disables token persistence within the web-component to delegate token management
279
- // to the global SDK hooks. This ensures token handling aligns with the SDK's configuration,
280
- // and web-component requests leverage the global SDK's beforeRequest hooks for consistency
281
- persistTokens: false,
282
- hooks: {
283
- get beforeRequest() {
284
- // Retrieves the beforeRequest hook from the global SDK, which is initialized
285
- // within the AuthProvider using the desired configuration. This approach ensures
286
- // the web-component utilizes the same beforeRequest hooks as the global SDK
287
- return sdk.httpClient.hooks?.beforeRequest;
288
- },
289
- set beforeRequest(_) {
290
- // The empty setter prevents runtime errors when attempts are made to assign a value to 'beforeRequest'.
291
- // JavaScript objects default to having both getters and setters
292
- }
293
- }
294
- };
295
- this.setupWebComponent();
296
- this.elementRef.nativeElement.appendChild(this.webComponent);
297
- }
298
- ngOnChanges() {
299
- this.setupWebComponent();
300
- }
301
- setupWebComponent() {
302
- this.webComponent.setAttribute('project-id', this.projectId);
303
- this.webComponent.setAttribute('flow-id', this.flowId);
304
- if (this.baseUrl) {
305
- this.webComponent.setAttribute('base-url', this.baseUrl);
306
- }
307
- if (this.baseStaticUrl) {
308
- this.webComponent.setAttribute('base-static-url', this.baseStaticUrl);
309
- }
310
- if (this.storeLastAuthenticatedUser) {
311
- this.webComponent.setAttribute('store-last-authenticated-user', this.storeLastAuthenticatedUser.toString());
312
- }
313
- if (this.locale) {
314
- this.webComponent.setAttribute('locale', this.locale);
315
- }
316
- if (this.theme) {
317
- this.webComponent.setAttribute('theme', this.theme);
318
- }
319
- if (this.tenant) {
320
- this.webComponent.setAttribute('tenant', this.tenant);
321
- }
322
- if (this.telemetryKey) {
323
- this.webComponent.setAttribute('telemetryKey', this.telemetryKey);
324
- }
325
- if (this.redirectUrl) {
326
- this.webComponent.setAttribute('redirect-url', this.redirectUrl);
327
- }
328
- if (this.autoFocus) {
329
- this.webComponent.setAttribute('auto-focus', this.autoFocus.toString());
330
- }
331
- if (this.debug) {
332
- this.webComponent.setAttribute('debug', this.debug.toString());
333
- }
334
- if (this.errorTransformer) {
335
- this.webComponent.errorTransformer = this.errorTransformer;
336
- }
337
- if (this.client) {
338
- this.webComponent.setAttribute('client', JSON.stringify(this.client));
339
- }
340
- if (this.form) {
341
- this.webComponent.setAttribute('form', JSON.stringify(this.form));
342
- }
343
- if (this.logger) {
344
- this.webComponent.logger = this.logger;
345
- }
346
- this.webComponent.addEventListener('success', (e) => {
347
- from(this.authService.descopeSdk.httpClient.hooks?.afterRequest(
348
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
349
- {}, new Response(JSON.stringify(e.detail)))).subscribe(() => {
350
- if (this.success) {
351
- this.success?.emit(e);
352
- }
353
- });
354
- });
355
- if (this.error) {
356
- this.webComponent.addEventListener('error', (e) => {
357
- this.error?.emit(e);
358
- });
359
- }
360
- if (this.ready) {
361
- this.webComponent.addEventListener('ready', () => {
362
- this.ready?.emit();
363
- });
364
- }
365
- }
366
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.9", ngImport: i0, type: DescopeComponent, deps: [{ token: i0.ElementRef }, { token: DescopeAuthService }, { token: DescopeAuthConfig }], target: i0.ɵɵFactoryTarget.Component }); }
367
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.9", type: DescopeComponent, isStandalone: true, selector: "descope[flowId]", inputs: { flowId: "flowId", locale: "locale", theme: "theme", tenant: "tenant", telemetryKey: "telemetryKey", redirectUrl: "redirectUrl", autoFocus: "autoFocus", debug: "debug", errorTransformer: "errorTransformer", client: "client", form: "form", logger: "logger" }, outputs: { success: "success", error: "error", ready: "ready" }, usesOnChanges: true, ngImport: i0, template: '', isInline: true }); }
368
- }
369
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.9", ngImport: i0, type: DescopeComponent, decorators: [{
370
- type: Component,
371
- args: [{
372
- selector: 'descope[flowId]',
373
- standalone: true,
374
- template: ''
375
- }]
376
- }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: DescopeAuthService }, { type: DescopeAuthConfig }]; }, propDecorators: { flowId: [{
377
- type: Input
378
- }], locale: [{
379
- type: Input
380
- }], theme: [{
381
- type: Input
382
- }], tenant: [{
383
- type: Input
384
- }], telemetryKey: [{
385
- type: Input
386
- }], redirectUrl: [{
387
- type: Input
388
- }], autoFocus: [{
389
- type: Input
390
- }], debug: [{
391
- type: Input
392
- }], errorTransformer: [{
393
- type: Input
394
- }], client: [{
395
- type: Input
396
- }], form: [{
397
- type: Input
398
- }], logger: [{
399
- type: Input
400
- }], success: [{
401
- type: Output
402
- }], error: [{
403
- type: Output
404
- }], ready: [{
405
- type: Output
406
- }] } });
407
-
408
- class SignInFlowComponent {
409
- constructor(descopeConfig) {
410
- this.success = new EventEmitter();
411
- this.error = new EventEmitter();
412
- this.projectId = descopeConfig.projectId;
413
- }
414
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.9", ngImport: i0, type: SignInFlowComponent, deps: [{ token: DescopeAuthConfig }], target: i0.ɵɵFactoryTarget.Component }); }
415
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.9", type: SignInFlowComponent, isStandalone: true, selector: "descope-sign-in-flow", inputs: { locale: "locale", theme: "theme", tenant: "tenant", telemetryKey: "telemetryKey", redirectUrl: "redirectUrl", autoFocus: "autoFocus", debug: "debug", errorTransformer: "errorTransformer", client: "client", form: "form", logger: "logger" }, outputs: { success: "success", error: "error" }, ngImport: i0, template: "<descope\n\t(success)=\"success.emit($event)\"\n\t(error)=\"error.emit($event)\"\n\tflowId=\"sign-in\"\n\t[locale]=\"locale\"\n\t[theme]=\"theme\"\n\t[tenant]=\"tenant\"\n\t[telemetryKey]=\"telemetryKey\"\n\t[redirectUrl]=\"redirectUrl\"\n\t[autoFocus]=\"autoFocus\"\n\t[debug]=\"debug\"\n\t[errorTransformer]=\"errorTransformer\"\n\t[client]=\"client\"\n\t[form]=\"form\"\n\t[logger]=\"logger\"\n>\n</descope>\n", dependencies: [{ kind: "component", type: DescopeComponent, selector: "descope[flowId]", inputs: ["flowId", "locale", "theme", "tenant", "telemetryKey", "redirectUrl", "autoFocus", "debug", "errorTransformer", "client", "form", "logger"], outputs: ["success", "error", "ready"] }] }); }
416
- }
417
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.9", ngImport: i0, type: SignInFlowComponent, decorators: [{
418
- type: Component,
419
- args: [{ selector: 'descope-sign-in-flow', standalone: true, imports: [DescopeComponent], template: "<descope\n\t(success)=\"success.emit($event)\"\n\t(error)=\"error.emit($event)\"\n\tflowId=\"sign-in\"\n\t[locale]=\"locale\"\n\t[theme]=\"theme\"\n\t[tenant]=\"tenant\"\n\t[telemetryKey]=\"telemetryKey\"\n\t[redirectUrl]=\"redirectUrl\"\n\t[autoFocus]=\"autoFocus\"\n\t[debug]=\"debug\"\n\t[errorTransformer]=\"errorTransformer\"\n\t[client]=\"client\"\n\t[form]=\"form\"\n\t[logger]=\"logger\"\n>\n</descope>\n" }]
420
- }], ctorParameters: function () { return [{ type: DescopeAuthConfig }]; }, propDecorators: { locale: [{
421
- type: Input
422
- }], theme: [{
423
- type: Input
424
- }], tenant: [{
425
- type: Input
426
- }], telemetryKey: [{
427
- type: Input
428
- }], redirectUrl: [{
429
- type: Input
430
- }], autoFocus: [{
431
- type: Input
432
- }], debug: [{
433
- type: Input
434
- }], errorTransformer: [{
435
- type: Input
436
- }], client: [{
437
- type: Input
438
- }], form: [{
439
- type: Input
440
- }], logger: [{
441
- type: Input
442
- }], success: [{
443
- type: Output
444
- }], error: [{
445
- type: Output
446
- }] } });
447
-
448
- class SignUpFlowComponent {
449
- constructor(descopeConfig) {
450
- this.success = new EventEmitter();
451
- this.error = new EventEmitter();
452
- this.projectId = descopeConfig.projectId;
453
- }
454
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.9", ngImport: i0, type: SignUpFlowComponent, deps: [{ token: DescopeAuthConfig }], target: i0.ɵɵFactoryTarget.Component }); }
455
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.9", type: SignUpFlowComponent, isStandalone: true, selector: "descope-sign-up-flow", inputs: { locale: "locale", theme: "theme", tenant: "tenant", telemetryKey: "telemetryKey", redirectUrl: "redirectUrl", autoFocus: "autoFocus", debug: "debug", errorTransformer: "errorTransformer", client: "client", form: "form", logger: "logger" }, outputs: { success: "success", error: "error" }, ngImport: i0, template: "<descope\n\t(success)=\"success.emit($event)\"\n\t(error)=\"error.emit($event)\"\n\tflowId=\"sign-up\"\n\t[locale]=\"locale\"\n\t[theme]=\"theme\"\n\t[tenant]=\"tenant\"\n\t[telemetryKey]=\"telemetryKey\"\n\t[redirectUrl]=\"redirectUrl\"\n\t[autoFocus]=\"autoFocus\"\n\t[debug]=\"debug\"\n\t[errorTransformer]=\"errorTransformer\"\n\t[client]=\"client\"\n\t[form]=\"form\"\n\t[logger]=\"logger\"\n>\n</descope>\n", dependencies: [{ kind: "component", type: DescopeComponent, selector: "descope[flowId]", inputs: ["flowId", "locale", "theme", "tenant", "telemetryKey", "redirectUrl", "autoFocus", "debug", "errorTransformer", "client", "form", "logger"], outputs: ["success", "error", "ready"] }] }); }
456
- }
457
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.9", ngImport: i0, type: SignUpFlowComponent, decorators: [{
458
- type: Component,
459
- args: [{ selector: 'descope-sign-up-flow', standalone: true, imports: [DescopeComponent], template: "<descope\n\t(success)=\"success.emit($event)\"\n\t(error)=\"error.emit($event)\"\n\tflowId=\"sign-up\"\n\t[locale]=\"locale\"\n\t[theme]=\"theme\"\n\t[tenant]=\"tenant\"\n\t[telemetryKey]=\"telemetryKey\"\n\t[redirectUrl]=\"redirectUrl\"\n\t[autoFocus]=\"autoFocus\"\n\t[debug]=\"debug\"\n\t[errorTransformer]=\"errorTransformer\"\n\t[client]=\"client\"\n\t[form]=\"form\"\n\t[logger]=\"logger\"\n>\n</descope>\n" }]
460
- }], ctorParameters: function () { return [{ type: DescopeAuthConfig }]; }, propDecorators: { locale: [{
461
- type: Input
462
- }], theme: [{
463
- type: Input
464
- }], tenant: [{
465
- type: Input
466
- }], telemetryKey: [{
467
- type: Input
468
- }], redirectUrl: [{
469
- type: Input
470
- }], autoFocus: [{
471
- type: Input
472
- }], debug: [{
473
- type: Input
474
- }], errorTransformer: [{
475
- type: Input
476
- }], client: [{
477
- type: Input
478
- }], form: [{
479
- type: Input
480
- }], logger: [{
481
- type: Input
482
- }], success: [{
483
- type: Output
484
- }], error: [{
485
- type: Output
486
- }] } });
487
-
488
- class SignUpOrInFlowComponent {
489
- constructor(descopeConfig) {
490
- this.success = new EventEmitter();
491
- this.error = new EventEmitter();
492
- this.projectId = descopeConfig.projectId;
493
- }
494
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.9", ngImport: i0, type: SignUpOrInFlowComponent, deps: [{ token: DescopeAuthConfig }], target: i0.ɵɵFactoryTarget.Component }); }
495
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.9", type: SignUpOrInFlowComponent, isStandalone: true, selector: "descope-sign-up-or-in-flow", inputs: { locale: "locale", theme: "theme", tenant: "tenant", telemetryKey: "telemetryKey", redirectUrl: "redirectUrl", autoFocus: "autoFocus", debug: "debug", errorTransformer: "errorTransformer", client: "client", form: "form", logger: "logger" }, outputs: { success: "success", error: "error" }, ngImport: i0, template: "<descope\n\t(success)=\"success.emit($event)\"\n\t(error)=\"error.emit($event)\"\n\tflowId=\"sign-up-or-in\"\n\t[locale]=\"locale\"\n\t[theme]=\"theme\"\n\t[tenant]=\"tenant\"\n\t[telemetryKey]=\"telemetryKey\"\n\t[redirectUrl]=\"redirectUrl\"\n\t[autoFocus]=\"autoFocus\"\n\t[debug]=\"debug\"\n\t[errorTransformer]=\"errorTransformer\"\n\t[client]=\"client\"\n\t[form]=\"form\"\n\t[logger]=\"logger\"\n>\n</descope>\n", dependencies: [{ kind: "component", type: DescopeComponent, selector: "descope[flowId]", inputs: ["flowId", "locale", "theme", "tenant", "telemetryKey", "redirectUrl", "autoFocus", "debug", "errorTransformer", "client", "form", "logger"], outputs: ["success", "error", "ready"] }] }); }
496
- }
497
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.9", ngImport: i0, type: SignUpOrInFlowComponent, decorators: [{
498
- type: Component,
499
- args: [{ selector: 'descope-sign-up-or-in-flow', standalone: true, imports: [DescopeComponent], template: "<descope\n\t(success)=\"success.emit($event)\"\n\t(error)=\"error.emit($event)\"\n\tflowId=\"sign-up-or-in\"\n\t[locale]=\"locale\"\n\t[theme]=\"theme\"\n\t[tenant]=\"tenant\"\n\t[telemetryKey]=\"telemetryKey\"\n\t[redirectUrl]=\"redirectUrl\"\n\t[autoFocus]=\"autoFocus\"\n\t[debug]=\"debug\"\n\t[errorTransformer]=\"errorTransformer\"\n\t[client]=\"client\"\n\t[form]=\"form\"\n\t[logger]=\"logger\"\n>\n</descope>\n" }]
500
- }], ctorParameters: function () { return [{ type: DescopeAuthConfig }]; }, propDecorators: { locale: [{
501
- type: Input
502
- }], theme: [{
503
- type: Input
504
- }], tenant: [{
505
- type: Input
506
- }], telemetryKey: [{
507
- type: Input
508
- }], redirectUrl: [{
509
- type: Input
510
- }], autoFocus: [{
511
- type: Input
512
- }], debug: [{
513
- type: Input
514
- }], errorTransformer: [{
515
- type: Input
516
- }], client: [{
517
- type: Input
518
- }], form: [{
519
- type: Input
520
- }], logger: [{
521
- type: Input
522
- }], success: [{
523
- type: Output
524
- }], error: [{
525
- type: Output
526
- }] } });
527
-
528
- class UserManagementComponent {
529
- constructor(elementRef, descopeConfig) {
530
- this.elementRef = elementRef;
531
- this.webComponent = new DescopeUserManagementWidget();
532
- this.projectId = descopeConfig.projectId;
533
- this.baseUrl = descopeConfig.baseUrl;
534
- this.baseStaticUrl = descopeConfig.baseStaticUrl;
535
- }
536
- ngOnInit() {
537
- this.setupWebComponent();
538
- this.elementRef.nativeElement.appendChild(this.webComponent);
539
- }
540
- ngOnChanges() {
541
- this.setupWebComponent();
542
- }
543
- setupWebComponent() {
544
- this.webComponent.setAttribute('project-id', this.projectId);
545
- this.webComponent.setAttribute('tenant', this.tenant);
546
- this.webComponent.setAttribute('widget-id', this.widgetId);
547
- if (this.baseUrl) {
548
- this.webComponent.setAttribute('base-url', this.baseUrl);
549
- }
550
- if (this.baseStaticUrl) {
551
- this.webComponent.setAttribute('base-static-url', this.baseStaticUrl);
552
- }
553
- if (this.theme) {
554
- this.webComponent.setAttribute('theme', this.theme);
555
- }
556
- if (this.debug) {
557
- this.webComponent.setAttribute('debug', this.debug.toString());
558
- }
559
- if (this.logger) {
560
- this.webComponent.logger = this.logger;
561
- }
562
- }
563
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.9", ngImport: i0, type: UserManagementComponent, deps: [{ token: i0.ElementRef }, { token: DescopeAuthConfig }], target: i0.ɵɵFactoryTarget.Component }); }
564
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.9", type: UserManagementComponent, isStandalone: true, selector: "user-management[tenant]", inputs: { tenant: "tenant", widgetId: "widgetId", theme: "theme", debug: "debug", logger: "logger" }, usesOnChanges: true, ngImport: i0, template: '', isInline: true }); }
565
- }
566
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.9", ngImport: i0, type: UserManagementComponent, decorators: [{
567
- type: Component,
568
- args: [{
569
- selector: 'user-management[tenant]',
570
- standalone: true,
571
- template: ''
572
- }]
573
- }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: DescopeAuthConfig }]; }, propDecorators: { tenant: [{
574
- type: Input
575
- }], widgetId: [{
576
- type: Input
577
- }], theme: [{
578
- type: Input
579
- }], debug: [{
580
- type: Input
581
- }], logger: [{
582
- type: Input
583
- }] } });
584
-
585
- class RoleManagementComponent {
586
- constructor(elementRef, descopeConfig) {
587
- this.elementRef = elementRef;
588
- this.webComponent = new DescopeRoleManagementWidget();
589
- this.projectId = descopeConfig.projectId;
590
- this.baseUrl = descopeConfig.baseUrl;
591
- this.baseStaticUrl = descopeConfig.baseStaticUrl;
592
- }
593
- ngOnInit() {
594
- this.setupWebComponent();
595
- this.elementRef.nativeElement.appendChild(this.webComponent);
596
- }
597
- ngOnChanges() {
598
- this.setupWebComponent();
599
- }
600
- setupWebComponent() {
601
- this.webComponent.setAttribute('project-id', this.projectId);
602
- this.webComponent.setAttribute('tenant', this.tenant);
603
- this.webComponent.setAttribute('widget-id', this.widgetId);
604
- if (this.baseUrl) {
605
- this.webComponent.setAttribute('base-url', this.baseUrl);
606
- }
607
- if (this.baseStaticUrl) {
608
- this.webComponent.setAttribute('base-static-url', this.baseStaticUrl);
609
- }
610
- if (this.theme) {
611
- this.webComponent.setAttribute('theme', this.theme);
612
- }
613
- if (this.debug) {
614
- this.webComponent.setAttribute('debug', this.debug.toString());
615
- }
616
- if (this.logger) {
617
- this.webComponent.logger = this.logger;
618
- }
619
- }
620
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.9", ngImport: i0, type: RoleManagementComponent, deps: [{ token: i0.ElementRef }, { token: DescopeAuthConfig }], target: i0.ɵɵFactoryTarget.Component }); }
621
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.9", type: RoleManagementComponent, isStandalone: true, selector: "role-management[tenant]", inputs: { tenant: "tenant", widgetId: "widgetId", theme: "theme", debug: "debug", logger: "logger" }, usesOnChanges: true, ngImport: i0, template: '', isInline: true }); }
622
- }
623
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.9", ngImport: i0, type: RoleManagementComponent, decorators: [{
624
- type: Component,
625
- args: [{
626
- selector: 'role-management[tenant]',
627
- standalone: true,
628
- template: ''
629
- }]
630
- }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: DescopeAuthConfig }]; }, propDecorators: { tenant: [{
631
- type: Input
632
- }], widgetId: [{
633
- type: Input
634
- }], theme: [{
635
- type: Input
636
- }], debug: [{
637
- type: Input
638
- }], logger: [{
639
- type: Input
640
- }] } });
641
-
642
- class AccessKeyManagementComponent {
643
- constructor(elementRef, descopeConfig) {
644
- this.elementRef = elementRef;
645
- this.webComponent = new DescopeAccessKeyManagementWidget();
646
- this.projectId = descopeConfig.projectId;
647
- this.baseUrl = descopeConfig.baseUrl;
648
- this.baseStaticUrl = descopeConfig.baseStaticUrl;
649
- }
650
- ngOnInit() {
651
- this.setupWebComponent();
652
- this.elementRef.nativeElement.appendChild(this.webComponent);
653
- }
654
- ngOnChanges() {
655
- this.setupWebComponent();
656
- }
657
- setupWebComponent() {
658
- this.webComponent.setAttribute('project-id', this.projectId);
659
- this.webComponent.setAttribute('tenant', this.tenant);
660
- this.webComponent.setAttribute('widget-id', this.widgetId);
661
- if (this.baseUrl) {
662
- this.webComponent.setAttribute('base-url', this.baseUrl);
663
- }
664
- if (this.baseStaticUrl) {
665
- this.webComponent.setAttribute('base-static-url', this.baseStaticUrl);
666
- }
667
- if (this.theme) {
668
- this.webComponent.setAttribute('theme', this.theme);
669
- }
670
- if (this.debug) {
671
- this.webComponent.setAttribute('debug', this.debug.toString());
672
- }
673
- if (this.logger) {
674
- this.webComponent.logger = this.logger;
675
- }
676
- }
677
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.9", ngImport: i0, type: AccessKeyManagementComponent, deps: [{ token: i0.ElementRef }, { token: DescopeAuthConfig }], target: i0.ɵɵFactoryTarget.Component }); }
678
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.9", type: AccessKeyManagementComponent, isStandalone: true, selector: "access-key-management[tenant]", inputs: { tenant: "tenant", widgetId: "widgetId", theme: "theme", debug: "debug", logger: "logger" }, usesOnChanges: true, ngImport: i0, template: '', isInline: true }); }
679
- }
680
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.9", ngImport: i0, type: AccessKeyManagementComponent, decorators: [{
681
- type: Component,
682
- args: [{
683
- selector: 'access-key-management[tenant]',
684
- standalone: true,
685
- template: ''
686
- }]
687
- }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: DescopeAuthConfig }]; }, propDecorators: { tenant: [{
688
- type: Input
689
- }], widgetId: [{
690
- type: Input
691
- }], theme: [{
692
- type: Input
693
- }], debug: [{
694
- type: Input
695
- }], logger: [{
696
- type: Input
697
- }] } });
698
-
699
- class AuditManagementComponent {
700
- constructor(elementRef, descopeConfig) {
701
- this.elementRef = elementRef;
702
- this.webComponent = new DescopeAuditManagementWidget();
703
- this.projectId = descopeConfig.projectId;
704
- this.baseUrl = descopeConfig.baseUrl;
705
- this.baseStaticUrl = descopeConfig.baseStaticUrl;
706
- }
707
- ngOnInit() {
708
- this.setupWebComponent();
709
- this.elementRef.nativeElement.appendChild(this.webComponent);
710
- }
711
- ngOnChanges() {
712
- this.setupWebComponent();
713
- }
714
- setupWebComponent() {
715
- this.webComponent.setAttribute('project-id', this.projectId);
716
- this.webComponent.setAttribute('tenant', this.tenant);
717
- this.webComponent.setAttribute('widget-id', this.widgetId);
718
- if (this.baseUrl) {
719
- this.webComponent.setAttribute('base-url', this.baseUrl);
720
- }
721
- if (this.baseStaticUrl) {
722
- this.webComponent.setAttribute('base-static-url', this.baseStaticUrl);
723
- }
724
- if (this.theme) {
725
- this.webComponent.setAttribute('theme', this.theme);
726
- }
727
- if (this.debug) {
728
- this.webComponent.setAttribute('debug', this.debug.toString());
729
- }
730
- if (this.logger) {
731
- this.webComponent.logger = this.logger;
732
- }
733
- }
734
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.9", ngImport: i0, type: AuditManagementComponent, deps: [{ token: i0.ElementRef }, { token: DescopeAuthConfig }], target: i0.ɵɵFactoryTarget.Component }); }
735
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.9", type: AuditManagementComponent, isStandalone: true, selector: "audit-management[tenant]", inputs: { tenant: "tenant", widgetId: "widgetId", theme: "theme", debug: "debug", logger: "logger" }, usesOnChanges: true, ngImport: i0, template: '', isInline: true }); }
736
- }
737
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.9", ngImport: i0, type: AuditManagementComponent, decorators: [{
738
- type: Component,
739
- args: [{
740
- selector: 'audit-management[tenant]',
741
- standalone: true,
742
- template: ''
743
- }]
744
- }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: DescopeAuthConfig }]; }, propDecorators: { tenant: [{
745
- type: Input
746
- }], widgetId: [{
747
- type: Input
748
- }], theme: [{
749
- type: Input
750
- }], debug: [{
751
- type: Input
752
- }], logger: [{
753
- type: Input
754
- }] } });
755
-
756
- class UserProfileComponent {
757
- constructor(elementRef, descopeConfig) {
758
- this.elementRef = elementRef;
759
- this.logout = new EventEmitter();
760
- this.webComponent = new DescopeUserProfileWidget();
761
- this.projectId = descopeConfig.projectId;
762
- this.baseUrl = descopeConfig.baseUrl;
763
- this.baseStaticUrl = descopeConfig.baseStaticUrl;
764
- }
765
- ngOnInit() {
766
- this.setupWebComponent();
767
- this.elementRef.nativeElement.appendChild(this.webComponent);
768
- }
769
- ngOnChanges() {
770
- this.setupWebComponent();
771
- }
772
- setupWebComponent() {
773
- this.webComponent.setAttribute('project-id', this.projectId);
774
- this.webComponent.setAttribute('widget-id', this.widgetId);
775
- if (this.baseUrl) {
776
- this.webComponent.setAttribute('base-url', this.baseUrl);
777
- }
778
- if (this.baseStaticUrl) {
779
- this.webComponent.setAttribute('base-static-url', this.baseStaticUrl);
780
- }
781
- if (this.theme) {
782
- this.webComponent.setAttribute('theme', this.theme);
783
- }
784
- if (this.debug) {
785
- this.webComponent.setAttribute('debug', this.debug.toString());
786
- }
787
- if (this.logger) {
788
- this.webComponent.logger = this.logger;
789
- }
790
- if (this.logout) {
791
- this.webComponent.addEventListener('logout', (e) => {
792
- this.logout?.emit(e);
793
- });
794
- }
795
- }
796
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.9", ngImport: i0, type: UserProfileComponent, deps: [{ token: i0.ElementRef }, { token: DescopeAuthConfig }], target: i0.ɵɵFactoryTarget.Component }); }
797
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.9", type: UserProfileComponent, isStandalone: true, selector: "user-profile", inputs: { widgetId: "widgetId", theme: "theme", debug: "debug", logger: "logger" }, outputs: { logout: "logout" }, usesOnChanges: true, ngImport: i0, template: '', isInline: true }); }
798
- }
799
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.9", ngImport: i0, type: UserProfileComponent, decorators: [{
800
- type: Component,
801
- args: [{
802
- selector: 'user-profile',
803
- standalone: true,
804
- template: ''
805
- }]
806
- }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: DescopeAuthConfig }]; }, propDecorators: { widgetId: [{
807
- type: Input
808
- }], theme: [{
809
- type: Input
810
- }], debug: [{
811
- type: Input
812
- }], logger: [{
813
- type: Input
814
- }], logout: [{
815
- type: Output
816
- }] } });
817
-
818
- class DescopeAuthModule {
819
- constructor(parentModule) {
820
- if (parentModule) {
821
- throw new Error('DescopeAuthModule is already loaded. Import it only once');
822
- }
823
- }
824
- static forRoot(config) {
825
- return {
826
- ngModule: DescopeAuthModule,
827
- providers: [{ provide: DescopeAuthConfig, useValue: config }]
828
- };
829
- }
830
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.9", ngImport: i0, type: DescopeAuthModule, deps: [{ token: DescopeAuthModule, optional: true, skipSelf: true }], target: i0.ɵɵFactoryTarget.NgModule }); }
831
- static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.9", ngImport: i0, type: DescopeAuthModule, imports: [DescopeComponent,
832
- SignInFlowComponent,
833
- SignUpFlowComponent,
834
- SignUpOrInFlowComponent,
835
- UserManagementComponent,
836
- RoleManagementComponent,
837
- AccessKeyManagementComponent,
838
- AuditManagementComponent,
839
- UserProfileComponent], exports: [DescopeComponent,
840
- SignInFlowComponent,
841
- SignUpFlowComponent,
842
- SignUpOrInFlowComponent,
843
- UserManagementComponent,
844
- RoleManagementComponent,
845
- AccessKeyManagementComponent,
846
- AuditManagementComponent,
847
- UserProfileComponent] }); }
848
- static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.9", ngImport: i0, type: DescopeAuthModule }); }
849
- }
850
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.9", ngImport: i0, type: DescopeAuthModule, decorators: [{
851
- type: NgModule,
852
- args: [{
853
- schemas: [CUSTOM_ELEMENTS_SCHEMA],
854
- imports: [
855
- DescopeComponent,
856
- SignInFlowComponent,
857
- SignUpFlowComponent,
858
- SignUpOrInFlowComponent,
859
- UserManagementComponent,
860
- RoleManagementComponent,
861
- AccessKeyManagementComponent,
862
- AuditManagementComponent,
863
- UserProfileComponent
864
- ],
865
- exports: [
866
- DescopeComponent,
867
- SignInFlowComponent,
868
- SignUpFlowComponent,
869
- SignUpOrInFlowComponent,
870
- UserManagementComponent,
871
- RoleManagementComponent,
872
- AccessKeyManagementComponent,
873
- AuditManagementComponent,
874
- UserProfileComponent
875
- ]
876
- }]
877
- }], ctorParameters: function () { return [{ type: DescopeAuthModule, decorators: [{
878
- type: Optional
879
- }, {
880
- type: SkipSelf
881
- }] }]; } });
882
-
883
- /*
884
- * Public API Surface of angular-sdk
885
- */
886
-
887
- /**
888
- * Generated bundle index. Do not edit.
889
- */
890
-
891
- export { AccessKeyManagementComponent, AuditManagementComponent, DescopeAuthConfig, DescopeAuthModule, DescopeAuthService, DescopeComponent, RoleManagementComponent, SignInFlowComponent, SignUpFlowComponent, SignUpOrInFlowComponent, UserManagementComponent, UserProfileComponent, descopeAuthGuard, descopeInterceptor };
892
- //# sourceMappingURL=descope-angular-sdk.mjs.map