@sneat/auth-ui 0.27.31 → 0.27.33

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"login-page.component.js","sourceRoot":"","sources":["../../../../../../../../libs/auth/ui/src/lib/pages/login-page/login-page.component.ts","../../../../../../../../libs/auth/ui/src/lib/pages/login-page/login-page.component.html"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AACrF,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EACL,aAAa,EACb,aAAa,EACb,SAAS,EACT,UAAU,EACV,OAAO,EACP,cAAc,EACd,UAAU,EACV,SAAS,EACT,UAAU,EACV,OAAO,EACP,QAAQ,EACR,UAAU,GACX,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAEL,kBAAkB,EAClB,qBAAqB,EACrB,gBAAgB,EAChB,mBAAmB,GACpB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,gBAAgB,EAChB,QAAQ,EACR,iBAAiB,EACjB,gBAAgB,EAGhB,gBAAgB,EAChB,eAAe,GAChB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AACzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;;AA8B7D,MAAM,OAAO,kBAAmB,SAAQ,kBAAkB;IAwDxD;QACE,KAAK,EAAE,CAAC;QAxDO,qBAAgB,G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AU,mFACV,SAAS,sRACT,UAAU,8EACV,aAAa,4DACb,QAAQ,iFACR,UAAU,kOACV,cAAc,+EACd,OAAO,gFACP,OAAO,yLACP,UAAU;;2FAWD,kBAAkB;kBA1B9B,SAAS;+BACE,aAAa,WAEd;wBACP,kBAAkB;wBAClB,SAAS;wBACT,UAAU;wBACV,SAAS;wBACT,UAAU;wBACV,aAAa;wBACb,QAAQ;wBACR,UAAU;wBACV,cAAc;wBACd,OAAO;wBACP,OAAO;wBACP,UAAU;qBACX,mBACgB,uBAAuB,CAAC,MAAM,aACpC;wBACT;4BACE,OAAO,EAAE,SAAS;4BAClB,QAAQ,EAAE,oBAAoB;yBAC/B;wBACD,eAAe;qBAChB","sourcesContent":["import { Component, computed, inject, ChangeDetectionStrategy } from '@angular/core';\nimport { toSignal } from '@angular/core/rxjs-interop';\nimport { ActivatedRoute } from '@angular/router';\nimport {\n NavController,\n IonBackButton,\n IonButton,\n IonButtons,\n IonCard,\n IonCardContent,\n IonContent,\n IonHeader,\n IonSpinner,\n IonText,\n IonTitle,\n IonToolbar,\n} from '@ionic/angular';\nimport {\n ILoginEventsHandler,\n LoginEventsHandler,\n SneatAuthStateService,\n SneatUserService,\n isSneatAccountReady,\n} from '@sneat/auth-core';\nimport {\n AnalyticsService,\n APP_INFO,\n clearCurrentSpace,\n currentSpacePath,\n IAnalyticsService,\n IAppInfo,\n readCurrentSpace,\n SpaceTypeFamily,\n} from '@sneat/core';\nimport { RandomIdService } from '@sneat/random';\nimport { ClassName, SneatBaseComponent } from '@sneat/ui';\nimport { combineLatest, Subject, takeUntil } from 'rxjs';\nimport { AuthPanelComponent } from './auth-panel.component';\nimport { safeAuthReturnPath } from './safe-auth-return-path';\n\ntype Action = 'join' | 'refuse'; // TODO: inject provider for action descriptions/messages.\n\n@Component({\n selector: 'sneat-login',\n templateUrl: './login-page.component.html',\n imports: [\n AuthPanelComponent,\n IonHeader,\n IonToolbar,\n IonButton,\n IonButtons,\n IonBackButton,\n IonTitle,\n IonContent,\n IonCardContent,\n IonText,\n IonCard,\n IonSpinner,\n ],\n changeDetection: ChangeDetectionStrategy.OnPush,\n providers: [\n {\n provide: ClassName,\n useValue: 'LoginPageComponent',\n },\n RandomIdService,\n ],\n})\nexport class LoginPageComponent extends SneatBaseComponent {\n private readonly analyticsService =\n inject<IAnalyticsService>(AnalyticsService);\n private readonly route = inject(ActivatedRoute);\n private readonly navController = inject(NavController);\n private readonly userService = inject(SneatUserService);\n private readonly authStateService = inject(SneatAuthStateService);\n private appInfo = inject<IAppInfo>(APP_INFO);\n private readonly loginEventsHandler = inject<ILoginEventsHandler>(\n LoginEventsHandler,\n { optional: true },\n );\n\n protected readonly redirectTo?: string;\n protected readonly to?: string;\n // Free-text explanation of WHY sign-in is needed, passed by the calling page\n // as query params (rendered as escaped text — never as HTML):\n // reason — short heading, e.g. \"Sign in to create a new game\"\n // reasonDetail — optional sub-heading / one-line elaboration\n protected readonly reason?: string;\n protected readonly reasonDetail?: string;\n protected readonly action?: Action; // TODO: document possible values?\n\n protected readonly appTitle: string;\n\n // Surfaces the Firebase auth state on the login page itself: if the user is\n // already signed in (e.g. the app failed to navigate them onward) we show a\n // \"you are already signed in as X\" panel instead of the sign-in form, so an\n // authenticated-but-stuck state is obvious rather than looking like sign-in\n // is broken.\n protected readonly isAuthenticated = computed(\n () =>\n this.authState()?.status === 'authenticated' &&\n !!this.authState()?.user?.uid &&\n !this.authState()?.user?.isAnonymous,\n );\n // While Firebase is still resolving the session — the initial state, and the\n // brief window right after a signInWithRedirect return — show a \"signing you\n // in\" spinner instead of flashing the sign-in form before we navigate onward.\n protected readonly isAuthenticating = computed(\n () =>\n this.authState()?.status === 'authenticating' &&\n this.authState()?.loadingPhase !== 'failed',\n );\n private readonly authState = toSignal(this.authStateService.authState);\n private readonly userState = toSignal(this.userService.userState);\n protected readonly isAccountReady = computed(() => {\n const userState = this.userState();\n const authState = this.authState();\n return isSneatAccountReady(authState, userState);\n });\n protected readonly signedInAs = computed(() => {\n const u = this.authState()?.user;\n return u?.displayName || u?.email || u?.uid || '';\n });\n\n constructor() {\n super();\n const appInfo = this.appInfo;\n this.appTitle = appInfo.appTitle || 'Sneat.app';\n if (location.hash.startsWith('#/')) {\n this.redirectTo = safeAuthReturnPath(location.hash.substring(1));\n }\n this.to = this.route.snapshot.queryParams['to']; // should we subscribe? I believe no.\n this.reason = this.route.snapshot.queryParams['reason'];\n this.reasonDetail = this.route.snapshot.queryParams['reasonDetail'];\n const action = location.hash.match(/[#&]action=(\\w+)/);\n this.action = action?.[1] as Action;\n\n const userRecordLoaded = new Subject<void>();\n combineLatest([this.authStateService.authState, this.userService.userState])\n .pipe(takeUntil(userRecordLoaded), this.takeUntilDestroyed())\n .subscribe({\n next: ([authState, userState]) => {\n const userRecord = userState.record;\n if (!userRecord || !isSneatAccountReady(authState, userState)) return;\n userRecordLoaded.next();\n // Fall back to the persisted current space so it is restored after login,\n // but only if the user actually has access to it.\n const space = readCurrentSpace();\n const hasAccess = !!space && (\n userRecord.spaceIDs?.includes(space.id) ||\n (!!userRecord.spaces && space.id in userRecord.spaces)\n );\n if (space && !hasAccess) {\n clearCurrentSpace();\n }\n const activePath = hasAccess ? currentSpacePath() : undefined;\n const family = Object.entries(userRecord.spaces || {}).find(\n ([, brief]) => brief.type === SpaceTypeFamily,\n );\n const familyPath = family\n ? `/space/${SpaceTypeFamily}/${family[0]}`\n : undefined;\n const redirectTo = this.redirectTo || activePath || familyPath || '/';\n this.navController\n .navigateRoot(redirectTo)\n .catch((err) => {\n this.errorLogger.logError(\n err,\n 'Failed to navigate back to ' + redirectTo,\n );\n });\n },\n error: this.errorHandler('Failed to get user state after login'),\n });\n }\n\n // Proceed into the app from the \"already signed in\" panel.\n protected continueToApp(): void {\n if (!this.isAccountReady()) return;\n const space = readCurrentSpace();\n const userState = this.userState();\n const hasAccess = !!space && !!userState?.record && (\n userState.record.spaceIDs?.includes(space.id) ||\n (!!userState.record.spaces && space.id in userState.record.spaces)\n );\n if (space && !hasAccess) {\n clearCurrentSpace();\n }\n const activePath = hasAccess ? currentSpacePath() : undefined;\n const family = Object.entries(userState?.record?.spaces || {}).find(\n ([, brief]) => brief.type === SpaceTypeFamily,\n );\n const familyPath = family\n ? `/space/${SpaceTypeFamily}/${family[0]}`\n : undefined;\n const redirectTo = this.redirectTo || activePath || familyPath || '/';\n this.navController\n .navigateRoot(redirectTo)\n .catch((err) => {\n this.errorLogger.logError(\n err,\n 'Failed to navigate to ' + redirectTo,\n );\n });\n }\n\n // Sign out so the sign-in form is shown again (e.g. to log in as someone else).\n protected reLogin(): void {\n clearCurrentSpace();\n this.authStateService\n .signOut()\n .catch(this.errorLogger.logErrorHandler('Failed to sign out for re-login'));\n }\n\n private errorHandler(\n m: string,\n eventName?: string,\n eventParams?: Record<string, string>,\n ): (err: unknown) => void {\n return (err) => this.handleError(err, m, eventName, eventParams);\n }\n\n private handleError(\n err: unknown,\n m: string,\n eventName?: string,\n eventParams?: Record<string, string>,\n ): void {\n if (eventName) {\n this.analyticsService.logEvent(eventName, eventParams);\n }\n this.errorLogger.logError(err, m, {\n report: !(err as { code: unknown }).code,\n });\n }\n}\n","<ion-header>\n <ion-toolbar color=\"light\">\n <ion-buttons slot=\"start\">\n <ion-back-button />\n </ion-buttons>\n <ion-title>Login &#64; {{ appTitle }}</ion-title>\n </ion-toolbar>\n</ion-header>\n\n<ion-content id=\"main-content\">\n @if (reason) {\n <ion-card color=\"tertiary\">\n <ion-card-content>\n <h2 class=\"reason-title\">{{ reason }}</h2>\n @if (reasonDetail) {\n <p class=\"reason-detail\">{{ reasonDetail }}</p>\n }\n </ion-card-content>\n </ion-card>\n } @else if (to) {\n <ion-card color=\"tertiary\">\n <ion-card-content>\n <p>Please sign in to join a team</p>\n </ion-card-content>\n </ion-card>\n }\n\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 @if (isAuthenticating()) {\n <ion-card>\n <ion-card-content class=\"ion-text-center ion-padding\">\n <ion-spinner name=\"lines\" />\n <p class=\"ion-no-margin ion-padding-top\">Signing you in…</p>\n </ion-card-content>\n </ion-card>\n } @else if (isAuthenticated()) {\n <ion-card color=\"success\">\n <ion-card-content>\n <p>\n @if (signedInAs()) {\n You are already signed in as <strong>{{ signedInAs() }}</strong>.\n } @else {\n You are already signed in.\n }\n </p>\n @if (isAccountReady()) {\n <ion-button expand=\"block\" (click)=\"continueToApp()\">Continue</ion-button>\n } @else {\n <sneat-auth-panel\n [returnTo]=\"redirectTo\"\n [showIntro]=\"false\"\n [showCredentials]=\"false\"\n />\n }\n <ion-button\n expand=\"block\"\n fill=\"outline\"\n color=\"medium\"\n (click)=\"reLogin()\"\n >\n Re-login as someone else\n </ion-button>\n </ion-card-content>\n </ion-card>\n } @else {\n <sneat-auth-panel [returnTo]=\"redirectTo\" [showIntro]=\"false\" />\n }\n\n <p style=\"text-align: center; font-size: smaller\">\n <ion-text color=\"medium\">\n If any issues get\n <a href=\"mailto:help@sneat.app?subject=Problem+with+login+at+Sneat.app\"\n >help&#64;sneat.app</a\n >\n </ion-text>\n </p>\n</ion-content>\n"]}
1
+ {"version":3,"file":"login-page.component.js","sourceRoot":"","sources":["../../../../../../../../libs/auth/ui/src/lib/pages/login-page/login-page.component.ts","../../../../../../../../libs/auth/ui/src/lib/pages/login-page/login-page.component.html"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AACrF,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EACL,aAAa,EACb,aAAa,EACb,SAAS,EACT,UAAU,EACV,OAAO,EACP,cAAc,EACd,UAAU,EACV,SAAS,EACT,UAAU,EACV,OAAO,EACP,QAAQ,EACR,UAAU,GACX,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAEL,kBAAkB,EACl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W,CAAC,GAAG,EAAE,CAAC,EAAE,SAAS,EAAE,WAAW,CAAC,CAAC;IACnE,CAAC;IAEO,WAAW,CACjB,GAAY,EACZ,CAAS,EACT,SAAkB,EAClB,WAAoC;QAEpC,IAAI,SAAS,EAAE,CAAC;YACd,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;QACzD,CAAC;QACD,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,GAAG,EAAE,CAAC,EAAE;YAChC,MAAM,EAAE,CAAE,GAAyB,CAAC,IAAI;SACzC,CAAC,CAAC;IACL,CAAC;8GAtKU,kBAAkB;kGAAlB,kBAAkB,0DARlB;YACT;gBACE,OAAO,EAAE,SAAS;gBAClB,QAAQ,EAAE,oBAAoB;aAC/B;YACD,eAAe;SAChB,iDClEH,i0EAgFA,4CDlCI,kBAAkB,mKAClB,SAAS,oGACT,UAAU,mFACV,SAAS,sRACT,UAAU,8EACV,aAAa,4DACb,QAAQ,iFACR,UAAU,kOACV,cAAc,+EACd,OAAO,gFACP,OAAO,yLACP,UAAU;;2FAWD,kBAAkB;kBA1B9B,SAAS;+BACE,aAAa,WAEd;wBACP,kBAAkB;wBAClB,SAAS;wBACT,UAAU;wBACV,SAAS;wBACT,UAAU;wBACV,aAAa;wBACb,QAAQ;wBACR,UAAU;wBACV,cAAc;wBACd,OAAO;wBACP,OAAO;wBACP,UAAU;qBACX,mBACgB,uBAAuB,CAAC,MAAM,aACpC;wBACT;4BACE,OAAO,EAAE,SAAS;4BAClB,QAAQ,EAAE,oBAAoB;yBAC/B;wBACD,eAAe;qBAChB","sourcesContent":["import { Component, computed, inject, ChangeDetectionStrategy } from '@angular/core';\nimport { toSignal } from '@angular/core/rxjs-interop';\nimport { ActivatedRoute } from '@angular/router';\nimport {\n NavController,\n IonBackButton,\n IonButton,\n IonButtons,\n IonCard,\n IonCardContent,\n IonContent,\n IonHeader,\n IonSpinner,\n IonText,\n IonTitle,\n IonToolbar,\n} from '@ionic/angular';\nimport {\n ILoginEventsHandler,\n LoginEventsHandler,\n SneatAuthStateService,\n SneatUserService,\n isSneatAccountReady,\n} from '@sneat/auth-core';\nimport {\n AnalyticsService,\n APP_INFO,\n clearCurrentSpace,\n currentSpacePath,\n IAnalyticsService,\n IAppInfo,\n readCurrentSpace,\n SpaceTypeFamily,\n} from '@sneat/core';\nimport { RandomIdService } from '@sneat/random';\nimport { ClassName, SneatBaseComponent } from '@sneat/ui';\nimport { combineLatest, Subject, takeUntil } from 'rxjs';\nimport { AuthPanelComponent } from './auth-panel.component';\nimport { safeAuthReturnPath } from './safe-auth-return-path';\n\ntype Action = 'join' | 'refuse'; // TODO: inject provider for action descriptions/messages.\n\n@Component({\n selector: 'sneat-login',\n templateUrl: './login-page.component.html',\n imports: [\n AuthPanelComponent,\n IonHeader,\n IonToolbar,\n IonButton,\n IonButtons,\n IonBackButton,\n IonTitle,\n IonContent,\n IonCardContent,\n IonText,\n IonCard,\n IonSpinner,\n ],\n changeDetection: ChangeDetectionStrategy.OnPush,\n providers: [\n {\n provide: ClassName,\n useValue: 'LoginPageComponent',\n },\n RandomIdService,\n ],\n})\nexport class LoginPageComponent extends SneatBaseComponent {\n private readonly analyticsService =\n inject<IAnalyticsService>(AnalyticsService);\n private readonly route = inject(ActivatedRoute);\n private readonly navController = inject(NavController);\n private readonly userService = inject(SneatUserService);\n private readonly authStateService = inject(SneatAuthStateService);\n private appInfo = inject<IAppInfo>(APP_INFO);\n private readonly loginEventsHandler = inject<ILoginEventsHandler>(\n LoginEventsHandler,\n { optional: true },\n );\n\n protected readonly redirectTo?: string;\n protected readonly to?: string;\n // Free-text explanation of WHY sign-in is needed, passed by the calling page\n // as query params (rendered as escaped text — never as HTML):\n // reason — short heading, e.g. \"Sign in to create a new game\"\n // reasonDetail — optional sub-heading / one-line elaboration\n protected readonly reason?: string;\n protected readonly reasonDetail?: string;\n protected readonly action?: Action; // TODO: document possible values?\n\n protected readonly appTitle: string;\n\n // Surfaces the Firebase auth state on the login page itself: if the user is\n // already signed in (e.g. the app failed to navigate them onward) we show a\n // \"you are already signed in as X\" panel instead of the sign-in form, so an\n // authenticated-but-stuck state is obvious rather than looking like sign-in\n // is broken.\n protected readonly isAuthenticated = computed(\n () =>\n this.authState()?.status === 'authenticated' &&\n !!this.authState()?.user?.uid &&\n !this.authState()?.user?.isAnonymous,\n );\n // While Firebase is still resolving the session — the initial state, and the\n // brief window right after a signInWithRedirect return — show a \"signing you\n // in\" spinner instead of flashing the sign-in form before we navigate onward.\n protected readonly isAuthenticating = computed(\n () =>\n this.authState()?.status === 'authenticating' &&\n this.authState()?.loadingPhase !== 'failed',\n );\n private readonly authState = toSignal(this.authStateService.authState);\n private readonly userState = toSignal(this.userService.userState);\n protected readonly isAccountReady = computed(() => {\n const userState = this.userState();\n const authState = this.authState();\n return isSneatAccountReady(authState, userState);\n });\n protected readonly signedInAs = computed(() => {\n const u = this.authState()?.user;\n return u?.displayName || u?.email || u?.uid || '';\n });\n\n constructor() {\n super();\n const appInfo = this.appInfo;\n this.appTitle = appInfo.appTitle || 'Sneat.app';\n if (location.hash.startsWith('#/')) {\n this.redirectTo = safeAuthReturnPath(location.hash.substring(1));\n }\n this.to = this.route.snapshot.queryParams['to']; // should we subscribe? I believe no.\n this.reason = this.route.snapshot.queryParams['reason'];\n this.reasonDetail = this.route.snapshot.queryParams['reasonDetail'];\n const action = location.hash.match(/[#&]action=(\\w+)/);\n this.action = action?.[1] as Action;\n\n const userRecordLoaded = new Subject<void>();\n combineLatest([this.authStateService.authState, this.userService.userState])\n .pipe(takeUntil(userRecordLoaded), this.takeUntilDestroyed())\n .subscribe({\n next: ([authState, userState]) => {\n const userRecord = userState.record;\n if (!userRecord || !isSneatAccountReady(authState, userState)) return;\n userRecordLoaded.next();\n // Fall back to the persisted current space so it is restored after login,\n // but only if the user actually has access to it.\n const space = readCurrentSpace();\n const hasAccess = !!space && (\n userRecord.spaceIDs?.includes(space.id) ||\n (!!userRecord.spaces && space.id in userRecord.spaces)\n );\n if (space && !hasAccess) {\n clearCurrentSpace();\n }\n const activePath = hasAccess ? currentSpacePath() : undefined;\n const family = Object.entries(userRecord.spaces || {}).find(\n ([, brief]) => brief.type === SpaceTypeFamily,\n );\n const familyPath = family\n ? `/space/${SpaceTypeFamily}/${family[0]}`\n : undefined;\n const redirectTo = this.redirectTo || activePath || familyPath || '/';\n this.navController\n .navigateRoot(redirectTo)\n .catch((err) => {\n this.errorLogger.logError(\n err,\n 'Failed to navigate back to ' + redirectTo,\n );\n });\n },\n error: this.errorHandler('Failed to get user state after login'),\n });\n }\n\n // Proceed into the app from the \"already signed in\" panel.\n protected continueToApp(): void {\n if (!this.isAccountReady()) return;\n const space = readCurrentSpace();\n const userState = this.userState();\n const hasAccess = !!space && !!userState?.record && (\n userState.record.spaceIDs?.includes(space.id) ||\n (!!userState.record.spaces && space.id in userState.record.spaces)\n );\n if (space && !hasAccess) {\n clearCurrentSpace();\n }\n const activePath = hasAccess ? currentSpacePath() : undefined;\n const family = Object.entries(userState?.record?.spaces || {}).find(\n ([, brief]) => brief.type === SpaceTypeFamily,\n );\n const familyPath = family\n ? `/space/${SpaceTypeFamily}/${family[0]}`\n : undefined;\n const redirectTo = this.redirectTo || activePath || familyPath || '/';\n this.navController\n .navigateRoot(redirectTo)\n .catch((err) => {\n this.errorLogger.logError(\n err,\n 'Failed to navigate to ' + redirectTo,\n );\n });\n }\n\n // Sign out so the sign-in form is shown again (e.g. to log in as someone else).\n protected reLogin(): void {\n clearCurrentSpace();\n this.authStateService\n .signOut()\n .catch(this.errorLogger.logErrorHandler('Failed to sign out for re-login'));\n }\n\n private errorHandler(\n m: string,\n eventName?: string,\n eventParams?: Record<string, string>,\n ): (err: unknown) => void {\n return (err) => this.handleError(err, m, eventName, eventParams);\n }\n\n private handleError(\n err: unknown,\n m: string,\n eventName?: string,\n eventParams?: Record<string, string>,\n ): void {\n if (eventName) {\n this.analyticsService.logEvent(eventName, eventParams);\n }\n this.errorLogger.logError(err, m, {\n report: !(err as { code: unknown }).code,\n });\n }\n}\n","<ion-header>\n <ion-toolbar color=\"light\">\n <ion-buttons slot=\"start\">\n <ion-back-button />\n </ion-buttons>\n <ion-title>Login &#64; {{ appTitle }}</ion-title>\n </ion-toolbar>\n</ion-header>\n\n<ion-content id=\"main-content\">\n @if (reason) {\n <ion-card color=\"tertiary\">\n <ion-card-content>\n <h2 class=\"reason-title\">{{ reason }}</h2>\n @if (reasonDetail) {\n <p class=\"reason-detail\">{{ reasonDetail }}</p>\n }\n </ion-card-content>\n </ion-card>\n } @else if (to) {\n <ion-card color=\"tertiary\">\n <ion-card-content>\n <p>Please sign in to join a team</p>\n </ion-card-content>\n </ion-card>\n }\n\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 @if (isAuthenticating()) {\n <ion-card>\n <ion-card-content class=\"ion-text-center ion-padding\">\n <ion-spinner name=\"lines\" />\n <p class=\"ion-no-margin ion-padding-top\">Signing you in…</p>\n </ion-card-content>\n </ion-card>\n } @else if (isAuthenticated()) {\n <ion-card color=\"success\">\n <ion-card-content>\n <p>\n @if (signedInAs()) {\n You are already signed in as <strong>{{ signedInAs() }}</strong>.\n } @else {\n You are already signed in.\n }\n </p>\n @if (isAccountReady()) {\n <ion-button expand=\"block\" (click)=\"continueToApp()\">Continue</ion-button>\n } @else {\n <sneat-auth-panel\n [returnTo]=\"redirectTo\"\n [showIntro]=\"false\"\n [showCredentials]=\"false\"\n />\n }\n <ion-button\n expand=\"block\"\n fill=\"outline\"\n color=\"medium\"\n (click)=\"reLogin()\"\n >\n Re-login as someone else\n </ion-button>\n </ion-card-content>\n </ion-card>\n } @else {\n <sneat-auth-panel [returnTo]=\"redirectTo\" [showIntro]=\"false\" />\n }\n\n <p style=\"text-align: center; font-size: smaller\">\n <ion-text color=\"medium\">\n If any issues get\n <a href=\"mailto:help@sneat.app?subject=Problem+with+login+at+Sneat.app\"\n >help&#64;sneat.app</a\n >\n </ion-text>\n </p>\n</ion-content>\n"]}
package/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  export * from './lib/pages/sneat-auth-routing.module';
2
2
  export * from './lib/pages/login-page/auth-panel.component';
3
+ export type { AuthPanelInitialMode } from './lib/pages/login-page/email-login-form/email-login-form.component';
3
4
  export * from './lib/pages/login-page/telegram-login-config';
4
5
  export * from './lib/components';
5
6
  export * from './lib/pipes/person-names.pipe';
@@ -1,7 +1,7 @@
1
1
  import { EventEmitter, OnInit } from '@angular/core';
2
2
  import { AuthProviderID } from '@sneat/auth-core';
3
3
  import { UserCredential } from 'firebase/auth';
4
- import { EmailFormSigningWith } from './email-login-form/email-login-form.component';
4
+ import { AuthPanelInitialMode, EmailFormSigningWith } from './email-login-form/email-login-form.component';
5
5
  import * as i0 from "@angular/core";
6
6
  export interface AuthPanelAccountReadyChange {
7
7
  readonly uid?: string;
@@ -10,6 +10,7 @@ export interface AuthPanelAccountReadyChange {
10
10
  /** Shared auth methods without page-shell or navigation side effects. */
11
11
  export declare class AuthPanelComponent implements OnInit {
12
12
  readonly returnTo: import("@angular/core").InputSignal<string | undefined>;
13
+ readonly initialMode: import("@angular/core").InputSignal<AuthPanelInitialMode | undefined>;
13
14
  readonly showIntro: import("@angular/core").InputSignal<boolean>;
14
15
  readonly showCredentials: import("@angular/core").InputSignal<boolean>;
15
16
  readonly accountReadyChange: EventEmitter<AuthPanelAccountReadyChange>;
@@ -31,5 +32,5 @@ export declare class AuthPanelComponent implements OnInit {
31
32
  protected loginWith(provider: AuthProviderID): Promise<void>;
32
33
  protected onLoggedIn(userCredential: UserCredential): void;
33
34
  static ɵfac: i0.ɵɵFactoryDeclaration<AuthPanelComponent, never>;
34
- static ɵcmp: i0.ɵɵComponentDeclaration<AuthPanelComponent, "sneat-auth-panel", never, { "returnTo": { "alias": "returnTo"; "required": false; "isSignal": true; }; "showIntro": { "alias": "showIntro"; "required": false; "isSignal": true; }; "showCredentials": { "alias": "showCredentials"; "required": false; "isSignal": true; }; }, { "accountReadyChange": "accountReadyChange"; }, never, never, true, never>;
35
+ static ɵcmp: i0.ɵɵComponentDeclaration<AuthPanelComponent, "sneat-auth-panel", never, { "returnTo": { "alias": "returnTo"; "required": false; "isSignal": true; }; "initialMode": { "alias": "initialMode"; "required": false; "isSignal": true; }; "showIntro": { "alias": "showIntro"; "required": false; "isSignal": true; }; "showCredentials": { "alias": "showCredentials"; "required": false; "isSignal": true; }; }, { "accountReadyChange": "accountReadyChange"; }, never, never, true, never>;
35
36
  }
@@ -1,12 +1,14 @@
1
- import { EventEmitter } from '@angular/core';
1
+ import { EventEmitter, OnInit } from '@angular/core';
2
2
  import { Auth } from 'firebase/auth';
3
3
  import { IonInput } from '@ionic/angular';
4
4
  import { IAppInfo } from '@sneat/core';
5
5
  import { UserCredential } from 'firebase/auth';
6
6
  import * as i0 from "@angular/core";
7
7
  export type EmailFormSigningWith = 'email' | 'emailLink' | 'resetPassword';
8
- export declare class EmailLoginFormComponent {
8
+ export type AuthPanelInitialMode = 'sign-in' | 'sign-up';
9
+ export declare class EmailLoginFormComponent implements OnInit {
9
10
  readonly returnTo: import("@angular/core").InputSignal<string | undefined>;
11
+ readonly initialMode: import("@angular/core").InputSignal<AuthPanelInitialMode | undefined>;
10
12
  readonly appInfo: IAppInfo;
11
13
  private readonly analyticsService;
12
14
  private readonly errorLogger;
@@ -30,6 +32,7 @@ export declare class EmailLoginFormComponent {
30
32
  protected readonly spaceTitleInput: import("@angular/core").Signal<IonInput | undefined>;
31
33
  readonly setFocusToInput: (input?: IonInput | import("@ionic/angular").IonTextarea, delay?: number) => void;
32
34
  constructor();
35
+ ngOnInit(): void;
33
36
  get validEmail(): boolean;
34
37
  getFirebaseAuth(): Auth;
35
38
  signUp(): Promise<void>;
@@ -49,5 +52,5 @@ export declare class EmailLoginFormComponent {
49
52
  private setFocusToEmail;
50
53
  private setFocusToSpaceTitle;
51
54
  static ɵfac: i0.ɵɵFactoryDeclaration<EmailLoginFormComponent, never>;
52
- static ɵcmp: i0.ɵɵComponentDeclaration<EmailLoginFormComponent, "sneat-email-login-form", never, { "returnTo": { "alias": "returnTo"; "required": false; "isSignal": true; }; }, { "signingWithChange": "signingWithChange"; "loggedIn": "loggedIn"; }, never, never, true, never>;
55
+ static ɵcmp: i0.ɵɵComponentDeclaration<EmailLoginFormComponent, "sneat-email-login-form", never, { "returnTo": { "alias": "returnTo"; "required": false; "isSignal": true; }; "initialMode": { "alias": "initialMode"; "required": false; "isSignal": true; }; }, { "signingWithChange": "signingWithChange"; "loggedIn": "loggedIn"; }, never, never, true, never>;
53
56
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sneat/auth-ui",
3
- "version": "0.27.31",
3
+ "version": "0.27.33",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },