connectbase-client 4.0.0 → 4.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -4440,6 +4440,27 @@ declare global {
4440
4440
  }
4441
4441
  interface NativeBridgeInterface {
4442
4442
  platform?: "electron" | "react-native" | "ios" | "android";
4443
+ /** 실행 OS (react-native: 'ios' | 'android', electron: process.platform) */
4444
+ os?: string;
4445
+ /** 네이티브 셸에서 실행 중인지 (패키징 앱이면 항상 true) */
4446
+ isNative?: boolean;
4447
+ /** 브릿지 원시 호출 (문서화되지 않은 타입 호출용) */
4448
+ call?: (type: string, payload?: unknown, options?: {
4449
+ timeoutMs?: number;
4450
+ }) => Promise<unknown>;
4451
+ app?: {
4452
+ getVersion?: () => Promise<string>;
4453
+ getName?: () => Promise<string>;
4454
+ getInfo?: () => Promise<NativeAppInfo>;
4455
+ getPath?: (name: string) => Promise<string | null>;
4456
+ reload?: () => Promise<void>;
4457
+ quit?: () => Promise<void>;
4458
+ };
4459
+ browser?: {
4460
+ openExternal: (url: string) => Promise<{
4461
+ success: boolean;
4462
+ }>;
4463
+ };
4443
4464
  camera?: {
4444
4465
  takePicture: (options?: CameraOptions) => Promise<ImageResult>;
4445
4466
  pickImage: (options?: PickImageOptions) => Promise<ImageResult[]>;
@@ -4455,6 +4476,9 @@ interface NativeBridgeInterface {
4455
4476
  scheduleLocal: (options: LocalNotificationOptions) => Promise<{
4456
4477
  notificationId: string;
4457
4478
  }>;
4479
+ setBadgeCount?: (count: number) => Promise<{
4480
+ success: boolean;
4481
+ }>;
4458
4482
  };
4459
4483
  speech?: {
4460
4484
  recognize: (options?: SpeechRecognizeOptions) => Promise<SpeechResult>;
@@ -4497,12 +4521,6 @@ interface NativeBridgeInterface {
4497
4521
  rewarded: boolean;
4498
4522
  }>;
4499
4523
  };
4500
- app?: {
4501
- getVersion: () => Promise<string>;
4502
- getName: () => Promise<string>;
4503
- getPath: (name: string) => Promise<string | null>;
4504
- quit: () => Promise<void>;
4505
- };
4506
4524
  system?: {
4507
4525
  getInfo: () => Promise<SystemInfo>;
4508
4526
  getMemory: () => Promise<MemoryInfo>;
@@ -4592,10 +4610,34 @@ interface NativeBridgeInterface {
4592
4610
  saveToGallery?: (uri: string) => Promise<{
4593
4611
  uri: string;
4594
4612
  }>;
4613
+ /** 모바일: 앱 문서/캐시 디렉터리 URI */
4614
+ getDirectories?: () => Promise<{
4615
+ document: string | null;
4616
+ cache: string | null;
4617
+ }>;
4618
+ /** 데스크톱: 접근이 허용된 앱 전용 데이터 폴더 */
4619
+ getAppDir?: () => Promise<string>;
4595
4620
  };
4596
4621
  onDeepLink?: (callback: (url: string) => void) => () => void;
4597
4622
  }
4598
4623
  type Platform = "web" | "mobile" | "desktop";
4624
+ /** 패키징 앱 정보 (`cb.native.getAppInfo()`) */
4625
+ interface NativeAppInfo {
4626
+ platform: string;
4627
+ os?: string;
4628
+ osVersion?: string;
4629
+ arch?: string;
4630
+ appVersion?: string;
4631
+ electronVersion?: string;
4632
+ webUrl?: string;
4633
+ }
4634
+ /** 위치 추적 핸들 (`cb.native.location.watchPosition()`) */
4635
+ interface LocationWatch {
4636
+ /** 네이티브 watch 식별자 (웹 폴백에서는 geolocation watch id) */
4637
+ watchId: string;
4638
+ /** 추적 중지 */
4639
+ clear: () => Promise<void>;
4640
+ }
4599
4641
  interface CameraOptions {
4600
4642
  quality?: number;
4601
4643
  base64?: boolean;
@@ -4748,6 +4790,20 @@ declare class NativeAPI {
4748
4790
  * 현재 플랫폼 감지
4749
4791
  */
4750
4792
  getPlatform(): Platform;
4793
+ /**
4794
+ * 패키징 앱(네이티브 셸) 안에서 실행 중인지
4795
+ */
4796
+ isNativeApp(): boolean;
4797
+ /**
4798
+ * 패키징 앱 정보 조회 (웹에서는 null)
4799
+ *
4800
+ * @example
4801
+ * ```typescript
4802
+ * const info = await cb.native.getAppInfo()
4803
+ * // { platform: 'react-native', os: 'ios', appVersion: '1.0.0', webUrl: '...' }
4804
+ * ```
4805
+ */
4806
+ getAppInfo(): Promise<NativeAppInfo | null>;
4751
4807
  /**
4752
4808
  * 특정 네이티브 기능 지원 여부 확인
4753
4809
  */
@@ -4835,6 +4891,42 @@ declare class NativeAPI {
4835
4891
  * 현재 위치 가져오기
4836
4892
  */
4837
4893
  getCurrentPosition: (options?: LocationOptions) => Promise<Position>;
4894
+ /**
4895
+ * 위치 추적 시작.
4896
+ *
4897
+ * 패키징 앱(모바일)에서는 네이티브가 `nativeLocationUpdate` 이벤트로 갱신을 보내고,
4898
+ * 웹/데스크톱에서는 Geolocation `watchPosition` 을 사용한다.
4899
+ *
4900
+ * @example
4901
+ * ```typescript
4902
+ * const watch = await cb.native.location.watchPosition((pos) => console.log(pos))
4903
+ * // 나중에
4904
+ * await watch.clear()
4905
+ * ```
4906
+ */
4907
+ watchPosition: (onUpdate: (position: Position) => void, options?: LocationOptions) => Promise<LocationWatch>;
4908
+ };
4909
+ /**
4910
+ * 모바일 전용 푸시 API
4911
+ *
4912
+ * 패키징 앱은 raw 디바이스 토큰(iOS=APNS, Android=FCM)을 발급받아
4913
+ * `cb.push.registerDevice()` 로 등록해야 서버 발송이 가능하다.
4914
+ */
4915
+ push: {
4916
+ /**
4917
+ * 네이티브 디바이스 푸시 토큰 조회.
4918
+ * 웹(패키징 앱이 아닌 경우)에서는 null 을 반환한다.
4919
+ */
4920
+ getToken: () => Promise<{
4921
+ token: string;
4922
+ platform?: string;
4923
+ } | null>;
4924
+ /** 알림 권한 요청 (웹은 Web Notification 권한) */
4925
+ requestPermission: () => Promise<boolean>;
4926
+ /** 로컬 알림 예약 (패키징 앱 전용) */
4927
+ scheduleLocal: (options: LocalNotificationOptions) => Promise<string | null>;
4928
+ /** 앱 아이콘 배지 숫자 설정 (미지원 플랫폼에서는 무시) */
4929
+ setBadgeCount: (count: number) => Promise<boolean>;
4838
4930
  };
4839
4931
  /**
4840
4932
  * 크로스 플랫폼 알림 API
@@ -5174,8 +5266,30 @@ declare class OAuthAPI {
5174
5266
  }
5175
5267
 
5176
5268
  type PaymentProvider = "toss" | "stripe" | "payapp" | "paypal" | "paddle" | "dodo";
5269
+ /**
5270
+ * 자격증명 모드 — 콘솔에 등록한 테스트 키/라이브 키 중 어느 쪽으로 결제할지.
5271
+ * 프로바이더별 기본 모드는 콘솔에서 정한다.
5272
+ */
5273
+ type PaymentMode = "test" | "live";
5177
5274
  type PaymentStatus = "pending" | "ready" | "in_progress" | "done" | "canceled" | "partial_canceled" | "aborted" | "expired" | "failed";
5178
5275
  interface PreparePaymentRequest {
5276
+ payment_provider?: PaymentProvider;
5277
+ /**
5278
+ * 사용할 자격증명 모드 오버라이드(선택). 미지정 시 콘솔의 프로바이더 모드를 따른다.
5279
+ *
5280
+ * **서버에서 시크릿 키(`cb_sk_*`)로 호출할 때만 적용된다.** 브라우저에 실리는 공개 키
5281
+ * (`cb_pk_*`) 호출에서는 무시된다 — 클라이언트가 test 를 골라 실제 돈 없이 "결제 성공"을
5282
+ * 만들 수 있으면 결제 성공에 걸린 권한 부여가 통째로 우회되기 때문이다.
5283
+ */
5284
+ payment_mode?: PaymentMode;
5285
+ /**
5286
+ * MoR 단건결제용 price/product ref 오버라이드(선택).
5287
+ *
5288
+ * Dodo 처럼 checkout 이 카탈로그 상품만 참조하는 프로바이더는 임의 금액 청구에
5289
+ * pay-what-you-want 상품이 필요하다. 보통 콘솔에 저장한 기본값을 쓰므로 생략하면 되고,
5290
+ * 상품별로 세금 카테고리를 달리 할 때만 지정한다. Paddle 은 무시한다.
5291
+ */
5292
+ provider_price_ref?: string;
5179
5293
  amount: number;
5180
5294
  order_name: string;
5181
5295
  order_id?: string;
@@ -5190,6 +5304,8 @@ interface PreparePaymentResponse {
5190
5304
  amount: number;
5191
5305
  order_name: string;
5192
5306
  payment_provider: PaymentProvider;
5307
+ /** 이 결제가 사용한 자격증명 모드. */
5308
+ payment_mode: PaymentMode;
5193
5309
  customer_key: string;
5194
5310
  toss_client_key: string;
5195
5311
  success_url: string;
@@ -5262,6 +5378,8 @@ interface PaymentDetail {
5262
5378
  currency: string;
5263
5379
  status: PaymentStatus;
5264
5380
  payment_provider?: PaymentProvider;
5381
+ /** 이 결제가 사용한 자격증명 모드 (test | live). */
5382
+ payment_mode?: PaymentMode;
5265
5383
  method?: string;
5266
5384
  customer_id?: string;
5267
5385
  customer_email?: string;
@@ -5281,6 +5399,8 @@ interface PaymentDetail {
5281
5399
  interface ListPaymentsOptions {
5282
5400
  /** pending | done | canceled | failed */
5283
5401
  status?: string;
5402
+ /** test | live. 미지정 시 전체. 테스트 결제를 걸러 실매출만 보려면 "live". */
5403
+ mode?: PaymentMode;
5284
5404
  /** ISO8601(RFC3339) 시작일 필터. */
5285
5405
  startDate?: string;
5286
5406
  /** ISO8601(RFC3339) 종료일 필터. */
@@ -9518,4 +9638,4 @@ declare class ConnectBase {
9518
9638
  updateConfig(config: Partial<ConnectBaseConfig>): void;
9519
9639
  }
9520
9640
 
9521
- export { AIAPI, type AIChatRequest, type AIChatResponse, type AIChatStreamCallbacks, type AIChatStreamOptions, type AIMessage, type AISource, type AIStreamChunk, type AITool, type AIToolCall, type AIToolEvent, AUTH_MEMBER_ID_TOKEN, type AckMessagesRequest, type AdMobDailyReport, type AdMobReportResponse, type AdMobReportSummary, type AdReportResponse, type AdReportSummary, type AdmobConnectionInfo, AdsAPI, type AdsenseConnectionInfo, type AgenticSearchProgress, type AggregateResult, type AggregateStage, type AnalyticsConfig, type AnalyticsEvent, ApiError, type ApiErrorDetail, type AppStatsResponse, type ArchivePolicy, type AtomicOperator, type AtomicOperatorType, AuthError, type AuthSettingsResponse, type BackupInfo, type BatchOperation, type BatchOperationResult, type BatchSetPageMetaRequest, type BatchWriteResult, type BillingCycle, type BillingKeyResponse, type BiometricInfo, type BiometricResult, type BulkCreateResponse, type BulkError, type CPUInfo, type CancelPaymentRequest, type CancelPaymentResponse, type CancelSubscriptionRequest, type CategoryInfo, type ChangePlanPreview, type ChangePlanRequest, type Channel, type ChannelMembership, type ChannelStats, type ChargeWithBillingKeyRequest, type ChargeWithBillingKeyResponse, type ChatMessage, type ClientMessage, type ColumnSchema, type CommentListResponse, type CompleteUploadRequest, type CompleteUploadResponse, type ConfirmBillingKeyRequest, type ConfirmPaymentRequest, type ConfirmPaymentResponse, ConnectBase, type ConnectBaseConfig, type ConnectedData, type ConnectionState, type ConsentOptions, type ConsumeMessagesResponse, type ConsumeOptions, type CopyTableRequest, type CopyTableResponse, type CreateBackupRequest, type CreateChannelRequest, type CreateCheckoutSessionRequest, type CreateCheckoutSessionResponse, type CreateColumnRequest, type CreateDataRequest, type CreateDocumentRequest, type CreateFolderRequest, type CreateFolderResponse, type CreateGeoIndexRequest, type CreateIndexRequest, type CreateLobbyRequest, type CreatePlaylistRequest, type CreatePublicKeyRequest, type CreatePublicKeyResponse, type CreateRelationRequest, type CreateRolePayload, type CreateRoleResult, type CreateRoomResult, type CreateSearchIndexRequest, type CreateSecurityRuleRequest, type CreateSubscriptionRequest, type CreateTableRequest, type CreateTriggerRequest, type CreateVideoStorageRequest, type DailyReport, type DataItem, type DataType, type DatabaseChange, type DatabaseChangeMessage, type DatabaseChangeType, type DatabaseRealtimeConnectOptions, type DatabaseRealtimeFilter, type DatabaseRealtimeHandlers, type DatabaseRealtimeSubscription, type DatabaseSnapshot, type DatabaseSnapshotMessage, type DatabaseSubscribeOptions, type DeleteWhereResponse, type DeviceInfo, type DocumentResponse, type EnabledProviderInfo, type EnabledProvidersResponse, EndpointAPI, type EndpointCallInit, type ErrorHandler, type ErrorMessage, type ErrorReport, type ErrorTrackerConfig, type ErrorType, type ExportDataRequest, type ExportDataResponse, type FetchDataResponse, type FetchFilesResponse, type FetchPublicKeysResponse, type FileItem, type FileStats, GameAPI, type GameAction, type GameClientConfig, type GameConfig, GameConfigAPI, type GameConfigPatch, type GameConnectionState, type GameConnectionStatus, type GameDelta, GameError, type GameErrorCode, type GameEventHandlers, type GamePlayer, GameRoom, type GameRoomConfig, type GameRoomInfo, GameRoomTransport, type GameServerMessage, type GameServerMessageType, type GameState, type GameTransportConfig, type GenerateUploadURLByPathRequest, type GenerateUploadURLRequest, type GenerateUploadURLResponse, type GeoBoundingBox, type GeoIndex, type GeoNear, type GeoPoint, type GeoPolygon, type GeoQuery, type GeoResponse, type GeoResult, type GetAuthorizationURLResponse, type GetFileByPathResponse, type GoogleConnectionStatus, type HistoryResponse, type ICEServer, type ICEServersResponse, type ImageResult, type ImportDataRequest, type ImportDataResponse, type IndexAnalysis, type IndexRecommendation, type InitUploadResponse, type InvokeFunctionRequest, type InvokeFunctionResponse, type IssueBillingKeyRequest, type IssueBillingKeyResponse, type JoinQueueRequest, type JoinRoomRequest, type JoinRoomResponse, type KnowledgeSearchRequest, type KnowledgeSearchResponse, type KnowledgeSearchResult, type LeaderboardEntry, type LeaderboardListResponse, type LeaderboardScoreEntry, type LifecyclePolicy, type ListBillingKeysResponse, type ListDocumentsResponse, type ListPageMetasOptions, type ListPageMetasResponse, type ListPaymentsOptions, type ListSubscriptionPaymentsRequest, type ListSubscriptionPaymentsResponse, type ListSubscriptionsRequest, type ListSubscriptionsResponse, type LobbyInfo, type LobbyInvite, type LobbyMember, type LobbyVisibility, type MatchResult, type MatchmakingTicket, type MatchqueueListResponse, type MatchqueueTicket, type MemberInfoResponse, type MemberSignInRequest, type MemberSignInResponse, type MemberSignUpRequest, type MemberSignUpResponse, type MembershipTier, type MemoryInfo, type MessageHandler, type MigrateDataRequest, type MigrateDataResponse, type MoveFileRequest, type NackMessageRequest, NativeAPI, type OAuthCallbackResponse, type OAuthProvider, type OnPaymentFailure, type OpenDialogOptions, type OpenDialogResult, type PageMetaResponse, type PartyInfo, type PartyInvite, type PartyMember, type PauseSubscriptionRequest, type PaymentDetail, type PaymentListItem, type PaymentListResult, type PaymentProvider, type PaymentStatus, type PeerInfo, type Platform, type PlayerEvent, type PlayerStats, type Playlist, type PlaylistItem, type PollUntilOptions, type PongMessage, type PopulateOption, type Position, type PreparePaymentRequest, type PreparePaymentResponse, type PresenceChangeHandler, type PresenceInfo, type PresenceSetOptions, type PresenceStatus, type PresenceStatusResult, type ProrationMode, type PublicKeyItem, type PublishBatchRequest, type PublishBatchResponse, type PublishMessageRequest, type PublishMessageResponse, type PushPlatform, type PushStatsResult, type QualityProgress, type QueryOptions, type QueueInfoResponse, type QueueMessage, type ReadReceiptHandler, type ReadReceiptInfo, type RealtimeConnectOptions, type RealtimeMessage, type RegisterDeviceRequest, type RelationType, type RenameFileRequest, type RenameFileResponse, type ReplayHighlight, type ReplayInfo, type ReplayPlayerInfo, type RestoreBackupRequest, type RestoreBackupResponse, type RetentionPolicy, type RoleDetail, type RoleList, type RoleListItem, type RolePermissionItem, type RoleUserItem, RolesAPI, type RoomInfo, type RoomStaleMessage, type RoomSummary, type RoomsResponse, type SaveDialogOptions, type SaveDialogResult, type ScriptDetailResponse, type ScriptListResponse, type ScriptMeta, type ScriptVersion, type ScriptVersionListResponse, type SearchIndex, type SearchOptions, type SearchResponse, type SearchResult, type SecurityRule, type SendOptions, type SendSuperChatOptions, type SendSuperChatResponse, type ServerMessage, SessionManager, type SetPageMetaRequest, type Shorts, type ShortsListResponse, type SignalingMessage, type SignalingMessageType, type SlowQueryInfo, type SpectatorInfo, type SpectatorPlayerState, type SpectatorState, type SpeechRecognizeOptions, type SpeechResult, type StateChange, type StateChangeHandler, type StorageUploadOptions, type StorageUploadProgress, type StreamContentPart, type StreamDoneCallback, type StreamDoneData, type StreamErrorCallback, type StreamHandlers, type StreamImageURLPart, type StreamMessage, type StreamOptions, type StreamSession, type StreamTextPart, type StreamTokenCallback, type StreamToolCallCallback, type StreamToolResultCallback, type StreamURLResponse, type SubscribeOptions, type SubscribeTopicRequest, type SubscribedData, type Subscription, type SubscriptionPaymentResponse, type SubscriptionPaymentStatus, type SubscriptionResponse, type SubscriptionStatus, type SuperChat, type SuperChatType, type SystemInfo, type TTLConfig, type TableAccessLevel, type TableColumnDef, type TableIndex, type TableRelation, type TableSchema, type TableSchemaDefinition, type TokenPersistence, type TransactionRead, type TransactionResult, type TransactionWrite, type TransactionWriteResult, type TranscodeStatus, type TransportType, type Trigger, type TriggerEvent, type TriggerHandlerType, type TypingChangeHandler, type TypingInfo, type UpdateBillingKeyRequest, type UpdateChannelRequest, type UpdateColumnRequest, type UpdateCustomDataRequest, type UpdateCustomDataResponse, type UpdateDataRequest, type UpdateDocumentRequest, type UpdateLobbyRequest, type UpdatePublicKeyRequest, type UpdatePublicKeyResponse, type UpdateRolePayload, type UpdateSecurityRuleRequest, type UpdateSubscriptionRequest, type UpdateTriggerRequest, type UpdateVideoRequest, type UpdateVideoStorageRequest, type UploadByPathOptions, type UploadFileOptions, type UploadFileResponse, type UploadOptions, type UploadProgress, type VAPIDPublicKeyResponse, type ValidateResponse, type ValidationSchema, type ValidationSchemaField, type ValidationStateTransitions, type Video, type VideoComment, type VideoCompleteUploadResponse, type VideoListOptions, type VideoListResponse, VideoProcessingError, type VideoQuality, type VideoStatus, type VideoStorage, type VideoStorageListResponse, type VideoVisibility, type VoiceChannel, type VoiceMember, type WaitOptions, type WatchHistoryItem, type WebPushSubscription, type WebRTCConnectOptions, type WebRTCConnectionState, type WebRTCMode, type WhereCondition, type WhereOperator, ConnectBase as default, detectInAppBrowser, escapeToExternalBrowser, isWebTransportSupported, toCreateRoomWire };
9641
+ export { AIAPI, type AIChatRequest, type AIChatResponse, type AIChatStreamCallbacks, type AIChatStreamOptions, type AIMessage, type AISource, type AIStreamChunk, type AITool, type AIToolCall, type AIToolEvent, AUTH_MEMBER_ID_TOKEN, type AckMessagesRequest, type AdMobDailyReport, type AdMobReportResponse, type AdMobReportSummary, type AdReportResponse, type AdReportSummary, type AdmobConnectionInfo, AdsAPI, type AdsenseConnectionInfo, type AgenticSearchProgress, type AggregateResult, type AggregateStage, type AnalyticsConfig, type AnalyticsEvent, ApiError, type ApiErrorDetail, type AppStatsResponse, type ArchivePolicy, type AtomicOperator, type AtomicOperatorType, AuthError, type AuthSettingsResponse, type BackupInfo, type BatchOperation, type BatchOperationResult, type BatchSetPageMetaRequest, type BatchWriteResult, type BillingCycle, type BillingKeyResponse, type BiometricInfo, type BiometricResult, type BulkCreateResponse, type BulkError, type CPUInfo, type CancelPaymentRequest, type CancelPaymentResponse, type CancelSubscriptionRequest, type CategoryInfo, type ChangePlanPreview, type ChangePlanRequest, type Channel, type ChannelMembership, type ChannelStats, type ChargeWithBillingKeyRequest, type ChargeWithBillingKeyResponse, type ChatMessage, type ClientMessage, type ColumnSchema, type CommentListResponse, type CompleteUploadRequest, type CompleteUploadResponse, type ConfirmBillingKeyRequest, type ConfirmPaymentRequest, type ConfirmPaymentResponse, ConnectBase, type ConnectBaseConfig, type ConnectedData, type ConnectionState, type ConsentOptions, type ConsumeMessagesResponse, type ConsumeOptions, type CopyTableRequest, type CopyTableResponse, type CreateBackupRequest, type CreateChannelRequest, type CreateCheckoutSessionRequest, type CreateCheckoutSessionResponse, type CreateColumnRequest, type CreateDataRequest, type CreateDocumentRequest, type CreateFolderRequest, type CreateFolderResponse, type CreateGeoIndexRequest, type CreateIndexRequest, type CreateLobbyRequest, type CreatePlaylistRequest, type CreatePublicKeyRequest, type CreatePublicKeyResponse, type CreateRelationRequest, type CreateRolePayload, type CreateRoleResult, type CreateRoomResult, type CreateSearchIndexRequest, type CreateSecurityRuleRequest, type CreateSubscriptionRequest, type CreateTableRequest, type CreateTriggerRequest, type CreateVideoStorageRequest, type DailyReport, type DataItem, type DataType, type DatabaseChange, type DatabaseChangeMessage, type DatabaseChangeType, type DatabaseRealtimeConnectOptions, type DatabaseRealtimeFilter, type DatabaseRealtimeHandlers, type DatabaseRealtimeSubscription, type DatabaseSnapshot, type DatabaseSnapshotMessage, type DatabaseSubscribeOptions, type DeleteWhereResponse, type DeviceInfo, type DocumentResponse, type EnabledProviderInfo, type EnabledProvidersResponse, EndpointAPI, type EndpointCallInit, type ErrorHandler, type ErrorMessage, type ErrorReport, type ErrorTrackerConfig, type ErrorType, type ExportDataRequest, type ExportDataResponse, type FetchDataResponse, type FetchFilesResponse, type FetchPublicKeysResponse, type FileItem, type FileStats, GameAPI, type GameAction, type GameClientConfig, type GameConfig, GameConfigAPI, type GameConfigPatch, type GameConnectionState, type GameConnectionStatus, type GameDelta, GameError, type GameErrorCode, type GameEventHandlers, type GamePlayer, GameRoom, type GameRoomConfig, type GameRoomInfo, GameRoomTransport, type GameServerMessage, type GameServerMessageType, type GameState, type GameTransportConfig, type GenerateUploadURLByPathRequest, type GenerateUploadURLRequest, type GenerateUploadURLResponse, type GeoBoundingBox, type GeoIndex, type GeoNear, type GeoPoint, type GeoPolygon, type GeoQuery, type GeoResponse, type GeoResult, type GetAuthorizationURLResponse, type GetFileByPathResponse, type GoogleConnectionStatus, type HistoryResponse, type ICEServer, type ICEServersResponse, type ImageResult, type ImportDataRequest, type ImportDataResponse, type IndexAnalysis, type IndexRecommendation, type InitUploadResponse, type InvokeFunctionRequest, type InvokeFunctionResponse, type IssueBillingKeyRequest, type IssueBillingKeyResponse, type JoinQueueRequest, type JoinRoomRequest, type JoinRoomResponse, type KnowledgeSearchRequest, type KnowledgeSearchResponse, type KnowledgeSearchResult, type LeaderboardEntry, type LeaderboardListResponse, type LeaderboardScoreEntry, type LifecyclePolicy, type ListBillingKeysResponse, type ListDocumentsResponse, type ListPageMetasOptions, type ListPageMetasResponse, type ListPaymentsOptions, type ListSubscriptionPaymentsRequest, type ListSubscriptionPaymentsResponse, type ListSubscriptionsRequest, type ListSubscriptionsResponse, type LobbyInfo, type LobbyInvite, type LobbyMember, type LobbyVisibility, type MatchResult, type MatchmakingTicket, type MatchqueueListResponse, type MatchqueueTicket, type MemberInfoResponse, type MemberSignInRequest, type MemberSignInResponse, type MemberSignUpRequest, type MemberSignUpResponse, type MembershipTier, type MemoryInfo, type MessageHandler, type MigrateDataRequest, type MigrateDataResponse, type MoveFileRequest, type NackMessageRequest, NativeAPI, type OAuthCallbackResponse, type OAuthProvider, type OnPaymentFailure, type OpenDialogOptions, type OpenDialogResult, type PageMetaResponse, type PartyInfo, type PartyInvite, type PartyMember, type PauseSubscriptionRequest, type PaymentDetail, type PaymentListItem, type PaymentListResult, type PaymentMode, type PaymentProvider, type PaymentStatus, type PeerInfo, type Platform, type PlayerEvent, type PlayerStats, type Playlist, type PlaylistItem, type PollUntilOptions, type PongMessage, type PopulateOption, type Position, type PreparePaymentRequest, type PreparePaymentResponse, type PresenceChangeHandler, type PresenceInfo, type PresenceSetOptions, type PresenceStatus, type PresenceStatusResult, type ProrationMode, type PublicKeyItem, type PublishBatchRequest, type PublishBatchResponse, type PublishMessageRequest, type PublishMessageResponse, type PushPlatform, type PushStatsResult, type QualityProgress, type QueryOptions, type QueueInfoResponse, type QueueMessage, type ReadReceiptHandler, type ReadReceiptInfo, type RealtimeConnectOptions, type RealtimeMessage, type RegisterDeviceRequest, type RelationType, type RenameFileRequest, type RenameFileResponse, type ReplayHighlight, type ReplayInfo, type ReplayPlayerInfo, type RestoreBackupRequest, type RestoreBackupResponse, type RetentionPolicy, type RoleDetail, type RoleList, type RoleListItem, type RolePermissionItem, type RoleUserItem, RolesAPI, type RoomInfo, type RoomStaleMessage, type RoomSummary, type RoomsResponse, type SaveDialogOptions, type SaveDialogResult, type ScriptDetailResponse, type ScriptListResponse, type ScriptMeta, type ScriptVersion, type ScriptVersionListResponse, type SearchIndex, type SearchOptions, type SearchResponse, type SearchResult, type SecurityRule, type SendOptions, type SendSuperChatOptions, type SendSuperChatResponse, type ServerMessage, SessionManager, type SetPageMetaRequest, type Shorts, type ShortsListResponse, type SignalingMessage, type SignalingMessageType, type SlowQueryInfo, type SpectatorInfo, type SpectatorPlayerState, type SpectatorState, type SpeechRecognizeOptions, type SpeechResult, type StateChange, type StateChangeHandler, type StorageUploadOptions, type StorageUploadProgress, type StreamContentPart, type StreamDoneCallback, type StreamDoneData, type StreamErrorCallback, type StreamHandlers, type StreamImageURLPart, type StreamMessage, type StreamOptions, type StreamSession, type StreamTextPart, type StreamTokenCallback, type StreamToolCallCallback, type StreamToolResultCallback, type StreamURLResponse, type SubscribeOptions, type SubscribeTopicRequest, type SubscribedData, type Subscription, type SubscriptionPaymentResponse, type SubscriptionPaymentStatus, type SubscriptionResponse, type SubscriptionStatus, type SuperChat, type SuperChatType, type SystemInfo, type TTLConfig, type TableAccessLevel, type TableColumnDef, type TableIndex, type TableRelation, type TableSchema, type TableSchemaDefinition, type TokenPersistence, type TransactionRead, type TransactionResult, type TransactionWrite, type TransactionWriteResult, type TranscodeStatus, type TransportType, type Trigger, type TriggerEvent, type TriggerHandlerType, type TypingChangeHandler, type TypingInfo, type UpdateBillingKeyRequest, type UpdateChannelRequest, type UpdateColumnRequest, type UpdateCustomDataRequest, type UpdateCustomDataResponse, type UpdateDataRequest, type UpdateDocumentRequest, type UpdateLobbyRequest, type UpdatePublicKeyRequest, type UpdatePublicKeyResponse, type UpdateRolePayload, type UpdateSecurityRuleRequest, type UpdateSubscriptionRequest, type UpdateTriggerRequest, type UpdateVideoRequest, type UpdateVideoStorageRequest, type UploadByPathOptions, type UploadFileOptions, type UploadFileResponse, type UploadOptions, type UploadProgress, type VAPIDPublicKeyResponse, type ValidateResponse, type ValidationSchema, type ValidationSchemaField, type ValidationStateTransitions, type Video, type VideoComment, type VideoCompleteUploadResponse, type VideoListOptions, type VideoListResponse, VideoProcessingError, type VideoQuality, type VideoStatus, type VideoStorage, type VideoStorageListResponse, type VideoVisibility, type VoiceChannel, type VoiceMember, type WaitOptions, type WatchHistoryItem, type WebPushSubscription, type WebRTCConnectOptions, type WebRTCConnectionState, type WebRTCMode, type WhereCondition, type WhereOperator, ConnectBase as default, detectInAppBrowser, escapeToExternalBrowser, isWebTransportSupported, toCreateRoomWire };
package/dist/index.d.ts CHANGED
@@ -4440,6 +4440,27 @@ declare global {
4440
4440
  }
4441
4441
  interface NativeBridgeInterface {
4442
4442
  platform?: "electron" | "react-native" | "ios" | "android";
4443
+ /** 실행 OS (react-native: 'ios' | 'android', electron: process.platform) */
4444
+ os?: string;
4445
+ /** 네이티브 셸에서 실행 중인지 (패키징 앱이면 항상 true) */
4446
+ isNative?: boolean;
4447
+ /** 브릿지 원시 호출 (문서화되지 않은 타입 호출용) */
4448
+ call?: (type: string, payload?: unknown, options?: {
4449
+ timeoutMs?: number;
4450
+ }) => Promise<unknown>;
4451
+ app?: {
4452
+ getVersion?: () => Promise<string>;
4453
+ getName?: () => Promise<string>;
4454
+ getInfo?: () => Promise<NativeAppInfo>;
4455
+ getPath?: (name: string) => Promise<string | null>;
4456
+ reload?: () => Promise<void>;
4457
+ quit?: () => Promise<void>;
4458
+ };
4459
+ browser?: {
4460
+ openExternal: (url: string) => Promise<{
4461
+ success: boolean;
4462
+ }>;
4463
+ };
4443
4464
  camera?: {
4444
4465
  takePicture: (options?: CameraOptions) => Promise<ImageResult>;
4445
4466
  pickImage: (options?: PickImageOptions) => Promise<ImageResult[]>;
@@ -4455,6 +4476,9 @@ interface NativeBridgeInterface {
4455
4476
  scheduleLocal: (options: LocalNotificationOptions) => Promise<{
4456
4477
  notificationId: string;
4457
4478
  }>;
4479
+ setBadgeCount?: (count: number) => Promise<{
4480
+ success: boolean;
4481
+ }>;
4458
4482
  };
4459
4483
  speech?: {
4460
4484
  recognize: (options?: SpeechRecognizeOptions) => Promise<SpeechResult>;
@@ -4497,12 +4521,6 @@ interface NativeBridgeInterface {
4497
4521
  rewarded: boolean;
4498
4522
  }>;
4499
4523
  };
4500
- app?: {
4501
- getVersion: () => Promise<string>;
4502
- getName: () => Promise<string>;
4503
- getPath: (name: string) => Promise<string | null>;
4504
- quit: () => Promise<void>;
4505
- };
4506
4524
  system?: {
4507
4525
  getInfo: () => Promise<SystemInfo>;
4508
4526
  getMemory: () => Promise<MemoryInfo>;
@@ -4592,10 +4610,34 @@ interface NativeBridgeInterface {
4592
4610
  saveToGallery?: (uri: string) => Promise<{
4593
4611
  uri: string;
4594
4612
  }>;
4613
+ /** 모바일: 앱 문서/캐시 디렉터리 URI */
4614
+ getDirectories?: () => Promise<{
4615
+ document: string | null;
4616
+ cache: string | null;
4617
+ }>;
4618
+ /** 데스크톱: 접근이 허용된 앱 전용 데이터 폴더 */
4619
+ getAppDir?: () => Promise<string>;
4595
4620
  };
4596
4621
  onDeepLink?: (callback: (url: string) => void) => () => void;
4597
4622
  }
4598
4623
  type Platform = "web" | "mobile" | "desktop";
4624
+ /** 패키징 앱 정보 (`cb.native.getAppInfo()`) */
4625
+ interface NativeAppInfo {
4626
+ platform: string;
4627
+ os?: string;
4628
+ osVersion?: string;
4629
+ arch?: string;
4630
+ appVersion?: string;
4631
+ electronVersion?: string;
4632
+ webUrl?: string;
4633
+ }
4634
+ /** 위치 추적 핸들 (`cb.native.location.watchPosition()`) */
4635
+ interface LocationWatch {
4636
+ /** 네이티브 watch 식별자 (웹 폴백에서는 geolocation watch id) */
4637
+ watchId: string;
4638
+ /** 추적 중지 */
4639
+ clear: () => Promise<void>;
4640
+ }
4599
4641
  interface CameraOptions {
4600
4642
  quality?: number;
4601
4643
  base64?: boolean;
@@ -4748,6 +4790,20 @@ declare class NativeAPI {
4748
4790
  * 현재 플랫폼 감지
4749
4791
  */
4750
4792
  getPlatform(): Platform;
4793
+ /**
4794
+ * 패키징 앱(네이티브 셸) 안에서 실행 중인지
4795
+ */
4796
+ isNativeApp(): boolean;
4797
+ /**
4798
+ * 패키징 앱 정보 조회 (웹에서는 null)
4799
+ *
4800
+ * @example
4801
+ * ```typescript
4802
+ * const info = await cb.native.getAppInfo()
4803
+ * // { platform: 'react-native', os: 'ios', appVersion: '1.0.0', webUrl: '...' }
4804
+ * ```
4805
+ */
4806
+ getAppInfo(): Promise<NativeAppInfo | null>;
4751
4807
  /**
4752
4808
  * 특정 네이티브 기능 지원 여부 확인
4753
4809
  */
@@ -4835,6 +4891,42 @@ declare class NativeAPI {
4835
4891
  * 현재 위치 가져오기
4836
4892
  */
4837
4893
  getCurrentPosition: (options?: LocationOptions) => Promise<Position>;
4894
+ /**
4895
+ * 위치 추적 시작.
4896
+ *
4897
+ * 패키징 앱(모바일)에서는 네이티브가 `nativeLocationUpdate` 이벤트로 갱신을 보내고,
4898
+ * 웹/데스크톱에서는 Geolocation `watchPosition` 을 사용한다.
4899
+ *
4900
+ * @example
4901
+ * ```typescript
4902
+ * const watch = await cb.native.location.watchPosition((pos) => console.log(pos))
4903
+ * // 나중에
4904
+ * await watch.clear()
4905
+ * ```
4906
+ */
4907
+ watchPosition: (onUpdate: (position: Position) => void, options?: LocationOptions) => Promise<LocationWatch>;
4908
+ };
4909
+ /**
4910
+ * 모바일 전용 푸시 API
4911
+ *
4912
+ * 패키징 앱은 raw 디바이스 토큰(iOS=APNS, Android=FCM)을 발급받아
4913
+ * `cb.push.registerDevice()` 로 등록해야 서버 발송이 가능하다.
4914
+ */
4915
+ push: {
4916
+ /**
4917
+ * 네이티브 디바이스 푸시 토큰 조회.
4918
+ * 웹(패키징 앱이 아닌 경우)에서는 null 을 반환한다.
4919
+ */
4920
+ getToken: () => Promise<{
4921
+ token: string;
4922
+ platform?: string;
4923
+ } | null>;
4924
+ /** 알림 권한 요청 (웹은 Web Notification 권한) */
4925
+ requestPermission: () => Promise<boolean>;
4926
+ /** 로컬 알림 예약 (패키징 앱 전용) */
4927
+ scheduleLocal: (options: LocalNotificationOptions) => Promise<string | null>;
4928
+ /** 앱 아이콘 배지 숫자 설정 (미지원 플랫폼에서는 무시) */
4929
+ setBadgeCount: (count: number) => Promise<boolean>;
4838
4930
  };
4839
4931
  /**
4840
4932
  * 크로스 플랫폼 알림 API
@@ -5174,8 +5266,30 @@ declare class OAuthAPI {
5174
5266
  }
5175
5267
 
5176
5268
  type PaymentProvider = "toss" | "stripe" | "payapp" | "paypal" | "paddle" | "dodo";
5269
+ /**
5270
+ * 자격증명 모드 — 콘솔에 등록한 테스트 키/라이브 키 중 어느 쪽으로 결제할지.
5271
+ * 프로바이더별 기본 모드는 콘솔에서 정한다.
5272
+ */
5273
+ type PaymentMode = "test" | "live";
5177
5274
  type PaymentStatus = "pending" | "ready" | "in_progress" | "done" | "canceled" | "partial_canceled" | "aborted" | "expired" | "failed";
5178
5275
  interface PreparePaymentRequest {
5276
+ payment_provider?: PaymentProvider;
5277
+ /**
5278
+ * 사용할 자격증명 모드 오버라이드(선택). 미지정 시 콘솔의 프로바이더 모드를 따른다.
5279
+ *
5280
+ * **서버에서 시크릿 키(`cb_sk_*`)로 호출할 때만 적용된다.** 브라우저에 실리는 공개 키
5281
+ * (`cb_pk_*`) 호출에서는 무시된다 — 클라이언트가 test 를 골라 실제 돈 없이 "결제 성공"을
5282
+ * 만들 수 있으면 결제 성공에 걸린 권한 부여가 통째로 우회되기 때문이다.
5283
+ */
5284
+ payment_mode?: PaymentMode;
5285
+ /**
5286
+ * MoR 단건결제용 price/product ref 오버라이드(선택).
5287
+ *
5288
+ * Dodo 처럼 checkout 이 카탈로그 상품만 참조하는 프로바이더는 임의 금액 청구에
5289
+ * pay-what-you-want 상품이 필요하다. 보통 콘솔에 저장한 기본값을 쓰므로 생략하면 되고,
5290
+ * 상품별로 세금 카테고리를 달리 할 때만 지정한다. Paddle 은 무시한다.
5291
+ */
5292
+ provider_price_ref?: string;
5179
5293
  amount: number;
5180
5294
  order_name: string;
5181
5295
  order_id?: string;
@@ -5190,6 +5304,8 @@ interface PreparePaymentResponse {
5190
5304
  amount: number;
5191
5305
  order_name: string;
5192
5306
  payment_provider: PaymentProvider;
5307
+ /** 이 결제가 사용한 자격증명 모드. */
5308
+ payment_mode: PaymentMode;
5193
5309
  customer_key: string;
5194
5310
  toss_client_key: string;
5195
5311
  success_url: string;
@@ -5262,6 +5378,8 @@ interface PaymentDetail {
5262
5378
  currency: string;
5263
5379
  status: PaymentStatus;
5264
5380
  payment_provider?: PaymentProvider;
5381
+ /** 이 결제가 사용한 자격증명 모드 (test | live). */
5382
+ payment_mode?: PaymentMode;
5265
5383
  method?: string;
5266
5384
  customer_id?: string;
5267
5385
  customer_email?: string;
@@ -5281,6 +5399,8 @@ interface PaymentDetail {
5281
5399
  interface ListPaymentsOptions {
5282
5400
  /** pending | done | canceled | failed */
5283
5401
  status?: string;
5402
+ /** test | live. 미지정 시 전체. 테스트 결제를 걸러 실매출만 보려면 "live". */
5403
+ mode?: PaymentMode;
5284
5404
  /** ISO8601(RFC3339) 시작일 필터. */
5285
5405
  startDate?: string;
5286
5406
  /** ISO8601(RFC3339) 종료일 필터. */
@@ -9518,4 +9638,4 @@ declare class ConnectBase {
9518
9638
  updateConfig(config: Partial<ConnectBaseConfig>): void;
9519
9639
  }
9520
9640
 
9521
- export { AIAPI, type AIChatRequest, type AIChatResponse, type AIChatStreamCallbacks, type AIChatStreamOptions, type AIMessage, type AISource, type AIStreamChunk, type AITool, type AIToolCall, type AIToolEvent, AUTH_MEMBER_ID_TOKEN, type AckMessagesRequest, type AdMobDailyReport, type AdMobReportResponse, type AdMobReportSummary, type AdReportResponse, type AdReportSummary, type AdmobConnectionInfo, AdsAPI, type AdsenseConnectionInfo, type AgenticSearchProgress, type AggregateResult, type AggregateStage, type AnalyticsConfig, type AnalyticsEvent, ApiError, type ApiErrorDetail, type AppStatsResponse, type ArchivePolicy, type AtomicOperator, type AtomicOperatorType, AuthError, type AuthSettingsResponse, type BackupInfo, type BatchOperation, type BatchOperationResult, type BatchSetPageMetaRequest, type BatchWriteResult, type BillingCycle, type BillingKeyResponse, type BiometricInfo, type BiometricResult, type BulkCreateResponse, type BulkError, type CPUInfo, type CancelPaymentRequest, type CancelPaymentResponse, type CancelSubscriptionRequest, type CategoryInfo, type ChangePlanPreview, type ChangePlanRequest, type Channel, type ChannelMembership, type ChannelStats, type ChargeWithBillingKeyRequest, type ChargeWithBillingKeyResponse, type ChatMessage, type ClientMessage, type ColumnSchema, type CommentListResponse, type CompleteUploadRequest, type CompleteUploadResponse, type ConfirmBillingKeyRequest, type ConfirmPaymentRequest, type ConfirmPaymentResponse, ConnectBase, type ConnectBaseConfig, type ConnectedData, type ConnectionState, type ConsentOptions, type ConsumeMessagesResponse, type ConsumeOptions, type CopyTableRequest, type CopyTableResponse, type CreateBackupRequest, type CreateChannelRequest, type CreateCheckoutSessionRequest, type CreateCheckoutSessionResponse, type CreateColumnRequest, type CreateDataRequest, type CreateDocumentRequest, type CreateFolderRequest, type CreateFolderResponse, type CreateGeoIndexRequest, type CreateIndexRequest, type CreateLobbyRequest, type CreatePlaylistRequest, type CreatePublicKeyRequest, type CreatePublicKeyResponse, type CreateRelationRequest, type CreateRolePayload, type CreateRoleResult, type CreateRoomResult, type CreateSearchIndexRequest, type CreateSecurityRuleRequest, type CreateSubscriptionRequest, type CreateTableRequest, type CreateTriggerRequest, type CreateVideoStorageRequest, type DailyReport, type DataItem, type DataType, type DatabaseChange, type DatabaseChangeMessage, type DatabaseChangeType, type DatabaseRealtimeConnectOptions, type DatabaseRealtimeFilter, type DatabaseRealtimeHandlers, type DatabaseRealtimeSubscription, type DatabaseSnapshot, type DatabaseSnapshotMessage, type DatabaseSubscribeOptions, type DeleteWhereResponse, type DeviceInfo, type DocumentResponse, type EnabledProviderInfo, type EnabledProvidersResponse, EndpointAPI, type EndpointCallInit, type ErrorHandler, type ErrorMessage, type ErrorReport, type ErrorTrackerConfig, type ErrorType, type ExportDataRequest, type ExportDataResponse, type FetchDataResponse, type FetchFilesResponse, type FetchPublicKeysResponse, type FileItem, type FileStats, GameAPI, type GameAction, type GameClientConfig, type GameConfig, GameConfigAPI, type GameConfigPatch, type GameConnectionState, type GameConnectionStatus, type GameDelta, GameError, type GameErrorCode, type GameEventHandlers, type GamePlayer, GameRoom, type GameRoomConfig, type GameRoomInfo, GameRoomTransport, type GameServerMessage, type GameServerMessageType, type GameState, type GameTransportConfig, type GenerateUploadURLByPathRequest, type GenerateUploadURLRequest, type GenerateUploadURLResponse, type GeoBoundingBox, type GeoIndex, type GeoNear, type GeoPoint, type GeoPolygon, type GeoQuery, type GeoResponse, type GeoResult, type GetAuthorizationURLResponse, type GetFileByPathResponse, type GoogleConnectionStatus, type HistoryResponse, type ICEServer, type ICEServersResponse, type ImageResult, type ImportDataRequest, type ImportDataResponse, type IndexAnalysis, type IndexRecommendation, type InitUploadResponse, type InvokeFunctionRequest, type InvokeFunctionResponse, type IssueBillingKeyRequest, type IssueBillingKeyResponse, type JoinQueueRequest, type JoinRoomRequest, type JoinRoomResponse, type KnowledgeSearchRequest, type KnowledgeSearchResponse, type KnowledgeSearchResult, type LeaderboardEntry, type LeaderboardListResponse, type LeaderboardScoreEntry, type LifecyclePolicy, type ListBillingKeysResponse, type ListDocumentsResponse, type ListPageMetasOptions, type ListPageMetasResponse, type ListPaymentsOptions, type ListSubscriptionPaymentsRequest, type ListSubscriptionPaymentsResponse, type ListSubscriptionsRequest, type ListSubscriptionsResponse, type LobbyInfo, type LobbyInvite, type LobbyMember, type LobbyVisibility, type MatchResult, type MatchmakingTicket, type MatchqueueListResponse, type MatchqueueTicket, type MemberInfoResponse, type MemberSignInRequest, type MemberSignInResponse, type MemberSignUpRequest, type MemberSignUpResponse, type MembershipTier, type MemoryInfo, type MessageHandler, type MigrateDataRequest, type MigrateDataResponse, type MoveFileRequest, type NackMessageRequest, NativeAPI, type OAuthCallbackResponse, type OAuthProvider, type OnPaymentFailure, type OpenDialogOptions, type OpenDialogResult, type PageMetaResponse, type PartyInfo, type PartyInvite, type PartyMember, type PauseSubscriptionRequest, type PaymentDetail, type PaymentListItem, type PaymentListResult, type PaymentProvider, type PaymentStatus, type PeerInfo, type Platform, type PlayerEvent, type PlayerStats, type Playlist, type PlaylistItem, type PollUntilOptions, type PongMessage, type PopulateOption, type Position, type PreparePaymentRequest, type PreparePaymentResponse, type PresenceChangeHandler, type PresenceInfo, type PresenceSetOptions, type PresenceStatus, type PresenceStatusResult, type ProrationMode, type PublicKeyItem, type PublishBatchRequest, type PublishBatchResponse, type PublishMessageRequest, type PublishMessageResponse, type PushPlatform, type PushStatsResult, type QualityProgress, type QueryOptions, type QueueInfoResponse, type QueueMessage, type ReadReceiptHandler, type ReadReceiptInfo, type RealtimeConnectOptions, type RealtimeMessage, type RegisterDeviceRequest, type RelationType, type RenameFileRequest, type RenameFileResponse, type ReplayHighlight, type ReplayInfo, type ReplayPlayerInfo, type RestoreBackupRequest, type RestoreBackupResponse, type RetentionPolicy, type RoleDetail, type RoleList, type RoleListItem, type RolePermissionItem, type RoleUserItem, RolesAPI, type RoomInfo, type RoomStaleMessage, type RoomSummary, type RoomsResponse, type SaveDialogOptions, type SaveDialogResult, type ScriptDetailResponse, type ScriptListResponse, type ScriptMeta, type ScriptVersion, type ScriptVersionListResponse, type SearchIndex, type SearchOptions, type SearchResponse, type SearchResult, type SecurityRule, type SendOptions, type SendSuperChatOptions, type SendSuperChatResponse, type ServerMessage, SessionManager, type SetPageMetaRequest, type Shorts, type ShortsListResponse, type SignalingMessage, type SignalingMessageType, type SlowQueryInfo, type SpectatorInfo, type SpectatorPlayerState, type SpectatorState, type SpeechRecognizeOptions, type SpeechResult, type StateChange, type StateChangeHandler, type StorageUploadOptions, type StorageUploadProgress, type StreamContentPart, type StreamDoneCallback, type StreamDoneData, type StreamErrorCallback, type StreamHandlers, type StreamImageURLPart, type StreamMessage, type StreamOptions, type StreamSession, type StreamTextPart, type StreamTokenCallback, type StreamToolCallCallback, type StreamToolResultCallback, type StreamURLResponse, type SubscribeOptions, type SubscribeTopicRequest, type SubscribedData, type Subscription, type SubscriptionPaymentResponse, type SubscriptionPaymentStatus, type SubscriptionResponse, type SubscriptionStatus, type SuperChat, type SuperChatType, type SystemInfo, type TTLConfig, type TableAccessLevel, type TableColumnDef, type TableIndex, type TableRelation, type TableSchema, type TableSchemaDefinition, type TokenPersistence, type TransactionRead, type TransactionResult, type TransactionWrite, type TransactionWriteResult, type TranscodeStatus, type TransportType, type Trigger, type TriggerEvent, type TriggerHandlerType, type TypingChangeHandler, type TypingInfo, type UpdateBillingKeyRequest, type UpdateChannelRequest, type UpdateColumnRequest, type UpdateCustomDataRequest, type UpdateCustomDataResponse, type UpdateDataRequest, type UpdateDocumentRequest, type UpdateLobbyRequest, type UpdatePublicKeyRequest, type UpdatePublicKeyResponse, type UpdateRolePayload, type UpdateSecurityRuleRequest, type UpdateSubscriptionRequest, type UpdateTriggerRequest, type UpdateVideoRequest, type UpdateVideoStorageRequest, type UploadByPathOptions, type UploadFileOptions, type UploadFileResponse, type UploadOptions, type UploadProgress, type VAPIDPublicKeyResponse, type ValidateResponse, type ValidationSchema, type ValidationSchemaField, type ValidationStateTransitions, type Video, type VideoComment, type VideoCompleteUploadResponse, type VideoListOptions, type VideoListResponse, VideoProcessingError, type VideoQuality, type VideoStatus, type VideoStorage, type VideoStorageListResponse, type VideoVisibility, type VoiceChannel, type VoiceMember, type WaitOptions, type WatchHistoryItem, type WebPushSubscription, type WebRTCConnectOptions, type WebRTCConnectionState, type WebRTCMode, type WhereCondition, type WhereOperator, ConnectBase as default, detectInAppBrowser, escapeToExternalBrowser, isWebTransportSupported, toCreateRoomWire };
9641
+ export { AIAPI, type AIChatRequest, type AIChatResponse, type AIChatStreamCallbacks, type AIChatStreamOptions, type AIMessage, type AISource, type AIStreamChunk, type AITool, type AIToolCall, type AIToolEvent, AUTH_MEMBER_ID_TOKEN, type AckMessagesRequest, type AdMobDailyReport, type AdMobReportResponse, type AdMobReportSummary, type AdReportResponse, type AdReportSummary, type AdmobConnectionInfo, AdsAPI, type AdsenseConnectionInfo, type AgenticSearchProgress, type AggregateResult, type AggregateStage, type AnalyticsConfig, type AnalyticsEvent, ApiError, type ApiErrorDetail, type AppStatsResponse, type ArchivePolicy, type AtomicOperator, type AtomicOperatorType, AuthError, type AuthSettingsResponse, type BackupInfo, type BatchOperation, type BatchOperationResult, type BatchSetPageMetaRequest, type BatchWriteResult, type BillingCycle, type BillingKeyResponse, type BiometricInfo, type BiometricResult, type BulkCreateResponse, type BulkError, type CPUInfo, type CancelPaymentRequest, type CancelPaymentResponse, type CancelSubscriptionRequest, type CategoryInfo, type ChangePlanPreview, type ChangePlanRequest, type Channel, type ChannelMembership, type ChannelStats, type ChargeWithBillingKeyRequest, type ChargeWithBillingKeyResponse, type ChatMessage, type ClientMessage, type ColumnSchema, type CommentListResponse, type CompleteUploadRequest, type CompleteUploadResponse, type ConfirmBillingKeyRequest, type ConfirmPaymentRequest, type ConfirmPaymentResponse, ConnectBase, type ConnectBaseConfig, type ConnectedData, type ConnectionState, type ConsentOptions, type ConsumeMessagesResponse, type ConsumeOptions, type CopyTableRequest, type CopyTableResponse, type CreateBackupRequest, type CreateChannelRequest, type CreateCheckoutSessionRequest, type CreateCheckoutSessionResponse, type CreateColumnRequest, type CreateDataRequest, type CreateDocumentRequest, type CreateFolderRequest, type CreateFolderResponse, type CreateGeoIndexRequest, type CreateIndexRequest, type CreateLobbyRequest, type CreatePlaylistRequest, type CreatePublicKeyRequest, type CreatePublicKeyResponse, type CreateRelationRequest, type CreateRolePayload, type CreateRoleResult, type CreateRoomResult, type CreateSearchIndexRequest, type CreateSecurityRuleRequest, type CreateSubscriptionRequest, type CreateTableRequest, type CreateTriggerRequest, type CreateVideoStorageRequest, type DailyReport, type DataItem, type DataType, type DatabaseChange, type DatabaseChangeMessage, type DatabaseChangeType, type DatabaseRealtimeConnectOptions, type DatabaseRealtimeFilter, type DatabaseRealtimeHandlers, type DatabaseRealtimeSubscription, type DatabaseSnapshot, type DatabaseSnapshotMessage, type DatabaseSubscribeOptions, type DeleteWhereResponse, type DeviceInfo, type DocumentResponse, type EnabledProviderInfo, type EnabledProvidersResponse, EndpointAPI, type EndpointCallInit, type ErrorHandler, type ErrorMessage, type ErrorReport, type ErrorTrackerConfig, type ErrorType, type ExportDataRequest, type ExportDataResponse, type FetchDataResponse, type FetchFilesResponse, type FetchPublicKeysResponse, type FileItem, type FileStats, GameAPI, type GameAction, type GameClientConfig, type GameConfig, GameConfigAPI, type GameConfigPatch, type GameConnectionState, type GameConnectionStatus, type GameDelta, GameError, type GameErrorCode, type GameEventHandlers, type GamePlayer, GameRoom, type GameRoomConfig, type GameRoomInfo, GameRoomTransport, type GameServerMessage, type GameServerMessageType, type GameState, type GameTransportConfig, type GenerateUploadURLByPathRequest, type GenerateUploadURLRequest, type GenerateUploadURLResponse, type GeoBoundingBox, type GeoIndex, type GeoNear, type GeoPoint, type GeoPolygon, type GeoQuery, type GeoResponse, type GeoResult, type GetAuthorizationURLResponse, type GetFileByPathResponse, type GoogleConnectionStatus, type HistoryResponse, type ICEServer, type ICEServersResponse, type ImageResult, type ImportDataRequest, type ImportDataResponse, type IndexAnalysis, type IndexRecommendation, type InitUploadResponse, type InvokeFunctionRequest, type InvokeFunctionResponse, type IssueBillingKeyRequest, type IssueBillingKeyResponse, type JoinQueueRequest, type JoinRoomRequest, type JoinRoomResponse, type KnowledgeSearchRequest, type KnowledgeSearchResponse, type KnowledgeSearchResult, type LeaderboardEntry, type LeaderboardListResponse, type LeaderboardScoreEntry, type LifecyclePolicy, type ListBillingKeysResponse, type ListDocumentsResponse, type ListPageMetasOptions, type ListPageMetasResponse, type ListPaymentsOptions, type ListSubscriptionPaymentsRequest, type ListSubscriptionPaymentsResponse, type ListSubscriptionsRequest, type ListSubscriptionsResponse, type LobbyInfo, type LobbyInvite, type LobbyMember, type LobbyVisibility, type MatchResult, type MatchmakingTicket, type MatchqueueListResponse, type MatchqueueTicket, type MemberInfoResponse, type MemberSignInRequest, type MemberSignInResponse, type MemberSignUpRequest, type MemberSignUpResponse, type MembershipTier, type MemoryInfo, type MessageHandler, type MigrateDataRequest, type MigrateDataResponse, type MoveFileRequest, type NackMessageRequest, NativeAPI, type OAuthCallbackResponse, type OAuthProvider, type OnPaymentFailure, type OpenDialogOptions, type OpenDialogResult, type PageMetaResponse, type PartyInfo, type PartyInvite, type PartyMember, type PauseSubscriptionRequest, type PaymentDetail, type PaymentListItem, type PaymentListResult, type PaymentMode, type PaymentProvider, type PaymentStatus, type PeerInfo, type Platform, type PlayerEvent, type PlayerStats, type Playlist, type PlaylistItem, type PollUntilOptions, type PongMessage, type PopulateOption, type Position, type PreparePaymentRequest, type PreparePaymentResponse, type PresenceChangeHandler, type PresenceInfo, type PresenceSetOptions, type PresenceStatus, type PresenceStatusResult, type ProrationMode, type PublicKeyItem, type PublishBatchRequest, type PublishBatchResponse, type PublishMessageRequest, type PublishMessageResponse, type PushPlatform, type PushStatsResult, type QualityProgress, type QueryOptions, type QueueInfoResponse, type QueueMessage, type ReadReceiptHandler, type ReadReceiptInfo, type RealtimeConnectOptions, type RealtimeMessage, type RegisterDeviceRequest, type RelationType, type RenameFileRequest, type RenameFileResponse, type ReplayHighlight, type ReplayInfo, type ReplayPlayerInfo, type RestoreBackupRequest, type RestoreBackupResponse, type RetentionPolicy, type RoleDetail, type RoleList, type RoleListItem, type RolePermissionItem, type RoleUserItem, RolesAPI, type RoomInfo, type RoomStaleMessage, type RoomSummary, type RoomsResponse, type SaveDialogOptions, type SaveDialogResult, type ScriptDetailResponse, type ScriptListResponse, type ScriptMeta, type ScriptVersion, type ScriptVersionListResponse, type SearchIndex, type SearchOptions, type SearchResponse, type SearchResult, type SecurityRule, type SendOptions, type SendSuperChatOptions, type SendSuperChatResponse, type ServerMessage, SessionManager, type SetPageMetaRequest, type Shorts, type ShortsListResponse, type SignalingMessage, type SignalingMessageType, type SlowQueryInfo, type SpectatorInfo, type SpectatorPlayerState, type SpectatorState, type SpeechRecognizeOptions, type SpeechResult, type StateChange, type StateChangeHandler, type StorageUploadOptions, type StorageUploadProgress, type StreamContentPart, type StreamDoneCallback, type StreamDoneData, type StreamErrorCallback, type StreamHandlers, type StreamImageURLPart, type StreamMessage, type StreamOptions, type StreamSession, type StreamTextPart, type StreamTokenCallback, type StreamToolCallCallback, type StreamToolResultCallback, type StreamURLResponse, type SubscribeOptions, type SubscribeTopicRequest, type SubscribedData, type Subscription, type SubscriptionPaymentResponse, type SubscriptionPaymentStatus, type SubscriptionResponse, type SubscriptionStatus, type SuperChat, type SuperChatType, type SystemInfo, type TTLConfig, type TableAccessLevel, type TableColumnDef, type TableIndex, type TableRelation, type TableSchema, type TableSchemaDefinition, type TokenPersistence, type TransactionRead, type TransactionResult, type TransactionWrite, type TransactionWriteResult, type TranscodeStatus, type TransportType, type Trigger, type TriggerEvent, type TriggerHandlerType, type TypingChangeHandler, type TypingInfo, type UpdateBillingKeyRequest, type UpdateChannelRequest, type UpdateColumnRequest, type UpdateCustomDataRequest, type UpdateCustomDataResponse, type UpdateDataRequest, type UpdateDocumentRequest, type UpdateLobbyRequest, type UpdatePublicKeyRequest, type UpdatePublicKeyResponse, type UpdateRolePayload, type UpdateSecurityRuleRequest, type UpdateSubscriptionRequest, type UpdateTriggerRequest, type UpdateVideoRequest, type UpdateVideoStorageRequest, type UploadByPathOptions, type UploadFileOptions, type UploadFileResponse, type UploadOptions, type UploadProgress, type VAPIDPublicKeyResponse, type ValidateResponse, type ValidationSchema, type ValidationSchemaField, type ValidationStateTransitions, type Video, type VideoComment, type VideoCompleteUploadResponse, type VideoListOptions, type VideoListResponse, VideoProcessingError, type VideoQuality, type VideoStatus, type VideoStorage, type VideoStorageListResponse, type VideoVisibility, type VoiceChannel, type VoiceMember, type WaitOptions, type WatchHistoryItem, type WebPushSubscription, type WebRTCConnectOptions, type WebRTCConnectionState, type WebRTCMode, type WhereCondition, type WhereOperator, ConnectBase as default, detectInAppBrowser, escapeToExternalBrowser, isWebTransportSupported, toCreateRoomWire };
package/dist/index.js CHANGED
@@ -5042,6 +5042,101 @@ var NativeAPI = class {
5042
5042
  }
5043
5043
  );
5044
5044
  });
5045
+ },
5046
+ /**
5047
+ * 위치 추적 시작.
5048
+ *
5049
+ * 패키징 앱(모바일)에서는 네이티브가 `nativeLocationUpdate` 이벤트로 갱신을 보내고,
5050
+ * 웹/데스크톱에서는 Geolocation `watchPosition` 을 사용한다.
5051
+ *
5052
+ * @example
5053
+ * ```typescript
5054
+ * const watch = await cb.native.location.watchPosition((pos) => console.log(pos))
5055
+ * // 나중에
5056
+ * await watch.clear()
5057
+ * ```
5058
+ */
5059
+ watchPosition: async (onUpdate, options) => {
5060
+ const platform = this.getPlatform();
5061
+ const bridge = window.NativeBridge;
5062
+ if (platform === "mobile" && bridge?.location?.watchPosition) {
5063
+ const { watchId } = await bridge.location.watchPosition(options);
5064
+ const handler = (event) => {
5065
+ const detail = event.detail;
5066
+ if (!detail || detail.watchId && detail.watchId !== watchId) return;
5067
+ onUpdate({
5068
+ latitude: detail.latitude,
5069
+ longitude: detail.longitude,
5070
+ altitude: detail.altitude,
5071
+ accuracy: detail.accuracy,
5072
+ timestamp: detail.timestamp
5073
+ });
5074
+ };
5075
+ window.addEventListener("nativeLocationUpdate", handler);
5076
+ return {
5077
+ watchId,
5078
+ clear: async () => {
5079
+ window.removeEventListener("nativeLocationUpdate", handler);
5080
+ await bridge.location?.stopWatch(watchId);
5081
+ }
5082
+ };
5083
+ }
5084
+ const id = navigator.geolocation.watchPosition(
5085
+ (pos) => onUpdate({
5086
+ latitude: pos.coords.latitude,
5087
+ longitude: pos.coords.longitude,
5088
+ altitude: pos.coords.altitude,
5089
+ accuracy: pos.coords.accuracy,
5090
+ timestamp: pos.timestamp
5091
+ }),
5092
+ void 0,
5093
+ {
5094
+ enableHighAccuracy: options?.accuracy === "high",
5095
+ timeout: 1e4,
5096
+ maximumAge: 0
5097
+ }
5098
+ );
5099
+ return {
5100
+ watchId: String(id),
5101
+ clear: async () => navigator.geolocation.clearWatch(id)
5102
+ };
5103
+ }
5104
+ };
5105
+ /**
5106
+ * 모바일 전용 푸시 API
5107
+ *
5108
+ * 패키징 앱은 raw 디바이스 토큰(iOS=APNS, Android=FCM)을 발급받아
5109
+ * `cb.push.registerDevice()` 로 등록해야 서버 발송이 가능하다.
5110
+ */
5111
+ this.push = {
5112
+ /**
5113
+ * 네이티브 디바이스 푸시 토큰 조회.
5114
+ * 웹(패키징 앱이 아닌 경우)에서는 null 을 반환한다.
5115
+ */
5116
+ getToken: async () => {
5117
+ if (this.getPlatform() === "mobile" && window.NativeBridge?.push) {
5118
+ return window.NativeBridge.push.getToken();
5119
+ }
5120
+ return null;
5121
+ },
5122
+ /** 알림 권한 요청 (웹은 Web Notification 권한) */
5123
+ requestPermission: async () => {
5124
+ return this.notification.requestPermission();
5125
+ },
5126
+ /** 로컬 알림 예약 (패키징 앱 전용) */
5127
+ scheduleLocal: async (options) => {
5128
+ if (this.getPlatform() === "mobile" && window.NativeBridge?.push) {
5129
+ const result = await window.NativeBridge.push.scheduleLocal(options);
5130
+ return result.notificationId;
5131
+ }
5132
+ return null;
5133
+ },
5134
+ /** 앱 아이콘 배지 숫자 설정 (미지원 플랫폼에서는 무시) */
5135
+ setBadgeCount: async (count) => {
5136
+ const setter = window.NativeBridge?.push?.setBadgeCount;
5137
+ if (!setter) return false;
5138
+ const result = await setter(count);
5139
+ return result.success;
5045
5140
  }
5046
5141
  };
5047
5142
  /**
@@ -5057,6 +5152,16 @@ var NativeAPI = class {
5057
5152
  const result = await window.NativeBridge.notification.show(options);
5058
5153
  return result.success;
5059
5154
  }
5155
+ if (platform === "mobile" && window.NativeBridge?.push?.scheduleLocal) {
5156
+ const granted = await this.notification.requestPermission();
5157
+ if (!granted) return false;
5158
+ await window.NativeBridge.push.scheduleLocal({
5159
+ title: options.title,
5160
+ body: options.body,
5161
+ trigger: null
5162
+ });
5163
+ return true;
5164
+ }
5060
5165
  if (!("Notification" in window)) return false;
5061
5166
  if (Notification.permission !== "granted") {
5062
5167
  const permission = await Notification.requestPermission();
@@ -5096,6 +5201,10 @@ var NativeAPI = class {
5096
5201
  const result = await window.NativeBridge.shell.openExternal(url);
5097
5202
  return result.success;
5098
5203
  }
5204
+ if (platform === "mobile" && window.NativeBridge?.browser) {
5205
+ const result = await window.NativeBridge.browser.openExternal(url);
5206
+ return result.success;
5207
+ }
5099
5208
  window.open(url, "_blank");
5100
5209
  return true;
5101
5210
  }
@@ -5341,6 +5450,26 @@ var NativeAPI = class {
5341
5450
  if (bridge?.camera || window.ReactNativeWebView) return "mobile";
5342
5451
  return "web";
5343
5452
  }
5453
+ /**
5454
+ * 패키징 앱(네이티브 셸) 안에서 실행 중인지
5455
+ */
5456
+ isNativeApp() {
5457
+ return this.getPlatform() !== "web";
5458
+ }
5459
+ /**
5460
+ * 패키징 앱 정보 조회 (웹에서는 null)
5461
+ *
5462
+ * @example
5463
+ * ```typescript
5464
+ * const info = await cb.native.getAppInfo()
5465
+ * // { platform: 'react-native', os: 'ios', appVersion: '1.0.0', webUrl: '...' }
5466
+ * ```
5467
+ */
5468
+ async getAppInfo() {
5469
+ const getInfo = this.bridge?.app?.getInfo;
5470
+ if (!getInfo) return null;
5471
+ return getInfo();
5472
+ }
5344
5473
  /**
5345
5474
  * 특정 네이티브 기능 지원 여부 확인
5346
5475
  */
@@ -6013,6 +6142,7 @@ var PaymentAPI = class {
6013
6142
  }
6014
6143
  const params = new URLSearchParams();
6015
6144
  if (options?.status) params.set("status", options.status);
6145
+ if (options?.mode) params.set("mode", options.mode);
6016
6146
  if (options?.startDate) params.set("start_date", options.startDate);
6017
6147
  if (options?.endDate) params.set("end_date", options.endDate);
6018
6148
  if (options?.limit !== void 0)