@apps-in-toss/framework 0.0.39 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bridge-meta.js +33 -14
- package/dist/index.cjs +1419 -781
- package/dist/index.d.cts +7 -2269
- package/dist/index.d.ts +7 -2269
- package/dist/index.js +1357 -736
- package/dist/internal.cjs +24 -0
- package/dist/internal.d.cts +1 -0
- package/dist/internal.d.ts +1 -0
- package/dist/internal.js +2 -0
- package/dist/jest/index.cjs +2 -2
- package/dist/jest/index.d.cts +1 -1
- package/dist/jest/index.d.ts +1 -1
- package/dist/jest/index.js +1 -1
- package/package.json +27 -26
- package/src/bridge-entry.ts +4 -0
- package/src/async-bridges.ts +0 -15
- package/src/constant-bridges.ts +0 -3
- package/src/event-bridges.ts +0 -2
package/dist/index.d.cts
CHANGED
|
@@ -3,13 +3,14 @@ import { ComponentType, PropsWithChildren } from 'react';
|
|
|
3
3
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
4
|
import * as _apps_in_toss_analytics from '@apps-in-toss/analytics';
|
|
5
5
|
export * from '@apps-in-toss/analytics';
|
|
6
|
-
import { InitialProps,
|
|
7
|
-
import { EmitterSubscription } from 'react-native';
|
|
6
|
+
import { InitialProps, GraniteProps } from '@granite-js/react-native';
|
|
8
7
|
import { PartnerWebViewScreenProps, ExternalWebViewScreenProps } from '@toss-design-system/react-native';
|
|
9
|
-
import { WebViewProps as WebViewProps$1 } from '@
|
|
8
|
+
import { WebViewProps as WebViewProps$1 } from '@granite-js/native/react-native-webview';
|
|
9
|
+
import { StartUpdateLocationOptions, Location, onVisibilityChangedByTransparentServiceWeb } from '@apps-in-toss/native-modules';
|
|
10
|
+
export * from '@apps-in-toss/native-modules';
|
|
10
11
|
|
|
11
12
|
interface AppsInTossProps {
|
|
12
|
-
context:
|
|
13
|
+
context: GraniteProps['context'];
|
|
13
14
|
analytics?: {
|
|
14
15
|
/**
|
|
15
16
|
* 분석 로그 출력 여부를 설정해요. 기본값은 `__DEV__` 예요.
|
|
@@ -23,2206 +24,6 @@ declare const AppsInToss: {
|
|
|
23
24
|
registerApp: typeof registerApp;
|
|
24
25
|
};
|
|
25
26
|
|
|
26
|
-
interface EventEmitterSchema<K extends string, P extends unknown[]> {
|
|
27
|
-
name: K;
|
|
28
|
-
params: P;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* @public
|
|
33
|
-
* @category 위치 정보
|
|
34
|
-
* @name Accuracy
|
|
35
|
-
* @description 위치 정확도 옵션이에요.
|
|
36
|
-
*/
|
|
37
|
-
declare enum Accuracy {
|
|
38
|
-
/**
|
|
39
|
-
* 오차범위 3KM 이내
|
|
40
|
-
*/
|
|
41
|
-
Lowest = 1,
|
|
42
|
-
/**
|
|
43
|
-
* 오차범위 1KM 이내
|
|
44
|
-
*/
|
|
45
|
-
Low = 2,
|
|
46
|
-
/**
|
|
47
|
-
* 오차범위 몇 백미터 이내
|
|
48
|
-
*/
|
|
49
|
-
Balanced = 3,
|
|
50
|
-
/**
|
|
51
|
-
* 오차범위 10M 이내
|
|
52
|
-
*/
|
|
53
|
-
High = 4,
|
|
54
|
-
/**
|
|
55
|
-
* 가장 높은 정확도
|
|
56
|
-
*/
|
|
57
|
-
Highest = 5,
|
|
58
|
-
/**
|
|
59
|
-
* 네비게이션을 위한 최고 정확도
|
|
60
|
-
*/
|
|
61
|
-
BestForNavigation = 6
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* @public
|
|
65
|
-
* @category 위치 정보
|
|
66
|
-
* @name Location
|
|
67
|
-
* @description 위치 정보를 나타내는 객체예요.
|
|
68
|
-
*/
|
|
69
|
-
interface Location {
|
|
70
|
-
/**
|
|
71
|
-
* Android에서만 지원하는 옵션이에요.
|
|
72
|
-
*
|
|
73
|
-
* - `FINE`: 정확한 위치
|
|
74
|
-
* - `COARSE`: 대략적인 위치
|
|
75
|
-
*
|
|
76
|
-
* @see https://developer.android.com/codelabs/approximate-location
|
|
77
|
-
*/
|
|
78
|
-
accessLocation?: 'FINE' | 'COARSE';
|
|
79
|
-
/**
|
|
80
|
-
* 위치가 업데이트된 시점의 유닉스 타임스탬프예요.
|
|
81
|
-
*/
|
|
82
|
-
timestamp: number;
|
|
83
|
-
/**
|
|
84
|
-
* @description 위치 정보를 나타내는 객체예요. 자세한 내용은 [LocationCoords](/react-native/reference/framework/Types/LocationCoords.html)을 참고해주세요.
|
|
85
|
-
*/
|
|
86
|
-
coords: LocationCoords;
|
|
87
|
-
}
|
|
88
|
-
/**
|
|
89
|
-
* @public
|
|
90
|
-
* @category 위치 정보
|
|
91
|
-
* @name LocationCoords
|
|
92
|
-
* @description 세부 위치 정보를 나타내는 객체예요.
|
|
93
|
-
*/
|
|
94
|
-
interface LocationCoords {
|
|
95
|
-
/**
|
|
96
|
-
* 위도
|
|
97
|
-
*/
|
|
98
|
-
latitude: number;
|
|
99
|
-
/**
|
|
100
|
-
* 경도
|
|
101
|
-
*/
|
|
102
|
-
longitude: number;
|
|
103
|
-
/**
|
|
104
|
-
* 높이
|
|
105
|
-
*/
|
|
106
|
-
altitude: number;
|
|
107
|
-
/**
|
|
108
|
-
* 위치 정확도
|
|
109
|
-
*/
|
|
110
|
-
accuracy: number;
|
|
111
|
-
/**
|
|
112
|
-
* 고도 정확도
|
|
113
|
-
*/
|
|
114
|
-
altitudeAccuracy: number;
|
|
115
|
-
/**
|
|
116
|
-
* 방향
|
|
117
|
-
*/
|
|
118
|
-
heading: number;
|
|
119
|
-
}
|
|
120
|
-
/**
|
|
121
|
-
* 사진 조회 결과를 나타내는 타입이에요.
|
|
122
|
-
*/
|
|
123
|
-
interface ImageResponse {
|
|
124
|
-
/** 가져온 사진의 고유 ID예요. */
|
|
125
|
-
id: string;
|
|
126
|
-
/** 사진의 데이터 URI예요. `base64` 옵션이 `true`인 경우 Base64 문자열로 반환돼요. */
|
|
127
|
-
dataUri: string;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
interface StartUpdateLocationOptions$1 {
|
|
131
|
-
/**
|
|
132
|
-
* 위치 정확도를 설정해요.
|
|
133
|
-
*/
|
|
134
|
-
accuracy: Accuracy;
|
|
135
|
-
/**
|
|
136
|
-
* 위치 업데이트 주기를 밀리초(ms) 단위로 설정해요.
|
|
137
|
-
*/
|
|
138
|
-
timeInterval: number;
|
|
139
|
-
/**
|
|
140
|
-
* 위치 변경 거리를 미터(m) 단위로 설정해요.
|
|
141
|
-
*/
|
|
142
|
-
distanceInterval: number;
|
|
143
|
-
}
|
|
144
|
-
interface StartUpdateLocationSubscription extends EmitterSubscription {
|
|
145
|
-
remove: () => Promise<void>;
|
|
146
|
-
}
|
|
147
|
-
/**
|
|
148
|
-
* @name UpdateLocationEventEmitter
|
|
149
|
-
* @kind typedef
|
|
150
|
-
* @description
|
|
151
|
-
* 디바이스의 위치 정보 변경을 감지해요
|
|
152
|
-
*/
|
|
153
|
-
type UpdateLocationEventEmitter = EventEmitterSchema<'updateLocation', [Location]>;
|
|
154
|
-
/**
|
|
155
|
-
* @public
|
|
156
|
-
* @category 위치 정보
|
|
157
|
-
* @name startUpdateLocation
|
|
158
|
-
* @description 디바이스의 위치 정보를 지속적으로 감지하고, 위치가 변경되면 콜백을 실행하는 함수예요. 콜백 함수를 등록하면 위치가 변경될 때마다 자동으로 호출돼요.
|
|
159
|
-
* 실시간 위치 추적이 필요한 기능을 구현할 때 사용할 수 있어요. 예를 들어 지도 앱에서 사용자의 현재 위치를 실시간으로 업데이트할 때, 운동 앱에서 사용자의 이동 거리를 기록할 때 등이에요.
|
|
160
|
-
* 위치 업데이트 주기와 정확도를 조정해 배터리 소모를 최소화하면서도 필요한 정보를 얻을 수 있어요.
|
|
161
|
-
*
|
|
162
|
-
* @param {StartUpdateLocationOptions} options - 위치 정보 감지에 필요한 설정 객체에요.
|
|
163
|
-
* @param {number} [options.accuracy] 위치 정확도를 설정해요.
|
|
164
|
-
* @param {number} [options.timeInterval] 위치 정보를 업데이트하는 최소 주기로, 단위는 밀리초(ms)예요. 이 값은 위치 업데이트가 발생하는 가장 짧은 간격을 설정하지만, 시스템이나 환경의 영향을 받아 지정한 주기보다 더 긴 간격으로 업데이트될 수 있어요.
|
|
165
|
-
* @param {number} [options.distanceInterval] 위치 변경 거리를 미터(m) 단위로 설정해요.
|
|
166
|
-
* @param {(location: Location) => void} [options.callback] 위치 정보가 변경될 때 호출되는 콜백 함수예요. 자세한 내용은 [Location](/react-native/reference/framework/Types/Location.html)을 참고해주세요.
|
|
167
|
-
*
|
|
168
|
-
* @example
|
|
169
|
-
* ### 위치 정보 변경 감지하기
|
|
170
|
-
*
|
|
171
|
-
* ```tsx
|
|
172
|
-
* import React, { useState, useEffect } from 'react';
|
|
173
|
-
* import { View, Text, Button } from 'react-native';
|
|
174
|
-
* import { startUpdateLocation } from '@apps-in-toss/framework';
|
|
175
|
-
*
|
|
176
|
-
* // 위치 정보 변경 감지하기
|
|
177
|
-
* function LocationWatcher() {
|
|
178
|
-
* const [location, setLocation] = useState(null);
|
|
179
|
-
*
|
|
180
|
-
* useEffect(() => {
|
|
181
|
-
* return startUpdateLocation({
|
|
182
|
-
* options: {
|
|
183
|
-
* accuracy: Accuracy.Balanced,
|
|
184
|
-
* timeInterval: 3000,
|
|
185
|
-
* distanceInterval: 10,
|
|
186
|
-
* },
|
|
187
|
-
* onEvent: (location) => {
|
|
188
|
-
* setLocation(location);
|
|
189
|
-
* },
|
|
190
|
-
* onError: (error) => {
|
|
191
|
-
* console.error('위치 정보를 가져오는데 실패했어요:', error);
|
|
192
|
-
* },
|
|
193
|
-
* });
|
|
194
|
-
* }, []);
|
|
195
|
-
*
|
|
196
|
-
* if (location == null) {
|
|
197
|
-
* return <Text>위치 정보를 가져오는 중이에요...</Text>;
|
|
198
|
-
* }
|
|
199
|
-
*
|
|
200
|
-
* return (
|
|
201
|
-
* <View>
|
|
202
|
-
* <Text>위도: {location.coords.latitude}</Text>
|
|
203
|
-
* <Text>경도: {location.coords.longitude}</Text>
|
|
204
|
-
* <Text>위치 정확도: {location.coords.accuracy}m</Text>
|
|
205
|
-
* <Text>높이: {location.coords.altitude}m</Text>
|
|
206
|
-
* <Text>고도 정확도: {location.coords.altitudeAccuracy}m</Text>
|
|
207
|
-
* <Text>방향: {location.coords.heading}°</Text>
|
|
208
|
-
* </View>
|
|
209
|
-
* );
|
|
210
|
-
* }
|
|
211
|
-
* ```
|
|
212
|
-
*/
|
|
213
|
-
declare function startUpdateLocation(eventParams: {
|
|
214
|
-
onEvent: (response: Location) => void;
|
|
215
|
-
onError: (error: unknown) => void;
|
|
216
|
-
options: StartUpdateLocationOptions$1;
|
|
217
|
-
}): () => void;
|
|
218
|
-
|
|
219
|
-
/**
|
|
220
|
-
* @public
|
|
221
|
-
* @category 광고
|
|
222
|
-
* @name AdMobFullScreenEvent
|
|
223
|
-
* @description 앱 화면을 덮는 광고(예: 전면 광고, 보상형 광고)를 사용하는 경우에 발생하는 이벤트 타입이에요.
|
|
224
|
-
* @example
|
|
225
|
-
* ### 광고 이벤트 처리하기
|
|
226
|
-
* ```ts
|
|
227
|
-
* function handleEvent(event: AdMobFullScreenEvent) {
|
|
228
|
-
* switch (event.type) {
|
|
229
|
-
* case 'clicked':
|
|
230
|
-
* console.log('광고가 클릭됐어요.');
|
|
231
|
-
* break;
|
|
232
|
-
*
|
|
233
|
-
* case 'dismissed':
|
|
234
|
-
* console.log('광고가 닫혔어요.');
|
|
235
|
-
* break;
|
|
236
|
-
*
|
|
237
|
-
* case 'failedToShow':
|
|
238
|
-
* console.log('광고가 보여지지 않았어요.');
|
|
239
|
-
* break;
|
|
240
|
-
*
|
|
241
|
-
* case 'impression':
|
|
242
|
-
* console.log('광고가 노출됐어요.');
|
|
243
|
-
* break;
|
|
244
|
-
*
|
|
245
|
-
* case 'show':
|
|
246
|
-
* console.log('광고가 보여졌어요.');
|
|
247
|
-
* break;
|
|
248
|
-
* }
|
|
249
|
-
* }
|
|
250
|
-
* ```
|
|
251
|
-
*/
|
|
252
|
-
type AdMobFullScreenEvent = AdClicked | AdDismissed | AdFailedToShow | AdImpression | AdShow;
|
|
253
|
-
type AdClicked = {
|
|
254
|
-
type: 'clicked';
|
|
255
|
-
};
|
|
256
|
-
type AdDismissed = {
|
|
257
|
-
type: 'dismissed';
|
|
258
|
-
};
|
|
259
|
-
type AdFailedToShow = {
|
|
260
|
-
type: 'failedToShow';
|
|
261
|
-
};
|
|
262
|
-
type AdImpression = {
|
|
263
|
-
type: 'impression';
|
|
264
|
-
};
|
|
265
|
-
type AdShow = {
|
|
266
|
-
type: 'show';
|
|
267
|
-
};
|
|
268
|
-
interface AdMobHandlerParams<Options = void, Event = AdMobFullScreenEvent> {
|
|
269
|
-
options: Options;
|
|
270
|
-
onEvent: (event: Event) => void;
|
|
271
|
-
onError: (error: unknown) => void;
|
|
272
|
-
}
|
|
273
|
-
/**
|
|
274
|
-
* @public
|
|
275
|
-
* @category 광고
|
|
276
|
-
* @name ResponseInfo
|
|
277
|
-
* @description 광고 로드 응답 정보를 담고 있는 객체예요.
|
|
278
|
-
* @property {Array<AdNetworkResponseInfo>} adNetworkInfoArray 광고 네트워크 응답 정보 배열예요.
|
|
279
|
-
* @property {AdNetworkResponseInfo | null} loadedAdNetworkInfo 로드된 광고 네트워크 응답 정보예요.
|
|
280
|
-
* @property {string | null} responseId 광고 응답 ID예요.
|
|
281
|
-
*/
|
|
282
|
-
interface ResponseInfo {
|
|
283
|
-
adNetworkInfoArray: Array<AdNetworkResponseInfo>;
|
|
284
|
-
loadedAdNetworkInfo: AdNetworkResponseInfo | null;
|
|
285
|
-
responseId: string | null;
|
|
286
|
-
}
|
|
287
|
-
/**
|
|
288
|
-
* @public
|
|
289
|
-
* @category 광고
|
|
290
|
-
* @name AdNetworkResponseInfo
|
|
291
|
-
* @description 광고 네트워크 응답 정보를 담고 있는 객체예요.
|
|
292
|
-
* @property {string} adSourceId 광고 소스 ID예요.
|
|
293
|
-
* @property {string} adSourceName 광고 소스 이름이예요.
|
|
294
|
-
* @property {string} adSourceInstanceId 광고 소스 인스턴스 ID예요.
|
|
295
|
-
* @property {string} adSourceInstanceName 광고 소스 인스턴스 이름이예요.
|
|
296
|
-
* @property {string | null} adNetworkClassName 광고 네트워크 클래스 이름이예요.
|
|
297
|
-
*/
|
|
298
|
-
interface AdNetworkResponseInfo {
|
|
299
|
-
adSourceId: string;
|
|
300
|
-
adSourceName: string;
|
|
301
|
-
adSourceInstanceId: string;
|
|
302
|
-
adSourceInstanceName: string;
|
|
303
|
-
adNetworkClassName: string | null;
|
|
304
|
-
}
|
|
305
|
-
/**
|
|
306
|
-
* @public
|
|
307
|
-
* @category 광고
|
|
308
|
-
* @name InterstitialAd
|
|
309
|
-
* @description 전면 광고의 ID와 응답 정보를 담고 있는 객체예요. 광고를 로드한 뒤, 관련 정보를 확인할 때 유용해요.
|
|
310
|
-
* @property {string} adUnitId 광고 ID예요.
|
|
311
|
-
* @property {ResponseInfo} responseInfo 광고 로드 응답 정보예요. 자세한 내용은 [ResponseInfo](/react-native/reference/framework/광고/ResponseInfo.html)를 참고하세요.
|
|
312
|
-
*/
|
|
313
|
-
interface InterstitialAd {
|
|
314
|
-
adUnitId: string;
|
|
315
|
-
responseInfo: ResponseInfo;
|
|
316
|
-
}
|
|
317
|
-
/**
|
|
318
|
-
* @public
|
|
319
|
-
* @category 광고
|
|
320
|
-
* @name RewardedAd
|
|
321
|
-
* @description 보상형 광고의 ID와 응답 정보를 담고 있는 객체예요. 광고를 로드한 뒤, 관련 정보를 확인할 때 유용해요.
|
|
322
|
-
* @property {string} adUnitId 광고 ID예요.
|
|
323
|
-
* @property {ResponseInfo} responseInfo 광고 로드 응답 정보예요. 자세한 내용은 [ResponseInfo](/react-native/reference/framework/광고/ResponseInfo.html)를 참고하세요.
|
|
324
|
-
*/
|
|
325
|
-
interface RewardedAd {
|
|
326
|
-
adUnitId: string;
|
|
327
|
-
responseInfo: ResponseInfo;
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
interface LoadAdMobInterstitialAdOptions {
|
|
331
|
-
/**
|
|
332
|
-
* 광고 단위 ID
|
|
333
|
-
*/
|
|
334
|
-
adUnitId: string;
|
|
335
|
-
}
|
|
336
|
-
/**
|
|
337
|
-
* @public
|
|
338
|
-
* @category 광고
|
|
339
|
-
* @name LoadAdMobInterstitialAdEvent
|
|
340
|
-
* @description 전면 광고를 불러오는 함수에서 발생하는 이벤트 타입이에요. `loaded` 이벤트가 발생하면 광고를 성공적으로 불러온 거예요. 이때 [InterstitialAd](/react-native/reference/framework/광고/InterstitialAd.html) 객체가 함께 반환돼요.
|
|
341
|
-
*/
|
|
342
|
-
type LoadAdMobInterstitialAdEvent = AdMobFullScreenEvent | {
|
|
343
|
-
type: 'loaded';
|
|
344
|
-
data: InterstitialAd;
|
|
345
|
-
};
|
|
346
|
-
/**
|
|
347
|
-
* @public
|
|
348
|
-
* @category 광고
|
|
349
|
-
* @name LoadAdMobInterstitialAdParams
|
|
350
|
-
* @description 전면 광고를 불러오는 함수에 필요한 옵션 객체예요.
|
|
351
|
-
*/
|
|
352
|
-
type LoadAdMobInterstitialAdParams = AdMobHandlerParams<LoadAdMobInterstitialAdOptions, LoadAdMobInterstitialAdEvent>;
|
|
353
|
-
/**
|
|
354
|
-
* @public
|
|
355
|
-
* @category 광고
|
|
356
|
-
* @name loadAdMobInterstitialAd
|
|
357
|
-
* @description 앱 화면 전체를 덮는 전면 광고를 미리 불러와서, 광고가 필요한 시점에 바로 보여줄 수 있도록 준비하는 함수예요.
|
|
358
|
-
* @param {LoadAdMobInterstitialAdParams} params 광고를 불러올 때 사용할 설정 값이에요. 광고 ID와 광고의 동작에 대한 콜백을 설정할 수 있어요.
|
|
359
|
-
* @param {LoadAdMobInterstitialAdOptions} params.options 광고를 불러올 때 전달할 옵션 객체예요.
|
|
360
|
-
* @param {string} params.options.adUnitId 광고 단위 ID예요. 발급받은 전면 광고용 ID를 입력해요.
|
|
361
|
-
* @param {(event: LoadAdMobInterstitialAdEvent) => void} [params.onEvent] 광고 관련 이벤트가 발생했을 때 호출돼요. (예시: 광고가 닫히거나 클릭됐을 때). 자세한 이벤트 타입은 [LoadAdMobInterstitialAdEvent](/react-native/reference/framework/광고/LoadAdMobInterstitialAdEvent.html)를 참고하세요.
|
|
362
|
-
* @param {(reason: unknown) => void} [params.onError] 광고를 불러오지 못했을 때 호출돼요. (예시: 네트워크 오류나 지원하지 않는 환경일 때)
|
|
363
|
-
* @property {() => boolean} [isSupported] 현재 실행 중인 앱(예: 토스 앱, 개발용 샌드박스 앱 등)에서 Google AdMob 광고 기능을 지원하는지 확인하는 함수예요. 기능을 사용하기 전에 지원 여부를 확인해야 해요.
|
|
364
|
-
*
|
|
365
|
-
* @example
|
|
366
|
-
* ### 버튼 눌러 불러온 전면 광고 보여주기
|
|
367
|
-
* ```tsx
|
|
368
|
-
* import { GoogleAdMob } from '@apps-in-toss/framework';
|
|
369
|
-
* import { useFocusEffect } from '@react-native-bedrock/native/@react-navigation/native';
|
|
370
|
-
* import { useCallback, useState } from 'react';
|
|
371
|
-
* import { Button, Text, View } from 'react-native';
|
|
372
|
-
* import { useNavigation } from 'react-native-bedrock';
|
|
373
|
-
*
|
|
374
|
-
* const AD_UNIT_ID = '<AD_UNIT_ID>';
|
|
375
|
-
*
|
|
376
|
-
* export function GoogleAdmobInterstitialAdExample() {
|
|
377
|
-
* const [adLoadStatus, setAdLoadStatus] = useState<'not_loaded' | 'loaded' | 'failed'>('not_loaded');
|
|
378
|
-
* const navigation = useNavigation();
|
|
379
|
-
*
|
|
380
|
-
* const loadAd = useCallback(() => {
|
|
381
|
-
* if (GoogleAdMob.loadAdMobInterstitialAd.isSupported() !== true) {
|
|
382
|
-
* return;
|
|
383
|
-
* }
|
|
384
|
-
|
|
385
|
-
* const cleanup = GoogleAdMob.loadAdMobInterstitialAd({
|
|
386
|
-
* options: {
|
|
387
|
-
* adUnitId: AD_UNIT_ID,
|
|
388
|
-
* },
|
|
389
|
-
* onEvent: (event) => {
|
|
390
|
-
* switch (event.type) {
|
|
391
|
-
* case 'loaded':
|
|
392
|
-
* console.log('광고 로드 성공', event.data);
|
|
393
|
-
* setAdLoadStatus('loaded');
|
|
394
|
-
* break;
|
|
395
|
-
*
|
|
396
|
-
* case 'clicked':
|
|
397
|
-
* console.log('광고 클릭');
|
|
398
|
-
* break;
|
|
399
|
-
*
|
|
400
|
-
* case 'dismissed':
|
|
401
|
-
* console.log('광고 닫힘');
|
|
402
|
-
* navigation.navigate('/examples/google-admob-interstitial-ad-landing');
|
|
403
|
-
* break;
|
|
404
|
-
*
|
|
405
|
-
* case 'failedToShow':
|
|
406
|
-
* console.log('광고 보여주기 실패');
|
|
407
|
-
* break;
|
|
408
|
-
*
|
|
409
|
-
* case 'impression':
|
|
410
|
-
* console.log('광고 노출');
|
|
411
|
-
* break;
|
|
412
|
-
*
|
|
413
|
-
* case 'show':
|
|
414
|
-
* console.log('광고 컨텐츠 보여졌음');
|
|
415
|
-
* break;
|
|
416
|
-
* }
|
|
417
|
-
* },
|
|
418
|
-
* onError: (error) => {
|
|
419
|
-
* console.error('광고 불러오기 실패', error);
|
|
420
|
-
* },
|
|
421
|
-
* });
|
|
422
|
-
*
|
|
423
|
-
* return cleanup;
|
|
424
|
-
* }, [navigation]);
|
|
425
|
-
*
|
|
426
|
-
* const showAd = useCallback(() => {
|
|
427
|
-
* if (GoogleAdMob.showAdMobInterstitialAd.isSupported() !== true) {
|
|
428
|
-
* return;
|
|
429
|
-
* }
|
|
430
|
-
*
|
|
431
|
-
* GoogleAdMob.showAdMobInterstitialAd({
|
|
432
|
-
* options: {
|
|
433
|
-
* adUnitId: AD_UNIT_ID,
|
|
434
|
-
* },
|
|
435
|
-
* onEvent: (event) => {
|
|
436
|
-
* switch (event.type) {
|
|
437
|
-
* case 'requested':
|
|
438
|
-
* console.log('광고 보여주기 요청 완료');
|
|
439
|
-
* break;
|
|
440
|
-
* }
|
|
441
|
-
* },
|
|
442
|
-
* onError: (error) => {
|
|
443
|
-
* console.error('광고 보여주기 실패', error);
|
|
444
|
-
* },
|
|
445
|
-
* });
|
|
446
|
-
* }, []);
|
|
447
|
-
*
|
|
448
|
-
* useFocusEffect(loadAd);
|
|
449
|
-
*
|
|
450
|
-
* return (
|
|
451
|
-
* <View>
|
|
452
|
-
* <Text>
|
|
453
|
-
* {adLoadStatus === 'not_loaded' && '광고 로드 하지 않음 '}
|
|
454
|
-
* {adLoadStatus === 'loaded' && '광고 로드 완료'}
|
|
455
|
-
* {adLoadStatus === 'failed' && '광고 로드 실패'}
|
|
456
|
-
* </Text>
|
|
457
|
-
*
|
|
458
|
-
* <Button title="Show Ad" onPress={showAd} disabled={adLoadStatus !== 'loaded'} />
|
|
459
|
-
* </View>
|
|
460
|
-
* );
|
|
461
|
-
* }
|
|
462
|
-
* ```
|
|
463
|
-
*/
|
|
464
|
-
declare function loadAdMobInterstitialAd(params: LoadAdMobInterstitialAdParams): () => void;
|
|
465
|
-
declare namespace loadAdMobInterstitialAd {
|
|
466
|
-
var isSupported: () => boolean;
|
|
467
|
-
}
|
|
468
|
-
interface ShowAdMobInterstitialAdOptions {
|
|
469
|
-
/**
|
|
470
|
-
* 광고 단위 ID
|
|
471
|
-
*/
|
|
472
|
-
adUnitId: string;
|
|
473
|
-
}
|
|
474
|
-
/**
|
|
475
|
-
* @public
|
|
476
|
-
* @category 광고
|
|
477
|
-
* @name ShowAdMobInterstitialAdEvent
|
|
478
|
-
* @description 전면 광고를 보여주는 함수에서 발생하는 이벤트 타입이에요. `requested` 이벤트가 발생하면 광고 노출 요청이 Google AdMob에 성공적으로 전달된 거예요.
|
|
479
|
-
*/
|
|
480
|
-
type ShowAdMobInterstitialAdEvent = {
|
|
481
|
-
type: 'requested';
|
|
482
|
-
};
|
|
483
|
-
/**
|
|
484
|
-
* @public
|
|
485
|
-
* @category 광고
|
|
486
|
-
* @name ShowAdMobInterstitialAdParams
|
|
487
|
-
* @description 불러온 전면 광고를 보여주는 함수에 필요한 옵션 객체예요.
|
|
488
|
-
*/
|
|
489
|
-
type ShowAdMobInterstitialAdParams = AdMobHandlerParams<ShowAdMobInterstitialAdOptions, ShowAdMobInterstitialAdEvent>;
|
|
490
|
-
/**
|
|
491
|
-
* @public
|
|
492
|
-
* @category 광고
|
|
493
|
-
* @name showAdMobInterstitialAd
|
|
494
|
-
* @description 앱 화면 전체를 덮는 전면 광고를 사용자에게 노출해요. 이 함수는 `loadAdMobInterstitialAd` 로 미리 불러온 광고를 실제로 사용자에게 노출해요.
|
|
495
|
-
* @param {ShowAdMobInterstitialAdParams} params 광고를 보여주기 위해 사용할 설정 값이에요. 광고 ID와과 광고의 동작에 대한 콜백을 설정할 수 있어요.
|
|
496
|
-
* @param {ShowAdMobInterstitialAdOptions} params.options 광고를 보여줄 때 전달할 옵션 객체예요.
|
|
497
|
-
* @param {string} params.options.adUnitId 광고 단위 ID예요. `loadAdMobInterstitialAd` 로 불러온 전면 광고용 ID를 입력해요.
|
|
498
|
-
* @param {(event: ShowAdMobInterstitialAdEvent) => void} [params.onEvent] 광고 관련 이벤트가 발생했을 때 호출돼요. (예시: 광고 노출을 요청했을 때). 자세한 이벤트 타입은 [ShowAdMobInterstitialAdEvent](/react-native/reference/framework/광고/ShowAdMobInterstitialAdEvent.html)를 참고하세요.
|
|
499
|
-
* @param {(reason: unknown) => void} [params.onError] 광고를 노출하지 못했을 때 호출돼요. (예시: 네트워크 오류나 지원하지 않는 환경일 때)
|
|
500
|
-
* @property {() => boolean} [isSupported] 현재 실행 중인 앱(예: 토스 앱, 개발용 샌드박스 앱 등)에서 Google AdMob 광고 기능을 지원하는지 확인하는 함수예요. 기능을 사용하기 전에 지원 여부를 확인해야 해요.
|
|
501
|
-
*
|
|
502
|
-
* @example
|
|
503
|
-
* ### 버튼 눌러 불러온 전면 광고 보여주기
|
|
504
|
-
* ```tsx
|
|
505
|
-
* import { GoogleAdMob } from '@apps-in-toss/framework';
|
|
506
|
-
* import { useFocusEffect } from '@react-native-bedrock/native/@react-navigation/native';
|
|
507
|
-
* import { useCallback, useState } from 'react';
|
|
508
|
-
* import { Button, Text, View } from 'react-native';
|
|
509
|
-
* import { useNavigation } from 'react-native-bedrock';
|
|
510
|
-
*
|
|
511
|
-
* const AD_UNIT_ID = '<AD_UNIT_ID>';
|
|
512
|
-
*
|
|
513
|
-
* export function GoogleAdmobInterstitialAdExample() {
|
|
514
|
-
* const [adLoadStatus, setAdLoadStatus] = useState<'not_loaded' | 'loaded' | 'failed'>('not_loaded');
|
|
515
|
-
* const navigation = useNavigation();
|
|
516
|
-
*
|
|
517
|
-
* const loadAd = useCallback(() => {
|
|
518
|
-
* if (GoogleAdMob.loadAdMobInterstitialAd.isSupported() !== true) {
|
|
519
|
-
* return;
|
|
520
|
-
* }
|
|
521
|
-
|
|
522
|
-
* const cleanup = GoogleAdMob.loadAdMobInterstitialAd({
|
|
523
|
-
* options: {
|
|
524
|
-
* adUnitId: AD_UNIT_ID,
|
|
525
|
-
* },
|
|
526
|
-
* onEvent: (event) => {
|
|
527
|
-
* switch (event.type) {
|
|
528
|
-
* case 'loaded':
|
|
529
|
-
* console.log('광고 로드 성공', event.data);
|
|
530
|
-
* setAdLoadStatus('loaded');
|
|
531
|
-
* break;
|
|
532
|
-
*
|
|
533
|
-
* case 'clicked':
|
|
534
|
-
* console.log('광고 클릭');
|
|
535
|
-
* break;
|
|
536
|
-
*
|
|
537
|
-
* case 'dismissed':
|
|
538
|
-
* console.log('광고 닫힘');
|
|
539
|
-
* navigation.navigate('/examples/google-admob-interstitial-ad-landing');
|
|
540
|
-
* break;
|
|
541
|
-
*
|
|
542
|
-
* case 'failedToShow':
|
|
543
|
-
* console.log('광고 보여주기 실패');
|
|
544
|
-
* break;
|
|
545
|
-
*
|
|
546
|
-
* case 'impression':
|
|
547
|
-
* console.log('광고 노출');
|
|
548
|
-
* break;
|
|
549
|
-
*
|
|
550
|
-
* case 'show':
|
|
551
|
-
* console.log('광고 컨텐츠 보여졌음');
|
|
552
|
-
* break;
|
|
553
|
-
* }
|
|
554
|
-
* },
|
|
555
|
-
* onError: (error) => {
|
|
556
|
-
* console.error('광고 불러오기 실패', error);
|
|
557
|
-
* },
|
|
558
|
-
* });
|
|
559
|
-
*
|
|
560
|
-
* return cleanup;
|
|
561
|
-
* }, [navigation]);
|
|
562
|
-
*
|
|
563
|
-
* const showAd = useCallback(() => {
|
|
564
|
-
* if (GoogleAdMob.showAdMobInterstitialAd.isSupported() !== true) {
|
|
565
|
-
* return;
|
|
566
|
-
* }
|
|
567
|
-
*
|
|
568
|
-
* GoogleAdMob.showAdMobInterstitialAd({
|
|
569
|
-
* options: {
|
|
570
|
-
* adUnitId: AD_UNIT_ID,
|
|
571
|
-
* },
|
|
572
|
-
* onEvent: (event) => {
|
|
573
|
-
* switch (event.type) {
|
|
574
|
-
* case 'requested':
|
|
575
|
-
* console.log('광고 보여주기 요청 완료');
|
|
576
|
-
* break;
|
|
577
|
-
* }
|
|
578
|
-
* },
|
|
579
|
-
* onError: (error) => {
|
|
580
|
-
* console.error('광고 보여주기 실패', error);
|
|
581
|
-
* },
|
|
582
|
-
* });
|
|
583
|
-
* }, []);
|
|
584
|
-
*
|
|
585
|
-
* useFocusEffect(loadAd);
|
|
586
|
-
*
|
|
587
|
-
* return (
|
|
588
|
-
* <View>
|
|
589
|
-
* <Text>
|
|
590
|
-
* {adLoadStatus === 'not_loaded' && '광고 로드 하지 않음 '}
|
|
591
|
-
* {adLoadStatus === 'loaded' && '광고 로드 완료'}
|
|
592
|
-
* {adLoadStatus === 'failed' && '광고 로드 실패'}
|
|
593
|
-
* </Text>
|
|
594
|
-
*
|
|
595
|
-
* <Button title="Show Ad" onPress={showAd} disabled={adLoadStatus !== 'loaded'} />
|
|
596
|
-
* </View>
|
|
597
|
-
* );
|
|
598
|
-
* }
|
|
599
|
-
* ```
|
|
600
|
-
*/
|
|
601
|
-
declare function showAdMobInterstitialAd(params: ShowAdMobInterstitialAdParams): () => void;
|
|
602
|
-
declare namespace showAdMobInterstitialAd {
|
|
603
|
-
var isSupported: () => boolean;
|
|
604
|
-
}
|
|
605
|
-
interface LoadAdMobRewardedAdOptions {
|
|
606
|
-
/**
|
|
607
|
-
* 광고 단위 ID
|
|
608
|
-
*/
|
|
609
|
-
adUnitId: string;
|
|
610
|
-
}
|
|
611
|
-
/**
|
|
612
|
-
* @public
|
|
613
|
-
* @category 광고
|
|
614
|
-
* @name LoadAdMobRewardedAdEvent
|
|
615
|
-
* @description 보상형 광고를 불러오는 함수에서 발생하는 이벤트 타입이에요. `loaded` 이벤트가 발생하면 광고를 성공적으로 불러온 거예요. 이때 [RewardedAd](/react-native/reference/framework/광고/RewardedAd.html) 객체가 함께 반환돼요. `userEarnedReward` 이벤트는 사용자가 광고를 끝까지 시청해, 보상 조건을 충족했을 때 발생해요.
|
|
616
|
-
*/
|
|
617
|
-
type LoadAdMobRewardedAdEvent = AdMobFullScreenEvent | {
|
|
618
|
-
type: 'loaded';
|
|
619
|
-
data: RewardedAd;
|
|
620
|
-
} | {
|
|
621
|
-
type: 'userEarnedReward';
|
|
622
|
-
};
|
|
623
|
-
/**
|
|
624
|
-
* @public
|
|
625
|
-
* @category 광고
|
|
626
|
-
* @name LoadAdMobRewardedAdParams
|
|
627
|
-
* @description 보상형 광고를 불러오는 함수에 필요한 옵션 객체예요.
|
|
628
|
-
*/
|
|
629
|
-
type LoadAdMobRewardedAdParams = AdMobHandlerParams<LoadAdMobRewardedAdOptions, LoadAdMobRewardedAdEvent>;
|
|
630
|
-
/**
|
|
631
|
-
* @public
|
|
632
|
-
* @category 광고
|
|
633
|
-
* @name loadAdMobRewardedAd
|
|
634
|
-
* @description 사용자가 광고를 끝까지 시청하면 리워드를 제공할 수 있는 보상형 광고를 미리 불러와서, 광고가 필요한 시점에 바로 보여줄 수 있도록 준비하는 함수예요.
|
|
635
|
-
* @param {LoadAdMobRewardedAdParams} params 광고를 불러올 때 사용할 설정 값이에요. 광고 ID와 광고의 동작에 대한 콜백을 설정할 수 있어요.
|
|
636
|
-
* @param {LoadAdMobRewardedAdOptions} params.options 광고를 불러올 때 전달할 옵션 객체예요.
|
|
637
|
-
* @param {string} params.options.adUnitId 광고 단위 ID예요. 발급받은 보상형 광고용 ID를 입력해요.
|
|
638
|
-
* @param {(event: LoadAdMobRewardedAdEvent) => void} [params.onEvent] 광고 관련 이벤트가 발생했을 때 호출돼요. (예시: 광고가 닫히거나 클릭됐을 때). 자세한 이벤트 타입은 [LoadAdMobRewardedAdEvent](/react-native/reference/framework/광고/LoadAdMobRewardedAdEvent.html)를 참고하세요.
|
|
639
|
-
* @param {(reason: unknown) => void} [params.onError] 광고를 불러오지 못했을 때 호출돼요. (예시: 네트워크 오류나 지원하지 않는 환경일 때)
|
|
640
|
-
* @property {() => boolean} [isSupported] 현재 실행 중인 앱(예: 토스 앱, 개발용 샌드박스 앱 등)에서 Google AdMob 광고 기능을 지원하는지 확인하는 함수예요. 기능을 사용하기 전에 지원 여부를 확인해야 해요.
|
|
641
|
-
*
|
|
642
|
-
* @example
|
|
643
|
-
*
|
|
644
|
-
* ### 버튼 눌러 불러온 보상형 광고 보여주기
|
|
645
|
-
*
|
|
646
|
-
* ```tsx
|
|
647
|
-
* import { GoogleAdMob } from '@apps-in-toss/framework';
|
|
648
|
-
* import { useCallback, useState } from 'react';
|
|
649
|
-
* import { Button, Text, View } from 'react-native';
|
|
650
|
-
*
|
|
651
|
-
* const AD_UNIT_ID = '<AD_UNIT_ID>';
|
|
652
|
-
*
|
|
653
|
-
* export function GoogleAdmobRewardedAdExample() {
|
|
654
|
-
* const [adLoadStatus, setAdLoadStatus] = useState<'not_loaded' | 'loaded' | 'failed'>('not_loaded');
|
|
655
|
-
*
|
|
656
|
-
* const loadAd = useCallback(() => {
|
|
657
|
-
* if (GoogleAdMob.loadAdMobRewardedAd.isSupported() !== true) {
|
|
658
|
-
* return;
|
|
659
|
-
* }
|
|
660
|
-
*
|
|
661
|
-
* const cleanup = GoogleAdMob.loadAdMobRewardedAd({
|
|
662
|
-
* options: {
|
|
663
|
-
* adUnitId: AD_UNIT_ID,
|
|
664
|
-
* },
|
|
665
|
-
* onEvent: (event) => {
|
|
666
|
-
* console.log(event.type);
|
|
667
|
-
* switch (event.type) {
|
|
668
|
-
* case 'loaded':
|
|
669
|
-
* console.log('광고 로드 성공', event.data);
|
|
670
|
-
* setAdLoadStatus('loaded');
|
|
671
|
-
* break;
|
|
672
|
-
*
|
|
673
|
-
* case 'clicked':
|
|
674
|
-
* console.log('광고 클릭');
|
|
675
|
-
* break;
|
|
676
|
-
*
|
|
677
|
-
* case 'dismissed':
|
|
678
|
-
* console.log('광고 닫힘');
|
|
679
|
-
* break;
|
|
680
|
-
*
|
|
681
|
-
* case 'failedToShow':
|
|
682
|
-
* console.log('광고 보여주기 실패');
|
|
683
|
-
* break;
|
|
684
|
-
*
|
|
685
|
-
* case 'impression':
|
|
686
|
-
* console.log('광고 노출');
|
|
687
|
-
* break;
|
|
688
|
-
*
|
|
689
|
-
* case 'show':
|
|
690
|
-
* console.log('광고 컨텐츠 보여졌음');
|
|
691
|
-
* break;
|
|
692
|
-
*
|
|
693
|
-
* case 'userEarnedReward':
|
|
694
|
-
* console.log('사용자가 광고 시청을 완료했음');
|
|
695
|
-
* break;
|
|
696
|
-
* }
|
|
697
|
-
* },
|
|
698
|
-
* onError: (error) => {
|
|
699
|
-
* console.error('광고 불러오기 실패', error);
|
|
700
|
-
* },
|
|
701
|
-
* });
|
|
702
|
-
*
|
|
703
|
-
* return cleanup;
|
|
704
|
-
* }, []);
|
|
705
|
-
*
|
|
706
|
-
* const showAd = useCallback(() => {
|
|
707
|
-
* if (GoogleAdMob.showAdMobRewardedAd.isSupported() !== true) {
|
|
708
|
-
* return;
|
|
709
|
-
* }
|
|
710
|
-
*
|
|
711
|
-
* GoogleAdMob.showAdMobRewardedAd({
|
|
712
|
-
* options: {
|
|
713
|
-
* adUnitId: AD_UNIT_ID,
|
|
714
|
-
* },
|
|
715
|
-
* onEvent: (event) => {
|
|
716
|
-
* switch (event.type) {
|
|
717
|
-
* case 'requested':
|
|
718
|
-
* console.log('광고 보여주기 요청 완료');
|
|
719
|
-
* setAdLoadStatus('not_loaded');
|
|
720
|
-
* break;
|
|
721
|
-
* }
|
|
722
|
-
* },
|
|
723
|
-
* onError: (error) => {
|
|
724
|
-
* console.error('광고 보여주기 실패', error);
|
|
725
|
-
* },
|
|
726
|
-
* });
|
|
727
|
-
* }, []);
|
|
728
|
-
*
|
|
729
|
-
* return (
|
|
730
|
-
* <View>
|
|
731
|
-
* <Text>
|
|
732
|
-
* {adLoadStatus === 'not_loaded' && '광고 로드 하지 않음 '}
|
|
733
|
-
* {adLoadStatus === 'loaded' && '광고 로드 완료'}
|
|
734
|
-
* {adLoadStatus === 'failed' && '광고 로드 실패'}
|
|
735
|
-
* </Text>
|
|
736
|
-
*
|
|
737
|
-
* <Button title="Load Ad" onPress={loadAd} />
|
|
738
|
-
* <Button title="Show Ad" onPress={showAd} disabled={adLoadStatus !== 'loaded'} />
|
|
739
|
-
* </View>
|
|
740
|
-
* );
|
|
741
|
-
* }
|
|
742
|
-
* ```
|
|
743
|
-
*/
|
|
744
|
-
declare function loadAdMobRewardedAd(params: LoadAdMobRewardedAdParams): () => void;
|
|
745
|
-
declare namespace loadAdMobRewardedAd {
|
|
746
|
-
var isSupported: () => boolean;
|
|
747
|
-
}
|
|
748
|
-
interface ShowAdMobRewardedAdOptions {
|
|
749
|
-
/**
|
|
750
|
-
* 광고 단위 ID
|
|
751
|
-
*/
|
|
752
|
-
adUnitId: string;
|
|
753
|
-
}
|
|
754
|
-
/**
|
|
755
|
-
* @public
|
|
756
|
-
* @category 광고
|
|
757
|
-
* @name ShowAdMobRewardedAdEvent
|
|
758
|
-
* @description 보상형 광고를 보여주는 함수에서 발생하는 이벤트 타입이에요. `requested` 이벤트가 발생하면 광고 노출 요청이 Google AdMob에 성공적으로 전달된 거예요.
|
|
759
|
-
*/
|
|
760
|
-
type ShowAdMobRewardedAdEvent = {
|
|
761
|
-
type: 'requested';
|
|
762
|
-
};
|
|
763
|
-
/**
|
|
764
|
-
* @public
|
|
765
|
-
* @category 광고
|
|
766
|
-
* @name ShowAdMobRewardedAdParams
|
|
767
|
-
* @description 불러온 보상형 광고를 보여주는 함수에 필요한 옵션 객체예요.
|
|
768
|
-
*/
|
|
769
|
-
type ShowAdMobRewardedAdParams = AdMobHandlerParams<ShowAdMobRewardedAdOptions, ShowAdMobRewardedAdEvent>;
|
|
770
|
-
/**
|
|
771
|
-
* @public
|
|
772
|
-
* @category 광고
|
|
773
|
-
* @name showAdMobRewardedAd
|
|
774
|
-
* @description 사용자가 광고를 끝까지 보면 리워드를 받을 수 있도록, 보상형 광고를 화면에 보여줘요. 이 함수는 `loadAdMobRewardedAd` 로 미리 불러온 광고를 실제로 사용자에게 노출해요.
|
|
775
|
-
* @param {ShowAdMobRewardedAdParams} params 광고를 보여주기 위해 사용할 설정 값이에요. 광고 ID와 광고의 동작에 대한 콜백을 설정할 수 있어요.
|
|
776
|
-
* @param {ShowAdMobRewardedAdOptions} params.options 광고를 보여줄 때 전달할 옵션 객체예요.
|
|
777
|
-
* @param {string} params.options.adUnitId 광고 단위 ID예요. `loadAdMobRewardedAd` 로 불러온 보상형 광고용 ID를 입력해요.
|
|
778
|
-
* @param {(event: ShowAdMobRewardedAdEvent) => void} [params.onEvent] 광고 관련 이벤트가 발생했을 때 호출돼요. (예시: 광고 노출을 요청했을 때). 자세한 이벤트 타입은 [ShowAdMobRewardedAdEvent](/react-native/reference/framework/광고/ShowAdMobRewardedAdEvent.html)를 참고하세요.
|
|
779
|
-
* @param {(reason: unknown) => void} [params.onError] 광고를 불러오지 못했을 때 호출돼요. (예시: 네트워크 오류나 지원하지 않는 환경일 때)
|
|
780
|
-
* @property {() => boolean} [isSupported] 현재 실행 중인 앱(예: 토스 앱, 개발용 샌드박스 앱 등)에서 Google AdMob 광고 기능을 지원하는지 확인하는 함수예요. 기능을 사용하기 전에 지원 여부를 확인해야 해요.
|
|
781
|
-
*
|
|
782
|
-
* @example
|
|
783
|
-
* ### 버튼 눌러 불러온 보상형 광고 보여주기
|
|
784
|
-
*
|
|
785
|
-
* ```tsx
|
|
786
|
-
* import { GoogleAdMob } from '@apps-in-toss/framework';
|
|
787
|
-
* import { useCallback, useState } from 'react';
|
|
788
|
-
* import { Button, Text, View } from 'react-native';
|
|
789
|
-
*
|
|
790
|
-
* const AD_UNIT_ID = '<AD_UNIT_ID>';
|
|
791
|
-
*
|
|
792
|
-
* export function GoogleAdmobRewardedAdExample() {
|
|
793
|
-
* const [adLoadStatus, setAdLoadStatus] = useState<'not_loaded' | 'loaded' | 'failed'>('not_loaded');
|
|
794
|
-
*
|
|
795
|
-
* const loadAd = useCallback(() => {
|
|
796
|
-
* if (GoogleAdMob.loadAdMobRewardedAd.isSupported() !== true) {
|
|
797
|
-
* return;
|
|
798
|
-
* }
|
|
799
|
-
*
|
|
800
|
-
* const cleanup = GoogleAdMob.loadAdMobRewardedAd({
|
|
801
|
-
* options: {
|
|
802
|
-
* adUnitId: AD_UNIT_ID,
|
|
803
|
-
* },
|
|
804
|
-
* onEvent: (event) => {
|
|
805
|
-
* console.log(event.type);
|
|
806
|
-
* switch (event.type) {
|
|
807
|
-
* case 'loaded':
|
|
808
|
-
* console.log('광고 로드 성공', event.data);
|
|
809
|
-
* setAdLoadStatus('loaded');
|
|
810
|
-
* break;
|
|
811
|
-
*
|
|
812
|
-
* case 'clicked':
|
|
813
|
-
* console.log('광고 클릭');
|
|
814
|
-
* break;
|
|
815
|
-
*
|
|
816
|
-
* case 'dismissed':
|
|
817
|
-
* console.log('광고 닫힘');
|
|
818
|
-
* break;
|
|
819
|
-
*
|
|
820
|
-
* case 'failedToShow':
|
|
821
|
-
* console.log('광고 보여주기 실패');
|
|
822
|
-
* break;
|
|
823
|
-
*
|
|
824
|
-
* case 'impression':
|
|
825
|
-
* console.log('광고 노출');
|
|
826
|
-
* break;
|
|
827
|
-
*
|
|
828
|
-
* case 'show':
|
|
829
|
-
* console.log('광고 컨텐츠 보여졌음');
|
|
830
|
-
* break;
|
|
831
|
-
*
|
|
832
|
-
* case 'userEarnedReward':
|
|
833
|
-
* console.log('사용자가 광고 시청을 완료했음');
|
|
834
|
-
* break;
|
|
835
|
-
* }
|
|
836
|
-
* },
|
|
837
|
-
* onError: (error) => {
|
|
838
|
-
* console.error('광고 불러오기 실패', error);
|
|
839
|
-
* },
|
|
840
|
-
* });
|
|
841
|
-
*
|
|
842
|
-
* return cleanup;
|
|
843
|
-
* }, []);
|
|
844
|
-
*
|
|
845
|
-
* const showAd = useCallback(() => {
|
|
846
|
-
* if (GoogleAdMob.showAdMobRewardedAd.isSupported() !== true) {
|
|
847
|
-
* return;
|
|
848
|
-
* }
|
|
849
|
-
*
|
|
850
|
-
* GoogleAdMob.showAdMobRewardedAd({
|
|
851
|
-
* options: {
|
|
852
|
-
* adUnitId: AD_UNIT_ID,
|
|
853
|
-
* },
|
|
854
|
-
* onEvent: (event) => {
|
|
855
|
-
* switch (event.type) {
|
|
856
|
-
* case 'requested':
|
|
857
|
-
* console.log('광고 보여주기 요청 완료');
|
|
858
|
-
* setAdLoadStatus('not_loaded');
|
|
859
|
-
* break;
|
|
860
|
-
* }
|
|
861
|
-
* },
|
|
862
|
-
* onError: (error) => {
|
|
863
|
-
* console.error('광고 보여주기 실패', error);
|
|
864
|
-
* },
|
|
865
|
-
* });
|
|
866
|
-
* }, []);
|
|
867
|
-
*
|
|
868
|
-
* return (
|
|
869
|
-
* <View>
|
|
870
|
-
* <Text>
|
|
871
|
-
* {adLoadStatus === 'not_loaded' && '광고 로드 하지 않음 '}
|
|
872
|
-
* {adLoadStatus === 'loaded' && '광고 로드 완료'}
|
|
873
|
-
* {adLoadStatus === 'failed' && '광고 로드 실패'}
|
|
874
|
-
* </Text>
|
|
875
|
-
*
|
|
876
|
-
* <Button title="Load Ad" onPress={loadAd} />
|
|
877
|
-
* <Button title="Show Ad" onPress={showAd} disabled={adLoadStatus !== 'loaded'} />
|
|
878
|
-
* </View>
|
|
879
|
-
* );
|
|
880
|
-
* }
|
|
881
|
-
* ```
|
|
882
|
-
*/
|
|
883
|
-
declare function showAdMobRewardedAd(params: ShowAdMobRewardedAdParams): () => void;
|
|
884
|
-
declare namespace showAdMobRewardedAd {
|
|
885
|
-
var isSupported: () => boolean;
|
|
886
|
-
}
|
|
887
|
-
|
|
888
|
-
/**
|
|
889
|
-
* @public
|
|
890
|
-
* @category 토스페이
|
|
891
|
-
* @name CheckoutPaymentOptions
|
|
892
|
-
* @description 토스페이 결제창을 띄울 때 필요한 옵션이에요.
|
|
893
|
-
* @property {string} payToken 결제 토큰이에요.
|
|
894
|
-
*/
|
|
895
|
-
interface CheckoutPaymentOptions {
|
|
896
|
-
/**
|
|
897
|
-
* 결제 토큰이에요.
|
|
898
|
-
*/
|
|
899
|
-
payToken: string;
|
|
900
|
-
}
|
|
901
|
-
/**
|
|
902
|
-
* @public
|
|
903
|
-
* @category 토스페이
|
|
904
|
-
* @name CheckoutPaymentResult
|
|
905
|
-
* @description 토스페이 결제창에서 사용자가 인증에 성공했는지 여부예요.
|
|
906
|
-
* @property {boolean} success 인증이 성공했는지 여부예요.
|
|
907
|
-
* @property {string} [reason] 인증이 실패했을 경우의 이유예요.
|
|
908
|
-
*/
|
|
909
|
-
interface CheckoutPaymentResult {
|
|
910
|
-
/**
|
|
911
|
-
* 인증이 성공했는지 여부예요.
|
|
912
|
-
*/
|
|
913
|
-
success: boolean;
|
|
914
|
-
/**
|
|
915
|
-
* 인증이 실패했을 경우의 이유예요.
|
|
916
|
-
*/
|
|
917
|
-
reason?: string;
|
|
918
|
-
}
|
|
919
|
-
/**
|
|
920
|
-
* @public
|
|
921
|
-
* @category 토스페이
|
|
922
|
-
* @name checkoutPayment
|
|
923
|
-
* @description 토스페이 결제창을 띄우고, 사용자 인증을 수행해요. 인증이 완료되면 성공 여부를 반환해요.
|
|
924
|
-
*
|
|
925
|
-
* 이 함수는 결제창을 통해 사용자 인증만 해요. 실제 결제 처리는 인증 성공 후 서버에서 별도로 해야 해요.
|
|
926
|
-
*
|
|
927
|
-
* @param {CheckoutPaymentOptions} options 결제창을 띄울 때 필요한 옵션이에요.
|
|
928
|
-
* @returns {Promise<CheckoutPaymentResult>} 인증 성공 여부를 포함한 결과를 반환해요.
|
|
929
|
-
*
|
|
930
|
-
* @example
|
|
931
|
-
*
|
|
932
|
-
* ### 토스페이 결제창 띄우고 인증 처리하기
|
|
933
|
-
*
|
|
934
|
-
* ```tsx
|
|
935
|
-
* import { TossPay } from '@apps-in-toss/framework';
|
|
936
|
-
*
|
|
937
|
-
* async function handlePayment() {
|
|
938
|
-
* try {
|
|
939
|
-
* // 실제 구현 시 결제 생성 역할을 하는 API 엔드포인트로 대체해주세요.
|
|
940
|
-
* const { payToken } = await fetch('/my-api/payment/create').then(res => res.json());
|
|
941
|
-
*
|
|
942
|
-
* const { success, reason } = await TossPay.checkoutPayment({ payToken });
|
|
943
|
-
*
|
|
944
|
-
* if (success) {
|
|
945
|
-
* // 실제 구현 시 결제를 실행하는 API 엔드포인트로 대체해주세요.
|
|
946
|
-
* await fetch('/my-api/payment/execute', {
|
|
947
|
-
* method: 'POST',
|
|
948
|
-
* body: JSON.stringify({ payToken }),
|
|
949
|
-
* headers: { 'Content-Type': 'application/json' },
|
|
950
|
-
* });
|
|
951
|
-
* } else {
|
|
952
|
-
* console.log('인증 실패:', reason);
|
|
953
|
-
* }
|
|
954
|
-
* } catch (error) {
|
|
955
|
-
* console.error('결제 인증 중 오류가 발생했어요:', error);
|
|
956
|
-
* }
|
|
957
|
-
* }
|
|
958
|
-
* ```
|
|
959
|
-
*/
|
|
960
|
-
declare function checkoutPayment(options: CheckoutPaymentOptions): Promise<CheckoutPaymentResult>;
|
|
961
|
-
|
|
962
|
-
/**
|
|
963
|
-
* @public
|
|
964
|
-
* @category 로그인
|
|
965
|
-
* @name appLogin
|
|
966
|
-
* @description 토스 인증으로 로그인해요. 로그인이 완료되면 다시 토스 앱으로 이동해요.
|
|
967
|
-
* @example
|
|
968
|
-
*
|
|
969
|
-
* ### 토스 인증을 통해 로그인을 하는 예제
|
|
970
|
-
*
|
|
971
|
-
* ```tsx
|
|
972
|
-
* import { Button } from 'react-native';
|
|
973
|
-
* import { appLogin } from '@apps-in-toss/framework';
|
|
974
|
-
*
|
|
975
|
-
* function Page() {
|
|
976
|
-
* const handleLogin = async () => {
|
|
977
|
-
* const { authorizationCode, referrer } = await appLogin();
|
|
978
|
-
*
|
|
979
|
-
* // 획득한 인가 코드(`authorizationCode`)와 `referrer`를 서버로 전달해요.
|
|
980
|
-
* }
|
|
981
|
-
*
|
|
982
|
-
* return <Button title="로그인" onPress={handleLogin} />;
|
|
983
|
-
* }
|
|
984
|
-
* ```
|
|
985
|
-
*/
|
|
986
|
-
declare function appLogin(): Promise<{
|
|
987
|
-
authorizationCode: string;
|
|
988
|
-
referrer: "DEFAULT" | "SANDBOX";
|
|
989
|
-
}>;
|
|
990
|
-
|
|
991
|
-
type Primitive = string | number | boolean | null | undefined | symbol;
|
|
992
|
-
|
|
993
|
-
interface EventLogParams {
|
|
994
|
-
log_name: string;
|
|
995
|
-
log_type: 'debug' | 'info' | 'warn' | 'error' | 'screen' | 'impression' | 'click';
|
|
996
|
-
params: Record<string, Primitive>;
|
|
997
|
-
}
|
|
998
|
-
/**
|
|
999
|
-
* @category 로깅
|
|
1000
|
-
* @kind function
|
|
1001
|
-
* @name eventLog
|
|
1002
|
-
* @description
|
|
1003
|
-
* 이벤트 로그를 기록하는 함수예요.
|
|
1004
|
-
*
|
|
1005
|
-
* 이 함수는 앱 내에서 발생하는 다양한 이벤트를 로깅하는 데 사용돼요. 디버깅, 정보 제공, 경고, 오류 등 다양한 유형의 로그를 기록할 수 있어요. 샌드박스 환경에서는 콘솔에 로그가 출력되고, 실제 환경에서는 로그 시스템에 기록돼요.
|
|
1006
|
-
*
|
|
1007
|
-
* @param {Object} params 로그 기록에 필요한 매개변수 객체예요.
|
|
1008
|
-
* @param {string} params.log_name 로그의 이름이에요.
|
|
1009
|
-
* @param {'debug' | 'info' | 'warn' | 'error' | 'screen' | 'impression' | 'click'} params.log_type 로그의 유형이에요.
|
|
1010
|
-
* @param {Record<string, Primitive>} params.params 로그에 포함할 추가 매개변수 객체예요.
|
|
1011
|
-
*
|
|
1012
|
-
* @returns {Promise<void>} 로그 기록이 완료되면 해결되는 Promise예요.
|
|
1013
|
-
*
|
|
1014
|
-
* @example
|
|
1015
|
-
* ### 이벤트 로그 기록하기
|
|
1016
|
-
*
|
|
1017
|
-
* ```tsx
|
|
1018
|
-
* import { eventLog } from '@apps-in-toss/framework';
|
|
1019
|
-
*
|
|
1020
|
-
* function logUserAction() {
|
|
1021
|
-
* eventLog({
|
|
1022
|
-
* log_name: 'user_action',
|
|
1023
|
-
* log_type: 'info',
|
|
1024
|
-
* params: {
|
|
1025
|
-
* action: 'button_click',
|
|
1026
|
-
* screen: 'main',
|
|
1027
|
-
* userId: 12345
|
|
1028
|
-
* }
|
|
1029
|
-
* });
|
|
1030
|
-
* }
|
|
1031
|
-
* ```
|
|
1032
|
-
*/
|
|
1033
|
-
declare function eventLog(params: EventLogParams): Promise<void>;
|
|
1034
|
-
|
|
1035
|
-
/**
|
|
1036
|
-
* 앨범 사진을 조회할 때 사용하는 옵션 타입이에요.
|
|
1037
|
-
*/
|
|
1038
|
-
interface FetchAlbumPhotosOptions {
|
|
1039
|
-
/** 가져올 사진의 최대 개수를 설정해요. 숫자를 입력하고 기본값은 10이에요. */
|
|
1040
|
-
maxCount?: number;
|
|
1041
|
-
/** 사진의 최대 폭을 제한해요. 단위는 픽셀이고 기본값은 1024이에요. */
|
|
1042
|
-
maxWidth?: number;
|
|
1043
|
-
/** 이미지를 base64 형식으로 반환할지 설정해요. 기본값은 `false`예요. */
|
|
1044
|
-
base64?: boolean;
|
|
1045
|
-
}
|
|
1046
|
-
/**
|
|
1047
|
-
* @public
|
|
1048
|
-
* @category 사진
|
|
1049
|
-
* @name fetchAlbumPhotos
|
|
1050
|
-
* @description
|
|
1051
|
-
* 사용자의 앨범에서 사진 목록을 불러오는 함수예요.
|
|
1052
|
-
* 최대 개수와 해상도를 설정할 수 있고 갤러리 미리보기, 이미지 선택 기능 등에 활용할 수 있어요.
|
|
1053
|
-
*
|
|
1054
|
-
* @param options - 조회 옵션을 담은 객체예요.
|
|
1055
|
-
* @param {number} [options.maxCount=10] 가져올 사진의 최대 개수를 설정해요. 숫자로 입력하며 기본값은 10이에요.
|
|
1056
|
-
* @param {number} [options.maxWidth=1024] 사진의 최대 폭을 제한해요. 단위는 픽셀이며 기본값은 `1024`이에요.
|
|
1057
|
-
* @param {boolean} [options.base64=false] 이미지를 base64 형식으로 반환할지 설정해요. 기본값은 `false`예요.
|
|
1058
|
-
* @returns {Promise<ImageResponse[]>}
|
|
1059
|
-
* 앨범 사진의 고유 ID와 데이터 URI를 포함한 배열을 반환해요.
|
|
1060
|
-
*
|
|
1061
|
-
* @example
|
|
1062
|
-
* ### 사진의 최대 폭을 360px로 제한하여 가져오기
|
|
1063
|
-
*
|
|
1064
|
-
* ```tsx
|
|
1065
|
-
* import React, { useState } from 'react';
|
|
1066
|
-
* import { View, Image, Button } from 'react-native';
|
|
1067
|
-
* import { fetchAlbumPhotos } from '@apps-in-toss/framework';
|
|
1068
|
-
*
|
|
1069
|
-
* const base64 = true;
|
|
1070
|
-
*
|
|
1071
|
-
* // 앨범 사진 목록을 가져와 화면에 표시하는 컴포넌트
|
|
1072
|
-
* function AlbumPhotoList() {
|
|
1073
|
-
* const [albumPhotos, setAlbumPhotos] = useState([]);
|
|
1074
|
-
*
|
|
1075
|
-
* const handlePress = async () => {
|
|
1076
|
-
* try {
|
|
1077
|
-
* const response = await fetchAlbumPhotos({
|
|
1078
|
-
* base64,
|
|
1079
|
-
* maxWidth: 360,
|
|
1080
|
-
* });
|
|
1081
|
-
* setAlbumPhotos((prev) => ([...prev, ...response]));
|
|
1082
|
-
* } catch (error) {
|
|
1083
|
-
* console.error('앨범을 가져오는 데 실패했어요:', error);
|
|
1084
|
-
* }
|
|
1085
|
-
* };
|
|
1086
|
-
*
|
|
1087
|
-
* return (
|
|
1088
|
-
* <View>
|
|
1089
|
-
* {albumPhotos.map((image) => {
|
|
1090
|
-
* // base64 형식으로 반환된 이미지를 표시하려면 데이터 URL 스키마 Prefix를 붙여야해요.
|
|
1091
|
-
* const imageUri = base64 ? 'data:image/jpeg;base64,' + image.dataUri : image.dataUri;
|
|
1092
|
-
*
|
|
1093
|
-
* return <Image source={{ uri: imageUri }} key={image.id} />;
|
|
1094
|
-
* })}
|
|
1095
|
-
* <Button title="앨범 가져오기" onPress={handlePress} />
|
|
1096
|
-
* </View>
|
|
1097
|
-
* );
|
|
1098
|
-
* }
|
|
1099
|
-
* ```
|
|
1100
|
-
*/
|
|
1101
|
-
declare function fetchAlbumPhotos(options: FetchAlbumPhotosOptions): Promise<ImageResponse[]>;
|
|
1102
|
-
|
|
1103
|
-
/**
|
|
1104
|
-
* 연락처 정보를 나타내는 타입이에요.
|
|
1105
|
-
*/
|
|
1106
|
-
interface ContactEntity {
|
|
1107
|
-
/** 연락처 이름이에요. */
|
|
1108
|
-
name: string;
|
|
1109
|
-
/** 연락처 전화번호로, 문자열 형식이에요. */
|
|
1110
|
-
phoneNumber: string;
|
|
1111
|
-
}
|
|
1112
|
-
/**
|
|
1113
|
-
* @public
|
|
1114
|
-
* @category 연락처
|
|
1115
|
-
* @name fetchContacts
|
|
1116
|
-
* @description 사용자의 연락처 목록을 페이지 단위로 가져오는 함수예요.
|
|
1117
|
-
* @param size - 한 번에 가져올 연락처 개수예요. 예를 들어, 10을 전달하면 최대 10개의 연락처를 가져와요.
|
|
1118
|
-
* @param offset - 가져올 연락처의 시작 지점이에요. 처음 호출할 때는 `0`을 전달해야 해요. 이후에는 이전 호출에서 반환된 `nextOffset` 값을 사용해요.
|
|
1119
|
-
* @param query - 추가적인 필터링 옵션이에요.
|
|
1120
|
-
* @param query.contains - 이름에 특정 문자열이 포함된 연락처만 가져오고 싶을 때 사용해요. 이 값을 전달하지 않으면 모든 연락처를 가져와요.
|
|
1121
|
-
* @returns {Promise<{result: { name: string; phoneNumber: string }[]; nextOffset: number | null; done: boolean}>}
|
|
1122
|
-
* 연락처 목록과 페이지네이션 정보를 포함한 객체를 반환해요.
|
|
1123
|
-
* - `result`: 가져온 연락처 목록이에요.
|
|
1124
|
-
* - `nextOffset`: 다음 호출에 사용할 오프셋 값이에요. 더 가져올 연락처가 없으면 `null`이에요.
|
|
1125
|
-
* - `done`: 모든 연락처를 다 가져왔는지 여부를 나타내요. 모두 가져왔다면 `true`예요.
|
|
1126
|
-
*
|
|
1127
|
-
* @signature
|
|
1128
|
-
* ```typescript
|
|
1129
|
-
* function fetchContacts({ size, offset, query }: {
|
|
1130
|
-
* size: number;
|
|
1131
|
-
* offset: number;
|
|
1132
|
-
* query?: {
|
|
1133
|
-
* contains?: string;
|
|
1134
|
-
* };
|
|
1135
|
-
* }): Promise<{
|
|
1136
|
-
* result: ContactEntity[];
|
|
1137
|
-
* nextOffset: number | null;
|
|
1138
|
-
* done: boolean;
|
|
1139
|
-
* }>;
|
|
1140
|
-
* ```
|
|
1141
|
-
*
|
|
1142
|
-
* @example
|
|
1143
|
-
* ### 특정 문자열이 포함된 연락처 목록 가져오기
|
|
1144
|
-
*
|
|
1145
|
-
* ```tsx
|
|
1146
|
-
* import React, { useState } from 'react';
|
|
1147
|
-
* import { View, Text, Button } from 'react-native';
|
|
1148
|
-
* import { fetchContacts, ContactEntity } from '@apps-in-toss/framework';
|
|
1149
|
-
*
|
|
1150
|
-
* // 특정 문자열을 포함한 연락처 목록을 가져와 화면에 표시하는 컴포넌트
|
|
1151
|
-
* function ContactsList() {
|
|
1152
|
-
* const [contacts, setContacts] = useState<{
|
|
1153
|
-
* result: ContactEntity[];
|
|
1154
|
-
* nextOffset: number | null;
|
|
1155
|
-
* done: boolean;
|
|
1156
|
-
* }>({
|
|
1157
|
-
* result: [],
|
|
1158
|
-
* nextOffset: null,
|
|
1159
|
-
* done: false,
|
|
1160
|
-
* });
|
|
1161
|
-
*
|
|
1162
|
-
* const handlePress = async () => {
|
|
1163
|
-
* try {
|
|
1164
|
-
* if (contacts.done) {
|
|
1165
|
-
* console.log('모든 연락처를 가져왔어요.');
|
|
1166
|
-
* return;
|
|
1167
|
-
* }
|
|
1168
|
-
*
|
|
1169
|
-
* const response = await fetchContacts({
|
|
1170
|
-
* size: 10,
|
|
1171
|
-
* offset: contacts.nextOffset ?? 0,
|
|
1172
|
-
* query: { contains: '김' },
|
|
1173
|
-
* });
|
|
1174
|
-
* setContacts((prev) => ({
|
|
1175
|
-
* result: [...prev.result, ...response.result],
|
|
1176
|
-
* nextOffset: response.nextOffset,
|
|
1177
|
-
* done: response.done,
|
|
1178
|
-
* }));
|
|
1179
|
-
* } catch (error) {
|
|
1180
|
-
* console.error('연락처를 가져오는 데 실패했어요:', error);
|
|
1181
|
-
* }
|
|
1182
|
-
* };
|
|
1183
|
-
*
|
|
1184
|
-
* return (
|
|
1185
|
-
* <View>
|
|
1186
|
-
* {contacts.result.map((contact, index) => (
|
|
1187
|
-
* <Text key={index}>{contact.name}: {contact.phoneNumber}</Text>
|
|
1188
|
-
* ))}
|
|
1189
|
-
* <Button
|
|
1190
|
-
* title={contacts.done ? '모든 연락처를 가져왔어요.' : '다음 연락처 가져오기'}
|
|
1191
|
-
* disabled={contacts.done}
|
|
1192
|
-
* onPress={handlePress}
|
|
1193
|
-
* />
|
|
1194
|
-
* </View>
|
|
1195
|
-
* );
|
|
1196
|
-
* }
|
|
1197
|
-
* ```
|
|
1198
|
-
*/
|
|
1199
|
-
declare function fetchContacts({ size, offset, query, }: {
|
|
1200
|
-
size: number;
|
|
1201
|
-
offset: number;
|
|
1202
|
-
query?: {
|
|
1203
|
-
contains?: string;
|
|
1204
|
-
};
|
|
1205
|
-
}): Promise<{
|
|
1206
|
-
result: ContactEntity[];
|
|
1207
|
-
nextOffset: number | null;
|
|
1208
|
-
done: boolean;
|
|
1209
|
-
}>;
|
|
1210
|
-
|
|
1211
|
-
/**
|
|
1212
|
-
* @public
|
|
1213
|
-
* @category 클립보드
|
|
1214
|
-
* @name getClipboardText
|
|
1215
|
-
* @description 클립보드에 저장된 텍스트를 가져오는 함수예요. 복사된 텍스트를 읽어서 다른 작업에 활용할 수 있어요.
|
|
1216
|
-
* @returns {Promise<string>} - 클립보드에 저장된 텍스트를 반환해요. 클립보드에 텍스트가 없으면 빈 문자열을 반환해요.
|
|
1217
|
-
*
|
|
1218
|
-
* @example
|
|
1219
|
-
* ### 클립보드의 텍스트 가져오기
|
|
1220
|
-
*
|
|
1221
|
-
* ```tsx
|
|
1222
|
-
* import React, { useState } from 'react';
|
|
1223
|
-
* import { View, Text, Button } from 'react-native';
|
|
1224
|
-
* import { getClipboardText } from '@apps-in-toss/framework';
|
|
1225
|
-
*
|
|
1226
|
-
* // '붙여넣기' 버튼을 누르면 클립보드에 저장된 텍스트를 가져와 화면에 표시해요.
|
|
1227
|
-
* function PasteButton() {
|
|
1228
|
-
* const [text, setText] = useState('');
|
|
1229
|
-
*
|
|
1230
|
-
* const handlePress = async () => {
|
|
1231
|
-
* try {
|
|
1232
|
-
* const clipboardText = await getClipboardText();
|
|
1233
|
-
* setText(clipboardText || '클립보드에 텍스트가 없어요.');
|
|
1234
|
-
* } catch (error) {
|
|
1235
|
-
* console.error('클립보드에서 텍스트를 가져오지 못했어요:', error);
|
|
1236
|
-
* }
|
|
1237
|
-
* };
|
|
1238
|
-
*
|
|
1239
|
-
* return (
|
|
1240
|
-
* <View>
|
|
1241
|
-
* <Text>{text}</Text>
|
|
1242
|
-
* <Button title="붙여넣기" onPress={handlePress} />
|
|
1243
|
-
* </View>
|
|
1244
|
-
* );
|
|
1245
|
-
* }
|
|
1246
|
-
* ```
|
|
1247
|
-
*/
|
|
1248
|
-
declare function getClipboardText(): Promise<string>;
|
|
1249
|
-
|
|
1250
|
-
interface GetCurrentLocationOptions {
|
|
1251
|
-
/**
|
|
1252
|
-
* 위치 정보를 가져올 정확도 수준이에요.
|
|
1253
|
-
*/
|
|
1254
|
-
accuracy: Accuracy;
|
|
1255
|
-
}
|
|
1256
|
-
/**
|
|
1257
|
-
* @public
|
|
1258
|
-
* @category 위치 정보
|
|
1259
|
-
* @name getCurrentLocation
|
|
1260
|
-
* @description 디바이스의 현재 위치 정보를 가져오는 함수예요.
|
|
1261
|
-
* 위치 기반 서비스를 구현할 때 사용되고, 한 번만 호출되어 현재 위치를 즉시 반환해요.
|
|
1262
|
-
* 예를 들어 지도 앱에서 사용자의 현재 위치를 한 번만 가져올 때, 날씨 앱에서 사용자의 위치를 기반으로 기상 정보를 제공할 때, 매장 찾기 기능에서 사용자의 위치를 기준으로 가까운 매장을 검색할 때 사용하면 유용해요.
|
|
1263
|
-
*
|
|
1264
|
-
* @param {GetCurrentLocationOptions} options 위치 정보를 가져올 때 사용하는 옵션 객체예요.
|
|
1265
|
-
* @param {Accuracy} [options.accuracy] 위치 정보의 정확도 수준이에요. 정확도는 `Accuracy` 타입으로 설정돼요.
|
|
1266
|
-
* @returns {Promise<Location>} 디바이스의 위치 정보가 담긴 객체를 반환해요. 자세한 내용은 [Location](/react-native/reference/framework/Types/Location.html)을 참고해주세요.
|
|
1267
|
-
*
|
|
1268
|
-
* @example
|
|
1269
|
-
* ### 디바이스의 현재 위치 정보 가져오기
|
|
1270
|
-
*
|
|
1271
|
-
* ```tsx
|
|
1272
|
-
* import React, { useState } from 'react';
|
|
1273
|
-
* import { View, Text, Button } from 'react-native';
|
|
1274
|
-
* import { getCurrentLocation } from '@apps-in-toss/framework';
|
|
1275
|
-
*
|
|
1276
|
-
* // 현재 위치 정보를 가져와 화면에 표시하는 컴포넌트
|
|
1277
|
-
* function CurrentPosition() {
|
|
1278
|
-
* const [position, setPosition] = useState(null);
|
|
1279
|
-
*
|
|
1280
|
-
* const handlePress = async () => {
|
|
1281
|
-
* try {
|
|
1282
|
-
* const response = await getCurrentLocation({ accuracy: Accuracy.Balanced });
|
|
1283
|
-
* setPosition(response);
|
|
1284
|
-
* } catch (error) {
|
|
1285
|
-
* console.error('위치 정보를 가져오는 데 실패했어요:', error);
|
|
1286
|
-
* }
|
|
1287
|
-
* };
|
|
1288
|
-
*
|
|
1289
|
-
* return (
|
|
1290
|
-
* <View>
|
|
1291
|
-
* {position ? (
|
|
1292
|
-
* <Text>위치: {position.coords.latitude}, {position.coords.longitude}</Text>
|
|
1293
|
-
* ) : (
|
|
1294
|
-
* <Text>위치 정보를 아직 가져오지 않았어요</Text>
|
|
1295
|
-
* )}
|
|
1296
|
-
* <Button title="현재 위치 정보 가져오기" onPress={handlePress} />
|
|
1297
|
-
* </View>
|
|
1298
|
-
* );
|
|
1299
|
-
* }
|
|
1300
|
-
* ```
|
|
1301
|
-
*/
|
|
1302
|
-
declare function getCurrentLocation(options: GetCurrentLocationOptions): Promise<Location>;
|
|
1303
|
-
|
|
1304
|
-
/**
|
|
1305
|
-
* @public
|
|
1306
|
-
* @category 환경 확인
|
|
1307
|
-
* @kind function
|
|
1308
|
-
* @name getDeviceId
|
|
1309
|
-
* @description
|
|
1310
|
-
* 사용 중인 기기의 고유 식별자를 문자열로 반환해요.
|
|
1311
|
-
*
|
|
1312
|
-
* 이 함수는 현재 사용 중인 기기의 고유 식별자를 문자열로 반환해요. 기기별로 설정이나 데이터를 저장하거나 사용자의 기기를 식별해서 로그를 기록하고 분석하는 데 사용할 수 있어요. 같은 사용자의 여러 기기를 구분하는 데도 유용해요.
|
|
1313
|
-
*
|
|
1314
|
-
* @returns {string} 기기의 고유 식별자를 나타내는 문자열이에요.
|
|
1315
|
-
*
|
|
1316
|
-
* @example
|
|
1317
|
-
* ### 기기 고유 식별자 가져오기
|
|
1318
|
-
*
|
|
1319
|
-
* ```tsx
|
|
1320
|
-
* import { getDeviceId } from '@apps-in-toss/framework';
|
|
1321
|
-
* import { Text } from 'react-native';
|
|
1322
|
-
*
|
|
1323
|
-
* function MyPage() {
|
|
1324
|
-
* const id = getDeviceId();
|
|
1325
|
-
*
|
|
1326
|
-
* return (
|
|
1327
|
-
* <Text>사용자의 기기 고유 식별자: {id}</Text>
|
|
1328
|
-
* );
|
|
1329
|
-
* }
|
|
1330
|
-
* ```
|
|
1331
|
-
*/
|
|
1332
|
-
declare function getDeviceId(): string;
|
|
1333
|
-
|
|
1334
|
-
/**
|
|
1335
|
-
* @public
|
|
1336
|
-
* @category 환경 확인
|
|
1337
|
-
* @kind function
|
|
1338
|
-
* @name getOperationalEnvironment
|
|
1339
|
-
* @description
|
|
1340
|
-
* 현재 실행 중인 앱의 운영 환경을 확인해요.
|
|
1341
|
-
* 토스 앱에서 실행 중이라면 `'toss'`, 샌드박스 환경에서 실행 중이라면 `'sandbox'`를 반환해요.
|
|
1342
|
-
*
|
|
1343
|
-
* 운영 환경은 앱이 실행되는 컨텍스트를 의미하며, 특정 기능의 사용 가능 여부를 판단하는 데 활용할 수 있어요.
|
|
1344
|
-
*
|
|
1345
|
-
* @returns {'toss' | 'sandbox'}
|
|
1346
|
-
* 현재 운영 환경을 나타내는 문자열이에요.
|
|
1347
|
-
* - `'toss'`: 토스 앱에서 실행 중이에요.
|
|
1348
|
-
* - `'sandbox'`: 샌드박스 환경에서 실행 중이에요.
|
|
1349
|
-
*
|
|
1350
|
-
* @example
|
|
1351
|
-
* ### 현재 운영 환경 확인하기
|
|
1352
|
-
*
|
|
1353
|
-
* ```tsx
|
|
1354
|
-
* import { getOperationalEnvironment } from '@apps-in-toss/framework';
|
|
1355
|
-
* import { Text } from 'react-native';
|
|
1356
|
-
*
|
|
1357
|
-
* function EnvironmentInfo() {
|
|
1358
|
-
* const environment = getOperationalEnvironment();
|
|
1359
|
-
*
|
|
1360
|
-
* return (
|
|
1361
|
-
* <Text>현재 운영 환경: {environment}</Text>
|
|
1362
|
-
* );
|
|
1363
|
-
* }
|
|
1364
|
-
* ```
|
|
1365
|
-
*/
|
|
1366
|
-
declare function getOperationalEnvironment(): 'toss' | 'sandbox';
|
|
1367
|
-
|
|
1368
|
-
/**
|
|
1369
|
-
* @public
|
|
1370
|
-
* @category 환경 확인
|
|
1371
|
-
* @name getTossAppVersion
|
|
1372
|
-
* @description 토스 앱 버전을 가져옵니다. 예를 들어, `5.206.0`과 같은 형태로 반환돼요. 토스 앱 버전을 로그로 남기거나, 특정 기능이 특정 버전 이상에서만 실행될 때 사용돼요.
|
|
1373
|
-
* @signature
|
|
1374
|
-
* ```typescript
|
|
1375
|
-
* function getTossAppVersion(): string
|
|
1376
|
-
* ```
|
|
1377
|
-
*
|
|
1378
|
-
* @returns {string} 토스 앱 버전
|
|
1379
|
-
*
|
|
1380
|
-
* @example
|
|
1381
|
-
*
|
|
1382
|
-
*
|
|
1383
|
-
* ### 토스 앱 버전 확인하기
|
|
1384
|
-
*
|
|
1385
|
-
* ```tsx
|
|
1386
|
-
* import { getTossAppVersion } from '@apps-in-toss/framework';
|
|
1387
|
-
* import { Text } from 'react-native';
|
|
1388
|
-
*
|
|
1389
|
-
* export function TossAppVersionPage() {
|
|
1390
|
-
* return (
|
|
1391
|
-
* <Text>{getTossAppVersion()}</Text>
|
|
1392
|
-
* )
|
|
1393
|
-
* }
|
|
1394
|
-
* ```
|
|
1395
|
-
*/
|
|
1396
|
-
declare function getTossAppVersion(): string;
|
|
1397
|
-
|
|
1398
|
-
/**
|
|
1399
|
-
* @public
|
|
1400
|
-
* @category 공유
|
|
1401
|
-
* @kind function
|
|
1402
|
-
* @name getTossShareLink
|
|
1403
|
-
* @description
|
|
1404
|
-
* `getTossShareLink` 함수는 사용자가 지정한 경로를 토스 앱에서 열 수 있는 공유 링크를 반환해요.
|
|
1405
|
-
* 이 링크를 다른 사람과 공유하면 토스 앱이 실행되면서 지정한 경로로 진입해요. 토스앱이 없는 사람은 iOS 일 때는 앱스토어로 이동하고, Android 일 때는 플레이스토어로 이동해요.
|
|
1406
|
-
*
|
|
1407
|
-
* 경로는 토스 앱 내부 특정 화면을 나타내는 딥링크(deep link) 형식이어야 해요.
|
|
1408
|
-
* 예를 들어 `intoss://<앱 이름>`이나 `intoss://<앱 이름>/about?name=test`처럼 작성해요.
|
|
1409
|
-
*
|
|
1410
|
-
* 이 함수를 사용하면 `deep_link_value`를 포함한 완성된 공유 링크를 만들 수 있어요.
|
|
1411
|
-
*
|
|
1412
|
-
* @param path - 딥링크로 열고 싶은 경로예요. `intoss://`로 시작하는 문자열이어야 해요.
|
|
1413
|
-
* @returns {Promise<string>} `deep_link_value`가 포함된 토스 공유 링크를 반환해요.
|
|
1414
|
-
*
|
|
1415
|
-
* @example
|
|
1416
|
-
* ```tsx
|
|
1417
|
-
* import { share } from 'react-native-bedrock';
|
|
1418
|
-
* import { getTossShareLink } from '@apps-in-toss/framework';
|
|
1419
|
-
*
|
|
1420
|
-
* // '/' 경로를 딥링크로 포함한 토스 공유 링크를 생성해요.
|
|
1421
|
-
* const tossLink = await getTossShareLink('intoss://my-app');
|
|
1422
|
-
*
|
|
1423
|
-
* // 생성한 링크를 메시지로 공유해요.
|
|
1424
|
-
* await share({ message: tossLink });
|
|
1425
|
-
* ```
|
|
1426
|
-
*/
|
|
1427
|
-
declare function getTossShareLink(path: string): Promise<string>;
|
|
1428
|
-
|
|
1429
|
-
/**
|
|
1430
|
-
* @public
|
|
1431
|
-
* @category 인앱결제
|
|
1432
|
-
* @name IapCreateOneTimePurchaseOrderOptions
|
|
1433
|
-
* @description 인앱결제 1건을 요청할 때 필요한 정보예요.
|
|
1434
|
-
* @property {string} productId - 주문할 상품의 ID예요.
|
|
1435
|
-
*/
|
|
1436
|
-
interface IapCreateOneTimePurchaseOrderOptions {
|
|
1437
|
-
productId: string;
|
|
1438
|
-
}
|
|
1439
|
-
/**
|
|
1440
|
-
* @public
|
|
1441
|
-
* @category 인앱결제
|
|
1442
|
-
* @name IapCreateOneTimePurchaseOrderResult
|
|
1443
|
-
* @description 인앱결제 1건이 완료되면 결제 세부 정보와 상품 정보를 담아 반환해요. 반환된 정보로 결제한 상품의 정보를 화면에 표시할 수 있어요.
|
|
1444
|
-
* @property {string} orderId - 결제 주문 ID이에요. 결제 완료 후 [결제 상태를 조회](https://developers-apps-in-toss.toss.im/api/getIapOrderStatus.html)할 때 사용해요.
|
|
1445
|
-
* @property {string} displayName - 화면에 표시할 상품 이름이에요.
|
|
1446
|
-
* @property {string} displayAmount - 통화 단위가 포함된 가격 정보예요. 예를 들어 `1,000원`으로 가격과 통화가 함께 표시돼요.
|
|
1447
|
-
* @property {number} amount - 상품 가격 숫자 값이에요. 화폐 단위와 쉼표를 제외한 순수 숫자예요. 예를 들어 `1000`으로 표시돼요.
|
|
1448
|
-
* @property {string} currency - [ISO 4217 표준](https://ko.wikipedia.org/wiki/ISO_4217)에 따른 상품 가격 통화 단위예요. 예를 들어 원화는 `KRW`, 달러는 `USD`로 표시돼요.
|
|
1449
|
-
* @property {number} fraction - 가격을 표시할 때 소수점 아래 몇 자리까지 보여줄지 정하는 값이에요. 예를 들어 달러는 소수점 둘째 자리까지 보여줘서 `2`, 원화는 소수점이 필요 없어서 `0`이에요
|
|
1450
|
-
* @property {string | null} miniAppIconUrl - 미니앱 아이콘 이미지의 URL이에요. 아이콘은 앱인토스 콘솔에서 설정한 이미지예요. 콘솔에서 아이콘을 등록하지 않았다면 `null`로 반환돼요.
|
|
1451
|
-
*/
|
|
1452
|
-
interface IapCreateOneTimePurchaseOrderResult {
|
|
1453
|
-
orderId: string;
|
|
1454
|
-
displayName: string;
|
|
1455
|
-
displayAmount: string;
|
|
1456
|
-
amount: number;
|
|
1457
|
-
currency: string;
|
|
1458
|
-
fraction: number;
|
|
1459
|
-
miniAppIconUrl: string | null;
|
|
1460
|
-
}
|
|
1461
|
-
/**
|
|
1462
|
-
* @public
|
|
1463
|
-
* @category 인앱결제
|
|
1464
|
-
* @name iapCreateOneTimePurchaseOrder
|
|
1465
|
-
* @description
|
|
1466
|
-
* 특정 인앱결제 주문서 페이지로 이동해요. 사용자가 상품 구매 버튼을 누르는 상황 등에 사용할 수 있어요. 사용자의 결제는 이동한 페이지에서 진행돼요. 만약 결제 중에 에러가 발생하면 에러 유형에 따라 에러 페이지로 이동해요.
|
|
1467
|
-
* @param {IapCreateOneTimePurchaseOrderOptions} params - 인앱결제를 생성할 때 필요한 정보예요.
|
|
1468
|
-
* @param {string} params.productId - 주문할 상품의 ID예요.
|
|
1469
|
-
* @returns {Promise<IapCreateOneTimePurchaseOrderResult | undefined>} 결제에 성공하면 결제 결과 객체를 반환해요. 앱 버전이 최소 지원 버전(안드로이드 5.219.0, iOS 5.219.0)보다 낮으면 인앱결제를 실행할 수 없어서 `undefined`를 반환해요.
|
|
1470
|
-
*
|
|
1471
|
-
* @throw {code: "INVALID_PRODUCT_ID"} - 유효하지 않은 상품 ID이거나, 해당 상품이 존재하지 않을 때 발생해요.
|
|
1472
|
-
* @throw {code: "PAYMENT_PENDING"} - 사용자가 요청한 결제가 아직 승인을 기다리고 있을 때 발생해요.
|
|
1473
|
-
* @throw {code: "NETWORK_ERROR"} - 서버 내부 문제로 요청을 처리할 수 없을 때 발생해요.
|
|
1474
|
-
* @throw {code: "INVALID_USER_ENVIRONMENT"} - 특정 기기, 계정 또는 설정 환경에서 구매할 수 없는 상품일 때 발생해요.
|
|
1475
|
-
* @throw {code: "ITEM_ALREADY_OWNED"} - 사용자가 이미 구매한 상품을 다시 구매하려고 할 때 발생해요.
|
|
1476
|
-
* @throw {code: "APP_MARKET_VERIFICATION_FAILED"} - 사용자가 결제를 완료했지만, 앱스토어에서 사용자 정보 검증에 실패했을 때 발생해요. 사용자가 앱스토어에 문의해서 환불을 요청해야해요.
|
|
1477
|
-
* @throw {code: "TOSS_SERVER_VERIFICATION_FAILED"} - 사용자가 결제를 완료했지만, 서버 전송에 실패해서 결제 정보를 저장할 수 없을 때 발생해요.
|
|
1478
|
-
* @throw {code: "INTERNAL_ERROR"} - 서버 내부 문제로 요청을 처리할 수 없을 때 발생해요.
|
|
1479
|
-
* @throw {code: "KOREAN_ACCOUNT_ONLY"} - iOS 환경에서 사용자의 계정이 한국 계정이 아닐 때 발생해요.
|
|
1480
|
-
* @throw {code: "USER_CANCELED"} - 사용자가 결제를 완료하지 않고 주문서 페이지를 이탈했을 때 발생해요.
|
|
1481
|
-
*
|
|
1482
|
-
* @example
|
|
1483
|
-
* ### 특정 인앱결제 주문서 페이지로 이동하기
|
|
1484
|
-
*
|
|
1485
|
-
* ```tsx
|
|
1486
|
-
* import { IAP } from "@apps-in-toss/web-framework";
|
|
1487
|
-
* import { Button } from "@toss-design-system/react-native";
|
|
1488
|
-
*
|
|
1489
|
-
* interface Props {
|
|
1490
|
-
* productId: string;
|
|
1491
|
-
* }
|
|
1492
|
-
*
|
|
1493
|
-
* function IapCreateOneTimePurchaseOrderButton({ productId }: Props) {
|
|
1494
|
-
* async function handleClick() {
|
|
1495
|
-
* try {
|
|
1496
|
-
* await IAP.createOneTimePurchaseOrder({
|
|
1497
|
-
* productId,
|
|
1498
|
-
* });
|
|
1499
|
-
* console.error("인앱결제에 성공했어요");
|
|
1500
|
-
* } catch (error) {
|
|
1501
|
-
* console.error('인앱결제에 실패했어요:', error);
|
|
1502
|
-
* }
|
|
1503
|
-
* }
|
|
1504
|
-
*
|
|
1505
|
-
* return <Button onClick={handleClick}>구매하기</Button>;
|
|
1506
|
-
* }
|
|
1507
|
-
* ```
|
|
1508
|
-
*/
|
|
1509
|
-
declare function createOneTimePurchaseOrder(params: IapCreateOneTimePurchaseOrderOptions): Promise<IapCreateOneTimePurchaseOrderResult | undefined>;
|
|
1510
|
-
/**
|
|
1511
|
-
* @public
|
|
1512
|
-
* @category 인앱결제
|
|
1513
|
-
* @name IapProductListItem
|
|
1514
|
-
* @description 인앱결제로 구매할 수 있는 상품 하나의 정보를 담은 객체예요. 상품 목록을 화면에 표시할 때 사용해요.
|
|
1515
|
-
* @property {string} sku - 상품의 고유 ID예요. [IAP.createOneTimePurchaseOrder](https://developers-apps-in-toss.toss.im/bedrock/reference/framework/%EC%9D%B8%EC%95%B1%20%EA%B2%B0%EC%A0%9C/createOneTimePurchaseOrder.html)를 호출할때 사용하는 `productId`와 동일한 값이에요.
|
|
1516
|
-
* @property {string} displayName - 화면에 표시할 상품 이름이에요. 상품 이름은 앱인토스 콘솔에서 설정한 값이에요.
|
|
1517
|
-
* @property {string} displayAmount - 통화 단위가 포함된 가격 정보예요. 예를 들어 `1,000원`으로 가격과 통화가 함께 표시돼요.
|
|
1518
|
-
* @property {string} iconUrl - 상품 아이콘 이미지의 URL이에요. 아이콘은 앱인토스 콘솔에서 설정한 이미지예요.
|
|
1519
|
-
* @property {string} description - 상품에 대한 설명이에요. 설명은 앱인토스 콘솔에서 설정한 값이에요.
|
|
1520
|
-
*/
|
|
1521
|
-
interface IapProductListItem {
|
|
1522
|
-
sku: string;
|
|
1523
|
-
displayAmount: string;
|
|
1524
|
-
displayName: string;
|
|
1525
|
-
iconUrl: string;
|
|
1526
|
-
description: string;
|
|
1527
|
-
}
|
|
1528
|
-
/**
|
|
1529
|
-
* @public
|
|
1530
|
-
* @category 인앱결제
|
|
1531
|
-
* @name iapGetProductItemList
|
|
1532
|
-
* @description 인앱결제로 구매할 수 있는 상품 목록을 가져와요. 상품 목록 화면에 진입할 때 호출해요.
|
|
1533
|
-
* @returns {Promise<{ products: IapProductListItem[] } | undefined>} 상품 목록을 포함한 객체를 반환해요. 앱 버전이 최소 지원 버전(안드로이드 5.219.0, iOS 5.219.0)보다 낮으면 `undefined`를 반환해요.
|
|
1534
|
-
*
|
|
1535
|
-
* @example
|
|
1536
|
-
* ### 구매 가능한 인앱결제 상품목록 가져오기
|
|
1537
|
-
*
|
|
1538
|
-
* ```tsx
|
|
1539
|
-
* import { IAP, IapProductListItem } from "@apps-in-toss/framework";
|
|
1540
|
-
* import { Button, List, ListRow } from "@toss-design-system/react-native";
|
|
1541
|
-
* import { useEffect, useState } from "react";
|
|
1542
|
-
*
|
|
1543
|
-
* function IapProductList() {
|
|
1544
|
-
* const [products, setProducts] = useState<IapProductListItem[]>([]);
|
|
1545
|
-
*
|
|
1546
|
-
* async function buyIapProduct(productId: string) {
|
|
1547
|
-
* try {
|
|
1548
|
-
* await IAP.createOneTimePurchaseOrder({
|
|
1549
|
-
* productId,
|
|
1550
|
-
* });
|
|
1551
|
-
*
|
|
1552
|
-
* console.error("인앱결제에 성공했어요");
|
|
1553
|
-
* } catch (error) {
|
|
1554
|
-
* console.error("인앱결제에 실패했어요:", error);
|
|
1555
|
-
* }
|
|
1556
|
-
* }
|
|
1557
|
-
*
|
|
1558
|
-
* useEffect(() => {
|
|
1559
|
-
* async function fetchProducts() {
|
|
1560
|
-
* try {
|
|
1561
|
-
* const response = await IAP.getProductItemList();
|
|
1562
|
-
* setProducts(response?.products ?? []);
|
|
1563
|
-
* } catch (error) {
|
|
1564
|
-
* console.error("상품 목록을 가져오는 데 실패했어요:", error);
|
|
1565
|
-
* }
|
|
1566
|
-
* }
|
|
1567
|
-
*
|
|
1568
|
-
* fetchProducts();
|
|
1569
|
-
* }, []);
|
|
1570
|
-
*
|
|
1571
|
-
* return (
|
|
1572
|
-
* <List>
|
|
1573
|
-
* {products.map((product) => (
|
|
1574
|
-
* <ListRow
|
|
1575
|
-
* key={product.sku}
|
|
1576
|
-
* left={
|
|
1577
|
-
* <ListRow.Image type="square" source={{ uri: product.iconUrl }} />
|
|
1578
|
-
* }
|
|
1579
|
-
* right={
|
|
1580
|
-
* <Button size="medium" onPress={() => buyIapProduct(product.sku)}>
|
|
1581
|
-
* 구매하기
|
|
1582
|
-
* </Button>
|
|
1583
|
-
* }
|
|
1584
|
-
* contents={
|
|
1585
|
-
* <ListRow.Texts
|
|
1586
|
-
* type="3RowTypeA"
|
|
1587
|
-
* top={product.displayName}
|
|
1588
|
-
* middle={product.description}
|
|
1589
|
-
* bottom={product.displayAmount}
|
|
1590
|
-
* />
|
|
1591
|
-
* }
|
|
1592
|
-
* />
|
|
1593
|
-
* ))}
|
|
1594
|
-
* </List>
|
|
1595
|
-
* );
|
|
1596
|
-
* }
|
|
1597
|
-
* ```
|
|
1598
|
-
*/
|
|
1599
|
-
declare function getProductItemList(): Promise<{
|
|
1600
|
-
products: IapProductListItem[];
|
|
1601
|
-
} | undefined>;
|
|
1602
|
-
/**
|
|
1603
|
-
* @public
|
|
1604
|
-
* @category 인앱결제
|
|
1605
|
-
* @name IAP
|
|
1606
|
-
* @description 인앱결제 관련 기능을 모은 객체예요. 단건 인앱결제 주문서 이동과 상품 목록 조회 기능을 제공해요.
|
|
1607
|
-
* @property {typeof createOneTimePurchaseOrder} [createOneTimePurchaseOrder] 특정 인앱결제 주문서 페이지로 이동해요. 자세한 내용은 [createOneTimePurchaseOrder](https://developers-apps-in-toss.toss.im/bedrock/reference/framework/%EC%9D%B8%EC%95%B1%20%EA%B2%B0%EC%A0%9C/getProductItemList.html) 문서를 참고하세요.
|
|
1608
|
-
* @property {typeof getProductItemList} [getProductItemList] 인앱결제로 구매할 수 있는 상품 목록을 가져와요. 자세한 내용은 [getProductItemList](https://developers-apps-in-toss.toss.im/bedrock/reference/framework/%EC%9D%B8%EC%95%B1%20%EA%B2%B0%EC%A0%9C/createOneTimePurchaseOrder.html) 문서를 참고하세요.
|
|
1609
|
-
*/
|
|
1610
|
-
declare const IAP: {
|
|
1611
|
-
createOneTimePurchaseOrder: typeof createOneTimePurchaseOrder;
|
|
1612
|
-
getProductItemList: typeof getProductItemList;
|
|
1613
|
-
};
|
|
1614
|
-
|
|
1615
|
-
/**
|
|
1616
|
-
* @public
|
|
1617
|
-
* @category 환경 확인
|
|
1618
|
-
* @kind function
|
|
1619
|
-
* @name isMinVersionSupported
|
|
1620
|
-
* @description
|
|
1621
|
-
* 현재 토스 앱 버전이 지정한 최소 버전 이상인지 확인해요.
|
|
1622
|
-
*
|
|
1623
|
-
* 이 함수는 현재 실행 중인 토스 앱의 버전이 파라미터로 전달된 최소 버전 요구사항을 충족하는지 확인해요. 특정 기능이 최신 버전에서만 동작할 때, 사용자에게 앱 업데이트를 안내할 수 있어요.
|
|
1624
|
-
*
|
|
1625
|
-
* @param {Object} minVersions 플랫폼별 최소 버전 요구사항을 지정하는 객체예요.
|
|
1626
|
-
* @param {(`${number}.${number}.${number}` | 'always' | 'never')} minVersions.android 안드로이드 플랫폼의 최소 버전 요구사항이에요.
|
|
1627
|
-
* @param {(`${number}.${number}.${number}` | 'always' | 'never')} minVersions.ios iOS 플랫폼의 최소 버전 요구사항이에요.
|
|
1628
|
-
* @returns {boolean} 현재 앱 버전이 최소 버전 이상이면 true, 그렇지 않으면 false를 반환해요.
|
|
1629
|
-
*
|
|
1630
|
-
* @example
|
|
1631
|
-
* ### 앱 버전 확인하기
|
|
1632
|
-
*
|
|
1633
|
-
* ```tsx
|
|
1634
|
-
* import { isMinVersionSupported } from '@apps-in-toss/framework';
|
|
1635
|
-
* import { Text, View } from 'react-native';
|
|
1636
|
-
*
|
|
1637
|
-
* function VersionCheck() {
|
|
1638
|
-
* const isSupported = isMinVersionSupported({
|
|
1639
|
-
* android: '1.2.0',
|
|
1640
|
-
* ios: '1.3.0'
|
|
1641
|
-
* });
|
|
1642
|
-
*
|
|
1643
|
-
* return (
|
|
1644
|
-
* <View>
|
|
1645
|
-
* {!isSupported && (
|
|
1646
|
-
* <Text>최신 버전으로 업데이트가 필요해요.</Text>
|
|
1647
|
-
* )}
|
|
1648
|
-
* </View>
|
|
1649
|
-
* );
|
|
1650
|
-
* }
|
|
1651
|
-
* ```
|
|
1652
|
-
*/
|
|
1653
|
-
declare function isMinVersionSupported(minVersions: {
|
|
1654
|
-
android: `${number}.${number}.${number}` | 'always' | 'never';
|
|
1655
|
-
ios: `${number}.${number}.${number}` | 'always' | 'never';
|
|
1656
|
-
}): boolean;
|
|
1657
|
-
|
|
1658
|
-
interface OpenCameraOptions {
|
|
1659
|
-
/**
|
|
1660
|
-
* 이미지를 Base64 형식으로 반환할지 여부를 나타내는 불리언 값이에요.
|
|
1661
|
-
*
|
|
1662
|
-
* 기본값: `false`.
|
|
1663
|
-
*/
|
|
1664
|
-
base64?: boolean;
|
|
1665
|
-
/**
|
|
1666
|
-
* 이미지의 최대 너비를 나타내는 숫자 값이에요.
|
|
1667
|
-
*
|
|
1668
|
-
* 기본값: `1024`.
|
|
1669
|
-
*/
|
|
1670
|
-
maxWidth?: number;
|
|
1671
|
-
}
|
|
1672
|
-
/**
|
|
1673
|
-
* @public
|
|
1674
|
-
* @category 카메라
|
|
1675
|
-
* @name openCamera
|
|
1676
|
-
* @description 카메라를 실행해서 촬영된 이미지를 반환하는 함수예요.
|
|
1677
|
-
* @param {OpenCameraOptions} options - 카메라 실행 시 사용되는 옵션 객체예요.
|
|
1678
|
-
* @param {boolean} [options.base64=false] - 이미지를 Base64 형식으로 반환할지 여부를 나타내는 불리언 값이에요. 기본값은 `false`예요. `true`로 설정하면 `dataUri` 대신 Base64 인코딩된 문자열을 반환해요.
|
|
1679
|
-
* @param {number} [options.maxWidth=1024] - 이미지의 최대 너비를 나타내는 숫자 값이에요. 기본값은 `1024`예요.
|
|
1680
|
-
* @returns {Promise<ImageResponse>}
|
|
1681
|
-
* 촬영된 이미지 정보를 포함한 객체를 반환해요. 반환 객체의 구성은 다음과 같아요:
|
|
1682
|
-
* - `id`: 이미지의 고유 식별자예요.
|
|
1683
|
-
* - `dataUri`: 이미지 데이터를 표현하는 데이터 URI예요.
|
|
1684
|
-
*
|
|
1685
|
-
* @example
|
|
1686
|
-
* ### 카메라 실행 후 촬영된 사진 가져오기
|
|
1687
|
-
*
|
|
1688
|
-
* ```tsx
|
|
1689
|
-
* import React, { useState } from 'react';
|
|
1690
|
-
* import { View, Text, Button, Image } from 'react-native';
|
|
1691
|
-
* import { openCamera } from '@apps-in-toss/framework';
|
|
1692
|
-
*
|
|
1693
|
-
* const base64 = true;
|
|
1694
|
-
*
|
|
1695
|
-
* // 카메라를 실행하고 촬영된 이미지를 화면에 표시하는 컴포넌트
|
|
1696
|
-
* function Camera() {
|
|
1697
|
-
* const [image, setImage] = useState(null);
|
|
1698
|
-
*
|
|
1699
|
-
* const handlePress = async () => {
|
|
1700
|
-
* try {
|
|
1701
|
-
* const response = await openCamera({ base64 });
|
|
1702
|
-
* setImage(response);
|
|
1703
|
-
* } catch (error) {
|
|
1704
|
-
* console.error('사진을 가져오는 데 실패했어요:', error);
|
|
1705
|
-
* }
|
|
1706
|
-
* };
|
|
1707
|
-
*
|
|
1708
|
-
* // base64 형식으로 반환된 이미지를 표시하려면 데이터 URL 스키마 Prefix를 붙여야해요.
|
|
1709
|
-
* const imageUri = base64 ? 'data:image/jpeg;base64,' + image.dataUri : image.dataUri;
|
|
1710
|
-
*
|
|
1711
|
-
* return (
|
|
1712
|
-
* <View>
|
|
1713
|
-
* {image ? (
|
|
1714
|
-
* <Image source={{ uri: imageUri }} style={{ width: 200, height: 200 }} />
|
|
1715
|
-
* ) : (
|
|
1716
|
-
* <Text>사진이 없어요</Text>
|
|
1717
|
-
* )}
|
|
1718
|
-
* <Button title="사진 촬영하기" onPress={handlePress} />
|
|
1719
|
-
* </View>
|
|
1720
|
-
* );
|
|
1721
|
-
* }
|
|
1722
|
-
* ```
|
|
1723
|
-
*/
|
|
1724
|
-
declare function openCamera(options?: OpenCameraOptions): Promise<ImageResponse>;
|
|
1725
|
-
|
|
1726
|
-
/**
|
|
1727
|
-
* @public
|
|
1728
|
-
* @category 게임센터
|
|
1729
|
-
* @name openGameCenterLeaderboard
|
|
1730
|
-
* @description 게임센터 리더보드 웹뷰를 열어요.
|
|
1731
|
-
* 앱 버전이 최소 지원 버전(`5.221.0`)보다 낮으면 아무 동작도 하지 않고 `undefined`를 반환해요.
|
|
1732
|
-
* 게임센터를 사용하는 사용자는 반드시 최소 지원 버전 이상이어야 게임을 실행할 수 있어요.
|
|
1733
|
-
* @returns 리더보드 웹뷰를 호출해요. 앱 버전이 낮으면 아무 동작도 하지 않고 `undefined`를 반환해요.
|
|
1734
|
-
*
|
|
1735
|
-
* @example
|
|
1736
|
-
* import { Button } from 'react-native';
|
|
1737
|
-
* import { openGameCenterLeaderboard } from '@apps-in-toss/framework';
|
|
1738
|
-
*
|
|
1739
|
-
* // '리더보드' 버튼을 누르면 게임센터 리더보드 웹뷰가 열려요.
|
|
1740
|
-
* function LeaderboardButton() {
|
|
1741
|
-
* const onPress = () => {
|
|
1742
|
-
* openGameCenterLeaderboard();
|
|
1743
|
-
* };
|
|
1744
|
-
*
|
|
1745
|
-
* return <Button title="리더보드 웹뷰 호출" onPress={onPress} />;
|
|
1746
|
-
* }
|
|
1747
|
-
*/
|
|
1748
|
-
declare function openGameCenterLeaderboard(): Promise<void>;
|
|
1749
|
-
|
|
1750
|
-
interface SaveBase64DataParams {
|
|
1751
|
-
data: string;
|
|
1752
|
-
fileName: string;
|
|
1753
|
-
mimeType: string;
|
|
1754
|
-
}
|
|
1755
|
-
/**
|
|
1756
|
-
* @public
|
|
1757
|
-
* @category 데이터
|
|
1758
|
-
* @name saveBase64Data
|
|
1759
|
-
* @description 문자열로 인코딩된 Base64 데이터를 지정한 파일 이름과 MIME 타입으로 사용자 기기에 저장해요. 이미지, 텍스트, PDF 등 다양한 형식의 데이터를 저장할 수 있어요.
|
|
1760
|
-
* @param {SaveBase64DataParams} params - 저장할 데이터와 파일 정보를 담은 객체예요.
|
|
1761
|
-
* @param {string} params.data - Base64 형식으로 인코딩된 데이터 문자열이에요.
|
|
1762
|
-
* @param {string} params.fileName - 저장할 파일 이름이에요. 확장자도 같이 붙여줘야해요. 예를 들어, 'example.png'로 저장할 수 있어요.
|
|
1763
|
-
* @param {string} params.mimeType - 저장할 파일의 MIME 타입이에요. 예를 들어 'image/png' 로 지정하면 이미지, 'application/pdf'는 PDF 파일이에요. 자세한 내용은 [MIME 문서](https://developer.mozilla.org/ko/docs/Web/HTTP/Guides/MIME_types)를 참고해주세요.
|
|
1764
|
-
*
|
|
1765
|
-
* @example
|
|
1766
|
-
* ### Base64 이미지 데이터를 사용자 기기에 저장하기
|
|
1767
|
-
*
|
|
1768
|
-
* ```tsx
|
|
1769
|
-
* import { Button } from 'react-native';
|
|
1770
|
-
* import { saveBase64Data } from '@apps-in-toss/framework';
|
|
1771
|
-
*
|
|
1772
|
-
* // '저장' 버튼을 누르면 이미지가 사용자 기기에 저장돼요.
|
|
1773
|
-
* function SaveButton() {
|
|
1774
|
-
* const handleSave = async () => {
|
|
1775
|
-
* try {
|
|
1776
|
-
* await saveBase64Data({
|
|
1777
|
-
* data: 'iVBORw0KGgo...',
|
|
1778
|
-
* fileName: 'some-photo.png',
|
|
1779
|
-
* mimeType: 'image/png',
|
|
1780
|
-
* });
|
|
1781
|
-
* } catch (error) {
|
|
1782
|
-
* console.error('데이터 저장에 실패했어요:', error);
|
|
1783
|
-
* }
|
|
1784
|
-
* };
|
|
1785
|
-
*
|
|
1786
|
-
* return <Button title="저장" onPress={handleSave} />;
|
|
1787
|
-
* }
|
|
1788
|
-
* ```
|
|
1789
|
-
*/
|
|
1790
|
-
declare function saveBase64Data(params: SaveBase64DataParams): Promise<void>;
|
|
1791
|
-
|
|
1792
|
-
/**
|
|
1793
|
-
* @public
|
|
1794
|
-
* @category 클립보드
|
|
1795
|
-
* @name setClipboardText
|
|
1796
|
-
* @description 텍스트를 클립보드에 복사해서 사용자가 다른 곳에 붙여 넣기 할 수 있어요.
|
|
1797
|
-
* @param {Promise<void>} text - 클립보드에 복사할 텍스트예요. 문자열 형식으로 입력해요.
|
|
1798
|
-
*
|
|
1799
|
-
* @example
|
|
1800
|
-
* ### 텍스트를 클립보드에 복사하기
|
|
1801
|
-
*
|
|
1802
|
-
* ```tsx
|
|
1803
|
-
* import { Button } from 'react-native';
|
|
1804
|
-
* import { setClipboardText } from '@apps-in-toss/framework';
|
|
1805
|
-
*
|
|
1806
|
-
* // '복사' 버튼을 누르면 "복사할 텍스트"가 클립보드에 복사돼요.
|
|
1807
|
-
* function CopyButton() {
|
|
1808
|
-
* const handleCopy = async () => {
|
|
1809
|
-
* try {
|
|
1810
|
-
* await setClipboardText('복사할 텍스트');
|
|
1811
|
-
* console.log('텍스트가 복사됐어요!');
|
|
1812
|
-
* } catch (error) {
|
|
1813
|
-
* console.error('텍스트 복사에 실패했어요:', error);
|
|
1814
|
-
* }
|
|
1815
|
-
* };
|
|
1816
|
-
*
|
|
1817
|
-
* return <Button title="복사" onPress={handleCopy} />;
|
|
1818
|
-
* }
|
|
1819
|
-
* ```
|
|
1820
|
-
*/
|
|
1821
|
-
declare function setClipboardText(text: string): Promise<void>;
|
|
1822
|
-
|
|
1823
|
-
/**
|
|
1824
|
-
* @public
|
|
1825
|
-
* @category 화면 제어
|
|
1826
|
-
* @kind function
|
|
1827
|
-
* @name setDeviceOrientation
|
|
1828
|
-
* @description
|
|
1829
|
-
* `setDeviceOrientation` 함수는 기기의 화면 방향을 설정하는 기능을 제공해요.
|
|
1830
|
-
* 이 기능은 특정 화면에서 가로 모드나 세로 모드를 강제로 지정해야 할 때 유용해요.
|
|
1831
|
-
*
|
|
1832
|
-
* `type` 옵션을 통해 원하는 화면 방향을 지정할 수 있어요. 특히, 이 함수는 앱 전체에 영향을 미치므로
|
|
1833
|
-
* 특정 화면에서만 사용하려면 화면을 벗어날 때 이전 상태로 복구하는 추가 작업이 필요해요.
|
|
1834
|
-
*
|
|
1835
|
-
* 예를 들어, 동영상 감상 화면에서는 가로 모드를 강제하고, 화면을 떠날 때 설정을 복구해서
|
|
1836
|
-
* 다른 화면들의 방향 설정에 영향을 주지 않도록 할 수 있어요.
|
|
1837
|
-
*
|
|
1838
|
-
* @param {object} options 화면 방향 설정 값이에요.
|
|
1839
|
-
* @param {string} options.type 화면 방향을 지정하는 옵션이에요.
|
|
1840
|
-
* 'portrait' | 'landscape' 중 하나를 선택할 수 있어요.
|
|
1841
|
-
*
|
|
1842
|
-
* @returns {Promise<void>} 화면 방향 설정이 완료되면 해결되는 Promise를 반환해요.
|
|
1843
|
-
*
|
|
1844
|
-
* @example
|
|
1845
|
-
* ### 화면 방향 설정하기
|
|
1846
|
-
*
|
|
1847
|
-
* ```tsx
|
|
1848
|
-
* import { Button } from 'react-native';
|
|
1849
|
-
* import { setDeviceOrientation } from '@apps-in-toss/framework';
|
|
1850
|
-
*
|
|
1851
|
-
* function SetDeviceOrientation() {
|
|
1852
|
-
* return (
|
|
1853
|
-
* <Button
|
|
1854
|
-
* title="가로 모드로 변경"
|
|
1855
|
-
* onPress={() => {
|
|
1856
|
-
* setDeviceOrientation({ type: 'landscape' });
|
|
1857
|
-
* }}
|
|
1858
|
-
* />
|
|
1859
|
-
* );
|
|
1860
|
-
* }
|
|
1861
|
-
* ```
|
|
1862
|
-
*
|
|
1863
|
-
* ### 화면 방향 복구하기
|
|
1864
|
-
* 특정 화면을 벗어날 때 이전 상태로 복구하려면 다음과 같이 `useEffect`를 사용하세요.
|
|
1865
|
-
*
|
|
1866
|
-
* ```tsx
|
|
1867
|
-
* import { useEffect } from 'react';
|
|
1868
|
-
* import { setDeviceOrientation } from '@apps-in-toss/framework';
|
|
1869
|
-
*
|
|
1870
|
-
* function VideoScreen() {
|
|
1871
|
-
* useEffect(() => {
|
|
1872
|
-
* setDeviceOrientation({ type: 'landscape' });
|
|
1873
|
-
*
|
|
1874
|
-
* return () => {
|
|
1875
|
-
* setDeviceOrientation({ type: 'portrait' }); // 설정을 이전 상태로 복구해요.
|
|
1876
|
-
* };
|
|
1877
|
-
* }, []);
|
|
1878
|
-
*
|
|
1879
|
-
* return <Text>동영상을 감상하는 화면</Text>;
|
|
1880
|
-
* }
|
|
1881
|
-
* ```
|
|
1882
|
-
*/
|
|
1883
|
-
declare function setDeviceOrientation(options: {
|
|
1884
|
-
type: 'portrait' | 'landscape';
|
|
1885
|
-
}): Promise<void>;
|
|
1886
|
-
|
|
1887
|
-
/**
|
|
1888
|
-
* @public
|
|
1889
|
-
* @category 저장소
|
|
1890
|
-
* @name getItem
|
|
1891
|
-
* @description 모바일 앱의 로컬 저장소에서 문자열 데이터를 가져와요. 주로 앱이 종료되었다가 다시 시작해도 데이터가 유지되어야 하는 경우에 사용해요.
|
|
1892
|
-
* @param {string} key - 가져올 아이템의 키를 입력해요.
|
|
1893
|
-
* @returns {Promise<string | null>} 지정한 키에 저장된 문자열 값을 반환해요. 값이 없으면 `null`을 반환해요.
|
|
1894
|
-
* @example
|
|
1895
|
-
*
|
|
1896
|
-
* ### `my-key`에 저장된 아이템 가져오기
|
|
1897
|
-
* ```ts
|
|
1898
|
-
* const value = await Storage.getItem('my-key');
|
|
1899
|
-
* console.log(value); // 'value'
|
|
1900
|
-
* ```
|
|
1901
|
-
*/
|
|
1902
|
-
declare function getItem(key: string): Promise<string | null>;
|
|
1903
|
-
/**
|
|
1904
|
-
* @public
|
|
1905
|
-
* @category 저장소
|
|
1906
|
-
* @name setItem
|
|
1907
|
-
* @description 모바일 앱의 로컬 저장소에 문자열 데이터를 저장해요. 주로 앱이 종료되었다가 다시 시작해도 데이터가 유지되어야 하는 경우에 사용해요.
|
|
1908
|
-
* @param {string} key - 저장할 아이템의 키를 입력해요.
|
|
1909
|
-
* @param {string} value - 저장할 아이템의 값을 입력해요.
|
|
1910
|
-
* @returns {Promise<void>} 아이템을 성공적으로 저장하면 아무 값도 반환하지 않아요.
|
|
1911
|
-
* @example
|
|
1912
|
-
*
|
|
1913
|
-
* ### `my-key`에 아이템 저장하기
|
|
1914
|
-
* ```ts
|
|
1915
|
-
* import { Storage } from '@apps-in-toss/framework';
|
|
1916
|
-
*
|
|
1917
|
-
* await Storage.setItem('my-key', 'value');
|
|
1918
|
-
* ```
|
|
1919
|
-
*/
|
|
1920
|
-
declare function setItem(key: string, value: string): Promise<void>;
|
|
1921
|
-
/**
|
|
1922
|
-
* @public
|
|
1923
|
-
* @category 저장소
|
|
1924
|
-
* @name removeItem
|
|
1925
|
-
* @description 모바일 앱의 로컬 저장소에서 특정 키에 해당하는 아이템을 삭제해요.
|
|
1926
|
-
* @param {string} key - 삭제할 아이템의 키를 입력해요.
|
|
1927
|
-
* @returns {Promise<void>} 아이템을 삭제하면 아무 값도 반환하지 않아요.
|
|
1928
|
-
* @example
|
|
1929
|
-
*
|
|
1930
|
-
* ### `my-key`에 저장된 아이템 삭제하기
|
|
1931
|
-
* ```ts
|
|
1932
|
-
* import { Storage } from '@apps-in-toss/framework';
|
|
1933
|
-
*
|
|
1934
|
-
* await Storage.removeItem('my-key');
|
|
1935
|
-
* ```
|
|
1936
|
-
*/
|
|
1937
|
-
declare function removeItem(key: string): Promise<void>;
|
|
1938
|
-
/**
|
|
1939
|
-
* @public
|
|
1940
|
-
* @category 저장소
|
|
1941
|
-
* @name clearItems
|
|
1942
|
-
* @description 모바일 앱의 로컬 저장소의 모든 아이템을 삭제해요.
|
|
1943
|
-
* @returns {Promise<void>} 아이템을 삭제하면 아무 값도 반환하지 않고 저장소가 초기화돼요.
|
|
1944
|
-
* @example
|
|
1945
|
-
*
|
|
1946
|
-
* ### 저장소 초기화하기
|
|
1947
|
-
* ```ts
|
|
1948
|
-
* import { Storage } from '@apps-in-toss/framework';
|
|
1949
|
-
*
|
|
1950
|
-
* await Storage.clearItems();
|
|
1951
|
-
* ```
|
|
1952
|
-
*/
|
|
1953
|
-
declare function clearItems(): Promise<void>;
|
|
1954
|
-
/**
|
|
1955
|
-
* @public
|
|
1956
|
-
* @category 저장소
|
|
1957
|
-
* @name Storage
|
|
1958
|
-
* @description 네이티브의 저장소를 사용해요.
|
|
1959
|
-
* @property {typeof getItem} [getItem] 모바일 앱의 로컬 저장소에서 아이템을 가져오는 함수예요. 자세한 내용은 [getItem](/react-native/reference/framework/저장소/getItem.html)을 참고하세요.
|
|
1960
|
-
* @property {typeof setItem} [setItem] 모바일 앱의 로컬 저장소에 아이템을 저장하는 함수예요. 자세한 내용은 [setItem](/react-native/reference/framework/저장소/setItem.html)을 참고하셰요.
|
|
1961
|
-
* @property {typeof removeItem} [removeItem] 모바일 앱의 로컬 저장소에서 아이템을 삭제하는 함수예요. 자세한 내용은 [removeItem](/react-native/reference/framework/저장소/removeItem.html)을 참고하세요.
|
|
1962
|
-
* @property {typeof clearItems} [clearItems] 모바일 앱의 로컬 저장소를 초기화하는 함수예요. 자세한 내용은 [clearItems](/react-native/reference/framework/저장소/clearItems.html)을 참고하세요.
|
|
1963
|
-
*/
|
|
1964
|
-
declare const Storage: {
|
|
1965
|
-
getItem: typeof getItem;
|
|
1966
|
-
setItem: typeof setItem;
|
|
1967
|
-
removeItem: typeof removeItem;
|
|
1968
|
-
clearItems: typeof clearItems;
|
|
1969
|
-
};
|
|
1970
|
-
|
|
1971
|
-
/**
|
|
1972
|
-
* @category 게임센터
|
|
1973
|
-
* @name GameCenterGameProfileResponse
|
|
1974
|
-
* @description 토스게임센터 프로필을 가져온 결과 타입이에요.
|
|
1975
|
-
* 앱에 프로필이 없는 경우, `statusCode`가 `'PROFILE_NOT_FOUND'`이고 다른 정보는 없어요.
|
|
1976
|
-
* 프로필이 있는 경우 `statusCode`가 `'SUCCESS'`이고, 닉네임과 프로필 이미지 주소가 함께 제공돼요.
|
|
1977
|
-
* @property {string} statusCode 프로필 조회 결과 상태예요. `'SUCCESS'` 또는 `'PROFILE_NOT_FOUND'` 중 하나예요.
|
|
1978
|
-
* @property {string} [nickname] 프로필 닉네임이에요. `statusCode`가 `'SUCCESS'`일 때만 있어요.
|
|
1979
|
-
* @property {string} [profileImageUri] 프로필 이미지 URL이에요. `statusCode`가 `'SUCCESS'`일 때만 있어요.
|
|
1980
|
-
*/
|
|
1981
|
-
type GameCenterGameProfileResponse = {
|
|
1982
|
-
statusCode: 'PROFILE_NOT_FOUND';
|
|
1983
|
-
} | {
|
|
1984
|
-
statusCode: 'SUCCESS';
|
|
1985
|
-
nickname: string;
|
|
1986
|
-
profileImageUri: string;
|
|
1987
|
-
};
|
|
1988
|
-
/**
|
|
1989
|
-
* @category 게임센터
|
|
1990
|
-
* @name getGameCenterGameProfile
|
|
1991
|
-
* @description 토스게임센터 프로필 정보를 가져와요.
|
|
1992
|
-
* 사용자가 프로필을 만들지 않았다면 `statusCode`가 `'PROFILE_NOT_FOUND'`인 응답이 반환돼요.
|
|
1993
|
-
* 앱 버전이 최소 지원 버전(안드로이드 5.221.0, iOS 5.221.0)보다 낮으면 `undefined`를 반환해요.
|
|
1994
|
-
* @returns {Promise<GameCenterGameProfileResponse | undefined>} 프로필 정보 또는 `undefined`를 반환해요.
|
|
1995
|
-
*
|
|
1996
|
-
* @example
|
|
1997
|
-
* ### 게임센터 프로필 가져오기
|
|
1998
|
-
* ```tsx
|
|
1999
|
-
* import { getGameCenterGameProfile } from './getGameCenterGameProfile';
|
|
2000
|
-
* import { useState } from 'react';
|
|
2001
|
-
* import { View, Button } from 'react-native';
|
|
2002
|
-
*
|
|
2003
|
-
* function GameProfile() {
|
|
2004
|
-
* const [profile, setProfile] = useState<GameCenterGameProfileResponse | null>(null);
|
|
2005
|
-
*
|
|
2006
|
-
* const handlePress = async () => {
|
|
2007
|
-
* try {
|
|
2008
|
-
* const result = await getGameCenterGameProfile();
|
|
2009
|
-
* if (result) {
|
|
2010
|
-
* setProfile(result);
|
|
2011
|
-
* }
|
|
2012
|
-
* } catch (error) {
|
|
2013
|
-
* console.error('게임센터 프로필 가져오기에 실패했어요.', error);
|
|
2014
|
-
* }
|
|
2015
|
-
* };
|
|
2016
|
-
*
|
|
2017
|
-
* return (
|
|
2018
|
-
* <View>
|
|
2019
|
-
* <Button title="게임센터 프로필 가져오기" onPress={handlePress} />
|
|
2020
|
-
* </View>
|
|
2021
|
-
* );
|
|
2022
|
-
* }
|
|
2023
|
-
* ```
|
|
2024
|
-
*/
|
|
2025
|
-
declare function getGameCenterGameProfile(): Promise<GameCenterGameProfileResponse | undefined>;
|
|
2026
|
-
|
|
2027
|
-
/**
|
|
2028
|
-
* @public
|
|
2029
|
-
* @category 게임센터
|
|
2030
|
-
* @name SubmitGameCenterLeaderBoardScoreResponse
|
|
2031
|
-
* @description
|
|
2032
|
-
* 토스게임센터 리더보드에 점수를 제출한 결과 정보를 담아서 반환해요. 반환된 정보를 사용해서 점수 제출 결과에 따라 적절한 에러 처리를 할 수 있어요.
|
|
2033
|
-
* @property {'SUCCESS' | 'LEADERBOARD_NOT_FOUND' | 'PROFILE_NOT_FOUND' | 'UNPARSABLE_SCORE'} statusCode
|
|
2034
|
-
* 점수 제출 결과를 나타내는 상태 코드예요.
|
|
2035
|
-
* - `'SUCCESS'`: 점수 제출이 성공했어요.
|
|
2036
|
-
* - `'LEADERBOARD_NOT_FOUND'`: `gameId`에 해당하는 리더보드를 찾을 수 없어요.
|
|
2037
|
-
* - `'PROFILE_NOT_FOUND'`: 사용자의 프로필이 없어요.
|
|
2038
|
-
* - `'UNPARSABLE_SCORE'`: 점수를 해석할 수 없어요. 점수는 실수(float) 형태의 문자열로 전달해야 해요.
|
|
2039
|
-
*/
|
|
2040
|
-
interface SubmitGameCenterLeaderBoardScoreResponse {
|
|
2041
|
-
statusCode: 'SUCCESS' | 'LEADERBOARD_NOT_FOUND' | 'PROFILE_NOT_FOUND' | 'UNPARSABLE_SCORE';
|
|
2042
|
-
}
|
|
2043
|
-
/**
|
|
2044
|
-
* @public
|
|
2045
|
-
* @category 게임센터
|
|
2046
|
-
* @name submitGameCenterLeaderBoardScore
|
|
2047
|
-
* @description
|
|
2048
|
-
* 사용자의 게임 점수를 토스게임센터 리더보드에 제출해요. 이 기능으로 사용자의 점수를 공식 리더보드에 기록하고 다른 사용자와 비교할 수 있어요.
|
|
2049
|
-
* @param {string} params.score
|
|
2050
|
-
* 제출할 게임 점수예요. 실수 형태의 숫자를 문자열로 전달해야 해요. 예를들어 `"123.45"` 또는 `"9999"` 예요.
|
|
2051
|
-
* @returns {Promise<SubmitGameCenterLeaderBoardScoreResponse | undefined>}
|
|
2052
|
-
* 점수 제출 결과를 반환해요. 앱 버전이 최소 지원 버전보다 낮으면 아무 동작도 하지 않고 `undefined`를 반환해요.
|
|
2053
|
-
*
|
|
2054
|
-
* @example
|
|
2055
|
-
* ### 게임 점수를 토스게임센터 리더보드에 제출하기
|
|
2056
|
-
* ```tsx
|
|
2057
|
-
* import { Button } from 'react-native';
|
|
2058
|
-
* import { submitGameCenterLeaderBoardScore } from '@apps-in-toss/framework';
|
|
2059
|
-
*
|
|
2060
|
-
* function GameCenterLeaderBoardScoreSubmitButton() {
|
|
2061
|
-
* async function handlePress() {
|
|
2062
|
-
* try {
|
|
2063
|
-
* const result = await submitGameCenterLeaderBoardScore({ score: '123.45' });
|
|
2064
|
-
*
|
|
2065
|
-
* if (!result) {
|
|
2066
|
-
* console.warn('지원하지 않는 앱 버전이에요.');
|
|
2067
|
-
* return;
|
|
2068
|
-
* }
|
|
2069
|
-
*
|
|
2070
|
-
* if (result.statusCode === 'SUCCESS') {
|
|
2071
|
-
* console.log('점수 제출 성공!');
|
|
2072
|
-
* } else {
|
|
2073
|
-
* console.error('점수 제출 실패:', result.statusCode);
|
|
2074
|
-
* }
|
|
2075
|
-
* } catch (error) {
|
|
2076
|
-
* console.error('점수 제출 중 오류가 발생했어요.', error);
|
|
2077
|
-
* }
|
|
2078
|
-
* }
|
|
2079
|
-
*
|
|
2080
|
-
* return (
|
|
2081
|
-
* <Button onPress={handlePress}>점수 제출하기</Button>
|
|
2082
|
-
* );
|
|
2083
|
-
* }
|
|
2084
|
-
* ```
|
|
2085
|
-
*/
|
|
2086
|
-
declare function submitGameCenterLeaderBoardScore(params: {
|
|
2087
|
-
score: string;
|
|
2088
|
-
}): Promise<SubmitGameCenterLeaderBoardScoreResponse | undefined>;
|
|
2089
|
-
|
|
2090
|
-
/**
|
|
2091
|
-
* @public
|
|
2092
|
-
* @category 친구초대
|
|
2093
|
-
* @name RewardFromContactsViralEvent
|
|
2094
|
-
* @description 친구에게 공유하기를 완료했을 때 지급할 리워드 정보를 담는 타입이에요. 이 타입을 사용하면 공유가 완료됐을 때 지급할 리워드 정보를 확인할 수 있어요.
|
|
2095
|
-
* @property {'sendViral'} type - 이벤트의 타입이에요. `'sendViral'`은 사용자가 친구에게 공유를 완료했을 때 돌아와요.
|
|
2096
|
-
* @property {Object} data - 지급할 리워드 관련 정보를 담고 있어요.
|
|
2097
|
-
* @property {number} data.rewardAmount - 지급할 리워드 수량이에요. 앱인토스 콘솔에서 설정한 수량 및 금액 값이에요.
|
|
2098
|
-
* @property {string} data.rewardUnit - 리워드의 단위예요. 앱인토스 콘솔에 설정된 리워드 이름인 '하트', '보석' 등이 리워드 단위예요.
|
|
2099
|
-
*/
|
|
2100
|
-
type RewardFromContactsViralEvent = {
|
|
2101
|
-
type: 'sendViral';
|
|
2102
|
-
data: {
|
|
2103
|
-
rewardAmount: number;
|
|
2104
|
-
rewardUnit: string;
|
|
2105
|
-
};
|
|
2106
|
-
};
|
|
2107
|
-
/**
|
|
2108
|
-
* @public
|
|
2109
|
-
* @category 친구초대
|
|
2110
|
-
* @name SuccessEvent
|
|
2111
|
-
* @description 연락처 공유 모듈이 정상적으로 종료됐을 때 전달되는 이벤트 객체예요. 종료 이유와 함께 리워드 상태 및 남은 친구 수 등 관련 정보를 제공해요.
|
|
2112
|
-
* @property {'close'} type - 이벤트의 타입이에요. `'close'`는 공유 모듈이 종료됐을 때 돌아와요.
|
|
2113
|
-
* @property {Object} data - 모듈 종료와 관련된 세부 정보를 담고 있어요.
|
|
2114
|
-
* @property {'clickBackButton' | 'noReward'} data.closeReason - 모듈이 종료된 이유예요. `'clickBackButton'`은 사용자가 뒤로 가기 버튼을 눌러 종료한 경우이고, `'noReward'`는 받을 수 있는 리워드가 없어서 종료된 경우예요.
|
|
2115
|
-
* @property {number} data.sentRewardAmount - 사용자가 받은 전체 리워드 수량이에요.
|
|
2116
|
-
* @property {number} data.sendableRewardsCount - 아직 공유할 수 있는 친구 수예요.
|
|
2117
|
-
* @property {number} data.sentRewardsCount - 사용자가 공유를 완료한 친구 수예요.
|
|
2118
|
-
* @property {string} data.rewardUnit - 리워드의 단위예요. 앱인토스 콘솔에 설정된 리워드 이름인 '하트', '보석' 등이 리워드 단위예요.
|
|
2119
|
-
*/
|
|
2120
|
-
type ContactsViralSuccessEvent = {
|
|
2121
|
-
type: 'close';
|
|
2122
|
-
data: {
|
|
2123
|
-
closeReason: 'clickBackButton' | 'noReward';
|
|
2124
|
-
sentRewardAmount?: number;
|
|
2125
|
-
sendableRewardsCount?: number;
|
|
2126
|
-
sentRewardsCount: number;
|
|
2127
|
-
rewardUnit?: string;
|
|
2128
|
-
};
|
|
2129
|
-
};
|
|
2130
|
-
type ContactsViralEvent = RewardFromContactsViralEvent | ContactsViralSuccessEvent;
|
|
2131
|
-
/**
|
|
2132
|
-
* @public
|
|
2133
|
-
* @category 친구초대
|
|
2134
|
-
* @name ContactsViralOption
|
|
2135
|
-
* @description [연락처 공유 기능](/bedrock/reference/framework/친구초대/contactsViral.html)을 사용할 때 필요한 옵션이에요.
|
|
2136
|
-
* @property {string} moduleId - 공유 리워드를 구분하는 UUID 형식의 고유 ID예요. 앱인토스 콘솔의 미니앱 > 공유 리워드 메뉴에서 확인할 수 있어요.
|
|
2137
|
-
*/
|
|
2138
|
-
type ContactsViralOption = {
|
|
2139
|
-
moduleId: string;
|
|
2140
|
-
};
|
|
2141
|
-
/**
|
|
2142
|
-
* @public
|
|
2143
|
-
* @category 친구초대
|
|
2144
|
-
* @description `ContactsViralParams`는 연락처 공유 기능을 사용할 때 전달해야 하는 파라미터 타입이에요. 옵션을 설정하고, 이벤트 및 에러 처리 콜백을 지정할 수 있어요.
|
|
2145
|
-
* @property {ContactsViralOption} options - 공유 기능에 사용할 옵션 객체예요.
|
|
2146
|
-
* @property {(event: ContactsViralEvent) => void} onEvent - 공유 이벤트가 발생했을 때 실행되는 함수예요. [`RewardFromContactsViralEvent`](/bedrock/reference/framework/친구초대/RewardFromContactsViralEvent.html) 또는 [`ContactsViralSuccessEvent`](/bedrock/reference/framework/친구초대/ContactsViralSuccessEvent.html) 타입의 이벤트 객체가 전달돼요.
|
|
2147
|
-
* @property {(error: unknown) => void} onError - 예기치 않은 에러가 발생했을 때 실행되는 함수예요.
|
|
2148
|
-
*/
|
|
2149
|
-
interface ContactsViralParams {
|
|
2150
|
-
options: ContactsViralOption;
|
|
2151
|
-
onEvent: (event: ContactsViralEvent) => void;
|
|
2152
|
-
onError: (error: unknown) => void;
|
|
2153
|
-
}
|
|
2154
|
-
/**
|
|
2155
|
-
* @public
|
|
2156
|
-
* @category 친구초대
|
|
2157
|
-
* @name contactsViral
|
|
2158
|
-
* @description 친구에게 공유하고 리워드를 받을 수 있는 기능을 제공해요. 사용자가 친구에게 공유를 완료하면 앱브릿지가 이벤트를 통해 리워드 정보를 전달해요.
|
|
2159
|
-
* @param {ContactsViralParams} params - 연락처 공유 기능을 실행할 때 사용하는 파라미터예요. 옵션 설정과 이벤트 핸들러를 포함해요. 자세한 내용은 [ContactsViralParams](/bedrock/reference/framework/친구초대/ContactsViralParams.html) 문서를 참고하세요.
|
|
2160
|
-
* @returns {() => void} 앱브릿지 cleanup 함수를 반환해요. 공유 기능이 끝나면 반드시 이 함수를 호출해서 리소스를 해제해야 해요.
|
|
2161
|
-
*
|
|
2162
|
-
* @example
|
|
2163
|
-
* ### 친구에게 공유하고 리워드 받기
|
|
2164
|
-
*
|
|
2165
|
-
* ```tsx
|
|
2166
|
-
* import { useCallback } from 'react';
|
|
2167
|
-
* import { Button } from 'react-native';
|
|
2168
|
-
* import { contactsViral } from '@apps-in-toss/framework';
|
|
2169
|
-
*
|
|
2170
|
-
* function ContactsViralButton({ moduleId }: { moduleId: string }) {
|
|
2171
|
-
* const handleContactsViral = useCallback(() => {
|
|
2172
|
-
* try {
|
|
2173
|
-
* const cleanup = contactsViral({
|
|
2174
|
-
* options: { moduleId: moduleId.trim() },
|
|
2175
|
-
* onEvent: (event) => {
|
|
2176
|
-
* if (event.type === 'sendViral') {
|
|
2177
|
-
* console.log('리워드 지급:', event.data.rewardAmount, event.data.rewardUnit);
|
|
2178
|
-
* } else if (event.type === 'close') {
|
|
2179
|
-
* console.log('모듈 종료:', event.data.closeReason);
|
|
2180
|
-
* }
|
|
2181
|
-
* },
|
|
2182
|
-
* onError: (error) => {
|
|
2183
|
-
* console.error('에러 발생:', error);
|
|
2184
|
-
* },
|
|
2185
|
-
* });
|
|
2186
|
-
*
|
|
2187
|
-
* return cleanup;
|
|
2188
|
-
* } catch (error) {
|
|
2189
|
-
* console.error('실행 중 에러:', error);
|
|
2190
|
-
* }
|
|
2191
|
-
* }, [moduleId]);
|
|
2192
|
-
*
|
|
2193
|
-
* return <Button title="친구에게 공유하고 리워드 받기" onPress={handleContactsViral} />;
|
|
2194
|
-
* }
|
|
2195
|
-
* ```
|
|
2196
|
-
*/
|
|
2197
|
-
declare function contactsViral(params: ContactsViralParams): () => void;
|
|
2198
|
-
|
|
2199
|
-
/**
|
|
2200
|
-
* @public
|
|
2201
|
-
* @category 토스페이
|
|
2202
|
-
* @name TossPay
|
|
2203
|
-
* @description 토스페이 결제 관련 함수를 모아둔 객체예요.
|
|
2204
|
-
* @property {typeof checkoutPayment} [checkoutPayment] 토스페이 결제를 인증하는 함수예요. 자세한 내용은 [checkoutPayment](/react-native/reference/framework/토스페이/checkoutPayment)를 참고하세요.
|
|
2205
|
-
*/
|
|
2206
|
-
declare const TossPay: {
|
|
2207
|
-
checkoutPayment: typeof checkoutPayment;
|
|
2208
|
-
};
|
|
2209
|
-
/**
|
|
2210
|
-
* @public
|
|
2211
|
-
* @category 광고
|
|
2212
|
-
* @name GoogleAdMob
|
|
2213
|
-
* @description Google AdMob 광고 관련 함수를 모아둔 객체예요.
|
|
2214
|
-
* @property {typeof loadAdMobInterstitialAd} [loadAdMobInterstitialAd] 전면 광고를 로드하는 함수예요. 자세한 내용은 [loadAdMobInterstitialAd](/react-native/reference/framework/광고/loadAdMobInterstitialAd.html)를 참고하세요.
|
|
2215
|
-
* @property {typeof showAdMobInterstitialAd} [showAdMobInterstitialAd] 로드한 전면 광고를 보여주는 함수예요. 자세한 내용은 [showAdMobInterstitialAd](/react-native/reference/framework/광고/showAdMobInterstitialAd.html)를 참고하세요.
|
|
2216
|
-
* @property {typeof loadAdMobRewardedAd} [loadAdMobRewardedAd] 보상형 광고를 로드하는 함수예요. 자세한 내용은 [loadAdMobRewardedAd](/react-native/reference/framework/광고/loadAdMobRewardedAd.html)를 참고하세요.
|
|
2217
|
-
* @property {typeof showAdMobRewardedAd} [showAdMobRewardedAd] 로드한 보상형 광고를 보여주는 함수예요. 자세한 내용은 [showAdMobRewardedAd](/react-native/reference/framework/광고/showAdMobRewardedAd.html)를 참고하세요.
|
|
2218
|
-
*/
|
|
2219
|
-
declare const GoogleAdMob: {
|
|
2220
|
-
loadAdMobInterstitialAd: typeof loadAdMobInterstitialAd;
|
|
2221
|
-
showAdMobInterstitialAd: typeof showAdMobInterstitialAd;
|
|
2222
|
-
loadAdMobRewardedAd: typeof loadAdMobRewardedAd;
|
|
2223
|
-
showAdMobRewardedAd: typeof showAdMobRewardedAd;
|
|
2224
|
-
};
|
|
2225
|
-
|
|
2226
27
|
type GameWebViewProps$1 = WebViewProps$1;
|
|
2227
28
|
|
|
2228
29
|
type WebViewProps = PartnerWebViewProps | ExternalWebViewProps | GameWebViewProps;
|
|
@@ -2255,7 +56,7 @@ declare function useCreateUserAgent({ batteryModePreference, colorPreference, lo
|
|
|
2255
56
|
safeAreaBottomTransparency?: string;
|
|
2256
57
|
}): string;
|
|
2257
58
|
|
|
2258
|
-
type UseGeolocationOptions = Omit<StartUpdateLocationOptions
|
|
59
|
+
type UseGeolocationOptions = Omit<StartUpdateLocationOptions, 'callback'>;
|
|
2259
60
|
/**
|
|
2260
61
|
* @public
|
|
2261
62
|
* @category 위치 정보
|
|
@@ -2305,69 +106,6 @@ declare const env: {
|
|
|
2305
106
|
getDeploymentId: () => string | undefined;
|
|
2306
107
|
};
|
|
2307
108
|
|
|
2308
|
-
declare class EntryMessageExitedEvent extends BedrockEventDefinition<undefined, undefined> {
|
|
2309
|
-
name: "entryMessageExited";
|
|
2310
|
-
remove(): void;
|
|
2311
|
-
listener(_: undefined): void;
|
|
2312
|
-
}
|
|
2313
|
-
|
|
2314
|
-
interface StartUpdateLocationOptions {
|
|
2315
|
-
/**
|
|
2316
|
-
* 위치 정확도를 설정해요.
|
|
2317
|
-
*/
|
|
2318
|
-
accuracy: Accuracy;
|
|
2319
|
-
/**
|
|
2320
|
-
* 위치 업데이트 주기를 밀리초(ms) 단위로 설정해요.
|
|
2321
|
-
*/
|
|
2322
|
-
timeInterval: number;
|
|
2323
|
-
/**
|
|
2324
|
-
* 위치 변경 거리를 미터(m) 단위로 설정해요.
|
|
2325
|
-
*/
|
|
2326
|
-
distanceInterval: number;
|
|
2327
|
-
}
|
|
2328
|
-
declare class UpdateLocationEvent extends BedrockEventDefinition<StartUpdateLocationOptions, Location> {
|
|
2329
|
-
name: "updateLocationEvent";
|
|
2330
|
-
subscriptionCount: number;
|
|
2331
|
-
ref: {
|
|
2332
|
-
remove: () => void;
|
|
2333
|
-
};
|
|
2334
|
-
remove(): void;
|
|
2335
|
-
listener(options: StartUpdateLocationOptions, onEvent: (response: Location) => void, onError: (error: unknown) => void): void;
|
|
2336
|
-
}
|
|
2337
|
-
|
|
2338
|
-
interface AppBridgeCallbackResult {
|
|
2339
|
-
name: string;
|
|
2340
|
-
params?: any;
|
|
2341
|
-
}
|
|
2342
|
-
declare class AppBridgeCallbackEvent extends BedrockEventDefinition<void, AppBridgeCallbackResult> {
|
|
2343
|
-
private static INTERNAL__appBridgeSubscription?;
|
|
2344
|
-
name: "appBridgeCallbackEvent";
|
|
2345
|
-
constructor();
|
|
2346
|
-
remove(): void;
|
|
2347
|
-
listener(): void;
|
|
2348
|
-
private registerAppBridgeCallbackEventListener;
|
|
2349
|
-
private ensureInvokeAppBridgeCallback;
|
|
2350
|
-
}
|
|
2351
|
-
|
|
2352
|
-
interface VisibilityChangedByTransparentServiceWebOptions {
|
|
2353
|
-
callbackId: string;
|
|
2354
|
-
}
|
|
2355
|
-
declare class VisibilityChangedByTransparentServiceWebEvent extends BedrockEventDefinition<VisibilityChangedByTransparentServiceWebOptions, boolean> {
|
|
2356
|
-
name: "onVisibilityChangedByTransparentServiceWeb";
|
|
2357
|
-
subscription: EmitterSubscription | null;
|
|
2358
|
-
remove(): void;
|
|
2359
|
-
listener(options: VisibilityChangedByTransparentServiceWebOptions, onEvent: (isVisible: boolean) => void, onError: (error: unknown) => void): void;
|
|
2360
|
-
private isVisibilityChangedByTransparentServiceWebResult;
|
|
2361
|
-
}
|
|
2362
|
-
|
|
2363
|
-
declare const appsInTossEvent: BedrockEvent<EntryMessageExitedEvent | VisibilityChangedByTransparentServiceWebEvent | UpdateLocationEvent | AppBridgeCallbackEvent>;
|
|
2364
|
-
|
|
2365
|
-
declare function onVisibilityChangedByTransparentServiceWeb(eventParams: {
|
|
2366
|
-
options: VisibilityChangedByTransparentServiceWebOptions;
|
|
2367
|
-
onEvent: (isVisible: boolean) => void;
|
|
2368
|
-
onError: (error: unknown) => void;
|
|
2369
|
-
}): () => void;
|
|
2370
|
-
|
|
2371
109
|
declare const INTERNAL__onVisibilityChangedByTransparentServiceWeb: typeof onVisibilityChangedByTransparentServiceWeb;
|
|
2372
110
|
|
|
2373
111
|
declare const Analytics: {
|
|
@@ -2377,4 +115,4 @@ declare const Analytics: {
|
|
|
2377
115
|
Area: ({ children, params: _params, ...props }: _apps_in_toss_analytics.LoggingAreaProps) => react_jsx_runtime.JSX.Element;
|
|
2378
116
|
};
|
|
2379
117
|
|
|
2380
|
-
export {
|
|
118
|
+
export { Analytics, AppsInToss, type ExternalWebViewProps, type GameWebViewProps, INTERNAL__onVisibilityChangedByTransparentServiceWeb, type PartnerWebViewProps, type UseGeolocationOptions, WebView, type WebViewProps, env, useCreateUserAgent, useGeolocation };
|