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