@sneat/auth-ui 0.27.40 → 0.27.41
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.
- package/esm2022/lib/components/user-auth-providers/user-auth-accounts.component.js +11 -5
- package/esm2022/lib/components/user-auth-providers/user-auth-accounts.component.js.map +1 -1
- package/esm2022/lib/components/user-auth-providers/user-auth-provider-status.js +7 -0
- package/esm2022/lib/components/user-auth-providers/user-auth-provider-status.js.map +1 -1
- package/esm2022/lib/pages/login-page/auth-panel.component.js +34 -3
- package/esm2022/lib/pages/login-page/auth-panel.component.js.map +1 -1
- package/lib/components/user-auth-providers/user-auth-accounts.component.d.ts +6 -1
- package/lib/pages/login-page/auth-panel.component.d.ts +10 -0
- package/package.json +1 -1
- package/tsconfig.lib.prod.tsbuildinfo +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ChangeDetectionStrategy, Component, signal, inject, } from '@angular/core';
|
|
1
|
+
import { ChangeDetectionStrategy, Component, input, signal, inject, } from '@angular/core';
|
|
2
2
|
import { FormsModule } from '@angular/forms';
|
|
3
3
|
import { IonButton, IonButtons, IonCard, IonCardContent, IonIcon, IonItem, IonItemDivider, IonLabel, IonList, IonText, } from '@ionic/angular';
|
|
4
4
|
import { SneatApiService } from '@sneat/api';
|
|
@@ -12,6 +12,12 @@ export class UserAuthAccountsComponent extends SneatBaseComponent {
|
|
|
12
12
|
super();
|
|
13
13
|
this.sneatUserService = inject(SneatUserService);
|
|
14
14
|
this.sneatApiService = inject(SneatApiService);
|
|
15
|
+
/**
|
|
16
|
+
* The messaging-apps section (Telegram, WhatsApp, Viber) and its Sneat.app
|
|
17
|
+
* copy. Apps that only need sign-in methods turn it off.
|
|
18
|
+
*/
|
|
19
|
+
this.showMessagingApps = input(true, /* @ts-ignore */
|
|
20
|
+
...(ngDevMode ? [{ debugName: "showMessagingApps" }] : /* istanbul ignore next */ []));
|
|
15
21
|
this.$userRecord = signal(undefined, /* @ts-ignore */
|
|
16
22
|
...(ngDevMode ? [{ debugName: "$userRecord" }] : /* istanbul ignore next */ []));
|
|
17
23
|
this.signingInWith = signal(undefined, /* @ts-ignore */
|
|
@@ -54,12 +60,12 @@ export class UserAuthAccountsComponent extends SneatBaseComponent {
|
|
|
54
60
|
});
|
|
55
61
|
}
|
|
56
62
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: UserAuthAccountsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
57
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.3", type: UserAuthAccountsComponent, isStandalone: true, selector: "sneat-user-auth-accounts", providers: [
|
|
63
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.3", type: UserAuthAccountsComponent, isStandalone: true, selector: "sneat-user-auth-accounts", inputs: { showMessagingApps: { classPropertyName: "showMessagingApps", publicName: "showMessagingApps", isSignal: true, isRequired: false, transformFunction: null } }, providers: [
|
|
58
64
|
{
|
|
59
65
|
provide: ClassName,
|
|
60
66
|
useValue: 'UserAuthAccountsComponent',
|
|
61
67
|
},
|
|
62
|
-
], usesInheritance: true, ngImport: i0, template: "<ion-card>\n <!--\t<ion-item color=\"light\" lines=\"full\">-->\n <!--\t\t<ion-label color=\"medium\"-->\n <!--\t\t\t><h2 style=\"font-weight: bold\">Authentication</h2></ion-label-->\n <!--\t\t>-->\n <!--\t</ion-item>-->\n <!--\t<ion-accordion-group [value]=\"integrations\">-->\n <!--\t\t<ion-accordion value=\"messaging-apps\">-->\n <!--\t\t\t<ion-item slot=\"header\" color=\"light\">-->\n <!--\t\t\t\t<ion-label>First Accordion</ion-label>-->\n <!--\t\t\t</ion-item>-->\n <!--\t\t\t<div class=\"ion-padding\" slot=\"content\">First Content</div>-->\n <!--\t\t</ion-accordion>-->\n <!--\t\t<ion-accordion value=\"quick-logins\">-->\n <!--\t\t\t<ion-item slot=\"header\" color=\"light\">-->\n <!--\t\t\t\t<ion-label>Second Accordion</ion-label>-->\n <!--\t\t\t</ion-item>-->\n <!--\t\t\t<div class=\"ion-padding\" slot=\"content\">Second Content</div>-->\n <!--\t\t</ion-accordion>-->\n <!--\t</ion-accordion-group>-->\n <!--\t<ion-item>-->\n <!--\t\t<ion-segment [(ngModel)]=\"integrations\" style=\"margin-bottom: 0.5em\">-->\n <!--\t\t\t<ion-segment-button value=\"messaging-apps\"-->\n <!--\t\t\t\t>Messaging Apps-->\n <!--\t\t\t</ion-segment-button>-->\n <!--\t\t\t<ion-segment-button value=\"quick-logins\">Quick logins</ion-segment-button>-->\n <!--\t\t</ion-segment>-->\n <!--\t</ion-item>-->\n <ion-list>\n <ion-item-divider color=\"light\">\n <ion-label color=\"medium\" style=\"font-weight: bold\"\n >Quick logins</ion-label\n >\n </ion-item-divider>\n <sneat-user-auth-provider-status\n providerID=\"google.com\"\n [signingInWith]=\"signingInWith()\"\n (signingInWithChange)=\"signingInWith.set($event)\"\n />\n <sneat-user-auth-provider-status\n providerID=\"apple.com\"\n [signingInWith]=\"signingInWith()\"\n (signingInWithChange)=\"signingInWith.set($event)\"\n />\n <sneat-user-auth-provider-status\n providerID=\"microsoft.com\"\n [signingInWith]=\"signingInWith()\"\n (signingInWithChange)=\"signingInWith.set($event)\"\n />\n </ion-list>\n <ion-list>\n
|
|
68
|
+
], usesInheritance: true, ngImport: i0, template: "<ion-card>\n <!--\t<ion-item color=\"light\" lines=\"full\">-->\n <!--\t\t<ion-label color=\"medium\"-->\n <!--\t\t\t><h2 style=\"font-weight: bold\">Authentication</h2></ion-label-->\n <!--\t\t>-->\n <!--\t</ion-item>-->\n <!--\t<ion-accordion-group [value]=\"integrations\">-->\n <!--\t\t<ion-accordion value=\"messaging-apps\">-->\n <!--\t\t\t<ion-item slot=\"header\" color=\"light\">-->\n <!--\t\t\t\t<ion-label>First Accordion</ion-label>-->\n <!--\t\t\t</ion-item>-->\n <!--\t\t\t<div class=\"ion-padding\" slot=\"content\">First Content</div>-->\n <!--\t\t</ion-accordion>-->\n <!--\t\t<ion-accordion value=\"quick-logins\">-->\n <!--\t\t\t<ion-item slot=\"header\" color=\"light\">-->\n <!--\t\t\t\t<ion-label>Second Accordion</ion-label>-->\n <!--\t\t\t</ion-item>-->\n <!--\t\t\t<div class=\"ion-padding\" slot=\"content\">Second Content</div>-->\n <!--\t\t</ion-accordion>-->\n <!--\t</ion-accordion-group>-->\n <!--\t<ion-item>-->\n <!--\t\t<ion-segment [(ngModel)]=\"integrations\" style=\"margin-bottom: 0.5em\">-->\n <!--\t\t\t<ion-segment-button value=\"messaging-apps\"-->\n <!--\t\t\t\t>Messaging Apps-->\n <!--\t\t\t</ion-segment-button>-->\n <!--\t\t\t<ion-segment-button value=\"quick-logins\">Quick logins</ion-segment-button>-->\n <!--\t\t</ion-segment>-->\n <!--\t</ion-item>-->\n <ion-list>\n <ion-item-divider color=\"light\">\n <ion-label color=\"medium\" style=\"font-weight: bold\"\n >Quick logins</ion-label\n >\n </ion-item-divider>\n <sneat-user-auth-provider-status\n providerID=\"google.com\"\n [signingInWith]=\"signingInWith()\"\n (signingInWithChange)=\"signingInWith.set($event)\"\n />\n <sneat-user-auth-provider-status\n providerID=\"apple.com\"\n [signingInWith]=\"signingInWith()\"\n (signingInWithChange)=\"signingInWith.set($event)\"\n />\n <sneat-user-auth-provider-status\n providerID=\"microsoft.com\"\n [signingInWith]=\"signingInWith()\"\n (signingInWithChange)=\"signingInWith.set($event)\"\n />\n <sneat-user-auth-provider-status\n providerID=\"github.com\"\n [signingInWith]=\"signingInWith()\"\n (signingInWithChange)=\"signingInWith.set($event)\"\n />\n </ion-list>\n @if (showMessagingApps()) {\n <ion-list>\n <ion-item-divider color=\"light\">\n <ion-label color=\"medium\" style=\"font-weight: bold\"\n >Messaging apps</ion-label\n >\n </ion-item-divider>\n\n <ion-item>\n <ion-icon slot=\"start\" name=\"paper-plane\" color=\"primary\"></ion-icon>\n @if (!$userRecord()) {\n <ion-label>\n <h3>Telegram</h3>\n <p>Checking....</p>\n </ion-label>\n } @else if (hasAccount('telegram')) {\n <ion-label>\n <h3 style=\"font-weight: bold\">Telegram</h3>\n <ion-text color=\"success\" [title]=\"getAccountID('telegram')\"\n >Connected!\n </ion-text>\n </ion-label>\n <ion-buttons slot=\"end\">\n <ion-button\n [disabled]=\"disconnecting()\"\n color=\"warning\"\n fill=\"solid\"\n (click)=\"disconnect('telegram')\"\n >\n <ion-icon name=\"close-outline\" slot=\"start\"></ion-icon>\n <ion-label>Disconnect</ion-label>\n </ion-button>\n </ion-buttons>\n } @else {\n <ion-label>\n <h3>Telegram</h3>\n <p>Not connected yet.</p>\n </ion-label>\n <ion-buttons slot=\"end\">\n <sneat-login-with-telegram [isUserAuthenticated]=\"true\" />\n </ion-buttons>\n }\n </ion-item>\n <ion-item>\n <ion-icon slot=\"start\" name=\"logo-whatsapp\"></ion-icon>\n <ion-label color=\"medium\">\n <h3 style=\"font-weight: bold\">WhatsApp</h3>\n <p>Not implemented yet - coming soon!</p>\n </ion-label>\n <!--\t\t<ion-buttons slot=\"end\">-->\n <!--\t\t\t<ion-button color=\"danger\">-->\n <!--\t\t\t\t<ion-icon name=\"close-circle-outline\" slot=\"start\"></ion-icon>-->\n <!--\t\t\t\t<ion-label>I have no WhatsApp</ion-label>-->\n <!--\t\t\t</ion-button>-->\n <!--\t\t</ion-buttons>-->\n </ion-item>\n <ion-item>\n <ion-icon slot=\"start\" name=\"logo-whatsapp\"></ion-icon>\n <!-- TODO: place Viber logo here -->\n <ion-label color=\"medium\">\n <h3 style=\"font-weight: bold\">Viber</h3>\n <p>Not implemented yet - coming soon!</p>\n </ion-label>\n </ion-item>\n </ion-list>\n <ion-card-content>\n <p>\n You'll get much more out of Sneat.app if you integrate it with messaging\n apps you use. Benefits:\n </p>\n <ul>\n <li>Easily add contacts</li>\n <li>Get reminders</li>\n <li>Add todo/to_buy from your messenger</li>\n <li>etc.</li>\n </ul>\n </ion-card-content>\n }\n</ion-card>\n", dependencies: [{ kind: "component", type: LoginWithTelegramComponent, selector: "sneat-login-with-telegram", inputs: ["isUserAuthenticated", "botID", "size", "requestAccess", "userPic"] }, { kind: "ngmodule", type: FormsModule }, { kind: "component", type: UserAuthAProviderStatusComponent, selector: "sneat-user-auth-provider-status", inputs: ["providerID", "signingInWith"], outputs: ["signingInWithChange"] }, { kind: "component", type: IonCard, selector: "ion-card", inputs: ["button", "color", "disabled", "download", "href", "mode", "rel", "routerAnimation", "routerDirection", "target", "type"] }, { kind: "component", type: IonList, selector: "ion-list", inputs: ["inset", "lines", "mode"] }, { 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: IonText, selector: "ion-text", inputs: ["color", "mode"] }, { 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: IonCardContent, selector: "ion-card-content", inputs: ["mode"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
63
69
|
}
|
|
64
70
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: UserAuthAccountsComponent, decorators: [{
|
|
65
71
|
type: Component,
|
|
@@ -82,6 +88,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImpor
|
|
|
82
88
|
provide: ClassName,
|
|
83
89
|
useValue: 'UserAuthAccountsComponent',
|
|
84
90
|
},
|
|
85
|
-
], template: "<ion-card>\n <!--\t<ion-item color=\"light\" lines=\"full\">-->\n <!--\t\t<ion-label color=\"medium\"-->\n <!--\t\t\t><h2 style=\"font-weight: bold\">Authentication</h2></ion-label-->\n <!--\t\t>-->\n <!--\t</ion-item>-->\n <!--\t<ion-accordion-group [value]=\"integrations\">-->\n <!--\t\t<ion-accordion value=\"messaging-apps\">-->\n <!--\t\t\t<ion-item slot=\"header\" color=\"light\">-->\n <!--\t\t\t\t<ion-label>First Accordion</ion-label>-->\n <!--\t\t\t</ion-item>-->\n <!--\t\t\t<div class=\"ion-padding\" slot=\"content\">First Content</div>-->\n <!--\t\t</ion-accordion>-->\n <!--\t\t<ion-accordion value=\"quick-logins\">-->\n <!--\t\t\t<ion-item slot=\"header\" color=\"light\">-->\n <!--\t\t\t\t<ion-label>Second Accordion</ion-label>-->\n <!--\t\t\t</ion-item>-->\n <!--\t\t\t<div class=\"ion-padding\" slot=\"content\">Second Content</div>-->\n <!--\t\t</ion-accordion>-->\n <!--\t</ion-accordion-group>-->\n <!--\t<ion-item>-->\n <!--\t\t<ion-segment [(ngModel)]=\"integrations\" style=\"margin-bottom: 0.5em\">-->\n <!--\t\t\t<ion-segment-button value=\"messaging-apps\"-->\n <!--\t\t\t\t>Messaging Apps-->\n <!--\t\t\t</ion-segment-button>-->\n <!--\t\t\t<ion-segment-button value=\"quick-logins\">Quick logins</ion-segment-button>-->\n <!--\t\t</ion-segment>-->\n <!--\t</ion-item>-->\n <ion-list>\n <ion-item-divider color=\"light\">\n <ion-label color=\"medium\" style=\"font-weight: bold\"\n >Quick logins</ion-label\n >\n </ion-item-divider>\n <sneat-user-auth-provider-status\n providerID=\"google.com\"\n [signingInWith]=\"signingInWith()\"\n (signingInWithChange)=\"signingInWith.set($event)\"\n />\n <sneat-user-auth-provider-status\n providerID=\"apple.com\"\n [signingInWith]=\"signingInWith()\"\n (signingInWithChange)=\"signingInWith.set($event)\"\n />\n <sneat-user-auth-provider-status\n providerID=\"microsoft.com\"\n [signingInWith]=\"signingInWith()\"\n (signingInWithChange)=\"signingInWith.set($event)\"\n />\n </ion-list>\n <ion-list>\n
|
|
86
|
-
}], ctorParameters: () => [] });
|
|
91
|
+
], template: "<ion-card>\n <!--\t<ion-item color=\"light\" lines=\"full\">-->\n <!--\t\t<ion-label color=\"medium\"-->\n <!--\t\t\t><h2 style=\"font-weight: bold\">Authentication</h2></ion-label-->\n <!--\t\t>-->\n <!--\t</ion-item>-->\n <!--\t<ion-accordion-group [value]=\"integrations\">-->\n <!--\t\t<ion-accordion value=\"messaging-apps\">-->\n <!--\t\t\t<ion-item slot=\"header\" color=\"light\">-->\n <!--\t\t\t\t<ion-label>First Accordion</ion-label>-->\n <!--\t\t\t</ion-item>-->\n <!--\t\t\t<div class=\"ion-padding\" slot=\"content\">First Content</div>-->\n <!--\t\t</ion-accordion>-->\n <!--\t\t<ion-accordion value=\"quick-logins\">-->\n <!--\t\t\t<ion-item slot=\"header\" color=\"light\">-->\n <!--\t\t\t\t<ion-label>Second Accordion</ion-label>-->\n <!--\t\t\t</ion-item>-->\n <!--\t\t\t<div class=\"ion-padding\" slot=\"content\">Second Content</div>-->\n <!--\t\t</ion-accordion>-->\n <!--\t</ion-accordion-group>-->\n <!--\t<ion-item>-->\n <!--\t\t<ion-segment [(ngModel)]=\"integrations\" style=\"margin-bottom: 0.5em\">-->\n <!--\t\t\t<ion-segment-button value=\"messaging-apps\"-->\n <!--\t\t\t\t>Messaging Apps-->\n <!--\t\t\t</ion-segment-button>-->\n <!--\t\t\t<ion-segment-button value=\"quick-logins\">Quick logins</ion-segment-button>-->\n <!--\t\t</ion-segment>-->\n <!--\t</ion-item>-->\n <ion-list>\n <ion-item-divider color=\"light\">\n <ion-label color=\"medium\" style=\"font-weight: bold\"\n >Quick logins</ion-label\n >\n </ion-item-divider>\n <sneat-user-auth-provider-status\n providerID=\"google.com\"\n [signingInWith]=\"signingInWith()\"\n (signingInWithChange)=\"signingInWith.set($event)\"\n />\n <sneat-user-auth-provider-status\n providerID=\"apple.com\"\n [signingInWith]=\"signingInWith()\"\n (signingInWithChange)=\"signingInWith.set($event)\"\n />\n <sneat-user-auth-provider-status\n providerID=\"microsoft.com\"\n [signingInWith]=\"signingInWith()\"\n (signingInWithChange)=\"signingInWith.set($event)\"\n />\n <sneat-user-auth-provider-status\n providerID=\"github.com\"\n [signingInWith]=\"signingInWith()\"\n (signingInWithChange)=\"signingInWith.set($event)\"\n />\n </ion-list>\n @if (showMessagingApps()) {\n <ion-list>\n <ion-item-divider color=\"light\">\n <ion-label color=\"medium\" style=\"font-weight: bold\"\n >Messaging apps</ion-label\n >\n </ion-item-divider>\n\n <ion-item>\n <ion-icon slot=\"start\" name=\"paper-plane\" color=\"primary\"></ion-icon>\n @if (!$userRecord()) {\n <ion-label>\n <h3>Telegram</h3>\n <p>Checking....</p>\n </ion-label>\n } @else if (hasAccount('telegram')) {\n <ion-label>\n <h3 style=\"font-weight: bold\">Telegram</h3>\n <ion-text color=\"success\" [title]=\"getAccountID('telegram')\"\n >Connected!\n </ion-text>\n </ion-label>\n <ion-buttons slot=\"end\">\n <ion-button\n [disabled]=\"disconnecting()\"\n color=\"warning\"\n fill=\"solid\"\n (click)=\"disconnect('telegram')\"\n >\n <ion-icon name=\"close-outline\" slot=\"start\"></ion-icon>\n <ion-label>Disconnect</ion-label>\n </ion-button>\n </ion-buttons>\n } @else {\n <ion-label>\n <h3>Telegram</h3>\n <p>Not connected yet.</p>\n </ion-label>\n <ion-buttons slot=\"end\">\n <sneat-login-with-telegram [isUserAuthenticated]=\"true\" />\n </ion-buttons>\n }\n </ion-item>\n <ion-item>\n <ion-icon slot=\"start\" name=\"logo-whatsapp\"></ion-icon>\n <ion-label color=\"medium\">\n <h3 style=\"font-weight: bold\">WhatsApp</h3>\n <p>Not implemented yet - coming soon!</p>\n </ion-label>\n <!--\t\t<ion-buttons slot=\"end\">-->\n <!--\t\t\t<ion-button color=\"danger\">-->\n <!--\t\t\t\t<ion-icon name=\"close-circle-outline\" slot=\"start\"></ion-icon>-->\n <!--\t\t\t\t<ion-label>I have no WhatsApp</ion-label>-->\n <!--\t\t\t</ion-button>-->\n <!--\t\t</ion-buttons>-->\n </ion-item>\n <ion-item>\n <ion-icon slot=\"start\" name=\"logo-whatsapp\"></ion-icon>\n <!-- TODO: place Viber logo here -->\n <ion-label color=\"medium\">\n <h3 style=\"font-weight: bold\">Viber</h3>\n <p>Not implemented yet - coming soon!</p>\n </ion-label>\n </ion-item>\n </ion-list>\n <ion-card-content>\n <p>\n You'll get much more out of Sneat.app if you integrate it with messaging\n apps you use. Benefits:\n </p>\n <ul>\n <li>Easily add contacts</li>\n <li>Get reminders</li>\n <li>Add todo/to_buy from your messenger</li>\n <li>etc.</li>\n </ul>\n </ion-card-content>\n }\n</ion-card>\n" }]
|
|
92
|
+
}], ctorParameters: () => [], propDecorators: { showMessagingApps: [{ type: i0.Input, args: [{ isSignal: true, alias: "showMessagingApps", required: false }] }] } });
|
|
87
93
|
//# sourceMappingURL=user-auth-accounts.component.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user-auth-accounts.component.js","sourceRoot":"","sources":["../../../../../../../../libs/auth/ui/src/lib/components/user-auth-providers/user-auth-accounts.component.ts","../../../../../../../../libs/auth/ui/src/lib/components/user-auth-providers/user-auth-accounts.component.html"],"names":[],"mappings":"AAAA,OAAO,EACL,uBAAuB,EACvB,SAAS,EACT,MAAM,EACN,MAAM,GACP,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EACL,SAAS,EACT,UAAU,EACV,OAAO,EACP,cAAc,EACd,OAAO,EACP,OAAO,EACP,cAAc,EACd,QAAQ,EACR,OAAO,EACP,OAAO,GACR,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,eAAe,EAAE,MAAM,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;wBACP,UAAU;wBACV,SAAS;wBACT,cAAc;qBACf,aACU;wBACT;4BACE,OAAO,EAAE,SAAS;4BAClB,QAAQ,EAAE,2BAA2B;yBACtC;qBACF","sourcesContent":["import {\n ChangeDetectionStrategy,\n Component,\n signal,\n inject,\n} from '@angular/core';\nimport { FormsModule } from '@angular/forms';\nimport {\n IonButton,\n IonButtons,\n IonCard,\n IonCardContent,\n IonIcon,\n IonItem,\n IonItemDivider,\n IonLabel,\n IonList,\n IonText,\n} from '@ionic/angular';\nimport { SneatApiService } from '@sneat/api';\nimport { AuthProviderID, SneatUserService } from '@sneat/auth-core';\nimport { IUserRecord } from '@sneat/auth-models';\nimport { ClassName, SneatBaseComponent } from '@sneat/ui';\nimport { LoginWithTelegramComponent } from '../../pages/login-page/login-with-telegram.component';\nimport { UserAuthAProviderStatusComponent } from './user-auth-provider-status';\n\n@Component({\n selector: 'sneat-user-auth-accounts',\n templateUrl: './user-auth-accounts.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [\n LoginWithTelegramComponent,\n FormsModule,\n UserAuthAProviderStatusComponent,\n IonCard,\n IonList,\n IonItemDivider,\n IonLabel,\n IonItem,\n IonIcon,\n IonText,\n IonButtons,\n IonButton,\n IonCardContent,\n ],\n providers: [\n {\n provide: ClassName,\n useValue: 'UserAuthAccountsComponent',\n },\n ],\n})\nexport class UserAuthAccountsComponent extends SneatBaseComponent {\n private readonly sneatUserService = inject(SneatUserService);\n private readonly sneatApiService = inject(SneatApiService);\n\n protected readonly $userRecord = signal<IUserRecord | undefined>(undefined);\n\n protected readonly signingInWith = signal<AuthProviderID | undefined>(\n undefined,\n );\n\n constructor() {\n super();\n this.sneatUserService.userState.pipe(this.takeUntilDestroyed()).subscribe({\n next: (user) => {\n this.$userRecord.set(user.record || undefined);\n },\n });\n }\n\n protected hasAccount(provider: 'telegram' | 'viber' | 'whatsapp'): boolean {\n provider = provider + ':';\n for (const account of this.$userRecord()?.accounts || []) {\n if (account.startsWith(provider)) {\n return true;\n }\n }\n return false;\n }\n\n protected getAccountID(provider: 'telegram'): string {\n const prefix = provider + '::';\n const a = this.$userRecord()?.accounts?.find((a) => a.startsWith(prefix));\n return a?.replace(prefix, '') || '';\n }\n\n protected readonly disconnecting = signal<\n 'telegram' | 'viber' | 'whatsapp' | undefined\n >(undefined);\n\n protected disconnect(provider: 'telegram'): void {\n if (\n !confirm(\n 'Are you sure you want to disconnect Telegram login from your account?',\n )\n ) {\n return;\n }\n this.disconnecting.set(provider);\n this.sneatApiService\n .delete('auth/disconnect?provider=' + provider)\n .subscribe({\n next: () => {\n this.disconnecting.set(undefined);\n alert('Disconnected!');\n },\n error: this.errorLogger.logErrorHandler('Failed to disconnect'),\n });\n }\n}\n","<ion-card>\n <!--\t<ion-item color=\"light\" lines=\"full\">-->\n <!--\t\t<ion-label color=\"medium\"-->\n <!--\t\t\t><h2 style=\"font-weight: bold\">Authentication</h2></ion-label-->\n <!--\t\t>-->\n <!--\t</ion-item>-->\n <!--\t<ion-accordion-group [value]=\"integrations\">-->\n <!--\t\t<ion-accordion value=\"messaging-apps\">-->\n <!--\t\t\t<ion-item slot=\"header\" color=\"light\">-->\n <!--\t\t\t\t<ion-label>First Accordion</ion-label>-->\n <!--\t\t\t</ion-item>-->\n <!--\t\t\t<div class=\"ion-padding\" slot=\"content\">First Content</div>-->\n <!--\t\t</ion-accordion>-->\n <!--\t\t<ion-accordion value=\"quick-logins\">-->\n <!--\t\t\t<ion-item slot=\"header\" color=\"light\">-->\n <!--\t\t\t\t<ion-label>Second Accordion</ion-label>-->\n <!--\t\t\t</ion-item>-->\n <!--\t\t\t<div class=\"ion-padding\" slot=\"content\">Second Content</div>-->\n <!--\t\t</ion-accordion>-->\n <!--\t</ion-accordion-group>-->\n <!--\t<ion-item>-->\n <!--\t\t<ion-segment [(ngModel)]=\"integrations\" style=\"margin-bottom: 0.5em\">-->\n <!--\t\t\t<ion-segment-button value=\"messaging-apps\"-->\n <!--\t\t\t\t>Messaging Apps-->\n <!--\t\t\t</ion-segment-button>-->\n <!--\t\t\t<ion-segment-button value=\"quick-logins\">Quick logins</ion-segment-button>-->\n <!--\t\t</ion-segment>-->\n <!--\t</ion-item>-->\n <ion-list>\n <ion-item-divider color=\"light\">\n <ion-label color=\"medium\" style=\"font-weight: bold\"\n >Quick logins</ion-label\n >\n </ion-item-divider>\n <sneat-user-auth-provider-status\n providerID=\"google.com\"\n [signingInWith]=\"signingInWith()\"\n (signingInWithChange)=\"signingInWith.set($event)\"\n />\n <sneat-user-auth-provider-status\n providerID=\"apple.com\"\n [signingInWith]=\"signingInWith()\"\n (signingInWithChange)=\"signingInWith.set($event)\"\n />\n <sneat-user-auth-provider-status\n providerID=\"microsoft.com\"\n [signingInWith]=\"signingInWith()\"\n (signingInWithChange)=\"signingInWith.set($event)\"\n />\n </ion-list>\n <ion-list>\n <ion-item-divider color=\"light\">\n <ion-label color=\"medium\" style=\"font-weight: bold\"\n >Messaging apps</ion-label\n >\n </ion-item-divider>\n\n <ion-item>\n <ion-icon slot=\"start\" name=\"paper-plane\" color=\"primary\"></ion-icon>\n @if (!$userRecord()) {\n <ion-label>\n <h3>Telegram</h3>\n <p>Checking....</p>\n </ion-label>\n } @else if (hasAccount(\"telegram\")) {\n <ion-label>\n <h3 style=\"font-weight: bold\">Telegram</h3>\n <ion-text color=\"success\" [title]=\"getAccountID('telegram')\"\n >Connected!\n </ion-text>\n </ion-label>\n <ion-buttons slot=\"end\">\n <ion-button\n [disabled]=\"disconnecting()\"\n color=\"warning\"\n fill=\"solid\"\n (click)=\"disconnect('telegram')\"\n >\n <ion-icon name=\"close-outline\" slot=\"start\"></ion-icon>\n <ion-label>Disconnect</ion-label>\n </ion-button>\n </ion-buttons>\n } @else {\n <ion-label>\n <h3>Telegram</h3>\n <p>Not connected yet.</p>\n </ion-label>\n <ion-buttons slot=\"end\">\n <sneat-login-with-telegram [isUserAuthenticated]=\"true\" />\n </ion-buttons>\n }\n </ion-item>\n <ion-item>\n <ion-icon slot=\"start\" name=\"logo-whatsapp\"></ion-icon>\n <ion-label color=\"medium\">\n <h3 style=\"font-weight: bold\">WhatsApp</h3>\n <p>Not implemented yet - coming soon!</p>\n </ion-label>\n <!--\t\t<ion-buttons slot=\"end\">-->\n <!--\t\t\t<ion-button color=\"danger\">-->\n <!--\t\t\t\t<ion-icon name=\"close-circle-outline\" slot=\"start\"></ion-icon>-->\n <!--\t\t\t\t<ion-label>I have no WhatsApp</ion-label>-->\n <!--\t\t\t</ion-button>-->\n <!--\t\t</ion-buttons>-->\n </ion-item>\n <ion-item>\n <ion-icon slot=\"start\" name=\"logo-whatsapp\"></ion-icon>\n <!-- TODO: place Viber logo here -->\n <ion-label color=\"medium\">\n <h3 style=\"font-weight: bold\">Viber</h3>\n <p>Not implemented yet - coming soon!</p>\n </ion-label>\n </ion-item>\n </ion-list>\n <ion-card-content>\n <p>\n You'll get much more out of Sneat.app if you integrate it with messaging\n apps you use. Benefits:\n </p>\n <ul>\n <li>Easily add contacts</li>\n <li>Get reminders</li>\n <li>Add todo/to_buy from your messenger</li>\n <li>etc.</li>\n </ul>\n </ion-card-content>\n</ion-card>\n"]}
|
|
1
|
+
{"version":3,"file":"user-auth-accounts.component.js","sourceRoot":"","sources":["../../../../../../../../libs/auth/ui/src/lib/components/user-auth-providers/user-auth-accounts.component.ts","../../../../../../../../libs/auth/ui/src/lib/components/user-auth-providers/user-auth-accounts.component.html"],"names":[],"mappings":"AAAA,OAAO,EACL,uBAAuB,EACvB,SAAS,EACT,KAAK,EACL,MAAM,EACN,MAAM,GACP,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EACL,SAAS,EACT,UAAU,EACV,OAAO,EACP,cAAc,EACd,OAAO,EACP,OAAO,EACP,cAAc,EACd,QAAQ,EACR,OAAO,EACP,OAAO,GACR,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7C,OA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c;wBACd,QAAQ;wBACR,OAAO;wBACP,OAAO;wBACP,OAAO;wBACP,UAAU;wBACV,SAAS;wBACT,cAAc;qBACf,aACU;wBACT;4BACE,OAAO,EAAE,SAAS;4BAClB,QAAQ,EAAE,2BAA2B;yBACtC;qBACF","sourcesContent":["import {\n ChangeDetectionStrategy,\n Component,\n input,\n signal,\n inject,\n} from '@angular/core';\nimport { FormsModule } from '@angular/forms';\nimport {\n IonButton,\n IonButtons,\n IonCard,\n IonCardContent,\n IonIcon,\n IonItem,\n IonItemDivider,\n IonLabel,\n IonList,\n IonText,\n} from '@ionic/angular';\nimport { SneatApiService } from '@sneat/api';\nimport { AuthProviderID, SneatUserService } from '@sneat/auth-core';\nimport { IUserRecord } from '@sneat/auth-models';\nimport { ClassName, SneatBaseComponent } from '@sneat/ui';\nimport { LoginWithTelegramComponent } from '../../pages/login-page/login-with-telegram.component';\nimport { UserAuthAProviderStatusComponent } from './user-auth-provider-status';\n\n@Component({\n selector: 'sneat-user-auth-accounts',\n templateUrl: './user-auth-accounts.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [\n LoginWithTelegramComponent,\n FormsModule,\n UserAuthAProviderStatusComponent,\n IonCard,\n IonList,\n IonItemDivider,\n IonLabel,\n IonItem,\n IonIcon,\n IonText,\n IonButtons,\n IonButton,\n IonCardContent,\n ],\n providers: [\n {\n provide: ClassName,\n useValue: 'UserAuthAccountsComponent',\n },\n ],\n})\nexport class UserAuthAccountsComponent extends SneatBaseComponent {\n private readonly sneatUserService = inject(SneatUserService);\n private readonly sneatApiService = inject(SneatApiService);\n\n /**\n * The messaging-apps section (Telegram, WhatsApp, Viber) and its Sneat.app\n * copy. Apps that only need sign-in methods turn it off.\n */\n readonly showMessagingApps = input(true);\n\n protected readonly $userRecord = signal<IUserRecord | undefined>(undefined);\n\n protected readonly signingInWith = signal<AuthProviderID | undefined>(\n undefined,\n );\n\n constructor() {\n super();\n this.sneatUserService.userState.pipe(this.takeUntilDestroyed()).subscribe({\n next: (user) => {\n this.$userRecord.set(user.record || undefined);\n },\n });\n }\n\n protected hasAccount(provider: 'telegram' | 'viber' | 'whatsapp'): boolean {\n provider = provider + ':';\n for (const account of this.$userRecord()?.accounts || []) {\n if (account.startsWith(provider)) {\n return true;\n }\n }\n return false;\n }\n\n protected getAccountID(provider: 'telegram'): string {\n const prefix = provider + '::';\n const a = this.$userRecord()?.accounts?.find((a) => a.startsWith(prefix));\n return a?.replace(prefix, '') || '';\n }\n\n protected readonly disconnecting = signal<\n 'telegram' | 'viber' | 'whatsapp' | undefined\n >(undefined);\n\n protected disconnect(provider: 'telegram'): void {\n if (\n !confirm(\n 'Are you sure you want to disconnect Telegram login from your account?',\n )\n ) {\n return;\n }\n this.disconnecting.set(provider);\n this.sneatApiService\n .delete('auth/disconnect?provider=' + provider)\n .subscribe({\n next: () => {\n this.disconnecting.set(undefined);\n alert('Disconnected!');\n },\n error: this.errorLogger.logErrorHandler('Failed to disconnect'),\n });\n }\n}\n","<ion-card>\n <!--\t<ion-item color=\"light\" lines=\"full\">-->\n <!--\t\t<ion-label color=\"medium\"-->\n <!--\t\t\t><h2 style=\"font-weight: bold\">Authentication</h2></ion-label-->\n <!--\t\t>-->\n <!--\t</ion-item>-->\n <!--\t<ion-accordion-group [value]=\"integrations\">-->\n <!--\t\t<ion-accordion value=\"messaging-apps\">-->\n <!--\t\t\t<ion-item slot=\"header\" color=\"light\">-->\n <!--\t\t\t\t<ion-label>First Accordion</ion-label>-->\n <!--\t\t\t</ion-item>-->\n <!--\t\t\t<div class=\"ion-padding\" slot=\"content\">First Content</div>-->\n <!--\t\t</ion-accordion>-->\n <!--\t\t<ion-accordion value=\"quick-logins\">-->\n <!--\t\t\t<ion-item slot=\"header\" color=\"light\">-->\n <!--\t\t\t\t<ion-label>Second Accordion</ion-label>-->\n <!--\t\t\t</ion-item>-->\n <!--\t\t\t<div class=\"ion-padding\" slot=\"content\">Second Content</div>-->\n <!--\t\t</ion-accordion>-->\n <!--\t</ion-accordion-group>-->\n <!--\t<ion-item>-->\n <!--\t\t<ion-segment [(ngModel)]=\"integrations\" style=\"margin-bottom: 0.5em\">-->\n <!--\t\t\t<ion-segment-button value=\"messaging-apps\"-->\n <!--\t\t\t\t>Messaging Apps-->\n <!--\t\t\t</ion-segment-button>-->\n <!--\t\t\t<ion-segment-button value=\"quick-logins\">Quick logins</ion-segment-button>-->\n <!--\t\t</ion-segment>-->\n <!--\t</ion-item>-->\n <ion-list>\n <ion-item-divider color=\"light\">\n <ion-label color=\"medium\" style=\"font-weight: bold\"\n >Quick logins</ion-label\n >\n </ion-item-divider>\n <sneat-user-auth-provider-status\n providerID=\"google.com\"\n [signingInWith]=\"signingInWith()\"\n (signingInWithChange)=\"signingInWith.set($event)\"\n />\n <sneat-user-auth-provider-status\n providerID=\"apple.com\"\n [signingInWith]=\"signingInWith()\"\n (signingInWithChange)=\"signingInWith.set($event)\"\n />\n <sneat-user-auth-provider-status\n providerID=\"microsoft.com\"\n [signingInWith]=\"signingInWith()\"\n (signingInWithChange)=\"signingInWith.set($event)\"\n />\n <sneat-user-auth-provider-status\n providerID=\"github.com\"\n [signingInWith]=\"signingInWith()\"\n (signingInWithChange)=\"signingInWith.set($event)\"\n />\n </ion-list>\n @if (showMessagingApps()) {\n <ion-list>\n <ion-item-divider color=\"light\">\n <ion-label color=\"medium\" style=\"font-weight: bold\"\n >Messaging apps</ion-label\n >\n </ion-item-divider>\n\n <ion-item>\n <ion-icon slot=\"start\" name=\"paper-plane\" color=\"primary\"></ion-icon>\n @if (!$userRecord()) {\n <ion-label>\n <h3>Telegram</h3>\n <p>Checking....</p>\n </ion-label>\n } @else if (hasAccount('telegram')) {\n <ion-label>\n <h3 style=\"font-weight: bold\">Telegram</h3>\n <ion-text color=\"success\" [title]=\"getAccountID('telegram')\"\n >Connected!\n </ion-text>\n </ion-label>\n <ion-buttons slot=\"end\">\n <ion-button\n [disabled]=\"disconnecting()\"\n color=\"warning\"\n fill=\"solid\"\n (click)=\"disconnect('telegram')\"\n >\n <ion-icon name=\"close-outline\" slot=\"start\"></ion-icon>\n <ion-label>Disconnect</ion-label>\n </ion-button>\n </ion-buttons>\n } @else {\n <ion-label>\n <h3>Telegram</h3>\n <p>Not connected yet.</p>\n </ion-label>\n <ion-buttons slot=\"end\">\n <sneat-login-with-telegram [isUserAuthenticated]=\"true\" />\n </ion-buttons>\n }\n </ion-item>\n <ion-item>\n <ion-icon slot=\"start\" name=\"logo-whatsapp\"></ion-icon>\n <ion-label color=\"medium\">\n <h3 style=\"font-weight: bold\">WhatsApp</h3>\n <p>Not implemented yet - coming soon!</p>\n </ion-label>\n <!--\t\t<ion-buttons slot=\"end\">-->\n <!--\t\t\t<ion-button color=\"danger\">-->\n <!--\t\t\t\t<ion-icon name=\"close-circle-outline\" slot=\"start\"></ion-icon>-->\n <!--\t\t\t\t<ion-label>I have no WhatsApp</ion-label>-->\n <!--\t\t\t</ion-button>-->\n <!--\t\t</ion-buttons>-->\n </ion-item>\n <ion-item>\n <ion-icon slot=\"start\" name=\"logo-whatsapp\"></ion-icon>\n <!-- TODO: place Viber logo here -->\n <ion-label color=\"medium\">\n <h3 style=\"font-weight: bold\">Viber</h3>\n <p>Not implemented yet - coming soon!</p>\n </ion-label>\n </ion-item>\n </ion-list>\n <ion-card-content>\n <p>\n You'll get much more out of Sneat.app if you integrate it with messaging\n apps you use. Benefits:\n </p>\n <ul>\n <li>Easily add contacts</li>\n <li>Get reminders</li>\n <li>Add todo/to_buy from your messenger</li>\n <li>etc.</li>\n </ul>\n </ion-card-content>\n }\n</ion-card>\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user-auth-provider-status.js","sourceRoot":"","sources":["../../../../../../../../libs/auth/ui/src/lib/components/user-auth-providers/user-auth-provider-status.ts","../../../../../../../../libs/auth/ui/src/lib/components/user-auth-providers/user-auth-provider-status.html"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,YAAY,EACZ,KAAK,EACL,MAAM,EACN,MAAM,EACN,QAAQ,EAER,MAAM,EACN,uBAAuB,EACxB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,SAAS,EACT,UAAU,EACV,OAAO,EACP,OAAO,EACP,QAAQ,EACR,UAAU,GACX,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAGL,qBAAqB,GACtB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,WAAW,EAAgB,MAAM,aAAa,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;;AA0B1C,MAAM,OAAO,gCAAgC;
|
|
1
|
+
{"version":3,"file":"user-auth-provider-status.js","sourceRoot":"","sources":["../../../../../../../../libs/auth/ui/src/lib/components/user-auth-providers/user-auth-provider-status.ts","../../../../../../../../libs/auth/ui/src/lib/components/user-auth-providers/user-auth-provider-status.html"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,YAAY,EACZ,KAAK,EACL,MAAM,EACN,MAAM,EACN,QAAQ,EAER,MAAM,EACN,uBAAuB,EACxB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,SAAS,EACT,UAAU,EACV,OAAO,EACP,OAAO,EACP,QAAQ,EACR,UAAU,GACX,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAGL,qBAAqB,GACtB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,WAAW,EAAgB,MAAM,aAAa,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;;AA0B1C,MAAM,OAAO,gCAAgC;IAkE3C;QAjEiB,gBAAW,GAAG,MAAM,CAAe,WAAW,CAAC,CAAC;QAChD,qBAAgB,GAAG,MAAM,CAAC,qBAAqB,CAAC,CAAC;QAEjD,eAAU,GAAG,IAAI,OAAO,EAAQ,CAAC;QAC3C,eAAU,GAAG,KAAK,CAAC,QAAQ;uFAAkB,CAAC;QAClC,aAAQ,GAAG,QAAQ,CAAW,GAAG,EAAE;YACpD,MAAM,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n OnDestroy,\n inject,\n ChangeDetectionStrategy\n} from '@angular/core';\nimport {\n IonButton,\n IonButtons,\n IonIcon,\n IonItem,\n IonLabel,\n IonSpinner,\n} from '@ionic/angular';\nimport {\n AuthProviderID,\n ISneatAuthUser,\n SneatAuthStateService,\n} from '@sneat/auth-core';\nimport { ErrorLogger, IErrorLogger } from '@sneat/core';\nimport { Subject, takeUntil } from 'rxjs';\n\ntype IonicColor =\n | 'primary'\n | 'secondary'\n | 'tertiary'\n | 'success'\n | 'warning'\n | 'danger'\n | 'light'\n | 'medium'\n | 'dark';\n\ninterface provider {\n readonly id: AuthProviderID;\n readonly title: string;\n readonly icon: string;\n readonly color: IonicColor;\n}\n\n@Component({\n selector: 'sneat-user-auth-provider-status',\n templateUrl: './user-auth-provider-status.html',\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [IonItem, IonIcon, IonLabel, IonButtons, IonButton, IonSpinner],\n})\nexport class UserAuthAProviderStatusComponent implements OnDestroy {\n private readonly errorLogger = inject<IErrorLogger>(ErrorLogger);\n private readonly authStateService = inject(SneatAuthStateService);\n\n private readonly $destroyed = new Subject<void>();\n public providerID = input.required<AuthProviderID>();\n protected readonly provider = computed<provider>(() => {\n const id = this.providerID();\n switch (id) {\n case 'facebook.com':\n return {\n id: id,\n title: 'Facebook',\n icon: 'logo-facebook',\n color: 'primary',\n };\n case 'google.com':\n return {\n id,\n title: 'Google',\n icon: 'logo-google',\n color: 'danger',\n };\n case 'apple.com':\n return {\n id,\n title: 'Apple',\n icon: 'logo-apple',\n color: 'dark',\n };\n case 'github.com':\n return {\n id,\n title: 'GitHub',\n icon: 'logo-github',\n color: 'dark',\n };\n case 'microsoft.com':\n return {\n id,\n title: 'Microsoft',\n icon: 'logo-windows',\n color: 'secondary',\n };\n case undefined:\n throw new Error('Undefined provider ID');\n default:\n return {\n id,\n title: id,\n icon: 'help-circle',\n color: 'medium',\n };\n }\n });\n\n readonly signingInWith = input.required<AuthProviderID | undefined>();\n\n @Output() readonly signingInWithChange = new EventEmitter<\n AuthProviderID | undefined\n >();\n\n protected readonly currentUser = signal<ISneatAuthUser | null | undefined>(\n undefined,\n );\n\n constructor() {\n this.authStateService.authUser\n .pipe(takeUntil(this.$destroyed))\n .subscribe((authUser) => {\n this.currentUser.set(authUser);\n });\n }\n\n protected readonly isSigningIn = computed(\n () => this.signingInWith() === this.providerID(),\n );\n\n protected readonly isDisabled = computed(() => {\n const signingInWith = this.signingInWith();\n return !!signingInWith;\n });\n\n readonly authProviderUserInfo = computed(() => {\n const providerID = this.providerID();\n return this.currentUser()?.providerData?.find(\n (pd) => pd.providerId == providerID,\n );\n });\n\n readonly isConnected = computed(() => !!this.authProviderUserInfo());\n\n protected connect(): void {\n const providerID = this.providerID();\n if (!providerID) {\n throw new Error('auth providerID is not set');\n }\n this.signingInWithChange.emit(providerID);\n this.authStateService\n .linkWith(providerID)\n .then(() => {\n this.signingInWithChange.emit(undefined);\n })\n .catch((e) => {\n console.error('Failed to connect', e);\n this.signingInWithChange.emit(undefined);\n });\n }\n\n protected disconnect(): void {\n const providerID = this.providerID();\n if (!providerID) {\n this.errorLogger.logError('auth providerID is not set');\n return;\n }\n this.authStateService\n .unlinkAuthProvider(providerID)\n .then(() => this.signingInWithChange.emit(undefined))\n .catch((err) => {\n this.signingInWithChange.emit(undefined);\n this.errorLogger.logError(err);\n });\n this.signingInWithChange.emit(providerID);\n }\n\n public ngOnDestroy(): void {\n this.$destroyed.next();\n this.$destroyed.complete();\n }\n}\n","<ion-item>\n <ion-icon [color]=\"provider().color\" [name]=\"provider().icon\" slot=\"start\" />\n <ion-label>\n <h3>{{ provider().title || providerID() }}</h3>\n <p>\n @if(isConnected()) { Connected as\n <b>{{authProviderUserInfo()?.displayName}}</b>\n ‐ \n <a href=\"mailto:{{authProviderUserInfo()?.email}}\"\n >{{authProviderUserInfo()?.email}}</a\n >. } @else { Not connected yet. }\n </p>\n </ion-label>\n <ion-buttons slot=\"end\">\n @if (isConnected()) {\n <ion-button color=\"medium\" fill=\"outline\" (click)=\"disconnect()\">\n <ion-icon name=\"close-circle-outline\" slot=\"start\"></ion-icon>\n <ion-label>\n @if (isSigningIn()) { Disconnecting... } @else { Disconnect }\n </ion-label>\n </ion-button>\n } @else {\n <ion-button\n [disabled]=\"isDisabled()\"\n [color]=\"provider().color\"\n [fill]=\"'solid'\"\n (click)=\"connect()\"\n >\n @if (isSigningIn()) {\n <ion-spinner slot=\"start\" name=\"lines-small\" />\n } @else {\n <ion-icon slot=\"start\" [name]=\"provider().icon\" />\n }\n\n <ion-label>\n @if (signingInWith() === providerID()) { Signing in... } @else { Connect\n }\n </ion-label>\n </ion-button>\n }\n </ion-buttons>\n</ion-item>\n"]}
|
|
@@ -2,7 +2,7 @@ import { ChangeDetectionStrategy, Component, DestroyRef, EventEmitter, Output, c
|
|
|
2
2
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
3
3
|
import { RouterLink } from '@angular/router';
|
|
4
4
|
import { Capacitor } from '@capacitor/core';
|
|
5
|
-
import { AuthStatuses, SneatAuthStateService, SneatUserService, isSneatAccountReady, } from '@sneat/auth-core';
|
|
5
|
+
import { AuthStatuses, SneatAuthStateService, SneatUserService, authProviderTitle, isAccountExistsWithDifferentCredential, isSneatAccountReady, } from '@sneat/auth-core';
|
|
6
6
|
import { ErrorLogger } from '@sneat/core';
|
|
7
7
|
import { IonButton, IonCard, IonCol, IonGrid, IonIcon, IonItem, IonItemDivider, IonLabel, IonList, IonRow, IonSpinner, IonText, } from '@ionic/angular';
|
|
8
8
|
import { EmailLoginFormComponent, } from './email-login-form/email-login-form.component';
|
|
@@ -30,6 +30,12 @@ export class AuthPanelComponent {
|
|
|
30
30
|
...(ngDevMode ? [{ debugName: "signingWith" }] : /* istanbul ignore next */ []));
|
|
31
31
|
this.authRecoveryNeeded = signal(false, /* @ts-ignore */
|
|
32
32
|
...(ngDevMode ? [{ debugName: "authRecoveryNeeded" }] : /* istanbul ignore next */ []));
|
|
33
|
+
/**
|
|
34
|
+
* Set when sign-in hit an email that already has an account: names the
|
|
35
|
+
* provider that will be connected once the user signs in the usual way.
|
|
36
|
+
*/
|
|
37
|
+
this.pendingLink = signal(undefined, /* @ts-ignore */
|
|
38
|
+
...(ngDevMode ? [{ debugName: "pendingLink" }] : /* istanbul ignore next */ []));
|
|
33
39
|
this.recordState = signal('loading', /* @ts-ignore */
|
|
34
40
|
...(ngDevMode ? [{ debugName: "recordState" }] : /* istanbul ignore next */ []));
|
|
35
41
|
this.isNativePlatform = Capacitor.isNativePlatform();
|
|
@@ -49,6 +55,19 @@ export class AuthPanelComponent {
|
|
|
49
55
|
return this.uiConfig.quickLoginProviders?.includes(provider) ?? true;
|
|
50
56
|
}
|
|
51
57
|
ngOnInit() {
|
|
58
|
+
// A redirect sign-in that hit an existing account is read after this
|
|
59
|
+
// page renders, so follow the pending link rather than reading it once.
|
|
60
|
+
this.authStateService.pendingCredentialLinkChanges
|
|
61
|
+
.pipe(takeUntilDestroyed(this.destroyRef))
|
|
62
|
+
.subscribe((link) => {
|
|
63
|
+
if (link) {
|
|
64
|
+
this.pendingLink.set({
|
|
65
|
+
provider: authProviderTitle(link.providerId),
|
|
66
|
+
email: link.email,
|
|
67
|
+
autoLink: true,
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
});
|
|
52
71
|
// This initial BehaviorSubject value is emitted after inputs and output
|
|
53
72
|
// listeners are connected. Consumers can gate account-dependent work until
|
|
54
73
|
// the matching user record is ready, even when auth resolved before mount.
|
|
@@ -103,6 +122,18 @@ export class AuthPanelComponent {
|
|
|
103
122
|
}
|
|
104
123
|
catch (error) {
|
|
105
124
|
clearLoginRedirectIntent();
|
|
125
|
+
this.signingWith.set(undefined);
|
|
126
|
+
if (isAccountExistsWithDifferentCredential(error)) {
|
|
127
|
+
// A pending link for another provider (an earlier attempt) is not
|
|
128
|
+
// this one: say how to connect this provider by hand.
|
|
129
|
+
if (this.authStateService.pendingCredentialLink?.providerId !== provider) {
|
|
130
|
+
this.pendingLink.set({
|
|
131
|
+
provider: authProviderTitle(provider),
|
|
132
|
+
autoLink: false,
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
106
137
|
const message = error.errorMessage;
|
|
107
138
|
if (message !== 'The user canceled the sign-in flow.' &&
|
|
108
139
|
!message?.includes('com.apple.AuthenticationServices.AuthorizationError error 1001.')) {
|
|
@@ -128,7 +159,7 @@ export class AuthPanelComponent {
|
|
|
128
159
|
this.userService.onUserSignedIn(authState);
|
|
129
160
|
}
|
|
130
161
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: AuthPanelComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
131
|
-
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 (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 }); }
|
|
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 }); }
|
|
132
163
|
}
|
|
133
164
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: AuthPanelComponent, decorators: [{
|
|
134
165
|
type: Component,
|
|
@@ -148,7 +179,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImpor
|
|
|
148
179
|
IonRow,
|
|
149
180
|
IonSpinner,
|
|
150
181
|
IonText,
|
|
151
|
-
], 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 (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" }]
|
|
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" }]
|
|
152
183
|
}], 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: [{
|
|
153
184
|
type: Output
|
|
154
185
|
}] } });
|
|
@@ -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;A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AC1B,CAAC;QACF,IAAI,CAAC,WAAW,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC;IAC7C,CAAC;8GA7HU,kBAAkB;kGAAlB,kBAAkB,uqBAFlB,CAAC,eAAe,CAAC,0BCjF9B,2rOA0MA,4CDzII,UAAU,kPACV,uBAAuB,oJACvB,0BAA0B,oJAC1B,SAAS,sRACT,OAAO,yLACP,MAAM,kTACN,OAAO,wEACP,OAAO,2JACP,OAAO,0NACP,cAAc,kGACd,QAAQ,6FACR,OAAO,yFACP,MAAM,oDACN,UAAU,yGACV,OAAO;;2FAIE,kBAAkB;kBAvB9B,SAAS;+BACE,kBAAkB,mBAEX,uBAAuB,CAAC,MAAM,WACtC;wBACP,UAAU;wBACV,uBAAuB;wBACvB,0BAA0B;wBAC1B,SAAS;wBACT,OAAO;wBACP,MAAM;wBACN,OAAO;wBACP,OAAO;wBACP,OAAO;wBACP,cAAc;wBACd,QAAQ;wBACR,OAAO;wBACP,MAAM;wBACN,UAAU;wBACV,OAAO;qBACR,aACU,CAAC,eAAe,CAAC;;sBAY3B,MAAM","sourcesContent":["import {\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 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 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 // 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 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 (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,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,iB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wBACvB,0BAA0B;wBAC1B,SAAS;wBACT,OAAO;wBACP,MAAM;wBACN,OAAO;wBACP,OAAO;wBACP,OAAO;wBACP,cAAc;wBACd,QAAQ;wBACR,OAAO;wBACP,MAAM;wBACN,UAAU;wBACV,OAAO;qBACR,aACU,CAAC,eAAe,CAAC;;sBAY3B,MAAM","sourcesContent":["import {\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 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"]}
|
|
@@ -5,6 +5,11 @@ import * as i0 from "@angular/core";
|
|
|
5
5
|
export declare class UserAuthAccountsComponent extends SneatBaseComponent {
|
|
6
6
|
private readonly sneatUserService;
|
|
7
7
|
private readonly sneatApiService;
|
|
8
|
+
/**
|
|
9
|
+
* The messaging-apps section (Telegram, WhatsApp, Viber) and its Sneat.app
|
|
10
|
+
* copy. Apps that only need sign-in methods turn it off.
|
|
11
|
+
*/
|
|
12
|
+
readonly showMessagingApps: import("@angular/core").InputSignal<boolean>;
|
|
8
13
|
protected readonly $userRecord: import("@angular/core").WritableSignal<IUserRecord | undefined>;
|
|
9
14
|
protected readonly signingInWith: import("@angular/core").WritableSignal<AuthProviderID | undefined>;
|
|
10
15
|
constructor();
|
|
@@ -13,5 +18,5 @@ export declare class UserAuthAccountsComponent extends SneatBaseComponent {
|
|
|
13
18
|
protected readonly disconnecting: import("@angular/core").WritableSignal<"telegram" | "viber" | "whatsapp" | undefined>;
|
|
14
19
|
protected disconnect(provider: 'telegram'): void;
|
|
15
20
|
static ɵfac: i0.ɵɵFactoryDeclaration<UserAuthAccountsComponent, never>;
|
|
16
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<UserAuthAccountsComponent, "sneat-user-auth-accounts", never, {}, {}, never, never, true, never>;
|
|
21
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<UserAuthAccountsComponent, "sneat-user-auth-accounts", never, { "showMessagingApps": { "alias": "showMessagingApps"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
17
22
|
}
|
|
@@ -18,6 +18,16 @@ export declare class AuthPanelComponent implements OnInit {
|
|
|
18
18
|
readonly accountReadyChange: EventEmitter<AuthPanelAccountReadyChange>;
|
|
19
19
|
protected readonly signingWith: import("@angular/core").WritableSignal<EmailFormSigningWith | AuthProviderID | undefined>;
|
|
20
20
|
protected readonly authRecoveryNeeded: import("@angular/core").WritableSignal<boolean>;
|
|
21
|
+
/**
|
|
22
|
+
* Set when sign-in hit an email that already has an account: names the
|
|
23
|
+
* provider that will be connected once the user signs in the usual way.
|
|
24
|
+
*/
|
|
25
|
+
protected readonly pendingLink: import("@angular/core").WritableSignal<{
|
|
26
|
+
readonly provider: string;
|
|
27
|
+
readonly email?: string;
|
|
28
|
+
/** False when no credential could be kept to link later. */
|
|
29
|
+
readonly autoLink: boolean;
|
|
30
|
+
} | undefined>;
|
|
21
31
|
protected readonly recordState: import("@angular/core").WritableSignal<"signed-out" | "loading" | "ready" | "failed">;
|
|
22
32
|
protected readonly isNativePlatform: boolean;
|
|
23
33
|
protected readonly safeReturnTo: import("@angular/core").Signal<string | undefined>;
|