@apps-in-toss/native-modules 2.1.1 → 2.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.
- package/dist/index.cjs +12 -1
- package/dist/index.d.cts +61 -1
- package/dist/index.d.ts +61 -1
- package/dist/index.js +12 -1
- package/package.json +2 -2
- package/src/MiniAppModule/native-modules/iap.ts +62 -0
- package/src/MiniAppModule/postMessage.ts +9 -6
package/dist/index.cjs
CHANGED
|
@@ -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
|
@@ -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.
|
|
4
|
+
"version": "2.3.0",
|
|
5
5
|
"description": "Native Modules for Apps In Toss",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"typecheck": "tsc --noEmit",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"vitest": "^3.2.4"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@apps-in-toss/types": "2.
|
|
45
|
+
"@apps-in-toss/types": "2.3.0",
|
|
46
46
|
"brick-module": "0.5.0",
|
|
47
47
|
"es-toolkit": "^1.39.3"
|
|
48
48
|
},
|
|
@@ -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,11 +1,11 @@
|
|
|
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
10
|
import { BrickModule } from 'brick-module';
|
|
11
11
|
import type { AppsInTossSignTossCertParams } from './native-modules/appsInTossSignTossCert';
|
|
@@ -13,7 +13,7 @@ import type { CheckoutPaymentOptions, CheckoutPaymentResult } from './native-mod
|
|
|
13
13
|
import type { GameCenterGameProfileResponse } from './native-modules/getGameCenterGameProfile';
|
|
14
14
|
import type { GetUserKeyForGameResponse } from './native-modules/getUserKeyForGame';
|
|
15
15
|
import type { GrantPromotionRewardForGameResponse } from './native-modules/grantPromotionRewardForGame';
|
|
16
|
-
import type { IapCreateOneTimePurchaseOrderResult } from './native-modules/iap';
|
|
16
|
+
import type { IapCreateOneTimePurchaseOrderResult, IapSubscriptionInfoResult } from './native-modules/iap';
|
|
17
17
|
import type { SaveBase64DataParams } from './native-modules/saveBase64Data';
|
|
18
18
|
import type { SubmitGameCenterLeaderBoardScoreResponse } from './native-modules/submitGameCenterLeaderBoardScore';
|
|
19
19
|
import type { MiniAppModuleSpec } from '../spec/MiniAppModule.brick';
|
|
@@ -46,7 +46,7 @@ export interface AsyncMethodsMap {
|
|
|
46
46
|
startUpdateLocation: (params: { accuracy: number; timeInterval: number; distanceInterval: number }) => Promise<void>;
|
|
47
47
|
getCurrentLocation: (params: { accuracy: number }) => Promise<Location>;
|
|
48
48
|
|
|
49
|
-
// IAP (
|
|
49
|
+
// IAP (7)
|
|
50
50
|
iapCreateOneTimePurchaseOrder: (params: { productId: string }) => Promise<IapCreateOneTimePurchaseOrderResult>;
|
|
51
51
|
processProductGrant: (params: { orderId: string; isProductGranted: boolean }) => Promise<void>;
|
|
52
52
|
iapGetProductItemList: (params: CompatiblePlaceholderArgument) => Promise<{ products: any[] }>;
|
|
@@ -55,6 +55,9 @@ export interface AsyncMethodsMap {
|
|
|
55
55
|
) => Promise<{ orders: Array<{ orderId: string; sku: string }> }>;
|
|
56
56
|
getCompletedOrRefundedOrders: (params: { key?: string | null }) => Promise<any>;
|
|
57
57
|
completeProductGrant: (params: { orderId: string }) => Promise<boolean>;
|
|
58
|
+
getSubscriptionInfo: (params: {
|
|
59
|
+
params: { orderId: string };
|
|
60
|
+
}) => Promise<{ subscription: IapSubscriptionInfoResult }>;
|
|
58
61
|
|
|
59
62
|
// Other (9)
|
|
60
63
|
eventLog: (params: { log_name: string; log_type: string; params: Record<string, string> }) => Promise<void>;
|