@apps-in-toss/native-modules 1.14.0 → 2.0.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/bridges-meta.json +11 -7
- package/dist/index.cjs +201 -219
- package/dist/index.d.cts +1479 -1446
- package/dist/index.d.ts +1479 -1446
- package/dist/index.js +173 -192
- package/package.json +10 -8
- package/src/BedrockModule/native-modules/index.ts +0 -2
- package/src/BedrockModule/native-modules/natives/BedrockModule.ts +8 -18
- package/src/BedrockModule/native-modules/natives/closeView.ts +2 -2
- package/src/BedrockModule/native-modules/natives/generateHapticFeedback/index.ts +2 -2
- package/src/BedrockModule/native-modules/natives/getLocale.ts +2 -2
- package/src/BedrockModule/native-modules/natives/getNetworkStatus/index.ts +2 -2
- package/src/BedrockModule/native-modules/natives/getSchemeUri.ts +2 -2
- package/src/BedrockModule/native-modules/natives/setIosSwipeGestureEnabled.ts +3 -3
- package/src/BedrockModule/native-modules/natives/setScreenAwakeMode.ts +2 -2
- package/src/BedrockModule/native-modules/natives/setSecureScreen.ts +2 -2
- package/src/BedrockModule/native-modules/natives/share.ts +2 -2
- package/src/CommonModule.brick.ts +36 -0
- package/src/{AppsInTossModule → MiniAppModule}/native-event-emitter/event-plugins/UpdateLocationEvent.ts +9 -6
- package/src/{AppsInTossModule → MiniAppModule}/native-event-emitter/internal/AppBridgeCallbackEvent.ts +8 -9
- package/src/{AppsInTossModule → MiniAppModule}/native-event-emitter/internal/VisibilityChangedByTransparentServiceWebEvent.ts +13 -12
- package/src/{AppsInTossModule → MiniAppModule}/native-event-emitter/internal/appBridge.spec.ts +5 -5
- package/src/{AppsInTossModule → MiniAppModule}/native-event-emitter/internal/appBridge.ts +4 -12
- package/src/MiniAppModule/native-modules/ads/types.ts +179 -0
- package/src/{AppsInTossModule → MiniAppModule}/native-modules/appLogin.ts +2 -2
- package/src/{AppsInTossModule → MiniAppModule}/native-modules/appsInTossSignTossCert.ts +6 -18
- package/src/{AppsInTossModule → MiniAppModule}/native-modules/checkoutPayment.ts +3 -3
- package/src/{AppsInTossModule → MiniAppModule}/native-modules/eventLog.ts +3 -3
- package/src/{AppsInTossModule → MiniAppModule}/native-modules/getDeviceId.ts +2 -2
- package/src/{AppsInTossModule → MiniAppModule}/native-modules/getGameCenterGameProfile.ts +2 -2
- package/src/MiniAppModule/native-modules/getGroupId.ts +20 -0
- package/src/{AppsInTossModule → MiniAppModule}/native-modules/getIsTossLoginIntegratedService.ts +2 -2
- package/src/{AppsInTossModule → MiniAppModule}/native-modules/getOperationalEnvironment.ts +2 -2
- package/src/{AppsInTossModule → MiniAppModule}/native-modules/getPermission.ts +2 -2
- package/src/{AppsInTossModule → MiniAppModule}/native-modules/getServerTime.ts +2 -2
- package/src/{AppsInTossModule → MiniAppModule}/native-modules/getTossAppVersion.ts +2 -2
- package/src/MiniAppModule/native-modules/getTossShareLink.ts +39 -0
- package/src/{AppsInTossModule → MiniAppModule}/native-modules/getUserKeyForGame.ts +2 -2
- package/src/{AppsInTossModule → MiniAppModule}/native-modules/grantPromotionRewardForGame.ts +10 -6
- package/src/{AppsInTossModule → MiniAppModule}/native-modules/iap.ts +11 -12
- package/src/{AppsInTossModule → MiniAppModule}/native-modules/index.ts +5 -3
- package/src/{AppsInTossModule → MiniAppModule}/native-modules/isMinVersionSupported.ts +3 -3
- package/src/{AppsInTossModule → MiniAppModule}/native-modules/permissions/fetchAlbumPhotos/fetchAlbumPhotos.ts +2 -2
- package/src/{AppsInTossModule → MiniAppModule}/native-modules/permissions/fetchContacts/fetchContacts.ts +2 -2
- package/src/{AppsInTossModule → MiniAppModule}/native-modules/permissions/getClipboardText/getClipboardText.ts +2 -2
- package/src/{AppsInTossModule → MiniAppModule}/native-modules/permissions/getCurrentLocation/getCurrentLocation.ts +2 -2
- package/src/{AppsInTossModule → MiniAppModule}/native-modules/permissions/openCamera/openCamera.ts +2 -2
- package/src/{AppsInTossModule → MiniAppModule}/native-modules/permissions/openPermissionDialog.ts +2 -2
- package/src/{AppsInTossModule → MiniAppModule}/native-modules/permissions/setClipboardText/setClipboardText.ts +2 -2
- package/src/{AppsInTossModule → MiniAppModule}/native-modules/saveBase64Data.ts +2 -2
- package/src/{AppsInTossModule → MiniAppModule}/native-modules/setDeviceOrientation.ts +2 -2
- package/src/MiniAppModule/native-modules/shareWithScheme.ts +23 -0
- package/src/{AppsInTossModule → MiniAppModule}/native-modules/storage.ts +5 -8
- package/src/{AppsInTossModule → MiniAppModule}/native-modules/submitGameCenterLeaderBoardScore.ts +2 -2
- package/src/{AppsInTossModule → MiniAppModule}/native-modules/tossCore.ts +5 -17
- package/src/MiniAppModule.brick.ts +158 -0
- package/src/TossCoreModule.brick.ts +17 -0
- package/src/async-bridges.ts +23 -23
- package/src/constant-bridges.ts +4 -3
- package/src/event-bridges.ts +3 -3
- package/src/index.ts +6 -5
- package/src/natives.ts +10 -0
- package/src/AppsInTossModule/native-event-emitter/nativeEventEmitter.ts +0 -35
- package/src/AppsInTossModule/native-modules/AppsInTossModule.ts +0 -107
- package/src/AppsInTossModule/native-modules/getTossShareLink.ts +0 -65
- package/src/BedrockModule/native-modules/core/BedrockCoreModule.ts +0 -8
- /package/src/{AppsInTossModule → MiniAppModule}/constants.ts +0 -0
- /package/src/{AppsInTossModule → MiniAppModule}/native-event-emitter/StartUpdateLocationPermissionError.ts +0 -0
- /package/src/{AppsInTossModule → MiniAppModule}/native-event-emitter/appsInTossEvent.ts +0 -0
- /package/src/{AppsInTossModule → MiniAppModule}/native-event-emitter/contactsViral.ts +0 -0
- /package/src/{AppsInTossModule → MiniAppModule}/native-event-emitter/index.ts +0 -0
- /package/src/{AppsInTossModule → MiniAppModule}/native-event-emitter/internal/onVisibilityChangedByTransparentServiceWeb.ts +0 -0
- /package/src/{AppsInTossModule → MiniAppModule}/native-event-emitter/startUpdateLocation.ts +0 -0
- /package/src/{AppsInTossModule → MiniAppModule}/native-event-emitter/types.ts +0 -0
- /package/src/{AppsInTossModule → MiniAppModule}/native-modules/ads/googleAdMobV2.ts +0 -0
- /package/src/{AppsInTossModule → MiniAppModule}/native-modules/eventLog.spec.ts +0 -0
- /package/src/{AppsInTossModule → MiniAppModule}/native-modules/isMinVersionSupported.spec.ts +0 -0
- /package/src/{AppsInTossModule → MiniAppModule}/native-modules/openGameCenterLeaderboard.ts +0 -0
- /package/src/{AppsInTossModule → MiniAppModule}/native-modules/permissions/createPermissionFunction.ts +0 -0
- /package/src/{AppsInTossModule → MiniAppModule}/native-modules/permissions/requestPermission.ts +0 -0
|
@@ -1,20 +1,8 @@
|
|
|
1
|
-
import { AppsInTossModule } from './AppsInTossModule';
|
|
2
1
|
import { isMinVersionSupported } from './isMinVersionSupported';
|
|
3
|
-
|
|
4
|
-
const MIN_VERSION_BY_USER_TYPE = {
|
|
5
|
-
USER_PERSONAL: {
|
|
6
|
-
android: '5.233.0',
|
|
7
|
-
ios: '5.233.0',
|
|
8
|
-
},
|
|
9
|
-
USER_NONE: {
|
|
10
|
-
android: '5.236.0',
|
|
11
|
-
ios: '5.236.0',
|
|
12
|
-
},
|
|
13
|
-
} as const;
|
|
2
|
+
import { safePostMessage } from '../../natives';
|
|
14
3
|
|
|
15
4
|
export interface AppsInTossSignTossCertParams {
|
|
16
5
|
txId: string;
|
|
17
|
-
skipConfirmDoc?: boolean;
|
|
18
6
|
}
|
|
19
7
|
|
|
20
8
|
/**
|
|
@@ -25,7 +13,6 @@ export interface AppsInTossSignTossCertParams {
|
|
|
25
13
|
*
|
|
26
14
|
* @param {AppsInTossSignTossCertParams} params - 서명에 필요한 파라미터를 포함하는 객체예요.
|
|
27
15
|
* @param {string} params.txId - 토스인증서를 사용한 본인확인이나 간편인증, 전자서명에서 사용하는 Transaction Id예요.
|
|
28
|
-
* @param {boolean} params.skipConfirmDoc - (선택) 토스 원터치 인증방식을 사용하기 위한 옵션이예요. true 설정 시 최소 버전: Android 5.236.0, iOS 5.236.0 (default: false)
|
|
29
16
|
*
|
|
30
17
|
* @example
|
|
31
18
|
* ```tsx
|
|
@@ -47,14 +34,15 @@ export interface AppsInTossSignTossCertParams {
|
|
|
47
34
|
*/
|
|
48
35
|
|
|
49
36
|
export async function appsInTossSignTossCert(params: AppsInTossSignTossCertParams) {
|
|
50
|
-
const
|
|
51
|
-
|
|
52
|
-
|
|
37
|
+
const isSupported = isMinVersionSupported({
|
|
38
|
+
android: '5.233.0',
|
|
39
|
+
ios: '5.233.0',
|
|
40
|
+
});
|
|
53
41
|
|
|
54
42
|
if (!isSupported) {
|
|
55
43
|
console.warn('appsInTossSignTossCert is not supported in this app version');
|
|
56
44
|
return;
|
|
57
45
|
}
|
|
58
46
|
|
|
59
|
-
await
|
|
47
|
+
await safePostMessage('appsInTossSignTossCert', params);
|
|
60
48
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { safePostMessage } from '../../natives';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* @public
|
|
@@ -75,6 +75,6 @@ export interface CheckoutPaymentResult {
|
|
|
75
75
|
* }
|
|
76
76
|
* ```
|
|
77
77
|
*/
|
|
78
|
-
export async function checkoutPayment(options: CheckoutPaymentOptions): Promise<CheckoutPaymentResult> {
|
|
79
|
-
return
|
|
78
|
+
export async function checkoutPayment(options: { params: CheckoutPaymentOptions }): Promise<CheckoutPaymentResult> {
|
|
79
|
+
return safePostMessage('checkoutPayment', options.params);
|
|
80
80
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { AppsInTossModule } from './AppsInTossModule';
|
|
2
1
|
import { isMinVersionSupported } from './isMinVersionSupported';
|
|
2
|
+
import { MiniAppModule, safePostMessage } from '../../natives';
|
|
3
3
|
import { Primitive } from '../../types';
|
|
4
4
|
|
|
5
5
|
function normalizeParams(params: Record<string, Primitive>): Record<string, string> {
|
|
@@ -52,7 +52,7 @@ export interface EventLogParams {
|
|
|
52
52
|
* ```
|
|
53
53
|
*/
|
|
54
54
|
export async function eventLog(params: EventLogParams) {
|
|
55
|
-
if (
|
|
55
|
+
if (MiniAppModule.getConstants().operationalEnvironment === 'sandbox') {
|
|
56
56
|
console.log('[eventLogDebug]', {
|
|
57
57
|
log_name: params.log_name,
|
|
58
58
|
log_type: params.log_type,
|
|
@@ -69,7 +69,7 @@ export async function eventLog(params: EventLogParams) {
|
|
|
69
69
|
return;
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
-
return
|
|
72
|
+
return safePostMessage('eventLog', {
|
|
73
73
|
log_name: params.log_name,
|
|
74
74
|
log_type: params.log_type,
|
|
75
75
|
params: normalizeParams(params.params),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { MiniAppModule } from '../../natives';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* @public
|
|
@@ -29,5 +29,5 @@ import { AppsInTossModule } from './AppsInTossModule';
|
|
|
29
29
|
* ```
|
|
30
30
|
*/
|
|
31
31
|
export function getDeviceId(): string {
|
|
32
|
-
return
|
|
32
|
+
return MiniAppModule.getConstants().deviceId;
|
|
33
33
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { AppsInTossModule } from './AppsInTossModule';
|
|
2
1
|
import { isMinVersionSupported } from './isMinVersionSupported';
|
|
2
|
+
import { safePostMessage } from '../../natives';
|
|
3
3
|
import { GAME_CENTER_MIN_VERSION } from '../constants';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -64,5 +64,5 @@ export async function getGameCenterGameProfile() {
|
|
|
64
64
|
return;
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
-
return
|
|
67
|
+
return safePostMessage('getGameCenterGameProfile', {});
|
|
68
68
|
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { MiniAppModule } from '../../natives';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @public
|
|
5
|
+
* @category Constants
|
|
6
|
+
* @name getGroupId
|
|
7
|
+
* @description 앱인토스에서 제공하는 그룹 ID를 가져와요.
|
|
8
|
+
* @returns {string} 그룹 ID
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```typescript
|
|
12
|
+
* import { getGroupId } from '@apps-in-toss/native-modules';
|
|
13
|
+
*
|
|
14
|
+
* const groupId = getGroupId();
|
|
15
|
+
* console.log('Group ID:', groupId);
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
export function getGroupId(): string {
|
|
19
|
+
return MiniAppModule.getConstants().groupId;
|
|
20
|
+
}
|
package/src/{AppsInTossModule → MiniAppModule}/native-modules/getIsTossLoginIntegratedService.ts
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { AppsInTossModule } from './AppsInTossModule';
|
|
2
1
|
import { isMinVersionSupported } from './isMinVersionSupported';
|
|
2
|
+
import { safePostMessage } from '../../natives';
|
|
3
3
|
import { GET_IS_TOSS_LOGIN_INTEGRATED_SERVICE_MIN_VERSION } from '../constants';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -56,6 +56,6 @@ export async function getIsTossLoginIntegratedService(): Promise<boolean | undef
|
|
|
56
56
|
return;
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
const response = await
|
|
59
|
+
const response = await safePostMessage('getIsTossLoginIntegratedService', {});
|
|
60
60
|
return response;
|
|
61
61
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { MiniAppModule } from '../../natives';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* @public
|
|
@@ -33,5 +33,5 @@ import { AppsInTossModule } from './AppsInTossModule';
|
|
|
33
33
|
* ```
|
|
34
34
|
*/
|
|
35
35
|
export function getOperationalEnvironment(): 'toss' | 'sandbox' {
|
|
36
|
-
return
|
|
36
|
+
return MiniAppModule.getConstants().operationalEnvironment;
|
|
37
37
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { PermissionAccess, PermissionName, PermissionStatus } from '@apps-in-toss/types';
|
|
2
|
-
import {
|
|
2
|
+
import { safePostMessage } from '../../natives';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* @category AppsInTossModules
|
|
@@ -54,5 +54,5 @@ export function getPermission(permission: {
|
|
|
54
54
|
name: PermissionName;
|
|
55
55
|
access: PermissionAccess;
|
|
56
56
|
}): Promise<PermissionStatus> {
|
|
57
|
-
return
|
|
57
|
+
return safePostMessage('getPermission', permission);
|
|
58
58
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { AppsInTossModule } from './AppsInTossModule';
|
|
2
1
|
import { isMinVersionSupported } from './isMinVersionSupported';
|
|
2
|
+
import { safePostMessage } from '../../natives';
|
|
3
3
|
import { GET_SERVER_TIME_MIN_VERSION } from '../constants';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -40,7 +40,7 @@ export async function getServerTime(): Promise<number | undefined> {
|
|
|
40
40
|
return;
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
return (await
|
|
43
|
+
return (await safePostMessage('getServerTime', {})).serverTime;
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
getServerTime.isSupported = () => isMinVersionSupported(GET_SERVER_TIME_MIN_VERSION);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { MiniAppModule } from '../../natives';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* @public
|
|
@@ -29,5 +29,5 @@ import { AppsInTossModule } from './AppsInTossModule';
|
|
|
29
29
|
* ```
|
|
30
30
|
*/
|
|
31
31
|
export function getTossAppVersion() {
|
|
32
|
-
return
|
|
32
|
+
return MiniAppModule.getConstants().tossAppVersion;
|
|
33
33
|
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { safePostMessage } from '../../natives';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @public
|
|
5
|
+
* @category 공유
|
|
6
|
+
* @kind function
|
|
7
|
+
* @name getTossShareLink
|
|
8
|
+
* @description
|
|
9
|
+
* `getTossShareLink` 함수는 사용자가 지정한 경로를 토스 앱에서 열 수 있는 공유 링크를 반환해요.
|
|
10
|
+
* 이 링크를 다른 사람과 공유하면 토스 앱이 실행되면서 지정한 경로로 진입해요. 토스앱이 없는 사람은 iOS 일 때는 앱스토어로 이동하고, Android 일 때는 플레이스토어로 이동해요.
|
|
11
|
+
*
|
|
12
|
+
* 경로는 토스 앱 내부 특정 화면을 나타내는 딥링크(deep link) 형식이어야 해요.
|
|
13
|
+
* 예를 들어 `intoss://<앱 이름>`이나 `intoss://<앱 이름>/about?name=test`처럼 작성해요.
|
|
14
|
+
*
|
|
15
|
+
* 이 함수를 사용하면 `deep_link_value`를 포함한 완성된 공유 링크를 만들 수 있어요.
|
|
16
|
+
*
|
|
17
|
+
* @param path - 딥링크로 열고 싶은 경로예요. `intoss://`로 시작하는 문자열이어야 해요.
|
|
18
|
+
* @returns {Promise<string>} `deep_link_value`가 포함된 토스 공유 링크를 반환해요.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```tsx
|
|
22
|
+
* import { share } from '@granite-js/react-native';
|
|
23
|
+
* import { getTossShareLink } from '@apps-in-toss/framework';
|
|
24
|
+
*
|
|
25
|
+
* // '/' 경로를 딥링크로 포함한 토스 공유 링크를 생성해요.
|
|
26
|
+
* const tossLink = await getTossShareLink('intoss://my-app');
|
|
27
|
+
*
|
|
28
|
+
* // 생성한 링크를 메시지로 공유해요.
|
|
29
|
+
* await share({ message: tossLink });
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
export async function getTossShareLink(path: string): Promise<string> {
|
|
33
|
+
const { shareLink } = await safePostMessage('getTossShareLink', {});
|
|
34
|
+
const shareUrl = new URL(shareLink);
|
|
35
|
+
|
|
36
|
+
shareUrl.searchParams.set('deep_link_value', path);
|
|
37
|
+
shareUrl.searchParams.set('af_dp', path);
|
|
38
|
+
return shareUrl.toString();
|
|
39
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { AppsInTossModule } from './AppsInTossModule';
|
|
2
1
|
import { isMinVersionSupported } from './isMinVersionSupported';
|
|
2
|
+
import { safePostMessage } from '../../natives';
|
|
3
3
|
import { GAME_USER_KEY_MIN_VERSION } from '../constants';
|
|
4
4
|
|
|
5
5
|
export interface GetUserKeyForGameSuccessResponse {
|
|
@@ -110,7 +110,7 @@ export async function getUserKeyForGame(): Promise<
|
|
|
110
110
|
}
|
|
111
111
|
|
|
112
112
|
try {
|
|
113
|
-
const response = await
|
|
113
|
+
const response = (await safePostMessage('getUserKeyForGame', {})) as GetUserKeyForGameResponse;
|
|
114
114
|
if (response.type === 'HASH') {
|
|
115
115
|
return response;
|
|
116
116
|
}
|
package/src/{AppsInTossModule → MiniAppModule}/native-modules/grantPromotionRewardForGame.ts
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { AppsInTossModule } from './AppsInTossModule';
|
|
2
1
|
import { isMinVersionSupported } from './isMinVersionSupported';
|
|
2
|
+
import { safePostMessage } from '../../natives';
|
|
3
3
|
import { GAME_PROMOTION_REWARD_MIN_VERSION } from '../constants';
|
|
4
4
|
|
|
5
5
|
export interface GrantPromotionRewardForGameSuccessResponse {
|
|
@@ -136,10 +136,11 @@ function isGrantPromotionRewardForGameError(error: unknown): error is { code: st
|
|
|
136
136
|
* }
|
|
137
137
|
* ```
|
|
138
138
|
*/
|
|
139
|
-
export async function grantPromotionRewardForGame({
|
|
140
|
-
params
|
|
141
|
-
|
|
142
|
-
|
|
139
|
+
export async function grantPromotionRewardForGame(params: {
|
|
140
|
+
params: {
|
|
141
|
+
promotionCode: string;
|
|
142
|
+
amount: number;
|
|
143
|
+
};
|
|
143
144
|
}): Promise<GrantPromotionRewardForGameResult> {
|
|
144
145
|
const isSupported = isMinVersionSupported(GAME_PROMOTION_REWARD_MIN_VERSION);
|
|
145
146
|
|
|
@@ -148,7 +149,10 @@ export async function grantPromotionRewardForGame({
|
|
|
148
149
|
}
|
|
149
150
|
|
|
150
151
|
try {
|
|
151
|
-
const response = await
|
|
152
|
+
const response = (await safePostMessage(
|
|
153
|
+
'grantPromotionRewardForGame',
|
|
154
|
+
params.params
|
|
155
|
+
)) as GrantPromotionRewardForGameResponse;
|
|
152
156
|
if (response.key) {
|
|
153
157
|
return response;
|
|
154
158
|
}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { noop } from 'es-toolkit';
|
|
2
2
|
import { isMinVersionSupported } from './isMinVersionSupported';
|
|
3
|
+
import { safePostMessage } from '../../natives';
|
|
3
4
|
import { INTERNAL__appBridgeHandler } from '../native-event-emitter/internal/appBridge';
|
|
4
5
|
|
|
5
|
-
const noop = () => {};
|
|
6
|
-
|
|
7
6
|
type Sku =
|
|
8
7
|
| {
|
|
9
8
|
/**
|
|
@@ -73,11 +72,11 @@ interface IapRequestOneTimePurchaseOptions {
|
|
|
73
72
|
|
|
74
73
|
export function iapCreateOneTimePurchaseOrder(params: Sku) {
|
|
75
74
|
const sku = (params.sku ?? params.productId) as string;
|
|
76
|
-
return
|
|
75
|
+
return safePostMessage('iapCreateOneTimePurchaseOrder', { productId: sku });
|
|
77
76
|
}
|
|
78
77
|
|
|
79
78
|
export function processProductGrant(params: { orderId: string; isProductGranted: boolean }) {
|
|
80
|
-
return
|
|
79
|
+
return safePostMessage('processProductGrant', { orderId: params.orderId, isProductGranted: params.isProductGranted });
|
|
81
80
|
}
|
|
82
81
|
|
|
83
82
|
export function requestOneTimePurchase(params: IapRequestOneTimePurchaseOptions) {
|
|
@@ -182,7 +181,7 @@ function createOneTimePurchaseOrder(params: IapCreateOneTimePurchaseOrderOptions
|
|
|
182
181
|
|
|
183
182
|
if (!isProcessProductGrantSupported) {
|
|
184
183
|
const v1 = () => {
|
|
185
|
-
|
|
184
|
+
safePostMessage('iapCreateOneTimePurchaseOrder', { productId: sku })
|
|
186
185
|
.then((response: IapCreateOneTimePurchaseOrderResult) => {
|
|
187
186
|
Promise.resolve(options.processProductGrant({ orderId: response.orderId }))
|
|
188
187
|
.then(() => {
|
|
@@ -208,7 +207,7 @@ function createOneTimePurchaseOrder(params: IapCreateOneTimePurchaseOrderOptions
|
|
|
208
207
|
{
|
|
209
208
|
onPurchased: async (params: { orderId: string }) => {
|
|
210
209
|
const isProductGranted = await options.processProductGrant(params);
|
|
211
|
-
await
|
|
210
|
+
await safePostMessage('processProductGrant', { orderId: params.orderId, isProductGranted });
|
|
212
211
|
},
|
|
213
212
|
onSuccess: (result: IapCreateOneTimePurchaseOrderResult) => {
|
|
214
213
|
onEvent({ type: 'success', data: result });
|
|
@@ -394,7 +393,7 @@ async function getProductItemList() {
|
|
|
394
393
|
return;
|
|
395
394
|
}
|
|
396
395
|
|
|
397
|
-
return
|
|
396
|
+
return safePostMessage('iapGetProductItemList', {});
|
|
398
397
|
}
|
|
399
398
|
|
|
400
399
|
/**
|
|
@@ -429,7 +428,7 @@ async function getPendingOrders() {
|
|
|
429
428
|
return;
|
|
430
429
|
}
|
|
431
430
|
|
|
432
|
-
return
|
|
431
|
+
return safePostMessage('getPendingOrders', {});
|
|
433
432
|
}
|
|
434
433
|
|
|
435
434
|
/**
|
|
@@ -482,7 +481,7 @@ async function getCompletedOrRefundedOrders(params?: { key?: string | null }) {
|
|
|
482
481
|
return;
|
|
483
482
|
}
|
|
484
483
|
|
|
485
|
-
return
|
|
484
|
+
return safePostMessage('getCompletedOrRefundedOrders', params ?? { key: null });
|
|
486
485
|
}
|
|
487
486
|
|
|
488
487
|
/**
|
|
@@ -518,7 +517,7 @@ async function completeProductGrant(params: { params: { orderId: string } }) {
|
|
|
518
517
|
return;
|
|
519
518
|
}
|
|
520
519
|
|
|
521
|
-
return
|
|
520
|
+
return safePostMessage('completeProductGrant', params.params);
|
|
522
521
|
}
|
|
523
522
|
|
|
524
523
|
/**
|
|
@@ -623,7 +622,7 @@ function createSubscriptionPurchaseOrder(params: CreateSubscriptionPurchaseOrder
|
|
|
623
622
|
{
|
|
624
623
|
onPurchased: async (purchasedParams: { orderId: string; subscriptionId?: string }) => {
|
|
625
624
|
const isProductGranted = await processProductGrant(purchasedParams);
|
|
626
|
-
await
|
|
625
|
+
await safePostMessage('processProductGrant', { orderId: purchasedParams.orderId, isProductGranted });
|
|
627
626
|
},
|
|
628
627
|
onSuccess: (result: IapCreateSubscriptionPurchaseOrderResult) => {
|
|
629
628
|
onEvent({ type: 'success', data: result });
|
|
@@ -14,9 +14,6 @@ import {
|
|
|
14
14
|
// TossPay
|
|
15
15
|
import { checkoutPayment, type CheckoutPaymentOptions, type CheckoutPaymentResult } from './checkoutPayment';
|
|
16
16
|
|
|
17
|
-
export { AppsInTossModuleInstance as INTERNAL__AppsInTossModule } from './AppsInTossModule';
|
|
18
|
-
export { AppsInTossModule } from './AppsInTossModule';
|
|
19
|
-
|
|
20
17
|
export * from './appLogin';
|
|
21
18
|
export * from './eventLog';
|
|
22
19
|
|
|
@@ -45,6 +42,9 @@ export * from './grantPromotionRewardForGame';
|
|
|
45
42
|
export * from './getIsTossLoginIntegratedService';
|
|
46
43
|
export * from '../native-event-emitter/contactsViral';
|
|
47
44
|
export * from './appsInTossSignTossCert';
|
|
45
|
+
export * from './getGroupId';
|
|
46
|
+
|
|
47
|
+
export * from './shareWithScheme';
|
|
48
48
|
export * from './getServerTime';
|
|
49
49
|
|
|
50
50
|
export type {
|
|
@@ -70,6 +70,8 @@ export const TossPay = {
|
|
|
70
70
|
checkoutPayment,
|
|
71
71
|
};
|
|
72
72
|
|
|
73
|
+
export * from './checkoutPayment';
|
|
74
|
+
|
|
73
75
|
/**
|
|
74
76
|
* @public
|
|
75
77
|
* @category 광고
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Platform } from 'react-native';
|
|
2
|
-
import {
|
|
2
|
+
import { MiniAppModule } from '../../natives';
|
|
3
3
|
import { compareVersions } from '../../utils/compareVersion';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -44,12 +44,12 @@ export function isMinVersionSupported(minVersions: {
|
|
|
44
44
|
android: `${number}.${number}.${number}` | 'always' | 'never';
|
|
45
45
|
ios: `${number}.${number}.${number}` | 'always' | 'never';
|
|
46
46
|
}): boolean {
|
|
47
|
-
const operationalEnvironment =
|
|
47
|
+
const operationalEnvironment = MiniAppModule.getConstants().operationalEnvironment;
|
|
48
48
|
if (operationalEnvironment === 'sandbox') {
|
|
49
49
|
return true;
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
-
const currentVersion =
|
|
52
|
+
const currentVersion = MiniAppModule.getConstants().tossAppVersion;
|
|
53
53
|
const isIOS = Platform.OS === 'ios';
|
|
54
54
|
const minVersion = isIOS ? minVersions.ios : minVersions.android;
|
|
55
55
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FetchAlbumPhotos, FetchAlbumPhotosPermissionError } from '@apps-in-toss/types';
|
|
2
|
-
import {
|
|
2
|
+
import { safePostMessage } from '../../../../natives';
|
|
3
3
|
import { createPermissionFunction } from '../createPermissionFunction';
|
|
4
4
|
|
|
5
5
|
const DEFAULT_MAX_COUNT = 10;
|
|
@@ -95,7 +95,7 @@ const DEFAULT_MAX_WIDTH = 1024;
|
|
|
95
95
|
*/
|
|
96
96
|
export const fetchAlbumPhotos = createPermissionFunction<FetchAlbumPhotos>({
|
|
97
97
|
handler: async (options) => {
|
|
98
|
-
return
|
|
98
|
+
return safePostMessage('fetchAlbumPhotos', {
|
|
99
99
|
...options,
|
|
100
100
|
maxCount: options?.maxCount ?? DEFAULT_MAX_COUNT,
|
|
101
101
|
maxWidth: options?.maxWidth ?? DEFAULT_MAX_WIDTH,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FetchContactsPermissionError, type FetchContacts } from '@apps-in-toss/types';
|
|
2
|
-
import {
|
|
2
|
+
import { safePostMessage } from '../../../../natives';
|
|
3
3
|
import { createPermissionFunction } from '../createPermissionFunction';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -116,7 +116,7 @@ import { createPermissionFunction } from '../createPermissionFunction';
|
|
|
116
116
|
|
|
117
117
|
export const fetchContacts = createPermissionFunction<FetchContacts>({
|
|
118
118
|
handler: async (options) => {
|
|
119
|
-
const contacts = await
|
|
119
|
+
const contacts = await safePostMessage('fetchContacts', options);
|
|
120
120
|
|
|
121
121
|
return {
|
|
122
122
|
result: contacts.result,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { GetClipboardTextPermissionError, type GetClipboardText } from '@apps-in-toss/types';
|
|
2
|
-
import {
|
|
2
|
+
import { safePostMessage } from '../../../../natives';
|
|
3
3
|
import { createPermissionFunction } from '../createPermissionFunction';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -77,7 +77,7 @@ import { createPermissionFunction } from '../createPermissionFunction';
|
|
|
77
77
|
*/
|
|
78
78
|
export const getClipboardText = createPermissionFunction<GetClipboardText>({
|
|
79
79
|
handler: () => {
|
|
80
|
-
return
|
|
80
|
+
return safePostMessage('getClipboardText', {});
|
|
81
81
|
},
|
|
82
82
|
permission: {
|
|
83
83
|
name: 'clipboard',
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { GetCurrentLocation, GetCurrentLocationPermissionError } from '@apps-in-toss/types';
|
|
2
|
-
import {
|
|
2
|
+
import { safePostMessage } from '../../../../natives';
|
|
3
3
|
import { createPermissionFunction } from '../createPermissionFunction';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -78,7 +78,7 @@ import { createPermissionFunction } from '../createPermissionFunction';
|
|
|
78
78
|
*/
|
|
79
79
|
export const getCurrentLocation = createPermissionFunction<GetCurrentLocation>({
|
|
80
80
|
handler: async (options) => {
|
|
81
|
-
return
|
|
81
|
+
return safePostMessage('getCurrentLocation', options);
|
|
82
82
|
},
|
|
83
83
|
permission: {
|
|
84
84
|
name: 'geolocation',
|
package/src/{AppsInTossModule → MiniAppModule}/native-modules/permissions/openCamera/openCamera.ts
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { OpenCameraPermissionError, type OpenCamera } from '@apps-in-toss/types';
|
|
2
|
-
import {
|
|
2
|
+
import { safePostMessage } from '../../../../natives';
|
|
3
3
|
import { createPermissionFunction } from '../createPermissionFunction';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -85,7 +85,7 @@ import { createPermissionFunction } from '../createPermissionFunction';
|
|
|
85
85
|
*/
|
|
86
86
|
export const openCamera = createPermissionFunction<OpenCamera>({
|
|
87
87
|
handler: (options) => {
|
|
88
|
-
return
|
|
88
|
+
return safePostMessage('openCamera', {
|
|
89
89
|
base64: false,
|
|
90
90
|
maxWidth: 1024,
|
|
91
91
|
...options,
|
package/src/{AppsInTossModule → MiniAppModule}/native-modules/permissions/openPermissionDialog.ts
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { PermissionAccess, PermissionDialogFunction, PermissionName } from '@apps-in-toss/types';
|
|
2
|
-
import {
|
|
2
|
+
import { safePostMessage } from '../../../natives';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* @category AppsInTossModules
|
|
@@ -50,5 +50,5 @@ export function openPermissionDialog(permission: {
|
|
|
50
50
|
name: PermissionName;
|
|
51
51
|
access: PermissionAccess;
|
|
52
52
|
}): ReturnType<PermissionDialogFunction> {
|
|
53
|
-
return
|
|
53
|
+
return safePostMessage('openPermissionDialog', permission);
|
|
54
54
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SetClipboardTextPermissionError, type SetClipboardText } from '@apps-in-toss/types';
|
|
2
|
-
import {
|
|
2
|
+
import { safePostMessage } from '../../../../natives';
|
|
3
3
|
import { createPermissionFunction } from '../createPermissionFunction';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -65,7 +65,7 @@ import { createPermissionFunction } from '../createPermissionFunction';
|
|
|
65
65
|
*/
|
|
66
66
|
export const setClipboardText = createPermissionFunction<SetClipboardText>({
|
|
67
67
|
handler: (text) => {
|
|
68
|
-
return
|
|
68
|
+
return safePostMessage('setClipboardText', { text });
|
|
69
69
|
},
|
|
70
70
|
permission: {
|
|
71
71
|
name: 'clipboard',
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { AppsInTossModule } from './AppsInTossModule';
|
|
2
1
|
import { isMinVersionSupported } from './isMinVersionSupported';
|
|
2
|
+
import { safePostMessage } from '../../natives';
|
|
3
3
|
|
|
4
4
|
export interface SaveBase64DataParams {
|
|
5
5
|
data: string;
|
|
@@ -53,5 +53,5 @@ export async function saveBase64Data(params: SaveBase64DataParams) {
|
|
|
53
53
|
return;
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
await
|
|
56
|
+
await safePostMessage('saveBase64Data', params);
|
|
57
57
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { AppsInTossModule } from './AppsInTossModule';
|
|
2
1
|
import { isMinVersionSupported } from './isMinVersionSupported';
|
|
2
|
+
import { safePostMessage } from '../../natives';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* @public
|
|
@@ -70,5 +70,5 @@ export async function setDeviceOrientation(options: { type: 'portrait' | 'landsc
|
|
|
70
70
|
return;
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
-
return
|
|
73
|
+
return safePostMessage('setDeviceOrientation', options);
|
|
74
74
|
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { safeSyncPostMessage } from '../../natives';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @public
|
|
5
|
+
* @category 공유
|
|
6
|
+
* @kind function
|
|
7
|
+
* @name shareWithScheme
|
|
8
|
+
* @description
|
|
9
|
+
* `shareWithScheme` 함수는 지정한 스킴 URL을 다른 앱과 공유해요.
|
|
10
|
+
*
|
|
11
|
+
* @param params - 공유할 스킴 URL 정보
|
|
12
|
+
* @param params.schemeURL - 공유할 스킴 URL
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```tsx
|
|
16
|
+
* import { shareWithScheme } from '@apps-in-toss/native-modules';
|
|
17
|
+
*
|
|
18
|
+
* shareWithScheme({ schemeURL: 'intoss://my-app?referrer=share' });
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
export function shareWithScheme(params: { schemeURL: string }): void {
|
|
22
|
+
safeSyncPostMessage('shareWithScheme', params);
|
|
23
|
+
}
|