@capytale/iframe-react 1.0.4 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +1 -1
- package/dist/index.d.ts +30 -88
- package/dist/index.es.js +306 -191
- package/package.json +4 -4
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"),E=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},M=t=>t?x(t):x,q=t=>t;function j(t,e=q){const n=u.useSyncExternalStore(t.subscribe,()=>e(t.getState()),()=>e(t.getInitialState()));return u.useDebugValue(n),n}const h=t=>{const e=M(t),n=s=>j(e,s);return Object.assign(n,e),n},J=t=>t?h(t):h,I=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 F=S;l(S=g,F)}},a!=null&&a.fireImmediately&&l(S,S)}return i(c)},t(e,n,s)},$=I,o=J()($(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}))})));let k=!1;const P=["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"],T={"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=E.getSocket();function L(t){if(k){console.warn("Contracts have already been plugged. Skipping.");return}k=!0;for(const e of t){if(!P.includes(e)){console.warn(`Contract ${e} is not implemented in Capytale. Skipping plug.`);continue}if(!(e in T)){console.warn(`Contract handler for ${e} is not defined. Skipping plug.`);continue}const n=T[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 R({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"];L(i)},[]),n&&!s?w.jsx("div",{className:"container",children:"Chargement en cours..."}):w.jsx("div",{className:"container",children:t})}const D=()=>o(t=>{if(t.mode===null)throw new Error("Mode is not set. Have you used contract 'mode'?");return t.mode}),Q=()=>o(t=>{if(t.workflow===null)throw new Error("Workflow is not set. Have you used contract 'workflow'?");return t.workflow}),W=()=>o(t=>{if(t.theme===null)throw new Error("Theme is not set. Have you used contract 'theme'?");return t.theme}),N=()=>o(t=>t.incSaveCount),O=()=>o(t=>t.incDirtyCount),G=()=>o(t=>t.loadedTextContent),H=()=>o(t=>t.loadedJsonContent),U=t=>{const e=o(n=>n.setGetTextContentFunction);u.useEffect(()=>{e(t)},[t,e])},B=t=>{const e=o(n=>n.setGetJsonContentFunction);u.useEffect(()=>{e(t)},[t,e])},V=t=>{const e=o(n=>n.afterSaveCount);u.useEffect(()=>{e>0&&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.previewTextFile(t,e)})},z=()=>(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 K=(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 X=(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 Y=(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},Z=()=>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=R;exports.useAfterSaveAction=V;exports.useJsonContentSaveFunction=B;exports.useLoadedJsonContent=H;exports.useLoadedTextContent=G;exports.useMode=D;exports.useNotifyIsDirty=O;exports.usePreviewImageFile=z;exports.usePreviewTextFile=_;exports.useQuickActions=X;exports.useRequestSave=N;exports.useSettings=Y;exports.useShowToast=Z;exports.useSidebarActions=K;exports.useTextContentSaveFunction=U;exports.useTheme=W;exports.useWorkflow=Q;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const F=require("react/jsx-runtime"),c=require("react"),k=require("@capytale/app-agent"),b=t=>{let e;const o=new Set,s=(l,S)=>{const g=typeof l=="function"?l(e):l;if(!Object.is(g,e)){const p=e;e=S??(typeof g!="object"||g===null)?g:Object.assign({},e,g),o.forEach(y=>y(e,p))}},i=()=>e,d={setState:s,getState:i,getInitialState:()=>a,subscribe:l=>(o.add(l),()=>o.delete(l))},a=e=t(s,i,d);return d},T=t=>t?b(t):b,B=t=>t;function E(t,e=B){const o=c.useSyncExternalStore(t.subscribe,c.useCallback(()=>e(t.getState()),[t,e]),c.useCallback(()=>e(t.getInitialState()),[t,e]));return c.useDebugValue(o),o}const w=t=>{const e=T(t),o=s=>E(e,s);return Object.assign(o,e),o},M=t=>t?w(t):w,j=t=>(e,o,s)=>{const i=s.subscribe;return s.subscribe=(u,d,a)=>{let l=u;if(d){const S=(a==null?void 0:a.equalityFn)||Object.is;let g=u(s.getState());l=p=>{const y=u(p);if(!S(g,y)){const D=g;d(g=y,D)}},a!=null&&a.fireImmediately&&d(g,g)}return i(l)},t(e,o,s)},q=j,n=M()(q(t=>({ready:!1,workflow:"current",mode:"assignment",theme:"light",saveCount:0,afterSaveCount:0,isDirtyCount:0,loadedTextContent:null,loadedJsonContent:null,loadedJsonActivityContent:null,loadedJsonAssignmentContent:null,loadedJsonActivityBinaryData:null,loadedJsonAssignmentBinaryData:null,getTextContentFunction:()=>(console.error("getTextContentFunction is not set"),null),getJsonContentFunction:()=>(console.error("getJsonContentFunction is not set"),null),getJsonActivityContentFunction:()=>(console.error("getJsonActivityContentFunction is not set"),null),getJsonAssignmentContentFunction:()=>(console.error("getJsonAssignmentContentFunction is not set"),null),getJsonActivityBinaryDataFunction:()=>(console.error("getJsonActivityBinaryDataFunction is not set"),null),getJsonAssignmentBinaryDataFunction:()=>(console.error("getJsonAssignmentBinaryDataFunction is not set"),null),sidebarActions:{},quickActions:{},activitySettings:null,setGetTextContentFunction:e=>{t({getTextContentFunction:e})},setGetJsonContentFunction:e=>{t({getJsonContentFunction:e})},setGetJsonActivityContentFunction:e=>{t({getJsonActivityContentFunction:e})},setGetJsonAssignmentContentFunction:e=>{t({getJsonAssignmentContentFunction:e})},setGetJsonActivityBinaryDataFunction:e=>{t({getJsonActivityBinaryDataFunction:e})},setGetJsonAssignmentBinaryDataFunction:e=>{t({getJsonAssignmentBinaryDataFunction: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}))})));let h=!1;const L=["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"],x={"mode:1":{setMode:t=>{n.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){n.setState({theme:null});return}if(t!=="light"&&t!=="dark"){console.warn(`Invalid theme: ${t}. Expected 'light' or 'dark'.`),n.setState({theme:null});return}n.setState({theme:t})}},"workflow:1":{setWorkflow:t=>{n.setState({workflow:t})}},"simple-content(text):1":{contentSaved:()=>{n.setState(t=>({afterSaveCount:t.afterSaveCount+1}))},getContent:()=>n.getState().getTextContentFunction(),loadContent:t=>{n.setState({loadedTextContent:t})}},"simple-content(json):1":{contentSaved:()=>{n.setState(t=>({afterSaveCount:t.afterSaveCount+1}))},getContent:()=>n.getState().getJsonContentFunction(),loadContent:t=>{n.setState({loadedJsonContent:t})}},"simple-binary-data(text):1":{contentSaved:()=>{n.setState(t=>({afterSaveCount:t.afterSaveCount+1}))},getContent:()=>n.getState().getTextContentFunction(),loadContent:t=>{n.setState({loadedTextContent:t})}},"simple-content-eval(text):1":{contentSaved:()=>{n.setState(t=>({afterSaveCount:t.afterSaveCount+1}))},getContent:()=>n.getState().getTextContentFunction(),loadContent:t=>{n.setState({loadedTextContent:t})},getAssignmentContent:()=>{throw new Error("getAssignmentContent is not implemented for simple-content-eval(text)")}},"simple-content-eval(json):1":{contentSaved:()=>{n.setState(t=>({afterSaveCount:t.afterSaveCount+1}))},getContent:()=>n.getState().getJsonContentFunction(),loadContent:t=>{n.setState({loadedJsonContent:t})},getAssignmentContent:()=>{throw new Error("getAssignmentContent is not implemented for simple-content-eval(json)")}},"simple-content-eval(json):2":{contentSaved:()=>{n.setState(t=>({afterSaveCount:t.afterSaveCount+1}))},getContent:()=>n.getState().getJsonContentFunction(),loadContent:t=>{n.setState({loadedJsonContent:t})},getAssignmentContent:()=>{throw new Error("getAssignmentContent is not implemented for simple-content-eval(json)")}},"simple-content-eval(text):2":{contentSaved:()=>{n.setState(t=>({afterSaveCount:t.afterSaveCount+1}))},getContent:()=>n.getState().getTextContentFunction(),loadContent:t=>{n.setState({loadedTextContent:t})},getAssignmentContent:()=>{throw new Error("getAssignmentContent is not implemented for simple-content-eval(text)")}},"separate-contents(json):1":{contentSaved:()=>{n.setState(t=>({afterSaveCount:t.afterSaveCount+1}))},loadContent:(t,e)=>{n.setState({loadedJsonActivityContent:t,loadedJsonAssignmentContent:e})},getActivityContent:()=>n.getState().getJsonActivityContentFunction(),getAssignmentContent:()=>n.getState().getJsonAssignmentContentFunction()},"separate-dual-contents(json):1":{contentSaved:()=>{n.setState(t=>({afterSaveCount:t.afterSaveCount+1}))},loadContent:({activityContent:t,assignmentContent:e,activityBinaryData:o,assignmentBinaryData:s})=>{n.setState({loadedJsonActivityContent:t,loadedJsonAssignmentContent:e,loadedJsonActivityBinaryData:o,loadedJsonAssignmentBinaryData:s})},getActivityContentAndData:()=>({content:n.getState().getJsonActivityContentFunction(),binaryData:n.getState().getJsonActivityBinaryDataFunction()}),getAssignmentContentAndData:()=>({content:n.getState().getJsonAssignmentContentFunction(),binaryData:n.getState().getJsonAssignmentBinaryDataFunction()})},"meta-player-anti-cheat:1":{lock:()=>{},unlock:()=>{}},"meta-player-ui:1":{executeAction(t){if(t.startsWith("qa")){const o=n.getState().quickActions[t];o?o():console.error(`Quick action not found: ${t}`)}else{const o=n.getState().sidebarActions[t];o?o():console.error(`Sidebar action not found: ${t}`)}},executeFileUpload(t,e){if(t.startsWith("qa")){const s=n.getState().quickActions[t];s?s(e):console.error(`Quick action not found: ${t}`)}else{const s=n.getState().sidebarActions[t];s?s(e):console.error(`Sidebar action not found: ${t}`)}},updateSettings(t){n.setState({activitySettings:t})}},"meta-player-events:1":{handleEvent(t){t==="all-loaded"&&n.setState({ready:!0})}}},C=k.getSocket();function G(t){if(h){console.warn("Contracts have already been plugged. Skipping.");return}h=!0;for(const e of t){if(!L.includes(e)){console.warn(`Contract ${e} is not implemented in Capytale. Skipping plug.`);continue}if(!(e in x)){console.warn(`Contract handler for ${e} is not defined. Skipping plug.`);continue}const o=x[e];C.plug([e],([])=>[o])}C.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 o=e.split(":")[0];C.use([o],([s])=>{n.subscribe(i=>i.isDirtyCount,()=>{var i;(i=s.i)==null||i.contentChanged(),console.log(`Content changed for contract ${o}`)})})}}const I=["meta-player-events:1","mode:1","workflow:1"];function $({children:t,contracts:e,loadOnlyWhenReady:o=!0}){const s=n(i=>i.ready);return c.useEffect(()=>{const i=[...e];for(const r of I)i.includes(r)||i.push(r);G(i)},[]),o&&!s?F.jsx("div",{className:"container",children:"Chargement en cours..."}):F.jsx("div",{className:"container",children:t})}const P=()=>n(t=>{if(t.mode===null)throw new Error("Mode is not set. Have you used contract 'mode'?");return t.mode}),R=()=>n(t=>{if(t.workflow===null)throw new Error("Workflow is not set. Have you used contract 'workflow'?");return t.workflow}),Q=()=>n(t=>{if(t.theme===null)throw new Error("Theme is not set. Have you used contract 'theme'?");return t.theme}),W=()=>n(t=>t.incSaveCount),N=()=>n(t=>t.incDirtyCount),O=()=>n(t=>t.loadedTextContent),H=()=>n(t=>t.loadedJsonContent),U=()=>n(t=>t.loadedJsonActivityContent),V=()=>n(t=>t.loadedJsonAssignmentContent),_=()=>n(t=>t.loadedJsonActivityBinaryData),z=()=>n(t=>t.loadedJsonAssignmentBinaryData),K=t=>{const e=n(o=>o.setGetTextContentFunction);c.useEffect(()=>{e(t)},[t,e])},X=t=>{const e=n(o=>o.setGetJsonContentFunction);c.useEffect(()=>{e(t)},[t,e])},Y=t=>{const e=n(o=>o.setGetJsonActivityContentFunction);c.useEffect(()=>{e(t)},[t,e])},Z=t=>{const e=n(o=>o.setGetJsonAssignmentContentFunction);c.useEffect(()=>{e(t)},[t,e])},tt=t=>{const e=n(o=>o.setGetJsonActivityBinaryDataFunction);c.useEffect(()=>{e(t)},[t,e])},et=t=>{const e=n(o=>o.setGetJsonAssignmentBinaryDataFunction);c.useEffect(()=>{e(t)},[t,e])},nt=t=>{const e=n(o=>o.afterSaveCount);c.useEffect(()=>{e>0&&t()},[e])},ot=()=>(t,e)=>{C.use(["meta-player-ui"],([o])=>{var s;if(o.version===0){console.error("Le MétaPlayer ne supporte pas le contrat meta-player-ui");return}(s=o.i)==null||s.previewTextFile(t,e)})},st=()=>(t,e)=>{C.use(["meta-player-ui"],([o])=>{var s;if(o.version===0){console.error("Le MétaPlayer ne supporte pas le contrat meta-player-ui");return}(s=o.i)==null||s.previewImageFile(t,e)})};let v=0,A=0;const it=(t,e)=>{const o=c.useMemo(t,e),s=n(i=>i.setSidebarActions);c.useEffect(()=>(v++,v>1&&console.error("Capytale iframe React: Multiple sidebar actions registered: ",v),()=>{v--}),[]),c.useEffect(()=>(C.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}A++;const r=o.map((a,l)=>({type:a.type,title:a.title,icon:a.icon,id:`sa-${A}-${l}`,...a.type==="file-upload"?{accept:a.accept}:{}})),u={};o.forEach((a,l)=>{u[`sa-${A}-${l}`]=a.action}),(d=i.i)==null||d.setSidebarActionButtons(r),s(u)}),()=>{s({}),C.use(["meta-player-ui"],([i])=>{var r;if(i.version===0){console.error("Le MétaPlayer ne supporte pas le contrat meta-player-ui");return}(r=i.i)==null||r.setSidebarActionButtons([])})}),[o])};let f=0,J=0;const at=(t,e)=>{const o=c.useMemo(t,e),s=n(i=>i.setQuickActions);c.useEffect(()=>(f++,f>1&&console.error("Capytale iframe React: Multiple quick actions registered: ",f),()=>{f--}),[]),c.useEffect(()=>(C.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}J++;const r=o.map((a,l)=>({type:a.type,title:a.title,icon:a.icon,id:`qa-${J}-${l}`,...a.type==="file-upload"?{accept:a.accept}:{}})),u={};o.forEach((a,l)=>{u[`qa-${J}-${l}`]=a.action}),(d=i.i)==null||d.setQuickActionButtons(r),s(u)}),()=>{s({}),C.use(["meta-player-ui"],([i])=>{var r;if(i.version===0){console.error("Le MétaPlayer ne supporte pas le contrat meta-player-ui");return}(r=i.i)==null||r.setQuickActionButtons([])})}),[o])};let m=0;const ct=(t,e)=>{const o=c.useMemo(t,e),s=n(u=>u.setActivitySettings),i=n(u=>u.activitySettings),r=c.useRef("");return c.useEffect(()=>(console.log("Mounting useSettings"),m++,m>1&&console.error("Capytale iframe React: Multiple settings registered: ",m),()=>{m--}),[]),c.useEffect(()=>{const u=JSON.stringify(o);if(u!==r.current)return r.current=u,C.use(["meta-player-ui"],([d])=>{var a;if(d.version===0){console.error("Le MétaPlayer ne supporte pas le contrat meta-player-ui");return}console.log("Updating settings UI in MetaPlayer",o),(a=d.i)==null||a.setSettingsUI(o)}),()=>{s(null)}},[o]),i},rt=()=>e=>{C.use(["meta-player-ui"],([o])=>{var s;if(o.version===0){console.error("Le MétaPlayer ne supporte pas le contrat meta-player-ui");return}(s=o.i)==null||s.showToast(e)})};exports.Capytale=$;exports.useAfterSaveAction=nt;exports.useJsonActivityBinaryDataSaveFunction=tt;exports.useJsonActivityContentSaveFunction=Y;exports.useJsonAssignmentBinaryDataSaveFunction=et;exports.useJsonAssignmentContentSaveFunction=Z;exports.useJsonContentSaveFunction=X;exports.useLoadedJsonActivityBinaryData=_;exports.useLoadedJsonActivityContent=U;exports.useLoadedJsonAssignmentBinaryData=z;exports.useLoadedJsonAssignmentContent=V;exports.useLoadedJsonContent=H;exports.useLoadedTextContent=O;exports.useMode=P;exports.useNotifyIsDirty=N;exports.usePreviewImageFile=st;exports.usePreviewTextFile=ot;exports.useQuickActions=at;exports.useRequestSave=W;exports.useSettings=ct;exports.useShowToast=rt;exports.useSidebarActions=it;exports.useTextContentSaveFunction=K;exports.useTheme=Q;exports.useWorkflow=R;
|
package/dist/index.d.ts
CHANGED
|
@@ -108,12 +108,14 @@ declare type AddIdData<C, I extends {
|
|
|
108
108
|
[Index in keyof C]: AddId<C[Index], I>;
|
|
109
109
|
} : AddId<C, I>;
|
|
110
110
|
|
|
111
|
+
declare type AllContractNames = keyof AllContracts;
|
|
112
|
+
|
|
111
113
|
declare type AllContracts = CapytaleContracts & CustomContracts;
|
|
112
114
|
|
|
113
115
|
export declare function Capytale({ children, contracts, loadOnlyWhenReady, }: PropsWithChildren<CapytaleProps>): JSX_2.Element;
|
|
114
116
|
|
|
115
117
|
declare type CapytaleProps = {
|
|
116
|
-
contracts:
|
|
118
|
+
contracts: ContractNamesExceptForced[];
|
|
117
119
|
loadOnlyWhenReady?: boolean;
|
|
118
120
|
};
|
|
119
121
|
|
|
@@ -127,15 +129,16 @@ declare type CollectionOf<T extends {
|
|
|
127
129
|
version: number;
|
|
128
130
|
}[]> = Indexed<IdContractTuple<T>>;
|
|
129
131
|
|
|
132
|
+
declare type ContractNamesExceptForced = Exclude<AllContractNames, ForcedContactNames>;
|
|
133
|
+
|
|
130
134
|
declare type CustomContracts = CollectionOf<[
|
|
131
|
-
AddIdData<
|
|
132
|
-
name: "meta-player-
|
|
133
|
-
}>,
|
|
134
|
-
AddIdData<MetaPlayerEventsV1, {
|
|
135
|
-
name: "meta-player-events";
|
|
135
|
+
AddIdData<MetaPlayerAntiCheatV1, {
|
|
136
|
+
name: "meta-player-anti-cheat";
|
|
136
137
|
}>
|
|
137
138
|
]>;
|
|
138
139
|
|
|
140
|
+
declare type ForcedContactNames = "meta-player-events:1" | "mode:1" | "workflow:1";
|
|
141
|
+
|
|
139
142
|
declare type IdContractTuple<T extends {
|
|
140
143
|
name: string;
|
|
141
144
|
version: number;
|
|
@@ -159,87 +162,21 @@ declare type Indexed<L extends [string, unknown]> = {
|
|
|
159
162
|
[I in L[0]]: Extract<L, [I, any]>[1];
|
|
160
163
|
};
|
|
161
164
|
|
|
162
|
-
declare type
|
|
163
|
-
version: 1;
|
|
164
|
-
/**
|
|
165
|
-
* L'interface qui expose le *MetaPlayer* à l'*Application*.
|
|
166
|
-
*/
|
|
167
|
-
metaplayer: {};
|
|
168
|
-
/**
|
|
169
|
-
* L'interface qui expose l'*Application* au *MetaPlayer*.
|
|
170
|
-
*/
|
|
171
|
-
application: {
|
|
172
|
-
/**
|
|
173
|
-
* Le *MetaPlayer* appelle cette méthode pour indiquer à l'*Application* qu'un événement a eu lieu.
|
|
174
|
-
*
|
|
175
|
-
* @param event l'identifiant de l'événement qui a eu lieu (pour l'instant seulement "all-loaded", qui indique que tous les contrats liés au chargement initial de l'activité ont été appelés par le *MetaPlayer*).
|
|
176
|
-
*/
|
|
177
|
-
handleEvent(event: "all-loaded" | (string & {})): void;
|
|
178
|
-
};
|
|
179
|
-
};
|
|
180
|
-
|
|
181
|
-
declare type MetaPlayerUIV1 = {
|
|
165
|
+
declare type MetaPlayerAntiCheatV1 = {
|
|
182
166
|
version: 1;
|
|
183
167
|
/**
|
|
184
168
|
* L'interface qui expose le *MetaPlayer* à l'*Application*.
|
|
185
169
|
*/
|
|
186
170
|
metaplayer: {
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
* @param actions Un tableau d'objets décrivant les boutons d'action rapide.
|
|
190
|
-
*/
|
|
191
|
-
setQuickActionButtons(actions: QuickActionInfo[]): void;
|
|
192
|
-
/**
|
|
193
|
-
* L'*Application* peut appeler cette méthode pour définir les boutons d'action dans la barre latérale.
|
|
194
|
-
* @param actions Un tableau d'objets décrivant les boutons d'action dans la barre latérale.
|
|
195
|
-
*/
|
|
196
|
-
setSidebarActionButtons(actions: QuickActionInfo[]): void;
|
|
197
|
-
/**
|
|
198
|
-
* L'*Application* peut appeler cette méthode pour définir l'interface utilisateur des paramètres de l'activité.
|
|
199
|
-
* @param settingsUI Un objet décrivant l'interface utilisateur des paramètres de l'activité.
|
|
200
|
-
*/
|
|
201
|
-
setSettingsUI(settingsUI: ActivitySettings | null): void;
|
|
202
|
-
/**
|
|
203
|
-
* L'*Application* peut appeler cette méthode pour demander au *MetaPlayer* de prévisualiser un fichier texte.
|
|
204
|
-
* @param title le titre du fichier texte à prévisualiser.
|
|
205
|
-
* @param content le contenu du fichier texte à prévisualiser.
|
|
206
|
-
*/
|
|
207
|
-
previewTextFile(title: string, content: string): void;
|
|
208
|
-
/**
|
|
209
|
-
* L'*Application* peut appeler cette méthode pour demander au *MetaPlayer* de prévisualiser un fichier image.
|
|
210
|
-
* @param title le titre du fichier image à prévisualiser.
|
|
211
|
-
* @param url l'URL du fichier image à prévisualiser.
|
|
212
|
-
*/
|
|
213
|
-
previewImageFile(title: string, url: string): void;
|
|
214
|
-
/**
|
|
215
|
-
* L'*Application* peut appeler cette méthode pour afficher une notification.
|
|
216
|
-
* @param message Un objet décrivant le message à afficher.
|
|
217
|
-
*/
|
|
218
|
-
showToast(message: MPToastMessage): void;
|
|
171
|
+
reportGainedFocus(): void;
|
|
172
|
+
reportLostFocus(): void;
|
|
219
173
|
};
|
|
220
174
|
/**
|
|
221
175
|
* L'interface qui expose l'*Application* au *MetaPlayer*.
|
|
222
176
|
*/
|
|
223
177
|
application: {
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
*
|
|
227
|
-
* @param id l'identifiant de l'action associée au bouton cliqué.
|
|
228
|
-
*/
|
|
229
|
-
executeAction(id: string): void;
|
|
230
|
-
/**
|
|
231
|
-
* Le *MetaPlayer* appelle cette méthode pour indiquer à l'*Application* que l'utilisateur a cliqué sur un bouton de type file-upload.
|
|
232
|
-
*
|
|
233
|
-
* @param id l'identifiant de l'action associée au bouton cliqué.
|
|
234
|
-
* @param file le fichier chargé par l'utilisateur.
|
|
235
|
-
*/
|
|
236
|
-
executeFileUpload(id: string, file: File): void;
|
|
237
|
-
/**
|
|
238
|
-
* Le *MetaPlayer* appelle cette méthode pour indiquer à l'*Application* que l'utilisateur a modifié les paramètres de l'activité.
|
|
239
|
-
*
|
|
240
|
-
* @param settingsUI Un objet décrivant l'interface utilisateur des paramètres de l'activité.
|
|
241
|
-
*/
|
|
242
|
-
updateSettings(settingsUI: ActivitySettings | null): void;
|
|
178
|
+
lock(): void;
|
|
179
|
+
unlock(): void;
|
|
243
180
|
};
|
|
244
181
|
};
|
|
245
182
|
|
|
@@ -270,21 +207,26 @@ declare type MPToastMessage = {
|
|
|
270
207
|
life?: number;
|
|
271
208
|
};
|
|
272
209
|
|
|
273
|
-
declare type QuickActionInfo = {
|
|
274
|
-
title: string;
|
|
275
|
-
icon: string;
|
|
276
|
-
id: string;
|
|
277
|
-
} & ({
|
|
278
|
-
type: "action";
|
|
279
|
-
} | {
|
|
280
|
-
type: "file-upload";
|
|
281
|
-
accept?: string;
|
|
282
|
-
});
|
|
283
|
-
|
|
284
210
|
export declare const useAfterSaveAction: (fn: () => any) => void;
|
|
285
211
|
|
|
212
|
+
export declare const useJsonActivityBinaryDataSaveFunction: (fn: () => any) => void;
|
|
213
|
+
|
|
214
|
+
export declare const useJsonActivityContentSaveFunction: (fn: () => any) => void;
|
|
215
|
+
|
|
216
|
+
export declare const useJsonAssignmentBinaryDataSaveFunction: (fn: () => any) => void;
|
|
217
|
+
|
|
218
|
+
export declare const useJsonAssignmentContentSaveFunction: (fn: () => any) => void;
|
|
219
|
+
|
|
286
220
|
export declare const useJsonContentSaveFunction: (fn: () => any) => void;
|
|
287
221
|
|
|
222
|
+
export declare const useLoadedJsonActivityBinaryData: () => any;
|
|
223
|
+
|
|
224
|
+
export declare const useLoadedJsonActivityContent: () => any;
|
|
225
|
+
|
|
226
|
+
export declare const useLoadedJsonAssignmentBinaryData: () => any;
|
|
227
|
+
|
|
228
|
+
export declare const useLoadedJsonAssignmentContent: () => any;
|
|
229
|
+
|
|
288
230
|
export declare const useLoadedJsonContent: () => any;
|
|
289
231
|
|
|
290
232
|
export declare const useLoadedTextContent: () => string | null;
|
package/dist/index.es.js
CHANGED
|
@@ -1,47 +1,47 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import
|
|
3
|
-
import { getSocket as
|
|
4
|
-
const
|
|
1
|
+
import { jsx as w } from "react/jsx-runtime";
|
|
2
|
+
import m, { useEffect as d, useMemo as b, useRef as B } from "react";
|
|
3
|
+
import { getSocket as M } from "@capytale/app-agent";
|
|
4
|
+
const h = (t) => {
|
|
5
5
|
let e;
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
if (!Object.is(
|
|
9
|
-
const
|
|
10
|
-
e =
|
|
6
|
+
const o = /* @__PURE__ */ new Set(), s = (u, S) => {
|
|
7
|
+
const g = typeof u == "function" ? u(e) : u;
|
|
8
|
+
if (!Object.is(g, e)) {
|
|
9
|
+
const A = e;
|
|
10
|
+
e = S ?? (typeof g != "object" || g === null) ? g : Object.assign({}, e, g), o.forEach((y) => y(e, A));
|
|
11
11
|
}
|
|
12
|
-
}, i = () => e, l = { setState: s, getState: i, getInitialState: () =>
|
|
12
|
+
}, i = () => e, l = { setState: s, getState: i, getInitialState: () => a, subscribe: (u) => (o.add(u), () => o.delete(u)) }, a = e = t(s, i, l);
|
|
13
13
|
return l;
|
|
14
|
-
}, j = (t) => t ?
|
|
15
|
-
function
|
|
16
|
-
const
|
|
14
|
+
}, j = (t) => t ? h(t) : h, E = (t) => t;
|
|
15
|
+
function G(t, e = E) {
|
|
16
|
+
const o = m.useSyncExternalStore(
|
|
17
17
|
t.subscribe,
|
|
18
|
-
() => e(t.getState()),
|
|
19
|
-
() => e(t.getInitialState())
|
|
18
|
+
m.useCallback(() => e(t.getState()), [t, e]),
|
|
19
|
+
m.useCallback(() => e(t.getInitialState()), [t, e])
|
|
20
20
|
);
|
|
21
|
-
return
|
|
21
|
+
return m.useDebugValue(o), o;
|
|
22
22
|
}
|
|
23
|
-
const
|
|
24
|
-
const e = j(t),
|
|
25
|
-
return Object.assign(
|
|
26
|
-
},
|
|
23
|
+
const x = (t) => {
|
|
24
|
+
const e = j(t), o = (s) => G(e, s);
|
|
25
|
+
return Object.assign(o, e), o;
|
|
26
|
+
}, $ = (t) => t ? x(t) : x, q = (t) => (e, o, s) => {
|
|
27
27
|
const i = s.subscribe;
|
|
28
|
-
return s.subscribe = (
|
|
29
|
-
let
|
|
28
|
+
return s.subscribe = (r, l, a) => {
|
|
29
|
+
let u = r;
|
|
30
30
|
if (l) {
|
|
31
|
-
const
|
|
32
|
-
let
|
|
33
|
-
|
|
34
|
-
const
|
|
35
|
-
if (!g
|
|
36
|
-
const
|
|
37
|
-
l(
|
|
31
|
+
const S = (a == null ? void 0 : a.equalityFn) || Object.is;
|
|
32
|
+
let g = r(s.getState());
|
|
33
|
+
u = (A) => {
|
|
34
|
+
const y = r(A);
|
|
35
|
+
if (!S(g, y)) {
|
|
36
|
+
const T = g;
|
|
37
|
+
l(g = y, T);
|
|
38
38
|
}
|
|
39
|
-
},
|
|
39
|
+
}, a != null && a.fireImmediately && l(g, g);
|
|
40
40
|
}
|
|
41
|
-
return i(
|
|
42
|
-
}, t(e,
|
|
43
|
-
},
|
|
44
|
-
|
|
41
|
+
return i(u);
|
|
42
|
+
}, t(e, o, s);
|
|
43
|
+
}, I = q, n = $()(
|
|
44
|
+
I((t) => ({
|
|
45
45
|
ready: !1,
|
|
46
46
|
workflow: "current",
|
|
47
47
|
mode: "assignment",
|
|
@@ -51,8 +51,16 @@ const T = (t) => {
|
|
|
51
51
|
isDirtyCount: 0,
|
|
52
52
|
loadedTextContent: null,
|
|
53
53
|
loadedJsonContent: null,
|
|
54
|
+
loadedJsonActivityContent: null,
|
|
55
|
+
loadedJsonAssignmentContent: null,
|
|
56
|
+
loadedJsonActivityBinaryData: null,
|
|
57
|
+
loadedJsonAssignmentBinaryData: null,
|
|
54
58
|
getTextContentFunction: () => (console.error("getTextContentFunction is not set"), null),
|
|
55
59
|
getJsonContentFunction: () => (console.error("getJsonContentFunction is not set"), null),
|
|
60
|
+
getJsonActivityContentFunction: () => (console.error("getJsonActivityContentFunction is not set"), null),
|
|
61
|
+
getJsonAssignmentContentFunction: () => (console.error("getJsonAssignmentContentFunction is not set"), null),
|
|
62
|
+
getJsonActivityBinaryDataFunction: () => (console.error("getJsonActivityBinaryDataFunction is not set"), null),
|
|
63
|
+
getJsonAssignmentBinaryDataFunction: () => (console.error("getJsonAssignmentBinaryDataFunction is not set"), null),
|
|
56
64
|
sidebarActions: {},
|
|
57
65
|
quickActions: {},
|
|
58
66
|
activitySettings: null,
|
|
@@ -62,6 +70,18 @@ const T = (t) => {
|
|
|
62
70
|
setGetJsonContentFunction: (e) => {
|
|
63
71
|
t({ getJsonContentFunction: e });
|
|
64
72
|
},
|
|
73
|
+
setGetJsonActivityContentFunction: (e) => {
|
|
74
|
+
t({ getJsonActivityContentFunction: e });
|
|
75
|
+
},
|
|
76
|
+
setGetJsonAssignmentContentFunction: (e) => {
|
|
77
|
+
t({ getJsonAssignmentContentFunction: e });
|
|
78
|
+
},
|
|
79
|
+
setGetJsonActivityBinaryDataFunction: (e) => {
|
|
80
|
+
t({ getJsonActivityBinaryDataFunction: e });
|
|
81
|
+
},
|
|
82
|
+
setGetJsonAssignmentBinaryDataFunction: (e) => {
|
|
83
|
+
t({ getJsonAssignmentBinaryDataFunction: e });
|
|
84
|
+
},
|
|
65
85
|
setSidebarActions: (e) => {
|
|
66
86
|
t({ sidebarActions: e });
|
|
67
87
|
},
|
|
@@ -77,8 +97,8 @@ const T = (t) => {
|
|
|
77
97
|
incDirtyCount: () => t((e) => ({ isDirtyCount: e.isDirtyCount + 1 }))
|
|
78
98
|
}))
|
|
79
99
|
);
|
|
80
|
-
let
|
|
81
|
-
const
|
|
100
|
+
let k = !1;
|
|
101
|
+
const L = [
|
|
82
102
|
"meta-player-events:1",
|
|
83
103
|
"meta-player-ui:1",
|
|
84
104
|
"mode:1",
|
|
@@ -90,10 +110,10 @@ const R = [
|
|
|
90
110
|
"simple-binary-data(text):1",
|
|
91
111
|
"simple-content-eval(text):1",
|
|
92
112
|
"simple-content-eval(json):1"
|
|
93
|
-
],
|
|
113
|
+
], D = {
|
|
94
114
|
"mode:1": {
|
|
95
115
|
setMode: (t) => {
|
|
96
|
-
|
|
116
|
+
n.setState({ mode: t });
|
|
97
117
|
}
|
|
98
118
|
},
|
|
99
119
|
"reload:1": {
|
|
@@ -104,65 +124,63 @@ const R = [
|
|
|
104
124
|
"theme:1": {
|
|
105
125
|
setTheme: (t) => {
|
|
106
126
|
if (t === null) {
|
|
107
|
-
|
|
127
|
+
n.setState({ theme: null });
|
|
108
128
|
return;
|
|
109
129
|
}
|
|
110
130
|
if (t !== "light" && t !== "dark") {
|
|
111
|
-
console.warn(
|
|
112
|
-
`Invalid theme: ${t}. Expected 'light' or 'dark'.`
|
|
113
|
-
), o.setState({ theme: null });
|
|
131
|
+
console.warn(`Invalid theme: ${t}. Expected 'light' or 'dark'.`), n.setState({ theme: null });
|
|
114
132
|
return;
|
|
115
133
|
}
|
|
116
|
-
|
|
134
|
+
n.setState({ theme: t });
|
|
117
135
|
}
|
|
118
136
|
},
|
|
119
137
|
"workflow:1": {
|
|
120
138
|
setWorkflow: (t) => {
|
|
121
|
-
|
|
139
|
+
n.setState({ workflow: t });
|
|
122
140
|
}
|
|
123
141
|
},
|
|
124
142
|
"simple-content(text):1": {
|
|
125
143
|
contentSaved: () => {
|
|
126
|
-
|
|
144
|
+
n.setState((t) => ({
|
|
127
145
|
afterSaveCount: t.afterSaveCount + 1
|
|
128
146
|
}));
|
|
129
147
|
},
|
|
130
|
-
getContent: () =>
|
|
148
|
+
getContent: () => n.getState().getTextContentFunction(),
|
|
131
149
|
loadContent: (t) => {
|
|
132
|
-
|
|
150
|
+
n.setState({ loadedTextContent: t });
|
|
133
151
|
}
|
|
134
152
|
},
|
|
135
153
|
"simple-content(json):1": {
|
|
136
154
|
contentSaved: () => {
|
|
137
|
-
|
|
155
|
+
n.setState((t) => ({
|
|
138
156
|
afterSaveCount: t.afterSaveCount + 1
|
|
139
157
|
}));
|
|
140
158
|
},
|
|
141
|
-
getContent: () =>
|
|
159
|
+
getContent: () => n.getState().getJsonContentFunction(),
|
|
142
160
|
loadContent: (t) => {
|
|
143
|
-
|
|
161
|
+
n.setState({ loadedJsonContent: t });
|
|
144
162
|
}
|
|
145
163
|
},
|
|
146
164
|
"simple-binary-data(text):1": {
|
|
147
165
|
contentSaved: () => {
|
|
148
|
-
|
|
166
|
+
n.setState((t) => ({
|
|
149
167
|
afterSaveCount: t.afterSaveCount + 1
|
|
150
168
|
}));
|
|
151
169
|
},
|
|
152
|
-
getContent: () =>
|
|
170
|
+
getContent: () => n.getState().getTextContentFunction(),
|
|
153
171
|
loadContent: (t) => {
|
|
154
|
-
|
|
172
|
+
n.setState({ loadedTextContent: t });
|
|
155
173
|
}
|
|
156
174
|
},
|
|
157
175
|
"simple-content-eval(text):1": {
|
|
158
176
|
contentSaved: () => {
|
|
159
|
-
|
|
177
|
+
n.setState((t) => ({
|
|
160
178
|
afterSaveCount: t.afterSaveCount + 1
|
|
161
179
|
}));
|
|
162
180
|
},
|
|
163
|
-
getContent: () =>
|
|
181
|
+
getContent: () => n.getState().getTextContentFunction(),
|
|
164
182
|
loadContent: (t) => {
|
|
165
|
-
|
|
183
|
+
n.setState({ loadedTextContent: t });
|
|
166
184
|
},
|
|
167
185
|
getAssignmentContent: () => {
|
|
168
186
|
throw new Error(
|
|
@@ -172,13 +190,13 @@ const R = [
|
|
|
172
190
|
},
|
|
173
191
|
"simple-content-eval(json):1": {
|
|
174
192
|
contentSaved: () => {
|
|
175
|
-
|
|
193
|
+
n.setState((t) => ({
|
|
176
194
|
afterSaveCount: t.afterSaveCount + 1
|
|
177
195
|
}));
|
|
178
196
|
},
|
|
179
|
-
getContent: () =>
|
|
197
|
+
getContent: () => n.getState().getJsonContentFunction(),
|
|
180
198
|
loadContent: (t) => {
|
|
181
|
-
|
|
199
|
+
n.setState({ loadedJsonContent: t });
|
|
182
200
|
},
|
|
183
201
|
getAssignmentContent: () => {
|
|
184
202
|
throw new Error(
|
|
@@ -188,13 +206,13 @@ const R = [
|
|
|
188
206
|
},
|
|
189
207
|
"simple-content-eval(json):2": {
|
|
190
208
|
contentSaved: () => {
|
|
191
|
-
|
|
209
|
+
n.setState((t) => ({
|
|
192
210
|
afterSaveCount: t.afterSaveCount + 1
|
|
193
211
|
}));
|
|
194
212
|
},
|
|
195
|
-
getContent: () =>
|
|
213
|
+
getContent: () => n.getState().getJsonContentFunction(),
|
|
196
214
|
loadContent: (t) => {
|
|
197
|
-
|
|
215
|
+
n.setState({ loadedJsonContent: t });
|
|
198
216
|
},
|
|
199
217
|
getAssignmentContent: () => {
|
|
200
218
|
throw new Error(
|
|
@@ -204,13 +222,13 @@ const R = [
|
|
|
204
222
|
},
|
|
205
223
|
"simple-content-eval(text):2": {
|
|
206
224
|
contentSaved: () => {
|
|
207
|
-
|
|
225
|
+
n.setState((t) => ({
|
|
208
226
|
afterSaveCount: t.afterSaveCount + 1
|
|
209
227
|
}));
|
|
210
228
|
},
|
|
211
|
-
getContent: () =>
|
|
229
|
+
getContent: () => n.getState().getTextContentFunction(),
|
|
212
230
|
loadContent: (t) => {
|
|
213
|
-
|
|
231
|
+
n.setState({ loadedTextContent: t });
|
|
214
232
|
},
|
|
215
233
|
getAssignmentContent: () => {
|
|
216
234
|
throw new Error(
|
|
@@ -218,58 +236,107 @@ const R = [
|
|
|
218
236
|
);
|
|
219
237
|
}
|
|
220
238
|
},
|
|
239
|
+
"separate-contents(json):1": {
|
|
240
|
+
contentSaved: () => {
|
|
241
|
+
n.setState((t) => ({
|
|
242
|
+
afterSaveCount: t.afterSaveCount + 1
|
|
243
|
+
}));
|
|
244
|
+
},
|
|
245
|
+
loadContent: (t, e) => {
|
|
246
|
+
n.setState({
|
|
247
|
+
loadedJsonActivityContent: t,
|
|
248
|
+
loadedJsonAssignmentContent: e
|
|
249
|
+
});
|
|
250
|
+
},
|
|
251
|
+
getActivityContent: () => n.getState().getJsonActivityContentFunction(),
|
|
252
|
+
getAssignmentContent: () => n.getState().getJsonAssignmentContentFunction()
|
|
253
|
+
},
|
|
254
|
+
"separate-dual-contents(json):1": {
|
|
255
|
+
contentSaved: () => {
|
|
256
|
+
n.setState((t) => ({
|
|
257
|
+
afterSaveCount: t.afterSaveCount + 1
|
|
258
|
+
}));
|
|
259
|
+
},
|
|
260
|
+
loadContent: ({
|
|
261
|
+
activityContent: t,
|
|
262
|
+
assignmentContent: e,
|
|
263
|
+
activityBinaryData: o,
|
|
264
|
+
assignmentBinaryData: s
|
|
265
|
+
}) => {
|
|
266
|
+
n.setState({
|
|
267
|
+
loadedJsonActivityContent: t,
|
|
268
|
+
loadedJsonAssignmentContent: e,
|
|
269
|
+
loadedJsonActivityBinaryData: o,
|
|
270
|
+
loadedJsonAssignmentBinaryData: s
|
|
271
|
+
});
|
|
272
|
+
},
|
|
273
|
+
getActivityContentAndData: () => ({
|
|
274
|
+
content: n.getState().getJsonActivityContentFunction(),
|
|
275
|
+
binaryData: n.getState().getJsonActivityBinaryDataFunction()
|
|
276
|
+
}),
|
|
277
|
+
getAssignmentContentAndData: () => ({
|
|
278
|
+
content: n.getState().getJsonAssignmentContentFunction(),
|
|
279
|
+
binaryData: n.getState().getJsonAssignmentBinaryDataFunction()
|
|
280
|
+
})
|
|
281
|
+
},
|
|
282
|
+
"meta-player-anti-cheat:1": {
|
|
283
|
+
lock: () => {
|
|
284
|
+
},
|
|
285
|
+
unlock: () => {
|
|
286
|
+
}
|
|
287
|
+
},
|
|
221
288
|
"meta-player-ui:1": {
|
|
222
289
|
executeAction(t) {
|
|
223
290
|
if (t.startsWith("qa")) {
|
|
224
|
-
const
|
|
225
|
-
|
|
291
|
+
const o = n.getState().quickActions[t];
|
|
292
|
+
o ? o() : console.error(`Quick action not found: ${t}`);
|
|
226
293
|
} else {
|
|
227
|
-
const
|
|
228
|
-
|
|
294
|
+
const o = n.getState().sidebarActions[t];
|
|
295
|
+
o ? o() : console.error(`Sidebar action not found: ${t}`);
|
|
229
296
|
}
|
|
230
297
|
},
|
|
231
298
|
executeFileUpload(t, e) {
|
|
232
299
|
if (t.startsWith("qa")) {
|
|
233
|
-
const s =
|
|
300
|
+
const s = n.getState().quickActions[t];
|
|
234
301
|
s ? s(e) : console.error(`Quick action not found: ${t}`);
|
|
235
302
|
} else {
|
|
236
|
-
const s =
|
|
303
|
+
const s = n.getState().sidebarActions[t];
|
|
237
304
|
s ? s(e) : console.error(`Sidebar action not found: ${t}`);
|
|
238
305
|
}
|
|
239
306
|
},
|
|
240
307
|
updateSettings(t) {
|
|
241
|
-
|
|
308
|
+
n.setState({ activitySettings: t });
|
|
242
309
|
}
|
|
243
310
|
},
|
|
244
311
|
"meta-player-events:1": {
|
|
245
312
|
handleEvent(t) {
|
|
246
|
-
t === "all-loaded" &&
|
|
313
|
+
t === "all-loaded" && n.setState({ ready: !0 });
|
|
247
314
|
}
|
|
248
315
|
}
|
|
249
|
-
},
|
|
250
|
-
function
|
|
251
|
-
if (
|
|
316
|
+
}, C = M();
|
|
317
|
+
function P(t) {
|
|
318
|
+
if (k) {
|
|
252
319
|
console.warn("Contracts have already been plugged. Skipping.");
|
|
253
320
|
return;
|
|
254
321
|
}
|
|
255
|
-
|
|
322
|
+
k = !0;
|
|
256
323
|
for (const e of t) {
|
|
257
|
-
if (!
|
|
324
|
+
if (!L.includes(e)) {
|
|
258
325
|
console.warn(
|
|
259
326
|
`Contract ${e} is not implemented in Capytale. Skipping plug.`
|
|
260
327
|
);
|
|
261
328
|
continue;
|
|
262
329
|
}
|
|
263
|
-
if (!(e in
|
|
330
|
+
if (!(e in D)) {
|
|
264
331
|
console.warn(
|
|
265
332
|
`Contract handler for ${e} is not defined. Skipping plug.`
|
|
266
333
|
);
|
|
267
334
|
continue;
|
|
268
335
|
}
|
|
269
|
-
const
|
|
270
|
-
|
|
336
|
+
const o = D[e];
|
|
337
|
+
C.plug([e], ([]) => [o]);
|
|
271
338
|
}
|
|
272
|
-
|
|
339
|
+
C.plugsDone();
|
|
273
340
|
for (const e of [
|
|
274
341
|
"simple-content(text):1",
|
|
275
342
|
"simple-content(json):1",
|
|
@@ -281,187 +348,235 @@ function Q(t) {
|
|
|
281
348
|
])
|
|
282
349
|
if (console.log(`Contract ${e} is being subscribed to content changes.`), t.includes(e)) {
|
|
283
350
|
console.log(`Subscribing to content changes for contract ${e}`);
|
|
284
|
-
const
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
(
|
|
289
|
-
|
|
351
|
+
const o = e.split(":")[0];
|
|
352
|
+
C.use([o], ([s]) => {
|
|
353
|
+
n.subscribe(
|
|
354
|
+
(i) => i.isDirtyCount,
|
|
355
|
+
() => {
|
|
356
|
+
var i;
|
|
357
|
+
(i = s.i) == null || i.contentChanged(), console.log(
|
|
358
|
+
`Content changed for contract ${o}`
|
|
359
|
+
);
|
|
360
|
+
}
|
|
361
|
+
);
|
|
290
362
|
});
|
|
291
363
|
}
|
|
292
364
|
}
|
|
293
|
-
|
|
365
|
+
const R = [
|
|
366
|
+
"meta-player-events:1",
|
|
367
|
+
"mode:1",
|
|
368
|
+
"workflow:1"
|
|
369
|
+
];
|
|
370
|
+
function O({
|
|
294
371
|
children: t,
|
|
295
372
|
contracts: e,
|
|
296
|
-
loadOnlyWhenReady:
|
|
373
|
+
loadOnlyWhenReady: o = !0
|
|
297
374
|
}) {
|
|
298
|
-
const s =
|
|
299
|
-
return
|
|
300
|
-
const i =
|
|
301
|
-
|
|
302
|
-
|
|
375
|
+
const s = n((i) => i.ready);
|
|
376
|
+
return d(() => {
|
|
377
|
+
const i = [...e];
|
|
378
|
+
for (const c of R)
|
|
379
|
+
i.includes(c) || i.push(c);
|
|
380
|
+
P(i);
|
|
381
|
+
}, []), o && !s ? /* @__PURE__ */ w("div", { className: "container", children: "Chargement en cours..." }) : /* @__PURE__ */ w("div", { className: "container", children: t });
|
|
303
382
|
}
|
|
304
|
-
const
|
|
383
|
+
const H = () => n((t) => {
|
|
305
384
|
if (t.mode === null)
|
|
306
385
|
throw new Error("Mode is not set. Have you used contract 'mode'?");
|
|
307
386
|
return t.mode;
|
|
308
|
-
}), U = () =>
|
|
387
|
+
}), U = () => n((t) => {
|
|
309
388
|
if (t.workflow === null)
|
|
310
389
|
throw new Error("Workflow is not set. Have you used contract 'workflow'?");
|
|
311
390
|
return t.workflow;
|
|
312
|
-
}),
|
|
391
|
+
}), V = () => n((t) => {
|
|
313
392
|
if (t.theme === null)
|
|
314
393
|
throw new Error("Theme is not set. Have you used contract 'theme'?");
|
|
315
394
|
return t.theme;
|
|
316
|
-
}),
|
|
317
|
-
const e =
|
|
318
|
-
(
|
|
395
|
+
}), _ = () => n((t) => t.incSaveCount), z = () => n((t) => t.incDirtyCount), K = () => n((t) => t.loadedTextContent), X = () => n((t) => t.loadedJsonContent), Y = () => n((t) => t.loadedJsonActivityContent), Z = () => n((t) => t.loadedJsonAssignmentContent), tt = () => n((t) => t.loadedJsonActivityBinaryData), et = () => n((t) => t.loadedJsonAssignmentBinaryData), nt = (t) => {
|
|
396
|
+
const e = n(
|
|
397
|
+
(o) => o.setGetTextContentFunction
|
|
319
398
|
);
|
|
320
|
-
|
|
399
|
+
d(() => {
|
|
321
400
|
e(t);
|
|
322
401
|
}, [t, e]);
|
|
323
|
-
},
|
|
324
|
-
const e =
|
|
325
|
-
(
|
|
402
|
+
}, ot = (t) => {
|
|
403
|
+
const e = n(
|
|
404
|
+
(o) => o.setGetJsonContentFunction
|
|
326
405
|
);
|
|
327
|
-
|
|
406
|
+
d(() => {
|
|
328
407
|
e(t);
|
|
329
408
|
}, [t, e]);
|
|
330
|
-
},
|
|
331
|
-
const e =
|
|
332
|
-
|
|
409
|
+
}, st = (t) => {
|
|
410
|
+
const e = n(
|
|
411
|
+
(o) => o.setGetJsonActivityContentFunction
|
|
412
|
+
);
|
|
413
|
+
d(() => {
|
|
414
|
+
e(t);
|
|
415
|
+
}, [t, e]);
|
|
416
|
+
}, it = (t) => {
|
|
417
|
+
const e = n(
|
|
418
|
+
(o) => o.setGetJsonAssignmentContentFunction
|
|
419
|
+
);
|
|
420
|
+
d(() => {
|
|
421
|
+
e(t);
|
|
422
|
+
}, [t, e]);
|
|
423
|
+
}, at = (t) => {
|
|
424
|
+
const e = n(
|
|
425
|
+
(o) => o.setGetJsonActivityBinaryDataFunction
|
|
426
|
+
);
|
|
427
|
+
d(() => {
|
|
428
|
+
e(t);
|
|
429
|
+
}, [t, e]);
|
|
430
|
+
}, ct = (t) => {
|
|
431
|
+
const e = n(
|
|
432
|
+
(o) => o.setGetJsonAssignmentBinaryDataFunction
|
|
433
|
+
);
|
|
434
|
+
d(() => {
|
|
435
|
+
e(t);
|
|
436
|
+
}, [t, e]);
|
|
437
|
+
}, rt = (t) => {
|
|
438
|
+
const e = n((o) => o.afterSaveCount);
|
|
439
|
+
d(() => {
|
|
333
440
|
e > 0 && t();
|
|
334
441
|
}, [e]);
|
|
335
|
-
},
|
|
336
|
-
|
|
442
|
+
}, ut = () => (t, e) => {
|
|
443
|
+
C.use(["meta-player-ui"], ([o]) => {
|
|
337
444
|
var s;
|
|
338
|
-
if (
|
|
445
|
+
if (o.version === 0) {
|
|
339
446
|
console.error("Le MétaPlayer ne supporte pas le contrat meta-player-ui");
|
|
340
447
|
return;
|
|
341
448
|
}
|
|
342
|
-
(s =
|
|
449
|
+
(s = o.i) == null || s.previewTextFile(t, e);
|
|
343
450
|
});
|
|
344
|
-
},
|
|
345
|
-
|
|
451
|
+
}, lt = () => (t, e) => {
|
|
452
|
+
C.use(["meta-player-ui"], ([o]) => {
|
|
346
453
|
var s;
|
|
347
|
-
if (
|
|
454
|
+
if (o.version === 0) {
|
|
348
455
|
console.error("Le MétaPlayer ne supporte pas le contrat meta-player-ui");
|
|
349
456
|
return;
|
|
350
457
|
}
|
|
351
|
-
(s =
|
|
458
|
+
(s = o.i) == null || s.previewImageFile(t, e);
|
|
352
459
|
});
|
|
353
460
|
};
|
|
354
|
-
let
|
|
355
|
-
const
|
|
356
|
-
const
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
}), []),
|
|
461
|
+
let v = 0, J = 0;
|
|
462
|
+
const dt = (t, e) => {
|
|
463
|
+
const o = b(t, e), s = n((i) => i.setSidebarActions);
|
|
464
|
+
d(() => (v++, v > 1 && console.error("Capytale iframe React: Multiple sidebar actions registered: ", v), () => {
|
|
465
|
+
v--;
|
|
466
|
+
}), []), d(() => (C.use(["meta-player-ui"], ([i]) => {
|
|
360
467
|
var l;
|
|
361
468
|
if (i.version === 0) {
|
|
362
469
|
console.error("Le MétaPlayer ne supporte pas le contrat meta-player-ui");
|
|
363
470
|
return;
|
|
364
471
|
}
|
|
365
|
-
|
|
366
|
-
const
|
|
367
|
-
type:
|
|
368
|
-
title:
|
|
369
|
-
icon:
|
|
370
|
-
id: `sa-${
|
|
371
|
-
...
|
|
372
|
-
})),
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
}), (l = i.i) == null || l.setSidebarActionButtons(
|
|
472
|
+
J++;
|
|
473
|
+
const c = o.map((a, u) => ({
|
|
474
|
+
type: a.type,
|
|
475
|
+
title: a.title,
|
|
476
|
+
icon: a.icon,
|
|
477
|
+
id: `sa-${J}-${u}`,
|
|
478
|
+
...a.type === "file-upload" ? { accept: a.accept } : {}
|
|
479
|
+
})), r = {};
|
|
480
|
+
o.forEach((a, u) => {
|
|
481
|
+
r[`sa-${J}-${u}`] = a.action;
|
|
482
|
+
}), (l = i.i) == null || l.setSidebarActionButtons(c), s(r);
|
|
376
483
|
}), () => {
|
|
377
|
-
s({}),
|
|
378
|
-
var
|
|
484
|
+
s({}), C.use(["meta-player-ui"], ([i]) => {
|
|
485
|
+
var c;
|
|
379
486
|
if (i.version === 0) {
|
|
380
487
|
console.error("Le MétaPlayer ne supporte pas le contrat meta-player-ui");
|
|
381
488
|
return;
|
|
382
489
|
}
|
|
383
|
-
(
|
|
490
|
+
(c = i.i) == null || c.setSidebarActionButtons([]);
|
|
384
491
|
});
|
|
385
|
-
}), [
|
|
492
|
+
}), [o]);
|
|
386
493
|
};
|
|
387
|
-
let
|
|
388
|
-
const
|
|
389
|
-
const
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
}), []),
|
|
494
|
+
let p = 0, F = 0;
|
|
495
|
+
const gt = (t, e) => {
|
|
496
|
+
const o = b(t, e), s = n((i) => i.setQuickActions);
|
|
497
|
+
d(() => (p++, p > 1 && console.error("Capytale iframe React: Multiple quick actions registered: ", p), () => {
|
|
498
|
+
p--;
|
|
499
|
+
}), []), d(() => (C.use(["meta-player-ui"], ([i]) => {
|
|
393
500
|
var l;
|
|
394
501
|
if (i.version === 0) {
|
|
395
502
|
console.error("Le MétaPlayer ne supporte pas le contrat meta-player-ui");
|
|
396
503
|
return;
|
|
397
504
|
}
|
|
398
|
-
|
|
399
|
-
const
|
|
400
|
-
type:
|
|
401
|
-
title:
|
|
402
|
-
icon:
|
|
403
|
-
id: `qa-${
|
|
404
|
-
...
|
|
405
|
-
})),
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
}), (l = i.i) == null || l.setQuickActionButtons(
|
|
505
|
+
F++;
|
|
506
|
+
const c = o.map((a, u) => ({
|
|
507
|
+
type: a.type,
|
|
508
|
+
title: a.title,
|
|
509
|
+
icon: a.icon,
|
|
510
|
+
id: `qa-${F}-${u}`,
|
|
511
|
+
...a.type === "file-upload" ? { accept: a.accept } : {}
|
|
512
|
+
})), r = {};
|
|
513
|
+
o.forEach((a, u) => {
|
|
514
|
+
r[`qa-${F}-${u}`] = a.action;
|
|
515
|
+
}), (l = i.i) == null || l.setQuickActionButtons(c), s(r);
|
|
409
516
|
}), () => {
|
|
410
|
-
s({}),
|
|
411
|
-
var
|
|
517
|
+
s({}), C.use(["meta-player-ui"], ([i]) => {
|
|
518
|
+
var c;
|
|
412
519
|
if (i.version === 0) {
|
|
413
520
|
console.error("Le MétaPlayer ne supporte pas le contrat meta-player-ui");
|
|
414
521
|
return;
|
|
415
522
|
}
|
|
416
|
-
(
|
|
523
|
+
(c = i.i) == null || c.setQuickActionButtons([]);
|
|
417
524
|
});
|
|
418
|
-
}), [
|
|
525
|
+
}), [o]);
|
|
419
526
|
};
|
|
420
|
-
let
|
|
421
|
-
const
|
|
422
|
-
const
|
|
423
|
-
return
|
|
424
|
-
|
|
425
|
-
}), []),
|
|
426
|
-
const
|
|
427
|
-
if (
|
|
428
|
-
return
|
|
429
|
-
var
|
|
527
|
+
let f = 0;
|
|
528
|
+
const Ct = (t, e) => {
|
|
529
|
+
const o = b(t, e), s = n((r) => r.setActivitySettings), i = n((r) => r.activitySettings), c = B("");
|
|
530
|
+
return d(() => (console.log("Mounting useSettings"), f++, f > 1 && console.error("Capytale iframe React: Multiple settings registered: ", f), () => {
|
|
531
|
+
f--;
|
|
532
|
+
}), []), d(() => {
|
|
533
|
+
const r = JSON.stringify(o);
|
|
534
|
+
if (r !== c.current)
|
|
535
|
+
return c.current = r, C.use(["meta-player-ui"], ([l]) => {
|
|
536
|
+
var a;
|
|
430
537
|
if (l.version === 0) {
|
|
431
538
|
console.error("Le MétaPlayer ne supporte pas le contrat meta-player-ui");
|
|
432
539
|
return;
|
|
433
540
|
}
|
|
434
|
-
console.log("Updating settings UI in MetaPlayer",
|
|
541
|
+
console.log("Updating settings UI in MetaPlayer", o), (a = l.i) == null || a.setSettingsUI(o);
|
|
435
542
|
}), () => {
|
|
436
543
|
s(null);
|
|
437
544
|
};
|
|
438
|
-
}, [
|
|
439
|
-
},
|
|
440
|
-
|
|
545
|
+
}, [o]), i;
|
|
546
|
+
}, St = () => (e) => {
|
|
547
|
+
C.use(["meta-player-ui"], ([o]) => {
|
|
441
548
|
var s;
|
|
442
|
-
if (
|
|
549
|
+
if (o.version === 0) {
|
|
443
550
|
console.error("Le MétaPlayer ne supporte pas le contrat meta-player-ui");
|
|
444
551
|
return;
|
|
445
552
|
}
|
|
446
|
-
(s =
|
|
553
|
+
(s = o.i) == null || s.showToast(e);
|
|
447
554
|
});
|
|
448
555
|
};
|
|
449
556
|
export {
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
557
|
+
O as Capytale,
|
|
558
|
+
rt as useAfterSaveAction,
|
|
559
|
+
at as useJsonActivityBinaryDataSaveFunction,
|
|
560
|
+
st as useJsonActivityContentSaveFunction,
|
|
561
|
+
ct as useJsonAssignmentBinaryDataSaveFunction,
|
|
562
|
+
it as useJsonAssignmentContentSaveFunction,
|
|
563
|
+
ot as useJsonContentSaveFunction,
|
|
564
|
+
tt as useLoadedJsonActivityBinaryData,
|
|
565
|
+
Y as useLoadedJsonActivityContent,
|
|
566
|
+
et as useLoadedJsonAssignmentBinaryData,
|
|
567
|
+
Z as useLoadedJsonAssignmentContent,
|
|
568
|
+
X as useLoadedJsonContent,
|
|
569
|
+
K as useLoadedTextContent,
|
|
570
|
+
H as useMode,
|
|
571
|
+
z as useNotifyIsDirty,
|
|
572
|
+
lt as usePreviewImageFile,
|
|
573
|
+
ut as usePreviewTextFile,
|
|
574
|
+
gt as useQuickActions,
|
|
575
|
+
_ as useRequestSave,
|
|
576
|
+
Ct as useSettings,
|
|
577
|
+
St as useShowToast,
|
|
578
|
+
dt as useSidebarActions,
|
|
579
|
+
nt as useTextContentSaveFunction,
|
|
580
|
+
V as useTheme,
|
|
466
581
|
U as useWorkflow
|
|
467
582
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capytale/iframe-react",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"dev": "vite",
|
|
@@ -26,9 +26,9 @@
|
|
|
26
26
|
],
|
|
27
27
|
"sideEffects": false,
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@capytale/app-agent": "^1.0.
|
|
30
|
-
"@capytale/contracts": "^1.0.
|
|
31
|
-
"zustand": "^5.0.
|
|
29
|
+
"@capytale/app-agent": "^1.0.12",
|
|
30
|
+
"@capytale/contracts": "^1.0.8",
|
|
31
|
+
"zustand": "^5.0.8"
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|
|
34
34
|
"react": ">=17.0.0 <20",
|