@fias/arche-sdk 1.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.
Files changed (42) hide show
  1. package/README.md +356 -0
  2. package/dist/bridge.d.ts +56 -0
  3. package/dist/bridge.d.ts.map +1 -0
  4. package/dist/bridge.js +190 -0
  5. package/dist/bridge.js.map +1 -0
  6. package/dist/cli/create-plugin.d.ts +3 -0
  7. package/dist/cli/create-plugin.d.ts.map +1 -0
  8. package/dist/cli/create-plugin.js +80 -0
  9. package/dist/cli/create-plugin.js.map +1 -0
  10. package/dist/context.d.ts +6 -0
  11. package/dist/context.d.ts.map +1 -0
  12. package/dist/context.js +9 -0
  13. package/dist/context.js.map +1 -0
  14. package/dist/fias.d.ts +30 -0
  15. package/dist/fias.d.ts.map +1 -0
  16. package/dist/fias.js +40 -0
  17. package/dist/fias.js.map +1 -0
  18. package/dist/hooks.d.ts +37 -0
  19. package/dist/hooks.d.ts.map +1 -0
  20. package/dist/hooks.js +116 -0
  21. package/dist/hooks.js.map +1 -0
  22. package/dist/index.d.ts +6 -0
  23. package/dist/index.d.ts.map +1 -0
  24. package/dist/index.js +22 -0
  25. package/dist/index.js.map +1 -0
  26. package/dist/index.mjs +323 -0
  27. package/dist/provider.d.ts +25 -0
  28. package/dist/provider.d.ts.map +1 -0
  29. package/dist/provider.js +47 -0
  30. package/dist/provider.js.map +1 -0
  31. package/dist/types.d.ts +118 -0
  32. package/dist/types.d.ts.map +1 -0
  33. package/dist/types.js +3 -0
  34. package/dist/types.js.map +1 -0
  35. package/package.json +54 -0
  36. package/templates/default/fias-plugin.json +11 -0
  37. package/templates/default/index.html +12 -0
  38. package/templates/default/package.json +23 -0
  39. package/templates/default/src/App.tsx +12 -0
  40. package/templates/default/src/index.tsx +12 -0
  41. package/templates/default/tsconfig.json +17 -0
  42. package/templates/default/vite.config.ts +18 -0
package/dist/index.mjs ADDED
@@ -0,0 +1,323 @@
1
+ // src/provider.tsx
2
+ import { useEffect, useMemo, useState } from "react";
3
+
4
+ // src/context.ts
5
+ import { createContext } from "react";
6
+ var FiasBridgeContext = createContext(null);
7
+
8
+ // src/bridge.ts
9
+ var messageCounter = 0;
10
+ function generateMessageId() {
11
+ return `msg_${Date.now()}_${++messageCounter}`;
12
+ }
13
+ var DEFAULT_TIMEOUT_MS = 3e4;
14
+ var FiasBridge = class {
15
+ constructor() {
16
+ this.pendingRequests = /* @__PURE__ */ new Map();
17
+ this.initialized = false;
18
+ this.initPromise = null;
19
+ this.initResolve = null;
20
+ this.archId = "";
21
+ this.permissions = [];
22
+ this.theme = null;
23
+ this.currentPath = "";
24
+ this.themeListeners = /* @__PURE__ */ new Set();
25
+ this.navigationListeners = /* @__PURE__ */ new Set();
26
+ this.handleMessage = (event) => {
27
+ const data = event.data;
28
+ if (!data || typeof data !== "object" || !data.type) return;
29
+ if (data.type === "init") {
30
+ const initMsg = data;
31
+ this.archId = initMsg.payload.archId;
32
+ this.permissions = initMsg.payload.permissions;
33
+ this.theme = initMsg.payload.theme;
34
+ this.currentPath = initMsg.payload.currentPath;
35
+ this.initialized = true;
36
+ this.initResolve?.();
37
+ return;
38
+ }
39
+ if (data.type === "theme_update") {
40
+ this.theme = data.payload;
41
+ for (const listener of this.themeListeners) {
42
+ listener(this.theme);
43
+ }
44
+ return;
45
+ }
46
+ if (data.type === "navigate_update") {
47
+ this.currentPath = data.payload;
48
+ for (const listener of this.navigationListeners) {
49
+ listener(this.currentPath);
50
+ }
51
+ return;
52
+ }
53
+ if (data.type === "response") {
54
+ const response = data;
55
+ const pending = this.pendingRequests.get(response.messageId);
56
+ if (!pending) return;
57
+ clearTimeout(pending.timer);
58
+ this.pendingRequests.delete(response.messageId);
59
+ if (response.error) {
60
+ pending.reject(new Error(response.error));
61
+ } else {
62
+ pending.resolve(response.payload);
63
+ }
64
+ }
65
+ };
66
+ this.initPromise = new Promise((resolve) => {
67
+ this.initResolve = resolve;
68
+ });
69
+ if (typeof window !== "undefined") {
70
+ window.addEventListener("message", this.handleMessage);
71
+ }
72
+ }
73
+ /**
74
+ * Wait for the host to send the init message.
75
+ */
76
+ async waitForInit() {
77
+ if (this.initialized) return;
78
+ return this.initPromise;
79
+ }
80
+ /**
81
+ * Signal to the host that the plugin is loaded and ready.
82
+ */
83
+ ready() {
84
+ this.send("ready", {});
85
+ }
86
+ /**
87
+ * Request the host to resize the plugin iframe.
88
+ */
89
+ resize(height) {
90
+ this.send("resize", { height });
91
+ }
92
+ /**
93
+ * Show a platform toast notification.
94
+ */
95
+ showToast(message, variant = "info") {
96
+ this.send("toast", { message, variant });
97
+ }
98
+ /**
99
+ * Send a request to the host and wait for a response.
100
+ */
101
+ async request(type, payload) {
102
+ await this.waitForInit();
103
+ return new Promise((resolve, reject) => {
104
+ const messageId = generateMessageId();
105
+ const timer = setTimeout(() => {
106
+ this.pendingRequests.delete(messageId);
107
+ reject(new Error(`Bridge request timed out: ${type}`));
108
+ }, DEFAULT_TIMEOUT_MS);
109
+ this.pendingRequests.set(messageId, {
110
+ resolve,
111
+ reject,
112
+ timer
113
+ });
114
+ this.send(type, payload, messageId);
115
+ });
116
+ }
117
+ getArchId() {
118
+ return this.archId;
119
+ }
120
+ getPermissions() {
121
+ return [...this.permissions];
122
+ }
123
+ getTheme() {
124
+ return this.theme;
125
+ }
126
+ getCurrentPath() {
127
+ return this.currentPath;
128
+ }
129
+ onThemeUpdate(listener) {
130
+ this.themeListeners.add(listener);
131
+ return () => this.themeListeners.delete(listener);
132
+ }
133
+ onNavigationUpdate(listener) {
134
+ this.navigationListeners.add(listener);
135
+ return () => this.navigationListeners.delete(listener);
136
+ }
137
+ /**
138
+ * Clean up event listeners. Called when FiasProvider unmounts.
139
+ */
140
+ destroy() {
141
+ if (typeof window !== "undefined") {
142
+ window.removeEventListener("message", this.handleMessage);
143
+ }
144
+ for (const pending of this.pendingRequests.values()) {
145
+ clearTimeout(pending.timer);
146
+ pending.reject(new Error("Bridge destroyed"));
147
+ }
148
+ this.pendingRequests.clear();
149
+ this.themeListeners.clear();
150
+ this.navigationListeners.clear();
151
+ }
152
+ send(type, payload, messageId) {
153
+ if (typeof window === "undefined") return;
154
+ const message = {
155
+ type,
156
+ messageId: messageId ?? generateMessageId(),
157
+ payload
158
+ };
159
+ window.parent.postMessage(message, "*");
160
+ }
161
+ };
162
+ var bridgeInstance = null;
163
+ function getBridge() {
164
+ if (!bridgeInstance) {
165
+ bridgeInstance = new FiasBridge();
166
+ }
167
+ return bridgeInstance;
168
+ }
169
+ function resetBridge() {
170
+ bridgeInstance?.destroy();
171
+ bridgeInstance = null;
172
+ }
173
+
174
+ // src/provider.tsx
175
+ import { jsx } from "react/jsx-runtime";
176
+ function FiasProvider({ children }) {
177
+ const [ready, setReady] = useState(false);
178
+ const bridge = useMemo(() => new FiasBridge(), []);
179
+ useEffect(() => {
180
+ let mounted = true;
181
+ bridge.waitForInit().then(() => {
182
+ if (mounted) {
183
+ bridge.ready();
184
+ setReady(true);
185
+ }
186
+ });
187
+ return () => {
188
+ mounted = false;
189
+ bridge.destroy();
190
+ };
191
+ }, [bridge]);
192
+ if (!ready) {
193
+ return null;
194
+ }
195
+ return /* @__PURE__ */ jsx(FiasBridgeContext.Provider, { value: bridge, children });
196
+ }
197
+
198
+ // src/hooks.ts
199
+ import { useCallback, useContext, useEffect as useEffect2, useState as useState2 } from "react";
200
+ function useBridge() {
201
+ const bridge = useContext(FiasBridgeContext);
202
+ if (!bridge) {
203
+ throw new Error("useBridge must be used within a <FiasProvider>");
204
+ }
205
+ return bridge;
206
+ }
207
+ function useFiasUser() {
208
+ const bridge = useBridge();
209
+ const [user, setUser] = useState2(null);
210
+ useEffect2(() => {
211
+ let mounted = true;
212
+ bridge.request("get_user", {}).then((data) => {
213
+ if (mounted) setUser(data);
214
+ });
215
+ return () => {
216
+ mounted = false;
217
+ };
218
+ }, [bridge]);
219
+ return user;
220
+ }
221
+ function useFiasTheme() {
222
+ const bridge = useBridge();
223
+ const [theme, setTheme] = useState2(bridge.getTheme());
224
+ useEffect2(() => {
225
+ return bridge.onThemeUpdate(setTheme);
226
+ }, [bridge]);
227
+ return theme;
228
+ }
229
+ function useFiasStorage() {
230
+ const bridge = useBridge();
231
+ const readFile = useCallback(
232
+ (path) => bridge.request("storage_read", { path }),
233
+ [bridge]
234
+ );
235
+ const writeFile = useCallback(
236
+ (path, content) => bridge.request("storage_write", { path, content }),
237
+ [bridge]
238
+ );
239
+ const listFiles = useCallback(
240
+ (prefix) => bridge.request("storage_list", { prefix }),
241
+ [bridge]
242
+ );
243
+ const deleteFile = useCallback(
244
+ (path) => bridge.request("storage_delete", { path }),
245
+ [bridge]
246
+ );
247
+ return { readFile, writeFile, listFiles, deleteFile };
248
+ }
249
+ function useEntityInvocation() {
250
+ const bridge = useBridge();
251
+ const [isLoading, setIsLoading] = useState2(false);
252
+ const [result, setResult] = useState2(null);
253
+ const [error, setError] = useState2(null);
254
+ const invoke = useCallback(
255
+ async (params) => {
256
+ setIsLoading(true);
257
+ setError(null);
258
+ try {
259
+ const res = await bridge.request("entity_invoke", params);
260
+ setResult(res);
261
+ return res;
262
+ } catch (err) {
263
+ const e = err instanceof Error ? err : new Error(String(err));
264
+ setError(e);
265
+ throw e;
266
+ } finally {
267
+ setIsLoading(false);
268
+ }
269
+ },
270
+ [bridge]
271
+ );
272
+ return { invoke, isLoading, result, error };
273
+ }
274
+ function useFiasNavigation() {
275
+ const bridge = useBridge();
276
+ const [currentPath, setCurrentPath] = useState2(bridge.getCurrentPath());
277
+ useEffect2(() => {
278
+ return bridge.onNavigationUpdate(setCurrentPath);
279
+ }, [bridge]);
280
+ const navigateTo = useCallback(
281
+ (path) => {
282
+ bridge.request("navigate", { path });
283
+ },
284
+ [bridge]
285
+ );
286
+ return { navigateTo, currentPath };
287
+ }
288
+
289
+ // src/fias.ts
290
+ var fias = {
291
+ /**
292
+ * Signal to the host that the plugin is loaded and ready.
293
+ * Called automatically by FiasProvider — only use manually
294
+ * if not using React.
295
+ */
296
+ ready() {
297
+ getBridge().ready();
298
+ },
299
+ /**
300
+ * Request the host to resize the plugin iframe to the given height.
301
+ */
302
+ resize(height) {
303
+ getBridge().resize(height);
304
+ },
305
+ /**
306
+ * Show a platform toast notification.
307
+ */
308
+ showToast(message, variant = "info") {
309
+ getBridge().showToast(message, variant);
310
+ }
311
+ };
312
+ export {
313
+ FiasBridge,
314
+ FiasProvider,
315
+ fias,
316
+ getBridge,
317
+ resetBridge,
318
+ useEntityInvocation,
319
+ useFiasNavigation,
320
+ useFiasStorage,
321
+ useFiasTheme,
322
+ useFiasUser
323
+ };
@@ -0,0 +1,25 @@
1
+ import React from 'react';
2
+ interface FiasProviderProps {
3
+ children: React.ReactNode;
4
+ }
5
+ /**
6
+ * Root wrapper component for FIAS plugins.
7
+ * Must wrap the entire plugin component tree.
8
+ * Establishes the postMessage bridge with the host platform.
9
+ *
10
+ * @example
11
+ * ```tsx
12
+ * import { FiasProvider } from '@fias/arche-sdk';
13
+ *
14
+ * export default function Plugin() {
15
+ * return (
16
+ * <FiasProvider>
17
+ * <App />
18
+ * </FiasProvider>
19
+ * );
20
+ * }
21
+ * ```
22
+ */
23
+ export declare function FiasProvider({ children }: FiasProviderProps): import("react/jsx-runtime").JSX.Element | null;
24
+ export {};
25
+ //# sourceMappingURL=provider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../src/provider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAuC,MAAM,OAAO,CAAC;AAI5D,UAAU,iBAAiB;IACzB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,YAAY,CAAC,EAAE,QAAQ,EAAE,EAAE,iBAAiB,kDA0B3D"}
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FiasProvider = FiasProvider;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_1 = require("react");
6
+ const context_1 = require("./context");
7
+ const bridge_1 = require("./bridge");
8
+ /**
9
+ * Root wrapper component for FIAS plugins.
10
+ * Must wrap the entire plugin component tree.
11
+ * Establishes the postMessage bridge with the host platform.
12
+ *
13
+ * @example
14
+ * ```tsx
15
+ * import { FiasProvider } from '@fias/arche-sdk';
16
+ *
17
+ * export default function Plugin() {
18
+ * return (
19
+ * <FiasProvider>
20
+ * <App />
21
+ * </FiasProvider>
22
+ * );
23
+ * }
24
+ * ```
25
+ */
26
+ function FiasProvider({ children }) {
27
+ const [ready, setReady] = (0, react_1.useState)(false);
28
+ const bridge = (0, react_1.useMemo)(() => new bridge_1.FiasBridge(), []);
29
+ (0, react_1.useEffect)(() => {
30
+ let mounted = true;
31
+ bridge.waitForInit().then(() => {
32
+ if (mounted) {
33
+ bridge.ready();
34
+ setReady(true);
35
+ }
36
+ });
37
+ return () => {
38
+ mounted = false;
39
+ bridge.destroy();
40
+ };
41
+ }, [bridge]);
42
+ if (!ready) {
43
+ return null;
44
+ }
45
+ return (0, jsx_runtime_1.jsx)(context_1.FiasBridgeContext.Provider, { value: bridge, children: children });
46
+ }
47
+ //# sourceMappingURL=provider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"provider.js","sourceRoot":"","sources":["../src/provider.tsx"],"names":[],"mappings":";;AA0BA,oCA0BC;;AApDD,iCAA4D;AAC5D,uCAA8C;AAC9C,qCAAsC;AAMtC;;;;;;;;;;;;;;;;;GAiBG;AACH,SAAgB,YAAY,CAAC,EAAE,QAAQ,EAAqB;IAC1D,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,IAAA,gBAAQ,EAAC,KAAK,CAAC,CAAC;IAE1C,MAAM,MAAM,GAAG,IAAA,eAAO,EAAC,GAAG,EAAE,CAAC,IAAI,mBAAU,EAAE,EAAE,EAAE,CAAC,CAAC;IAEnD,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,IAAI,OAAO,GAAG,IAAI,CAAC;QAEnB,MAAM,CAAC,WAAW,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE;YAC7B,IAAI,OAAO,EAAE,CAAC;gBACZ,MAAM,CAAC,KAAK,EAAE,CAAC;gBACf,QAAQ,CAAC,IAAI,CAAC,CAAC;YACjB,CAAC;QACH,CAAC,CAAC,CAAC;QAEH,OAAO,GAAG,EAAE;YACV,OAAO,GAAG,KAAK,CAAC;YAChB,MAAM,CAAC,OAAO,EAAE,CAAC;QACnB,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;IAEb,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,uBAAC,2BAAiB,CAAC,QAAQ,IAAC,KAAK,EAAE,MAAM,YAAG,QAAQ,GAA8B,CAAC;AAC5F,CAAC"}
@@ -0,0 +1,118 @@
1
+ /**
2
+ * Permission scopes that plugins can request in their manifest.
3
+ */
4
+ export type PluginPermission = 'user:profile:read' | 'entities:invoke' | 'storage:sandbox' | 'theme:read';
5
+ /**
6
+ * User profile data available via useFiasUser() hook.
7
+ */
8
+ export interface FiasUser {
9
+ userId: string;
10
+ displayName: string;
11
+ avatar: string | null;
12
+ }
13
+ /**
14
+ * Platform theme tokens available via useFiasTheme() hook.
15
+ */
16
+ export interface FiasTheme {
17
+ colors: {
18
+ primary: string;
19
+ secondary: string;
20
+ background: string;
21
+ surface: string;
22
+ text: string;
23
+ textSecondary: string;
24
+ border: string;
25
+ error: string;
26
+ warning: string;
27
+ success: string;
28
+ };
29
+ spacing: {
30
+ xs: string;
31
+ sm: string;
32
+ md: string;
33
+ lg: string;
34
+ xl: string;
35
+ };
36
+ fonts: {
37
+ body: string;
38
+ heading: string;
39
+ mono: string;
40
+ };
41
+ mode: 'light' | 'dark';
42
+ }
43
+ /**
44
+ * Storage API available via useFiasStorage() hook.
45
+ */
46
+ export interface FiasStorageApi {
47
+ readFile: (path: string) => Promise<string | null>;
48
+ writeFile: (path: string, content: string) => Promise<void>;
49
+ listFiles: (prefix?: string) => Promise<string[]>;
50
+ deleteFile: (path: string) => Promise<void>;
51
+ }
52
+ /**
53
+ * Entity invocation result.
54
+ */
55
+ export interface EntityInvocationResult {
56
+ output: string;
57
+ metadata?: Record<string, unknown>;
58
+ }
59
+ /**
60
+ * Entity invocation API available via useEntityInvocation() hook.
61
+ */
62
+ export interface EntityInvocationApi {
63
+ invoke: (params: EntityInvocationParams) => Promise<EntityInvocationResult>;
64
+ isLoading: boolean;
65
+ result: EntityInvocationResult | null;
66
+ error: Error | null;
67
+ }
68
+ export interface EntityInvocationParams {
69
+ entityId: string;
70
+ input: string;
71
+ parameters?: Record<string, unknown>;
72
+ }
73
+ /**
74
+ * Navigation API available via useFiasNavigation() hook.
75
+ */
76
+ export interface FiasNavigationApi {
77
+ navigateTo: (path: string) => void;
78
+ currentPath: string;
79
+ }
80
+ /**
81
+ * Message types sent from the plugin iframe to the parent frame.
82
+ */
83
+ export type PluginToHostMessageType = 'ready' | 'resize' | 'toast' | 'get_user' | 'get_theme' | 'storage_read' | 'storage_write' | 'storage_list' | 'storage_delete' | 'entity_invoke' | 'navigate';
84
+ /**
85
+ * Message types sent from the parent frame to the plugin iframe.
86
+ */
87
+ export type HostToPluginMessageType = 'init' | 'response' | 'theme_update' | 'navigate_update';
88
+ /**
89
+ * Base message structure for all bridge communication.
90
+ */
91
+ export interface BridgeMessage<T = unknown> {
92
+ type: PluginToHostMessageType | HostToPluginMessageType;
93
+ messageId: string;
94
+ payload: T;
95
+ }
96
+ /**
97
+ * Response message from the host to a plugin request.
98
+ */
99
+ export interface BridgeResponse<T = unknown> {
100
+ type: 'response';
101
+ messageId: string;
102
+ payload: T;
103
+ error?: string;
104
+ }
105
+ /**
106
+ * Init message sent by the host to the plugin on load.
107
+ */
108
+ export interface BridgeInitMessage {
109
+ type: 'init';
110
+ messageId: string;
111
+ payload: {
112
+ archId: string;
113
+ permissions: PluginPermission[];
114
+ theme: FiasTheme;
115
+ currentPath: string;
116
+ };
117
+ }
118
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"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"}
package/dist/types.js ADDED
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
package/package.json ADDED
@@ -0,0 +1,54 @@
1
+ {
2
+ "name": "@fias/arche-sdk",
3
+ "version": "1.0.0",
4
+ "description": "SDK for building FIAS platform plugin arches",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "module": "dist/index.mjs",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.mjs",
12
+ "require": "./dist/index.js"
13
+ }
14
+ },
15
+ "bin": {
16
+ "create-fias-plugin": "dist/cli/create-plugin.js"
17
+ },
18
+ "files": [
19
+ "dist",
20
+ "templates",
21
+ "README.md"
22
+ ],
23
+ "publishConfig": {
24
+ "access": "public"
25
+ },
26
+ "scripts": {
27
+ "build": "tsc && esbuild src/index.ts --bundle --format=esm --outfile=dist/index.mjs --external:react --external:react-dom --jsx=automatic --target=es2020",
28
+ "clean": "rm -rf dist",
29
+ "watch": "tsc -w",
30
+ "typecheck": "tsc --noEmit",
31
+ "test": "jest",
32
+ "test:coverage": "jest --coverage"
33
+ },
34
+ "keywords": [
35
+ "fias",
36
+ "plugin",
37
+ "arche",
38
+ "sdk"
39
+ ],
40
+ "license": "MIT",
41
+ "peerDependencies": {
42
+ "react": "^18.0.0 || ^19.0.0"
43
+ },
44
+ "devDependencies": {
45
+ "@types/jest": "^30.0.0",
46
+ "@types/node": "^25.0.0",
47
+ "@types/react": "^19.0.0",
48
+ "esbuild": "^0.24.0",
49
+ "jest": "^29.7.0",
50
+ "react": "^19.0.0",
51
+ "ts-jest": "^29.1.1",
52
+ "typescript": "^5.3.3"
53
+ }
54
+ }
@@ -0,0 +1,11 @@
1
+ {
2
+ "name": "{{name}}",
3
+ "version": "1.0.0",
4
+ "description": "A FIAS plugin arche",
5
+ "main": "src/index.tsx",
6
+ "archeType": "tool",
7
+ "tags": [],
8
+ "pricing": { "model": "free", "currency": "usd" },
9
+ "permissions": ["theme:read"],
10
+ "sdk": "^1.0.0"
11
+ }
@@ -0,0 +1,12 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
+ <title>FIAS Plugin</title>
7
+ </head>
8
+ <body>
9
+ <div id="root"></div>
10
+ <script type="module" src="/src/index.tsx"></script>
11
+ </body>
12
+ </html>
@@ -0,0 +1,23 @@
1
+ {
2
+ "name": "{{name}}",
3
+ "version": "1.0.0",
4
+ "private": true,
5
+ "scripts": {
6
+ "dev": "vite",
7
+ "build": "vite build",
8
+ "validate": "tsc --noEmit",
9
+ "submit": "echo 'Submission CLI not yet available'"
10
+ },
11
+ "dependencies": {
12
+ "@fias/arche-sdk": "^1.0.0",
13
+ "react": "^19.0.0",
14
+ "react-dom": "^19.0.0"
15
+ },
16
+ "devDependencies": {
17
+ "@types/react": "^19.0.0",
18
+ "@types/react-dom": "^19.0.0",
19
+ "@vitejs/plugin-react": "^4.0.0",
20
+ "typescript": "^5.3.3",
21
+ "vite": "^6.0.0"
22
+ }
23
+ }
@@ -0,0 +1,12 @@
1
+ import { useFiasTheme } from '@fias/arche-sdk';
2
+
3
+ export function App() {
4
+ const theme = useFiasTheme();
5
+
6
+ return (
7
+ <div style={{ padding: theme?.spacing.md, fontFamily: theme?.fonts.body }}>
8
+ <h1>My FIAS Plugin</h1>
9
+ <p>Edit src/App.tsx to get started.</p>
10
+ </div>
11
+ );
12
+ }
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ import ReactDOM from 'react-dom/client';
3
+ import { FiasProvider } from '@fias/arche-sdk';
4
+ import { App } from './App';
5
+
6
+ ReactDOM.createRoot(document.getElementById('root')!).render(
7
+ <React.StrictMode>
8
+ <FiasProvider>
9
+ <App />
10
+ </FiasProvider>
11
+ </React.StrictMode>,
12
+ );
@@ -0,0 +1,17 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2020",
4
+ "module": "ESNext",
5
+ "moduleResolution": "bundler",
6
+ "lib": ["ES2020", "DOM", "DOM.Iterable"],
7
+ "jsx": "react-jsx",
8
+ "strict": true,
9
+ "esModuleInterop": true,
10
+ "skipLibCheck": true,
11
+ "forceConsistentCasingInFileNames": true,
12
+ "resolveJsonModule": true,
13
+ "isolatedModules": true,
14
+ "noEmit": true
15
+ },
16
+ "include": ["src"]
17
+ }