@sneat/auth-ui 0.27.41 → 0.27.42

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,10 +1,11 @@
1
+ import { AuthProviderButtonsComponent, OAUTH_PROVIDER_IDS, } from '@sneat/auth-ui/provider-buttons';
1
2
  import { ChangeDetectionStrategy, Component, DestroyRef, EventEmitter, Output, computed, inject, input, signal, } from '@angular/core';
2
3
  import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
3
4
  import { RouterLink } from '@angular/router';
4
5
  import { Capacitor } from '@capacitor/core';
5
6
  import { AuthStatuses, SneatAuthStateService, SneatUserService, authProviderTitle, isAccountExistsWithDifferentCredential, isSneatAccountReady, } from '@sneat/auth-core';
6
7
  import { ErrorLogger } from '@sneat/core';
7
- import { IonButton, IonCard, IonCol, IonGrid, IonIcon, IonItem, IonItemDivider, IonLabel, IonList, IonRow, IonSpinner, IonText, } from '@ionic/angular';
8
+ import { IonButton, IonCard, IonCol, IonGrid, IonIcon, IonItemDivider, IonLabel, IonRow, IonSpinner, IonText, } from '@ionic/angular';
8
9
  import { EmailLoginFormComponent, } from './email-login-form/email-login-form.component';
9
10
  import { LoginWithTelegramComponent } from './login-with-telegram.component';
10
11
  import { safeAuthReturnPath } from './safe-auth-return-path';
@@ -28,6 +29,9 @@ export class AuthPanelComponent {
28
29
  this.accountReadyChange = new EventEmitter();
29
30
  this.signingWith = signal(undefined, /* @ts-ignore */
30
31
  ...(ngDevMode ? [{ debugName: "signingWith" }] : /* istanbul ignore next */ []));
32
+ this.oauthProviders = OAUTH_PROVIDER_IDS.filter((provider) => this.providerVisible(provider));
33
+ this.oauthSigningWith = computed(() => OAUTH_PROVIDER_IDS.find((provider) => provider === this.signingWith()), /* @ts-ignore */
34
+ ...(ngDevMode ? [{ debugName: "oauthSigningWith" }] : /* istanbul ignore next */ []));
31
35
  this.authRecoveryNeeded = signal(false, /* @ts-ignore */
32
36
  ...(ngDevMode ? [{ debugName: "authRecoveryNeeded" }] : /* istanbul ignore next */ []));
33
37
  /**
@@ -159,12 +163,13 @@ export class AuthPanelComponent {
159
163
  this.userService.onUserSignedIn(authState);
160
164
  }
161
165
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: AuthPanelComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
162
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.3", type: AuthPanelComponent, isStandalone: true, selector: "sneat-auth-panel", inputs: { returnTo: { classPropertyName: "returnTo", publicName: "returnTo", isSignal: true, isRequired: false, transformFunction: null }, initialMode: { classPropertyName: "initialMode", publicName: "initialMode", isSignal: true, isRequired: false, transformFunction: null }, showIntro: { classPropertyName: "showIntro", publicName: "showIntro", isSignal: true, isRequired: false, transformFunction: null }, showCredentials: { classPropertyName: "showCredentials", publicName: "showCredentials", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { accountReadyChange: "accountReadyChange" }, providers: [RandomIdService], ngImport: i0, template: "@if (authRecoveryNeeded()) {\n <div class=\"ion-padding ion-text-center\" role=\"alert\">\n <p>\n We couldn't complete sign-in. Try again with email or another sign-in\n method.\n </p>\n </div>\n}\n\n@if (pendingLink(); as link) {\n <div class=\"ion-padding ion-text-center\" role=\"alert\">\n <p>\n @if (link.email) {\n <b>{{ link.email }}</b> already has an account.\n } @else {\n This email already has an account.\n }\n Sign in the way you did before \u2014 with email or another sign-in method \u2014\n @if (link.autoLink) {\n and we'll connect {{ link.provider }} to it automatically.\n } @else {\n then connect {{ link.provider }} from your account page.\n }\n </p>\n </div>\n}\n\n@if (recordState() === 'failed') {\n <div class=\"ion-padding ion-text-center\" role=\"alert\">\n <p>Your account is still being prepared. Retry before continuing.</p>\n <ion-button fill=\"outline\" (click)=\"retryUserRecordInitialization()\">\n Retry account setup\n </ion-button>\n </div>\n} @else if (recordState() === 'loading') {\n <div class=\"ion-padding ion-text-center\" role=\"status\" aria-live=\"polite\">\n <ion-spinner name=\"lines-small\" />\n <p>Preparing your account\u2026</p>\n </div>\n} @else {\n @if (showCredentials() || authRecoveryNeeded()) {\n @if (showIntro()) {\n <p style=\"text-align: center; font-size: smaller\">\n <ion-text color=\"medium\">Sign in with your Sneat account.</ion-text>\n </p>\n }\n\n <sneat-email-login-form\n [returnTo]=\"safeReturnTo()\"\n [initialMode]=\"initialMode()\"\n (signingWithChange)=\"onEmailFormStatusChanged($event)\"\n (loggedIn)=\"onLoggedIn($event)\"\n />\n\n <div class=\"ion-padding-horizontal ion-text-center\">\n <ion-button\n fill=\"outline\"\n expand=\"block\"\n routerLink=\"/sso\"\n [queryParams]=\"ssoQueryParams()\"\n [disabled]=\"!!signingWith()\"\n >\n <ion-icon name=\"business-outline\" slot=\"start\" />\n Sign in with company SSO\n </ion-button>\n </div>\n\n @if (uiConfig.quickLoginProviders?.length !== 0) {\n <ion-card>\n @if (uiConfig.showQuickLoginHeader !== false) {\n <ion-item-divider color=\"light\">\n <ion-label\n color=\"medium\"\n style=\"text-align: center; width: 100%; font-weight: bold\"\n >\n Quick login\n </ion-label>\n </ion-item-divider>\n }\n <ion-grid class=\"ion-grid-layout\">\n @if (!isNativePlatform && providerVisible('telegram')) {\n <ion-row>\n <ion-col>\n <div class=\"ion-padding\" style=\"text-align: center\">\n <sneat-login-with-telegram />\n </div>\n </ion-col>\n </ion-row>\n }\n <ion-row>\n @if (providerVisible('google.com')) {\n <ion-col size=\"12\" size-md=\"6\">\n <ion-list lines=\"none\">\n <ion-item\n (click)=\"loginWith('google.com')\"\n tappable\n [disabled]=\"!!signingWith()\"\n >\n @if (signingWith() === 'google.com') {\n <ion-spinner slot=\"start\" name=\"lines-small\" />\n } @else {\n <ion-icon\n color=\"danger\"\n name=\"logo-google\"\n slot=\"start\"\n />\n }\n <ion-label color=\"danger\"> Login with Google</ion-label>\n </ion-item>\n </ion-list>\n </ion-col>\n }\n @if (providerVisible('apple.com')) {\n <ion-col size=\"12\" size-md=\"6\">\n <ion-list lines=\"none\">\n <ion-item\n (click)=\"loginWith('apple.com')\"\n tappable\n [disabled]=\"!!signingWith()\"\n >\n @if (signingWith() === 'apple.com') {\n <ion-spinner slot=\"start\" name=\"lines-small\" />\n } @else {\n <ion-icon color=\"dark\" name=\"logo-apple\" slot=\"start\" />\n }\n <ion-label color=\"dark\">Login with Apple</ion-label>\n </ion-item>\n </ion-list>\n </ion-col>\n }\n </ion-row>\n <ion-row>\n @if (providerVisible('microsoft.com')) {\n <ion-col size=\"12\" size-md=\"6\">\n <ion-list lines=\"none\">\n <ion-item\n (click)=\"loginWith('microsoft.com')\"\n tappable\n [disabled]=\"!!signingWith()\"\n >\n @if (signingWith() === 'microsoft.com') {\n <ion-spinner\n slot=\"start\"\n color=\"secondary\"\n name=\"lines-small\"\n />\n } @else {\n <ion-icon\n slot=\"start\"\n color=\"secondary\"\n name=\"logo-windows\"\n />\n }\n <ion-label color=\"secondary\"\n >Login with Microsoft</ion-label\n >\n </ion-item>\n </ion-list>\n </ion-col>\n }\n @if (providerVisible('facebook.com')) {\n <ion-col size=\"12\" size-md=\"6\">\n <ion-list lines=\"none\">\n <ion-item\n (click)=\"loginWith('facebook.com')\"\n tappable\n [disabled]=\"!!signingWith()\"\n >\n @if (signingWith() === 'facebook.com') {\n <ion-spinner\n slot=\"start\"\n color=\"primary\"\n name=\"lines-small\"\n />\n } @else {\n <ion-icon\n slot=\"start\"\n color=\"primary\"\n name=\"logo-facebook\"\n />\n }\n <ion-label color=\"primary\">Login with Facebook</ion-label>\n </ion-item>\n </ion-list>\n </ion-col>\n }\n </ion-row>\n <ion-row>\n @if (providerVisible('github.com')) {\n <ion-col size=\"12\" size-md=\"6\">\n <ion-list lines=\"none\">\n <ion-item\n (click)=\"loginWith('github.com')\"\n tappable\n [disabled]=\"!!signingWith()\"\n >\n @if (signingWith() === 'github.com') {\n <ion-spinner\n slot=\"start\"\n color=\"tertiary\"\n name=\"lines-small\"\n />\n } @else {\n <ion-icon\n slot=\"start\"\n color=\"tertiary\"\n name=\"logo-github\"\n />\n }\n <ion-label color=\"tertiary\">Login with GitHub</ion-label>\n </ion-item>\n </ion-list>\n </ion-col>\n }\n </ion-row>\n </ion-grid>\n </ion-card>\n }\n }\n}\n", dependencies: [{ kind: "directive", type: RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "browserUrl", "routerLink"] }, { kind: "component", type: EmailLoginFormComponent, selector: "sneat-email-login-form", inputs: ["returnTo", "initialMode"], outputs: ["signingWithChange", "loggedIn"] }, { kind: "component", type: LoginWithTelegramComponent, selector: "sneat-login-with-telegram", inputs: ["isUserAuthenticated", "botID", "size", "requestAccess", "userPic"] }, { 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: IonCard, selector: "ion-card", inputs: ["button", "color", "disabled", "download", "href", "mode", "rel", "routerAnimation", "routerDirection", "target", "type"] }, { kind: "component", type: IonCol, selector: "ion-col", inputs: ["offset", "offsetLg", "offsetMd", "offsetSm", "offsetXl", "offsetXs", "pull", "pullLg", "pullMd", "pullSm", "pullXl", "pullXs", "push", "pushLg", "pushMd", "pushSm", "pushXl", "pushXs", "size", "sizeLg", "sizeMd", "sizeSm", "sizeXl", "sizeXs"] }, { kind: "component", type: IonGrid, selector: "ion-grid", inputs: ["fixed"] }, { kind: "component", type: IonIcon, selector: "ion-icon", inputs: ["color", "flipRtl", "icon", "ios", "lazy", "md", "mode", "name", "sanitize", "size", "src"] }, { 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: IonItemDivider, selector: "ion-item-divider", inputs: ["color", "mode", "sticky"] }, { kind: "component", type: IonLabel, selector: "ion-label", inputs: ["color", "mode", "position"] }, { kind: "component", type: IonList, selector: "ion-list", inputs: ["inset", "lines", "mode"] }, { kind: "component", type: IonRow, selector: "ion-row" }, { kind: "component", type: IonSpinner, selector: "ion-spinner", inputs: ["color", "duration", "name", "paused"] }, { kind: "component", type: IonText, selector: "ion-text", inputs: ["color", "mode"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
166
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.3", type: AuthPanelComponent, isStandalone: true, selector: "sneat-auth-panel", inputs: { returnTo: { classPropertyName: "returnTo", publicName: "returnTo", isSignal: true, isRequired: false, transformFunction: null }, initialMode: { classPropertyName: "initialMode", publicName: "initialMode", isSignal: true, isRequired: false, transformFunction: null }, showIntro: { classPropertyName: "showIntro", publicName: "showIntro", isSignal: true, isRequired: false, transformFunction: null }, showCredentials: { classPropertyName: "showCredentials", publicName: "showCredentials", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { accountReadyChange: "accountReadyChange" }, providers: [RandomIdService], ngImport: i0, template: "@if (authRecoveryNeeded()) {\n <div class=\"ion-padding ion-text-center\" role=\"alert\">\n <p>\n We couldn't complete sign-in. Try again with email or another sign-in\n method.\n </p>\n </div>\n}\n\n@if (pendingLink(); as link) {\n <div class=\"ion-padding ion-text-center\" role=\"alert\">\n <p>\n @if (link.email) {\n <b>{{ link.email }}</b> already has an account.\n } @else {\n This email already has an account.\n }\n Sign in the way you did before \u2014 with email or another sign-in method \u2014\n @if (link.autoLink) {\n and we'll connect {{ link.provider }} to it automatically.\n } @else {\n then connect {{ link.provider }} from your account page.\n }\n </p>\n </div>\n}\n\n@if (recordState() === 'failed') {\n <div class=\"ion-padding ion-text-center\" role=\"alert\">\n <p>Your account is still being prepared. Retry before continuing.</p>\n <ion-button fill=\"outline\" (click)=\"retryUserRecordInitialization()\">\n Retry account setup\n </ion-button>\n </div>\n} @else if (recordState() === 'loading') {\n <div class=\"ion-padding ion-text-center\" role=\"status\" aria-live=\"polite\">\n <ion-spinner name=\"lines-small\" />\n <p>Preparing your account\u2026</p>\n </div>\n} @else {\n @if (showCredentials() || authRecoveryNeeded()) {\n @if (showIntro()) {\n <p style=\"text-align: center; font-size: smaller\">\n <ion-text color=\"medium\">Sign in with your Sneat account.</ion-text>\n </p>\n }\n\n <sneat-email-login-form\n [returnTo]=\"safeReturnTo()\"\n [initialMode]=\"initialMode()\"\n (signingWithChange)=\"onEmailFormStatusChanged($event)\"\n (loggedIn)=\"onLoggedIn($event)\"\n />\n\n <div class=\"ion-padding-horizontal ion-text-center\">\n <ion-button\n fill=\"outline\"\n expand=\"block\"\n routerLink=\"/sso\"\n [queryParams]=\"ssoQueryParams()\"\n [disabled]=\"!!signingWith()\"\n >\n <ion-icon name=\"business-outline\" slot=\"start\" />\n Sign in with company SSO\n </ion-button>\n </div>\n\n @if (uiConfig.quickLoginProviders?.length !== 0) {\n <ion-card>\n @if (uiConfig.showQuickLoginHeader !== false) {\n <ion-item-divider color=\"light\">\n <ion-label\n color=\"medium\"\n style=\"text-align: center; width: 100%; font-weight: bold\"\n >\n Quick login\n </ion-label>\n </ion-item-divider>\n }\n <ion-grid class=\"ion-grid-layout\">\n @if (!isNativePlatform && providerVisible('telegram')) {\n <ion-row>\n <ion-col>\n <div class=\"ion-padding\" style=\"text-align: center\">\n <sneat-login-with-telegram />\n </div>\n </ion-col>\n </ion-row>\n }\n <sneat-auth-provider-buttons\n [providers]=\"oauthProviders\"\n [busy]=\"oauthSigningWith()\"\n [disabled]=\"!!signingWith()\"\n (providerSelected)=\"loginWith($event)\"\n />\n </ion-grid>\n </ion-card>\n }\n }\n}\n", dependencies: [{ kind: "directive", type: RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "browserUrl", "routerLink"] }, { kind: "component", type: AuthProviderButtonsComponent, selector: "sneat-auth-provider-buttons", inputs: ["providers", "busy", "disabled", "labels"], outputs: ["providerSelected"] }, { kind: "component", type: EmailLoginFormComponent, selector: "sneat-email-login-form", inputs: ["returnTo", "initialMode"], outputs: ["signingWithChange", "loggedIn"] }, { kind: "component", type: LoginWithTelegramComponent, selector: "sneat-login-with-telegram", inputs: ["isUserAuthenticated", "botID", "size", "requestAccess", "userPic"] }, { 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: IonCard, selector: "ion-card", inputs: ["button", "color", "disabled", "download", "href", "mode", "rel", "routerAnimation", "routerDirection", "target", "type"] }, { kind: "component", type: IonCol, selector: "ion-col", inputs: ["offset", "offsetLg", "offsetMd", "offsetSm", "offsetXl", "offsetXs", "pull", "pullLg", "pullMd", "pullSm", "pullXl", "pullXs", "push", "pushLg", "pushMd", "pushSm", "pushXl", "pushXs", "size", "sizeLg", "sizeMd", "sizeSm", "sizeXl", "sizeXs"] }, { kind: "component", type: IonGrid, selector: "ion-grid", inputs: ["fixed"] }, { kind: "component", type: IonIcon, selector: "ion-icon", inputs: ["color", "flipRtl", "icon", "ios", "lazy", "md", "mode", "name", "sanitize", "size", "src"] }, { 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: IonRow, selector: "ion-row" }, { kind: "component", type: IonSpinner, selector: "ion-spinner", inputs: ["color", "duration", "name", "paused"] }, { kind: "component", type: IonText, selector: "ion-text", inputs: ["color", "mode"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
163
167
  }
164
168
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: AuthPanelComponent, decorators: [{
165
169
  type: Component,
166
170
  args: [{ selector: 'sneat-auth-panel', changeDetection: ChangeDetectionStrategy.OnPush, imports: [
167
171
  RouterLink,
172
+ AuthProviderButtonsComponent,
168
173
  EmailLoginFormComponent,
169
174
  LoginWithTelegramComponent,
170
175
  IonButton,
@@ -172,14 +177,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImpor
172
177
  IonCol,
173
178
  IonGrid,
174
179
  IonIcon,
175
- IonItem,
176
180
  IonItemDivider,
177
181
  IonLabel,
178
- IonList,
179
182
  IonRow,
180
183
  IonSpinner,
181
184
  IonText,
182
- ], providers: [RandomIdService], template: "@if (authRecoveryNeeded()) {\n <div class=\"ion-padding ion-text-center\" role=\"alert\">\n <p>\n We couldn't complete sign-in. Try again with email or another sign-in\n method.\n </p>\n </div>\n}\n\n@if (pendingLink(); as link) {\n <div class=\"ion-padding ion-text-center\" role=\"alert\">\n <p>\n @if (link.email) {\n <b>{{ link.email }}</b> already has an account.\n } @else {\n This email already has an account.\n }\n Sign in the way you did before \u2014 with email or another sign-in method \u2014\n @if (link.autoLink) {\n and we'll connect {{ link.provider }} to it automatically.\n } @else {\n then connect {{ link.provider }} from your account page.\n }\n </p>\n </div>\n}\n\n@if (recordState() === 'failed') {\n <div class=\"ion-padding ion-text-center\" role=\"alert\">\n <p>Your account is still being prepared. Retry before continuing.</p>\n <ion-button fill=\"outline\" (click)=\"retryUserRecordInitialization()\">\n Retry account setup\n </ion-button>\n </div>\n} @else if (recordState() === 'loading') {\n <div class=\"ion-padding ion-text-center\" role=\"status\" aria-live=\"polite\">\n <ion-spinner name=\"lines-small\" />\n <p>Preparing your account\u2026</p>\n </div>\n} @else {\n @if (showCredentials() || authRecoveryNeeded()) {\n @if (showIntro()) {\n <p style=\"text-align: center; font-size: smaller\">\n <ion-text color=\"medium\">Sign in with your Sneat account.</ion-text>\n </p>\n }\n\n <sneat-email-login-form\n [returnTo]=\"safeReturnTo()\"\n [initialMode]=\"initialMode()\"\n (signingWithChange)=\"onEmailFormStatusChanged($event)\"\n (loggedIn)=\"onLoggedIn($event)\"\n />\n\n <div class=\"ion-padding-horizontal ion-text-center\">\n <ion-button\n fill=\"outline\"\n expand=\"block\"\n routerLink=\"/sso\"\n [queryParams]=\"ssoQueryParams()\"\n [disabled]=\"!!signingWith()\"\n >\n <ion-icon name=\"business-outline\" slot=\"start\" />\n Sign in with company SSO\n </ion-button>\n </div>\n\n @if (uiConfig.quickLoginProviders?.length !== 0) {\n <ion-card>\n @if (uiConfig.showQuickLoginHeader !== false) {\n <ion-item-divider color=\"light\">\n <ion-label\n color=\"medium\"\n style=\"text-align: center; width: 100%; font-weight: bold\"\n >\n Quick login\n </ion-label>\n </ion-item-divider>\n }\n <ion-grid class=\"ion-grid-layout\">\n @if (!isNativePlatform && providerVisible('telegram')) {\n <ion-row>\n <ion-col>\n <div class=\"ion-padding\" style=\"text-align: center\">\n <sneat-login-with-telegram />\n </div>\n </ion-col>\n </ion-row>\n }\n <ion-row>\n @if (providerVisible('google.com')) {\n <ion-col size=\"12\" size-md=\"6\">\n <ion-list lines=\"none\">\n <ion-item\n (click)=\"loginWith('google.com')\"\n tappable\n [disabled]=\"!!signingWith()\"\n >\n @if (signingWith() === 'google.com') {\n <ion-spinner slot=\"start\" name=\"lines-small\" />\n } @else {\n <ion-icon\n color=\"danger\"\n name=\"logo-google\"\n slot=\"start\"\n />\n }\n <ion-label color=\"danger\"> Login with Google</ion-label>\n </ion-item>\n </ion-list>\n </ion-col>\n }\n @if (providerVisible('apple.com')) {\n <ion-col size=\"12\" size-md=\"6\">\n <ion-list lines=\"none\">\n <ion-item\n (click)=\"loginWith('apple.com')\"\n tappable\n [disabled]=\"!!signingWith()\"\n >\n @if (signingWith() === 'apple.com') {\n <ion-spinner slot=\"start\" name=\"lines-small\" />\n } @else {\n <ion-icon color=\"dark\" name=\"logo-apple\" slot=\"start\" />\n }\n <ion-label color=\"dark\">Login with Apple</ion-label>\n </ion-item>\n </ion-list>\n </ion-col>\n }\n </ion-row>\n <ion-row>\n @if (providerVisible('microsoft.com')) {\n <ion-col size=\"12\" size-md=\"6\">\n <ion-list lines=\"none\">\n <ion-item\n (click)=\"loginWith('microsoft.com')\"\n tappable\n [disabled]=\"!!signingWith()\"\n >\n @if (signingWith() === 'microsoft.com') {\n <ion-spinner\n slot=\"start\"\n color=\"secondary\"\n name=\"lines-small\"\n />\n } @else {\n <ion-icon\n slot=\"start\"\n color=\"secondary\"\n name=\"logo-windows\"\n />\n }\n <ion-label color=\"secondary\"\n >Login with Microsoft</ion-label\n >\n </ion-item>\n </ion-list>\n </ion-col>\n }\n @if (providerVisible('facebook.com')) {\n <ion-col size=\"12\" size-md=\"6\">\n <ion-list lines=\"none\">\n <ion-item\n (click)=\"loginWith('facebook.com')\"\n tappable\n [disabled]=\"!!signingWith()\"\n >\n @if (signingWith() === 'facebook.com') {\n <ion-spinner\n slot=\"start\"\n color=\"primary\"\n name=\"lines-small\"\n />\n } @else {\n <ion-icon\n slot=\"start\"\n color=\"primary\"\n name=\"logo-facebook\"\n />\n }\n <ion-label color=\"primary\">Login with Facebook</ion-label>\n </ion-item>\n </ion-list>\n </ion-col>\n }\n </ion-row>\n <ion-row>\n @if (providerVisible('github.com')) {\n <ion-col size=\"12\" size-md=\"6\">\n <ion-list lines=\"none\">\n <ion-item\n (click)=\"loginWith('github.com')\"\n tappable\n [disabled]=\"!!signingWith()\"\n >\n @if (signingWith() === 'github.com') {\n <ion-spinner\n slot=\"start\"\n color=\"tertiary\"\n name=\"lines-small\"\n />\n } @else {\n <ion-icon\n slot=\"start\"\n color=\"tertiary\"\n name=\"logo-github\"\n />\n }\n <ion-label color=\"tertiary\">Login with GitHub</ion-label>\n </ion-item>\n </ion-list>\n </ion-col>\n }\n </ion-row>\n </ion-grid>\n </ion-card>\n }\n }\n}\n" }]
185
+ ], providers: [RandomIdService], template: "@if (authRecoveryNeeded()) {\n <div class=\"ion-padding ion-text-center\" role=\"alert\">\n <p>\n We couldn't complete sign-in. Try again with email or another sign-in\n method.\n </p>\n </div>\n}\n\n@if (pendingLink(); as link) {\n <div class=\"ion-padding ion-text-center\" role=\"alert\">\n <p>\n @if (link.email) {\n <b>{{ link.email }}</b> already has an account.\n } @else {\n This email already has an account.\n }\n Sign in the way you did before \u2014 with email or another sign-in method \u2014\n @if (link.autoLink) {\n and we'll connect {{ link.provider }} to it automatically.\n } @else {\n then connect {{ link.provider }} from your account page.\n }\n </p>\n </div>\n}\n\n@if (recordState() === 'failed') {\n <div class=\"ion-padding ion-text-center\" role=\"alert\">\n <p>Your account is still being prepared. Retry before continuing.</p>\n <ion-button fill=\"outline\" (click)=\"retryUserRecordInitialization()\">\n Retry account setup\n </ion-button>\n </div>\n} @else if (recordState() === 'loading') {\n <div class=\"ion-padding ion-text-center\" role=\"status\" aria-live=\"polite\">\n <ion-spinner name=\"lines-small\" />\n <p>Preparing your account\u2026</p>\n </div>\n} @else {\n @if (showCredentials() || authRecoveryNeeded()) {\n @if (showIntro()) {\n <p style=\"text-align: center; font-size: smaller\">\n <ion-text color=\"medium\">Sign in with your Sneat account.</ion-text>\n </p>\n }\n\n <sneat-email-login-form\n [returnTo]=\"safeReturnTo()\"\n [initialMode]=\"initialMode()\"\n (signingWithChange)=\"onEmailFormStatusChanged($event)\"\n (loggedIn)=\"onLoggedIn($event)\"\n />\n\n <div class=\"ion-padding-horizontal ion-text-center\">\n <ion-button\n fill=\"outline\"\n expand=\"block\"\n routerLink=\"/sso\"\n [queryParams]=\"ssoQueryParams()\"\n [disabled]=\"!!signingWith()\"\n >\n <ion-icon name=\"business-outline\" slot=\"start\" />\n Sign in with company SSO\n </ion-button>\n </div>\n\n @if (uiConfig.quickLoginProviders?.length !== 0) {\n <ion-card>\n @if (uiConfig.showQuickLoginHeader !== false) {\n <ion-item-divider color=\"light\">\n <ion-label\n color=\"medium\"\n style=\"text-align: center; width: 100%; font-weight: bold\"\n >\n Quick login\n </ion-label>\n </ion-item-divider>\n }\n <ion-grid class=\"ion-grid-layout\">\n @if (!isNativePlatform && providerVisible('telegram')) {\n <ion-row>\n <ion-col>\n <div class=\"ion-padding\" style=\"text-align: center\">\n <sneat-login-with-telegram />\n </div>\n </ion-col>\n </ion-row>\n }\n <sneat-auth-provider-buttons\n [providers]=\"oauthProviders\"\n [busy]=\"oauthSigningWith()\"\n [disabled]=\"!!signingWith()\"\n (providerSelected)=\"loginWith($event)\"\n />\n </ion-grid>\n </ion-card>\n }\n }\n}\n" }]
183
186
  }], propDecorators: { returnTo: [{ type: i0.Input, args: [{ isSignal: true, alias: "returnTo", required: false }] }], initialMode: [{ type: i0.Input, args: [{ isSignal: true, alias: "initialMode", required: false }] }], showIntro: [{ type: i0.Input, args: [{ isSignal: true, alias: "showIntro", required: false }] }], showCredentials: [{ type: i0.Input, args: [{ isSignal: true, alias: "showCredentials", required: false }] }], accountReadyChange: [{
184
187
  type: Output
185
188
  }] } });
@@ -1 +1 @@
1
- {"version":3,"file":"auth-panel.component.js","sourceRoot":"","sources":["../../../../../../../../libs/auth/ui/src/lib/pages/login-page/auth-panel.component.ts","../../../../../../../../libs/auth/ui/src/lib/pages/login-page/auth-panel.component.html"],"names":[],"mappings":"AAAA,OAAO,EACL,uBAAuB,EACvB,SAAS,EACT,UAAU,EACV,YAAY,EAEZ,MAAM,EACN,QAAQ,EACR,MAAM,EACN,KAAK,EACL,MAAM,GACP,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAEL,YAAY,EAEZ,qBAAqB,EACrB,gBAAgB,EAChB,iBAAiB,EACjB,sCAAsC,EACtC,mBAAmB,GACpB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,WAAW,EAAgB,MAAM,aAAa,CAAC;AAExD,OAAO,EACL,SAAS,EACT,OAAO,EACP,MAAM,EACN,O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\n Component,\n DestroyRef,\n EventEmitter,\n OnInit,\n Output,\n computed,\n inject,\n input,\n signal,\n} from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { RouterLink } from '@angular/router';\nimport { Capacitor } from '@capacitor/core';\nimport {\n AuthProviderID,\n AuthStatuses,\n ISneatAuthState,\n SneatAuthStateService,\n SneatUserService,\n authProviderTitle,\n isAccountExistsWithDifferentCredential,\n isSneatAccountReady,\n} from '@sneat/auth-core';\nimport { ErrorLogger, IErrorLogger } from '@sneat/core';\nimport { UserCredential } from 'firebase/auth';\nimport {\n IonButton,\n IonCard,\n IonCol,\n IonGrid,\n IonIcon,\n IonItem,\n IonItemDivider,\n IonLabel,\n IonList,\n IonRow,\n IonSpinner,\n IonText,\n} from '@ionic/angular';\nimport {\n AuthPanelInitialMode,\n EmailFormSigningWith,\n EmailLoginFormComponent,\n} from './email-login-form/email-login-form.component';\nimport { LoginWithTelegramComponent } from './login-with-telegram.component';\nimport { safeAuthReturnPath } from './safe-auth-return-path';\nimport {\n clearLoginRedirectIntent,\n markLoginRedirectIntent,\n} from './login-redirect-intent';\nimport { combineLatest } from 'rxjs';\nimport { AUTH_PANEL_UI_CONFIG } from './auth-panel-ui-config';\nimport { RandomIdService } from '@sneat/random';\n\nexport interface AuthPanelAccountReadyChange {\n readonly uid?: string;\n readonly ready: boolean;\n}\n\n/** Shared auth methods without page-shell or navigation side effects. */\n@Component({\n selector: 'sneat-auth-panel',\n templateUrl: './auth-panel.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [\n RouterLink,\n EmailLoginFormComponent,\n LoginWithTelegramComponent,\n IonButton,\n IonCard,\n IonCol,\n IonGrid,\n IonIcon,\n IonItem,\n IonItemDivider,\n IonLabel,\n IonList,\n IonRow,\n IonSpinner,\n IonText,\n ],\n providers: [RandomIdService],\n})\nexport class AuthPanelComponent implements OnInit {\n protected readonly uiConfig = inject(AUTH_PANEL_UI_CONFIG);\n protected providerVisible(provider: AuthProviderID | 'telegram'): boolean {\n return this.uiConfig.quickLoginProviders?.includes(provider) ?? true;\n }\n\n readonly returnTo = input<string | undefined>();\n readonly initialMode = input<AuthPanelInitialMode | undefined>();\n readonly showIntro = input(true);\n readonly showCredentials = input(true);\n @Output() readonly accountReadyChange =\n new EventEmitter<AuthPanelAccountReadyChange>();\n\n protected readonly signingWith = signal<\n AuthProviderID | EmailFormSigningWith | undefined\n >(undefined);\n protected readonly authRecoveryNeeded = signal(false);\n /**\n * Set when sign-in hit an email that already has an account: names the\n * provider that will be connected once the user signs in the usual way.\n */\n protected readonly pendingLink = signal<\n | {\n readonly provider: string;\n readonly email?: string;\n /** False when no credential could be kept to link later. */\n readonly autoLink: boolean;\n }\n | undefined\n >(undefined);\n protected readonly recordState = signal<\n 'signed-out' | 'loading' | 'ready' | 'failed'\n >('loading');\n protected readonly isNativePlatform = Capacitor.isNativePlatform();\n protected readonly safeReturnTo = computed(() =>\n safeAuthReturnPath(this.returnTo()),\n );\n protected readonly ssoQueryParams = computed(() => {\n const returnTo = this.safeReturnTo();\n return returnTo ? { returnTo } : undefined;\n });\n\n private readonly authStateService = inject(SneatAuthStateService);\n private readonly userService = inject(SneatUserService);\n private readonly errorLogger = inject<IErrorLogger>(ErrorLogger);\n private readonly destroyRef = inject(DestroyRef);\n\n ngOnInit(): void {\n // A redirect sign-in that hit an existing account is read after this\n // page renders, so follow the pending link rather than reading it once.\n this.authStateService.pendingCredentialLinkChanges\n .pipe(takeUntilDestroyed(this.destroyRef))\n .subscribe((link) => {\n if (link) {\n this.pendingLink.set({\n provider: authProviderTitle(link.providerId),\n email: link.email,\n autoLink: true,\n });\n }\n });\n // This initial BehaviorSubject value is emitted after inputs and output\n // listeners are connected. Consumers can gate account-dependent work until\n // the matching user record is ready, even when auth resolved before mount.\n combineLatest([this.authStateService.authState, this.userService.userState])\n .pipe(takeUntilDestroyed(this.destroyRef))\n .subscribe(([authState, userState]) => {\n const uid = authState.user?.uid;\n const authRecoveryNeeded = authState.loadingPhase === 'failed';\n const sameIdentity =\n !!uid &&\n userState.status === 'authenticated' &&\n userState.user?.uid === uid &&\n !userState.user.isAnonymous;\n const ready = isSneatAccountReady(authState, userState);\n const failed =\n !authRecoveryNeeded &&\n authState.status === 'authenticated' &&\n !authState.user?.isAnonymous &&\n sameIdentity &&\n userState.userRecordStatus === 'failed';\n const signedOut =\n authState.status === 'notAuthenticated' ||\n authState.user?.isAnonymous === true;\n this.authRecoveryNeeded.set(authRecoveryNeeded);\n this.recordState.set(\n ready\n ? 'ready'\n : failed\n ? 'failed'\n : signedOut || authRecoveryNeeded\n ? 'signed-out'\n : 'loading',\n );\n if (\n ready ||\n authRecoveryNeeded ||\n authState.status === 'notAuthenticated'\n ) {\n this.signingWith.set(undefined);\n }\n this.accountReadyChange.emit({\n uid,\n ready,\n });\n });\n }\n\n protected retryUserRecordInitialization(): void {\n this.userService.retryUserRecordInitialization();\n }\n\n protected onEmailFormStatusChanged(signingWith?: EmailFormSigningWith): void {\n this.signingWith.set(signingWith);\n }\n\n protected async loginWith(provider: AuthProviderID): Promise<void> {\n this.signingWith.set(provider);\n markLoginRedirectIntent(this.safeReturnTo());\n try {\n await this.authStateService.signInWith(provider);\n clearLoginRedirectIntent();\n } catch (error) {\n clearLoginRedirectIntent();\n this.signingWith.set(undefined);\n if (isAccountExistsWithDifferentCredential(error)) {\n // A pending link for another provider (an earlier attempt) is not\n // this one: say how to connect this provider by hand.\n if (\n this.authStateService.pendingCredentialLink?.providerId !== provider\n ) {\n this.pendingLink.set({\n provider: authProviderTitle(provider),\n autoLink: false,\n });\n }\n return;\n }\n const message = (error as { errorMessage?: string }).errorMessage;\n if (\n message !== 'The user canceled the sign-in flow.' &&\n !message?.includes(\n 'com.apple.AuthenticationServices.AuthorizationError error 1001.',\n )\n ) {\n this.errorLogger.logError(error, `Failed to sign-in with ${provider}`);\n }\n this.signingWith.set(undefined);\n }\n }\n\n protected onLoggedIn(userCredential: UserCredential): void {\n this.signingWith.set(undefined);\n if (!userCredential.user) return;\n if (userCredential.user.email) {\n const previousEmail = localStorage.getItem('emailForSignIn') || '';\n if (!previousEmail) {\n localStorage.setItem('emailForSignIn', userCredential.user.email);\n }\n }\n const authState: ISneatAuthState = {\n status: AuthStatuses.authenticated,\n user: userCredential.user,\n };\n this.userService.onUserSignedIn(authState);\n }\n}\n","@if (authRecoveryNeeded()) {\n <div class=\"ion-padding ion-text-center\" role=\"alert\">\n <p>\n We couldn't complete sign-in. Try again with email or another sign-in\n method.\n </p>\n </div>\n}\n\n@if (pendingLink(); as link) {\n <div class=\"ion-padding ion-text-center\" role=\"alert\">\n <p>\n @if (link.email) {\n <b>{{ link.email }}</b> already has an account.\n } @else {\n This email already has an account.\n }\n Sign in the way you did before — with email or another sign-in method —\n @if (link.autoLink) {\n and we'll connect {{ link.provider }} to it automatically.\n } @else {\n then connect {{ link.provider }} from your account page.\n }\n </p>\n </div>\n}\n\n@if (recordState() === 'failed') {\n <div class=\"ion-padding ion-text-center\" role=\"alert\">\n <p>Your account is still being prepared. Retry before continuing.</p>\n <ion-button fill=\"outline\" (click)=\"retryUserRecordInitialization()\">\n Retry account setup\n </ion-button>\n </div>\n} @else if (recordState() === 'loading') {\n <div class=\"ion-padding ion-text-center\" role=\"status\" aria-live=\"polite\">\n <ion-spinner name=\"lines-small\" />\n <p>Preparing your account…</p>\n </div>\n} @else {\n @if (showCredentials() || authRecoveryNeeded()) {\n @if (showIntro()) {\n <p style=\"text-align: center; font-size: smaller\">\n <ion-text color=\"medium\">Sign in with your Sneat account.</ion-text>\n </p>\n }\n\n <sneat-email-login-form\n [returnTo]=\"safeReturnTo()\"\n [initialMode]=\"initialMode()\"\n (signingWithChange)=\"onEmailFormStatusChanged($event)\"\n (loggedIn)=\"onLoggedIn($event)\"\n />\n\n <div class=\"ion-padding-horizontal ion-text-center\">\n <ion-button\n fill=\"outline\"\n expand=\"block\"\n routerLink=\"/sso\"\n [queryParams]=\"ssoQueryParams()\"\n [disabled]=\"!!signingWith()\"\n >\n <ion-icon name=\"business-outline\" slot=\"start\" />\n Sign in with company SSO\n </ion-button>\n </div>\n\n @if (uiConfig.quickLoginProviders?.length !== 0) {\n <ion-card>\n @if (uiConfig.showQuickLoginHeader !== false) {\n <ion-item-divider color=\"light\">\n <ion-label\n color=\"medium\"\n style=\"text-align: center; width: 100%; font-weight: bold\"\n >\n Quick login\n </ion-label>\n </ion-item-divider>\n }\n <ion-grid class=\"ion-grid-layout\">\n @if (!isNativePlatform && providerVisible('telegram')) {\n <ion-row>\n <ion-col>\n <div class=\"ion-padding\" style=\"text-align: center\">\n <sneat-login-with-telegram />\n </div>\n </ion-col>\n </ion-row>\n }\n <ion-row>\n @if (providerVisible('google.com')) {\n <ion-col size=\"12\" size-md=\"6\">\n <ion-list lines=\"none\">\n <ion-item\n (click)=\"loginWith('google.com')\"\n tappable\n [disabled]=\"!!signingWith()\"\n >\n @if (signingWith() === 'google.com') {\n <ion-spinner slot=\"start\" name=\"lines-small\" />\n } @else {\n <ion-icon\n color=\"danger\"\n name=\"logo-google\"\n slot=\"start\"\n />\n }\n <ion-label color=\"danger\"> Login with Google</ion-label>\n </ion-item>\n </ion-list>\n </ion-col>\n }\n @if (providerVisible('apple.com')) {\n <ion-col size=\"12\" size-md=\"6\">\n <ion-list lines=\"none\">\n <ion-item\n (click)=\"loginWith('apple.com')\"\n tappable\n [disabled]=\"!!signingWith()\"\n >\n @if (signingWith() === 'apple.com') {\n <ion-spinner slot=\"start\" name=\"lines-small\" />\n } @else {\n <ion-icon color=\"dark\" name=\"logo-apple\" slot=\"start\" />\n }\n <ion-label color=\"dark\">Login with Apple</ion-label>\n </ion-item>\n </ion-list>\n </ion-col>\n }\n </ion-row>\n <ion-row>\n @if (providerVisible('microsoft.com')) {\n <ion-col size=\"12\" size-md=\"6\">\n <ion-list lines=\"none\">\n <ion-item\n (click)=\"loginWith('microsoft.com')\"\n tappable\n [disabled]=\"!!signingWith()\"\n >\n @if (signingWith() === 'microsoft.com') {\n <ion-spinner\n slot=\"start\"\n color=\"secondary\"\n name=\"lines-small\"\n />\n } @else {\n <ion-icon\n slot=\"start\"\n color=\"secondary\"\n name=\"logo-windows\"\n />\n }\n <ion-label color=\"secondary\"\n >Login with Microsoft</ion-label\n >\n </ion-item>\n </ion-list>\n </ion-col>\n }\n @if (providerVisible('facebook.com')) {\n <ion-col size=\"12\" size-md=\"6\">\n <ion-list lines=\"none\">\n <ion-item\n (click)=\"loginWith('facebook.com')\"\n tappable\n [disabled]=\"!!signingWith()\"\n >\n @if (signingWith() === 'facebook.com') {\n <ion-spinner\n slot=\"start\"\n color=\"primary\"\n name=\"lines-small\"\n />\n } @else {\n <ion-icon\n slot=\"start\"\n color=\"primary\"\n name=\"logo-facebook\"\n />\n }\n <ion-label color=\"primary\">Login with Facebook</ion-label>\n </ion-item>\n </ion-list>\n </ion-col>\n }\n </ion-row>\n <ion-row>\n @if (providerVisible('github.com')) {\n <ion-col size=\"12\" size-md=\"6\">\n <ion-list lines=\"none\">\n <ion-item\n (click)=\"loginWith('github.com')\"\n tappable\n [disabled]=\"!!signingWith()\"\n >\n @if (signingWith() === 'github.com') {\n <ion-spinner\n slot=\"start\"\n color=\"tertiary\"\n name=\"lines-small\"\n />\n } @else {\n <ion-icon\n slot=\"start\"\n color=\"tertiary\"\n name=\"logo-github\"\n />\n }\n <ion-label color=\"tertiary\">Login with GitHub</ion-label>\n </ion-item>\n </ion-list>\n </ion-col>\n }\n </ion-row>\n </ion-grid>\n </ion-card>\n }\n }\n}\n"]}
1
+ {"version":3,"file":"auth-panel.component.js","sourceRoot":"","sources":["../../../../../../../../libs/auth/ui/src/lib/pages/login-page/auth-panel.component.ts","../../../../../../../../libs/auth/ui/src/lib/pages/login-page/auth-panel.component.html"],"names":[],"mappings":"AAAA,OAAO,EACL,4BAA4B,EAC5B,kBAAkB,GACnB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACL,uBAAuB,EACvB,SAAS,EACT,UAAU,EACV,YAAY,EAEZ,MAAM,EACN,QA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CAAC,IAAI;SAC1B,CAAC;QACF,IAAI,CAAC,WAAW,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC;IAC7C,CAAC;8GA3KU,kBAAkB;kGAAlB,kBAAkB,uqBAFlB,CAAC,eAAe,CAAC,0BCpF9B,grGAoGA,4CD/BI,UAAU,kPACV,4BAA4B,4JAC5B,uBAAuB,oJACvB,0BAA0B,oJAC1B,SAAS,sRACT,OAAO,yLACP,MAAM,kTACN,OAAO,wEACP,OAAO,2JACP,cAAc,kGACd,QAAQ,6FACR,MAAM,oDACN,UAAU,yGACV,OAAO;;2FAIE,kBAAkB;kBAtB9B,SAAS;+BACE,kBAAkB,mBAEX,uBAAuB,CAAC,MAAM,WACtC;wBACP,UAAU;wBACV,4BAA4B;wBAC5B,uBAAuB;wBACvB,0BAA0B;wBAC1B,SAAS;wBACT,OAAO;wBACP,MAAM;wBACN,OAAO;wBACP,OAAO;wBACP,cAAc;wBACd,QAAQ;wBACR,MAAM;wBACN,UAAU;wBACV,OAAO;qBACR,aACU,CAAC,eAAe,CAAC;;sBAY3B,MAAM","sourcesContent":["import {\n AuthProviderButtonsComponent,\n OAUTH_PROVIDER_IDS,\n} from '@sneat/auth-ui/provider-buttons';\nimport {\n ChangeDetectionStrategy,\n Component,\n DestroyRef,\n EventEmitter,\n OnInit,\n Output,\n computed,\n inject,\n input,\n signal,\n} from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { RouterLink } from '@angular/router';\nimport { Capacitor } from '@capacitor/core';\nimport {\n AuthProviderID,\n AuthStatuses,\n ISneatAuthState,\n SneatAuthStateService,\n SneatUserService,\n authProviderTitle,\n isAccountExistsWithDifferentCredential,\n isSneatAccountReady,\n} from '@sneat/auth-core';\nimport { ErrorLogger, IErrorLogger } from '@sneat/core';\nimport { UserCredential } from 'firebase/auth';\nimport {\n IonButton,\n IonCard,\n IonCol,\n IonGrid,\n IonIcon,\n IonItemDivider,\n IonLabel,\n IonRow,\n IonSpinner,\n IonText,\n} from '@ionic/angular';\nimport {\n AuthPanelInitialMode,\n EmailFormSigningWith,\n EmailLoginFormComponent,\n} from './email-login-form/email-login-form.component';\nimport { LoginWithTelegramComponent } from './login-with-telegram.component';\nimport { safeAuthReturnPath } from './safe-auth-return-path';\nimport {\n clearLoginRedirectIntent,\n markLoginRedirectIntent,\n} from './login-redirect-intent';\nimport { combineLatest } from 'rxjs';\nimport { AUTH_PANEL_UI_CONFIG } from './auth-panel-ui-config';\nimport { RandomIdService } from '@sneat/random';\n\nexport interface AuthPanelAccountReadyChange {\n readonly uid?: string;\n readonly ready: boolean;\n}\n\n/** Shared auth methods without page-shell or navigation side effects. */\n@Component({\n selector: 'sneat-auth-panel',\n templateUrl: './auth-panel.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [\n RouterLink,\n AuthProviderButtonsComponent,\n EmailLoginFormComponent,\n LoginWithTelegramComponent,\n IonButton,\n IonCard,\n IonCol,\n IonGrid,\n IonIcon,\n IonItemDivider,\n IonLabel,\n IonRow,\n IonSpinner,\n IonText,\n ],\n providers: [RandomIdService],\n})\nexport class AuthPanelComponent implements OnInit {\n protected readonly uiConfig = inject(AUTH_PANEL_UI_CONFIG);\n protected providerVisible(provider: AuthProviderID | 'telegram'): boolean {\n return this.uiConfig.quickLoginProviders?.includes(provider) ?? true;\n }\n\n readonly returnTo = input<string | undefined>();\n readonly initialMode = input<AuthPanelInitialMode | undefined>();\n readonly showIntro = input(true);\n readonly showCredentials = input(true);\n @Output() readonly accountReadyChange =\n new EventEmitter<AuthPanelAccountReadyChange>();\n\n protected readonly signingWith = signal<\n AuthProviderID | EmailFormSigningWith | undefined\n >(undefined);\n protected readonly oauthProviders = OAUTH_PROVIDER_IDS.filter((provider) =>\n this.providerVisible(provider),\n );\n protected readonly oauthSigningWith = computed(() =>\n OAUTH_PROVIDER_IDS.find((provider) => provider === this.signingWith()),\n );\n protected readonly authRecoveryNeeded = signal(false);\n /**\n * Set when sign-in hit an email that already has an account: names the\n * provider that will be connected once the user signs in the usual way.\n */\n protected readonly pendingLink = signal<\n | {\n readonly provider: string;\n readonly email?: string;\n /** False when no credential could be kept to link later. */\n readonly autoLink: boolean;\n }\n | undefined\n >(undefined);\n protected readonly recordState = signal<\n 'signed-out' | 'loading' | 'ready' | 'failed'\n >('loading');\n protected readonly isNativePlatform = Capacitor.isNativePlatform();\n protected readonly safeReturnTo = computed(() =>\n safeAuthReturnPath(this.returnTo()),\n );\n protected readonly ssoQueryParams = computed(() => {\n const returnTo = this.safeReturnTo();\n return returnTo ? { returnTo } : undefined;\n });\n\n private readonly authStateService = inject(SneatAuthStateService);\n private readonly userService = inject(SneatUserService);\n private readonly errorLogger = inject<IErrorLogger>(ErrorLogger);\n private readonly destroyRef = inject(DestroyRef);\n\n ngOnInit(): void {\n // A redirect sign-in that hit an existing account is read after this\n // page renders, so follow the pending link rather than reading it once.\n this.authStateService.pendingCredentialLinkChanges\n .pipe(takeUntilDestroyed(this.destroyRef))\n .subscribe((link) => {\n if (link) {\n this.pendingLink.set({\n provider: authProviderTitle(link.providerId),\n email: link.email,\n autoLink: true,\n });\n }\n });\n // This initial BehaviorSubject value is emitted after inputs and output\n // listeners are connected. Consumers can gate account-dependent work until\n // the matching user record is ready, even when auth resolved before mount.\n combineLatest([this.authStateService.authState, this.userService.userState])\n .pipe(takeUntilDestroyed(this.destroyRef))\n .subscribe(([authState, userState]) => {\n const uid = authState.user?.uid;\n const authRecoveryNeeded = authState.loadingPhase === 'failed';\n const sameIdentity =\n !!uid &&\n userState.status === 'authenticated' &&\n userState.user?.uid === uid &&\n !userState.user.isAnonymous;\n const ready = isSneatAccountReady(authState, userState);\n const failed =\n !authRecoveryNeeded &&\n authState.status === 'authenticated' &&\n !authState.user?.isAnonymous &&\n sameIdentity &&\n userState.userRecordStatus === 'failed';\n const signedOut =\n authState.status === 'notAuthenticated' ||\n authState.user?.isAnonymous === true;\n this.authRecoveryNeeded.set(authRecoveryNeeded);\n this.recordState.set(\n ready\n ? 'ready'\n : failed\n ? 'failed'\n : signedOut || authRecoveryNeeded\n ? 'signed-out'\n : 'loading',\n );\n if (\n ready ||\n authRecoveryNeeded ||\n authState.status === 'notAuthenticated'\n ) {\n this.signingWith.set(undefined);\n }\n this.accountReadyChange.emit({\n uid,\n ready,\n });\n });\n }\n\n protected retryUserRecordInitialization(): void {\n this.userService.retryUserRecordInitialization();\n }\n\n protected onEmailFormStatusChanged(signingWith?: EmailFormSigningWith): void {\n this.signingWith.set(signingWith);\n }\n\n protected async loginWith(provider: AuthProviderID): Promise<void> {\n this.signingWith.set(provider);\n markLoginRedirectIntent(this.safeReturnTo());\n try {\n await this.authStateService.signInWith(provider);\n clearLoginRedirectIntent();\n } catch (error) {\n clearLoginRedirectIntent();\n this.signingWith.set(undefined);\n if (isAccountExistsWithDifferentCredential(error)) {\n // A pending link for another provider (an earlier attempt) is not\n // this one: say how to connect this provider by hand.\n if (\n this.authStateService.pendingCredentialLink?.providerId !== provider\n ) {\n this.pendingLink.set({\n provider: authProviderTitle(provider),\n autoLink: false,\n });\n }\n return;\n }\n const message = (error as { errorMessage?: string }).errorMessage;\n if (\n message !== 'The user canceled the sign-in flow.' &&\n !message?.includes(\n 'com.apple.AuthenticationServices.AuthorizationError error 1001.',\n )\n ) {\n this.errorLogger.logError(error, `Failed to sign-in with ${provider}`);\n }\n this.signingWith.set(undefined);\n }\n }\n\n protected onLoggedIn(userCredential: UserCredential): void {\n this.signingWith.set(undefined);\n if (!userCredential.user) return;\n if (userCredential.user.email) {\n const previousEmail = localStorage.getItem('emailForSignIn') || '';\n if (!previousEmail) {\n localStorage.setItem('emailForSignIn', userCredential.user.email);\n }\n }\n const authState: ISneatAuthState = {\n status: AuthStatuses.authenticated,\n user: userCredential.user,\n };\n this.userService.onUserSignedIn(authState);\n }\n}\n","@if (authRecoveryNeeded()) {\n <div class=\"ion-padding ion-text-center\" role=\"alert\">\n <p>\n We couldn't complete sign-in. Try again with email or another sign-in\n method.\n </p>\n </div>\n}\n\n@if (pendingLink(); as link) {\n <div class=\"ion-padding ion-text-center\" role=\"alert\">\n <p>\n @if (link.email) {\n <b>{{ link.email }}</b> already has an account.\n } @else {\n This email already has an account.\n }\n Sign in the way you did before — with email or another sign-in method —\n @if (link.autoLink) {\n and we'll connect {{ link.provider }} to it automatically.\n } @else {\n then connect {{ link.provider }} from your account page.\n }\n </p>\n </div>\n}\n\n@if (recordState() === 'failed') {\n <div class=\"ion-padding ion-text-center\" role=\"alert\">\n <p>Your account is still being prepared. Retry before continuing.</p>\n <ion-button fill=\"outline\" (click)=\"retryUserRecordInitialization()\">\n Retry account setup\n </ion-button>\n </div>\n} @else if (recordState() === 'loading') {\n <div class=\"ion-padding ion-text-center\" role=\"status\" aria-live=\"polite\">\n <ion-spinner name=\"lines-small\" />\n <p>Preparing your account…</p>\n </div>\n} @else {\n @if (showCredentials() || authRecoveryNeeded()) {\n @if (showIntro()) {\n <p style=\"text-align: center; font-size: smaller\">\n <ion-text color=\"medium\">Sign in with your Sneat account.</ion-text>\n </p>\n }\n\n <sneat-email-login-form\n [returnTo]=\"safeReturnTo()\"\n [initialMode]=\"initialMode()\"\n (signingWithChange)=\"onEmailFormStatusChanged($event)\"\n (loggedIn)=\"onLoggedIn($event)\"\n />\n\n <div class=\"ion-padding-horizontal ion-text-center\">\n <ion-button\n fill=\"outline\"\n expand=\"block\"\n routerLink=\"/sso\"\n [queryParams]=\"ssoQueryParams()\"\n [disabled]=\"!!signingWith()\"\n >\n <ion-icon name=\"business-outline\" slot=\"start\" />\n Sign in with company SSO\n </ion-button>\n </div>\n\n @if (uiConfig.quickLoginProviders?.length !== 0) {\n <ion-card>\n @if (uiConfig.showQuickLoginHeader !== false) {\n <ion-item-divider color=\"light\">\n <ion-label\n color=\"medium\"\n style=\"text-align: center; width: 100%; font-weight: bold\"\n >\n Quick login\n </ion-label>\n </ion-item-divider>\n }\n <ion-grid class=\"ion-grid-layout\">\n @if (!isNativePlatform && providerVisible('telegram')) {\n <ion-row>\n <ion-col>\n <div class=\"ion-padding\" style=\"text-align: center\">\n <sneat-login-with-telegram />\n </div>\n </ion-col>\n </ion-row>\n }\n <sneat-auth-provider-buttons\n [providers]=\"oauthProviders\"\n [busy]=\"oauthSigningWith()\"\n [disabled]=\"!!signingWith()\"\n (providerSelected)=\"loginWith($event)\"\n />\n </ion-grid>\n </ion-card>\n }\n }\n}\n"]}
@@ -0,0 +1,2 @@
1
+ export { AuthProviderButtonsComponent, OAUTH_PROVIDER_IDS, } from './provider-buttons.component';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../libs/auth/ui/src/provider-buttons/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,4BAA4B,EAC5B,kBAAkB,GACnB,MAAM,8BAA8B,CAAC","sourcesContent":["export {\n AuthProviderButtonsComponent,\n OAUTH_PROVIDER_IDS,\n} from './provider-buttons.component';\nexport type {\n OAuthProviderId,\n OAuthProviderLabels,\n} from './provider-buttons.component';\n"]}
@@ -0,0 +1,88 @@
1
+ import { ChangeDetectionStrategy, Component, computed, input, output, } from '@angular/core';
2
+ import { IonCol, IonIcon, IonItem, IonLabel, IonList, IonRow, IonSpinner, } from '@ionic/angular';
3
+ import { logoApple, logoFacebook, logoGithub, logoGoogle, logoWindows, } from 'ionicons/icons';
4
+ import * as i0 from "@angular/core";
5
+ /** Fixed display order, independent of the caller's visibility allowlist order. */
6
+ export const OAUTH_PROVIDER_IDS = [
7
+ 'google.com',
8
+ 'apple.com',
9
+ 'microsoft.com',
10
+ 'facebook.com',
11
+ 'github.com',
12
+ ];
13
+ const providers = [
14
+ {
15
+ id: 'google.com',
16
+ label: 'Login with Google',
17
+ icon: logoGoogle,
18
+ color: 'danger',
19
+ spinnerColor: undefined,
20
+ },
21
+ {
22
+ id: 'apple.com',
23
+ label: 'Login with Apple',
24
+ icon: logoApple,
25
+ color: 'dark',
26
+ spinnerColor: undefined,
27
+ },
28
+ {
29
+ id: 'microsoft.com',
30
+ label: 'Login with Microsoft',
31
+ icon: logoWindows,
32
+ color: 'secondary',
33
+ spinnerColor: 'secondary',
34
+ },
35
+ {
36
+ id: 'facebook.com',
37
+ label: 'Login with Facebook',
38
+ icon: logoFacebook,
39
+ color: 'primary',
40
+ spinnerColor: 'primary',
41
+ },
42
+ {
43
+ id: 'github.com',
44
+ label: 'Login with GitHub',
45
+ icon: logoGithub,
46
+ color: 'tertiary',
47
+ spinnerColor: 'tertiary',
48
+ },
49
+ ];
50
+ /** Presentation only: the host owns authentication, readiness, navigation and errors. */
51
+ export class AuthProviderButtonsComponent {
52
+ constructor() {
53
+ this.providers = input(/* @ts-ignore */
54
+ ...(ngDevMode ? [undefined, { debugName: "providers" }] : /* istanbul ignore next */ []));
55
+ this.busy = input(/* @ts-ignore */
56
+ ...(ngDevMode ? [undefined, { debugName: "busy" }] : /* istanbul ignore next */ []));
57
+ this.disabled = input(false, /* @ts-ignore */
58
+ ...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
59
+ this.labels = input({}, /* @ts-ignore */
60
+ ...(ngDevMode ? [{ debugName: "labels" }] : /* istanbul ignore next */ []));
61
+ this.providerSelected = output();
62
+ this.rows = computed(() => [providers.slice(0, 2), providers.slice(2, 4), providers.slice(4)]
63
+ .map((row) => row.filter((provider) => this.providers()?.includes(provider.id) ?? true))
64
+ .filter((row) => row.length), /* @ts-ignore */
65
+ ...(ngDevMode ? [{ debugName: "rows" }] : /* istanbul ignore next */ []));
66
+ }
67
+ label(provider) {
68
+ const label = this.labels()[provider.id];
69
+ return typeof label === 'string' &&
70
+ label.trim().length &&
71
+ label.length <= 160
72
+ ? label.trim()
73
+ : provider.label;
74
+ }
75
+ select(provider) {
76
+ if (!this.disabled() &&
77
+ !this.busy() &&
78
+ (this.providers()?.includes(provider) ?? true))
79
+ this.providerSelected.emit(provider);
80
+ }
81
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: AuthProviderButtonsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
82
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.3", type: AuthProviderButtonsComponent, isStandalone: true, selector: "sneat-auth-provider-buttons", inputs: { providers: { classPropertyName: "providers", publicName: "providers", isSignal: true, isRequired: false, transformFunction: null }, busy: { classPropertyName: "busy", publicName: "busy", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, labels: { classPropertyName: "labels", publicName: "labels", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { providerSelected: "providerSelected" }, ngImport: i0, template: "@for (row of rows(); track $index) {\n <ion-row>\n @for (provider of row; track provider.id) {\n <ion-col size=\"12\" size-md=\"6\">\n <ion-list lines=\"none\">\n <ion-item\n [button]=\"true\"\n [detail]=\"false\"\n type=\"button\"\n [disabled]=\"disabled() || !!busy()\"\n [attr.aria-busy]=\"busy() === provider.id ? 'true' : null\"\n [attr.data-provider]=\"provider.id\"\n (click)=\"select(provider.id)\"\n >\n @if (busy() === provider.id) {\n <ion-spinner\n slot=\"start\"\n name=\"lines-small\"\n [color]=\"provider.spinnerColor\"\n aria-hidden=\"true\"\n />\n } @else {\n <ion-icon\n slot=\"start\"\n [color]=\"provider.color\"\n [icon]=\"provider.icon\"\n aria-hidden=\"true\"\n />\n }\n <ion-label [color]=\"provider.color\">{{\n label(provider)\n }}</ion-label>\n </ion-item>\n </ion-list>\n </ion-col>\n }\n </ion-row>\n}\n", styles: [":host{display:block}\n"], dependencies: [{ kind: "component", type: IonCol, selector: "ion-col", inputs: ["offset", "offsetLg", "offsetMd", "offsetSm", "offsetXl", "offsetXs", "pull", "pullLg", "pullMd", "pullSm", "pullXl", "pullXs", "push", "pushLg", "pushMd", "pushSm", "pushXl", "pushXs", "size", "sizeLg", "sizeMd", "sizeSm", "sizeXl", "sizeXs"] }, { kind: "component", type: IonIcon, selector: "ion-icon", inputs: ["color", "flipRtl", "icon", "ios", "lazy", "md", "mode", "name", "sanitize", "size", "src"] }, { 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: IonLabel, selector: "ion-label", inputs: ["color", "mode", "position"] }, { kind: "component", type: IonList, selector: "ion-list", inputs: ["inset", "lines", "mode"] }, { kind: "component", type: IonRow, selector: "ion-row" }, { kind: "component", type: IonSpinner, selector: "ion-spinner", inputs: ["color", "duration", "name", "paused"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
83
+ }
84
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: AuthProviderButtonsComponent, decorators: [{
85
+ type: Component,
86
+ args: [{ selector: 'sneat-auth-provider-buttons', imports: [IonCol, IonIcon, IonItem, IonLabel, IonList, IonRow, IonSpinner], changeDetection: ChangeDetectionStrategy.OnPush, template: "@for (row of rows(); track $index) {\n <ion-row>\n @for (provider of row; track provider.id) {\n <ion-col size=\"12\" size-md=\"6\">\n <ion-list lines=\"none\">\n <ion-item\n [button]=\"true\"\n [detail]=\"false\"\n type=\"button\"\n [disabled]=\"disabled() || !!busy()\"\n [attr.aria-busy]=\"busy() === provider.id ? 'true' : null\"\n [attr.data-provider]=\"provider.id\"\n (click)=\"select(provider.id)\"\n >\n @if (busy() === provider.id) {\n <ion-spinner\n slot=\"start\"\n name=\"lines-small\"\n [color]=\"provider.spinnerColor\"\n aria-hidden=\"true\"\n />\n } @else {\n <ion-icon\n slot=\"start\"\n [color]=\"provider.color\"\n [icon]=\"provider.icon\"\n aria-hidden=\"true\"\n />\n }\n <ion-label [color]=\"provider.color\">{{\n label(provider)\n }}</ion-label>\n </ion-item>\n </ion-list>\n </ion-col>\n }\n </ion-row>\n}\n", styles: [":host{display:block}\n"] }]
87
+ }], propDecorators: { providers: [{ type: i0.Input, args: [{ isSignal: true, alias: "providers", required: false }] }], busy: [{ type: i0.Input, args: [{ isSignal: true, alias: "busy", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], labels: [{ type: i0.Input, args: [{ isSignal: true, alias: "labels", required: false }] }], providerSelected: [{ type: i0.Output, args: ["providerSelected"] }] } });
88
+ //# sourceMappingURL=provider-buttons.component.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"provider-buttons.component.js","sourceRoot":"","sources":["../../../../../../libs/auth/ui/src/provider-buttons/provider-buttons.component.ts","../../../../../../libs/auth/ui/src/provider-buttons/provider-buttons.component.html"],"names":[],"mappings":"AAAA,OAAO,EACL,uBAAuB,EACvB,SAAS,EACT,QAAQ,EACR,KAAK,EACL,MAAM,GACP,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,MAAM,EACN,OAAO,EACP,OAAO,EACP,QAAQ,EACR,OAAO,EACP,MAAM,EACN,UAAU,GACX,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,SAAS,EACT,YAAY,EACZ,UAAU,EACV,UAAU,EACV,WAAW,GACZ,MAAM,gBAAgB,CAAC;;AAExB,mFAAmF;AACnF,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,YAAY;IACZ,WAAW;IACX,eAAe;IACf,cAAc;IACd,YAAY;CACJ,CAAC;AAMX,MAAM,SAAS,GAAG;IAChB;QACE,EAAE,EAAE,YAAY;QAChB,KAAK,EAAE,mBAAmB;QAC1B,IAAI,EAAE,UAAU;QAChB,KAAK,EAAE,QAAQ;QACf,YAAY,EAAE,SAAS;KACxB;IACD;QACE,EAAE,EAAE,WAAW;QACf,KAAK,EAAE,kBAAkB;QACzB,IAAI,EAAE,SAAS;QACf,KAAK,EAAE,MAAM;QACb,YAAY,EAAE,SAAS;KACxB;IACD;QACE,EAAE,EAAE,eAAe;QACnB,KAAK,EAAE,sBAAsB;QAC7B,IAAI,EAAE,WAAW;QACjB,KAAK,EAAE,W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9B,KAAK,CAAC,IAAI,EAAE,CAAC,MAAM;YACnB,KAAK,CAAC,MAAM,IAAI,GAAG;YACnB,CAAC,CAAC,KAAK,CAAC,IAAI,EAAE;YACd,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC;IACrB,CAAC;IACS,MAAM,CAAC,QAAyB;QACxC,IACE,CAAC,IAAI,CAAC,QAAQ,EAAE;YAChB,CAAC,IAAI,CAAC,IAAI,EAAE;YACZ,CAAC,IAAI,CAAC,SAAS,EAAE,EAAE,QAAQ,CAAC,QAAQ,CAAC,IAAI,IAAI,CAAC;YAE9C,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACzC,CAAC;8GA9BU,4BAA4B;kGAA5B,4BAA4B,2oBCnFzC,0rCAsCA,gFDwCY,MAAM,kTAAE,OAAO,2JAAE,OAAO,0NAAE,QAAQ,6FAAE,OAAO,yFAAE,MAAM,oDAAE,UAAU;;2FAK9D,4BAA4B;kBAPxC,SAAS;+BACE,6BAA6B,WAC9B,CAAC,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,CAAC,mBAGzD,uBAAuB,CAAC,MAAM","sourcesContent":["import {\n ChangeDetectionStrategy,\n Component,\n computed,\n input,\n output,\n} from '@angular/core';\nimport {\n IonCol,\n IonIcon,\n IonItem,\n IonLabel,\n IonList,\n IonRow,\n IonSpinner,\n} from '@ionic/angular';\nimport {\n logoApple,\n logoFacebook,\n logoGithub,\n logoGoogle,\n logoWindows,\n} from 'ionicons/icons';\n\n/** Fixed display order, independent of the caller's visibility allowlist order. */\nexport const OAUTH_PROVIDER_IDS = [\n 'google.com',\n 'apple.com',\n 'microsoft.com',\n 'facebook.com',\n 'github.com',\n] as const;\nexport type OAuthProviderId = (typeof OAUTH_PROVIDER_IDS)[number];\n/** Plain text only; absent, blank or over-160-character labels use English defaults. */\nexport type OAuthProviderLabels = Readonly<\n Partial<Record<OAuthProviderId, string>>\n>;\nconst providers = [\n {\n id: 'google.com',\n label: 'Login with Google',\n icon: logoGoogle,\n color: 'danger',\n spinnerColor: undefined,\n },\n {\n id: 'apple.com',\n label: 'Login with Apple',\n icon: logoApple,\n color: 'dark',\n spinnerColor: undefined,\n },\n {\n id: 'microsoft.com',\n label: 'Login with Microsoft',\n icon: logoWindows,\n color: 'secondary',\n spinnerColor: 'secondary',\n },\n {\n id: 'facebook.com',\n label: 'Login with Facebook',\n icon: logoFacebook,\n color: 'primary',\n spinnerColor: 'primary',\n },\n {\n id: 'github.com',\n label: 'Login with GitHub',\n icon: logoGithub,\n color: 'tertiary',\n spinnerColor: 'tertiary',\n },\n] as const;\n\n/** Presentation only: the host owns authentication, readiness, navigation and errors. */\n@Component({\n selector: 'sneat-auth-provider-buttons',\n imports: [IonCol, IonIcon, IonItem, IonLabel, IonList, IonRow, IonSpinner],\n templateUrl: './provider-buttons.component.html',\n styles: ':host { display: block; }',\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class AuthProviderButtonsComponent {\n readonly providers = input<readonly OAuthProviderId[] | undefined>();\n readonly busy = input<OAuthProviderId | undefined>();\n readonly disabled = input(false);\n readonly labels = input<OAuthProviderLabels>({});\n readonly providerSelected = output<OAuthProviderId>();\n readonly rows = computed(() =>\n [providers.slice(0, 2), providers.slice(2, 4), providers.slice(4)]\n .map((row) =>\n row.filter(\n (provider) => this.providers()?.includes(provider.id) ?? true,\n ),\n )\n .filter((row) => row.length),\n );\n protected label(provider: (typeof providers)[number]): string {\n const label = this.labels()[provider.id];\n return typeof label === 'string' &&\n label.trim().length &&\n label.length <= 160\n ? label.trim()\n : provider.label;\n }\n protected select(provider: OAuthProviderId): void {\n if (\n !this.disabled() &&\n !this.busy() &&\n (this.providers()?.includes(provider) ?? true)\n )\n this.providerSelected.emit(provider);\n }\n}\n","@for (row of rows(); track $index) {\n <ion-row>\n @for (provider of row; track provider.id) {\n <ion-col size=\"12\" size-md=\"6\">\n <ion-list lines=\"none\">\n <ion-item\n [button]=\"true\"\n [detail]=\"false\"\n type=\"button\"\n [disabled]=\"disabled() || !!busy()\"\n [attr.aria-busy]=\"busy() === provider.id ? 'true' : null\"\n [attr.data-provider]=\"provider.id\"\n (click)=\"select(provider.id)\"\n >\n @if (busy() === provider.id) {\n <ion-spinner\n slot=\"start\"\n name=\"lines-small\"\n [color]=\"provider.spinnerColor\"\n aria-hidden=\"true\"\n />\n } @else {\n <ion-icon\n slot=\"start\"\n [color]=\"provider.color\"\n [icon]=\"provider.icon\"\n aria-hidden=\"true\"\n />\n }\n <ion-label [color]=\"provider.color\">{{\n label(provider)\n }}</ion-label>\n </ion-item>\n </ion-list>\n </ion-col>\n }\n </ion-row>\n}\n"]}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Generated bundle index. Do not edit.
3
+ */
4
+ export * from './index';
5
+ //# sourceMappingURL=sneat-auth-ui-provider-buttons.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sneat-auth-ui-provider-buttons.js","sourceRoot":"","sources":["../../../../../../libs/auth/ui/src/provider-buttons/sneat-auth-ui-provider-buttons.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,SAAS,CAAC","sourcesContent":["/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"]}
@@ -17,6 +17,8 @@ export declare class AuthPanelComponent implements OnInit {
17
17
  readonly showCredentials: import("@angular/core").InputSignal<boolean>;
18
18
  readonly accountReadyChange: EventEmitter<AuthPanelAccountReadyChange>;
19
19
  protected readonly signingWith: import("@angular/core").WritableSignal<EmailFormSigningWith | AuthProviderID | undefined>;
20
+ protected readonly oauthProviders: ("apple.com" | "google.com" | "microsoft.com" | "facebook.com" | "github.com")[];
21
+ protected readonly oauthSigningWith: import("@angular/core").Signal<"apple.com" | "google.com" | "microsoft.com" | "facebook.com" | "github.com" | undefined>;
20
22
  protected readonly authRecoveryNeeded: import("@angular/core").WritableSignal<boolean>;
21
23
  /**
22
24
  * Set when sign-in hit an email that already has an account: names the
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sneat/auth-ui",
3
- "version": "0.27.41",
3
+ "version": "0.27.42",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -19,6 +19,7 @@
19
19
  "@sneat/space-services": "^0.27.0"
20
20
  },
21
21
  "dependencies": {
22
+ "ionicons": "8.1.0",
22
23
  "tslib": "2.8.1"
23
24
  },
24
25
  "type": "module",
@@ -31,6 +32,10 @@
31
32
  ".": {
32
33
  "types": "./sneat-auth-ui.d.ts",
33
34
  "default": "./esm2022/sneat-auth-ui.js"
35
+ },
36
+ "./provider-buttons": {
37
+ "types": "./provider-buttons/sneat-auth-ui-provider-buttons.d.ts",
38
+ "default": "./esm2022/provider-buttons/sneat-auth-ui-provider-buttons.js"
34
39
  }
35
40
  },
36
41
  "sideEffects": false
@@ -0,0 +1,31 @@
1
+ # OAuth provider buttons
2
+
3
+ > **Web UI:** follow the [Sneat web UI bible](https://github.com/sneat-co/sneat-specs/blob/main/standards/frontend-ux/README.md).
4
+
5
+ Import `AuthProviderButtonsComponent` from `@sneat/auth-ui/provider-buttons`.
6
+ This standalone OnPush component renders the existing Google, Apple, Microsoft,
7
+ Facebook and GitHub provider rows. It needs no auth, router, user-record,
8
+ Firestore or analytics providers. Selecting a native Ionic button emits
9
+ `providerSelected: OAuthProviderId`; the host owns authentication, navigation,
10
+ errors and account readiness. Construction starts no authentication or storage
11
+ operation. SVG icons are bundled through the component's direct Ionicons dependency,
12
+ so consumers need no global icon registration or icon-asset requests.
13
+
14
+ Inputs:
15
+
16
+ - `providers`: optional provider allowlist; omitted shows all five, `[]` shows none.
17
+ Display order stays Google, Apple, Microsoft, Facebook, GitHub.
18
+ - `busy`: optional active provider; shows its spinner and disables all buttons.
19
+ - `disabled`: disables every button, including while another sign-in method is busy.
20
+ - `labels`: partial plain-text map keyed by provider ID. Missing, blank or labels
21
+ longer than 160 characters fall back to the existing English label.
22
+
23
+ For example, `[labels]="{'google.com': 'Войти через Google'}"` localizes that
24
+ button. Content is interpolated as text. The component supplies rows/columns
25
+ without a card or page shell, so it can remain inside the existing AuthPanel grid
26
+ or a host-owned login dialog. Telegram, company SSO, email and account-readiness
27
+ behavior remain in AuthPanel.
28
+
29
+ A consumer must install a published `@sneat/auth-ui` release containing this
30
+ secondary entry; source aliases alone do not make it available in an older package.
31
+ Lazy hosts should load the entry only on explicit login intent.
@@ -0,0 +1,2 @@
1
+ export { AuthProviderButtonsComponent, OAUTH_PROVIDER_IDS, } from './provider-buttons.component';
2
+ export type { OAuthProviderId, OAuthProviderLabels, } from './provider-buttons.component';
@@ -0,0 +1,81 @@
1
+ import * as i0 from "@angular/core";
2
+ /** Fixed display order, independent of the caller's visibility allowlist order. */
3
+ export declare const OAUTH_PROVIDER_IDS: readonly ["google.com", "apple.com", "microsoft.com", "facebook.com", "github.com"];
4
+ export type OAuthProviderId = (typeof OAUTH_PROVIDER_IDS)[number];
5
+ /** Plain text only; absent, blank or over-160-character labels use English defaults. */
6
+ export type OAuthProviderLabels = Readonly<Partial<Record<OAuthProviderId, string>>>;
7
+ declare const providers: readonly [{
8
+ readonly id: "google.com";
9
+ readonly label: "Login with Google";
10
+ readonly icon: string;
11
+ readonly color: "danger";
12
+ readonly spinnerColor: undefined;
13
+ }, {
14
+ readonly id: "apple.com";
15
+ readonly label: "Login with Apple";
16
+ readonly icon: string;
17
+ readonly color: "dark";
18
+ readonly spinnerColor: undefined;
19
+ }, {
20
+ readonly id: "microsoft.com";
21
+ readonly label: "Login with Microsoft";
22
+ readonly icon: string;
23
+ readonly color: "secondary";
24
+ readonly spinnerColor: "secondary";
25
+ }, {
26
+ readonly id: "facebook.com";
27
+ readonly label: "Login with Facebook";
28
+ readonly icon: string;
29
+ readonly color: "primary";
30
+ readonly spinnerColor: "primary";
31
+ }, {
32
+ readonly id: "github.com";
33
+ readonly label: "Login with GitHub";
34
+ readonly icon: string;
35
+ readonly color: "tertiary";
36
+ readonly spinnerColor: "tertiary";
37
+ }];
38
+ /** Presentation only: the host owns authentication, readiness, navigation and errors. */
39
+ export declare class AuthProviderButtonsComponent {
40
+ readonly providers: import("@angular/core").InputSignal<readonly ("google.com" | "apple.com" | "microsoft.com" | "facebook.com" | "github.com")[] | undefined>;
41
+ readonly busy: import("@angular/core").InputSignal<"google.com" | "apple.com" | "microsoft.com" | "facebook.com" | "github.com" | undefined>;
42
+ readonly disabled: import("@angular/core").InputSignal<boolean>;
43
+ readonly labels: import("@angular/core").InputSignal<Readonly<Partial<Record<"google.com" | "apple.com" | "microsoft.com" | "facebook.com" | "github.com", string>>>>;
44
+ readonly providerSelected: import("@angular/core").OutputEmitterRef<"google.com" | "apple.com" | "microsoft.com" | "facebook.com" | "github.com">;
45
+ readonly rows: import("@angular/core").Signal<({
46
+ readonly id: "google.com";
47
+ readonly label: "Login with Google";
48
+ readonly icon: string;
49
+ readonly color: "danger";
50
+ readonly spinnerColor: undefined;
51
+ } | {
52
+ readonly id: "apple.com";
53
+ readonly label: "Login with Apple";
54
+ readonly icon: string;
55
+ readonly color: "dark";
56
+ readonly spinnerColor: undefined;
57
+ } | {
58
+ readonly id: "microsoft.com";
59
+ readonly label: "Login with Microsoft";
60
+ readonly icon: string;
61
+ readonly color: "secondary";
62
+ readonly spinnerColor: "secondary";
63
+ } | {
64
+ readonly id: "facebook.com";
65
+ readonly label: "Login with Facebook";
66
+ readonly icon: string;
67
+ readonly color: "primary";
68
+ readonly spinnerColor: "primary";
69
+ } | {
70
+ readonly id: "github.com";
71
+ readonly label: "Login with GitHub";
72
+ readonly icon: string;
73
+ readonly color: "tertiary";
74
+ readonly spinnerColor: "tertiary";
75
+ })[][]>;
76
+ protected label(provider: (typeof providers)[number]): string;
77
+ protected select(provider: OAuthProviderId): void;
78
+ static ɵfac: i0.ɵɵFactoryDeclaration<AuthProviderButtonsComponent, never>;
79
+ static ɵcmp: i0.ɵɵComponentDeclaration<AuthProviderButtonsComponent, "sneat-auth-provider-buttons", never, { "providers": { "alias": "providers"; "required": false; "isSignal": true; }; "busy": { "alias": "busy"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "labels": { "alias": "labels"; "required": false; "isSignal": true; }; }, { "providerSelected": "providerSelected"; }, never, never, true, never>;
80
+ }
81
+ export {};
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Generated bundle index. Do not edit.
3
+ */
4
+ /// <amd-module name="@sneat/auth-ui/provider-buttons" />
5
+ export * from './index';