@rolatech/angular-auth 17.2.18 → 19.0.0-beta.1

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 (46) hide show
  1. package/fesm2022/rolatech-angular-auth.mjs +116 -87
  2. package/fesm2022/rolatech-angular-auth.mjs.map +1 -1
  3. package/lib/components/address/address.component.d.ts +13 -0
  4. package/lib/components/faceid-detect-dialog/faceid-detect-dialog.component.d.ts +5 -3
  5. package/lib/components/index.d.ts +1 -0
  6. package/lib/interfaces/auth.interface.d.ts +23 -0
  7. package/lib/services/auth.user.service.d.ts +5 -0
  8. package/package.json +8 -6
  9. package/themes/_default.scss +1 -1
  10. package/esm2022/index.mjs +0 -10
  11. package/esm2022/lib/angular-auth.module.mjs +0 -24
  12. package/esm2022/lib/auth-routing.module.mjs +0 -40
  13. package/esm2022/lib/auth.routes.mjs +0 -13
  14. package/esm2022/lib/auth.store.mjs +0 -51
  15. package/esm2022/lib/components/auth-dialog/auth-dialog.component.mjs +0 -14
  16. package/esm2022/lib/components/faceid-detect-dialog/faceid-detect-dialog.component.mjs +0 -88
  17. package/esm2022/lib/components/forbidden/forbidden.component.mjs +0 -11
  18. package/esm2022/lib/components/index.mjs +0 -2
  19. package/esm2022/lib/components/unauthorized/unauthorized.component.mjs +0 -11
  20. package/esm2022/lib/guards/auth-dialog.guard.mjs +0 -37
  21. package/esm2022/lib/guards/auth.guard.mjs +0 -40
  22. package/esm2022/lib/guards/index.mjs +0 -5
  23. package/esm2022/lib/guards/permission.guard.mjs +0 -16
  24. package/esm2022/lib/guards/role.guard.mjs +0 -32
  25. package/esm2022/lib/interceptors/auth.interceptor.mjs +0 -66
  26. package/esm2022/lib/interceptors/cookie.interceptor.mjs +0 -31
  27. package/esm2022/lib/interceptors/error.interceptor.mjs +0 -63
  28. package/esm2022/lib/interceptors/index.mjs +0 -3
  29. package/esm2022/lib/interfaces/auth.interface.mjs +0 -7
  30. package/esm2022/lib/pages/forgot-password/forgot-password.component.mjs +0 -13
  31. package/esm2022/lib/pages/passwordreset/passwordreset.component.mjs +0 -13
  32. package/esm2022/lib/pages/signin/signin.component.mjs +0 -67
  33. package/esm2022/lib/pages/signup/signup.component.mjs +0 -13
  34. package/esm2022/lib/services/auth.service.mjs +0 -139
  35. package/esm2022/lib/services/auth.user.service.mjs +0 -135
  36. package/esm2022/lib/services/index.mjs +0 -4
  37. package/esm2022/lib/services/storage.service.mjs +0 -50
  38. package/esm2022/provider.mjs +0 -25
  39. package/esm2022/rolatech-angular-auth.mjs +0 -5
  40. package/lib/angular-auth.module.d.ts +0 -10
  41. package/lib/auth-routing.module.d.ts +0 -7
  42. package/lib/interceptors/cookie.interceptor.d.ts +0 -9
  43. package/lib/pages/forgot-password/forgot-password.component.d.ts +0 -8
  44. package/lib/pages/passwordreset/passwordreset.component.d.ts +0 -8
  45. package/lib/pages/signin/signin.component.d.ts +0 -25
  46. package/lib/pages/signup/signup.component.d.ts +0 -8
@@ -1,35 +1,37 @@
1
1
  import * as i0 from '@angular/core';
2
- import { Component, signal, computed, Injectable, inject, PLATFORM_ID, makeEnvironmentProviders } from '@angular/core';
2
+ import { Component, signal, computed, Injectable, inject, output, model, PLATFORM_ID, makeEnvironmentProviders } from '@angular/core';
3
3
  import { MatDialogRef, MAT_DIALOG_DATA, MatDialogModule, MatDialog } from '@angular/material/dialog';
4
- import { APP_CONFIG } from '@rolatech/angular-common';
4
+ import { APP_CONFIG, AngularCommonModule } from '@rolatech/angular-common';
5
5
  import { SnackBarService } from '@rolatech/angular-services';
6
6
  import QRCode from 'qrcode';
7
- import * as i1 from '@angular/material/button';
8
7
  import { MatButtonModule } from '@angular/material/button';
9
- import { HttpClient, HttpErrorResponse, HttpResponse, HTTP_INTERCEPTORS } from '@angular/common/http';
8
+ import { HttpClient, HttpErrorResponse, HTTP_INTERCEPTORS } from '@angular/common/http';
10
9
  import { map, tap, filter, catchError as catchError$1 } from 'rxjs/operators';
11
10
  import { ActivatedRoute, Router } from '@angular/router';
12
- import { SpinnerComponent } from '@rolatech/angular-components';
11
+ import { SpinnerComponent, AngularComponentsModule } from '@rolatech/angular-components';
12
+ import * as i1 from '@angular/forms';
13
+ import * as i2 from '@angular/material/form-field';
14
+ import * as i3 from '@angular/material/input';
13
15
  import { isPlatformBrowser, CommonModule } from '@angular/common';
14
16
  import { of, map as map$1, BehaviorSubject, catchError, throwError, NEVER } from 'rxjs';
15
17
  import { MatSnackBar } from '@angular/material/snack-bar';
16
18
 
17
19
  class ForbiddenComponent {
18
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: ForbiddenComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
19
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.0.1", type: ForbiddenComponent, isStandalone: true, selector: "rolatech-forbidden", ngImport: i0, template: "<div class=\"p-6 max-w-lg h-auto max-h-32\">\n <div class=\"flex flex-col\">\n <b>403.</b>\n <p>Forbidden page.</p>\n </div>\n</div>\n", styles: [""] });
20
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: ForbiddenComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
21
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.0.3", type: ForbiddenComponent, isStandalone: true, selector: "rolatech-forbidden", ngImport: i0, template: "<div class=\"p-6 max-w-lg h-auto max-h-32\">\n <div class=\"flex flex-col\">\n <b>403.</b>\n <p>Forbidden page.</p>\n </div>\n</div>\n", styles: [""] });
20
22
  }
21
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: ForbiddenComponent, decorators: [{
23
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: ForbiddenComponent, decorators: [{
22
24
  type: Component,
23
- args: [{ selector: 'rolatech-forbidden', standalone: true, template: "<div class=\"p-6 max-w-lg h-auto max-h-32\">\n <div class=\"flex flex-col\">\n <b>403.</b>\n <p>Forbidden page.</p>\n </div>\n</div>\n" }]
25
+ args: [{ selector: 'rolatech-forbidden', template: "<div class=\"p-6 max-w-lg h-auto max-h-32\">\n <div class=\"flex flex-col\">\n <b>403.</b>\n <p>Forbidden page.</p>\n </div>\n</div>\n" }]
24
26
  }] });
25
27
 
26
28
  class UnauthorizedComponent {
27
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: UnauthorizedComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
28
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.0.1", type: UnauthorizedComponent, isStandalone: true, selector: "rolatech-unauthorized", ngImport: i0, template: "<div class=\"p-6 max-w-lg h-auto max-h-32\">\n <div class=\"flex flex-col\">\n <b>401.</b>\n <p>Unauthorized page.</p>\n </div>\n</div>\n", styles: [""] });
29
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: UnauthorizedComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
30
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.0.3", type: UnauthorizedComponent, isStandalone: true, selector: "rolatech-unauthorized", ngImport: i0, template: "<div class=\"p-6 max-w-lg h-auto max-h-32\">\n <div class=\"flex flex-col\">\n <b>401.</b>\n <p>Unauthorized page.</p>\n </div>\n</div>\n", styles: [""] });
29
31
  }
30
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: UnauthorizedComponent, decorators: [{
32
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: UnauthorizedComponent, decorators: [{
31
33
  type: Component,
32
- args: [{ selector: 'rolatech-unauthorized', standalone: true, template: "<div class=\"p-6 max-w-lg h-auto max-h-32\">\n <div class=\"flex flex-col\">\n <b>401.</b>\n <p>Unauthorized page.</p>\n </div>\n</div>\n" }]
34
+ args: [{ selector: 'rolatech-unauthorized', template: "<div class=\"p-6 max-w-lg h-auto max-h-32\">\n <div class=\"flex flex-col\">\n <b>401.</b>\n <p>Unauthorized page.</p>\n </div>\n</div>\n" }]
33
35
  }] });
34
36
 
35
37
  class AuthStore {
@@ -73,10 +75,10 @@ class AuthStore {
73
75
  return { ...state };
74
76
  });
75
77
  }
76
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: AuthStore, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
77
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: AuthStore, providedIn: 'root' });
78
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AuthStore, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
79
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AuthStore, providedIn: 'root' });
78
80
  }
79
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: AuthStore, decorators: [{
81
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AuthStore, decorators: [{
80
82
  type: Injectable,
81
83
  args: [{ providedIn: 'root' }]
82
84
  }] });
@@ -205,10 +207,10 @@ class AuthService {
205
207
  this.authStore.updateAuthenticated(true);
206
208
  }));
207
209
  }
208
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: AuthService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
209
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: AuthService, providedIn: 'root' });
210
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AuthService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
211
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AuthService, providedIn: 'root' });
210
212
  }
211
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: AuthService, decorators: [{
213
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AuthService, decorators: [{
212
214
  type: Injectable,
213
215
  args: [{ providedIn: 'root' }]
214
216
  }] });
@@ -219,6 +221,7 @@ class FaceidDetectDialogComponent {
219
221
  data = inject(MAT_DIALOG_DATA);
220
222
  authService = inject(AuthService);
221
223
  snackBarService = inject(SnackBarService);
224
+ output = output();
222
225
  loading = false;
223
226
  qrcodeUrl = '';
224
227
  verified = false;
@@ -226,6 +229,9 @@ class FaceidDetectDialogComponent {
226
229
  constructor() {
227
230
  this.request();
228
231
  }
232
+ ngOnDestroy() {
233
+ clearInterval(this.interval);
234
+ }
229
235
  request() {
230
236
  this.loading = true;
231
237
  this.authService.requestFaceIdDetect().subscribe({
@@ -242,25 +248,6 @@ class FaceidDetectDialogComponent {
242
248
  clearInterval(this.interval);
243
249
  this.dialogRef.close(this.verified);
244
250
  }
245
- checkFaceIdStatus() {
246
- this.loading = false;
247
- this.authService.faceIdStatus().subscribe({
248
- next: (res) => {
249
- this.verified = res.data.verified;
250
- if (res.data.verified) {
251
- clearInterval(this.interval);
252
- this.dialogRef.close(true);
253
- }
254
- else {
255
- this.snackBarService.open('未认证');
256
- }
257
- },
258
- error: (error) => {
259
- clearInterval(this.interval);
260
- this.dialogRef.close(false);
261
- },
262
- });
263
- }
264
251
  loop() {
265
252
  this.loading = false;
266
253
  this.interval = setInterval(() => {
@@ -272,7 +259,6 @@ class FaceidDetectDialogComponent {
272
259
  }
273
260
  },
274
261
  });
275
- this;
276
262
  }, 2000);
277
263
  }
278
264
  async genQRCode(url) {
@@ -283,14 +269,46 @@ class FaceidDetectDialogComponent {
283
269
  console.error(err);
284
270
  }
285
271
  }
286
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: FaceidDetectDialogComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
287
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.0.1", type: FaceidDetectDialogComponent, isStandalone: true, selector: "rolatech-faceid-detect-dialog", ngImport: i0, template: "<div class=\"flex flex-col p-3 max-w-[500px] mx-auto\">\n <div class=\"text-xl font-bold p-3\">\u4F7F\u7528\u5FAE\u4FE1\u626B\u63CF\u4E8C\u7EF4\u7801, \u5B8C\u6210\u4EBA\u8138\u5B9E\u540D\u8BA4\u8BC1</div>\n <div class=\"w-[256px] h-[256px] mx-auto flex justify-center items-center\">\n @if (loading) {\n <div>\n <rolatech-spinner></rolatech-spinner>\n </div>\n }\n\n <img [src]=\"qrcodeUrl\" />\n </div>\n <div class=\"p-3 flex justify-end items-center gap-3\">\n <button mat-button (click)=\"cancel()\">\u53D6\u6D88</button>\n <button mat-flat-button color=\"primary\" (click)=\"checkFaceIdStatus()\">\u5B8C\u6210\u8BA4\u8BC1</button>\n </div>\n</div>\n", styles: ["*{margin:0;padding:0}.normalPanel .panelContent{width:188px;height:188px}.normalPanel .wrp_code{position:relative;width:188px;height:188px;margin:0}.impowerBox .title,.normalPanel .info{display:none}.impowerBox .qrcode{margin-top:0;border:0;width:188px;height:188px}#MAXIM{content:\"veg20170418191511\"}mat-mdc-dialog-content mdc-dialog__content{padding:0}\n"], dependencies: [{ kind: "component", type: SpinnerComponent, selector: "rolatech-spinner", inputs: ["title"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i1.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", exportAs: ["matButton"] }] });
272
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: FaceidDetectDialogComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
273
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.3", type: FaceidDetectDialogComponent, isStandalone: true, selector: "rolatech-faceid-detect-dialog", outputs: { output: "output" }, ngImport: i0, template: "<div class=\"flex flex-col p-3 max-w-[500px] mx-auto\">\n <div class=\"w-[256px] h-[256px] mx-auto flex justify-center items-center\">\n @if (loading) {\n <div>\n <rolatech-spinner></rolatech-spinner>\n </div>\n }\n <img [src]=\"qrcodeUrl\" alt />\n </div>\n</div>\n", styles: ["*{margin:0;padding:0}.normalPanel .panelContent{width:188px;height:188px}.normalPanel .wrp_code{position:relative;width:188px;height:188px;margin:0}.impowerBox .title,.normalPanel .info{display:none}.impowerBox .qrcode{margin-top:0;border:0;width:188px;height:188px}#MAXIM{content:\"veg20170418191511\"}mat-mdc-dialog-content mdc-dialog__content{padding:0}\n"], dependencies: [{ kind: "component", type: SpinnerComponent, selector: "rolatech-spinner", inputs: ["title"] }, { kind: "ngmodule", type: MatButtonModule }] });
288
274
  }
289
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: FaceidDetectDialogComponent, decorators: [{
275
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: FaceidDetectDialogComponent, decorators: [{
290
276
  type: Component,
291
- args: [{ selector: 'rolatech-faceid-detect-dialog', standalone: true, imports: [SpinnerComponent, MatButtonModule], template: "<div class=\"flex flex-col p-3 max-w-[500px] mx-auto\">\n <div class=\"text-xl font-bold p-3\">\u4F7F\u7528\u5FAE\u4FE1\u626B\u63CF\u4E8C\u7EF4\u7801, \u5B8C\u6210\u4EBA\u8138\u5B9E\u540D\u8BA4\u8BC1</div>\n <div class=\"w-[256px] h-[256px] mx-auto flex justify-center items-center\">\n @if (loading) {\n <div>\n <rolatech-spinner></rolatech-spinner>\n </div>\n }\n\n <img [src]=\"qrcodeUrl\" />\n </div>\n <div class=\"p-3 flex justify-end items-center gap-3\">\n <button mat-button (click)=\"cancel()\">\u53D6\u6D88</button>\n <button mat-flat-button color=\"primary\" (click)=\"checkFaceIdStatus()\">\u5B8C\u6210\u8BA4\u8BC1</button>\n </div>\n</div>\n", styles: ["*{margin:0;padding:0}.normalPanel .panelContent{width:188px;height:188px}.normalPanel .wrp_code{position:relative;width:188px;height:188px;margin:0}.impowerBox .title,.normalPanel .info{display:none}.impowerBox .qrcode{margin-top:0;border:0;width:188px;height:188px}#MAXIM{content:\"veg20170418191511\"}mat-mdc-dialog-content mdc-dialog__content{padding:0}\n"] }]
277
+ args: [{ selector: 'rolatech-faceid-detect-dialog', imports: [SpinnerComponent, MatButtonModule], template: "<div class=\"flex flex-col p-3 max-w-[500px] mx-auto\">\n <div class=\"w-[256px] h-[256px] mx-auto flex justify-center items-center\">\n @if (loading) {\n <div>\n <rolatech-spinner></rolatech-spinner>\n </div>\n }\n <img [src]=\"qrcodeUrl\" alt />\n </div>\n</div>\n", styles: ["*{margin:0;padding:0}.normalPanel .panelContent{width:188px;height:188px}.normalPanel .wrp_code{position:relative;width:188px;height:188px;margin:0}.impowerBox .title,.normalPanel .info{display:none}.impowerBox .qrcode{margin-top:0;border:0;width:188px;height:188px}#MAXIM{content:\"veg20170418191511\"}mat-mdc-dialog-content mdc-dialog__content{padding:0}\n"] }]
292
278
  }], ctorParameters: () => [] });
293
279
 
280
+ var UserStatus;
281
+ (function (UserStatus) {
282
+ UserStatus["ACTIVE"] = "\u6B63\u5E38";
283
+ UserStatus["AWAITING"] = "\u5BA1\u6838\u4E2D";
284
+ UserStatus["DELETED"] = "\u5DF2\u5220\u9664";
285
+ })(UserStatus || (UserStatus = {}));
286
+ var AddressType;
287
+ (function (AddressType) {
288
+ AddressType["HOME"] = "\u4F4F\u5B85\u5730\u5740";
289
+ AddressType["WORK"] = "\u5DE5\u4F5C\u5730\u5740";
290
+ AddressType["BILLING"] = "\u8D26\u5355\u5730\u5740";
291
+ AddressType["SHIPPING"] = "\u8D2D\u7269\u5730\u5740";
292
+ AddressType["OTHER"] = "\u5176\u4ED6";
293
+ })(AddressType || (AddressType = {}));
294
+
295
+ class AddressComponent {
296
+ addressType = AddressType;
297
+ enumKeys = Object.keys(this.addressType).filter((key) => isNaN(Number(key)));
298
+ address = model();
299
+ output = output();
300
+ ngOnInit() { }
301
+ ngDoCheck() {
302
+ this.output.emit(this.address());
303
+ }
304
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AddressComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
305
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.3", type: AddressComponent, isStandalone: true, selector: "rolatech-address", inputs: { address: { classPropertyName: "address", publicName: "address", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { address: "addressChange", output: "output" }, ngImport: i0, template: "<div>\n <mat-form-field appearance=\"fill\">\n <mat-label> \u59D3\u540D </mat-label>\n <input matInput [(ngModel)]=\"address().name\" />\n </mat-form-field>\n @if (address().type === addressType.BILLING) {\n <mat-form-field appearance=\"fill\">\n <mat-label> \u90AE\u7BB1 </mat-label>\n <input matInput [(ngModel)]=\"address().email\" />\n </mat-form-field>\n }\n <mat-form-field appearance=\"fill\">\n <mat-label> \u624B\u673A </mat-label>\n <input matInput [(ngModel)]=\"address().phone\" />\n </mat-form-field>\n <mat-form-field appearance=\"fill\">\n <mat-label> \u7701\u4EFD </mat-label>\n <input matInput [(ngModel)]=\"address().province\" />\n </mat-form-field>\n <mat-form-field appearance=\"fill\">\n <mat-label> \u57CE\u5E02 </mat-label>\n <input matInput [(ngModel)]=\"address().city\" />\n </mat-form-field>\n <mat-form-field appearance=\"fill\">\n <mat-label> \u533A </mat-label>\n <input matInput [(ngModel)]=\"address().district\" />\n </mat-form-field>\n <mat-form-field appearance=\"fill\">\n <mat-label> \u8857\u9053 </mat-label>\n <input matInput [(ngModel)]=\"address().street\" />\n </mat-form-field>\n <mat-form-field appearance=\"fill\">\n <mat-label> \u5176\u4ED6 </mat-label>\n <input matInput [(ngModel)]=\"address().detail\" />\n </mat-form-field>\n</div>\n", styles: ["mat-form-field{width:100%}\n"], dependencies: [{ kind: "ngmodule", type: AngularCommonModule }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: AngularComponentsModule }, { kind: "component", type: i2.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i2.MatLabel, selector: "mat-label" }, { kind: "directive", type: i3.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }] });
306
+ }
307
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AddressComponent, decorators: [{
308
+ type: Component,
309
+ args: [{ selector: 'rolatech-address', imports: [AngularCommonModule, AngularComponentsModule], template: "<div>\n <mat-form-field appearance=\"fill\">\n <mat-label> \u59D3\u540D </mat-label>\n <input matInput [(ngModel)]=\"address().name\" />\n </mat-form-field>\n @if (address().type === addressType.BILLING) {\n <mat-form-field appearance=\"fill\">\n <mat-label> \u90AE\u7BB1 </mat-label>\n <input matInput [(ngModel)]=\"address().email\" />\n </mat-form-field>\n }\n <mat-form-field appearance=\"fill\">\n <mat-label> \u624B\u673A </mat-label>\n <input matInput [(ngModel)]=\"address().phone\" />\n </mat-form-field>\n <mat-form-field appearance=\"fill\">\n <mat-label> \u7701\u4EFD </mat-label>\n <input matInput [(ngModel)]=\"address().province\" />\n </mat-form-field>\n <mat-form-field appearance=\"fill\">\n <mat-label> \u57CE\u5E02 </mat-label>\n <input matInput [(ngModel)]=\"address().city\" />\n </mat-form-field>\n <mat-form-field appearance=\"fill\">\n <mat-label> \u533A </mat-label>\n <input matInput [(ngModel)]=\"address().district\" />\n </mat-form-field>\n <mat-form-field appearance=\"fill\">\n <mat-label> \u8857\u9053 </mat-label>\n <input matInput [(ngModel)]=\"address().street\" />\n </mat-form-field>\n <mat-form-field appearance=\"fill\">\n <mat-label> \u5176\u4ED6 </mat-label>\n <input matInput [(ngModel)]=\"address().detail\" />\n </mat-form-field>\n</div>\n", styles: ["mat-form-field{width:100%}\n"] }]
310
+ }] });
311
+
294
312
  const AuthGuard = (route, state) => {
295
313
  const environment = inject(APP_CONFIG);
296
314
  const platformId = inject(PLATFORM_ID);
@@ -303,7 +321,7 @@ const AuthGuard = (route, state) => {
303
321
  }
304
322
  return authService.introspect().pipe(map$1(({ roles, authenticated }) => {
305
323
  const routeRoles = route.data['roles'];
306
- let passRoled = routeRoles ? roles?.some((r) => routeRoles.indexOf(r) >= 0) : true;
324
+ const passRoled = routeRoles ? roles?.some((r) => routeRoles.indexOf(r) >= 0) : true;
307
325
  if (authenticated && !passRoled) {
308
326
  router.navigate(['/forbidden']);
309
327
  return false;
@@ -327,12 +345,12 @@ const AuthGuard = (route, state) => {
327
345
 
328
346
  class AuthDialogComponent {
329
347
  dialogRef = inject(MatDialogRef);
330
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: AuthDialogComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
331
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.0.1", type: AuthDialogComponent, isStandalone: true, selector: "rolatech-auth-dialog", ngImport: i0, template: "<p>auth-dialog works!</p>\n", styles: [""], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: MatDialogModule }] });
348
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AuthDialogComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
349
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.0.3", type: AuthDialogComponent, isStandalone: true, selector: "rolatech-auth-dialog", ngImport: i0, template: "<p>auth-dialog works!</p>\n", styles: [""], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: MatDialogModule }] });
332
350
  }
333
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: AuthDialogComponent, decorators: [{
351
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AuthDialogComponent, decorators: [{
334
352
  type: Component,
335
- args: [{ selector: 'rolatech-auth-dialog', standalone: true, imports: [CommonModule, MatDialogModule], template: "<p>auth-dialog works!</p>\n" }]
353
+ args: [{ selector: 'rolatech-auth-dialog', imports: [CommonModule, MatDialogModule], template: "<p>auth-dialog works!</p>\n" }]
336
354
  }] });
337
355
 
338
356
  const AuthDialogGuard = (route, state) => {
@@ -521,10 +539,26 @@ class AuthUserService {
521
539
  followersStats(username) {
522
540
  return this.http.get(`${this.environment.baseUrl}/auth/users/followers/stats/by`, { params: { username: username } });
523
541
  }
524
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: AuthUserService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
525
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: AuthUserService, providedIn: 'root' });
542
+ // Address;
543
+ addAddress(data) {
544
+ return this.http.post(`${this.environment.baseUrl}/auth/users/addresses`, data, { withCredentials: true });
545
+ }
546
+ updateAddress(id, data) {
547
+ return this.http.put(`${this.environment.baseUrl}/auth/users/addresses/${id}`, data, { withCredentials: true });
548
+ }
549
+ findAllAddress(options) {
550
+ return this.http.get(`${this.environment.baseUrl}/auth/users/addresses`, { params: options, withCredentials: true });
551
+ }
552
+ getAddress(id) {
553
+ return this.http.get(`${this.environment.baseUrl}/auth/users/addresses/${id}`, { withCredentials: true });
554
+ }
555
+ deleteAddressById(id) {
556
+ return this.http.delete(`${this.environment.baseUrl}/auth/users/addresses/${id}`, { withCredentials: true });
557
+ }
558
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AuthUserService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
559
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AuthUserService, providedIn: 'root' });
526
560
  }
527
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: AuthUserService, decorators: [{
561
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AuthUserService, decorators: [{
528
562
  type: Injectable,
529
563
  args: [{
530
564
  providedIn: 'root',
@@ -568,10 +602,10 @@ class LocalstorageService {
568
602
  setItem(key, value) {
569
603
  return this.storage.setItem(key, value);
570
604
  }
571
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: LocalstorageService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
572
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: LocalstorageService, providedIn: 'root' });
605
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: LocalstorageService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
606
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: LocalstorageService, providedIn: 'root' });
573
607
  }
574
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: LocalstorageService, decorators: [{
608
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: LocalstorageService, decorators: [{
575
609
  type: Injectable,
576
610
  args: [{
577
611
  providedIn: 'root',
@@ -626,13 +660,14 @@ class ErrorInterceptor {
626
660
  return throwError(() => error.error);
627
661
  }
628
662
  handleDefaultError(error) {
629
- // return throwError(() => new Error('系统错误'));
630
- return throwError(() => error.error);
663
+ console.log(typeof error.error);
664
+ return throwError(() => new Error('系统错误'));
665
+ // return throwError(() => error.error);
631
666
  }
632
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: ErrorInterceptor, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
633
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: ErrorInterceptor });
667
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: ErrorInterceptor, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
668
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: ErrorInterceptor });
634
669
  }
635
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: ErrorInterceptor, decorators: [{
670
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: ErrorInterceptor, decorators: [{
636
671
  type: Injectable
637
672
  }] });
638
673
 
@@ -645,32 +680,26 @@ class AuthInterceptor {
645
680
  const authRequest = request.clone({
646
681
  headers: request.headers.append('Client-Id', this.environment.clientId),
647
682
  });
648
- if (request.withCredentials) {
649
- return next.handle(authRequest).pipe(map((res) => {
650
- if (res instanceof HttpResponse && isPlatformBrowser(this.platformId)) {
651
- // window.location.href = res.headers.get('Location') as string;
683
+ return next.handle(authRequest).pipe(map((res) => {
684
+ // if (res instanceof HttpResponse && isPlatformBrowser(this.platformId)) {
685
+ // // window.location.href = res.headers.get('Location') as string;
686
+ // }
687
+ return res;
688
+ }), catchError$1((error) => {
689
+ if (isPlatformBrowser(this.platformId)) {
690
+ if (error.url?.includes('auth/introspect')) {
691
+ // if (window.location.origin !== `${this.environment.accountsUrl}`) {
692
+ // window.location.href = `${this.environment.accountsUrl}/signin?continue=` + window.location.href;
693
+ // return NEVER;
694
+ // }
652
695
  }
653
- return res;
654
- }), catchError$1((error) => {
655
- if (isPlatformBrowser(this.platformId)) {
656
- if (error.url?.includes('auth/introspect')) {
657
- // if (window.location.origin !== `${this.environment.accountsUrl}`) {
658
- // window.location.href = `${this.environment.accountsUrl}/signin?continue=` + window.location.href;
659
- // return NEVER;
660
- // }
661
- }
662
- if (error instanceof HttpErrorResponse && error.error.code === 'G401') {
663
- window.location.href = `${this.environment.accountsUrl}/signin?continue=` + window.location.href;
664
- return NEVER;
665
- }
696
+ if (error instanceof HttpErrorResponse && error.error.code === 'G401') {
697
+ window.location.href = `${this.environment.accountsUrl}/signin?continue=` + window.location.href;
698
+ return NEVER;
666
699
  }
667
- return throwError(() => error);
668
- }));
669
- }
670
- const newRequest = request.clone({
671
- headers: request.headers.append('Client-Id', this.environment.clientId),
672
- });
673
- return next.handle(newRequest);
700
+ }
701
+ return throwError(() => error.message);
702
+ }));
674
703
  }
675
704
  addClientIdHeader(request) {
676
705
  return request.clone({
@@ -687,10 +716,10 @@ class AuthInterceptor {
687
716
  },
688
717
  });
689
718
  }
690
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: AuthInterceptor, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
691
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: AuthInterceptor });
719
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AuthInterceptor, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
720
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AuthInterceptor });
692
721
  }
693
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: AuthInterceptor, decorators: [{
722
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AuthInterceptor, decorators: [{
694
723
  type: Injectable
695
724
  }], ctorParameters: () => [] });
696
725
 
@@ -731,5 +760,5 @@ const authRoutes = [
731
760
  * Generated bundle index. Do not edit.
732
761
  */
733
762
 
734
- export { AuthDialogGuard, AuthGuard, AuthInterceptor, AuthService, AuthStore, AuthUserService, ErrorInterceptor, FaceidDetectDialogComponent, ForbiddenComponent, LocalstorageService, PermissionGuard, RoleGuard, UnauthorizedComponent, authRoutes, provideAngularAuth };
763
+ export { AddressComponent, AuthDialogGuard, AuthGuard, AuthInterceptor, AuthService, AuthStore, AuthUserService, ErrorInterceptor, FaceidDetectDialogComponent, ForbiddenComponent, LocalstorageService, PermissionGuard, RoleGuard, UnauthorizedComponent, authRoutes, provideAngularAuth };
735
764
  //# sourceMappingURL=rolatech-angular-auth.mjs.map