@weavix/sdk-react 0.0.26 → 0.0.28
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/README.md +1 -1
- package/dist/components/PluginProvider.d.ts +3 -0
- package/dist/components/PluginProvider.d.ts.map +1 -1
- package/dist/hooks/useIsOrbita.d.ts +13 -0
- package/dist/hooks/useIsOrbita.d.ts.map +1 -0
- package/dist/hooks/usePluginBootstrap.d.ts +1 -0
- package/dist/hooks/usePluginBootstrap.d.ts.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +47 -27
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -44,7 +44,7 @@ function AppFull() {
|
|
|
44
44
|
- **`PluginProvider`** — initializes the plugin, manages lifecycle, provides context
|
|
45
45
|
- **`usePluginContext()`** — hook for accessing theme, language, slot, slotContext, registerHandler
|
|
46
46
|
- **`isInternalUrl()`** — utility for checking if a URL is internal
|
|
47
|
-
- **Hooks**: `useTheme`, `useLanguage`, `useIsYateam`, `useUserId`, `useConfirm`, `useToaster`, `useLocalizedString`
|
|
47
|
+
- **Hooks**: `useTheme`, `useLanguage`, `useIsYateam`, `useUserId`, `useIsOrbita`, `useConfirm`, `useToaster`, `useLocalizedString`
|
|
48
48
|
- **Components**: `PluginError`, `PluginLoader`, `ErrorBoundary`
|
|
49
49
|
- **Re-exports from `@weavix/sdk-core`**: `hostApi`, `uiApi`, `on`, `dispatchHostEvent`, error codes, types (no `trackerApi` — use tracker-react packages for Tracker HTTP)
|
|
50
50
|
|
|
@@ -15,6 +15,8 @@ interface CommonPluginContextValue {
|
|
|
15
15
|
userId?: string;
|
|
16
16
|
/** Is this a yateam environment? */
|
|
17
17
|
isYateam?: boolean;
|
|
18
|
+
/** Is the Orbit enabled */
|
|
19
|
+
isOrbita?: boolean;
|
|
18
20
|
/** Origin of the parent window (host). */
|
|
19
21
|
origin: string;
|
|
20
22
|
/** Slot in which the plugin is opened. */
|
|
@@ -54,6 +56,7 @@ export type PluginContextValue = BasicPluginContextValue | FullPluginContextValu
|
|
|
54
56
|
* - `theme` — on `theme.changed`
|
|
55
57
|
* - `language` — on `language.changed`
|
|
56
58
|
* - `slotContext` — on `context.changed`
|
|
59
|
+
* - `isOrbita` — on `isOrbita.changed`
|
|
57
60
|
*
|
|
58
61
|
* Supports two context levels:
|
|
59
62
|
* - `'basic'` (default) — slotContext contains only `{ entityId }`.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PluginProvider.d.ts","sourceRoot":"","sources":["../../src/components/PluginProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,EACH,KAAK,YAAY,EAEjB,KAAK,KAAK,EAKb,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACH,KAAK,SAAS,EAOjB,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"PluginProvider.d.ts","sourceRoot":"","sources":["../../src/components/PluginProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,EACH,KAAK,YAAY,EAEjB,KAAK,KAAK,EAKb,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACH,KAAK,SAAS,EAOjB,MAAM,OAAO,CAAC;AAUf;;GAEG;AACH,MAAM,MAAM,uBAAuB,GAAG,CAClC,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,OAAO,KACvC,IAAI,CAAC;AAEV,UAAU,wBAAwB;IAC9B,+DAA+D;IAC/D,KAAK,EAAE,KAAK,GAAG,SAAS,CAAC;IACzB,qEAAqE;IACrE,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B,8CAA8C;IAC9C,OAAO,EAAE,MAAM,CAAC;IAChB,eAAe;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,oCAAoC;IACpC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,2BAA2B;IAC3B,QA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;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,cAAc,CAAC,EAC3B,QAAQ,EACR,UAAiB,EACjB,QAAQ,EACR,aAAa,EACb,eAAsB,GACzB,EAAE,mBAAmB,2CA0LrB"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Реактивный хук для получения текущего статуса Орбиты.
|
|
3
|
+
* @returns Включена ли Орбита (например, 'true'), или `undefined` до получения первого события.
|
|
4
|
+
* @example
|
|
5
|
+
* ```tsx
|
|
6
|
+
* function App() {
|
|
7
|
+
* const isOrbita = useIsOrbita();
|
|
8
|
+
* return <span>Orbita: {String(isOrbita)}</span>;
|
|
9
|
+
* }
|
|
10
|
+
* ```
|
|
11
|
+
*/
|
|
12
|
+
export declare function useIsOrbita(): boolean | undefined;
|
|
13
|
+
//# sourceMappingURL=useIsOrbita.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useIsOrbita.d.ts","sourceRoot":"","sources":["../../src/hooks/useIsOrbita.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;GAUG;AACH,wBAAgB,WAAW,IAAI,OAAO,GAAG,SAAS,CAiBjD"}
|
|
@@ -8,6 +8,7 @@ export type PluginBootstrapState<TContext> = {
|
|
|
8
8
|
context?: TContext;
|
|
9
9
|
userId?: string;
|
|
10
10
|
isYateam?: boolean;
|
|
11
|
+
isOrbita?: boolean;
|
|
11
12
|
};
|
|
12
13
|
export declare function usePluginBootstrap<TContext>(options?: HostInitOptions): PluginBootstrapState<TContext>;
|
|
13
14
|
//# sourceMappingURL=usePluginBootstrap.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePluginBootstrap.d.ts","sourceRoot":"","sources":["../../src/hooks/usePluginBootstrap.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,OAAO,EACP,KAAK,eAAe,EACpB,KAAK,KAAK,EAIb,MAAM,kBAAkB,CAAC;AAG1B,MAAM,MAAM,oBAAoB,CAAC,QAAQ,IAAI;IACzC,IAAI,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;IACxB,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,QAAQ,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACtB,CAAC;AAqBF,wBAAgB,kBAAkB,CAAC,QAAQ,EACvC,OAAO,GAAE,eAAoB,GAC9B,oBAAoB,CAAC,QAAQ,CAAC,
|
|
1
|
+
{"version":3,"file":"usePluginBootstrap.d.ts","sourceRoot":"","sources":["../../src/hooks/usePluginBootstrap.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,OAAO,EACP,KAAK,eAAe,EACpB,KAAK,KAAK,EAIb,MAAM,kBAAkB,CAAC;AAG1B,MAAM,MAAM,oBAAoB,CAAC,QAAQ,IAAI;IACzC,IAAI,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;IACxB,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,QAAQ,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACtB,CAAC;AAqBF,wBAAgB,kBAAkB,CAAC,QAAQ,EACvC,OAAO,GAAE,eAAoB,GAC9B,oBAAoB,CAAC,QAAQ,CAAC,CAwHhC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ export { PluginProvider, usePluginContext, isInternalUrl } from './components/Pl
|
|
|
6
6
|
export type { BasicPluginContextValue, FullPluginContextValue, PluginContextValue, PluginProviderProps, RegisterHandlerFunction, } from './components/PluginProvider';
|
|
7
7
|
export { useConfirm } from './hooks/useConfirm';
|
|
8
8
|
export { useIsYateam } from './hooks/useIsYateam';
|
|
9
|
+
export { useIsOrbita } from './hooks/useIsOrbita';
|
|
9
10
|
export { useLanguage } from './hooks/useLanguage';
|
|
10
11
|
export { useLocalizedString } from './hooks/useLocalizedString';
|
|
11
12
|
export { usePluginBootstrap } from './hooks/usePluginBootstrap';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,YAAY,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC9F,YAAY,EACR,uBAAuB,EACvB,sBAAsB,EACtB,kBAAkB,EAClB,mBAAmB,EACnB,uBAAuB,GAC1B,MAAM,6BAA6B,CAAC;AAGrC,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,m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AChE,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,YAAY,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAGvE,OAAO,EACH,QAAQ,EACR,kBAAkB,EAClB,OAAO,EACP,OAAO,EACP,oBAAoB,EACpB,sBAAsB,EACtB,wBAAwB,EACxB,8BAA8B,EAC9B,iBAAiB,EACjB,KAAK,EACL,aAAa,EACb,gBAAgB,EAChB,EAAE,EACF,iBAAiB,GACpB,MAAM,kBAAkB,CAAC;AAE1B,YAAY,EACR,YAAY,EACZ,cAAc,EACd,aAAa,EACb,YAAY,EACZ,wBAAwB,EACxB,OAAO,IAAI,WAAW,EACtB,iBAAiB,EACjB,iBAAiB,EACjB,eAAe,EACf,eAAe,EACf,KAAK,EACL,WAAW,EACX,YAAY,EACZ,WAAW,GACd,MAAM,kBAAkB,CAAC"}
|
package/dist/index.mjs
CHANGED
|
@@ -136,13 +136,24 @@ function z() {
|
|
|
136
136
|
}, []), e;
|
|
137
137
|
}
|
|
138
138
|
//#endregion
|
|
139
|
+
//#region src/hooks/useIsOrbita.ts
|
|
140
|
+
function B() {
|
|
141
|
+
let [e, t] = s(() => {
|
|
142
|
+
let e;
|
|
143
|
+
return O("isOrbita.changed", (t) => {
|
|
144
|
+
e = t;
|
|
145
|
+
})(), e;
|
|
146
|
+
});
|
|
147
|
+
return i(() => O("isOrbita.changed", t), []), e;
|
|
148
|
+
}
|
|
149
|
+
//#endregion
|
|
139
150
|
//#region src/components/PluginProvider.tsx
|
|
140
|
-
var
|
|
141
|
-
function
|
|
142
|
-
let t = r(
|
|
151
|
+
var V = t(null);
|
|
152
|
+
function H(e = "basic") {
|
|
153
|
+
let t = r(V);
|
|
143
154
|
if (!t) throw Error("usePluginContext must be used within PluginProvider");
|
|
144
155
|
if (e === "full" && t.contextLevel !== "full") throw Error("🛑 [Security] Code requests 'full' context, but manifest declares 'basic'. Change the contextLevel in your manifest to get full access.");
|
|
145
|
-
let n = R(), i = L(), a = I(), o = z(), s = F(), c = {
|
|
156
|
+
let n = R(), i = L(), a = I(), o = z(), s = F(), c = B(), l = {
|
|
146
157
|
service: E.getService(),
|
|
147
158
|
origin: E.getOrigin(),
|
|
148
159
|
slot: t.slot,
|
|
@@ -152,7 +163,8 @@ function V(e = "basic") {
|
|
|
152
163
|
theme: n,
|
|
153
164
|
language: i,
|
|
154
165
|
isYateam: a,
|
|
155
|
-
userId: o
|
|
166
|
+
userId: o,
|
|
167
|
+
isOrbita: c
|
|
156
168
|
};
|
|
157
169
|
if (e === "basic") {
|
|
158
170
|
let e = t.entityId ? {
|
|
@@ -160,32 +172,32 @@ function V(e = "basic") {
|
|
|
160
172
|
...t.entityMeta ? { entityMeta: t.entityMeta } : {}
|
|
161
173
|
} : void 0;
|
|
162
174
|
return {
|
|
163
|
-
...
|
|
175
|
+
...l,
|
|
164
176
|
contextLevel: "basic",
|
|
165
177
|
slotContext: e
|
|
166
178
|
};
|
|
167
179
|
}
|
|
168
180
|
return {
|
|
169
|
-
...
|
|
181
|
+
...l,
|
|
170
182
|
contextLevel: "full",
|
|
171
183
|
slotContext: s
|
|
172
184
|
};
|
|
173
185
|
}
|
|
174
|
-
var
|
|
186
|
+
var U = (e) => {
|
|
175
187
|
try {
|
|
176
188
|
return new URL(e, window.location.href).origin === window.location.origin;
|
|
177
189
|
} catch {
|
|
178
190
|
return !0;
|
|
179
191
|
}
|
|
180
192
|
};
|
|
181
|
-
function
|
|
193
|
+
function W({ children: e, autoResize: t = !0, fallback: n, errorFallback: r, autoNotifyReady: u = !0 }) {
|
|
182
194
|
let d = o(!1), [f, p] = s(!1), [m, h] = s(null), [g, _] = s(null), v = a(() => (e, t) => k(e, t), []);
|
|
183
195
|
return i(() => {
|
|
184
196
|
let e = (e) => {
|
|
185
197
|
let t = e.target.closest("[href], [data-href]");
|
|
186
198
|
if (!t) return;
|
|
187
199
|
let n = t.getAttribute("href") || t.getAttribute("data-href");
|
|
188
|
-
if (!n ||
|
|
200
|
+
if (!n || U(n)) return;
|
|
189
201
|
e.preventDefault();
|
|
190
202
|
let r = t.getAttribute("target") === "_blank";
|
|
191
203
|
j.navigate({
|
|
@@ -214,12 +226,13 @@ function U({ children: e, autoResize: t = !0, fallback: n, errorFallback: r, aut
|
|
|
214
226
|
entityMeta: r,
|
|
215
227
|
registerHandler: v
|
|
216
228
|
}), u && await E.notifyReady();
|
|
217
|
-
let [i, a, o, s, c] = await Promise.allSettled([
|
|
229
|
+
let [i, a, o, s, c, l] = await Promise.allSettled([
|
|
218
230
|
E.getTheme(),
|
|
219
231
|
E.getLanguage(),
|
|
220
232
|
e === "full" ? E.getContext() : Promise.resolve(null),
|
|
221
233
|
E.getIsYateam(),
|
|
222
|
-
E.getUserId()
|
|
234
|
+
E.getUserId(),
|
|
235
|
+
E.getIsOrbita()
|
|
223
236
|
]);
|
|
224
237
|
i.status === "fulfilled" && i.value && x({
|
|
225
238
|
messageId: "",
|
|
@@ -236,6 +249,11 @@ function U({ children: e, autoResize: t = !0, fallback: n, errorFallback: r, aut
|
|
|
236
249
|
type: "event",
|
|
237
250
|
method: "isYateam.changed",
|
|
238
251
|
result: s.value
|
|
252
|
+
}), l.status === "fulfilled" && x({
|
|
253
|
+
messageId: "",
|
|
254
|
+
type: "event",
|
|
255
|
+
method: "isOrbita.changed",
|
|
256
|
+
result: l.value
|
|
239
257
|
}), c.status === "fulfilled" && c.value && x({
|
|
240
258
|
messageId: "",
|
|
241
259
|
type: "event",
|
|
@@ -265,22 +283,22 @@ function U({ children: e, autoResize: t = !0, fallback: n, errorFallback: r, aut
|
|
|
265
283
|
u
|
|
266
284
|
]), m ? r ? /* @__PURE__ */ l(c, { children: r(m) }) : /* @__PURE__ */ l(N, { error: m }) : !f || !g ? /* @__PURE__ */ l(c, { children: n }) : /* @__PURE__ */ l(M, {
|
|
267
285
|
fallback: r || ((e) => /* @__PURE__ */ l(N, { error: e })),
|
|
268
|
-
children: /* @__PURE__ */ l(
|
|
286
|
+
children: /* @__PURE__ */ l(V.Provider, {
|
|
269
287
|
value: g,
|
|
270
288
|
children: e
|
|
271
289
|
})
|
|
272
290
|
});
|
|
273
291
|
}
|
|
274
|
-
var
|
|
292
|
+
var G = () => ({ show: n((e) => j.confirm.show(e), []) }), K = (e = "ru") => {
|
|
275
293
|
let t = L();
|
|
276
294
|
return (n) => w(n, t, e);
|
|
277
295
|
};
|
|
278
296
|
//#endregion
|
|
279
297
|
//#region src/hooks/usePluginBootstrap.ts
|
|
280
|
-
function
|
|
298
|
+
function q(e) {
|
|
281
299
|
return e instanceof Error ? e.message : "Unknown plugin bootstrap error";
|
|
282
300
|
}
|
|
283
|
-
function
|
|
301
|
+
function J(e, t) {
|
|
284
302
|
t != null && x({
|
|
285
303
|
messageId: "",
|
|
286
304
|
type: "event",
|
|
@@ -288,35 +306,36 @@ function q(e, t) {
|
|
|
288
306
|
result: t
|
|
289
307
|
});
|
|
290
308
|
}
|
|
291
|
-
function
|
|
309
|
+
function Y(e = {}) {
|
|
292
310
|
let { autoResize: t = !0 } = e, n = o(null);
|
|
293
311
|
n.current ||= new f();
|
|
294
|
-
let r = n.current, [a, c] = s(!0), [l, u] = s(null), [d, p] = s(), [m, h] = s(), [g, _] = s(), [v, y] = s(), [b, x] = s();
|
|
312
|
+
let r = n.current, [a, c] = s(!0), [l, u] = s(null), [d, p] = s(), [m, h] = s(), [g, _] = s(), [v, y] = s(), [b, x] = s(), [S, C] = s();
|
|
295
313
|
return i(() => {
|
|
296
314
|
let e = !1, n = [], i = (e, t) => {
|
|
297
315
|
n.push(O(e, t));
|
|
298
316
|
};
|
|
299
317
|
try {
|
|
300
|
-
r.init({ autoResize: t }), i("context.changed", (e) => _(e)), i("theme.changed", (e) => p(e)), i("language.changed", (e) => h(e)), i("userId.changed", (e) => y(e)), i("isYateam.changed", (e) => x(e));
|
|
318
|
+
r.init({ autoResize: t }), i("context.changed", (e) => _(e)), i("theme.changed", (e) => p(e)), i("language.changed", (e) => h(e)), i("userId.changed", (e) => y(e)), i("isYateam.changed", (e) => x(e)), i("isOrbita.changed", (e) => C(e));
|
|
301
319
|
} catch (e) {
|
|
302
|
-
return u(
|
|
320
|
+
return u(q(e)), c(!1), () => {
|
|
303
321
|
n.forEach((e) => e()), r.destroy();
|
|
304
322
|
};
|
|
305
323
|
}
|
|
306
324
|
return (async () => {
|
|
307
325
|
try {
|
|
308
|
-
let t = r.getContextLevel() === "full" ? r.getContext() : Promise.resolve(void 0), [n, i, a, o, s] = await Promise.all([
|
|
326
|
+
let t = r.getContextLevel() === "full" ? r.getContext() : Promise.resolve(void 0), [n, i, a, o, s, l] = await Promise.all([
|
|
309
327
|
t,
|
|
310
328
|
r.getTheme(),
|
|
311
329
|
r.getLanguage(),
|
|
312
330
|
r.getUserId(),
|
|
313
|
-
r.getIsYateam()
|
|
331
|
+
r.getIsYateam(),
|
|
332
|
+
r.getIsOrbita()
|
|
314
333
|
]);
|
|
315
334
|
if (e) return;
|
|
316
|
-
_(n), p(i), h(a), y(o), x(s),
|
|
335
|
+
_(n), p(i), h(a), y(o), x(s), C(l), J("context.changed", n), J("theme.changed", i), J("language.changed", a), J("userId.changed", o), J("isYateam.changed", s), J("isOrbita.changed", l), c(!1), await r.notifyReady();
|
|
317
336
|
} catch (t) {
|
|
318
337
|
if (e) return;
|
|
319
|
-
u(
|
|
338
|
+
u(q(t)), c(!1);
|
|
320
339
|
}
|
|
321
340
|
})(), () => {
|
|
322
341
|
e = !0, n.forEach((e) => e()), r.destroy();
|
|
@@ -329,11 +348,12 @@ function J(e = {}) {
|
|
|
329
348
|
language: m,
|
|
330
349
|
context: g,
|
|
331
350
|
userId: v,
|
|
332
|
-
isYateam: b
|
|
351
|
+
isYateam: b,
|
|
352
|
+
isOrbita: S
|
|
333
353
|
};
|
|
334
354
|
}
|
|
335
|
-
var
|
|
355
|
+
var X = () => ({ add: n((e) => j.toaster.add(e), []) });
|
|
336
356
|
//#endregion
|
|
337
|
-
export { M as ErrorBoundary, d as HostApi, p as METHOD_NOT_SUPPORTED, m as MISSING_REQUIRED_SCOPE, h as PLUGIN_ID_IS_NOT_CORRECT, g as PLUGIN_ID_OR_SLOT_NOT_PROVIDED, _ as PluginActionError, N as PluginError, P as PluginLoader,
|
|
357
|
+
export { M as ErrorBoundary, d as HostApi, p as METHOD_NOT_SUPPORTED, m as MISSING_REQUIRED_SCOPE, h as PLUGIN_ID_IS_NOT_CORRECT, g as PLUGIN_ID_OR_SLOT_NOT_PROVIDED, _ as PluginActionError, N as PluginError, P as PluginLoader, W as PluginProvider, v as UNKNOWN_ERROR, y as VALIDATION_ERROR, b as dispatchHostEvent, S as getField, C as getLocalizedString, T as hostApi, U as isInternalUrl, D as on, A as uiApi, G as useConfirm, B as useIsOrbita, I as useIsYateam, L as useLanguage, K as useLocalizedString, Y as usePluginBootstrap, H as usePluginContext, R as useTheme, X as useToaster, z as useUserId };
|
|
338
358
|
|
|
339
359
|
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../src/components/ErrorBoundary.tsx","../src/components/PluginError.tsx","../src/components/PluginLoader.tsx","../src/hooks/useContext.ts","../src/hooks/useIsYateam.ts","../src/hooks/useLanguage.ts","../src/hooks/useTheme.ts","../src/hooks/useUserId.ts","../src/components/PluginProvider.tsx","../src/hooks/useConfirm.ts","../src/hooks/useLocalizedString.ts","../src/hooks/usePluginBootstrap.ts","../src/hooks/useToaster.ts"],"sourcesContent":["import { Component, ReactNode } from 'react';\n\ninterface ErrorBoundaryProps {\n children: ReactNode;\n fallback: (error: Error) => ReactNode;\n}\n\ninterface ErrorBoundaryState {\n hasError: boolean;\n error: Error | null;\n}\n\nexport class ErrorBoundary extends Component<ErrorBoundaryProps, ErrorBoundaryState> {\n static getDerivedStateFromError(error: Error): ErrorBoundaryState {\n return { hasError: true, error };\n }\n\n constructor(props: ErrorBoundaryProps) {\n super(props);\n this.state = { hasError: false, error: null };\n }\n\n componentDidCatch(error: Error, errorInfo: React.ErrorInfo) {\n console.error('ErrorBoundary caught an error:', error, errorInfo);\n }\n\n render() {\n if (this.state.hasError && this.state.error) {\n return this.props.fallback(this.state.error);\n }\n\n return this.props.children;\n }\n}\n","import type { FC } from 'react';\nimport './PluginError.scss';\n\nexport interface PluginErrorProps {\n error: Error;\n}\n\nconst PluginErrorImpl = ({ error }: PluginErrorProps) => (\n <div className=\"plugin-error\">\n <div className=\"plugin-error__container\">\n <div className=\"plugin-error__header\">\n <svg\n className=\"plugin-error__icon\"\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n >\n <circle cx=\"12\" cy=\"12\" r=\"10\" fill=\"#f44336\" />\n <path\n d=\"M12 7v6m0 4h.01\"\n stroke=\"white\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n />\n </svg>\n <h3 className=\"plugin-error__title\">Ошибка инициализации плагина</h3>\n </div>\n <div className=\"plugin-error__message\">\n Не удалось инициализировать плагин. Проверьте параметры запуска и попробуйте\n перезагрузить страницу.\n </div>\n <details className=\"plugin-error__details\">\n <summary className=\"plugin-error__summary\">Детали ошибки</summary>\n <pre className=\"plugin-error__stack\">\n {error.message}\n {error.stack && `\\n\\n${error.stack}`}\n </pre>\n </details>\n </div>\n </div>\n);\n\n/**\n * Дефолтный компонент для отображения ошибки инициализации плагина\n */\nexport const PluginError = PluginErrorImpl as FC<PluginErrorProps>;\n","import type { FC } from 'react';\nimport './PluginLoader.scss';\n\nconst PluginLoaderImpl = () => (\n <div className=\"plugin-loader\">\n <div className=\"plugin-loader__content\">\n <div className=\"plugin-loader__spinner\" />\n <div className=\"plugin-loader__text\">Загрузка плагина...</div>\n </div>\n </div>\n);\n\n/**\n * Простой лоадер для отображения во время инициализации плагина\n */\nexport const PluginLoader = PluginLoaderImpl as FC;\n","import { on } from '@weavix/sdk-core';\nimport { useEffect, useState } from 'react';\n\n/**\n * Reactive hook for receiving the current slot context pushed by the host.\n * @template T - Type of the context object (defaults to `unknown`)\n * @returns Current context, or `undefined` until the first event arrives from the host.\n * @example\n * ```tsx\n * interface IssueContext {\n * key: string;\n * summary: string;\n * }\n *\n * function App() {\n * const context = useContext<IssueContext>();\n * if (!context) return <Loader />;\n * return <div>{context.summary}</div>;\n * }\n * ```\n */\nexport function useContext<T = unknown>(): T | undefined {\n const [context, setContext] = useState<T | undefined>(() => {\n let initial: T | undefined;\n const unsubscribe = on('context.changed', (value) => {\n initial = value as T;\n });\n unsubscribe();\n return initial;\n });\n\n useEffect(() => {\n const unsubscribe = on('context.changed', (value) => {\n setContext(value as T);\n });\n\n return unsubscribe;\n }, []);\n\n return context;\n}\n","import { hostApi } from '@weavix/sdk-core';\nimport { useEffect, useState } from 'react';\n\n/**\n * Реактивный хук для получения текущей сборки приложения.\n * @returns Является ли ятимом приложение (например, 'true'), или `undefined` до получения первого события.\n * @example\n * ```tsx\n * function App() {\n * const isYateam = useIsYateam();\n * return <span>Ятим ли сейчас?: {isYateam}</span>;\n * }\n * ```\n */\nexport function useIsYateam(): boolean | undefined {\n const [isYateam, setIsYateam] = useState<boolean | undefined>(undefined);\n\n useEffect(() => {\n const init = async () => {\n const yateam = (await hostApi.getIsYateam()) as boolean | undefined;\n setIsYateam(yateam);\n };\n\n init();\n }, []);\n\n return isYateam;\n}\n","import { on } from '@weavix/sdk-core';\nimport { useEffect, useState } from 'react';\n\n/**\n * Реактивный хук для получения текущего языка хоста.\n * @returns Код текущего языка (например, `'ru'`, `'en'`), или `undefined` до получения первого события.\n * @example\n * ```tsx\n * function App() {\n * const language = useLanguage();\n * return <span>Текущий язык: {language}</span>;\n * }\n * ```\n */\nexport function useLanguage(): string | undefined {\n const [language, setLanguage] = useState<string | undefined>(() => {\n let initial: string | undefined;\n const unsubscribe = on('language.changed', (value) => {\n initial = value;\n });\n unsubscribe();\n return initial;\n });\n\n useEffect(() => {\n const unsubscribe = on('language.changed', (value) => {\n setLanguage(value);\n });\n\n return unsubscribe;\n }, []);\n\n return language;\n}\n","import { type Theme, on } from '@weavix/sdk-core';\nimport { useEffect, useState } from 'react';\n\n/**\n * Реактивный хук для получения текущей темы хоста.\n * @returns Текущая тема (`'light'` | `'dark'` и т.д.), или `undefined` до получения первого события.\n * @example\n * ```tsx\n * function App() {\n * const theme = useTheme();\n * return <div className={theme}>...</div>;\n * }\n * ```\n */\nexport function useTheme(): Theme | undefined {\n const [theme, setTheme] = useState<Theme | undefined>(() => {\n let initial: Theme | undefined;\n const unsubscribe = on('theme.changed', (value) => {\n initial = value;\n });\n unsubscribe();\n return initial;\n });\n\n useEffect(() => {\n const unsubscribe = on('theme.changed', (value) => {\n setTheme(value);\n });\n\n return unsubscribe;\n }, []);\n\n return theme;\n}\n","import { hostApi } from '@weavix/sdk-core';\nimport { useEffect, useState } from 'react';\n\n/**\n * Реактивный хук для получения айди текущего пользователя.\n * @returns Айди пользователя (например, `'qwertyu'`), или `undefined` до получения первого события.\n * @example\n * ```tsx\n * function App() {\n * const userId = useUserId();\n * return <span>Айди: {userId}</span>;\n * }\n * ```\n */\nexport function useUserId(): string | undefined {\n const [userId, setUserId] = useState<string | undefined>(undefined);\n\n useEffect(() => {\n const init = async () => {\n const id = (await hostApi.getUserId()) as string | undefined;\n\n setUserId(id);\n };\n\n init();\n }, []);\n\n return userId;\n}\n","import {\n type BasicContext,\n type ContextLevel,\n type Theme,\n dispatchHostEvent,\n hostApi,\n setHandler,\n uiApi,\n} from '@weavix/sdk-core';\nimport {\n type ReactNode,\n createContext,\n useContext,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { useContext as useSlotContext } from '../hooks/useContext';\nimport { useIsYateam } from '../hooks/useIsYateam';\nimport { useLanguage } from '../hooks/useLanguage';\nimport { useTheme } from '../hooks/useTheme';\nimport { useUserId } from '../hooks/useUserId';\nimport { ErrorBoundary } from './ErrorBoundary';\nimport { PluginError } from './PluginError';\n\n/**\n * Generic registerHandler — no Tracker-specific types.\n */\nexport type RegisterHandlerFunction = (\n methodName: string,\n handler: (...args: unknown[]) => unknown,\n) => void;\n\ninterface CommonPluginContextValue {\n /** Current host theme. Updated reactively on theme.changed. */\n theme: Theme | undefined;\n /** Current host language. Updated reactively on language.changed. */\n language: string | undefined;\n /** Service in which the plugin was opened. */\n service: string;\n /** User ID. */\n userId?: string;\n /** Is this a yateam environment? */\n isYateam?: boolean;\n /** Origin of the parent window (host). */\n origin: string;\n /** Slot in which the plugin is opened. */\n slot: string;\n /** URL inside the plugin. */\n innerUrl: string;\n /** Plugin query parameters. */\n queryParams: Record<string, string>;\n /** Register a handler for responding to host requests. */\n registerHandler: RegisterHandlerFunction;\n}\n\n/**\n * Plugin context at contextLevel = 'basic'.\n * slotContext contains only entityId.\n */\nexport interface BasicPluginContextValue extends CommonPluginContextValue {\n /** Page context — only entityId at basic level. */\n slotContext: BasicContext | undefined;\n\n /** Context level declared in the manifest. */\n contextLevel: 'basic';\n}\n\n/**\n * Plugin context at contextLevel = 'full'.\n * slotContext contains the full slot object.\n */\nexport interface FullPluginContextValue extends CommonPluginContextValue {\n /** Page context — full slot object at full level. */\n slotContext: unknown;\n\n /** Context level declared in the manifest. */\n contextLevel: 'full';\n}\n\nexport type PluginContextValue = BasicPluginContextValue | FullPluginContextValue;\n\n/** Internal context type — only stable data (slot + registerHandler) */\ntype InternalContextValue = {\n slot: string;\n registerHandler: RegisterHandlerFunction;\n innerUrl: string;\n queryParams: Record<string, string>;\n contextLevel: ContextLevel;\n entityId: string | null;\n entityMeta: Record<string, string> | undefined;\n};\n\nconst PluginContext = createContext<InternalContextValue | null>(null);\n\n/**\n * Hook for getting theme, language, slot and slot context from PluginProvider.\n *\n * All values are reactive — updated automatically on push events from the host:\n * - `theme` — on `theme.changed`\n * - `language` — on `language.changed`\n * - `slotContext` — on `context.changed`\n *\n * Supports two context levels:\n * - `'basic'` (default) — slotContext contains only `{ entityId }`.\n * - `'full'` — slotContext contains the full slot object.\n * Requires `contextLevel: \"full\"` in the plugin manifest.\n */\nexport function usePluginContext(): BasicPluginContextValue;\nexport function usePluginContext(level: 'basic'): BasicPluginContextValue;\nexport function usePluginContext(level: 'full'): FullPluginContextValue;\nexport function usePluginContext(\n level: ContextLevel = 'basic',\n): BasicPluginContextValue | FullPluginContextValue {\n const ctx = useContext(PluginContext);\n if (!ctx) {\n throw new Error('usePluginContext must be used within PluginProvider');\n }\n\n // Runtime guard: code requests more than manifest allows\n if (level === 'full' && ctx.contextLevel !== 'full') {\n throw new Error(\n \"🛑 [Security] Code requests 'full' context, but manifest declares 'basic'. \" +\n 'Change the contextLevel in your manifest to get full access.',\n );\n }\n\n // Reactive values — each hook subscribes to its own event\n const theme = useTheme();\n const language = useLanguage();\n const isYateam = useIsYateam();\n const userId = useUserId();\n const fullSlotContext = useSlotContext();\n\n const commonContextValue = {\n service: hostApi.getService(),\n origin: hostApi.getOrigin(),\n slot: ctx.slot,\n innerUrl: ctx.innerUrl,\n queryParams: ctx.queryParams,\n registerHandler: ctx.registerHandler,\n theme,\n language,\n isYateam,\n userId,\n };\n\n if (level === 'basic') {\n const basicSlotContext: BasicContext | undefined = ctx.entityId\n ? { entityId: ctx.entityId, ...(ctx.entityMeta ? { entityMeta: ctx.entityMeta } : {}) }\n : undefined;\n\n return {\n ...commonContextValue,\n contextLevel: 'basic',\n slotContext: basicSlotContext,\n } as BasicPluginContextValue;\n }\n\n return {\n ...commonContextValue,\n contextLevel: 'full',\n slotContext: fullSlotContext,\n } as FullPluginContextValue;\n}\n\nexport interface PluginProviderProps {\n children: ReactNode;\n /**\n * Automatically resize the plugin container when content changes.\n * @default true\n */\n autoResize?: boolean;\n /**\n * Component to display during initialization.\n * @default undefined (nothing shown)\n */\n fallback?: ReactNode;\n /**\n * Component to display on initialization error.\n * @default <PluginError error={error} />\n */\n errorFallback?: (error: Error) => ReactNode;\n /**\n * Automatically notify the host that the plugin is ready after initialization.\n * @default true\n */\n autoNotifyReady?: boolean;\n}\n\nexport const isInternalUrl = (url: string) => {\n try {\n const urlObj = new URL(url, window.location.href);\n return urlObj.origin === window.location.origin;\n } catch {\n return true;\n }\n};\n\n/**\n * Generic plugin provider.\n * Wraps the application and manages the plugin lifecycle.\n *\n * After initialization, theme, language and slot context are available via\n * `usePluginContext()` and update reactively on push events from the host.\n * @example\n * ```tsx\n * root.render(\n * <PluginProvider>\n * <App />\n * </PluginProvider>\n * );\n * ```\n */\nexport function PluginProvider({\n children,\n autoResize = true,\n fallback,\n errorFallback,\n autoNotifyReady = true,\n}: PluginProviderProps) {\n const initializedRef = useRef(false);\n const [initialized, setInitialized] = useState(false);\n const [error, setError] = useState<Error | null>(null);\n const [internalValue, setInternalValue] = useState<InternalContextValue | null>(null);\n\n const registerHandler = useMemo<RegisterHandlerFunction>(() => {\n return (methodName: string, handler: (...args: unknown[]) => unknown) =>\n setHandler(methodName as never, handler as never);\n }, []);\n\n useEffect(() => {\n const handleLinkClick = (event: MouseEvent) => {\n const target = event.target as HTMLElement;\n const linkElement = target.closest<HTMLElement>('[href], [data-href]');\n\n if (!linkElement) return;\n\n const href = linkElement.getAttribute('href') || linkElement.getAttribute('data-href');\n if (!href) return;\n\n if (isInternalUrl(href)) {\n return;\n }\n\n event.preventDefault();\n\n const targetAttr = linkElement.getAttribute('target');\n const newTab = targetAttr === '_blank';\n\n uiApi\n .navigate({\n path: href,\n options: {\n newTab,\n },\n })\n .then(() => {\n console.info(`Navigation: ${href}`);\n })\n .catch((err) => {\n console.error('Navigation error:', err);\n });\n };\n\n document.addEventListener('click', handleLinkClick);\n\n return () => {\n document.removeEventListener('click', handleLinkClick);\n };\n }, []);\n\n useEffect(() => {\n // Prevent double initialization in React StrictMode\n if (initializedRef.current) {\n return;\n }\n\n const initPlugin = async () => {\n try {\n hostApi.init({ autoResize });\n initializedRef.current = true;\n\n const contextLevel = hostApi.getContextLevel();\n const entityId = hostApi.getEntityId();\n const entityMeta = hostApi.getEntityMeta();\n\n setInternalValue({\n slot: hostApi.getSlot(),\n innerUrl: hostApi.getInnerUrl(),\n queryParams: hostApi.getQueryParams(),\n contextLevel,\n entityId,\n entityMeta,\n registerHandler,\n });\n\n if (autoNotifyReady) {\n await hostApi.notifyReady();\n }\n\n // Fetch initial values and prime the eventBus cache so that\n // hooks subscribing after these responses arrive still get the values.\n // For basic contextLevel, skip the context.get postMessage call.\n const [theme, language, context, isYateam, userId] = await Promise.allSettled([\n hostApi.getTheme(),\n hostApi.getLanguage(),\n contextLevel === 'full' ? hostApi.getContext() : Promise.resolve(null),\n hostApi.getIsYateam(),\n hostApi.getUserId(),\n ]);\n\n if (theme.status === 'fulfilled' && theme.value) {\n dispatchHostEvent({\n messageId: '',\n type: 'event',\n method: 'theme.changed',\n result: theme.value,\n });\n }\n if (language.status === 'fulfilled' && language.value) {\n dispatchHostEvent({\n messageId: '',\n type: 'event',\n method: 'language.changed',\n result: language.value,\n });\n }\n\n if (isYateam.status === 'fulfilled' && isYateam.value) {\n dispatchHostEvent({\n messageId: '',\n type: 'event',\n method: 'isYateam.changed',\n result: isYateam.value,\n });\n }\n\n if (userId.status === 'fulfilled' && userId.value) {\n dispatchHostEvent({\n messageId: '',\n type: 'event',\n method: 'userId.changed',\n result: userId.value,\n });\n }\n\n // For basic level, dispatch entityId as context.\n // For full level, dispatch the full context from host.\n if (contextLevel === 'basic') {\n if (entityId) {\n dispatchHostEvent({\n messageId: '',\n type: 'event',\n method: 'context.changed',\n result: { entityId, ...(entityMeta ? { entityMeta } : {}) },\n });\n }\n } else if (context.status === 'fulfilled' && context.value) {\n dispatchHostEvent({\n messageId: '',\n type: 'event',\n method: 'context.changed',\n result: context.value,\n });\n }\n\n setInitialized(true);\n } catch (err) {\n setError(err as Error);\n }\n };\n\n initPlugin();\n }, [autoResize, registerHandler, autoNotifyReady]);\n\n if (error) {\n if (errorFallback) {\n return <>{errorFallback(error)}</>;\n }\n\n return <PluginError error={error} />;\n }\n\n if (!initialized || !internalValue) {\n return <>{fallback}</>;\n }\n\n return (\n <ErrorBoundary\n fallback={errorFallback || ((pluginError) => <PluginError error={pluginError} />)}\n >\n <PluginContext.Provider value={internalValue}>{children}</PluginContext.Provider>\n </ErrorBoundary>\n );\n}\n","import { type ConfirmOptions, type ConfirmResult, uiApi } from '@weavix/sdk-core';\nimport { useCallback } from 'react';\n\nexport type UseConfirmReturn = {\n show: (options: ConfirmOptions) => Promise<ConfirmResult>;\n};\n\nconst useConfirmImpl = () => {\n const show = useCallback((options: ConfirmOptions) => uiApi.confirm.show(options), []);\n\n return { show };\n};\n\nexport const useConfirm = useConfirmImpl as () => UseConfirmReturn;\n","import { type LocalizedString, getLocalizedString } from '@weavix/sdk-core';\nimport { useLanguage } from './useLanguage';\n\nconst useLocalizedStringImpl = (fallbackLanguage = 'ru') => {\n const language = useLanguage();\n\n return (value: LocalizedString): string => {\n return getLocalizedString(value, language, fallbackLanguage);\n };\n};\n\n/**\n * Хук для получения локализованной строки на основе текущего языка из контекста.\n */\nexport const useLocalizedString = useLocalizedStringImpl as (\n fallbackLanguage?: string,\n) => (value: LocalizedString) => string;\n","import {\n HostApi,\n type HostInitOptions,\n type Theme,\n type Unsubscribe,\n dispatchHostEvent,\n on,\n} from '@weavix/sdk-core';\nimport { useEffect, useRef, useState } from 'react';\n\nexport type PluginBootstrapState<TContext> = {\n host: HostApi<TContext>;\n loading: boolean;\n error: string | null;\n theme?: Theme;\n language?: string;\n context?: TContext;\n userId?: string;\n isYateam?: boolean;\n};\n\nfunction getErrorMessage(error: unknown): string {\n return error instanceof Error ? error.message : 'Unknown plugin bootstrap error';\n}\n\ntype BootstrapEventMethod = Parameters<typeof dispatchHostEvent>[0]['method'];\n\nfunction dispatchInitialValue(method: BootstrapEventMethod, result: unknown) {\n if (result === undefined || result === null) {\n return;\n }\n\n dispatchHostEvent({\n messageId: '',\n type: 'event',\n method,\n result,\n });\n}\n\nexport function usePluginBootstrap<TContext>(\n options: HostInitOptions = {},\n): PluginBootstrapState<TContext> {\n const { autoResize = true } = options;\n const hostRef = useRef<HostApi<TContext> | null>(null);\n\n if (!hostRef.current) {\n hostRef.current = new HostApi<TContext>();\n }\n\n const host = hostRef.current;\n const [loading, setLoading] = useState(true);\n const [error, setError] = useState<string | null>(null);\n const [theme, setTheme] = useState<Theme>();\n const [language, setLanguage] = useState<string>();\n const [context, setContext] = useState<TContext>();\n const [userId, setUserId] = useState<string>();\n const [isYateam, setIsYateam] = useState<boolean>();\n\n useEffect(() => {\n let cancelled = false;\n const unsubscribes: Unsubscribe[] = [];\n\n const subscribe = <M extends Parameters<typeof on>[0]>(\n method: M,\n callback: (value: unknown) => void,\n ) => {\n unsubscribes.push(on(method, callback as never));\n };\n\n try {\n host.init({ autoResize });\n\n subscribe('context.changed', (value) => setContext(value as TContext));\n subscribe('theme.changed', (value) => setTheme(value as Theme));\n subscribe('language.changed', (value) => setLanguage(value as string));\n subscribe('userId.changed', (value) => setUserId(value as string));\n subscribe('isYateam.changed', (value) => setIsYateam(value as boolean));\n } catch (initError) {\n setError(getErrorMessage(initError));\n setLoading(false);\n\n return () => {\n unsubscribes.forEach((unsubscribe) => unsubscribe());\n host.destroy();\n };\n }\n\n const bootstrap = async () => {\n try {\n const contextPromise =\n host.getContextLevel() === 'full'\n ? host.getContext()\n : Promise.resolve(undefined);\n const [\n resolvedContext,\n resolvedTheme,\n resolvedLanguage,\n resolvedUserId,\n resolvedIsYateam,\n ] = await Promise.all([\n contextPromise,\n host.getTheme() as Promise<Theme>,\n host.getLanguage() as Promise<string>,\n host.getUserId() as Promise<string | undefined>,\n host.getIsYateam() as Promise<boolean | undefined>,\n ]);\n\n if (cancelled) {\n return;\n }\n\n setContext(resolvedContext);\n setTheme(resolvedTheme);\n setLanguage(resolvedLanguage);\n setUserId(resolvedUserId);\n setIsYateam(resolvedIsYateam);\n\n dispatchInitialValue('context.changed', resolvedContext);\n dispatchInitialValue('theme.changed', resolvedTheme);\n dispatchInitialValue('language.changed', resolvedLanguage);\n dispatchInitialValue('userId.changed', resolvedUserId);\n dispatchInitialValue('isYateam.changed', resolvedIsYateam);\n\n setLoading(false);\n await host.notifyReady();\n } catch (bootstrapError) {\n if (cancelled) {\n return;\n }\n\n setError(getErrorMessage(bootstrapError));\n setLoading(false);\n }\n };\n\n bootstrap();\n\n return () => {\n cancelled = true;\n unsubscribes.forEach((unsubscribe) => unsubscribe());\n host.destroy();\n };\n }, [autoResize, host]);\n\n return {\n host,\n loading,\n error,\n theme,\n language,\n context,\n userId,\n isYateam,\n };\n}\n","import { type ToastOptions, uiApi } from '@weavix/sdk-core';\nimport { useCallback } from 'react';\n\nexport type UseToasterReturn = {\n add: (options: ToastOptions) => Promise<{ name: string }>;\n};\n\nconst useToasterImpl = () => {\n const add = useCallback((options: ToastOptions) => uiApi.toaster.add(options), []);\n\n return { add };\n};\n\nexport const useToaster = useToasterImpl as () => UseToasterReturn;\n"],"mappings":";;;;AAYA,IAAa,IAAb,cAAmC,EAAkD;CACjF,OAAO,yBAAyB,GAAkC;EAC9D,OAAO;GAAE,UAAU;GAAM;EAAM;CACnC;CAEA,YAAY,GAA2B;EAEnC,AADA,MAAM,CAAK,GACX,KAAK,QAAQ;GAAE,UAAU;GAAO,OAAO;EAAK;CAChD;CAEA,kBAAkB,GAAc,GAA4B;EACxD,QAAQ,MAAM,kCAAkC,GAAO,CAAS;CACpE;CAEA,SAAS;EAKL,OAJI,KAAK,MAAM,YAAY,KAAK,MAAM,QAC3B,KAAK,MAAM,SAAS,KAAK,MAAM,KAAK,IAGxC,KAAK,MAAM;CACtB;AACJ,GCaa,KAvCY,EAAE,eACvB,kBAAC,OAAD;CAAK,WAAU;WACX,kBAAC,OAAD;EAAK,WAAU;YAAf;GACI,kBAAC,OAAD;IAAK,WAAU;cAAf,CACI,kBAAC,OAAD;KACI,WAAU;KACV,OAAM;KACN,QAAO;KACP,SAAQ;KACR,MAAK;eALT,CAOI,kB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EACH;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACJ;AACJ;AC9IA,IAAa,WAHF,EAAE,KAFG,GAAa,MAA0B,EAAM,QAAQ,IAAI,CAAO,GAAG,CAAC,CAEvE,EAAI"}
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../src/components/ErrorBoundary.tsx","../src/components/PluginError.tsx","../src/components/PluginLoader.tsx","../src/hooks/useContext.ts","../src/hooks/useIsYateam.ts","../src/hooks/useLanguage.ts","../src/hooks/useTheme.ts","../src/hooks/useUserId.ts","../src/hooks/useIsOrbita.ts","../src/components/PluginProvider.tsx","../src/hooks/useConfirm.ts","../src/hooks/useLocalizedString.ts","../src/hooks/usePluginBootstrap.ts","../src/hooks/useToaster.ts"],"sourcesContent":["import { Component, ReactNode } from 'react';\n\ninterface ErrorBoundaryProps {\n children: ReactNode;\n fallback: (error: Error) => ReactNode;\n}\n\ninterface ErrorBoundaryState {\n hasError: boolean;\n error: Error | null;\n}\n\nexport class ErrorBoundary extends Component<ErrorBoundaryProps, ErrorBoundaryState> {\n static getDerivedStateFromError(error: Error): ErrorBoundaryState {\n return { hasError: true, error };\n }\n\n constructor(props: ErrorBoundaryProps) {\n super(props);\n this.state = { hasError: false, error: null };\n }\n\n componentDidCatch(error: Error, errorInfo: React.ErrorInfo) {\n console.error('ErrorBoundary caught an error:', error, errorInfo);\n }\n\n render() {\n if (this.state.hasError && this.state.error) {\n return this.props.fallback(this.state.error);\n }\n\n return this.props.children;\n }\n}\n","import type { FC } from 'react';\nimport './PluginError.scss';\n\nexport interface PluginErrorProps {\n error: Error;\n}\n\nconst PluginErrorImpl = ({ error }: PluginErrorProps) => (\n <div className=\"plugin-error\">\n <div className=\"plugin-error__container\">\n <div className=\"plugin-error__header\">\n <svg\n className=\"plugin-error__icon\"\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n >\n <circle cx=\"12\" cy=\"12\" r=\"10\" fill=\"#f44336\" />\n <path\n d=\"M12 7v6m0 4h.01\"\n stroke=\"white\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n />\n </svg>\n <h3 className=\"plugin-error__title\">Ошибка инициализации плагина</h3>\n </div>\n <div className=\"plugin-error__message\">\n Не удалось инициализировать плагин. Проверьте параметры запуска и попробуйте\n перезагрузить страницу.\n </div>\n <details className=\"plugin-error__details\">\n <summary className=\"plugin-error__summary\">Детали ошибки</summary>\n <pre className=\"plugin-error__stack\">\n {error.message}\n {error.stack && `\\n\\n${error.stack}`}\n </pre>\n </details>\n </div>\n </div>\n);\n\n/**\n * Дефолтный компонент для отображения ошибки инициализации плагина\n */\nexport const PluginError = PluginErrorImpl as FC<PluginErrorProps>;\n","import type { FC } from 'react';\nimport './PluginLoader.scss';\n\nconst PluginLoaderImpl = () => (\n <div className=\"plugin-loader\">\n <div className=\"plugin-loader__content\">\n <div className=\"plugin-loader__spinner\" />\n <div className=\"plugin-loader__text\">Загрузка плагина...</div>\n </div>\n </div>\n);\n\n/**\n * Простой лоадер для отображения во время инициализации плагина\n */\nexport const PluginLoader = PluginLoaderImpl as FC;\n","import { on } from '@weavix/sdk-core';\nimport { useEffect, useState } from 'react';\n\n/**\n * Reactive hook for receiving the current slot context pushed by the host.\n * @template T - Type of the context object (defaults to `unknown`)\n * @returns Current context, or `undefined` until the first event arrives from the host.\n * @example\n * ```tsx\n * interface IssueContext {\n * key: string;\n * summary: string;\n * }\n *\n * function App() {\n * const context = useContext<IssueContext>();\n * if (!context) return <Loader />;\n * return <div>{context.summary}</div>;\n * }\n * ```\n */\nexport function useContext<T = unknown>(): T | undefined {\n const [context, setContext] = useState<T | undefined>(() => {\n let initial: T | undefined;\n const unsubscribe = on('context.changed', (value) => {\n initial = value as T;\n });\n unsubscribe();\n return initial;\n });\n\n useEffect(() => {\n const unsubscribe = on('context.changed', (value) => {\n setContext(value as T);\n });\n\n return unsubscribe;\n }, []);\n\n return context;\n}\n","import { hostApi } from '@weavix/sdk-core';\nimport { useEffect, useState } from 'react';\n\n/**\n * Реактивный хук для получения текущей сборки приложения.\n * @returns Является ли ятимом приложение (например, 'true'), или `undefined` до получения первого события.\n * @example\n * ```tsx\n * function App() {\n * const isYateam = useIsYateam();\n * return <span>Ятим ли сейчас?: {isYateam}</span>;\n * }\n * ```\n */\nexport function useIsYateam(): boolean | undefined {\n const [isYateam, setIsYateam] = useState<boolean | undefined>(undefined);\n\n useEffect(() => {\n const init = async () => {\n const yateam = (await hostApi.getIsYateam()) as boolean | undefined;\n setIsYateam(yateam);\n };\n\n init();\n }, []);\n\n return isYateam;\n}\n","import { on } from '@weavix/sdk-core';\nimport { useEffect, useState } from 'react';\n\n/**\n * Реактивный хук для получения текущего языка хоста.\n * @returns Код текущего языка (например, `'ru'`, `'en'`), или `undefined` до получения первого события.\n * @example\n * ```tsx\n * function App() {\n * const language = useLanguage();\n * return <span>Текущий язык: {language}</span>;\n * }\n * ```\n */\nexport function useLanguage(): string | undefined {\n const [language, setLanguage] = useState<string | undefined>(() => {\n let initial: string | undefined;\n const unsubscribe = on('language.changed', (value) => {\n initial = value;\n });\n unsubscribe();\n return initial;\n });\n\n useEffect(() => {\n const unsubscribe = on('language.changed', (value) => {\n setLanguage(value);\n });\n\n return unsubscribe;\n }, []);\n\n return language;\n}\n","import { type Theme, on } from '@weavix/sdk-core';\nimport { useEffect, useState } from 'react';\n\n/**\n * Реактивный хук для получения текущей темы хоста.\n * @returns Текущая тема (`'light'` | `'dark'` и т.д.), или `undefined` до получения первого события.\n * @example\n * ```tsx\n * function App() {\n * const theme = useTheme();\n * return <div className={theme}>...</div>;\n * }\n * ```\n */\nexport function useTheme(): Theme | undefined {\n const [theme, setTheme] = useState<Theme | undefined>(() => {\n let initial: Theme | undefined;\n const unsubscribe = on('theme.changed', (value) => {\n initial = value;\n });\n unsubscribe();\n return initial;\n });\n\n useEffect(() => {\n const unsubscribe = on('theme.changed', (value) => {\n setTheme(value);\n });\n\n return unsubscribe;\n }, []);\n\n return theme;\n}\n","import { hostApi } from '@weavix/sdk-core';\nimport { useEffect, useState } from 'react';\n\n/**\n * Реактивный хук для получения айди текущего пользователя.\n * @returns Айди пользователя (например, `'qwertyu'`), или `undefined` до получения первого события.\n * @example\n * ```tsx\n * function App() {\n * const userId = useUserId();\n * return <span>Айди: {userId}</span>;\n * }\n * ```\n */\nexport function useUserId(): string | undefined {\n const [userId, setUserId] = useState<string | undefined>(undefined);\n\n useEffect(() => {\n const init = async () => {\n const id = (await hostApi.getUserId()) as string | undefined;\n\n setUserId(id);\n };\n\n init();\n }, []);\n\n return userId;\n}\n","import { on } from '@weavix/sdk-core';\nimport { useEffect, useState } from 'react';\n\n/**\n * Реактивный хук для получения текущего статуса Орбиты.\n * @returns Включена ли Орбита (например, 'true'), или `undefined` до получения первого события.\n * @example\n * ```tsx\n * function App() {\n * const isOrbita = useIsOrbita();\n * return <span>Orbita: {String(isOrbita)}</span>;\n * }\n * ```\n */\nexport function useIsOrbita(): boolean | undefined {\n const [isOrbita, setIsOrbita] = useState<boolean | undefined>(() => {\n let initial: boolean | undefined;\n const unsubscribe = on('isOrbita.changed', (value) => {\n initial = value;\n });\n\n unsubscribe();\n\n return initial;\n });\n\n useEffect(() => {\n return on('isOrbita.changed', setIsOrbita);\n }, []);\n\n return isOrbita;\n}\n","import {\n type BasicContext,\n type ContextLevel,\n type Theme,\n dispatchHostEvent,\n hostApi,\n setHandler,\n uiApi,\n} from '@weavix/sdk-core';\nimport {\n type ReactNode,\n createContext,\n useContext,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { useContext as useSlotContext } from '../hooks/useContext';\nimport { useIsYateam } from '../hooks/useIsYateam';\nimport { useLanguage } from '../hooks/useLanguage';\nimport { useTheme } from '../hooks/useTheme';\nimport { useUserId } from '../hooks/useUserId';\nimport { ErrorBoundary } from './ErrorBoundary';\nimport { PluginError } from './PluginError';\nimport { useIsOrbita } from '../hooks/useIsOrbita';\n\n/**\n * Generic registerHandler — no Tracker-specific types.\n */\nexport type RegisterHandlerFunction = (\n methodName: string,\n handler: (...args: unknown[]) => unknown,\n) => void;\n\ninterface CommonPluginContextValue {\n /** Current host theme. Updated reactively on theme.changed. */\n theme: Theme | undefined;\n /** Current host language. Updated reactively on language.changed. */\n language: string | undefined;\n /** Service in which the plugin was opened. */\n service: string;\n /** User ID. */\n userId?: string;\n /** Is this a yateam environment? */\n isYateam?: boolean;\n /** Is the Orbit enabled */\n isOrbita?: boolean;\n /** Origin of the parent window (host). */\n origin: string;\n /** Slot in which the plugin is opened. */\n slot: string;\n /** URL inside the plugin. */\n innerUrl: string;\n /** Plugin query parameters. */\n queryParams: Record<string, string>;\n /** Register a handler for responding to host requests. */\n registerHandler: RegisterHandlerFunction;\n}\n\n/**\n * Plugin context at contextLevel = 'basic'.\n * slotContext contains only entityId.\n */\nexport interface BasicPluginContextValue extends CommonPluginContextValue {\n /** Page context — only entityId at basic level. */\n slotContext: BasicContext | undefined;\n\n /** Context level declared in the manifest. */\n contextLevel: 'basic';\n}\n\n/**\n * Plugin context at contextLevel = 'full'.\n * slotContext contains the full slot object.\n */\nexport interface FullPluginContextValue extends CommonPluginContextValue {\n /** Page context — full slot object at full level. */\n slotContext: unknown;\n\n /** Context level declared in the manifest. */\n contextLevel: 'full';\n}\n\nexport type PluginContextValue = BasicPluginContextValue | FullPluginContextValue;\n\n/** Internal context type — only stable data (slot + registerHandler) */\ntype InternalContextValue = {\n slot: string;\n registerHandler: RegisterHandlerFunction;\n innerUrl: string;\n queryParams: Record<string, string>;\n contextLevel: ContextLevel;\n entityId: string | null;\n entityMeta: Record<string, string> | undefined;\n};\n\nconst PluginContext = createContext<InternalContextValue | null>(null);\n\n/**\n * Hook for getting theme, language, slot and slot context from PluginProvider.\n *\n * All values are reactive — updated automatically on push events from the host:\n * - `theme` — on `theme.changed`\n * - `language` — on `language.changed`\n * - `slotContext` — on `context.changed`\n * - `isOrbita` — on `isOrbita.changed`\n *\n * Supports two context levels:\n * - `'basic'` (default) — slotContext contains only `{ entityId }`.\n * - `'full'` — slotContext contains the full slot object.\n * Requires `contextLevel: \"full\"` in the plugin manifest.\n */\nexport function usePluginContext(): BasicPluginContextValue;\nexport function usePluginContext(level: 'basic'): BasicPluginContextValue;\nexport function usePluginContext(level: 'full'): FullPluginContextValue;\nexport function usePluginContext(\n level: ContextLevel = 'basic',\n): BasicPluginContextValue | FullPluginContextValue {\n const ctx = useContext(PluginContext);\n if (!ctx) {\n throw new Error('usePluginContext must be used within PluginProvider');\n }\n\n // Runtime guard: code requests more than manifest allows\n if (level === 'full' && ctx.contextLevel !== 'full') {\n throw new Error(\n \"🛑 [Security] Code requests 'full' context, but manifest declares 'basic'. \" +\n 'Change the contextLevel in your manifest to get full access.',\n );\n }\n\n // Reactive values — each hook subscribes to its own event\n const theme = useTheme();\n const language = useLanguage();\n const isYateam = useIsYateam();\n const userId = useUserId();\n const fullSlotContext = useSlotContext();\n const isOrbita = useIsOrbita();\n\n const commonContextValue = {\n service: hostApi.getService(),\n origin: hostApi.getOrigin(),\n slot: ctx.slot,\n innerUrl: ctx.innerUrl,\n queryParams: ctx.queryParams,\n registerHandler: ctx.registerHandler,\n theme,\n language,\n isYateam,\n userId,\n isOrbita,\n };\n\n if (level === 'basic') {\n const basicSlotContext: BasicContext | undefined = ctx.entityId\n ? { entityId: ctx.entityId, ...(ctx.entityMeta ? { entityMeta: ctx.entityMeta } : {}) }\n : undefined;\n\n return {\n ...commonContextValue,\n contextLevel: 'basic',\n slotContext: basicSlotContext,\n } as BasicPluginContextValue;\n }\n\n return {\n ...commonContextValue,\n contextLevel: 'full',\n slotContext: fullSlotContext,\n } as FullPluginContextValue;\n}\n\nexport interface PluginProviderProps {\n children: ReactNode;\n /**\n * Automatically resize the plugin container when content changes.\n * @default true\n */\n autoResize?: boolean;\n /**\n * Component to display during initialization.\n * @default undefined (nothing shown)\n */\n fallback?: ReactNode;\n /**\n * Component to display on initialization error.\n * @default <PluginError error={error} />\n */\n errorFallback?: (error: Error) => ReactNode;\n /**\n * Automatically notify the host that the plugin is ready after initialization.\n * @default true\n */\n autoNotifyReady?: boolean;\n}\n\nexport const isInternalUrl = (url: string) => {\n try {\n const urlObj = new URL(url, window.location.href);\n return urlObj.origin === window.location.origin;\n } catch {\n return true;\n }\n};\n\n/**\n * Generic plugin provider.\n * Wraps the application and manages the plugin lifecycle.\n *\n * After initialization, theme, language and slot context are available via\n * `usePluginContext()` and update reactively on push events from the host.\n * @example\n * ```tsx\n * root.render(\n * <PluginProvider>\n * <App />\n * </PluginProvider>\n * );\n * ```\n */\nexport function PluginProvider({\n children,\n autoResize = true,\n fallback,\n errorFallback,\n autoNotifyReady = true,\n}: PluginProviderProps) {\n const initializedRef = useRef(false);\n const [initialized, setInitialized] = useState(false);\n const [error, setError] = useState<Error | null>(null);\n const [internalValue, setInternalValue] = useState<InternalContextValue | null>(null);\n\n const registerHandler = useMemo<RegisterHandlerFunction>(() => {\n return (methodName: string, handler: (...args: unknown[]) => unknown) =>\n setHandler(methodName as never, handler as never);\n }, []);\n\n useEffect(() => {\n const handleLinkClick = (event: MouseEvent) => {\n const target = event.target as HTMLElement;\n const linkElement = target.closest<HTMLElement>('[href], [data-href]');\n\n if (!linkElement) return;\n\n const href = linkElement.getAttribute('href') || linkElement.getAttribute('data-href');\n if (!href) return;\n\n if (isInternalUrl(href)) {\n return;\n }\n\n event.preventDefault();\n\n const targetAttr = linkElement.getAttribute('target');\n const newTab = targetAttr === '_blank';\n\n uiApi\n .navigate({\n path: href,\n options: {\n newTab,\n },\n })\n .then(() => {\n console.info(`Navigation: ${href}`);\n })\n .catch((err) => {\n console.error('Navigation error:', err);\n });\n };\n\n document.addEventListener('click', handleLinkClick);\n\n return () => {\n document.removeEventListener('click', handleLinkClick);\n };\n }, []);\n\n useEffect(() => {\n // Prevent double initialization in React StrictMode\n if (initializedRef.current) {\n return;\n }\n\n const initPlugin = async () => {\n try {\n hostApi.init({ autoResize });\n initializedRef.current = true;\n\n const contextLevel = hostApi.getContextLevel();\n const entityId = hostApi.getEntityId();\n const entityMeta = hostApi.getEntityMeta();\n\n setInternalValue({\n slot: hostApi.getSlot(),\n innerUrl: hostApi.getInnerUrl(),\n queryParams: hostApi.getQueryParams(),\n contextLevel,\n entityId,\n entityMeta,\n registerHandler,\n });\n\n if (autoNotifyReady) {\n await hostApi.notifyReady();\n }\n\n // Fetch initial values and prime the eventBus cache so that\n // hooks subscribing after these responses arrive still get the values.\n // For basic contextLevel, skip the context.get postMessage call.\n const [theme, language, context, isYateam, userId, isOrbita] =\n await Promise.allSettled([\n hostApi.getTheme(),\n hostApi.getLanguage(),\n contextLevel === 'full' ? hostApi.getContext() : Promise.resolve(null),\n hostApi.getIsYateam(),\n hostApi.getUserId(),\n hostApi.getIsOrbita(),\n ]);\n\n if (theme.status === 'fulfilled' && theme.value) {\n dispatchHostEvent({\n messageId: '',\n type: 'event',\n method: 'theme.changed',\n result: theme.value,\n });\n }\n if (language.status === 'fulfilled' && language.value) {\n dispatchHostEvent({\n messageId: '',\n type: 'event',\n method: 'language.changed',\n result: language.value,\n });\n }\n\n if (isYateam.status === 'fulfilled' && isYateam.value) {\n dispatchHostEvent({\n messageId: '',\n type: 'event',\n method: 'isYateam.changed',\n result: isYateam.value,\n });\n }\n\n if (isOrbita.status === 'fulfilled') {\n dispatchHostEvent({\n messageId: '',\n type: 'event',\n method: 'isOrbita.changed',\n result: isOrbita.value,\n });\n }\n\n if (userId.status === 'fulfilled' && userId.value) {\n dispatchHostEvent({\n messageId: '',\n type: 'event',\n method: 'userId.changed',\n result: userId.value,\n });\n }\n\n // For basic level, dispatch entityId as context.\n // For full level, dispatch the full context from host.\n if (contextLevel === 'basic') {\n if (entityId) {\n dispatchHostEvent({\n messageId: '',\n type: 'event',\n method: 'context.changed',\n result: { entityId, ...(entityMeta ? { entityMeta } : {}) },\n });\n }\n } else if (context.status === 'fulfilled' && context.value) {\n dispatchHostEvent({\n messageId: '',\n type: 'event',\n method: 'context.changed',\n result: context.value,\n });\n }\n\n setInitialized(true);\n } catch (err) {\n setError(err as Error);\n }\n };\n\n initPlugin();\n }, [autoResize, registerHandler, autoNotifyReady]);\n\n if (error) {\n if (errorFallback) {\n return <>{errorFallback(error)}</>;\n }\n\n return <PluginError error={error} />;\n }\n\n if (!initialized || !internalValue) {\n return <>{fallback}</>;\n }\n\n return (\n <ErrorBoundary\n fallback={errorFallback || ((pluginError) => <PluginError error={pluginError} />)}\n >\n <PluginContext.Provider value={internalValue}>{children}</PluginContext.Provider>\n </ErrorBoundary>\n );\n}\n","import { type ConfirmOptions, type ConfirmResult, uiApi } from '@weavix/sdk-core';\nimport { useCallback } from 'react';\n\nexport type UseConfirmReturn = {\n show: (options: ConfirmOptions) => Promise<ConfirmResult>;\n};\n\nconst useConfirmImpl = () => {\n const show = useCallback((options: ConfirmOptions) => uiApi.confirm.show(options), []);\n\n return { show };\n};\n\nexport const useConfirm = useConfirmImpl as () => UseConfirmReturn;\n","import { type LocalizedString, getLocalizedString } from '@weavix/sdk-core';\nimport { useLanguage } from './useLanguage';\n\nconst useLocalizedStringImpl = (fallbackLanguage = 'ru') => {\n const language = useLanguage();\n\n return (value: LocalizedString): string => {\n return getLocalizedString(value, language, fallbackLanguage);\n };\n};\n\n/**\n * Хук для получения локализованной строки на основе текущего языка из контекста.\n */\nexport const useLocalizedString = useLocalizedStringImpl as (\n fallbackLanguage?: string,\n) => (value: LocalizedString) => string;\n","import {\n HostApi,\n type HostInitOptions,\n type Theme,\n type Unsubscribe,\n dispatchHostEvent,\n on,\n} from '@weavix/sdk-core';\nimport { useEffect, useRef, useState } from 'react';\n\nexport type PluginBootstrapState<TContext> = {\n host: HostApi<TContext>;\n loading: boolean;\n error: string | null;\n theme?: Theme;\n language?: string;\n context?: TContext;\n userId?: string;\n isYateam?: boolean;\n isOrbita?: boolean;\n};\n\nfunction getErrorMessage(error: unknown): string {\n return error instanceof Error ? error.message : 'Unknown plugin bootstrap error';\n}\n\ntype BootstrapEventMethod = Parameters<typeof dispatchHostEvent>[0]['method'];\n\nfunction dispatchInitialValue(method: BootstrapEventMethod, result: unknown) {\n if (result === undefined || result === null) {\n return;\n }\n\n dispatchHostEvent({\n messageId: '',\n type: 'event',\n method,\n result,\n });\n}\n\nexport function usePluginBootstrap<TContext>(\n options: HostInitOptions = {},\n): PluginBootstrapState<TContext> {\n const { autoResize = true } = options;\n const hostRef = useRef<HostApi<TContext> | null>(null);\n\n if (!hostRef.current) {\n hostRef.current = new HostApi<TContext>();\n }\n\n const host = hostRef.current;\n const [loading, setLoading] = useState(true);\n const [error, setError] = useState<string | null>(null);\n const [theme, setTheme] = useState<Theme>();\n const [language, setLanguage] = useState<string>();\n const [context, setContext] = useState<TContext>();\n const [userId, setUserId] = useState<string>();\n const [isYateam, setIsYateam] = useState<boolean>();\n const [isOrbita, setIsOrbita] = useState<boolean>();\n\n useEffect(() => {\n let cancelled = false;\n const unsubscribes: Unsubscribe[] = [];\n\n const subscribe = <M extends Parameters<typeof on>[0]>(\n method: M,\n callback: (value: unknown) => void,\n ) => {\n unsubscribes.push(on(method, callback as never));\n };\n\n try {\n host.init({ autoResize });\n\n subscribe('context.changed', (value) => setContext(value as TContext));\n subscribe('theme.changed', (value) => setTheme(value as Theme));\n subscribe('language.changed', (value) => setLanguage(value as string));\n subscribe('userId.changed', (value) => setUserId(value as string));\n subscribe('isYateam.changed', (value) => setIsYateam(value as boolean));\n subscribe('isOrbita.changed', (value) => setIsOrbita(value as boolean));\n } catch (initError) {\n setError(getErrorMessage(initError));\n setLoading(false);\n\n return () => {\n unsubscribes.forEach((unsubscribe) => unsubscribe());\n host.destroy();\n };\n }\n\n const bootstrap = async () => {\n try {\n const contextPromise =\n host.getContextLevel() === 'full'\n ? host.getContext()\n : Promise.resolve(undefined);\n const [\n resolvedContext,\n resolvedTheme,\n resolvedLanguage,\n resolvedUserId,\n resolvedIsYateam,\n resolvedIsOrbita,\n ] = await Promise.all([\n contextPromise,\n host.getTheme() as Promise<Theme>,\n host.getLanguage() as Promise<string>,\n host.getUserId() as Promise<string | undefined>,\n host.getIsYateam() as Promise<boolean | undefined>,\n host.getIsOrbita() as Promise<boolean | undefined>,\n ]);\n\n if (cancelled) {\n return;\n }\n\n setContext(resolvedContext);\n setTheme(resolvedTheme);\n setLanguage(resolvedLanguage);\n setUserId(resolvedUserId);\n setIsYateam(resolvedIsYateam);\n setIsOrbita(resolvedIsOrbita);\n\n dispatchInitialValue('context.changed', resolvedContext);\n dispatchInitialValue('theme.changed', resolvedTheme);\n dispatchInitialValue('language.changed', resolvedLanguage);\n dispatchInitialValue('userId.changed', resolvedUserId);\n dispatchInitialValue('isYateam.changed', resolvedIsYateam);\n dispatchInitialValue('isOrbita.changed', resolvedIsOrbita);\n\n setLoading(false);\n await host.notifyReady();\n } catch (bootstrapError) {\n if (cancelled) {\n return;\n }\n\n setError(getErrorMessage(bootstrapError));\n setLoading(false);\n }\n };\n\n bootstrap();\n\n return () => {\n cancelled = true;\n unsubscribes.forEach((unsubscribe) => unsubscribe());\n host.destroy();\n };\n }, [autoResize, host]);\n\n return {\n host,\n loading,\n error,\n theme,\n language,\n context,\n userId,\n isYateam,\n isOrbita,\n };\n}\n","import { type ToastOptions, uiApi } from '@weavix/sdk-core';\nimport { useCallback } from 'react';\n\nexport type UseToasterReturn = {\n add: (options: ToastOptions) => Promise<{ name: string }>;\n};\n\nconst useToasterImpl = () => {\n const add = useCallback((options: ToastOptions) => uiApi.toaster.add(options), []);\n\n return { add };\n};\n\nexport const useToaster = useToasterImpl as () => UseToasterReturn;\n"],"mappings":";;;;AAYA,IAAa,IAAb,cAAmC,EAAkD;CACjF,OAAO,yBAAyB,GAAkC;EAC9D,OAAO;GAAE,UAAU;GAAM;EAAM;CACnC;CAEA,YAAY,GAA2B;EAEnC,AADA,MAAM,CAAK,GACX,KAAK,QAAQ;GAAE,UAAU;GAAO,OAAO;EAAK;CAChD;CAEA,kBAAkB,GAAc,GAA4B;EACxD,QAAQ,MAAM,kCAAkC,GAAO,CAAS;CACpE;CAEA,SAAS;EAKL,OAJI,KAAK,MAAM,YAA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AAM,SACrB,EAAK,WAAW,IAChB,QAAQ,QAAQ,KAAA,CAAS,GAC7B,CACF,GACA,GACA,GACA,GACA,GACA,KACA,MAAM,QAAQ,IAAI;KAClB;KACA,EAAK,SAAS;KACd,EAAK,YAAY;KACjB,EAAK,UAAU;KACf,EAAK,YAAY;KACjB,EAAK,YAAY;IACrB,CAAC;IAED,IAAI,GACA;IAkBJ,AAfA,EAAW,CAAe,GAC1B,EAAS,CAAa,GACtB,EAAY,CAAgB,GAC5B,EAAU,CAAc,GACxB,EAAY,CAAgB,GAC5B,EAAY,CAAgB,GAE5B,EAAqB,mBAAmB,CAAe,GACvD,EAAqB,iBAAiB,CAAa,GACnD,EAAqB,oBAAoB,CAAgB,GACzD,EAAqB,kBAAkB,CAAc,GACrD,EAAqB,oBAAoB,CAAgB,GACzD,EAAqB,oBAAoB,CAAgB,GAEzD,EAAW,EAAK,GAChB,MAAM,EAAK,YAAY;GAC3B,SAAS,GAAgB;IACrB,IAAI,GACA;IAIJ,AADA,EAAS,EAAgB,CAAc,CAAC,GACxC,EAAW,EAAK;GACpB;EACJ,GAEU,SAEG;GAGT,AAFA,IAAY,IACZ,EAAa,SAAS,MAAgB,EAAY,CAAC,GACnD,EAAK,QAAQ;EACjB;CACJ,GAAG,CAAC,GAAY,CAAI,CAAC,GAEd;EACH;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACJ;AACJ;ACtJA,IAAa,WAHF,EAAE,KAFG,GAAa,MAA0B,EAAM,QAAQ,IAAI,CAAO,GAAG,CAAC,CAEvE,EAAI"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@weavix/sdk-react",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.28",
|
|
4
4
|
"exports": {
|
|
5
5
|
".": {
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"README.md"
|
|
13
13
|
],
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@weavix/sdk-core": "0.0.
|
|
15
|
+
"@weavix/sdk-core": "0.0.28"
|
|
16
16
|
},
|
|
17
17
|
"peerDependencies": {
|
|
18
18
|
"react": "^18.0.0"
|