@apps-in-toss/native-modules 1.0.3 → 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 (38) 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 +167 -122
  6. package/dist/index.d.cts +635 -589
  7. package/dist/index.d.ts +635 -589
  8. package/dist/index.js +167 -122
  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/event-plugins/UpdateLocationEvent.ts +3 -3
  16. package/src/AppsInTossModule/native-event-emitter/index.ts +1 -0
  17. package/src/AppsInTossModule/native-event-emitter/internal/appBridge.ts +7 -1
  18. package/src/AppsInTossModule/native-event-emitter/startUpdateLocation.ts +64 -44
  19. package/src/AppsInTossModule/native-modules/AppsInTossModule.ts +22 -27
  20. package/src/AppsInTossModule/native-modules/getPermission.ts +1 -1
  21. package/src/AppsInTossModule/native-modules/index.ts +9 -6
  22. package/src/AppsInTossModule/native-modules/permissions/createPermissionFunction.ts +25 -0
  23. package/src/AppsInTossModule/native-modules/permissions/fetchAlbumPhotos/fetchAlbumPhotos.ts +109 -0
  24. package/src/AppsInTossModule/native-modules/{fetchContacts.ts → permissions/fetchContacts/fetchContacts.ts} +51 -40
  25. package/src/AppsInTossModule/native-modules/permissions/getClipboardText/getClipboardText.ts +87 -0
  26. package/src/AppsInTossModule/native-modules/permissions/getCurrentLocation/getCurrentLocation.ts +88 -0
  27. package/src/AppsInTossModule/native-modules/permissions/openCamera/openCamera.ts +99 -0
  28. package/src/AppsInTossModule/native-modules/{openPermissionDialog.ts → permissions/openPermissionDialog.ts} +3 -3
  29. package/src/AppsInTossModule/native-modules/{requestPermission.ts → permissions/requestPermission.ts} +2 -2
  30. package/src/AppsInTossModule/native-modules/permissions/setClipboardText/setClipboardText.ts +75 -0
  31. package/src/AppsInTossModule/native-modules/saveBase64Data.ts +1 -1
  32. package/src/async-bridges.ts +9 -6
  33. package/src/types.ts +0 -106
  34. package/src/AppsInTossModule/native-modules/fetchAlbumPhotos.ts +0 -88
  35. package/src/AppsInTossModule/native-modules/getClipboardText.ts +0 -47
  36. package/src/AppsInTossModule/native-modules/getCurrentLocation.ts +0 -65
  37. package/src/AppsInTossModule/native-modules/openCamera.ts +0 -81
  38. 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
@@ -1439,358 +1362,130 @@ interface CheckoutPaymentResult {
1439
1362
  declare function checkoutPayment(options: CheckoutPaymentOptions): Promise<CheckoutPaymentResult>;
1440
1363
 
1441
1364
  /**
1442
- * 앨범 사진을 조회할 때 사용하는 옵션 타입이에요.
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'`일 때만 있어요.
1443
1373
  */
1444
- interface FetchAlbumPhotosOptions {
1445
- /** 가져올 사진의 최대 개수를 설정해요. 숫자를 입력하고 기본값은 10이에요. */
1446
- maxCount?: number;
1447
- /** 사진의 최대 폭을 제한해요. 단위는 픽셀이고 기본값은 1024이에요. */
1448
- maxWidth?: number;
1449
- /** 이미지를 base64 형식으로 반환할지 설정해요. 기본값은 `false`예요. */
1450
- base64?: boolean;
1451
- }
1374
+ type GameCenterGameProfileResponse = {
1375
+ statusCode: 'PROFILE_NOT_FOUND';
1376
+ } | {
1377
+ statusCode: 'SUCCESS';
1378
+ nickname: string;
1379
+ profileImageUri: string;
1380
+ };
1452
1381
  /**
1453
- * @public
1454
- * @category 사진
1455
- * @name fetchAlbumPhotos
1456
- * @description
1457
- * 사용자의 앨범에서 사진 목록을 불러오는 함수예요.
1458
- * 최대 개수와 해상도를 설정할 있고 갤러리 미리보기, 이미지 선택 기능 등에 활용할 수 있어요.
1459
- *
1460
- * @param options - 조회 옵션을 담은 객체예요.
1461
- * @param {number} [options.maxCount=10] 가져올 사진의 최대 개수를 설정해요. 숫자로 입력하며 기본값은 10이에요.
1462
- * @param {number} [options.maxWidth=1024] 사진의 최대 폭을 제한해요. 단위는 픽셀이며 기본값은 `1024`이에요.
1463
- * @param {boolean} [options.base64=false] 이미지를 base64 형식으로 반환할지 설정해요. 기본값은 `false`예요.
1464
- * @returns {Promise<ImageResponse[]>}
1465
- * 앨범 사진의 고유 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`를 반환해요.
1466
1388
  *
1467
1389
  * @example
1468
- * ### 사진의 최대 폭을 360px로 제한하여 가져오기
1469
- *
1390
+ * ### 게임센터 프로필 가져오기
1470
1391
  * ```tsx
1471
- * import React, { useState } from 'react';
1472
- * import { View, Image, Button } from 'react-native';
1473
- * import { fetchAlbumPhotos } from '@apps-in-toss/framework';
1474
- *
1475
- * const base64 = true;
1392
+ * import { getGameCenterGameProfile } from './getGameCenterGameProfile';
1393
+ * import { useState } from 'react';
1394
+ * import { View, Button } from 'react-native';
1476
1395
  *
1477
- * // 앨범 사진 목록을 가져와 화면에 표시하는 컴포넌트
1478
- * function AlbumPhotoList() {
1479
- * const [albumPhotos, setAlbumPhotos] = useState([]);
1396
+ * function GameProfile() {
1397
+ * const [profile, setProfile] = useState<GameCenterGameProfileResponse | null>(null);
1480
1398
  *
1481
1399
  * const handlePress = async () => {
1482
1400
  * try {
1483
- * const response = await fetchAlbumPhotos({
1484
- * base64,
1485
- * maxWidth: 360,
1486
- * });
1487
- * setAlbumPhotos((prev) => ([...prev, ...response]));
1401
+ * const result = await getGameCenterGameProfile();
1402
+ * if (result) {
1403
+ * setProfile(result);
1404
+ * }
1488
1405
  * } catch (error) {
1489
- * console.error('앨범을 가져오는 실패했어요:', error);
1406
+ * console.error('게임센터 프로필 가져오기에 실패했어요.', error);
1490
1407
  * }
1491
1408
  * };
1492
1409
  *
1493
1410
  * return (
1494
1411
  * <View>
1495
- * {albumPhotos.map((image) => {
1496
- * // base64 형식으로 반환된 이미지를 표시하려면 데이터 URL 스키마 Prefix를 붙여야해요.
1497
- * const imageUri = base64 ? 'data:image/jpeg;base64,' + image.dataUri : image.dataUri;
1498
- *
1499
- * return <Image source={{ uri: imageUri }} key={image.id} />;
1500
- * })}
1501
- * <Button title="앨범 가져오기" onPress={handlePress} />
1412
+ * <Button title="게임센터 프로필 가져오기" onPress={handlePress} />
1502
1413
  * </View>
1503
1414
  * );
1504
1415
  * }
1505
1416
  * ```
1506
1417
  */
1507
- declare function fetchAlbumPhotos(options: FetchAlbumPhotosOptions): Promise<ImageResponse[]>;
1418
+ declare function getGameCenterGameProfile(): Promise<GameCenterGameProfileResponse | undefined>;
1508
1419
 
1509
1420
  /**
1510
- * 연락처 정보를 나타내는 타입이에요.
1421
+ * @public
1422
+ * @category 인앱결제
1423
+ * @name IapCreateOneTimePurchaseOrderOptions
1424
+ * @description 인앱결제 1건을 요청할 때 필요한 정보예요.
1425
+ * @property {string} productId - 주문할 상품의 ID예요.
1511
1426
  */
1512
- interface ContactEntity {
1513
- /** 연락처 이름이에요. */
1514
- name: string;
1515
- /** 연락처 전화번호로, 문자열 형식이에요. */
1516
- phoneNumber: string;
1427
+ interface IapCreateOneTimePurchaseOrderOptions {
1428
+ productId: string;
1517
1429
  }
1518
- interface ContactResult {
1519
- result: ContactEntity[];
1520
- nextOffset: number | null;
1521
- 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;
1522
1451
  }
1523
1452
  /**
1524
1453
  * @public
1525
- * @category 연락처
1526
- * @name fetchContacts
1527
- * @description 사용자의 연락처 목록을 페이지 단위로 가져오는 함수예요.
1528
- * @param options - 연락처를 가져올 지정하는 옵션 객체예요.
1529
- * @param options.size - 번에 가져올 연락처 개수예요. 예를 들어, 10을 전달하면 최대 10개의 연락처를 가져와요.
1530
- * @param options.offset - 가져올 연락처의 시작 지점이에요. 처음 호출할 때는 `0`을 전달해야 해요. 이후에는 이전 호출에서 반환된 `nextOffset` 값을 사용해요.
1531
- * @param options.query - 추가적인 필터링 옵션이에요.
1532
- * @param options.query.contains - 이름에 특정 문자열이 포함된 연락처만 가져오고 싶을 때 사용해요. 이 값을 전달하지 않으면 모든 연락처를 가져와요.
1533
- * @returns {Promise<ContactResult>}
1534
- * 연락처 목록과 페이지네이션 정보를 포함한 객체를 반환해요.
1535
- * - `result`: 가져온 연락처 목록이에요.
1536
- * - `nextOffset`: 다음 호출에 사용할 오프셋 값이에요. 더 가져올 연락처가 없으면 `null`이에요.
1537
- * - `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`를 반환해요.
1538
1461
  *
1539
- * @signature
1540
- * ```typescript
1541
- * function fetchContacts(options: {
1542
- * size: number;
1543
- * offset: number;
1544
- * query?: {
1545
- * contains?: string;
1546
- * };
1547
- * }): Promise<ContactResult>;
1548
- * ```
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"} - 사용자가 결제를 완료하지 않고 주문서 페이지를 이탈했을 때 발생해요.
1549
1472
  *
1550
1473
  * @example
1551
- * ### 특정 문자열이 포함된 연락처 목록 가져오기
1474
+ * ### 특정 인앱결제 주문서 페이지로 이동하기
1552
1475
  *
1553
1476
  * ```tsx
1554
- * import React, { useState } from 'react';
1555
- * import { View, Text, Button } from 'react-native';
1556
- * 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";
1557
1479
  *
1558
- * // 특정 문자열을 포함한 연락처 목록을 가져와 화면에 표시하는 컴포넌트
1559
- * function ContactsList() {
1560
- * const [contacts, setContacts] = useState<{
1561
- * result: ContactEntity[];
1562
- * nextOffset: number | null;
1563
- * done: boolean;
1564
- * }>({
1565
- * result: [],
1566
- * nextOffset: null,
1567
- * done: false,
1568
- * });
1480
+ * interface Props {
1481
+ * productId: string;
1482
+ * }
1569
1483
  *
1570
- * const handlePress = async () => {
1484
+ * function IapCreateOneTimePurchaseOrderButton({ productId }: Props) {
1485
+ * async function handleClick() {
1571
1486
  * try {
1572
- * if (contacts.done) {
1573
- * console.log('모든 연락처를 가져왔어요.');
1574
- * return;
1575
- * }
1576
- *
1577
- * const response = await fetchContacts({
1578
- * size: 10,
1579
- * offset: contacts.nextOffset ?? 0,
1580
- * query: { contains: '김' },
1581
- * });
1582
- * setContacts((prev) => ({
1583
- * result: [...prev.result, ...response.result],
1584
- * nextOffset: response.nextOffset,
1585
- * done: response.done,
1586
- * }));
1587
- * } catch (error) {
1588
- * console.error('연락처를 가져오는 데 실패했어요:', error);
1589
- * }
1590
- * };
1591
- *
1592
- * return (
1593
- * <View>
1594
- * {contacts.result.map((contact, index) => (
1595
- * <Text key={index}>{contact.name}: {contact.phoneNumber}</Text>
1596
- * ))}
1597
- * <Button
1598
- * title={contacts.done ? '모든 연락처를 가져왔어요.' : '다음 연락처 가져오기'}
1599
- * disabled={contacts.done}
1600
- * onPress={handlePress}
1601
- * />
1602
- * </View>
1603
- * );
1604
- * }
1605
- * ```
1606
- */
1607
- declare function fetchContacts(options: {
1608
- size: number;
1609
- offset: number;
1610
- query?: {
1611
- contains?: string;
1612
- };
1613
- }): Promise<ContactResult>;
1614
-
1615
- interface GetCurrentLocationOptions {
1616
- /**
1617
- * 위치 정보를 가져올 정확도 수준이에요.
1618
- */
1619
- accuracy: Accuracy;
1620
- }
1621
- /**
1622
- * @public
1623
- * @category 위치 정보
1624
- * @name getCurrentLocation
1625
- * @description 디바이스의 현재 위치 정보를 가져오는 함수예요.
1626
- * 위치 기반 서비스를 구현할 때 사용되고, 한 번만 호출되어 현재 위치를 즉시 반환해요.
1627
- * 예를 들어 지도 앱에서 사용자의 현재 위치를 한 번만 가져올 때, 날씨 앱에서 사용자의 위치를 기반으로 기상 정보를 제공할 때, 매장 찾기 기능에서 사용자의 위치를 기준으로 가까운 매장을 검색할 때 사용하면 유용해요.
1628
- *
1629
- * @param {GetCurrentLocationOptions} options 위치 정보를 가져올 때 사용하는 옵션 객체예요.
1630
- * @param {Accuracy} [options.accuracy] 위치 정보의 정확도 수준이에요. 정확도는 `Accuracy` 타입으로 설정돼요.
1631
- * @returns {Promise<Location>} 디바이스의 위치 정보가 담긴 객체를 반환해요. 자세한 내용은 [Location](/react-native/reference/native-modules/Types/Location.html)을 참고해주세요.
1632
- *
1633
- * @example
1634
- * ### 디바이스의 현재 위치 정보 가져오기
1635
- *
1636
- * ```tsx
1637
- * import React, { useState } from 'react';
1638
- * import { View, Text, Button } from 'react-native';
1639
- * import { getCurrentLocation } from '@apps-in-toss/framework';
1640
- *
1641
- * // 현재 위치 정보를 가져와 화면에 표시하는 컴포넌트
1642
- * function CurrentPosition() {
1643
- * const [position, setPosition] = useState(null);
1644
- *
1645
- * const handlePress = async () => {
1646
- * try {
1647
- * const response = await getCurrentLocation({ accuracy: Accuracy.Balanced });
1648
- * setPosition(response);
1649
- * } catch (error) {
1650
- * console.error('위치 정보를 가져오는 데 실패했어요:', error);
1651
- * }
1652
- * };
1653
- *
1654
- * return (
1655
- * <View>
1656
- * {position ? (
1657
- * <Text>위치: {position.coords.latitude}, {position.coords.longitude}</Text>
1658
- * ) : (
1659
- * <Text>위치 정보를 아직 가져오지 않았어요</Text>
1660
- * )}
1661
- * <Button title="현재 위치 정보 가져오기" onPress={handlePress} />
1662
- * </View>
1663
- * );
1664
- * }
1665
- * ```
1666
- */
1667
- declare function getCurrentLocation(options: GetCurrentLocationOptions): Promise<Location>;
1668
-
1669
- /**
1670
- * @category 게임센터
1671
- * @name GameCenterGameProfileResponse
1672
- * @description 토스게임센터 프로필을 가져온 결과 타입이에요.
1673
- * 앱에 프로필이 없는 경우, `statusCode`가 `'PROFILE_NOT_FOUND'`이고 다른 정보는 없어요.
1674
- * 프로필이 있는 경우 `statusCode`가 `'SUCCESS'`이고, 닉네임과 프로필 이미지 주소가 함께 제공돼요.
1675
- * @property {string} statusCode 프로필 조회 결과 상태예요. `'SUCCESS'` 또는 `'PROFILE_NOT_FOUND'` 중 하나예요.
1676
- * @property {string} [nickname] 프로필 닉네임이에요. `statusCode`가 `'SUCCESS'`일 때만 있어요.
1677
- * @property {string} [profileImageUri] 프로필 이미지 URL이에요. `statusCode`가 `'SUCCESS'`일 때만 있어요.
1678
- */
1679
- type GameCenterGameProfileResponse = {
1680
- statusCode: 'PROFILE_NOT_FOUND';
1681
- } | {
1682
- statusCode: 'SUCCESS';
1683
- nickname: string;
1684
- profileImageUri: string;
1685
- };
1686
- /**
1687
- * @category 게임센터
1688
- * @name getGameCenterGameProfile
1689
- * @description 토스게임센터 프로필 정보를 가져와요.
1690
- * 사용자가 프로필을 만들지 않았다면 `statusCode`가 `'PROFILE_NOT_FOUND'`인 응답이 반환돼요.
1691
- * 앱 버전이 최소 지원 버전(안드로이드 5.221.0, iOS 5.221.0)보다 낮으면 `undefined`를 반환해요.
1692
- * @returns {Promise<GameCenterGameProfileResponse | undefined>} 프로필 정보 또는 `undefined`를 반환해요.
1693
- *
1694
- * @example
1695
- * ### 게임센터 프로필 가져오기
1696
- * ```tsx
1697
- * import { getGameCenterGameProfile } from './getGameCenterGameProfile';
1698
- * import { useState } from 'react';
1699
- * import { View, Button } from 'react-native';
1700
- *
1701
- * function GameProfile() {
1702
- * const [profile, setProfile] = useState<GameCenterGameProfileResponse | null>(null);
1703
- *
1704
- * const handlePress = async () => {
1705
- * try {
1706
- * const result = await getGameCenterGameProfile();
1707
- * if (result) {
1708
- * setProfile(result);
1709
- * }
1710
- * } catch (error) {
1711
- * console.error('게임센터 프로필 가져오기에 실패했어요.', error);
1712
- * }
1713
- * };
1714
- *
1715
- * return (
1716
- * <View>
1717
- * <Button title="게임센터 프로필 가져오기" onPress={handlePress} />
1718
- * </View>
1719
- * );
1720
- * }
1721
- * ```
1722
- */
1723
- declare function getGameCenterGameProfile(): Promise<GameCenterGameProfileResponse | undefined>;
1724
-
1725
- /**
1726
- * @public
1727
- * @category 인앱결제
1728
- * @name IapCreateOneTimePurchaseOrderOptions
1729
- * @description 인앱결제 1건을 요청할 때 필요한 정보예요.
1730
- * @property {string} productId - 주문할 상품의 ID예요.
1731
- */
1732
- interface IapCreateOneTimePurchaseOrderOptions {
1733
- productId: string;
1734
- }
1735
- /**
1736
- * @public
1737
- * @category 인앱결제
1738
- * @name IapCreateOneTimePurchaseOrderResult
1739
- * @description 인앱결제 1건이 완료되면 결제 세부 정보와 상품 정보를 담아 반환해요. 반환된 정보로 결제한 상품의 정보를 화면에 표시할 수 있어요.
1740
- * @property {string} orderId - 결제 주문 ID이에요. 결제 완료 후 [결제 상태를 조회](https://developers-apps-in-toss.toss.im/api/getIapOrderStatus.html)할 때 사용해요.
1741
- * @property {string} displayName - 화면에 표시할 상품 이름이에요.
1742
- * @property {string} displayAmount - 통화 단위가 포함된 가격 정보예요. 예를 들어 `1,000원`으로 가격과 통화가 함께 표시돼요.
1743
- * @property {number} amount - 상품 가격 숫자 값이에요. 화폐 단위와 쉼표를 제외한 순수 숫자예요. 예를 들어 `1000`으로 표시돼요.
1744
- * @property {string} currency - [ISO 4217 표준](https://ko.wikipedia.org/wiki/ISO_4217)에 따른 상품 가격 통화 단위예요. 예를 들어 원화는 `KRW`, 달러는 `USD`로 표시돼요.
1745
- * @property {number} fraction - 가격을 표시할 때 소수점 아래 몇 자리까지 보여줄지 정하는 값이에요. 예를 들어 달러는 소수점 둘째 자리까지 보여줘서 `2`, 원화는 소수점이 필요 없어서 `0`이에요
1746
- * @property {string | null} miniAppIconUrl - 미니앱 아이콘 이미지의 URL이에요. 아이콘은 앱인토스 콘솔에서 설정한 이미지예요. 콘솔에서 아이콘을 등록하지 않았다면 `null`로 반환돼요.
1747
- */
1748
- interface IapCreateOneTimePurchaseOrderResult {
1749
- orderId: string;
1750
- displayName: string;
1751
- displayAmount: string;
1752
- amount: number;
1753
- currency: string;
1754
- fraction: number;
1755
- miniAppIconUrl: string | null;
1756
- }
1757
- /**
1758
- * @public
1759
- * @category 인앱결제
1760
- * @name iapCreateOneTimePurchaseOrder
1761
- * @description
1762
- * 특정 인앱결제 주문서 페이지로 이동해요. 사용자가 상품 구매 버튼을 누르는 상황 등에 사용할 수 있어요. 사용자의 결제는 이동한 페이지에서 진행돼요. 만약 결제 중에 에러가 발생하면 에러 유형에 따라 에러 페이지로 이동해요.
1763
- * @param {IapCreateOneTimePurchaseOrderOptions} params - 인앱결제를 생성할 때 필요한 정보예요.
1764
- * @param {string} params.productId - 주문할 상품의 ID예요.
1765
- * @returns {Promise<IapCreateOneTimePurchaseOrderResult | undefined>} 결제에 성공하면 결제 결과 객체를 반환해요. 앱 버전이 최소 지원 버전(안드로이드 5.219.0, iOS 5.219.0)보다 낮으면 인앱결제를 실행할 수 없어서 `undefined`를 반환해요.
1766
- *
1767
- * @throw {code: "INVALID_PRODUCT_ID"} - 유효하지 않은 상품 ID이거나, 해당 상품이 존재하지 않을 때 발생해요.
1768
- * @throw {code: "PAYMENT_PENDING"} - 사용자가 요청한 결제가 아직 승인을 기다리고 있을 때 발생해요.
1769
- * @throw {code: "NETWORK_ERROR"} - 서버 내부 문제로 요청을 처리할 수 없을 때 발생해요.
1770
- * @throw {code: "INVALID_USER_ENVIRONMENT"} - 특정 기기, 계정 또는 설정 환경에서 구매할 수 없는 상품일 때 발생해요.
1771
- * @throw {code: "ITEM_ALREADY_OWNED"} - 사용자가 이미 구매한 상품을 다시 구매하려고 할 때 발생해요.
1772
- * @throw {code: "APP_MARKET_VERIFICATION_FAILED"} - 사용자가 결제를 완료했지만, 앱스토어에서 사용자 정보 검증에 실패했을 때 발생해요. 사용자가 앱스토어에 문의해서 환불을 요청해야해요.
1773
- * @throw {code: "TOSS_SERVER_VERIFICATION_FAILED"} - 사용자가 결제를 완료했지만, 서버 전송에 실패해서 결제 정보를 저장할 수 없을 때 발생해요.
1774
- * @throw {code: "INTERNAL_ERROR"} - 서버 내부 문제로 요청을 처리할 수 없을 때 발생해요.
1775
- * @throw {code: "KOREAN_ACCOUNT_ONLY"} - iOS 환경에서 사용자의 계정이 한국 계정이 아닐 때 발생해요.
1776
- * @throw {code: "USER_CANCELED"} - 사용자가 결제를 완료하지 않고 주문서 페이지를 이탈했을 때 발생해요.
1777
- *
1778
- * @example
1779
- * ### 특정 인앱결제 주문서 페이지로 이동하기
1780
- *
1781
- * ```tsx
1782
- * import { IAP } from "@apps-in-toss/web-framework";
1783
- * import { Button } from "@toss-design-system/react-native";
1784
- *
1785
- * interface Props {
1786
- * productId: string;
1787
- * }
1788
- *
1789
- * function IapCreateOneTimePurchaseOrderButton({ productId }: Props) {
1790
- * async function handleClick() {
1791
- * try {
1792
- * await IAP.createOneTimePurchaseOrder({
1793
- * productId,
1487
+ * await IAP.createOneTimePurchaseOrder({
1488
+ * productId,
1794
1489
  * });
1795
1490
  * console.error("인앱결제에 성공했어요");
1796
1491
  * } catch (error) {
@@ -1908,74 +1603,6 @@ declare const IAP: {
1908
1603
  getProductItemList: typeof getProductItemList;
1909
1604
  };
1910
1605
 
1911
- interface OpenCameraOptions {
1912
- /**
1913
- * 이미지를 Base64 형식으로 반환할지 여부를 나타내는 불리언 값이에요.
1914
- *
1915
- * 기본값: `false`.
1916
- */
1917
- base64?: boolean;
1918
- /**
1919
- * 이미지의 최대 너비를 나타내는 숫자 값이에요.
1920
- *
1921
- * 기본값: `1024`.
1922
- */
1923
- maxWidth?: number;
1924
- }
1925
- /**
1926
- * @public
1927
- * @category 카메라
1928
- * @name openCamera
1929
- * @description 카메라를 실행해서 촬영된 이미지를 반환하는 함수예요.
1930
- * @param {OpenCameraOptions} options - 카메라 실행 시 사용되는 옵션 객체예요.
1931
- * @param {boolean} [options.base64=false] - 이미지를 Base64 형식으로 반환할지 여부를 나타내는 불리언 값이에요. 기본값은 `false`예요. `true`로 설정하면 `dataUri` 대신 Base64 인코딩된 문자열을 반환해요.
1932
- * @param {number} [options.maxWidth=1024] - 이미지의 최대 너비를 나타내는 숫자 값이에요. 기본값은 `1024`예요.
1933
- * @returns {Promise<ImageResponse>}
1934
- * 촬영된 이미지 정보를 포함한 객체를 반환해요. 반환 객체의 구성은 다음과 같아요:
1935
- * - `id`: 이미지의 고유 식별자예요.
1936
- * - `dataUri`: 이미지 데이터를 표현하는 데이터 URI예요.
1937
- *
1938
- * @example
1939
- * ### 카메라 실행 후 촬영된 사진 가져오기
1940
- *
1941
- * ```tsx
1942
- * import React, { useState } from 'react';
1943
- * import { View, Text, Button, Image } from 'react-native';
1944
- * import { openCamera } from '@apps-in-toss/framework';
1945
- *
1946
- * const base64 = true;
1947
- *
1948
- * // 카메라를 실행하고 촬영된 이미지를 화면에 표시하는 컴포넌트
1949
- * function Camera() {
1950
- * const [image, setImage] = useState(null);
1951
- *
1952
- * const handlePress = async () => {
1953
- * try {
1954
- * const response = await openCamera({ base64 });
1955
- * setImage(response);
1956
- * } catch (error) {
1957
- * console.error('사진을 가져오는 데 실패했어요:', error);
1958
- * }
1959
- * };
1960
- *
1961
- * // base64 형식으로 반환된 이미지를 표시하려면 데이터 URL 스키마 Prefix를 붙여야해요.
1962
- * const imageUri = base64 ? 'data:image/jpeg;base64,' + image.dataUri : image.dataUri;
1963
- *
1964
- * return (
1965
- * <View>
1966
- * {image ? (
1967
- * <Image source={{ uri: imageUri }} style={{ width: 200, height: 200 }} />
1968
- * ) : (
1969
- * <Text>사진이 없어요</Text>
1970
- * )}
1971
- * <Button title="사진 촬영하기" onPress={handlePress} />
1972
- * </View>
1973
- * );
1974
- * }
1975
- * ```
1976
- */
1977
- declare function openCamera(options?: OpenCameraOptions): Promise<ImageResponse>;
1978
-
1979
1606
  interface SaveBase64DataParams {
1980
1607
  data: string;
1981
1608
  fileName: string;
@@ -2081,7 +1708,6 @@ declare function submitGameCenterLeaderBoardScore(params: {
2081
1708
  score: string;
2082
1709
  }): Promise<SubmitGameCenterLeaderBoardScoreResponse | undefined>;
2083
1710
 
2084
- type CompatiblePlaceholderArgument = object;
2085
1711
  /**
2086
1712
  * TurboModule 타입 별칭 사용하는 이유?
2087
1713
  * React Native Codegen 에 의해 코드젠 되는 것이 아니라 추후 내부 모듈 체계에 의해 처리될 것이기 때문에 RN Codegen에 본 파일을 코드젠 하지 않도록 함
@@ -2092,13 +1718,15 @@ interface Spec extends TurboModule {
2092
1718
  operationalEnvironment: 'sandbox' | 'toss';
2093
1719
  tossAppVersion: string;
2094
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>;
2095
1727
  getWebBundleURL: (arg: CompatiblePlaceholderArgument) => {
2096
1728
  url: string;
2097
1729
  };
2098
- getClipboardText: (arg: CompatiblePlaceholderArgument) => Promise<string>;
2099
- setClipboardText: (option: {
2100
- text: string;
2101
- }) => Promise<void>;
2102
1730
  getPermission: (permission: {
2103
1731
  name: PermissionName;
2104
1732
  access: PermissionAccess;
@@ -2107,20 +1735,6 @@ interface Spec extends TurboModule {
2107
1735
  name: PermissionName;
2108
1736
  access: PermissionAccess;
2109
1737
  }) => Promise<Exclude<PermissionStatus, 'notDetermined'>>;
2110
- fetchContacts: ({ size, offset, query, }: {
2111
- size: number;
2112
- offset: number;
2113
- query?: {
2114
- contains?: string;
2115
- };
2116
- }) => Promise<{
2117
- result: ContactEntity[];
2118
- nextOffset: number | undefined;
2119
- done: boolean;
2120
- }>;
2121
- fetchAlbumPhotos: (options: FetchAlbumPhotosOptions) => Promise<ImageResponse[]>;
2122
- getCurrentLocation: (options: GetCurrentLocationOptions) => Promise<Location>;
2123
- openCamera: (options: OpenCameraOptions) => Promise<ImageResponse>;
2124
1738
  appLogin: (arg: CompatiblePlaceholderArgument) => Promise<{
2125
1739
  authorizationCode: string;
2126
1740
  referrer: 'DEFAULT' | 'SANDBOX';
@@ -2195,6 +1809,8 @@ declare function appLogin(): Promise<{
2195
1809
  referrer: 'DEFAULT' | 'SANDBOX';
2196
1810
  }>;
2197
1811
 
1812
+ type Primitive = string | number | boolean | null | undefined | symbol;
1813
+
2198
1814
  interface EventLogParams {
2199
1815
  log_name: string;
2200
1816
  log_type: 'debug' | 'info' | 'warn' | 'error' | 'screen' | 'impression' | 'click';
@@ -2237,44 +1853,505 @@ interface EventLogParams {
2237
1853
  */
2238
1854
  declare function eventLog(params: EventLogParams): Promise<void>;
2239
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
+
2240
2059
  /**
2241
2060
  * @public
2242
2061
  * @category 클립보드
2243
2062
  * @name getClipboardText
2244
2063
  * @description 클립보드에 저장된 텍스트를 가져오는 함수예요. 복사된 텍스트를 읽어서 다른 작업에 활용할 수 있어요.
2064
+ * @property [openPermissionDialog] - 클립보드 읽기 권한을 다시 요청하는 다이얼로그를 표시해요. 사용자는 "허용", "한 번만 허용", "안하기" 중 하나를 선택할 수 있어요. "허용"이나 "한 번만 허용"을 선택하면 `allowed`를 반환하고, "안하기"를 선택하면 `denied`를 반환해요.
2065
+ * @property [getPermission] - 클립보드 읽기 권한의 현재 상태를 반환해요. `allowed`는 사용자가 클립보드 읽기 권한을 허용한 상태예요. `denied`는 사용자가 클립보드 읽기 권한을 거부한 상태예요. `notDetermined`는 클립보드 읽기 권한 요청을 한 번도 하지 않은 상태예요.
2245
2066
  * @returns {Promise<string>} - 클립보드에 저장된 텍스트를 반환해요. 클립보드에 텍스트가 없으면 빈 문자열을 반환해요.
2246
2067
  *
2068
+ * @signature
2069
+ * ```typescript
2070
+ * function getClipboardText(): Promise<string>;
2071
+ * ```
2072
+ *
2247
2073
  * @example
2248
2074
  * ### 클립보드의 텍스트 가져오기
2249
2075
  *
2250
- * ```tsx
2251
- * import React, { useState } from 'react';
2252
- * import { View, Text, Button } from 'react-native';
2253
- * import { getClipboardText } from '@apps-in-toss/framework';
2076
+ * 클립보드의 텍스트를 가져오는 예제예요.
2077
+ * "권한 확인하기"버튼을 눌러서 현재 클립보드 읽기 권한을 확인해요.
2078
+ * 사용자가 권한을 거부했거나 시스템에서 권한이 제한된 경우에는 [`GetClipboardTextPermissionError`](/react-native/reference/types/권한/GetClipboardTextPermissionError)를 반환해요.
2079
+ * "권한 요청하기"버튼을 눌러서 클립보드 읽기 권한을 요청할 수 있어요.
2254
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
+
2255
2090
  * // '붙여넣기' 버튼을 누르면 클립보드에 저장된 텍스트를 가져와 화면에 표시해요.
2256
2091
  * function PasteButton() {
2257
- * const [text, setText] = useState('');
2258
- *
2092
+ * const [text, setText] = useState(''); *
2093
+
2259
2094
  * const handlePress = async () => {
2260
2095
  * try {
2261
2096
  * const clipboardText = await getClipboardText();
2262
2097
  * setText(clipboardText || '클립보드에 텍스트가 없어요.');
2263
2098
  * } catch (error) {
2264
- * console.error('클립보드에서 텍스트를 가져오지 못했어요:', error);
2099
+ * if (error instanceof GetClipboardTextPermissionError) {
2100
+ * // 클립보드 읽기 권한 없음
2101
+ * } *
2102
+
2103
+ * if (error instanceof SetClipboardTextPermissionError) {
2104
+ * // 클립보드 쓰기 권한 없음
2105
+ * }
2265
2106
  * }
2266
- * };
2267
- *
2107
+ * }; *
2108
+
2268
2109
  * return (
2269
2110
  * <View>
2270
2111
  * <Text>{text}</Text>
2271
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
+ * />
2272
2127
  * </View>
2273
2128
  * );
2274
2129
  * }
2275
2130
  * ```
2276
2131
  */
2277
- declare function getClipboardText(): Promise<string>;
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
+ * />
2349
+ * </View>
2350
+ * );
2351
+ * }
2352
+ * ```
2353
+ */
2354
+ declare const openCamera: _apps_in_toss_types.PermissionFunctionWithDialog<OpenCamera>;
2278
2355
 
2279
2356
  /**
2280
2357
  * @public
@@ -2444,37 +2521,6 @@ declare function isMinVersionSupported(minVersions: {
2444
2521
  ios: `${number}.${number}.${number}` | 'always' | 'never';
2445
2522
  }): boolean;
2446
2523
 
2447
- /**
2448
- * @public
2449
- * @category 클립보드
2450
- * @name setClipboardText
2451
- * @description 텍스트를 클립보드에 복사해서 사용자가 다른 곳에 붙여 넣기 할 수 있어요.
2452
- * @param {Promise<void>} text - 클립보드에 복사할 텍스트예요. 문자열 형식으로 입력해요.
2453
- *
2454
- * @example
2455
- * ### 텍스트를 클립보드에 복사하기
2456
- *
2457
- * ```tsx
2458
- * import { Button } from 'react-native';
2459
- * import { setClipboardText } from '@apps-in-toss/framework';
2460
- *
2461
- * // '복사' 버튼을 누르면 "복사할 텍스트"가 클립보드에 복사돼요.
2462
- * function CopyButton() {
2463
- * const handleCopy = async () => {
2464
- * try {
2465
- * await setClipboardText('복사할 텍스트');
2466
- * console.log('텍스트가 복사됐어요!');
2467
- * } catch (error) {
2468
- * console.error('텍스트 복사에 실패했어요:', error);
2469
- * }
2470
- * };
2471
- *
2472
- * return <Button title="복사" onPress={handleCopy} />;
2473
- * }
2474
- * ```
2475
- */
2476
- declare function setClipboardText(text: string): Promise<void>;
2477
-
2478
2524
  /**
2479
2525
  * @public
2480
2526
  * @category 화면 제어
@@ -3143,4 +3189,4 @@ declare const INTERNAL__module: {
3143
3189
  tossCoreEventLog: typeof tossCoreEventLog;
3144
3190
  };
3145
3191
 
3146
- 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__appBridgeHandler, 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 };