import { APIs } from "./apis/APIs.js"; import { EventRequest } from "./events/types.js"; import { BridgePlatform } from "./bridges/Bridge.js"; import { Event } from "./events/Event.js"; import { CategoryRec, ItemRec, ItemsRec, UserRec } from "./recs/ItemRec.js"; import { LogLevel } from "./utils/Logger.js"; import { BehaviorSubject, Subject } from "rxjs"; //#region src/BluxClient.d.ts type BluxUser = { id: string; bluxAPIKey: string; applicationId: string; deviceId: string; userId?: string; }; type BridgeOptions = { /** * @deprecated `bridgePlatform`을 사용하세요. */ useRNBridge?: boolean; } | { bridgePlatform?: BridgePlatform; }; type ApiRequestQueueJob = { action: () => Promise; resolve: (value: T) => void; reject: (error: unknown) => void; }; type UserPropertiesQueueItem = { userProperties?: APIs.bluxUsersUpdateProperties.Body["user_properties"]; customUserProperties?: APIs.bluxUsersUpdateProperties.Body["custom_user_properties"]; resolve: () => void; reject: (error: unknown) => void; }; /** * 인앱 메시지에서 BluxBridge.triggerAction() 호출 시 전달되는 이벤트 */ type InAppCustomActionEvent = { /** 액션 식별자 */actionId: string; /** 액션에 전달된 데이터 */ data: Record; }; /** * 인앱 커스텀 액션 핸들러 타입 */ type InAppCustomActionHandler = (event: InAppCustomActionEvent) => void | Promise; type GetNotificationsResult = { notifications: { id: string; title: string; body: string; imageUrl?: string; url?: string; sentAt: string; }[]; nextCursor?: string; }; declare class BluxClient { private readonly api; private readonly sdkInfo; readonly bluxUser$: BehaviorSubject; /** * 내부 async 작업을 1개씩 직렬로 처리하는 큐입니다. * `enqueueRequest()`로 넣으면, 호출자는 완료 시점까지 `await` 할 수 있습니다. */ readonly apiRequestQueue$: Subject>; readonly inappQueue$: BehaviorSubject<{ notificationId: string; inappId: string; htmlString: string; baseUrl: string; } | undefined>; readonly eventQueue$: Subject; readonly userPropertiesQueue$: Subject; private readonly INITIAL_NEXT_POLL_DELAY_MS; private readonly nextPollDelayMs$; private cachedNextPollDelayMs; private lastPollTimestamp; private readonly bluxApplicationId; private readonly bluxAPIKey; private readonly customDeviceId?; private readonly bridge; private impressedElements; private intersectionObservingElements; private readonly intersectionObserver; private readonly intersectionEntry$; private hitElements; private currentInappCleanup; private inAppCustomActionHandlers; private resolveBridge; constructor({ bluxApplicationId, bluxAPIKey, customDeviceId, ...bridgeOptions }: { bluxApplicationId: string; bluxAPIKey: string; customDeviceId?: string; } & BridgeOptions, completionCallback?: (args: { errorMessage?: string; success: boolean; }) => void); private enqueueRequest; private generateApiHeader; private displayInapp; private init; setLogLevel(logLevel: LogLevel): void; private getBluxUserWithTimeout; signIn({ userId }: { userId: string; }): Promise; signOut(): Promise; setUserProperties({ userProperties }: { userProperties: NonNullable; }): Promise; setCustomUserProperties({ customUserProperties }: { customUserProperties: NonNullable; }): Promise; sendEvent(event: Event | Event[]): void; /** * 현재 표시 중인 인앱 메시지를 프로그래밍 방식으로 닫습니다. * * Custom HTML 인앱에서 async 핸들러 완료 후 수동으로 닫을 때 사용합니다. * * @example * ```typescript * // BluxBridge.triggerAction('share', { url: '...' }, false); // shouldDismiss: false * // 핸들러에서 async 작업 완료 후: * bluxClient.dismissInApp(); * ``` */ dismissInApp(): void; /** * Custom HTML 인앱에서 BluxBridge.triggerAction() 호출 시 실행될 핸들러를 등록합니다. * 여러 핸들러를 등록할 수 있으며, 등록 순서대로 실행됩니다. * * @param handler - 커스텀 액션 핸들러 함수 * @returns 핸들러를 제거하는 unsubscribe 함수 * * @example * ```typescript * const unsubscribe = bluxClient.addInAppCustomActionHandler(async (event) => { * if (event.actionId === 'share') { * await navigator.share({ url: event.data.url as string }); * // async 작업 완료 후 수동으로 닫기 (shouldDismiss: false로 호출한 경우) * bluxClient.dismissInApp(); * } * }); * * // 핸들러 제거 * unsubscribe(); * ``` */ addInAppCustomActionHandler(handler: InAppCustomActionHandler): () => void; private urlAndRef$; private handleUrlAndRef; private registerImpressionTracker; private registerHitTracker; getUserRec(rec: UserRec): Promise; getItemRec(rec: ItemRec): Promise; getItemsRec(rec: ItemsRec): Promise; getNotifications(params?: { limit?: number; fromSentAt?: string | Date; toSentAt?: string | Date; cursor?: string; }): Promise; getCategoryRec(rec: CategoryRec): Promise; } //#endregion export { BluxClient, GetNotificationsResult }; //# sourceMappingURL=BluxClient.d.ts.map