@tekrom/tsoft-app-gate 0.1.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.
@@ -0,0 +1,17 @@
1
+ export type BridgeConfig = {
2
+ apiKey: string;
3
+ shopId: string;
4
+ host: string;
5
+ };
6
+ export declare function createApp(config: BridgeConfig): {
7
+ config: BridgeConfig;
8
+ post(action: string, payload: any): void;
9
+ };
10
+ export declare function setNavigationMenu(app: ReturnType<typeof createApp>, items: Array<{
11
+ label: string;
12
+ path: string;
13
+ }>): void;
14
+ export declare function showToast(app: ReturnType<typeof createApp>, options: {
15
+ message: string;
16
+ variant?: 'success' | 'error';
17
+ }): void;
package/dist/index.js ADDED
@@ -0,0 +1,21 @@
1
+ // src/index.ts
2
+ export function createApp(config) {
3
+ const app = {
4
+ config,
5
+ post(action, payload) {
6
+ window.parent.postMessage({
7
+ namespace: 'T_SOFT_APP_BRIDGE',
8
+ action,
9
+ payload,
10
+ appId: config.apiKey, // veya başka id
11
+ }, config.host);
12
+ },
13
+ };
14
+ return app;
15
+ }
16
+ export function setNavigationMenu(app, items) {
17
+ app.post('NAVIGATION_MENU.SET', { items });
18
+ }
19
+ export function showToast(app, options) {
20
+ app.post('TOAST.SHOW', options);
21
+ }
package/package.json ADDED
@@ -0,0 +1,31 @@
1
+ {
2
+ "name": "@tekrom/tsoft-app-gate",
3
+ "version": "0.1.0",
4
+ "description": "T-Soft app gate core SDK",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.js"
12
+ }
13
+ },
14
+ "files": [
15
+ "dist"
16
+ ],
17
+ "scripts": {
18
+ "build": "tsc",
19
+ "prepublishOnly": "npm run build"
20
+ },
21
+ "keywords": [
22
+ "tsoft",
23
+ "app-gate",
24
+ "embedded-app"
25
+ ],
26
+ "author": "T-Soft",
27
+ "license": "MIT",
28
+ "devDependencies": {
29
+ "typescript": "^5.9.3"
30
+ }
31
+ }