@apps-in-toss/native-modules 2.1.0 → 2.2.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/index.cjs CHANGED
@@ -77,7 +77,7 @@ __export(index_exports, {
77
77
  });
78
78
  module.exports = __toCommonJS(index_exports);
79
79
 
80
- // src/MiniAppModule.brick.ts
80
+ // src/MiniAppModule/postMessage.ts
81
81
  var import_brick_module = require("brick-module");
82
82
  var MiniAppModule = import_brick_module.BrickModule.get("MiniAppModule");
83
83
  function safePostMessage(method, params) {
@@ -94,13 +94,13 @@ var import_react_native4 = require("@granite-js/react-native");
94
94
  var import_types = require("@apps-in-toss/types");
95
95
  var import_react_native = require("@granite-js/react-native");
96
96
 
97
- // src/TossCoreModule.brick.ts
97
+ // src/BedrockModule/commonModule.ts
98
98
  var import_brick_module2 = require("brick-module");
99
- var TossCoreModule = import_brick_module2.BrickModule.get("TossCoreModule");
99
+ var CommonModule = import_brick_module2.BrickModule.get("CommonModule");
100
100
 
101
- // src/CommonModule.brick.ts
101
+ // src/TossCoreModule/instance.ts
102
102
  var import_brick_module3 = require("brick-module");
103
- var CommonModule = import_brick_module3.BrickModule.get("CommonModule");
103
+ var TossCoreModule = import_brick_module3.BrickModule.get("TossCoreModule");
104
104
 
105
105
  // src/MiniAppModule/native-modules/permissions/openPermissionDialog.ts
106
106
  function openPermissionDialog(permission) {
@@ -784,6 +784,16 @@ async function completeProductGrant(params) {
784
784
  }
785
785
  return safePostMessage("completeProductGrant", params.params);
786
786
  }
787
+ async function getSubscriptionInfo(params) {
788
+ const isSupported = isMinVersionSupported({
789
+ android: "5.253.0",
790
+ ios: "5.250.0"
791
+ });
792
+ if (!isSupported) {
793
+ return;
794
+ }
795
+ return safePostMessage("getSubscriptionInfo", params);
796
+ }
787
797
  function createSubscriptionPurchaseOrder(params) {
788
798
  const isSupported = isMinVersionSupported({
789
799
  android: "5.248.0",
@@ -818,7 +828,8 @@ var IAP = {
818
828
  getProductItemList,
819
829
  getPendingOrders,
820
830
  getCompletedOrRefundedOrders,
821
- completeProductGrant
831
+ completeProductGrant,
832
+ getSubscriptionInfo
822
833
  };
823
834
 
824
835
  // src/MiniAppModule/native-modules/saveBase64Data.ts
package/dist/index.d.cts CHANGED
@@ -741,6 +741,57 @@ declare function completeProductGrant(params: {
741
741
  orderId: string;
742
742
  };
743
743
  }): Promise<boolean | undefined>;
744
+ /**
745
+ * @public
746
+ * @category 인앱결제
747
+ * @name IapSubscriptionInfoResult
748
+ * @description 구독 주문의 현재 상태 정보를 담은 객체예요.
749
+ * @property {number} catalogId 구독 상품의 식별자예요.
750
+ * @property {"ACTIVE" |"EXPIRED"|"IN_GRACE_PERIOD"|"ON_HOLD"|"PAUSED"|"REVOKED"} status 구독 상태를 나타내는 값이에요.
751
+ * @property {string | null} expiresAt 구독 만료 예정 시각이에요. 만료 정보가 없으면 `null`이에요.
752
+ * @property {boolean} isAutoRenew 구독 자동 갱신 여부예요.
753
+ * @property {string | null} gracePeriodExpiresAt 결제 유예 기간 만료 시각이에요. 유예 기간이 없으면 `null`이에요.
754
+ * @property {boolean} isAccessible 현재 구독 상품을 이용할 수 있는지 여부예요.
755
+ */
756
+ interface IapSubscriptionInfoResult {
757
+ catalogId: number;
758
+ status: 'ACTIVE' | 'EXPIRED' | 'IN_GRACE_PERIOD' | 'ON_HOLD' | 'PAUSED' | 'REVOKED';
759
+ expiresAt: string | null;
760
+ isAutoRenew: boolean;
761
+ gracePeriodExpiresAt: string | null;
762
+ isAccessible: boolean;
763
+ }
764
+ /**
765
+ * @public
766
+ * @category 인앱결제
767
+ * @name getSubscriptionInfo
768
+ * @description 구독 주문의 현재 상태 정보를 가져와요.
769
+ * @param {{ params: { orderId: string } }} params 조회할 구독 주문 정보를 담은 객체예요.
770
+ * @param {string} params.orderId 주문의 고유 ID예요.
771
+ * @returns {Promise<{ subscription: IapSubscriptionInfoResult } | undefined>} 구독 상태 정보를 담은 객체를 반환해요. 앱 버전이 최소 지원 버전(안드로이드 5.253.0, iOS 5.250.0)보다 낮으면 `undefined`를 반환해요.
772
+ *
773
+ * @example
774
+ * ### 주문 ID로 구독 상태 조회하기
775
+ * ```typescript
776
+ * import { IAP } from '@apps-in-toss/framework';
777
+ *
778
+ * async function fetchSubscriptionInfo(orderId: string) {
779
+ * try {
780
+ * const response = await IAP.getSubscriptionInfo({ params: { orderId } });
781
+ * return response?.subscription;
782
+ * } catch (error) {
783
+ * console.error(error);
784
+ * }
785
+ * }
786
+ * ```
787
+ */
788
+ declare function getSubscriptionInfo(params: {
789
+ params: {
790
+ orderId: string;
791
+ };
792
+ }): Promise<{
793
+ subscription: IapSubscriptionInfoResult;
794
+ } | undefined>;
744
795
  /**
745
796
  * @public
746
797
  * @category 인앱결제
@@ -835,6 +886,7 @@ declare function createSubscriptionPurchaseOrder(params: CreateSubscriptionPurch
835
886
  * @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) 문서를 참고하세요.
836
887
  * @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) 문서를 참고하세요.
837
888
  * @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) 문서를 참고하세요.
889
+ * @property {typeof getSubscriptionInfo} [getSubscriptionInfo] 구독 주문의 현재 상태 정보를 가져와요.
838
890
  */
839
891
  declare const IAP: {
840
892
  createOneTimePurchaseOrder: typeof createOneTimePurchaseOrder;
@@ -843,6 +895,7 @@ declare const IAP: {
843
895
  getPendingOrders: typeof getPendingOrders;
844
896
  getCompletedOrRefundedOrders: typeof getCompletedOrRefundedOrders;
845
897
  completeProductGrant: typeof completeProductGrant;
898
+ getSubscriptionInfo: typeof getSubscriptionInfo;
846
899
  };
847
900
 
848
901
  interface SaveBase64DataParams {
@@ -1024,6 +1077,13 @@ interface AsyncMethodsMap {
1024
1077
  completeProductGrant: (params: {
1025
1078
  orderId: string;
1026
1079
  }) => Promise<boolean>;
1080
+ getSubscriptionInfo: (params: {
1081
+ params: {
1082
+ orderId: string;
1083
+ };
1084
+ }) => Promise<{
1085
+ subscription: IapSubscriptionInfoResult;
1086
+ }>;
1027
1087
  eventLog: (params: {
1028
1088
  log_name: string;
1029
1089
  log_type: string;
@@ -3233,4 +3293,4 @@ declare const INTERNAL__module: {
3233
3293
  tossCoreEventLog: typeof tossCoreEventLog;
3234
3294
  };
3235
3295
 
3236
- export { type AppsInTossSignTossCertParams, type CheckoutPaymentOptions, type CheckoutPaymentResult, type CompletedOrRefundedOrdersResult, type ConsumableProductListItem, type ContactsViralParams, type CreateSubscriptionPurchaseOrderOptions, type EventLogParams, type GameCenterGameProfileResponse, type GetUserKeyForGameErrorResponse, type GetUserKeyForGameResponse, type GetUserKeyForGameSuccessResponse, GoogleAdMob, type GrantPromotionRewardErrorResponse, type GrantPromotionRewardErrorResult, type GrantPromotionRewardForGameErrorResponse, type GrantPromotionRewardForGameErrorResult, type GrantPromotionRewardForGameResponse, type GrantPromotionRewardForGameSuccessResponse, type GrantPromotionRewardResponse, type GrantPromotionRewardSuccessResponse, type HapticFeedbackType, IAP, INTERNAL__appBridgeHandler, INTERNAL__module, type IapCreateOneTimePurchaseOrderOptions, type IapCreateOneTimePurchaseOrderResult, type IapCreateSubscriptionPurchaseOrderResult, type IapProductListItem, type NetworkStatus, type NonConsumableProductListItem, type Primitive, type SaveBase64DataParams, Storage, type SubmitGameCenterLeaderBoardScoreResponse, type SubscriptionProductListItem, TossPay, type UpdateLocationEventEmitter, appLogin, appsInTossEvent, appsInTossSignTossCert, checkoutPayment, closeView, contactsViral, eventLog, fetchAlbumPhotos, fetchContacts, generateHapticFeedback, getClipboardText, getCurrentLocation, getDeviceId, getGameCenterGameProfile, getGroupId, getIsTossLoginIntegratedService, getLocale, getNetworkStatus, getOperationalEnvironment, getPlatformOS, getSchemeUri, getServerTime, getTossAppVersion, getTossShareLink, getUserKeyForGame, grantPromotionReward, grantPromotionRewardForGame, iapCreateOneTimePurchaseOrder, isMinVersionSupported, onVisibilityChangedByTransparentServiceWeb, openCamera, openGameCenterLeaderboard, openURL, processProductGrant, requestOneTimePurchase, safePostMessage, safeSyncPostMessage, saveBase64Data, setClipboardText, setDeviceOrientation, setIosSwipeGestureEnabled, setScreenAwakeMode, setSecureScreen, share, shareWithScheme, startUpdateLocation, submitGameCenterLeaderBoardScore };
3296
+ export { type AppsInTossSignTossCertParams, type CheckoutPaymentOptions, type CheckoutPaymentResult, type CompletedOrRefundedOrdersResult, type ConsumableProductListItem, type ContactsViralParams, type CreateSubscriptionPurchaseOrderOptions, type EventLogParams, type GameCenterGameProfileResponse, type GetUserKeyForGameErrorResponse, type GetUserKeyForGameResponse, type GetUserKeyForGameSuccessResponse, GoogleAdMob, type GrantPromotionRewardErrorResponse, type GrantPromotionRewardErrorResult, type GrantPromotionRewardForGameErrorResponse, type GrantPromotionRewardForGameErrorResult, type GrantPromotionRewardForGameResponse, type GrantPromotionRewardForGameSuccessResponse, type GrantPromotionRewardResponse, type GrantPromotionRewardSuccessResponse, type HapticFeedbackType, IAP, INTERNAL__appBridgeHandler, INTERNAL__module, type IapCreateOneTimePurchaseOrderOptions, type IapCreateOneTimePurchaseOrderResult, type IapCreateSubscriptionPurchaseOrderResult, type IapProductListItem, type IapSubscriptionInfoResult, type NetworkStatus, type NonConsumableProductListItem, type Primitive, type SaveBase64DataParams, Storage, type SubmitGameCenterLeaderBoardScoreResponse, type SubscriptionProductListItem, TossPay, type UpdateLocationEventEmitter, appLogin, appsInTossEvent, appsInTossSignTossCert, checkoutPayment, closeView, contactsViral, eventLog, fetchAlbumPhotos, fetchContacts, generateHapticFeedback, getClipboardText, getCurrentLocation, getDeviceId, getGameCenterGameProfile, getGroupId, getIsTossLoginIntegratedService, getLocale, getNetworkStatus, getOperationalEnvironment, getPlatformOS, getSchemeUri, getServerTime, getTossAppVersion, getTossShareLink, getUserKeyForGame, grantPromotionReward, grantPromotionRewardForGame, iapCreateOneTimePurchaseOrder, isMinVersionSupported, onVisibilityChangedByTransparentServiceWeb, openCamera, openGameCenterLeaderboard, openURL, processProductGrant, requestOneTimePurchase, safePostMessage, safeSyncPostMessage, saveBase64Data, setClipboardText, setDeviceOrientation, setIosSwipeGestureEnabled, setScreenAwakeMode, setSecureScreen, share, shareWithScheme, startUpdateLocation, submitGameCenterLeaderBoardScore };
package/dist/index.d.ts CHANGED
@@ -741,6 +741,57 @@ declare function completeProductGrant(params: {
741
741
  orderId: string;
742
742
  };
743
743
  }): Promise<boolean | undefined>;
744
+ /**
745
+ * @public
746
+ * @category 인앱결제
747
+ * @name IapSubscriptionInfoResult
748
+ * @description 구독 주문의 현재 상태 정보를 담은 객체예요.
749
+ * @property {number} catalogId 구독 상품의 식별자예요.
750
+ * @property {"ACTIVE" |"EXPIRED"|"IN_GRACE_PERIOD"|"ON_HOLD"|"PAUSED"|"REVOKED"} status 구독 상태를 나타내는 값이에요.
751
+ * @property {string | null} expiresAt 구독 만료 예정 시각이에요. 만료 정보가 없으면 `null`이에요.
752
+ * @property {boolean} isAutoRenew 구독 자동 갱신 여부예요.
753
+ * @property {string | null} gracePeriodExpiresAt 결제 유예 기간 만료 시각이에요. 유예 기간이 없으면 `null`이에요.
754
+ * @property {boolean} isAccessible 현재 구독 상품을 이용할 수 있는지 여부예요.
755
+ */
756
+ interface IapSubscriptionInfoResult {
757
+ catalogId: number;
758
+ status: 'ACTIVE' | 'EXPIRED' | 'IN_GRACE_PERIOD' | 'ON_HOLD' | 'PAUSED' | 'REVOKED';
759
+ expiresAt: string | null;
760
+ isAutoRenew: boolean;
761
+ gracePeriodExpiresAt: string | null;
762
+ isAccessible: boolean;
763
+ }
764
+ /**
765
+ * @public
766
+ * @category 인앱결제
767
+ * @name getSubscriptionInfo
768
+ * @description 구독 주문의 현재 상태 정보를 가져와요.
769
+ * @param {{ params: { orderId: string } }} params 조회할 구독 주문 정보를 담은 객체예요.
770
+ * @param {string} params.orderId 주문의 고유 ID예요.
771
+ * @returns {Promise<{ subscription: IapSubscriptionInfoResult } | undefined>} 구독 상태 정보를 담은 객체를 반환해요. 앱 버전이 최소 지원 버전(안드로이드 5.253.0, iOS 5.250.0)보다 낮으면 `undefined`를 반환해요.
772
+ *
773
+ * @example
774
+ * ### 주문 ID로 구독 상태 조회하기
775
+ * ```typescript
776
+ * import { IAP } from '@apps-in-toss/framework';
777
+ *
778
+ * async function fetchSubscriptionInfo(orderId: string) {
779
+ * try {
780
+ * const response = await IAP.getSubscriptionInfo({ params: { orderId } });
781
+ * return response?.subscription;
782
+ * } catch (error) {
783
+ * console.error(error);
784
+ * }
785
+ * }
786
+ * ```
787
+ */
788
+ declare function getSubscriptionInfo(params: {
789
+ params: {
790
+ orderId: string;
791
+ };
792
+ }): Promise<{
793
+ subscription: IapSubscriptionInfoResult;
794
+ } | undefined>;
744
795
  /**
745
796
  * @public
746
797
  * @category 인앱결제
@@ -835,6 +886,7 @@ declare function createSubscriptionPurchaseOrder(params: CreateSubscriptionPurch
835
886
  * @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) 문서를 참고하세요.
836
887
  * @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) 문서를 참고하세요.
837
888
  * @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) 문서를 참고하세요.
889
+ * @property {typeof getSubscriptionInfo} [getSubscriptionInfo] 구독 주문의 현재 상태 정보를 가져와요.
838
890
  */
839
891
  declare const IAP: {
840
892
  createOneTimePurchaseOrder: typeof createOneTimePurchaseOrder;
@@ -843,6 +895,7 @@ declare const IAP: {
843
895
  getPendingOrders: typeof getPendingOrders;
844
896
  getCompletedOrRefundedOrders: typeof getCompletedOrRefundedOrders;
845
897
  completeProductGrant: typeof completeProductGrant;
898
+ getSubscriptionInfo: typeof getSubscriptionInfo;
846
899
  };
847
900
 
848
901
  interface SaveBase64DataParams {
@@ -1024,6 +1077,13 @@ interface AsyncMethodsMap {
1024
1077
  completeProductGrant: (params: {
1025
1078
  orderId: string;
1026
1079
  }) => Promise<boolean>;
1080
+ getSubscriptionInfo: (params: {
1081
+ params: {
1082
+ orderId: string;
1083
+ };
1084
+ }) => Promise<{
1085
+ subscription: IapSubscriptionInfoResult;
1086
+ }>;
1027
1087
  eventLog: (params: {
1028
1088
  log_name: string;
1029
1089
  log_type: string;
@@ -3233,4 +3293,4 @@ declare const INTERNAL__module: {
3233
3293
  tossCoreEventLog: typeof tossCoreEventLog;
3234
3294
  };
3235
3295
 
3236
- export { type AppsInTossSignTossCertParams, type CheckoutPaymentOptions, type CheckoutPaymentResult, type CompletedOrRefundedOrdersResult, type ConsumableProductListItem, type ContactsViralParams, type CreateSubscriptionPurchaseOrderOptions, type EventLogParams, type GameCenterGameProfileResponse, type GetUserKeyForGameErrorResponse, type GetUserKeyForGameResponse, type GetUserKeyForGameSuccessResponse, GoogleAdMob, type GrantPromotionRewardErrorResponse, type GrantPromotionRewardErrorResult, type GrantPromotionRewardForGameErrorResponse, type GrantPromotionRewardForGameErrorResult, type GrantPromotionRewardForGameResponse, type GrantPromotionRewardForGameSuccessResponse, type GrantPromotionRewardResponse, type GrantPromotionRewardSuccessResponse, type HapticFeedbackType, IAP, INTERNAL__appBridgeHandler, INTERNAL__module, type IapCreateOneTimePurchaseOrderOptions, type IapCreateOneTimePurchaseOrderResult, type IapCreateSubscriptionPurchaseOrderResult, type IapProductListItem, type NetworkStatus, type NonConsumableProductListItem, type Primitive, type SaveBase64DataParams, Storage, type SubmitGameCenterLeaderBoardScoreResponse, type SubscriptionProductListItem, TossPay, type UpdateLocationEventEmitter, appLogin, appsInTossEvent, appsInTossSignTossCert, checkoutPayment, closeView, contactsViral, eventLog, fetchAlbumPhotos, fetchContacts, generateHapticFeedback, getClipboardText, getCurrentLocation, getDeviceId, getGameCenterGameProfile, getGroupId, getIsTossLoginIntegratedService, getLocale, getNetworkStatus, getOperationalEnvironment, getPlatformOS, getSchemeUri, getServerTime, getTossAppVersion, getTossShareLink, getUserKeyForGame, grantPromotionReward, grantPromotionRewardForGame, iapCreateOneTimePurchaseOrder, isMinVersionSupported, onVisibilityChangedByTransparentServiceWeb, openCamera, openGameCenterLeaderboard, openURL, processProductGrant, requestOneTimePurchase, safePostMessage, safeSyncPostMessage, saveBase64Data, setClipboardText, setDeviceOrientation, setIosSwipeGestureEnabled, setScreenAwakeMode, setSecureScreen, share, shareWithScheme, startUpdateLocation, submitGameCenterLeaderBoardScore };
3296
+ export { type AppsInTossSignTossCertParams, type CheckoutPaymentOptions, type CheckoutPaymentResult, type CompletedOrRefundedOrdersResult, type ConsumableProductListItem, type ContactsViralParams, type CreateSubscriptionPurchaseOrderOptions, type EventLogParams, type GameCenterGameProfileResponse, type GetUserKeyForGameErrorResponse, type GetUserKeyForGameResponse, type GetUserKeyForGameSuccessResponse, GoogleAdMob, type GrantPromotionRewardErrorResponse, type GrantPromotionRewardErrorResult, type GrantPromotionRewardForGameErrorResponse, type GrantPromotionRewardForGameErrorResult, type GrantPromotionRewardForGameResponse, type GrantPromotionRewardForGameSuccessResponse, type GrantPromotionRewardResponse, type GrantPromotionRewardSuccessResponse, type HapticFeedbackType, IAP, INTERNAL__appBridgeHandler, INTERNAL__module, type IapCreateOneTimePurchaseOrderOptions, type IapCreateOneTimePurchaseOrderResult, type IapCreateSubscriptionPurchaseOrderResult, type IapProductListItem, type IapSubscriptionInfoResult, type NetworkStatus, type NonConsumableProductListItem, type Primitive, type SaveBase64DataParams, Storage, type SubmitGameCenterLeaderBoardScoreResponse, type SubscriptionProductListItem, TossPay, type UpdateLocationEventEmitter, appLogin, appsInTossEvent, appsInTossSignTossCert, checkoutPayment, closeView, contactsViral, eventLog, fetchAlbumPhotos, fetchContacts, generateHapticFeedback, getClipboardText, getCurrentLocation, getDeviceId, getGameCenterGameProfile, getGroupId, getIsTossLoginIntegratedService, getLocale, getNetworkStatus, getOperationalEnvironment, getPlatformOS, getSchemeUri, getServerTime, getTossAppVersion, getTossShareLink, getUserKeyForGame, grantPromotionReward, grantPromotionRewardForGame, iapCreateOneTimePurchaseOrder, isMinVersionSupported, onVisibilityChangedByTransparentServiceWeb, openCamera, openGameCenterLeaderboard, openURL, processProductGrant, requestOneTimePurchase, safePostMessage, safeSyncPostMessage, saveBase64Data, setClipboardText, setDeviceOrientation, setIosSwipeGestureEnabled, setScreenAwakeMode, setSecureScreen, share, shareWithScheme, startUpdateLocation, submitGameCenterLeaderBoardScore };
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- // src/MiniAppModule.brick.ts
1
+ // src/MiniAppModule/postMessage.ts
2
2
  import { BrickModule } from "brick-module";
3
3
  var MiniAppModule = BrickModule.get("MiniAppModule");
4
4
  function safePostMessage(method, params) {
@@ -15,13 +15,13 @@ import { GraniteEvent } from "@granite-js/react-native";
15
15
  import { GetCurrentLocationPermissionError } from "@apps-in-toss/types";
16
16
  import { GraniteEventDefinition } from "@granite-js/react-native";
17
17
 
18
- // src/TossCoreModule.brick.ts
18
+ // src/BedrockModule/commonModule.ts
19
19
  import { BrickModule as BrickModule2 } from "brick-module";
20
- var TossCoreModule = BrickModule2.get("TossCoreModule");
20
+ var CommonModule = BrickModule2.get("CommonModule");
21
21
 
22
- // src/CommonModule.brick.ts
22
+ // src/TossCoreModule/instance.ts
23
23
  import { BrickModule as BrickModule3 } from "brick-module";
24
- var CommonModule = BrickModule3.get("CommonModule");
24
+ var TossCoreModule = BrickModule3.get("TossCoreModule");
25
25
 
26
26
  // src/MiniAppModule/native-modules/permissions/openPermissionDialog.ts
27
27
  function openPermissionDialog(permission) {
@@ -705,6 +705,16 @@ async function completeProductGrant(params) {
705
705
  }
706
706
  return safePostMessage("completeProductGrant", params.params);
707
707
  }
708
+ async function getSubscriptionInfo(params) {
709
+ const isSupported = isMinVersionSupported({
710
+ android: "5.253.0",
711
+ ios: "5.250.0"
712
+ });
713
+ if (!isSupported) {
714
+ return;
715
+ }
716
+ return safePostMessage("getSubscriptionInfo", params);
717
+ }
708
718
  function createSubscriptionPurchaseOrder(params) {
709
719
  const isSupported = isMinVersionSupported({
710
720
  android: "5.248.0",
@@ -739,7 +749,8 @@ var IAP = {
739
749
  getProductItemList,
740
750
  getPendingOrders,
741
751
  getCompletedOrRefundedOrders,
742
- completeProductGrant
752
+ completeProductGrant,
753
+ getSubscriptionInfo
743
754
  };
744
755
 
745
756
  // src/MiniAppModule/native-modules/saveBase64Data.ts
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@apps-in-toss/native-modules",
3
3
  "type": "module",
4
- "version": "2.1.0",
4
+ "version": "2.2.0",
5
5
  "description": "Native Modules for Apps In Toss",
6
6
  "scripts": {
7
7
  "typecheck": "tsc --noEmit",
@@ -29,8 +29,8 @@
29
29
  ],
30
30
  "devDependencies": {
31
31
  "@babel/runtime": "^7",
32
- "@granite-js/native": "1.0.4",
33
- "@granite-js/react-native": "1.0.4",
32
+ "@granite-js/native": "1.0.10",
33
+ "@granite-js/react-native": "1.0.10",
34
34
  "@types/react": "19.2.3",
35
35
  "dts-bundle-generator": "^9.5.1",
36
36
  "esbuild": "0.25.5",
@@ -42,7 +42,7 @@
42
42
  "vitest": "^3.2.4"
43
43
  },
44
44
  "dependencies": {
45
- "@apps-in-toss/types": "2.1.0",
45
+ "@apps-in-toss/types": "2.2.0",
46
46
  "brick-module": "0.5.0",
47
47
  "es-toolkit": "^1.39.3"
48
48
  },
@@ -51,5 +51,8 @@
51
51
  "@granite-js/react-native": "*",
52
52
  "react": "*",
53
53
  "react-native": "*"
54
+ },
55
+ "brickModule": {
56
+ "specSrc": "./src/spec"
54
57
  }
55
58
  }
@@ -0,0 +1,14 @@
1
+ import { BrickModule } from 'brick-module';
2
+ import type { CommonModuleSpec } from '../spec/CommonModule.brick';
3
+
4
+ /**
5
+ * CommonModule Instance
6
+ * Native module instance accessed through BrickModule
7
+ */
8
+ export const CommonModule = BrickModule.get<CommonModuleSpec>('CommonModule');
9
+
10
+ /**
11
+ * Deprecated exports for backward compatibility
12
+ */
13
+ /** @deprecated Use CommonModule instead */
14
+ export const BedrockModule = CommonModule;
@@ -52,7 +52,8 @@ import { CommonModule } from '../BedrockModule';
52
52
  * ```
53
53
  */
54
54
  export function getNetworkStatus(): Promise<NetworkStatus> {
55
- return CommonModule.getNetworkStatus();
55
+ // RN84에서는 동기, RN72에서는 비동기로 동작하지만, 안정성을 위해 항상 비동기로 처리해요.
56
+ return CommonModule.getNetworkStatus() as unknown as Promise<NetworkStatus>;
56
57
  }
57
58
 
58
59
  /** export type */
@@ -33,5 +33,5 @@ import { MiniAppModule } from '../../natives';
33
33
  * ```
34
34
  */
35
35
  export function getOperationalEnvironment(): 'toss' | 'sandbox' {
36
- return MiniAppModule.getConstants().operationalEnvironment;
36
+ return MiniAppModule.getConstants().operationalEnvironment as 'toss' | 'sandbox';
37
37
  }
@@ -520,6 +520,66 @@ async function completeProductGrant(params: { params: { orderId: string } }) {
520
520
  return safePostMessage('completeProductGrant', params.params);
521
521
  }
522
522
 
523
+ /**
524
+ * @public
525
+ * @category 인앱결제
526
+ * @name IapSubscriptionInfoResult
527
+ * @description 구독 주문의 현재 상태 정보를 담은 객체예요.
528
+ * @property {number} catalogId 구독 상품의 식별자예요.
529
+ * @property {"ACTIVE" |"EXPIRED"|"IN_GRACE_PERIOD"|"ON_HOLD"|"PAUSED"|"REVOKED"} status 구독 상태를 나타내는 값이에요.
530
+ * @property {string | null} expiresAt 구독 만료 예정 시각이에요. 만료 정보가 없으면 `null`이에요.
531
+ * @property {boolean} isAutoRenew 구독 자동 갱신 여부예요.
532
+ * @property {string | null} gracePeriodExpiresAt 결제 유예 기간 만료 시각이에요. 유예 기간이 없으면 `null`이에요.
533
+ * @property {boolean} isAccessible 현재 구독 상품을 이용할 수 있는지 여부예요.
534
+ */
535
+ export interface IapSubscriptionInfoResult {
536
+ catalogId: number;
537
+ status: 'ACTIVE' | 'EXPIRED' | 'IN_GRACE_PERIOD' | 'ON_HOLD' | 'PAUSED' | 'REVOKED';
538
+ expiresAt: string | null;
539
+ isAutoRenew: boolean;
540
+ gracePeriodExpiresAt: string | null;
541
+ isAccessible: boolean;
542
+ }
543
+
544
+ /**
545
+ * @public
546
+ * @category 인앱결제
547
+ * @name getSubscriptionInfo
548
+ * @description 구독 주문의 현재 상태 정보를 가져와요.
549
+ * @param {{ params: { orderId: string } }} params 조회할 구독 주문 정보를 담은 객체예요.
550
+ * @param {string} params.orderId 주문의 고유 ID예요.
551
+ * @returns {Promise<{ subscription: IapSubscriptionInfoResult } | undefined>} 구독 상태 정보를 담은 객체를 반환해요. 앱 버전이 최소 지원 버전(안드로이드 5.253.0, iOS 5.250.0)보다 낮으면 `undefined`를 반환해요.
552
+ *
553
+ * @example
554
+ * ### 주문 ID로 구독 상태 조회하기
555
+ * ```typescript
556
+ * import { IAP } from '@apps-in-toss/framework';
557
+ *
558
+ * async function fetchSubscriptionInfo(orderId: string) {
559
+ * try {
560
+ * const response = await IAP.getSubscriptionInfo({ params: { orderId } });
561
+ * return response?.subscription;
562
+ * } catch (error) {
563
+ * console.error(error);
564
+ * }
565
+ * }
566
+ * ```
567
+ */
568
+ async function getSubscriptionInfo(params: {
569
+ params: { orderId: string };
570
+ }): Promise<{ subscription: IapSubscriptionInfoResult } | undefined> {
571
+ const isSupported = isMinVersionSupported({
572
+ android: '5.253.0',
573
+ ios: '5.250.0',
574
+ });
575
+
576
+ if (!isSupported) {
577
+ return;
578
+ }
579
+
580
+ return safePostMessage('getSubscriptionInfo', params);
581
+ }
582
+
523
583
  /**
524
584
  * @public
525
585
  * @category 인앱결제
@@ -646,6 +706,7 @@ function createSubscriptionPurchaseOrder(params: CreateSubscriptionPurchaseOrder
646
706
  * @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) 문서를 참고하세요.
647
707
  * @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) 문서를 참고하세요.
648
708
  * @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) 문서를 참고하세요.
709
+ * @property {typeof getSubscriptionInfo} [getSubscriptionInfo] 구독 주문의 현재 상태 정보를 가져와요.
649
710
  */
650
711
  export const IAP = {
651
712
  createOneTimePurchaseOrder,
@@ -654,4 +715,5 @@ export const IAP = {
654
715
  getPendingOrders,
655
716
  getCompletedOrRefundedOrders,
656
717
  completeProductGrant,
718
+ getSubscriptionInfo,
657
719
  };
@@ -1,48 +1,22 @@
1
1
  import type {
2
2
  CompatiblePlaceholderArgument,
3
- PermissionName,
4
- PermissionAccess,
5
- PermissionStatus,
6
- ImageResponse,
7
3
  ContactResult,
4
+ ImageResponse,
8
5
  Location,
6
+ PermissionAccess,
7
+ PermissionName,
8
+ PermissionStatus,
9
9
  } from '@apps-in-toss/types';
10
- import { Any, AnyObject, BrickModule, BrickModuleSpec } from 'brick-module';
11
- import { CodegenTypes } from 'react-native';
12
- import type { AppsInTossSignTossCertParams } from './MiniAppModule/native-modules/appsInTossSignTossCert';
13
- import type { CheckoutPaymentOptions, CheckoutPaymentResult } from './MiniAppModule/native-modules/checkoutPayment';
14
- import type { GameCenterGameProfileResponse } from './MiniAppModule/native-modules/getGameCenterGameProfile';
15
- import type { GetUserKeyForGameResponse } from './MiniAppModule/native-modules/getUserKeyForGame';
16
- import type { GrantPromotionRewardForGameResponse } from './MiniAppModule/native-modules/grantPromotionRewardForGame';
17
- import type { IapCreateOneTimePurchaseOrderResult } from './MiniAppModule/native-modules/iap';
18
- import type { SaveBase64DataParams } from './MiniAppModule/native-modules/saveBase64Data';
19
- import type { SubmitGameCenterLeaderBoardScoreResponse } from './MiniAppModule/native-modules/submitGameCenterLeaderBoardScore';
20
-
21
- /**
22
- * MiniAppModule Spec
23
- * Unified type definition for MiniAppModule (formerly AppsInTossModule)
24
- */
25
- export interface MiniAppModuleSpec extends BrickModuleSpec {
26
- readonly moduleName: 'MiniAppModule';
27
- // readonly supportedEvents: ['updateLocation', 'visibilityChangedByTransparentServiceWeb', 'appBridgeCallback'];
28
-
29
- readonly onSendEvent: CodegenTypes.EventEmitter<{
30
- eventName: string; // updateLocation, visibilityChangedByTransparentServiceWeb, appBridgeCallback
31
- body: AnyObject;
32
- }>;
33
-
34
- getConstants(): {
35
- // Constants
36
- groupId: string;
37
- operationalEnvironment: 'sandbox' | 'toss';
38
- tossAppVersion: string;
39
- deviceId: string;
40
- };
41
-
42
- // All async/sync methods are now handled via postMessage/postMessageSync
43
- postMessage(name: string, params: AnyObject, callbacks: AnyObject): Promise<Any>;
44
- postMessageSync(name: string, params: AnyObject, callbacks: AnyObject): Any;
45
- }
10
+ import { BrickModule } from 'brick-module';
11
+ import type { AppsInTossSignTossCertParams } from './native-modules/appsInTossSignTossCert';
12
+ import type { CheckoutPaymentOptions, CheckoutPaymentResult } from './native-modules/checkoutPayment';
13
+ import type { GameCenterGameProfileResponse } from './native-modules/getGameCenterGameProfile';
14
+ import type { GetUserKeyForGameResponse } from './native-modules/getUserKeyForGame';
15
+ import type { GrantPromotionRewardForGameResponse } from './native-modules/grantPromotionRewardForGame';
16
+ import type { IapCreateOneTimePurchaseOrderResult, IapSubscriptionInfoResult } from './native-modules/iap';
17
+ import type { SaveBase64DataParams } from './native-modules/saveBase64Data';
18
+ import type { SubmitGameCenterLeaderBoardScoreResponse } from './native-modules/submitGameCenterLeaderBoardScore';
19
+ import type { MiniAppModuleSpec } from '../spec/MiniAppModule.brick';
46
20
 
47
21
  /**
48
22
  * Async Methods Map
@@ -72,7 +46,7 @@ export interface AsyncMethodsMap {
72
46
  startUpdateLocation: (params: { accuracy: number; timeInterval: number; distanceInterval: number }) => Promise<void>;
73
47
  getCurrentLocation: (params: { accuracy: number }) => Promise<Location>;
74
48
 
75
- // IAP (6)
49
+ // IAP (7)
76
50
  iapCreateOneTimePurchaseOrder: (params: { productId: string }) => Promise<IapCreateOneTimePurchaseOrderResult>;
77
51
  processProductGrant: (params: { orderId: string; isProductGranted: boolean }) => Promise<void>;
78
52
  iapGetProductItemList: (params: CompatiblePlaceholderArgument) => Promise<{ products: any[] }>;
@@ -81,6 +55,9 @@ export interface AsyncMethodsMap {
81
55
  ) => Promise<{ orders: Array<{ orderId: string; sku: string }> }>;
82
56
  getCompletedOrRefundedOrders: (params: { key?: string | null }) => Promise<any>;
83
57
  completeProductGrant: (params: { orderId: string }) => Promise<boolean>;
58
+ getSubscriptionInfo: (params: {
59
+ params: { orderId: string };
60
+ }) => Promise<{ subscription: IapSubscriptionInfoResult }>;
84
61
 
85
62
  // Other (9)
86
63
  eventLog: (params: { log_name: string; log_type: string; params: Record<string, string> }) => Promise<void>;
@@ -0,0 +1,8 @@
1
+ import { BrickModule } from 'brick-module';
2
+ import type { TossCoreModuleSpec } from '../spec/TossCoreModule.brick';
3
+
4
+ /**
5
+ * TossCoreModule Instance
6
+ * Native module instance accessed through BrickModule
7
+ */
8
+ export const TossCoreModule = BrickModule.get<TossCoreModuleSpec>('TossCoreModule');
package/src/index.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  // MiniAppModule (formerly AppsInTossModule)
2
- export { safePostMessage, safeSyncPostMessage } from './MiniAppModule.brick';
2
+ export { safePostMessage, safeSyncPostMessage } from './MiniAppModule/postMessage';
3
3
  export * from './MiniAppModule/native-event-emitter';
4
4
  export * from './MiniAppModule/native-modules';
5
5
 
package/src/natives.ts CHANGED
@@ -5,6 +5,10 @@
5
5
  * This file re-exports all native module definitions for backward compatibility.
6
6
  */
7
7
 
8
- export * from './MiniAppModule.brick';
9
- export * from './TossCoreModule.brick';
10
- export * from './CommonModule.brick';
8
+ export * from './spec/MiniAppModule.brick';
9
+ export * from './spec/TossCoreModule.brick';
10
+ export * from './spec/CommonModule.brick';
11
+
12
+ export * from './MiniAppModule/postMessage';
13
+ export * from './BedrockModule/commonModule';
14
+ export * from './TossCoreModule/instance';
@@ -0,0 +1,48 @@
1
+ import { BrickModuleSpec } from 'brick-module';
2
+
3
+ interface ScreenAwakeModeParameter {
4
+ enabled: boolean;
5
+ }
6
+
7
+ interface SecureScreenParameter {
8
+ enabled: boolean;
9
+ }
10
+
11
+ interface HapticParameter {
12
+ type: string;
13
+ }
14
+
15
+ interface IosSwipeGestureParameters {
16
+ isEnabled: boolean;
17
+ }
18
+
19
+ interface ShareParameter {
20
+ message: string;
21
+ }
22
+
23
+ interface LeftEdgeTouchEnabledParameter {
24
+ isEnabled: boolean;
25
+ }
26
+
27
+ /**
28
+ * CommonModule Spec
29
+ * Unified type definition for CommonModule (formerly BedrockModule)
30
+ */
31
+ export interface CommonModuleSpec extends BrickModuleSpec {
32
+ readonly moduleName: 'CommonModule';
33
+
34
+ getConstants(): {
35
+ schemeUri: string;
36
+ locale: string;
37
+ };
38
+
39
+ getNetworkStatus(): string;
40
+ closeView(): void;
41
+ generateHapticFeedback(parameter: HapticParameter): Promise<void>;
42
+ share(parameter: ShareParameter): void;
43
+ setSecureScreen(parameter: SecureScreenParameter): Promise<{ enabled: boolean }>;
44
+ setScreenAwakeMode(parameter: ScreenAwakeModeParameter): Promise<{ enabled: boolean }>;
45
+ setIosSwipeGestureEnabled(parameter: IosSwipeGestureParameters): Promise<void>;
46
+
47
+ setLeftEdgeTouchEnabled(parameter: LeftEdgeTouchEnabledParameter): void;
48
+ }
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Granite Screen module for Brick framework
3
+ * Provides bundle loading and management with automatic bridge generation
4
+ */
5
+
6
+ import type { BrickModuleSpec } from 'brick-module';
7
+
8
+ export interface MiniAppBundleLoaderModuleSpec extends BrickModuleSpec {
9
+ readonly moduleName: 'MiniAppBundleLoader';
10
+
11
+ // Import bundle lazily
12
+ importLazy(): Promise<void>;
13
+ }
@@ -0,0 +1,27 @@
1
+ import { Any, AnyObject, BrickModuleSpec } from 'brick-module';
2
+ import { CodegenTypes } from 'react-native';
3
+
4
+ /**
5
+ * MiniAppModule Spec
6
+ * Unified type definition for MiniAppModule (formerly AppsInTossModule)
7
+ */
8
+ export interface MiniAppModuleSpec extends BrickModuleSpec {
9
+ readonly moduleName: 'MiniAppModule';
10
+
11
+ getConstants(): {
12
+ groupId: string;
13
+ operationalEnvironment: string;
14
+ tossAppVersion: string;
15
+ deviceId: string;
16
+ };
17
+
18
+ // All async/sync methods are now handled via postMessage/postMessageSync
19
+ postMessage(name: string, params: AnyObject, callbacks: AnyObject): Promise<Any>;
20
+ postMessageSync(name: string, params: AnyObject, callbacks: AnyObject): Any;
21
+
22
+ // readonly supportedEvents: ['sendEvent'];
23
+ readonly onSendEvent: CodegenTypes.EventEmitter<{
24
+ eventName: string; // updateLocation, visibilityChangedByTransparentServiceWeb, appBridgeCallback
25
+ body: AnyObject;
26
+ }>;
27
+ }
@@ -0,0 +1,11 @@
1
+ import { AnyObject, BrickModuleSpec } from 'brick-module';
2
+
3
+ /**
4
+ * TossCoreModule Spec
5
+ * Unified type definition for TossCoreModule (Toss App internal logging)
6
+ */
7
+ export interface TossCoreModuleSpec extends BrickModuleSpec {
8
+ readonly moduleName: 'TossCoreModule';
9
+
10
+ eventLog(params: AnyObject): Promise<void>;
11
+ }
@@ -1,36 +0,0 @@
1
- import { BrickModule, BrickModuleSpec } from 'brick-module';
2
- import type { HapticFeedbackOptions } from './BedrockModule/native-modules/natives/generateHapticFeedback/types';
3
- import type { NetworkStatus } from './BedrockModule/native-modules/natives/getNetworkStatus/types';
4
-
5
- /**
6
- * CommonModule Spec
7
- * Unified type definition for CommonModule (formerly BedrockModule)
8
- */
9
- export interface CommonModuleSpec extends BrickModuleSpec {
10
- readonly moduleName: 'BedrockModule';
11
-
12
- getConstants(): {
13
- locale: string;
14
- schemeUri: string;
15
- };
16
-
17
- closeView: () => void;
18
- generateHapticFeedback: (options: HapticFeedbackOptions) => Promise<void>;
19
- share: (message: { message: string }) => void;
20
- setSecureScreen: (options: { enabled: boolean }) => Promise<{ enabled: boolean }>;
21
- setScreenAwakeMode: (options: { enabled: boolean }) => Promise<{ enabled: boolean }>;
22
- getNetworkStatus: () => Promise<NetworkStatus>;
23
- setIosSwipeGestureEnabled: ({ isEnabled }: { isEnabled: boolean }) => Promise<void>;
24
- }
25
-
26
- /**
27
- * CommonModule Instance
28
- * Native module instance accessed through BrickModule
29
- */
30
- export const CommonModule = BrickModule.get<CommonModuleSpec>('CommonModule');
31
-
32
- /**
33
- * Deprecated exports for backward compatibility
34
- */
35
- /** @deprecated Use CommonModule instead */
36
- export const BedrockModule = CommonModule;
@@ -1,17 +0,0 @@
1
- import { BrickModule, BrickModuleSpec } from 'brick-module';
2
-
3
- /**
4
- * TossCoreModule Spec
5
- * Unified type definition for TossCoreModule (Toss App internal logging)
6
- */
7
- export interface TossCoreModuleSpec extends BrickModuleSpec {
8
- readonly moduleName: 'TossCoreModule';
9
-
10
- eventLog: (params: { log_name: string; log_type: string; params: Record<string, unknown> }) => Promise<void>;
11
- }
12
-
13
- /**
14
- * TossCoreModule Instance
15
- * Native module instance accessed through BrickModule
16
- */
17
- export const TossCoreModule = BrickModule.get<TossCoreModuleSpec>('TossCoreModule');