import { NativeEventEmitter } from 'react-native'; import { Event } from './Events/Event'; import { UserProperties } from './UserProperties'; import { type NotificationClickedHandler } from './notifications/BluxNotification'; import type { NotificationForegroundWillDisplayHandler } from './notifications/NotificationForegroundWillDisplayEvent'; import type { NotificationUrlOpenOptions } from './notifications/NotificationUrlOpenOptions'; import type { InAppUrlOpenOptions } from './notifications/InAppUrlOpenOptions'; import { type InAppClickedHandler } from './notifications/BluxInApp'; export type LogLevel = 'error' | 'verbose'; export type InitializeParams = { bluxApplicationId: string; bluxAPIKey: string; requestPermissionOnLaunch: boolean; customDeviceId?: string; }; export type WebViewMessage = { nativeEvent: { data: string; }; }; /** * Custom HTML 인앱 메시지에서 `BluxBridge.triggerAction()` 호출 시 전달되는 이벤트 */ export type InAppCustomActionEvent = { /** 액션 식별자 (예: "share", "navigate") */ actionId: string; /** 액션과 함께 전달된 데이터 */ data: Record; }; /** * Custom HTML 인앱 메시지에서 `BluxBridge.triggerAction()` 호출 시 실행되는 핸들러 타입 */ export type InAppCustomActionHandler = (event: InAppCustomActionEvent) => void; declare class BluxClient { static eventEmitter: NativeEventEmitter; private static inAppCustomActionHandlers; static initialize(params: InitializeParams): Promise; static setLogLevel(level: LogLevel): Promise; static signIn({ userId }: { userId: string; }): Promise; static signOut(): Promise; static sendEvent(event: Event | Event[]): Promise; static sendEventData(events: object[]): Promise; static setUserProperties({ userProperties, }: { userProperties: UserProperties; }): Promise; static setCustomUserProperties({ customUserProperties, }: { customUserProperties: Record; }): Promise; /** * 푸시 알림 URL을 어떻게 열지 호스트 앱이 제어합니다. * * - `internalWebView` (기본값): SDK 내장 WebView로 연다 * - `externalBrowser`: 외부 브라우저로 연다 * - `none`: SDK가 자동으로 열지 않는다 ({@link setNotificationClickedHandler}에서 직접 처리) * * @example * ```typescript * await BluxClient.setNotificationUrlOpenOptions({ httpUrlOpenTarget: 'externalBrowser' }); * ``` */ static setNotificationUrlOpenOptions(options: NotificationUrlOpenOptions): Promise; /** * 앱이 포그라운드 상태일 때 푸시 알림이 표시되기 직전에 실행될 핸들러를 등록합니다. * * 핸들러 안에서 `event.display()`를 호출해야 시스템 알림이 실제로 표시됩니다. * 호출하지 않으면 시스템 알림은 표시되지 않으니, 인앱 UI로만 처리할 때 유용합니다. * * @example * ```typescript * BluxClient.setNotificationForegroundWillDisplayHandler(async (event) => { * await event.display(); * }); * ``` */ static setNotificationForegroundWillDisplayHandler(handler: NotificationForegroundWillDisplayHandler): Promise; /** * 푸시 알림 클릭 시 실행될 핸들러를 등록합니다. * * 등록 이전에 클릭된 알림이 있으면 등록 직후 즉시 핸들러로 전달됩니다. * * @example * ```typescript * BluxClient.setNotificationClickedHandler((notification) => { * if (notification.url) myRouter.go(notification.url); * }); * ``` */ static setNotificationClickedHandler(handler: NotificationClickedHandler): Promise; /** * 인앱 메시지 URL을 어떻게 열지 호스트 앱이 제어합니다. * * - `internalWebView` (기본값): SDK 내장 WebView로 연다 * - `externalBrowser`: 외부 브라우저로 연다 * - `none`: SDK가 자동으로 열지 않는다 * * @example * ```typescript * await BluxClient.setInAppUrlOpenOptions({ httpUrlOpenTarget: 'externalBrowser' }); * ``` */ static setInAppUrlOpenOptions(options: InAppUrlOpenOptions): Promise; /** * 인앱 메시지의 http/https 링크 클릭을 호스트 앱이 직접 처리하도록 콜백을 등록합니다. * * 등록되어 있으면 SDK는 클릭된 URL을 자동으로 열지 않고 콜백만 호출합니다. * (클릭 트래킹과 인앱 dismiss는 정상 수행) * 등록되어 있지 않으면 {@link setInAppUrlOpenOptions} 정책이 적용됩니다. * * Custom HTML 인앱의 `BluxBridge.triggerAction()` 처리에는 영향을 주지 않습니다. * Custom HTML에서 호스트 라우팅을 받고 싶다면 {@link addInAppCustomActionHandler}를 사용하세요. * * @example * ```typescript * BluxClient.setInAppClickedHandler((inApp) => { * if (inApp.url) myRouter.go(inApp.url); * }); * ``` */ static setInAppClickedHandler(handler: InAppClickedHandler): Promise; /** * Custom HTML 인앱 메시지에서 `BluxBridge.triggerAction()` 호출 시 실행될 핸들러를 등록합니다. * * 여러 핸들러를 등록할 수 있으며 등록 순서대로 실행됩니다. * 반환된 unsubscribe 함수를 호출하면 등록한 핸들러만 제거됩니다. * * @returns 등록한 핸들러를 제거하는 unsubscribe 함수 * * @example * ```typescript * const unsubscribe = BluxClient.addInAppCustomActionHandler((event) => { * if (event.actionId === 'share') { * // 공유 로직 * } else if (event.actionId === 'navigate') { * const { screen, id } = event.data; * } * }); * * unsubscribe(); * ``` */ static addInAppCustomActionHandler(handler: InAppCustomActionHandler): () => void; /** * 현재 표시 중인 인앱 메시지를 프로그래밍 방식으로 닫습니다. * * Custom HTML 인앱에서 async 핸들러 완료 후 수동으로 닫을 때 사용합니다. * * @example * ```typescript * BluxClient.addInAppCustomActionHandler(async (event) => { * if (event.actionId === 'share') { * await Share.share({ message: event.data.url }); * BluxClient.dismissInApp(); * } * }); * * // HTML에서 shouldDismiss: false로 호출 * // BluxBridge.triggerAction('share', { url: '...' }, false); * ``` */ static dismissInApp(): void; static onMessage(message: WebViewMessage | string): Promise; } export default BluxClient; export * from './Events'; export * from './UserProperties'; export type { BluxNotification, NotificationClickedHandler, } from './notifications/BluxNotification'; export type { NotificationForegroundWillDisplayEvent, NotificationForegroundWillDisplayHandler, } from './notifications/NotificationForegroundWillDisplayEvent'; export type { HttpUrlOpenTarget } from './notifications/HttpUrlOpenTarget'; export type { NotificationUrlOpenOptions } from './notifications/NotificationUrlOpenOptions'; export type { InAppUrlOpenOptions } from './notifications/InAppUrlOpenOptions'; export type { BluxInApp, InAppClickedHandler } from './notifications/BluxInApp'; //# sourceMappingURL=index.d.ts.map