@apps-in-toss/native-modules 2.2.0 → 2.4.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.
@@ -127,6 +127,10 @@
127
127
  "identifier": "getServerTime",
128
128
  "dts": "/**\n * @public\n * @category 시간\n * @name getServerTime\n * @description\n * 토스 앱 서버의 현재 시간을 Unix timestamp 형식으로 가져와요.\n * 디바이스 시간이 아닌 서버 기준 시간을 반환하므로 클라이언트 시간 조작에 따른 보상 중복 수령 등의 치팅을 방지할 수 있어요.\n *\n * @returns {Promise<number | undefined>} 서버 시간을 Unix timestamp 밀리초 단위로 반환해요. (예: 1705123456789) 지원하지 않는 버전에서는 `undefined`를 반환해요.\n * @property {() => boolean} isSupported 현재 앱 버전이 이 기능을 지원하는지 확인하는 함수예요.\n *\n * @example\n * ```tsx\n * import { getServerTime } from '@apps-in-toss/framework';\n *\n * async function checkRewardEligibility() {\n * // 버전 체크를 먼저 수행하는 것을 권장해요\n * if (!getServerTime.isSupported()) {\n * console.log('이 기능은 지원되지 않는 버전입니다.');\n * return;\n * }\n *\n * const serverTime = await getServerTime();\n * const rewardDeadline = 1705200000000;\n *\n * if (serverTime && serverTime > rewardDeadline) {\n * console.log('보상 수령 기간이 지났습니다.');\n * }\n * }\n * ```\n */\nexport declare function getServerTime(): Promise<number | undefined>;\nexport declare namespace getServerTime {\n\tvar isSupported: () => boolean;\n}\n\nexport {};\n"
129
129
  },
130
+ {
131
+ "identifier": "requestReview",
132
+ "dts": "/**\n * @public\n * @category 리뷰\n * @name getServerTime\n * @description\n * 유저에게 미니앱 리뷰를 요청해요.\n *\n * @property {() => boolean} isSupported 현재 앱 버전이 이 기능을 지원하는지 확인하는 함수예요.\n */\nexport declare function requestReview(): Promise<void>;\nexport declare namespace requestReview {\n\tvar isSupported: () => boolean;\n}\n\nexport {};\n"
133
+ },
130
134
  {
131
135
  "identifier": "getLocale",
132
136
  "dts": "/**\n * @public\n * @category 언어\n * @kind function\n * @name getLocale\n * @description\n * 사용자의 로케일(locale) 정보를 반환해요. 네이티브 모듈에서 로케일 정보를 가져올 수 없을 때는 기본값으로 'ko-KR'을 반환합니다. 앱의 현지화 및 언어 설정과 관련된 기능을 구현할 때 사용하세요.\n *\n * @returns {string} 사용자의 로케일 정보를 반환해요.\n *\n * @example\n * ### 현재 사용자의 로케일 정보 가져오기\n *\n * ```tsx\n * import { getLocale } from '@apps-in-toss/native-modules';\n * import { Text } from 'react-native';\n *\n * function MyPage() {\n * const locale = getLocale();\n *\n * return (\n * <Text>사용자의 로케일 정보: {locale}</Text>\n * )\n * }\n *\n * ```\n */\nexport declare function getLocale(): string;\n\nexport {};\n"
package/dist/index.cjs CHANGED
@@ -62,6 +62,7 @@ __export(index_exports, {
62
62
  openURL: () => openURL2,
63
63
  processProductGrant: () => processProductGrant,
64
64
  requestOneTimePurchase: () => requestOneTimePurchase,
65
+ requestReview: () => requestReview,
65
66
  safePostMessage: () => safePostMessage,
66
67
  safeSyncPostMessage: () => safeSyncPostMessage,
67
68
  saveBase64Data: () => saveBase64Data,
@@ -1055,6 +1056,21 @@ async function getServerTime() {
1055
1056
  }
1056
1057
  getServerTime.isSupported = () => isMinVersionSupported(GET_SERVER_TIME_MIN_VERSION);
1057
1058
 
1059
+ // src/MiniAppModule/native-modules/requestReview.ts
1060
+ var MIN_VERSION = { android: "5.253.0", ios: "5.253.0" };
1061
+ async function requestReview() {
1062
+ const isSupported = requestReview.isSupported();
1063
+ if (!isSupported) {
1064
+ return;
1065
+ }
1066
+ const brandDisplayName = global.__appsInToss?.brandDisplayName;
1067
+ if (brandDisplayName == null) {
1068
+ throw new Error("requestReview: Not AppsInToss Environment");
1069
+ }
1070
+ return safePostMessage("requestMiniAppReview", { title: brandDisplayName });
1071
+ }
1072
+ requestReview.isSupported = () => MiniAppModule.getConstants().operationalEnvironment === "toss" && isMinVersionSupported(MIN_VERSION);
1073
+
1058
1074
  // src/MiniAppModule/native-modules/index.ts
1059
1075
  var TossPay = {
1060
1076
  checkoutPayment
@@ -1213,6 +1229,7 @@ var INTERNAL__module = {
1213
1229
  openURL,
1214
1230
  processProductGrant,
1215
1231
  requestOneTimePurchase,
1232
+ requestReview,
1216
1233
  safePostMessage,
1217
1234
  safeSyncPostMessage,
1218
1235
  saveBase64Data,
package/dist/index.d.cts CHANGED
@@ -1145,6 +1145,9 @@ interface AsyncMethodsMap {
1145
1145
  shareWithScheme: (params: {
1146
1146
  schemeURL: string;
1147
1147
  }) => Promise<void>;
1148
+ requestMiniAppReview: (params: {
1149
+ title: string;
1150
+ }) => Promise<void>;
1148
1151
  }
1149
1152
  /**
1150
1153
  * Sync Methods Map
@@ -2836,6 +2839,20 @@ declare namespace getServerTime {
2836
2839
  var isSupported: () => boolean;
2837
2840
  }
2838
2841
 
2842
+ /**
2843
+ * @public
2844
+ * @category 리뷰
2845
+ * @name getServerTime
2846
+ * @description
2847
+ * 유저에게 미니앱 리뷰를 요청해요.
2848
+ *
2849
+ * @property {() => boolean} isSupported 현재 앱 버전이 이 기능을 지원하는지 확인하는 함수예요.
2850
+ */
2851
+ declare function requestReview(): Promise<void>;
2852
+ declare namespace requestReview {
2853
+ var isSupported: () => boolean;
2854
+ }
2855
+
2839
2856
  /**
2840
2857
  * @public
2841
2858
  * @category 토스페이
@@ -3293,4 +3310,4 @@ declare const INTERNAL__module: {
3293
3310
  tossCoreEventLog: typeof tossCoreEventLog;
3294
3311
  };
3295
3312
 
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 };
3313
+ 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, requestReview, safePostMessage, safeSyncPostMessage, saveBase64Data, setClipboardText, setDeviceOrientation, setIosSwipeGestureEnabled, setScreenAwakeMode, setSecureScreen, share, shareWithScheme, startUpdateLocation, submitGameCenterLeaderBoardScore };
package/dist/index.d.ts CHANGED
@@ -1145,6 +1145,9 @@ interface AsyncMethodsMap {
1145
1145
  shareWithScheme: (params: {
1146
1146
  schemeURL: string;
1147
1147
  }) => Promise<void>;
1148
+ requestMiniAppReview: (params: {
1149
+ title: string;
1150
+ }) => Promise<void>;
1148
1151
  }
1149
1152
  /**
1150
1153
  * Sync Methods Map
@@ -2836,6 +2839,20 @@ declare namespace getServerTime {
2836
2839
  var isSupported: () => boolean;
2837
2840
  }
2838
2841
 
2842
+ /**
2843
+ * @public
2844
+ * @category 리뷰
2845
+ * @name getServerTime
2846
+ * @description
2847
+ * 유저에게 미니앱 리뷰를 요청해요.
2848
+ *
2849
+ * @property {() => boolean} isSupported 현재 앱 버전이 이 기능을 지원하는지 확인하는 함수예요.
2850
+ */
2851
+ declare function requestReview(): Promise<void>;
2852
+ declare namespace requestReview {
2853
+ var isSupported: () => boolean;
2854
+ }
2855
+
2839
2856
  /**
2840
2857
  * @public
2841
2858
  * @category 토스페이
@@ -3293,4 +3310,4 @@ declare const INTERNAL__module: {
3293
3310
  tossCoreEventLog: typeof tossCoreEventLog;
3294
3311
  };
3295
3312
 
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 };
3313
+ 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, requestReview, safePostMessage, safeSyncPostMessage, saveBase64Data, setClipboardText, setDeviceOrientation, setIosSwipeGestureEnabled, setScreenAwakeMode, setSecureScreen, share, shareWithScheme, startUpdateLocation, submitGameCenterLeaderBoardScore };
package/dist/index.js CHANGED
@@ -976,6 +976,21 @@ async function getServerTime() {
976
976
  }
977
977
  getServerTime.isSupported = () => isMinVersionSupported(GET_SERVER_TIME_MIN_VERSION);
978
978
 
979
+ // src/MiniAppModule/native-modules/requestReview.ts
980
+ var MIN_VERSION = { android: "5.253.0", ios: "5.253.0" };
981
+ async function requestReview() {
982
+ const isSupported = requestReview.isSupported();
983
+ if (!isSupported) {
984
+ return;
985
+ }
986
+ const brandDisplayName = global.__appsInToss?.brandDisplayName;
987
+ if (brandDisplayName == null) {
988
+ throw new Error("requestReview: Not AppsInToss Environment");
989
+ }
990
+ return safePostMessage("requestMiniAppReview", { title: brandDisplayName });
991
+ }
992
+ requestReview.isSupported = () => MiniAppModule.getConstants().operationalEnvironment === "toss" && isMinVersionSupported(MIN_VERSION);
993
+
979
994
  // src/MiniAppModule/native-modules/index.ts
980
995
  var TossPay = {
981
996
  checkoutPayment
@@ -1133,6 +1148,7 @@ export {
1133
1148
  openURL2 as openURL,
1134
1149
  processProductGrant,
1135
1150
  requestOneTimePurchase,
1151
+ requestReview,
1136
1152
  safePostMessage,
1137
1153
  safeSyncPostMessage,
1138
1154
  saveBase64Data,
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.2.0",
4
+ "version": "2.4.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.2.0",
45
+ "@apps-in-toss/types": "2.4.0",
46
46
  "brick-module": "0.5.0",
47
47
  "es-toolkit": "^1.39.3"
48
48
  },
@@ -44,9 +44,9 @@ export * from './getIsTossLoginIntegratedService';
44
44
  export * from '../native-event-emitter/contactsViral';
45
45
  export * from './appsInTossSignTossCert';
46
46
  export * from './getGroupId';
47
-
48
47
  export * from './shareWithScheme';
49
48
  export * from './getServerTime';
49
+ export * from './requestReview';
50
50
 
51
51
  export type {
52
52
  CheckoutPaymentOptions,
@@ -0,0 +1,33 @@
1
+ import { isMinVersionSupported } from './isMinVersionSupported';
2
+ import { MiniAppModule, safePostMessage } from '../../natives';
3
+
4
+ const MIN_VERSION = { android: '5.253.0', ios: '5.253.0' } as const;
5
+
6
+ /**
7
+ * @public
8
+ * @category 리뷰
9
+ * @name getServerTime
10
+ * @description
11
+ * 유저에게 미니앱 리뷰를 요청해요.
12
+ *
13
+ * @property {() => boolean} isSupported 현재 앱 버전이 이 기능을 지원하는지 확인하는 함수예요.
14
+ */
15
+ export async function requestReview(): Promise<void> {
16
+ const isSupported = requestReview.isSupported();
17
+
18
+ if (!isSupported) {
19
+ return;
20
+ }
21
+
22
+ const brandDisplayName = global.__appsInToss?.brandDisplayName;
23
+
24
+ if (brandDisplayName == null) {
25
+ throw new Error('requestReview: Not AppsInToss Environment');
26
+ }
27
+
28
+ return safePostMessage('requestMiniAppReview', { title: brandDisplayName });
29
+ }
30
+ requestReview.isSupported = () =>
31
+ MiniAppModule.getConstants().operationalEnvironment === 'toss' && isMinVersionSupported(MIN_VERSION);
32
+
33
+ declare const global: { __granite: any; __appsInToss: any };
@@ -95,6 +95,7 @@ export interface AsyncMethodsMap {
95
95
 
96
96
  getServerTime: (params: CompatiblePlaceholderArgument) => Promise<{ serverTime: number }>;
97
97
  shareWithScheme: (params: { schemeURL: string }) => Promise<void>;
98
+ requestMiniAppReview: (params: { title: string }) => Promise<void>;
98
99
  }
99
100
 
100
101
  /**
@@ -33,3 +33,4 @@ export * from './MiniAppModule/native-modules/grantPromotionReward';
33
33
  export * from './MiniAppModule/native-modules/grantPromotionRewardForGame';
34
34
  export * from './MiniAppModule/native-modules/getIsTossLoginIntegratedService';
35
35
  export * from './MiniAppModule/native-modules/getServerTime';
36
+ export * from './MiniAppModule/native-modules/requestReview';