@apps-in-toss/native-modules 1.2.1 → 1.3.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.
@@ -91,6 +91,10 @@
91
91
  "identifier": "saveBase64Data",
92
92
  "dts": "export interface SaveBase64DataParams {\n\tdata: string;\n\tfileName: string;\n\tmimeType: string;\n}\n/**\n * @public\n * @category 데이터\n * @name saveBase64Data\n * @description 문자열로 인코딩된 Base64 데이터를 지정한 파일 이름과 MIME 타입으로 사용자 기기에 저장해요. 이미지, 텍스트, PDF 등 다양한 형식의 데이터를 저장할 수 있어요.\n * @param {SaveBase64DataParams} params - 저장할 데이터와 파일 정보를 담은 객체예요.\n * @param {string} params.data - Base64 형식으로 인코딩된 데이터 문자열이에요.\n * @param {string} params.fileName - 저장할 파일 이름이에요. 확장자도 같이 붙여줘야해요. 예를 들어, 'example.png'로 저장할 수 있어요.\n * @param {string} params.mimeType - 저장할 파일의 MIME 타입이에요. 예를 들어 'image/png' 로 지정하면 이미지, 'application/pdf'는 PDF 파일이에요. 자세한 내용은 [MIME 문서](https://developer.mozilla.org/ko/docs/Web/HTTP/Guides/MIME_types)를 참고해주세요.\n *\n * @example\n * ### Base64 이미지 데이터를 사용자 기기에 저장하기\n *\n * ```tsx\n * import { Button } from 'react-native';\n * import { saveBase64Data } from '@apps-in-toss/framework';\n *\n * // '저장' 버튼을 누르면 이미지가 사용자 기기에 저장돼요.\n * function SaveButton() {\n * const handleSave = async () => {\n * try {\n * await saveBase64Data({\n * data: 'iVBORw0KGgo...',\n * fileName: 'some-photo.png',\n * mimeType: 'image/png',\n * });\n * } catch (error) {\n * console.error('데이터 저장에 실패했어요:', error);\n * }\n * };\n *\n * return <Button title=\"저장\" onPress={handleSave} />;\n * }\n * ```\n */\nexport declare function saveBase64Data(params: SaveBase64DataParams): Promise<void>;\n\nexport {};\n"
93
93
  },
94
+ {
95
+ "identifier": "appsInTossSignTossCert",
96
+ "dts": "export interface AppsInTossSignTossCertParams {\n\ttxId: string;\n}\n/**\n * @public\n * @category 토스인증\n * @name appsInTossSignTossCert\n * @description 토스 인증서를 사용해 서명하는 기능을 제공해요. 이 함수를 사용하면 앱인토스에서 제공하는 인증서를 활용해 서명을 할 수 있어요.\n *\n * @param {AppsInTossSignTossCertParams} params - 서명에 필요한 파라미터를 포함하는 객체예요.\n * @param {string} params.txId - 토스인증서를 사용한 본인확인이나 간편인증, 전자서명에서 사용하는 Transaction Id예요.\n *\n * @example\n * ```tsx\n * import { appsInTossSignTossCert } from '@apps-in-toss/framework';\n *\n * // 서명에 필요한 파라미터를 정의해요.\n * const params = {\n * txId: \"f2e1a6df...\"\n * };\n *\n * appsInTossSignTossCert(params)\n * .then(() => {\n * console.log('서명 작업이 성공적으로 완료되었어요.');\n * })\n * .catch((error) => {\n * console.error('서명 작업 중 에러가 발생했어요:', error);\n * });\n * ```\n */\nexport declare function appsInTossSignTossCert(params: AppsInTossSignTossCertParams): Promise<void>;\n\nexport {};\n"
97
+ },
94
98
  {
95
99
  "identifier": "getGameCenterGameProfile",
96
100
  "dts": "/**\n * @category 게임센터\n * @name GameCenterGameProfileResponse\n * @description 토스게임센터 프로필을 가져온 결과 타입이에요.\n * 앱에 프로필이 없는 경우, `statusCode`가 `'PROFILE_NOT_FOUND'`이고 다른 정보는 없어요.\n * 프로필이 있는 경우 `statusCode`가 `'SUCCESS'`이고, 닉네임과 프로필 이미지 주소가 함께 제공돼요.\n * @property {string} statusCode 프로필 조회 결과 상태예요. `'SUCCESS'` 또는 `'PROFILE_NOT_FOUND'` 중 하나예요.\n * @property {string} [nickname] 프로필 닉네임이에요. `statusCode`가 `'SUCCESS'`일 때만 있어요.\n * @property {string} [profileImageUri] 프로필 이미지 URL이에요. `statusCode`가 `'SUCCESS'`일 때만 있어요.\n */\nexport type GameCenterGameProfileResponse = {\n\tstatusCode: \"PROFILE_NOT_FOUND\";\n} | {\n\tstatusCode: \"SUCCESS\";\n\tnickname: string;\n\tprofileImageUri: string;\n};\n/**\n * @category 게임센터\n * @name getGameCenterGameProfile\n * @description 토스게임센터 프로필 정보를 가져와요.\n * 사용자가 프로필을 만들지 않았다면 `statusCode`가 `'PROFILE_NOT_FOUND'`인 응답이 반환돼요.\n * 앱 버전이 최소 지원 버전(안드로이드 5.221.0, iOS 5.221.0)보다 낮으면 `undefined`를 반환해요.\n * @returns {Promise<GameCenterGameProfileResponse | undefined>} 프로필 정보 또는 `undefined`를 반환해요.\n *\n * @example\n * ### 게임센터 프로필 가져오기\n * ```tsx\n * import { getGameCenterGameProfile } from './getGameCenterGameProfile';\n * import { useState } from 'react';\n * import { View, Button } from 'react-native';\n *\n * function GameProfile() {\n * const [profile, setProfile] = useState<GameCenterGameProfileResponse | null>(null);\n *\n * const handlePress = async () => {\n * try {\n * const result = await getGameCenterGameProfile();\n * if (result) {\n * setProfile(result);\n * }\n * } catch (error) {\n * console.error('게임센터 프로필 가져오기에 실패했어요.', error);\n * }\n * };\n *\n * return (\n * <View>\n * <Button title=\"게임센터 프로필 가져오기\" onPress={handlePress} />\n * </View>\n * );\n * }\n * ```\n */\nexport declare function getGameCenterGameProfile(): Promise<GameCenterGameProfileResponse | undefined>;\n\nexport {};\n"
package/dist/index.cjs CHANGED
@@ -33,6 +33,7 @@ __export(index_exports, {
33
33
  TossPay: () => TossPay,
34
34
  appLogin: () => appLogin,
35
35
  appsInTossEvent: () => appsInTossEvent,
36
+ appsInTossSignTossCert: () => appsInTossSignTossCert,
36
37
  closeView: () => closeView,
37
38
  contactsViral: () => contactsViral,
38
39
  eventLog: () => eventLog,
@@ -839,11 +840,22 @@ async function getCompletedOrRefundedOrders(params) {
839
840
  }
840
841
  return AppsInTossModule.getCompletedOrRefundedOrders(params ?? { key: null });
841
842
  }
843
+ async function completeProductGrant(params) {
844
+ const isSupported = isMinVersionSupported({
845
+ android: "5.233.0",
846
+ ios: "5.233.0"
847
+ });
848
+ if (!isSupported) {
849
+ return;
850
+ }
851
+ return AppsInTossModule.completeProductGrant(params);
852
+ }
842
853
  var IAP = {
843
854
  createOneTimePurchaseOrder,
844
855
  getProductItemList,
845
856
  getPendingOrders,
846
- getCompletedOrRefundedOrders
857
+ getCompletedOrRefundedOrders,
858
+ completeProductGrant
847
859
  };
848
860
 
849
861
  // src/AppsInTossModule/native-modules/saveBase64Data.ts
@@ -959,6 +971,19 @@ function contactsViral(params) {
959
971
  return unregisterCallbacks;
960
972
  }
961
973
 
974
+ // src/AppsInTossModule/native-modules/appsInTossSignTossCert.ts
975
+ async function appsInTossSignTossCert(params) {
976
+ const isSupported = isMinVersionSupported({
977
+ android: "5.233.0",
978
+ ios: "5.233.0"
979
+ });
980
+ if (!isSupported) {
981
+ console.warn("appsInTossSignTossCert is not supported in this app version");
982
+ return;
983
+ }
984
+ await AppsInTossModule.appsInTossSignTossCert({ params });
985
+ }
986
+
962
987
  // src/AppsInTossModule/native-modules/index.ts
963
988
  var TossPay = {
964
989
  checkoutPayment
@@ -1100,6 +1125,7 @@ var INTERNAL__module = {
1100
1125
  TossPay,
1101
1126
  appLogin,
1102
1127
  appsInTossEvent,
1128
+ appsInTossSignTossCert,
1103
1129
  closeView,
1104
1130
  contactsViral,
1105
1131
  eventLog,
package/dist/index.d.cts CHANGED
@@ -1355,6 +1355,38 @@ interface CheckoutPaymentResult {
1355
1355
  */
1356
1356
  declare function checkoutPayment(options: CheckoutPaymentOptions): Promise<CheckoutPaymentResult>;
1357
1357
 
1358
+ interface AppsInTossSignTossCertParams {
1359
+ txId: string;
1360
+ }
1361
+ /**
1362
+ * @public
1363
+ * @category 토스인증
1364
+ * @name appsInTossSignTossCert
1365
+ * @description 토스 인증서를 사용해 서명하는 기능을 제공해요. 이 함수를 사용하면 앱인토스에서 제공하는 인증서를 활용해 서명을 할 수 있어요.
1366
+ *
1367
+ * @param {AppsInTossSignTossCertParams} params - 서명에 필요한 파라미터를 포함하는 객체예요.
1368
+ * @param {string} params.txId - 토스인증서를 사용한 본인확인이나 간편인증, 전자서명에서 사용하는 Transaction Id예요.
1369
+ *
1370
+ * @example
1371
+ * ```tsx
1372
+ * import { appsInTossSignTossCert } from '@apps-in-toss/framework';
1373
+ *
1374
+ * // 서명에 필요한 파라미터를 정의해요.
1375
+ * const params = {
1376
+ * txId: "f2e1a6df..."
1377
+ * };
1378
+ *
1379
+ * appsInTossSignTossCert(params)
1380
+ * .then(() => {
1381
+ * console.log('서명 작업이 성공적으로 완료되었어요.');
1382
+ * })
1383
+ * .catch((error) => {
1384
+ * console.error('서명 작업 중 에러가 발생했어요:', error);
1385
+ * });
1386
+ * ```
1387
+ */
1388
+ declare function appsInTossSignTossCert(params: AppsInTossSignTossCertParams): Promise<void>;
1389
+
1358
1390
  /**
1359
1391
  * @category 게임센터
1360
1392
  * @name GameCenterGameProfileResponse
@@ -1707,19 +1739,51 @@ interface CompletedOrRefundedOrdersResult {
1707
1739
  declare function getCompletedOrRefundedOrders(params?: {
1708
1740
  key?: string | null;
1709
1741
  }): Promise<CompletedOrRefundedOrdersResult | undefined>;
1742
+ /**
1743
+ * @public
1744
+ * @category 인앱결제
1745
+ * @name completeProductGrant
1746
+ * @description 상품 지급 처리를 완료했다는 메시지를 앱에 전달해요. 이 함수를 사용하면 결제가 완료된 주문의 상품 지급이 정상적으로 완료되었음을 알릴 수 있어요.
1747
+ * @param {{ params: { orderId: string } }} params 결제가 완료된 주문 정보를 담은 객체예요.
1748
+ * @param {string} params.orderId 주문의 고유 ID예요. 상품 지급을 완료할 주문을 지정할 때 사용해요.
1749
+ * @returns {Promise<boolean>} 상품 지급이 완료됐는지 여부를 반환해요. 앱 버전이 최소 지원 버전(안드로이드 5.233.0, iOS 5.233.0)보다 낮으면 `undefined`를 반환해요.
1750
+ *
1751
+ * @example
1752
+ * ### 결제를 성공한 뒤 상품을 지급하는 예시
1753
+ * ```typescript
1754
+ * import { IAP } from '@apps-in-toss/framework';
1755
+ *
1756
+ * async function handleGrantProduct(orderId: string) {
1757
+ * try {
1758
+ * await IAP.completeProductGrant({ params: { orderId } });
1759
+ * } catch (error) {
1760
+ * console.error(error);
1761
+ * }
1762
+ * }
1763
+ * ```
1764
+ */
1765
+ declare function completeProductGrant(params: {
1766
+ params: {
1767
+ orderId: string;
1768
+ };
1769
+ }): Promise<boolean | undefined>;
1710
1770
  /**
1711
1771
  * @public
1712
1772
  * @category 인앱결제
1713
1773
  * @name IAP
1714
1774
  * @description 인앱결제 관련 기능을 모은 객체예요. 단건 인앱결제 주문서 이동과 상품 목록 조회 기능을 제공해요.
1715
- * @property {typeof createOneTimePurchaseOrder} [createOneTimePurchaseOrder] 특정 인앱결제 주문서 페이지로 이동해요. 자세한 내용은 [createOneTimePurchaseOrder](https://developers-apps-in-toss.toss.im/bedrock/reference/native-modules/%EC%9D%B8%EC%95%B1%20%EA%B2%B0%EC%A0%9C/getProductItemList.html) 문서를 참고하세요.
1716
- * @property {typeof getProductItemList} [getProductItemList] 인앱결제로 구매할 수 있는 상품 목록을 가져와요. 자세한 내용은 [getProductItemList](https://developers-apps-in-toss.toss.im/bedrock/reference/native-modules/%EC%9D%B8%EC%95%B1%20%EA%B2%B0%EC%A0%9C/createOneTimePurchaseOrder.html) 문서를 참고하세요.
1775
+ * @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/createOneTimePurchaseOrder.html) 문서를 참고하세요.
1776
+ * @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/getProductItemList.html) 문서를 참고하세요.
1777
+ * @property {typeof getPendingOrders} [getPendingOrders] 대기 중인 주문 목록을 가져와요. 자세한 내용은 [getPendingOrders](https://developers-apps-in-toss.toss.im/bedrock/reference/framework/%EC%9D%B8%EC%95%B1%20%EA%B2%B0%EC%A0%9C/getPendingOrders.htm) 문서를 참고하세요.
1778
+ * @property {typeof getCompletedOrRefundedOrders} [getCompletedOrRefundedOrders] 인앱결제로 구매하거나 환불한 주문 목록을 가져와요. 자세한 내용은 [getCompletedOrRefundedOrders](https://developers-apps-in-toss.toss.im/bedrock/reference/framework/%EC%9D%B8%EC%95%B1%20%EA%B2%B0%EC%A0%9C/getCompletedOrRefundedOrders.html) 문서를 참고하세요.
1779
+ * @property {typeof completeProductGrant} [completeProductGrant] 상품 지급 처리를 완료했다는 메시지를 앱에 전달해요. 자세한 내용은 [completeProductGrant](https://developers-apps-in-toss.toss.im/bedrock/reference/framework/%EC%9D%B8%EC%95%B1%20%EA%B2%B0%EC%A0%9C/completeProductGrant.html) 문서를 참고하세요.
1717
1780
  */
1718
1781
  declare const IAP: {
1719
1782
  createOneTimePurchaseOrder: typeof createOneTimePurchaseOrder;
1720
1783
  getProductItemList: typeof getProductItemList;
1721
1784
  getPendingOrders: typeof getPendingOrders;
1722
1785
  getCompletedOrRefundedOrders: typeof getCompletedOrRefundedOrders;
1786
+ completeProductGrant: typeof completeProductGrant;
1723
1787
  };
1724
1788
 
1725
1789
  interface SaveBase64DataParams {
@@ -1910,11 +1974,20 @@ interface Spec extends TurboModule {
1910
1974
  getCompletedOrRefundedOrders: (params: {
1911
1975
  key?: string | null;
1912
1976
  }) => Promise<CompletedOrRefundedOrdersResult>;
1977
+ completeProductGrant: (params: {
1978
+ params: {
1979
+ orderId: string;
1980
+ };
1981
+ }) => Promise<boolean>;
1913
1982
  getGameCenterGameProfile: (params: CompatiblePlaceholderArgument) => Promise<GameCenterGameProfileResponse>;
1914
1983
  submitGameCenterLeaderBoardScore: (params: {
1915
1984
  score: string;
1916
1985
  }) => Promise<SubmitGameCenterLeaderBoardScoreResponse>;
1917
1986
  contactsViral: (params: ContactsViralParams) => () => void;
1987
+ /** 토스인증 */
1988
+ appsInTossSignTossCert: (params: {
1989
+ params: AppsInTossSignTossCertParams;
1990
+ }) => void;
1918
1991
  }
1919
1992
  declare const AppsInTossModuleInstance: any;
1920
1993
  declare const AppsInTossModule: Spec;
@@ -3328,4 +3401,4 @@ declare const INTERNAL__module: {
3328
3401
  tossCoreEventLog: typeof tossCoreEventLog;
3329
3402
  };
3330
3403
 
3331
- export { AppsInTossModule, BedrockCoreModule, BedrockModule, type CheckoutPaymentOptions, type CheckoutPaymentResult, type CompletedOrRefundedOrdersResult, type ContactsViralParams, type EventLogParams, type GameCenterGameProfileResponse, GoogleAdMob, type HapticFeedbackType, IAP, AppsInTossModuleInstance as INTERNAL__AppsInTossModule, INTERNAL__appBridgeHandler, INTERNAL__module, type IapCreateOneTimePurchaseOrderOptions, type IapCreateOneTimePurchaseOrderResult, type IapProductListItem, type LoadAdMobEvent, type LoadAdMobInterstitialAdEvent, type LoadAdMobInterstitialAdOptions, type LoadAdMobOptions, type LoadAdMobParams, type LoadAdMobRewardedAdEvent, type LoadAdMobRewardedAdOptions, type NetworkStatus, type Primitive, type SaveBase64DataParams, type ShowAdMobEvent, type ShowAdMobInterstitialAdEvent, type ShowAdMobInterstitialAdOptions, type ShowAdMobOptions, type ShowAdMobParams, type ShowAdMobRewardedAdEvent, type ShowAdMobRewardedAdOptions, Storage, type SubmitGameCenterLeaderBoardScoreResponse, TossPay, type UpdateLocationEventEmitter, appLogin, appsInTossEvent, closeView, contactsViral, eventLog, fetchAlbumPhotos, fetchContacts, generateHapticFeedback, getClipboardText, getCurrentLocation, getDeviceId, getGameCenterGameProfile, getLocale, getNetworkStatus, getOperationalEnvironment, getPlatformOS, getSchemeUri, getTossAppVersion, getTossShareLink, iapCreateOneTimePurchaseOrder, isMinVersionSupported, onVisibilityChangedByTransparentServiceWeb, openCamera, openGameCenterLeaderboard, openURL, processProductGrant, requestOneTimePurchase, saveBase64Data, setClipboardText, setDeviceOrientation, setIosSwipeGestureEnabled, setScreenAwakeMode, setSecureScreen, share, startUpdateLocation, submitGameCenterLeaderBoardScore };
3404
+ export { AppsInTossModule, type AppsInTossSignTossCertParams, BedrockCoreModule, BedrockModule, type CheckoutPaymentOptions, type CheckoutPaymentResult, type CompletedOrRefundedOrdersResult, type ContactsViralParams, type EventLogParams, type GameCenterGameProfileResponse, GoogleAdMob, type HapticFeedbackType, IAP, AppsInTossModuleInstance as INTERNAL__AppsInTossModule, INTERNAL__appBridgeHandler, INTERNAL__module, type IapCreateOneTimePurchaseOrderOptions, type IapCreateOneTimePurchaseOrderResult, type IapProductListItem, type LoadAdMobEvent, type LoadAdMobInterstitialAdEvent, type LoadAdMobInterstitialAdOptions, type LoadAdMobOptions, type LoadAdMobParams, type LoadAdMobRewardedAdEvent, type LoadAdMobRewardedAdOptions, type NetworkStatus, type Primitive, type SaveBase64DataParams, type ShowAdMobEvent, type ShowAdMobInterstitialAdEvent, type ShowAdMobInterstitialAdOptions, type ShowAdMobOptions, type ShowAdMobParams, type ShowAdMobRewardedAdEvent, type ShowAdMobRewardedAdOptions, Storage, type SubmitGameCenterLeaderBoardScoreResponse, TossPay, type UpdateLocationEventEmitter, appLogin, appsInTossEvent, appsInTossSignTossCert, closeView, contactsViral, eventLog, fetchAlbumPhotos, fetchContacts, generateHapticFeedback, getClipboardText, getCurrentLocation, getDeviceId, getGameCenterGameProfile, getLocale, getNetworkStatus, getOperationalEnvironment, getPlatformOS, getSchemeUri, getTossAppVersion, getTossShareLink, iapCreateOneTimePurchaseOrder, isMinVersionSupported, onVisibilityChangedByTransparentServiceWeb, openCamera, openGameCenterLeaderboard, openURL, processProductGrant, requestOneTimePurchase, saveBase64Data, setClipboardText, setDeviceOrientation, setIosSwipeGestureEnabled, setScreenAwakeMode, setSecureScreen, share, startUpdateLocation, submitGameCenterLeaderBoardScore };
package/dist/index.d.ts CHANGED
@@ -1355,6 +1355,38 @@ interface CheckoutPaymentResult {
1355
1355
  */
1356
1356
  declare function checkoutPayment(options: CheckoutPaymentOptions): Promise<CheckoutPaymentResult>;
1357
1357
 
1358
+ interface AppsInTossSignTossCertParams {
1359
+ txId: string;
1360
+ }
1361
+ /**
1362
+ * @public
1363
+ * @category 토스인증
1364
+ * @name appsInTossSignTossCert
1365
+ * @description 토스 인증서를 사용해 서명하는 기능을 제공해요. 이 함수를 사용하면 앱인토스에서 제공하는 인증서를 활용해 서명을 할 수 있어요.
1366
+ *
1367
+ * @param {AppsInTossSignTossCertParams} params - 서명에 필요한 파라미터를 포함하는 객체예요.
1368
+ * @param {string} params.txId - 토스인증서를 사용한 본인확인이나 간편인증, 전자서명에서 사용하는 Transaction Id예요.
1369
+ *
1370
+ * @example
1371
+ * ```tsx
1372
+ * import { appsInTossSignTossCert } from '@apps-in-toss/framework';
1373
+ *
1374
+ * // 서명에 필요한 파라미터를 정의해요.
1375
+ * const params = {
1376
+ * txId: "f2e1a6df..."
1377
+ * };
1378
+ *
1379
+ * appsInTossSignTossCert(params)
1380
+ * .then(() => {
1381
+ * console.log('서명 작업이 성공적으로 완료되었어요.');
1382
+ * })
1383
+ * .catch((error) => {
1384
+ * console.error('서명 작업 중 에러가 발생했어요:', error);
1385
+ * });
1386
+ * ```
1387
+ */
1388
+ declare function appsInTossSignTossCert(params: AppsInTossSignTossCertParams): Promise<void>;
1389
+
1358
1390
  /**
1359
1391
  * @category 게임센터
1360
1392
  * @name GameCenterGameProfileResponse
@@ -1707,19 +1739,51 @@ interface CompletedOrRefundedOrdersResult {
1707
1739
  declare function getCompletedOrRefundedOrders(params?: {
1708
1740
  key?: string | null;
1709
1741
  }): Promise<CompletedOrRefundedOrdersResult | undefined>;
1742
+ /**
1743
+ * @public
1744
+ * @category 인앱결제
1745
+ * @name completeProductGrant
1746
+ * @description 상품 지급 처리를 완료했다는 메시지를 앱에 전달해요. 이 함수를 사용하면 결제가 완료된 주문의 상품 지급이 정상적으로 완료되었음을 알릴 수 있어요.
1747
+ * @param {{ params: { orderId: string } }} params 결제가 완료된 주문 정보를 담은 객체예요.
1748
+ * @param {string} params.orderId 주문의 고유 ID예요. 상품 지급을 완료할 주문을 지정할 때 사용해요.
1749
+ * @returns {Promise<boolean>} 상품 지급이 완료됐는지 여부를 반환해요. 앱 버전이 최소 지원 버전(안드로이드 5.233.0, iOS 5.233.0)보다 낮으면 `undefined`를 반환해요.
1750
+ *
1751
+ * @example
1752
+ * ### 결제를 성공한 뒤 상품을 지급하는 예시
1753
+ * ```typescript
1754
+ * import { IAP } from '@apps-in-toss/framework';
1755
+ *
1756
+ * async function handleGrantProduct(orderId: string) {
1757
+ * try {
1758
+ * await IAP.completeProductGrant({ params: { orderId } });
1759
+ * } catch (error) {
1760
+ * console.error(error);
1761
+ * }
1762
+ * }
1763
+ * ```
1764
+ */
1765
+ declare function completeProductGrant(params: {
1766
+ params: {
1767
+ orderId: string;
1768
+ };
1769
+ }): Promise<boolean | undefined>;
1710
1770
  /**
1711
1771
  * @public
1712
1772
  * @category 인앱결제
1713
1773
  * @name IAP
1714
1774
  * @description 인앱결제 관련 기능을 모은 객체예요. 단건 인앱결제 주문서 이동과 상품 목록 조회 기능을 제공해요.
1715
- * @property {typeof createOneTimePurchaseOrder} [createOneTimePurchaseOrder] 특정 인앱결제 주문서 페이지로 이동해요. 자세한 내용은 [createOneTimePurchaseOrder](https://developers-apps-in-toss.toss.im/bedrock/reference/native-modules/%EC%9D%B8%EC%95%B1%20%EA%B2%B0%EC%A0%9C/getProductItemList.html) 문서를 참고하세요.
1716
- * @property {typeof getProductItemList} [getProductItemList] 인앱결제로 구매할 수 있는 상품 목록을 가져와요. 자세한 내용은 [getProductItemList](https://developers-apps-in-toss.toss.im/bedrock/reference/native-modules/%EC%9D%B8%EC%95%B1%20%EA%B2%B0%EC%A0%9C/createOneTimePurchaseOrder.html) 문서를 참고하세요.
1775
+ * @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/createOneTimePurchaseOrder.html) 문서를 참고하세요.
1776
+ * @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/getProductItemList.html) 문서를 참고하세요.
1777
+ * @property {typeof getPendingOrders} [getPendingOrders] 대기 중인 주문 목록을 가져와요. 자세한 내용은 [getPendingOrders](https://developers-apps-in-toss.toss.im/bedrock/reference/framework/%EC%9D%B8%EC%95%B1%20%EA%B2%B0%EC%A0%9C/getPendingOrders.htm) 문서를 참고하세요.
1778
+ * @property {typeof getCompletedOrRefundedOrders} [getCompletedOrRefundedOrders] 인앱결제로 구매하거나 환불한 주문 목록을 가져와요. 자세한 내용은 [getCompletedOrRefundedOrders](https://developers-apps-in-toss.toss.im/bedrock/reference/framework/%EC%9D%B8%EC%95%B1%20%EA%B2%B0%EC%A0%9C/getCompletedOrRefundedOrders.html) 문서를 참고하세요.
1779
+ * @property {typeof completeProductGrant} [completeProductGrant] 상품 지급 처리를 완료했다는 메시지를 앱에 전달해요. 자세한 내용은 [completeProductGrant](https://developers-apps-in-toss.toss.im/bedrock/reference/framework/%EC%9D%B8%EC%95%B1%20%EA%B2%B0%EC%A0%9C/completeProductGrant.html) 문서를 참고하세요.
1717
1780
  */
1718
1781
  declare const IAP: {
1719
1782
  createOneTimePurchaseOrder: typeof createOneTimePurchaseOrder;
1720
1783
  getProductItemList: typeof getProductItemList;
1721
1784
  getPendingOrders: typeof getPendingOrders;
1722
1785
  getCompletedOrRefundedOrders: typeof getCompletedOrRefundedOrders;
1786
+ completeProductGrant: typeof completeProductGrant;
1723
1787
  };
1724
1788
 
1725
1789
  interface SaveBase64DataParams {
@@ -1910,11 +1974,20 @@ interface Spec extends TurboModule {
1910
1974
  getCompletedOrRefundedOrders: (params: {
1911
1975
  key?: string | null;
1912
1976
  }) => Promise<CompletedOrRefundedOrdersResult>;
1977
+ completeProductGrant: (params: {
1978
+ params: {
1979
+ orderId: string;
1980
+ };
1981
+ }) => Promise<boolean>;
1913
1982
  getGameCenterGameProfile: (params: CompatiblePlaceholderArgument) => Promise<GameCenterGameProfileResponse>;
1914
1983
  submitGameCenterLeaderBoardScore: (params: {
1915
1984
  score: string;
1916
1985
  }) => Promise<SubmitGameCenterLeaderBoardScoreResponse>;
1917
1986
  contactsViral: (params: ContactsViralParams) => () => void;
1987
+ /** 토스인증 */
1988
+ appsInTossSignTossCert: (params: {
1989
+ params: AppsInTossSignTossCertParams;
1990
+ }) => void;
1918
1991
  }
1919
1992
  declare const AppsInTossModuleInstance: any;
1920
1993
  declare const AppsInTossModule: Spec;
@@ -3328,4 +3401,4 @@ declare const INTERNAL__module: {
3328
3401
  tossCoreEventLog: typeof tossCoreEventLog;
3329
3402
  };
3330
3403
 
3331
- export { AppsInTossModule, BedrockCoreModule, BedrockModule, type CheckoutPaymentOptions, type CheckoutPaymentResult, type CompletedOrRefundedOrdersResult, type ContactsViralParams, type EventLogParams, type GameCenterGameProfileResponse, GoogleAdMob, type HapticFeedbackType, IAP, AppsInTossModuleInstance as INTERNAL__AppsInTossModule, INTERNAL__appBridgeHandler, INTERNAL__module, type IapCreateOneTimePurchaseOrderOptions, type IapCreateOneTimePurchaseOrderResult, type IapProductListItem, type LoadAdMobEvent, type LoadAdMobInterstitialAdEvent, type LoadAdMobInterstitialAdOptions, type LoadAdMobOptions, type LoadAdMobParams, type LoadAdMobRewardedAdEvent, type LoadAdMobRewardedAdOptions, type NetworkStatus, type Primitive, type SaveBase64DataParams, type ShowAdMobEvent, type ShowAdMobInterstitialAdEvent, type ShowAdMobInterstitialAdOptions, type ShowAdMobOptions, type ShowAdMobParams, type ShowAdMobRewardedAdEvent, type ShowAdMobRewardedAdOptions, Storage, type SubmitGameCenterLeaderBoardScoreResponse, TossPay, type UpdateLocationEventEmitter, appLogin, appsInTossEvent, closeView, contactsViral, eventLog, fetchAlbumPhotos, fetchContacts, generateHapticFeedback, getClipboardText, getCurrentLocation, getDeviceId, getGameCenterGameProfile, getLocale, getNetworkStatus, getOperationalEnvironment, getPlatformOS, getSchemeUri, getTossAppVersion, getTossShareLink, iapCreateOneTimePurchaseOrder, isMinVersionSupported, onVisibilityChangedByTransparentServiceWeb, openCamera, openGameCenterLeaderboard, openURL, processProductGrant, requestOneTimePurchase, saveBase64Data, setClipboardText, setDeviceOrientation, setIosSwipeGestureEnabled, setScreenAwakeMode, setSecureScreen, share, startUpdateLocation, submitGameCenterLeaderBoardScore };
3404
+ export { AppsInTossModule, type AppsInTossSignTossCertParams, BedrockCoreModule, BedrockModule, type CheckoutPaymentOptions, type CheckoutPaymentResult, type CompletedOrRefundedOrdersResult, type ContactsViralParams, type EventLogParams, type GameCenterGameProfileResponse, GoogleAdMob, type HapticFeedbackType, IAP, AppsInTossModuleInstance as INTERNAL__AppsInTossModule, INTERNAL__appBridgeHandler, INTERNAL__module, type IapCreateOneTimePurchaseOrderOptions, type IapCreateOneTimePurchaseOrderResult, type IapProductListItem, type LoadAdMobEvent, type LoadAdMobInterstitialAdEvent, type LoadAdMobInterstitialAdOptions, type LoadAdMobOptions, type LoadAdMobParams, type LoadAdMobRewardedAdEvent, type LoadAdMobRewardedAdOptions, type NetworkStatus, type Primitive, type SaveBase64DataParams, type ShowAdMobEvent, type ShowAdMobInterstitialAdEvent, type ShowAdMobInterstitialAdOptions, type ShowAdMobOptions, type ShowAdMobParams, type ShowAdMobRewardedAdEvent, type ShowAdMobRewardedAdOptions, Storage, type SubmitGameCenterLeaderBoardScoreResponse, TossPay, type UpdateLocationEventEmitter, appLogin, appsInTossEvent, appsInTossSignTossCert, closeView, contactsViral, eventLog, fetchAlbumPhotos, fetchContacts, generateHapticFeedback, getClipboardText, getCurrentLocation, getDeviceId, getGameCenterGameProfile, getLocale, getNetworkStatus, getOperationalEnvironment, getPlatformOS, getSchemeUri, getTossAppVersion, getTossShareLink, iapCreateOneTimePurchaseOrder, isMinVersionSupported, onVisibilityChangedByTransparentServiceWeb, openCamera, openGameCenterLeaderboard, openURL, processProductGrant, requestOneTimePurchase, saveBase64Data, setClipboardText, setDeviceOrientation, setIosSwipeGestureEnabled, setScreenAwakeMode, setSecureScreen, share, startUpdateLocation, submitGameCenterLeaderBoardScore };
package/dist/index.js CHANGED
@@ -767,11 +767,22 @@ async function getCompletedOrRefundedOrders(params) {
767
767
  }
768
768
  return AppsInTossModule.getCompletedOrRefundedOrders(params ?? { key: null });
769
769
  }
770
+ async function completeProductGrant(params) {
771
+ const isSupported = isMinVersionSupported({
772
+ android: "5.233.0",
773
+ ios: "5.233.0"
774
+ });
775
+ if (!isSupported) {
776
+ return;
777
+ }
778
+ return AppsInTossModule.completeProductGrant(params);
779
+ }
770
780
  var IAP = {
771
781
  createOneTimePurchaseOrder,
772
782
  getProductItemList,
773
783
  getPendingOrders,
774
- getCompletedOrRefundedOrders
784
+ getCompletedOrRefundedOrders,
785
+ completeProductGrant
775
786
  };
776
787
 
777
788
  // src/AppsInTossModule/native-modules/saveBase64Data.ts
@@ -887,6 +898,19 @@ function contactsViral(params) {
887
898
  return unregisterCallbacks;
888
899
  }
889
900
 
901
+ // src/AppsInTossModule/native-modules/appsInTossSignTossCert.ts
902
+ async function appsInTossSignTossCert(params) {
903
+ const isSupported = isMinVersionSupported({
904
+ android: "5.233.0",
905
+ ios: "5.233.0"
906
+ });
907
+ if (!isSupported) {
908
+ console.warn("appsInTossSignTossCert is not supported in this app version");
909
+ return;
910
+ }
911
+ await AppsInTossModule.appsInTossSignTossCert({ params });
912
+ }
913
+
890
914
  // src/AppsInTossModule/native-modules/index.ts
891
915
  var TossPay = {
892
916
  checkoutPayment
@@ -1027,6 +1051,7 @@ export {
1027
1051
  TossPay,
1028
1052
  appLogin,
1029
1053
  appsInTossEvent,
1054
+ appsInTossSignTossCert,
1030
1055
  closeView,
1031
1056
  contactsViral,
1032
1057
  eventLog,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@apps-in-toss/native-modules",
3
3
  "type": "module",
4
- "version": "1.2.1",
4
+ "version": "1.3.0",
5
5
  "description": "Native Modules for Apps In Toss",
6
6
  "scripts": {
7
7
  "prepack": "yarn build",
@@ -30,8 +30,8 @@
30
30
  ],
31
31
  "devDependencies": {
32
32
  "@babel/runtime": "^7",
33
- "@granite-js/native": "0.1.22",
34
- "@granite-js/react-native": "0.1.22",
33
+ "@granite-js/native": "0.1.28",
34
+ "@granite-js/react-native": "0.1.28",
35
35
  "@types/react": "18.3.3",
36
36
  "dts-bundle-generator": "^9.5.1",
37
37
  "esbuild": "0.25.5",
@@ -43,7 +43,7 @@
43
43
  "vitest": "^3.2.4"
44
44
  },
45
45
  "dependencies": {
46
- "@apps-in-toss/types": "^1.2.1",
46
+ "@apps-in-toss/types": "^1.3.0",
47
47
  "es-toolkit": "^1.39.3"
48
48
  },
49
49
  "peerDependencies": {
@@ -54,5 +54,5 @@
54
54
  "publishConfig": {
55
55
  "access": "public"
56
56
  },
57
- "gitHead": "40254858b2f5f6d54bd7b228d0bc1dc96d3259aa"
57
+ "gitHead": "71845fd4a349b630c91f07c3ab3d14f81774335a"
58
58
  }
@@ -13,6 +13,7 @@ import type {
13
13
  SetClipboardTextOptions,
14
14
  } from '@apps-in-toss/types';
15
15
  import { TurboModuleRegistry, type TurboModule as __TurboModule } from 'react-native';
16
+ import type { AppsInTossSignTossCertParams } from './appsInTossSignTossCert';
16
17
  import type { CheckoutPaymentOptions, CheckoutPaymentResult } from './checkoutPayment';
17
18
  import type { GameCenterGameProfileResponse } from './getGameCenterGameProfile';
18
19
  import { IapCreateOneTimePurchaseOrderResult, IapProductListItem, CompletedOrRefundedOrdersResult } from './iap';
@@ -74,11 +75,15 @@ interface Spec extends __TurboModule {
74
75
  processProductGrant: (params: { orderId: string; isProductGranted: boolean }) => Promise<void>;
75
76
  getPendingOrders: (params: CompatiblePlaceholderArgument) => Promise<{ orderIds: string[] }>;
76
77
  getCompletedOrRefundedOrders: (params: { key?: string | null }) => Promise<CompletedOrRefundedOrdersResult>;
78
+ completeProductGrant: (params: { params: { orderId: string } }) => Promise<boolean>;
77
79
 
78
80
  getGameCenterGameProfile: (params: CompatiblePlaceholderArgument) => Promise<GameCenterGameProfileResponse>;
79
81
  submitGameCenterLeaderBoardScore: (params: { score: string }) => Promise<SubmitGameCenterLeaderBoardScoreResponse>;
80
82
 
81
83
  contactsViral: (params: ContactsViralParams) => () => void;
84
+
85
+ /** 토스인증 */
86
+ appsInTossSignTossCert: (params: { params: AppsInTossSignTossCertParams }) => void;
82
87
  }
83
88
 
84
89
  const Module = TurboModuleRegistry.getEnforcing<Spec>('AppsInTossModule');
@@ -0,0 +1,48 @@
1
+ import { AppsInTossModule } from './AppsInTossModule';
2
+ import { isMinVersionSupported } from './isMinVersionSupported';
3
+
4
+ export interface AppsInTossSignTossCertParams {
5
+ txId: string;
6
+ }
7
+
8
+ /**
9
+ * @public
10
+ * @category 토스인증
11
+ * @name appsInTossSignTossCert
12
+ * @description 토스 인증서를 사용해 서명하는 기능을 제공해요. 이 함수를 사용하면 앱인토스에서 제공하는 인증서를 활용해 서명을 할 수 있어요.
13
+ *
14
+ * @param {AppsInTossSignTossCertParams} params - 서명에 필요한 파라미터를 포함하는 객체예요.
15
+ * @param {string} params.txId - 토스인증서를 사용한 본인확인이나 간편인증, 전자서명에서 사용하는 Transaction Id예요.
16
+ *
17
+ * @example
18
+ * ```tsx
19
+ * import { appsInTossSignTossCert } from '@apps-in-toss/framework';
20
+ *
21
+ * // 서명에 필요한 파라미터를 정의해요.
22
+ * const params = {
23
+ * txId: "f2e1a6df..."
24
+ * };
25
+ *
26
+ * appsInTossSignTossCert(params)
27
+ * .then(() => {
28
+ * console.log('서명 작업이 성공적으로 완료되었어요.');
29
+ * })
30
+ * .catch((error) => {
31
+ * console.error('서명 작업 중 에러가 발생했어요:', error);
32
+ * });
33
+ * ```
34
+ */
35
+
36
+ export async function appsInTossSignTossCert(params: AppsInTossSignTossCertParams) {
37
+ const isSupported = isMinVersionSupported({
38
+ android: '5.233.0',
39
+ ios: '5.233.0',
40
+ });
41
+
42
+ if (!isSupported) {
43
+ console.warn('appsInTossSignTossCert is not supported in this app version');
44
+ return;
45
+ }
46
+
47
+ await AppsInTossModule.appsInTossSignTossCert({ params });
48
+ }
@@ -413,17 +413,57 @@ async function getCompletedOrRefundedOrders(params?: { key?: string | null }) {
413
413
  return AppsInTossModule.getCompletedOrRefundedOrders(params ?? { key: null });
414
414
  }
415
415
 
416
+ /**
417
+ * @public
418
+ * @category 인앱결제
419
+ * @name completeProductGrant
420
+ * @description 상품 지급 처리를 완료했다는 메시지를 앱에 전달해요. 이 함수를 사용하면 결제가 완료된 주문의 상품 지급이 정상적으로 완료되었음을 알릴 수 있어요.
421
+ * @param {{ params: { orderId: string } }} params 결제가 완료된 주문 정보를 담은 객체예요.
422
+ * @param {string} params.orderId 주문의 고유 ID예요. 상품 지급을 완료할 주문을 지정할 때 사용해요.
423
+ * @returns {Promise<boolean>} 상품 지급이 완료됐는지 여부를 반환해요. 앱 버전이 최소 지원 버전(안드로이드 5.233.0, iOS 5.233.0)보다 낮으면 `undefined`를 반환해요.
424
+ *
425
+ * @example
426
+ * ### 결제를 성공한 뒤 상품을 지급하는 예시
427
+ * ```typescript
428
+ * import { IAP } from '@apps-in-toss/framework';
429
+ *
430
+ * async function handleGrantProduct(orderId: string) {
431
+ * try {
432
+ * await IAP.completeProductGrant({ params: { orderId } });
433
+ * } catch (error) {
434
+ * console.error(error);
435
+ * }
436
+ * }
437
+ * ```
438
+ */
439
+ async function completeProductGrant(params: { params: { orderId: string } }) {
440
+ const isSupported = isMinVersionSupported({
441
+ android: '5.233.0',
442
+ ios: '5.233.0',
443
+ });
444
+
445
+ if (!isSupported) {
446
+ return;
447
+ }
448
+
449
+ return AppsInTossModule.completeProductGrant(params);
450
+ }
451
+
416
452
  /**
417
453
  * @public
418
454
  * @category 인앱결제
419
455
  * @name IAP
420
456
  * @description 인앱결제 관련 기능을 모은 객체예요. 단건 인앱결제 주문서 이동과 상품 목록 조회 기능을 제공해요.
421
- * @property {typeof createOneTimePurchaseOrder} [createOneTimePurchaseOrder] 특정 인앱결제 주문서 페이지로 이동해요. 자세한 내용은 [createOneTimePurchaseOrder](https://developers-apps-in-toss.toss.im/bedrock/reference/native-modules/%EC%9D%B8%EC%95%B1%20%EA%B2%B0%EC%A0%9C/getProductItemList.html) 문서를 참고하세요.
422
- * @property {typeof getProductItemList} [getProductItemList] 인앱결제로 구매할 수 있는 상품 목록을 가져와요. 자세한 내용은 [getProductItemList](https://developers-apps-in-toss.toss.im/bedrock/reference/native-modules/%EC%9D%B8%EC%95%B1%20%EA%B2%B0%EC%A0%9C/createOneTimePurchaseOrder.html) 문서를 참고하세요.
457
+ * @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/createOneTimePurchaseOrder.html) 문서를 참고하세요.
458
+ * @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/getProductItemList.html) 문서를 참고하세요.
459
+ * @property {typeof getPendingOrders} [getPendingOrders] 대기 중인 주문 목록을 가져와요. 자세한 내용은 [getPendingOrders](https://developers-apps-in-toss.toss.im/bedrock/reference/framework/%EC%9D%B8%EC%95%B1%20%EA%B2%B0%EC%A0%9C/getPendingOrders.htm) 문서를 참고하세요.
460
+ * @property {typeof getCompletedOrRefundedOrders} [getCompletedOrRefundedOrders] 인앱결제로 구매하거나 환불한 주문 목록을 가져와요. 자세한 내용은 [getCompletedOrRefundedOrders](https://developers-apps-in-toss.toss.im/bedrock/reference/framework/%EC%9D%B8%EC%95%B1%20%EA%B2%B0%EC%A0%9C/getCompletedOrRefundedOrders.html) 문서를 참고하세요.
461
+ * @property {typeof completeProductGrant} [completeProductGrant] 상품 지급 처리를 완료했다는 메시지를 앱에 전달해요. 자세한 내용은 [completeProductGrant](https://developers-apps-in-toss.toss.im/bedrock/reference/framework/%EC%9D%B8%EC%95%B1%20%EA%B2%B0%EC%A0%9C/completeProductGrant.html) 문서를 참고하세요.
423
462
  */
424
463
  export const IAP = {
425
464
  createOneTimePurchaseOrder,
426
465
  getProductItemList,
427
466
  getPendingOrders,
428
467
  getCompletedOrRefundedOrders,
468
+ completeProductGrant,
429
469
  };
@@ -54,6 +54,7 @@ export * from './openGameCenterLeaderboard';
54
54
  export * from './getGameCenterGameProfile';
55
55
  export * from './submitGameCenterLeaderBoardScore';
56
56
  export * from '../native-event-emitter/contactsViral';
57
+ export * from './appsInTossSignTossCert';
57
58
 
58
59
  export type {
59
60
  LoadAdMobInterstitialAdEvent,
@@ -24,6 +24,7 @@ export * from './AppsInTossModule/native-modules/getTossShareLink';
24
24
  export * from './AppsInTossModule/native-modules/setDeviceOrientation';
25
25
  export * from './AppsInTossModule/native-modules/checkoutPayment';
26
26
  export * from './AppsInTossModule/native-modules/saveBase64Data';
27
+ export * from './AppsInTossModule/native-modules/appsInTossSignTossCert';
27
28
  export * from './AppsInTossModule/native-modules/getGameCenterGameProfile';
28
29
  export * from './AppsInTossModule/native-modules/openGameCenterLeaderboard';
29
30
  export * from './AppsInTossModule/native-modules/submitGameCenterLeaderBoardScore';