import React from 'react'; import * as react_jsx_runtime from 'react/jsx-runtime'; type HotUpdaterPlatform = 'ios' | 'android'; interface OtaManifestRelease { bundleId: string; appVersion: string; minNativeVersion: string; force?: boolean; disabled?: boolean; notes?: string; url: string; sha256?: string; size?: number; } interface OtaManifest { schemaVersion: number; platform: HotUpdaterPlatform; channel: string; updatedAt: string; release?: OtaManifestRelease | null; } interface HotUpdaterTexts { checkingTitle: string; updatingTitle: string; preparingTitle: string; forceUpdatingTitle: string; upToDateTitle: string; upToDateMessage: string; checkFailedTitle: string; checkFailedMessage: string; downloadedReadyTitle: string; downloadedCompletedTitle: string; downloadedMessage: string; forceUpdateCompletedMessage: string; updateDownloadFailedMessage: string; releaseOnlyMessage: string; restartNowText: string; restartLaterText: string; launchPreparingMessage: string; launchForceUpdatingMessage: string; launchForceUpdateFailedMessage: string; launchForceUpdateCompletedMessage: string; launchOptionalUpdateReadyMessage: string; launchBackgroundUpdateFailedMessage: string; launchCheckFailedMessage: string; } interface HotUpdaterCheckParams { platform: HotUpdaterPlatform; appVersion: string; channel: string; bundleId: string; minBundleId: string; requestHeaders?: Record; } interface HotUpdaterUpdateInfo { id: string; shouldForceUpdate: boolean; status: 'UPDATE'; fileUrl: string; fileHash: string | null; message: string | null; } type HotUpdaterManualResult = { status: 'up-to-date'; message: string; } | { status: 'downloaded'; message: string; shouldReload: boolean; } | { status: 'error'; message: string; }; interface HotUpdaterSummary { appVersion: string; channel: string; platform: HotUpdaterPlatform; manifestSource: string; } interface HotUpdaterClient { getSummary: () => HotUpdaterSummary; getTexts: () => HotUpdaterTexts; checkManually: () => Promise; checkManuallyAndPrompt: (promptOptions?: ManualPromptOptions) => Promise; previewManifest: () => Promise; prepareLaunch: (options?: PrepareHotUpdaterLaunchOptions) => Promise; reload: () => Promise; } interface HotUpdaterContextValue { summary: HotUpdaterSummary; manifest: OtaManifest | null; isRefreshingManifest: boolean; refreshManifest: () => Promise; checkForUpdates: () => Promise; startLaunchUpdateCheck: () => Promise; launchUpdateState: { phase: 'idle' | 'checking' | 'updating-force' | 'ready' | 'error'; message: string | null; progress: number; }; reload: () => Promise; } interface OptionalUpdatePromptContext { message: string; titles: { downloadedTitle: string; restartNowText: string; restartLaterText: string; }; actions: { reload: () => Promise; markPending: () => void; }; } interface HotUpdaterLaunchState { phase: 'idle' | 'checking' | 'updating-force' | 'ready' | 'error'; message: string | null; } interface PrepareHotUpdaterLaunchOptions { downloadOptionalUpdateInBackground?: boolean; onStateChange?: (state: HotUpdaterLaunchState) => void; onOptionalUpdateReady?: (result: { message: string; shouldReload: boolean; }) => void; onError?: (error: Error) => void; } interface PrepareHotUpdaterLaunchResult { status: 'ready' | 'reloading' | 'error'; message: string | null; shouldPromptReload?: boolean; } interface ManifestProviderContext extends HotUpdaterCheckParams { } type ManifestProvider = (context: ManifestProviderContext) => Promise; interface CreateHotUpdaterOptions { appVersion?: string; defaultChannel?: string; getChannel?: () => string; getManifest: ManifestProvider; texts?: Partial; describeManifestSource?: (context: { platform: HotUpdaterPlatform; channel: string; }) => string; } interface CreateOssHotUpdaterOptions { manifestBaseURL: string; appVersion?: string; defaultChannel?: string; getChannel?: () => string; requestHeaders?: Record; texts?: Partial; } interface WrapAppOptions { reloadOnForceUpdate?: boolean; updateMode?: 'auto' | 'manual'; defaultUI?: DefaultHotUpdaterUIOptions; fallbackComponent?: React.FC<{ status: string; progress: number; message: string | null; }>; onError?: (error: Error | unknown) => void; onUpdateProcessCompleted?: (result: { status: 'ROLLBACK' | 'UPDATE' | 'UP_TO_DATE'; shouldForceUpdate: boolean; message: string | null; id: string; }) => void; } interface ManualPromptOptions { upToDateTitle?: string; upToDateMessage?: string; errorTitle?: string; downloadedTitle?: string; restartNowText?: string; restartLaterText?: string; promptHandler?: (context: ManualPromptContext) => Promise | void; } interface ManualPromptContext { result: HotUpdaterManualResult; titles: { upToDateTitle: string; upToDateMessage?: string; errorTitle: string; downloadedTitle: string; restartNowText: string; restartLaterText: string; }; actions: { reload: () => Promise; }; } interface DefaultHotUpdaterUIOptions { backgroundColor?: string; spinnerColor?: string; titleColor?: string; messageColor?: string; progressColor?: string; checkingTitle?: string; updatingTitle?: string; texts?: Partial; } interface DefaultHotUpdaterLaunchUIOptions { backgroundColor?: string; spinnerColor?: string; titleColor?: string; messageColor?: string; preparingTitle?: string; forceUpdatingTitle?: string; texts?: Partial; } interface CreateHotUpdaterContextOptions { autoRefreshManifestOnMount?: boolean; optionalUpdatePromptHandler?: (context: OptionalUpdatePromptContext) => Promise | void; manualPromptHandler?: (context: ManualPromptContext) => Promise | void; } interface ResolveUpdateDecision { update: HotUpdaterUpdateInfo | null; reason: 'manifest-missing' | 'release-missing' | 'platform-mismatch' | 'channel-mismatch' | 'app-version-mismatch' | 'min-native-version-not-satisfied' | 'release-disabled' | 'bundle-already-installed' | 'update-available'; details: Record; } declare function compareVersion(left: string, right: string): 0 | 1 | -1; declare function resolveUpdateDecisionFromManifest(manifest: OtaManifest | null, params: HotUpdaterCheckParams): ResolveUpdateDecision; declare function resolveUpdateFromManifest(manifest: OtaManifest | null, params: HotUpdaterCheckParams): HotUpdaterUpdateInfo | null; declare function fetchJsonManifest(url: string, requestHeaders?: Record): Promise; type LogLevel = 'debug' | 'info' | 'warn' | 'error'; declare function hotUpdaterLogger(level: LogLevel, message: string, payload?: unknown): void; declare function flushPendingHotUpdaterLogs(): void; interface HotUpdaterProviderProps { children: React.ReactNode; optionalUpdatePromptHandler?: CreateHotUpdaterContextOptions['optionalUpdatePromptHandler']; manualPromptHandler?: CreateHotUpdaterContextOptions['manualPromptHandler']; } declare function createHotUpdaterContext(hotUpdater: HotUpdaterClient, options?: CreateHotUpdaterContextOptions): { HotUpdaterProvider: ({ children, optionalUpdatePromptHandler, manualPromptHandler, }: HotUpdaterProviderProps) => react_jsx_runtime.JSX.Element; useHotUpdaterContext: () => HotUpdaterContextValue; }; declare function createHotUpdater(options: CreateHotUpdaterOptions): { resolver: { checkUpdate: (params: ManifestProviderContext) => Promise; }; getCurrentChannel: () => string; getSummary: () => HotUpdaterSummary; getTexts: () => HotUpdaterTexts; checkManually: () => Promise; checkManuallyAndPrompt: (promptOptions?: ManualPromptOptions) => Promise; prepareLaunch: (launchOptions?: PrepareHotUpdaterLaunchOptions) => Promise; previewManifest: () => Promise; reload: () => Promise; wrapApp:

(WrappedComponent: React.ComponentType

, wrapOptions?: WrapAppOptions) => React.ComponentType

; }; declare function createOssHotUpdater(options: CreateOssHotUpdaterOptions): { resolver: { checkUpdate: (params: ManifestProviderContext) => Promise; }; getCurrentChannel: () => string; getSummary: () => HotUpdaterSummary; getTexts: () => HotUpdaterTexts; checkManually: () => Promise; checkManuallyAndPrompt: (promptOptions?: ManualPromptOptions) => Promise; prepareLaunch: (launchOptions?: PrepareHotUpdaterLaunchOptions) => Promise; previewManifest: () => Promise; reload: () => Promise; wrapApp:

(WrappedComponent: React.ComponentType

, wrapOptions?: WrapAppOptions) => React.ComponentType

; }; declare function withOssHotUpdater

(WrappedComponent: React.ComponentType

, options: CreateOssHotUpdaterOptions, wrapOptions?: WrapAppOptions): React.ComponentType

; declare function DefaultHotUpdaterFallback({ progress, status, message, ui, }: { progress: number; status: string; message?: string | null; ui?: DefaultHotUpdaterUIOptions; }): react_jsx_runtime.JSX.Element; declare function DefaultHotUpdaterLaunchFallback({ status, message, progress, ui, }: { status: 'CHECKING' | 'UPDATING'; message?: string | null; progress?: number; ui?: DefaultHotUpdaterLaunchUIOptions; }): react_jsx_runtime.JSX.Element; export { type CreateHotUpdaterContextOptions, type CreateHotUpdaterOptions, type CreateOssHotUpdaterOptions, DefaultHotUpdaterFallback, DefaultHotUpdaterLaunchFallback, type DefaultHotUpdaterLaunchUIOptions, type DefaultHotUpdaterUIOptions, type HotUpdaterCheckParams, type HotUpdaterClient, type HotUpdaterContextValue, type HotUpdaterLaunchState, type HotUpdaterManualResult, type HotUpdaterPlatform, type HotUpdaterSummary, type HotUpdaterTexts, type HotUpdaterUpdateInfo, type ManifestProvider, type ManifestProviderContext, type ManualPromptContext, type ManualPromptOptions, type OptionalUpdatePromptContext, type OtaManifest, type OtaManifestRelease, type PrepareHotUpdaterLaunchOptions, type PrepareHotUpdaterLaunchResult, type ResolveUpdateDecision, type WrapAppOptions, compareVersion, createHotUpdater, createHotUpdaterContext, createOssHotUpdater, fetchJsonManifest, flushPendingHotUpdaterLogs, hotUpdaterLogger, resolveUpdateDecisionFromManifest, resolveUpdateFromManifest, withOssHotUpdater };