@sneat/app 0.5.2 → 0.5.4
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.
|
@@ -3,6 +3,7 @@ import { Title } from '@angular/platform-browser';
|
|
|
3
3
|
import { ActivatedRoute, NavigationEnd, Router } from '@angular/router';
|
|
4
4
|
import { SneatAuthStateService, TelegramAuthService, } from '@sneat/auth-core';
|
|
5
5
|
import { AnalyticsService, clearCurrentSpace, TopMenuService } from '@sneat/core';
|
|
6
|
+
import { getRedirectResult } from 'firebase/auth';
|
|
6
7
|
import { filter } from 'rxjs';
|
|
7
8
|
export class BaseAppComponent {
|
|
8
9
|
constructor() {
|
|
@@ -14,6 +15,12 @@ export class BaseAppComponent {
|
|
|
14
15
|
this.authStateService = inject(SneatAuthStateService);
|
|
15
16
|
this.topMenuService = inject(TopMenuService); // used in templates
|
|
16
17
|
this.telegramAuthService.authenticateIfTelegramWebApp();
|
|
18
|
+
// Complete any pending signInWithRedirect when the app boots. The
|
|
19
|
+
// authStateService's onIdTokenChanged listener then propagates the
|
|
20
|
+
// signed-in user. Resolves to null (harmless) when sign-in used a popup or
|
|
21
|
+
// there is no pending redirect. Lives here so every app that extends
|
|
22
|
+
// BaseAppComponent gets redirect-based sign-in for free.
|
|
23
|
+
getRedirectResult(this.authStateService.fbAuth).catch((err) => console.error('getRedirectResult failed', err));
|
|
17
24
|
this.authStateService.authState.subscribe((s) => {
|
|
18
25
|
this.authStatus = s.status;
|
|
19
26
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-app.component.js","sourceRoot":"","sources":["../../../../../libs/app/src/lib/base-app.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,OAAO,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACxE,OAA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EAAE,CAAC;gBACV,MAAM,SAAS,GAAG,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,CAAC,WAAW,CAAC,CAAC;gBAC9D,IAAI,SAAS,EAAE,CAAC;oBACd,KAAK,GAAG,GAAG,qBAAqB,CAAC,SAAS,CAAC,IAAI,KAAK,EAAE,CAAC;gBACzD,CAAC;YACH,CAAC;YACD,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAC,WAAW,EAAE;gBAC1C,SAAS,EAAE,KAAK,CAAC,iBAAiB;gBAClC,KAAK;aACN,CAAC,CAAC;YACH,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,cAAc,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,gBAAgB;YACtE,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;YAElC,IAAI,CAAC,8BAA8B,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC;QAC/D,CAAC,CAAC,CAAC;IACP,CAAC;IAED,gFAAgF;IAChF,kFAAkF;IAClF,+EAA+E;IAC/E,gFAAgF;IAChF,iEAAiE;IACzD,8BAA8B,CAAC,GAAW;QAChD,IAAI,IAAI,CAAC,UAAU,KAAK,eAAe,EAAE,CAAC;YACxC,OAAO;QACT,CAAC;QACD,IACE,GAAG,CAAC,UAAU,CAAC,SAAS,CAAC;YACzB,GAAG,CAAC,UAAU,CAAC,QAAQ,CAAC;YACxB,GAAG,CAAC,UAAU,CAAC,aAAa,CAAC,EAC7B,CAAC;YACD,OAAO;QACT,CAAC;QACD,iBAAiB,EAAE,CAAC;IACtB,CAAC;CACF;AAED,SAAS,qBAAqB,CAAC,IAAY;IACzC,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AACtD,CAAC","sourcesContent":["import { inject } from '@angular/core';\nimport { Title } from '@angular/platform-browser';\nimport { ActivatedRoute, NavigationEnd, Router } from '@angular/router';\nimport {\n AuthStatus,\n SneatAuthStateService,\n TelegramAuthService,\n} from '@sneat/auth-core';\nimport { AnalyticsService, clearCurrentSpace, TopMenuService } from '@sneat/core';\nimport { filter } from 'rxjs';\n\nexport class BaseAppComponent {\n private readonly telegramAuthService = inject(TelegramAuthService);\n private readonly router = inject(Router);\n private readonly activatedRoute = inject(ActivatedRoute);\n private readonly analyticsService = inject(AnalyticsService);\n private readonly titleService = inject(Title);\n private readonly authStateService = inject(SneatAuthStateService);\n protected readonly topMenuService = inject(TopMenuService); // used in templates\n\n private authStatus?: AuthStatus;\n\n constructor() {\n this.telegramAuthService.authenticateIfTelegramWebApp();\n this.authStateService.authState.subscribe((s) => {\n this.authStatus = s.status;\n });\n this.router.events\n .pipe(filter((event) => event instanceof NavigationEnd))\n .subscribe((event: NavigationEnd) => {\n let route = this.activatedRoute.firstChild;\n while (route?.firstChild) {\n route = route.firstChild;\n }\n let title = route?.snapshot.data['title'];\n if (title) {\n const spaceType = route?.snapshot?.paramMap?.get('spaceType');\n if (spaceType) {\n title = `${capitalizeFirstLetter(spaceType)} ${title}`;\n }\n }\n this.analyticsService.logEvent('$pageview', {\n page_path: event.urlAfterRedirects,\n title,\n });\n title = title ? `${title} @ Sneat.App` : 'Sneat.App'; // Default title\n this.titleService.setTitle(title);\n\n this.forgetCurrentSpaceIfLeftSpaces(event.urlAfterRedirects);\n });\n }\n\n // Keep the persisted current space in sync with where an authenticated user is:\n // once they navigate to a non-space page, forget it so login does not bounce them\n // back to a space they had left. Auth routes are ignored so signing out from a\n // space still restores it; the `authenticated` guard preserves the value during\n // the logged-out login flow so the login page can still read it.\n private forgetCurrentSpaceIfLeftSpaces(url: string): void {\n if (this.authStatus !== 'authenticated') {\n return;\n }\n if (\n url.startsWith('/space/') ||\n url.startsWith('/login') ||\n url.startsWith('/signed-out')\n ) {\n return;\n }\n clearCurrentSpace();\n }\n}\n\nfunction capitalizeFirstLetter(text: string): string {\n return text.charAt(0).toUpperCase() + text.slice(1);\n}\n"]}
|
|
1
|
+
{"version":3,"file":"base-app.component.js","sourceRoot":"","sources":["../../../../../libs/app/src/lib/base-app.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,OAAO,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACxE,OAAO,EAEL,qBAAqB,EACrB,mBAAmB,GACpB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClF,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAE9B,MAAM,OAAO,gBAAgB;IAW3B;QAViB,wBAAmB,GAAG,MAAM,CAAC,mBAAmB,CAAC,CAAC;QAClD,WAAM,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC;QACxB,mBAAc,GAAG,MAAM,CAAC,cAAc,CAAC,CAAC;QACxC,qBAAgB,GAAG,MAAM,CAAC,gBAAgB,CAAC,CAAC;QAC5C,iBAAY,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;QAC7B,qBAAgB,GAAG,MAAM,CAAC,qBAAqB,CAAC,CAAC;QAC/C,mBAAc,GAAG,MAAM,CAAC,cAAc,CAAC,CAAC,CAAC,oBAAoB;QAK9E,IAAI,CAAC,mBAAmB,CAAC,4BAA4B,EAAE,CAAC;QACxD,kEAAkE;QAClE,mEAAmE;QACnE,2EAA2E;QAC3E,qEAAqE;QACrE,yDAAyD;QACzD,iBAAiB,CAAC,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE,CAC5D,OAAO,CAAC,KAAK,CAAC,0BAA0B,EAAE,GAAG,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;IAED,gFAAgF;IAChF,kFAAkF;IAClF,+EAA+E;IAC/E,gFAAgF;IAChF,iEAAiE;IACzD,8BAA8B,CAAC,GAAW;QAChD,IAAI,IAAI,CAAC,UAAU,KAAK,eAAe,EAAE,CAAC;YACxC,OAAO;QACT,CAAC;QACD,IACE,GAAG,CAAC,UAAU,CAAC,SAAS,CAAC;YACzB,GAAG,CAAC,UAAU,CAAC,QAAQ,CAAC;YACxB,GAAG,CAAC,UAAU,CAAC,aAAa,CAAC,EAC7B,CAAC;YACD,OAAO;QACT,CAAC;QACD,iBAAiB,EAAE,CAAC;IACtB,CAAC;CACF;AAED,SAAS,qBAAqB,CAAC,IAAY;IACzC,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AACtD,CAAC","sourcesContent":["import { inject } from '@angular/core';\nimport { Title } from '@angular/platform-browser';\nimport { ActivatedRoute, NavigationEnd, Router } from '@angular/router';\nimport {\n AuthStatus,\n SneatAuthStateService,\n TelegramAuthService,\n} from '@sneat/auth-core';\nimport { AnalyticsService, clearCurrentSpace, TopMenuService } from '@sneat/core';\nimport { getRedirectResult } from 'firebase/auth';\nimport { filter } from 'rxjs';\n\nexport class BaseAppComponent {\n private readonly telegramAuthService = inject(TelegramAuthService);\n private readonly router = inject(Router);\n private readonly activatedRoute = inject(ActivatedRoute);\n private readonly analyticsService = inject(AnalyticsService);\n private readonly titleService = inject(Title);\n private readonly authStateService = inject(SneatAuthStateService);\n protected readonly topMenuService = inject(TopMenuService); // used in templates\n\n private authStatus?: AuthStatus;\n\n constructor() {\n this.telegramAuthService.authenticateIfTelegramWebApp();\n // Complete any pending signInWithRedirect when the app boots. The\n // authStateService's onIdTokenChanged listener then propagates the\n // signed-in user. Resolves to null (harmless) when sign-in used a popup or\n // there is no pending redirect. Lives here so every app that extends\n // BaseAppComponent gets redirect-based sign-in for free.\n getRedirectResult(this.authStateService.fbAuth).catch((err) =>\n console.error('getRedirectResult failed', err),\n );\n this.authStateService.authState.subscribe((s) => {\n this.authStatus = s.status;\n });\n this.router.events\n .pipe(filter((event) => event instanceof NavigationEnd))\n .subscribe((event: NavigationEnd) => {\n let route = this.activatedRoute.firstChild;\n while (route?.firstChild) {\n route = route.firstChild;\n }\n let title = route?.snapshot.data['title'];\n if (title) {\n const spaceType = route?.snapshot?.paramMap?.get('spaceType');\n if (spaceType) {\n title = `${capitalizeFirstLetter(spaceType)} ${title}`;\n }\n }\n this.analyticsService.logEvent('$pageview', {\n page_path: event.urlAfterRedirects,\n title,\n });\n title = title ? `${title} @ Sneat.App` : 'Sneat.App'; // Default title\n this.titleService.setTitle(title);\n\n this.forgetCurrentSpaceIfLeftSpaces(event.urlAfterRedirects);\n });\n }\n\n // Keep the persisted current space in sync with where an authenticated user is:\n // once they navigate to a non-space page, forget it so login does not bounce them\n // back to a space they had left. Auth routes are ignored so signing out from a\n // space still restores it; the `authenticated` guard preserves the value during\n // the logged-out login flow so the login page can still read it.\n private forgetCurrentSpaceIfLeftSpaces(url: string): void {\n if (this.authStatus !== 'authenticated') {\n return;\n }\n if (\n url.startsWith('/space/') ||\n url.startsWith('/login') ||\n url.startsWith('/signed-out')\n ) {\n return;\n }\n clearCurrentSpace();\n }\n}\n\nfunction capitalizeFirstLetter(text: string): string {\n return text.charAt(0).toUpperCase() + text.slice(1);\n}\n"]}
|
|
@@ -9,6 +9,7 @@ import { LOGGER_FACTORY, loggerFactory, TopMenuService } from '@sneat/core';
|
|
|
9
9
|
import { provideErrorLogger, provideSentryAppInitializer, provideSneatAnalytics, } from '@sneat/logging';
|
|
10
10
|
import { RANDOM_ID_OPTIONS } from '@sneat/random';
|
|
11
11
|
import { AppComponentService } from './app-component.service';
|
|
12
|
+
import { EnvConfigToken } from '@sneat/core';
|
|
12
13
|
import { getAngularFireProviders } from './init-firebase';
|
|
13
14
|
// import { getAngularFireImports } from './init-firebase';
|
|
14
15
|
import { registerPosthog } from './register-posthog';
|
|
@@ -26,6 +27,7 @@ export function getStandardSneatProviders(environmentConfig) {
|
|
|
26
27
|
provideIonicAngular(),
|
|
27
28
|
provideAnimationsAsync(),
|
|
28
29
|
{ provide: LOGGER_FACTORY, useValue: loggerFactory },
|
|
30
|
+
{ provide: EnvConfigToken, useValue: environmentConfig },
|
|
29
31
|
{
|
|
30
32
|
provide: RouteReuseStrategy,
|
|
31
33
|
useClass: IonicRouteStrategy,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-standard-sneat-providers.js","sourceRoot":"","sources":["../../../../../libs/app/src/lib/get-standard-sneat-providers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAEzD,OAAO,EAAE,sBAAsB,EAAE,MAAM,4CAA4C,CAAC;AACpF,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EAAE,yBAAyB,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AACxE,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC5E,OAAO,EACL,kBAAkB,EAClB,2BAA2B,EAC3B,qBAAqB,GACtB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"get-standard-sneat-providers.js","sourceRoot":"","sources":["../../../../../libs/app/src/lib/get-standard-sneat-providers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAEzD,OAAO,EAAE,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AC7B;QACD;YACE,OAAO,EAAE,eAAe;YACxB,QAAQ,EAAE,iBAAiB,CAAC,QAAQ;gBAClC,CAAC,CAAC,KAAK,QAAQ,CAAC,IAAI,MAAM;gBAC1B,CAAC,CAAC,iBAAiB,CAAC,cAAc,CAAC,QAAQ;oBACzC,CAAC,CAAC,gCAAgC,CAAC,8BAA8B;oBACjE,CAAC,CAAC,yBAAyB;SAChC;QACD;YACE,OAAO,EAAE,iBAAiB;YAC1B,QAAQ,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE;SACrB;QACD,uBAAuB,CAAC,iBAAiB,CAAC,cAAc,CAAC;QACzD,qBAAqB,CAAC,iBAAiB,CAAC;QACxC,mBAAmB,EAAE,+CAA+C;QACpE,cAAc;QACd,mBAAmB;KACpB,CAAC;IACF,IAAI,iBAAiB,CAAC,MAAM,EAAE,CAAC;QAC7B,SAAS,CAAC,IAAI,CAAC,2BAA2B,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC,CAAC;IACxE,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC","sourcesContent":["import { provideHttpClient } from '@angular/common/http';\nimport { EnvironmentProviders, Provider } from '@angular/core';\nimport { provideAnimationsAsync } from '@angular/platform-browser/animations/async';\nimport { RouteReuseStrategy } from '@angular/router';\nimport { IonicRouteStrategy } from '@ionic/angular/standalone';\nimport { provideIonicAngular } from '@ionic/angular/standalone';\nimport { DefaultSneatAppApiBaseUrl, SneatApiBaseUrl } from '@sneat/api';\nimport { TelegramAuthService } from '@sneat/auth-core';\nimport { LOGGER_FACTORY, loggerFactory, TopMenuService } from '@sneat/core';\nimport {\n provideErrorLogger,\n provideSentryAppInitializer,\n provideSneatAnalytics,\n} from '@sneat/logging';\nimport { RANDOM_ID_OPTIONS } from '@sneat/random';\nimport { AppComponentService } from './app-component.service';\nimport { EnvConfigToken, IEnvironmentConfig } from '@sneat/core';\nimport { getAngularFireProviders } from './init-firebase';\n\n// import { getAngularFireImports } from './init-firebase';\n\nimport { registerPosthog } from './register-posthog';\n\nexport function getStandardSneatProviders(\n environmentConfig: IEnvironmentConfig,\n): readonly (Provider | EnvironmentProviders)[] {\n // console.log(\n // \t'getStandardSneatProviders(), environmentConfig:' +\n // \t\tJSON.stringify(environmentConfig, undefined, '\\t'),\n // );\n if (environmentConfig.posthog) {\n registerPosthog(environmentConfig.posthog);\n }\n\n const providers = [\n provideHttpClient(),\n provideErrorLogger(),\n provideIonicAngular(),\n provideAnimationsAsync(),\n { provide: LOGGER_FACTORY, useValue: loggerFactory },\n { provide: EnvConfigToken, useValue: environmentConfig },\n {\n provide: RouteReuseStrategy,\n useClass: IonicRouteStrategy,\n },\n {\n provide: SneatApiBaseUrl,\n useValue: environmentConfig.useNgrok\n ? `//${location.host}/v0/`\n : environmentConfig.firebaseConfig.emulator\n ? 'https://local-api.sneat.ws/v0/' // 'http://localhost:4300/v0/'\n : DefaultSneatAppApiBaseUrl,\n },\n {\n provide: RANDOM_ID_OPTIONS,\n useValue: { len: 9 },\n },\n getAngularFireProviders(environmentConfig.firebaseConfig),\n provideSneatAnalytics(environmentConfig),\n AppComponentService, // TODO: check if it's used and probably remove\n TopMenuService,\n TelegramAuthService,\n ];\n if (environmentConfig.sentry) {\n providers.push(provideSentryAppInitializer(environmentConfig.sentry));\n }\n return providers;\n}\n"]}
|