@machinemetrics/mm-react-embeddable 0.9.8 → 0.9.9

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
- `,h=({id:n,genericFrameFallback:c,src:i,path:t,onInit:f=()=>{},...u})=>{const d=e.useRef(),[s,r]=e.useState(),[a,o]=e.useState(0),{registerFrame:m,sendMessage:E}=e.useContext(p),[g,w]=e.useState(),[R,C]=e.useState(!1);return e.useEffect(()=>{t!==void 0&&(console.log(t),w(t))},[t]),e.useEffect(()=>{g===void 0||!a||E(n,"navigate",{path:g})},[g,a,n,E]),e.useEffect(()=>{!i||!n||!d||(async()=>{const b=new URL(i);m(n,b.origin,d),f();try{if((await(await fetch(`${b.origin}/mm-app-manifest.json`)).json()).manifestVersion)r(`${b.origin}/mm-embedded-interop?id=${n}`);else throw Error()}catch{c?(r(i),o(1)):C(!0)}})()},[i,n,m,d]),y(n,"ready",()=>o(b=>b+1)),R?e.createElement("div",{style:{height:"100%",display:"flex",alignItems:"center",justifyContent:"center"}},e.createElement("div",{style:{textAlign:"center"}},"Application must adhere to the MM App Manifest specification to be embedded.")):e.createElement(x,{isready:a,ref:d,src:s,...u})};h.propTypes={id:l.string,genericFrameFallback:l.bool,src:l.string.isRequired,path:l.string,onInit:l.func};exports.MMEmbeddableZone=h;exports.MMEmbeddableZoneProvider=M;exports.useEmbeddedEffect=y;
6
+ `,h=({id:n,genericFrameFallback:c,src:i,path:t,onInit:f=()=>{},...u})=>{const d=e.useRef(),[s,r]=e.useState(),[a,o]=e.useState(0),{registerFrame:m,sendMessage:E}=e.useContext(p),[g,w]=e.useState(),[R,C]=e.useState(!1);return e.useEffect(()=>{t!==void 0&&(console.log(t),w(t))},[t]),e.useEffect(()=>{g===void 0||!a||E(n,"navigate",{path:g})},[g,a,n,E]),e.useEffect(()=>{!i||!n||!d||(async()=>{const b=new URL(i);m(n,b.origin,d),f();try{if((await(await fetch(`${b.origin}/mm-app-manifest.json`)).json()).version)r(`${b.origin}/mm-embedded-interop?id=${n}`);else throw Error()}catch{c?(r(i),o(1)):C(!0)}})()},[i,n,m,d]),y(n,"ready",()=>o(b=>b+1)),R?e.createElement("div",{style:{height:"100%",display:"flex",alignItems:"center",justifyContent:"center"}},e.createElement("div",{style:{textAlign:"center"}},"Application must adhere to the MM App Manifest specification to be embedded.")):e.createElement(x,{isready:a,ref:d,src:s,...u})};h.propTypes={id:l.string,genericFrameFallback:l.bool,src:l.string.isRequired,path:l.string,onInit:l.func};exports.MMEmbeddableZone=h;exports.MMEmbeddableZoneProvider=M;exports.useEmbeddedEffect=y;
@@ -37,7 +37,7 @@ const w = P(null), $ = ({ children: n }) => {
37
37
  })
38
38
  };
39
39
  return /* @__PURE__ */ E.createElement(w.Provider, { value: c }, n);
40
- }, Z = (n, a, i) => {
40
+ }, v = (n, a, i) => {
41
41
  const e = R(w);
42
42
  if (e === null)
43
43
  throw new Error(
@@ -61,12 +61,12 @@ const w = P(null), $ = ({ children: n }) => {
61
61
  $.propTypes = {
62
62
  children: f.node.isRequired
63
63
  };
64
- const j = C.iframe`
64
+ const Z = C.iframe`
65
65
  width: 100%;
66
66
  height: 100%;
67
67
  border: none;
68
68
  visibility: ${(n) => n.isready ? "visible" : "hidden"};
69
- `, v = ({
69
+ `, j = ({
70
70
  id: n,
71
71
  genericFrameFallback: a,
72
72
  src: i,
@@ -85,7 +85,7 @@ const j = C.iframe`
85
85
  const g = new URL(i);
86
86
  m(n, g.origin, c), u();
87
87
  try {
88
- if ((await (await fetch(`${g.origin}/mm-app-manifest.json`)).json()).manifestVersion)
88
+ if ((await (await fetch(`${g.origin}/mm-app-manifest.json`)).json()).version)
89
89
  t(`${g.origin}/mm-embedded-interop?id=${n}`);
90
90
  else
91
91
  throw Error();
@@ -93,7 +93,7 @@ const j = C.iframe`
93
93
  a ? (t(i), s(1)) : L(!0);
94
94
  }
95
95
  })();
96
- }, [i, n, m, c]), Z(n, "ready", () => s((g) => g + 1)), x ? /* @__PURE__ */ E.createElement(
96
+ }, [i, n, m, c]), v(n, "ready", () => s((g) => g + 1)), x ? /* @__PURE__ */ E.createElement(
97
97
  "div",
98
98
  {
99
99
  style: {
@@ -104,9 +104,9 @@ const j = C.iframe`
104
104
  }
105
105
  },
106
106
  /* @__PURE__ */ E.createElement("div", { style: { textAlign: "center" } }, "Application must adhere to the MM App Manifest specification to be embedded.")
107
- ) : /* @__PURE__ */ E.createElement(j, { isready: o, ref: c, src: r, ...d });
107
+ ) : /* @__PURE__ */ E.createElement(Z, { isready: o, ref: c, src: r, ...d });
108
108
  };
109
- v.propTypes = {
109
+ j.propTypes = {
110
110
  id: f.string,
111
111
  genericFrameFallback: f.bool,
112
112
  src: f.string.isRequired,
@@ -114,7 +114,7 @@ v.propTypes = {
114
114
  onInit: f.func
115
115
  };
116
116
  export {
117
- v as MMEmbeddableZone,
117
+ j as MMEmbeddableZone,
118
118
  $ as MMEmbeddableZoneProvider,
119
- Z as useEmbeddedEffect
119
+ v as useEmbeddedEffect
120
120
  };
@@ -3,4 +3,4 @@
3
3
  height: 100%;
4
4
  border: none;
5
5
  visibility: ${s=>s.isready?"visible":"hidden"};
6
- `,w=({id:s,genericFrameFallback:f,src:u,path:t,onInit:m=()=>{},...c})=>{const a=e.useRef(),[r,n]=e.useState(),[d,o]=e.useState(0),{registerFrame:b,sendMessage:g}=e.useContext(p),[h,x]=e.useState(),[L,S]=e.useState(!1);return e.useEffect(()=>{t!==void 0&&(console.log(t),x(t))},[t]),e.useEffect(()=>{h===void 0||!d||g(s,"navigate",{path:h})},[h,d,s,g]),e.useEffect(()=>{!u||!s||!a||(async()=>{const E=new URL(u);b(s,E.origin,a),m();try{if((await(await fetch(`${E.origin}/mm-app-manifest.json`)).json()).manifestVersion)n(`${E.origin}/mm-embedded-interop?id=${s}`);else throw Error()}catch{f?(n(u),o(1)):S(!0)}})()},[u,s,b,a]),M(s,"ready",()=>o(E=>E+1)),L?e.createElement("div",{style:{height:"100%",display:"flex",alignItems:"center",justifyContent:"center"}},e.createElement("div",{style:{textAlign:"center"}},"Application must adhere to the MM App Manifest specification to be embedded.")):e.createElement(I,{isready:d,ref:a,src:r,...c})};w.propTypes={id:l.string,genericFrameFallback:l.bool,src:l.string.isRequired,path:l.string,onInit:l.func},i.MMEmbeddableZone=w,i.MMEmbeddableZoneProvider=y,i.useEmbeddedEffect=M,Object.defineProperty(i,Symbol.toStringTag,{value:"Module"})});
6
+ `,w=({id:s,genericFrameFallback:f,src:u,path:t,onInit:m=()=>{},...c})=>{const a=e.useRef(),[r,n]=e.useState(),[d,o]=e.useState(0),{registerFrame:b,sendMessage:g}=e.useContext(p),[h,x]=e.useState(),[L,S]=e.useState(!1);return e.useEffect(()=>{t!==void 0&&(console.log(t),x(t))},[t]),e.useEffect(()=>{h===void 0||!d||g(s,"navigate",{path:h})},[h,d,s,g]),e.useEffect(()=>{!u||!s||!a||(async()=>{const E=new URL(u);b(s,E.origin,a),m();try{if((await(await fetch(`${E.origin}/mm-app-manifest.json`)).json()).version)n(`${E.origin}/mm-embedded-interop?id=${s}`);else throw Error()}catch{f?(n(u),o(1)):S(!0)}})()},[u,s,b,a]),M(s,"ready",()=>o(E=>E+1)),L?e.createElement("div",{style:{height:"100%",display:"flex",alignItems:"center",justifyContent:"center"}},e.createElement("div",{style:{textAlign:"center"}},"Application must adhere to the MM App Manifest specification to be embedded.")):e.createElement(I,{isready:d,ref:a,src:r,...c})};w.propTypes={id:l.string,genericFrameFallback:l.bool,src:l.string.isRequired,path:l.string,onInit:l.func},i.MMEmbeddableZone=w,i.MMEmbeddableZoneProvider=y,i.useEmbeddedEffect=M,Object.defineProperty(i,Symbol.toStringTag,{value:"Module"})});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@machinemetrics/mm-react-embeddable",
3
- "version": "0.9.8",
3
+ "version": "0.9.9",
4
4
  "license": "MIT",
5
5
  "module": "dist/mm-react-embeddable.es.js",
6
6
  "main": "dist/mm-react-embeddable.cjs.js",