perf(bundle): replace broad storage and utils imports

This commit is contained in:
2026-07-14 18:13:55 +08:00
parent e270be9bd9
commit 0033625866
85 changed files with 136 additions and 97 deletions
+12 -5
View File
@@ -24,12 +24,19 @@ The command uses the built-in Next.js Turbopack analyzer and writes:
Compressed sizes below are Turbopack module estimates. `Eager` is the route's synchronous client graph; `async` is code behind at least one dynamic import.
| Route | Eager before | Eager baseline | Change | Async baseline |
| Route | Before direct imports | Eager baseline | Change | Async baseline |
| --- | ---: | ---: | ---: | ---: |
| `/splash` | 644.4 KiB | 644.4 KiB | 0.0 KiB | 14.3 KiB |
| `/chat` | 666.2 KiB | 666.2 KiB | 0.0 KiB | 14.7 KiB |
| `/subscription` | 660.7 KiB | 657.0 KiB | -3.7 KiB | 20.7 KiB |
| `/tip` | 653.9 KiB | 650.4 KiB | -3.5 KiB | 20.7 KiB |
| `/splash` | 647.2 KiB | 646.2 KiB | -1.0 KiB | 14.3 KiB |
| `/chat` | 670.5 KiB | 669.8 KiB | -0.7 KiB | 14.7 KiB |
| `/subscription` | 660.1 KiB | 658.4 KiB | -1.7 KiB | 20.6 KiB |
| `/tip` | 653.3 KiB | 651.6 KiB | -1.7 KiB | 20.6 KiB |
The direct-import pass replaces root `@/utils` and `@/data/storage` barrel
imports with symbol-level module paths. Turbopack already eliminated most unused
barrel exports, so the immediate size reduction is modest. The explicit paths
keep future barrel exports from silently expanding the client graph. Dexie and
UA Parser remain in the analyzed routes through active feature dependencies and
require separate feature-boundary work to remove from the eager graph.
Module loading baseline:
+2 -1
View File
@@ -18,7 +18,8 @@ import type {
PaymentContextState,
} from "@/stores/payment/payment-context";
import type { PaymentEvent } from "@/stores/payment/payment-events";
import { AppEnvUtil, Logger } from "@/utils";
import { AppEnvUtil } from "@/utils/app-env";
import { Logger } from "@/utils/logger";
const UNSUPPORTED_PAYMENT_PARAMS_MESSAGE =
"Payment parameters did not include a supported URL or Stripe client secret.";
+1 -1
View File
@@ -13,7 +13,7 @@ import { ROUTES } from "@/router/routes";
import { useAppNavigator } from "@/router/use-app-navigator";
import { AuthBackground, AuthPanel } from "./components";
import { Logger } from "@/utils";
import { Logger } from "@/utils/logger";
const log = new Logger("AppAuthAuthScreen");
@@ -3,7 +3,7 @@ import type { ReactNode } from "react";
import { MdEmail } from "react-icons/md";
import { BottomSheet } from "@/app/_components/core/bottom-sheet";
import { AppEnvUtil } from "@/utils";
import { AppEnvUtil } from "@/utils/app-env";
import { AuthProviderIcon } from "./auth-provider-icon";
import { AuthSocialButton } from "./auth-social-button";
+2 -1
View File
@@ -13,7 +13,8 @@ import {
import { AuthTextField } from "./auth-text-field";
import { AuthPrimaryButton } from "./auth-primary-button";
import { AuthErrorMessage } from "./auth-error-message";
import { AppEnvUtil, Logger } from "@/utils";
import { AppEnvUtil } from "@/utils/app-env";
import { Logger } from "@/utils/logger";
const log = new Logger("AppAuthComponentsEmailLoginForm");
const NON_PRODUCTION_DEFAULT_EMAIL = "chanwillian0@gmail.com";
@@ -24,7 +24,7 @@ import {
import { AuthTextField } from "./auth-text-field";
import { AuthPrimaryButton } from "./auth-primary-button";
import { AuthErrorMessage } from "./auth-error-message";
import { Logger } from "@/utils";
import { Logger } from "@/utils/logger";
const log = new Logger("AppAuthComponentsEmailRegisterForm");
+2 -1
View File
@@ -2,7 +2,8 @@
import type { LoginStatus } from "@/data/dto/auth";
import type { ChatUpgradeReason } from "@/stores/chat/chat-state";
import { AppEnvUtil, BrowserDetector } from "@/utils";
import { AppEnvUtil } from "@/utils/app-env";
import { BrowserDetector } from "@/utils/browser-detect";
export interface ExternalBrowserPromptState {
hasInitialized: boolean;
+1 -1
View File
@@ -3,7 +3,7 @@ import { useRef, useState } from "react";
import { useChatDispatch } from "@/stores/chat/chat-context";
import { useKeyboardHeight } from "@/hooks";
import { Logger } from "@/utils";
import { Logger } from "@/utils/logger";
import { ChatInputTextField } from "./chat-input-text-field";
import { ChatSendButton } from "./chat-send-button";
@@ -19,7 +19,7 @@ import {
canShowPwaInstallPromptOnce,
recordPwaInstallPromptShown,
} from "@/lib/chat/pwa_install_prompt";
import { pwaUtil } from "@/utils";
import { pwaUtil } from "@/utils/pwa";
import { PwaInstallDialog } from "./pwa-install-dialog";
@@ -7,7 +7,7 @@ import {
peekPendingChatUnlock,
} from "@/lib/navigation/chat_unlock_session";
import { useChatDispatch } from "@/stores/chat/chat-context";
import { Logger } from "@/utils";
import { Logger } from "@/utils/logger";
const log = new Logger("UseChatPromotionBootstrap");
+1 -1
View File
@@ -15,7 +15,7 @@ import Link from "next/link";
import { ExceptionHandler } from "@/core/errors";
import { ROUTES } from "@/router/routes";
import { Logger } from "@/utils";
import { Logger } from "@/utils/logger";
const log = new Logger("AppError");
@@ -15,7 +15,7 @@ import {
savePendingChatPromotion,
} from "@/lib/navigation/chat_unlock_session";
import { ROUTES } from "@/router/routes";
import { Logger } from "@/utils";
import { Logger } from "@/utils/logger";
import { useAuthDispatch, useAuthState } from "@/stores/auth/auth-context";
const log = new Logger("ExternalEntryPersist");
+1 -1
View File
@@ -2,7 +2,7 @@
import { useEffect, useState } from "react";
import { pwaUtil } from "@/utils";
import { pwaUtil } from "@/utils/pwa";
type PwaInstallResult = Awaited<ReturnType<typeof pwaUtil.install>>;
@@ -6,7 +6,8 @@ import type { LoginStatus } from "@/data/dto/auth";
import { useHasHydrated } from "@/hooks/use-has-hydrated";
import { loadSplashLatestMessagePreview } from "@/lib/chat/splash_latest_message";
import { useSplashLatestMessageCache } from "@/providers/splash-latest-message-provider";
import { Logger, Result } from "@/utils";
import { Logger } from "@/utils/logger";
import { Result } from "@/utils/result";
const log = new Logger("SplashLatestMessage");
+1 -1
View File
@@ -6,7 +6,7 @@ import { AppBottomNav, MobileShell } from "@/app/_components/core";
import { ROUTES } from "@/router/routes";
import { useAppNavigator } from "@/router/use-app-navigator";
import { useAuthState } from "@/stores/auth/auth-context";
import { pwaUtil } from "@/utils";
import { pwaUtil } from "@/utils/pwa";
import {
SplashBackground,
@@ -15,7 +15,7 @@ import { loadStripe } from "@stripe/stripe-js";
import { ExceptionHandler } from "@/core/errors";
import { ROUTES } from "@/router/routes";
import { Logger } from "@/utils";
import { Logger } from "@/utils/logger";
import { stripePaymentDialogStyles as styles } from "./stripe-payment-dialog.styles";
@@ -9,7 +9,7 @@ import {
usePaymentDispatch,
usePaymentState,
} from "@/stores/payment/payment-context";
import { Logger } from "@/utils";
import { Logger } from "@/utils/logger";
import { LazyStripePaymentDialog } from "./lazy-stripe-payment-dialog";
import { stripePaymentDialogStyles as dialogStyles } from "./stripe-payment-dialog.styles";
+1 -1
View File
@@ -6,7 +6,7 @@ import {
usePaymentDispatch,
usePaymentState,
} from "@/stores/payment/payment-context";
import { Logger } from "@/utils";
import { Logger } from "@/utils/logger";
import { LazyStripePaymentDialog } from "../subscription/components/lazy-stripe-payment-dialog";
import { stripePaymentDialogStyles as dialogStyles } from "../subscription/components/stripe-payment-dialog.styles";
+2 -1
View File
@@ -10,7 +10,8 @@
*/
import { getApiConfig } from "@/core/net/config/api_config";
import { ExceptionHandler } from "@/core/errors";
import { AppEnvUtil, Logger } from "@/utils";
import { AppEnvUtil } from "@/utils/app-env";
import { Logger } from "@/utils/logger";
const log = new Logger("ChatWebSocket");
const RECONNECT_DELAY_MS = 3000;
+1 -1
View File
@@ -4,7 +4,7 @@
* 通过环境变量配置后端服务地址与超时时间。
*
*/
import { AppEnvUtil, type AppEnv } from "@/utils";
import { AppEnvUtil, type AppEnv } from "@/utils/app-env";
export type { AppEnv };
@@ -8,7 +8,9 @@ import type { FetchHook } from "ofetch";
import { ApiPath } from "../../../data/services/api/api_path";
import { ApiError, ErrorCode } from "../../../data/services/api/api_result";
import { AuthStorage } from "@/data/storage/auth/auth_storage";
import { AppEnvUtil, deviceIdentifier, Result } from "@/utils";
import { AppEnvUtil } from "@/utils/app-env";
import { deviceIdentifier } from "@/utils/device_identifier";
import { Result } from "@/utils/result";
/**
* 不需要 auth token 刷新的路径
@@ -6,7 +6,8 @@
*/
import type { FetchHook } from "ofetch";
import { AppEnvUtil, Logger } from "@/utils";
import { AppEnvUtil } from "@/utils/app-env";
import { Logger } from "@/utils/logger";
const log = new Logger("ApiLoggingInterceptor");
@@ -6,7 +6,7 @@
*
*/
import type { FetchHook } from "ofetch";
import { Logger } from "@/utils";
import { Logger } from "@/utils/logger";
import { ApiPath } from "../../../data/services/api/api_path";
import { AuthStorage } from "../../../data/storage/auth/auth_storage";
+1 -1
View File
@@ -7,7 +7,7 @@
* - 队列只负责发送节奏,不关心每批消息是否成功消费
* - 队列可在任意时刻清空(dispose)
*/
import { Logger } from "@/utils";
import { Logger } from "@/utils/logger";
export type MessageConsumer = (content: string) => void | Promise<void>;
@@ -9,7 +9,7 @@ import { AuthRepository } from "@/data/repositories/auth_repository";
import type { AuthApi } from "@/data/services/api";
import type { IAuthStorage } from "@/data/storage/auth";
import type { IUserStorage } from "@/data/storage/user";
import { Result } from "@/utils";
import { Result } from "@/utils/result";
function createRepository(overrides: Partial<AuthApi>) {
const storage = {
@@ -8,7 +8,7 @@ import { AuthRepository } from "@/data/repositories/auth_repository";
import type { AuthApi } from "@/data/services/api";
import type { IAuthStorage } from "@/data/storage/auth";
import type { IUserStorage } from "@/data/storage/user";
import { Result } from "@/utils";
import { Result } from "@/utils/result";
function createRepository(input: {
api?: Partial<AuthApi>;
@@ -1,7 +1,7 @@
import { describe, expect, it, vi } from "vitest";
import { LoginStatus } from "@/data/dto/auth";
import { Result } from "@/utils";
import { Result } from "@/utils/result";
import { resolveChatCacheOwnerKey } from "../chat_cache_identity";
@@ -2,7 +2,7 @@ import { describe, expect, it, vi } from "vitest";
import { ChatMessage } from "@/data/dto/chat";
import { LocalMessage } from "@/data/storage/chat";
import { Result } from "@/utils";
import { Result } from "@/utils/result";
import { ChatLocalMessageStore } from "../chat_local_message_store";
@@ -1,6 +1,6 @@
import { afterEach, describe, expect, it, vi } from "vitest";
import { Result } from "@/utils";
import { Result } from "@/utils/result";
import { ChatMediaCacheCoordinator } from "../chat_media_cache_coordinator";
@@ -3,7 +3,7 @@ import { describe, expect, it, vi } from "vitest";
import { TipPaymentPlansResponse } from "@/data/dto/payment";
import { PaymentRepository } from "@/data/repositories/payment_repository";
import type { PaymentApi } from "@/data/services/api";
import { Result } from "@/utils";
import { Result } from "@/utils/result";
describe("PaymentRepository", () => {
it("adapts tip plans without caching them as subscription plans", async () => {
+5 -7
View File
@@ -19,13 +19,11 @@ import {
RegisterRequest,
} from "@/data/dto/auth";
import { User } from "@/data/dto/user";
import {
AppEnvUtil,
PlatformDetector,
Result,
Logger,
deviceIdentifier,
} from "@/utils";
import { AppEnvUtil } from "@/utils/app-env";
import { PlatformDetector } from "@/utils/platform-detect";
import { Result } from "@/utils/result";
import { Logger } from "@/utils/logger";
import { deviceIdentifier } from "@/utils/device_identifier";
import type { IAuthRepository } from "@/data/repositories/interfaces";
import { AuthStorage, type IAuthStorage } from "@/data/storage/auth";
import { UserStorage, type IUserStorage } from "@/data/storage/user";
+1 -1
View File
@@ -3,7 +3,7 @@
import { LoginStatus } from "@/data/dto/auth";
import { AuthStorage, type IAuthStorage } from "@/data/storage/auth";
import { UserStorage, type IUserStorage } from "@/data/storage/user";
import { Result, type Result as ResultT } from "@/utils";
import { Result, type Result as ResultT } from "@/utils/result";
export type ChatCacheIdentityResolver = () => Promise<ResultT<string>>;
@@ -3,7 +3,7 @@
import { ChatMessage } from "@/data/dto/chat";
import type { UnlockedPrivateMessageLocalPatch } from "@/data/repositories/interfaces";
import { LocalChatStorage, LocalMessage } from "@/data/storage/chat";
import { Result } from "@/utils";
import { Result } from "@/utils/result";
import {
resolveChatCacheOwnerKey,
@@ -6,7 +6,8 @@ import {
type LocalChatMediaRow,
} from "@/data/storage/chat";
import { requestBrowserPersistentStorageOnce } from "@/lib/browser/persistent_storage";
import { Logger, Result } from "@/utils";
import { Logger } from "@/utils/logger";
import { Result } from "@/utils/result";
import type {
CacheRemoteChatMediaInput,
ChatMediaLookupInput,
@@ -10,7 +10,7 @@ import {
} from "@/data/dto/chat";
import type { ChatApi } from "@/data/services/api";
import type { UnlockPrivateMessageInput } from "@/data/repositories/interfaces";
import { Result } from "@/utils";
import { Result } from "@/utils/result";
export class ChatRemoteDataSource {
constructor(private readonly api: ChatApi) {}
+1 -1
View File
@@ -20,7 +20,7 @@ import type {
UnlockPrivateMessageInput,
UnlockedPrivateMessageLocalPatch,
} from "@/data/repositories/interfaces";
import type { Result } from "@/utils";
import type { Result } from "@/utils/result";
import { ChatLocalMessageStore } from "./chat_local_message_store";
import { ChatMediaCacheCoordinator } from "./chat_media_cache_coordinator";
@@ -13,7 +13,7 @@
*
*/
import type { Result } from "@/utils";
import type { Result } from "@/utils/result";
import type {
GuestLoginResponse,
LoginStatus,
@@ -6,7 +6,7 @@
* 聚合聊天远程操作、身份隔离的本地历史,以及媒体缓存能力。
*/
import type { Result } from "@/utils";
import type { Result } from "@/utils/result";
import type {
ChatHistoryResponse,
ChatMediaKind,
@@ -9,7 +9,7 @@
*
*/
import type { Result } from "@/utils";
import type { Result } from "@/utils/result";
export interface IMetricsRepository {
/** 上报 PWA 事件。自动注入当前秒级时间戳。 */
@@ -4,7 +4,7 @@
* IUserRepository 接口
*/
import type { Result } from "@/utils";
import type { Result } from "@/utils/result";
import type {
User,
UserEntitlements,
+1 -1
View File
@@ -7,7 +7,7 @@
*/
import { MetricsApi, metricsApi } from "@/data/services/api";
import { AppEvent, PwaEvent } from "@/data/dto/metrics";
import { Result } from "@/utils";
import { Result } from "@/utils/result";
import type { IMetricsRepository } from "@/data/repositories/interfaces";
import { createLazySingleton } from "./lazy_singleton";
+1 -1
View File
@@ -4,7 +4,7 @@ import {
User,
UserEntitlements,
} from "@/data/dto/user";
import { Result } from "@/utils";
import { Result } from "@/utils/result";
import type { IUserRepository } from "@/data/repositories/interfaces";
import { createLazySingleton } from "./lazy_singleton";
@@ -3,7 +3,9 @@ import { createStorage } from "unstorage";
import memoryDriver from "unstorage/drivers/memory";
import { AuthStorage } from "@/data/storage/auth";
import { deviceIdentifier, Result, SpAsyncUtil } from "@/utils";
import { deviceIdentifier } from "@/utils/device_identifier";
import { Result } from "@/utils/result";
import { SpAsyncUtil } from "@/utils/storage";
import { ErrorCode } from "../api_result";
import { createHttpClient } from "../http_client";
+1 -1
View File
@@ -27,7 +27,7 @@ import {
} from "@/data/dto/auth";
import { User } from "@/data/dto/user";
import type { UserData } from "@/data/schemas/user/user";
import { Logger } from "@/utils";
import { Logger } from "@/utils/logger";
const log = new Logger("DataServicesApiAuthApi");
+2 -1
View File
@@ -12,7 +12,8 @@
* - 不需要 appId / appSecretaccessToken 自身就是凭证)
*/
import { FacebookUserData } from "@/data/dto/auth";
import { Logger, Result, toError } from "@/utils";
import { Logger } from "@/utils/logger";
import { Result, toError } from "@/utils/result";
const log = new Logger("FacebookGraph");
@@ -4,7 +4,7 @@ import memoryDriver from "unstorage/drivers/memory";
import { StorageKeys } from "@/data/storage/storage_keys";
import { runStorageMigrations } from "@/data/storage/storage_migration";
import { SpAsyncUtil } from "@/utils";
import { SpAsyncUtil } from "@/utils/storage";
describe("runStorageMigrations", () => {
beforeEach(() => {
+2 -1
View File
@@ -12,7 +12,8 @@
* PWA 对话框使用布尔标记;每日上报类方法仍使用 `yyyy-MM-dd` 字符串比对。
*/
import { Result, type Result as ResultT, SpAsyncUtil } from "@/utils";
import { Result, type Result as ResultT } from "@/utils/result";
import { SpAsyncUtil } from "@/utils/storage";
import { StorageKeys } from "../storage_keys";
export class AppStorage {
+2 -1
View File
@@ -1,7 +1,8 @@
"use client";
import { LoginStatus, type LoginStatus as LoginStatusT } from "@/data/dto/auth";
import { Result, type Result as ResultT, SpAsyncUtil } from "@/utils";
import { Result, type Result as ResultT } from "@/utils/result";
import { SpAsyncUtil } from "@/utils/storage";
import { StorageKeys } from "../storage_keys";
import type { IAuthStorage } from "./iauth_storage";
+1 -1
View File
@@ -10,7 +10,7 @@
* - 所有方法返回 `Promise<Result<T>>`,与 Dart `Future<Result<T>>` 对齐
*/
import type { Result } from "@/utils";
import type { Result } from "@/utils/result";
import type { LoginStatus } from "@/data/dto/auth";
export interface IAuthStorage {
@@ -1,6 +1,6 @@
"use client";
import { Result, type Result as ResultT } from "@/utils";
import { Result, type Result as ResultT } from "@/utils/result";
import type { ChatMediaKind } from "@/data/dto/chat";
import {
+1 -1
View File
@@ -9,7 +9,7 @@
*
*/
import { Result, type Result as ResultT } from "@/utils";
import { Result, type Result as ResultT } from "@/utils/result";
import { LocalChatDB } from "./local_chat_db";
import { LocalMessage } from "./local_message";
@@ -2,7 +2,7 @@ import { beforeEach, describe, expect, it, vi } from "vitest";
import { createStorage } from "unstorage";
import memoryDriver from "unstorage/drivers/memory";
import { SessionAsyncUtil } from "@/utils";
import { SessionAsyncUtil } from "@/utils/session-storage";
import { NavigationStorage } from "../navigation_storage";
@@ -4,7 +4,8 @@ import { z } from "zod";
import { StorageKeys } from "@/data/storage/storage_keys";
import { ChatLockTypeSchema } from "@/data/schemas/chat";
import { Result, SessionAsyncUtil } from "@/utils";
import { Result } from "@/utils/result";
import { SessionAsyncUtil } from "@/utils/session-storage";
const MAX_AGE_MS = 30 * 60 * 1000;
@@ -4,7 +4,8 @@ import {
PaymentPlansResponseSchema,
type PaymentPlansResponseData,
} from "@/data/schemas/payment";
import { type Result as ResultT, SpAsyncUtil } from "@/utils";
import { type Result as ResultT } from "@/utils/result";
import { SpAsyncUtil } from "@/utils/storage";
import { StorageKeys } from "../storage_keys";
@@ -2,7 +2,8 @@
import { z } from "zod";
import { Result, type Result as ResultT, SpAsyncUtil } from "@/utils";
import { Result, type Result as ResultT } from "@/utils/result";
import { SpAsyncUtil } from "@/utils/storage";
import { StorageKeys } from "../storage_keys";
+2 -1
View File
@@ -1,6 +1,7 @@
"use client";
import { Result, type Result as ResultT, SpAsyncUtil } from "@/utils";
import { Result, type Result as ResultT } from "@/utils/result";
import { SpAsyncUtil } from "@/utils/storage";
import { StorageKeys } from "./storage_keys";
@@ -4,7 +4,7 @@ import memoryDriver from "unstorage/drivers/memory";
import { StorageKeys } from "@/data/storage/storage_keys";
import { UserStorage } from "@/data/storage/user/user_storage";
import { SpAsyncUtil } from "@/utils";
import { SpAsyncUtil } from "@/utils/storage";
describe("UserStorage", () => {
beforeEach(() => {
+1 -1
View File
@@ -11,7 +11,7 @@
* profile localStorage
*/
import type { Result } from "@/utils";
import type { Result } from "@/utils/result";
import type { UserEntitlementSnapshotData } from "@/data/schemas/user/user_entitlement_snapshot";
import type {
PersistedUserData,
+2 -1
View File
@@ -24,7 +24,8 @@ import {
type PersistedUserData,
type PersistedUserInput,
} from "@/data/schemas/user/persisted_user";
import { type Result as ResultT, SpAsyncUtil } from "@/utils";
import { type Result as ResultT } from "@/utils/result";
import { SpAsyncUtil } from "@/utils/storage";
import { StorageKeys } from "../storage_keys";
import type { IUserStorage } from "./iuser_storage";
+2 -1
View File
@@ -1,4 +1,5 @@
import { BrowserDetector, PlatformDetector } from "@/utils";
import { BrowserDetector } from "@/utils/browser-detect";
import { PlatformDetector } from "@/utils/platform-detect";
import type { KeyboardAdaptEnvironment } from "./types";
+1 -1
View File
@@ -14,7 +14,7 @@
*/
import { useEffect } from "react";
import { Logger } from "@/utils";
import { Logger } from "@/utils/logger";
import {
FALLBACK_INPUT_LIFT_PX,
+1 -1
View File
@@ -9,7 +9,7 @@
*
* Web Speech API Chrome / Edge Safari / Firefox
*/
import { Result } from "@/utils";
import { Result } from "@/utils/result";
export interface SpeechRecognitionResultEvent {
transcript: string;
+1 -1
View File
@@ -2,7 +2,7 @@ import { describe, expect, it, vi } from "vitest";
import type { IAuthStorage } from "@/data/storage/auth";
import { LoginStatus } from "@/data/dto/auth";
import { Result } from "@/utils";
import { Result } from "@/utils/result";
import { hasCompleteBusinessAuthSession } from "../auth_session";
+1 -1
View File
@@ -1,6 +1,6 @@
"use client";
import { Logger } from "@/utils";
import { Logger } from "@/utils/logger";
const log = new Logger("LibBrowserPersistentStorage");
let storagePersistenceRequested = false;
@@ -1,6 +1,6 @@
import { beforeEach, describe, expect, it, vi } from "vitest";
import { Result } from "@/utils";
import { Result } from "@/utils/result";
const getHistoryMock = vi.hoisted(() => vi.fn());
+1 -1
View File
@@ -3,7 +3,7 @@
import { AuthStorage } from "@/data/storage/auth/auth_storage";
import { UserStorage } from "@/data/storage/user/user_storage";
import { ROUTES } from "@/router/routes";
import { UrlLauncherUtil } from "@/utils";
import { UrlLauncherUtil } from "@/utils/url-launcher-util";
export async function openChatInExternalBrowser(): Promise<void> {
const authStorage = AuthStorage.getInstance();
+1 -1
View File
@@ -2,7 +2,7 @@
import type { ChatMediaKind } from "@/data/dto/chat";
import { getChatRepository } from "@/data/repositories/chat_repository";
import { Result, type Result as ResultT } from "@/utils";
import { Result, type Result as ResultT } from "@/utils/result";
import { localChatMediaRowToBlob } from "./chat_media_blob";
+1 -1
View File
@@ -5,7 +5,7 @@ import {
resolveChatCacheOwnerKey,
type ChatCacheIdentityResolver,
} from "@/data/repositories/chat_cache_identity";
import { Result, type Result as ResultT } from "@/utils";
import { Result, type Result as ResultT } from "@/utils/result";
import type { SplashLatestMessageCache } from "./splash_latest_message_cache";
import { getLatestSplashMessagePreview } from "./splash_latest_message_preview";
+4 -1
View File
@@ -3,7 +3,10 @@
import { useEffect, useRef, useState } from "react";
import type { ChatMediaKind } from "@/data/dto/chat";
import { BrowserDetector, Logger, PlatformDetector, Result } from "@/utils";
import { BrowserDetector } from "@/utils/browser-detect";
import { Logger } from "@/utils/logger";
import { PlatformDetector } from "@/utils/platform-detect";
import { Result } from "@/utils/result";
import {
cacheRemoteChatMediaBlob,
+2 -1
View File
@@ -1,6 +1,7 @@
"use client";
import { Logger, Result } from "@/utils";
import { Logger } from "@/utils/logger";
import { Result } from "@/utils/result";
import {
savePendingEzpayOrder,
+2 -2
View File
@@ -3,13 +3,13 @@
import {
PendingPaymentOrderStorage,
type PendingPaymentOrder,
} from "@/data/storage";
} from "@/data/storage/payment/pending_payment_order_storage";
import { ROUTES } from "@/router/routes";
import {
DEFAULT_TIP_COFFEE_TYPE,
TIP_COFFEE_TYPE_PARAM,
} from "@/lib/tip/tip_coffee";
import type { Result } from "@/utils";
import type { Result } from "@/utils/result";
export type PendingPaymentSubscriptionType =
PendingPaymentOrder["subscriptionType"];
+3 -1
View File
@@ -2,7 +2,9 @@
import { useEffect, type ReactNode } from "react";
import { BrowserDetector, Logger, PlatformDetector } from "@/utils";
import { BrowserDetector } from "@/utils/browser-detect";
import { Logger } from "@/utils/logger";
import { PlatformDetector } from "@/utils/platform-detect";
const CSS_VAR_VIEWPORT_HEIGHT = "--app-viewport-height";
const CSS_VAR_VISIBLE_HEIGHT = "--app-visible-height";
+3 -1
View File
@@ -9,7 +9,9 @@ import { getAuthRepository } from "@/data/repositories/auth_repository";
import { fetchFacebookUserData } from "@/data/services";
import { AuthStorage } from "@/data/storage/auth/auth_storage";
import { UserStorage } from "@/data/storage/user/user_storage";
import { deviceIdentifier, Logger, Result } from "@/utils";
import { deviceIdentifier } from "@/utils/device_identifier";
import { Logger } from "@/utils/logger";
import { Result } from "@/utils/result";
import { hasCompleteBusinessAuthSession } from "@/lib/auth/auth_session";
import { readGuestId, readPsid } from "./auth-helpers";
+2 -2
View File
@@ -10,9 +10,9 @@
*/
import { useEffect } from "react";
import { runStorageMigrations } from "@/data/storage";
import { runStorageMigrations } from "@/data/storage/storage_migration";
import { useAuthDispatch } from "./auth-context";
import { Logger } from "@/utils";
import { Logger } from "@/utils/logger";
const log = new Logger("StoresAuthAuthStatusChecker");
+1 -1
View File
@@ -1,6 +1,6 @@
import { fromCallback } from "xstate";
import { Logger } from "@/utils";
import { Logger } from "@/utils/logger";
import {
readLocalHistorySnapshot,
+3 -1
View File
@@ -1,7 +1,9 @@
import type { UiMessage } from "@/data/dto/chat";
import { resolveChatCacheOwnerKey } from "@/data/repositories/chat_cache_identity";
import { getChatRepository } from "@/data/repositories/chat_repository";
import { Logger, Result, todayString } from "@/utils";
import { Logger } from "@/utils/logger";
import { Result } from "@/utils/result";
import { todayString } from "@/utils/date";
import {
CHAT_HISTORY_LIMIT,
+2 -1
View File
@@ -1,4 +1,5 @@
import { Logger, todayString } from "@/utils";
import { Logger } from "@/utils/logger";
import { todayString } from "@/utils/date";
import { chatAssign, type ChatActionArgs } from "./chat-flow-actions";
import { beginPendingReply } from "./chat-machine.helpers";
+1 -1
View File
@@ -1,6 +1,6 @@
import { type ChatSendResponse, type UiMessage } from "@/data/dto/chat";
import type { ChatLockDetailData } from "@/data/schemas/chat";
import { todayString } from "@/utils";
import { todayString } from "@/utils/date";
/**
* ChatMessage[] -> UiMessage[].
+1 -1
View File
@@ -1,6 +1,6 @@
import type { UiMessage } from "@/data/dto/chat";
import type { PendingChatPromotion } from "@/data/storage/navigation";
import { todayString } from "@/utils";
import { todayString } from "@/utils/date";
import {
applySingleUnlockOutput,
+3 -1
View File
@@ -5,7 +5,9 @@ import { MessageQueue } from "@/core/net/message-queue";
import type { ChatSendResponse } from "@/data/dto/chat";
import { getChatRepository } from "@/data/repositories/chat_repository";
import { resolveChatCacheOwnerKey } from "@/data/repositories/chat_cache_identity";
import { Logger, Result, todayString } from "@/utils";
import { Logger } from "@/utils/logger";
import { Result } from "@/utils/result";
import { todayString } from "@/utils/date";
import type { ChatEvent } from "./chat-events";
import {
+2 -1
View File
@@ -2,7 +2,8 @@ import { fromPromise } from "xstate";
import { getChatRepository } from "@/data/repositories/chat_repository";
import { resolveChatCacheOwnerKey } from "@/data/repositories/chat_cache_identity";
import { Logger, Result } from "@/utils";
import { Logger } from "@/utils/logger";
import { Result } from "@/utils/result";
import {
chatAssign,
+1 -1
View File
@@ -10,7 +10,7 @@ import {
PaymentPlansResponse,
} from "@/data/dto/payment";
import { getPaymentRepository } from "@/data/repositories/payment_repository";
import { Result } from "@/utils";
import { Result } from "@/utils/result";
import type { PaymentPlanCatalog } from "./payment-state";
@@ -5,7 +5,7 @@ import type {
PrivateAlbumUnlockResponse,
} from "@/data/dto/private-room";
import { getPrivateRoomRepository } from "@/data/repositories/private_room_repository";
import { Result } from "@/utils";
import { Result } from "@/utils/result";
import {
PRIVATE_ROOM_CHARACTER,
+1 -1
View File
@@ -16,7 +16,7 @@ import { fromPromise } from "xstate";
import { getUserRepository } from "@/data/repositories/user_repository";
import { getAuthRepository } from "@/data/repositories/auth_repository";
import { Result } from "@/utils";
import { Result } from "@/utils/result";
import {
applyEntitlementSnapshotToView,
+1 -1
View File
@@ -16,7 +16,7 @@
import type { UserView } from "@/data/dto/user";
import type { UserEntitlementSnapshotData } from "@/data/schemas/user";
import { UserStorage } from "@/data/storage/user/user_storage";
import { Result } from "@/utils";
import { Result } from "@/utils/result";
// ============================================================
// Storage singleton