@apps-in-toss/native-modules 2.3.0 → 2.4.1

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,
@@ -77,9 +78,11 @@ __export(index_exports, {
77
78
  });
78
79
  module.exports = __toCommonJS(index_exports);
79
80
 
80
- // src/MiniAppModule/postMessage.ts
81
+ // src/spec/MiniAppModule.brick.ts
81
82
  var import_brick_module = require("brick-module");
82
83
  var MiniAppModule = import_brick_module.BrickModule.get("MiniAppModule");
84
+
85
+ // src/MiniAppModule/postMessage.ts
83
86
  function safePostMessage(method, params) {
84
87
  return MiniAppModule.postMessage(method, params, {});
85
88
  }
@@ -94,13 +97,13 @@ var import_react_native4 = require("@granite-js/react-native");
94
97
  var import_types = require("@apps-in-toss/types");
95
98
  var import_react_native = require("@granite-js/react-native");
96
99
 
97
- // src/BedrockModule/commonModule.ts
100
+ // src/spec/TossCoreModule.brick.ts
98
101
  var import_brick_module2 = require("brick-module");
99
- var CommonModule = import_brick_module2.BrickModule.get("CommonModule");
102
+ var TossCoreModule = import_brick_module2.BrickModule.get("TossCoreModule");
100
103
 
101
- // src/TossCoreModule/instance.ts
104
+ // src/spec/CommonModule.brick.ts
102
105
  var import_brick_module3 = require("brick-module");
103
- var TossCoreModule = import_brick_module3.BrickModule.get("TossCoreModule");
106
+ var CommonModule = import_brick_module3.BrickModule.get("CommonModule");
104
107
 
105
108
  // src/MiniAppModule/native-modules/permissions/openPermissionDialog.ts
106
109
  function openPermissionDialog(permission) {
@@ -1055,6 +1058,21 @@ async function getServerTime() {
1055
1058
  }
1056
1059
  getServerTime.isSupported = () => isMinVersionSupported(GET_SERVER_TIME_MIN_VERSION);
1057
1060
 
1061
+ // src/MiniAppModule/native-modules/requestReview.ts
1062
+ var MIN_VERSION = { android: "5.253.0", ios: "5.253.0" };
1063
+ async function requestReview() {
1064
+ const isSupported = requestReview.isSupported();
1065
+ if (!isSupported) {
1066
+ return;
1067
+ }
1068
+ const brandDisplayName = global.__appsInToss?.brandDisplayName;
1069
+ if (brandDisplayName == null) {
1070
+ throw new Error("requestReview: Not AppsInToss Environment");
1071
+ }
1072
+ return safePostMessage("requestMiniAppReview", { title: brandDisplayName });
1073
+ }
1074
+ requestReview.isSupported = () => MiniAppModule.getConstants().operationalEnvironment === "toss" && isMinVersionSupported(MIN_VERSION);
1075
+
1058
1076
  // src/MiniAppModule/native-modules/index.ts
1059
1077
  var TossPay = {
1060
1078
  checkoutPayment
@@ -1213,6 +1231,7 @@ var INTERNAL__module = {
1213
1231
  openURL,
1214
1232
  processProductGrant,
1215
1233
  requestOneTimePurchase,
1234
+ requestReview,
1216
1235
  safePostMessage,
1217
1236
  safeSyncPostMessage,
1218
1237
  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
@@ -1,6 +1,8 @@
1
- // src/MiniAppModule/postMessage.ts
1
+ // src/spec/MiniAppModule.brick.ts
2
2
  import { BrickModule } from "brick-module";
3
3
  var MiniAppModule = BrickModule.get("MiniAppModule");
4
+
5
+ // src/MiniAppModule/postMessage.ts
4
6
  function safePostMessage(method, params) {
5
7
  return MiniAppModule.postMessage(method, params, {});
6
8
  }
@@ -15,13 +17,13 @@ import { GraniteEvent } from "@granite-js/react-native";
15
17
  import { GetCurrentLocationPermissionError } from "@apps-in-toss/types";
16
18
  import { GraniteEventDefinition } from "@granite-js/react-native";
17
19
 
18
- // src/BedrockModule/commonModule.ts
20
+ // src/spec/TossCoreModule.brick.ts
19
21
  import { BrickModule as BrickModule2 } from "brick-module";
20
- var CommonModule = BrickModule2.get("CommonModule");
22
+ var TossCoreModule = BrickModule2.get("TossCoreModule");
21
23
 
22
- // src/TossCoreModule/instance.ts
24
+ // src/spec/CommonModule.brick.ts
23
25
  import { BrickModule as BrickModule3 } from "brick-module";
24
- var TossCoreModule = BrickModule3.get("TossCoreModule");
26
+ var CommonModule = BrickModule3.get("CommonModule");
25
27
 
26
28
  // src/MiniAppModule/native-modules/permissions/openPermissionDialog.ts
27
29
  function openPermissionDialog(permission) {
@@ -976,6 +978,21 @@ async function getServerTime() {
976
978
  }
977
979
  getServerTime.isSupported = () => isMinVersionSupported(GET_SERVER_TIME_MIN_VERSION);
978
980
 
981
+ // src/MiniAppModule/native-modules/requestReview.ts
982
+ var MIN_VERSION = { android: "5.253.0", ios: "5.253.0" };
983
+ async function requestReview() {
984
+ const isSupported = requestReview.isSupported();
985
+ if (!isSupported) {
986
+ return;
987
+ }
988
+ const brandDisplayName = global.__appsInToss?.brandDisplayName;
989
+ if (brandDisplayName == null) {
990
+ throw new Error("requestReview: Not AppsInToss Environment");
991
+ }
992
+ return safePostMessage("requestMiniAppReview", { title: brandDisplayName });
993
+ }
994
+ requestReview.isSupported = () => MiniAppModule.getConstants().operationalEnvironment === "toss" && isMinVersionSupported(MIN_VERSION);
995
+
979
996
  // src/MiniAppModule/native-modules/index.ts
980
997
  var TossPay = {
981
998
  checkoutPayment
@@ -1133,6 +1150,7 @@ export {
1133
1150
  openURL2 as openURL,
1134
1151
  processProductGrant,
1135
1152
  requestOneTimePurchase,
1153
+ requestReview,
1136
1154
  safePostMessage,
1137
1155
  safeSyncPostMessage,
1138
1156
  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.3.0",
4
+ "version": "2.4.1",
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.3.0",
45
+ "@apps-in-toss/types": "2.4.1",
46
46
  "brick-module": "0.5.0",
47
47
  "es-toolkit": "^1.39.3"
48
48
  },
@@ -1,14 +1,12 @@
1
- import { BrickModule } from 'brick-module';
2
- import type { CommonModuleSpec } from '../spec/CommonModule.brick';
3
-
4
1
  /**
5
2
  * CommonModule Instance
6
3
  * Native module instance accessed through BrickModule
7
4
  */
8
- export const CommonModule = BrickModule.get<CommonModuleSpec>('CommonModule');
9
-
10
5
  /**
11
6
  * Deprecated exports for backward compatibility
12
7
  */
8
+
9
+ import { CommonModule } from '../spec/CommonModule.brick';
10
+
13
11
  /** @deprecated Use CommonModule instead */
14
12
  export const BedrockModule = CommonModule;
@@ -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 };
@@ -7,7 +7,6 @@ import type {
7
7
  PermissionName,
8
8
  PermissionStatus,
9
9
  } from '@apps-in-toss/types';
10
- import { BrickModule } from 'brick-module';
11
10
  import type { AppsInTossSignTossCertParams } from './native-modules/appsInTossSignTossCert';
12
11
  import type { CheckoutPaymentOptions, CheckoutPaymentResult } from './native-modules/checkoutPayment';
13
12
  import type { GameCenterGameProfileResponse } from './native-modules/getGameCenterGameProfile';
@@ -16,7 +15,7 @@ import type { GrantPromotionRewardForGameResponse } from './native-modules/grant
16
15
  import type { IapCreateOneTimePurchaseOrderResult, IapSubscriptionInfoResult } from './native-modules/iap';
17
16
  import type { SaveBase64DataParams } from './native-modules/saveBase64Data';
18
17
  import type { SubmitGameCenterLeaderBoardScoreResponse } from './native-modules/submitGameCenterLeaderBoardScore';
19
- import type { MiniAppModuleSpec } from '../spec/MiniAppModule.brick';
18
+ import { MiniAppModule } from '../spec/MiniAppModule.brick';
20
19
 
21
20
  /**
22
21
  * Async Methods Map
@@ -95,6 +94,7 @@ export interface AsyncMethodsMap {
95
94
 
96
95
  getServerTime: (params: CompatiblePlaceholderArgument) => Promise<{ serverTime: number }>;
97
96
  shareWithScheme: (params: { schemeURL: string }) => Promise<void>;
97
+ requestMiniAppReview: (params: { title: string }) => Promise<void>;
98
98
  }
99
99
 
100
100
  /**
@@ -106,12 +106,6 @@ export interface SyncMethodsMap {
106
106
  stopUpdateLocation: (params: object) => void;
107
107
  }
108
108
 
109
- /**
110
- * MiniAppModule Instance
111
- * Native module instance accessed through BrickModule
112
- */
113
- export const MiniAppModule = BrickModule.get<MiniAppModuleSpec>('MiniAppModule');
114
-
115
109
  /**
116
110
  * Type-safe postMessage wrapper
117
111
  * Provides type inference for async method calls without requiring 'as unknown' casts
@@ -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';
package/src/natives.ts CHANGED
@@ -11,4 +11,3 @@ export * from './spec/CommonModule.brick';
11
11
 
12
12
  export * from './MiniAppModule/postMessage';
13
13
  export * from './BedrockModule/commonModule';
14
- export * from './TossCoreModule/instance';
@@ -1,4 +1,4 @@
1
- import { BrickModuleSpec } from 'brick-module';
1
+ import { BrickModule, BrickModuleSpec } from 'brick-module';
2
2
 
3
3
  interface ScreenAwakeModeParameter {
4
4
  enabled: boolean;
@@ -46,3 +46,5 @@ export interface CommonModuleSpec extends BrickModuleSpec {
46
46
 
47
47
  setLeftEdgeTouchEnabled(parameter: LeftEdgeTouchEnabledParameter): void;
48
48
  }
49
+
50
+ export const CommonModule = BrickModule.get<CommonModuleSpec>('CommonModule');
@@ -1,4 +1,4 @@
1
- import { Any, AnyObject, BrickModuleSpec } from 'brick-module';
1
+ import { Any, AnyObject, BrickModule, BrickModuleSpec } from 'brick-module';
2
2
  import { CodegenTypes } from 'react-native';
3
3
 
4
4
  /**
@@ -25,3 +25,5 @@ export interface MiniAppModuleSpec extends BrickModuleSpec {
25
25
  body: AnyObject;
26
26
  }>;
27
27
  }
28
+
29
+ export const MiniAppModule = BrickModule.get<MiniAppModuleSpec>('MiniAppModule');
@@ -1,4 +1,4 @@
1
- import { AnyObject, BrickModuleSpec } from 'brick-module';
1
+ import { AnyObject, BrickModule, BrickModuleSpec } from 'brick-module';
2
2
 
3
3
  /**
4
4
  * TossCoreModule Spec
@@ -9,3 +9,5 @@ export interface TossCoreModuleSpec extends BrickModuleSpec {
9
9
 
10
10
  eventLog(params: AnyObject): Promise<void>;
11
11
  }
12
+
13
+ export const TossCoreModule = BrickModule.get<TossCoreModuleSpec>('TossCoreModule');
@@ -1,8 +0,0 @@
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');