@apps-in-toss/native-modules 1.0.2 → 1.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.
Files changed (42) hide show
  1. package/dist/VisibilityChangedByTransparentServiceWebEvent-D6XJvPVh.d.cts +20 -0
  2. package/dist/VisibilityChangedByTransparentServiceWebEvent-D6XJvPVh.d.ts +20 -0
  3. package/dist/bridges-meta.json +24 -12
  4. package/dist/chunk-YS54L7RG.js +209 -0
  5. package/dist/index.cjs +209 -150
  6. package/dist/index.d.cts +662 -592
  7. package/dist/index.d.ts +662 -592
  8. package/dist/index.js +186 -128
  9. package/dist/private.cjs +236 -0
  10. package/dist/private.d.cts +17 -0
  11. package/dist/private.d.ts +17 -0
  12. package/dist/private.js +11 -0
  13. package/package.json +3 -2
  14. package/src/AppsInTossModule/native-event-emitter/StartUpdateLocationPermissionError.ts +1 -0
  15. package/src/AppsInTossModule/native-event-emitter/appsInTossEvent.ts +2 -0
  16. package/src/AppsInTossModule/native-event-emitter/event-plugins/HomeIconButtonClickHandleEvent.ts +10 -0
  17. package/src/AppsInTossModule/native-event-emitter/event-plugins/UpdateLocationEvent.ts +3 -3
  18. package/src/AppsInTossModule/native-event-emitter/index.ts +2 -0
  19. package/src/AppsInTossModule/native-event-emitter/internal/appBridge.ts +7 -1
  20. package/src/AppsInTossModule/native-event-emitter/startUpdateLocation.ts +64 -44
  21. package/src/AppsInTossModule/native-modules/AppsInTossModule.ts +22 -27
  22. package/src/AppsInTossModule/native-modules/ads/googleAdMobV2.ts +3 -3
  23. package/src/AppsInTossModule/native-modules/ads/types.ts +1 -1
  24. package/src/AppsInTossModule/native-modules/getPermission.ts +1 -1
  25. package/src/AppsInTossModule/native-modules/index.ts +9 -6
  26. package/src/AppsInTossModule/native-modules/permissions/createPermissionFunction.ts +25 -0
  27. package/src/AppsInTossModule/native-modules/permissions/fetchAlbumPhotos/fetchAlbumPhotos.ts +109 -0
  28. package/src/AppsInTossModule/native-modules/{fetchContacts.ts → permissions/fetchContacts/fetchContacts.ts} +51 -40
  29. package/src/AppsInTossModule/native-modules/permissions/getClipboardText/getClipboardText.ts +87 -0
  30. package/src/AppsInTossModule/native-modules/permissions/getCurrentLocation/getCurrentLocation.ts +88 -0
  31. package/src/AppsInTossModule/native-modules/permissions/openCamera/openCamera.ts +99 -0
  32. package/src/AppsInTossModule/native-modules/{openPermissionDialog.ts → permissions/openPermissionDialog.ts} +3 -3
  33. package/src/AppsInTossModule/native-modules/{requestPermission.ts → permissions/requestPermission.ts} +2 -2
  34. package/src/AppsInTossModule/native-modules/permissions/setClipboardText/setClipboardText.ts +75 -0
  35. package/src/AppsInTossModule/native-modules/saveBase64Data.ts +1 -1
  36. package/src/async-bridges.ts +9 -6
  37. package/src/types.ts +0 -106
  38. package/src/AppsInTossModule/native-modules/fetchAlbumPhotos.ts +0 -88
  39. package/src/AppsInTossModule/native-modules/getClipboardText.ts +0 -47
  40. package/src/AppsInTossModule/native-modules/getCurrentLocation.ts +0 -65
  41. package/src/AppsInTossModule/native-modules/openCamera.ts +0 -81
  42. package/src/AppsInTossModule/native-modules/setClipboardText.ts +0 -39
package/dist/index.d.ts CHANGED
@@ -1,131 +1,14 @@
1
- import { EmitterSubscription, TurboModule } from 'react-native';
1
+ import * as _apps_in_toss_types from '@apps-in-toss/types';
2
+ import { Location, StartUpdateLocationEventParams, Accuracy, CompatiblePlaceholderArgument, SetClipboardTextOptions, FetchContactsOptions, ContactResult, FetchAlbumPhotosOptions, ImageResponse, GetCurrentLocationOptions, OpenCameraOptions, PermissionName, PermissionAccess, PermissionStatus, FetchAlbumPhotos, FetchContacts, GetClipboardText, GetCurrentLocation, SetClipboardText, OpenCamera } from '@apps-in-toss/types';
3
+ export { StartUpdateLocationPermissionError } from '@apps-in-toss/types';
2
4
  import { GraniteEventDefinition, GraniteEvent } from '@granite-js/react-native';
5
+ import { EmitterSubscription, TurboModule } from 'react-native';
3
6
 
4
7
  interface EventEmitterSchema<K extends string, P extends unknown[]> {
5
8
  name: K;
6
9
  params: P;
7
10
  }
8
11
 
9
- type PermissionStatus = 'notDetermined' | 'denied' | 'allowed';
10
- type PermissionAccess = 'read' | 'write' | 'access';
11
- type PermissionName = 'clipboard' | 'contacts' | 'photos' | 'geolocation' | 'camera';
12
- type Primitive = string | number | boolean | null | undefined | symbol;
13
- /**
14
- * @public
15
- * @category 위치 정보
16
- * @name Accuracy
17
- * @description 위치 정확도 옵션이에요.
18
- */
19
- declare enum Accuracy {
20
- /**
21
- * 오차범위 3KM 이내
22
- */
23
- Lowest = 1,
24
- /**
25
- * 오차범위 1KM 이내
26
- */
27
- Low = 2,
28
- /**
29
- * 오차범위 몇 백미터 이내
30
- */
31
- Balanced = 3,
32
- /**
33
- * 오차범위 10M 이내
34
- */
35
- High = 4,
36
- /**
37
- * 가장 높은 정확도
38
- */
39
- Highest = 5,
40
- /**
41
- * 네비게이션을 위한 최고 정확도
42
- */
43
- BestForNavigation = 6
44
- }
45
- /**
46
- * @public
47
- * @category 위치 정보
48
- * @name Location
49
- * @description 위치 정보를 나타내는 객체예요.
50
- */
51
- interface Location {
52
- /**
53
- * Android에서만 지원하는 옵션이에요.
54
- *
55
- * - `FINE`: 정확한 위치
56
- * - `COARSE`: 대략적인 위치
57
- *
58
- * @see https://developer.android.com/codelabs/approximate-location
59
- */
60
- accessLocation?: 'FINE' | 'COARSE';
61
- /**
62
- * 위치가 업데이트된 시점의 유닉스 타임스탬프예요.
63
- */
64
- timestamp: number;
65
- /**
66
- * @description 위치 정보를 나타내는 객체예요. 자세한 내용은 [LocationCoords](/react-native/reference/native-modules/Types/LocationCoords.html)을 참고해주세요.
67
- */
68
- coords: LocationCoords;
69
- }
70
- /**
71
- * @public
72
- * @category 위치 정보
73
- * @name LocationCoords
74
- * @description 세부 위치 정보를 나타내는 객체예요.
75
- */
76
- interface LocationCoords {
77
- /**
78
- * 위도
79
- */
80
- latitude: number;
81
- /**
82
- * 경도
83
- */
84
- longitude: number;
85
- /**
86
- * 높이
87
- */
88
- altitude: number;
89
- /**
90
- * 위치 정확도
91
- */
92
- accuracy: number;
93
- /**
94
- * 고도 정확도
95
- */
96
- altitudeAccuracy: number;
97
- /**
98
- * 방향
99
- */
100
- heading: number;
101
- }
102
- /**
103
- * 사진 조회 결과를 나타내는 타입이에요.
104
- */
105
- interface ImageResponse {
106
- /** 가져온 사진의 고유 ID예요. */
107
- id: string;
108
- /** 사진의 데이터 URI예요. `base64` 옵션이 `true`인 경우 Base64 문자열로 반환돼요. */
109
- dataUri: string;
110
- }
111
-
112
- interface StartUpdateLocationOptions$1 {
113
- /**
114
- * 위치 정확도를 설정해요.
115
- */
116
- accuracy: Accuracy;
117
- /**
118
- * 위치 업데이트 주기를 밀리초(ms) 단위로 설정해요.
119
- */
120
- timeInterval: number;
121
- /**
122
- * 위치 변경 거리를 미터(m) 단위로 설정해요.
123
- */
124
- distanceInterval: number;
125
- }
126
- interface StartUpdateLocationSubscription extends EmitterSubscription {
127
- remove: () => Promise<void>;
128
- }
129
12
  /**
130
13
  * @name UpdateLocationEventEmitter
131
14
  * @kind typedef
@@ -141,26 +24,46 @@ type UpdateLocationEventEmitter = EventEmitterSchema<'updateLocation', [Location
141
24
  * 실시간 위치 추적이 필요한 기능을 구현할 때 사용할 수 있어요. 예를 들어 지도 앱에서 사용자의 현재 위치를 실시간으로 업데이트할 때, 운동 앱에서 사용자의 이동 거리를 기록할 때 등이에요.
142
25
  * 위치 업데이트 주기와 정확도를 조정해 배터리 소모를 최소화하면서도 필요한 정보를 얻을 수 있어요.
143
26
  *
27
+ *
28
+ * @param {(error: unknown) => void} onError 위치 정보 감지에 실패했을 때 호출되는 콜백 함수예요.
29
+ * @param {(location: Location) => void} onEvent 위치 정보가 변경될 때 호출되는 콜백 함수예요. 자세한 내용은 [Location](/react-native/reference/native-modules/Types/Location.html)을 참고해주세요.
144
30
  * @param {StartUpdateLocationOptions} options - 위치 정보 감지에 필요한 설정 객체에요.
145
31
  * @param {number} [options.accuracy] 위치 정확도를 설정해요.
146
32
  * @param {number} [options.timeInterval] 위치 정보를 업데이트하는 최소 주기로, 단위는 밀리초(ms)예요. 이 값은 위치 업데이트가 발생하는 가장 짧은 간격을 설정하지만, 시스템이나 환경의 영향을 받아 지정한 주기보다 더 긴 간격으로 업데이트될 수 있어요.
147
33
  * @param {number} [options.distanceInterval] 위치 변경 거리를 미터(m) 단위로 설정해요.
148
- * @param {(location: Location) => void} [options.callback] 위치 정보가 변경될 때 호출되는 콜백 함수예요. 자세한 내용은 [Location](/react-native/reference/native-modules/Types/Location.html)을 참고해주세요.
34
+ *
35
+ * @property [openPermissionDialog] - 위치 정보 권한을 다시 요청하는 다이얼로그를 표시해요. 사용자는 "허용", "한 번만 허용", "안하기" 중 하나를 선택할 수 있어요. "허용"이나 "한 번만 허용"을 선택하면 `allowed`를 반환하고, "안하기"를 선택하면 `denied`를 반환해요.
36
+ * @property [getPermission] - 위치 정보 권한의 현재 상태를 반환해요. `allowed`는 사용자가 위치 정보 권한을 허용한 상태예요. `denied`는 사용자가 위치 정보 권한을 거부한 상태예요. `notDetermined`는 위치 정보 권한 요청을 한 번도 하지 않은 상태예요.
37
+ *
38
+ * @signature
39
+ * ```typescript
40
+ * function startUpdateLocation(options: {
41
+ * onError: (error: unknown) => void;
42
+ * onEvent: (location: Location) => void;
43
+ * options: StartUpdateLocationOptions;
44
+ * }): () => void;
45
+ * ```
149
46
  *
150
47
  * @example
151
48
  * ### 위치 정보 변경 감지하기
152
49
  *
50
+ * 위치 정보가 변경되는것을 감지하는 예제예요. "위치 정보 변경 감지하기"를 눌러서 감지할 수 있어요.
51
+ *
52
+ * "권한 확인하기"버튼을 눌러서 현재 위치 정보 변경 감지 권한을 확인해요.
53
+ * 사용자가 권한을 거부했거나 시스템에서 권한이 제한된 경우에는 [`StartUpdateLocationPermissionError`](/react-native/reference/types/권한/StartUpdateLocationPermissionError)를 반환해요.
54
+ * "권한 요청하기"버튼을 눌러서 위치 정보 변경 감지 권한을 요청할 수 있어요.
55
+ *
153
56
  * ```tsx
154
- * import React, { useState, useEffect } from 'react';
155
- * import { View, Text, Button } from 'react-native';
156
- * import { startUpdateLocation } from '@apps-in-toss/framework';
57
+ * import { Accuracy, Location, startUpdateLocation, StartUpdateLocationPermissionError } from '@apps-in-toss/framework';
58
+ * import { useCallback, useState } from 'react';
59
+ * import { Alert, Button, Text, View } from 'react-native';
157
60
  *
158
61
  * // 위치 정보 변경 감지하기
159
62
  * function LocationWatcher() {
160
- * const [location, setLocation] = useState(null);
63
+ * const [location, setLocation] = useState<Location | null>(null);
161
64
  *
162
- * useEffect(() => {
163
- * return startUpdateLocation({
65
+ * const handlePress = useCallback(() => {
66
+ * startUpdateLocation({
164
67
  * options: {
165
68
  * accuracy: Accuracy.Balanced,
166
69
  * timeInterval: 3000,
@@ -170,33 +73,53 @@ type UpdateLocationEventEmitter = EventEmitterSchema<'updateLocation', [Location
170
73
  * setLocation(location);
171
74
  * },
172
75
  * onError: (error) => {
76
+ * if (error instanceof StartUpdateLocationPermissionError) {
77
+ * // 위치 정보 변경 감지 권한 없음
78
+ * }
173
79
  * console.error('위치 정보를 가져오는데 실패했어요:', error);
174
80
  * },
175
81
  * });
176
82
  * }, []);
177
83
  *
178
- * if (location == null) {
179
- * return <Text>위치 정보를 가져오는 중이에요...</Text>;
180
- * }
181
- *
182
84
  * return (
183
85
  * <View>
184
- * <Text>위도: {location.coords.latitude}</Text>
185
- * <Text>경도: {location.coords.longitude}</Text>
186
- * <Text>위치 정확도: {location.coords.accuracy}m</Text>
187
- * <Text>높이: {location.coords.altitude}m</Text>
188
- * <Text>고도 정확도: {location.coords.altitudeAccuracy}m</Text>
189
- * <Text>방향: {location.coords.heading}°</Text>
86
+ * {location != null && (
87
+ * <>
88
+ * <Text>위도: {location.coords.latitude}</Text>
89
+ * <Text>경도: {location.coords.longitude}</Text>
90
+ * <Text>위치 정확도: {location.coords.accuracy}m</Text>
91
+ * <Text>높이: {location.coords.altitude}m</Text>
92
+ * <Text>고도 정확도: {location.coords.altitudeAccuracy}m</Text>
93
+ * <Text>방향: {location.coords.heading}°</Text>
94
+ * </>
95
+ * )}
96
+ *
97
+ * <Button title="위치 정보 변경 감지하기" onPress={handlePress} />
98
+ *
99
+ * <Button
100
+ * title="권한 확인하기"
101
+ * onPress={async () => {
102
+ * const permission = await startUpdateLocation.getPermission();
103
+ * Alert.alert(permission);
104
+ * }}
105
+ * />
106
+ * <Button
107
+ * title="권한 요청하기"
108
+ * onPress={async () => {
109
+ * const permission = await startUpdateLocation.openPermissionDialog();
110
+ * Alert.alert(permission);
111
+ * }}
112
+ * />
190
113
  * </View>
191
114
  * );
192
115
  * }
193
116
  * ```
194
117
  */
195
- declare function startUpdateLocation(eventParams: {
196
- onEvent: (response: Location) => void;
197
- onError: (error: unknown) => void;
198
- options: StartUpdateLocationOptions$1;
199
- }): () => void;
118
+ declare function startUpdateLocation(eventParams: StartUpdateLocationEventParams): () => void;
119
+ declare namespace startUpdateLocation {
120
+ var openPermissionDialog: _apps_in_toss_types.PermissionDialogFunction;
121
+ var getPermission: _apps_in_toss_types.GetPermissionFunction;
122
+ }
200
123
 
201
124
  /**
202
125
  * @public
@@ -314,6 +237,12 @@ declare class EntryMessageExitedEvent extends GraniteEventDefinition<undefined,
314
237
  listener(_: undefined): void;
315
238
  }
316
239
 
240
+ declare class HomeIconButtonClickHandleEvent extends GraniteEventDefinition<undefined, undefined> {
241
+ name: "homeIconButtonClickEvent";
242
+ remove(): void;
243
+ listener(_: undefined): void;
244
+ }
245
+
317
246
  interface StartUpdateLocationOptions {
318
247
  /**
319
248
  * 위치 정확도를 설정해요.
@@ -363,7 +292,7 @@ declare class VisibilityChangedByTransparentServiceWebEvent extends GraniteEvent
363
292
  private isVisibilityChangedByTransparentServiceWebResult;
364
293
  }
365
294
 
366
- declare const appsInTossEvent: GraniteEvent<EntryMessageExitedEvent | UpdateLocationEvent | AppBridgeCallbackEvent | VisibilityChangedByTransparentServiceWebEvent>;
295
+ declare const appsInTossEvent: GraniteEvent<EntryMessageExitedEvent | HomeIconButtonClickHandleEvent | UpdateLocationEvent | AppBridgeCallbackEvent | VisibilityChangedByTransparentServiceWebEvent>;
367
296
 
368
297
  declare function onVisibilityChangedByTransparentServiceWeb(eventParams: {
369
298
  options: {
@@ -373,6 +302,24 @@ declare function onVisibilityChangedByTransparentServiceWeb(eventParams: {
373
302
  onError: (error: unknown) => void;
374
303
  }): () => void;
375
304
 
305
+ interface AppBridgeCompatCallbacks<Result> {
306
+ onSuccess: (result: Result) => void;
307
+ onError: (reason: unknown) => void;
308
+ }
309
+ type AppBridgeCallback = (...args: any[]) => void;
310
+ declare function invokeAppBridgeCallback(id: string, ...args: any[]): boolean;
311
+ declare function invokeAppBridgeMethod<Result = any, Params = any>(methodName: string, params: Params, callbacks: AppBridgeCompatCallbacks<Result> & Record<string, AppBridgeCallback>): () => void;
312
+ declare function registerCallback(callback: AppBridgeCallback, name?: string): string;
313
+ declare function unregisterCallback(id: string): void;
314
+ declare function getCallbackIds(): string[];
315
+ declare const INTERNAL__appBridgeHandler: {
316
+ invokeAppBridgeCallback: typeof invokeAppBridgeCallback;
317
+ invokeAppBridgeMethod: typeof invokeAppBridgeMethod;
318
+ registerCallback: typeof registerCallback;
319
+ unregisterCallback: typeof unregisterCallback;
320
+ getCallbackIds: typeof getCallbackIds;
321
+ };
322
+
376
323
  /**
377
324
  * @public
378
325
  * @category 광고
@@ -497,7 +444,7 @@ interface RewardedAd {
497
444
  * @description 광고의 ID와 응답 정보를 담고 있는 객체예요. 광고를 로드한 뒤, 관련 정보를 확인할 때 유용해요.
498
445
  * @property {string} adGroupId 광고 그룹 ID예요.
499
446
  * @property {string} adUnitId 광고 ID예요.
500
- * @property {ResponseInfo} responseInfo 광고 로드 응답 정보예요. 자세한 내용은 [ResponseInfo](/react-native/reference/framework/광고/ResponseInfo.html)를 참고하세요.
447
+ * @property {ResponseInfo} responseInfo 광고 로드 응답 정보예요. 자세한 내용은 [ResponseInfo](/react-native/reference/native-modules/광고/ResponseInfo.html)를 참고하세요.
501
448
  */
502
449
  interface AdMobLoadResult {
503
450
  adGroupId: string;
@@ -1064,7 +1011,7 @@ interface LoadAdMobOptions {
1064
1011
  * @public
1065
1012
  * @category 광고
1066
1013
  * @name LoadAdMobEvent
1067
- * @description 광고를 불러오는 함수에서 발생하는 이벤트 타입이에요. `loaded` 이벤트가 발생하면 광고를 성공적으로 불러온 거예요. 이때 [AdMobLoadResult](/react-native/reference/framework/광고/AdMobLoadResult.html) 객체가 함께 반환돼요.
1014
+ * @description 광고를 불러오는 함수에서 발생하는 이벤트 타입이에요. `loaded` 이벤트가 발생하면 광고를 성공적으로 불러온 거예요. 이때 [AdMobLoadResult](/react-native/reference/native-modules/광고/AdMobLoadResult.html) 객체가 함께 반환돼요.
1068
1015
  */
1069
1016
  type LoadAdMobEvent = {
1070
1017
  type: 'loaded';
@@ -1085,7 +1032,7 @@ type LoadAdMobParams = AdMobHandlerParams<LoadAdMobOptions, LoadAdMobEvent>;
1085
1032
  * @param {LoadAdMobParams} params 광고를 불러올 때 사용할 설정 값이에요. 광고 그룹 ID와 광고의 동작에 대한 콜백을 설정할 수 있어요.
1086
1033
  * @param {LoadAdMobOptions} params.options 광고를 불러올 때 전달할 옵션 객체예요.
1087
1034
  * @param {string} params.options.adGroupId 광고 그룹 단위 ID예요. 콘솔에서 발급받은 ID를 입력해요.
1088
- * @param {(event: LoadAdMobEvent) => void} [params.onEvent] 광고 관련 이벤트가 발생했을 때 호출돼요. (예시: 광고가 닫히거나 클릭됐을 때). 자세한 이벤트 타입은 [LoadAdMobEvent](/react-native/reference/framework/광고/LoadAdMobEvent.html)를 참고하세요.
1035
+ * @param {(event: LoadAdMobEvent) => void} [params.onEvent] 광고 관련 이벤트가 발생했을 때 호출돼요. (예시: 광고가 닫히거나 클릭됐을 때). 자세한 이벤트 타입은 [LoadAdMobEvent](/react-native/reference/native-modules/광고/LoadAdMobEvent.html)를 참고하세요.
1089
1036
  * @param {(reason: unknown) => void} [params.onError] 광고를 불러오지 못했을 때 호출돼요. (예시: 네트워크 오류나 지원하지 않는 환경일 때)
1090
1037
  * @property {() => boolean} [isSupported] 현재 실행 중인 앱(예: 토스 앱, 개발용 샌드박스 앱 등)에서 Google AdMob 광고 기능을 지원하는지 확인하는 함수예요. 기능을 사용하기 전에 지원 여부를 확인해야 해요.
1091
1038
  *
@@ -1227,7 +1174,7 @@ type ShowAdMobParams = AdMobHandlerParams<ShowAdMobOptions, ShowAdMobEvent>;
1227
1174
  * @param {ShowAdMobParams} params 광고를 보여주기 위해 사용할 설정 값이에요. 광고 그룹 ID와과 광고의 동작에 대한 콜백을 설정할 수 있어요.
1228
1175
  * @param {ShowAdMobOptions} params.options 광고를 보여줄 때 전달할 옵션 객체예요.
1229
1176
  * @param {string} params.options.adUnitId 광고 그룹 단위 ID예요. `loadAppsInTossAdMob` 로 불러온 광고용 그룹 ID를 입력해요.
1230
- * @param {(event: ShowAdMobEvent) => void} [params.onEvent] 광고 관련 이벤트가 발생했을 때 호출돼요. (예시: 광고 노출을 요청했을 때). 자세한 이벤트 타입은 [ShowAdMobEvent](/react-native/reference/framework/광고/ShowAdMobEvent.html)를 참고하세요.
1177
+ * @param {(event: ShowAdMobEvent) => void} [params.onEvent] 광고 관련 이벤트가 발생했을 때 호출돼요. (예시: 광고 노출을 요청했을 때). 자세한 이벤트 타입은 [ShowAdMobEvent](/react-native/reference/native-modules/광고/ShowAdMobEvent.html)를 참고하세요.
1231
1178
  * @param {(reason: unknown) => void} [params.onError] 광고를 노출하지 못했을 때 호출돼요. (예시: 네트워크 오류나 지원하지 않는 환경일 때)
1232
1179
  * @property {() => boolean} [isSupported] 현재 실행 중인 앱(예: 토스 앱, 개발용 샌드박스 앱 등)에서 Google AdMob 광고 기능을 지원하는지 확인하는 함수예요. 기능을 사용하기 전에 지원 여부를 확인해야 해요.
1233
1180
  *
@@ -1415,355 +1362,127 @@ interface CheckoutPaymentResult {
1415
1362
  declare function checkoutPayment(options: CheckoutPaymentOptions): Promise<CheckoutPaymentResult>;
1416
1363
 
1417
1364
  /**
1418
- * 앨범 사진을 조회할 때 사용하는 옵션 타입이에요.
1365
+ * @category 게임센터
1366
+ * @name GameCenterGameProfileResponse
1367
+ * @description 토스게임센터 프로필을 가져온 결과 타입이에요.
1368
+ * 앱에 프로필이 없는 경우, `statusCode`가 `'PROFILE_NOT_FOUND'`이고 다른 정보는 없어요.
1369
+ * 프로필이 있는 경우 `statusCode`가 `'SUCCESS'`이고, 닉네임과 프로필 이미지 주소가 함께 제공돼요.
1370
+ * @property {string} statusCode 프로필 조회 결과 상태예요. `'SUCCESS'` 또는 `'PROFILE_NOT_FOUND'` 중 하나예요.
1371
+ * @property {string} [nickname] 프로필 닉네임이에요. `statusCode`가 `'SUCCESS'`일 때만 있어요.
1372
+ * @property {string} [profileImageUri] 프로필 이미지 URL이에요. `statusCode`가 `'SUCCESS'`일 때만 있어요.
1419
1373
  */
1420
- interface FetchAlbumPhotosOptions {
1421
- /** 가져올 사진의 최대 개수를 설정해요. 숫자를 입력하고 기본값은 10이에요. */
1422
- maxCount?: number;
1423
- /** 사진의 최대 폭을 제한해요. 단위는 픽셀이고 기본값은 1024이에요. */
1424
- maxWidth?: number;
1425
- /** 이미지를 base64 형식으로 반환할지 설정해요. 기본값은 `false`예요. */
1426
- base64?: boolean;
1427
- }
1374
+ type GameCenterGameProfileResponse = {
1375
+ statusCode: 'PROFILE_NOT_FOUND';
1376
+ } | {
1377
+ statusCode: 'SUCCESS';
1378
+ nickname: string;
1379
+ profileImageUri: string;
1380
+ };
1428
1381
  /**
1429
- * @public
1430
- * @category 사진
1431
- * @name fetchAlbumPhotos
1432
- * @description
1433
- * 사용자의 앨범에서 사진 목록을 불러오는 함수예요.
1434
- * 최대 개수와 해상도를 설정할 있고 갤러리 미리보기, 이미지 선택 기능 등에 활용할 수 있어요.
1435
- *
1436
- * @param options - 조회 옵션을 담은 객체예요.
1437
- * @param {number} [options.maxCount=10] 가져올 사진의 최대 개수를 설정해요. 숫자로 입력하며 기본값은 10이에요.
1438
- * @param {number} [options.maxWidth=1024] 사진의 최대 폭을 제한해요. 단위는 픽셀이며 기본값은 `1024`이에요.
1439
- * @param {boolean} [options.base64=false] 이미지를 base64 형식으로 반환할지 설정해요. 기본값은 `false`예요.
1440
- * @returns {Promise<ImageResponse[]>}
1441
- * 앨범 사진의 고유 ID와 데이터 URI를 포함한 배열을 반환해요.
1382
+ * @category 게임센터
1383
+ * @name getGameCenterGameProfile
1384
+ * @description 토스게임센터 프로필 정보를 가져와요.
1385
+ * 사용자가 프로필을 만들지 않았다면 `statusCode`가 `'PROFILE_NOT_FOUND'`인 응답이 반환돼요.
1386
+ * 버전이 최소 지원 버전(안드로이드 5.221.0, iOS 5.221.0)보다 낮으면 `undefined`를 반환해요.
1387
+ * @returns {Promise<GameCenterGameProfileResponse | undefined>} 프로필 정보 또는 `undefined`를 반환해요.
1442
1388
  *
1443
1389
  * @example
1444
- * ### 사진의 최대 폭을 360px로 제한하여 가져오기
1445
- *
1390
+ * ### 게임센터 프로필 가져오기
1446
1391
  * ```tsx
1447
- * import React, { useState } from 'react';
1448
- * import { View, Image, Button } from 'react-native';
1449
- * import { fetchAlbumPhotos } from '@apps-in-toss/framework';
1450
- *
1451
- * const base64 = true;
1392
+ * import { getGameCenterGameProfile } from './getGameCenterGameProfile';
1393
+ * import { useState } from 'react';
1394
+ * import { View, Button } from 'react-native';
1452
1395
  *
1453
- * // 앨범 사진 목록을 가져와 화면에 표시하는 컴포넌트
1454
- * function AlbumPhotoList() {
1455
- * const [albumPhotos, setAlbumPhotos] = useState([]);
1396
+ * function GameProfile() {
1397
+ * const [profile, setProfile] = useState<GameCenterGameProfileResponse | null>(null);
1456
1398
  *
1457
1399
  * const handlePress = async () => {
1458
1400
  * try {
1459
- * const response = await fetchAlbumPhotos({
1460
- * base64,
1461
- * maxWidth: 360,
1462
- * });
1463
- * setAlbumPhotos((prev) => ([...prev, ...response]));
1401
+ * const result = await getGameCenterGameProfile();
1402
+ * if (result) {
1403
+ * setProfile(result);
1404
+ * }
1464
1405
  * } catch (error) {
1465
- * console.error('앨범을 가져오는 실패했어요:', error);
1406
+ * console.error('게임센터 프로필 가져오기에 실패했어요.', error);
1466
1407
  * }
1467
1408
  * };
1468
1409
  *
1469
1410
  * return (
1470
1411
  * <View>
1471
- * {albumPhotos.map((image) => {
1472
- * // base64 형식으로 반환된 이미지를 표시하려면 데이터 URL 스키마 Prefix를 붙여야해요.
1473
- * const imageUri = base64 ? 'data:image/jpeg;base64,' + image.dataUri : image.dataUri;
1474
- *
1475
- * return <Image source={{ uri: imageUri }} key={image.id} />;
1476
- * })}
1477
- * <Button title="앨범 가져오기" onPress={handlePress} />
1412
+ * <Button title="게임센터 프로필 가져오기" onPress={handlePress} />
1478
1413
  * </View>
1479
1414
  * );
1480
1415
  * }
1481
1416
  * ```
1482
1417
  */
1483
- declare function fetchAlbumPhotos(options: FetchAlbumPhotosOptions): Promise<ImageResponse[]>;
1418
+ declare function getGameCenterGameProfile(): Promise<GameCenterGameProfileResponse | undefined>;
1484
1419
 
1485
1420
  /**
1486
- * 연락처 정보를 나타내는 타입이에요.
1421
+ * @public
1422
+ * @category 인앱결제
1423
+ * @name IapCreateOneTimePurchaseOrderOptions
1424
+ * @description 인앱결제 1건을 요청할 때 필요한 정보예요.
1425
+ * @property {string} productId - 주문할 상품의 ID예요.
1487
1426
  */
1488
- interface ContactEntity {
1489
- /** 연락처 이름이에요. */
1490
- name: string;
1491
- /** 연락처 전화번호로, 문자열 형식이에요. */
1492
- phoneNumber: string;
1427
+ interface IapCreateOneTimePurchaseOrderOptions {
1428
+ productId: string;
1493
1429
  }
1494
- interface ContactResult {
1495
- result: ContactEntity[];
1496
- nextOffset: number | null;
1497
- done: boolean;
1430
+ /**
1431
+ * @public
1432
+ * @category 인앱결제
1433
+ * @name IapCreateOneTimePurchaseOrderResult
1434
+ * @description 인앱결제 1건이 완료되면 결제 세부 정보와 상품 정보를 담아 반환해요. 반환된 정보로 결제한 상품의 정보를 화면에 표시할 수 있어요.
1435
+ * @property {string} orderId - 결제 주문 ID이에요. 결제 완료 후 [결제 상태를 조회](https://developers-apps-in-toss.toss.im/api/getIapOrderStatus.html)할 때 사용해요.
1436
+ * @property {string} displayName - 화면에 표시할 상품 이름이에요.
1437
+ * @property {string} displayAmount - 통화 단위가 포함된 가격 정보예요. 예를 들어 `1,000원`으로 가격과 통화가 함께 표시돼요.
1438
+ * @property {number} amount - 상품 가격 숫자 값이에요. 화폐 단위와 쉼표를 제외한 순수 숫자예요. 예를 들어 `1000`으로 표시돼요.
1439
+ * @property {string} currency - [ISO 4217 표준](https://ko.wikipedia.org/wiki/ISO_4217)에 따른 상품 가격 통화 단위예요. 예를 들어 원화는 `KRW`, 달러는 `USD`로 표시돼요.
1440
+ * @property {number} fraction - 가격을 표시할 때 소수점 아래 몇 자리까지 보여줄지 정하는 값이에요. 예를 들어 달러는 소수점 둘째 자리까지 보여줘서 `2`, 원화는 소수점이 필요 없어서 `0`이에요
1441
+ * @property {string | null} miniAppIconUrl - 미니앱 아이콘 이미지의 URL이에요. 아이콘은 앱인토스 콘솔에서 설정한 이미지예요. 콘솔에서 아이콘을 등록하지 않았다면 `null`로 반환돼요.
1442
+ */
1443
+ interface IapCreateOneTimePurchaseOrderResult {
1444
+ orderId: string;
1445
+ displayName: string;
1446
+ displayAmount: string;
1447
+ amount: number;
1448
+ currency: string;
1449
+ fraction: number;
1450
+ miniAppIconUrl: string | null;
1498
1451
  }
1499
1452
  /**
1500
1453
  * @public
1501
- * @category 연락처
1502
- * @name fetchContacts
1503
- * @description 사용자의 연락처 목록을 페이지 단위로 가져오는 함수예요.
1504
- * @param options - 연락처를 가져올 지정하는 옵션 객체예요.
1505
- * @param options.size - 번에 가져올 연락처 개수예요. 예를 들어, 10을 전달하면 최대 10개의 연락처를 가져와요.
1506
- * @param options.offset - 가져올 연락처의 시작 지점이에요. 처음 호출할 때는 `0`을 전달해야 해요. 이후에는 이전 호출에서 반환된 `nextOffset` 값을 사용해요.
1507
- * @param options.query - 추가적인 필터링 옵션이에요.
1508
- * @param options.query.contains - 이름에 특정 문자열이 포함된 연락처만 가져오고 싶을 때 사용해요. 이 값을 전달하지 않으면 모든 연락처를 가져와요.
1509
- * @returns {Promise<ContactResult>}
1510
- * 연락처 목록과 페이지네이션 정보를 포함한 객체를 반환해요.
1511
- * - `result`: 가져온 연락처 목록이에요.
1512
- * - `nextOffset`: 다음 호출에 사용할 오프셋 값이에요. 더 가져올 연락처가 없으면 `null`이에요.
1513
- * - `done`: 모든 연락처를 다 가져왔는지 여부를 나타내요. 모두 가져왔다면 `true`예요.
1454
+ * @category 인앱결제
1455
+ * @name iapCreateOneTimePurchaseOrder
1456
+ * @description
1457
+ * 특정 인앱결제 주문서 페이지로 이동해요. 사용자가 상품 구매 버튼을 누르는 상황 등에 사용할 수 있어요. 사용자의 결제는 이동한 페이지에서 진행돼요. 만약 결제 중에 에러가 발생하면 에러 유형에 따라 에러 페이지로 이동해요.
1458
+ * @param {IapCreateOneTimePurchaseOrderOptions} params - 인앱결제를 생성할 필요한 정보예요.
1459
+ * @param {string} params.productId - 주문할 상품의 ID예요.
1460
+ * @returns {Promise<IapCreateOneTimePurchaseOrderResult | undefined>} 결제에 성공하면 결제 결과 객체를 반환해요. 앱 버전이 최소 지원 버전(안드로이드 5.219.0, iOS 5.219.0)보다 낮으면 인앱결제를 실행할 수 없어서 `undefined`를 반환해요.
1514
1461
  *
1515
- * @signature
1516
- * ```typescript
1517
- * function fetchContacts(options: {
1518
- * size: number;
1519
- * offset: number;
1520
- * query?: {
1521
- * contains?: string;
1522
- * };
1523
- * }): Promise<ContactResult>;
1524
- * ```
1462
+ * @throw {code: "INVALID_PRODUCT_ID"} - 유효하지 않은 상품 ID이거나, 해당 상품이 존재하지 않을 때 발생해요.
1463
+ * @throw {code: "PAYMENT_PENDING"} - 사용자가 요청한 결제가 아직 승인을 기다리고 있을 때 발생해요.
1464
+ * @throw {code: "NETWORK_ERROR"} - 서버 내부 문제로 요청을 처리할 수 없을 때 발생해요.
1465
+ * @throw {code: "INVALID_USER_ENVIRONMENT"} - 특정 기기, 계정 또는 설정 환경에서 구매할 수 없는 상품일 때 발생해요.
1466
+ * @throw {code: "ITEM_ALREADY_OWNED"} - 사용자가 이미 구매한 상품을 다시 구매하려고 할 때 발생해요.
1467
+ * @throw {code: "APP_MARKET_VERIFICATION_FAILED"} - 사용자가 결제를 완료했지만, 앱스토어에서 사용자 정보 검증에 실패했을 때 발생해요. 사용자가 앱스토어에 문의해서 환불을 요청해야해요.
1468
+ * @throw {code: "TOSS_SERVER_VERIFICATION_FAILED"} - 사용자가 결제를 완료했지만, 서버 전송에 실패해서 결제 정보를 저장할 수 없을 때 발생해요.
1469
+ * @throw {code: "INTERNAL_ERROR"} - 서버 내부 문제로 요청을 처리할 수 없을 때 발생해요.
1470
+ * @throw {code: "KOREAN_ACCOUNT_ONLY"} - iOS 환경에서 사용자의 계정이 한국 계정이 아닐 때 발생해요.
1471
+ * @throw {code: "USER_CANCELED"} - 사용자가 결제를 완료하지 않고 주문서 페이지를 이탈했을 때 발생해요.
1525
1472
  *
1526
1473
  * @example
1527
- * ### 특정 문자열이 포함된 연락처 목록 가져오기
1474
+ * ### 특정 인앱결제 주문서 페이지로 이동하기
1528
1475
  *
1529
1476
  * ```tsx
1530
- * import React, { useState } from 'react';
1531
- * import { View, Text, Button } from 'react-native';
1532
- * import { fetchContacts, ContactEntity } from '@apps-in-toss/framework';
1477
+ * import { IAP } from "@apps-in-toss/web-framework";
1478
+ * import { Button } from "@toss-design-system/react-native";
1533
1479
  *
1534
- * // 특정 문자열을 포함한 연락처 목록을 가져와 화면에 표시하는 컴포넌트
1535
- * function ContactsList() {
1536
- * const [contacts, setContacts] = useState<{
1537
- * result: ContactEntity[];
1538
- * nextOffset: number | null;
1539
- * done: boolean;
1540
- * }>({
1541
- * result: [],
1542
- * nextOffset: null,
1543
- * done: false,
1544
- * });
1480
+ * interface Props {
1481
+ * productId: string;
1482
+ * }
1545
1483
  *
1546
- * const handlePress = async () => {
1547
- * try {
1548
- * if (contacts.done) {
1549
- * console.log('모든 연락처를 가져왔어요.');
1550
- * return;
1551
- * }
1552
- *
1553
- * const response = await fetchContacts({
1554
- * size: 10,
1555
- * offset: contacts.nextOffset ?? 0,
1556
- * query: { contains: '김' },
1557
- * });
1558
- * setContacts((prev) => ({
1559
- * result: [...prev.result, ...response.result],
1560
- * nextOffset: response.nextOffset,
1561
- * done: response.done,
1562
- * }));
1563
- * } catch (error) {
1564
- * console.error('연락처를 가져오는 데 실패했어요:', error);
1565
- * }
1566
- * };
1567
- *
1568
- * return (
1569
- * <View>
1570
- * {contacts.result.map((contact, index) => (
1571
- * <Text key={index}>{contact.name}: {contact.phoneNumber}</Text>
1572
- * ))}
1573
- * <Button
1574
- * title={contacts.done ? '모든 연락처를 가져왔어요.' : '다음 연락처 가져오기'}
1575
- * disabled={contacts.done}
1576
- * onPress={handlePress}
1577
- * />
1578
- * </View>
1579
- * );
1580
- * }
1581
- * ```
1582
- */
1583
- declare function fetchContacts(options: {
1584
- size: number;
1585
- offset: number;
1586
- query?: {
1587
- contains?: string;
1588
- };
1589
- }): Promise<ContactResult>;
1590
-
1591
- interface GetCurrentLocationOptions {
1592
- /**
1593
- * 위치 정보를 가져올 정확도 수준이에요.
1594
- */
1595
- accuracy: Accuracy;
1596
- }
1597
- /**
1598
- * @public
1599
- * @category 위치 정보
1600
- * @name getCurrentLocation
1601
- * @description 디바이스의 현재 위치 정보를 가져오는 함수예요.
1602
- * 위치 기반 서비스를 구현할 때 사용되고, 한 번만 호출되어 현재 위치를 즉시 반환해요.
1603
- * 예를 들어 지도 앱에서 사용자의 현재 위치를 한 번만 가져올 때, 날씨 앱에서 사용자의 위치를 기반으로 기상 정보를 제공할 때, 매장 찾기 기능에서 사용자의 위치를 기준으로 가까운 매장을 검색할 때 사용하면 유용해요.
1604
- *
1605
- * @param {GetCurrentLocationOptions} options 위치 정보를 가져올 때 사용하는 옵션 객체예요.
1606
- * @param {Accuracy} [options.accuracy] 위치 정보의 정확도 수준이에요. 정확도는 `Accuracy` 타입으로 설정돼요.
1607
- * @returns {Promise<Location>} 디바이스의 위치 정보가 담긴 객체를 반환해요. 자세한 내용은 [Location](/react-native/reference/native-modules/Types/Location.html)을 참고해주세요.
1608
- *
1609
- * @example
1610
- * ### 디바이스의 현재 위치 정보 가져오기
1611
- *
1612
- * ```tsx
1613
- * import React, { useState } from 'react';
1614
- * import { View, Text, Button } from 'react-native';
1615
- * import { getCurrentLocation } from '@apps-in-toss/framework';
1616
- *
1617
- * // 현재 위치 정보를 가져와 화면에 표시하는 컴포넌트
1618
- * function CurrentPosition() {
1619
- * const [position, setPosition] = useState(null);
1620
- *
1621
- * const handlePress = async () => {
1622
- * try {
1623
- * const response = await getCurrentLocation({ accuracy: Accuracy.Balanced });
1624
- * setPosition(response);
1625
- * } catch (error) {
1626
- * console.error('위치 정보를 가져오는 데 실패했어요:', error);
1627
- * }
1628
- * };
1629
- *
1630
- * return (
1631
- * <View>
1632
- * {position ? (
1633
- * <Text>위치: {position.coords.latitude}, {position.coords.longitude}</Text>
1634
- * ) : (
1635
- * <Text>위치 정보를 아직 가져오지 않았어요</Text>
1636
- * )}
1637
- * <Button title="현재 위치 정보 가져오기" onPress={handlePress} />
1638
- * </View>
1639
- * );
1640
- * }
1641
- * ```
1642
- */
1643
- declare function getCurrentLocation(options: GetCurrentLocationOptions): Promise<Location>;
1644
-
1645
- /**
1646
- * @category 게임센터
1647
- * @name GameCenterGameProfileResponse
1648
- * @description 토스게임센터 프로필을 가져온 결과 타입이에요.
1649
- * 앱에 프로필이 없는 경우, `statusCode`가 `'PROFILE_NOT_FOUND'`이고 다른 정보는 없어요.
1650
- * 프로필이 있는 경우 `statusCode`가 `'SUCCESS'`이고, 닉네임과 프로필 이미지 주소가 함께 제공돼요.
1651
- * @property {string} statusCode 프로필 조회 결과 상태예요. `'SUCCESS'` 또는 `'PROFILE_NOT_FOUND'` 중 하나예요.
1652
- * @property {string} [nickname] 프로필 닉네임이에요. `statusCode`가 `'SUCCESS'`일 때만 있어요.
1653
- * @property {string} [profileImageUri] 프로필 이미지 URL이에요. `statusCode`가 `'SUCCESS'`일 때만 있어요.
1654
- */
1655
- type GameCenterGameProfileResponse = {
1656
- statusCode: 'PROFILE_NOT_FOUND';
1657
- } | {
1658
- statusCode: 'SUCCESS';
1659
- nickname: string;
1660
- profileImageUri: string;
1661
- };
1662
- /**
1663
- * @category 게임센터
1664
- * @name getGameCenterGameProfile
1665
- * @description 토스게임센터 프로필 정보를 가져와요.
1666
- * 사용자가 프로필을 만들지 않았다면 `statusCode`가 `'PROFILE_NOT_FOUND'`인 응답이 반환돼요.
1667
- * 앱 버전이 최소 지원 버전(안드로이드 5.221.0, iOS 5.221.0)보다 낮으면 `undefined`를 반환해요.
1668
- * @returns {Promise<GameCenterGameProfileResponse | undefined>} 프로필 정보 또는 `undefined`를 반환해요.
1669
- *
1670
- * @example
1671
- * ### 게임센터 프로필 가져오기
1672
- * ```tsx
1673
- * import { getGameCenterGameProfile } from './getGameCenterGameProfile';
1674
- * import { useState } from 'react';
1675
- * import { View, Button } from 'react-native';
1676
- *
1677
- * function GameProfile() {
1678
- * const [profile, setProfile] = useState<GameCenterGameProfileResponse | null>(null);
1679
- *
1680
- * const handlePress = async () => {
1681
- * try {
1682
- * const result = await getGameCenterGameProfile();
1683
- * if (result) {
1684
- * setProfile(result);
1685
- * }
1686
- * } catch (error) {
1687
- * console.error('게임센터 프로필 가져오기에 실패했어요.', error);
1688
- * }
1689
- * };
1690
- *
1691
- * return (
1692
- * <View>
1693
- * <Button title="게임센터 프로필 가져오기" onPress={handlePress} />
1694
- * </View>
1695
- * );
1696
- * }
1697
- * ```
1698
- */
1699
- declare function getGameCenterGameProfile(): Promise<GameCenterGameProfileResponse | undefined>;
1700
-
1701
- /**
1702
- * @public
1703
- * @category 인앱결제
1704
- * @name IapCreateOneTimePurchaseOrderOptions
1705
- * @description 인앱결제 1건을 요청할 때 필요한 정보예요.
1706
- * @property {string} productId - 주문할 상품의 ID예요.
1707
- */
1708
- interface IapCreateOneTimePurchaseOrderOptions {
1709
- productId: string;
1710
- }
1711
- /**
1712
- * @public
1713
- * @category 인앱결제
1714
- * @name IapCreateOneTimePurchaseOrderResult
1715
- * @description 인앱결제 1건이 완료되면 결제 세부 정보와 상품 정보를 담아 반환해요. 반환된 정보로 결제한 상품의 정보를 화면에 표시할 수 있어요.
1716
- * @property {string} orderId - 결제 주문 ID이에요. 결제 완료 후 [결제 상태를 조회](https://developers-apps-in-toss.toss.im/api/getIapOrderStatus.html)할 때 사용해요.
1717
- * @property {string} displayName - 화면에 표시할 상품 이름이에요.
1718
- * @property {string} displayAmount - 통화 단위가 포함된 가격 정보예요. 예를 들어 `1,000원`으로 가격과 통화가 함께 표시돼요.
1719
- * @property {number} amount - 상품 가격 숫자 값이에요. 화폐 단위와 쉼표를 제외한 순수 숫자예요. 예를 들어 `1000`으로 표시돼요.
1720
- * @property {string} currency - [ISO 4217 표준](https://ko.wikipedia.org/wiki/ISO_4217)에 따른 상품 가격 통화 단위예요. 예를 들어 원화는 `KRW`, 달러는 `USD`로 표시돼요.
1721
- * @property {number} fraction - 가격을 표시할 때 소수점 아래 몇 자리까지 보여줄지 정하는 값이에요. 예를 들어 달러는 소수점 둘째 자리까지 보여줘서 `2`, 원화는 소수점이 필요 없어서 `0`이에요
1722
- * @property {string | null} miniAppIconUrl - 미니앱 아이콘 이미지의 URL이에요. 아이콘은 앱인토스 콘솔에서 설정한 이미지예요. 콘솔에서 아이콘을 등록하지 않았다면 `null`로 반환돼요.
1723
- */
1724
- interface IapCreateOneTimePurchaseOrderResult {
1725
- orderId: string;
1726
- displayName: string;
1727
- displayAmount: string;
1728
- amount: number;
1729
- currency: string;
1730
- fraction: number;
1731
- miniAppIconUrl: string | null;
1732
- }
1733
- /**
1734
- * @public
1735
- * @category 인앱결제
1736
- * @name iapCreateOneTimePurchaseOrder
1737
- * @description
1738
- * 특정 인앱결제 주문서 페이지로 이동해요. 사용자가 상품 구매 버튼을 누르는 상황 등에 사용할 수 있어요. 사용자의 결제는 이동한 페이지에서 진행돼요. 만약 결제 중에 에러가 발생하면 에러 유형에 따라 에러 페이지로 이동해요.
1739
- * @param {IapCreateOneTimePurchaseOrderOptions} params - 인앱결제를 생성할 때 필요한 정보예요.
1740
- * @param {string} params.productId - 주문할 상품의 ID예요.
1741
- * @returns {Promise<IapCreateOneTimePurchaseOrderResult | undefined>} 결제에 성공하면 결제 결과 객체를 반환해요. 앱 버전이 최소 지원 버전(안드로이드 5.219.0, iOS 5.219.0)보다 낮으면 인앱결제를 실행할 수 없어서 `undefined`를 반환해요.
1742
- *
1743
- * @throw {code: "INVALID_PRODUCT_ID"} - 유효하지 않은 상품 ID이거나, 해당 상품이 존재하지 않을 때 발생해요.
1744
- * @throw {code: "PAYMENT_PENDING"} - 사용자가 요청한 결제가 아직 승인을 기다리고 있을 때 발생해요.
1745
- * @throw {code: "NETWORK_ERROR"} - 서버 내부 문제로 요청을 처리할 수 없을 때 발생해요.
1746
- * @throw {code: "INVALID_USER_ENVIRONMENT"} - 특정 기기, 계정 또는 설정 환경에서 구매할 수 없는 상품일 때 발생해요.
1747
- * @throw {code: "ITEM_ALREADY_OWNED"} - 사용자가 이미 구매한 상품을 다시 구매하려고 할 때 발생해요.
1748
- * @throw {code: "APP_MARKET_VERIFICATION_FAILED"} - 사용자가 결제를 완료했지만, 앱스토어에서 사용자 정보 검증에 실패했을 때 발생해요. 사용자가 앱스토어에 문의해서 환불을 요청해야해요.
1749
- * @throw {code: "TOSS_SERVER_VERIFICATION_FAILED"} - 사용자가 결제를 완료했지만, 서버 전송에 실패해서 결제 정보를 저장할 수 없을 때 발생해요.
1750
- * @throw {code: "INTERNAL_ERROR"} - 서버 내부 문제로 요청을 처리할 수 없을 때 발생해요.
1751
- * @throw {code: "KOREAN_ACCOUNT_ONLY"} - iOS 환경에서 사용자의 계정이 한국 계정이 아닐 때 발생해요.
1752
- * @throw {code: "USER_CANCELED"} - 사용자가 결제를 완료하지 않고 주문서 페이지를 이탈했을 때 발생해요.
1753
- *
1754
- * @example
1755
- * ### 특정 인앱결제 주문서 페이지로 이동하기
1756
- *
1757
- * ```tsx
1758
- * import { IAP } from "@apps-in-toss/web-framework";
1759
- * import { Button } from "@toss-design-system/react-native";
1760
- *
1761
- * interface Props {
1762
- * productId: string;
1763
- * }
1764
- *
1765
- * function IapCreateOneTimePurchaseOrderButton({ productId }: Props) {
1766
- * async function handleClick() {
1484
+ * function IapCreateOneTimePurchaseOrderButton({ productId }: Props) {
1485
+ * async function handleClick() {
1767
1486
  * try {
1768
1487
  * await IAP.createOneTimePurchaseOrder({
1769
1488
  * productId,
@@ -1884,74 +1603,6 @@ declare const IAP: {
1884
1603
  getProductItemList: typeof getProductItemList;
1885
1604
  };
1886
1605
 
1887
- interface OpenCameraOptions {
1888
- /**
1889
- * 이미지를 Base64 형식으로 반환할지 여부를 나타내는 불리언 값이에요.
1890
- *
1891
- * 기본값: `false`.
1892
- */
1893
- base64?: boolean;
1894
- /**
1895
- * 이미지의 최대 너비를 나타내는 숫자 값이에요.
1896
- *
1897
- * 기본값: `1024`.
1898
- */
1899
- maxWidth?: number;
1900
- }
1901
- /**
1902
- * @public
1903
- * @category 카메라
1904
- * @name openCamera
1905
- * @description 카메라를 실행해서 촬영된 이미지를 반환하는 함수예요.
1906
- * @param {OpenCameraOptions} options - 카메라 실행 시 사용되는 옵션 객체예요.
1907
- * @param {boolean} [options.base64=false] - 이미지를 Base64 형식으로 반환할지 여부를 나타내는 불리언 값이에요. 기본값은 `false`예요. `true`로 설정하면 `dataUri` 대신 Base64 인코딩된 문자열을 반환해요.
1908
- * @param {number} [options.maxWidth=1024] - 이미지의 최대 너비를 나타내는 숫자 값이에요. 기본값은 `1024`예요.
1909
- * @returns {Promise<ImageResponse>}
1910
- * 촬영된 이미지 정보를 포함한 객체를 반환해요. 반환 객체의 구성은 다음과 같아요:
1911
- * - `id`: 이미지의 고유 식별자예요.
1912
- * - `dataUri`: 이미지 데이터를 표현하는 데이터 URI예요.
1913
- *
1914
- * @example
1915
- * ### 카메라 실행 후 촬영된 사진 가져오기
1916
- *
1917
- * ```tsx
1918
- * import React, { useState } from 'react';
1919
- * import { View, Text, Button, Image } from 'react-native';
1920
- * import { openCamera } from '@apps-in-toss/framework';
1921
- *
1922
- * const base64 = true;
1923
- *
1924
- * // 카메라를 실행하고 촬영된 이미지를 화면에 표시하는 컴포넌트
1925
- * function Camera() {
1926
- * const [image, setImage] = useState(null);
1927
- *
1928
- * const handlePress = async () => {
1929
- * try {
1930
- * const response = await openCamera({ base64 });
1931
- * setImage(response);
1932
- * } catch (error) {
1933
- * console.error('사진을 가져오는 데 실패했어요:', error);
1934
- * }
1935
- * };
1936
- *
1937
- * // base64 형식으로 반환된 이미지를 표시하려면 데이터 URL 스키마 Prefix를 붙여야해요.
1938
- * const imageUri = base64 ? 'data:image/jpeg;base64,' + image.dataUri : image.dataUri;
1939
- *
1940
- * return (
1941
- * <View>
1942
- * {image ? (
1943
- * <Image source={{ uri: imageUri }} style={{ width: 200, height: 200 }} />
1944
- * ) : (
1945
- * <Text>사진이 없어요</Text>
1946
- * )}
1947
- * <Button title="사진 촬영하기" onPress={handlePress} />
1948
- * </View>
1949
- * );
1950
- * }
1951
- * ```
1952
- */
1953
- declare function openCamera(options?: OpenCameraOptions): Promise<ImageResponse>;
1954
-
1955
1606
  interface SaveBase64DataParams {
1956
1607
  data: string;
1957
1608
  fileName: string;
@@ -2057,7 +1708,6 @@ declare function submitGameCenterLeaderBoardScore(params: {
2057
1708
  score: string;
2058
1709
  }): Promise<SubmitGameCenterLeaderBoardScoreResponse | undefined>;
2059
1710
 
2060
- type CompatiblePlaceholderArgument = object;
2061
1711
  /**
2062
1712
  * TurboModule 타입 별칭 사용하는 이유?
2063
1713
  * React Native Codegen 에 의해 코드젠 되는 것이 아니라 추후 내부 모듈 체계에 의해 처리될 것이기 때문에 RN Codegen에 본 파일을 코드젠 하지 않도록 함
@@ -2068,13 +1718,15 @@ interface Spec extends TurboModule {
2068
1718
  operationalEnvironment: 'sandbox' | 'toss';
2069
1719
  tossAppVersion: string;
2070
1720
  deviceId: string;
1721
+ getClipboardText: (arg: CompatiblePlaceholderArgument) => Promise<string>;
1722
+ setClipboardText: (option: SetClipboardTextOptions) => Promise<void>;
1723
+ fetchContacts: (option: FetchContactsOptions) => Promise<ContactResult>;
1724
+ fetchAlbumPhotos: (options: FetchAlbumPhotosOptions) => Promise<ImageResponse[]>;
1725
+ getCurrentLocation: (options: GetCurrentLocationOptions) => Promise<Location>;
1726
+ openCamera: (options: OpenCameraOptions) => Promise<ImageResponse>;
2071
1727
  getWebBundleURL: (arg: CompatiblePlaceholderArgument) => {
2072
1728
  url: string;
2073
1729
  };
2074
- getClipboardText: (arg: CompatiblePlaceholderArgument) => Promise<string>;
2075
- setClipboardText: (option: {
2076
- text: string;
2077
- }) => Promise<void>;
2078
1730
  getPermission: (permission: {
2079
1731
  name: PermissionName;
2080
1732
  access: PermissionAccess;
@@ -2083,20 +1735,6 @@ interface Spec extends TurboModule {
2083
1735
  name: PermissionName;
2084
1736
  access: PermissionAccess;
2085
1737
  }) => Promise<Exclude<PermissionStatus, 'notDetermined'>>;
2086
- fetchContacts: ({ size, offset, query, }: {
2087
- size: number;
2088
- offset: number;
2089
- query?: {
2090
- contains?: string;
2091
- };
2092
- }) => Promise<{
2093
- result: ContactEntity[];
2094
- nextOffset: number | undefined;
2095
- done: boolean;
2096
- }>;
2097
- fetchAlbumPhotos: (options: FetchAlbumPhotosOptions) => Promise<ImageResponse[]>;
2098
- getCurrentLocation: (options: GetCurrentLocationOptions) => Promise<Location>;
2099
- openCamera: (options: OpenCameraOptions) => Promise<ImageResponse>;
2100
1738
  appLogin: (arg: CompatiblePlaceholderArgument) => Promise<{
2101
1739
  authorizationCode: string;
2102
1740
  referrer: 'DEFAULT' | 'SANDBOX';
@@ -2171,6 +1809,8 @@ declare function appLogin(): Promise<{
2171
1809
  referrer: 'DEFAULT' | 'SANDBOX';
2172
1810
  }>;
2173
1811
 
1812
+ type Primitive = string | number | boolean | null | undefined | symbol;
1813
+
2174
1814
  interface EventLogParams {
2175
1815
  log_name: string;
2176
1816
  log_type: 'debug' | 'info' | 'warn' | 'error' | 'screen' | 'impression' | 'click';
@@ -2213,44 +1853,505 @@ interface EventLogParams {
2213
1853
  */
2214
1854
  declare function eventLog(params: EventLogParams): Promise<void>;
2215
1855
 
1856
+ /**
1857
+ * @public
1858
+ * @category 사진
1859
+ * @name fetchAlbumPhotos
1860
+ * @description
1861
+ * 사용자의 앨범에서 사진 목록을 불러오는 함수예요.
1862
+ * 최대 개수와 해상도를 설정할 수 있고 갤러리 미리보기, 이미지 선택 기능 등에 활용할 수 있어요.
1863
+ *
1864
+ * @param options - 조회 옵션을 담은 객체예요.
1865
+ * @param {number} [options.maxCount=10] 가져올 사진의 최대 개수를 설정해요. 숫자로 입력하며 기본값은 10이에요.
1866
+ * @param {number} [options.maxWidth=1024] 사진의 최대 폭을 제한해요. 단위는 픽셀이며 기본값은 `1024`이에요.
1867
+ * @param {boolean} [options.base64=false] 이미지를 base64 형식으로 반환할지 설정해요. 기본값은 `false`예요.
1868
+ * @property [openPermissionDialog] - 사진첩 읽기 권한을 다시 요청하는 다이얼로그를 표시해요. 사용자는 "허용", "한 번만 허용", "안하기" 중 하나를 선택할 수 있어요. "허용"이나 "한 번만 허용"을 선택하면 `allowed`를 반환하고, "안하기"를 선택하면 `denied`를 반환해요.
1869
+ * @property [getPermission] - 사진첩 읽기 권한의 현재 상태를 반환해요. `allowed`는 사용자가 사진첩 읽기 권한을 허용한 상태예요. `denied`는 사용자가 사진첩 읽기 권한을 거부한 상태예요. `notDetermined`는 사진첩 읽기 권한 요청을 한 번도 하지 않은 상태예요.
1870
+ * @returns {Promise<ImageResponse[]>}
1871
+ * 앨범 사진의 고유 ID와 데이터 URI를 포함한 배열을 반환해요.
1872
+ *
1873
+ * @signature
1874
+ * ```typescript
1875
+ * function fetchAlbumPhotos(options: {
1876
+ * maxCount: number;
1877
+ * maxWidth: number;
1878
+ * base64: boolean;
1879
+ * }): Promise<ImageResponse[]>;
1880
+ * ```
1881
+ *
1882
+ * @example
1883
+ * ### 사진의 최대 폭을 360px로 제한하여 가져오기
1884
+ *
1885
+ * 사진을 가져오는 예제예요.
1886
+ * "권한 확인하기"버튼을 눌러서 현재 사진첩 읽기 권한을 확인해요.
1887
+ * 사용자가 권한을 거부했거나 시스템에서 권한이 제한된 경우에는 [`FetchAlbumPhotosPermissionError`](/react-native/reference/types/권한/FetchAlbumPhotosPermissionError)를 반환해요.
1888
+ * "권한 요청하기"버튼을 눌러서 사진첩 읽기 권한을 요청할 수 있어요.
1889
+ *
1890
+ * ```tsx
1891
+ * import { fetchAlbumPhotos, FetchAlbumPhotosPermissionError, ImageResponse } from '@apps-in-toss/framework';
1892
+ * import { useState } from 'react';
1893
+ * import { Alert, Button, Image, View } from 'react-native';
1894
+ *
1895
+ * const base64 = true;
1896
+ *
1897
+ * // 앨범 사진 목록을 가져와 화면에 표시하는 컴포넌트
1898
+ * function AlbumPhotoList() {
1899
+ * const [albumPhotos, setAlbumPhotos] = useState<ImageResponse[]>([]);
1900
+ *
1901
+ * const handlePress = async () => {
1902
+ * try {
1903
+ * const response = await fetchAlbumPhotos({
1904
+ * base64,
1905
+ * maxWidth: 360,
1906
+ * });
1907
+ * setAlbumPhotos((prev) => [...prev, ...response]);
1908
+ * } catch (error) {
1909
+ * if (error instanceof FetchAlbumPhotosPermissionError) {
1910
+ * // 앨범 읽기 권한 없음
1911
+ * }
1912
+ * console.error('앨범을 가져오는 데 실패했어요:', error);
1913
+ * }
1914
+ * };
1915
+ *
1916
+ * return (
1917
+ * <View>
1918
+ * {albumPhotos.map((image) => {
1919
+ * // base64 형식으로 반환된 이미지를 표시하려면 데이터 URL 스키마 Prefix를 붙여야해요.
1920
+ * const imageUri = base64 ? 'data:image/jpeg;base64,' + image.dataUri : image.dataUri;
1921
+ *
1922
+ * return <Image source={{ uri: imageUri }} key={image.id} />;
1923
+ * })}
1924
+ * <Button title="앨범 가져오기" onPress={handlePress} />
1925
+ * <Button
1926
+ * title="권한 확인하기"
1927
+ * onPress={async () => {
1928
+ * const permission = await fetchAlbumPhotos.getPermission();
1929
+ * Alert.alert(permission);
1930
+ * }}
1931
+ * />
1932
+ * <Button
1933
+ * title="권한 요청하기"
1934
+ * onPress={async () => {
1935
+ * const permission = await fetchAlbumPhotos.openPermissionDialog();
1936
+ * Alert.alert(permission);
1937
+ * }}
1938
+ * />
1939
+ * </View>
1940
+ * );
1941
+ * }
1942
+ * ```
1943
+ */
1944
+ declare const fetchAlbumPhotos: _apps_in_toss_types.PermissionFunctionWithDialog<FetchAlbumPhotos>;
1945
+
1946
+ /**
1947
+ * @public
1948
+ * @category 연락처
1949
+ * @name fetchContacts
1950
+ * @description 사용자의 연락처 목록을 페이지 단위로 가져오는 함수예요.
1951
+ * @param options - 연락처를 가져올 때 지정하는 옵션 객체예요.
1952
+ * @param options.size - 한 번에 가져올 연락처 개수예요. 예를 들어, 10을 전달하면 최대 10개의 연락처를 가져와요.
1953
+ * @param options.offset - 가져올 연락처의 시작 지점이에요. 처음 호출할 때는 `0`을 전달해야 해요. 이후에는 이전 호출에서 반환된 `nextOffset` 값을 사용해요.
1954
+ * @param options.query - 추가적인 필터링 옵션이에요.
1955
+ * @param options.query.contains - 이름에 특정 문자열이 포함된 연락처만 가져오고 싶을 때 사용해요. 이 값을 전달하지 않으면 모든 연락처를 가져와요.
1956
+ * @property [openPermissionDialog] - 연락처 읽기 권한을 다시 요청하는 다이얼로그를 표시해요. 사용자는 "허용", "한 번만 허용", "안하기" 중 하나를 선택할 수 있어요. "허용"이나 "한 번만 허용"을 선택하면 `allowed`를 반환하고, "안하기"를 선택하면 `denied`를 반환해요.
1957
+ * @property [getPermission] - 연락처 읽기 권한의 현재 상태를 반환해요. `allowed`는 사용자가 연락처 읽기 권한을 허용한 상태예요. `denied`는 사용자가 연락처 읽기 권한을 거부한 상태예요. `notDetermined`는 연락처 읽기 권한 요청을 한 번도 하지 않은 상태예요.
1958
+ *
1959
+ * @returns {Promise<ContactResult>}
1960
+ * 연락처 목록과 페이지네이션 정보를 포함한 객체를 반환해요.
1961
+ * - `result`: 가져온 연락처 목록이에요.
1962
+ * - `nextOffset`: 다음 호출에 사용할 오프셋 값이에요. 더 가져올 연락처가 없으면 `null`이에요.
1963
+ * - `done`: 모든 연락처를 다 가져왔는지 여부를 나타내요. 모두 가져왔다면 `true`예요.
1964
+ *
1965
+ * @signature
1966
+ * ```typescript
1967
+ * function fetchContacts(options: {
1968
+ * size: number;
1969
+ * offset: number;
1970
+ * query?: {
1971
+ * contains?: string;
1972
+ * };
1973
+ * }): Promise<ContactResult>;
1974
+ * ```
1975
+ *
1976
+ * @example
1977
+ * ### 특정 문자열이 포함된 연락처 목록 가져오기
1978
+ *
1979
+ * 연락처 목록을 가져오는 예제예요.
1980
+ * "권한 확인하기"버튼을 눌러서 현재 연락처 읽기 권한을 확인해요.
1981
+ * 사용자가 권한을 거부했거나 시스템에서 권한이 제한된 경우에는 [`FetchContactsPermissionError`](/react-native/reference/types/권한/FetchContactsPermissionError)를 반환해요.
1982
+ * "권한 요청하기"버튼을 눌러서 연락처 읽기 권한을 요청할 수 있어요.
1983
+ *
1984
+ * ```tsx
1985
+ * import { ContactEntity, fetchContacts, FetchContactsPermissionError } from '@apps-in-toss/framework';
1986
+ * import { useState } from 'react';
1987
+ * import { Alert, Button, Text, View } from 'react-native';
1988
+ *
1989
+ * // 특정 문자열을 포함한 연락처 목록을 가져와 화면에 표시하는 컴포넌트
1990
+ * function ContactsList() {
1991
+ * const [contacts, setContacts] = useState<{
1992
+ * result: ContactEntity[];
1993
+ * nextOffset: number | null;
1994
+ * done: boolean;
1995
+ * }>({
1996
+ * result: [],
1997
+ * nextOffset: null,
1998
+ * done: false,
1999
+ * });
2000
+ *
2001
+ * const handlePress = async () => {
2002
+ * try {
2003
+ * if (contacts.done) {
2004
+ * console.log('모든 연락처를 가져왔어요.');
2005
+ * return;
2006
+ * }
2007
+ *
2008
+ * const response = await fetchContacts({
2009
+ * size: 10,
2010
+ * offset: contacts.nextOffset ?? 0,
2011
+ * query: { contains: '김' },
2012
+ * });
2013
+ * setContacts((prev) => ({
2014
+ * result: [...prev.result, ...response.result],
2015
+ * nextOffset: response.nextOffset,
2016
+ * done: response.done,
2017
+ * }));
2018
+ * } catch (error) {
2019
+ * if (error instanceof FetchContactsPermissionError) {
2020
+ * // 연락처 읽기 권한 없음
2021
+ * }
2022
+ * console.error('연락처를 가져오는 데 실패했어요:', error);
2023
+ * }
2024
+ * };
2025
+ *
2026
+ * return (
2027
+ * <View>
2028
+ * {contacts.result.map((contact, index) => (
2029
+ * <Text key={index}>
2030
+ * {contact.name}: {contact.phoneNumber}
2031
+ * </Text>
2032
+ * ))}
2033
+ * <Button
2034
+ * title={contacts.done ? '모든 연락처를 가져왔어요.' : '다음 연락처 가져오기'}
2035
+ * disabled={contacts.done}
2036
+ * onPress={handlePress}
2037
+ * />
2038
+ * <Button
2039
+ * title="권한 확인하기"
2040
+ * onPress={async () => {
2041
+ * const permission = await fetchContacts.getPermission();
2042
+ * Alert.alert(permission);
2043
+ * }}
2044
+ * />
2045
+ * <Button
2046
+ * title="권한 요청하기"
2047
+ * onPress={async () => {
2048
+ * const permission = await fetchContacts.openPermissionDialog();
2049
+ * Alert.alert(permission);
2050
+ * }}
2051
+ * />
2052
+ * </View>
2053
+ * );
2054
+ * }
2055
+ * ```
2056
+ */
2057
+ declare const fetchContacts: _apps_in_toss_types.PermissionFunctionWithDialog<FetchContacts>;
2058
+
2216
2059
  /**
2217
2060
  * @public
2218
2061
  * @category 클립보드
2219
2062
  * @name getClipboardText
2220
2063
  * @description 클립보드에 저장된 텍스트를 가져오는 함수예요. 복사된 텍스트를 읽어서 다른 작업에 활용할 수 있어요.
2064
+ * @property [openPermissionDialog] - 클립보드 읽기 권한을 다시 요청하는 다이얼로그를 표시해요. 사용자는 "허용", "한 번만 허용", "안하기" 중 하나를 선택할 수 있어요. "허용"이나 "한 번만 허용"을 선택하면 `allowed`를 반환하고, "안하기"를 선택하면 `denied`를 반환해요.
2065
+ * @property [getPermission] - 클립보드 읽기 권한의 현재 상태를 반환해요. `allowed`는 사용자가 클립보드 읽기 권한을 허용한 상태예요. `denied`는 사용자가 클립보드 읽기 권한을 거부한 상태예요. `notDetermined`는 클립보드 읽기 권한 요청을 한 번도 하지 않은 상태예요.
2221
2066
  * @returns {Promise<string>} - 클립보드에 저장된 텍스트를 반환해요. 클립보드에 텍스트가 없으면 빈 문자열을 반환해요.
2222
2067
  *
2068
+ * @signature
2069
+ * ```typescript
2070
+ * function getClipboardText(): Promise<string>;
2071
+ * ```
2072
+ *
2223
2073
  * @example
2224
2074
  * ### 클립보드의 텍스트 가져오기
2225
2075
  *
2226
- * ```tsx
2227
- * import React, { useState } from 'react';
2228
- * import { View, Text, Button } from 'react-native';
2229
- * import { getClipboardText } from '@apps-in-toss/framework';
2076
+ * 클립보드의 텍스트를 가져오는 예제예요.
2077
+ * "권한 확인하기"버튼을 눌러서 현재 클립보드 읽기 권한을 확인해요.
2078
+ * 사용자가 권한을 거부했거나 시스템에서 권한이 제한된 경우에는 [`GetClipboardTextPermissionError`](/react-native/reference/types/권한/GetClipboardTextPermissionError)를 반환해요.
2079
+ * "권한 요청하기"버튼을 눌러서 클립보드 읽기 권한을 요청할 수 있어요.
2230
2080
  *
2081
+ * ```tsx
2082
+ * import {
2083
+ * getClipboardText,
2084
+ * GetClipboardTextPermissionError,
2085
+ * SetClipboardTextPermissionError,
2086
+ * } from '@apps-in-toss/framework';
2087
+ * import { useState } from 'react';
2088
+ * import { Alert, Button, Text, View } from 'react-native'; *
2089
+
2231
2090
  * // '붙여넣기' 버튼을 누르면 클립보드에 저장된 텍스트를 가져와 화면에 표시해요.
2232
2091
  * function PasteButton() {
2233
- * const [text, setText] = useState('');
2234
- *
2092
+ * const [text, setText] = useState(''); *
2093
+
2235
2094
  * const handlePress = async () => {
2236
2095
  * try {
2237
2096
  * const clipboardText = await getClipboardText();
2238
2097
  * setText(clipboardText || '클립보드에 텍스트가 없어요.');
2239
2098
  * } catch (error) {
2240
- * console.error('클립보드에서 텍스트를 가져오지 못했어요:', error);
2099
+ * if (error instanceof GetClipboardTextPermissionError) {
2100
+ * // 클립보드 읽기 권한 없음
2101
+ * } *
2102
+
2103
+ * if (error instanceof SetClipboardTextPermissionError) {
2104
+ * // 클립보드 쓰기 권한 없음
2105
+ * }
2241
2106
  * }
2242
- * };
2243
- *
2107
+ * }; *
2108
+
2244
2109
  * return (
2245
2110
  * <View>
2246
2111
  * <Text>{text}</Text>
2247
2112
  * <Button title="붙여넣기" onPress={handlePress} />
2113
+ * <Button
2114
+ * title="권한 확인하기"
2115
+ * onPress={async () => {
2116
+ * const permission = await getClipboardText.getPermission();
2117
+ * Alert.alert(permission);
2118
+ * }}
2119
+ * />
2120
+ * <Button
2121
+ * title="권한 요청하기"
2122
+ * onPress={async () => {
2123
+ * const permission = await getClipboardText.openPermissionDialog();
2124
+ * Alert.alert(permission);
2125
+ * }}
2126
+ * />
2127
+ * </View>
2128
+ * );
2129
+ * }
2130
+ * ```
2131
+ */
2132
+ declare const getClipboardText: _apps_in_toss_types.PermissionFunctionWithDialog<GetClipboardText>;
2133
+
2134
+ /**
2135
+ * @public
2136
+ * @category 위치 정보
2137
+ * @name getCurrentLocation
2138
+ * @description 디바이스의 현재 위치 정보를 가져오는 함수예요.
2139
+ * 위치 기반 서비스를 구현할 때 사용되고, 한 번만 호출되어 현재 위치를 즉시 반환해요.
2140
+ * 예를 들어 지도 앱에서 사용자의 현재 위치를 한 번만 가져올 때, 날씨 앱에서 사용자의 위치를 기반으로 기상 정보를 제공할 때, 매장 찾기 기능에서 사용자의 위치를 기준으로 가까운 매장을 검색할 때 사용하면 유용해요.
2141
+ *
2142
+ * @param {GetCurrentLocationOptions} options 위치 정보를 가져올 때 사용하는 옵션 객체예요.
2143
+ * @param {Accuracy} [options.accuracy] 위치 정보의 정확도 수준이에요. 정확도는 `Accuracy` 타입으로 설정돼요.
2144
+ * @property [openPermissionDialog] - 위치 정보 권한을 다시 요청하는 다이얼로그를 표시해요. 사용자는 "허용", "한 번만 허용", "안하기" 중 하나를 선택할 수 있어요. "허용"이나 "한 번만 허용"을 선택하면 `allowed`를 반환하고, "안하기"를 선택하면 `denied`를 반환해요.
2145
+ * @property [getPermission] - 위치 정보 권한의 현재 상태를 반환해요. `allowed`는 사용자가 위치 정보 권한을 허용한 상태예요. `denied`는 사용자가 위치 정보 권한을 거부한 상태예요. `notDetermined`는 위치 정보 권한 요청을 한 번도 하지 않은 상태예요.
2146
+ * @returns {Promise<Location>} 디바이스의 위치 정보가 담긴 객체를 반환해요. 자세한 내용은 [Location](/react-native/reference/native-modules/Types/Location.html)을 참고해주세요.
2147
+ *
2148
+ * @signature
2149
+ * ```typescript
2150
+ * function getCurrentLocation(options: {
2151
+ * accuracy: Accuracy;
2152
+ * }): Promise<Location>;
2153
+ * ```
2154
+ *
2155
+ * @example
2156
+ * ### 디바이스의 현재 위치 정보 가져오기
2157
+ *
2158
+ * "권한 확인하기"버튼을 눌러서 현재 위치정보 권한을 확인해요.
2159
+ * 사용자가 권한을 거부했거나 시스템에서 권한이 제한된 경우에는 [`GetCurrentLocationPermissionError`](/react-native/reference/types/권한/GetCurrentLocationPermissionError)를 반환해요.
2160
+ * "권한 요청하기"버튼을 눌러서 위치정보 권한을 요청할 수 있어요.
2161
+ *
2162
+ * ```tsx
2163
+ * import { Accuracy, getCurrentLocation, Location } from '@apps-in-toss/framework';
2164
+ * import { useState } from 'react';
2165
+ * import { Alert, Button, Text, View } from 'react-native';
2166
+ *
2167
+ * // 현재 위치 정보를 가져와 화면에 표시하는 컴포넌트
2168
+ * function CurrentPosition() {
2169
+ * const [position, setPosition] = useState<Location | null>(null);
2170
+ *
2171
+ * const handlePress = async () => {
2172
+ * try {
2173
+ * const response = await getCurrentLocation({ accuracy: Accuracy.Balanced });
2174
+ * setPosition(response);
2175
+ * } catch (error) {
2176
+ * console.error('위치 정보를 가져오는 데 실패했어요:', error);
2177
+ * }
2178
+ * };
2179
+ *
2180
+ * return (
2181
+ * <View>
2182
+ * {position ? (
2183
+ * <Text>
2184
+ * 위치: {position.coords.latitude}, {position.coords.longitude}
2185
+ * </Text>
2186
+ * ) : (
2187
+ * <Text>위치 정보를 아직 가져오지 않았어요</Text>
2188
+ * )}
2189
+ * <Button title="현재 위치 정보 가져오기" onPress={handlePress} />
2190
+ * <Button
2191
+ * title="권한 확인하기"
2192
+ * onPress={async () => {
2193
+ * Alert.alert(await getCurrentLocation.getPermission());
2194
+ * }}
2195
+ * />
2196
+ * <Button
2197
+ * title="권한 요청하기"
2198
+ * onPress={async () => {
2199
+ * Alert.alert(await getCurrentLocation.openPermissionDialog());
2200
+ * }}
2201
+ * />
2202
+ * </View>
2203
+ * );
2204
+ * }
2205
+ *
2206
+ * ```
2207
+ */
2208
+ declare const getCurrentLocation: _apps_in_toss_types.PermissionFunctionWithDialog<GetCurrentLocation>;
2209
+
2210
+ /**
2211
+ * @public
2212
+ * @category 클립보드
2213
+ * @name setClipboardText
2214
+ * @description 텍스트를 클립보드에 복사해서 사용자가 다른 곳에 붙여 넣기 할 수 있어요.
2215
+ * @param {Promise<void>} text - 클립보드에 복사할 텍스트예요. 문자열 형식으로 입력해요.
2216
+ * @property [openPermissionDialog] - 클립보드 쓰기 권한을 다시 요청하는 다이얼로그를 표시해요. 사용자는 "허용", "한 번만 허용", "안하기" 중 하나를 선택할 수 있어요. "허용"이나 "한 번만 허용"을 선택하면 `allowed`를 반환하고, "안하기"를 선택하면 `denied`를 반환해요.
2217
+ * @property [getPermission] - 클립보드 쓰기 권한의 현재 상태를 반환해요. `allowed`는 사용자가 클립보드 쓰기 권한을 허용한 상태예요. `denied`는 사용자가 클립보드 쓰기 권한을 거부한 상태예요. `notDetermined`는 클립보드 쓰기 권한 요청을 한 번도 하지 않은 상태예요.
2218
+ *
2219
+ * @signature
2220
+ * ```typescript
2221
+ * function setClipboardText(text: string): Promise<void>;
2222
+ * ```
2223
+ *
2224
+ * @example
2225
+ * ### 텍스트를 클립보드에 복사하기
2226
+ *
2227
+ * 텍스트를 클립보드에 복사하는 예제예요.
2228
+ * "권한 확인하기"버튼을 눌러서 현재 클립보드 쓰기 권한을 확인해요.
2229
+ * 사용자가 권한을 거부했거나 시스템에서 권한이 제한된 경우에는 [`SetClipboardTextPermissionError`](/react-native/reference/types/권한/SetClipboardTextPermissionError)를 반환해요.
2230
+ * "권한 요청하기"버튼을 눌러서 클립보드 쓰기 권한을 요청할 수 있어요.
2231
+ *
2232
+ * ```tsx
2233
+ * import { setClipboardText, SetClipboardTextPermissionError } from '@apps-in-toss/framework';
2234
+ * import { Alert, Button } from 'react-native';
2235
+ *
2236
+ * // '복사' 버튼을 누르면 "복사할 텍스트"가 클립보드에 복사돼요.
2237
+ * function CopyButton() {
2238
+ * const handleCopy = async () => {
2239
+ * try {
2240
+ * await setClipboardText('복사할 텍스트');
2241
+ * console.log('텍스트가 복사됐어요!');
2242
+ * } catch (error) {
2243
+ * if (error instanceof SetClipboardTextPermissionError) {
2244
+ * // 텍스트 쓰기 권한 거부됨
2245
+ * }
2246
+ * }
2247
+ * };
2248
+ *
2249
+ * return (
2250
+ * <>
2251
+ * <Button title="복사" onPress={handleCopy} />
2252
+ * <Button
2253
+ * title="권한 확인하기"
2254
+ * onPress={async () => {
2255
+ * const permission = await setClipboardText.getPermission();
2256
+ * Alert.alert(permission);
2257
+ * }}
2258
+ * />
2259
+ * <Button
2260
+ * title="권한 요청하기"
2261
+ * onPress={async () => {
2262
+ * const permission = await setClipboardText.openPermissionDialog();
2263
+ * Alert.alert(permission);
2264
+ * }}
2265
+ * />
2266
+ * </>
2267
+ * );
2268
+ * }
2269
+ * ```
2270
+ */
2271
+ declare const setClipboardText: _apps_in_toss_types.PermissionFunctionWithDialog<SetClipboardText>;
2272
+
2273
+ /**
2274
+ * @public
2275
+ * @category 카메라
2276
+ * @name openCamera
2277
+ * @description 카메라를 실행해서 촬영된 이미지를 반환하는 함수예요.
2278
+ * @param {OpenCameraOptions} options - 카메라 실행 시 사용되는 옵션 객체예요.
2279
+ * @param {boolean} [options.base64=false] - 이미지를 Base64 형식으로 반환할지 여부를 나타내는 불리언 값이에요. 기본값은 `false`예요. `true`로 설정하면 `dataUri` 대신 Base64 인코딩된 문자열을 반환해요.
2280
+ * @param {number} [options.maxWidth=1024] - 이미지의 최대 너비를 나타내는 숫자 값이에요. 기본값은 `1024`예요.
2281
+ * @property [openPermissionDialog] - 카메라 접근 권한을 다시 요청하는 다이얼로그를 표시해요. 사용자는 "허용", "한 번만 허용", "안하기" 중 하나를 선택할 수 있어요. "허용"이나 "한 번만 허용"을 선택하면 `allowed`를 반환하고, "안하기"를 선택하면 `denied`를 반환해요.
2282
+ * @property [getPermission] - 카메라 접근 권한의 현재 상태를 반환해요. `allowed`는 사용자가 카메라 접근 권한을 허용한 상태예요. `denied`는 사용자가 카메라 접근 권한을 거부한 상태예요. `notDetermined`는 카메라 접근 권한 요청을 한 번도 하지 않은 상태예요.
2283
+ * @returns {Promise<ImageResponse>}
2284
+ * 촬영된 이미지 정보를 포함한 객체를 반환해요. 반환 객체의 구성은 다음과 같아요:
2285
+ * - `id`: 이미지의 고유 식별자예요.
2286
+ * - `dataUri`: 이미지 데이터를 표현하는 데이터 URI예요.
2287
+ *
2288
+ * @signature
2289
+ * ```typescript
2290
+ * function openCamera(options: {
2291
+ * base64: boolean;
2292
+ * maxWidth: number;
2293
+ * }): Promise<ImageResponse>;
2294
+ * ```
2295
+ *
2296
+ * @example
2297
+ * ### 카메라 실행 후 촬영된 사진 가져오기
2298
+ *
2299
+ * 카메라로 사진을 찍고 결과를 가져오는 예제예요.
2300
+ * 이 과정에서 현재 카메라 권한 상태를 확인할 수 있고, 권한이 없으면 권한을 요청해요.
2301
+ * 사용자가 권한을 거부했거나 시스템에서 권한이 제한된 경우에는 [`OpenCameraPermissionError`](/react-native/reference/types/권한/OpenCameraPermissionError)를 반환해요.
2302
+ *
2303
+ * ```tsx
2304
+ * import { ImageResponse, openCamera, OpenCameraPermissionError } from '@apps-in-toss/framework';
2305
+ * import { useState } from 'react';
2306
+ * import { Alert, Button, Image, Text, View } from 'react-native';
2307
+ *
2308
+ * const base64 = true;
2309
+ *
2310
+ * // 카메라를 실행하고 촬영된 이미지를 화면에 표시하는 컴포넌트
2311
+ * function Camera() {
2312
+ * const [image, setImage] = useState<ImageResponse | null>(null);
2313
+ *
2314
+ * const handlePress = async () => {
2315
+ * try {
2316
+ * const response = await openCamera({ base64 });
2317
+ * setImage(response);
2318
+ * } catch (error) {
2319
+ * if (error instanceof OpenCameraPermissionError) {
2320
+ * console.log('권한 에러');
2321
+ * }
2322
+ *
2323
+ * console.error('사진을 가져오는 데 실패했어요:', error);
2324
+ * }
2325
+ * };
2326
+ *
2327
+ * // base64 형식으로 반환된 이미지를 표시하려면 데이터 URL 스키마 Prefix를 붙여야해요.
2328
+ * const imageUri = base64 ? 'data:image/jpeg;base64,' + image?.dataUri : image?.dataUri;
2329
+ *
2330
+ * return (
2331
+ * <View>
2332
+ * {image ? <Image source={{ uri: imageUri }} style={{ width: 200, height: 200 }} /> : <Text>사진이 없어요</Text>}
2333
+ * <Button title="사진 촬영하기" onPress={handlePress} />
2334
+ * <Button
2335
+ * title="권한 확인하기"
2336
+ * onPress={async () => {
2337
+ * const permission = await openCamera.getPermission();
2338
+ * Alert.alert(permission);
2339
+ * }}
2340
+ * />
2341
+ *
2342
+ * <Button
2343
+ * title="권한 요청하기"
2344
+ * onPress={async () => {
2345
+ * const currentPermission = await openCamera.openPermissionDialog();
2346
+ * Alert.alert(currentPermission);
2347
+ * }}
2348
+ * />
2248
2349
  * </View>
2249
2350
  * );
2250
2351
  * }
2251
2352
  * ```
2252
2353
  */
2253
- declare function getClipboardText(): Promise<string>;
2354
+ declare const openCamera: _apps_in_toss_types.PermissionFunctionWithDialog<OpenCamera>;
2254
2355
 
2255
2356
  /**
2256
2357
  * @public
@@ -2420,37 +2521,6 @@ declare function isMinVersionSupported(minVersions: {
2420
2521
  ios: `${number}.${number}.${number}` | 'always' | 'never';
2421
2522
  }): boolean;
2422
2523
 
2423
- /**
2424
- * @public
2425
- * @category 클립보드
2426
- * @name setClipboardText
2427
- * @description 텍스트를 클립보드에 복사해서 사용자가 다른 곳에 붙여 넣기 할 수 있어요.
2428
- * @param {Promise<void>} text - 클립보드에 복사할 텍스트예요. 문자열 형식으로 입력해요.
2429
- *
2430
- * @example
2431
- * ### 텍스트를 클립보드에 복사하기
2432
- *
2433
- * ```tsx
2434
- * import { Button } from 'react-native';
2435
- * import { setClipboardText } from '@apps-in-toss/framework';
2436
- *
2437
- * // '복사' 버튼을 누르면 "복사할 텍스트"가 클립보드에 복사돼요.
2438
- * function CopyButton() {
2439
- * const handleCopy = async () => {
2440
- * try {
2441
- * await setClipboardText('복사할 텍스트');
2442
- * console.log('텍스트가 복사됐어요!');
2443
- * } catch (error) {
2444
- * console.error('텍스트 복사에 실패했어요:', error);
2445
- * }
2446
- * };
2447
- *
2448
- * return <Button title="복사" onPress={handleCopy} />;
2449
- * }
2450
- * ```
2451
- */
2452
- declare function setClipboardText(text: string): Promise<void>;
2453
-
2454
2524
  /**
2455
2525
  * @public
2456
2526
  * @category 화면 제어
@@ -3119,4 +3189,4 @@ declare const INTERNAL__module: {
3119
3189
  tossCoreEventLog: typeof tossCoreEventLog;
3120
3190
  };
3121
3191
 
3122
- export { Accuracy, AppsInTossModule, BedrockCoreModule, BedrockModule, type CheckoutPaymentOptions, type CheckoutPaymentResult, type ContactEntity, type ContactResult, type ContactsViralParams, type EventLogParams, type FetchAlbumPhotosOptions, type GameCenterGameProfileResponse, type GetCurrentLocationOptions, GoogleAdMob, type HapticFeedbackType, IAP, AppsInTossModuleInstance as INTERNAL__AppsInTossModule, INTERNAL__module, type IapCreateOneTimePurchaseOrderOptions, type IapCreateOneTimePurchaseOrderResult, type IapProductListItem, type ImageResponse, type LoadAdMobEvent, type LoadAdMobInterstitialAdEvent, type LoadAdMobInterstitialAdOptions, type LoadAdMobOptions, type LoadAdMobParams, type LoadAdMobRewardedAdEvent, type LoadAdMobRewardedAdOptions, type Location, type LocationCoords, type NetworkStatus, type OpenCameraOptions, type PermissionAccess, type PermissionName, type PermissionStatus, type Primitive, type SaveBase64DataParams, type ShowAdMobEvent, type ShowAdMobInterstitialAdEvent, type ShowAdMobInterstitialAdOptions, type ShowAdMobOptions, type ShowAdMobParams, type ShowAdMobRewardedAdEvent, type ShowAdMobRewardedAdOptions, type StartUpdateLocationOptions$1 as StartUpdateLocationOptions, type StartUpdateLocationSubscription, Storage, type SubmitGameCenterLeaderBoardScoreResponse, TossPay, type UpdateLocationEventEmitter, appLogin, appsInTossEvent, closeView, contactsViral, eventLog, fetchAlbumPhotos, fetchContacts, generateHapticFeedback, getClipboardText, getCurrentLocation, getDeviceId, getGameCenterGameProfile, getLocale, getNetworkStatus, getOperationalEnvironment, getPlatformOS, getSchemeUri, getTossAppVersion, getTossShareLink, isMinVersionSupported, onVisibilityChangedByTransparentServiceWeb, openCamera, openGameCenterLeaderboard, openURL, saveBase64Data, setClipboardText, setDeviceOrientation, setIosSwipeGestureEnabled, setScreenAwakeMode, setSecureScreen, share, startUpdateLocation, submitGameCenterLeaderBoardScore };
3192
+ export { AppsInTossModule, BedrockCoreModule, BedrockModule, type CheckoutPaymentOptions, type CheckoutPaymentResult, type ContactsViralParams, type EventLogParams, type GameCenterGameProfileResponse, GoogleAdMob, type HapticFeedbackType, IAP, AppsInTossModuleInstance as INTERNAL__AppsInTossModule, INTERNAL__appBridgeHandler, INTERNAL__module, type IapCreateOneTimePurchaseOrderOptions, type IapCreateOneTimePurchaseOrderResult, type IapProductListItem, type LoadAdMobEvent, type LoadAdMobInterstitialAdEvent, type LoadAdMobInterstitialAdOptions, type LoadAdMobOptions, type LoadAdMobParams, type LoadAdMobRewardedAdEvent, type LoadAdMobRewardedAdOptions, type NetworkStatus, type Primitive, type SaveBase64DataParams, type ShowAdMobEvent, type ShowAdMobInterstitialAdEvent, type ShowAdMobInterstitialAdOptions, type ShowAdMobOptions, type ShowAdMobParams, type ShowAdMobRewardedAdEvent, type ShowAdMobRewardedAdOptions, Storage, type SubmitGameCenterLeaderBoardScoreResponse, TossPay, type UpdateLocationEventEmitter, appLogin, appsInTossEvent, closeView, contactsViral, eventLog, fetchAlbumPhotos, fetchContacts, generateHapticFeedback, getClipboardText, getCurrentLocation, getDeviceId, getGameCenterGameProfile, getLocale, getNetworkStatus, getOperationalEnvironment, getPlatformOS, getSchemeUri, getTossAppVersion, getTossShareLink, isMinVersionSupported, onVisibilityChangedByTransparentServiceWeb, openCamera, openGameCenterLeaderboard, openURL, saveBase64Data, setClipboardText, setDeviceOrientation, setIosSwipeGestureEnabled, setScreenAwakeMode, setSecureScreen, share, startUpdateLocation, submitGameCenterLeaderBoardScore };