@apps-in-toss/native-modules 1.14.1 → 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,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { safePostMessage } from '../../natives';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* @public
|
|
@@ -16,7 +16,7 @@ import { AppsInTossModule } from './AppsInTossModule';
|
|
|
16
16
|
* ```
|
|
17
17
|
*/
|
|
18
18
|
function getItem(key: string): Promise<string | null> {
|
|
19
|
-
return
|
|
19
|
+
return safePostMessage('getStorageItem', { key });
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
/**
|
|
@@ -37,10 +37,7 @@ function getItem(key: string): Promise<string | null> {
|
|
|
37
37
|
* ```
|
|
38
38
|
*/
|
|
39
39
|
function setItem(key: string, value: string): Promise<void> {
|
|
40
|
-
return
|
|
41
|
-
key,
|
|
42
|
-
value,
|
|
43
|
-
});
|
|
40
|
+
return safePostMessage('setStorageItem', { key, value });
|
|
44
41
|
}
|
|
45
42
|
|
|
46
43
|
/**
|
|
@@ -60,7 +57,7 @@ function setItem(key: string, value: string): Promise<void> {
|
|
|
60
57
|
* ```
|
|
61
58
|
*/
|
|
62
59
|
function removeItem(key: string): Promise<void> {
|
|
63
|
-
return
|
|
60
|
+
return safePostMessage('removeStorageItem', { key });
|
|
64
61
|
}
|
|
65
62
|
|
|
66
63
|
/**
|
|
@@ -79,7 +76,7 @@ function removeItem(key: string): Promise<void> {
|
|
|
79
76
|
* ```
|
|
80
77
|
*/
|
|
81
78
|
function clearItems(): Promise<void> {
|
|
82
|
-
return
|
|
79
|
+
return safePostMessage('clearStorage', {});
|
|
83
80
|
}
|
|
84
81
|
|
|
85
82
|
/**
|
package/src/{AppsInTossModule → MiniAppModule}/native-modules/submitGameCenterLeaderBoardScore.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_CENTER_MIN_VERSION } from '../constants';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -70,5 +70,5 @@ export async function submitGameCenterLeaderBoardScore(params: { score: string }
|
|
|
70
70
|
return;
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
-
return
|
|
73
|
+
return safePostMessage('submitGameCenterLeaderBoardScore', params);
|
|
74
74
|
}
|
|
@@ -1,16 +1,6 @@
|
|
|
1
|
-
import { NativeModules } from 'react-native';
|
|
2
1
|
import { getOperationalEnvironment } from './getOperationalEnvironment';
|
|
3
2
|
import { isMinVersionSupported } from './isMinVersionSupported';
|
|
4
|
-
|
|
5
|
-
const TossCoreModule: {
|
|
6
|
-
eventLog: (params: {
|
|
7
|
-
params: {
|
|
8
|
-
log_name: string;
|
|
9
|
-
log_type: string;
|
|
10
|
-
params: Record<string, unknown>;
|
|
11
|
-
};
|
|
12
|
-
}) => Promise<void>;
|
|
13
|
-
} = NativeModules.TossCoreModule;
|
|
3
|
+
import { TossCoreModule } from '../../natives';
|
|
14
4
|
|
|
15
5
|
export function tossCoreEventLog(params: { log_name: string; log_type: string; params: Record<string, unknown> }) {
|
|
16
6
|
const supported = isMinVersionSupported({ ios: '5.210.0', android: '5.210.0' });
|
|
@@ -19,11 +9,9 @@ export function tossCoreEventLog(params: { log_name: string; log_type: string; p
|
|
|
19
9
|
return;
|
|
20
10
|
}
|
|
21
11
|
|
|
22
|
-
TossCoreModule.eventLog({
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
params: params.params,
|
|
27
|
-
},
|
|
12
|
+
return TossCoreModule.eventLog({
|
|
13
|
+
log_name: params.log_name,
|
|
14
|
+
log_type: params.log_type,
|
|
15
|
+
params: params.params,
|
|
28
16
|
});
|
|
29
17
|
}
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
CompatiblePlaceholderArgument,
|
|
3
|
+
PermissionName,
|
|
4
|
+
PermissionAccess,
|
|
5
|
+
PermissionStatus,
|
|
6
|
+
ImageResponse,
|
|
7
|
+
ContactResult,
|
|
8
|
+
Location,
|
|
9
|
+
} from '@apps-in-toss/types';
|
|
10
|
+
import { Any, AnyObject, BrickModule, BrickModuleSpec } from 'brick-module';
|
|
11
|
+
import { CodegenTypes } from 'react-native';
|
|
12
|
+
import type { AppsInTossSignTossCertParams } from './MiniAppModule/native-modules/appsInTossSignTossCert';
|
|
13
|
+
import type { CheckoutPaymentOptions, CheckoutPaymentResult } from './MiniAppModule/native-modules/checkoutPayment';
|
|
14
|
+
import type { GameCenterGameProfileResponse } from './MiniAppModule/native-modules/getGameCenterGameProfile';
|
|
15
|
+
import type { GetUserKeyForGameResponse } from './MiniAppModule/native-modules/getUserKeyForGame';
|
|
16
|
+
import type { GrantPromotionRewardForGameResponse } from './MiniAppModule/native-modules/grantPromotionRewardForGame';
|
|
17
|
+
import type { IapCreateOneTimePurchaseOrderResult } from './MiniAppModule/native-modules/iap';
|
|
18
|
+
import type { SaveBase64DataParams } from './MiniAppModule/native-modules/saveBase64Data';
|
|
19
|
+
import type { SubmitGameCenterLeaderBoardScoreResponse } from './MiniAppModule/native-modules/submitGameCenterLeaderBoardScore';
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* MiniAppModule Spec
|
|
23
|
+
* Unified type definition for MiniAppModule (formerly AppsInTossModule)
|
|
24
|
+
*/
|
|
25
|
+
export interface MiniAppModuleSpec extends BrickModuleSpec {
|
|
26
|
+
readonly moduleName: 'MiniAppModule';
|
|
27
|
+
// readonly supportedEvents: ['updateLocation', 'visibilityChangedByTransparentServiceWeb', 'appBridgeCallback'];
|
|
28
|
+
|
|
29
|
+
readonly onSendEvent: CodegenTypes.EventEmitter<{
|
|
30
|
+
eventName: string; // updateLocation, visibilityChangedByTransparentServiceWeb, appBridgeCallback
|
|
31
|
+
body: AnyObject;
|
|
32
|
+
}>;
|
|
33
|
+
|
|
34
|
+
getConstants(): {
|
|
35
|
+
// Constants
|
|
36
|
+
groupId: string;
|
|
37
|
+
operationalEnvironment: 'sandbox' | 'toss';
|
|
38
|
+
tossAppVersion: string;
|
|
39
|
+
deviceId: string;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
// All async/sync methods are now handled via postMessage/postMessageSync
|
|
43
|
+
postMessage(name: string, params: AnyObject, callbacks: AnyObject): Promise<Any>;
|
|
44
|
+
postMessageSync(name: string, params: AnyObject, callbacks: AnyObject): Any;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Async Methods Map
|
|
49
|
+
* Type definitions for all async methods accessed via postMessage
|
|
50
|
+
*/
|
|
51
|
+
export interface AsyncMethodsMap {
|
|
52
|
+
// Storage (4)
|
|
53
|
+
getStorageItem: (params: { key: string }) => Promise<string | null>;
|
|
54
|
+
setStorageItem: (params: { key: string; value: string }) => Promise<void>;
|
|
55
|
+
removeStorageItem: (params: { key: string }) => Promise<void>;
|
|
56
|
+
clearStorage: (params: CompatiblePlaceholderArgument) => Promise<void>;
|
|
57
|
+
|
|
58
|
+
// Permissions (2)
|
|
59
|
+
getPermission: (params: { name: PermissionName; access: PermissionAccess }) => Promise<PermissionStatus>;
|
|
60
|
+
openPermissionDialog: (params: { name: PermissionName; access: PermissionAccess }) => Promise<'allowed' | 'denied'>;
|
|
61
|
+
|
|
62
|
+
// Clipboard (2)
|
|
63
|
+
getClipboardText: (params: CompatiblePlaceholderArgument) => Promise<string>;
|
|
64
|
+
setClipboardText: (params: { text: string }) => Promise<void>;
|
|
65
|
+
|
|
66
|
+
// Contacts & Photos (3)
|
|
67
|
+
fetchContacts: (params: { size: number; offset: number; query?: { contains?: string } }) => Promise<ContactResult>;
|
|
68
|
+
fetchAlbumPhotos: (params: { base64?: boolean; maxCount?: number; maxWidth?: number }) => Promise<ImageResponse[]>;
|
|
69
|
+
openCamera: (params: { base64?: boolean; maxWidth?: number }) => Promise<ImageResponse>;
|
|
70
|
+
|
|
71
|
+
// Location (1)
|
|
72
|
+
startUpdateLocation: (params: { accuracy: number; timeInterval: number; distanceInterval: number }) => Promise<void>;
|
|
73
|
+
getCurrentLocation: (params: { accuracy: number }) => Promise<Location>;
|
|
74
|
+
|
|
75
|
+
// IAP (6)
|
|
76
|
+
iapCreateOneTimePurchaseOrder: (params: { productId: string }) => Promise<IapCreateOneTimePurchaseOrderResult>;
|
|
77
|
+
processProductGrant: (params: { orderId: string; isProductGranted: boolean }) => Promise<void>;
|
|
78
|
+
iapGetProductItemList: (params: CompatiblePlaceholderArgument) => Promise<{ products: any[] }>;
|
|
79
|
+
getPendingOrders: (
|
|
80
|
+
params: CompatiblePlaceholderArgument
|
|
81
|
+
) => Promise<{ orders: Array<{ orderId: string; sku: string }> }>;
|
|
82
|
+
getCompletedOrRefundedOrders: (params: { key?: string | null }) => Promise<any>;
|
|
83
|
+
completeProductGrant: (params: { orderId: string }) => Promise<boolean>;
|
|
84
|
+
|
|
85
|
+
// Other (9)
|
|
86
|
+
eventLog: (params: { log_name: string; log_type: string; params: Record<string, string> }) => Promise<void>;
|
|
87
|
+
getTossShareLink: (params: CompatiblePlaceholderArgument) => Promise<{ shareLink: string }>;
|
|
88
|
+
appLogin: (
|
|
89
|
+
params: CompatiblePlaceholderArgument
|
|
90
|
+
) => Promise<{ authorizationCode: string; referrer: 'DEFAULT' | 'SANDBOX' }>;
|
|
91
|
+
checkoutPayment: (params: CheckoutPaymentOptions) => Promise<CheckoutPaymentResult>;
|
|
92
|
+
setDeviceOrientation: (params: { type: 'portrait' | 'landscape' }) => Promise<void>;
|
|
93
|
+
saveBase64Data: (params: SaveBase64DataParams) => Promise<void>;
|
|
94
|
+
appsInTossSignTossCert: (params: AppsInTossSignTossCertParams) => Promise<void>;
|
|
95
|
+
getGameCenterGameProfile: (
|
|
96
|
+
params: CompatiblePlaceholderArgument
|
|
97
|
+
) => Promise<GameCenterGameProfileResponse | undefined>;
|
|
98
|
+
getUserKeyForGame: (params: CompatiblePlaceholderArgument) => Promise<GetUserKeyForGameResponse | undefined>;
|
|
99
|
+
grantPromotionRewardForGame: (params: {
|
|
100
|
+
promotionCode: string;
|
|
101
|
+
amount: number;
|
|
102
|
+
}) => Promise<GrantPromotionRewardForGameResponse | undefined>;
|
|
103
|
+
submitGameCenterLeaderBoardScore: (params: {
|
|
104
|
+
score: string;
|
|
105
|
+
}) => Promise<SubmitGameCenterLeaderBoardScoreResponse | undefined>;
|
|
106
|
+
|
|
107
|
+
// INTERNAL__appBridgeHandler methods (9)
|
|
108
|
+
requestOneTimePurchase: (params: { sku: string }) => Promise<void>;
|
|
109
|
+
contactsViral: (params: { moduleId: string }) => Promise<void>;
|
|
110
|
+
getMiniAppsSupportContact: (params: object) => Promise<void>;
|
|
111
|
+
loadAdMobInterstitialAd: (params: { adUnitId: string }) => Promise<void>;
|
|
112
|
+
showAdMobInterstitialAd: (params: { adUnitId: string }) => Promise<void>;
|
|
113
|
+
loadAdMobRewardedAd: (params: { adUnitId: string }) => Promise<void>;
|
|
114
|
+
showAdMobRewardedAd: (params: { adUnitId: string }) => Promise<void>;
|
|
115
|
+
loadAppsInTossAdmob: (params: { adGroupId: string; referrer: string }) => Promise<void>;
|
|
116
|
+
showAppsInTossAdmob: (params: { adGroupId: string; referrer: string }) => Promise<void>;
|
|
117
|
+
getIsTossLoginIntegratedService: (params: object) => Promise<boolean | undefined>;
|
|
118
|
+
|
|
119
|
+
getServerTime: (params: CompatiblePlaceholderArgument) => Promise<{ serverTime: number }>;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Sync Methods Map
|
|
124
|
+
* Type definitions for all sync methods accessed via postMessageSync
|
|
125
|
+
*/
|
|
126
|
+
export interface SyncMethodsMap {
|
|
127
|
+
getWebBundleURL: (params: CompatiblePlaceholderArgument) => { url: string };
|
|
128
|
+
shareWithScheme: (params: { schemeURL: string }) => void;
|
|
129
|
+
stopUpdateLocation: (params: object) => void;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* MiniAppModule Instance
|
|
134
|
+
* Native module instance accessed through BrickModule
|
|
135
|
+
*/
|
|
136
|
+
export const MiniAppModule = BrickModule.get<MiniAppModuleSpec>('MiniAppModule');
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Type-safe postMessage wrapper
|
|
140
|
+
* Provides type inference for async method calls without requiring 'as unknown' casts
|
|
141
|
+
*/
|
|
142
|
+
export function safePostMessage<K extends keyof AsyncMethodsMap>(
|
|
143
|
+
method: K,
|
|
144
|
+
params: Parameters<AsyncMethodsMap[K]>[0]
|
|
145
|
+
): ReturnType<AsyncMethodsMap[K]> {
|
|
146
|
+
return MiniAppModule.postMessage(method, params, {}) as ReturnType<AsyncMethodsMap[K]>;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* Type-safe postMessageSync wrapper
|
|
151
|
+
* Provides type inference for sync method calls without requiring 'as unknown' casts
|
|
152
|
+
*/
|
|
153
|
+
export function safeSyncPostMessage<K extends keyof SyncMethodsMap>(
|
|
154
|
+
method: K,
|
|
155
|
+
params: Parameters<SyncMethodsMap[K]>[0]
|
|
156
|
+
): ReturnType<SyncMethodsMap[K]> {
|
|
157
|
+
return MiniAppModule.postMessageSync(method, params, {}) as ReturnType<SyncMethodsMap[K]>;
|
|
158
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { BrickModule, BrickModuleSpec } from 'brick-module';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* TossCoreModule Spec
|
|
5
|
+
* Unified type definition for TossCoreModule (Toss App internal logging)
|
|
6
|
+
*/
|
|
7
|
+
export interface TossCoreModuleSpec extends BrickModuleSpec {
|
|
8
|
+
readonly moduleName: 'TossCoreModule';
|
|
9
|
+
|
|
10
|
+
eventLog: (params: { log_name: string; log_type: string; params: Record<string, unknown> }) => Promise<void>;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* TossCoreModule Instance
|
|
15
|
+
* Native module instance accessed through BrickModule
|
|
16
|
+
*/
|
|
17
|
+
export const TossCoreModule = BrickModule.get<TossCoreModuleSpec>('TossCoreModule');
|
package/src/async-bridges.ts
CHANGED
|
@@ -9,26 +9,26 @@ export * from './BedrockModule/native-modules/natives/setIosSwipeGestureEnabled'
|
|
|
9
9
|
export * from './BedrockModule/native-modules/natives/openURL';
|
|
10
10
|
|
|
11
11
|
// AppsInTossModule
|
|
12
|
-
export * from './
|
|
13
|
-
export * from './
|
|
14
|
-
export * from './
|
|
15
|
-
export * from './
|
|
16
|
-
export * from './
|
|
17
|
-
export * from './
|
|
18
|
-
export * from './
|
|
19
|
-
export * from './
|
|
20
|
-
export * from './
|
|
21
|
-
export * from './
|
|
22
|
-
export * from './
|
|
23
|
-
export * from './
|
|
24
|
-
export * from './
|
|
25
|
-
export * from './
|
|
26
|
-
export * from './
|
|
27
|
-
export * from './
|
|
28
|
-
export * from './
|
|
29
|
-
export * from './
|
|
30
|
-
export * from './
|
|
31
|
-
export * from './
|
|
32
|
-
export * from './
|
|
33
|
-
export * from './
|
|
34
|
-
export * from './
|
|
12
|
+
export * from './MiniAppModule/native-modules/permissions/openPermissionDialog';
|
|
13
|
+
export * from './MiniAppModule/native-modules/permissions/requestPermission';
|
|
14
|
+
export * from './MiniAppModule/native-modules/getPermission';
|
|
15
|
+
export * from './MiniAppModule/native-modules/permissions/setClipboardText/setClipboardText';
|
|
16
|
+
export * from './MiniAppModule/native-modules/permissions/getClipboardText/getClipboardText';
|
|
17
|
+
export * from './MiniAppModule/native-modules/permissions/fetchContacts/fetchContacts';
|
|
18
|
+
export * from './MiniAppModule/native-modules/permissions/fetchAlbumPhotos/fetchAlbumPhotos';
|
|
19
|
+
export * from './MiniAppModule/native-modules/permissions/getCurrentLocation/getCurrentLocation';
|
|
20
|
+
export * from './MiniAppModule/native-modules/permissions/openCamera/openCamera';
|
|
21
|
+
export * from './MiniAppModule/native-modules/appLogin';
|
|
22
|
+
export * from './MiniAppModule/native-modules/eventLog';
|
|
23
|
+
export * from './MiniAppModule/native-modules/getTossShareLink';
|
|
24
|
+
export * from './MiniAppModule/native-modules/setDeviceOrientation';
|
|
25
|
+
export * from './MiniAppModule/native-modules/checkoutPayment';
|
|
26
|
+
export * from './MiniAppModule/native-modules/saveBase64Data';
|
|
27
|
+
export * from './MiniAppModule/native-modules/appsInTossSignTossCert';
|
|
28
|
+
export * from './MiniAppModule/native-modules/getGameCenterGameProfile';
|
|
29
|
+
export * from './MiniAppModule/native-modules/openGameCenterLeaderboard';
|
|
30
|
+
export * from './MiniAppModule/native-modules/submitGameCenterLeaderBoardScore';
|
|
31
|
+
export * from './MiniAppModule/native-modules/getUserKeyForGame';
|
|
32
|
+
export * from './MiniAppModule/native-modules/grantPromotionRewardForGame';
|
|
33
|
+
export * from './MiniAppModule/native-modules/getIsTossLoginIntegratedService';
|
|
34
|
+
export * from './MiniAppModule/native-modules/getServerTime';
|
package/src/constant-bridges.ts
CHANGED
|
@@ -4,6 +4,7 @@ export * from './BedrockModule/native-modules/natives/getSchemeUri';
|
|
|
4
4
|
export * from './BedrockModule/native-modules/natives/getPlatformOS';
|
|
5
5
|
|
|
6
6
|
// AppsInTossModule
|
|
7
|
-
export * from './
|
|
8
|
-
export * from './
|
|
9
|
-
export * from './
|
|
7
|
+
export * from './MiniAppModule/native-modules/getOperationalEnvironment';
|
|
8
|
+
export * from './MiniAppModule/native-modules/getTossAppVersion';
|
|
9
|
+
export * from './MiniAppModule/native-modules/getDeviceId';
|
|
10
|
+
export * from './MiniAppModule/native-modules/getGroupId';
|
package/src/event-bridges.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// AppsInTossModule
|
|
2
|
-
export * from './
|
|
3
|
-
export * from './
|
|
4
|
-
export * from './
|
|
2
|
+
export * from './MiniAppModule/native-event-emitter/startUpdateLocation';
|
|
3
|
+
export * from './MiniAppModule/native-event-emitter/internal/onVisibilityChangedByTransparentServiceWeb';
|
|
4
|
+
export * from './MiniAppModule/native-event-emitter/contactsViral';
|
package/src/index.ts
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
// AppsInTossModule
|
|
2
|
-
export
|
|
3
|
-
export * from './
|
|
1
|
+
// MiniAppModule (formerly AppsInTossModule)
|
|
2
|
+
export { safePostMessage, safeSyncPostMessage } from './MiniAppModule.brick';
|
|
3
|
+
export * from './MiniAppModule/native-event-emitter';
|
|
4
|
+
export * from './MiniAppModule/native-modules';
|
|
4
5
|
|
|
5
|
-
// BedrockModule
|
|
6
|
+
// CommonModule (formerly BedrockModule)
|
|
6
7
|
export * from './BedrockModule/native-modules';
|
|
7
8
|
|
|
8
9
|
// Types
|
|
9
10
|
export * from './types';
|
|
10
11
|
|
|
11
12
|
// Private
|
|
12
|
-
import { tossCoreEventLog } from './
|
|
13
|
+
import { tossCoreEventLog } from './MiniAppModule/native-modules/tossCore';
|
|
13
14
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
14
15
|
export const INTERNAL__module = {
|
|
15
16
|
tossCoreEventLog,
|
package/src/natives.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SSOT (Single Source of Truth) for all native modules
|
|
3
|
+
*
|
|
4
|
+
* All native modules are accessed through BrickModule for consistency.
|
|
5
|
+
* This file re-exports all native module definitions for backward compatibility.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
export * from './MiniAppModule.brick';
|
|
9
|
+
export * from './TossCoreModule.brick';
|
|
10
|
+
export * from './CommonModule.brick';
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { NativeEventEmitter, type EmitterSubscription } from 'react-native';
|
|
2
|
-
import type { OnVisibilityChangedByTransparentServiceWebEventEmitter } from './internal/onVisibilityChangedByTransparentServiceWeb';
|
|
3
|
-
import type { UpdateLocationEventEmitter } from './startUpdateLocation';
|
|
4
|
-
import type { EventEmitterSchema } from './types';
|
|
5
|
-
import { AppsInTossModuleInstance } from '../native-modules/AppsInTossModule';
|
|
6
|
-
|
|
7
|
-
type EventEmitters = UpdateLocationEventEmitter | OnVisibilityChangedByTransparentServiceWebEventEmitter;
|
|
8
|
-
|
|
9
|
-
type MapOf<T> = T extends EventEmitterSchema<infer K, any> ? { [key in K]: T } : never;
|
|
10
|
-
type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
|
|
11
|
-
type EventEmittersMap = UnionToIntersection<MapOf<EventEmitters>>;
|
|
12
|
-
type EventKeys = keyof EventEmittersMap;
|
|
13
|
-
type ParamOf<K extends EventKeys> = EventEmittersMap[K]['params'];
|
|
14
|
-
/**
|
|
15
|
-
* @interface AppsInTossEventEmitter
|
|
16
|
-
* @description
|
|
17
|
-
* 네이티브 플랫폼에서 발생하는 이벤트들을 처리하는 NativeEventEmitter를 App In Toss 프레임워크에서 사용하는 형태에 맞게 정의한 인터페이스에요.
|
|
18
|
-
* @property {(event: EventKeys, callback: (...params: ParamOf<E>) => void) => EmitterSubscription} addListener - 이벤트 리스너를 추가하는 함수
|
|
19
|
-
* @property {(subscription: EmitterSubscription) => void} removeSubscription - 이벤트 구독을 제거하는 함수
|
|
20
|
-
*/
|
|
21
|
-
interface AppsInTossEventEmitter {
|
|
22
|
-
addListener<Event extends EventKeys>(
|
|
23
|
-
event: Event,
|
|
24
|
-
callback: (...params: ParamOf<Event>) => void
|
|
25
|
-
): EmitterSubscription;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* @kind constant
|
|
30
|
-
* @name nativeEventEmitter
|
|
31
|
-
* @description
|
|
32
|
-
* App In Toss 프레임워크에서 제공하는 react-native의 NativeEventEmitter instance에요.
|
|
33
|
-
* @type {AppsInTossEventEmitter}
|
|
34
|
-
*/
|
|
35
|
-
export const nativeEventEmitter = new NativeEventEmitter(AppsInTossModuleInstance) as unknown as AppsInTossEventEmitter;
|
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
CompatiblePlaceholderArgument,
|
|
3
|
-
ContactResult,
|
|
4
|
-
FetchAlbumPhotosOptions,
|
|
5
|
-
FetchContactsOptions,
|
|
6
|
-
GetCurrentLocationOptions,
|
|
7
|
-
ImageResponse,
|
|
8
|
-
Location,
|
|
9
|
-
OpenCameraOptions,
|
|
10
|
-
PermissionAccess,
|
|
11
|
-
PermissionName,
|
|
12
|
-
PermissionStatus,
|
|
13
|
-
SetClipboardTextOptions,
|
|
14
|
-
} from '@apps-in-toss/types';
|
|
15
|
-
import { TurboModuleRegistry, type TurboModule as __TurboModule } from 'react-native';
|
|
16
|
-
import type { AppsInTossSignTossCertParams } from './appsInTossSignTossCert';
|
|
17
|
-
import type { CheckoutPaymentOptions, CheckoutPaymentResult } from './checkoutPayment';
|
|
18
|
-
import type { GameCenterGameProfileResponse } from './getGameCenterGameProfile';
|
|
19
|
-
import { GetUserKeyForGameResponse } from './getUserKeyForGame';
|
|
20
|
-
import { GrantPromotionRewardForGameResponse } from './grantPromotionRewardForGame';
|
|
21
|
-
import { IapCreateOneTimePurchaseOrderResult, IapProductListItem, CompletedOrRefundedOrdersResult } from './iap';
|
|
22
|
-
import type { SaveBase64DataParams } from './saveBase64Data';
|
|
23
|
-
import type { SubmitGameCenterLeaderBoardScoreResponse } from './submitGameCenterLeaderBoardScore';
|
|
24
|
-
import type { ContactsViralParams } from '../native-event-emitter/contactsViral';
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* TurboModule 타입 별칭 사용하는 이유?
|
|
28
|
-
* React Native Codegen 에 의해 코드젠 되는 것이 아니라 추후 내부 모듈 체계에 의해 처리될 것이기 때문에 RN Codegen에 본 파일을 코드젠 하지 않도록 함
|
|
29
|
-
* (코드젠 내부에서 "extends TurboModule" 문자열을 찾기 때문에 패턴에 매칭되지 않도록 함)
|
|
30
|
-
*/
|
|
31
|
-
interface Spec extends __TurboModule {
|
|
32
|
-
groupId: string;
|
|
33
|
-
operationalEnvironment: 'sandbox' | 'toss';
|
|
34
|
-
tossAppVersion: string;
|
|
35
|
-
deviceId: string;
|
|
36
|
-
|
|
37
|
-
getClipboardText: (arg: CompatiblePlaceholderArgument) => Promise<string>;
|
|
38
|
-
setClipboardText: (option: SetClipboardTextOptions) => Promise<void>;
|
|
39
|
-
fetchContacts: (option: FetchContactsOptions) => Promise<ContactResult>;
|
|
40
|
-
fetchAlbumPhotos: (options: FetchAlbumPhotosOptions) => Promise<ImageResponse[]>;
|
|
41
|
-
getCurrentLocation: (options: GetCurrentLocationOptions) => Promise<Location>;
|
|
42
|
-
openCamera: (options: OpenCameraOptions) => Promise<ImageResponse>;
|
|
43
|
-
|
|
44
|
-
getWebBundleURL: (arg: CompatiblePlaceholderArgument) => { url: string };
|
|
45
|
-
getPermission: (permission: { name: PermissionName; access: PermissionAccess }) => Promise<PermissionStatus>;
|
|
46
|
-
openPermissionDialog: (permission: {
|
|
47
|
-
name: PermissionName;
|
|
48
|
-
access: PermissionAccess;
|
|
49
|
-
}) => Promise<Exclude<PermissionStatus, 'notDetermined'>>;
|
|
50
|
-
appLogin: (
|
|
51
|
-
arg: CompatiblePlaceholderArgument
|
|
52
|
-
) => Promise<{ authorizationCode: string; referrer: 'DEFAULT' | 'SANDBOX' }>;
|
|
53
|
-
checkoutPayment: (options: { params: CheckoutPaymentOptions }) => Promise<CheckoutPaymentResult>;
|
|
54
|
-
|
|
55
|
-
/** Storage */
|
|
56
|
-
getStorageItem: (params: { key: string }) => Promise<string | null>;
|
|
57
|
-
setStorageItem: (params: { key: string; value: string }) => Promise<void>;
|
|
58
|
-
removeStorageItem: (params: { key: string }) => Promise<void>;
|
|
59
|
-
clearStorage: (arg: CompatiblePlaceholderArgument) => Promise<void>;
|
|
60
|
-
eventLog: (params: {
|
|
61
|
-
log_name: string;
|
|
62
|
-
log_type: 'debug' | 'info' | 'warn' | 'error' | 'event' | 'screen' | 'impression' | 'click';
|
|
63
|
-
params: Record<string, string>;
|
|
64
|
-
}) => Promise<void>;
|
|
65
|
-
getTossShareLink: (params: object) => Promise<{ shareLink: string }>;
|
|
66
|
-
setDeviceOrientation: (options: { type: 'portrait' | 'landscape' }) => Promise<void>;
|
|
67
|
-
saveBase64Data: (params: SaveBase64DataParams) => Promise<void>;
|
|
68
|
-
|
|
69
|
-
/** IAP */
|
|
70
|
-
iapGetProductItemList: (arg: CompatiblePlaceholderArgument) => Promise<{ products: IapProductListItem[] }>;
|
|
71
|
-
/** @deprecated `requestOneTimePurchase`를 사용해주세요. */
|
|
72
|
-
iapCreateOneTimePurchaseOrder: (params: { productId: string }) => Promise<IapCreateOneTimePurchaseOrderResult>;
|
|
73
|
-
requestOneTimePurchase: (
|
|
74
|
-
params: { sku: string },
|
|
75
|
-
fallbacks: { onPurchased: (params: { orderId: string }) => void }
|
|
76
|
-
) => () => void;
|
|
77
|
-
requestSubscriptionPurchase: (
|
|
78
|
-
params: { sku: string; offerId: string | null },
|
|
79
|
-
fallbacks: { onPurchased: (params: { orderId: string; subscriptionId?: string }) => void }
|
|
80
|
-
) => () => void;
|
|
81
|
-
processProductGrant: (params: { orderId: string; isProductGranted: boolean }) => Promise<void>;
|
|
82
|
-
getPendingOrders: (
|
|
83
|
-
params: CompatiblePlaceholderArgument
|
|
84
|
-
) => Promise<{ orders: { orderId: string; sku: string; paymentCompletedDate: string }[] }>;
|
|
85
|
-
getCompletedOrRefundedOrders: (params: { key?: string | null }) => Promise<CompletedOrRefundedOrdersResult>;
|
|
86
|
-
completeProductGrant: (params: { params: { orderId: string } }) => Promise<boolean>;
|
|
87
|
-
|
|
88
|
-
getGameCenterGameProfile: (params: CompatiblePlaceholderArgument) => Promise<GameCenterGameProfileResponse>;
|
|
89
|
-
getUserKeyForGame: (params: CompatiblePlaceholderArgument) => Promise<GetUserKeyForGameResponse>;
|
|
90
|
-
getIsTossLoginIntegratedService: (params: CompatiblePlaceholderArgument) => Promise<boolean>;
|
|
91
|
-
grantPromotionRewardForGame: (params: {
|
|
92
|
-
params: { promotionCode: string; amount: number };
|
|
93
|
-
}) => Promise<GrantPromotionRewardForGameResponse>;
|
|
94
|
-
submitGameCenterLeaderBoardScore: (params: { score: string }) => Promise<SubmitGameCenterLeaderBoardScoreResponse>;
|
|
95
|
-
|
|
96
|
-
contactsViral: (params: ContactsViralParams) => () => void;
|
|
97
|
-
|
|
98
|
-
/** 토스인증 */
|
|
99
|
-
appsInTossSignTossCert: (params: { params: AppsInTossSignTossCertParams }) => void;
|
|
100
|
-
|
|
101
|
-
getServerTime: (arg: CompatiblePlaceholderArgument) => Promise<{ serverTime: number }>;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
const Module = TurboModuleRegistry.getEnforcing<Spec>('AppsInTossModule');
|
|
105
|
-
|
|
106
|
-
export const AppsInTossModuleInstance = Module as any;
|
|
107
|
-
export const AppsInTossModule = Module;
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { AppsInTossModule } from './AppsInTossModule';
|
|
2
|
-
import { isMinVersionSupported } from './isMinVersionSupported';
|
|
3
|
-
|
|
4
|
-
const V2_MIN_VERSION = {
|
|
5
|
-
android: '5.240.0',
|
|
6
|
-
ios: '5.239.0',
|
|
7
|
-
} as const;
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* @public
|
|
11
|
-
* @category 공유
|
|
12
|
-
* @kind function
|
|
13
|
-
* @name getTossShareLink
|
|
14
|
-
* @description
|
|
15
|
-
* 사용자가 지정한 경로를 토스 앱에서 열 수 있는 공유 링크를 생성해요.
|
|
16
|
-
*
|
|
17
|
-
* 생성된 링크를 다른 사람과 공유하면:
|
|
18
|
-
* - 토스 앱이 설치되어 있으면: 토스 앱이 실행되면서 지정한 경로로 이동해요.
|
|
19
|
-
* - 토스 앱이 없으면: iOS는 앱스토어로, Android는 플레이스토어로 이동해요.
|
|
20
|
-
*
|
|
21
|
-
* @param path - 딥링크 경로예요. `intoss://`로 시작하는 문자열이어야 해요. (예: `intoss://my-app`, `intoss://my-app/detail?id=123`)
|
|
22
|
-
* @param ogImageUrl - (선택) 공유 시 표시될 커스텀 OG 이미지 URL이에요. 최소 버전: Android 5.240.0, iOS 5.239.0
|
|
23
|
-
* @returns {Promise<string>} 생성된 토스 공유 링크
|
|
24
|
-
*
|
|
25
|
-
* @example
|
|
26
|
-
* ```tsx
|
|
27
|
-
* import { share } from '@granite-js/react-native';
|
|
28
|
-
* import { getTossShareLink } from '@apps-in-toss/framework';
|
|
29
|
-
*
|
|
30
|
-
* // 기본 사용법
|
|
31
|
-
* const tossLink = await getTossShareLink('intoss://my-app');
|
|
32
|
-
* await share({ message: tossLink });
|
|
33
|
-
*
|
|
34
|
-
* // 커스텀 OG 이미지와 함께 사용
|
|
35
|
-
* const linkWithImage = await getTossShareLink(
|
|
36
|
-
* 'intoss://my-app/event',
|
|
37
|
-
* 'https://example.com/og-image.png'
|
|
38
|
-
* );
|
|
39
|
-
* await share({ message: linkWithImage });
|
|
40
|
-
* ```
|
|
41
|
-
*/
|
|
42
|
-
export async function getTossShareLink(path: string, ogImageUrl?: string): Promise<string> {
|
|
43
|
-
if (!isMinVersionSupported(V2_MIN_VERSION)) {
|
|
44
|
-
return await getTossShareLinkV1(path);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
const params = {
|
|
48
|
-
params: {
|
|
49
|
-
url: path,
|
|
50
|
-
ogImageUrl,
|
|
51
|
-
},
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
const { shareLink } = await AppsInTossModule.getTossShareLink(params);
|
|
55
|
-
return shareLink;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
async function getTossShareLinkV1(path: string): Promise<string> {
|
|
59
|
-
const { shareLink } = await AppsInTossModule.getTossShareLink({});
|
|
60
|
-
const shareUrl = new URL(shareLink);
|
|
61
|
-
|
|
62
|
-
shareUrl.searchParams.set('deep_link_value', path);
|
|
63
|
-
shareUrl.searchParams.set('af_dp', path);
|
|
64
|
-
return shareUrl.toString();
|
|
65
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/src/{AppsInTossModule → MiniAppModule}/native-modules/isMinVersionSupported.spec.ts
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/src/{AppsInTossModule → MiniAppModule}/native-modules/permissions/requestPermission.ts
RENAMED
|
File without changes
|