@sneat/auth-ui 0.26.0 → 0.26.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm2022/lib/components/auth-menu-item/auth-menu-item.component.js +14 -9
- package/esm2022/lib/components/auth-menu-item/auth-menu-item.component.js.map +1 -1
- package/esm2022/lib/components/user-auth-providers/user-auth-accounts.component.js +11 -8
- 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 +22 -14
- package/esm2022/lib/components/user-auth-providers/user-auth-provider-status.js.map +1 -1
- package/esm2022/lib/components/user-required-fields/user-required-fields-modal.component.js +10 -12
- package/esm2022/lib/components/user-required-fields/user-required-fields-modal.component.js.map +1 -1
- package/esm2022/lib/components/user-required-fields/user-required-fields.service.js +4 -4
- package/esm2022/lib/components/user-required-fields/user-required-fields.service.js.map +1 -1
- package/esm2022/lib/pages/login-page/email-login-form/email-login-form.component.js +24 -14
- package/esm2022/lib/pages/login-page/email-login-form/email-login-form.component.js.map +1 -1
- package/esm2022/lib/pages/login-page/login-page.component.js +15 -11
- package/esm2022/lib/pages/login-page/login-page.component.js.map +1 -1
- package/esm2022/lib/pages/login-page/login-with-telegram.component.js +22 -26
- package/esm2022/lib/pages/login-page/login-with-telegram.component.js.map +1 -1
- package/esm2022/lib/pages/login-page/sneat-auth-with-telegram.service.js +3 -3
- package/esm2022/lib/pages/sign-in-from-email-link/sign-in-from-email-link-page.component.js +10 -7
- package/esm2022/lib/pages/sign-in-from-email-link/sign-in-from-email-link-page.component.js.map +1 -1
- package/esm2022/lib/pages/sneat-auth-routing.module.js +4 -4
- package/esm2022/lib/pipes/person-names.pipe.js +3 -3
- package/lib/components/user-required-fields/user-required-fields-modal.component.d.ts +2 -2
- package/lib/pages/login-page/email-login-form/email-login-form.component.d.ts +2 -2
- package/lib/pages/login-page/login-with-telegram.component.d.ts +6 -6
- package/package.json +4 -4
- package/tsconfig.lib.prod.tsbuildinfo +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { JsonPipe } from '@angular/common';
|
|
2
2
|
import { ChangeDetectionStrategy, Component, computed, signal, inject, } from '@angular/core';
|
|
3
3
|
import { RouterModule } from '@angular/router';
|
|
4
|
-
import { IonButton, IonButtons, IonIcon, IonItem, IonItemDivider, IonLabel, MenuController, NavController, } from '@ionic/angular
|
|
4
|
+
import { IonButton, IonButtons, IonIcon, IonItem, IonItemDivider, IonLabel, MenuController, NavController, } from '@ionic/angular';
|
|
5
5
|
import { SneatAuthStateService, SneatUserService, } from '@sneat/auth-core';
|
|
6
6
|
import { ErrorLogger } from '@sneat/core';
|
|
7
7
|
import { Subject, takeUntil } from 'rxjs';
|
|
@@ -18,11 +18,16 @@ export class AuthMenuItemComponent {
|
|
|
18
18
|
this.navCtrl = inject(NavController);
|
|
19
19
|
this.authStateService = inject(SneatAuthStateService);
|
|
20
20
|
this.menuController = inject(MenuController);
|
|
21
|
-
this.$user = signal(undefined,
|
|
22
|
-
|
|
23
|
-
this.$
|
|
24
|
-
|
|
25
|
-
this.$
|
|
21
|
+
this.$user = signal(undefined, /* @ts-ignore */
|
|
22
|
+
...(ngDevMode ? [{ debugName: "$user" }] : /* istanbul ignore next */ []));
|
|
23
|
+
this.$err = signal(undefined, /* @ts-ignore */
|
|
24
|
+
...(ngDevMode ? [{ debugName: "$err" }] : /* istanbul ignore next */ []));
|
|
25
|
+
this.$authState = signal(undefined, /* @ts-ignore */
|
|
26
|
+
...(ngDevMode ? [{ debugName: "$authState" }] : /* istanbul ignore next */ []));
|
|
27
|
+
this.$authStatus = computed(() => this.$authState()?.status, /* @ts-ignore */
|
|
28
|
+
...(ngDevMode ? [{ debugName: "$authStatus" }] : /* istanbul ignore next */ []));
|
|
29
|
+
this.$isAuthenticating = computed(() => this.$authStatus() === 'authenticating', /* @ts-ignore */
|
|
30
|
+
...(ngDevMode ? [{ debugName: "$isAuthenticating" }] : /* istanbul ignore next */ []));
|
|
26
31
|
this.$destroyed = new Subject();
|
|
27
32
|
this.personName = personNames;
|
|
28
33
|
const errorLogger = this.errorLogger;
|
|
@@ -62,10 +67,10 @@ export class AuthMenuItemComponent {
|
|
|
62
67
|
}
|
|
63
68
|
return false;
|
|
64
69
|
}
|
|
65
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
66
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "
|
|
70
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: AuthMenuItemComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
71
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.3", type: AuthMenuItemComponent, isStandalone: true, selector: "sneat-auth-menu-item", ngImport: i0, template: "<ion-item-divider color=\"light\">\n @if ($authStatus() === \"authenticated\") {\n <ion-label>Signed in as</ion-label>\n } @else {\n <ion-label>Authentication</ion-label>\n }\n</ion-item-divider>\n@if (!$authState()) {\n <ion-item>\n <ion-label>Loading....</ion-label>\n </ion-item>\n} @else if ($isAuthenticating()) {\n <ion-item routerLink=\"login\">\n <ion-label>Authenticating....</ion-label>\n </ion-item>\n}\n@if ($authStatus() === \"notAuthenticated\") {\n <ion-item routerLink=\"/login\" tappable=\"true\">\n <ion-icon slot=\"start\" name=\"person-circle-outline\" />\n <ion-label color=\"primary\"> Please sign in</ion-label>\n </ion-item>\n}\n@if ($authStatus() === \"authenticated\") {\n <ion-item\n tappable=\"true\"\n routerLink=\"/my\"\n routerDirection=\"forward\"\n (click)=\"closeMenu()\"\n >\n <!-- <ion-buttons slot=\"start\" class=\"ion-no-margin\">-->\n <!-- <ion-button disabled color=\"medium\" >-->\n <!-- <ion-icon slot=\"start\" name=\"person-circle-outline\"></ion-icon>-->\n <!-- </ion-button>-->\n <!-- </ion-buttons>-->\n <ion-icon slot=\"start\" name=\"person-circle-outline\" />\n\n <ion-label color=\"medium\">\n @if ($user()?.record?.names; as names) {\n {{ names | personNames }}\n } @else {\n @if ($authState()?.user; as user) {\n {{ user.displayName || user.email || user.phoneNumber || user.uid }}\n }\n }\n </ion-label>\n\n <ion-buttons slot=\"end\">\n <!--\t\t<ion-button color=\"medium\" title=\"Settings\">-->\n <!--\t\t\t<ion-icon name=\"settings-outline\"></ion-icon>-->\n <!--\t\t</ion-button>-->\n <ion-button color=\"medium\" title=\"Sign-out\" (click)=\"logout($event)\">\n <ion-icon name=\"log-out-outline\" />\n </ion-button>\n </ion-buttons>\n </ion-item>\n}\n@if ($err()) {\n <ion-item> ERROR: {{ $err() | json }}</ion-item>\n}\n", dependencies: [{ kind: "ngmodule", type: RouterModule }, { kind: "directive", type: i1.RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "browserUrl", "routerLink"] }, { kind: "component", type: IonItemDivider, selector: "ion-item-divider", inputs: ["color", "mode", "sticky"] }, { kind: "component", type: IonLabel, selector: "ion-label", inputs: ["color", "mode", "position"] }, { kind: "component", type: IonItem, selector: "ion-item", inputs: ["button", "color", "detail", "detailIcon", "disabled", "download", "href", "lines", "mode", "rel", "routerAnimation", "routerDirection", "target", "type"] }, { kind: "component", type: IonIcon, selector: "ion-icon", inputs: ["color", "flipRtl", "icon", "ios", "lazy", "md", "mode", "name", "sanitize", "size", "src"] }, { kind: "component", type: IonButtons, selector: "ion-buttons", inputs: ["collapse"] }, { kind: "component", type: IonButton, selector: "ion-button", inputs: ["buttonType", "color", "disabled", "download", "expand", "fill", "form", "href", "mode", "rel", "routerAnimation", "routerDirection", "shape", "size", "strong", "target", "type"], outputs: ["ionFocus", "ionBlur"] }, { kind: "pipe", type: PersonNamesPipe, name: "personNames" }, { kind: "pipe", type: JsonPipe, name: "json" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
67
72
|
}
|
|
68
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
73
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: AuthMenuItemComponent, decorators: [{
|
|
69
74
|
type: Component,
|
|
70
75
|
args: [{ selector: 'sneat-auth-menu-item', imports: [
|
|
71
76
|
RouterModule,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth-menu-item.component.js","sourceRoot":"","sources":["../../../../../../../../libs/auth/ui/src/lib/components/auth-menu-item/auth-menu-item.component.ts","../../../../../../../../libs/auth/ui/src/lib/components/auth-menu-item/auth-menu-item.component.html"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EACL,uBAAuB,EACvB,SAAS,EACT,QAAQ,EACR,MAAM,EAEN,MAAM,GACP,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EACL,SAAS,EACT,UAAU,EACV,OAAO,EACP,OAAO,EACP,cAAc,EACd,QAAQ,EACR,cAAc,EACd,aAAa,GACd,MAAM,
|
|
1
|
+
{"version":3,"file":"auth-menu-item.component.js","sourceRoot":"","sources":["../../../../../../../../libs/auth/ui/src/lib/components/auth-menu-item/auth-menu-item.component.ts","../../../../../../../../libs/auth/ui/src/lib/components/auth-menu-item/auth-menu-item.component.html"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EACL,uBAAuB,EACvB,SAAS,EACT,QAAQ,EACR,MAAM,EAEN,MAAM,GACP,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EACL,SAAS,EACT,UAAU,EACV,OAAO,EACP,OAAO,EACP,cAAc,EACd,QAAQ,EACR,cAAc,EAC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U,qBAAqB;kGAArB,qBAAqB,gFC7ClC,q6DA2DA,2CD1BI,YAAY,8RAEZ,cAAc,kGACd,QAAQ,6FACR,OAAO,0NACP,OAAO,2JACP,UAAU,8EACV,SAAS,iRANT,eAAe,+CAOf,QAAQ;;2FAIC,qBAAqB;kBAhBjC,SAAS;+BACE,sBAAsB,WAEvB;wBACP,YAAY;wBACZ,eAAe;wBACf,cAAc;wBACd,QAAQ;wBACR,OAAO;wBACP,OAAO;wBACP,UAAU;wBACV,SAAS;wBACT,QAAQ;qBACT,mBACgB,uBAAuB,CAAC,MAAM","sourcesContent":["import { JsonPipe } from '@angular/common';\nimport {\n ChangeDetectionStrategy,\n Component,\n computed,\n signal,\n OnDestroy,\n inject,\n} from '@angular/core';\nimport { RouterModule } from '@angular/router';\nimport {\n IonButton,\n IonButtons,\n IonIcon,\n IonItem,\n IonItemDivider,\n IonLabel,\n MenuController,\n NavController,\n} from '@ionic/angular';\nimport {\n ISneatAuthState,\n ISneatUserState,\n SneatAuthStateService,\n SneatUserService,\n} from '@sneat/auth-core';\nimport { ErrorLogger, IErrorLogger } from '@sneat/core';\nimport { Subject, takeUntil } from 'rxjs';\nimport { PersonNamesPipe, personNames } from '../../pipes/person-names.pipe';\n@Component({\n selector: 'sneat-auth-menu-item',\n templateUrl: './auth-menu-item.component.html',\n imports: [\n RouterModule,\n PersonNamesPipe,\n IonItemDivider,\n IonLabel,\n IonItem,\n IonIcon,\n IonButtons,\n IonButton,\n JsonPipe,\n ],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class AuthMenuItemComponent implements OnDestroy {\n private readonly errorLogger = inject<IErrorLogger>(ErrorLogger);\n private readonly navCtrl = inject(NavController);\n private readonly authStateService = inject(SneatAuthStateService);\n private readonly menuController = inject(MenuController);\n\n protected readonly $user = signal<ISneatUserState | undefined>(undefined);\n protected $err = signal<unknown>(undefined);\n\n protected readonly $authState = signal<ISneatAuthState | undefined>(\n undefined,\n );\n protected readonly $authStatus = computed(() => this.$authState()?.status);\n protected readonly $isAuthenticating = computed(\n () => this.$authStatus() === 'authenticating',\n );\n\n protected readonly $destroyed = new Subject<void>();\n\n public ngOnDestroy(): void {\n this.$destroyed.next();\n this.$destroyed.complete();\n }\n\n constructor() {\n const errorLogger = this.errorLogger;\n const authStateService = this.authStateService;\n const userService = inject(SneatUserService);\n\n userService.userState\n .pipe(takeUntil(this.$destroyed))\n .subscribe(this.$user.set);\n authStateService.authState.pipe(takeUntil(this.$destroyed)).subscribe({\n next: this.$authState.set,\n error: (err) => {\n this.$err.set(err);\n errorLogger.logError('failed to get auth state');\n },\n });\n }\n\n public closeMenu(): void {\n this.menuController\n .close()\n .catch(this.errorLogger.logErrorHandler('Failed to close menu'));\n }\n\n public logout(event: Event): boolean {\n event.stopPropagation();\n event.preventDefault();\n try {\n this.authStateService\n .signOut()\n .then(() => {\n this.navCtrl\n .navigateBack('/signed-out')\n .catch(\n this.errorLogger.logErrorHandler(\n 'Failed to navigate to signed out page',\n ),\n );\n })\n .catch(this.errorLogger.logErrorHandler('Failed to sign out'));\n } catch (e) {\n this.errorLogger.logError(e, 'Failed to logout');\n }\n return false;\n }\n\n protected readonly personName = personNames;\n}\n","<ion-item-divider color=\"light\">\n @if ($authStatus() === \"authenticated\") {\n <ion-label>Signed in as</ion-label>\n } @else {\n <ion-label>Authentication</ion-label>\n }\n</ion-item-divider>\n@if (!$authState()) {\n <ion-item>\n <ion-label>Loading....</ion-label>\n </ion-item>\n} @else if ($isAuthenticating()) {\n <ion-item routerLink=\"login\">\n <ion-label>Authenticating....</ion-label>\n </ion-item>\n}\n@if ($authStatus() === \"notAuthenticated\") {\n <ion-item routerLink=\"/login\" tappable=\"true\">\n <ion-icon slot=\"start\" name=\"person-circle-outline\" />\n <ion-label color=\"primary\"> Please sign in</ion-label>\n </ion-item>\n}\n@if ($authStatus() === \"authenticated\") {\n <ion-item\n tappable=\"true\"\n routerLink=\"/my\"\n routerDirection=\"forward\"\n (click)=\"closeMenu()\"\n >\n <!-- <ion-buttons slot=\"start\" class=\"ion-no-margin\">-->\n <!-- <ion-button disabled color=\"medium\" >-->\n <!-- <ion-icon slot=\"start\" name=\"person-circle-outline\"></ion-icon>-->\n <!-- </ion-button>-->\n <!-- </ion-buttons>-->\n <ion-icon slot=\"start\" name=\"person-circle-outline\" />\n\n <ion-label color=\"medium\">\n @if ($user()?.record?.names; as names) {\n {{ names | personNames }}\n } @else {\n @if ($authState()?.user; as user) {\n {{ user.displayName || user.email || user.phoneNumber || user.uid }}\n }\n }\n </ion-label>\n\n <ion-buttons slot=\"end\">\n <!--\t\t<ion-button color=\"medium\" title=\"Settings\">-->\n <!--\t\t\t<ion-icon name=\"settings-outline\"></ion-icon>-->\n <!--\t\t</ion-button>-->\n <ion-button color=\"medium\" title=\"Sign-out\" (click)=\"logout($event)\">\n <ion-icon name=\"log-out-outline\" />\n </ion-button>\n </ion-buttons>\n </ion-item>\n}\n@if ($err()) {\n <ion-item> ERROR: {{ $err() | json }}</ion-item>\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ChangeDetectionStrategy, Component, signal, inject, } from '@angular/core';
|
|
2
2
|
import { FormsModule } from '@angular/forms';
|
|
3
|
-
import { IonButton, IonButtons, IonCard, IonCardContent, IonIcon, IonItem, IonItemDivider, IonLabel, IonList, IonText, } from '@ionic/angular
|
|
3
|
+
import { IonButton, IonButtons, IonCard, IonCardContent, IonIcon, IonItem, IonItemDivider, IonLabel, IonList, IonText, } from '@ionic/angular';
|
|
4
4
|
import { SneatApiService } from '@sneat/api';
|
|
5
5
|
import { SneatUserService } from '@sneat/auth-core';
|
|
6
6
|
import { ClassName, SneatBaseComponent } from '@sneat/ui';
|
|
@@ -12,9 +12,12 @@ export class UserAuthAccountsComponent extends SneatBaseComponent {
|
|
|
12
12
|
super();
|
|
13
13
|
this.sneatUserService = inject(SneatUserService);
|
|
14
14
|
this.sneatApiService = inject(SneatApiService);
|
|
15
|
-
this.$userRecord = signal(undefined,
|
|
16
|
-
|
|
17
|
-
this.
|
|
15
|
+
this.$userRecord = signal(undefined, /* @ts-ignore */
|
|
16
|
+
...(ngDevMode ? [{ debugName: "$userRecord" }] : /* istanbul ignore next */ []));
|
|
17
|
+
this.signingInWith = signal(undefined, /* @ts-ignore */
|
|
18
|
+
...(ngDevMode ? [{ debugName: "signingInWith" }] : /* istanbul ignore next */ []));
|
|
19
|
+
this.disconnecting = signal(undefined, /* @ts-ignore */
|
|
20
|
+
...(ngDevMode ? [{ debugName: "disconnecting" }] : /* istanbul ignore next */ []));
|
|
18
21
|
this.sneatUserService.userState.pipe(this.takeUntilDestroyed()).subscribe({
|
|
19
22
|
next: (user) => {
|
|
20
23
|
this.$userRecord.set(user.record || undefined);
|
|
@@ -50,15 +53,15 @@ export class UserAuthAccountsComponent extends SneatBaseComponent {
|
|
|
50
53
|
error: this.errorLogger.logErrorHandler('Failed to disconnect'),
|
|
51
54
|
});
|
|
52
55
|
}
|
|
53
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
54
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "
|
|
56
|
+
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: [
|
|
55
58
|
{
|
|
56
59
|
provide: ClassName,
|
|
57
60
|
useValue: 'UserAuthAccountsComponent',
|
|
58
61
|
},
|
|
59
|
-
], 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 <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", 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"] }, { kind: "component", type: IonCardContent, selector: "ion-card-content", inputs: ["mode"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
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 <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", 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 }); }
|
|
60
63
|
}
|
|
61
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
64
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: UserAuthAccountsComponent, decorators: [{
|
|
62
65
|
type: Component,
|
|
63
66
|
args: [{ selector: 'sneat-user-auth-accounts', changeDetection: ChangeDetectionStrategy.OnPush, imports: [
|
|
64
67
|
LoginWithTelegramComponent,
|
|
@@ -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,2BAA2B,CAAC;AACnC,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAkB,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEpE,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAC1D,OAAO,EAAE,0BAA0B,EAAE,MAAM,sDAAsD,CAAC;AAClG,OAAO,EAAE,gCAAgC,EAAE,MAAM,6BAA6B,CAAC;;AA4B/E,MAAM,OAAO,yBAA0B,SAAQ,kBAAkB;IAU/D;QACE,KAAK,EAAE,CAAC;QAVO,qBAAgB,GAAG,MAAM,CAAC,gBAAgB,CAAC,CAAC;QAC5C,oBAAe,GAAG,MAAM,CAAC,eAAe,CAAC,CAAC;QAExC,gBAAW,GAAG,MAAM,CAA0B,SAAS,uDAAC,CAAC;QAEzD,kBAAa,GAAG,MAAM,CACvC,SAAS,yDACV,CAAC;QA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gBACT,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;gBAClC,KAAK,CAAC,eAAe,CAAC,CAAC;YACzB,CAAC;YACD,KAAK,EAAE,IAAI,CAAC,WAAW,CAAC,eAAe,CAAC,sBAAsB,CAAC;SAChE,CAAC,CAAC;IACP,CAAC;8GAzDU,yBAAyB;kGAAzB,yBAAyB,uEAPzB;YACT;gBACE,OAAO,EAAE,SAAS;gBAClB,QAAQ,EAAE,2BAA2B;aACtC;SACF,iDClDH,klJA+HA,4CDhGI,0BAA0B,mJAC1B,WAAW,+BACX,gCAAgC,uJAChC,OAAO,yLACP,OAAO,yFACP,cAAc,kGACd,QAAQ,6FACR,OAAO,0NACP,OAAO,2JACP,OAAO,gFACP,UAAU,8EACV,SAAS,oPACT,cAAc;;2FASL,yBAAyB;kBA1BrC,SAAS;+BACE,0BAA0B,mBAEnB,uBAAuB,CAAC,MAAM,WACtC;wBACP,0BAA0B;wBAC1B,WAAW;wBACX,gCAAgC;wBAChC,OAAO;wBACP,OAAO;wBACP,cAAc;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 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/standalone';\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,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,OAAO,EAAkB,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEpE,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAC1D,OAAO,EAAE,0BAA0B,EAAE,MAAM,sDAAsD,CAAC;AAClG,OAAO,EAAE,gCAAgC,EAAE,MAAM,6BAA6B,CAAC;;AA4B/E,MAAM,OAAO,yBAA0B,SAAQ,kBAAkB;IAU/D;QACE,KAAK,EAAE,CAAC;QAVO,qBAAgB,GAAG,MAAM,CAAC,gBAAgB,CAAC,CAAC;QAC5C,oBAAe,GAAG,MAAM,CAAC,eAAe,CAAC,CAAC;QAExC,gBAAW,GAAG,MAAM,CAA0B,SAAS;wFAAC,CAAC;QAEzD,kBAAa,GAAG,MAAM,CACvC,SAAS;0FACV,CAAC;QA2BiB,kBAAa,GAAG,MAAM,CA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C,GAAG,CAAC,SAAS,CAAC,CAAC;gBAClC,KAAK,CAAC,eAAe,CAAC,CAAC;YACzB,CAAC;YACD,KAAK,EAAE,IAAI,CAAC,WAAW,CAAC,eAAe,CAAC,sBAAsB,CAAC;SAChE,CAAC,CAAC;IACP,CAAC;8GAzDU,yBAAyB;kGAAzB,yBAAyB,uEAPzB;YACT;gBACE,OAAO,EAAE,SAAS;gBAClB,QAAQ,EAAE,2BAA2B;aACtC;SACF,iDClDH,klJA+HA,4CDhGI,0BAA0B,mJAC1B,WAAW,+BACX,gCAAgC,uJAChC,OAAO,yLACP,OAAO,yFACP,cAAc,kGACd,QAAQ,6FACR,OAAO,0NACP,OAAO,2JACP,OAAO,gFACP,UAAU,8EACV,SAAS,sRACT,cAAc;;2FASL,yBAAyB;kBA1BrC,SAAS;+BACE,0BAA0B,mBAEnB,uBAAuB,CAAC,MAAM,WACtC;wBACP,0BAA0B;wBAC1B,WAAW;wBACX,gCAAgC;wBAChC,OAAO;wBACP,OAAO;wBACP,cAAc;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 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,5 +1,5 @@
|
|
|
1
|
-
import { Component, EventEmitter, input, Output, signal, computed, inject, } from '@angular/core';
|
|
2
|
-
import { IonButton, IonButtons, IonIcon, IonItem, IonLabel, IonSpinner, } from '@ionic/angular
|
|
1
|
+
import { Component, EventEmitter, input, Output, signal, computed, inject, ChangeDetectionStrategy } from '@angular/core';
|
|
2
|
+
import { IonButton, IonButtons, IonIcon, IonItem, IonLabel, IonSpinner, } from '@ionic/angular';
|
|
3
3
|
import { SneatAuthStateService, } from '@sneat/auth-core';
|
|
4
4
|
import { ErrorLogger } from '@sneat/core';
|
|
5
5
|
import { Subject, takeUntil } from 'rxjs';
|
|
@@ -9,7 +9,8 @@ export class UserAuthAProviderStatusComponent {
|
|
|
9
9
|
this.errorLogger = inject(ErrorLogger);
|
|
10
10
|
this.authStateService = inject(SneatAuthStateService);
|
|
11
11
|
this.$destroyed = new Subject();
|
|
12
|
-
this.providerID = input.required(
|
|
12
|
+
this.providerID = input.required(/* @ts-ignore */
|
|
13
|
+
...(ngDevMode ? [{ debugName: "providerID" }] : /* istanbul ignore next */ []));
|
|
13
14
|
this.provider = computed(() => {
|
|
14
15
|
const id = this.providerID();
|
|
15
16
|
switch (id) {
|
|
@@ -51,20 +52,27 @@ export class UserAuthAProviderStatusComponent {
|
|
|
51
52
|
color: 'medium',
|
|
52
53
|
};
|
|
53
54
|
}
|
|
54
|
-
},
|
|
55
|
-
|
|
55
|
+
}, /* @ts-ignore */
|
|
56
|
+
...(ngDevMode ? [{ debugName: "provider" }] : /* istanbul ignore next */ []));
|
|
57
|
+
this.signingInWith = input.required(/* @ts-ignore */
|
|
58
|
+
...(ngDevMode ? [{ debugName: "signingInWith" }] : /* istanbul ignore next */ []));
|
|
56
59
|
this.signingInWithChange = new EventEmitter();
|
|
57
|
-
this.currentUser = signal(undefined,
|
|
58
|
-
|
|
60
|
+
this.currentUser = signal(undefined, /* @ts-ignore */
|
|
61
|
+
...(ngDevMode ? [{ debugName: "currentUser" }] : /* istanbul ignore next */ []));
|
|
62
|
+
this.isSigningIn = computed(() => this.signingInWith() === this.providerID(), /* @ts-ignore */
|
|
63
|
+
...(ngDevMode ? [{ debugName: "isSigningIn" }] : /* istanbul ignore next */ []));
|
|
59
64
|
this.isDisabled = computed(() => {
|
|
60
65
|
const signingInWith = this.signingInWith();
|
|
61
66
|
return !!signingInWith;
|
|
62
|
-
},
|
|
67
|
+
}, /* @ts-ignore */
|
|
68
|
+
...(ngDevMode ? [{ debugName: "isDisabled" }] : /* istanbul ignore next */ []));
|
|
63
69
|
this.authProviderUserInfo = computed(() => {
|
|
64
70
|
const providerID = this.providerID();
|
|
65
71
|
return this.currentUser()?.providerData?.find((pd) => pd.providerId == providerID);
|
|
66
|
-
},
|
|
67
|
-
|
|
72
|
+
}, /* @ts-ignore */
|
|
73
|
+
...(ngDevMode ? [{ debugName: "authProviderUserInfo" }] : /* istanbul ignore next */ []));
|
|
74
|
+
this.isConnected = computed(() => !!this.authProviderUserInfo(), /* @ts-ignore */
|
|
75
|
+
...(ngDevMode ? [{ debugName: "isConnected" }] : /* istanbul ignore next */ []));
|
|
68
76
|
this.authStateService.authUser
|
|
69
77
|
.pipe(takeUntil(this.$destroyed))
|
|
70
78
|
.subscribe((authUser) => {
|
|
@@ -106,12 +114,12 @@ export class UserAuthAProviderStatusComponent {
|
|
|
106
114
|
this.$destroyed.next();
|
|
107
115
|
this.$destroyed.complete();
|
|
108
116
|
}
|
|
109
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
110
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "
|
|
117
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: UserAuthAProviderStatusComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
118
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.3", type: UserAuthAProviderStatusComponent, isStandalone: true, selector: "sneat-user-auth-provider-status", inputs: { providerID: { classPropertyName: "providerID", publicName: "providerID", isSignal: true, isRequired: true, transformFunction: null }, signingInWith: { classPropertyName: "signingInWith", publicName: "signingInWith", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { signingInWithChange: "signingInWithChange" }, ngImport: i0, template: "<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", dependencies: [{ 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: IonLabel, selector: "ion-label", inputs: ["color", "mode", "position"] }, { kind: "component", type: IonButtons, selector: "ion-buttons", inputs: ["collapse"] }, { kind: "component", type: IonButton, selector: "ion-button", inputs: ["buttonType", "color", "disabled", "download", "expand", "fill", "form", "href", "mode", "rel", "routerAnimation", "routerDirection", "shape", "size", "strong", "target", "type"], outputs: ["ionFocus", "ionBlur"] }, { kind: "component", type: IonSpinner, selector: "ion-spinner", inputs: ["color", "duration", "name", "paused"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
111
119
|
}
|
|
112
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
120
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: UserAuthAProviderStatusComponent, decorators: [{
|
|
113
121
|
type: Component,
|
|
114
|
-
args: [{ selector: 'sneat-user-auth-provider-status', imports: [IonItem, IonIcon, IonLabel, IonButtons, IonButton, IonSpinner], template: "<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" }]
|
|
122
|
+
args: [{ selector: 'sneat-user-auth-provider-status', changeDetection: ChangeDetectionStrategy.OnPush, imports: [IonItem, IonIcon, IonLabel, IonButtons, IonButton, IonSpinner], template: "<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" }]
|
|
115
123
|
}], ctorParameters: () => [], propDecorators: { providerID: [{ type: i0.Input, args: [{ isSignal: true, alias: "providerID", required: true }] }], signingInWith: [{ type: i0.Input, args: [{ isSignal: true, alias: "signingInWith", required: true }] }], signingInWithChange: [{
|
|
116
124
|
type: Output
|
|
117
125
|
}] } });
|
|
@@ -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,
|
|
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;IA2D3C;QA1DiB,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,EAAE,GAAG,IAAI,CAAC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QAClB,MAAM,UAAU,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC;QACrC,IAAI,CAAC,UAAU,EAAE,CAAC;YAChB,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,4BAA4B,CAAC,CAAC;YACxD,OAAO;QACT,CAAC;QACD,IAAI,CAAC,gBAAgB;aAClB,kBAAkB,CAAC,UAAU,CAAC;aAC9B,IAAI,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;aACpD,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;YACb,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;YACzC,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;QACjC,CAAC,CAAC,CAAC;QACL,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IAC5C,CAAC;IAEM,WAAW;QAChB,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC;QACvB,IAAI,CAAC,UAAU,CAAC,QAAQ,EAAE,CAAC;IAC7B,CAAC;8GAzHU,gCAAgC;kGAAhC,gCAAgC,qbCnD7C,8zCA0CA,4CDOY,OAAO,0NAAE,OAAO,2JAAE,QAAQ,6FAAE,UAAU,8EAAE,SAAS,sRAAE,UAAU;;2FAE5D,gCAAgC;kBAN5C,SAAS;+BACE,iCAAiC,mBAE1B,uBAAuB,CAAC,MAAM,WACtC,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,CAAC;;sBAqDvE,MAAM","sourcesContent":["import {\n Component,\n EventEmitter,\n input,\n Output,\n signal,\n computed,\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 '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"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Component,
|
|
1
|
+
import { Component, inject, ChangeDetectionStrategy, input } from '@angular/core';
|
|
2
2
|
import { FormControl, FormGroup, FormsModule, ReactiveFormsModule, Validators, } from '@angular/forms';
|
|
3
|
-
import { IonButton, IonButtons, IonContent, IonFooter, IonHeader, IonIcon, IonInput, IonItem, IonItemDivider, IonLabel, IonTitle, IonToolbar, ModalController, } from '@ionic/angular
|
|
3
|
+
import { IonButton, IonButtons, IonContent, IonFooter, IonHeader, IonIcon, IonInput, IonItem, IonItemDivider, IonLabel, IonTitle, IonToolbar, ModalController, } from '@ionic/angular';
|
|
4
4
|
import { SneatUserService, UserRecordService, } from '@sneat/auth-core';
|
|
5
5
|
import { ClassName, SelectFromListComponent } from '@sneat/ui';
|
|
6
6
|
import { SneatBaseComponent } from '@sneat/ui';
|
|
@@ -13,7 +13,8 @@ export class UserRequiredFieldsModalComponent extends SneatBaseComponent {
|
|
|
13
13
|
this.modalController = inject(ModalController);
|
|
14
14
|
this.userRecordService = inject(UserRecordService);
|
|
15
15
|
this.sneatUserService = inject(SneatUserService);
|
|
16
|
-
this.space =
|
|
16
|
+
this.space = input.required(/* @ts-ignore */
|
|
17
|
+
...(ngDevMode ? [{ debugName: "space" }] : /* istanbul ignore next */ []));
|
|
17
18
|
this.genders = [
|
|
18
19
|
{ id: 'male', emoji: '♂️', title: 'Male' },
|
|
19
20
|
{ id: 'female', emoji: '♀️', title: 'Female' },
|
|
@@ -72,15 +73,15 @@ export class UserRequiredFieldsModalComponent extends SneatBaseComponent {
|
|
|
72
73
|
.dismiss(false)
|
|
73
74
|
.catch(this.errorLogger.logErrorHandler('Failed to close modal'));
|
|
74
75
|
}
|
|
75
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
76
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "
|
|
76
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: UserRequiredFieldsModalComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
77
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.3", type: UserRequiredFieldsModalComponent, isStandalone: true, selector: "sneat-user-required-fields-form", inputs: { space: { classPropertyName: "space", publicName: "space", isSignal: true, isRequired: true, transformFunction: null } }, providers: [
|
|
77
78
|
{
|
|
78
79
|
provide: ClassName,
|
|
79
80
|
useValue: 'UserRequiredFieldsModalComponent',
|
|
80
81
|
},
|
|
81
|
-
], usesInheritance: true, ngImport: i0, template: "<ion-header>\n <ion-toolbar color=\"primary\">\n <ion-title>About me</ion-title>\n <ion-buttons slot=\"end\">\n <ion-button (click)=\"close()\">\n <ion-icon name=\"close-outline\" />\n </ion-button>\n </ion-buttons>\n </ion-toolbar>\n</ion-header>\n<ion-content>\n <form (ngSubmit)=\"save()\" [formGroup]=\"form\">\n <ion-item>\n <ion-input\n label=\"First name\"\n name=\"first_name\"\n type=\"text\"\n required\n max=\"20\"\n [formControl]=\"firstName\"\n />\n </ion-item>\n <ion-item>\n <ion-input\n label=\"Last name\"\n name=\"last_name\"\n type=\"text\"\n required\n max=\"20\"\n [formControl]=\"lastName\"\n />\n </ion-item>\n @if (!gender.value) {\n <ion-item-divider>\n <ion-label>Gender</ion-label>\n </ion-item-divider>\n }\n <sneat-select-from-list\n label=\"Gender\"\n [items]=\"genders\"\n [formControl]=\"gender\"\n />\n\n @if (gender.value || ageGroup.value) {\n @if (!ageGroup.value) {\n <ion-item-divider>\n <ion-label>Age group</ion-label>\n </ion-item-divider>\n }\n <sneat-select-from-list\n label=\"Age group\"\n [items]=\"ageGroups\"\n [formControl]=\"ageGroup\"\n />\n }\n </form>\n</ion-content>\n<ion-footer>\n <ion-toolbar>\n <ion-buttons slot=\"end\">\n <ion-button [disabled]=\"submitting\" (click)=\"save()\">Save</ion-button>\n </ion-buttons>\n </ion-toolbar>\n</ion-footer>\n", dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],[formArray],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "component", type: SelectFromListComponent, selector: "sneat-select-from-list", inputs: ["value", "filterLabel", "label", "listLabel", "listLabelColor", "isFilterable", "isLoading", "items", "items$", "lastItemLines", "labelPlacement", "justify", "other", "canAdd", "filterItem", "selectMode", "isReadonly", "$isProcessing", "sortBy"], outputs: ["valueChange", "filterChanged"] }, { kind: "component", type: IonHeader, selector: "ion-header", inputs: ["collapse", "mode", "translucent"] }, { kind: "component", type: IonToolbar, selector: "ion-toolbar", inputs: ["color", "mode"] }, { kind: "component", type: IonTitle, selector: "ion-title", inputs: ["color", "size"] }, { 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"] }, { kind: "component", type: IonIcon, selector: "ion-icon", inputs: ["color", "flipRtl", "icon", "ios", "lazy", "md", "mode", "name", "sanitize", "size", "src"] }, { kind: "component", type: IonContent, selector: "ion-content", inputs: ["color", "fixedSlotPlacement", "forceOverscroll", "fullscreen", "scrollEvents", "scrollX", "scrollY"] }, { 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: IonInput, selector: "ion-input", inputs: ["accept", "autocapitalize", "autocomplete", "autocorrect", "autofocus", "clearInput", "clearOnEdit", "color", "counter", "counterFormatter", "debounce", "disabled", "enterkeyhint", "errorText", "fill", "helperText", "inputmode", "label", "labelPlacement", "max", "maxlength", "min", "minlength", "mode", "multiple", "name", "pattern", "placeholder", "readonly", "required", "shape", "size", "spellcheck", "step", "type", "value"] }, { 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: IonFooter, selector: "ion-footer", inputs: ["collapse", "mode", "translucent"] }] }); }
|
|
82
|
+
], usesInheritance: true, ngImport: i0, template: "<ion-header>\n <ion-toolbar color=\"primary\">\n <ion-title>About me</ion-title>\n <ion-buttons slot=\"end\">\n <ion-button (click)=\"close()\">\n <ion-icon name=\"close-outline\" />\n </ion-button>\n </ion-buttons>\n </ion-toolbar>\n</ion-header>\n<ion-content>\n <form (ngSubmit)=\"save()\" [formGroup]=\"form\">\n <ion-item>\n <ion-input\n label=\"First name\"\n name=\"first_name\"\n type=\"text\"\n required\n max=\"20\"\n [formControl]=\"firstName\"\n />\n </ion-item>\n <ion-item>\n <ion-input\n label=\"Last name\"\n name=\"last_name\"\n type=\"text\"\n required\n max=\"20\"\n [formControl]=\"lastName\"\n />\n </ion-item>\n @if (!gender.value) {\n <ion-item-divider>\n <ion-label>Gender</ion-label>\n </ion-item-divider>\n }\n <sneat-select-from-list\n label=\"Gender\"\n [items]=\"genders\"\n [formControl]=\"gender\"\n />\n\n @if (gender.value || ageGroup.value) {\n @if (!ageGroup.value) {\n <ion-item-divider>\n <ion-label>Age group</ion-label>\n </ion-item-divider>\n }\n <sneat-select-from-list\n label=\"Age group\"\n [items]=\"ageGroups\"\n [formControl]=\"ageGroup\"\n />\n }\n </form>\n</ion-content>\n<ion-footer>\n <ion-toolbar>\n <ion-buttons slot=\"end\">\n <ion-button [disabled]=\"submitting\" (click)=\"save()\">Save</ion-button>\n </ion-buttons>\n </ion-toolbar>\n</ion-footer>\n", dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],[formArray],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "component", type: SelectFromListComponent, selector: "sneat-select-from-list", inputs: ["value", "filterLabel", "label", "listLabel", "listLabelColor", "isFilterable", "isLoading", "items", "items$", "lastItemLines", "labelPlacement", "justify", "other", "canAdd", "filterItem", "selectMode", "isReadonly", "$isProcessing", "sortBy"], outputs: ["valueChange", "filterChanged"] }, { kind: "component", type: IonHeader, selector: "ion-header", inputs: ["collapse", "mode", "translucent"] }, { kind: "component", type: IonToolbar, selector: "ion-toolbar", inputs: ["color", "mode"] }, { kind: "component", type: IonTitle, selector: "ion-title", inputs: ["color", "size"] }, { 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: IonIcon, selector: "ion-icon", inputs: ["color", "flipRtl", "icon", "ios", "lazy", "md", "mode", "name", "sanitize", "size", "src"] }, { kind: "component", type: IonContent, selector: "ion-content", inputs: ["color", "fixedSlotPlacement", "forceOverscroll", "fullscreen", "scrollEvents", "scrollX", "scrollY"], outputs: ["ionScrollStart", "ionScroll", "ionScrollEnd"] }, { 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: IonInput, selector: "ion-input", inputs: ["accept", "autocapitalize", "autocomplete", "autocorrect", "autofocus", "clearInput", "clearOnEdit", "color", "counter", "counterFormatter", "debounce", "disabled", "enterkeyhint", "errorText", "fill", "helperText", "inputmode", "label", "labelPlacement", "max", "maxlength", "min", "minlength", "mode", "multiple", "name", "pattern", "placeholder", "readonly", "required", "shape", "size", "spellcheck", "step", "type", "value"] }, { 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: IonFooter, selector: "ion-footer", inputs: ["collapse", "mode", "translucent"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
82
83
|
}
|
|
83
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
84
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: UserRequiredFieldsModalComponent, decorators: [{
|
|
84
85
|
type: Component,
|
|
85
86
|
args: [{ selector: 'sneat-user-required-fields-form', imports: [
|
|
86
87
|
FormsModule,
|
|
@@ -98,14 +99,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.0", ngImpor
|
|
|
98
99
|
IonItemDivider,
|
|
99
100
|
IonLabel,
|
|
100
101
|
IonFooter,
|
|
101
|
-
], providers: [
|
|
102
|
+
], changeDetection: ChangeDetectionStrategy.OnPush, providers: [
|
|
102
103
|
{
|
|
103
104
|
provide: ClassName,
|
|
104
105
|
useValue: 'UserRequiredFieldsModalComponent',
|
|
105
106
|
},
|
|
106
107
|
], template: "<ion-header>\n <ion-toolbar color=\"primary\">\n <ion-title>About me</ion-title>\n <ion-buttons slot=\"end\">\n <ion-button (click)=\"close()\">\n <ion-icon name=\"close-outline\" />\n </ion-button>\n </ion-buttons>\n </ion-toolbar>\n</ion-header>\n<ion-content>\n <form (ngSubmit)=\"save()\" [formGroup]=\"form\">\n <ion-item>\n <ion-input\n label=\"First name\"\n name=\"first_name\"\n type=\"text\"\n required\n max=\"20\"\n [formControl]=\"firstName\"\n />\n </ion-item>\n <ion-item>\n <ion-input\n label=\"Last name\"\n name=\"last_name\"\n type=\"text\"\n required\n max=\"20\"\n [formControl]=\"lastName\"\n />\n </ion-item>\n @if (!gender.value) {\n <ion-item-divider>\n <ion-label>Gender</ion-label>\n </ion-item-divider>\n }\n <sneat-select-from-list\n label=\"Gender\"\n [items]=\"genders\"\n [formControl]=\"gender\"\n />\n\n @if (gender.value || ageGroup.value) {\n @if (!ageGroup.value) {\n <ion-item-divider>\n <ion-label>Age group</ion-label>\n </ion-item-divider>\n }\n <sneat-select-from-list\n label=\"Age group\"\n [items]=\"ageGroups\"\n [formControl]=\"ageGroup\"\n />\n }\n </form>\n</ion-content>\n<ion-footer>\n <ion-toolbar>\n <ion-buttons slot=\"end\">\n <ion-button [disabled]=\"submitting\" (click)=\"save()\">Save</ion-button>\n </ion-buttons>\n </ion-toolbar>\n</ion-footer>\n" }]
|
|
107
|
-
}], ctorParameters: () => [], propDecorators: { space: [{
|
|
108
|
-
type: Input,
|
|
109
|
-
args: [{ required: true }]
|
|
110
|
-
}] } });
|
|
108
|
+
}], ctorParameters: () => [], propDecorators: { space: [{ type: i0.Input, args: [{ isSignal: true, alias: "space", required: true }] }] } });
|
|
111
109
|
//# sourceMappingURL=user-required-fields-modal.component.js.map
|
package/esm2022/lib/components/user-required-fields/user-required-fields-modal.component.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user-required-fields-modal.component.js","sourceRoot":"","sources":["../../../../../../../../libs/auth/ui/src/lib/components/user-required-fields/user-required-fields-modal.component.ts","../../../../../../../../libs/auth/ui/src/lib/components/user-required-fields/user-required-fields-modal.component.html"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,
|
|
1
|
+
{"version":3,"file":"user-required-fields-modal.component.js","sourceRoot":"","sources":["../../../../../../../../libs/auth/ui/src/lib/components/user-required-fields/user-required-fields-modal.component.ts","../../../../../../../../libs/auth/ui/src/lib/components/user-required-fields/user-required-fields-modal.component.html"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,uBAAuB,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAClF,OAAO,EACL,WAAW,EACX,SAAS,EACT,WAAW,EACX,mBAAmB,EACnB,UAAU,GACX,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,SAAS,EACT,UAAU,EACV,UAAU,EACV,SAAS,EACT,SAAS,EACT,OAAO,EACP,QAAQ,EACR,OAAO,EACP,cAAc,EACd,QAAQ,EACR,QAAQ,EACR,UAAU,EACV,eAAe,GAChB,MAAM,gBAAgB,CAAC;AACxB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AM,aACpC;wBACT;4BACE,OAAO,EAAE,SAAS;4BAClB,QAAQ,EAAE,kCAAkC;yBAC7C;qBACF","sourcesContent":["import { Component, inject, ChangeDetectionStrategy, input } from '@angular/core';\nimport {\n FormControl,\n FormGroup,\n FormsModule,\n ReactiveFormsModule,\n Validators,\n} from '@angular/forms';\nimport {\n IonButton,\n IonButtons,\n IonContent,\n IonFooter,\n IonHeader,\n IonIcon,\n IonInput,\n IonItem,\n IonItemDivider,\n IonLabel,\n IonTitle,\n IonToolbar,\n ModalController,\n} from '@ionic/angular';\nimport {\n IInitUserRecordRequest,\n ISneatUserState,\n SneatUserService,\n UserRecordService,\n} from '@sneat/auth-core';\nimport { AgeGroupID, Gender } from '@sneat/core';\nimport { ClassName, ISelectItem, SelectFromListComponent } from '@sneat/ui';\nimport { ISpaceContext } from '@sneat/space-models';\nimport { SneatBaseComponent } from '@sneat/ui';\nimport { takeUntil } from 'rxjs';\n\n@Component({\n selector: 'sneat-user-required-fields-form',\n templateUrl: './user-required-fields-modal.component.html',\n imports: [\n FormsModule,\n ReactiveFormsModule,\n SelectFromListComponent,\n IonHeader,\n IonToolbar,\n IonTitle,\n IonButtons,\n IonButton,\n IonIcon,\n IonContent,\n IonItem,\n IonInput,\n IonItemDivider,\n IonLabel,\n IonFooter,\n ],\n changeDetection: ChangeDetectionStrategy.OnPush,\n providers: [\n {\n provide: ClassName,\n useValue: 'UserRequiredFieldsModalComponent',\n },\n ],\n})\nexport class UserRequiredFieldsModalComponent extends SneatBaseComponent {\n private readonly modalController = inject(ModalController);\n private readonly userRecordService = inject(UserRecordService);\n private readonly sneatUserService = inject(SneatUserService);\n\n readonly space = input.required<ISpaceContext>();\n\n protected readonly genders: ISelectItem[] = [\n { id: 'male', emoji: '♂️', title: 'Male' },\n { id: 'female', emoji: '♀️', title: 'Female' },\n { id: 'other', emoji: '⚥', title: 'Other' },\n { id: 'undisclosed', iconName: 'body', title: 'Undisclosed' },\n ];\n\n protected readonly ageGroups: ISelectItem[] = [\n { id: 'adult', emoji: '🧓', title: 'Adult' },\n { id: 'child', emoji: '🧒', title: 'Child' },\n ];\n\n protected readonly firstName = new FormControl('', Validators.required);\n protected readonly lastName = new FormControl('', Validators.required);\n protected readonly gender = new FormControl('', Validators.required);\n protected readonly ageGroup = new FormControl('', Validators.required);\n\n protected readonly form = new FormGroup({\n firstName: this.firstName,\n lastName: this.lastName,\n gender: this.gender,\n ageGroup: this.ageGroup,\n });\n\n protected submitting = false;\n\n protected userState?: ISneatUserState;\n\n constructor() {\n super();\n this.sneatUserService.userState.pipe(takeUntil(this.destroyed$)).subscribe({\n next: (userState) => (this.userState = userState),\n });\n }\n\n protected save(): void {\n this.submitting = true;\n if (!this.form.valid) {\n setTimeout(() => {\n alert('Please fill in all fields.');\n this.submitting = false;\n });\n return;\n }\n\n const gender = this.gender.value as Gender;\n const ageGroup = this.ageGroup.value as AgeGroupID;\n\n const request: IInitUserRecordRequest = {\n names: {\n firstName: this.firstName.value || undefined,\n lastName: this.lastName.value || undefined,\n },\n gender,\n ageGroup,\n };\n this.userRecordService.initUserRecord(request).subscribe({\n next: () => this.modalController.dismiss(true).catch(console.error),\n error: (err) => {\n this.errorLogger.logError('Failed to init user record:', err);\n alert('Failed to init user record');\n this.submitting = false;\n },\n });\n }\n\n protected close(): void {\n this.modalController\n .dismiss(false)\n .catch(this.errorLogger.logErrorHandler('Failed to close modal'));\n }\n}\n","<ion-header>\n <ion-toolbar color=\"primary\">\n <ion-title>About me</ion-title>\n <ion-buttons slot=\"end\">\n <ion-button (click)=\"close()\">\n <ion-icon name=\"close-outline\" />\n </ion-button>\n </ion-buttons>\n </ion-toolbar>\n</ion-header>\n<ion-content>\n <form (ngSubmit)=\"save()\" [formGroup]=\"form\">\n <ion-item>\n <ion-input\n label=\"First name\"\n name=\"first_name\"\n type=\"text\"\n required\n max=\"20\"\n [formControl]=\"firstName\"\n />\n </ion-item>\n <ion-item>\n <ion-input\n label=\"Last name\"\n name=\"last_name\"\n type=\"text\"\n required\n max=\"20\"\n [formControl]=\"lastName\"\n />\n </ion-item>\n @if (!gender.value) {\n <ion-item-divider>\n <ion-label>Gender</ion-label>\n </ion-item-divider>\n }\n <sneat-select-from-list\n label=\"Gender\"\n [items]=\"genders\"\n [formControl]=\"gender\"\n />\n\n @if (gender.value || ageGroup.value) {\n @if (!ageGroup.value) {\n <ion-item-divider>\n <ion-label>Age group</ion-label>\n </ion-item-divider>\n }\n <sneat-select-from-list\n label=\"Age group\"\n [items]=\"ageGroups\"\n [formControl]=\"ageGroup\"\n />\n }\n </form>\n</ion-content>\n<ion-footer>\n <ion-toolbar>\n <ion-buttons slot=\"end\">\n <ion-button [disabled]=\"submitting\" (click)=\"save()\">Save</ion-button>\n </ion-buttons>\n </ion-toolbar>\n</ion-footer>\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Injectable, inject } from '@angular/core';
|
|
2
|
-
import { ModalController } from '@ionic/angular
|
|
2
|
+
import { ModalController } from '@ionic/angular';
|
|
3
3
|
import { UserRequiredFieldsModalComponent } from './user-required-fields-modal.component';
|
|
4
4
|
import * as i0 from "@angular/core";
|
|
5
5
|
// providedIn:'root' so every consumer resolves it without a local provider.
|
|
@@ -24,10 +24,10 @@ export class UserRequiredFieldsService {
|
|
|
24
24
|
.catch(reject);
|
|
25
25
|
});
|
|
26
26
|
}
|
|
27
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
28
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
27
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: UserRequiredFieldsService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
28
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: UserRequiredFieldsService, providedIn: 'root' }); }
|
|
29
29
|
}
|
|
30
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
30
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: UserRequiredFieldsService, decorators: [{
|
|
31
31
|
type: Injectable,
|
|
32
32
|
args: [{ providedIn: 'root' }]
|
|
33
33
|
}] });
|