diff --git a/src/app/app.ts b/src/app/app.ts index ccaab04..ef63784 100644 --- a/src/app/app.ts +++ b/src/app/app.ts @@ -91,13 +91,5 @@ export class App implements OnInit { console.error('Update check failed:', err); } }); - - this.swUpdate.versionUpdates - .pipe(takeUntilDestroyed(this.destroyRef)) - .subscribe(event => { - if (event.type === 'VERSION_READY') { - console.log('New app version ready'); - } - }); } } diff --git a/src/app/components/telegram-login/telegram-login.component.ts b/src/app/components/telegram-login/telegram-login.component.ts index 4df5fee..b206314 100644 --- a/src/app/components/telegram-login/telegram-login.component.ts +++ b/src/app/components/telegram-login/telegram-login.component.ts @@ -27,7 +27,6 @@ export class TelegramLoginComponent implements OnDestroy { private pollTimer?: ReturnType; constructor() { - console.log('TelegramLoginComponent initialized'); effect(() => { if (this.showDialog()) { this.initQrLogin(); diff --git a/src/app/models/auth.model.ts b/src/app/models/auth.model.ts index 55fac5f..111d06b 100644 --- a/src/app/models/auth.model.ts +++ b/src/app/models/auth.model.ts @@ -1,6 +1,6 @@ export interface AuthSession { sessionId: string; - userId: any; + userId: number | null; username: string | null; displayName: string; active: boolean; diff --git a/src/app/pages/cart/cart.component.ts b/src/app/pages/cart/cart.component.ts index 4de347e..ba787c4 100644 --- a/src/app/pages/cart/cart.component.ts +++ b/src/app/pages/cart/cart.component.ts @@ -1,4 +1,4 @@ -import { Component, computed, ChangeDetectionStrategy, signal, OnDestroy, inject } from '@angular/core'; +import { Component, ChangeDetectionStrategy, signal, OnDestroy, inject } from '@angular/core'; import { DecimalPipe } from '@angular/common'; import { Router, RouterLink } from '@angular/router'; import { FormsModule } from '@angular/forms'; @@ -65,7 +65,6 @@ export class CartComponent implements OnDestroy { private router: Router, private langService: LanguageService ) { - console.log('CartComponent initialized'); this.items = this.cartService.items; this.itemCount = this.cartService.itemCount; this.totalPrice = this.cartService.totalPrice; @@ -233,7 +232,6 @@ export class CartComponent implements OnDestroy { } startPolling(): void { - console.log('Starting payment status polling CART'); this.stopPolling(); if (!this.paymentId()) { this.setPaymentError(); @@ -437,9 +435,8 @@ export class CartComponent implements OnDestroy { } private getTelegramUserId(): string | null { - console.log('Getting Telegram User ID', this.authService.session(), window.Telegram?.WebApp?.initDataUnsafe?.user); const sessionTelegramUserId = this.authService.session()?.userId; - if (sessionTelegramUserId) { + if (sessionTelegramUserId !== null && sessionTelegramUserId !== undefined) { return sessionTelegramUserId.toString(); } diff --git a/src/app/services/auth.service.ts b/src/app/services/auth.service.ts index cb01e74..e1d7830 100644 --- a/src/app/services/auth.service.ts +++ b/src/app/services/auth.service.ts @@ -215,8 +215,8 @@ export class AuthService { ?? this.readString(this.readFirst(user, ['displayName', 'DisplayName', 'name', 'Name'])) const displayName = explicitDisplayName ?? username ?? (fullName || 'Telegram User'); const telegramUserId = this.readNumber(this.readFirst(user, ['userId','telegramUserId', 'telegramUserID', 'TelegramUserID', 'id', 'ID'])) - ?? this.readNumber(this.readFirst(response, ['telegramUserId', 'telegramUserID', 'TelegramUserID', 'userID', 'UserID', 'UserId'])) - ?? 0; + ?? this.readNumber(this.readFirst(response, ['userId', 'telegramUserId', 'telegramUserID', 'TelegramUserID', 'userID', 'UserID', 'UserId'])) + ?? null; const expiresAt = this.readString(this.readFirst(response, ['expiresAt', 'ExpiresAt', 'expires', 'Expires'])) ?? new Date(Date.now() + WEB_SESSION_COOKIE_MAX_AGE_SECONDS * 1000).toISOString();