@apps-in-toss/web-bridge 0.0.0-dev.1752115036458 → 0.0.0-dev.1753241576118

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/build/bridge.d.ts +30 -0
  2. package/build/bridge.js +1 -0
  3. package/{built → build}/closeView.d.ts +1 -1
  4. package/{built → build}/fetchContacts.d.ts +22 -20
  5. package/{built → build}/generateHapticFeedback.d.ts +2 -2
  6. package/{built → build}/getCurrentLocation.d.ts +8 -2
  7. package/build/getGameCenterGameProfile.d.ts +57 -0
  8. package/{built → build}/getLocale.d.ts +1 -1
  9. package/{built → build}/getNetworkStatus.d.ts +1 -1
  10. package/{built → build}/getPlatformOS.d.ts +1 -1
  11. package/{built → build}/getSchemeUri.d.ts +1 -1
  12. package/{built → build}/index.d.ts +101 -7
  13. package/{built → build}/index.js +60 -4
  14. package/build/openGameCenterLeaderboard.d.ts +25 -0
  15. package/{built → build}/openURL.d.ts +1 -1
  16. package/{built → build}/setIosSwipeGestureEnabled.d.ts +1 -1
  17. package/{built → build}/setScreenAwakeMode.d.ts +2 -2
  18. package/{built → build}/setSecureScreen.d.ts +1 -1
  19. package/{built → build}/share.d.ts +1 -1
  20. package/{built → build}/startUpdateLocation.d.ts +9 -3
  21. package/build/submitGameCenterLeaderBoardScore.d.ts +64 -0
  22. package/package.json +15 -15
  23. package/built/bridge.d.ts +0 -27
  24. package/built/bridge.js +0 -1
  25. /package/{built → build}/appLogin.d.ts +0 -0
  26. /package/{built → build}/checkoutPayment.d.ts +0 -0
  27. /package/{built → build}/eventLog.d.ts +0 -0
  28. /package/{built → build}/fetchAlbumPhotos.d.ts +0 -0
  29. /package/{built → build}/getClipboardText.d.ts +0 -0
  30. /package/{built → build}/getDeviceId.d.ts +0 -0
  31. /package/{built → build}/getOperationalEnvironment.d.ts +0 -0
  32. /package/{built → build}/getTossAppVersion.d.ts +0 -0
  33. /package/{built → build}/getTossShareLink.d.ts +0 -0
  34. /package/{built → build}/openCamera.d.ts +0 -0
  35. /package/{built → build}/saveBase64Data.d.ts +0 -0
  36. /package/{built → build}/setClipboardText.d.ts +0 -0
  37. /package/{built → build}/setDeviceOrientation.d.ts +0 -0
@@ -0,0 +1,30 @@
1
+ export * from './closeView.js';
2
+ export * from './generateHapticFeedback.js';
3
+ export * from './share.js';
4
+ export * from './setSecureScreen.js';
5
+ export * from './setScreenAwakeMode.js';
6
+ export * from './getNetworkStatus.js';
7
+ export * from './setIosSwipeGestureEnabled.js';
8
+ export * from './openURL.js';
9
+ export * from './getLocale.js';
10
+ export * from './getSchemeUri.js';
11
+ export * from './getPlatformOS.js';
12
+ export * from './setClipboardText.js';
13
+ export * from './getClipboardText.js';
14
+ export * from './fetchContacts.js';
15
+ export * from './fetchAlbumPhotos.js';
16
+ export * from './getCurrentLocation.js';
17
+ export * from './openCamera.js';
18
+ export * from './appLogin.js';
19
+ export * from './checkoutPayment.js';
20
+ export * from './eventLog.js';
21
+ export * from './getTossShareLink.js';
22
+ export * from './setDeviceOrientation.js';
23
+ export * from './saveBase64Data.js';
24
+ export * from './getGameCenterGameProfile.js';
25
+ export * from './getOperationalEnvironment.js';
26
+ export * from './openGameCenterLeaderboard.js';
27
+ export * from './submitGameCenterLeaderBoardScore.js';
28
+ export * from './getTossAppVersion.js';
29
+ export * from './getDeviceId.js';
30
+ export * from './startUpdateLocation.js';
@@ -0,0 +1 @@
1
+ import{createAsyncBridge,createConstantBridge,createEventBridge}from"@apps-in-toss/bridge-core";var createEvents=function(){return{emit:function emit(event,args){for(var callbacks=this.events[event]||[],i=0,length=callbacks.length;i<length;i++){callbacks[i](args)}},events:{},on:function on(event,cb){var _this=this;var _this_events,_event;((_this_events=this.events)[_event=event]||(_this_events[_event]=[])).push(cb);return function(){var _this_events_event;_this.events[event]=(_this_events_event=_this.events[event])===null||_this_events_event===void 0?void 0:_this_events_event.filter(function(i){return cb!==i})}}}};if(typeof window!=="undefined"){window.__BEDROCK_NATIVE_EMITTER=createEvents()}export var closeView=createAsyncBridge("closeView");export var generateHapticFeedback=createAsyncBridge("generateHapticFeedback");export var share=createAsyncBridge("share");export var setSecureScreen=createAsyncBridge("setSecureScreen");export var setScreenAwakeMode=createAsyncBridge("setScreenAwakeMode");export var getNetworkStatus=createAsyncBridge("getNetworkStatus");export var setIosSwipeGestureEnabled=createAsyncBridge("setIosSwipeGestureEnabled");export var openURL=createAsyncBridge("openURL");export var getLocale=createConstantBridge("getLocale");export var getSchemeUri=createConstantBridge("getSchemeUri");export var getPlatformOS=createConstantBridge("getPlatformOS");export var setClipboardText=createAsyncBridge("setClipboardText");export var getClipboardText=createAsyncBridge("getClipboardText");export var fetchContacts=createAsyncBridge("fetchContacts");export var fetchAlbumPhotos=createAsyncBridge("fetchAlbumPhotos");export var Accuracy=function(Accuracy){Accuracy[Accuracy["Lowest"]=1]="Lowest";Accuracy[Accuracy["Low"]=2]="Low";Accuracy[Accuracy["Balanced"]=3]="Balanced";Accuracy[Accuracy["High"]=4]="High";Accuracy[Accuracy["Highest"]=5]="Highest";Accuracy[Accuracy["BestForNavigation"]=6]="BestForNavigation";return Accuracy}({});export var getCurrentLocation=createAsyncBridge("getCurrentLocation");export var openCamera=createAsyncBridge("openCamera");export var appLogin=createAsyncBridge("appLogin");export var checkoutPayment=createAsyncBridge("checkoutPayment");export var eventLog=createAsyncBridge("eventLog");export var getTossShareLink=createAsyncBridge("getTossShareLink");export var setDeviceOrientation=createAsyncBridge("setDeviceOrientation");export var saveBase64Data=createAsyncBridge("saveBase64Data");export var getGameCenterGameProfile=createAsyncBridge("getGameCenterGameProfile");export var getOperationalEnvironment=createConstantBridge("getOperationalEnvironment");export var openGameCenterLeaderboard=createAsyncBridge("openGameCenterLeaderboard");export var submitGameCenterLeaderBoardScore=createAsyncBridge("submitGameCenterLeaderBoardScore");export var getTossAppVersion=createConstantBridge("getTossAppVersion");export var getDeviceId=createConstantBridge("getDeviceId");export var startUpdateLocation=createEventBridge("startUpdateLocation");
@@ -11,7 +11,7 @@
11
11
  *
12
12
  * ```tsx
13
13
  *
14
- * import { closeView } from 'react-native-bedrock';
14
+ * import { closeView } from '@apps-in-toss/web-framework';
15
15
  *
16
16
  * function CloseButton() {
17
17
  * return <input type="button" value="닫기" onClick={closeView} />;
@@ -7,22 +7,16 @@ export interface ContactEntity {
7
7
  /** 연락처 전화번호로, 문자열 형식이에요. */
8
8
  phoneNumber: string;
9
9
  }
10
- export interface ContactResult {
11
- result: ContactEntity[];
12
- nextOffset: number | null;
13
- done: boolean;
14
- }
15
10
  /**
16
11
  * @public
17
12
  * @category 연락처
18
13
  * @name fetchContacts
19
14
  * @description 사용자의 연락처 목록을 페이지 단위로 가져오는 함수예요.
20
- * @param options - 연락처를 가져올 지정하는 옵션 객체예요.
21
- * @param options.size - 번에 가져올 연락처 개수예요. 예를 들어, 10을 전달하면 최대 10개의 연락처를 가져와요.
22
- * @param options.offset - 가져올 연락처의 시작 지점이에요. 처음 호출할 때는 `0`을 전달해야 해요. 이후에는 이전 호출에서 반환된 `nextOffset` 값을 사용해요.
23
- * @param options.query - 추가적인 필터링 옵션이에요.
24
- * @param options.query.contains - 이름에 특정 문자열이 포함된 연락처만 가져오고 싶을 사용해요. 값을 전달하지 않으면 모든 연락처를 가져와요.
25
- * @returns {Promise<ContactResult>}
15
+ * @param size - 번에 가져올 연락처 개수예요. 예를 들어, 10을 전달하면 최대 10개의 연락처를 가져와요.
16
+ * @param offset - 가져올 연락처의 시작 지점이에요. 처음 호출할 때는 `0`을 전달해야 해요. 이후에는 이전 호출에서 반환된 `nextOffset` 값을 사용해요.
17
+ * @param query - 추가적인 필터링 옵션이에요.
18
+ * @param query.contains - 이름에 특정 문자열이 포함된 연락처만 가져오고 싶을 때 사용해요. 이 값을 전달하지 않으면 모든 연락처를 가져와요.
19
+ * @returns {Promise<{result: { name: string; phoneNumber: string }[]; nextOffset: number | null; done: boolean}>}
26
20
  * 연락처 목록과 페이지네이션 정보를 포함한 객체를 반환해요.
27
21
  * - `result`: 가져온 연락처 목록이에요.
28
22
  * - `nextOffset`: 다음 호출에 사용할 오프셋 값이에요. 더 가져올 연락처가 없으면 `null`이에요.
@@ -30,13 +24,17 @@ export interface ContactResult {
30
24
  *
31
25
  * @signature
32
26
  * ```typescript
33
- * function fetchContacts(options: {
34
- * size: number;
35
- * offset: number;
36
- * query?: {
37
- * contains?: string;
38
- * };
39
- * }): Promise<ContactResult>;
27
+ * function fetchContacts({ size, offset, query }: {
28
+ * size: number;
29
+ * offset: number;
30
+ * query?: {
31
+ * contains?: string;
32
+ * };
33
+ * }): Promise<{
34
+ * result: ContactEntity[];
35
+ * nextOffset: number | null;
36
+ * done: boolean;
37
+ * }>;
40
38
  * ```
41
39
  *
42
40
  * @example
@@ -96,12 +94,16 @@ export interface ContactResult {
96
94
  * }
97
95
  * ```
98
96
  */
99
- export declare function fetchContacts(options: {
97
+ export declare function fetchContacts({ size, offset, query, }: {
100
98
  size: number;
101
99
  offset: number;
102
100
  query?: {
103
101
  contains?: string;
104
102
  };
105
- }): Promise<ContactResult>;
103
+ }): Promise<{
104
+ result: ContactEntity[];
105
+ nextOffset: number | null;
106
+ done: boolean;
107
+ }>;
106
108
 
107
109
  export {};
@@ -29,7 +29,7 @@ export interface HapticFeedbackOptions {
29
29
  * @public
30
30
  * @category 인터렉션
31
31
  * @name generateHapticFeedback
32
- * @description 디바이스에 햅틱 진동을 일으키는 함수예요. 예를 들어, 버튼 터치나 화면전환에 드라마틱한 효과를 주고 싶을 때 사용할 수 있어요. [HapticFeedbackOptions](/react-native/reference/native-modules/인터렉션/HapticFeedbackOptions.html)에서 진동타입을 확인해 보세요.
32
+ * @description 디바이스에 햅틱 진동을 일으키는 함수예요. 예를 들어, 버튼 터치나 화면전환에 드라마틱한 효과를 주고 싶을 때 사용할 수 있어요. [HapticFeedbackOptions](/react-native/reference/@apps-in-toss/web-framework/인터렉션/HapticFeedbackOptions.html)에서 진동타입을 확인해 보세요.
33
33
  * @returns {void}
34
34
  *
35
35
  * @example
@@ -37,7 +37,7 @@ export interface HapticFeedbackOptions {
37
37
  *
38
38
  * ```tsx
39
39
  *
40
- * import { generateHapticFeedback } from 'react-native-bedrock';
40
+ * import { generateHapticFeedback } from '@apps-in-toss/web-framework';
41
41
  *
42
42
  * function GenerateHapticFeedback() {
43
43
  * return <input type="button" value="햅틱" onClick={() => { generateHapticFeedback( { type: "tickWeak"}) }} />;
@@ -30,7 +30,13 @@ export declare enum Accuracy {
30
30
  */
31
31
  BestForNavigation = 6
32
32
  }
33
- interface Location$1 {
33
+ /**
34
+ * @public
35
+ * @category 위치 정보
36
+ * @name Location
37
+ * @description 위치 정보를 나타내는 객체예요.
38
+ */
39
+ export interface Location {
34
40
  /**
35
41
  * Android에서만 지원하는 옵션이에요.
36
42
  *
@@ -133,6 +139,6 @@ export interface GetCurrentLocationOptions {
133
139
  * }
134
140
  * ```
135
141
  */
136
- export declare function getCurrentLocation(options: GetCurrentLocationOptions): Promise<Location$1>;
142
+ export declare function getCurrentLocation(options: GetCurrentLocationOptions): Promise<Location>;
137
143
 
138
144
  export {};
@@ -0,0 +1,57 @@
1
+ /**
2
+ * @category 게임센터
3
+ * @name GameCenterGameProfileResponse
4
+ * @description 토스게임센터 프로필을 가져온 결과 타입이에요.
5
+ * 앱에 프로필이 없는 경우, `statusCode`가 `'PROFILE_NOT_FOUND'`이고 다른 정보는 없어요.
6
+ * 프로필이 있는 경우 `statusCode`가 `'SUCCESS'`이고, 닉네임과 프로필 이미지 주소가 함께 제공돼요.
7
+ * @property {string} statusCode 프로필 조회 결과 상태예요. `'SUCCESS'` 또는 `'PROFILE_NOT_FOUND'` 중 하나예요.
8
+ * @property {string} [nickname] 프로필 닉네임이에요. `statusCode`가 `'SUCCESS'`일 때만 있어요.
9
+ * @property {string} [profileImageUri] 프로필 이미지 URL이에요. `statusCode`가 `'SUCCESS'`일 때만 있어요.
10
+ */
11
+ export type GameCenterGameProfileResponse = {
12
+ statusCode: "PROFILE_NOT_FOUND";
13
+ } | {
14
+ statusCode: "SUCCESS";
15
+ nickname: string;
16
+ profileImageUri: string;
17
+ };
18
+ /**
19
+ * @category 게임센터
20
+ * @name getGameCenterGameProfile
21
+ * @description 토스게임센터 프로필 정보를 가져와요.
22
+ * 사용자가 프로필을 만들지 않았다면 `statusCode`가 `'PROFILE_NOT_FOUND'`인 응답이 반환돼요.
23
+ * 앱 버전이 최소 지원 버전(안드로이드 5.221.0, iOS 5.221.0)보다 낮으면 `undefined`를 반환해요.
24
+ * @returns {Promise<GameCenterGameProfileResponse | undefined>} 프로필 정보 또는 `undefined`를 반환해요.
25
+ *
26
+ * @example
27
+ * ### 게임센터 프로필 가져오기
28
+ * ```tsx
29
+ * import { getGameCenterGameProfile } from './getGameCenterGameProfile';
30
+ * import { useState } from 'react';
31
+ *
32
+ *
33
+ * function GameProfile() {
34
+ * const [profile, setProfile] = useState<GameCenterGameProfileResponse | null>(null);
35
+ *
36
+ * const handlePress = async () => {
37
+ * try {
38
+ * const result = await getGameCenterGameProfile();
39
+ * if (result) {
40
+ * setProfile(result);
41
+ * }
42
+ * } catch (error) {
43
+ * console.error('게임센터 프로필 가져오기에 실패했어요.', error);
44
+ * }
45
+ * };
46
+ *
47
+ * return (
48
+ * <div>
49
+ * <input type="button" value="게임센터 프로필 가져오기" onClick={handlePress} />
50
+ * </div>
51
+ * );
52
+ * }
53
+ * ```
54
+ */
55
+ export declare function getGameCenterGameProfile(): Promise<GameCenterGameProfileResponse | undefined>;
56
+
57
+ export {};
@@ -12,7 +12,7 @@
12
12
  * ### 현재 사용자의 로케일 정보 가져오기
13
13
  *
14
14
  * ```tsx
15
- * import { getLocale } from 'react-native-bedrock';
15
+ * import { getLocale } from '@apps-in-toss/web-framework';
16
16
  *
17
17
  *
18
18
  * function MyPage() {
@@ -27,7 +27,7 @@ export type NetworkStatus = "OFFLINE" | "WIFI" | "2G" | "3G" | "4G" | "5G" | "WW
27
27
  * ```tsx
28
28
  * import { useState, useEffect } from 'react';
29
29
  *
30
- * import { getNetworkStatus, NetworkStatus } from 'react-native-bedrock';
30
+ * import { getNetworkStatus, NetworkStatus } from '@apps-in-toss/web-framework';
31
31
  *
32
32
  * function GetNetworkStatus() {
33
33
  * const [status, setStatus] = useState<NetworkStatus | ''>('');
@@ -20,7 +20,7 @@
20
20
  * ### 현재 실행중인 OS 플랫폼 확인하기
21
21
  *
22
22
  * ```tsx
23
- * import { getPlatformOS } from 'react-native-bedrock';
23
+ * import { getPlatformOS } from '@apps-in-toss/web-framework';
24
24
  * import { Text } 'react-native';
25
25
  *
26
26
  * function Page() {
@@ -10,7 +10,7 @@
10
10
  * ### 처음 진입한 스킴 값 가져오기
11
11
  *
12
12
  * ```tsx
13
- * import { getSchemeUri } from 'react-native-bedrock';
13
+ * import { getSchemeUri } from '@apps-in-toss/web-framework';
14
14
  *
15
15
  *
16
16
  * function MyPage() {
@@ -82,6 +82,91 @@ declare const Storage: {
82
82
  clearItems: (args_0: void) => Promise<void>;
83
83
  };
84
84
 
85
+ /**
86
+ * @public
87
+ * @category 인앱결제
88
+ * @name IapCreateOneTimePurchaseOrderResult
89
+ * @description 인앱결제 1건이 완료되면 결제 세부 정보와 상품 정보를 담아 반환해요. 반환된 정보로 결제한 상품의 정보를 화면에 표시할 수 있어요.
90
+ * @property {string | null} miniAppIconUrl - 미니앱 아이콘 이미지의 URL이에요. 아이콘은 앱인토스 콘솔에서 설정한 이미지예요. 콘솔에서 아이콘을 등록하지 않았다면 `null`로 반환돼요.
91
+ * @property {string} displayName - 화면에 표시할 상품 이름이에요.
92
+ * @property {string} displayAmount - 통화 단위가 포함된 가격 정보예요. 예를 들어 `1,000원`으로 가격과 통화가 함께 표시돼요.
93
+ * @property {number} amount - 상품 가격 숫자 값이에요. 화폐 단위와 쉼표를 제외한 순수 숫자예요. 예를 들어 `1000`으로 표시돼요.
94
+ * @property {string} currency - [ISO 4217 표준](https://ko.wikipedia.org/wiki/ISO_4217)에 따른 상품 가격 통화 단위예요. 예를 들어 원화는 `KRW`, 달러는 `USD`로 표시돼요.
95
+ * @property {number} fraction - 가격을 표시할 때 소수점 아래 몇 자리까지 보여줄지 정하는 값이에요. 예를 들어 달러는 소수점 둘째 자리까지 보여줘서 `2`, 원화는 소수점이 필요 없어서 `0`이에요
96
+ */
97
+ interface IapCreateOneTimePurchaseOrderResult {
98
+ miniAppIconUrl: string | null;
99
+ displayName: string;
100
+ displayAmount: string;
101
+ amount: number;
102
+ currency: string;
103
+ fraction: number;
104
+ }
105
+ /**
106
+ * @public
107
+ * @category 인앱결제
108
+ * @name IapProductListItem
109
+ * @description 인앱결제로 구매할 수 있는 상품 하나의 정보를 담은 객체예요. 상품 목록을 화면에 표시할 때 사용해요.
110
+ * @property {string} sku - 상품의 고유 ID예요. [인앱결제 주문서 페이지로 이동할때](/bedrock/reference/framework/인앱결제/createOneTimePurchaseOrder.html) 사용하는 `productId`와 동일한 값이에요.
111
+ * @property {string} displayName - 화면에 표시할 상품 이름이에요. 상품 이름은 앱인토스 콘솔에서 설정한 값이에요.
112
+ * @property {string} displayAmount - 통화 단위가 포함된 가격 정보예요. 예를 들어 `1,000원`으로 가격과 통화가 함께 표시돼요.
113
+ * @property {string} iconUrl - 상품 아이콘 이미지의 URL이에요. 아이콘은 앱인토스 콘솔에서 설정한 이미지예요.
114
+ * @property {string} description - 상품에 대한 설명이에요. 설명은 앱인토스 콘솔에서 설정한 값이에요.
115
+ */
116
+ interface IapProductListItem {
117
+ sku: string;
118
+ displayAmount: string;
119
+ displayName: string;
120
+ iconUrl: string;
121
+ description: string;
122
+ }
123
+ /**
124
+ * @public
125
+ * @category 인앱결제
126
+ * @name iapCreateOneTimePurchaseOrder
127
+ * @description
128
+ * 특정 인앱결제 주문서 페이지로 이동해요. 사용자가 상품 구매 버튼을 누르는 상황 등에 사용할 수 있어요. 사용자의 결제는 이동한 페이지에서 진행돼요. 만약 결제 중에 에러가 발생하면 에러 유형에 따라 에러 페이지로 이동해요.
129
+ * @param {IapCreateOneTimePurchaseOrderOptions} params - 인앱결제를 생성할 때 필요한 정보예요.
130
+ * @param {string} params.productId - 주문할 상품의 ID예요.
131
+ * @returns {Promise<IapCreateOneTimePurchaseOrderResult | undefined>} 결제에 성공하면 결제 결과 객체를 반환해요. 앱 버전이 최소 지원 버전(안드로이드 5.219.0, iOS 5.219.0)보다 낮으면 인앱결제를 실행할 수 없어서 `undefined`를 반환해요.
132
+ */
133
+ declare const IAP: {
134
+ /**
135
+ * @public
136
+ * @category 인앱결제
137
+ * @name iapCreateOneTimePurchaseOrder
138
+ * @description
139
+ * 단건 인앱결제 주문서 페이지로 이동해요. 결제는 해당 페이지에서 진행돼요. 주문 중 에러가 발생하면 에러 유형에 따라 에러 페이지로 이동해요.
140
+ * @param {IapCreateOneTimePurchaseOrderOptions} params - 인앱결제를 생성할 때 필요한 정보예요.
141
+ * @param {string} params.productId - 주문할 상품의 ID예요.
142
+ * @returns {Promise<IapCreateOneTimePurchaseOrderResult | undefined>} 결제가 성공하면 결과 객체를 반환해요. 앱 버전이 지원되지 않으면 `undefined`를 반환해요.
143
+ *
144
+ * @throw {code: "INVALID_PRODUCT_ID"} - 유효하지 않은 상품 ID이거나, 해당 상품이 존재하지 않을 때 발생해요.
145
+ * @throw {code: "PAYMENT_PENDING"} - 사용자가 요청한 결제가 아직 승인을 기다리고 있을 때 발생해요.
146
+ * @throw {code: "NETWORK_ERROR"} - 서버 내부 문제로 요청을 처리할 수 없을 때 발생해요.
147
+ * @throw {code: "INVALID_USER_ENVIRONMENT"} - 특정 기기, 계정 또는 설정 환경에서 구매할 수 없는 상품일 때 발생해요.
148
+ * @throw {code: "ITEM_ALREADY_OWNED"} - 사용자가 이미 구매한 상품을 다시 구매하려고 할 때 발생해요.
149
+ * @throw {code: "APP_MARKET_VERIFICATION_FAILED"} - 사용자가 결제를 완료했지만, 앱스토어에서 사용자 정보 검증에 실패했을 때 발생해요. 사용자가 앱스토어에 문의해서 환불을 요청해야해요.
150
+ * @throw {code: "TOSS_SERVER_VERIFICATION_FAILED"} - 사용자가 결제를 완료했지만, 서버 전송에 실패해서 결제 정보를 저장할 수 없을 때 발생해요.
151
+ * @throw {code: "INTERNAL_ERROR"} - 서버 내부 문제로 요청을 처리할 수 없을 때 발생해요.
152
+ * @throw {code: "KOREAN_ACCOUNT_ONLY"} - iOS 환경에서 사용자의 계정이 한국 계정이 아닐 때 발생해요.
153
+ * @throw {code: "USER_CANCELED"} - 사용자가 결제를 완료하지 않고 주문서 페이지를 이탈했을 때 발생해요.
154
+ */
155
+ createOneTimePurchaseOrder: (args_0: {
156
+ productId: string;
157
+ }, args_1: IapCreateOneTimePurchaseOrderResult) => Promise<any>;
158
+ /**
159
+ * @public
160
+ * @category 인앱결제
161
+ * @name iapGetProductItemList
162
+ * @description 인앱결제로 구매할 수 있는 상품 목록을 가져와요. 상품 목록 화면에 진입할 때 호출해요.
163
+ * @returns {Promise<{ products: IapProductListItem[] } | undefined>} 상품 목록을 포함한 객체를 반환해요. 앱 버전이 최소 지원 버전(안드로이드 5.219.0, iOS 5.219.0)보다 낮으면 `undefined`를 반환해요.
164
+ */
165
+ getProductItemList: () => Promise<{
166
+ products: IapProductListItem[];
167
+ }>;
168
+ };
169
+
85
170
  declare function getSafeAreaInsets(): {
86
171
  top: number;
87
172
  bottom: number;
@@ -368,18 +453,18 @@ declare const GoogleAdMob: {
368
453
  };
369
454
  };
370
455
 
371
- type GraniteEvent = {
456
+ type BedrockEvent = {
372
457
  backEvent: {
373
458
  onEvent: () => void;
374
459
  onError?: (error: Error) => void;
375
460
  options?: void;
376
461
  };
377
462
  };
378
- declare const graniteEvent: {
379
- addEventListener: <K extends keyof GraniteEvent>(event: K, { onEvent, onError, options, }: {
380
- onEvent: GraniteEvent[K]["onEvent"];
381
- onError?: GraniteEvent[K]["onError"];
382
- options?: GraniteEvent[K]["options"];
463
+ declare const bedrockEvent: {
464
+ addEventListener: <K extends keyof BedrockEvent>(event: K, { onEvent, onError, options, }: {
465
+ onEvent: BedrockEvent[K]["onEvent"];
466
+ onError?: BedrockEvent[K]["onError"];
467
+ options?: BedrockEvent[K]["options"];
383
468
  }) => () => void;
384
469
  };
385
470
 
@@ -445,4 +530,13 @@ declare const env: {
445
530
  getDeploymentId: () => string;
446
531
  };
447
532
 
448
- export { type AppsInTossEvent, GoogleAdMob, type GraniteEvent, Storage, appsInTossEvent, env, getSafeAreaInsets, graniteEvent, isMinVersionSupported };
533
+ interface AppsInTossGlobals {
534
+ deploymentId: string;
535
+ brandDisplayName: string;
536
+ brandIcon: string;
537
+ brandPrimaryColor: string;
538
+ brandBridgeColorMode: 'basic' | 'inverted';
539
+ }
540
+ declare const getAppsInTossGlobals: () => AppsInTossGlobals;
541
+
542
+ export { type AppsInTossEvent, type AppsInTossGlobals, type BedrockEvent, GoogleAdMob, IAP, type IapCreateOneTimePurchaseOrderResult, type IapProductListItem, Storage, appsInTossEvent, bedrockEvent, env, getAppsInTossGlobals, getSafeAreaInsets, isMinVersionSupported };
@@ -1,4 +1,4 @@
1
- export * from './bridge.js';
1
+ export * from './bridge.js'
2
2
 
3
3
  // src/index.ts
4
4
  export * from "@apps-in-toss/bridge-core";
@@ -75,6 +75,43 @@ var Storage = {
75
75
  clearItems: createAsyncBridge("clearItems")
76
76
  };
77
77
 
78
+ // src/iap.ts
79
+ import { createAsyncBridge as createAsyncBridge2 } from "@apps-in-toss/bridge-core";
80
+ var IAP = {
81
+ /**
82
+ * @public
83
+ * @category 인앱결제
84
+ * @name iapCreateOneTimePurchaseOrder
85
+ * @description
86
+ * 단건 인앱결제 주문서 페이지로 이동해요. 결제는 해당 페이지에서 진행돼요. 주문 중 에러가 발생하면 에러 유형에 따라 에러 페이지로 이동해요.
87
+ * @param {IapCreateOneTimePurchaseOrderOptions} params - 인앱결제를 생성할 때 필요한 정보예요.
88
+ * @param {string} params.productId - 주문할 상품의 ID예요.
89
+ * @returns {Promise<IapCreateOneTimePurchaseOrderResult | undefined>} 결제가 성공하면 결과 객체를 반환해요. 앱 버전이 지원되지 않으면 `undefined`를 반환해요.
90
+ *
91
+ * @throw {code: "INVALID_PRODUCT_ID"} - 유효하지 않은 상품 ID이거나, 해당 상품이 존재하지 않을 때 발생해요.
92
+ * @throw {code: "PAYMENT_PENDING"} - 사용자가 요청한 결제가 아직 승인을 기다리고 있을 때 발생해요.
93
+ * @throw {code: "NETWORK_ERROR"} - 서버 내부 문제로 요청을 처리할 수 없을 때 발생해요.
94
+ * @throw {code: "INVALID_USER_ENVIRONMENT"} - 특정 기기, 계정 또는 설정 환경에서 구매할 수 없는 상품일 때 발생해요.
95
+ * @throw {code: "ITEM_ALREADY_OWNED"} - 사용자가 이미 구매한 상품을 다시 구매하려고 할 때 발생해요.
96
+ * @throw {code: "APP_MARKET_VERIFICATION_FAILED"} - 사용자가 결제를 완료했지만, 앱스토어에서 사용자 정보 검증에 실패했을 때 발생해요. 사용자가 앱스토어에 문의해서 환불을 요청해야해요.
97
+ * @throw {code: "TOSS_SERVER_VERIFICATION_FAILED"} - 사용자가 결제를 완료했지만, 서버 전송에 실패해서 결제 정보를 저장할 수 없을 때 발생해요.
98
+ * @throw {code: "INTERNAL_ERROR"} - 서버 내부 문제로 요청을 처리할 수 없을 때 발생해요.
99
+ * @throw {code: "KOREAN_ACCOUNT_ONLY"} - iOS 환경에서 사용자의 계정이 한국 계정이 아닐 때 발생해요.
100
+ * @throw {code: "USER_CANCELED"} - 사용자가 결제를 완료하지 않고 주문서 페이지를 이탈했을 때 발생해요.
101
+ */
102
+ createOneTimePurchaseOrder: createAsyncBridge2(
103
+ "iapCreateOneTimePurchaseOrder"
104
+ ),
105
+ /**
106
+ * @public
107
+ * @category 인앱결제
108
+ * @name iapGetProductItemList
109
+ * @description 인앱결제로 구매할 수 있는 상품 목록을 가져와요. 상품 목록 화면에 진입할 때 호출해요.
110
+ * @returns {Promise<{ products: IapProductListItem[] } | undefined>} 상품 목록을 포함한 객체를 반환해요. 앱 버전이 최소 지원 버전(안드로이드 5.219.0, iOS 5.219.0)보다 낮으면 `undefined`를 반환해요.
111
+ */
112
+ getProductItemList: createAsyncBridge2("iapGetProductItemList")
113
+ };
114
+
78
115
  // src/getSafeAreaInsets.ts
79
116
  import { createConstantBridge } from "@apps-in-toss/bridge-core";
80
117
  var getSafeAreaBottom = createConstantBridge("getSafeAreaBottom");
@@ -362,9 +399,9 @@ var GoogleAdMob = {
362
399
  )
363
400
  };
364
401
 
365
- // src/graniteEvent.ts
402
+ // src/bedrockEvent.ts
366
403
  import { createEventBridge as createEventBridge2 } from "@apps-in-toss/bridge-core";
367
- var graniteEvent = {
404
+ var bedrockEvent = {
368
405
  addEventListener: (event, {
369
406
  onEvent,
370
407
  onError,
@@ -488,12 +525,31 @@ import { createConstantBridge as createConstantBridge4 } from "@apps-in-toss/bri
488
525
  var env = {
489
526
  getDeploymentId: createConstantBridge4("getDeploymentId")
490
527
  };
528
+
529
+ // src/global.ts
530
+ import { createConstantBridge as createConstantBridge5 } from "@apps-in-toss/bridge-core";
531
+ var deploymentId = createConstantBridge5("deploymentId");
532
+ var brandDisplayName = createConstantBridge5("brandDisplayName");
533
+ var brandIcon = createConstantBridge5("brandIcon");
534
+ var brandPrimaryColor = createConstantBridge5("brandPrimaryColor");
535
+ var brandBridgeColorMode = createConstantBridge5("brandBridgeColorMode");
536
+ var getAppsInTossGlobals = () => {
537
+ return {
538
+ deploymentId: deploymentId(),
539
+ brandDisplayName: brandDisplayName(),
540
+ brandIcon: brandIcon(),
541
+ brandPrimaryColor: brandPrimaryColor(),
542
+ brandBridgeColorMode: brandBridgeColorMode()
543
+ };
544
+ };
491
545
  export {
492
546
  GoogleAdMob,
547
+ IAP,
493
548
  Storage,
494
549
  appsInTossEvent,
550
+ bedrockEvent,
495
551
  env,
552
+ getAppsInTossGlobals,
496
553
  getSafeAreaInsets,
497
- graniteEvent,
498
554
  isMinVersionSupported
499
555
  };
@@ -0,0 +1,25 @@
1
+ /**
2
+ * @public
3
+ * @category 게임센터
4
+ * @name openGameCenterLeaderboard
5
+ * @description 게임센터 리더보드 웹뷰를 열어요.
6
+ * 앱 버전이 최소 지원 버전(`5.221.0`)보다 낮으면 아무 동작도 하지 않고 `undefined`를 반환해요.
7
+ * 게임센터를 사용하는 사용자는 반드시 최소 지원 버전 이상이어야 게임을 실행할 수 있어요.
8
+ * @returns 리더보드 웹뷰를 호출해요. 앱 버전이 낮으면 아무 동작도 하지 않고 `undefined`를 반환해요.
9
+ *
10
+ * @example
11
+ *
12
+ * import { openGameCenterLeaderboard } from '@apps-in-toss/web-framework';
13
+ *
14
+ * // '리더보드' 버튼을 누르면 게임센터 리더보드 웹뷰가 열려요.
15
+ * function LeaderboardButton() {
16
+ * const onClick = () => {
17
+ * openGameCenterLeaderboard();
18
+ * };
19
+ *
20
+ * return <input type="button" value="리더보드 웹뷰 호출" onClick={onClick} />;
21
+ * }
22
+ */
23
+ export declare function openGameCenterLeaderboard(): Promise<void>;
24
+
25
+ export {};
@@ -21,7 +21,7 @@
21
21
  * ### 외부 URL 열기
22
22
  *
23
23
  * ```tsx
24
- * import { openURL } from 'react-native-bedrock';
24
+ * import { openURL } from '@apps-in-toss/web-framework';
25
25
  *
26
26
  *
27
27
  * function Page() {
@@ -18,7 +18,7 @@
18
18
  *
19
19
  *
20
20
  * ```tsx
21
- * import { setIosSwipeGestureEnabled } from 'react-native-bedrock';
21
+ * import { setIosSwipeGestureEnabled } from '@apps-in-toss/web-framework';
22
22
  *
23
23
  *
24
24
  * function Page() {
@@ -25,7 +25,7 @@
25
25
  *
26
26
  * ```tsx
27
27
  *
28
- * import { setScreenAwakeMode } from 'react-native-bedrock';
28
+ * import { setScreenAwakeMode } from '@apps-in-toss/web-framework';
29
29
  *
30
30
  * function SetScreenAwakeMode() {
31
31
  * return (
@@ -44,7 +44,7 @@
44
44
  *
45
45
  * ```tsx
46
46
  * import { useEffect } from 'react';
47
- * import { setScreenAwakeMode, cleanUp } from 'react-native-bedrock';
47
+ * import { setScreenAwakeMode, cleanUp } from '@apps-in-toss/web-framework';
48
48
  *
49
49
  * function MediaScreen() {
50
50
  * useEffect(() => {
@@ -15,7 +15,7 @@
15
15
  *
16
16
  * ```tsx
17
17
  *
18
- * import { setSecureScreen } from 'react-native-bedrock';
18
+ * import { setSecureScreen } from '@apps-in-toss/web-framework';
19
19
  *
20
20
  * function SetSecureScreen() {
21
21
  * return <input type="button" value="캡쳐 막기" onClick={async () => {
@@ -16,7 +16,7 @@
16
16
  * 아래는 버튼을 클릭하면 메시지를 공유하는 간단한 예제예요.
17
17
  *
18
18
  * ```tsx
19
- * import { share } from 'react-native-bedrock';
19
+ * import { share } from '@apps-in-toss/web-framework';
20
20
  *
21
21
  *
22
22
  * function MyPage() {
@@ -30,7 +30,13 @@ declare enum Accuracy {
30
30
  */
31
31
  BestForNavigation = 6
32
32
  }
33
- interface Location$1 {
33
+ /**
34
+ * @public
35
+ * @category 위치 정보
36
+ * @name Location
37
+ * @description 위치 정보를 나타내는 객체예요.
38
+ */
39
+ export interface Location {
34
40
  /**
35
41
  * Android에서만 지원하는 옵션이에요.
36
42
  *
@@ -105,7 +111,7 @@ export interface StartUpdateLocationSubscription extends EmitterSubscription {
105
111
  * 디바이스의 위치 정보 변경을 감지해요
106
112
  */
107
113
  export type UpdateLocationEventEmitter = EventEmitterSchema<"updateLocation", [
108
- Location$1
114
+ Location
109
115
  ]>;
110
116
  /**
111
117
  * @public
@@ -167,7 +173,7 @@ export type UpdateLocationEventEmitter = EventEmitterSchema<"updateLocation", [
167
173
  * ```
168
174
  */
169
175
  export declare function startUpdateLocation(eventParams: {
170
- onEvent: (response: Location$1) => void;
176
+ onEvent: (response: Location) => void;
171
177
  onError: (error: unknown) => void;
172
178
  options: StartUpdateLocationOptions;
173
179
  }): () => void;
@@ -0,0 +1,64 @@
1
+ /**
2
+ * @public
3
+ * @category 게임센터
4
+ * @name SubmitGameCenterLeaderBoardScoreResponse
5
+ * @description
6
+ * 토스게임센터 리더보드에 점수를 제출한 결과 정보를 담아서 반환해요. 반환된 정보를 사용해서 점수 제출 결과에 따라 적절한 에러 처리를 할 수 있어요.
7
+ * @property {'SUCCESS' | 'LEADERBOARD_NOT_FOUND' | 'PROFILE_NOT_FOUND' | 'UNPARSABLE_SCORE'} statusCode
8
+ * 점수 제출 결과를 나타내는 상태 코드예요.
9
+ * - `'SUCCESS'`: 점수 제출이 성공했어요.
10
+ * - `'LEADERBOARD_NOT_FOUND'`: `gameId`에 해당하는 리더보드를 찾을 수 없어요.
11
+ * - `'PROFILE_NOT_FOUND'`: 사용자의 프로필이 없어요.
12
+ * - `'UNPARSABLE_SCORE'`: 점수를 해석할 수 없어요. 점수는 실수(float) 형태의 문자열로 전달해야 해요.
13
+ */
14
+ export interface SubmitGameCenterLeaderBoardScoreResponse {
15
+ statusCode: "SUCCESS" | "LEADERBOARD_NOT_FOUND" | "PROFILE_NOT_FOUND" | "UNPARSABLE_SCORE";
16
+ }
17
+ /**
18
+ * @public
19
+ * @category 게임센터
20
+ * @name submitGameCenterLeaderBoardScore
21
+ * @description
22
+ * 사용자의 게임 점수를 토스게임센터 리더보드에 제출해요. 이 기능으로 사용자의 점수를 공식 리더보드에 기록하고 다른 사용자와 비교할 수 있어요.
23
+ * @param {string} params.score
24
+ * 제출할 게임 점수예요. 실수 형태의 숫자를 문자열로 전달해야 해요. 예를들어 `"123.45"` 또는 `"9999"` 예요.
25
+ * @returns {Promise<SubmitGameCenterLeaderBoardScoreResponse | undefined>}
26
+ * 점수 제출 결과를 반환해요. 앱 버전이 최소 지원 버전보다 낮으면 아무 동작도 하지 않고 `undefined`를 반환해요.
27
+ *
28
+ * @example
29
+ * ### 게임 점수를 토스게임센터 리더보드에 제출하기
30
+ * ```tsx
31
+ *
32
+ * import { submitGameCenterLeaderBoardScore } from '@apps-in-toss/web-framework';
33
+ *
34
+ * function GameCenterLeaderBoardScoreSubmitButton() {
35
+ * async function handlePress() {
36
+ * try {
37
+ * const result = await submitGameCenterLeaderBoardScore({ score: '123.45' });
38
+ *
39
+ * if (!result) {
40
+ * console.warn('지원하지 않는 앱 버전이에요.');
41
+ * return;
42
+ * }
43
+ *
44
+ * if (result.statusCode === 'SUCCESS') {
45
+ * console.log('점수 제출 성공!');
46
+ * } else {
47
+ * console.error('점수 제출 실패:', result.statusCode);
48
+ * }
49
+ * } catch (error) {
50
+ * console.error('점수 제출 중 오류가 발생했어요.', error);
51
+ * }
52
+ * }
53
+ *
54
+ * return (
55
+ * <input type="button" onClick={handlePress}>점수 제출하기</button>
56
+ * );
57
+ * }
58
+ * ```
59
+ */
60
+ export declare function submitGameCenterLeaderBoardScore(params: {
61
+ score: string;
62
+ }): Promise<SubmitGameCenterLeaderBoardScoreResponse | undefined>;
63
+
64
+ export {};
package/package.json CHANGED
@@ -1,33 +1,33 @@
1
1
  {
2
2
  "name": "@apps-in-toss/web-bridge",
3
3
  "type": "module",
4
- "version": "0.0.0-dev.1752115036458",
4
+ "version": "0.0.0-dev.1753241576118",
5
5
  "description": "Web Bridge for Apps In Toss",
6
6
  "scripts": {
7
7
  "prepack": "yarn build",
8
8
  "typecheck": "tsc --noEmit",
9
9
  "lint": "eslint .",
10
- "build": "tsup"
10
+ "build": "echo 'no build'",
11
+ "sync-bridge": "bridgepack build"
11
12
  },
12
- "main": "./built/index.js",
13
- "module": "./built/index.js",
14
- "types": "./built/index.d.ts",
13
+ "main": "./build/index.js",
14
+ "module": "./build/index.js",
15
+ "types": "./build/index.d.ts",
15
16
  "exports": {
16
17
  ".": {
17
- "types": "./built/index.d.ts",
18
- "default": "./built/index.js"
18
+ "types": "./build/index.d.ts",
19
+ "default": "./build/index.js"
19
20
  }
20
21
  },
21
22
  "files": [
22
- "built"
23
+ "build"
23
24
  ],
24
25
  "devDependencies": {
25
- "@apps-in-toss/bridge-core": "0.0.0-dev.1752115036458",
26
- "@apps-in-toss/framework": "0.0.0-dev.1752115036458",
27
- "@swc/core": "^1.12.7",
28
- "picocolors": "^1.1.1",
29
- "ts-morph": "^26.0.0",
30
- "tsup": "^8.5.0",
26
+ "@apps-in-toss-internal/bridgepack": "0.0.0-dev.1753241576118",
27
+ "@apps-in-toss/bridge-core": "0.0.0-dev.1753241576118",
28
+ "@apps-in-toss/framework": "0.0.0-dev.1753241576118",
29
+ "react-native-bedrock": "0.0.25",
30
+ "tsup": "^8.3.5",
31
31
  "typescript": "4.9.5",
32
32
  "vitest": "^3.1.2"
33
33
  },
@@ -37,5 +37,5 @@
37
37
  "publishConfig": {
38
38
  "access": "public"
39
39
  },
40
- "gitHead": "73735f83556eb2727f160e998234101bd17e55f0"
40
+ "gitHead": "739c606380e6a8681e5dbc55f70b7f72f3f7721b"
41
41
  }
package/built/bridge.d.ts DELETED
@@ -1,27 +0,0 @@
1
- export * from './closeView';
2
- export * from './generateHapticFeedback';
3
- export * from './share';
4
- export * from './setSecureScreen';
5
- export * from './setScreenAwakeMode';
6
- export * from './getNetworkStatus';
7
- export * from './setIosSwipeGestureEnabled';
8
- export * from './openURL';
9
- export * from './setClipboardText';
10
- export * from './getClipboardText';
11
- export * from './fetchContacts';
12
- export * from './fetchAlbumPhotos';
13
- export * from './getCurrentLocation';
14
- export * from './openCamera';
15
- export * from './appLogin';
16
- export * from './eventLog';
17
- export * from './getTossShareLink';
18
- export * from './setDeviceOrientation';
19
- export * from './checkoutPayment';
20
- export * from './saveBase64Data';
21
- export * from './getLocale';
22
- export * from './getSchemeUri';
23
- export * from './getPlatformOS';
24
- export * from './getOperationalEnvironment';
25
- export * from './getTossAppVersion';
26
- export * from './getDeviceId';
27
- export * from './startUpdateLocation';
package/built/bridge.js DELETED
@@ -1 +0,0 @@
1
- import{createAsyncBridge,createConstantBridge,createEventBridge}from"@apps-in-toss/bridge-core";var createEvents=function(){return{emit:function emit(event,args){for(var callbacks=this.events[event]||[],i=0,length=callbacks.length;i<length;i++){callbacks[i](args)}},events:{},on:function on(event,cb){var _this=this;var _this_events,_event;((_this_events=this.events)[_event=event]||(_this_events[_event]=[])).push(cb);return function(){var _this_events_event;_this.events[event]=(_this_events_event=_this.events[event])===null||_this_events_event===void 0?void 0:_this_events_event.filter(function(i){return cb!==i})}}}};if(typeof window!=="undefined"){window.__GRANITE_NATIVE_EMITTER=createEvents()}export var closeView=createAsyncBridge("closeView");export var generateHapticFeedback=createAsyncBridge("generateHapticFeedback");export var share=createAsyncBridge("share");export var setSecureScreen=createAsyncBridge("setSecureScreen");export var setScreenAwakeMode=createAsyncBridge("setScreenAwakeMode");export var getNetworkStatus=createAsyncBridge("getNetworkStatus");export var setIosSwipeGestureEnabled=createAsyncBridge("setIosSwipeGestureEnabled");export var openURL=createAsyncBridge("openURL");export var setClipboardText=createAsyncBridge("setClipboardText");export var getClipboardText=createAsyncBridge("getClipboardText");export var fetchContacts=createAsyncBridge("fetchContacts");export var fetchAlbumPhotos=createAsyncBridge("fetchAlbumPhotos");export var Accuracy=function(Accuracy){Accuracy[Accuracy["Lowest"]=1]="Lowest";Accuracy[Accuracy["Low"]=2]="Low";Accuracy[Accuracy["Balanced"]=3]="Balanced";Accuracy[Accuracy["High"]=4]="High";Accuracy[Accuracy["Highest"]=5]="Highest";Accuracy[Accuracy["BestForNavigation"]=6]="BestForNavigation";return Accuracy}({});export var getCurrentLocation=createAsyncBridge("getCurrentLocation");export var openCamera=createAsyncBridge("openCamera");export var appLogin=createAsyncBridge("appLogin");export var eventLog=createAsyncBridge("eventLog");export var getTossShareLink=createAsyncBridge("getTossShareLink");export var setDeviceOrientation=createAsyncBridge("setDeviceOrientation");export var checkoutPayment=createAsyncBridge("checkoutPayment");export var saveBase64Data=createAsyncBridge("saveBase64Data");export var getLocale=createConstantBridge("getLocale");export var getSchemeUri=createConstantBridge("getSchemeUri");export var getPlatformOS=createConstantBridge("getPlatformOS");export var getOperationalEnvironment=createConstantBridge("getOperationalEnvironment");export var getTossAppVersion=createConstantBridge("getTossAppVersion");export var getDeviceId=createConstantBridge("getDeviceId");export var startUpdateLocation=createEventBridge("startUpdateLocation");
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes