@machinemetrics/mm-react-embeddable 1.0.10 → 1.0.12-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.
|
@@ -1,35 +1,6 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
2
|
-
* @license React
|
|
3
|
-
* react-jsx-runtime.production.min.js
|
|
4
|
-
*
|
|
5
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
6
|
-
*
|
|
7
|
-
* This source code is licensed under the MIT license found in the
|
|
8
|
-
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var Ye;function hr(){if(Ye)return K;Ye=1;var d=c,g=Symbol.for("react.element"),T=Symbol.for("react.fragment"),b=Object.prototype.hasOwnProperty,w=d.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,y={key:!0,ref:!0,__self:!0,__source:!0};function M(S,h,C){var m,P={},x=null,A=null;C!==void 0&&(x=""+C),h.key!==void 0&&(x=""+h.key),h.ref!==void 0&&(A=h.ref);for(m in h)b.call(h,m)&&!y.hasOwnProperty(m)&&(P[m]=h[m]);if(S&&S.defaultProps)for(m in h=S.defaultProps,h)P[m]===void 0&&(P[m]=h[m]);return{$$typeof:g,type:S,key:x,ref:A,props:P,_owner:w.current}}return K.Fragment=T,K.jsx=M,K.jsxs=M,K}var N={};/**
|
|
10
|
-
* @license React
|
|
11
|
-
* react-jsx-runtime.development.js
|
|
12
|
-
*
|
|
13
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
14
|
-
*
|
|
15
|
-
* This source code is licensed under the MIT license found in the
|
|
16
|
-
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/var Ue;function Rr(){return Ue||(Ue=1,process.env.NODE_ENV!=="production"&&function(){var d=c,g=Symbol.for("react.element"),T=Symbol.for("react.portal"),b=Symbol.for("react.fragment"),w=Symbol.for("react.strict_mode"),y=Symbol.for("react.profiler"),M=Symbol.for("react.provider"),S=Symbol.for("react.context"),h=Symbol.for("react.forward_ref"),C=Symbol.for("react.suspense"),m=Symbol.for("react.suspense_list"),P=Symbol.for("react.memo"),x=Symbol.for("react.lazy"),A=Symbol.for("react.offscreen"),a=Symbol.iterator,p="@@iterator";function s(e){if(e===null||typeof e!="object")return null;var r=a&&e[a]||e[p];return typeof r=="function"?r:null}var u=d.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function l(e){{for(var r=arguments.length,t=new Array(r>1?r-1:0),n=1;n<r;n++)t[n-1]=arguments[n];_("error",e,t)}}function _(e,r,t){{var n=u.ReactDebugCurrentFrame,f=n.getStackAddendum();f!==""&&(r+="%s",t=t.concat([f]));var v=t.map(function(i){return String(i)});v.unshift("Warning: "+r),Function.prototype.apply.call(console[e],console,v)}}var I=!1,Y=!1,D=!1,z=!1,H=!1,$;$=Symbol.for("react.module.reference");function oe(e){return!!(typeof e=="string"||typeof e=="function"||e===b||e===y||H||e===w||e===C||e===m||z||e===A||I||Y||D||typeof e=="object"&&e!==null&&(e.$$typeof===x||e.$$typeof===P||e.$$typeof===M||e.$$typeof===S||e.$$typeof===h||e.$$typeof===$||e.getModuleId!==void 0))}function ie(e,r,t){var n=e.displayName;if(n)return n;var f=r.displayName||r.name||"";return f!==""?t+"("+f+")":t}function q(e){return e.displayName||"Context"}function F(e){if(e==null)return null;if(typeof e.tag=="number"&&l("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case b:return"Fragment";case T:return"Portal";case y:return"Profiler";case w:return"StrictMode";case C:return"Suspense";case m:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case S:var r=e;return q(r)+".Consumer";case M:var t=e;return q(t._context)+".Provider";case h:return ie(e,e.render,"ForwardRef");case P:var n=e.displayName||null;return n!==null?n:F(e.type)||"Memo";case x:{var f=e,v=f._payload,i=f._init;try{return F(i(v))}catch{return null}}}return null}var W=Object.assign,Z=0,me,Ee,ye,he,Re,_e,we;function Ce(){}Ce.__reactDisabledLog=!0;function Ke(){{if(Z===0){me=console.log,Ee=console.info,ye=console.warn,he=console.error,Re=console.group,_e=console.groupCollapsed,we=console.groupEnd;var e={configurable:!0,enumerable:!0,value:Ce,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}Z++}}function Ne(){{if(Z--,Z===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:W({},e,{value:me}),info:W({},e,{value:Ee}),warn:W({},e,{value:ye}),error:W({},e,{value:he}),group:W({},e,{value:Re}),groupCollapsed:W({},e,{value:_e}),groupEnd:W({},e,{value:we})})}Z<0&&l("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var se=u.ReactCurrentDispatcher,ue;function X(e,r,t){{if(ue===void 0)try{throw Error()}catch(f){var n=f.stack.trim().match(/\n( *(at )?)/);ue=n&&n[1]||""}return`
|
|
18
|
-
`+ue+e}}var ce=!1,Q;{var Ge=typeof WeakMap=="function"?WeakMap:Map;Q=new Ge}function Te(e,r){if(!e||ce)return"";{var t=Q.get(e);if(t!==void 0)return t}var n;ce=!0;var f=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var v;v=se.current,se.current=null,Ke();try{if(r){var i=function(){throw Error()};if(Object.defineProperty(i.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(i,[])}catch(j){n=j}Reflect.construct(e,[],i)}else{try{i.call()}catch(j){n=j}e.call(i.prototype)}}else{try{throw Error()}catch(j){n=j}e()}}catch(j){if(j&&n&&typeof j.stack=="string"){for(var o=j.stack.split(`
|
|
19
|
-
`),O=n.stack.split(`
|
|
20
|
-
`),E=o.length-1,R=O.length-1;E>=1&&R>=0&&o[E]!==O[R];)R--;for(;E>=1&&R>=0;E--,R--)if(o[E]!==O[R]){if(E!==1||R!==1)do if(E--,R--,R<0||o[E]!==O[R]){var k=`
|
|
21
|
-
`+o[E].replace(" at new "," at ");return e.displayName&&k.includes("<anonymous>")&&(k=k.replace("<anonymous>",e.displayName)),typeof e=="function"&&Q.set(e,k),k}while(E>=1&&R>=0);break}}}finally{ce=!1,se.current=v,Ne(),Error.prepareStackTrace=f}var V=e?e.displayName||e.name:"",L=V?X(V):"";return typeof e=="function"&&Q.set(e,L),L}function ze(e,r,t){return Te(e,!1)}function He(e){var r=e.prototype;return!!(r&&r.isReactComponent)}function ee(e,r,t){if(e==null)return"";if(typeof e=="function")return Te(e,He(e));if(typeof e=="string")return X(e);switch(e){case C:return X("Suspense");case m:return X("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case h:return ze(e.render);case P:return ee(e.type,r,t);case x:{var n=e,f=n._payload,v=n._init;try{return ee(v(f),r,t)}catch{}}}return""}var B=Object.prototype.hasOwnProperty,Se={},Oe=u.ReactDebugCurrentFrame;function re(e){if(e){var r=e._owner,t=ee(e.type,e._source,r?r.type:null);Oe.setExtraStackFrame(t)}else Oe.setExtraStackFrame(null)}function Xe(e,r,t,n,f){{var v=Function.call.bind(B);for(var i in e)if(v(e,i)){var o=void 0;try{if(typeof e[i]!="function"){var O=Error((n||"React class")+": "+t+" type `"+i+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[i]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw O.name="Invariant Violation",O}o=e[i](r,i,n,t,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(E){o=E}o&&!(o instanceof Error)&&(re(f),l("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",n||"React class",t,i,typeof o),re(null)),o instanceof Error&&!(o.message in Se)&&(Se[o.message]=!0,re(f),l("Failed %s type: %s",t,o.message),re(null))}}}var Qe=Array.isArray;function le(e){return Qe(e)}function er(e){{var r=typeof Symbol=="function"&&Symbol.toStringTag,t=r&&e[Symbol.toStringTag]||e.constructor.name||"Object";return t}}function rr(e){try{return Pe(e),!1}catch{return!0}}function Pe(e){return""+e}function je(e){if(rr(e))return l("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",er(e)),Pe(e)}var J=u.ReactCurrentOwner,tr={key:!0,ref:!0,__self:!0,__source:!0},xe,ke,fe;fe={};function nr(e){if(B.call(e,"ref")){var r=Object.getOwnPropertyDescriptor(e,"ref").get;if(r&&r.isReactWarning)return!1}return e.ref!==void 0}function ar(e){if(B.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return!1}return e.key!==void 0}function or(e,r){if(typeof e.ref=="string"&&J.current&&r&&J.current.stateNode!==r){var t=F(J.current.type);fe[t]||(l('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',F(J.current.type),e.ref),fe[t]=!0)}}function ir(e,r){{var t=function(){xe||(xe=!0,l("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",r))};t.isReactWarning=!0,Object.defineProperty(e,"key",{get:t,configurable:!0})}}function sr(e,r){{var t=function(){ke||(ke=!0,l("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",r))};t.isReactWarning=!0,Object.defineProperty(e,"ref",{get:t,configurable:!0})}}var ur=function(e,r,t,n,f,v,i){var o={$$typeof:g,type:e,key:r,ref:t,props:i,_owner:v};return o._store={},Object.defineProperty(o._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(o,"_self",{configurable:!1,enumerable:!1,writable:!1,value:n}),Object.defineProperty(o,"_source",{configurable:!1,enumerable:!1,writable:!1,value:f}),Object.freeze&&(Object.freeze(o.props),Object.freeze(o)),o};function cr(e,r,t,n,f){{var v,i={},o=null,O=null;t!==void 0&&(je(t),o=""+t),ar(r)&&(je(r.key),o=""+r.key),nr(r)&&(O=r.ref,or(r,f));for(v in r)B.call(r,v)&&!tr.hasOwnProperty(v)&&(i[v]=r[v]);if(e&&e.defaultProps){var E=e.defaultProps;for(v in E)i[v]===void 0&&(i[v]=E[v])}if(o||O){var R=typeof e=="function"?e.displayName||e.name||"Unknown":e;o&&ir(i,R),O&&sr(i,R)}return ur(e,o,O,f,n,J.current,i)}}var de=u.ReactCurrentOwner,Me=u.ReactDebugCurrentFrame;function U(e){if(e){var r=e._owner,t=ee(e.type,e._source,r?r.type:null);Me.setExtraStackFrame(t)}else Me.setExtraStackFrame(null)}var ve;ve=!1;function pe(e){return typeof e=="object"&&e!==null&&e.$$typeof===g}function Fe(){{if(de.current){var e=F(de.current.type);if(e)return`
|
|
22
|
-
|
|
23
|
-
Check the render method of \``+e+"`."}return""}}function lr(e){return""}var Ie={};function fr(e){{var r=Fe();if(!r){var t=typeof e=="string"?e:e.displayName||e.name;t&&(r=`
|
|
24
|
-
|
|
25
|
-
Check the top-level render call using <`+t+">.")}return r}}function Ae(e,r){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var t=fr(r);if(Ie[t])return;Ie[t]=!0;var n="";e&&e._owner&&e._owner!==de.current&&(n=" It was passed a child from "+F(e._owner.type)+"."),U(e),l('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',t,n),U(null)}}function De(e,r){{if(typeof e!="object")return;if(le(e))for(var t=0;t<e.length;t++){var n=e[t];pe(n)&&Ae(n,r)}else if(pe(e))e._store&&(e._store.validated=!0);else if(e){var f=s(e);if(typeof f=="function"&&f!==e.entries)for(var v=f.call(e),i;!(i=v.next()).done;)pe(i.value)&&Ae(i.value,r)}}}function dr(e){{var r=e.type;if(r==null||typeof r=="string")return;var t;if(typeof r=="function")t=r.propTypes;else if(typeof r=="object"&&(r.$$typeof===h||r.$$typeof===P))t=r.propTypes;else return;if(t){var n=F(r);Xe(t,e.props,"prop",n,e)}else if(r.PropTypes!==void 0&&!ve){ve=!0;var f=F(r);l("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",f||"Unknown")}typeof r.getDefaultProps=="function"&&!r.getDefaultProps.isReactClassApproved&&l("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function vr(e){{for(var r=Object.keys(e.props),t=0;t<r.length;t++){var n=r[t];if(n!=="children"&&n!=="key"){U(e),l("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",n),U(null);break}}e.ref!==null&&(U(e),l("Invalid attribute `ref` supplied to `React.Fragment`."),U(null))}}var $e={};function We(e,r,t,n,f,v){{var i=oe(e);if(!i){var o="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(o+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var O=lr();O?o+=O:o+=Fe();var E;e===null?E="null":le(e)?E="array":e!==void 0&&e.$$typeof===g?(E="<"+(F(e.type)||"Unknown")+" />",o=" Did you accidentally export a JSX literal instead of a component?"):E=typeof e,l("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",E,o)}var R=cr(e,r,t,f,v);if(R==null)return R;if(i){var k=r.children;if(k!==void 0)if(n)if(le(k)){for(var V=0;V<k.length;V++)De(k[V],e);Object.freeze&&Object.freeze(k)}else l("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else De(k,e)}if(B.call(r,"key")){var L=F(e),j=Object.keys(r).filter(function(yr){return yr!=="key"}),be=j.length>0?"{key: someKey, "+j.join(": ..., ")+": ...}":"{key: someKey}";if(!$e[L+be]){var Er=j.length>0?"{"+j.join(": ..., ")+": ...}":"{}";l(`A props object containing a "key" prop is being spread into JSX:
|
|
26
|
-
let props = %s;
|
|
27
|
-
<%s {...props} />
|
|
28
|
-
React keys must be passed directly to JSX without using spread:
|
|
29
|
-
let props = %s;
|
|
30
|
-
<%s key={someKey} {...props} />`,be,L,Er,L),$e[L+be]=!0}}return e===b?vr(R):dr(R),R}}function pr(e,r,t){return We(e,r,t,!0)}function br(e,r,t){return We(e,r,t,!1)}var gr=br,mr=pr;N.Fragment=b,N.jsx=gr,N.jsxs=mr}()),N}process.env.NODE_ENV==="production"?ge.exports=hr():ge.exports=Rr();var ne=ge.exports;const ae=c.createContext(null),Ve=({children:d})=>{const[g,T]=c.useState({}),b=c.useRef({}),w=c.useRef({}),y=c.useRef({}),M=c.useCallback((a,p)=>{var s;return!!((s=y.current[a])!=null&&s.has(p))},[]),S=c.useCallback((a,p,s)=>{T(u=>({...u,[a]:{origin:p,frameRef:s}}))},[]),h=c.useCallback(a=>{T(p=>{const s={...p};return delete s[a],s}),delete y.current[a]},[]);c.useEffect(()=>{const a=(s=[],u)=>{s.forEach(l=>l(u))},p=s=>{var I,Y,D,z,H;if(!((I=s==null?void 0:s.data)!=null&&I.instanceId))return;const{instanceId:u,type:l}=s.data,_=b.current;if(l==="response"){const{callbackId:$,response:oe,error:ie}=s.data,q=w.current[$];q&&(q(oe,ie),delete w.current[$]);return}if(l==="mark-registered"){const{requestType:$}=s.data;y.current[u]||(y.current[u]=new Set),y.current[u].add($);return}a((Y=_[u])==null?void 0:Y[l],s.data),a((D=_["*"])==null?void 0:D[l],s.data),a((z=_[u])==null?void 0:z["*"],s.data),a((H=_["*"])==null?void 0:H["*"],s.data)};return window.addEventListener("message",p),()=>{window.removeEventListener("message",p)}},[g]);const C=c.useCallback((a,p,s)=>{var l,_;const u=g[a];if(!u){console.warn(`Origin not set for id: ${a}. Unable to send message.`);return}(_=(l=u==null?void 0:u.frameRef)==null?void 0:l.current)!=null&&_.contentWindow&&u.frameRef.current.contentWindow.postMessage({type:p,...s,instanceId:a},u.origin)},[g]),m=c.useCallback(async(a,p,s={})=>new Promise((u,l)=>{const _=crypto.randomUUID(),I=(Y,D)=>{delete w.current[_],D?l(D):u(Y)};w.current[_]=I,C(a,"request",{callbackId:_,requestType:p,data:s})}),[C]),P=c.useCallback((a,p)=>{C(a,"load-options",p)},[C]),x=c.useCallback((a,p)=>{C(a,"validate",p)},[C]),A=c.useMemo(()=>({registerFrame:S,unregisterFrame:h,sendMessage:C,sendRequest:m,loadOptions:P,validate:x,hasHandler:M,addListener:(a,p,s)=>(b.current[a]||(b.current[a]={}),b.current[a][p]||(b.current[a][p]=[]),b.current[a][p].push(s),()=>{b.current[a][p]=b.current[a][p].filter(u=>u!==s)})}),[S,h,C,m,P,x,M]);return ne.jsx(ae.Provider,{value:A,children:d})},te={},qe=async d=>{try{const g=new URL(d).origin;if(te[g]!==void 0)return te[g];const b=await(await fetch(`${g}/mm-app-manifest.json`)).json();if(!b.version)throw new Error("Invalid manifest");return te[g]=b,b}catch{}return te[origin]=!1,!1},Ze=async d=>!!await qe(d),Be=(d,g,T)=>{const b=c.useContext(ae);if(b===null)throw new Error("useEmbeddedEffect must be used within a MMEmbeddableZoneProvider");const w=c.useRef(T);c.useEffect(()=>{w.current=T},[T]),c.useEffect(()=>{if(!(!d||!g))return b.addListener(d,g,(...y)=>w.current(...y))},[b,d,g])};Ve.propTypes={children:G.node.isRequired};const _r=Le.default||Le,wr=_r.iframe`
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const x=require("react/jsx-runtime"),t=require("react"),w=require("prop-types"),Z=require("styled-components"),S=t.createContext(null),$=({children:n})=>{const[i,d]=t.useState({}),a=t.useRef({}),u=t.useRef({}),c=t.useRef({}),M=t.useCallback((e,r)=>!!c.current[e]?.has(r),[]),p=t.useCallback((e,r,s)=>{d(o=>({...o,[e]:{origin:r,frameRef:s}}))},[]),y=t.useCallback(e=>{d(r=>{const s={...r};return delete s[e],s}),delete c.current[e]},[]);t.useEffect(()=>{const e=(s=[],o)=>{s.forEach(l=>l(o))},r=s=>{if(!s?.data?.instanceId)return;const{instanceId:o,type:l}=s.data,m=a.current;if(l==="response"){const{callbackId:E,response:F,error:C}=s.data,q=u.current[E];q&&(q(F,C),delete u.current[E]);return}if(l==="mark-registered"){const{requestType:E}=s.data;c.current[o]||(c.current[o]=new Set),c.current[o].add(E);return}e(m[o]?.[l],s.data),e(m["*"]?.[l],s.data),e(m[o]?.["*"],s.data),e(m["*"]?.["*"],s.data)};return window.addEventListener("message",r),()=>{window.removeEventListener("message",r)}},[i]);const f=t.useCallback((e,r,s)=>{const o=i[e];if(!o){console.warn(`Origin not set for id: ${e}. Unable to send message.`);return}o?.frameRef?.current?.contentWindow&&o.frameRef.current.contentWindow.postMessage({type:r,...s,instanceId:e},o.origin)},[i]),b=t.useRef(0),k=t.useCallback(()=>`${Date.now()}-${++b.current}`,[]),h=t.useCallback(async(e,r,s={})=>new Promise((o,l)=>{const m=k(),E=(F,C)=>{delete u.current[m],C?l(C):o(F)};u.current[m]=E,f(e,"request",{callbackId:m,requestType:r,data:s})}),[f]),R=t.useCallback((e,r)=>{f(e,"load-options",r)},[f]),g=t.useCallback((e,r)=>{f(e,"validate",r)},[f]),v=t.useMemo(()=>({registerFrame:p,unregisterFrame:y,sendMessage:f,sendRequest:h,loadOptions:R,validate:g,hasHandler:M,addListener:(e,r,s)=>(a.current[e]||(a.current[e]={}),a.current[e][r]||(a.current[e][r]=[]),a.current[e][r].push(s),()=>{a.current[e][r]=a.current[e][r].filter(o=>o!==s)})}),[p,y,f,h,R,g,M]);return x.jsx(S.Provider,{value:v,children:n})},I={},j=async n=>{try{const i=new URL(n).origin;if(I[i]!==void 0)return I[i];const a=await(await fetch(`${i}/mm-app-manifest.json`)).json();if(!a.version)throw new Error("Invalid manifest");return I[i]=a,a}catch{}return I[origin]=!1,!1},P=async n=>!!await j(n),L=(n,i,d)=>{const a=t.useContext(S);if(a===null)throw new Error("useEmbeddedEffect must be used within a MMEmbeddableZoneProvider");const u=t.useRef(d);t.useEffect(()=>{u.current=d},[d]),t.useEffect(()=>{if(!(!n||!i))return a.addListener(n,i,(...c)=>u.current(...c))},[a,n,i])};$.propTypes={children:w.node.isRequired};const T=Z.default||Z,U=T.iframe`
|
|
31
2
|
width: 100%;
|
|
32
3
|
height: 100%;
|
|
33
4
|
border: none;
|
|
34
|
-
visibility: ${
|
|
35
|
-
`,
|
|
5
|
+
visibility: ${n=>n.$isReady?"visible":"hidden"};
|
|
6
|
+
`,A=({id:n,src:i,path:d,onInit:a=()=>{},context:u={},params:c={},...M})=>{if("isConfiguring"in M)return console.error("isConfiguring must be passed via the params prop to MMEmbeddableZone"),null;if("colorMode"in u)return console.error("colorMode must be passed via the params prop to MMEmbeddableZone"),null;if("isFullScreen"in u)return console.error("isFullScreen must be passed via the params prop to MMEmbeddableZone"),null;const p=t.useRef(),[y,f]=t.useState(),[b,k]=t.useState(0),{registerFrame:h,unregisterFrame:R,sendMessage:g}=t.useContext(S),[v,e]=t.useState(!0),[r,s]=t.useState();return t.useEffect(()=>{b&&g(n,"set-context",{context:{...u,colorMode:c.colorMode,isFullScreen:c.isFullScreen}})},[u,c.colorMode,c.isFullScreen,n,b]),t.useEffect(()=>{b&&(g(n,"set-params",{params:c}),g(n,"set-configuring",{isConfiguring:c.isConfiguring}))},[c,n,b]),t.useEffect(()=>{d!==void 0&&s(d||"/")},[d]),t.useEffect(()=>{r===void 0||!b||g(n,"navigate",{path:r})},[r,b,n,g]),t.useEffect(()=>{if(!(!i||!n||!p))return(async()=>{const o=await P(i);if(e(o),o){const l=new URL(i);h(n,l.origin,p),a(),f(`${l.origin}/mm-embedded-interop?id=${n}&origin=${window.location.origin}`);return}})(),()=>{R(n)}},[i,n,h,p]),L(n,"ready",()=>k(o=>o+1)),v?x.jsx(U,{$isReady:b,ref:p,src:y,...M}):x.jsx("div",{style:{height:"100%",display:"flex",flex:1,alignItems:"center",justifyContent:"center"},children:x.jsx("div",{style:{textAlign:"center"},children:"Application must adhere to the MM App Manifest specification to be embedded."})})};A.propTypes={id:w.string,src:w.string.isRequired,path:w.string,onInit:w.func};exports.MMEmbeddableZone=A;exports.MMEmbeddableZoneContext=S;exports.MMEmbeddableZoneProvider=$;exports.getAppInfo=j;exports.testIsEmbeddable=P;exports.useEmbeddedEffect=L;
|
|
@@ -1,821 +1,187 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
*/
|
|
14
|
-
var qe;
|
|
15
|
-
function _r() {
|
|
16
|
-
if (qe) return N;
|
|
17
|
-
qe = 1;
|
|
18
|
-
var f = Je, g = Symbol.for("react.element"), T = Symbol.for("react.fragment"), p = Object.prototype.hasOwnProperty, _ = f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, y = { key: !0, ref: !0, __self: !0, __source: !0 };
|
|
19
|
-
function k(S, h, w) {
|
|
20
|
-
var b, O = {}, j = null, I = null;
|
|
21
|
-
w !== void 0 && (j = "" + w), h.key !== void 0 && (j = "" + h.key), h.ref !== void 0 && (I = h.ref);
|
|
22
|
-
for (b in h) p.call(h, b) && !y.hasOwnProperty(b) && (O[b] = h[b]);
|
|
23
|
-
if (S && S.defaultProps) for (b in h = S.defaultProps, h) O[b] === void 0 && (O[b] = h[b]);
|
|
24
|
-
return { $$typeof: g, type: S, key: j, ref: I, props: O, _owner: _.current };
|
|
25
|
-
}
|
|
26
|
-
return N.Fragment = T, N.jsx = k, N.jsxs = k, N;
|
|
27
|
-
}
|
|
28
|
-
var G = {};
|
|
29
|
-
/**
|
|
30
|
-
* @license React
|
|
31
|
-
* react-jsx-runtime.development.js
|
|
32
|
-
*
|
|
33
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
34
|
-
*
|
|
35
|
-
* This source code is licensed under the MIT license found in the
|
|
36
|
-
* LICENSE file in the root directory of this source tree.
|
|
37
|
-
*/
|
|
38
|
-
var Be;
|
|
39
|
-
function wr() {
|
|
40
|
-
return Be || (Be = 1, process.env.NODE_ENV !== "production" && function() {
|
|
41
|
-
var f = Je, g = Symbol.for("react.element"), T = Symbol.for("react.portal"), p = Symbol.for("react.fragment"), _ = Symbol.for("react.strict_mode"), y = Symbol.for("react.profiler"), k = Symbol.for("react.provider"), S = Symbol.for("react.context"), h = Symbol.for("react.forward_ref"), w = Symbol.for("react.suspense"), b = Symbol.for("react.suspense_list"), O = Symbol.for("react.memo"), j = Symbol.for("react.lazy"), I = Symbol.for("react.offscreen"), a = Symbol.iterator, v = "@@iterator";
|
|
42
|
-
function s(e) {
|
|
43
|
-
if (e === null || typeof e != "object")
|
|
44
|
-
return null;
|
|
45
|
-
var r = a && e[a] || e[v];
|
|
46
|
-
return typeof r == "function" ? r : null;
|
|
47
|
-
}
|
|
48
|
-
var u = f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
49
|
-
function c(e) {
|
|
50
|
-
{
|
|
51
|
-
for (var r = arguments.length, t = new Array(r > 1 ? r - 1 : 0), n = 1; n < r; n++)
|
|
52
|
-
t[n - 1] = arguments[n];
|
|
53
|
-
R("error", e, t);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
function R(e, r, t) {
|
|
57
|
-
{
|
|
58
|
-
var n = u.ReactDebugCurrentFrame, l = n.getStackAddendum();
|
|
59
|
-
l !== "" && (r += "%s", t = t.concat([l]));
|
|
60
|
-
var d = t.map(function(i) {
|
|
61
|
-
return String(i);
|
|
62
|
-
});
|
|
63
|
-
d.unshift("Warning: " + r), Function.prototype.apply.call(console[e], console, d);
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
var M = !1, U = !1, D = !1, Q = !1, ee = !1, $;
|
|
67
|
-
$ = Symbol.for("react.module.reference");
|
|
68
|
-
function se(e) {
|
|
69
|
-
return !!(typeof e == "string" || typeof e == "function" || e === p || e === y || ee || e === _ || e === w || e === b || Q || e === I || M || U || D || typeof e == "object" && e !== null && (e.$$typeof === j || e.$$typeof === O || e.$$typeof === k || e.$$typeof === S || e.$$typeof === h || // This needs to include all possible module reference object
|
|
70
|
-
// types supported by any Flight configuration anywhere since
|
|
71
|
-
// we don't know which Flight build this will end up being used
|
|
72
|
-
// with.
|
|
73
|
-
e.$$typeof === $ || e.getModuleId !== void 0));
|
|
74
|
-
}
|
|
75
|
-
function ue(e, r, t) {
|
|
76
|
-
var n = e.displayName;
|
|
77
|
-
if (n)
|
|
78
|
-
return n;
|
|
79
|
-
var l = r.displayName || r.name || "";
|
|
80
|
-
return l !== "" ? t + "(" + l + ")" : t;
|
|
81
|
-
}
|
|
82
|
-
function B(e) {
|
|
83
|
-
return e.displayName || "Context";
|
|
84
|
-
}
|
|
85
|
-
function F(e) {
|
|
86
|
-
if (e == null)
|
|
87
|
-
return null;
|
|
88
|
-
if (typeof e.tag == "number" && c("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof e == "function")
|
|
89
|
-
return e.displayName || e.name || null;
|
|
90
|
-
if (typeof e == "string")
|
|
91
|
-
return e;
|
|
92
|
-
switch (e) {
|
|
93
|
-
case p:
|
|
94
|
-
return "Fragment";
|
|
95
|
-
case T:
|
|
96
|
-
return "Portal";
|
|
97
|
-
case y:
|
|
98
|
-
return "Profiler";
|
|
99
|
-
case _:
|
|
100
|
-
return "StrictMode";
|
|
101
|
-
case w:
|
|
102
|
-
return "Suspense";
|
|
103
|
-
case b:
|
|
104
|
-
return "SuspenseList";
|
|
105
|
-
}
|
|
106
|
-
if (typeof e == "object")
|
|
107
|
-
switch (e.$$typeof) {
|
|
108
|
-
case S:
|
|
109
|
-
var r = e;
|
|
110
|
-
return B(r) + ".Consumer";
|
|
111
|
-
case k:
|
|
112
|
-
var t = e;
|
|
113
|
-
return B(t._context) + ".Provider";
|
|
114
|
-
case h:
|
|
115
|
-
return ue(e, e.render, "ForwardRef");
|
|
116
|
-
case O:
|
|
117
|
-
var n = e.displayName || null;
|
|
118
|
-
return n !== null ? n : F(e.type) || "Memo";
|
|
119
|
-
case j: {
|
|
120
|
-
var l = e, d = l._payload, i = l._init;
|
|
121
|
-
try {
|
|
122
|
-
return F(i(d));
|
|
123
|
-
} catch {
|
|
124
|
-
return null;
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
return null;
|
|
129
|
-
}
|
|
130
|
-
var W = Object.assign, J = 0, Ee, Re, _e, we, Te, Se, Ce;
|
|
131
|
-
function Oe() {
|
|
132
|
-
}
|
|
133
|
-
Oe.__reactDisabledLog = !0;
|
|
134
|
-
function Ze() {
|
|
135
|
-
{
|
|
136
|
-
if (J === 0) {
|
|
137
|
-
Ee = console.log, Re = console.info, _e = console.warn, we = console.error, Te = console.group, Se = console.groupCollapsed, Ce = console.groupEnd;
|
|
138
|
-
var e = {
|
|
139
|
-
configurable: !0,
|
|
140
|
-
enumerable: !0,
|
|
141
|
-
value: Oe,
|
|
142
|
-
writable: !0
|
|
143
|
-
};
|
|
144
|
-
Object.defineProperties(console, {
|
|
145
|
-
info: e,
|
|
146
|
-
log: e,
|
|
147
|
-
warn: e,
|
|
148
|
-
error: e,
|
|
149
|
-
group: e,
|
|
150
|
-
groupCollapsed: e,
|
|
151
|
-
groupEnd: e
|
|
152
|
-
});
|
|
153
|
-
}
|
|
154
|
-
J++;
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
function Ne() {
|
|
158
|
-
{
|
|
159
|
-
if (J--, J === 0) {
|
|
160
|
-
var e = {
|
|
161
|
-
configurable: !0,
|
|
162
|
-
enumerable: !0,
|
|
163
|
-
writable: !0
|
|
164
|
-
};
|
|
165
|
-
Object.defineProperties(console, {
|
|
166
|
-
log: W({}, e, {
|
|
167
|
-
value: Ee
|
|
168
|
-
}),
|
|
169
|
-
info: W({}, e, {
|
|
170
|
-
value: Re
|
|
171
|
-
}),
|
|
172
|
-
warn: W({}, e, {
|
|
173
|
-
value: _e
|
|
174
|
-
}),
|
|
175
|
-
error: W({}, e, {
|
|
176
|
-
value: we
|
|
177
|
-
}),
|
|
178
|
-
group: W({}, e, {
|
|
179
|
-
value: Te
|
|
180
|
-
}),
|
|
181
|
-
groupCollapsed: W({}, e, {
|
|
182
|
-
value: Se
|
|
183
|
-
}),
|
|
184
|
-
groupEnd: W({}, e, {
|
|
185
|
-
value: Ce
|
|
186
|
-
})
|
|
187
|
-
});
|
|
188
|
-
}
|
|
189
|
-
J < 0 && c("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
var ce = u.ReactCurrentDispatcher, le;
|
|
193
|
-
function re(e, r, t) {
|
|
194
|
-
{
|
|
195
|
-
if (le === void 0)
|
|
196
|
-
try {
|
|
197
|
-
throw Error();
|
|
198
|
-
} catch (l) {
|
|
199
|
-
var n = l.stack.trim().match(/\n( *(at )?)/);
|
|
200
|
-
le = n && n[1] || "";
|
|
201
|
-
}
|
|
202
|
-
return `
|
|
203
|
-
` + le + e;
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
var fe = !1, te;
|
|
207
|
-
{
|
|
208
|
-
var Ge = typeof WeakMap == "function" ? WeakMap : Map;
|
|
209
|
-
te = new Ge();
|
|
210
|
-
}
|
|
211
|
-
function Pe(e, r) {
|
|
212
|
-
if (!e || fe)
|
|
213
|
-
return "";
|
|
214
|
-
{
|
|
215
|
-
var t = te.get(e);
|
|
216
|
-
if (t !== void 0)
|
|
217
|
-
return t;
|
|
218
|
-
}
|
|
219
|
-
var n;
|
|
220
|
-
fe = !0;
|
|
221
|
-
var l = Error.prepareStackTrace;
|
|
222
|
-
Error.prepareStackTrace = void 0;
|
|
223
|
-
var d;
|
|
224
|
-
d = ce.current, ce.current = null, Ze();
|
|
225
|
-
try {
|
|
226
|
-
if (r) {
|
|
227
|
-
var i = function() {
|
|
228
|
-
throw Error();
|
|
229
|
-
};
|
|
230
|
-
if (Object.defineProperty(i.prototype, "props", {
|
|
231
|
-
set: function() {
|
|
232
|
-
throw Error();
|
|
233
|
-
}
|
|
234
|
-
}), typeof Reflect == "object" && Reflect.construct) {
|
|
235
|
-
try {
|
|
236
|
-
Reflect.construct(i, []);
|
|
237
|
-
} catch (P) {
|
|
238
|
-
n = P;
|
|
239
|
-
}
|
|
240
|
-
Reflect.construct(e, [], i);
|
|
241
|
-
} else {
|
|
242
|
-
try {
|
|
243
|
-
i.call();
|
|
244
|
-
} catch (P) {
|
|
245
|
-
n = P;
|
|
246
|
-
}
|
|
247
|
-
e.call(i.prototype);
|
|
248
|
-
}
|
|
249
|
-
} else {
|
|
250
|
-
try {
|
|
251
|
-
throw Error();
|
|
252
|
-
} catch (P) {
|
|
253
|
-
n = P;
|
|
254
|
-
}
|
|
255
|
-
e();
|
|
256
|
-
}
|
|
257
|
-
} catch (P) {
|
|
258
|
-
if (P && n && typeof P.stack == "string") {
|
|
259
|
-
for (var o = P.stack.split(`
|
|
260
|
-
`), C = n.stack.split(`
|
|
261
|
-
`), m = o.length - 1, E = C.length - 1; m >= 1 && E >= 0 && o[m] !== C[E]; )
|
|
262
|
-
E--;
|
|
263
|
-
for (; m >= 1 && E >= 0; m--, E--)
|
|
264
|
-
if (o[m] !== C[E]) {
|
|
265
|
-
if (m !== 1 || E !== 1)
|
|
266
|
-
do
|
|
267
|
-
if (m--, E--, E < 0 || o[m] !== C[E]) {
|
|
268
|
-
var x = `
|
|
269
|
-
` + o[m].replace(" at new ", " at ");
|
|
270
|
-
return e.displayName && x.includes("<anonymous>") && (x = x.replace("<anonymous>", e.displayName)), typeof e == "function" && te.set(e, x), x;
|
|
271
|
-
}
|
|
272
|
-
while (m >= 1 && E >= 0);
|
|
273
|
-
break;
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
|
-
} finally {
|
|
277
|
-
fe = !1, ce.current = d, Ne(), Error.prepareStackTrace = l;
|
|
278
|
-
}
|
|
279
|
-
var q = e ? e.displayName || e.name : "", L = q ? re(q) : "";
|
|
280
|
-
return typeof e == "function" && te.set(e, L), L;
|
|
281
|
-
}
|
|
282
|
-
function ze(e, r, t) {
|
|
283
|
-
return Pe(e, !1);
|
|
284
|
-
}
|
|
285
|
-
function He(e) {
|
|
286
|
-
var r = e.prototype;
|
|
287
|
-
return !!(r && r.isReactComponent);
|
|
288
|
-
}
|
|
289
|
-
function ne(e, r, t) {
|
|
290
|
-
if (e == null)
|
|
291
|
-
return "";
|
|
292
|
-
if (typeof e == "function")
|
|
293
|
-
return Pe(e, He(e));
|
|
294
|
-
if (typeof e == "string")
|
|
295
|
-
return re(e);
|
|
296
|
-
switch (e) {
|
|
297
|
-
case w:
|
|
298
|
-
return re("Suspense");
|
|
299
|
-
case b:
|
|
300
|
-
return re("SuspenseList");
|
|
301
|
-
}
|
|
302
|
-
if (typeof e == "object")
|
|
303
|
-
switch (e.$$typeof) {
|
|
304
|
-
case h:
|
|
305
|
-
return ze(e.render);
|
|
306
|
-
case O:
|
|
307
|
-
return ne(e.type, r, t);
|
|
308
|
-
case j: {
|
|
309
|
-
var n = e, l = n._payload, d = n._init;
|
|
310
|
-
try {
|
|
311
|
-
return ne(d(l), r, t);
|
|
312
|
-
} catch {
|
|
313
|
-
}
|
|
314
|
-
}
|
|
315
|
-
}
|
|
316
|
-
return "";
|
|
317
|
-
}
|
|
318
|
-
var K = Object.prototype.hasOwnProperty, je = {}, xe = u.ReactDebugCurrentFrame;
|
|
319
|
-
function ae(e) {
|
|
320
|
-
if (e) {
|
|
321
|
-
var r = e._owner, t = ne(e.type, e._source, r ? r.type : null);
|
|
322
|
-
xe.setExtraStackFrame(t);
|
|
323
|
-
} else
|
|
324
|
-
xe.setExtraStackFrame(null);
|
|
325
|
-
}
|
|
326
|
-
function Xe(e, r, t, n, l) {
|
|
327
|
-
{
|
|
328
|
-
var d = Function.call.bind(K);
|
|
329
|
-
for (var i in e)
|
|
330
|
-
if (d(e, i)) {
|
|
331
|
-
var o = void 0;
|
|
332
|
-
try {
|
|
333
|
-
if (typeof e[i] != "function") {
|
|
334
|
-
var C = Error((n || "React class") + ": " + t + " type `" + i + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof e[i] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
|
|
335
|
-
throw C.name = "Invariant Violation", C;
|
|
336
|
-
}
|
|
337
|
-
o = e[i](r, i, n, t, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
|
|
338
|
-
} catch (m) {
|
|
339
|
-
o = m;
|
|
340
|
-
}
|
|
341
|
-
o && !(o instanceof Error) && (ae(l), c("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", n || "React class", t, i, typeof o), ae(null)), o instanceof Error && !(o.message in je) && (je[o.message] = !0, ae(l), c("Failed %s type: %s", t, o.message), ae(null));
|
|
342
|
-
}
|
|
343
|
-
}
|
|
344
|
-
}
|
|
345
|
-
var Qe = Array.isArray;
|
|
346
|
-
function de(e) {
|
|
347
|
-
return Qe(e);
|
|
348
|
-
}
|
|
349
|
-
function er(e) {
|
|
350
|
-
{
|
|
351
|
-
var r = typeof Symbol == "function" && Symbol.toStringTag, t = r && e[Symbol.toStringTag] || e.constructor.name || "Object";
|
|
352
|
-
return t;
|
|
353
|
-
}
|
|
354
|
-
}
|
|
355
|
-
function rr(e) {
|
|
356
|
-
try {
|
|
357
|
-
return ke(e), !1;
|
|
358
|
-
} catch {
|
|
359
|
-
return !0;
|
|
360
|
-
}
|
|
361
|
-
}
|
|
362
|
-
function ke(e) {
|
|
363
|
-
return "" + e;
|
|
364
|
-
}
|
|
365
|
-
function Fe(e) {
|
|
366
|
-
if (rr(e))
|
|
367
|
-
return c("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", er(e)), ke(e);
|
|
368
|
-
}
|
|
369
|
-
var Z = u.ReactCurrentOwner, tr = {
|
|
370
|
-
key: !0,
|
|
371
|
-
ref: !0,
|
|
372
|
-
__self: !0,
|
|
373
|
-
__source: !0
|
|
374
|
-
}, Me, Ie, ve;
|
|
375
|
-
ve = {};
|
|
376
|
-
function nr(e) {
|
|
377
|
-
if (K.call(e, "ref")) {
|
|
378
|
-
var r = Object.getOwnPropertyDescriptor(e, "ref").get;
|
|
379
|
-
if (r && r.isReactWarning)
|
|
380
|
-
return !1;
|
|
381
|
-
}
|
|
382
|
-
return e.ref !== void 0;
|
|
383
|
-
}
|
|
384
|
-
function ar(e) {
|
|
385
|
-
if (K.call(e, "key")) {
|
|
386
|
-
var r = Object.getOwnPropertyDescriptor(e, "key").get;
|
|
387
|
-
if (r && r.isReactWarning)
|
|
388
|
-
return !1;
|
|
389
|
-
}
|
|
390
|
-
return e.key !== void 0;
|
|
391
|
-
}
|
|
392
|
-
function or(e, r) {
|
|
393
|
-
if (typeof e.ref == "string" && Z.current && r && Z.current.stateNode !== r) {
|
|
394
|
-
var t = F(Z.current.type);
|
|
395
|
-
ve[t] || (c('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref', F(Z.current.type), e.ref), ve[t] = !0);
|
|
396
|
-
}
|
|
397
|
-
}
|
|
398
|
-
function ir(e, r) {
|
|
399
|
-
{
|
|
400
|
-
var t = function() {
|
|
401
|
-
Me || (Me = !0, c("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", r));
|
|
402
|
-
};
|
|
403
|
-
t.isReactWarning = !0, Object.defineProperty(e, "key", {
|
|
404
|
-
get: t,
|
|
405
|
-
configurable: !0
|
|
406
|
-
});
|
|
407
|
-
}
|
|
408
|
-
}
|
|
409
|
-
function sr(e, r) {
|
|
410
|
-
{
|
|
411
|
-
var t = function() {
|
|
412
|
-
Ie || (Ie = !0, c("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", r));
|
|
413
|
-
};
|
|
414
|
-
t.isReactWarning = !0, Object.defineProperty(e, "ref", {
|
|
415
|
-
get: t,
|
|
416
|
-
configurable: !0
|
|
417
|
-
});
|
|
418
|
-
}
|
|
419
|
-
}
|
|
420
|
-
var ur = function(e, r, t, n, l, d, i) {
|
|
421
|
-
var o = {
|
|
422
|
-
// This tag allows us to uniquely identify this as a React Element
|
|
423
|
-
$$typeof: g,
|
|
424
|
-
// Built-in properties that belong on the element
|
|
425
|
-
type: e,
|
|
426
|
-
key: r,
|
|
427
|
-
ref: t,
|
|
428
|
-
props: i,
|
|
429
|
-
// Record the component responsible for creating this element.
|
|
430
|
-
_owner: d
|
|
431
|
-
};
|
|
432
|
-
return o._store = {}, Object.defineProperty(o._store, "validated", {
|
|
433
|
-
configurable: !1,
|
|
434
|
-
enumerable: !1,
|
|
435
|
-
writable: !0,
|
|
436
|
-
value: !1
|
|
437
|
-
}), Object.defineProperty(o, "_self", {
|
|
438
|
-
configurable: !1,
|
|
439
|
-
enumerable: !1,
|
|
440
|
-
writable: !1,
|
|
441
|
-
value: n
|
|
442
|
-
}), Object.defineProperty(o, "_source", {
|
|
443
|
-
configurable: !1,
|
|
444
|
-
enumerable: !1,
|
|
445
|
-
writable: !1,
|
|
446
|
-
value: l
|
|
447
|
-
}), Object.freeze && (Object.freeze(o.props), Object.freeze(o)), o;
|
|
448
|
-
};
|
|
449
|
-
function cr(e, r, t, n, l) {
|
|
450
|
-
{
|
|
451
|
-
var d, i = {}, o = null, C = null;
|
|
452
|
-
t !== void 0 && (Fe(t), o = "" + t), ar(r) && (Fe(r.key), o = "" + r.key), nr(r) && (C = r.ref, or(r, l));
|
|
453
|
-
for (d in r)
|
|
454
|
-
K.call(r, d) && !tr.hasOwnProperty(d) && (i[d] = r[d]);
|
|
455
|
-
if (e && e.defaultProps) {
|
|
456
|
-
var m = e.defaultProps;
|
|
457
|
-
for (d in m)
|
|
458
|
-
i[d] === void 0 && (i[d] = m[d]);
|
|
459
|
-
}
|
|
460
|
-
if (o || C) {
|
|
461
|
-
var E = typeof e == "function" ? e.displayName || e.name || "Unknown" : e;
|
|
462
|
-
o && ir(i, E), C && sr(i, E);
|
|
463
|
-
}
|
|
464
|
-
return ur(e, o, C, l, n, Z.current, i);
|
|
465
|
-
}
|
|
466
|
-
}
|
|
467
|
-
var pe = u.ReactCurrentOwner, Ae = u.ReactDebugCurrentFrame;
|
|
468
|
-
function V(e) {
|
|
469
|
-
if (e) {
|
|
470
|
-
var r = e._owner, t = ne(e.type, e._source, r ? r.type : null);
|
|
471
|
-
Ae.setExtraStackFrame(t);
|
|
472
|
-
} else
|
|
473
|
-
Ae.setExtraStackFrame(null);
|
|
474
|
-
}
|
|
475
|
-
var ge;
|
|
476
|
-
ge = !1;
|
|
477
|
-
function be(e) {
|
|
478
|
-
return typeof e == "object" && e !== null && e.$$typeof === g;
|
|
479
|
-
}
|
|
480
|
-
function De() {
|
|
481
|
-
{
|
|
482
|
-
if (pe.current) {
|
|
483
|
-
var e = F(pe.current.type);
|
|
484
|
-
if (e)
|
|
485
|
-
return `
|
|
486
|
-
|
|
487
|
-
Check the render method of \`` + e + "`.";
|
|
488
|
-
}
|
|
489
|
-
return "";
|
|
490
|
-
}
|
|
491
|
-
}
|
|
492
|
-
function lr(e) {
|
|
493
|
-
return "";
|
|
494
|
-
}
|
|
495
|
-
var $e = {};
|
|
496
|
-
function fr(e) {
|
|
497
|
-
{
|
|
498
|
-
var r = De();
|
|
499
|
-
if (!r) {
|
|
500
|
-
var t = typeof e == "string" ? e : e.displayName || e.name;
|
|
501
|
-
t && (r = `
|
|
502
|
-
|
|
503
|
-
Check the top-level render call using <` + t + ">.");
|
|
504
|
-
}
|
|
505
|
-
return r;
|
|
506
|
-
}
|
|
507
|
-
}
|
|
508
|
-
function We(e, r) {
|
|
509
|
-
{
|
|
510
|
-
if (!e._store || e._store.validated || e.key != null)
|
|
511
|
-
return;
|
|
512
|
-
e._store.validated = !0;
|
|
513
|
-
var t = fr(r);
|
|
514
|
-
if ($e[t])
|
|
515
|
-
return;
|
|
516
|
-
$e[t] = !0;
|
|
517
|
-
var n = "";
|
|
518
|
-
e && e._owner && e._owner !== pe.current && (n = " It was passed a child from " + F(e._owner.type) + "."), V(e), c('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', t, n), V(null);
|
|
519
|
-
}
|
|
520
|
-
}
|
|
521
|
-
function Le(e, r) {
|
|
522
|
-
{
|
|
523
|
-
if (typeof e != "object")
|
|
524
|
-
return;
|
|
525
|
-
if (de(e))
|
|
526
|
-
for (var t = 0; t < e.length; t++) {
|
|
527
|
-
var n = e[t];
|
|
528
|
-
be(n) && We(n, r);
|
|
529
|
-
}
|
|
530
|
-
else if (be(e))
|
|
531
|
-
e._store && (e._store.validated = !0);
|
|
532
|
-
else if (e) {
|
|
533
|
-
var l = s(e);
|
|
534
|
-
if (typeof l == "function" && l !== e.entries)
|
|
535
|
-
for (var d = l.call(e), i; !(i = d.next()).done; )
|
|
536
|
-
be(i.value) && We(i.value, r);
|
|
537
|
-
}
|
|
538
|
-
}
|
|
539
|
-
}
|
|
540
|
-
function dr(e) {
|
|
541
|
-
{
|
|
542
|
-
var r = e.type;
|
|
543
|
-
if (r == null || typeof r == "string")
|
|
544
|
-
return;
|
|
545
|
-
var t;
|
|
546
|
-
if (typeof r == "function")
|
|
547
|
-
t = r.propTypes;
|
|
548
|
-
else if (typeof r == "object" && (r.$$typeof === h || // Note: Memo only checks outer props here.
|
|
549
|
-
// Inner props are checked in the reconciler.
|
|
550
|
-
r.$$typeof === O))
|
|
551
|
-
t = r.propTypes;
|
|
552
|
-
else
|
|
553
|
-
return;
|
|
554
|
-
if (t) {
|
|
555
|
-
var n = F(r);
|
|
556
|
-
Xe(t, e.props, "prop", n, e);
|
|
557
|
-
} else if (r.PropTypes !== void 0 && !ge) {
|
|
558
|
-
ge = !0;
|
|
559
|
-
var l = F(r);
|
|
560
|
-
c("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", l || "Unknown");
|
|
561
|
-
}
|
|
562
|
-
typeof r.getDefaultProps == "function" && !r.getDefaultProps.isReactClassApproved && c("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
|
|
563
|
-
}
|
|
564
|
-
}
|
|
565
|
-
function vr(e) {
|
|
566
|
-
{
|
|
567
|
-
for (var r = Object.keys(e.props), t = 0; t < r.length; t++) {
|
|
568
|
-
var n = r[t];
|
|
569
|
-
if (n !== "children" && n !== "key") {
|
|
570
|
-
V(e), c("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", n), V(null);
|
|
571
|
-
break;
|
|
572
|
-
}
|
|
573
|
-
}
|
|
574
|
-
e.ref !== null && (V(e), c("Invalid attribute `ref` supplied to `React.Fragment`."), V(null));
|
|
575
|
-
}
|
|
576
|
-
}
|
|
577
|
-
var Ye = {};
|
|
578
|
-
function Ue(e, r, t, n, l, d) {
|
|
579
|
-
{
|
|
580
|
-
var i = se(e);
|
|
581
|
-
if (!i) {
|
|
582
|
-
var o = "";
|
|
583
|
-
(e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (o += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
|
|
584
|
-
var C = lr();
|
|
585
|
-
C ? o += C : o += De();
|
|
586
|
-
var m;
|
|
587
|
-
e === null ? m = "null" : de(e) ? m = "array" : e !== void 0 && e.$$typeof === g ? (m = "<" + (F(e.type) || "Unknown") + " />", o = " Did you accidentally export a JSX literal instead of a component?") : m = typeof e, c("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", m, o);
|
|
588
|
-
}
|
|
589
|
-
var E = cr(e, r, t, l, d);
|
|
590
|
-
if (E == null)
|
|
591
|
-
return E;
|
|
592
|
-
if (i) {
|
|
593
|
-
var x = r.children;
|
|
594
|
-
if (x !== void 0)
|
|
595
|
-
if (n)
|
|
596
|
-
if (de(x)) {
|
|
597
|
-
for (var q = 0; q < x.length; q++)
|
|
598
|
-
Le(x[q], e);
|
|
599
|
-
Object.freeze && Object.freeze(x);
|
|
600
|
-
} else
|
|
601
|
-
c("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
|
|
602
|
-
else
|
|
603
|
-
Le(x, e);
|
|
604
|
-
}
|
|
605
|
-
if (K.call(r, "key")) {
|
|
606
|
-
var L = F(e), P = Object.keys(r).filter(function(hr) {
|
|
607
|
-
return hr !== "key";
|
|
608
|
-
}), me = P.length > 0 ? "{key: someKey, " + P.join(": ..., ") + ": ...}" : "{key: someKey}";
|
|
609
|
-
if (!Ye[L + me]) {
|
|
610
|
-
var yr = P.length > 0 ? "{" + P.join(": ..., ") + ": ...}" : "{}";
|
|
611
|
-
c(`A props object containing a "key" prop is being spread into JSX:
|
|
612
|
-
let props = %s;
|
|
613
|
-
<%s {...props} />
|
|
614
|
-
React keys must be passed directly to JSX without using spread:
|
|
615
|
-
let props = %s;
|
|
616
|
-
<%s key={someKey} {...props} />`, me, L, yr, L), Ye[L + me] = !0;
|
|
617
|
-
}
|
|
618
|
-
}
|
|
619
|
-
return e === p ? vr(E) : dr(E), E;
|
|
620
|
-
}
|
|
621
|
-
}
|
|
622
|
-
function pr(e, r, t) {
|
|
623
|
-
return Ue(e, r, t, !0);
|
|
624
|
-
}
|
|
625
|
-
function gr(e, r, t) {
|
|
626
|
-
return Ue(e, r, t, !1);
|
|
627
|
-
}
|
|
628
|
-
var br = gr, mr = pr;
|
|
629
|
-
G.Fragment = p, G.jsx = br, G.jsxs = mr;
|
|
630
|
-
}()), G;
|
|
631
|
-
}
|
|
632
|
-
process.env.NODE_ENV === "production" ? ye.exports = _r() : ye.exports = wr();
|
|
633
|
-
var ie = ye.exports;
|
|
634
|
-
const he = Er(null), Tr = ({ children: f }) => {
|
|
635
|
-
const [g, T] = z({}), p = X({}), _ = X({}), y = X({}), k = Y((a, v) => {
|
|
636
|
-
var s;
|
|
637
|
-
return !!((s = y.current[a]) != null && s.has(v));
|
|
638
|
-
}, []), S = Y((a, v, s) => {
|
|
639
|
-
T((u) => ({ ...u, [a]: { origin: v, frameRef: s } }));
|
|
640
|
-
}, []), h = Y((a) => {
|
|
641
|
-
T((v) => {
|
|
642
|
-
const s = { ...v };
|
|
643
|
-
return delete s[a], s;
|
|
644
|
-
}), delete y.current[a];
|
|
1
|
+
import { jsx as x } from "react/jsx-runtime";
|
|
2
|
+
import { createContext as j, useState as R, useRef as w, useCallback as b, useEffect as p, useMemo as A, useContext as U } from "react";
|
|
3
|
+
import I from "prop-types";
|
|
4
|
+
import k from "styled-components";
|
|
5
|
+
const Z = j(null), T = ({ children: n }) => {
|
|
6
|
+
const [o, d] = R({}), i = w({}), a = w({}), c = w({}), y = b((e, r) => !!c.current[e]?.has(r), []), h = b((e, r, t) => {
|
|
7
|
+
d((s) => ({ ...s, [e]: { origin: r, frameRef: t } }));
|
|
8
|
+
}, []), F = b((e) => {
|
|
9
|
+
d((r) => {
|
|
10
|
+
const t = { ...r };
|
|
11
|
+
return delete t[e], t;
|
|
12
|
+
}), delete c.current[e];
|
|
645
13
|
}, []);
|
|
646
|
-
|
|
647
|
-
const
|
|
648
|
-
|
|
649
|
-
},
|
|
650
|
-
|
|
651
|
-
if (!((M = s == null ? void 0 : s.data) != null && M.instanceId))
|
|
14
|
+
p(() => {
|
|
15
|
+
const e = (t = [], s) => {
|
|
16
|
+
t.forEach((u) => u(s));
|
|
17
|
+
}, r = (t) => {
|
|
18
|
+
if (!t?.data?.instanceId)
|
|
652
19
|
return;
|
|
653
|
-
const { instanceId:
|
|
654
|
-
if (
|
|
655
|
-
const { callbackId:
|
|
656
|
-
|
|
20
|
+
const { instanceId: s, type: u } = t.data, g = i.current;
|
|
21
|
+
if (u === "response") {
|
|
22
|
+
const { callbackId: M, response: S, error: $ } = t.data, q = a.current[M];
|
|
23
|
+
q && (q(S, $), delete a.current[M]);
|
|
657
24
|
return;
|
|
658
25
|
}
|
|
659
|
-
if (
|
|
660
|
-
const { requestType:
|
|
661
|
-
|
|
26
|
+
if (u === "mark-registered") {
|
|
27
|
+
const { requestType: M } = t.data;
|
|
28
|
+
c.current[s] || (c.current[s] = /* @__PURE__ */ new Set()), c.current[s].add(M);
|
|
662
29
|
return;
|
|
663
30
|
}
|
|
664
|
-
|
|
31
|
+
e(g[s]?.[u], t.data), e(g["*"]?.[u], t.data), e(g[s]?.["*"], t.data), e(g["*"]?.["*"], t.data);
|
|
665
32
|
};
|
|
666
|
-
return window.addEventListener("message",
|
|
667
|
-
window.removeEventListener("message",
|
|
33
|
+
return window.addEventListener("message", r), () => {
|
|
34
|
+
window.removeEventListener("message", r);
|
|
668
35
|
};
|
|
669
|
-
}, [
|
|
670
|
-
const
|
|
671
|
-
(
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
console.warn(`Origin not set for id: ${a}. Unable to send message.`);
|
|
36
|
+
}, [o]);
|
|
37
|
+
const l = b(
|
|
38
|
+
(e, r, t) => {
|
|
39
|
+
const s = o[e];
|
|
40
|
+
if (!s) {
|
|
41
|
+
console.warn(`Origin not set for id: ${e}. Unable to send message.`);
|
|
676
42
|
return;
|
|
677
43
|
}
|
|
678
|
-
|
|
679
|
-
{ type:
|
|
680
|
-
|
|
44
|
+
s?.frameRef?.current?.contentWindow && s.frameRef.current.contentWindow.postMessage(
|
|
45
|
+
{ type: r, ...t, instanceId: e },
|
|
46
|
+
s.origin
|
|
681
47
|
);
|
|
682
48
|
},
|
|
683
|
-
[
|
|
684
|
-
), b =
|
|
685
|
-
async (
|
|
686
|
-
const
|
|
687
|
-
delete
|
|
49
|
+
[o]
|
|
50
|
+
), f = w(0), L = b(() => `${Date.now()}-${++f.current}`, []), E = b(
|
|
51
|
+
async (e, r, t = {}) => new Promise((s, u) => {
|
|
52
|
+
const g = L(), M = (S, $) => {
|
|
53
|
+
delete a.current[g], $ ? u($) : s(S);
|
|
688
54
|
};
|
|
689
|
-
|
|
55
|
+
a.current[g] = M, l(e, "request", { callbackId: g, requestType: r, data: t });
|
|
690
56
|
}),
|
|
691
|
-
[
|
|
692
|
-
),
|
|
693
|
-
(
|
|
694
|
-
|
|
57
|
+
[l]
|
|
58
|
+
), C = b(
|
|
59
|
+
(e, r) => {
|
|
60
|
+
l(e, "load-options", r);
|
|
695
61
|
},
|
|
696
|
-
[
|
|
697
|
-
),
|
|
698
|
-
(
|
|
699
|
-
|
|
62
|
+
[l]
|
|
63
|
+
), m = b(
|
|
64
|
+
(e, r) => {
|
|
65
|
+
l(e, "validate", r);
|
|
700
66
|
},
|
|
701
|
-
[
|
|
702
|
-
),
|
|
67
|
+
[l]
|
|
68
|
+
), P = A(
|
|
703
69
|
() => ({
|
|
704
|
-
registerFrame:
|
|
705
|
-
unregisterFrame:
|
|
706
|
-
sendMessage:
|
|
707
|
-
sendRequest:
|
|
708
|
-
loadOptions:
|
|
709
|
-
validate:
|
|
710
|
-
hasHandler:
|
|
711
|
-
addListener: (
|
|
712
|
-
|
|
70
|
+
registerFrame: h,
|
|
71
|
+
unregisterFrame: F,
|
|
72
|
+
sendMessage: l,
|
|
73
|
+
sendRequest: E,
|
|
74
|
+
loadOptions: C,
|
|
75
|
+
validate: m,
|
|
76
|
+
hasHandler: y,
|
|
77
|
+
addListener: (e, r, t) => (i.current[e] || (i.current[e] = {}), i.current[e][r] || (i.current[e][r] = []), i.current[e][r].push(t), () => {
|
|
78
|
+
i.current[e][r] = i.current[e][r].filter((s) => s !== t);
|
|
713
79
|
})
|
|
714
80
|
}),
|
|
715
81
|
[
|
|
716
|
-
S,
|
|
717
82
|
h,
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
83
|
+
F,
|
|
84
|
+
l,
|
|
85
|
+
E,
|
|
86
|
+
C,
|
|
87
|
+
m,
|
|
88
|
+
y
|
|
723
89
|
]
|
|
724
90
|
);
|
|
725
|
-
return /* @__PURE__ */
|
|
726
|
-
},
|
|
91
|
+
return /* @__PURE__ */ x(Z.Provider, { value: P, children: n });
|
|
92
|
+
}, v = {}, O = async (n) => {
|
|
727
93
|
try {
|
|
728
|
-
const
|
|
729
|
-
if (
|
|
730
|
-
return
|
|
731
|
-
const
|
|
732
|
-
if (!
|
|
94
|
+
const o = new URL(n).origin;
|
|
95
|
+
if (v[o] !== void 0)
|
|
96
|
+
return v[o];
|
|
97
|
+
const i = await (await fetch(`${o}/mm-app-manifest.json`)).json();
|
|
98
|
+
if (!i.version)
|
|
733
99
|
throw new Error("Invalid manifest");
|
|
734
|
-
return
|
|
100
|
+
return v[o] = i, i;
|
|
735
101
|
} catch {
|
|
736
102
|
}
|
|
737
|
-
return
|
|
738
|
-
},
|
|
739
|
-
const
|
|
740
|
-
if (
|
|
103
|
+
return v[origin] = !1, !1;
|
|
104
|
+
}, H = async (n) => !!await O(n), W = (n, o, d) => {
|
|
105
|
+
const i = U(Z);
|
|
106
|
+
if (i === null)
|
|
741
107
|
throw new Error(
|
|
742
108
|
"useEmbeddedEffect must be used within a MMEmbeddableZoneProvider"
|
|
743
109
|
);
|
|
744
|
-
const
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
}, [
|
|
748
|
-
if (!(!
|
|
749
|
-
return
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
(...
|
|
110
|
+
const a = w(d);
|
|
111
|
+
p(() => {
|
|
112
|
+
a.current = d;
|
|
113
|
+
}, [d]), p(() => {
|
|
114
|
+
if (!(!n || !o))
|
|
115
|
+
return i.addListener(
|
|
116
|
+
n,
|
|
117
|
+
o,
|
|
118
|
+
(...c) => a.current(...c)
|
|
753
119
|
);
|
|
754
|
-
}, [
|
|
120
|
+
}, [i, n, o]);
|
|
755
121
|
};
|
|
756
|
-
|
|
757
|
-
children:
|
|
122
|
+
T.propTypes = {
|
|
123
|
+
children: I.node.isRequired
|
|
758
124
|
};
|
|
759
|
-
const
|
|
125
|
+
const B = k.default || k, D = B.iframe`
|
|
760
126
|
width: 100%;
|
|
761
127
|
height: 100%;
|
|
762
128
|
border: none;
|
|
763
|
-
visibility: ${(
|
|
764
|
-
`,
|
|
765
|
-
id:
|
|
766
|
-
src:
|
|
767
|
-
path:
|
|
768
|
-
onInit:
|
|
129
|
+
visibility: ${(n) => n.$isReady ? "visible" : "hidden"};
|
|
130
|
+
`, _ = ({
|
|
131
|
+
id: n,
|
|
132
|
+
src: o,
|
|
133
|
+
path: d,
|
|
134
|
+
onInit: i = () => {
|
|
769
135
|
},
|
|
770
|
-
context:
|
|
771
|
-
params:
|
|
772
|
-
...
|
|
136
|
+
context: a = {},
|
|
137
|
+
params: c = {},
|
|
138
|
+
...y
|
|
773
139
|
}) => {
|
|
774
|
-
if ("isConfiguring" in
|
|
140
|
+
if ("isConfiguring" in y)
|
|
775
141
|
return console.error(
|
|
776
142
|
"isConfiguring must be passed via the params prop to MMEmbeddableZone"
|
|
777
143
|
), null;
|
|
778
|
-
if ("colorMode" in
|
|
144
|
+
if ("colorMode" in a)
|
|
779
145
|
return console.error(
|
|
780
146
|
"colorMode must be passed via the params prop to MMEmbeddableZone"
|
|
781
147
|
), null;
|
|
782
|
-
if ("isFullScreen" in
|
|
148
|
+
if ("isFullScreen" in a)
|
|
783
149
|
return console.error(
|
|
784
150
|
"isFullScreen must be passed via the params prop to MMEmbeddableZone"
|
|
785
151
|
), null;
|
|
786
|
-
const
|
|
787
|
-
|
|
788
|
-
), [
|
|
789
|
-
return
|
|
790
|
-
|
|
152
|
+
const h = w(), [F, l] = R(), [f, L] = R(0), { registerFrame: E, unregisterFrame: C, sendMessage: m } = U(
|
|
153
|
+
Z
|
|
154
|
+
), [P, e] = R(!0), [r, t] = R();
|
|
155
|
+
return p(() => {
|
|
156
|
+
f && m(n, "set-context", {
|
|
791
157
|
context: {
|
|
792
|
-
...
|
|
158
|
+
...a,
|
|
793
159
|
// TODO: Remove this once everything is migrated to params
|
|
794
|
-
colorMode:
|
|
795
|
-
isFullScreen:
|
|
160
|
+
colorMode: c.colorMode,
|
|
161
|
+
isFullScreen: c.isFullScreen
|
|
796
162
|
}
|
|
797
163
|
});
|
|
798
|
-
}, [
|
|
799
|
-
|
|
800
|
-
}, [
|
|
801
|
-
|
|
802
|
-
}, [
|
|
803
|
-
|
|
804
|
-
}, [
|
|
805
|
-
if (!(!
|
|
164
|
+
}, [a, c.colorMode, c.isFullScreen, n, f]), p(() => {
|
|
165
|
+
f && (m(n, "set-params", { params: c }), m(n, "set-configuring", { isConfiguring: c.isConfiguring }));
|
|
166
|
+
}, [c, n, f]), p(() => {
|
|
167
|
+
d !== void 0 && t(d || "/");
|
|
168
|
+
}, [d]), p(() => {
|
|
169
|
+
r === void 0 || !f || m(n, "navigate", { path: r });
|
|
170
|
+
}, [r, f, n, m]), p(() => {
|
|
171
|
+
if (!(!o || !n || !h))
|
|
806
172
|
return (async () => {
|
|
807
|
-
const
|
|
808
|
-
if (s
|
|
809
|
-
const
|
|
810
|
-
|
|
811
|
-
`${
|
|
173
|
+
const s = await H(o);
|
|
174
|
+
if (e(s), s) {
|
|
175
|
+
const u = new URL(o);
|
|
176
|
+
E(n, u.origin, h), i(), l(
|
|
177
|
+
`${u.origin}/mm-embedded-interop?id=${n}&origin=${window.location.origin}`
|
|
812
178
|
);
|
|
813
179
|
return;
|
|
814
180
|
}
|
|
815
181
|
})(), () => {
|
|
816
|
-
|
|
182
|
+
C(n);
|
|
817
183
|
};
|
|
818
|
-
}, [
|
|
184
|
+
}, [o, n, E, h]), W(n, "ready", () => L((s) => s + 1)), P ? /* @__PURE__ */ x(D, { $isReady: f, ref: h, src: F, ...y }) : /* @__PURE__ */ x(
|
|
819
185
|
"div",
|
|
820
186
|
{
|
|
821
187
|
style: {
|
|
@@ -825,21 +191,21 @@ const Pr = Ve.default || Ve, jr = Pr.iframe`
|
|
|
825
191
|
alignItems: "center",
|
|
826
192
|
justifyContent: "center"
|
|
827
193
|
},
|
|
828
|
-
children: /* @__PURE__ */
|
|
194
|
+
children: /* @__PURE__ */ x("div", { style: { textAlign: "center" }, children: "Application must adhere to the MM App Manifest specification to be embedded." })
|
|
829
195
|
}
|
|
830
196
|
);
|
|
831
197
|
};
|
|
832
|
-
|
|
833
|
-
id:
|
|
834
|
-
src:
|
|
835
|
-
path:
|
|
836
|
-
onInit:
|
|
198
|
+
_.propTypes = {
|
|
199
|
+
id: I.string,
|
|
200
|
+
src: I.string.isRequired,
|
|
201
|
+
path: I.string,
|
|
202
|
+
onInit: I.func
|
|
837
203
|
};
|
|
838
204
|
export {
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
205
|
+
_ as MMEmbeddableZone,
|
|
206
|
+
Z as MMEmbeddableZoneContext,
|
|
207
|
+
T as MMEmbeddableZoneProvider,
|
|
208
|
+
O as getAppInfo,
|
|
209
|
+
H as testIsEmbeddable,
|
|
210
|
+
W as useEmbeddedEffect
|
|
845
211
|
};
|
|
@@ -1,35 +1,6 @@
|
|
|
1
|
-
(function(
|
|
2
|
-
* @license React
|
|
3
|
-
* react-jsx-runtime.production.min.js
|
|
4
|
-
*
|
|
5
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
6
|
-
*
|
|
7
|
-
* This source code is licensed under the MIT license found in the
|
|
8
|
-
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var Ee;function ze(){if(Ee)return K;Ee=1;var d=i,g=Symbol.for("react.element"),S=Symbol.for("react.fragment"),b=Object.prototype.hasOwnProperty,w=d.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,E={key:!0,ref:!0,__self:!0,__source:!0};function F(T,h,C){var m,j={},k=null,D=null;C!==void 0&&(k=""+C),h.key!==void 0&&(k=""+h.key),h.ref!==void 0&&(D=h.ref);for(m in h)b.call(h,m)&&!E.hasOwnProperty(m)&&(j[m]=h[m]);if(T&&T.defaultProps)for(m in h=T.defaultProps,h)j[m]===void 0&&(j[m]=h[m]);return{$$typeof:g,type:T,key:k,ref:D,props:j,_owner:w.current}}return K.Fragment=S,K.jsx=F,K.jsxs=F,K}var N={};/**
|
|
10
|
-
* @license React
|
|
11
|
-
* react-jsx-runtime.development.js
|
|
12
|
-
*
|
|
13
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
14
|
-
*
|
|
15
|
-
* This source code is licensed under the MIT license found in the
|
|
16
|
-
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/var he;function He(){return he||(he=1,process.env.NODE_ENV!=="production"&&function(){var d=i,g=Symbol.for("react.element"),S=Symbol.for("react.portal"),b=Symbol.for("react.fragment"),w=Symbol.for("react.strict_mode"),E=Symbol.for("react.profiler"),F=Symbol.for("react.provider"),T=Symbol.for("react.context"),h=Symbol.for("react.forward_ref"),C=Symbol.for("react.suspense"),m=Symbol.for("react.suspense_list"),j=Symbol.for("react.memo"),k=Symbol.for("react.lazy"),D=Symbol.for("react.offscreen"),a=Symbol.iterator,p="@@iterator";function u(e){if(e===null||typeof e!="object")return null;var r=a&&e[a]||e[p];return typeof r=="function"?r:null}var c=d.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function l(e){{for(var r=arguments.length,t=new Array(r>1?r-1:0),n=1;n<r;n++)t[n-1]=arguments[n];_("error",e,t)}}function _(e,r,t){{var n=c.ReactDebugCurrentFrame,f=n.getStackAddendum();f!==""&&(r+="%s",t=t.concat([f]));var v=t.map(function(s){return String(s)});v.unshift("Warning: "+r),Function.prototype.apply.call(console[e],console,v)}}var A=!1,V=!1,W=!1,ee=!1,re=!1,L;L=Symbol.for("react.module.reference");function se(e){return!!(typeof e=="string"||typeof e=="function"||e===b||e===E||re||e===w||e===C||e===m||ee||e===D||A||V||W||typeof e=="object"&&e!==null&&(e.$$typeof===k||e.$$typeof===j||e.$$typeof===F||e.$$typeof===T||e.$$typeof===h||e.$$typeof===L||e.getModuleId!==void 0))}function ue(e,r,t){var n=e.displayName;if(n)return n;var f=r.displayName||r.name||"";return f!==""?t+"("+f+")":t}function G(e){return e.displayName||"Context"}function I(e){if(e==null)return null;if(typeof e.tag=="number"&&l("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case b:return"Fragment";case S:return"Portal";case E:return"Profiler";case w:return"StrictMode";case C:return"Suspense";case m:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case T:var r=e;return G(r)+".Consumer";case F:var t=e;return G(t._context)+".Provider";case h:return ue(e,e.render,"ForwardRef");case j:var n=e.displayName||null;return n!==null?n:I(e.type)||"Memo";case k:{var f=e,v=f._payload,s=f._init;try{return I(s(v))}catch{return null}}}return null}var Y=Object.assign,z=0,Te,Oe,Pe,je,xe,ke,Me;function Fe(){}Fe.__reactDisabledLog=!0;function Qe(){{if(z===0){Te=console.log,Oe=console.info,Pe=console.warn,je=console.error,xe=console.group,ke=console.groupCollapsed,Me=console.groupEnd;var e={configurable:!0,enumerable:!0,value:Fe,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}z++}}function qe(){{if(z--,z===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:Y({},e,{value:Te}),info:Y({},e,{value:Oe}),warn:Y({},e,{value:Pe}),error:Y({},e,{value:je}),group:Y({},e,{value:xe}),groupCollapsed:Y({},e,{value:ke}),groupEnd:Y({},e,{value:Me})})}z<0&&l("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var ce=c.ReactCurrentDispatcher,le;function te(e,r,t){{if(le===void 0)try{throw Error()}catch(f){var n=f.stack.trim().match(/\n( *(at )?)/);le=n&&n[1]||""}return`
|
|
18
|
-
`+le+e}}var fe=!1,ne;{var $e=typeof WeakMap=="function"?WeakMap:Map;ne=new $e}function Ie(e,r){if(!e||fe)return"";{var t=ne.get(e);if(t!==void 0)return t}var n;fe=!0;var f=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var v;v=ce.current,ce.current=null,Qe();try{if(r){var s=function(){throw Error()};if(Object.defineProperty(s.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(s,[])}catch(x){n=x}Reflect.construct(e,[],s)}else{try{s.call()}catch(x){n=x}e.call(s.prototype)}}else{try{throw Error()}catch(x){n=x}e()}}catch(x){if(x&&n&&typeof x.stack=="string"){for(var o=x.stack.split(`
|
|
19
|
-
`),O=n.stack.split(`
|
|
20
|
-
`),y=o.length-1,R=O.length-1;y>=1&&R>=0&&o[y]!==O[R];)R--;for(;y>=1&&R>=0;y--,R--)if(o[y]!==O[R]){if(y!==1||R!==1)do if(y--,R--,R<0||o[y]!==O[R]){var M=`
|
|
21
|
-
`+o[y].replace(" at new "," at ");return e.displayName&&M.includes("<anonymous>")&&(M=M.replace("<anonymous>",e.displayName)),typeof e=="function"&&ne.set(e,M),M}while(y>=1&&R>=0);break}}}finally{fe=!1,ce.current=v,qe(),Error.prepareStackTrace=f}var B=e?e.displayName||e.name:"",U=B?te(B):"";return typeof e=="function"&&ne.set(e,U),U}function er(e,r,t){return Ie(e,!1)}function rr(e){var r=e.prototype;return!!(r&&r.isReactComponent)}function ae(e,r,t){if(e==null)return"";if(typeof e=="function")return Ie(e,rr(e));if(typeof e=="string")return te(e);switch(e){case C:return te("Suspense");case m:return te("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case h:return er(e.render);case j:return ae(e.type,r,t);case k:{var n=e,f=n._payload,v=n._init;try{return ae(v(f),r,t)}catch{}}}return""}var H=Object.prototype.hasOwnProperty,Ae={},De=c.ReactDebugCurrentFrame;function oe(e){if(e){var r=e._owner,t=ae(e.type,e._source,r?r.type:null);De.setExtraStackFrame(t)}else De.setExtraStackFrame(null)}function tr(e,r,t,n,f){{var v=Function.call.bind(H);for(var s in e)if(v(e,s)){var o=void 0;try{if(typeof e[s]!="function"){var O=Error((n||"React class")+": "+t+" type `"+s+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[s]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw O.name="Invariant Violation",O}o=e[s](r,s,n,t,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(y){o=y}o&&!(o instanceof Error)&&(oe(f),l("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",n||"React class",t,s,typeof o),oe(null)),o instanceof Error&&!(o.message in Ae)&&(Ae[o.message]=!0,oe(f),l("Failed %s type: %s",t,o.message),oe(null))}}}var nr=Array.isArray;function de(e){return nr(e)}function ar(e){{var r=typeof Symbol=="function"&&Symbol.toStringTag,t=r&&e[Symbol.toStringTag]||e.constructor.name||"Object";return t}}function or(e){try{return We(e),!1}catch{return!0}}function We(e){return""+e}function Le(e){if(or(e))return l("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",ar(e)),We(e)}var X=c.ReactCurrentOwner,ir={key:!0,ref:!0,__self:!0,__source:!0},Ye,Ue,ve;ve={};function sr(e){if(H.call(e,"ref")){var r=Object.getOwnPropertyDescriptor(e,"ref").get;if(r&&r.isReactWarning)return!1}return e.ref!==void 0}function ur(e){if(H.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return!1}return e.key!==void 0}function cr(e,r){if(typeof e.ref=="string"&&X.current&&r&&X.current.stateNode!==r){var t=I(X.current.type);ve[t]||(l('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',I(X.current.type),e.ref),ve[t]=!0)}}function lr(e,r){{var t=function(){Ye||(Ye=!0,l("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",r))};t.isReactWarning=!0,Object.defineProperty(e,"key",{get:t,configurable:!0})}}function fr(e,r){{var t=function(){Ue||(Ue=!0,l("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",r))};t.isReactWarning=!0,Object.defineProperty(e,"ref",{get:t,configurable:!0})}}var dr=function(e,r,t,n,f,v,s){var o={$$typeof:g,type:e,key:r,ref:t,props:s,_owner:v};return o._store={},Object.defineProperty(o._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(o,"_self",{configurable:!1,enumerable:!1,writable:!1,value:n}),Object.defineProperty(o,"_source",{configurable:!1,enumerable:!1,writable:!1,value:f}),Object.freeze&&(Object.freeze(o.props),Object.freeze(o)),o};function vr(e,r,t,n,f){{var v,s={},o=null,O=null;t!==void 0&&(Le(t),o=""+t),ur(r)&&(Le(r.key),o=""+r.key),sr(r)&&(O=r.ref,cr(r,f));for(v in r)H.call(r,v)&&!ir.hasOwnProperty(v)&&(s[v]=r[v]);if(e&&e.defaultProps){var y=e.defaultProps;for(v in y)s[v]===void 0&&(s[v]=y[v])}if(o||O){var R=typeof e=="function"?e.displayName||e.name||"Unknown":e;o&&lr(s,R),O&&fr(s,R)}return dr(e,o,O,f,n,X.current,s)}}var pe=c.ReactCurrentOwner,Ve=c.ReactDebugCurrentFrame;function Z(e){if(e){var r=e._owner,t=ae(e.type,e._source,r?r.type:null);Ve.setExtraStackFrame(t)}else Ve.setExtraStackFrame(null)}var be;be=!1;function ge(e){return typeof e=="object"&&e!==null&&e.$$typeof===g}function Ze(){{if(pe.current){var e=I(pe.current.type);if(e)return`
|
|
22
|
-
|
|
23
|
-
Check the render method of \``+e+"`."}return""}}function pr(e){return""}var Be={};function br(e){{var r=Ze();if(!r){var t=typeof e=="string"?e:e.displayName||e.name;t&&(r=`
|
|
24
|
-
|
|
25
|
-
Check the top-level render call using <`+t+">.")}return r}}function Je(e,r){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var t=br(r);if(Be[t])return;Be[t]=!0;var n="";e&&e._owner&&e._owner!==pe.current&&(n=" It was passed a child from "+I(e._owner.type)+"."),Z(e),l('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',t,n),Z(null)}}function Ke(e,r){{if(typeof e!="object")return;if(de(e))for(var t=0;t<e.length;t++){var n=e[t];ge(n)&&Je(n,r)}else if(ge(e))e._store&&(e._store.validated=!0);else if(e){var f=u(e);if(typeof f=="function"&&f!==e.entries)for(var v=f.call(e),s;!(s=v.next()).done;)ge(s.value)&&Je(s.value,r)}}}function gr(e){{var r=e.type;if(r==null||typeof r=="string")return;var t;if(typeof r=="function")t=r.propTypes;else if(typeof r=="object"&&(r.$$typeof===h||r.$$typeof===j))t=r.propTypes;else return;if(t){var n=I(r);tr(t,e.props,"prop",n,e)}else if(r.PropTypes!==void 0&&!be){be=!0;var f=I(r);l("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",f||"Unknown")}typeof r.getDefaultProps=="function"&&!r.getDefaultProps.isReactClassApproved&&l("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function mr(e){{for(var r=Object.keys(e.props),t=0;t<r.length;t++){var n=r[t];if(n!=="children"&&n!=="key"){Z(e),l("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",n),Z(null);break}}e.ref!==null&&(Z(e),l("Invalid attribute `ref` supplied to `React.Fragment`."),Z(null))}}var Ne={};function Ge(e,r,t,n,f,v){{var s=se(e);if(!s){var o="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(o+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var O=pr();O?o+=O:o+=Ze();var y;e===null?y="null":de(e)?y="array":e!==void 0&&e.$$typeof===g?(y="<"+(I(e.type)||"Unknown")+" />",o=" Did you accidentally export a JSX literal instead of a component?"):y=typeof e,l("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",y,o)}var R=vr(e,r,t,f,v);if(R==null)return R;if(s){var M=r.children;if(M!==void 0)if(n)if(de(M)){for(var B=0;B<M.length;B++)Ke(M[B],e);Object.freeze&&Object.freeze(M)}else l("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else Ke(M,e)}if(H.call(r,"key")){var U=I(e),x=Object.keys(r).filter(function(wr){return wr!=="key"}),me=x.length>0?"{key: someKey, "+x.join(": ..., ")+": ...}":"{key: someKey}";if(!Ne[U+me]){var _r=x.length>0?"{"+x.join(": ..., ")+": ...}":"{}";l(`A props object containing a "key" prop is being spread into JSX:
|
|
26
|
-
let props = %s;
|
|
27
|
-
<%s {...props} />
|
|
28
|
-
React keys must be passed directly to JSX without using spread:
|
|
29
|
-
let props = %s;
|
|
30
|
-
<%s key={someKey} {...props} />`,me,U,_r,U),Ne[U+me]=!0}}return e===b?mr(R):gr(R),R}}function yr(e,r,t){return Ge(e,r,t,!0)}function Er(e,r,t){return Ge(e,r,t,!1)}var hr=Er,Rr=yr;N.Fragment=b,N.jsx=hr,N.jsxs=Rr}()),N}process.env.NODE_ENV==="production"?ie.exports=ze():ie.exports=He();var Q=ie.exports;const q=i.createContext(null),Re=({children:d})=>{const[g,S]=i.useState({}),b=i.useRef({}),w=i.useRef({}),E=i.useRef({}),F=i.useCallback((a,p)=>{var u;return!!((u=E.current[a])!=null&&u.has(p))},[]),T=i.useCallback((a,p,u)=>{S(c=>({...c,[a]:{origin:p,frameRef:u}}))},[]),h=i.useCallback(a=>{S(p=>{const u={...p};return delete u[a],u}),delete E.current[a]},[]);i.useEffect(()=>{const a=(u=[],c)=>{u.forEach(l=>l(c))},p=u=>{var A,V,W,ee,re;if(!((A=u==null?void 0:u.data)!=null&&A.instanceId))return;const{instanceId:c,type:l}=u.data,_=b.current;if(l==="response"){const{callbackId:L,response:se,error:ue}=u.data,G=w.current[L];G&&(G(se,ue),delete w.current[L]);return}if(l==="mark-registered"){const{requestType:L}=u.data;E.current[c]||(E.current[c]=new Set),E.current[c].add(L);return}a((V=_[c])==null?void 0:V[l],u.data),a((W=_["*"])==null?void 0:W[l],u.data),a((ee=_[c])==null?void 0:ee["*"],u.data),a((re=_["*"])==null?void 0:re["*"],u.data)};return window.addEventListener("message",p),()=>{window.removeEventListener("message",p)}},[g]);const C=i.useCallback((a,p,u)=>{var l,_;const c=g[a];if(!c){console.warn(`Origin not set for id: ${a}. Unable to send message.`);return}(_=(l=c==null?void 0:c.frameRef)==null?void 0:l.current)!=null&&_.contentWindow&&c.frameRef.current.contentWindow.postMessage({type:p,...u,instanceId:a},c.origin)},[g]),m=i.useCallback(async(a,p,u={})=>new Promise((c,l)=>{const _=crypto.randomUUID(),A=(V,W)=>{delete w.current[_],W?l(W):c(V)};w.current[_]=A,C(a,"request",{callbackId:_,requestType:p,data:u})}),[C]),j=i.useCallback((a,p)=>{C(a,"load-options",p)},[C]),k=i.useCallback((a,p)=>{C(a,"validate",p)},[C]),D=i.useMemo(()=>({registerFrame:T,unregisterFrame:h,sendMessage:C,sendRequest:m,loadOptions:j,validate:k,hasHandler:F,addListener:(a,p,u)=>(b.current[a]||(b.current[a]={}),b.current[a][p]||(b.current[a][p]=[]),b.current[a][p].push(u),()=>{b.current[a][p]=b.current[a][p].filter(c=>c!==u)})}),[T,h,C,m,j,k,F]);return Q.jsx(q.Provider,{value:D,children:d})},$={},_e=async d=>{try{const g=new URL(d).origin;if($[g]!==void 0)return $[g];const b=await(await fetch(`${g}/mm-app-manifest.json`)).json();if(!b.version)throw new Error("Invalid manifest");return $[g]=b,b}catch{}return $[origin]=!1,!1},we=async d=>!!await _e(d),Ce=(d,g,S)=>{const b=i.useContext(q);if(b===null)throw new Error("useEmbeddedEffect must be used within a MMEmbeddableZoneProvider");const w=i.useRef(S);i.useEffect(()=>{w.current=S},[S]),i.useEffect(()=>{if(!(!d||!g))return b.addListener(d,g,(...E)=>w.current(...E))},[b,d,g])};Re.propTypes={children:J.node.isRequired};const Xe=(ye.default||ye).iframe`
|
|
1
|
+
(function(d,g){typeof exports=="object"&&typeof module<"u"?g(exports,require("react/jsx-runtime"),require("react"),require("prop-types"),require("styled-components")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","react","prop-types","styled-components"],g):(d=typeof globalThis<"u"?globalThis:d||self,g(d["mm-react-embeddable"]={},d.React,d.React,d.PropTypes,d.styled))})(this,(function(d,g,e,y,$){"use strict";const C=e.createContext(null),x=({children:r})=>{const[i,l]=e.useState({}),u=e.useRef({}),a=e.useRef({}),c=e.useRef({}),w=e.useCallback((n,t)=>!!c.current[n]?.has(t),[]),M=e.useCallback((n,t,s)=>{l(o=>({...o,[n]:{origin:t,frameRef:s}}))},[]),S=e.useCallback(n=>{l(t=>{const s={...t};return delete s[n],s}),delete c.current[n]},[]);e.useEffect(()=>{const n=(s=[],o)=>{s.forEach(f=>f(o))},t=s=>{if(!s?.data?.instanceId)return;const{instanceId:o,type:f}=s.data,E=u.current;if(f==="response"){const{callbackId:h,response:Z,error:v}=s.data,U=a.current[h];U&&(U(Z,v),delete a.current[h]);return}if(f==="mark-registered"){const{requestType:h}=s.data;c.current[o]||(c.current[o]=new Set),c.current[o].add(h);return}n(E[o]?.[f],s.data),n(E["*"]?.[f],s.data),n(E[o]?.["*"],s.data),n(E["*"]?.["*"],s.data)};return window.addEventListener("message",t),()=>{window.removeEventListener("message",t)}},[i]);const b=e.useCallback((n,t,s)=>{const o=i[n];if(!o){console.warn(`Origin not set for id: ${n}. Unable to send message.`);return}o?.frameRef?.current?.contentWindow&&o.frameRef.current.contentWindow.postMessage({type:t,...s,instanceId:n},o.origin)},[i]),m=e.useRef(0),F=e.useCallback(()=>`${Date.now()}-${++m.current}`,[]),R=e.useCallback(async(n,t,s={})=>new Promise((o,f)=>{const E=F(),h=(Z,v)=>{delete a.current[E],v?f(v):o(Z)};a.current[E]=h,b(n,"request",{callbackId:E,requestType:t,data:s})}),[b]),k=e.useCallback((n,t)=>{b(n,"load-options",t)},[b]),p=e.useCallback((n,t)=>{b(n,"validate",t)},[b]),q=e.useMemo(()=>({registerFrame:M,unregisterFrame:S,sendMessage:b,sendRequest:R,loadOptions:k,validate:p,hasHandler:w,addListener:(n,t,s)=>(u.current[n]||(u.current[n]={}),u.current[n][t]||(u.current[n][t]=[]),u.current[n][t].push(s),()=>{u.current[n][t]=u.current[n][t].filter(o=>o!==s)})}),[M,S,b,R,k,p,w]);return g.jsx(C.Provider,{value:q,children:r})},I={},j=async r=>{try{const i=new URL(r).origin;if(I[i]!==void 0)return I[i];const u=await(await fetch(`${i}/mm-app-manifest.json`)).json();if(!u.version)throw new Error("Invalid manifest");return I[i]=u,u}catch{}return I[origin]=!1,!1},L=async r=>!!await j(r),A=(r,i,l)=>{const u=e.useContext(C);if(u===null)throw new Error("useEmbeddedEffect must be used within a MMEmbeddableZoneProvider");const a=e.useRef(l);e.useEffect(()=>{a.current=l},[l]),e.useEffect(()=>{if(!(!r||!i))return u.addListener(r,i,(...c)=>a.current(...c))},[u,r,i])};x.propTypes={children:y.node.isRequired};const O=($.default||$).iframe`
|
|
31
2
|
width: 100%;
|
|
32
3
|
height: 100%;
|
|
33
4
|
border: none;
|
|
34
|
-
visibility: ${
|
|
35
|
-
`,
|
|
5
|
+
visibility: ${r=>r.$isReady?"visible":"hidden"};
|
|
6
|
+
`,P=({id:r,src:i,path:l,onInit:u=()=>{},context:a={},params:c={},...w})=>{if("isConfiguring"in w)return console.error("isConfiguring must be passed via the params prop to MMEmbeddableZone"),null;if("colorMode"in a)return console.error("colorMode must be passed via the params prop to MMEmbeddableZone"),null;if("isFullScreen"in a)return console.error("isFullScreen must be passed via the params prop to MMEmbeddableZone"),null;const M=e.useRef(),[S,b]=e.useState(),[m,F]=e.useState(0),{registerFrame:R,unregisterFrame:k,sendMessage:p}=e.useContext(C),[q,n]=e.useState(!0),[t,s]=e.useState();return e.useEffect(()=>{m&&p(r,"set-context",{context:{...a,colorMode:c.colorMode,isFullScreen:c.isFullScreen}})},[a,c.colorMode,c.isFullScreen,r,m]),e.useEffect(()=>{m&&(p(r,"set-params",{params:c}),p(r,"set-configuring",{isConfiguring:c.isConfiguring}))},[c,r,m]),e.useEffect(()=>{l!==void 0&&s(l||"/")},[l]),e.useEffect(()=>{t===void 0||!m||p(r,"navigate",{path:t})},[t,m,r,p]),e.useEffect(()=>{if(!(!i||!r||!M))return(async()=>{const o=await L(i);if(n(o),o){const f=new URL(i);R(r,f.origin,M),u(),b(`${f.origin}/mm-embedded-interop?id=${r}&origin=${window.location.origin}`);return}})(),()=>{k(r)}},[i,r,R,M]),A(r,"ready",()=>F(o=>o+1)),q?g.jsx(O,{$isReady:m,ref:M,src:S,...w}):g.jsx("div",{style:{height:"100%",display:"flex",flex:1,alignItems:"center",justifyContent:"center"},children:g.jsx("div",{style:{textAlign:"center"},children:"Application must adhere to the MM App Manifest specification to be embedded."})})};P.propTypes={id:y.string,src:y.string.isRequired,path:y.string,onInit:y.func},d.MMEmbeddableZone=P,d.MMEmbeddableZoneContext=C,d.MMEmbeddableZoneProvider=x,d.getAppInfo=j,d.testIsEmbeddable=L,d.useEmbeddedEffect=A,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.0.
|
|
3
|
+
"version": "1.0.12-0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"module": "dist/mm-react-embeddable.es.js",
|
|
6
6
|
"main": "dist/mm-react-embeddable.cjs.js",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
},
|
|
19
19
|
"scripts": {
|
|
20
20
|
"build": "vite build",
|
|
21
|
-
"start": "vite build --watch",
|
|
21
|
+
"start": "npm install --omit=peer && npm link && vite build --watch",
|
|
22
22
|
"test": "vitest run",
|
|
23
23
|
"test:watch": "vitest"
|
|
24
24
|
},
|
|
@@ -35,11 +35,11 @@
|
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@testing-library/react": "^14.3.1",
|
|
38
|
-
"@vitejs/plugin-react": "^
|
|
39
|
-
"@vitest/coverage-v8": "^
|
|
38
|
+
"@vitejs/plugin-react": "^5.1.1",
|
|
39
|
+
"@vitest/coverage-v8": "^4.0.10",
|
|
40
40
|
"jsdom": "^24.1.3",
|
|
41
41
|
"prettier": "^3.3.3",
|
|
42
|
-
"vite": "^
|
|
43
|
-
"vitest": "^
|
|
42
|
+
"vite": "^7.2.2",
|
|
43
|
+
"vitest": "^4.0.10"
|
|
44
44
|
}
|
|
45
45
|
}
|