@sneat/auth-ui 0.27.5 → 0.27.6

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.
@@ -1,7 +1,7 @@
1
1
  import { JsonPipe } from '@angular/common';
2
2
  import { ChangeDetectionStrategy, Component, computed, signal, inject, } from '@angular/core';
3
3
  import { RouterModule } from '@angular/router';
4
- import { IonButton, IonButtons, IonIcon, IonItem, IonItemDivider, IonLabel, MenuController, NavController, } from '@ionic/angular';
4
+ import { IonButton, IonButtons, IonIcon, IonItem, IonItemDivider, IonLabel, IonSpinner, MenuController, NavController, } from '@ionic/angular';
5
5
  import { SneatAuthStateService, SneatUserService, } from '@sneat/auth-core';
6
6
  import { ErrorLogger } from '@sneat/core';
7
7
  import { Subject, takeUntil } from 'rxjs';
@@ -68,7 +68,7 @@ export class AuthMenuItemComponent {
68
68
  return false;
69
69
  }
70
70
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: AuthMenuItemComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
71
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.3", type: AuthMenuItemComponent, isStandalone: true, selector: "sneat-auth-menu-item", ngImport: i0, template: "<ion-item-divider color=\"light\">\n @if ($authStatus() === \"authenticated\") {\n <ion-label>Signed in as</ion-label>\n } @else {\n <ion-label>Authentication</ion-label>\n }\n</ion-item-divider>\n@if (!$authState()) {\n <ion-item>\n <ion-label>Loading....</ion-label>\n </ion-item>\n} @else if ($isAuthenticating()) {\n <ion-item routerLink=\"login\">\n <ion-label>Authenticating....</ion-label>\n </ion-item>\n}\n@if ($authStatus() === \"notAuthenticated\") {\n <ion-item routerLink=\"/login\" tappable=\"true\">\n <ion-icon slot=\"start\" name=\"person-circle-outline\" />\n <ion-label color=\"primary\"> Please sign in</ion-label>\n </ion-item>\n}\n@if ($authStatus() === \"authenticated\") {\n <ion-item\n tappable=\"true\"\n routerLink=\"/my\"\n routerDirection=\"forward\"\n (click)=\"closeMenu()\"\n >\n <!-- <ion-buttons slot=\"start\" class=\"ion-no-margin\">-->\n <!-- <ion-button disabled color=\"medium\" >-->\n <!-- <ion-icon slot=\"start\" name=\"person-circle-outline\"></ion-icon>-->\n <!-- </ion-button>-->\n <!-- </ion-buttons>-->\n <ion-icon slot=\"start\" name=\"person-circle-outline\" />\n\n <ion-label color=\"medium\">\n @if ($user()?.record?.names; as names) {\n {{ names | personNames }}\n } @else {\n @if ($authState()?.user; as user) {\n {{ user.displayName || user.email || user.phoneNumber || user.uid }}\n }\n }\n </ion-label>\n\n <ion-buttons slot=\"end\">\n <!--\t\t<ion-button color=\"medium\" title=\"Settings\">-->\n <!--\t\t\t<ion-icon name=\"settings-outline\"></ion-icon>-->\n <!--\t\t</ion-button>-->\n <ion-button color=\"medium\" title=\"Sign-out\" (click)=\"logout($event)\">\n <ion-icon name=\"log-out-outline\" />\n </ion-button>\n </ion-buttons>\n </ion-item>\n}\n@if ($err()) {\n <ion-item> ERROR: {{ $err() | json }}</ion-item>\n}\n", dependencies: [{ kind: "ngmodule", type: RouterModule }, { kind: "directive", type: i1.RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "browserUrl", "routerLink"] }, { kind: "component", type: IonItemDivider, selector: "ion-item-divider", inputs: ["color", "mode", "sticky"] }, { kind: "component", type: IonLabel, selector: "ion-label", inputs: ["color", "mode", "position"] }, { kind: "component", type: IonItem, selector: "ion-item", inputs: ["button", "color", "detail", "detailIcon", "disabled", "download", "href", "lines", "mode", "rel", "routerAnimation", "routerDirection", "target", "type"] }, { kind: "component", type: IonIcon, selector: "ion-icon", inputs: ["color", "flipRtl", "icon", "ios", "lazy", "md", "mode", "name", "sanitize", "size", "src"] }, { kind: "component", type: IonButtons, selector: "ion-buttons", inputs: ["collapse"] }, { kind: "component", type: IonButton, selector: "ion-button", inputs: ["buttonType", "color", "disabled", "download", "expand", "fill", "form", "href", "mode", "rel", "routerAnimation", "routerDirection", "shape", "size", "strong", "target", "type"], outputs: ["ionFocus", "ionBlur"] }, { kind: "pipe", type: PersonNamesPipe, name: "personNames" }, { kind: "pipe", type: JsonPipe, name: "json" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
71
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.3", type: AuthMenuItemComponent, isStandalone: true, selector: "sneat-auth-menu-item", ngImport: i0, template: "<ion-item-divider color=\"header\">\n @if ($authStatus() === \"authenticated\") {\n <ion-label>Signed in as</ion-label>\n } @else {\n <ion-label>Authentication</ion-label>\n }\n</ion-item-divider>\n@if (!$authState()) {\n <ion-item>\n <ion-label>Loading....</ion-label>\n </ion-item>\n} @else if ($isAuthenticating()) {\n <ion-item data-testid=\"authenticating\" routerLink=\"login\">\n <ion-icon slot=\"start\" name=\"person-circle-outline\" />\n <ion-label>Authenticating...</ion-label>\n <ion-buttons slot=\"end\">\n <ion-spinner\n name=\"lines-small\"\n color=\"medium\"\n aria-label=\"Authenticating\"\n />\n </ion-buttons>\n </ion-item>\n}\n@if ($authStatus() === \"notAuthenticated\") {\n <ion-item routerLink=\"/login\" tappable=\"true\">\n <ion-icon slot=\"start\" name=\"person-circle-outline\" />\n <ion-label color=\"primary\"> Please sign in</ion-label>\n </ion-item>\n}\n@if ($authStatus() === \"authenticated\") {\n <ion-item\n tappable=\"true\"\n routerLink=\"/my\"\n routerDirection=\"forward\"\n (click)=\"closeMenu()\"\n >\n <!-- <ion-buttons slot=\"start\" class=\"ion-no-margin\">-->\n <!-- <ion-button disabled color=\"medium\" >-->\n <!-- <ion-icon slot=\"start\" name=\"person-circle-outline\"></ion-icon>-->\n <!-- </ion-button>-->\n <!-- </ion-buttons>-->\n <ion-icon slot=\"start\" name=\"person-circle-outline\" />\n\n <ion-label color=\"medium\">\n @if ($user()?.record?.names; as names) {\n {{ names | personNames }}\n } @else {\n @if ($authState()?.user; as user) {\n {{ user.displayName || user.email || user.phoneNumber || user.uid }}\n }\n }\n </ion-label>\n\n <ion-buttons slot=\"end\">\n <!--\t\t<ion-button color=\"medium\" title=\"Settings\">-->\n <!--\t\t\t<ion-icon name=\"settings-outline\"></ion-icon>-->\n <!--\t\t</ion-button>-->\n <ion-button color=\"medium\" title=\"Sign-out\" (click)=\"logout($event)\">\n <ion-icon name=\"log-out-outline\" />\n </ion-button>\n </ion-buttons>\n </ion-item>\n}\n@if ($err()) {\n <ion-item> ERROR: {{ $err() | json }}</ion-item>\n}\n", dependencies: [{ kind: "ngmodule", type: RouterModule }, { kind: "directive", type: i1.RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "browserUrl", "routerLink"] }, { kind: "component", type: IonItemDivider, selector: "ion-item-divider", inputs: ["color", "mode", "sticky"] }, { kind: "component", type: IonLabel, selector: "ion-label", inputs: ["color", "mode", "position"] }, { kind: "component", type: IonItem, selector: "ion-item", inputs: ["button", "color", "detail", "detailIcon", "disabled", "download", "href", "lines", "mode", "rel", "routerAnimation", "routerDirection", "target", "type"] }, { kind: "component", type: IonIcon, selector: "ion-icon", inputs: ["color", "flipRtl", "icon", "ios", "lazy", "md", "mode", "name", "sanitize", "size", "src"] }, { kind: "component", type: IonButtons, selector: "ion-buttons", inputs: ["collapse"] }, { kind: "component", type: IonButton, selector: "ion-button", inputs: ["buttonType", "color", "disabled", "download", "expand", "fill", "form", "href", "mode", "rel", "routerAnimation", "routerDirection", "shape", "size", "strong", "target", "type"], outputs: ["ionFocus", "ionBlur"] }, { kind: "component", type: IonSpinner, selector: "ion-spinner", inputs: ["color", "duration", "name", "paused"] }, { kind: "pipe", type: PersonNamesPipe, name: "personNames" }, { kind: "pipe", type: JsonPipe, name: "json" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
72
72
  }
73
73
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: AuthMenuItemComponent, decorators: [{
74
74
  type: Component,
@@ -81,7 +81,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImpor
81
81
  IonIcon,
82
82
  IonButtons,
83
83
  IonButton,
84
+ IonSpinner,
84
85
  JsonPipe,
85
- ], changeDetection: ChangeDetectionStrategy.OnPush, template: "<ion-item-divider color=\"light\">\n @if ($authStatus() === \"authenticated\") {\n <ion-label>Signed in as</ion-label>\n } @else {\n <ion-label>Authentication</ion-label>\n }\n</ion-item-divider>\n@if (!$authState()) {\n <ion-item>\n <ion-label>Loading....</ion-label>\n </ion-item>\n} @else if ($isAuthenticating()) {\n <ion-item routerLink=\"login\">\n <ion-label>Authenticating....</ion-label>\n </ion-item>\n}\n@if ($authStatus() === \"notAuthenticated\") {\n <ion-item routerLink=\"/login\" tappable=\"true\">\n <ion-icon slot=\"start\" name=\"person-circle-outline\" />\n <ion-label color=\"primary\"> Please sign in</ion-label>\n </ion-item>\n}\n@if ($authStatus() === \"authenticated\") {\n <ion-item\n tappable=\"true\"\n routerLink=\"/my\"\n routerDirection=\"forward\"\n (click)=\"closeMenu()\"\n >\n <!-- <ion-buttons slot=\"start\" class=\"ion-no-margin\">-->\n <!-- <ion-button disabled color=\"medium\" >-->\n <!-- <ion-icon slot=\"start\" name=\"person-circle-outline\"></ion-icon>-->\n <!-- </ion-button>-->\n <!-- </ion-buttons>-->\n <ion-icon slot=\"start\" name=\"person-circle-outline\" />\n\n <ion-label color=\"medium\">\n @if ($user()?.record?.names; as names) {\n {{ names | personNames }}\n } @else {\n @if ($authState()?.user; as user) {\n {{ user.displayName || user.email || user.phoneNumber || user.uid }}\n }\n }\n </ion-label>\n\n <ion-buttons slot=\"end\">\n <!--\t\t<ion-button color=\"medium\" title=\"Settings\">-->\n <!--\t\t\t<ion-icon name=\"settings-outline\"></ion-icon>-->\n <!--\t\t</ion-button>-->\n <ion-button color=\"medium\" title=\"Sign-out\" (click)=\"logout($event)\">\n <ion-icon name=\"log-out-outline\" />\n </ion-button>\n </ion-buttons>\n </ion-item>\n}\n@if ($err()) {\n <ion-item> ERROR: {{ $err() | json }}</ion-item>\n}\n" }]
86
+ ], changeDetection: ChangeDetectionStrategy.OnPush, template: "<ion-item-divider color=\"header\">\n @if ($authStatus() === \"authenticated\") {\n <ion-label>Signed in as</ion-label>\n } @else {\n <ion-label>Authentication</ion-label>\n }\n</ion-item-divider>\n@if (!$authState()) {\n <ion-item>\n <ion-label>Loading....</ion-label>\n </ion-item>\n} @else if ($isAuthenticating()) {\n <ion-item data-testid=\"authenticating\" routerLink=\"login\">\n <ion-icon slot=\"start\" name=\"person-circle-outline\" />\n <ion-label>Authenticating...</ion-label>\n <ion-buttons slot=\"end\">\n <ion-spinner\n name=\"lines-small\"\n color=\"medium\"\n aria-label=\"Authenticating\"\n />\n </ion-buttons>\n </ion-item>\n}\n@if ($authStatus() === \"notAuthenticated\") {\n <ion-item routerLink=\"/login\" tappable=\"true\">\n <ion-icon slot=\"start\" name=\"person-circle-outline\" />\n <ion-label color=\"primary\"> Please sign in</ion-label>\n </ion-item>\n}\n@if ($authStatus() === \"authenticated\") {\n <ion-item\n tappable=\"true\"\n routerLink=\"/my\"\n routerDirection=\"forward\"\n (click)=\"closeMenu()\"\n >\n <!-- <ion-buttons slot=\"start\" class=\"ion-no-margin\">-->\n <!-- <ion-button disabled color=\"medium\" >-->\n <!-- <ion-icon slot=\"start\" name=\"person-circle-outline\"></ion-icon>-->\n <!-- </ion-button>-->\n <!-- </ion-buttons>-->\n <ion-icon slot=\"start\" name=\"person-circle-outline\" />\n\n <ion-label color=\"medium\">\n @if ($user()?.record?.names; as names) {\n {{ names | personNames }}\n } @else {\n @if ($authState()?.user; as user) {\n {{ user.displayName || user.email || user.phoneNumber || user.uid }}\n }\n }\n </ion-label>\n\n <ion-buttons slot=\"end\">\n <!--\t\t<ion-button color=\"medium\" title=\"Settings\">-->\n <!--\t\t\t<ion-icon name=\"settings-outline\"></ion-icon>-->\n <!--\t\t</ion-button>-->\n <ion-button color=\"medium\" title=\"Sign-out\" (click)=\"logout($event)\">\n <ion-icon name=\"log-out-outline\" />\n </ion-button>\n </ion-buttons>\n </ion-item>\n}\n@if ($err()) {\n <ion-item> ERROR: {{ $err() | json }}</ion-item>\n}\n" }]
86
87
  }], ctorParameters: () => [] });
87
88
  //# sourceMappingURL=auth-menu-item.component.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"auth-menu-item.component.js","sourceRoot":"","sources":["../../../../../../../../libs/auth/ui/src/lib/components/auth-menu-item/auth-menu-item.component.ts","../../../../../../../../libs/auth/ui/src/lib/components/auth-menu-item/auth-menu-item.component.html"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EACL,uBAAuB,EACvB,SAAS,EACT,QAAQ,EACR,MAAM,EAEN,MAAM,GACP,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EACL,SAAS,EACT,UAAU,EACV,OAAO,EACP,OAAO,EACP,cAAc,EACd,QAAQ,EACR,cAAc,EACd,aAAa,GACd,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAGL,qBAAqB,EACrB,gBAAgB,GACjB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,WAAW,EAAgB,MAAM,aAAa,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;;;AAiB7E,MAAM,OAAO,qBAAqB;IAmBzB,WAAW;QAChB,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC;QACvB,IAAI,CAAC,UAAU,CAAC,QAAQ,EAAE,CAAC;IAC7B,CAAC;IAED;QAvBiB,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AAC,CAAC;YACnD,CAAC;SACF,CAAC,CAAC;IACL,CAAC;IAEM,SAAS;QACd,IAAI,CAAC,cAAc;aAChB,KAAK,EAAE;aACP,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,eAAe,CAAC,sBAAsB,CAAC,CAAC,CAAC;IACrE,CAAC;IAEM,MAAM,CAAC,KAAY;QACxB,KAAK,CAAC,eAAe,EAAE,CAAC;QACxB,KAAK,CAAC,cAAc,EAAE,CAAC;QACvB,IAAI,CAAC;YACH,IAAI,CAAC,gBAAgB;iBAClB,OAAO,EAAE;iBACT,IAAI,CAAC,GAAG,EAAE;gBACT,IAAI,CAAC,OAAO;qBACT,YAAY,CAAC,aAAa,CAAC;qBAC3B,KAAK,CACJ,IAAI,CAAC,WAAW,CAAC,eAAe,CAC9B,uCAAuC,CACxC,CACF,CAAC;YACN,CAAC,CAAC;iBACD,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,eAAe,CAAC,oBAAoB,CAAC,CAAC,CAAC;QACnE,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC,EAAE,kBAAkB,CAAC,CAAC;QACnD,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;8GAnEU,qBAAqB;kGAArB,qBAAqB,gFC7ClC,q6DA2DA,2CD1BI,YAAY,8RAEZ,cAAc,kGACd,QAAQ,6FACR,OAAO,0NACP,OAAO,2JACP,UAAU,8EACV,SAAS,iRANT,eAAe,+CAOf,QAAQ;;2FAIC,qBAAqB;kBAhBjC,SAAS;+BACE,sBAAsB,WAEvB;wBACP,YAAY;wBACZ,eAAe;wBACf,cAAc;wBACd,QAAQ;wBACR,OAAO;wBACP,OAAO;wBACP,UAAU;wBACV,SAAS;wBACT,QAAQ;qBACT,mBACgB,uBAAuB,CAAC,MAAM","sourcesContent":["import { JsonPipe } from '@angular/common';\nimport {\n ChangeDetectionStrategy,\n Component,\n computed,\n signal,\n OnDestroy,\n inject,\n} from '@angular/core';\nimport { RouterModule } from '@angular/router';\nimport {\n IonButton,\n IonButtons,\n IonIcon,\n IonItem,\n IonItemDivider,\n IonLabel,\n MenuController,\n NavController,\n} from '@ionic/angular';\nimport {\n ISneatAuthState,\n ISneatUserState,\n SneatAuthStateService,\n SneatUserService,\n} from '@sneat/auth-core';\nimport { ErrorLogger, IErrorLogger } from '@sneat/core';\nimport { Subject, takeUntil } from 'rxjs';\nimport { PersonNamesPipe, personNames } from '../../pipes/person-names.pipe';\n@Component({\n selector: 'sneat-auth-menu-item',\n templateUrl: './auth-menu-item.component.html',\n imports: [\n RouterModule,\n PersonNamesPipe,\n IonItemDivider,\n IonLabel,\n IonItem,\n IonIcon,\n IonButtons,\n IonButton,\n JsonPipe,\n ],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class AuthMenuItemComponent implements OnDestroy {\n private readonly errorLogger = inject<IErrorLogger>(ErrorLogger);\n private readonly navCtrl = inject(NavController);\n private readonly authStateService = inject(SneatAuthStateService);\n private readonly menuController = inject(MenuController);\n\n protected readonly $user = signal<ISneatUserState | undefined>(undefined);\n protected $err = signal<unknown>(undefined);\n\n protected readonly $authState = signal<ISneatAuthState | undefined>(\n undefined,\n );\n protected readonly $authStatus = computed(() => this.$authState()?.status);\n protected readonly $isAuthenticating = computed(\n () => this.$authStatus() === 'authenticating',\n );\n\n protected readonly $destroyed = new Subject<void>();\n\n public ngOnDestroy(): void {\n this.$destroyed.next();\n this.$destroyed.complete();\n }\n\n constructor() {\n const errorLogger = this.errorLogger;\n const authStateService = this.authStateService;\n const userService = inject(SneatUserService);\n\n userService.userState\n .pipe(takeUntil(this.$destroyed))\n .subscribe(this.$user.set);\n authStateService.authState.pipe(takeUntil(this.$destroyed)).subscribe({\n next: this.$authState.set,\n error: (err) => {\n this.$err.set(err);\n errorLogger.logError('failed to get auth state');\n },\n });\n }\n\n public closeMenu(): void {\n this.menuController\n .close()\n .catch(this.errorLogger.logErrorHandler('Failed to close menu'));\n }\n\n public logout(event: Event): boolean {\n event.stopPropagation();\n event.preventDefault();\n try {\n this.authStateService\n .signOut()\n .then(() => {\n this.navCtrl\n .navigateBack('/signed-out')\n .catch(\n this.errorLogger.logErrorHandler(\n 'Failed to navigate to signed out page',\n ),\n );\n })\n .catch(this.errorLogger.logErrorHandler('Failed to sign out'));\n } catch (e) {\n this.errorLogger.logError(e, 'Failed to logout');\n }\n return false;\n }\n\n protected readonly personName = personNames;\n}\n","<ion-item-divider color=\"light\">\n @if ($authStatus() === \"authenticated\") {\n <ion-label>Signed in as</ion-label>\n } @else {\n <ion-label>Authentication</ion-label>\n }\n</ion-item-divider>\n@if (!$authState()) {\n <ion-item>\n <ion-label>Loading....</ion-label>\n </ion-item>\n} @else if ($isAuthenticating()) {\n <ion-item routerLink=\"login\">\n <ion-label>Authenticating....</ion-label>\n </ion-item>\n}\n@if ($authStatus() === \"notAuthenticated\") {\n <ion-item routerLink=\"/login\" tappable=\"true\">\n <ion-icon slot=\"start\" name=\"person-circle-outline\" />\n <ion-label color=\"primary\"> Please sign in</ion-label>\n </ion-item>\n}\n@if ($authStatus() === \"authenticated\") {\n <ion-item\n tappable=\"true\"\n routerLink=\"/my\"\n routerDirection=\"forward\"\n (click)=\"closeMenu()\"\n >\n <!-- <ion-buttons slot=\"start\" class=\"ion-no-margin\">-->\n <!-- <ion-button disabled color=\"medium\" >-->\n <!-- <ion-icon slot=\"start\" name=\"person-circle-outline\"></ion-icon>-->\n <!-- </ion-button>-->\n <!-- </ion-buttons>-->\n <ion-icon slot=\"start\" name=\"person-circle-outline\" />\n\n <ion-label color=\"medium\">\n @if ($user()?.record?.names; as names) {\n {{ names | personNames }}\n } @else {\n @if ($authState()?.user; as user) {\n {{ user.displayName || user.email || user.phoneNumber || user.uid }}\n }\n }\n </ion-label>\n\n <ion-buttons slot=\"end\">\n <!--\t\t<ion-button color=\"medium\" title=\"Settings\">-->\n <!--\t\t\t<ion-icon name=\"settings-outline\"></ion-icon>-->\n <!--\t\t</ion-button>-->\n <ion-button color=\"medium\" title=\"Sign-out\" (click)=\"logout($event)\">\n <ion-icon name=\"log-out-outline\" />\n </ion-button>\n </ion-buttons>\n </ion-item>\n}\n@if ($err()) {\n <ion-item> ERROR: {{ $err() | json }}</ion-item>\n}\n"]}
1
+ {"version":3,"file":"auth-menu-item.component.js","sourceRoot":"","sources":["../../../../../../../../libs/auth/ui/src/lib/components/auth-menu-item/auth-menu-item.component.ts","../../../../../../../../libs/auth/ui/src/lib/components/auth-menu-item/auth-menu-item.component.html"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EACL,uBAAuB,EACvB,SAAS,EACT,QAAQ,EACR,MAAM,EAEN,MAAM,GACP,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EACL,SAAS,EACT,UAAU,EACV,OAAO,EACP,OAAO,EACP,cAAc,EACd,QAAQ,EACR,UAAU,EACV,cAAc,EACd,aAAa,GACd,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAGL,qBAAqB,EACrB,gBAAgB,GACjB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,WAAW,EAAgB,MAAM,aAAa,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;;;AAkB7E,MAAM,OAAO,qBAAqB;IAmBzB,WAAW;QAChB,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC;QACvB,IAAI,CAAC,UAAU,CAAC,QAAQ,EAAE,CAAC;IAC7B,CAAC;IAED;QAvBiB,gBAAW,GAAG,MAAM,CAAe,WAAW,CAAC,CAAC;QAChD,YAAO,GAAG,MAAM,CAAC,aAAa,CAAC,CAAC;QAChC,qBAAgB,GAAG,MAAM,CAAC,qBAAqB,CAAC,C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AAC,eAAe,CAAC,sBAAsB,CAAC,CAAC,CAAC;IACrE,CAAC;IAEM,MAAM,CAAC,KAAY;QACxB,KAAK,CAAC,eAAe,EAAE,CAAC;QACxB,KAAK,CAAC,cAAc,EAAE,CAAC;QACvB,IAAI,CAAC;YACH,IAAI,CAAC,gBAAgB;iBAClB,OAAO,EAAE;iBACT,IAAI,CAAC,GAAG,EAAE;gBACT,IAAI,CAAC,OAAO;qBACT,YAAY,CAAC,aAAa,CAAC;qBAC3B,KAAK,CACJ,IAAI,CAAC,WAAW,CAAC,eAAe,CAC9B,uCAAuC,CACxC,CACF,CAAC;YACN,CAAC,CAAC;iBACD,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,eAAe,CAAC,oBAAoB,CAAC,CAAC,CAAC;QACnE,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC,EAAE,kBAAkB,CAAC,CAAC;QACnD,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;8GAnEU,qBAAqB;kGAArB,qBAAqB,gFC/ClC,qrEAmEA,2CDjCI,YAAY,8RAEZ,cAAc,kGACd,QAAQ,6FACR,OAAO,0NACP,OAAO,2JACP,UAAU,8EACV,SAAS,sRACT,UAAU,oGAPV,eAAe,+CAQf,QAAQ;;2FAIC,qBAAqB;kBAjBjC,SAAS;+BACE,sBAAsB,WAEvB;wBACP,YAAY;wBACZ,eAAe;wBACf,cAAc;wBACd,QAAQ;wBACR,OAAO;wBACP,OAAO;wBACP,UAAU;wBACV,SAAS;wBACT,UAAU;wBACV,QAAQ;qBACT,mBACgB,uBAAuB,CAAC,MAAM","sourcesContent":["import { JsonPipe } from '@angular/common';\nimport {\n ChangeDetectionStrategy,\n Component,\n computed,\n signal,\n OnDestroy,\n inject,\n} from '@angular/core';\nimport { RouterModule } from '@angular/router';\nimport {\n IonButton,\n IonButtons,\n IonIcon,\n IonItem,\n IonItemDivider,\n IonLabel,\n IonSpinner,\n MenuController,\n NavController,\n} from '@ionic/angular';\nimport {\n ISneatAuthState,\n ISneatUserState,\n SneatAuthStateService,\n SneatUserService,\n} from '@sneat/auth-core';\nimport { ErrorLogger, IErrorLogger } from '@sneat/core';\nimport { Subject, takeUntil } from 'rxjs';\nimport { PersonNamesPipe, personNames } from '../../pipes/person-names.pipe';\n@Component({\n selector: 'sneat-auth-menu-item',\n templateUrl: './auth-menu-item.component.html',\n imports: [\n RouterModule,\n PersonNamesPipe,\n IonItemDivider,\n IonLabel,\n IonItem,\n IonIcon,\n IonButtons,\n IonButton,\n IonSpinner,\n JsonPipe,\n ],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class AuthMenuItemComponent implements OnDestroy {\n private readonly errorLogger = inject<IErrorLogger>(ErrorLogger);\n private readonly navCtrl = inject(NavController);\n private readonly authStateService = inject(SneatAuthStateService);\n private readonly menuController = inject(MenuController);\n\n protected readonly $user = signal<ISneatUserState | undefined>(undefined);\n protected $err = signal<unknown>(undefined);\n\n protected readonly $authState = signal<ISneatAuthState | undefined>(\n undefined,\n );\n protected readonly $authStatus = computed(() => this.$authState()?.status);\n protected readonly $isAuthenticating = computed(\n () => this.$authStatus() === 'authenticating',\n );\n\n protected readonly $destroyed = new Subject<void>();\n\n public ngOnDestroy(): void {\n this.$destroyed.next();\n this.$destroyed.complete();\n }\n\n constructor() {\n const errorLogger = this.errorLogger;\n const authStateService = this.authStateService;\n const userService = inject(SneatUserService);\n\n userService.userState\n .pipe(takeUntil(this.$destroyed))\n .subscribe(this.$user.set);\n authStateService.authState.pipe(takeUntil(this.$destroyed)).subscribe({\n next: this.$authState.set,\n error: (err) => {\n this.$err.set(err);\n errorLogger.logError('failed to get auth state');\n },\n });\n }\n\n public closeMenu(): void {\n this.menuController\n .close()\n .catch(this.errorLogger.logErrorHandler('Failed to close menu'));\n }\n\n public logout(event: Event): boolean {\n event.stopPropagation();\n event.preventDefault();\n try {\n this.authStateService\n .signOut()\n .then(() => {\n this.navCtrl\n .navigateBack('/signed-out')\n .catch(\n this.errorLogger.logErrorHandler(\n 'Failed to navigate to signed out page',\n ),\n );\n })\n .catch(this.errorLogger.logErrorHandler('Failed to sign out'));\n } catch (e) {\n this.errorLogger.logError(e, 'Failed to logout');\n }\n return false;\n }\n\n protected readonly personName = personNames;\n}\n","<ion-item-divider color=\"header\">\n @if ($authStatus() === \"authenticated\") {\n <ion-label>Signed in as</ion-label>\n } @else {\n <ion-label>Authentication</ion-label>\n }\n</ion-item-divider>\n@if (!$authState()) {\n <ion-item>\n <ion-label>Loading....</ion-label>\n </ion-item>\n} @else if ($isAuthenticating()) {\n <ion-item data-testid=\"authenticating\" routerLink=\"login\">\n <ion-icon slot=\"start\" name=\"person-circle-outline\" />\n <ion-label>Authenticating...</ion-label>\n <ion-buttons slot=\"end\">\n <ion-spinner\n name=\"lines-small\"\n color=\"medium\"\n aria-label=\"Authenticating\"\n />\n </ion-buttons>\n </ion-item>\n}\n@if ($authStatus() === \"notAuthenticated\") {\n <ion-item routerLink=\"/login\" tappable=\"true\">\n <ion-icon slot=\"start\" name=\"person-circle-outline\" />\n <ion-label color=\"primary\"> Please sign in</ion-label>\n </ion-item>\n}\n@if ($authStatus() === \"authenticated\") {\n <ion-item\n tappable=\"true\"\n routerLink=\"/my\"\n routerDirection=\"forward\"\n (click)=\"closeMenu()\"\n >\n <!-- <ion-buttons slot=\"start\" class=\"ion-no-margin\">-->\n <!-- <ion-button disabled color=\"medium\" >-->\n <!-- <ion-icon slot=\"start\" name=\"person-circle-outline\"></ion-icon>-->\n <!-- </ion-button>-->\n <!-- </ion-buttons>-->\n <ion-icon slot=\"start\" name=\"person-circle-outline\" />\n\n <ion-label color=\"medium\">\n @if ($user()?.record?.names; as names) {\n {{ names | personNames }}\n } @else {\n @if ($authState()?.user; as user) {\n {{ user.displayName || user.email || user.phoneNumber || user.uid }}\n }\n }\n </ion-label>\n\n <ion-buttons slot=\"end\">\n <!--\t\t<ion-button color=\"medium\" title=\"Settings\">-->\n <!--\t\t\t<ion-icon name=\"settings-outline\"></ion-icon>-->\n <!--\t\t</ion-button>-->\n <ion-button color=\"medium\" title=\"Sign-out\" (click)=\"logout($event)\">\n <ion-icon name=\"log-out-outline\" />\n </ion-button>\n </ion-buttons>\n </ion-item>\n}\n@if ($err()) {\n <ion-item> ERROR: {{ $err() | json }}</ion-item>\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sneat/auth-ui",
3
- "version": "0.27.5",
3
+ "version": "0.27.6",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },