@apps-in-toss/native-modules 2.1.0 → 2.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +5 -5
- package/dist/index.js +5 -5
- package/package.json +7 -4
- package/src/BedrockModule/commonModule.ts +14 -0
- package/src/BedrockModule/native-modules/natives/getNetworkStatus/index.ts +2 -1
- package/src/MiniAppModule/native-modules/getOperationalEnvironment.ts +1 -1
- package/src/{MiniAppModule.brick.ts → MiniAppModule/postMessage.ts} +10 -36
- package/src/TossCoreModule/instance.ts +8 -0
- package/src/index.ts +1 -1
- package/src/natives.ts +7 -3
- package/src/spec/CommonModule.brick.ts +48 -0
- package/src/spec/MiniAppBundleLoaderModule.brick.ts +13 -0
- package/src/spec/MiniAppModule.brick.ts +27 -0
- package/src/spec/TossCoreModule.brick.ts +11 -0
- package/src/CommonModule.brick.ts +0 -36
- package/src/TossCoreModule.brick.ts +0 -17
package/dist/index.cjs
CHANGED
|
@@ -77,7 +77,7 @@ __export(index_exports, {
|
|
|
77
77
|
});
|
|
78
78
|
module.exports = __toCommonJS(index_exports);
|
|
79
79
|
|
|
80
|
-
// src/MiniAppModule.
|
|
80
|
+
// src/MiniAppModule/postMessage.ts
|
|
81
81
|
var import_brick_module = require("brick-module");
|
|
82
82
|
var MiniAppModule = import_brick_module.BrickModule.get("MiniAppModule");
|
|
83
83
|
function safePostMessage(method, params) {
|
|
@@ -94,13 +94,13 @@ var import_react_native4 = require("@granite-js/react-native");
|
|
|
94
94
|
var import_types = require("@apps-in-toss/types");
|
|
95
95
|
var import_react_native = require("@granite-js/react-native");
|
|
96
96
|
|
|
97
|
-
// src/
|
|
97
|
+
// src/BedrockModule/commonModule.ts
|
|
98
98
|
var import_brick_module2 = require("brick-module");
|
|
99
|
-
var
|
|
99
|
+
var CommonModule = import_brick_module2.BrickModule.get("CommonModule");
|
|
100
100
|
|
|
101
|
-
// src/
|
|
101
|
+
// src/TossCoreModule/instance.ts
|
|
102
102
|
var import_brick_module3 = require("brick-module");
|
|
103
|
-
var
|
|
103
|
+
var TossCoreModule = import_brick_module3.BrickModule.get("TossCoreModule");
|
|
104
104
|
|
|
105
105
|
// src/MiniAppModule/native-modules/permissions/openPermissionDialog.ts
|
|
106
106
|
function openPermissionDialog(permission) {
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// src/MiniAppModule.
|
|
1
|
+
// src/MiniAppModule/postMessage.ts
|
|
2
2
|
import { BrickModule } from "brick-module";
|
|
3
3
|
var MiniAppModule = BrickModule.get("MiniAppModule");
|
|
4
4
|
function safePostMessage(method, params) {
|
|
@@ -15,13 +15,13 @@ import { GraniteEvent } from "@granite-js/react-native";
|
|
|
15
15
|
import { GetCurrentLocationPermissionError } from "@apps-in-toss/types";
|
|
16
16
|
import { GraniteEventDefinition } from "@granite-js/react-native";
|
|
17
17
|
|
|
18
|
-
// src/
|
|
18
|
+
// src/BedrockModule/commonModule.ts
|
|
19
19
|
import { BrickModule as BrickModule2 } from "brick-module";
|
|
20
|
-
var
|
|
20
|
+
var CommonModule = BrickModule2.get("CommonModule");
|
|
21
21
|
|
|
22
|
-
// src/
|
|
22
|
+
// src/TossCoreModule/instance.ts
|
|
23
23
|
import { BrickModule as BrickModule3 } from "brick-module";
|
|
24
|
-
var
|
|
24
|
+
var TossCoreModule = BrickModule3.get("TossCoreModule");
|
|
25
25
|
|
|
26
26
|
// src/MiniAppModule/native-modules/permissions/openPermissionDialog.ts
|
|
27
27
|
function openPermissionDialog(permission) {
|
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.1.
|
|
4
|
+
"version": "2.1.1",
|
|
5
5
|
"description": "Native Modules for Apps In Toss",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"typecheck": "tsc --noEmit",
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
],
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@babel/runtime": "^7",
|
|
32
|
-
"@granite-js/native": "1.0.
|
|
33
|
-
"@granite-js/react-native": "1.0.
|
|
32
|
+
"@granite-js/native": "1.0.10",
|
|
33
|
+
"@granite-js/react-native": "1.0.10",
|
|
34
34
|
"@types/react": "19.2.3",
|
|
35
35
|
"dts-bundle-generator": "^9.5.1",
|
|
36
36
|
"esbuild": "0.25.5",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"vitest": "^3.2.4"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@apps-in-toss/types": "2.1.
|
|
45
|
+
"@apps-in-toss/types": "2.1.1",
|
|
46
46
|
"brick-module": "0.5.0",
|
|
47
47
|
"es-toolkit": "^1.39.3"
|
|
48
48
|
},
|
|
@@ -51,5 +51,8 @@
|
|
|
51
51
|
"@granite-js/react-native": "*",
|
|
52
52
|
"react": "*",
|
|
53
53
|
"react-native": "*"
|
|
54
|
+
},
|
|
55
|
+
"brickModule": {
|
|
56
|
+
"specSrc": "./src/spec"
|
|
54
57
|
}
|
|
55
58
|
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { BrickModule } from 'brick-module';
|
|
2
|
+
import type { CommonModuleSpec } from '../spec/CommonModule.brick';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* CommonModule Instance
|
|
6
|
+
* Native module instance accessed through BrickModule
|
|
7
|
+
*/
|
|
8
|
+
export const CommonModule = BrickModule.get<CommonModuleSpec>('CommonModule');
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Deprecated exports for backward compatibility
|
|
12
|
+
*/
|
|
13
|
+
/** @deprecated Use CommonModule instead */
|
|
14
|
+
export const BedrockModule = CommonModule;
|
|
@@ -52,7 +52,8 @@ import { CommonModule } from '../BedrockModule';
|
|
|
52
52
|
* ```
|
|
53
53
|
*/
|
|
54
54
|
export function getNetworkStatus(): Promise<NetworkStatus> {
|
|
55
|
-
|
|
55
|
+
// RN84에서는 동기, RN72에서는 비동기로 동작하지만, 안정성을 위해 항상 비동기로 처리해요.
|
|
56
|
+
return CommonModule.getNetworkStatus() as unknown as Promise<NetworkStatus>;
|
|
56
57
|
}
|
|
57
58
|
|
|
58
59
|
/** export type */
|
|
@@ -33,5 +33,5 @@ import { MiniAppModule } from '../../natives';
|
|
|
33
33
|
* ```
|
|
34
34
|
*/
|
|
35
35
|
export function getOperationalEnvironment(): 'toss' | 'sandbox' {
|
|
36
|
-
return MiniAppModule.getConstants().operationalEnvironment;
|
|
36
|
+
return MiniAppModule.getConstants().operationalEnvironment as 'toss' | 'sandbox';
|
|
37
37
|
}
|
|
@@ -7,42 +7,16 @@ import type {
|
|
|
7
7
|
ContactResult,
|
|
8
8
|
Location,
|
|
9
9
|
} from '@apps-in-toss/types';
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import type {
|
|
13
|
-
import type {
|
|
14
|
-
import type {
|
|
15
|
-
import type {
|
|
16
|
-
import type {
|
|
17
|
-
import type {
|
|
18
|
-
import type {
|
|
19
|
-
import type {
|
|
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
|
-
}
|
|
10
|
+
import { BrickModule } from 'brick-module';
|
|
11
|
+
import type { AppsInTossSignTossCertParams } from './native-modules/appsInTossSignTossCert';
|
|
12
|
+
import type { CheckoutPaymentOptions, CheckoutPaymentResult } from './native-modules/checkoutPayment';
|
|
13
|
+
import type { GameCenterGameProfileResponse } from './native-modules/getGameCenterGameProfile';
|
|
14
|
+
import type { GetUserKeyForGameResponse } from './native-modules/getUserKeyForGame';
|
|
15
|
+
import type { GrantPromotionRewardForGameResponse } from './native-modules/grantPromotionRewardForGame';
|
|
16
|
+
import type { IapCreateOneTimePurchaseOrderResult } from './native-modules/iap';
|
|
17
|
+
import type { SaveBase64DataParams } from './native-modules/saveBase64Data';
|
|
18
|
+
import type { SubmitGameCenterLeaderBoardScoreResponse } from './native-modules/submitGameCenterLeaderBoardScore';
|
|
19
|
+
import type { MiniAppModuleSpec } from '../spec/MiniAppModule.brick';
|
|
46
20
|
|
|
47
21
|
/**
|
|
48
22
|
* Async Methods Map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { BrickModule } from 'brick-module';
|
|
2
|
+
import type { TossCoreModuleSpec } from '../spec/TossCoreModule.brick';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* TossCoreModule Instance
|
|
6
|
+
* Native module instance accessed through BrickModule
|
|
7
|
+
*/
|
|
8
|
+
export const TossCoreModule = BrickModule.get<TossCoreModuleSpec>('TossCoreModule');
|
package/src/index.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// MiniAppModule (formerly AppsInTossModule)
|
|
2
|
-
export { safePostMessage, safeSyncPostMessage } from './MiniAppModule
|
|
2
|
+
export { safePostMessage, safeSyncPostMessage } from './MiniAppModule/postMessage';
|
|
3
3
|
export * from './MiniAppModule/native-event-emitter';
|
|
4
4
|
export * from './MiniAppModule/native-modules';
|
|
5
5
|
|
package/src/natives.ts
CHANGED
|
@@ -5,6 +5,10 @@
|
|
|
5
5
|
* This file re-exports all native module definitions for backward compatibility.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
export * from './MiniAppModule.brick';
|
|
9
|
-
export * from './TossCoreModule.brick';
|
|
10
|
-
export * from './CommonModule.brick';
|
|
8
|
+
export * from './spec/MiniAppModule.brick';
|
|
9
|
+
export * from './spec/TossCoreModule.brick';
|
|
10
|
+
export * from './spec/CommonModule.brick';
|
|
11
|
+
|
|
12
|
+
export * from './MiniAppModule/postMessage';
|
|
13
|
+
export * from './BedrockModule/commonModule';
|
|
14
|
+
export * from './TossCoreModule/instance';
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { BrickModuleSpec } from 'brick-module';
|
|
2
|
+
|
|
3
|
+
interface ScreenAwakeModeParameter {
|
|
4
|
+
enabled: boolean;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
interface SecureScreenParameter {
|
|
8
|
+
enabled: boolean;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
interface HapticParameter {
|
|
12
|
+
type: string;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
interface IosSwipeGestureParameters {
|
|
16
|
+
isEnabled: boolean;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
interface ShareParameter {
|
|
20
|
+
message: string;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
interface LeftEdgeTouchEnabledParameter {
|
|
24
|
+
isEnabled: boolean;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* CommonModule Spec
|
|
29
|
+
* Unified type definition for CommonModule (formerly BedrockModule)
|
|
30
|
+
*/
|
|
31
|
+
export interface CommonModuleSpec extends BrickModuleSpec {
|
|
32
|
+
readonly moduleName: 'CommonModule';
|
|
33
|
+
|
|
34
|
+
getConstants(): {
|
|
35
|
+
schemeUri: string;
|
|
36
|
+
locale: string;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
getNetworkStatus(): string;
|
|
40
|
+
closeView(): void;
|
|
41
|
+
generateHapticFeedback(parameter: HapticParameter): Promise<void>;
|
|
42
|
+
share(parameter: ShareParameter): void;
|
|
43
|
+
setSecureScreen(parameter: SecureScreenParameter): Promise<{ enabled: boolean }>;
|
|
44
|
+
setScreenAwakeMode(parameter: ScreenAwakeModeParameter): Promise<{ enabled: boolean }>;
|
|
45
|
+
setIosSwipeGestureEnabled(parameter: IosSwipeGestureParameters): Promise<void>;
|
|
46
|
+
|
|
47
|
+
setLeftEdgeTouchEnabled(parameter: LeftEdgeTouchEnabledParameter): void;
|
|
48
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Granite Screen module for Brick framework
|
|
3
|
+
* Provides bundle loading and management with automatic bridge generation
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import type { BrickModuleSpec } from 'brick-module';
|
|
7
|
+
|
|
8
|
+
export interface MiniAppBundleLoaderModuleSpec extends BrickModuleSpec {
|
|
9
|
+
readonly moduleName: 'MiniAppBundleLoader';
|
|
10
|
+
|
|
11
|
+
// Import bundle lazily
|
|
12
|
+
importLazy(): Promise<void>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Any, AnyObject, BrickModuleSpec } from 'brick-module';
|
|
2
|
+
import { CodegenTypes } from 'react-native';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* MiniAppModule Spec
|
|
6
|
+
* Unified type definition for MiniAppModule (formerly AppsInTossModule)
|
|
7
|
+
*/
|
|
8
|
+
export interface MiniAppModuleSpec extends BrickModuleSpec {
|
|
9
|
+
readonly moduleName: 'MiniAppModule';
|
|
10
|
+
|
|
11
|
+
getConstants(): {
|
|
12
|
+
groupId: string;
|
|
13
|
+
operationalEnvironment: string;
|
|
14
|
+
tossAppVersion: string;
|
|
15
|
+
deviceId: string;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
// All async/sync methods are now handled via postMessage/postMessageSync
|
|
19
|
+
postMessage(name: string, params: AnyObject, callbacks: AnyObject): Promise<Any>;
|
|
20
|
+
postMessageSync(name: string, params: AnyObject, callbacks: AnyObject): Any;
|
|
21
|
+
|
|
22
|
+
// readonly supportedEvents: ['sendEvent'];
|
|
23
|
+
readonly onSendEvent: CodegenTypes.EventEmitter<{
|
|
24
|
+
eventName: string; // updateLocation, visibilityChangedByTransparentServiceWeb, appBridgeCallback
|
|
25
|
+
body: AnyObject;
|
|
26
|
+
}>;
|
|
27
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { AnyObject, 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: AnyObject): Promise<void>;
|
|
11
|
+
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { BrickModule, BrickModuleSpec } from 'brick-module';
|
|
2
|
-
import type { HapticFeedbackOptions } from './BedrockModule/native-modules/natives/generateHapticFeedback/types';
|
|
3
|
-
import type { NetworkStatus } from './BedrockModule/native-modules/natives/getNetworkStatus/types';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* CommonModule Spec
|
|
7
|
-
* Unified type definition for CommonModule (formerly BedrockModule)
|
|
8
|
-
*/
|
|
9
|
-
export interface CommonModuleSpec extends BrickModuleSpec {
|
|
10
|
-
readonly moduleName: 'BedrockModule';
|
|
11
|
-
|
|
12
|
-
getConstants(): {
|
|
13
|
-
locale: string;
|
|
14
|
-
schemeUri: string;
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
closeView: () => void;
|
|
18
|
-
generateHapticFeedback: (options: HapticFeedbackOptions) => Promise<void>;
|
|
19
|
-
share: (message: { message: string }) => void;
|
|
20
|
-
setSecureScreen: (options: { enabled: boolean }) => Promise<{ enabled: boolean }>;
|
|
21
|
-
setScreenAwakeMode: (options: { enabled: boolean }) => Promise<{ enabled: boolean }>;
|
|
22
|
-
getNetworkStatus: () => Promise<NetworkStatus>;
|
|
23
|
-
setIosSwipeGestureEnabled: ({ isEnabled }: { isEnabled: boolean }) => Promise<void>;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* CommonModule Instance
|
|
28
|
-
* Native module instance accessed through BrickModule
|
|
29
|
-
*/
|
|
30
|
-
export const CommonModule = BrickModule.get<CommonModuleSpec>('CommonModule');
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Deprecated exports for backward compatibility
|
|
34
|
-
*/
|
|
35
|
-
/** @deprecated Use CommonModule instead */
|
|
36
|
-
export const BedrockModule = CommonModule;
|
|
@@ -1,17 +0,0 @@
|
|
|
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');
|