@ait-co/devtools 0.0.2 → 0.1.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.
@@ -1,7 +1,127 @@
1
+ //#region src/mock/ads/index.d.ts
1
2
  /**
2
- * @ait-co/devtools 중앙 상태 관리
3
- * DevTools Panel과 mock 구현체가 이 상태를 공유한다.
3
+ * 광고 mock (GoogleAdMob, TossAds, FullScreenAd)
4
+ */
5
+ declare const GoogleAdMob: {
6
+ loadAppsInTossAdMob: ((args: {
7
+ onEvent: (data: {
8
+ type: string;
9
+ data?: unknown;
10
+ }) => void;
11
+ onError: (error: Error) => void;
12
+ options?: {
13
+ adGroupId?: string;
14
+ };
15
+ }) => (() => void)) & {
16
+ isSupported: () => boolean;
17
+ };
18
+ showAppsInTossAdMob: ((args: {
19
+ onEvent: (data: {
20
+ type: string;
21
+ data?: unknown;
22
+ }) => void;
23
+ onError: (error: Error) => void;
24
+ options?: {
25
+ adGroupId?: string;
26
+ };
27
+ }) => (() => void)) & {
28
+ isSupported: () => boolean;
29
+ };
30
+ isAppsInTossAdMobLoaded: ((_options: {
31
+ adGroupId?: string;
32
+ }) => Promise<boolean>) & {
33
+ isSupported: () => boolean;
34
+ };
35
+ };
36
+ declare const TossAds: {
37
+ initialize: ((_options: unknown) => void) & {
38
+ isSupported: () => boolean;
39
+ };
40
+ attach: ((_adGroupId: string, target: string | HTMLElement, _options?: unknown) => void) & {
41
+ isSupported: () => boolean;
42
+ };
43
+ attachBanner: ((_adGroupId: string, target: string | HTMLElement, _options?: unknown) => {
44
+ destroy: () => void;
45
+ }) & {
46
+ isSupported: () => boolean;
47
+ };
48
+ destroy: ((_slotId: string) => void) & {
49
+ isSupported: () => boolean;
50
+ };
51
+ destroyAll: (() => void) & {
52
+ isSupported: () => boolean;
53
+ };
54
+ };
55
+ declare const loadFullScreenAd: ((args: {
56
+ onEvent: (data: {
57
+ type: string;
58
+ data?: unknown;
59
+ }) => void;
60
+ onError: (error: Error) => void;
61
+ options?: {
62
+ adGroupId?: string;
63
+ };
64
+ }) => (() => void)) & {
65
+ isSupported: () => boolean;
66
+ };
67
+ declare const showFullScreenAd: ((args: {
68
+ onEvent: (data: {
69
+ type: string;
70
+ data?: unknown;
71
+ }) => void;
72
+ onError: (error: Error) => void;
73
+ options?: {
74
+ adGroupId?: string;
75
+ };
76
+ }) => (() => void)) & {
77
+ isSupported: () => boolean;
78
+ };
79
+ //#endregion
80
+ //#region src/mock/analytics/index.d.ts
81
+ /**
82
+ * Analytics mock
83
+ */
84
+ type Primitive$1 = string | number | boolean | null | undefined | symbol;
85
+ type LoggerParams = {
86
+ log_name?: string;
87
+ } & Record<string, Primitive$1>;
88
+ declare const Analytics: {
89
+ screen: (params?: LoggerParams) => Promise<void> | undefined;
90
+ impression: (params?: LoggerParams) => Promise<void> | undefined;
91
+ click: (params?: LoggerParams) => Promise<void> | undefined;
92
+ };
93
+ declare function eventLog(params: {
94
+ log_name: string;
95
+ log_type: 'debug' | 'info' | 'warn' | 'error' | 'event' | 'screen' | 'impression' | 'click';
96
+ params: Record<string, Primitive$1>;
97
+ }): Promise<void>;
98
+ //#endregion
99
+ //#region src/mock/auth/index.d.ts
100
+ /**
101
+ * 인증/로그인 mock
102
+ */
103
+ declare function appLogin(): Promise<{
104
+ authorizationCode: string;
105
+ referrer: 'DEFAULT' | 'SANDBOX';
106
+ }>;
107
+ declare function getIsTossLoginIntegratedService(): Promise<boolean | undefined>;
108
+ declare function getUserKeyForGame(): Promise<{
109
+ hash: string;
110
+ type: 'HASH';
111
+ } | 'INVALID_CATEGORY' | 'ERROR' | undefined>;
112
+ interface AppsInTossSignTossCertParams {
113
+ txId: string;
114
+ }
115
+ declare function appsInTossSignTossCert(_params: AppsInTossSignTossCertParams): Promise<void>;
116
+ //#endregion
117
+ //#region src/mock/device/_helpers.d.ts
118
+ /**
119
+ * 디바이스 모듈 내부 공유 헬퍼
4
120
  */
121
+ declare function getDefaultPlaceholderImages(): string[];
122
+ //#endregion
123
+ //#region src/mock/types.d.ts
124
+ type Primitive = string | number | boolean | null | undefined | symbol;
5
125
  type PlatformOS = 'ios' | 'android';
6
126
  type OperationalEnvironment = 'toss' | 'sandbox';
7
127
  type NetworkStatus = 'OFFLINE' | 'WIFI' | '2G' | '3G' | '4G' | '5G' | 'WWAN' | 'UNKNOWN';
@@ -10,185 +130,344 @@ type PermissionName = 'clipboard' | 'contacts' | 'photos' | 'geolocation' | 'cam
10
130
  type HapticFeedbackType = 'tickWeak' | 'tap' | 'tickMedium' | 'softMedium' | 'basicWeak' | 'basicMedium' | 'success' | 'error' | 'wiggle' | 'confetti';
11
131
  type DeviceApiMode = 'mock' | 'web' | 'prompt';
12
132
  interface DeviceModes {
13
- camera: DeviceApiMode;
14
- photos: DeviceApiMode;
15
- location: DeviceApiMode;
16
- network: 'mock' | 'web';
17
- clipboard: 'mock' | 'web';
133
+ camera: DeviceApiMode;
134
+ photos: DeviceApiMode;
135
+ location: DeviceApiMode;
136
+ network: 'mock' | 'web';
137
+ clipboard: 'mock' | 'web';
18
138
  }
19
139
  interface MockData {
20
- images: string[];
21
- clipboardText: string;
140
+ images: string[];
141
+ clipboardText: string;
22
142
  }
23
143
  interface LocationCoords {
24
- latitude: number;
25
- longitude: number;
26
- altitude: number;
27
- accuracy: number;
28
- altitudeAccuracy: number;
29
- heading: number;
144
+ latitude: number;
145
+ longitude: number;
146
+ altitude: number;
147
+ accuracy: number;
148
+ altitudeAccuracy: number;
149
+ heading: number;
30
150
  }
31
151
  interface MockLocation {
32
- coords: LocationCoords;
33
- timestamp: number;
34
- accessLocation?: 'FINE' | 'COARSE';
152
+ coords: LocationCoords;
153
+ timestamp: number;
154
+ accessLocation?: 'FINE' | 'COARSE';
35
155
  }
36
156
  interface MockContact {
37
- name: string;
38
- phoneNumber: string;
157
+ name: string;
158
+ phoneNumber: string;
39
159
  }
40
160
  interface MockIapProduct {
41
- sku: string;
42
- type: 'CONSUMABLE' | 'NON_CONSUMABLE' | 'SUBSCRIPTION';
43
- displayName: string;
44
- displayAmount: string;
45
- iconUrl: string;
46
- description: string;
47
- renewalCycle?: 'WEEKLY' | 'MONTHLY' | 'YEARLY';
161
+ sku: string;
162
+ type: 'CONSUMABLE' | 'NON_CONSUMABLE' | 'SUBSCRIPTION';
163
+ displayName: string;
164
+ displayAmount: string;
165
+ iconUrl: string;
166
+ description: string;
167
+ renewalCycle?: 'WEEKLY' | 'MONTHLY' | 'YEARLY';
48
168
  }
49
169
  type IapNextResult = 'success' | 'USER_CANCELED' | 'INVALID_PRODUCT_ID' | 'PAYMENT_PENDING' | 'NETWORK_ERROR' | 'ITEM_ALREADY_OWNED' | 'INTERNAL_ERROR';
50
170
  interface AnalyticsLogEntry {
51
- timestamp: number;
52
- type: string;
53
- params: Record<string, unknown>;
171
+ timestamp: number;
172
+ type: string;
173
+ params: Record<string, unknown>;
54
174
  }
55
175
  interface SafeAreaInsets$1 {
56
- top: number;
57
- bottom: number;
58
- left: number;
59
- right: number;
176
+ top: number;
177
+ bottom: number;
178
+ left: number;
179
+ right: number;
60
180
  }
61
- type Listener = () => void;
62
- interface AitDevtoolsState {
63
- platform: PlatformOS;
64
- environment: OperationalEnvironment;
65
- appVersion: string;
66
- locale: string;
67
- schemeUri: string;
68
- groupId: string;
69
- deploymentId: string;
70
- deviceId: string;
71
- brand: {
72
- displayName: string;
73
- icon: string;
74
- primaryColor: string;
75
- };
76
- networkStatus: NetworkStatus;
77
- permissions: Record<PermissionName, PermissionStatus>;
78
- location: MockLocation;
79
- safeAreaInsets: SafeAreaInsets$1;
80
- contacts: MockContact[];
81
- iap: {
82
- products: MockIapProduct[];
83
- nextResult: IapNextResult;
84
- pendingOrders: Array<{
85
- orderId: string;
86
- sku: string;
87
- paymentCompletedDate: string;
88
- }>;
89
- completedOrders: Array<{
90
- orderId: string;
91
- sku: string;
92
- status: 'COMPLETED' | 'REFUNDED';
93
- date: string;
94
- }>;
95
- };
96
- payment: {
97
- nextResult: 'success' | 'fail';
98
- failReason: string;
99
- };
100
- auth: {
101
- isLoggedIn: boolean;
102
- isTossLoginIntegrated: boolean;
103
- userKeyHash: string;
104
- };
105
- ads: {
106
- isLoaded: boolean;
107
- nextEvent: 'loaded' | 'clicked' | 'dismissed' | 'failedToShow' | 'impression' | 'userEarnedReward';
108
- };
109
- game: {
110
- profile: {
111
- nickname: string;
112
- profileImageUri: string;
113
- } | null;
114
- leaderboardScores: Array<{
115
- score: string;
116
- timestamp: number;
117
- }>;
118
- };
119
- analyticsLog: AnalyticsLogEntry[];
120
- deviceModes: DeviceModes;
121
- mockData: MockData;
122
- panelEditable: boolean;
181
+ //#endregion
182
+ //#region src/mock/device/camera.d.ts
183
+ /**
184
+ * Camera & Album Photos mock
185
+ * mock/web/prompt 모드 지원
186
+ */
187
+ declare const openCamera: ((_options?: {
188
+ base64?: boolean;
189
+ maxWidth?: number;
190
+ }) => Promise<{
191
+ id: string;
192
+ dataUri: string;
193
+ }>) & {
194
+ getPermission: () => Promise<PermissionStatus>;
195
+ openPermissionDialog: () => Promise<"allowed" | "denied">;
196
+ };
197
+ declare const fetchAlbumPhotos: ((options?: {
198
+ maxCount?: number;
199
+ maxWidth?: number;
200
+ base64?: boolean;
201
+ }) => Promise<Array<{
202
+ id: string;
203
+ dataUri: string;
204
+ }>>) & {
205
+ getPermission: () => Promise<PermissionStatus>;
206
+ openPermissionDialog: () => Promise<"allowed" | "denied">;
207
+ };
208
+ //#endregion
209
+ //#region src/mock/device/clipboard.d.ts
210
+ /**
211
+ * Clipboard mock
212
+ * mock/web 모드 지원
213
+ */
214
+ declare const getClipboardText: (() => Promise<string>) & {
215
+ getPermission: () => Promise<PermissionStatus>;
216
+ openPermissionDialog: () => Promise<"allowed" | "denied">;
217
+ };
218
+ declare const setClipboardText: ((text: string) => Promise<void>) & {
219
+ getPermission: () => Promise<PermissionStatus>;
220
+ openPermissionDialog: () => Promise<"allowed" | "denied">;
221
+ };
222
+ //#endregion
223
+ //#region src/mock/device/contacts.d.ts
224
+ /**
225
+ * Contacts mock
226
+ */
227
+ declare const fetchContacts: ((options: {
228
+ size: number;
229
+ offset: number;
230
+ query?: {
231
+ contains?: string;
232
+ };
233
+ }) => Promise<{
234
+ result: MockContact[];
235
+ nextOffset: number | null;
236
+ done: boolean;
237
+ }>) & {
238
+ getPermission: () => Promise<PermissionStatus>;
239
+ openPermissionDialog: () => Promise<"allowed" | "denied">;
240
+ };
241
+ //#endregion
242
+ //#region src/mock/device/haptic.d.ts
243
+ /**
244
+ * Haptic Feedback & saveBase64Data mock
245
+ */
246
+ declare function generateHapticFeedback(options: {
247
+ type: string;
248
+ }): Promise<void>;
249
+ declare function saveBase64Data(params: {
250
+ data: string;
251
+ fileName: string;
252
+ mimeType: string;
253
+ }): Promise<void>;
254
+ //#endregion
255
+ //#region src/mock/device/location.d.ts
256
+ declare enum Accuracy {
257
+ Lowest = 1,
258
+ Low = 2,
259
+ Balanced = 3,
260
+ High = 4,
261
+ Highest = 5,
262
+ BestForNavigation = 6
123
263
  }
124
- declare class AitStateManager {
125
- private _state;
126
- private _listeners;
127
- constructor();
128
- get state(): AitDevtoolsState;
129
- update(partial: Partial<AitDevtoolsState>): void;
130
- /** 중첩 객체 업데이트용 */
131
- patch<K extends keyof AitDevtoolsState>(key: K, partial: Partial<AitDevtoolsState[K]>): void;
132
- subscribe(listener: Listener): () => void;
133
- /** 분석 로그 추가 */
134
- logAnalytics(entry: Omit<AnalyticsLogEntry, 'timestamp'>): void;
135
- /** 이벤트 트리거 (backEvent, homeEvent 등) */
136
- trigger(event: string): void;
137
- reset(): void;
138
- private _notify;
264
+ declare const getCurrentLocation: ((_options?: {
265
+ accuracy: Accuracy;
266
+ }) => Promise<MockLocation>) & {
267
+ getPermission: () => Promise<PermissionStatus>;
268
+ openPermissionDialog: () => Promise<"allowed" | "denied">;
269
+ };
270
+ interface StartUpdateLocationEventParams {
271
+ onEvent: (response: MockLocation) => void;
272
+ onError: (error: unknown) => void;
273
+ options: {
274
+ accuracy: Accuracy;
275
+ timeInterval: number;
276
+ distanceInterval: number;
277
+ };
139
278
  }
140
- declare const aitState: AitStateManager;
141
-
279
+ declare const startUpdateLocation: ((eventParams: StartUpdateLocationEventParams) => (() => void)) & {
280
+ getPermission: () => Promise<PermissionStatus>;
281
+ openPermissionDialog: () => Promise<"allowed" | "denied">;
282
+ };
283
+ //#endregion
284
+ //#region src/mock/device/storage.d.ts
142
285
  /**
143
- * 인증/로그인 mock
286
+ * Storage mock
287
+ * localStorage에 `__ait_storage:` prefix로 저장하여 앱 자체 localStorage와 분리
144
288
  */
145
- declare function appLogin(): Promise<{
146
- authorizationCode: string;
147
- referrer: 'DEFAULT' | 'SANDBOX';
148
- }>;
149
- declare function getIsTossLoginIntegratedService(): Promise<boolean | undefined>;
150
- declare function getUserKeyForGame(): Promise<{
151
- hash: string;
152
- type: 'HASH';
153
- } | 'INVALID_CATEGORY' | 'ERROR' | undefined>;
154
- interface AppsInTossSignTossCertParams {
155
- txId: string;
289
+ declare const Storage: {
290
+ getItem: (key: string) => Promise<string | null>;
291
+ setItem: (key: string, value: string) => Promise<void>;
292
+ removeItem: (key: string) => Promise<void>;
293
+ clearItems: () => Promise<void>;
294
+ };
295
+ //#endregion
296
+ //#region src/mock/game/index.d.ts
297
+ /**
298
+ * 게임/프로모션 mock
299
+ */
300
+ declare function grantPromotionReward(params: {
301
+ params: {
302
+ promotionCode: string;
303
+ amount: number;
304
+ };
305
+ }): Promise<{
306
+ key: string;
307
+ } | {
308
+ errorCode: string;
309
+ message: string;
310
+ } | 'ERROR' | undefined>;
311
+ declare function grantPromotionRewardForGame(params: {
312
+ params: {
313
+ promotionCode: string;
314
+ amount: number;
315
+ };
316
+ }): Promise<{
317
+ key: string;
318
+ } | {
319
+ errorCode: string;
320
+ message: string;
321
+ } | 'ERROR' | undefined>;
322
+ declare function submitGameCenterLeaderBoardScore(params: {
323
+ score: string;
324
+ }): Promise<{
325
+ statusCode: 'SUCCESS' | 'LEADERBOARD_NOT_FOUND' | 'PROFILE_NOT_FOUND' | 'UNPARSABLE_SCORE';
326
+ } | undefined>;
327
+ declare function getGameCenterGameProfile(): Promise<{
328
+ statusCode: 'SUCCESS';
329
+ nickname: string;
330
+ profileImageUri: string;
331
+ } | {
332
+ statusCode: 'PROFILE_NOT_FOUND';
333
+ } | undefined>;
334
+ declare function openGameCenterLeaderboard(): Promise<void>;
335
+ interface ContactsViralEvent {
336
+ type: string;
337
+ data: Record<string, unknown>;
156
338
  }
157
- declare function appsInTossSignTossCert(_params: AppsInTossSignTossCertParams): Promise<void>;
158
-
339
+ declare function contactsViral(params: {
340
+ options: {
341
+ moduleId: string;
342
+ };
343
+ onEvent: (event: ContactsViralEvent) => void;
344
+ onError: (error: unknown) => void;
345
+ }): () => void;
346
+ //#endregion
347
+ //#region src/mock/iap/index.d.ts
159
348
  /**
160
- * 화면/네비게이션/이벤트 mock
349
+ * IAP (인앱결제) mock
161
350
  */
162
-
351
+ interface IapCreateOneTimePurchaseOrderOptions {
352
+ options: {
353
+ sku?: string;
354
+ productId?: string;
355
+ processProductGrant: (params: {
356
+ orderId: string;
357
+ }) => boolean | Promise<boolean>;
358
+ };
359
+ onEvent: (event: {
360
+ type: 'success';
361
+ data: IapOrderResult;
362
+ }) => void | Promise<void>;
363
+ onError: (error: unknown) => void | Promise<void>;
364
+ }
365
+ interface CreateSubscriptionPurchaseOrderOptions {
366
+ options: {
367
+ sku: string;
368
+ offerId?: string | null;
369
+ processProductGrant: (params: {
370
+ orderId: string;
371
+ subscriptionId?: string;
372
+ }) => boolean | Promise<boolean>;
373
+ };
374
+ onEvent: (event: {
375
+ type: 'success';
376
+ data: IapOrderResult;
377
+ }) => void | Promise<void>;
378
+ onError: (error: unknown) => void | Promise<void>;
379
+ }
380
+ interface IapOrderResult {
381
+ orderId: string;
382
+ displayName: string;
383
+ displayAmount: string;
384
+ amount: number;
385
+ currency: string;
386
+ fraction: number;
387
+ miniAppIconUrl: string | null;
388
+ }
389
+ declare const IAP: {
390
+ createOneTimePurchaseOrder(params: IapCreateOneTimePurchaseOrderOptions): () => void;
391
+ createSubscriptionPurchaseOrder(params: CreateSubscriptionPurchaseOrderOptions): () => void;
392
+ getProductItemList(): Promise<{
393
+ products: unknown[];
394
+ }>;
395
+ getPendingOrders(): Promise<{
396
+ orders: Array<{
397
+ orderId: string;
398
+ sku: string;
399
+ paymentCompletedDate: string;
400
+ }>;
401
+ }>;
402
+ getCompletedOrRefundedOrders(): Promise<{
403
+ hasNext: boolean;
404
+ nextKey?: string | null;
405
+ orders: Array<{
406
+ orderId: string;
407
+ sku: string;
408
+ status: "COMPLETED" | "REFUNDED";
409
+ date: string;
410
+ }>;
411
+ }>;
412
+ completeProductGrant(args: {
413
+ params: {
414
+ orderId: string;
415
+ };
416
+ }): Promise<boolean>;
417
+ getSubscriptionInfo(_args: {
418
+ params: {
419
+ orderId: string;
420
+ };
421
+ }): Promise<{
422
+ subscription: {
423
+ catalogId: number;
424
+ status: string;
425
+ expiresAt: string;
426
+ isAutoRenew: boolean;
427
+ gracePeriodExpiresAt: null;
428
+ isAccessible: boolean;
429
+ };
430
+ }>;
431
+ };
432
+ declare function checkoutPayment(options: {
433
+ params: {
434
+ payToken: string;
435
+ };
436
+ }): Promise<{
437
+ success: boolean;
438
+ reason?: string;
439
+ }>;
440
+ //#endregion
441
+ //#region src/mock/navigation/index.d.ts
163
442
  declare function closeView(): Promise<void>;
164
443
  declare function openURL(url: string): Promise<void>;
165
444
  declare function share(message: {
166
- message: string;
445
+ message: string;
167
446
  }): Promise<void>;
168
447
  declare function getTossShareLink(path: string, _ogImageUrl?: string): Promise<string>;
169
448
  declare function setIosSwipeGestureEnabled(_options: {
170
- isEnabled: boolean;
449
+ isEnabled: boolean;
171
450
  }): Promise<void>;
172
451
  declare function setDeviceOrientation(_options: {
173
- type: 'portrait' | 'landscape';
452
+ type: 'portrait' | 'landscape';
174
453
  }): Promise<void>;
175
454
  declare function setScreenAwakeMode(options: {
176
- enabled: boolean;
455
+ enabled: boolean;
177
456
  }): Promise<{
178
- enabled: boolean;
457
+ enabled: boolean;
179
458
  }>;
180
459
  declare function setSecureScreen(options: {
181
- enabled: boolean;
460
+ enabled: boolean;
182
461
  }): Promise<{
183
- enabled: boolean;
462
+ enabled: boolean;
184
463
  }>;
185
464
  declare function requestReview(): Promise<void>;
186
465
  declare function getPlatformOS(): 'ios' | 'android';
187
466
  declare function getOperationalEnvironment(): 'toss' | 'sandbox';
188
467
  declare function getTossAppVersion(): string;
189
468
  declare function isMinVersionSupported(minVersions: {
190
- android: string;
191
- ios: string;
469
+ android: string;
470
+ ios: string;
192
471
  }): boolean;
193
472
  declare function getSchemeUri(): string;
194
473
  declare function getLocale(): string;
@@ -197,433 +476,191 @@ declare function getGroupId(): string;
197
476
  declare function getNetworkStatus(): Promise<NetworkStatus>;
198
477
  declare function getServerTime(): Promise<number | undefined>;
199
478
  interface GraniteEventMap {
200
- backEvent: {
201
- onEvent: () => void;
202
- onError?: (error: Error) => void;
203
- options?: void;
204
- };
205
- homeEvent: {
206
- onEvent: () => void;
207
- onError?: (error: Error) => void;
208
- options?: void;
209
- };
479
+ backEvent: {
480
+ onEvent: () => void;
481
+ onError?: (error: Error) => void;
482
+ options?: undefined;
483
+ };
484
+ homeEvent: {
485
+ onEvent: () => void;
486
+ onError?: (error: Error) => void;
487
+ options?: undefined;
488
+ };
210
489
  }
211
490
  declare const graniteEvent: {
212
- addEventListener<K extends keyof GraniteEventMap>(event: K, { onEvent, onError }: {
213
- onEvent: GraniteEventMap[K]["onEvent"];
214
- onError?: GraniteEventMap[K]["onError"];
215
- options?: GraniteEventMap[K]["options"];
216
- }): () => void;
491
+ addEventListener<K extends keyof GraniteEventMap>(event: K, {
492
+ onEvent,
493
+ onError
494
+ }: {
495
+ onEvent: GraniteEventMap[K]["onEvent"];
496
+ onError?: GraniteEventMap[K]["onError"];
497
+ options?: GraniteEventMap[K]["options"];
498
+ }): () => void;
217
499
  };
218
500
  declare const appsInTossEvent: {
219
- addEventListener<K extends string>(_event: K, _handlers: {
220
- onEvent: (...args: unknown[]) => void;
221
- onError?: (error: Error) => void;
222
- options?: unknown;
223
- }): () => void;
501
+ addEventListener<K extends string>(_event: K, _handlers: {
502
+ onEvent: (...args: unknown[]) => void;
503
+ onError?: (error: Error) => void;
504
+ options?: unknown;
505
+ }): () => void;
224
506
  };
225
507
  interface TdsEventMap {
226
- navigationAccessoryEvent: {
227
- onEvent: (data: {
228
- id: string;
229
- }) => void;
230
- onError?: (error: Error) => void;
231
- options: undefined;
232
- };
508
+ navigationAccessoryEvent: {
509
+ onEvent: (data: {
510
+ id: string;
511
+ }) => void;
512
+ onError?: (error: Error) => void;
513
+ options: undefined;
514
+ };
233
515
  }
234
516
  declare const tdsEvent: {
235
- addEventListener<K extends keyof TdsEventMap>(event: K, { onEvent }: {
236
- onEvent: TdsEventMap[K]["onEvent"];
237
- onError?: TdsEventMap[K]["onError"];
238
- options?: TdsEventMap[K]["options"];
239
- }): () => void;
517
+ addEventListener<K extends keyof TdsEventMap>(event: K, {
518
+ onEvent
519
+ }: {
520
+ onEvent: TdsEventMap[K]["onEvent"];
521
+ onError?: TdsEventMap[K]["onError"];
522
+ options?: TdsEventMap[K]["options"];
523
+ }): () => void;
240
524
  };
241
525
  declare function onVisibilityChangedByTransparentServiceWeb(eventParams: {
242
- options: {
243
- callbackId: string;
244
- };
245
- onEvent: (isVisible: boolean) => void;
246
- onError: (error: unknown) => void;
526
+ options: {
527
+ callbackId: string;
528
+ };
529
+ onEvent: (isVisible: boolean) => void;
530
+ onError: (error: unknown) => void;
247
531
  }): () => void;
248
532
  declare const env: {
249
- getDeploymentId: () => string;
533
+ getDeploymentId: () => string;
250
534
  };
251
535
  declare function getAppsInTossGlobals(): {
252
- deploymentId: string;
253
- brandDisplayName: string;
254
- brandIcon: string;
255
- brandPrimaryColor: string;
536
+ deploymentId: string;
537
+ brandDisplayName: string;
538
+ brandIcon: string;
539
+ brandPrimaryColor: string;
256
540
  };
257
541
  type SafeAreaInsetsValue = {
258
- top: number;
259
- bottom: number;
260
- left: number;
261
- right: number;
542
+ top: number;
543
+ bottom: number;
544
+ left: number;
545
+ right: number;
262
546
  };
263
547
  type SafeAreaInsetsSubscribeHandler = {
264
- onEvent: (data: SafeAreaInsetsValue) => void;
548
+ onEvent: (data: SafeAreaInsetsValue) => void;
265
549
  };
266
550
  declare const SafeAreaInsets: {
267
- get: () => SafeAreaInsetsValue;
268
- subscribe: ({ onEvent }: SafeAreaInsetsSubscribeHandler) => (() => void);
551
+ get: () => SafeAreaInsetsValue;
552
+ subscribe: ({
553
+ onEvent
554
+ }: SafeAreaInsetsSubscribeHandler) => (() => void);
269
555
  };
270
556
  /** @deprecated */
271
557
  declare function getSafeAreaInsets(): number;
272
-
273
- declare function getDefaultPlaceholderImages(): string[];
274
- declare const Storage: {
275
- getItem: (key: string) => Promise<string | null>;
276
- setItem: (key: string, value: string) => Promise<void>;
277
- removeItem: (key: string) => Promise<void>;
278
- clearItems: () => Promise<void>;
279
- };
280
- declare enum Accuracy {
281
- Lowest = 1,
282
- Low = 2,
283
- Balanced = 3,
284
- High = 4,
285
- Highest = 5,
286
- BestForNavigation = 6
287
- }
288
-
289
- declare const getCurrentLocation: ((_options?: {
290
- accuracy: Accuracy;
291
- }) => Promise<MockLocation>) & {
292
- getPermission: () => Promise<PermissionStatus>;
293
- openPermissionDialog: () => Promise<"allowed" | "denied">;
294
- };
295
- interface StartUpdateLocationEventParams {
296
- onEvent: (response: MockLocation) => void;
297
- onError: (error: unknown) => void;
298
- options: {
299
- accuracy: Accuracy;
300
- timeInterval: number;
301
- distanceInterval: number;
302
- };
303
- }
304
- declare function _startUpdateLocation(eventParams: StartUpdateLocationEventParams): () => void;
305
- declare const startUpdateLocation: typeof _startUpdateLocation & {
306
- getPermission: () => Promise<PermissionStatus>;
307
- openPermissionDialog: () => Promise<"denied" | "allowed">;
308
- };
309
- declare const openCamera: ((_options?: {
310
- base64?: boolean;
311
- maxWidth?: number;
312
- }) => Promise<{
313
- id: string;
314
- dataUri: string;
315
- }>) & {
316
- getPermission: () => Promise<PermissionStatus>;
317
- openPermissionDialog: () => Promise<"allowed" | "denied">;
318
- };
319
- declare const fetchAlbumPhotos: ((options?: {
320
- maxCount?: number;
321
- maxWidth?: number;
322
- base64?: boolean;
323
- }) => Promise<Array<{
324
- id: string;
325
- dataUri: string;
326
- }>>) & {
327
- getPermission: () => Promise<PermissionStatus>;
328
- openPermissionDialog: () => Promise<"allowed" | "denied">;
329
- };
330
- declare const fetchContacts: ((options: {
331
- size: number;
332
- offset: number;
333
- query?: {
334
- contains?: string;
335
- };
336
- }) => Promise<{
337
- result: MockContact[];
338
- nextOffset: number | null;
339
- done: boolean;
340
- }>) & {
341
- getPermission: () => Promise<PermissionStatus>;
342
- openPermissionDialog: () => Promise<"allowed" | "denied">;
343
- };
344
- declare const getClipboardText: (() => Promise<string>) & {
345
- getPermission: () => Promise<PermissionStatus>;
346
- openPermissionDialog: () => Promise<"allowed" | "denied">;
347
- };
348
- declare const setClipboardText: ((text: string) => Promise<void>) & {
349
- getPermission: () => Promise<PermissionStatus>;
350
- openPermissionDialog: () => Promise<"allowed" | "denied">;
351
- };
352
- declare function generateHapticFeedback(options: {
353
- type: string;
354
- }): Promise<void>;
355
- declare function saveBase64Data(params: {
356
- data: string;
357
- fileName: string;
358
- mimeType: string;
359
- }): Promise<void>;
360
-
361
- /**
362
- * IAP (인앱결제) mock
363
- */
364
- interface IapCreateOneTimePurchaseOrderOptions {
365
- options: {
366
- sku?: string;
367
- productId?: string;
368
- processProductGrant: (params: {
369
- orderId: string;
370
- }) => boolean | Promise<boolean>;
371
- };
372
- onEvent: (event: {
373
- type: 'success';
374
- data: IapOrderResult;
375
- }) => void | Promise<void>;
376
- onError: (error: unknown) => void | Promise<void>;
377
- }
378
- interface CreateSubscriptionPurchaseOrderOptions {
379
- options: {
380
- sku: string;
381
- offerId?: string | null;
382
- processProductGrant: (params: {
383
- orderId: string;
384
- subscriptionId?: string;
385
- }) => boolean | Promise<boolean>;
386
- };
387
- onEvent: (event: {
388
- type: 'success';
389
- data: IapOrderResult;
390
- }) => void | Promise<void>;
391
- onError: (error: unknown) => void | Promise<void>;
392
- }
393
- interface IapOrderResult {
394
- orderId: string;
395
- displayName: string;
396
- displayAmount: string;
397
- amount: number;
398
- currency: string;
399
- fraction: number;
400
- miniAppIconUrl: string | null;
401
- }
402
- declare const IAP: {
403
- createOneTimePurchaseOrder(params: IapCreateOneTimePurchaseOrderOptions): () => void;
404
- createSubscriptionPurchaseOrder(params: CreateSubscriptionPurchaseOrderOptions): () => void;
405
- getProductItemList(): Promise<{
406
- products: unknown[];
407
- }>;
408
- getPendingOrders(): Promise<{
409
- orders: Array<{
410
- orderId: string;
411
- sku: string;
412
- paymentCompletedDate: string;
413
- }>;
414
- }>;
415
- getCompletedOrRefundedOrders(): Promise<{
416
- hasNext: boolean;
417
- nextKey?: string | null;
418
- orders: Array<{
419
- orderId: string;
420
- sku: string;
421
- status: "COMPLETED" | "REFUNDED";
422
- date: string;
423
- }>;
424
- }>;
425
- completeProductGrant(args: {
426
- params: {
427
- orderId: string;
428
- };
429
- }): Promise<boolean>;
430
- getSubscriptionInfo(_args: {
431
- params: {
432
- orderId: string;
433
- };
434
- }): Promise<{
435
- subscription: {
436
- catalogId: number;
437
- status: string;
438
- expiresAt: string;
439
- isAutoRenew: boolean;
440
- gracePeriodExpiresAt: null;
441
- isAccessible: boolean;
442
- };
443
- }>;
444
- };
445
- declare function checkoutPayment(options: {
446
- params: {
447
- payToken: string;
448
- };
449
- }): Promise<{
450
- success: boolean;
451
- reason?: string;
452
- }>;
453
-
454
- /**
455
- * 광고 mock (GoogleAdMob, TossAds, FullScreenAd)
456
- */
457
- declare const GoogleAdMob: {
458
- loadAppsInTossAdMob: ((args: {
459
- onEvent: (data: {
460
- type: string;
461
- data?: unknown;
462
- }) => void;
463
- onError: (error: Error) => void;
464
- options?: {
465
- adGroupId?: string;
466
- };
467
- }) => (() => void)) & {
468
- isSupported: () => boolean;
469
- };
470
- showAppsInTossAdMob: ((args: {
471
- onEvent: (data: {
472
- type: string;
473
- data?: unknown;
474
- }) => void;
475
- onError: (error: Error) => void;
476
- options?: {
477
- adGroupId?: string;
478
- };
479
- }) => (() => void)) & {
480
- isSupported: () => boolean;
481
- };
482
- isAppsInTossAdMobLoaded: ((_options: {
483
- adGroupId?: string;
484
- }) => Promise<boolean>) & {
485
- isSupported: () => boolean;
486
- };
487
- };
488
- declare const TossAds: {
489
- initialize: ((_options: unknown) => void) & {
490
- isSupported: () => boolean;
491
- };
492
- attach: ((_adGroupId: string, target: string | HTMLElement, _options?: unknown) => void) & {
493
- isSupported: () => boolean;
494
- };
495
- attachBanner: ((_adGroupId: string, target: string | HTMLElement, _options?: unknown) => {
496
- destroy: () => void;
497
- }) & {
498
- isSupported: () => boolean;
499
- };
500
- destroy: ((_slotId: string) => void) & {
501
- isSupported: () => boolean;
502
- };
503
- destroyAll: (() => void) & {
504
- isSupported: () => boolean;
505
- };
506
- };
507
- declare const loadFullScreenAd: ((args: {
508
- onEvent: (data: {
509
- type: string;
510
- data?: unknown;
511
- }) => void;
512
- onError: (error: Error) => void;
513
- options?: {
514
- adGroupId?: string;
515
- };
516
- }) => (() => void)) & {
517
- isSupported: () => boolean;
518
- };
519
- declare const showFullScreenAd: ((args: {
520
- onEvent: (data: {
521
- type: string;
522
- data?: unknown;
523
- }) => void;
524
- onError: (error: Error) => void;
525
- options?: {
526
- adGroupId?: string;
527
- };
528
- }) => (() => void)) & {
529
- isSupported: () => boolean;
530
- };
531
-
532
- /**
533
- * 게임/프로모션 mock
534
- */
535
- declare function grantPromotionReward(params: {
536
- params: {
537
- promotionCode: string;
538
- amount: number;
539
- };
540
- }): Promise<{
541
- key: string;
542
- } | {
543
- errorCode: string;
544
- message: string;
545
- } | 'ERROR' | undefined>;
546
- declare function grantPromotionRewardForGame(params: {
547
- params: {
548
- promotionCode: string;
549
- amount: number;
550
- };
551
- }): Promise<{
552
- key: string;
553
- } | {
554
- errorCode: string;
555
- message: string;
556
- } | 'ERROR' | undefined>;
557
- declare function submitGameCenterLeaderBoardScore(params: {
558
- score: string;
559
- }): Promise<{
560
- statusCode: 'SUCCESS' | 'LEADERBOARD_NOT_FOUND' | 'PROFILE_NOT_FOUND' | 'UNPARSABLE_SCORE';
561
- } | undefined>;
562
- declare function getGameCenterGameProfile(): Promise<{
563
- statusCode: 'SUCCESS';
564
- nickname: string;
565
- profileImageUri: string;
566
- } | {
567
- statusCode: 'PROFILE_NOT_FOUND';
568
- } | undefined>;
569
- declare function openGameCenterLeaderboard(): Promise<void>;
570
- interface ContactsViralEvent {
571
- type: string;
572
- data: Record<string, unknown>;
573
- }
574
- declare function contactsViral(params: {
575
- options: {
576
- moduleId: string;
577
- };
578
- onEvent: (event: ContactsViralEvent) => void;
579
- onError: (error: unknown) => void;
580
- }): () => void;
581
-
582
- /**
583
- * Analytics mock
584
- */
585
- type Primitive$1 = string | number | boolean | null | undefined | symbol;
586
- type LoggerParams = {
587
- log_name?: string;
588
- } & Record<string, Primitive$1>;
589
- declare const Analytics: {
590
- screen: (params?: LoggerParams) => Promise<void> | undefined;
591
- impression: (params?: LoggerParams) => Promise<void> | undefined;
592
- click: (params?: LoggerParams) => Promise<void> | undefined;
593
- };
594
- declare function eventLog(params: {
595
- log_name: string;
596
- log_type: 'debug' | 'info' | 'warn' | 'error' | 'event' | 'screen' | 'impression' | 'click';
597
- params: Record<string, Primitive$1>;
598
- }): Promise<void>;
599
-
558
+ //#endregion
559
+ //#region src/mock/partner/index.d.ts
600
560
  /**
601
561
  * Partner / TDS mock
602
562
  */
603
563
  interface AddAccessoryButtonOptions {
604
- id: string;
605
- title: string;
606
- icon: {
607
- name: string;
608
- };
564
+ id: string;
565
+ title: string;
566
+ icon: {
567
+ name: string;
568
+ };
609
569
  }
610
570
  declare const partner: {
611
- addAccessoryButton(options: AddAccessoryButtonOptions): Promise<void>;
612
- removeAccessoryButton(): Promise<void>;
571
+ addAccessoryButton(options: AddAccessoryButtonOptions): Promise<void>;
572
+ removeAccessoryButton(): Promise<void>;
613
573
  };
614
-
615
- /**
616
- * 권한 시스템 mock
617
- * 각 디바이스 API (.getPermission, .openPermissionDialog)에 부착된다.
618
- */
619
-
574
+ //#endregion
575
+ //#region src/mock/permissions.d.ts
620
576
  declare function getPermission(name: PermissionName): Promise<PermissionStatus>;
621
577
  declare function openPermissionDialog(name: PermissionName): Promise<'allowed' | 'denied'>;
622
578
  declare function requestPermission(permission: {
623
- name: PermissionName;
624
- access: string;
579
+ name: PermissionName;
580
+ access: string;
625
581
  }): Promise<'allowed' | 'denied'>;
626
-
627
- type Primitive = string | number | boolean | null | undefined | symbol;
628
-
629
- export { Accuracy, type AitDevtoolsState, Analytics, type AnalyticsLogEntry, type DeviceApiMode, type DeviceModes, GoogleAdMob, type HapticFeedbackType, IAP, type IapNextResult, type LocationCoords, type MockContact, type MockData, type MockIapProduct, type MockLocation, type NetworkStatus, type OperationalEnvironment, type PermissionName, type PermissionStatus, type PlatformOS, type Primitive, SafeAreaInsets, type SafeAreaInsets$1 as SafeAreaInsetsType, Storage, TossAds, aitState, appLogin, appsInTossEvent, appsInTossSignTossCert, checkoutPayment, closeView, contactsViral, env, eventLog, fetchAlbumPhotos, fetchContacts, generateHapticFeedback, getAppsInTossGlobals, getClipboardText, getCurrentLocation, getDefaultPlaceholderImages, getDeviceId, getGameCenterGameProfile, getGroupId, getIsTossLoginIntegratedService, getLocale, getNetworkStatus, getOperationalEnvironment, getPermission, getPlatformOS, getSafeAreaInsets, getSchemeUri, getServerTime, getTossAppVersion, getTossShareLink, getUserKeyForGame, graniteEvent, grantPromotionReward, grantPromotionRewardForGame, isMinVersionSupported, loadFullScreenAd, onVisibilityChangedByTransparentServiceWeb, openCamera, openGameCenterLeaderboard, openPermissionDialog, openURL, partner, requestPermission, requestReview, saveBase64Data, setClipboardText, setDeviceOrientation, setIosSwipeGestureEnabled, setScreenAwakeMode, setSecureScreen, share, showFullScreenAd, startUpdateLocation, submitGameCenterLeaderBoardScore, tdsEvent };
582
+ //#endregion
583
+ //#region src/mock/state.d.ts
584
+ type Listener = () => void;
585
+ interface AitDevtoolsState {
586
+ platform: PlatformOS;
587
+ environment: OperationalEnvironment;
588
+ appVersion: string;
589
+ locale: string;
590
+ schemeUri: string;
591
+ groupId: string;
592
+ deploymentId: string;
593
+ deviceId: string;
594
+ brand: {
595
+ displayName: string;
596
+ icon: string;
597
+ primaryColor: string;
598
+ };
599
+ networkStatus: NetworkStatus;
600
+ permissions: Record<PermissionName, PermissionStatus>;
601
+ location: MockLocation;
602
+ safeAreaInsets: SafeAreaInsets$1;
603
+ contacts: MockContact[];
604
+ iap: {
605
+ products: MockIapProduct[];
606
+ nextResult: IapNextResult;
607
+ pendingOrders: Array<{
608
+ orderId: string;
609
+ sku: string;
610
+ paymentCompletedDate: string;
611
+ }>;
612
+ completedOrders: Array<{
613
+ orderId: string;
614
+ sku: string;
615
+ status: 'COMPLETED' | 'REFUNDED';
616
+ date: string;
617
+ }>;
618
+ };
619
+ payment: {
620
+ nextResult: 'success' | 'fail';
621
+ failReason: string;
622
+ };
623
+ auth: {
624
+ isLoggedIn: boolean;
625
+ isTossLoginIntegrated: boolean;
626
+ userKeyHash: string;
627
+ };
628
+ ads: {
629
+ isLoaded: boolean;
630
+ nextEvent: 'loaded' | 'clicked' | 'dismissed' | 'failedToShow' | 'impression' | 'userEarnedReward';
631
+ };
632
+ game: {
633
+ profile: {
634
+ nickname: string;
635
+ profileImageUri: string;
636
+ } | null;
637
+ leaderboardScores: Array<{
638
+ score: string;
639
+ timestamp: number;
640
+ }>;
641
+ };
642
+ analyticsLog: AnalyticsLogEntry[];
643
+ deviceModes: DeviceModes;
644
+ mockData: MockData;
645
+ panelEditable: boolean;
646
+ }
647
+ declare class AitStateManager {
648
+ private _state;
649
+ private _listeners;
650
+ constructor();
651
+ get state(): AitDevtoolsState;
652
+ update(partial: Partial<AitDevtoolsState>): void;
653
+ /** 중첩 객체 업데이트용 */
654
+ patch<K extends keyof AitDevtoolsState>(key: K, partial: Partial<AitDevtoolsState[K]>): void;
655
+ subscribe(listener: Listener): () => void;
656
+ /** 분석 로그 추가 */
657
+ logAnalytics(entry: Omit<AnalyticsLogEntry, 'timestamp'>): void;
658
+ /** 이벤트 트리거 (backEvent, homeEvent 등) */
659
+ trigger(event: string): void;
660
+ reset(): void;
661
+ private _notify;
662
+ }
663
+ declare const aitState: AitStateManager;
664
+ //#endregion
665
+ export { Accuracy, type AitDevtoolsState, Analytics, type AnalyticsLogEntry, type DeviceApiMode, type DeviceModes, GoogleAdMob, type HapticFeedbackType, IAP, type IapNextResult, type LocationCoords, type MockContact, type MockData, type MockIapProduct, type MockLocation, type NetworkStatus, type OperationalEnvironment, type PermissionName, type PermissionStatus, type PlatformOS, type Primitive, type SafeAreaInsets, type SafeAreaInsets$1 as SafeAreaInsetsType, Storage, TossAds, aitState, appLogin, appsInTossEvent, appsInTossSignTossCert, checkoutPayment, closeView, contactsViral, env, eventLog, fetchAlbumPhotos, fetchContacts, generateHapticFeedback, getAppsInTossGlobals, getClipboardText, getCurrentLocation, getDefaultPlaceholderImages, getDeviceId, getGameCenterGameProfile, getGroupId, getIsTossLoginIntegratedService, getLocale, getNetworkStatus, getOperationalEnvironment, getPermission, getPlatformOS, getSafeAreaInsets, getSchemeUri, getServerTime, getTossAppVersion, getTossShareLink, getUserKeyForGame, graniteEvent, grantPromotionReward, grantPromotionRewardForGame, isMinVersionSupported, loadFullScreenAd, onVisibilityChangedByTransparentServiceWeb, openCamera, openGameCenterLeaderboard, openPermissionDialog, openURL, partner, requestPermission, requestReview, saveBase64Data, setClipboardText, setDeviceOrientation, setIosSwipeGestureEnabled, setScreenAwakeMode, setSecureScreen, share, showFullScreenAd, startUpdateLocation, submitGameCenterLeaderBoardScore, tdsEvent };
666
+ //# sourceMappingURL=index.d.ts.map