@machinemetrics/mm-react-embeddable 1.1.1-0 → 1.1.1

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.
@@ -3,4 +3,4 @@
3
3
  height: 100%;
4
4
  border: none;
5
5
  visibility: ${n=>n.$isReady?"visible":"hidden"};
6
- `,T=({id:n,src:i,path:u,onInit:c=()=>{},context:l={},params:o={},...m})=>{if("isConfiguring"in m)return console.error("isConfiguring must be passed via the params prop to MMEmbeddableZone"),null;if("colorMode"in l)return console.error("colorMode must be passed via the params prop to MMEmbeddableZone"),null;if("isFullScreen"in l)return console.error("isFullScreen must be passed via the params prop to MMEmbeddableZone"),null;const d=r.useRef(),[h,w]=r.useState(),[f,b]=r.useState(0),{registerFrame:C,unregisterFrame:q,sendMessage:p}=r.useContext($),[k,x]=r.useState(!0),[E,e]=r.useState();return r.useEffect(()=>{f&&p(n,"set-context",{context:{...l,colorMode:o.colorMode,isFullScreen:o.isFullScreen}})},[l,o.colorMode,o.isFullScreen,n,f]),r.useEffect(()=>{f&&(p(n,"set-params",{params:o}),p(n,"set-configuring",{isConfiguring:o.isConfiguring}))},[o,n,f]),r.useEffect(()=>{u!==void 0&&e(u.indexOf("/")===0?u:`/${u}`)},[u]),r.useEffect(()=>{E===void 0||!f||p(n,"navigate",{path:E})},[E,f,n,p]),r.useEffect(()=>{if(!(!i||!n||!d))return(async()=>{const t=await A(i);if(x(t),t){const s=new URL(i);C(n,s.origin,d),c(),w(`${s.origin}/mm-embedded-interop?id=${n}&origin=${window.location.origin}`);return}})(),()=>{q(n)}},[i,n,C,d]),O(n,"ready",()=>b(t=>t+1)),k?S.jsx(W,{$isReady:f,ref:d,src:h,...m}):S.jsx("div",{style:{height:"100%",display:"flex",flex:1,alignItems:"center",justifyContent:"center"},children:S.jsx("div",{style:{textAlign:"center"},children:"Application must adhere to the MM App Manifest specification to be embedded."})})};T.propTypes={id:R.string,src:R.string.isRequired,path:R.string,onInit:R.func};exports.MMEmbeddableZone=T;exports.MMEmbeddableZoneContext=$;exports.MMEmbeddableZoneProvider=P;exports.getAppInfo=L;exports.testIsEmbeddable=A;exports.useEmbeddedEffect=O;
6
+ `,T=({id:n,src:i,path:u,onInit:c=()=>{},context:l={},params:o={},...m})=>{if("isConfiguring"in m)return console.error("isConfiguring must be passed via the params prop to MMEmbeddableZone"),null;if("colorMode"in l)return console.error("colorMode must be passed via the params prop to MMEmbeddableZone"),null;if("isFullScreen"in l)return console.error("isFullScreen must be passed via the params prop to MMEmbeddableZone"),null;const d=r.useRef(),[h,w]=r.useState(),[f,b]=r.useState(0),{registerFrame:C,unregisterFrame:q,sendMessage:p}=r.useContext($),[k,x]=r.useState(!0),[E,e]=r.useState();return r.useEffect(()=>{f&&p(n,"set-context",{context:{...l,colorMode:o.colorMode,isFullScreen:o.isFullScreen}})},[l,o.colorMode,o.isFullScreen,n,f]),r.useEffect(()=>{f&&(p(n,"set-params",{params:o}),p(n,"set-configuring",{isConfiguring:o.isConfiguring}))},[o,n,f]),r.useEffect(()=>{u!==void 0&&e(u?.indexOf("/")===0?u:`/${u}`)},[u]),r.useEffect(()=>{E===void 0||!f||p(n,"navigate",{path:E})},[E,f,n,p]),r.useEffect(()=>{if(!(!i||!n||!d))return(async()=>{const t=await A(i);if(x(t),t){const s=new URL(i);C(n,s.origin,d),c(),w(`${s.origin}/mm-embedded-interop?id=${n}&origin=${window.location.origin}`);return}})(),()=>{q(n)}},[i,n,C,d]),O(n,"ready",()=>b(t=>t+1)),k?S.jsx(W,{$isReady:f,ref:d,src:h,...m}):S.jsx("div",{style:{height:"100%",display:"flex",flex:1,alignItems:"center",justifyContent:"center"},children:S.jsx("div",{style:{textAlign:"center"},children:"Application must adhere to the MM App Manifest specification to be embedded."})})};T.propTypes={id:R.string,src:R.string.isRequired,path:R.string,onInit:R.func};exports.MMEmbeddableZone=T;exports.MMEmbeddableZoneContext=$;exports.MMEmbeddableZoneProvider=P;exports.getAppInfo=L;exports.testIsEmbeddable=A;exports.useEmbeddedEffect=O;
@@ -178,7 +178,7 @@ const _ = j.default || j, z = _.iframe`
178
178
  }, [u, s.colorMode, s.isFullScreen, n, l]), h(() => {
179
179
  l && (b(n, "set-params", { params: s }), b(n, "set-configuring", { isConfiguring: s.isConfiguring }));
180
180
  }, [s, n, l]), h(() => {
181
- c !== void 0 && e(c.indexOf("/") === 0 ? c : `/${c}`);
181
+ c !== void 0 && e(c?.indexOf("/") === 0 ? c : `/${c}`);
182
182
  }, [c]), h(() => {
183
183
  E === void 0 || !l || b(n, "navigate", { path: E });
184
184
  }, [E, l, n, b]), h(() => {
@@ -3,4 +3,4 @@
3
3
  height: 100%;
4
4
  border: none;
5
5
  visibility: ${s=>s.$isReady?"visible":"hidden"};
6
- `,U=({id:s,src:i,path:c,onInit:a=()=>{},context:f={},params:o={},...y})=>{if("isConfiguring"in y)return console.error("isConfiguring must be passed via the params prop to MMEmbeddableZone"),null;if("colorMode"in f)return console.error("colorMode must be passed via the params prop to MMEmbeddableZone"),null;if("isFullScreen"in f)return console.error("isFullScreen must be passed via the params prop to MMEmbeddableZone"),null;const l=e.useRef(),[I,F]=e.useState(),[b,m]=e.useState(0),{registerFrame:S,unregisterFrame:Z,sendMessage:M}=e.useContext(C),[$,x]=e.useState(!0),[w,n]=e.useState();return e.useEffect(()=>{b&&M(s,"set-context",{context:{...f,colorMode:o.colorMode,isFullScreen:o.isFullScreen}})},[f,o.colorMode,o.isFullScreen,s,b]),e.useEffect(()=>{b&&(M(s,"set-params",{params:o}),M(s,"set-configuring",{isConfiguring:o.isConfiguring}))},[o,s,b]),e.useEffect(()=>{c!==void 0&&n(c.indexOf("/")===0?c:`/${c}`)},[c]),e.useEffect(()=>{w===void 0||!b||M(s,"navigate",{path:w})},[w,b,s,M]),e.useEffect(()=>{if(!(!i||!s||!l))return(async()=>{const t=await O(i);if(x(t),t){const r=new URL(i);S(s,r.origin,l),a(),F(`${r.origin}/mm-embedded-interop?id=${s}&origin=${window.location.origin}`);return}})(),()=>{Z(s)}},[i,s,S,l]),P(s,"ready",()=>m(t=>t+1)),$?p.jsx(W,{$isReady:b,ref:l,src:I,...y}):p.jsx("div",{style:{height:"100%",display:"flex",flex:1,alignItems:"center",justifyContent:"center"},children:p.jsx("div",{style:{textAlign:"center"},children:"Application must adhere to the MM App Manifest specification to be embedded."})})};U.propTypes={id:R.string,src:R.string.isRequired,path:R.string,onInit:R.func},d.MMEmbeddableZone=U,d.MMEmbeddableZoneContext=C,d.MMEmbeddableZoneProvider=L,d.getAppInfo=A,d.testIsEmbeddable=O,d.useEmbeddedEffect=P,Object.defineProperty(d,Symbol.toStringTag,{value:"Module"})}));
6
+ `,U=({id:s,src:i,path:c,onInit:a=()=>{},context:f={},params:o={},...y})=>{if("isConfiguring"in y)return console.error("isConfiguring must be passed via the params prop to MMEmbeddableZone"),null;if("colorMode"in f)return console.error("colorMode must be passed via the params prop to MMEmbeddableZone"),null;if("isFullScreen"in f)return console.error("isFullScreen must be passed via the params prop to MMEmbeddableZone"),null;const l=e.useRef(),[I,F]=e.useState(),[b,m]=e.useState(0),{registerFrame:S,unregisterFrame:Z,sendMessage:M}=e.useContext(C),[$,x]=e.useState(!0),[w,n]=e.useState();return e.useEffect(()=>{b&&M(s,"set-context",{context:{...f,colorMode:o.colorMode,isFullScreen:o.isFullScreen}})},[f,o.colorMode,o.isFullScreen,s,b]),e.useEffect(()=>{b&&(M(s,"set-params",{params:o}),M(s,"set-configuring",{isConfiguring:o.isConfiguring}))},[o,s,b]),e.useEffect(()=>{c!==void 0&&n(c?.indexOf("/")===0?c:`/${c}`)},[c]),e.useEffect(()=>{w===void 0||!b||M(s,"navigate",{path:w})},[w,b,s,M]),e.useEffect(()=>{if(!(!i||!s||!l))return(async()=>{const t=await O(i);if(x(t),t){const r=new URL(i);S(s,r.origin,l),a(),F(`${r.origin}/mm-embedded-interop?id=${s}&origin=${window.location.origin}`);return}})(),()=>{Z(s)}},[i,s,S,l]),P(s,"ready",()=>m(t=>t+1)),$?p.jsx(W,{$isReady:b,ref:l,src:I,...y}):p.jsx("div",{style:{height:"100%",display:"flex",flex:1,alignItems:"center",justifyContent:"center"},children:p.jsx("div",{style:{textAlign:"center"},children:"Application must adhere to the MM App Manifest specification to be embedded."})})};U.propTypes={id:R.string,src:R.string.isRequired,path:R.string,onInit:R.func},d.MMEmbeddableZone=U,d.MMEmbeddableZoneContext=C,d.MMEmbeddableZoneProvider=L,d.getAppInfo=A,d.testIsEmbeddable=O,d.useEmbeddedEffect=P,Object.defineProperty(d,Symbol.toStringTag,{value:"Module"})}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@machinemetrics/mm-react-embeddable",
3
- "version": "1.1.1-0",
3
+ "version": "1.1.1",
4
4
  "license": "MIT",
5
5
  "module": "dist/mm-react-embeddable.es.js",
6
6
  "main": "dist/mm-react-embeddable.cjs.js",