@capytale/iframe-react 1.0.2 → 1.0.3
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.js +1 -1
- package/dist/index.es.js +81 -46
- package/package.json +2 -2
package/dist/index.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const w=require("react/jsx-runtime"),u=require("react"),F=require("@capytale/app-agent"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const w=require("react/jsx-runtime"),u=require("react"),F=require("@capytale/app-agent"),x=t=>{let e;const n=new Set,s=(c,p)=>{const S=typeof c=="function"?c(e):c;if(!Object.is(S,e)){const y=e;e=p??(typeof S!="object"||S===null)?S:Object.assign({},e,S),n.forEach(g=>g(e,y))}},i=()=>e,l={setState:s,getState:i,getInitialState:()=>a,subscribe:c=>(n.add(c),()=>n.delete(c))},a=e=t(s,i,l);return l},E=t=>t?x(t):x,M=t=>t;function q(t,e=M){const n=u.useSyncExternalStore(t.subscribe,()=>e(t.getState()),()=>e(t.getInitialState()));return u.useDebugValue(n),n}const h=t=>{const e=E(t),n=s=>q(e,s);return Object.assign(n,e),n},j=t=>t?h(t):h,J=t=>(e,n,s)=>{const i=s.subscribe;return s.subscribe=(r,l,a)=>{let c=r;if(l){const p=(a==null?void 0:a.equalityFn)||Object.is;let S=r(s.getState());c=y=>{const g=r(y);if(!p(S,g)){const T=S;l(S=g,T)}},a!=null&&a.fireImmediately&&l(S,S)}return i(c)},t(e,n,s)},I=J,o=j()(I(t=>({ready:!1,workflow:"current",mode:"assignment",theme:"light",saveCount:0,afterSaveCount:0,isDirtyCount:0,loadedTextContent:null,loadedJsonContent:null,getTextContentFunction:()=>(console.error("getTextContentFunction is not set"),null),getJsonContentFunction:()=>(console.error("getJsonContentFunction is not set"),null),sidebarActions:{},quickActions:{},activitySettings:null,setGetTextContentFunction:e=>{t({getTextContentFunction:e})},setGetJsonContentFunction:e=>{t({getJsonContentFunction:e})},setSidebarActions:e=>{t({sidebarActions:e})},setQuickActions:e=>{t({quickActions:e})},setActivitySettings:e=>{t({activitySettings:e})},incSaveCount:()=>t(e=>({saveCount:e.saveCount+1})),incDirtyCount:()=>t(e=>({isDirtyCount:e.isDirtyCount+1}))}))),$=["meta-player-events:1","meta-player-ui:1","mode:1","reload:1","theme:1","workflow:1","simple-content(text):1","simple-content(json):1","simple-binary-data(text):1","simple-content-eval(text):1","simple-content-eval(json):1"],k={"mode:1":{setMode:t=>{o.setState({mode:t})}},"reload:1":{reloaded:t=>{console.log("Reloaded with state:",t),console.error("Not implemented yet")}},"theme:1":{setTheme:t=>{if(t===null){o.setState({theme:null});return}if(t!=="light"&&t!=="dark"){console.warn(`Invalid theme: ${t}. Expected 'light' or 'dark'.`),o.setState({theme:null});return}o.setState({theme:t})}},"workflow:1":{setWorkflow:t=>{o.setState({workflow:t})}},"simple-content(text):1":{contentSaved:()=>{o.setState(t=>({afterSaveCount:t.afterSaveCount+1}))},getContent:()=>o.getState().getTextContentFunction(),loadContent:t=>{o.setState({loadedTextContent:t})}},"simple-content(json):1":{contentSaved:()=>{o.setState(t=>({afterSaveCount:t.afterSaveCount+1}))},getContent:()=>o.getState().getJsonContentFunction(),loadContent:t=>{o.setState({loadedJsonContent:t})}},"simple-binary-data(text):1":{contentSaved:()=>{o.setState(t=>({afterSaveCount:t.afterSaveCount+1}))},getContent:()=>o.getState().getTextContentFunction(),loadContent:t=>{o.setState({loadedTextContent:t})}},"simple-content-eval(text):1":{contentSaved:()=>{o.setState(t=>({afterSaveCount:t.afterSaveCount+1}))},getContent:()=>o.getState().getTextContentFunction(),loadContent:t=>{o.setState({loadedTextContent:t})},getAssignmentContent:()=>{throw new Error("getAssignmentContent is not implemented for simple-content-eval(text)")}},"simple-content-eval(json):1":{contentSaved:()=>{o.setState(t=>({afterSaveCount:t.afterSaveCount+1}))},getContent:()=>o.getState().getJsonContentFunction(),loadContent:t=>{o.setState({loadedJsonContent:t})},getAssignmentContent:()=>{throw new Error("getAssignmentContent is not implemented for simple-content-eval(json)")}},"simple-content-eval(json):2":{contentSaved:()=>{o.setState(t=>({afterSaveCount:t.afterSaveCount+1}))},getContent:()=>o.getState().getJsonContentFunction(),loadContent:t=>{o.setState({loadedJsonContent:t})},getAssignmentContent:()=>{throw new Error("getAssignmentContent is not implemented for simple-content-eval(json)")}},"simple-content-eval(text):2":{contentSaved:()=>{o.setState(t=>({afterSaveCount:t.afterSaveCount+1}))},getContent:()=>o.getState().getTextContentFunction(),loadContent:t=>{o.setState({loadedTextContent:t})},getAssignmentContent:()=>{throw new Error("getAssignmentContent is not implemented for simple-content-eval(text)")}},"meta-player-ui:1":{executeAction(t){if(t.startsWith("qa")){const n=o.getState().quickActions[t];n?n():console.error(`Quick action not found: ${t}`)}else{const n=o.getState().sidebarActions[t];n?n():console.error(`Sidebar action not found: ${t}`)}},executeFileUpload(t,e){if(t.startsWith("qa")){const s=o.getState().quickActions[t];s?s(e):console.error(`Quick action not found: ${t}`)}else{const s=o.getState().sidebarActions[t];s?s(e):console.error(`Sidebar action not found: ${t}`)}},updateSettings(t){o.setState({activitySettings:t})}},"meta-player-events:1":{handleEvent(t){t==="all-loaded"&&o.setState({ready:!0})}}},f=F.getSocket();function P(t){for(const e of t){if(!$.includes(e)){console.warn(`Contract ${e} is not implemented in Capytale. Skipping plug.`);continue}if(!(e in k)){console.warn(`Contract handler for ${e} is not defined. Skipping plug.`);continue}const n=k[e];f.plug([e],([])=>[n])}f.plugsDone();for(const e of["simple-content(text):1","simple-content(json):1","simple-binary-data(text):1","simple-content-eval(text):1","simple-content-eval(json):1","simple-content-eval(json):2","simple-content-eval(text):2"])if(console.log(`Contract ${e} is being subscribed to content changes.`),t.includes(e)){console.log(`Subscribing to content changes for contract ${e}`);const n=e.split(":")[0];f.use([n],([s])=>{o.subscribe(i=>i.isDirtyCount,()=>{var i;(i=s.i)==null||i.contentChanged(),console.log(`Content changed for contract ${n}`)})})}}function L({children:t,contracts:e,loadOnlyWhenReady:n=!0}){const s=o(i=>i.ready);return u.useEffect(()=>{const i=e.includes("meta-player-events:1")?e:[...e,"meta-player-events:1"];P(i)},[]),n&&!s?w.jsx("div",{className:"container",children:"Chargement en cours..."}):w.jsx("div",{className:"container",children:t})}const R=()=>o(t=>{if(t.mode===null)throw new Error("Mode is not set. Have you used contract 'mode'?");return t.mode}),D=()=>o(t=>{if(t.workflow===null)throw new Error("Workflow is not set. Have you used contract 'workflow'?");return t.workflow}),Q=()=>o(t=>{if(t.theme===null)throw new Error("Theme is not set. Have you used contract 'theme'?");return t.theme}),W=()=>o(t=>t.incSaveCount),N=()=>o(t=>t.incDirtyCount),O=()=>o(t=>t.loadedTextContent),G=()=>o(t=>t.loadedJsonContent),H=t=>{const e=o(n=>n.setGetTextContentFunction);u.useEffect(()=>{e(t)},[t,e])},U=t=>{const e=o(n=>n.setGetJsonContentFunction);u.useEffect(()=>{e(t)},[t,e])},B=t=>{const e=o(n=>n.afterSaveCount);u.useEffect(()=>{e>0&&t()},[e])},V=()=>(t,e)=>{f.use(["meta-player-ui"],([n])=>{var s;if(n.version===0){console.error("Le MétaPlayer ne supporte pas le contrat meta-player-ui");return}(s=n.i)==null||s.previewTextFile(t,e)})},_=()=>(t,e)=>{f.use(["meta-player-ui"],([n])=>{var s;if(n.version===0){console.error("Le MétaPlayer ne supporte pas le contrat meta-player-ui");return}(s=n.i)==null||s.previewImageFile(t,e)})};let C=0,b=0;const z=(t,e)=>{const n=u.useMemo(t,e),s=o(i=>i.setSidebarActions);u.useEffect(()=>(C++,C>1&&console.error("Capytale iframe React: Multiple sidebar actions registered: ",C),()=>{C--}),[]),u.useEffect(()=>(f.use(["meta-player-ui"],([i])=>{var l;if(i.version===0){console.error("Le MétaPlayer ne supporte pas le contrat meta-player-ui");return}b++;const d=n.map((a,c)=>({type:a.type,title:a.title,icon:a.icon,id:`sa-${b}-${c}`,...a.type==="file-upload"?{accept:a.accept}:{}})),r={};n.forEach((a,c)=>{r[`sa-${b}-${c}`]=a.action}),(l=i.i)==null||l.setSidebarActionButtons(d),s(r)}),()=>{s({}),f.use(["meta-player-ui"],([i])=>{var d;if(i.version===0){console.error("Le MétaPlayer ne supporte pas le contrat meta-player-ui");return}(d=i.i)==null||d.setSidebarActionButtons([])})}),[n])};let m=0,A=0;const K=(t,e)=>{const n=u.useMemo(t,e),s=o(i=>i.setQuickActions);u.useEffect(()=>(m++,m>1&&console.error("Capytale iframe React: Multiple quick actions registered: ",m),()=>{m--}),[]),u.useEffect(()=>(f.use(["meta-player-ui"],([i])=>{var l;if(i.version===0){console.error("Le MétaPlayer ne supporte pas le contrat meta-player-ui");return}A++;const d=n.map((a,c)=>({type:a.type,title:a.title,icon:a.icon,id:`qa-${A}-${c}`,...a.type==="file-upload"?{accept:a.accept}:{}})),r={};n.forEach((a,c)=>{r[`qa-${A}-${c}`]=a.action}),(l=i.i)==null||l.setQuickActionButtons(d),s(r)}),()=>{s({}),f.use(["meta-player-ui"],([i])=>{var d;if(i.version===0){console.error("Le MétaPlayer ne supporte pas le contrat meta-player-ui");return}(d=i.i)==null||d.setQuickActionButtons([])})}),[n])};let v=0;const X=(t,e)=>{const n=u.useMemo(t,e),s=o(r=>r.setActivitySettings),i=o(r=>r.activitySettings),d=u.useRef("");return u.useEffect(()=>(console.log("Mounting useSettings"),v++,v>1&&console.error("Capytale iframe React: Multiple settings registered: ",v),()=>{v--}),[]),u.useEffect(()=>{const r=JSON.stringify(n);if(r!==d.current)return d.current=r,f.use(["meta-player-ui"],([l])=>{var a;if(l.version===0){console.error("Le MétaPlayer ne supporte pas le contrat meta-player-ui");return}console.log("Updating settings UI in MetaPlayer",n),(a=l.i)==null||a.setSettingsUI(n)}),()=>{s(null)}},[n]),i},Y=()=>e=>{f.use(["meta-player-ui"],([n])=>{var s;if(n.version===0){console.error("Le MétaPlayer ne supporte pas le contrat meta-player-ui");return}(s=n.i)==null||s.showToast(e)})};exports.Capytale=L;exports.useAfterSaveAction=B;exports.useJsonContentSaveFunction=U;exports.useLoadedJsonContent=G;exports.useLoadedTextContent=O;exports.useMode=R;exports.useNotifyIsDirty=N;exports.usePreviewImageFile=_;exports.usePreviewTextFile=V;exports.useQuickActions=K;exports.useRequestSave=W;exports.useSettings=X;exports.useShowToast=Y;exports.useSidebarActions=z;exports.useTextContentSaveFunction=H;exports.useTheme=Q;exports.useWorkflow=D;
|
package/dist/index.es.js
CHANGED
|
@@ -1,46 +1,46 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import
|
|
3
|
-
import { getSocket as
|
|
1
|
+
import { jsx as x } from "react/jsx-runtime";
|
|
2
|
+
import h, { useEffect as S, useMemo as w, useRef as E } from "react";
|
|
3
|
+
import { getSocket as J } from "@capytale/app-agent";
|
|
4
4
|
const k = (t) => {
|
|
5
5
|
let e;
|
|
6
|
-
const n = /* @__PURE__ */ new Set(), s = (c,
|
|
6
|
+
const n = /* @__PURE__ */ new Set(), s = (c, g) => {
|
|
7
7
|
const d = typeof c == "function" ? c(e) : c;
|
|
8
8
|
if (!Object.is(d, e)) {
|
|
9
|
-
const
|
|
10
|
-
e =
|
|
9
|
+
const y = e;
|
|
10
|
+
e = g ?? (typeof d != "object" || d === null) ? d : Object.assign({}, e, d), n.forEach((f) => f(e, y));
|
|
11
11
|
}
|
|
12
|
-
}, i = () => e,
|
|
13
|
-
return
|
|
14
|
-
},
|
|
15
|
-
function
|
|
16
|
-
const n =
|
|
12
|
+
}, i = () => e, l = { setState: s, getState: i, getInitialState: () => r, subscribe: (c) => (n.add(c), () => n.delete(c)) }, r = e = t(s, i, l);
|
|
13
|
+
return l;
|
|
14
|
+
}, $ = (t) => t ? k(t) : k, j = (t) => t;
|
|
15
|
+
function q(t, e = j) {
|
|
16
|
+
const n = h.useSyncExternalStore(
|
|
17
17
|
t.subscribe,
|
|
18
18
|
() => e(t.getState()),
|
|
19
19
|
() => e(t.getInitialState())
|
|
20
20
|
);
|
|
21
|
-
return
|
|
21
|
+
return h.useDebugValue(n), n;
|
|
22
22
|
}
|
|
23
23
|
const T = (t) => {
|
|
24
|
-
const e =
|
|
24
|
+
const e = $(t), n = (s) => q(e, s);
|
|
25
25
|
return Object.assign(n, e), n;
|
|
26
|
-
},
|
|
26
|
+
}, I = (t) => t ? T(t) : T, P = (t) => (e, n, s) => {
|
|
27
27
|
const i = s.subscribe;
|
|
28
|
-
return s.subscribe = (a,
|
|
28
|
+
return s.subscribe = (a, l, r) => {
|
|
29
29
|
let c = a;
|
|
30
|
-
if (
|
|
31
|
-
const
|
|
30
|
+
if (l) {
|
|
31
|
+
const g = (r == null ? void 0 : r.equalityFn) || Object.is;
|
|
32
32
|
let d = a(s.getState());
|
|
33
|
-
c = (
|
|
34
|
-
const
|
|
35
|
-
if (!
|
|
33
|
+
c = (y) => {
|
|
34
|
+
const f = a(y);
|
|
35
|
+
if (!g(d, f)) {
|
|
36
36
|
const M = d;
|
|
37
|
-
|
|
37
|
+
l(d = f, M);
|
|
38
38
|
}
|
|
39
|
-
}, r != null && r.fireImmediately &&
|
|
39
|
+
}, r != null && r.fireImmediately && l(d, d);
|
|
40
40
|
}
|
|
41
41
|
return i(c);
|
|
42
42
|
}, t(e, n, s);
|
|
43
|
-
}, D = P, o =
|
|
43
|
+
}, D = P, o = I()(
|
|
44
44
|
D((t) => ({
|
|
45
45
|
ready: !1,
|
|
46
46
|
workflow: "current",
|
|
@@ -184,6 +184,38 @@ const T = (t) => {
|
|
|
184
184
|
);
|
|
185
185
|
}
|
|
186
186
|
},
|
|
187
|
+
"simple-content-eval(json):2": {
|
|
188
|
+
contentSaved: () => {
|
|
189
|
+
o.setState((t) => ({
|
|
190
|
+
afterSaveCount: t.afterSaveCount + 1
|
|
191
|
+
}));
|
|
192
|
+
},
|
|
193
|
+
getContent: () => o.getState().getJsonContentFunction(),
|
|
194
|
+
loadContent: (t) => {
|
|
195
|
+
o.setState({ loadedJsonContent: t });
|
|
196
|
+
},
|
|
197
|
+
getAssignmentContent: () => {
|
|
198
|
+
throw new Error(
|
|
199
|
+
"getAssignmentContent is not implemented for simple-content-eval(json)"
|
|
200
|
+
);
|
|
201
|
+
}
|
|
202
|
+
},
|
|
203
|
+
"simple-content-eval(text):2": {
|
|
204
|
+
contentSaved: () => {
|
|
205
|
+
o.setState((t) => ({
|
|
206
|
+
afterSaveCount: t.afterSaveCount + 1
|
|
207
|
+
}));
|
|
208
|
+
},
|
|
209
|
+
getContent: () => o.getState().getTextContentFunction(),
|
|
210
|
+
loadContent: (t) => {
|
|
211
|
+
o.setState({ loadedTextContent: t });
|
|
212
|
+
},
|
|
213
|
+
getAssignmentContent: () => {
|
|
214
|
+
throw new Error(
|
|
215
|
+
"getAssignmentContent is not implemented for simple-content-eval(text)"
|
|
216
|
+
);
|
|
217
|
+
}
|
|
218
|
+
},
|
|
187
219
|
"meta-player-ui:1": {
|
|
188
220
|
executeAction(t) {
|
|
189
221
|
if (t.startsWith("qa")) {
|
|
@@ -212,7 +244,7 @@ const T = (t) => {
|
|
|
212
244
|
t === "all-loaded" && o.setState({ ready: !0 });
|
|
213
245
|
}
|
|
214
246
|
}
|
|
215
|
-
}, p =
|
|
247
|
+
}, p = J();
|
|
216
248
|
function R(t) {
|
|
217
249
|
for (const e of t) {
|
|
218
250
|
if (!L.includes(e)) {
|
|
@@ -235,7 +267,10 @@ function R(t) {
|
|
|
235
267
|
"simple-content(text):1",
|
|
236
268
|
"simple-content(json):1",
|
|
237
269
|
"simple-binary-data(text):1",
|
|
238
|
-
"simple-content-eval(text):1"
|
|
270
|
+
"simple-content-eval(text):1",
|
|
271
|
+
"simple-content-eval(json):1",
|
|
272
|
+
"simple-content-eval(json):2",
|
|
273
|
+
"simple-content-eval(text):2"
|
|
239
274
|
])
|
|
240
275
|
if (console.log(`Contract ${e} is being subscribed to content changes.`), t.includes(e)) {
|
|
241
276
|
console.log(`Subscribing to content changes for contract ${e}`);
|
|
@@ -257,7 +292,7 @@ function G({
|
|
|
257
292
|
return S(() => {
|
|
258
293
|
const i = e.includes("meta-player-events:1") ? e : [...e, "meta-player-events:1"];
|
|
259
294
|
R(i);
|
|
260
|
-
}, []), n && !s ? /* @__PURE__ */
|
|
295
|
+
}, []), n && !s ? /* @__PURE__ */ x("div", { className: "container", children: "Chargement en cours..." }) : /* @__PURE__ */ x("div", { className: "container", children: t });
|
|
261
296
|
}
|
|
262
297
|
const H = () => o((t) => {
|
|
263
298
|
if (t.mode === null)
|
|
@@ -311,17 +346,17 @@ const H = () => o((t) => {
|
|
|
311
346
|
};
|
|
312
347
|
let C = 0, b = 0;
|
|
313
348
|
const et = (t, e) => {
|
|
314
|
-
const n =
|
|
349
|
+
const n = w(t, e), s = o((i) => i.setSidebarActions);
|
|
315
350
|
S(() => (C++, C > 1 && console.error("Capytale iframe React: Multiple sidebar actions registered: ", C), () => {
|
|
316
351
|
C--;
|
|
317
352
|
}), []), S(() => (p.use(["meta-player-ui"], ([i]) => {
|
|
318
|
-
var
|
|
353
|
+
var l;
|
|
319
354
|
if (i.version === 0) {
|
|
320
355
|
console.error("Le MétaPlayer ne supporte pas le contrat meta-player-ui");
|
|
321
356
|
return;
|
|
322
357
|
}
|
|
323
358
|
b++;
|
|
324
|
-
const
|
|
359
|
+
const u = n.map((r, c) => ({
|
|
325
360
|
type: r.type,
|
|
326
361
|
title: r.title,
|
|
327
362
|
icon: r.icon,
|
|
@@ -330,31 +365,31 @@ const et = (t, e) => {
|
|
|
330
365
|
})), a = {};
|
|
331
366
|
n.forEach((r, c) => {
|
|
332
367
|
a[`sa-${b}-${c}`] = r.action;
|
|
333
|
-
}), (
|
|
368
|
+
}), (l = i.i) == null || l.setSidebarActionButtons(u), s(a);
|
|
334
369
|
}), () => {
|
|
335
370
|
s({}), p.use(["meta-player-ui"], ([i]) => {
|
|
336
|
-
var
|
|
371
|
+
var u;
|
|
337
372
|
if (i.version === 0) {
|
|
338
373
|
console.error("Le MétaPlayer ne supporte pas le contrat meta-player-ui");
|
|
339
374
|
return;
|
|
340
375
|
}
|
|
341
|
-
(
|
|
376
|
+
(u = i.i) == null || u.setSidebarActionButtons([]);
|
|
342
377
|
});
|
|
343
378
|
}), [n]);
|
|
344
379
|
};
|
|
345
380
|
let m = 0, A = 0;
|
|
346
381
|
const nt = (t, e) => {
|
|
347
|
-
const n =
|
|
382
|
+
const n = w(t, e), s = o((i) => i.setQuickActions);
|
|
348
383
|
S(() => (m++, m > 1 && console.error("Capytale iframe React: Multiple quick actions registered: ", m), () => {
|
|
349
384
|
m--;
|
|
350
385
|
}), []), S(() => (p.use(["meta-player-ui"], ([i]) => {
|
|
351
|
-
var
|
|
386
|
+
var l;
|
|
352
387
|
if (i.version === 0) {
|
|
353
388
|
console.error("Le MétaPlayer ne supporte pas le contrat meta-player-ui");
|
|
354
389
|
return;
|
|
355
390
|
}
|
|
356
391
|
A++;
|
|
357
|
-
const
|
|
392
|
+
const u = n.map((r, c) => ({
|
|
358
393
|
type: r.type,
|
|
359
394
|
title: r.title,
|
|
360
395
|
icon: r.icon,
|
|
@@ -363,33 +398,33 @@ const nt = (t, e) => {
|
|
|
363
398
|
})), a = {};
|
|
364
399
|
n.forEach((r, c) => {
|
|
365
400
|
a[`qa-${A}-${c}`] = r.action;
|
|
366
|
-
}), (
|
|
401
|
+
}), (l = i.i) == null || l.setQuickActionButtons(u), s(a);
|
|
367
402
|
}), () => {
|
|
368
403
|
s({}), p.use(["meta-player-ui"], ([i]) => {
|
|
369
|
-
var
|
|
404
|
+
var u;
|
|
370
405
|
if (i.version === 0) {
|
|
371
406
|
console.error("Le MétaPlayer ne supporte pas le contrat meta-player-ui");
|
|
372
407
|
return;
|
|
373
408
|
}
|
|
374
|
-
(
|
|
409
|
+
(u = i.i) == null || u.setQuickActionButtons([]);
|
|
375
410
|
});
|
|
376
411
|
}), [n]);
|
|
377
412
|
};
|
|
378
|
-
let
|
|
413
|
+
let v = 0;
|
|
379
414
|
const ot = (t, e) => {
|
|
380
|
-
const n =
|
|
381
|
-
return S(() => (console.log("Mounting useSettings"),
|
|
382
|
-
|
|
415
|
+
const n = w(t, e), s = o((a) => a.setActivitySettings), i = o((a) => a.activitySettings), u = E("");
|
|
416
|
+
return S(() => (console.log("Mounting useSettings"), v++, v > 1 && console.error("Capytale iframe React: Multiple settings registered: ", v), () => {
|
|
417
|
+
v--;
|
|
383
418
|
}), []), S(() => {
|
|
384
419
|
const a = JSON.stringify(n);
|
|
385
|
-
if (a !==
|
|
386
|
-
return
|
|
420
|
+
if (a !== u.current)
|
|
421
|
+
return u.current = a, p.use(["meta-player-ui"], ([l]) => {
|
|
387
422
|
var r;
|
|
388
|
-
if (
|
|
423
|
+
if (l.version === 0) {
|
|
389
424
|
console.error("Le MétaPlayer ne supporte pas le contrat meta-player-ui");
|
|
390
425
|
return;
|
|
391
426
|
}
|
|
392
|
-
console.log("Updating settings UI in MetaPlayer", n), (r =
|
|
427
|
+
console.log("Updating settings UI in MetaPlayer", n), (r = l.i) == null || r.setSettingsUI(n);
|
|
393
428
|
}), () => {
|
|
394
429
|
s(null);
|
|
395
430
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capytale/iframe-react",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"dev": "vite",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
],
|
|
27
27
|
"sideEffects": false,
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@capytale/app-agent": "^1.0.
|
|
29
|
+
"@capytale/app-agent": "^1.0.8",
|
|
30
30
|
"@capytale/contracts": "^1.0.2",
|
|
31
31
|
"zustand": "^5.0.6"
|
|
32
32
|
},
|