@descope/angular-sdk 0.0.0-next-33691177-20231227 → 0.0.0-next-a14bbb42-20231227

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 (112) hide show
  1. package/README.md +13 -448
  2. package/environment.d.ts +3 -0
  3. package/esm2022/descope-angular-sdk.mjs +5 -0
  4. package/esm2022/environment.mjs +4 -0
  5. package/esm2022/lib/components/descope/descope.component.mjs +106 -0
  6. package/esm2022/lib/components/sign-in-flow/sign-in-flow.component.mjs +40 -0
  7. package/esm2022/lib/components/sign-up-flow/sign-up-flow.component.mjs +40 -0
  8. package/esm2022/lib/components/sign-up-or-in-flow/sign-up-or-in-flow.component.mjs +40 -0
  9. package/esm2022/lib/descope-auth.module.mjs +52 -0
  10. package/esm2022/lib/services/descope-auth.guard.mjs +15 -0
  11. package/esm2022/lib/services/descope-auth.service.mjs +139 -0
  12. package/esm2022/lib/services/descope.interceptor.mjs +51 -0
  13. package/esm2022/lib/types/types.mjs +6 -0
  14. package/esm2022/lib/utils/constants.mjs +7 -0
  15. package/esm2022/lib/utils/helpers.mjs +27 -0
  16. package/esm2022/public-api.mjs +13 -0
  17. package/fesm2022/descope-angular-sdk.mjs +500 -0
  18. package/fesm2022/descope-angular-sdk.mjs.map +1 -0
  19. package/index.d.ts +5 -0
  20. package/lib/components/descope/descope.component.d.ts +32 -0
  21. package/lib/components/sign-in-flow/sign-in-flow.component.d.ts +24 -0
  22. package/lib/components/sign-up-flow/sign-up-flow.component.d.ts +24 -0
  23. package/lib/components/sign-up-or-in-flow/sign-up-or-in-flow.component.d.ts +24 -0
  24. package/lib/descope-auth.module.d.ts +14 -0
  25. package/lib/services/descope-auth.guard.d.ts +2 -0
  26. package/lib/services/descope-auth.service.d.ts +38 -0
  27. package/lib/services/descope.interceptor.d.ts +2 -0
  28. package/lib/types/types.d.ts +8 -0
  29. package/lib/utils/constants.d.ts +5 -0
  30. package/lib/utils/helpers.d.ts +5 -0
  31. package/package.json +32 -66
  32. package/{projects/angular-sdk/src/public-api.ts → public-api.d.ts} +0 -4
  33. package/.editorconfig +0 -16
  34. package/.eslintrc.json +0 -40
  35. package/.github/workflows/ci.yml +0 -98
  36. package/.github/workflows/publish-next.yml +0 -41
  37. package/.github/workflows/publish.yml +0 -28
  38. package/.github/workflows/release.yml +0 -45
  39. package/.husky/pre-commit +0 -4
  40. package/.prettierrc +0 -8
  41. package/.vscode/extensions.json +0 -4
  42. package/.vscode/launch.json +0 -20
  43. package/.vscode/settings.json +0 -3
  44. package/.vscode/tasks.json +0 -42
  45. package/LICENSE +0 -21
  46. package/angular.json +0 -154
  47. package/jest.config.js +0 -17
  48. package/projects/angular-sdk/.eslintrc.json +0 -32
  49. package/projects/angular-sdk/README.md +0 -25
  50. package/projects/angular-sdk/ng-package.json +0 -8
  51. package/projects/angular-sdk/package.json +0 -20
  52. package/projects/angular-sdk/src/environment.ts +0 -3
  53. package/projects/angular-sdk/src/lib/components/descope/descope.component.spec.ts +0 -104
  54. package/projects/angular-sdk/src/lib/components/descope/descope.component.ts +0 -114
  55. package/projects/angular-sdk/src/lib/components/sign-in-flow/sign-in-flow.component.html +0 -15
  56. package/projects/angular-sdk/src/lib/components/sign-in-flow/sign-in-flow.component.spec.ts +0 -53
  57. package/projects/angular-sdk/src/lib/components/sign-in-flow/sign-in-flow.component.ts +0 -32
  58. package/projects/angular-sdk/src/lib/components/sign-up-flow/sign-up-flow.component.html +0 -15
  59. package/projects/angular-sdk/src/lib/components/sign-up-flow/sign-up-flow.component.spec.ts +0 -51
  60. package/projects/angular-sdk/src/lib/components/sign-up-flow/sign-up-flow.component.ts +0 -32
  61. package/projects/angular-sdk/src/lib/components/sign-up-or-in-flow/sign-up-or-in-flow.component.html +0 -15
  62. package/projects/angular-sdk/src/lib/components/sign-up-or-in-flow/sign-up-or-in-flow.component.spec.ts +0 -53
  63. package/projects/angular-sdk/src/lib/components/sign-up-or-in-flow/sign-up-or-in-flow.component.ts +0 -32
  64. package/projects/angular-sdk/src/lib/descope-auth.module.ts +0 -46
  65. package/projects/angular-sdk/src/lib/services/descope-auth.guard.spec.ts +0 -76
  66. package/projects/angular-sdk/src/lib/services/descope-auth.guard.ts +0 -16
  67. package/projects/angular-sdk/src/lib/services/descope-auth.service.spec.ts +0 -264
  68. package/projects/angular-sdk/src/lib/services/descope-auth.service.ts +0 -176
  69. package/projects/angular-sdk/src/lib/services/descope.interceptor.spec.ts +0 -102
  70. package/projects/angular-sdk/src/lib/services/descope.interceptor.ts +0 -76
  71. package/projects/angular-sdk/src/lib/types/types.ts +0 -10
  72. package/projects/angular-sdk/src/lib/utils/constants.ts +0 -8
  73. package/projects/angular-sdk/src/lib/utils/helpers.spec.ts +0 -103
  74. package/projects/angular-sdk/src/lib/utils/helpers.ts +0 -36
  75. package/projects/angular-sdk/tsconfig.lib.json +0 -12
  76. package/projects/angular-sdk/tsconfig.lib.prod.json +0 -10
  77. package/projects/angular-sdk/tsconfig.spec.json +0 -11
  78. package/projects/demo-app/.eslintrc.json +0 -31
  79. package/projects/demo-app/src/app/app-routing.module.ts +0 -23
  80. package/projects/demo-app/src/app/app.component.html +0 -3
  81. package/projects/demo-app/src/app/app.component.scss +0 -16
  82. package/projects/demo-app/src/app/app.component.spec.ts +0 -37
  83. package/projects/demo-app/src/app/app.component.ts +0 -8
  84. package/projects/demo-app/src/app/app.module.ts +0 -52
  85. package/projects/demo-app/src/app/home/home.component.html +0 -23
  86. package/projects/demo-app/src/app/home/home.component.scss +0 -15
  87. package/projects/demo-app/src/app/home/home.component.spec.ts +0 -44
  88. package/projects/demo-app/src/app/home/home.component.ts +0 -61
  89. package/projects/demo-app/src/app/interceptor/auth.interceptor.ts +0 -20
  90. package/projects/demo-app/src/app/login/login.component.html +0 -12
  91. package/projects/demo-app/src/app/login/login.component.spec.ts +0 -42
  92. package/projects/demo-app/src/app/login/login.component.ts +0 -35
  93. package/projects/demo-app/src/app/protected/protected.component.html +0 -18
  94. package/projects/demo-app/src/app/protected/protected.component.scss +0 -8
  95. package/projects/demo-app/src/app/protected/protected.component.spec.ts +0 -42
  96. package/projects/demo-app/src/app/protected/protected.component.ts +0 -40
  97. package/projects/demo-app/src/assets/.gitkeep +0 -0
  98. package/projects/demo-app/src/environments/conifg.ts +0 -13
  99. package/projects/demo-app/src/environments/environment.ts +0 -19
  100. package/projects/demo-app/src/favicon.ico +0 -0
  101. package/projects/demo-app/src/index.html +0 -17
  102. package/projects/demo-app/src/main.ts +0 -7
  103. package/projects/demo-app/src/styles.scss +0 -21
  104. package/projects/demo-app/tsconfig.app.json +0 -10
  105. package/projects/demo-app/tsconfig.spec.json +0 -10
  106. package/renovate.json +0 -4
  107. package/scripts/gitleaks/.gitleaks.toml +0 -653
  108. package/scripts/gitleaks/gitleaks.sh +0 -34
  109. package/scripts/setversion/setversion.js +0 -20
  110. package/setup-jest.ts +0 -1
  111. package/thirdPartyLicenseCollector_linux_amd64 +0 -0
  112. package/tsconfig.json +0 -35
package/README.md CHANGED
@@ -1,460 +1,25 @@
1
- # Descope SDK for Angular
1
+ # AngularSdk
2
2
 
3
- The Descope SDK for Angular provides convenient access to the Descope for an application written on top of Angular. You can read more on the [Descope Website](https://descope.com).
3
+ This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 16.2.0.
4
4
 
5
- ## Requirements
5
+ ## Code scaffolding
6
6
 
7
- - The SDK supports Angular version 16 and above.
8
- - A Descope `Project ID` is required for using the SDK. Find it on the [project page in the Descope Console](https://app.descope.com/settings/project).
7
+ Run `ng generate component component-name --project angular-sdk` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module --project angular-sdk`.
9
8
 
10
- ## Installing the SDK
9
+ > Note: Don't forget to add `--project angular-sdk` or else it will be added to the default project in your `angular.json` file.
11
10
 
12
- Install the package with:
11
+ ## Build
13
12
 
14
- ```bash
15
- npm i --save @descope/angular-sdk
16
- ```
13
+ Run `ng build angular-sdk` to build the project. The build artifacts will be stored in the `dist/` directory.
17
14
 
18
- Add Descope type definitions to your `tsconfig.ts`
15
+ ## Publishing
19
16
 
20
- ```
21
- "compilerOptions": {
22
- "typeRoots": ["./node_modules/@descope"],
23
- <other options>
24
- }
25
- ```
17
+ After building your library with `ng build angular-sdk`, go to the dist folder `cd dist/angular-sdk` and run `npm publish`.
26
18
 
27
- ## Usage
19
+ ## Running unit tests
28
20
 
29
- ### NgModule - Import `DescopeAuthModule` to your application
21
+ Run `ng test angular-sdk` to execute the unit tests via [Karma](https://karma-runner.github.io).
30
22
 
31
- `app.module.ts`
23
+ ## Further help
32
24
 
33
- ```ts
34
- import { NgModule } from '@angular/core';
35
- import { BrowserModule } from '@angular/platform-browser';
36
-
37
- import { AppComponent } from './app.component';
38
- import { DescopeAuthModule } from '@descope/angular-sdk';
39
-
40
- @NgModule({
41
- declarations: [AppComponent],
42
- imports: [
43
- BrowserModule,
44
- DescopeAuthModule.forRoot({
45
- projectId: '<your_project_id>'
46
- })
47
- ],
48
- bootstrap: [AppComponent]
49
- })
50
- export class AppModule {}
51
- ```
52
-
53
- ### Standalone Mode - Configure Descope SDK for your application
54
-
55
- `main.ts`
56
-
57
- ```ts
58
- import { bootstrapApplication } from '@angular/platform-browser';
59
- import { AppComponent } from './app/app.component';
60
- import { DescopeAuthConfig } from '@descope/angular-sdk';
61
-
62
- bootstrapApplication(AppComponent, {
63
- providers: [
64
- { provide: DescopeAuthConfig, useValue: { projectId: '<your_project_id>' } }
65
- ]
66
- }).catch((err) => console.error(err));
67
- ```
68
-
69
- ### Use Descope to render specific flow
70
-
71
- You can use **default flows** or **provide flow id** directly to the descope component
72
-
73
- #### 1. Default flows
74
-
75
- `app.component.html`
76
-
77
- ```angular2html
78
- <descope-sign-in-flow
79
- (success)="onSuccess()"
80
- (error)="onError()"
81
- ></descope-sign-in-flow>
82
- ```
83
-
84
- `app.component.ts`
85
-
86
- ```ts
87
- import { Component } from '@angular/core';
88
-
89
- @Component({
90
- selector: 'app-root',
91
- templateUrl: './app.component.html'
92
- })
93
- export class AppComponent {
94
- onSuccess() {
95
- console.log('SUCCESSFULLY LOGGED IN FROM WEB COMPONENT');
96
- }
97
-
98
- onError() {
99
- console.log('ERROR FROM LOG IN FLOW FROM WEB COMPONENT');
100
- }
101
- }
102
- ```
103
-
104
- #### 2. Provide flow id
105
-
106
- ```angular2html
107
- <descope
108
- flowId="<your_flow_id>"
109
- (success)="<your_success_function>"
110
- (error)="<your_error_function>"
111
- <!-- theme can be "light", "dark" or "os", which auto select a theme based on the OS theme. Default is "light"
112
- theme="dark"
113
-
114
- locale can be any supported locale which the flow's screen translated to, if not provided, the locale is taken from the browser's locale.
115
- locale="en"
116
-
117
- debug can be set to true to enable debug mode
118
- debug="true"
119
-
120
- tenant ID for SSO (SAML) login. If not provided, Descope will use the domain of available email to choose the tenant
121
- tenant=<tenantId>
122
-
123
- Redirect URL for OAuth and SSO (will be used when redirecting back from the OAuth provider / IdP), or for "Magic Link" and "Enchanted Link" (will be used as a link in the message sent to the the user)
124
- redirectUrl=<redirectUrl>
125
-
126
- telemetryKey=<telemtry_key>
127
-
128
- autoFocus can be true, false or "skipFirstScreen". Default is true.
129
- - true: automatically focus on the first input of each screen
130
- - false: do not automatically focus on screen's inputs
131
- - "skipFirstScreen": automatically focus on the first input of each screen, except first screen
132
- autoFocus="skipFirstScreen"
133
-
134
- errorTransformer is a function that receives an error object and returns a string. The returned string will be displayed to the user.
135
- NOTE: errorTransformer is not required. If not provided, the error object will be displayed as is.
136
- Example:
137
- errorTransformer = (error: { text: string; type: string }): string => {
138
- const translationMap: { [key: string]: string } = {
139
- SAMLStartFailed: 'Failed to start SAML flow'
140
- };
141
- return translationMap[error.type] || error.text;
142
- };
143
- ...
144
- errorTransformer={errorTransformer}
145
-
146
- logger is an object describing how to log info, warn and errors.
147
- NOTE: logger is not required. If not provided, the logs will be printed to the console.
148
- Example:
149
- const logger = {
150
- info: (title: string, description: string, state: any) => {
151
- console.log(title, description, JSON.stringify(state));
152
- },
153
- warn: (title: string, description: string) => {
154
- console.warn(title);
155
- },
156
- error: (title: string, description: string) => {
157
- console.error('OH NOO');
158
- },
159
- }
160
- ...
161
- logger={logger}-->
162
- ></descope>
163
- ```
164
-
165
- #### Standalone Mode Note:
166
-
167
- All components in the sdk are standalone, so you can use them by directly importing them to your components.
168
-
169
- ### Use the `DescopeAuthService` and its exposed fields (`descopeSdk`, `session$`, `user$`) to access authentication state, user details and utilities
170
-
171
- This can be helpful to implement application-specific logic. Examples:
172
-
173
- - Render different components if current session is authenticated
174
- - Render user's content
175
- - Logout button
176
-
177
- `app.component.html`
178
-
179
- ```angular2html
180
- <p *ngIf="!isAuthenticated"> You are not logged in</p>
181
- <button *ngIf="isAuthenticated" (click)="logout()">LOGOUT</button>
182
- <p>User: {{userName}}</p>
183
- ```
184
-
185
- `app.component.ts`
186
-
187
- ```ts
188
- import { Component, OnInit } from '@angular/core';
189
- import { DescopeAuthService } from '@descope/angular-sdk';
190
-
191
- @Component({
192
- selector: 'app-home',
193
- templateUrl: './app.component.html',
194
- styleUrls: ['./app.component.scss']
195
- })
196
- export class AppComponent implements OnInit {
197
- isAuthenticated: boolean = false;
198
- userName: string = '';
199
-
200
- constructor(private authService: DescopeAuthService) {}
201
-
202
- ngOnInit() {
203
- this.authService.session$.subscribe((session) => {
204
- this.isAuthenticated = session.isAuthenticated;
205
- });
206
- this.authService.user$.subscribe((descopeUser) => {
207
- if (descopeUser.user) {
208
- this.userName = descopeUser.user.name ?? '';
209
- }
210
- });
211
- }
212
-
213
- logout() {
214
- this.authService.descopeSdk.logout();
215
- }
216
- }
217
- ```
218
-
219
- ### Session Refresh
220
-
221
- `DescopeAuthService` provides `refreshSession` and `refreshUser` methods that triggers a single request to the Descope backend to attempt to refresh the session or user. You can use them whenever you want to refresh the session/user. For example you can use `APP_INITIALIZER` provider to attempt to refresh session and user on each page refresh:
222
-
223
- `app.module.ts`
224
-
225
- ```ts
226
- import { APP_INITIALIZER, NgModule } from '@angular/core';
227
- import { BrowserModule } from '@angular/platform-browser';
228
- import { AppComponent } from './app.component';
229
- import { DescopeAuthModule, DescopeAuthService } from '@descope/angular-sdk';
230
- import { zip } from 'rxjs';
231
-
232
- export function initializeApp(authService: DescopeAuthService) {
233
- return () => zip([authService.refreshSession(), authService.refreshUser()]);
234
- }
235
-
236
- @NgModule({
237
- declarations: [AppComponent],
238
- imports: [
239
- BrowserModule,
240
- DescopeAuthModule.forRoot({
241
- projectId: '<your_project_id>'
242
- })
243
- ],
244
- providers: [
245
- {
246
- provide: APP_INITIALIZER,
247
- useFactory: initializeApp,
248
- deps: [DescopeAuthService],
249
- multi: true
250
- }
251
- ],
252
- bootstrap: [AppComponent]
253
- })
254
- export class AppModule {}
255
- ```
256
-
257
- #### Standalone Mode Note:
258
-
259
- You can use the same approach with `APP_INITIALIZER` in standalone mode, by adding it to `providers` array of the application.
260
-
261
- ### Descope Interceptor
262
-
263
- You can also use `DescopeInterceptor` to attempt to refresh session on each HTTP request that gets `401` or `403` response:
264
-
265
- `app.module.ts`
266
-
267
- ```ts
268
- import { NgModule } from '@angular/core';
269
- import { BrowserModule } from '@angular/platform-browser';
270
- import { AppComponent } from './app.component';
271
- import {
272
- HttpClientModule,
273
- provideHttpClient,
274
- withInterceptors
275
- } from '@angular/common/http';
276
- import { DescopeAuthModule, descopeInterceptor } from '@descope/angular-sdk';
277
-
278
- @NgModule({
279
- declarations: [AppComponent],
280
- imports: [
281
- BrowserModule,
282
- HttpClientModule,
283
- DescopeAuthModule.forRoot({
284
- projectId: '<your_project_id>',
285
- pathsToIntercept: ['/protectedPath']
286
- })
287
- ],
288
- providers: [provideHttpClient(withInterceptors([descopeInterceptor]))],
289
- bootstrap: [AppComponent]
290
- })
291
- export class AppModule {}
292
- ```
293
-
294
- `DescopeInterceptor`:
295
-
296
- - is configured for requests that urls contain one of `pathsToIntercept`. If not provided it will be used for all requests.
297
- - attaches session token as `Authorization` header in `Bearer <token>` format
298
- - if requests get response with `401` or `403` it automatically attempts to refresh session
299
- - if refresh attempt is successful, it automatically retries original request, otherwise it fails with original error
300
-
301
- **For more SDK usage examples refer to [docs](https://docs.descope.com/build/guides/client_sdks/)**
302
-
303
- ### Session token server validation (pass session token to server API)
304
-
305
- When developing a full-stack application, it is common to have private server API which requires a valid session token:
306
-
307
- ![session-token-validation-diagram](https://docs.descope.com/static/SessionValidation-cf7b2d5d26594f96421d894273a713d8.png)
308
-
309
- Note: Descope also provides server-side SDKs in various languages (NodeJS, Go, Python, etc). Descope's server SDKs have out-of-the-box session validation API that supports the options described bellow. To read more about session validation, Read [this section](https://docs.descope.com/build/guides/gettingstarted/#session-validation) in Descope documentation.
310
-
311
- You can securely communicate with your backend either by using `DescopeInterceptor` or manually adding token to your requests (ie. by using `DescopeAuthService.getSessionToken()` helper function)
312
-
313
- ### Helper Functions
314
-
315
- You can also use the following helper methods on `DescopeAuthService` to assist with various actions managing your JWT.
316
-
317
- - `getSessionToken()` - Get current session token.
318
- - `getRefreshToken()` - Get current refresh token.
319
- - `isAuthenticated()` - Returns boolean whether user is authenticated
320
- - `refreshSession` - Force a refresh on current session token using an existing valid refresh token.
321
- - `refreshUser` - Force a refresh on current user using an existing valid refresh token.
322
- - `getJwtRoles(token = getSessionToken(), tenant = '')` - Get current roles from an existing session token. Provide tenant id for specific tenant roles.
323
- - `getJwtPermissions(token = getSessionToken(), tenant = '')` - Fet current permissions from an existing session token. Provide tenant id for specific tenant permissions.
324
-
325
- ### Refresh token lifecycle
326
-
327
- Descope SDK is automatically refreshes the session token when it is about to expire. This is done in the background using the refresh token, without any additional configuration.
328
-
329
- If the Descope project settings are configured to manage tokens in cookies.
330
- you must also configure a custom domain, and set it as the `baseUrl` in `DescopeAuthModule`.
331
-
332
- ### Descope Guard
333
-
334
- `angular-sdk` provides a convenient route guard that prevents from accessing given route for users that are not authenticated:
335
-
336
- ```ts
337
- import { NgModule } from '@angular/core';
338
- import { RouterModule, Routes } from '@angular/router';
339
- import { HomeComponent } from './home/home.component';
340
- import { ProtectedComponent } from './protected/protected.component';
341
- import { descopeAuthGuard } from '@descope/angular-sdk';
342
- import { LoginComponent } from './login/login.component';
343
-
344
- const routes: Routes = [
345
- {
346
- path: 'step-up',
347
- component: ProtectedComponent,
348
- canActivate: [descopeAuthGuard],
349
- data: { descopeFallbackUrl: '/' }
350
- },
351
- { path: 'login', component: LoginComponent },
352
- { path: '**', component: HomeComponent }
353
- ];
354
-
355
- @NgModule({
356
- imports: [RouterModule.forRoot(routes, { enableTracing: false })],
357
- exports: [RouterModule]
358
- })
359
- export class AppRoutingModule {}
360
- ```
361
-
362
- If not authenticated user tries to access protected route they will be redirected to `descopeFallbackUrl`
363
-
364
- ## Code Example
365
-
366
- You can find an example angular app in the [examples folder](./projects/demo-app).
367
-
368
- ### Setup
369
-
370
- To run the examples, create `environment.development.ts` file in `environments` folder.
371
-
372
- ```ts
373
- import { Env } from './conifg';
374
-
375
- export const environment: Env = {
376
- descopeProjectId: '<your_project_id>'
377
- };
378
- ```
379
-
380
- Find your Project ID in the [Descope console](https://app.descope.com/settings/project).
381
-
382
- ### Run Example
383
-
384
- Run the following command in the root of the project to build and run the example:
385
-
386
- ```bash
387
- npm i && npm start
388
- ```
389
-
390
- ### Example Optional Env Variables
391
-
392
- See the following table for customization environment variables for the example app:
393
-
394
- | Env Variable | Description | Default value |
395
- | ------------------- | ------------------------------------------------------------------------------------------------------------- | ----------------- |
396
- | descopeFlowId | Which flow ID to use in the login page | **sign-up-or-in** |
397
- | descopeBaseUrl | Custom Descope base URL | None |
398
- | descopeTheme | Flow theme | None |
399
- | descopeLocale | Flow locale | Browser's locale |
400
- | descopeRedirectUrl | Flow redirect URL for OAuth/SSO/Magic Link/Enchanted Link | None |
401
- | descopeTenantId | Flow tenant ID for SSO/SAML | None |
402
- | descopeDebugMode | **"true"** - Enable debugger</br>**"false"** - Disable flow debugger | None |
403
- | descopeStepUpFlowId | Step up flow ID to show to logged in user (via button). e.g. "step-up". Button will be hidden if not provided | None |
404
- | descopeTelemetryKey | **String** - Telemetry public key provided by Descope Inc | None |
405
- | descopeBackendUrl | Url to your test backend app in case you want to test e2e | None |
406
-
407
- Example `environment.development.ts` file:
408
-
409
- ```ts
410
- import { Env } from './conifg';
411
-
412
- export const environment: Env = {
413
- descopeProjectId: '<your_project_id>',
414
- descopeBaseUrl: '<your_base_url>',
415
- descopeFlowId: 'sign-in',
416
- descopeDebugMode: false,
417
- descopeTheme: 'os',
418
- descopeLocale: 'en_US',
419
- descopeRedirectUrl: '<your_redirect_url>',
420
- descopeTelemetryKey: '<your_telemetry_key>',
421
- descopeStepUpFlowId: 'step-up',
422
- descopeBackendUrl: 'http://localhost:8080/protected'
423
- };
424
- ```
425
-
426
- ## Troubleshooting
427
-
428
- If you encounter warning during build of your application:
429
-
430
- ```
431
- ▲ [WARNING] Module 'lodash.get' used by 'node_modules/@descope/web-component/node_modules/@descope/core-js-sdk/dist/index.esm.js' is not ESM
432
- ```
433
-
434
- add `lodash.get` to allowed CommonJS dependencies in `angular.json`
435
-
436
- ```json
437
- "architect": {
438
- "build": {
439
- "builder": "@angular-devkit/build-angular:browser",
440
- "options": {
441
- "allowedCommonJsDependencies": ["lodash.get"],
442
- <other_options>
443
- }
444
- <other_config>
445
- }
446
- <other_config>
447
- }
448
- ```
449
-
450
- ## Learn More
451
-
452
- To learn more please see the [Descope Documentation and API reference page](https://docs.descope.com/).
453
-
454
- ## Contact Us
455
-
456
- If you need help you can email [Descope Support](mailto:support@descope.com)
457
-
458
- ## License
459
-
460
- The Descope SDK for Angular is licensed for use under the terms and conditions of the [MIT license Agreement](./LICENSE).
25
+ To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.io/cli) page.
@@ -0,0 +1,3 @@
1
+ export declare const environment: {
2
+ buildVersion: string;
3
+ };
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Generated bundle index. Do not edit.
3
+ */
4
+ export * from './public-api';
5
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZGVzY29wZS1hbmd1bGFyLXNkay5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3Byb2plY3RzL2FuZ3VsYXItc2RrL3NyYy9kZXNjb3BlLWFuZ3VsYXItc2RrLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOztHQUVHO0FBRUgsY0FBYyxjQUFjLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyIvKipcbiAqIEdlbmVyYXRlZCBidW5kbGUgaW5kZXguIERvIG5vdCBlZGl0LlxuICovXG5cbmV4cG9ydCAqIGZyb20gJy4vcHVibGljLWFwaSc7XG4iXX0=
@@ -0,0 +1,4 @@
1
+ export const environment = {
2
+ buildVersion: '0.0.0-next-a14bbb42-20231227'
3
+ };
4
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZW52aXJvbm1lbnQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9wcm9qZWN0cy9hbmd1bGFyLXNkay9zcmMvZW52aXJvbm1lbnQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsTUFBTSxDQUFDLE1BQU0sV0FBVyxHQUFHO0lBQ3pCLFlBQVksRUFBRSw4QkFBOEI7Q0FDN0MsQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbImV4cG9ydCBjb25zdCBlbnZpcm9ubWVudCA9IHtcbiAgYnVpbGRWZXJzaW9uOiAnMC4wLjAtbmV4dC1hMTRiYmI0Mi0yMDIzMTIyNydcbn07XG4iXX0=
@@ -0,0 +1,106 @@
1
+ import { Component, EventEmitter, Input, Output } from '@angular/core';
2
+ import DescopeWebComponent from '@descope/web-component';
3
+ import DescopeWc from '@descope/web-component';
4
+ import { from } from 'rxjs';
5
+ import { baseHeaders } from '../../utils/constants';
6
+ import * as i0 from "@angular/core";
7
+ import * as i1 from "../../services/descope-auth.service";
8
+ import * as i2 from "../../types/types";
9
+ export class DescopeComponent {
10
+ constructor(elementRef, authService, descopeConfig) {
11
+ this.elementRef = elementRef;
12
+ this.authService = authService;
13
+ this.success = new EventEmitter();
14
+ this.error = new EventEmitter();
15
+ this.webComponent = new DescopeWebComponent();
16
+ this.projectId = descopeConfig.projectId;
17
+ }
18
+ ngOnInit() {
19
+ DescopeWc.sdkConfigOverrides = { baseHeaders };
20
+ this.setupWebComponent();
21
+ this.elementRef.nativeElement.appendChild(this.webComponent);
22
+ }
23
+ ngOnChanges() {
24
+ this.setupWebComponent();
25
+ }
26
+ setupWebComponent() {
27
+ this.webComponent.setAttribute('project-id', this.projectId);
28
+ this.webComponent.setAttribute('flow-id', this.flowId);
29
+ if (this.locale) {
30
+ this.webComponent.setAttribute('locale', this.locale);
31
+ }
32
+ if (this.theme) {
33
+ this.webComponent.setAttribute('theme', this.theme);
34
+ }
35
+ if (this.tenant) {
36
+ this.webComponent.setAttribute('tenant', this.tenant);
37
+ }
38
+ if (this.telemetryKey) {
39
+ this.webComponent.setAttribute('telemetryKey', this.telemetryKey);
40
+ }
41
+ if (this.redirectUrl) {
42
+ this.webComponent.setAttribute('redirect-url', this.redirectUrl);
43
+ }
44
+ if (this.autoFocus) {
45
+ this.webComponent.setAttribute('auto-focus', this.autoFocus.toString());
46
+ }
47
+ if (this.debug) {
48
+ this.webComponent.setAttribute('debug', this.debug.toString());
49
+ }
50
+ if (this.errorTransformer) {
51
+ this.webComponent.errorTransformer = this.errorTransformer;
52
+ }
53
+ if (this.logger) {
54
+ this.webComponent.logger = this.logger;
55
+ }
56
+ if (this.success) {
57
+ this.webComponent.addEventListener('success', (e) => {
58
+ from(this.authService.descopeSdk.httpClient.hooks?.afterRequest(
59
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
60
+ {}, new Response(JSON.stringify(e.detail)))).subscribe(() => {
61
+ this.success?.emit();
62
+ });
63
+ });
64
+ }
65
+ if (this.error) {
66
+ this.webComponent.addEventListener('error', () => {
67
+ this.error?.emit();
68
+ });
69
+ }
70
+ }
71
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.9", ngImport: i0, type: DescopeComponent, deps: [{ token: i0.ElementRef }, { token: i1.DescopeAuthService }, { token: i2.DescopeAuthConfig }], target: i0.ɵɵFactoryTarget.Component }); }
72
+ 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", logger: "logger" }, outputs: { success: "success", error: "error" }, usesOnChanges: true, ngImport: i0, template: '', isInline: true }); }
73
+ }
74
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.9", ngImport: i0, type: DescopeComponent, decorators: [{
75
+ type: Component,
76
+ args: [{
77
+ selector: 'descope[flowId]',
78
+ standalone: true,
79
+ template: ''
80
+ }]
81
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i1.DescopeAuthService }, { type: i2.DescopeAuthConfig }]; }, propDecorators: { flowId: [{
82
+ type: Input
83
+ }], locale: [{
84
+ type: Input
85
+ }], theme: [{
86
+ type: Input
87
+ }], tenant: [{
88
+ type: Input
89
+ }], telemetryKey: [{
90
+ type: Input
91
+ }], redirectUrl: [{
92
+ type: Input
93
+ }], autoFocus: [{
94
+ type: Input
95
+ }], debug: [{
96
+ type: Input
97
+ }], errorTransformer: [{
98
+ type: Input
99
+ }], logger: [{
100
+ type: Input
101
+ }], success: [{
102
+ type: Output
103
+ }], error: [{
104
+ type: Output
105
+ }] } });
106
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZGVzY29wZS5jb21wb25lbnQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi9wcm9qZWN0cy9hbmd1bGFyLXNkay9z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eComponent } from '../descope/descope.component';
3
+ import * as i0 from "@angular/core";
4
+ import * as i1 from "../../types/types";
5
+ export class SignInFlowComponent {
6
+ constructor(descopeConfig) {
7
+ this.success = new EventEmitter();
8
+ this.error = new EventEmitter();
9
+ this.projectId = descopeConfig.projectId;
10
+ }
11
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.9", ngImport: i0, type: SignInFlowComponent, deps: [{ token: i1.DescopeAuthConfig }], target: i0.ɵɵFactoryTarget.Component }); }
12
+ 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", logger: "logger" }, outputs: { success: "success", error: "error" }, ngImport: i0, template: "<descope\n\t(success)=\"success.emit()\"\n\t(error)=\"error.emit()\"\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[logger]=\"logger\"\n>\n</descope>\n", dependencies: [{ kind: "component", type: DescopeComponent, selector: "descope[flowId]", inputs: ["flowId", "locale", "theme", "tenant", "telemetryKey", "redirectUrl", "autoFocus", "debug", "errorTransformer", "logger"], outputs: ["success", "error"] }] }); }
13
+ }
14
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.9", ngImport: i0, type: SignInFlowComponent, decorators: [{
15
+ type: Component,
16
+ args: [{ selector: 'descope-sign-in-flow', standalone: true, imports: [DescopeComponent], template: "<descope\n\t(success)=\"success.emit()\"\n\t(error)=\"error.emit()\"\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[logger]=\"logger\"\n>\n</descope>\n" }]
17
+ }], ctorParameters: function () { return [{ type: i1.DescopeAuthConfig }]; }, propDecorators: { locale: [{
18
+ type: Input
19
+ }], theme: [{
20
+ type: Input
21
+ }], tenant: [{
22
+ type: Input
23
+ }], telemetryKey: [{
24
+ type: Input
25
+ }], redirectUrl: [{
26
+ type: Input
27
+ }], autoFocus: [{
28
+ type: Input
29
+ }], debug: [{
30
+ type: Input
31
+ }], errorTransformer: [{
32
+ type: Input
33
+ }], logger: [{
34
+ type: Input
35
+ }], success: [{
36
+ type: Output
37
+ }], error: [{
38
+ type: Output
39
+ }] } });
40
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2lnbi1pbi1mbG93LmNvbXBvbmVudC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uL3Byb2plY3RzL2FuZ3VsYXItc2RrL3NyYy9saWIvY29tcG9uZW50cy9zaWduLWluLWZsb3cvc2lnbi1pbi1mbG93LmNvbXBvbmVudC50cyIsIi4uLy4uLy4uLy4uLy4uL3Byb2plY3RzL2FuZ3VsYXItc2RrL3NyYy9saWIvY29tcG9uZW50cy9zaWduLWluLWZsb3cvc2lnbi1pbi1mbG93LmNvbXBvbmVudC5odG1sIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxTQUFTLEVBQUUsWUFBWSxFQUFFLEtBQUssRUFBRSxNQUFNLEVBQUUsTUFBTSxlQUFlLENBQUM7QUFFdkUsT0FBTyxFQUFFLGdCQUFnQixFQUFFLE1BQU0sOEJBQThCLENBQUM7OztB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