@apps-in-toss/native-modules 2.4.4 → 2.4.5
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/bridges-meta.json +3 -3
- package/dist/index.cjs +5 -5
- package/dist/index.d.cts +22 -23
- package/dist/index.d.ts +22 -23
- package/dist/index.js +4 -4
- package/package.json +2 -2
- package/src/MiniAppModule/native-modules/{getUserKey.ts → getAnonymousKey.ts} +12 -16
- package/src/MiniAppModule/native-modules/getUserKeyForGame.ts +11 -9
- package/src/MiniAppModule/native-modules/index.ts +1 -1
- package/src/MiniAppModule/postMessage.ts +2 -2
- package/src/async-bridges.ts +1 -1
package/dist/bridges-meta.json
CHANGED
|
@@ -108,12 +108,12 @@
|
|
|
108
108
|
"dts": "/**\n * @public\n * @category 게임센터\n * @name SubmitGameCenterLeaderBoardScoreResponse\n * @description\n * 토스게임센터 리더보드에 점수를 제출한 결과 정보를 담아서 반환해요. 반환된 정보를 사용해서 점수 제출 결과에 따라 적절한 에러 처리를 할 수 있어요.\n * @property {'SUCCESS' | 'LEADERBOARD_NOT_FOUND' | 'PROFILE_NOT_FOUND' | 'UNPARSABLE_SCORE'} statusCode\n * 점수 제출 결과를 나타내는 상태 코드예요.\n * - `'SUCCESS'`: 점수 제출이 성공했어요.\n * - `'LEADERBOARD_NOT_FOUND'`: `gameId`에 해당하는 리더보드를 찾을 수 없어요.\n * - `'PROFILE_NOT_FOUND'`: 사용자의 프로필이 없어요.\n * - `'UNPARSABLE_SCORE'`: 점수를 해석할 수 없어요. 점수는 실수(float) 형태의 문자열로 전달해야 해요.\n */\nexport interface SubmitGameCenterLeaderBoardScoreResponse {\n\tstatusCode: \"SUCCESS\" | \"LEADERBOARD_NOT_FOUND\" | \"PROFILE_NOT_FOUND\" | \"UNPARSABLE_SCORE\";\n}\n/**\n * @public\n * @category 게임센터\n * @name submitGameCenterLeaderBoardScore\n * @description\n * 사용자의 게임 점수를 토스게임센터 리더보드에 제출해요. 이 기능으로 사용자의 점수를 공식 리더보드에 기록하고 다른 사용자와 비교할 수 있어요.\n * @param {string} params.score\n * 제출할 게임 점수예요. 실수 형태의 숫자를 문자열로 전달해야 해요. 예를들어 `\"123.45\"` 또는 `\"9999\"` 예요.\n * @returns {Promise<SubmitGameCenterLeaderBoardScoreResponse | undefined>}\n * 점수 제출 결과를 반환해요. 앱 버전이 최소 지원 버전보다 낮으면 아무 동작도 하지 않고 `undefined`를 반환해요.\n *\n * @example\n * ### 게임 점수를 토스게임센터 리더보드에 제출하기\n * ```tsx\n * import { Button } from 'react-native';\n * import { submitGameCenterLeaderBoardScore } from '@apps-in-toss/framework';\n *\n * function GameCenterLeaderBoardScoreSubmitButton() {\n * async function handlePress() {\n * try {\n * const result = await submitGameCenterLeaderBoardScore({ score: '123.45' });\n *\n * if (!result) {\n * console.warn('지원하지 않는 앱 버전이에요.');\n * return;\n * }\n *\n * if (result.statusCode === 'SUCCESS') {\n * console.log('점수 제출 성공!');\n * } else {\n * console.error('점수 제출 실패:', result.statusCode);\n * }\n * } catch (error) {\n * console.error('점수 제출 중 오류가 발생했어요.', error);\n * }\n * }\n *\n * return (\n * <Button onPress={handlePress}>점수 제출하기</Button>\n * );\n * }\n * ```\n */\nexport declare function submitGameCenterLeaderBoardScore(params: {\n\tscore: string;\n}): Promise<SubmitGameCenterLeaderBoardScoreResponse | undefined>;\n\nexport {};\n"
|
|
109
109
|
},
|
|
110
110
|
{
|
|
111
|
-
"identifier": "
|
|
112
|
-
"dts": "export interface
|
|
111
|
+
"identifier": "getAnonymousKey",
|
|
112
|
+
"dts": "export interface GetAnonymousKeySuccessResponse {\n\thash: string;\n\ttype: \"HASH\";\n}\nexport type GetAnonymousKeyResponse = GetAnonymousKeySuccessResponse;\n/**\n * @public\n * @name getAnonymousKey\n * @description\n * 미니앱에서 사용자의 고유 키를 가져와요. 이 키를 사용해서 사용자를 식별하고 데이터를 관리할 수 있어요.\n * @returns {Promise<GetAnonymousKeyResponse | 'ERROR' | undefined>}\n * 사용자 키 조회 결과를 반환해요.\n * - `GetAnonymousKeyResponse`: 사용자 키 조회에 성공했어요. `{ type: 'HASH', hash: string }` 형태로 반환돼요.\n * - `'ERROR'`: 알 수 없는 오류가 발생했어요.\n * - `undefined`: 앱 버전이 최소 지원 버전보다 낮아요.\n *\n * @example\n * ```tsx\n * // react-native\n * import { Button } from 'react-native';\n * import { getAnonymousKey } from '@apps-in-toss/framework';\n *\n * function UserKeyButton() {\n * async function handlePress() {\n * const result = await getAnonymousKey();\n *\n * if (!result) {\n * console.warn('지원하지 않는 앱 버전이에요.');\n * return;\n * }\n *\n * if (result === 'ERROR') {\n * console.error('사용자 키 조회 중 오류가 발생했어요.');\n * return;\n * }\n *\n * if (result.type === 'HASH') {\n * console.log('사용자 키:', result.hash);\n * // 여기에서 사용자 키를 사용해 데이터를 관리할 수 있어요.\n * }\n * }\n *\n * return (\n * <Button onPress={handlePress} title=\"유저 키 가져오기\" />\n * );\n * }\n * ```\n *\n * @example\n * ```tsx\n * // webview\n * import { getAnonymousKey } from '@apps-in-toss/web-framework';\n *\n * function UserKeyButton() {\n * async function handleClick() {\n * const result = await getAnonymousKey();\n *\n * if (!result) {\n * console.warn('지원하지 않는 앱 버전이에요.');\n * return;\n * }\n *\n * if (result === 'ERROR') {\n * console.error('사용자 키 조회 중 오류가 발생했어요.');\n * return;\n * }\n *\n * if (result.type === 'HASH') {\n * console.log('사용자 키:', result.hash);\n * // 여기에서 사용자 키를 사용해 데이터를 관리할 수 있어요.\n * }\n * }\n *\n * return (\n * <button onClick={handleClick}>유저 키 가져오기</button>\n * );\n * }\n * ```\n */\nexport declare function getAnonymousKey(): Promise<GetAnonymousKeySuccessResponse | \"ERROR\" | undefined>;\n\nexport {};\n"
|
|
113
113
|
},
|
|
114
114
|
{
|
|
115
115
|
"identifier": "getUserKeyForGame",
|
|
116
|
-
"dts": "export interface
|
|
116
|
+
"dts": "export interface GetAnonymousKeySuccessResponse {\n\thash: string;\n\ttype: \"HASH\";\n}\nexport type GetAnonymousKeyResponse = GetAnonymousKeySuccessResponse;\n/**\n * @deprecated 이 타입은 더 이상 사용되지 않습니다. 대신 {@link GetAnonymousKeySuccessResponse}를 사용해주세요.\n */\nexport type GetUserKeyForGameSuccessResponse = GetAnonymousKeySuccessResponse;\n/**\n * @deprecated 이 타입은 더 이상 사용되지 않습니다.\n */\nexport type GetUserKeyForGameErrorResponse = {\n\ttype: \"NOT_AVAILABLE\";\n};\n/**\n * @deprecated 이 타입은 더 이상 사용되지 않습니다. 대신 {@link GetAnonymousKeyResponse}를 사용해주세요.\n */\nexport type GetUserKeyForGameResponse = GetAnonymousKeyResponse | GetUserKeyForGameErrorResponse;\n/**\n *\n * @deprecated 이 함수는 더 이상 사용되지 않습니다. 대신 {@link getAnonymousKey}를 사용해주세요.\n */\nexport declare function getUserKeyForGame(): Promise<GetUserKeyForGameSuccessResponse | \"INVALID_CATEGORY\" | \"ERROR\" | undefined>;\n\nexport {};\n"
|
|
117
117
|
},
|
|
118
118
|
{
|
|
119
119
|
"identifier": "grantPromotionReward",
|
package/dist/index.cjs
CHANGED
|
@@ -37,6 +37,7 @@ __export(index_exports, {
|
|
|
37
37
|
fetchAlbumPhotos: () => fetchAlbumPhotos,
|
|
38
38
|
fetchContacts: () => fetchContacts,
|
|
39
39
|
generateHapticFeedback: () => generateHapticFeedback,
|
|
40
|
+
getAnonymousKey: () => getAnonymousKey,
|
|
40
41
|
getClipboardText: () => getClipboardText,
|
|
41
42
|
getCurrentLocation: () => getCurrentLocation,
|
|
42
43
|
getDeviceId: () => getDeviceId,
|
|
@@ -51,7 +52,6 @@ __export(index_exports, {
|
|
|
51
52
|
getServerTime: () => getServerTime,
|
|
52
53
|
getTossAppVersion: () => getTossAppVersion,
|
|
53
54
|
getTossShareLink: () => getTossShareLink,
|
|
54
|
-
getUserKey: () => getUserKey,
|
|
55
55
|
getUserKeyForGame: () => getUserKeyForGame,
|
|
56
56
|
grantPromotionReward: () => grantPromotionReward,
|
|
57
57
|
grantPromotionRewardForGame: () => grantPromotionRewardForGame,
|
|
@@ -939,8 +939,8 @@ async function submitGameCenterLeaderBoardScore(params) {
|
|
|
939
939
|
return safePostMessage("submitGameCenterLeaderBoardScore", params);
|
|
940
940
|
}
|
|
941
941
|
|
|
942
|
-
// src/MiniAppModule/native-modules/
|
|
943
|
-
async function
|
|
942
|
+
// src/MiniAppModule/native-modules/getAnonymousKey.ts
|
|
943
|
+
async function getAnonymousKey() {
|
|
944
944
|
const isSupported = isMinVersionSupported(USER_KEY_MIN_VERSION);
|
|
945
945
|
if (!isSupported) {
|
|
946
946
|
return;
|
|
@@ -958,7 +958,7 @@ async function getUserKey() {
|
|
|
958
958
|
|
|
959
959
|
// src/MiniAppModule/native-modules/getUserKeyForGame.ts
|
|
960
960
|
async function getUserKeyForGame() {
|
|
961
|
-
return
|
|
961
|
+
return getAnonymousKey();
|
|
962
962
|
}
|
|
963
963
|
|
|
964
964
|
// src/MiniAppModule/native-modules/grantPromotionReward.ts
|
|
@@ -1209,6 +1209,7 @@ var INTERNAL__module = {
|
|
|
1209
1209
|
fetchAlbumPhotos,
|
|
1210
1210
|
fetchContacts,
|
|
1211
1211
|
generateHapticFeedback,
|
|
1212
|
+
getAnonymousKey,
|
|
1212
1213
|
getClipboardText,
|
|
1213
1214
|
getCurrentLocation,
|
|
1214
1215
|
getDeviceId,
|
|
@@ -1223,7 +1224,6 @@ var INTERNAL__module = {
|
|
|
1223
1224
|
getServerTime,
|
|
1224
1225
|
getTossAppVersion,
|
|
1225
1226
|
getTossShareLink,
|
|
1226
|
-
getUserKey,
|
|
1227
1227
|
getUserKeyForGame,
|
|
1228
1228
|
grantPromotionReward,
|
|
1229
1229
|
grantPromotionRewardForGame,
|
package/dist/index.d.cts
CHANGED
|
@@ -168,22 +168,19 @@ type GameCenterGameProfileResponse = {
|
|
|
168
168
|
*/
|
|
169
169
|
declare function getGameCenterGameProfile(): Promise<GameCenterGameProfileResponse | undefined>;
|
|
170
170
|
|
|
171
|
-
interface
|
|
171
|
+
interface GetAnonymousKeySuccessResponse {
|
|
172
172
|
hash: string;
|
|
173
173
|
type: 'HASH';
|
|
174
174
|
}
|
|
175
|
-
|
|
176
|
-
type: 'NOT_AVAILABLE';
|
|
177
|
-
}
|
|
178
|
-
type GetUserKeyResponse = GetUserKeySuccessResponse | GetUserKeyErrorResponse;
|
|
175
|
+
type GetAnonymousKeyResponse = GetAnonymousKeySuccessResponse;
|
|
179
176
|
/**
|
|
180
177
|
* @public
|
|
181
|
-
* @name
|
|
178
|
+
* @name getAnonymousKey
|
|
182
179
|
* @description
|
|
183
|
-
* 미니앱에서 사용자의 고유 키를 가져와요. 이 키를 사용해서 사용자를 식별하고
|
|
184
|
-
* @returns {Promise<
|
|
180
|
+
* 미니앱에서 사용자의 고유 키를 가져와요. 이 키를 사용해서 사용자를 식별하고 데이터를 관리할 수 있어요.
|
|
181
|
+
* @returns {Promise<GetAnonymousKeyResponse | 'ERROR' | undefined>}
|
|
185
182
|
* 사용자 키 조회 결과를 반환해요.
|
|
186
|
-
* - `
|
|
183
|
+
* - `GetAnonymousKeyResponse`: 사용자 키 조회에 성공했어요. `{ type: 'HASH', hash: string }` 형태로 반환돼요.
|
|
187
184
|
* - `'ERROR'`: 알 수 없는 오류가 발생했어요.
|
|
188
185
|
* - `undefined`: 앱 버전이 최소 지원 버전보다 낮아요.
|
|
189
186
|
*
|
|
@@ -191,11 +188,11 @@ type GetUserKeyResponse = GetUserKeySuccessResponse | GetUserKeyErrorResponse;
|
|
|
191
188
|
* ```tsx
|
|
192
189
|
* // react-native
|
|
193
190
|
* import { Button } from 'react-native';
|
|
194
|
-
* import {
|
|
191
|
+
* import { getAnonymousKey } from '@apps-in-toss/framework';
|
|
195
192
|
*
|
|
196
193
|
* function UserKeyButton() {
|
|
197
194
|
* async function handlePress() {
|
|
198
|
-
* const result = await
|
|
195
|
+
* const result = await getAnonymousKey();
|
|
199
196
|
*
|
|
200
197
|
* if (!result) {
|
|
201
198
|
* console.warn('지원하지 않는 앱 버전이에요.');
|
|
@@ -222,11 +219,11 @@ type GetUserKeyResponse = GetUserKeySuccessResponse | GetUserKeyErrorResponse;
|
|
|
222
219
|
* @example
|
|
223
220
|
* ```tsx
|
|
224
221
|
* // webview
|
|
225
|
-
* import {
|
|
222
|
+
* import { getAnonymousKey } from '@apps-in-toss/web-framework';
|
|
226
223
|
*
|
|
227
224
|
* function UserKeyButton() {
|
|
228
225
|
* async function handleClick() {
|
|
229
|
-
* const result = await
|
|
226
|
+
* const result = await getAnonymousKey();
|
|
230
227
|
*
|
|
231
228
|
* if (!result) {
|
|
232
229
|
* console.warn('지원하지 않는 앱 버전이에요.');
|
|
@@ -250,23 +247,25 @@ type GetUserKeyResponse = GetUserKeySuccessResponse | GetUserKeyErrorResponse;
|
|
|
250
247
|
* }
|
|
251
248
|
* ```
|
|
252
249
|
*/
|
|
253
|
-
declare function
|
|
250
|
+
declare function getAnonymousKey(): Promise<GetAnonymousKeySuccessResponse | 'ERROR' | undefined>;
|
|
254
251
|
|
|
255
252
|
/**
|
|
256
|
-
* @deprecated 이 타입은 더 이상 사용되지 않습니다. 대신 {@link
|
|
253
|
+
* @deprecated 이 타입은 더 이상 사용되지 않습니다. 대신 {@link GetAnonymousKeySuccessResponse}를 사용해주세요.
|
|
257
254
|
*/
|
|
258
|
-
type GetUserKeyForGameSuccessResponse =
|
|
255
|
+
type GetUserKeyForGameSuccessResponse = GetAnonymousKeySuccessResponse;
|
|
259
256
|
/**
|
|
260
|
-
* @deprecated 이 타입은 더 이상 사용되지 않습니다.
|
|
257
|
+
* @deprecated 이 타입은 더 이상 사용되지 않습니다.
|
|
261
258
|
*/
|
|
262
|
-
type GetUserKeyForGameErrorResponse =
|
|
259
|
+
type GetUserKeyForGameErrorResponse = {
|
|
260
|
+
type: 'NOT_AVAILABLE';
|
|
261
|
+
};
|
|
263
262
|
/**
|
|
264
|
-
* @deprecated 이 타입은 더 이상 사용되지 않습니다. 대신 {@link
|
|
263
|
+
* @deprecated 이 타입은 더 이상 사용되지 않습니다. 대신 {@link GetAnonymousKeyResponse}를 사용해주세요.
|
|
265
264
|
*/
|
|
266
|
-
type GetUserKeyForGameResponse =
|
|
265
|
+
type GetUserKeyForGameResponse = GetAnonymousKeyResponse | GetUserKeyForGameErrorResponse;
|
|
267
266
|
/**
|
|
268
267
|
*
|
|
269
|
-
* @deprecated 이 함수는 더 이상 사용되지 않습니다. 대신 {@link
|
|
268
|
+
* @deprecated 이 함수는 더 이상 사용되지 않습니다. 대신 {@link getAnonymousKey}를 사용해주세요.
|
|
270
269
|
*/
|
|
271
270
|
declare function getUserKeyForGame(): Promise<GetUserKeyForGameSuccessResponse | 'INVALID_CATEGORY' | 'ERROR' | undefined>;
|
|
272
271
|
|
|
@@ -1109,7 +1108,7 @@ interface AsyncMethodsMap {
|
|
|
1109
1108
|
appsInTossSignTossCert: (params: AppsInTossSignTossCertParams) => Promise<void>;
|
|
1110
1109
|
getGameCenterGameProfile: (params: CompatiblePlaceholderArgument) => Promise<GameCenterGameProfileResponse | undefined>;
|
|
1111
1110
|
getUserKeyForGame: (params: CompatiblePlaceholderArgument) => Promise<GetUserKeyForGameResponse | undefined>;
|
|
1112
|
-
getUserKey: (params: CompatiblePlaceholderArgument) => Promise<
|
|
1111
|
+
getUserKey: (params: CompatiblePlaceholderArgument) => Promise<GetAnonymousKeyResponse | undefined>;
|
|
1113
1112
|
grantPromotionRewardForGame: (params: {
|
|
1114
1113
|
promotionCode: string;
|
|
1115
1114
|
amount: number;
|
|
@@ -3316,4 +3315,4 @@ declare const INTERNAL__module: {
|
|
|
3316
3315
|
tossCoreEventLog: typeof tossCoreEventLog;
|
|
3317
3316
|
};
|
|
3318
3317
|
|
|
3319
|
-
export { type AppsInTossSignTossCertParams, type CheckoutPaymentOptions, type CheckoutPaymentResult, type CompletedOrRefundedOrdersResult, type ConsumableProductListItem, type ContactsViralParams, type CreateSubscriptionPurchaseOrderOptions, type EventLogParams, type GameCenterGameProfileResponse, type
|
|
3318
|
+
export { type AppsInTossSignTossCertParams, type CheckoutPaymentOptions, type CheckoutPaymentResult, type CompletedOrRefundedOrdersResult, type ConsumableProductListItem, type ContactsViralParams, type CreateSubscriptionPurchaseOrderOptions, type EventLogParams, type GameCenterGameProfileResponse, type GetAnonymousKeyResponse, type GetAnonymousKeySuccessResponse, 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, getAnonymousKey, 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
|
@@ -168,22 +168,19 @@ type GameCenterGameProfileResponse = {
|
|
|
168
168
|
*/
|
|
169
169
|
declare function getGameCenterGameProfile(): Promise<GameCenterGameProfileResponse | undefined>;
|
|
170
170
|
|
|
171
|
-
interface
|
|
171
|
+
interface GetAnonymousKeySuccessResponse {
|
|
172
172
|
hash: string;
|
|
173
173
|
type: 'HASH';
|
|
174
174
|
}
|
|
175
|
-
|
|
176
|
-
type: 'NOT_AVAILABLE';
|
|
177
|
-
}
|
|
178
|
-
type GetUserKeyResponse = GetUserKeySuccessResponse | GetUserKeyErrorResponse;
|
|
175
|
+
type GetAnonymousKeyResponse = GetAnonymousKeySuccessResponse;
|
|
179
176
|
/**
|
|
180
177
|
* @public
|
|
181
|
-
* @name
|
|
178
|
+
* @name getAnonymousKey
|
|
182
179
|
* @description
|
|
183
|
-
* 미니앱에서 사용자의 고유 키를 가져와요. 이 키를 사용해서 사용자를 식별하고
|
|
184
|
-
* @returns {Promise<
|
|
180
|
+
* 미니앱에서 사용자의 고유 키를 가져와요. 이 키를 사용해서 사용자를 식별하고 데이터를 관리할 수 있어요.
|
|
181
|
+
* @returns {Promise<GetAnonymousKeyResponse | 'ERROR' | undefined>}
|
|
185
182
|
* 사용자 키 조회 결과를 반환해요.
|
|
186
|
-
* - `
|
|
183
|
+
* - `GetAnonymousKeyResponse`: 사용자 키 조회에 성공했어요. `{ type: 'HASH', hash: string }` 형태로 반환돼요.
|
|
187
184
|
* - `'ERROR'`: 알 수 없는 오류가 발생했어요.
|
|
188
185
|
* - `undefined`: 앱 버전이 최소 지원 버전보다 낮아요.
|
|
189
186
|
*
|
|
@@ -191,11 +188,11 @@ type GetUserKeyResponse = GetUserKeySuccessResponse | GetUserKeyErrorResponse;
|
|
|
191
188
|
* ```tsx
|
|
192
189
|
* // react-native
|
|
193
190
|
* import { Button } from 'react-native';
|
|
194
|
-
* import {
|
|
191
|
+
* import { getAnonymousKey } from '@apps-in-toss/framework';
|
|
195
192
|
*
|
|
196
193
|
* function UserKeyButton() {
|
|
197
194
|
* async function handlePress() {
|
|
198
|
-
* const result = await
|
|
195
|
+
* const result = await getAnonymousKey();
|
|
199
196
|
*
|
|
200
197
|
* if (!result) {
|
|
201
198
|
* console.warn('지원하지 않는 앱 버전이에요.');
|
|
@@ -222,11 +219,11 @@ type GetUserKeyResponse = GetUserKeySuccessResponse | GetUserKeyErrorResponse;
|
|
|
222
219
|
* @example
|
|
223
220
|
* ```tsx
|
|
224
221
|
* // webview
|
|
225
|
-
* import {
|
|
222
|
+
* import { getAnonymousKey } from '@apps-in-toss/web-framework';
|
|
226
223
|
*
|
|
227
224
|
* function UserKeyButton() {
|
|
228
225
|
* async function handleClick() {
|
|
229
|
-
* const result = await
|
|
226
|
+
* const result = await getAnonymousKey();
|
|
230
227
|
*
|
|
231
228
|
* if (!result) {
|
|
232
229
|
* console.warn('지원하지 않는 앱 버전이에요.');
|
|
@@ -250,23 +247,25 @@ type GetUserKeyResponse = GetUserKeySuccessResponse | GetUserKeyErrorResponse;
|
|
|
250
247
|
* }
|
|
251
248
|
* ```
|
|
252
249
|
*/
|
|
253
|
-
declare function
|
|
250
|
+
declare function getAnonymousKey(): Promise<GetAnonymousKeySuccessResponse | 'ERROR' | undefined>;
|
|
254
251
|
|
|
255
252
|
/**
|
|
256
|
-
* @deprecated 이 타입은 더 이상 사용되지 않습니다. 대신 {@link
|
|
253
|
+
* @deprecated 이 타입은 더 이상 사용되지 않습니다. 대신 {@link GetAnonymousKeySuccessResponse}를 사용해주세요.
|
|
257
254
|
*/
|
|
258
|
-
type GetUserKeyForGameSuccessResponse =
|
|
255
|
+
type GetUserKeyForGameSuccessResponse = GetAnonymousKeySuccessResponse;
|
|
259
256
|
/**
|
|
260
|
-
* @deprecated 이 타입은 더 이상 사용되지 않습니다.
|
|
257
|
+
* @deprecated 이 타입은 더 이상 사용되지 않습니다.
|
|
261
258
|
*/
|
|
262
|
-
type GetUserKeyForGameErrorResponse =
|
|
259
|
+
type GetUserKeyForGameErrorResponse = {
|
|
260
|
+
type: 'NOT_AVAILABLE';
|
|
261
|
+
};
|
|
263
262
|
/**
|
|
264
|
-
* @deprecated 이 타입은 더 이상 사용되지 않습니다. 대신 {@link
|
|
263
|
+
* @deprecated 이 타입은 더 이상 사용되지 않습니다. 대신 {@link GetAnonymousKeyResponse}를 사용해주세요.
|
|
265
264
|
*/
|
|
266
|
-
type GetUserKeyForGameResponse =
|
|
265
|
+
type GetUserKeyForGameResponse = GetAnonymousKeyResponse | GetUserKeyForGameErrorResponse;
|
|
267
266
|
/**
|
|
268
267
|
*
|
|
269
|
-
* @deprecated 이 함수는 더 이상 사용되지 않습니다. 대신 {@link
|
|
268
|
+
* @deprecated 이 함수는 더 이상 사용되지 않습니다. 대신 {@link getAnonymousKey}를 사용해주세요.
|
|
270
269
|
*/
|
|
271
270
|
declare function getUserKeyForGame(): Promise<GetUserKeyForGameSuccessResponse | 'INVALID_CATEGORY' | 'ERROR' | undefined>;
|
|
272
271
|
|
|
@@ -1109,7 +1108,7 @@ interface AsyncMethodsMap {
|
|
|
1109
1108
|
appsInTossSignTossCert: (params: AppsInTossSignTossCertParams) => Promise<void>;
|
|
1110
1109
|
getGameCenterGameProfile: (params: CompatiblePlaceholderArgument) => Promise<GameCenterGameProfileResponse | undefined>;
|
|
1111
1110
|
getUserKeyForGame: (params: CompatiblePlaceholderArgument) => Promise<GetUserKeyForGameResponse | undefined>;
|
|
1112
|
-
getUserKey: (params: CompatiblePlaceholderArgument) => Promise<
|
|
1111
|
+
getUserKey: (params: CompatiblePlaceholderArgument) => Promise<GetAnonymousKeyResponse | undefined>;
|
|
1113
1112
|
grantPromotionRewardForGame: (params: {
|
|
1114
1113
|
promotionCode: string;
|
|
1115
1114
|
amount: number;
|
|
@@ -3316,4 +3315,4 @@ declare const INTERNAL__module: {
|
|
|
3316
3315
|
tossCoreEventLog: typeof tossCoreEventLog;
|
|
3317
3316
|
};
|
|
3318
3317
|
|
|
3319
|
-
export { type AppsInTossSignTossCertParams, type CheckoutPaymentOptions, type CheckoutPaymentResult, type CompletedOrRefundedOrdersResult, type ConsumableProductListItem, type ContactsViralParams, type CreateSubscriptionPurchaseOrderOptions, type EventLogParams, type GameCenterGameProfileResponse, type
|
|
3318
|
+
export { type AppsInTossSignTossCertParams, type CheckoutPaymentOptions, type CheckoutPaymentResult, type CompletedOrRefundedOrdersResult, type ConsumableProductListItem, type ContactsViralParams, type CreateSubscriptionPurchaseOrderOptions, type EventLogParams, type GameCenterGameProfileResponse, type GetAnonymousKeyResponse, type GetAnonymousKeySuccessResponse, 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, getAnonymousKey, 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
|
@@ -858,8 +858,8 @@ async function submitGameCenterLeaderBoardScore(params) {
|
|
|
858
858
|
return safePostMessage("submitGameCenterLeaderBoardScore", params);
|
|
859
859
|
}
|
|
860
860
|
|
|
861
|
-
// src/MiniAppModule/native-modules/
|
|
862
|
-
async function
|
|
861
|
+
// src/MiniAppModule/native-modules/getAnonymousKey.ts
|
|
862
|
+
async function getAnonymousKey() {
|
|
863
863
|
const isSupported = isMinVersionSupported(USER_KEY_MIN_VERSION);
|
|
864
864
|
if (!isSupported) {
|
|
865
865
|
return;
|
|
@@ -877,7 +877,7 @@ async function getUserKey() {
|
|
|
877
877
|
|
|
878
878
|
// src/MiniAppModule/native-modules/getUserKeyForGame.ts
|
|
879
879
|
async function getUserKeyForGame() {
|
|
880
|
-
return
|
|
880
|
+
return getAnonymousKey();
|
|
881
881
|
}
|
|
882
882
|
|
|
883
883
|
// src/MiniAppModule/native-modules/grantPromotionReward.ts
|
|
@@ -1127,6 +1127,7 @@ export {
|
|
|
1127
1127
|
fetchAlbumPhotos,
|
|
1128
1128
|
fetchContacts,
|
|
1129
1129
|
generateHapticFeedback,
|
|
1130
|
+
getAnonymousKey,
|
|
1130
1131
|
getClipboardText,
|
|
1131
1132
|
getCurrentLocation,
|
|
1132
1133
|
getDeviceId,
|
|
@@ -1141,7 +1142,6 @@ export {
|
|
|
1141
1142
|
getServerTime,
|
|
1142
1143
|
getTossAppVersion,
|
|
1143
1144
|
getTossShareLink,
|
|
1144
|
-
getUserKey,
|
|
1145
1145
|
getUserKeyForGame,
|
|
1146
1146
|
grantPromotionReward,
|
|
1147
1147
|
grantPromotionRewardForGame,
|
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.
|
|
4
|
+
"version": "2.4.5",
|
|
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.4.
|
|
45
|
+
"@apps-in-toss/types": "2.4.5",
|
|
46
46
|
"brick-module": "0.5.0",
|
|
47
47
|
"es-toolkit": "^1.39.3"
|
|
48
48
|
},
|
|
@@ -2,25 +2,21 @@ import { isMinVersionSupported } from './isMinVersionSupported';
|
|
|
2
2
|
import { safePostMessage } from '../../natives';
|
|
3
3
|
import { USER_KEY_MIN_VERSION } from '../constants';
|
|
4
4
|
|
|
5
|
-
export interface
|
|
5
|
+
export interface GetAnonymousKeySuccessResponse {
|
|
6
6
|
hash: string;
|
|
7
7
|
type: 'HASH';
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
export
|
|
11
|
-
type: 'NOT_AVAILABLE';
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export type GetUserKeyResponse = GetUserKeySuccessResponse | GetUserKeyErrorResponse;
|
|
10
|
+
export type GetAnonymousKeyResponse = GetAnonymousKeySuccessResponse;
|
|
15
11
|
|
|
16
12
|
/**
|
|
17
13
|
* @public
|
|
18
|
-
* @name
|
|
14
|
+
* @name getAnonymousKey
|
|
19
15
|
* @description
|
|
20
|
-
* 미니앱에서 사용자의 고유 키를 가져와요. 이 키를 사용해서 사용자를 식별하고
|
|
21
|
-
* @returns {Promise<
|
|
16
|
+
* 미니앱에서 사용자의 고유 키를 가져와요. 이 키를 사용해서 사용자를 식별하고 데이터를 관리할 수 있어요.
|
|
17
|
+
* @returns {Promise<GetAnonymousKeyResponse | 'ERROR' | undefined>}
|
|
22
18
|
* 사용자 키 조회 결과를 반환해요.
|
|
23
|
-
* - `
|
|
19
|
+
* - `GetAnonymousKeyResponse`: 사용자 키 조회에 성공했어요. `{ type: 'HASH', hash: string }` 형태로 반환돼요.
|
|
24
20
|
* - `'ERROR'`: 알 수 없는 오류가 발생했어요.
|
|
25
21
|
* - `undefined`: 앱 버전이 최소 지원 버전보다 낮아요.
|
|
26
22
|
*
|
|
@@ -28,11 +24,11 @@ export type GetUserKeyResponse = GetUserKeySuccessResponse | GetUserKeyErrorResp
|
|
|
28
24
|
* ```tsx
|
|
29
25
|
* // react-native
|
|
30
26
|
* import { Button } from 'react-native';
|
|
31
|
-
* import {
|
|
27
|
+
* import { getAnonymousKey } from '@apps-in-toss/framework';
|
|
32
28
|
*
|
|
33
29
|
* function UserKeyButton() {
|
|
34
30
|
* async function handlePress() {
|
|
35
|
-
* const result = await
|
|
31
|
+
* const result = await getAnonymousKey();
|
|
36
32
|
*
|
|
37
33
|
* if (!result) {
|
|
38
34
|
* console.warn('지원하지 않는 앱 버전이에요.');
|
|
@@ -59,11 +55,11 @@ export type GetUserKeyResponse = GetUserKeySuccessResponse | GetUserKeyErrorResp
|
|
|
59
55
|
* @example
|
|
60
56
|
* ```tsx
|
|
61
57
|
* // webview
|
|
62
|
-
* import {
|
|
58
|
+
* import { getAnonymousKey } from '@apps-in-toss/web-framework';
|
|
63
59
|
*
|
|
64
60
|
* function UserKeyButton() {
|
|
65
61
|
* async function handleClick() {
|
|
66
|
-
* const result = await
|
|
62
|
+
* const result = await getAnonymousKey();
|
|
67
63
|
*
|
|
68
64
|
* if (!result) {
|
|
69
65
|
* console.warn('지원하지 않는 앱 버전이에요.');
|
|
@@ -87,7 +83,7 @@ export type GetUserKeyResponse = GetUserKeySuccessResponse | GetUserKeyErrorResp
|
|
|
87
83
|
* }
|
|
88
84
|
* ```
|
|
89
85
|
*/
|
|
90
|
-
export async function
|
|
86
|
+
export async function getAnonymousKey(): Promise<GetAnonymousKeySuccessResponse | 'ERROR' | undefined> {
|
|
91
87
|
const isSupported = isMinVersionSupported(USER_KEY_MIN_VERSION);
|
|
92
88
|
|
|
93
89
|
if (!isSupported) {
|
|
@@ -95,7 +91,7 @@ export async function getUserKey(): Promise<GetUserKeySuccessResponse | 'ERROR'
|
|
|
95
91
|
}
|
|
96
92
|
|
|
97
93
|
try {
|
|
98
|
-
const response = (await safePostMessage('getUserKeyForGame', {})) as
|
|
94
|
+
const response = (await safePostMessage('getUserKeyForGame', {})) as GetAnonymousKeyResponse;
|
|
99
95
|
if (response.type === 'HASH') {
|
|
100
96
|
return response;
|
|
101
97
|
}
|
|
@@ -1,26 +1,28 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getAnonymousKey, GetAnonymousKeyResponse, GetAnonymousKeySuccessResponse } from './getAnonymousKey';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* @deprecated 이 타입은 더 이상 사용되지 않습니다. 대신 {@link
|
|
4
|
+
* @deprecated 이 타입은 더 이상 사용되지 않습니다. 대신 {@link GetAnonymousKeySuccessResponse}를 사용해주세요.
|
|
5
5
|
*/
|
|
6
|
-
export type GetUserKeyForGameSuccessResponse =
|
|
6
|
+
export type GetUserKeyForGameSuccessResponse = GetAnonymousKeySuccessResponse;
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
|
-
* @deprecated 이 타입은 더 이상 사용되지 않습니다.
|
|
9
|
+
* @deprecated 이 타입은 더 이상 사용되지 않습니다.
|
|
10
10
|
*/
|
|
11
|
-
export type GetUserKeyForGameErrorResponse =
|
|
11
|
+
export type GetUserKeyForGameErrorResponse = {
|
|
12
|
+
type: 'NOT_AVAILABLE';
|
|
13
|
+
}
|
|
12
14
|
|
|
13
15
|
/**
|
|
14
|
-
* @deprecated 이 타입은 더 이상 사용되지 않습니다. 대신 {@link
|
|
16
|
+
* @deprecated 이 타입은 더 이상 사용되지 않습니다. 대신 {@link GetAnonymousKeyResponse}를 사용해주세요.
|
|
15
17
|
*/
|
|
16
|
-
export type GetUserKeyForGameResponse =
|
|
18
|
+
export type GetUserKeyForGameResponse = GetAnonymousKeyResponse | GetUserKeyForGameErrorResponse;
|
|
17
19
|
|
|
18
20
|
/**
|
|
19
21
|
*
|
|
20
|
-
* @deprecated 이 함수는 더 이상 사용되지 않습니다. 대신 {@link
|
|
22
|
+
* @deprecated 이 함수는 더 이상 사용되지 않습니다. 대신 {@link getAnonymousKey}를 사용해주세요.
|
|
21
23
|
*/
|
|
22
24
|
export async function getUserKeyForGame(): Promise<
|
|
23
25
|
GetUserKeyForGameSuccessResponse | 'INVALID_CATEGORY' | 'ERROR' | undefined
|
|
24
26
|
> {
|
|
25
|
-
return
|
|
27
|
+
return getAnonymousKey();
|
|
26
28
|
}
|
|
@@ -37,7 +37,7 @@ export * from './storage';
|
|
|
37
37
|
export * from './openGameCenterLeaderboard';
|
|
38
38
|
export * from './getGameCenterGameProfile';
|
|
39
39
|
export * from './submitGameCenterLeaderBoardScore';
|
|
40
|
-
export * from './
|
|
40
|
+
export * from './getAnonymousKey';
|
|
41
41
|
export * from './getUserKeyForGame';
|
|
42
42
|
export * from './grantPromotionReward';
|
|
43
43
|
export * from './grantPromotionRewardForGame';
|
|
@@ -10,7 +10,7 @@ import type {
|
|
|
10
10
|
import type { AppsInTossSignTossCertParams } from './native-modules/appsInTossSignTossCert';
|
|
11
11
|
import type { CheckoutPaymentOptions, CheckoutPaymentResult } from './native-modules/checkoutPayment';
|
|
12
12
|
import type { GameCenterGameProfileResponse } from './native-modules/getGameCenterGameProfile';
|
|
13
|
-
import type {
|
|
13
|
+
import type { GetAnonymousKeyResponse } from './native-modules/getAnonymousKey';
|
|
14
14
|
import type { GetUserKeyForGameResponse } from './native-modules/getUserKeyForGame';
|
|
15
15
|
import type { GrantPromotionRewardForGameResponse } from './native-modules/grantPromotionRewardForGame';
|
|
16
16
|
import type { IapCreateOneTimePurchaseOrderResult, IapSubscriptionInfoResult } from './native-modules/iap';
|
|
@@ -73,7 +73,7 @@ export interface AsyncMethodsMap {
|
|
|
73
73
|
params: CompatiblePlaceholderArgument
|
|
74
74
|
) => Promise<GameCenterGameProfileResponse | undefined>;
|
|
75
75
|
getUserKeyForGame: (params: CompatiblePlaceholderArgument) => Promise<GetUserKeyForGameResponse | undefined>;
|
|
76
|
-
getUserKey: (params: CompatiblePlaceholderArgument) => Promise<
|
|
76
|
+
getUserKey: (params: CompatiblePlaceholderArgument) => Promise<GetAnonymousKeyResponse | undefined>;
|
|
77
77
|
grantPromotionRewardForGame: (params: {
|
|
78
78
|
promotionCode: string;
|
|
79
79
|
amount: number;
|
package/src/async-bridges.ts
CHANGED
|
@@ -28,7 +28,7 @@ export * from './MiniAppModule/native-modules/appsInTossSignTossCert';
|
|
|
28
28
|
export * from './MiniAppModule/native-modules/getGameCenterGameProfile';
|
|
29
29
|
export * from './MiniAppModule/native-modules/openGameCenterLeaderboard';
|
|
30
30
|
export * from './MiniAppModule/native-modules/submitGameCenterLeaderBoardScore';
|
|
31
|
-
export * from './MiniAppModule/native-modules/
|
|
31
|
+
export * from './MiniAppModule/native-modules/getAnonymousKey';
|
|
32
32
|
export * from './MiniAppModule/native-modules/getUserKeyForGame';
|
|
33
33
|
export * from './MiniAppModule/native-modules/grantPromotionReward';
|
|
34
34
|
export * from './MiniAppModule/native-modules/grantPromotionRewardForGame';
|