@descope/angular-sdk 0.22.2 → 0.23.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.
Files changed (31) hide show
  1. package/README.md +1 -1
  2. package/dist/esm2022/environment.mjs +2 -2
  3. package/dist/esm2022/lib/base/base-lazy-widget.component.mjs +50 -0
  4. package/dist/esm2022/lib/components/access-key-management/access-key-management.component.mjs +28 -20
  5. package/dist/esm2022/lib/components/applications-portal/applications-portal.component.mjs +28 -20
  6. package/dist/esm2022/lib/components/audit-management/audit-management.component.mjs +28 -20
  7. package/dist/esm2022/lib/components/descope/descope.component.mjs +54 -29
  8. package/dist/esm2022/lib/components/role-management/role-management.component.mjs +28 -20
  9. package/dist/esm2022/lib/components/sign-in-flow/sign-in-flow.component.mjs +4 -4
  10. package/dist/esm2022/lib/components/sign-up-flow/sign-up-flow.component.mjs +4 -4
  11. package/dist/esm2022/lib/components/sign-up-or-in-flow/sign-up-or-in-flow.component.mjs +4 -4
  12. package/dist/esm2022/lib/components/user-management/user-management.component.mjs +28 -20
  13. package/dist/esm2022/lib/components/user-profile/user-profile.component.mjs +28 -20
  14. package/dist/esm2022/lib/descope-auth.module.mjs +5 -5
  15. package/dist/esm2022/lib/services/descope-auth.service.mjs +4 -4
  16. package/dist/esm2022/lib/types/types.mjs +1 -1
  17. package/dist/fesm2022/descope-angular-sdk.mjs +266 -152
  18. package/dist/fesm2022/descope-angular-sdk.mjs.map +1 -1
  19. package/dist/lib/base/base-lazy-widget.component.d.ts +45 -0
  20. package/dist/lib/components/access-key-management/access-key-management.component.d.ts +8 -12
  21. package/dist/lib/components/applications-portal/applications-portal.component.d.ts +8 -12
  22. package/dist/lib/components/audit-management/audit-management.component.d.ts +8 -12
  23. package/dist/lib/components/descope/descope.component.d.ts +7 -4
  24. package/dist/lib/components/role-management/role-management.component.d.ts +8 -12
  25. package/dist/lib/components/sign-in-flow/sign-in-flow.component.d.ts +1 -2
  26. package/dist/lib/components/sign-up-flow/sign-up-flow.component.d.ts +1 -2
  27. package/dist/lib/components/sign-up-or-in-flow/sign-up-or-in-flow.component.d.ts +1 -2
  28. package/dist/lib/components/user-management/user-management.component.d.ts +8 -12
  29. package/dist/lib/components/user-profile/user-profile.component.d.ts +8 -12
  30. package/dist/lib/types/types.d.ts +1 -2
  31. package/package.json +12 -12
@@ -1,16 +1,10 @@
1
1
  import * as i0 from '@angular/core';
2
- import { Injectable, inject, EventEmitter, Component, CUSTOM_ELEMENTS_SCHEMA, ViewChild, Input, Output, NgModule, Optional, SkipSelf } from '@angular/core';
2
+ import { Injectable, inject, EventEmitter, PLATFORM_ID, Component, CUSTOM_ELEMENTS_SCHEMA, Inject, ViewChild, Input, Output, Directive, NgModule, Optional, SkipSelf } from '@angular/core';
3
3
  import createSdk from '@descope/web-js-sdk';
4
4
  import { from, BehaviorSubject, finalize, tap, of, throwError } from 'rxjs';
5
5
  import { Router } from '@angular/router';
6
6
  import { switchMap, catchError } from 'rxjs/operators';
7
- import DescopeWc 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
- import DescopeApplicationsPortalWidget from '@descope/applications-portal-widget';
7
+ import { isPlatformBrowser } from '@angular/common';
14
8
 
15
9
  function observabilify(value) {
16
10
  /* eslint-disable @typescript-eslint/no-explicit-any */
@@ -39,7 +33,7 @@ function observabilify(value) {
39
33
  }
40
34
 
41
35
  const environment = {
42
- buildVersion: '0.22.2'
36
+ buildVersion: '0.23.0'
43
37
  };
44
38
 
45
39
  const baseHeaders = {
@@ -193,10 +187,10 @@ class DescopeAuthService {
193
187
  claims
194
188
  });
195
189
  }
196
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.4", ngImport: i0, type: DescopeAuthService, deps: [{ token: DescopeAuthConfig }], target: i0.ɵɵFactoryTarget.Injectable }); }
197
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.1.4", ngImport: i0, type: DescopeAuthService, providedIn: 'root' }); }
190
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: DescopeAuthService, deps: [{ token: DescopeAuthConfig }], target: i0.ɵɵFactoryTarget.Injectable }); }
191
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: DescopeAuthService, providedIn: 'root' }); }
198
192
  }
199
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImport: i0, type: DescopeAuthService, decorators: [{
193
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: DescopeAuthService, decorators: [{
200
194
  type: Injectable,
201
195
  args: [{
202
196
  providedIn: 'root'
@@ -288,12 +282,14 @@ class DescopeComponent {
288
282
  return undefined;
289
283
  }
290
284
  }
291
- constructor(elementRef, authService, descopeConfig) {
285
+ constructor(elementRef, authService, descopeConfig, platformId) {
292
286
  this.elementRef = elementRef;
293
287
  this.authService = authService;
288
+ this.platformId = platformId;
294
289
  this.success = new EventEmitter();
295
290
  this.error = new EventEmitter();
296
291
  this.ready = new EventEmitter();
292
+ this.isWebComponentLoaded = false;
297
293
  this.projectId = descopeConfig.projectId;
298
294
  this.baseUrl = descopeConfig.baseUrl;
299
295
  this.baseStaticUrl = descopeConfig.baseStaticUrl;
@@ -301,28 +297,48 @@ class DescopeComponent {
301
297
  this.storeLastAuthenticatedUser = descopeConfig.storeLastAuthenticatedUser;
302
298
  this.customStorage = descopeConfig.customStorage;
303
299
  }
304
- ngOnInit() {
305
- const sdk = this.authService.descopeSdk;
306
- DescopeWc.sdkConfigOverrides = {
307
- // Overrides the web-component's base headers to indicate usage via the React SDK
308
- baseHeaders,
309
- // Disables token persistence within the web-component to delegate token management
310
- // to the global SDK hooks. This ensures token handling aligns with the SDK's configuration,
311
- // and web-component requests leverage the global SDK's beforeRequest hooks for consistency
312
- persistTokens: false,
313
- hooks: {
314
- get beforeRequest() {
315
- // Retrieves the beforeRequest hook from the global SDK, which is initialized
316
- // within the AuthProvider using the desired configuration. This approach ensures
317
- // the web-component utilizes the same beforeRequest hooks as the global SDK
318
- return sdk.httpClient.hooks?.beforeRequest;
319
- },
320
- set beforeRequest(_) {
321
- // The empty setter prevents runtime errors when attempts are made to assign a value to 'beforeRequest'.
322
- // JavaScript objects default to having both getters and setters
300
+ async ngOnInit() {
301
+ // Only load web component in browser environment
302
+ if (!isPlatformBrowser(this.platformId)) {
303
+ return;
304
+ }
305
+ await this.loadWebComponent();
306
+ }
307
+ async loadWebComponent() {
308
+ if (this.isWebComponentLoaded) {
309
+ return;
310
+ }
311
+ try {
312
+ // Dynamically import the web component only in browser context
313
+ const DescopeWcModule = await import('@descope/web-component');
314
+ const DescopeWc = DescopeWcModule.default;
315
+ const sdk = this.authService.descopeSdk;
316
+ DescopeWc.sdkConfigOverrides = {
317
+ // Overrides the web-component's base headers to indicate usage via the Angular SDK
318
+ baseHeaders,
319
+ // Disables token persistence within the web-component to delegate token management
320
+ // to the global SDK hooks. This ensures token handling aligns with the SDK's configuration,
321
+ // and web-component requests leverage the global SDK's beforeRequest hooks for consistency
322
+ persistTokens: false,
323
+ hooks: {
324
+ get beforeRequest() {
325
+ // Retrieves the beforeRequest hook from the global SDK, which is initialized
326
+ // within the AuthProvider using the desired configuration. This approach ensures
327
+ // the web-component utilizes the same beforeRequest hooks as the global SDK
328
+ return sdk.httpClient.hooks?.beforeRequest;
329
+ },
330
+ set beforeRequest(_) {
331
+ // The empty setter prevents runtime errors when attempts are made to assign a value to 'beforeRequest'.
332
+ // JavaScript objects default to having both getters and setters
333
+ }
323
334
  }
324
- }
325
- };
335
+ };
336
+ this.isWebComponentLoaded = true;
337
+ }
338
+ catch (error) {
339
+ // eslint-disable-next-line no-console
340
+ console.error('Failed to load Descope web component:', error);
341
+ }
326
342
  }
327
343
  ngAfterViewInit() {
328
344
  if (!this.descopeWc?.nativeElement)
@@ -373,8 +389,8 @@ class DescopeComponent {
373
389
  });
374
390
  }
375
391
  }
376
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.4", ngImport: i0, type: DescopeComponent, deps: [{ token: i0.ElementRef }, { token: DescopeAuthService }, { token: DescopeAuthConfig }], target: i0.ɵɵFactoryTarget.Component }); }
377
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.1.4", type: DescopeComponent, isStandalone: true, selector: "descope[flowId]", inputs: { flowId: "flowId", locale: "locale", theme: "theme", tenant: "tenant", telemetryKey: "telemetryKey", redirectUrl: "redirectUrl", autoFocus: "autoFocus", validateOnBlur: "validateOnBlur", restartOnError: "restartOnError", debug: "debug", errorTransformer: "errorTransformer", onScreenUpdate: "onScreenUpdate", client: "client", nonce: "nonce", dismissScreenErrorOnInput: "dismissScreenErrorOnInput", form: "form", logger: "logger", styleId: "styleId", popupOrigin: "popupOrigin" }, outputs: { success: "success", error: "error", ready: "ready" }, viewQueries: [{ propertyName: "descopeWc", first: true, predicate: ["descopeWc"], descendants: true }], usesOnChanges: true, ngImport: i0, template: `
392
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: DescopeComponent, deps: [{ token: i0.ElementRef }, { token: DescopeAuthService }, { token: DescopeAuthConfig }, { token: PLATFORM_ID }], target: i0.ɵɵFactoryTarget.Component }); }
393
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.17", type: DescopeComponent, isStandalone: true, selector: "descope[flowId]", inputs: { flowId: "flowId", locale: "locale", theme: "theme", tenant: "tenant", telemetryKey: "telemetryKey", redirectUrl: "redirectUrl", autoFocus: "autoFocus", validateOnBlur: "validateOnBlur", restartOnError: "restartOnError", debug: "debug", errorTransformer: "errorTransformer", onScreenUpdate: "onScreenUpdate", client: "client", nonce: "nonce", dismissScreenErrorOnInput: "dismissScreenErrorOnInput", form: "form", logger: "logger", styleId: "styleId", popupOrigin: "popupOrigin" }, outputs: { success: "success", error: "error", ready: "ready" }, viewQueries: [{ propertyName: "descopeWc", first: true, predicate: ["descopeWc"], descendants: true }], usesOnChanges: true, ngImport: i0, template: `
378
394
  <descope-wc
379
395
  #descopeWc
380
396
  [attr.project-id]="projectId"
@@ -404,7 +420,7 @@ class DescopeComponent {
404
420
  </descope-wc>
405
421
  `, isInline: true }); }
406
422
  }
407
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImport: i0, type: DescopeComponent, decorators: [{
423
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: DescopeComponent, decorators: [{
408
424
  type: Component,
409
425
  args: [{
410
426
  selector: 'descope[flowId]',
@@ -440,7 +456,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImpor
440
456
  </descope-wc>
441
457
  `
442
458
  }]
443
- }], ctorParameters: () => [{ type: i0.ElementRef }, { type: DescopeAuthService }, { type: DescopeAuthConfig }], propDecorators: { descopeWc: [{
459
+ }], ctorParameters: () => [{ type: i0.ElementRef }, { type: DescopeAuthService }, { type: DescopeAuthConfig }, { type: undefined, decorators: [{
460
+ type: Inject,
461
+ args: [PLATFORM_ID]
462
+ }] }], propDecorators: { descopeWc: [{
444
463
  type: ViewChild,
445
464
  args: ['descopeWc']
446
465
  }], flowId: [{
@@ -495,10 +514,10 @@ class SignInFlowComponent {
495
514
  this.error = new EventEmitter();
496
515
  this.projectId = descopeConfig.projectId;
497
516
  }
498
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.4", ngImport: i0, type: SignInFlowComponent, deps: [{ token: DescopeAuthConfig }], target: i0.ɵɵFactoryTarget.Component }); }
499
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.1.4", type: SignInFlowComponent, isStandalone: true, selector: "descope-sign-in-flow", inputs: { locale: "locale", theme: "theme", tenant: "tenant", telemetryKey: "telemetryKey", redirectUrl: "redirectUrl", autoFocus: "autoFocus", validateOnBlur: "validateOnBlur", restartOnError: "restartOnError", debug: "debug", errorTransformer: "errorTransformer", onScreenUpdate: "onScreenUpdate", client: "client", nonce: "nonce", dismissScreenErrorOnInput: "dismissScreenErrorOnInput", form: "form", logger: "logger", styleId: "styleId" }, outputs: { success: "success", error: "error" }, ngImport: i0, template: "<descope\n (success)=\"success.emit($event)\"\n (error)=\"error.emit($event)\"\n flowId=\"sign-in\"\n [locale]=\"locale\"\n [theme]=\"theme\"\n [tenant]=\"tenant\"\n [telemetryKey]=\"telemetryKey\"\n [redirectUrl]=\"redirectUrl\"\n [autoFocus]=\"autoFocus\"\n [validateOnBlur]=\"validateOnBlur\"\n [restartOnError]=\"restartOnError\"\n [debug]=\"debug\"\n [errorTransformer]=\"errorTransformer\"\n [onScreenUpdate]=\"onScreenUpdate\"\n [client]=\"client\"\n [nonce]=\"nonce\"\n [dismissScreenErrorOnInput]=\"dismissScreenErrorOnInput\"\n [form]=\"form\"\n [logger]=\"logger\"\n [styleId]=\"styleId\"\n>\n</descope>\n", dependencies: [{ kind: "component", type: DescopeComponent, selector: "descope[flowId]", inputs: ["flowId", "locale", "theme", "tenant", "telemetryKey", "redirectUrl", "autoFocus", "validateOnBlur", "restartOnError", "debug", "errorTransformer", "onScreenUpdate", "client", "nonce", "dismissScreenErrorOnInput", "form", "logger", "styleId", "popupOrigin"], outputs: ["success", "error", "ready"] }] }); }
517
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: SignInFlowComponent, deps: [{ token: DescopeAuthConfig }], target: i0.ɵɵFactoryTarget.Component }); }
518
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.17", type: SignInFlowComponent, isStandalone: true, selector: "descope-sign-in-flow", inputs: { locale: "locale", theme: "theme", tenant: "tenant", telemetryKey: "telemetryKey", redirectUrl: "redirectUrl", autoFocus: "autoFocus", validateOnBlur: "validateOnBlur", restartOnError: "restartOnError", debug: "debug", errorTransformer: "errorTransformer", onScreenUpdate: "onScreenUpdate", client: "client", nonce: "nonce", dismissScreenErrorOnInput: "dismissScreenErrorOnInput", form: "form", logger: "logger", styleId: "styleId" }, outputs: { success: "success", error: "error" }, ngImport: i0, template: "<descope\n (success)=\"success.emit($event)\"\n (error)=\"error.emit($event)\"\n flowId=\"sign-in\"\n [locale]=\"locale\"\n [theme]=\"theme\"\n [tenant]=\"tenant\"\n [telemetryKey]=\"telemetryKey\"\n [redirectUrl]=\"redirectUrl\"\n [autoFocus]=\"autoFocus\"\n [validateOnBlur]=\"validateOnBlur\"\n [restartOnError]=\"restartOnError\"\n [debug]=\"debug\"\n [errorTransformer]=\"errorTransformer\"\n [onScreenUpdate]=\"onScreenUpdate\"\n [client]=\"client\"\n [nonce]=\"nonce\"\n [dismissScreenErrorOnInput]=\"dismissScreenErrorOnInput\"\n [form]=\"form\"\n [logger]=\"logger\"\n [styleId]=\"styleId\"\n>\n</descope>\n", dependencies: [{ kind: "component", type: DescopeComponent, selector: "descope[flowId]", inputs: ["flowId", "locale", "theme", "tenant", "telemetryKey", "redirectUrl", "autoFocus", "validateOnBlur", "restartOnError", "debug", "errorTransformer", "onScreenUpdate", "client", "nonce", "dismissScreenErrorOnInput", "form", "logger", "styleId", "popupOrigin"], outputs: ["success", "error", "ready"] }] }); }
500
519
  }
501
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImport: i0, type: SignInFlowComponent, decorators: [{
520
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: SignInFlowComponent, decorators: [{
502
521
  type: Component,
503
522
  args: [{ selector: 'descope-sign-in-flow', standalone: true, imports: [DescopeComponent], schemas: [CUSTOM_ELEMENTS_SCHEMA], template: "<descope\n (success)=\"success.emit($event)\"\n (error)=\"error.emit($event)\"\n flowId=\"sign-in\"\n [locale]=\"locale\"\n [theme]=\"theme\"\n [tenant]=\"tenant\"\n [telemetryKey]=\"telemetryKey\"\n [redirectUrl]=\"redirectUrl\"\n [autoFocus]=\"autoFocus\"\n [validateOnBlur]=\"validateOnBlur\"\n [restartOnError]=\"restartOnError\"\n [debug]=\"debug\"\n [errorTransformer]=\"errorTransformer\"\n [onScreenUpdate]=\"onScreenUpdate\"\n [client]=\"client\"\n [nonce]=\"nonce\"\n [dismissScreenErrorOnInput]=\"dismissScreenErrorOnInput\"\n [form]=\"form\"\n [logger]=\"logger\"\n [styleId]=\"styleId\"\n>\n</descope>\n" }]
504
523
  }], ctorParameters: () => [{ type: DescopeAuthConfig }], propDecorators: { locale: [{
@@ -547,10 +566,10 @@ class SignUpFlowComponent {
547
566
  this.error = new EventEmitter();
548
567
  this.projectId = descopeConfig.projectId;
549
568
  }
550
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.4", ngImport: i0, type: SignUpFlowComponent, deps: [{ token: DescopeAuthConfig }], target: i0.ɵɵFactoryTarget.Component }); }
551
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.1.4", type: SignUpFlowComponent, isStandalone: true, selector: "descope-sign-up-flow", inputs: { locale: "locale", theme: "theme", tenant: "tenant", telemetryKey: "telemetryKey", redirectUrl: "redirectUrl", autoFocus: "autoFocus", validateOnBlur: "validateOnBlur", restartOnError: "restartOnError", debug: "debug", errorTransformer: "errorTransformer", onScreenUpdate: "onScreenUpdate", client: "client", nonce: "nonce", dismissScreenErrorOnInput: "dismissScreenErrorOnInput", form: "form", logger: "logger", styleId: "styleId" }, outputs: { success: "success", error: "error" }, ngImport: i0, template: "<descope\n (success)=\"success.emit($event)\"\n (error)=\"error.emit($event)\"\n flowId=\"sign-up\"\n [locale]=\"locale\"\n [theme]=\"theme\"\n [tenant]=\"tenant\"\n [telemetryKey]=\"telemetryKey\"\n [redirectUrl]=\"redirectUrl\"\n [autoFocus]=\"autoFocus\"\n [validateOnBlur]=\"validateOnBlur\"\n [restartOnError]=\"restartOnError\"\n [debug]=\"debug\"\n [errorTransformer]=\"errorTransformer\"\n [onScreenUpdate]=\"onScreenUpdate\"\n [client]=\"client\"\n [nonce]=\"nonce\"\n [dismissScreenErrorOnInput]=\"dismissScreenErrorOnInput\"\n [form]=\"form\"\n [logger]=\"logger\"\n [styleId]=\"styleId\"\n>\n</descope>\n", dependencies: [{ kind: "component", type: DescopeComponent, selector: "descope[flowId]", inputs: ["flowId", "locale", "theme", "tenant", "telemetryKey", "redirectUrl", "autoFocus", "validateOnBlur", "restartOnError", "debug", "errorTransformer", "onScreenUpdate", "client", "nonce", "dismissScreenErrorOnInput", "form", "logger", "styleId", "popupOrigin"], outputs: ["success", "error", "ready"] }] }); }
569
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: SignUpFlowComponent, deps: [{ token: DescopeAuthConfig }], target: i0.ɵɵFactoryTarget.Component }); }
570
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.17", type: SignUpFlowComponent, isStandalone: true, selector: "descope-sign-up-flow", inputs: { locale: "locale", theme: "theme", tenant: "tenant", telemetryKey: "telemetryKey", redirectUrl: "redirectUrl", autoFocus: "autoFocus", validateOnBlur: "validateOnBlur", restartOnError: "restartOnError", debug: "debug", errorTransformer: "errorTransformer", onScreenUpdate: "onScreenUpdate", client: "client", nonce: "nonce", dismissScreenErrorOnInput: "dismissScreenErrorOnInput", form: "form", logger: "logger", styleId: "styleId" }, outputs: { success: "success", error: "error" }, ngImport: i0, template: "<descope\n (success)=\"success.emit($event)\"\n (error)=\"error.emit($event)\"\n flowId=\"sign-up\"\n [locale]=\"locale\"\n [theme]=\"theme\"\n [tenant]=\"tenant\"\n [telemetryKey]=\"telemetryKey\"\n [redirectUrl]=\"redirectUrl\"\n [autoFocus]=\"autoFocus\"\n [validateOnBlur]=\"validateOnBlur\"\n [restartOnError]=\"restartOnError\"\n [debug]=\"debug\"\n [errorTransformer]=\"errorTransformer\"\n [onScreenUpdate]=\"onScreenUpdate\"\n [client]=\"client\"\n [nonce]=\"nonce\"\n [dismissScreenErrorOnInput]=\"dismissScreenErrorOnInput\"\n [form]=\"form\"\n [logger]=\"logger\"\n [styleId]=\"styleId\"\n>\n</descope>\n", dependencies: [{ kind: "component", type: DescopeComponent, selector: "descope[flowId]", inputs: ["flowId", "locale", "theme", "tenant", "telemetryKey", "redirectUrl", "autoFocus", "validateOnBlur", "restartOnError", "debug", "errorTransformer", "onScreenUpdate", "client", "nonce", "dismissScreenErrorOnInput", "form", "logger", "styleId", "popupOrigin"], outputs: ["success", "error", "ready"] }] }); }
552
571
  }
553
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImport: i0, type: SignUpFlowComponent, decorators: [{
572
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: SignUpFlowComponent, decorators: [{
554
573
  type: Component,
555
574
  args: [{ selector: 'descope-sign-up-flow', standalone: true, imports: [DescopeComponent], schemas: [CUSTOM_ELEMENTS_SCHEMA], template: "<descope\n (success)=\"success.emit($event)\"\n (error)=\"error.emit($event)\"\n flowId=\"sign-up\"\n [locale]=\"locale\"\n [theme]=\"theme\"\n [tenant]=\"tenant\"\n [telemetryKey]=\"telemetryKey\"\n [redirectUrl]=\"redirectUrl\"\n [autoFocus]=\"autoFocus\"\n [validateOnBlur]=\"validateOnBlur\"\n [restartOnError]=\"restartOnError\"\n [debug]=\"debug\"\n [errorTransformer]=\"errorTransformer\"\n [onScreenUpdate]=\"onScreenUpdate\"\n [client]=\"client\"\n [nonce]=\"nonce\"\n [dismissScreenErrorOnInput]=\"dismissScreenErrorOnInput\"\n [form]=\"form\"\n [logger]=\"logger\"\n [styleId]=\"styleId\"\n>\n</descope>\n" }]
556
575
  }], ctorParameters: () => [{ type: DescopeAuthConfig }], propDecorators: { locale: [{
@@ -599,10 +618,10 @@ class SignUpOrInFlowComponent {
599
618
  this.error = new EventEmitter();
600
619
  this.projectId = descopeConfig.projectId;
601
620
  }
602
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.4", ngImport: i0, type: SignUpOrInFlowComponent, deps: [{ token: DescopeAuthConfig }], target: i0.ɵɵFactoryTarget.Component }); }
603
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.1.4", type: SignUpOrInFlowComponent, isStandalone: true, selector: "descope-sign-up-or-in-flow", inputs: { locale: "locale", theme: "theme", tenant: "tenant", telemetryKey: "telemetryKey", redirectUrl: "redirectUrl", autoFocus: "autoFocus", validateOnBlur: "validateOnBlur", restartOnError: "restartOnError", debug: "debug", errorTransformer: "errorTransformer", onScreenUpdate: "onScreenUpdate", client: "client", nonce: "nonce", dismissScreenErrorOnInput: "dismissScreenErrorOnInput", form: "form", logger: "logger", styleId: "styleId" }, outputs: { success: "success", error: "error" }, ngImport: i0, template: "<descope\n (success)=\"success.emit($event)\"\n (error)=\"error.emit($event)\"\n flowId=\"sign-up-or-in\"\n [locale]=\"locale\"\n [theme]=\"theme\"\n [tenant]=\"tenant\"\n [telemetryKey]=\"telemetryKey\"\n [redirectUrl]=\"redirectUrl\"\n [autoFocus]=\"autoFocus\"\n [validateOnBlur]=\"validateOnBlur\"\n [restartOnError]=\"restartOnError\"\n [debug]=\"debug\"\n [errorTransformer]=\"errorTransformer\"\n [onScreenUpdate]=\"onScreenUpdate\"\n [client]=\"client\"\n [nonce]=\"nonce\"\n [dismissScreenErrorOnInput]=\"dismissScreenErrorOnInput\"\n [form]=\"form\"\n [logger]=\"logger\"\n [styleId]=\"styleId\"\n>\n</descope>\n", dependencies: [{ kind: "component", type: DescopeComponent, selector: "descope[flowId]", inputs: ["flowId", "locale", "theme", "tenant", "telemetryKey", "redirectUrl", "autoFocus", "validateOnBlur", "restartOnError", "debug", "errorTransformer", "onScreenUpdate", "client", "nonce", "dismissScreenErrorOnInput", "form", "logger", "styleId", "popupOrigin"], outputs: ["success", "error", "ready"] }] }); }
621
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: SignUpOrInFlowComponent, deps: [{ token: DescopeAuthConfig }], target: i0.ɵɵFactoryTarget.Component }); }
622
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.17", type: SignUpOrInFlowComponent, isStandalone: true, selector: "descope-sign-up-or-in-flow", inputs: { locale: "locale", theme: "theme", tenant: "tenant", telemetryKey: "telemetryKey", redirectUrl: "redirectUrl", autoFocus: "autoFocus", validateOnBlur: "validateOnBlur", restartOnError: "restartOnError", debug: "debug", errorTransformer: "errorTransformer", onScreenUpdate: "onScreenUpdate", client: "client", nonce: "nonce", dismissScreenErrorOnInput: "dismissScreenErrorOnInput", form: "form", logger: "logger", styleId: "styleId" }, outputs: { success: "success", error: "error" }, ngImport: i0, template: "<descope\n (success)=\"success.emit($event)\"\n (error)=\"error.emit($event)\"\n flowId=\"sign-up-or-in\"\n [locale]=\"locale\"\n [theme]=\"theme\"\n [tenant]=\"tenant\"\n [telemetryKey]=\"telemetryKey\"\n [redirectUrl]=\"redirectUrl\"\n [autoFocus]=\"autoFocus\"\n [validateOnBlur]=\"validateOnBlur\"\n [restartOnError]=\"restartOnError\"\n [debug]=\"debug\"\n [errorTransformer]=\"errorTransformer\"\n [onScreenUpdate]=\"onScreenUpdate\"\n [client]=\"client\"\n [nonce]=\"nonce\"\n [dismissScreenErrorOnInput]=\"dismissScreenErrorOnInput\"\n [form]=\"form\"\n [logger]=\"logger\"\n [styleId]=\"styleId\"\n>\n</descope>\n", dependencies: [{ kind: "component", type: DescopeComponent, selector: "descope[flowId]", inputs: ["flowId", "locale", "theme", "tenant", "telemetryKey", "redirectUrl", "autoFocus", "validateOnBlur", "restartOnError", "debug", "errorTransformer", "onScreenUpdate", "client", "nonce", "dismissScreenErrorOnInput", "form", "logger", "styleId", "popupOrigin"], outputs: ["success", "error", "ready"] }] }); }
604
623
  }
605
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImport: i0, type: SignUpOrInFlowComponent, decorators: [{
624
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: SignUpOrInFlowComponent, decorators: [{
606
625
  type: Component,
607
626
  args: [{ selector: 'descope-sign-up-or-in-flow', standalone: true, imports: [DescopeComponent], schemas: [CUSTOM_ELEMENTS_SCHEMA], template: "<descope\n (success)=\"success.emit($event)\"\n (error)=\"error.emit($event)\"\n flowId=\"sign-up-or-in\"\n [locale]=\"locale\"\n [theme]=\"theme\"\n [tenant]=\"tenant\"\n [telemetryKey]=\"telemetryKey\"\n [redirectUrl]=\"redirectUrl\"\n [autoFocus]=\"autoFocus\"\n [validateOnBlur]=\"validateOnBlur\"\n [restartOnError]=\"restartOnError\"\n [debug]=\"debug\"\n [errorTransformer]=\"errorTransformer\"\n [onScreenUpdate]=\"onScreenUpdate\"\n [client]=\"client\"\n [nonce]=\"nonce\"\n [dismissScreenErrorOnInput]=\"dismissScreenErrorOnInput\"\n [form]=\"form\"\n [logger]=\"logger\"\n [styleId]=\"styleId\"\n>\n</descope>\n" }]
608
627
  }], ctorParameters: () => [{ type: DescopeAuthConfig }], propDecorators: { locale: [{
@@ -645,27 +664,77 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImpor
645
664
  type: Output
646
665
  }] } });
647
666
 
648
- class UserManagementComponent {
649
- constructor(elementRef, descopeConfig) {
667
+ /**
668
+ * Abstract base class for widget components that need to be lazily loaded
669
+ * with SSR support. This class handles the common lifecycle patterns:
670
+ * - Browser detection for SSR compatibility
671
+ * - Lazy loading of widgets
672
+ * - DOM manipulation (appending to element)
673
+ * - Lifecycle coordination between loading, setup, and event listeners
674
+ *
675
+ * Derived components must implement:
676
+ * - loadWidget(): Dynamic import and instantiation of the specific widget
677
+ * - setupWebComponent(): Configure attributes and properties on the widget
678
+ * - setupEventListeners(): Attach event listeners to the widget
679
+ */
680
+ class BaseLazyWidgetComponent {
681
+ constructor(elementRef, platformId) {
650
682
  this.elementRef = elementRef;
683
+ this.platformId = platformId;
684
+ }
685
+ async ngOnInit() {
686
+ // Only load widget in browser environment
687
+ if (!isPlatformBrowser(this.platformId)) {
688
+ return;
689
+ }
690
+ const widget = await this.loadWidget();
691
+ if (widget) {
692
+ this.webComponent = widget;
693
+ this.setupWebComponent();
694
+ this.elementRef.nativeElement.appendChild(this.webComponent);
695
+ // Set up event listeners after the widget is loaded and appended
696
+ this.setupEventListeners();
697
+ }
698
+ }
699
+ ngOnChanges() {
700
+ if (this.webComponent) {
701
+ this.setupWebComponent();
702
+ }
703
+ }
704
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: BaseLazyWidgetComponent, deps: [{ token: i0.ElementRef }, { token: PLATFORM_ID }], target: i0.ɵɵFactoryTarget.Directive }); }
705
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.17", type: BaseLazyWidgetComponent, isStandalone: true, usesOnChanges: true, ngImport: i0 }); }
706
+ }
707
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: BaseLazyWidgetComponent, decorators: [{
708
+ type: Directive
709
+ }], ctorParameters: () => [{ type: i0.ElementRef }, { type: undefined, decorators: [{
710
+ type: Inject,
711
+ args: [PLATFORM_ID]
712
+ }] }] });
713
+
714
+ class UserManagementComponent extends BaseLazyWidgetComponent {
715
+ constructor(elementRef, descopeConfig, platformId) {
716
+ super(elementRef, platformId);
651
717
  this.ready = new EventEmitter();
652
- this.webComponent = new DescopeUserManagementWidget();
653
718
  this.projectId = descopeConfig.projectId;
654
719
  this.baseUrl = descopeConfig.baseUrl;
655
720
  this.baseStaticUrl = descopeConfig.baseStaticUrl;
656
721
  this.baseCdnUrl = descopeConfig.baseCdnUrl;
657
722
  }
658
- ngOnInit() {
659
- this.setupWebComponent();
660
- this.elementRef.nativeElement.appendChild(this.webComponent);
661
- }
662
- ngOnChanges() {
663
- this.setupWebComponent();
664
- }
665
- ngAfterViewInit() {
666
- this.setupEventListeners();
723
+ async loadWidget() {
724
+ try {
725
+ const WidgetModule = await import('@descope/user-management-widget');
726
+ const DescopeUserManagementWidget = WidgetModule.default;
727
+ return new DescopeUserManagementWidget();
728
+ }
729
+ catch (error) {
730
+ // eslint-disable-next-line no-console
731
+ console.error('Failed to load User Management widget:', error);
732
+ return null;
733
+ }
667
734
  }
668
735
  setupWebComponent() {
736
+ if (!this.webComponent)
737
+ return;
669
738
  this.webComponent.setAttribute('project-id', this.projectId);
670
739
  this.webComponent.setAttribute('tenant', this.tenant);
671
740
  this.webComponent.setAttribute('widget-id', this.widgetId);
@@ -692,16 +761,18 @@ class UserManagementComponent {
692
761
  }
693
762
  }
694
763
  setupEventListeners() {
764
+ if (!this.webComponent)
765
+ return;
695
766
  if (this.ready) {
696
767
  this.webComponent.addEventListener('ready', () => {
697
768
  this.ready?.emit();
698
769
  });
699
770
  }
700
771
  }
701
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.4", ngImport: i0, type: UserManagementComponent, deps: [{ token: i0.ElementRef }, { token: DescopeAuthConfig }], target: i0.ɵɵFactoryTarget.Component }); }
702
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.1.4", type: UserManagementComponent, isStandalone: true, selector: "user-management[tenant]", inputs: { tenant: "tenant", widgetId: "widgetId", theme: "theme", debug: "debug", logger: "logger", styleId: "styleId" }, outputs: { ready: "ready" }, usesOnChanges: true, ngImport: i0, template: '', isInline: true }); }
772
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: UserManagementComponent, deps: [{ token: i0.ElementRef }, { token: DescopeAuthConfig }, { token: PLATFORM_ID }], target: i0.ɵɵFactoryTarget.Component }); }
773
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.17", type: UserManagementComponent, isStandalone: true, selector: "user-management[tenant]", inputs: { tenant: "tenant", widgetId: "widgetId", theme: "theme", debug: "debug", logger: "logger", styleId: "styleId" }, outputs: { ready: "ready" }, usesInheritance: true, ngImport: i0, template: '', isInline: true }); }
703
774
  }
704
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImport: i0, type: UserManagementComponent, decorators: [{
775
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: UserManagementComponent, decorators: [{
705
776
  type: Component,
706
777
  args: [{
707
778
  selector: 'user-management[tenant]',
@@ -709,7 +780,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImpor
709
780
  schemas: [CUSTOM_ELEMENTS_SCHEMA],
710
781
  template: ''
711
782
  }]
712
- }], ctorParameters: () => [{ type: i0.ElementRef }, { type: DescopeAuthConfig }], propDecorators: { tenant: [{
783
+ }], ctorParameters: () => [{ type: i0.ElementRef }, { type: DescopeAuthConfig }, { type: undefined, decorators: [{
784
+ type: Inject,
785
+ args: [PLATFORM_ID]
786
+ }] }], propDecorators: { tenant: [{
713
787
  type: Input
714
788
  }], widgetId: [{
715
789
  type: Input
@@ -725,27 +799,30 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImpor
725
799
  type: Output
726
800
  }] } });
727
801
 
728
- class RoleManagementComponent {
729
- constructor(elementRef, descopeConfig) {
730
- this.elementRef = elementRef;
802
+ class RoleManagementComponent extends BaseLazyWidgetComponent {
803
+ constructor(elementRef, descopeConfig, platformId) {
804
+ super(elementRef, platformId);
731
805
  this.ready = new EventEmitter();
732
- this.webComponent = new DescopeRoleManagementWidget();
733
806
  this.projectId = descopeConfig.projectId;
734
807
  this.baseUrl = descopeConfig.baseUrl;
735
808
  this.baseStaticUrl = descopeConfig.baseStaticUrl;
736
809
  this.baseCdnUrl = descopeConfig.baseCdnUrl;
737
810
  }
738
- ngOnInit() {
739
- this.setupWebComponent();
740
- this.elementRef.nativeElement.appendChild(this.webComponent);
741
- }
742
- ngOnChanges() {
743
- this.setupWebComponent();
744
- }
745
- ngAfterViewInit() {
746
- this.setupEventListeners();
811
+ async loadWidget() {
812
+ try {
813
+ const WidgetModule = await import('@descope/role-management-widget');
814
+ const DescopeRoleManagementWidget = WidgetModule.default;
815
+ return new DescopeRoleManagementWidget();
816
+ }
817
+ catch (error) {
818
+ // eslint-disable-next-line no-console
819
+ console.error('Failed to load Role Management widget:', error);
820
+ return null;
821
+ }
747
822
  }
748
823
  setupWebComponent() {
824
+ if (!this.webComponent)
825
+ return;
749
826
  this.webComponent.setAttribute('project-id', this.projectId);
750
827
  this.webComponent.setAttribute('tenant', this.tenant);
751
828
  this.webComponent.setAttribute('widget-id', this.widgetId);
@@ -772,16 +849,18 @@ class RoleManagementComponent {
772
849
  }
773
850
  }
774
851
  setupEventListeners() {
852
+ if (!this.webComponent)
853
+ return;
775
854
  if (this.ready) {
776
855
  this.webComponent.addEventListener('ready', () => {
777
856
  this.ready?.emit();
778
857
  });
779
858
  }
780
859
  }
781
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.4", ngImport: i0, type: RoleManagementComponent, deps: [{ token: i0.ElementRef }, { token: DescopeAuthConfig }], target: i0.ɵɵFactoryTarget.Component }); }
782
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.1.4", type: RoleManagementComponent, isStandalone: true, selector: "role-management[tenant]", inputs: { tenant: "tenant", widgetId: "widgetId", theme: "theme", debug: "debug", logger: "logger", styleId: "styleId" }, outputs: { ready: "ready" }, usesOnChanges: true, ngImport: i0, template: '', isInline: true }); }
860
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: RoleManagementComponent, deps: [{ token: i0.ElementRef }, { token: DescopeAuthConfig }, { token: PLATFORM_ID }], target: i0.ɵɵFactoryTarget.Component }); }
861
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.17", type: RoleManagementComponent, isStandalone: true, selector: "role-management[tenant]", inputs: { tenant: "tenant", widgetId: "widgetId", theme: "theme", debug: "debug", logger: "logger", styleId: "styleId" }, outputs: { ready: "ready" }, usesInheritance: true, ngImport: i0, template: '', isInline: true }); }
783
862
  }
784
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImport: i0, type: RoleManagementComponent, decorators: [{
863
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: RoleManagementComponent, decorators: [{
785
864
  type: Component,
786
865
  args: [{
787
866
  selector: 'role-management[tenant]',
@@ -789,7 +868,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImpor
789
868
  schemas: [CUSTOM_ELEMENTS_SCHEMA],
790
869
  template: ''
791
870
  }]
792
- }], ctorParameters: () => [{ type: i0.ElementRef }, { type: DescopeAuthConfig }], propDecorators: { tenant: [{
871
+ }], ctorParameters: () => [{ type: i0.ElementRef }, { type: DescopeAuthConfig }, { type: undefined, decorators: [{
872
+ type: Inject,
873
+ args: [PLATFORM_ID]
874
+ }] }], propDecorators: { tenant: [{
793
875
  type: Input
794
876
  }], widgetId: [{
795
877
  type: Input
@@ -805,27 +887,30 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImpor
805
887
  type: Output
806
888
  }] } });
807
889
 
808
- class AccessKeyManagementComponent {
809
- constructor(elementRef, descopeConfig) {
810
- this.elementRef = elementRef;
890
+ class AccessKeyManagementComponent extends BaseLazyWidgetComponent {
891
+ constructor(elementRef, descopeConfig, platformId) {
892
+ super(elementRef, platformId);
811
893
  this.ready = new EventEmitter();
812
- this.webComponent = new DescopeAccessKeyManagementWidget();
813
894
  this.projectId = descopeConfig.projectId;
814
895
  this.baseUrl = descopeConfig.baseUrl;
815
896
  this.baseStaticUrl = descopeConfig.baseStaticUrl;
816
897
  this.baseCdnUrl = descopeConfig.baseCdnUrl;
817
898
  }
818
- ngOnInit() {
819
- this.setupWebComponent();
820
- this.elementRef.nativeElement.appendChild(this.webComponent);
821
- }
822
- ngOnChanges() {
823
- this.setupWebComponent();
824
- }
825
- ngAfterViewInit() {
826
- this.setupEventListeners();
899
+ async loadWidget() {
900
+ try {
901
+ const WidgetModule = await import('@descope/access-key-management-widget');
902
+ const DescopeAccessKeyManagementWidget = WidgetModule.default;
903
+ return new DescopeAccessKeyManagementWidget();
904
+ }
905
+ catch (error) {
906
+ // eslint-disable-next-line no-console
907
+ console.error('Failed to load Access Key Management widget:', error);
908
+ return null;
909
+ }
827
910
  }
828
911
  setupWebComponent() {
912
+ if (!this.webComponent)
913
+ return;
829
914
  this.webComponent.setAttribute('project-id', this.projectId);
830
915
  this.webComponent.setAttribute('tenant', this.tenant);
831
916
  this.webComponent.setAttribute('widget-id', this.widgetId);
@@ -849,16 +934,18 @@ class AccessKeyManagementComponent {
849
934
  }
850
935
  }
851
936
  setupEventListeners() {
937
+ if (!this.webComponent)
938
+ return;
852
939
  if (this.ready) {
853
940
  this.webComponent.addEventListener('ready', () => {
854
941
  this.ready?.emit();
855
942
  });
856
943
  }
857
944
  }
858
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.4", ngImport: i0, type: AccessKeyManagementComponent, deps: [{ token: i0.ElementRef }, { token: DescopeAuthConfig }], target: i0.ɵɵFactoryTarget.Component }); }
859
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.1.4", type: AccessKeyManagementComponent, isStandalone: true, selector: "access-key-management[tenant]", inputs: { tenant: "tenant", widgetId: "widgetId", theme: "theme", debug: "debug", logger: "logger", styleId: "styleId" }, outputs: { ready: "ready" }, usesOnChanges: true, ngImport: i0, template: '', isInline: true }); }
945
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: AccessKeyManagementComponent, deps: [{ token: i0.ElementRef }, { token: DescopeAuthConfig }, { token: PLATFORM_ID }], target: i0.ɵɵFactoryTarget.Component }); }
946
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.17", type: AccessKeyManagementComponent, isStandalone: true, selector: "access-key-management[tenant]", inputs: { tenant: "tenant", widgetId: "widgetId", theme: "theme", debug: "debug", logger: "logger", styleId: "styleId" }, outputs: { ready: "ready" }, usesInheritance: true, ngImport: i0, template: '', isInline: true }); }
860
947
  }
861
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImport: i0, type: AccessKeyManagementComponent, decorators: [{
948
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: AccessKeyManagementComponent, decorators: [{
862
949
  type: Component,
863
950
  args: [{
864
951
  selector: 'access-key-management[tenant]',
@@ -866,7 +953,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImpor
866
953
  schemas: [CUSTOM_ELEMENTS_SCHEMA],
867
954
  template: ''
868
955
  }]
869
- }], ctorParameters: () => [{ type: i0.ElementRef }, { type: DescopeAuthConfig }], propDecorators: { tenant: [{
956
+ }], ctorParameters: () => [{ type: i0.ElementRef }, { type: DescopeAuthConfig }, { type: undefined, decorators: [{
957
+ type: Inject,
958
+ args: [PLATFORM_ID]
959
+ }] }], propDecorators: { tenant: [{
870
960
  type: Input
871
961
  }], widgetId: [{
872
962
  type: Input
@@ -882,27 +972,30 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImpor
882
972
  type: Output
883
973
  }] } });
884
974
 
885
- class AuditManagementComponent {
886
- constructor(elementRef, descopeConfig) {
887
- this.elementRef = elementRef;
975
+ class AuditManagementComponent extends BaseLazyWidgetComponent {
976
+ constructor(elementRef, descopeConfig, platformId) {
977
+ super(elementRef, platformId);
888
978
  this.ready = new EventEmitter();
889
- this.webComponent = new DescopeAuditManagementWidget();
890
979
  this.projectId = descopeConfig.projectId;
891
980
  this.baseUrl = descopeConfig.baseUrl;
892
981
  this.baseStaticUrl = descopeConfig.baseStaticUrl;
893
982
  this.baseCdnUrl = descopeConfig.baseCdnUrl;
894
983
  }
895
- ngOnInit() {
896
- this.setupWebComponent();
897
- this.elementRef.nativeElement.appendChild(this.webComponent);
898
- }
899
- ngOnChanges() {
900
- this.setupWebComponent();
901
- }
902
- ngAfterViewInit() {
903
- this.setupEventListeners();
984
+ async loadWidget() {
985
+ try {
986
+ const WidgetModule = await import('@descope/audit-management-widget');
987
+ const DescopeAuditManagementWidget = WidgetModule.default;
988
+ return new DescopeAuditManagementWidget();
989
+ }
990
+ catch (error) {
991
+ // eslint-disable-next-line no-console
992
+ console.error('Failed to load Audit Management widget:', error);
993
+ return null;
994
+ }
904
995
  }
905
996
  setupWebComponent() {
997
+ if (!this.webComponent)
998
+ return;
906
999
  this.webComponent.setAttribute('project-id', this.projectId);
907
1000
  this.webComponent.setAttribute('tenant', this.tenant);
908
1001
  this.webComponent.setAttribute('widget-id', this.widgetId);
@@ -929,16 +1022,18 @@ class AuditManagementComponent {
929
1022
  }
930
1023
  }
931
1024
  setupEventListeners() {
1025
+ if (!this.webComponent)
1026
+ return;
932
1027
  if (this.ready) {
933
1028
  this.webComponent.addEventListener('ready', () => {
934
1029
  this.ready?.emit();
935
1030
  });
936
1031
  }
937
1032
  }
938
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.4", ngImport: i0, type: AuditManagementComponent, deps: [{ token: i0.ElementRef }, { token: DescopeAuthConfig }], target: i0.ɵɵFactoryTarget.Component }); }
939
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.1.4", type: AuditManagementComponent, isStandalone: true, selector: "audit-management[tenant]", inputs: { tenant: "tenant", widgetId: "widgetId", theme: "theme", debug: "debug", logger: "logger", styleId: "styleId" }, outputs: { ready: "ready" }, usesOnChanges: true, ngImport: i0, template: '', isInline: true }); }
1033
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: AuditManagementComponent, deps: [{ token: i0.ElementRef }, { token: DescopeAuthConfig }, { token: PLATFORM_ID }], target: i0.ɵɵFactoryTarget.Component }); }
1034
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.17", type: AuditManagementComponent, isStandalone: true, selector: "audit-management[tenant]", inputs: { tenant: "tenant", widgetId: "widgetId", theme: "theme", debug: "debug", logger: "logger", styleId: "styleId" }, outputs: { ready: "ready" }, usesInheritance: true, ngImport: i0, template: '', isInline: true }); }
940
1035
  }
941
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImport: i0, type: AuditManagementComponent, decorators: [{
1036
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: AuditManagementComponent, decorators: [{
942
1037
  type: Component,
943
1038
  args: [{
944
1039
  selector: 'audit-management[tenant]',
@@ -946,7 +1041,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImpor
946
1041
  schemas: [CUSTOM_ELEMENTS_SCHEMA],
947
1042
  template: ''
948
1043
  }]
949
- }], ctorParameters: () => [{ type: i0.ElementRef }, { type: DescopeAuthConfig }], propDecorators: { tenant: [{
1044
+ }], ctorParameters: () => [{ type: i0.ElementRef }, { type: DescopeAuthConfig }, { type: undefined, decorators: [{
1045
+ type: Inject,
1046
+ args: [PLATFORM_ID]
1047
+ }] }], propDecorators: { tenant: [{
950
1048
  type: Input
951
1049
  }], widgetId: [{
952
1050
  type: Input
@@ -962,29 +1060,32 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImpor
962
1060
  type: Output
963
1061
  }] } });
964
1062
 
965
- class UserProfileComponent {
966
- constructor(elementRef, descopeConfig, descopeAuthService) {
967
- this.elementRef = elementRef;
1063
+ class UserProfileComponent extends BaseLazyWidgetComponent {
1064
+ constructor(elementRef, descopeConfig, descopeAuthService, platformId) {
1065
+ super(elementRef, platformId);
968
1066
  this.descopeAuthService = descopeAuthService;
969
1067
  this.logout = new EventEmitter();
970
1068
  this.ready = new EventEmitter();
971
- this.webComponent = new DescopeUserProfileWidget();
972
1069
  this.projectId = descopeConfig.projectId;
973
1070
  this.baseUrl = descopeConfig.baseUrl;
974
1071
  this.baseStaticUrl = descopeConfig.baseStaticUrl;
975
1072
  this.baseCdnUrl = descopeConfig.baseCdnUrl;
976
1073
  }
977
- ngOnInit() {
978
- this.setupWebComponent();
979
- this.elementRef.nativeElement.appendChild(this.webComponent);
980
- }
981
- ngOnChanges() {
982
- this.setupWebComponent();
983
- }
984
- ngAfterViewInit() {
985
- this.setupEventListeners();
1074
+ async loadWidget() {
1075
+ try {
1076
+ const WidgetModule = await import('@descope/user-profile-widget');
1077
+ const DescopeUserProfileWidget = WidgetModule.default;
1078
+ return new DescopeUserProfileWidget();
1079
+ }
1080
+ catch (error) {
1081
+ // eslint-disable-next-line no-console
1082
+ console.error('Failed to load User Profile widget:', error);
1083
+ return null;
1084
+ }
986
1085
  }
987
1086
  setupWebComponent() {
1087
+ if (!this.webComponent)
1088
+ return;
988
1089
  this.webComponent.setAttribute('project-id', this.projectId);
989
1090
  this.webComponent.setAttribute('widget-id', this.widgetId);
990
1091
  if (this.baseUrl) {
@@ -1010,6 +1111,8 @@ class UserProfileComponent {
1010
1111
  }
1011
1112
  }
1012
1113
  setupEventListeners() {
1114
+ if (!this.webComponent)
1115
+ return;
1013
1116
  this.webComponent.addEventListener('logout', (e) => {
1014
1117
  this.logout?.emit(e);
1015
1118
  this.descopeAuthService.setSession('');
@@ -1022,17 +1125,20 @@ class UserProfileComponent {
1022
1125
  });
1023
1126
  }
1024
1127
  }
1025
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.4", ngImport: i0, type: UserProfileComponent, deps: [{ token: i0.ElementRef }, { token: DescopeAuthConfig }, { token: DescopeAuthService }], target: i0.ɵɵFactoryTarget.Component }); }
1026
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.1.4", type: UserProfileComponent, isStandalone: true, selector: "user-profile", inputs: { widgetId: "widgetId", theme: "theme", debug: "debug", logger: "logger", styleId: "styleId" }, outputs: { logout: "logout", ready: "ready" }, usesOnChanges: true, ngImport: i0, template: '', isInline: true }); }
1128
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: UserProfileComponent, deps: [{ token: i0.ElementRef }, { token: DescopeAuthConfig }, { token: DescopeAuthService }, { token: PLATFORM_ID }], target: i0.ɵɵFactoryTarget.Component }); }
1129
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.17", type: UserProfileComponent, isStandalone: true, selector: "user-profile", inputs: { widgetId: "widgetId", theme: "theme", debug: "debug", logger: "logger", styleId: "styleId" }, outputs: { logout: "logout", ready: "ready" }, usesInheritance: true, ngImport: i0, template: '', isInline: true }); }
1027
1130
  }
1028
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImport: i0, type: UserProfileComponent, decorators: [{
1131
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: UserProfileComponent, decorators: [{
1029
1132
  type: Component,
1030
1133
  args: [{
1031
1134
  selector: 'user-profile',
1032
1135
  standalone: true,
1033
1136
  template: ''
1034
1137
  }]
1035
- }], ctorParameters: () => [{ type: i0.ElementRef }, { type: DescopeAuthConfig }, { type: DescopeAuthService }], propDecorators: { widgetId: [{
1138
+ }], ctorParameters: () => [{ type: i0.ElementRef }, { type: DescopeAuthConfig }, { type: DescopeAuthService }, { type: undefined, decorators: [{
1139
+ type: Inject,
1140
+ args: [PLATFORM_ID]
1141
+ }] }], propDecorators: { widgetId: [{
1036
1142
  type: Input
1037
1143
  }], theme: [{
1038
1144
  type: Input
@@ -1048,28 +1154,31 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImpor
1048
1154
  type: Output
1049
1155
  }] } });
1050
1156
 
1051
- class ApplicationsPortalComponent {
1052
- constructor(elementRef, descopeConfig) {
1053
- this.elementRef = elementRef;
1157
+ class ApplicationsPortalComponent extends BaseLazyWidgetComponent {
1158
+ constructor(elementRef, descopeConfig, platformId) {
1159
+ super(elementRef, platformId);
1054
1160
  this.logout = new EventEmitter();
1055
1161
  this.ready = new EventEmitter();
1056
- this.webComponent = new DescopeApplicationsPortalWidget();
1057
1162
  this.projectId = descopeConfig.projectId;
1058
1163
  this.baseUrl = descopeConfig.baseUrl;
1059
1164
  this.baseStaticUrl = descopeConfig.baseStaticUrl;
1060
1165
  this.baseCdnUrl = descopeConfig.baseCdnUrl;
1061
1166
  }
1062
- ngOnInit() {
1063
- this.setupWebComponent();
1064
- this.elementRef.nativeElement.appendChild(this.webComponent);
1065
- }
1066
- ngOnChanges() {
1067
- this.setupWebComponent();
1068
- }
1069
- ngAfterViewInit() {
1070
- this.setupEventListeners();
1167
+ async loadWidget() {
1168
+ try {
1169
+ const WidgetModule = await import('@descope/applications-portal-widget');
1170
+ const DescopeApplicationsPortalWidget = WidgetModule.default;
1171
+ return new DescopeApplicationsPortalWidget();
1172
+ }
1173
+ catch (error) {
1174
+ // eslint-disable-next-line no-console
1175
+ console.error('Failed to load Applications Portal widget:', error);
1176
+ return null;
1177
+ }
1071
1178
  }
1072
1179
  setupWebComponent() {
1180
+ if (!this.webComponent)
1181
+ return;
1073
1182
  this.webComponent.setAttribute('project-id', this.projectId);
1074
1183
  this.webComponent.setAttribute('widget-id', this.widgetId);
1075
1184
  if (this.baseUrl) {
@@ -1095,6 +1204,8 @@ class ApplicationsPortalComponent {
1095
1204
  }
1096
1205
  }
1097
1206
  setupEventListeners() {
1207
+ if (!this.webComponent)
1208
+ return;
1098
1209
  if (this.logout) {
1099
1210
  this.webComponent.addEventListener('logout', (e) => {
1100
1211
  this.logout?.emit(e);
@@ -1106,17 +1217,20 @@ class ApplicationsPortalComponent {
1106
1217
  });
1107
1218
  }
1108
1219
  }
1109
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.4", ngImport: i0, type: ApplicationsPortalComponent, deps: [{ token: i0.ElementRef }, { token: DescopeAuthConfig }], target: i0.ɵɵFactoryTarget.Component }); }
1110
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.1.4", type: ApplicationsPortalComponent, isStandalone: true, selector: "applications-portal", inputs: { widgetId: "widgetId", theme: "theme", debug: "debug", logger: "logger", styleId: "styleId" }, outputs: { logout: "logout", ready: "ready" }, usesOnChanges: true, ngImport: i0, template: '', isInline: true }); }
1220
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: ApplicationsPortalComponent, deps: [{ token: i0.ElementRef }, { token: DescopeAuthConfig }, { token: PLATFORM_ID }], target: i0.ɵɵFactoryTarget.Component }); }
1221
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.17", type: ApplicationsPortalComponent, isStandalone: true, selector: "applications-portal", inputs: { widgetId: "widgetId", theme: "theme", debug: "debug", logger: "logger", styleId: "styleId" }, outputs: { logout: "logout", ready: "ready" }, usesInheritance: true, ngImport: i0, template: '', isInline: true }); }
1111
1222
  }
1112
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImport: i0, type: ApplicationsPortalComponent, decorators: [{
1223
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: ApplicationsPortalComponent, decorators: [{
1113
1224
  type: Component,
1114
1225
  args: [{
1115
1226
  selector: 'applications-portal',
1116
1227
  standalone: true,
1117
1228
  template: ''
1118
1229
  }]
1119
- }], ctorParameters: () => [{ type: i0.ElementRef }, { type: DescopeAuthConfig }], propDecorators: { widgetId: [{
1230
+ }], ctorParameters: () => [{ type: i0.ElementRef }, { type: DescopeAuthConfig }, { type: undefined, decorators: [{
1231
+ type: Inject,
1232
+ args: [PLATFORM_ID]
1233
+ }] }], propDecorators: { widgetId: [{
1120
1234
  type: Input
1121
1235
  }], theme: [{
1122
1236
  type: Input
@@ -1145,8 +1259,8 @@ class DescopeAuthModule {
1145
1259
  providers: [{ provide: DescopeAuthConfig, useValue: config }]
1146
1260
  };
1147
1261
  }
1148
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.4", ngImport: i0, type: DescopeAuthModule, deps: [{ token: DescopeAuthModule, optional: true, skipSelf: true }], target: i0.ɵɵFactoryTarget.NgModule }); }
1149
- static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.1.4", ngImport: i0, type: DescopeAuthModule, imports: [DescopeComponent,
1262
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: DescopeAuthModule, deps: [{ token: DescopeAuthModule, optional: true, skipSelf: true }], target: i0.ɵɵFactoryTarget.NgModule }); }
1263
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.17", ngImport: i0, type: DescopeAuthModule, imports: [DescopeComponent,
1150
1264
  SignInFlowComponent,
1151
1265
  SignUpFlowComponent,
1152
1266
  SignUpOrInFlowComponent,
@@ -1165,9 +1279,9 @@ class DescopeAuthModule {
1165
1279
  AuditManagementComponent,
1166
1280
  UserProfileComponent,
1167
1281
  ApplicationsPortalComponent] }); }
1168
- static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.1.4", ngImport: i0, type: DescopeAuthModule }); }
1282
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: DescopeAuthModule }); }
1169
1283
  }
1170
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImport: i0, type: DescopeAuthModule, decorators: [{
1284
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: DescopeAuthModule, decorators: [{
1171
1285
  type: NgModule,
1172
1286
  args: [{
1173
1287
  schemas: [CUSTOM_ELEMENTS_SCHEMA],