@machinemetrics/mm-react-embeddable 1.0.9-2 → 1.0.9-3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react"),Y=require("prop-types"),ee=require("styled-components");var q={exports:{}},N={};/**
|
|
2
2
|
* @license React
|
|
3
3
|
* react-jsx-runtime.production.js
|
|
4
4
|
*
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* This source code is licensed under the MIT license found in the
|
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var
|
|
9
|
+
*/var re;function fe(){if(re)return N;re=1;var n=Symbol.for("react.transitional.element"),f=Symbol.for("react.fragment");function m(i,l,c){var T=null;if(c!==void 0&&(T=""+c),l.key!==void 0&&(T=""+l.key),"key"in l){c={};for(var g in l)g!=="key"&&(c[g]=l[g])}else c=l;return l=c.ref,{$$typeof:n,type:i,key:T,ref:l!==void 0?l:null,props:c}}return N.Fragment=f,N.jsx=m,N.jsxs=m,N}var $={};/**
|
|
10
10
|
* @license React
|
|
11
11
|
* react-jsx-runtime.development.js
|
|
12
12
|
*
|
|
@@ -14,14 +14,14 @@
|
|
|
14
14
|
*
|
|
15
15
|
* This source code is licensed under the MIT license found in the
|
|
16
16
|
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/var
|
|
17
|
+
*/var te;function de(){return te||(te=1,process.env.NODE_ENV!=="production"&&(function(){function n(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===Z?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case a:return"Fragment";case u:return"Profiler";case o:return"StrictMode";case A:return"Suspense";case x:return"SuspenseList";case M:return"Activity"}if(typeof e=="object")switch(typeof e.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),e.$$typeof){case t:return"Portal";case b:return(e.displayName||"Context")+".Provider";case R:return(e._context.displayName||"Context")+".Consumer";case k:var r=e.render;return e=e.displayName,e||(e=r.displayName||r.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case L:return r=e.displayName||null,r!==null?r:n(e.type)||"Memo";case C:r=e._payload,e=e._init;try{return n(e(r))}catch{}}return null}function f(e){return""+e}function m(e){try{f(e);var r=!1}catch{r=!0}if(r){r=console;var d=r.error,E=typeof Symbol=="function"&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object";return d.call(r,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",E),f(e)}}function i(e){if(e===a)return"<>";if(typeof e=="object"&&e!==null&&e.$$typeof===C)return"<...>";try{var r=n(e);return r?"<"+r+">":"<...>"}catch{return"<...>"}}function l(){var e=I.A;return e===null?null:e.getOwner()}function c(){return Error("react-stack-top-frame")}function T(e){if(F.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return!1}return e.key!==void 0}function g(e,r){function d(){X||(X=!0,console.error("%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://react.dev/link/special-props)",r))}d.isReactWarning=!0,Object.defineProperty(e,"key",{get:d,configurable:!0})}function P(){var e=n(this.type);return H[e]||(H[e]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),e=this.props.ref,e!==void 0?e:null}function v(e,r,d,E,y,h,z,V){return d=h.ref,e={$$typeof:O,type:e,key:r,props:h,_owner:y},(d!==void 0?d:null)!==null?Object.defineProperty(e,"ref",{enumerable:!1,get:P}):Object.defineProperty(e,"ref",{enumerable:!1,value:null}),e._store={},Object.defineProperty(e._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(e,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(e,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:z}),Object.defineProperty(e,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:V}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}function _(e,r,d,E,y,h,z,V){var p=r.children;if(p!==void 0)if(E)if(ie(p)){for(E=0;E<p.length;E++)S(p[E]);Object.freeze&&Object.freeze(p)}else console.error("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 S(p);if(F.call(r,"key")){p=n(e);var j=Object.keys(r).filter(function(le){return le!=="key"});E=0<j.length?"{key: someKey, "+j.join(": ..., ")+": ...}":"{key: someKey}",K[p+E]||(j=0<j.length?"{"+j.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
18
18
|
let props = %s;
|
|
19
19
|
<%s {...props} />
|
|
20
20
|
React keys must be passed directly to JSX without using spread:
|
|
21
21
|
let props = %s;
|
|
22
|
-
<%s key={someKey} {...props} />`,
|
|
22
|
+
<%s key={someKey} {...props} />`,E,p,j,p),K[p+E]=!0)}if(p=null,d!==void 0&&(m(d),p=""+d),T(r)&&(m(r.key),p=""+r.key),"key"in r){d={};for(var G in r)G!=="key"&&(d[G]=r[G])}else d=r;return p&&g(d,typeof e=="function"?e.displayName||e.name||"Unknown":e),v(e,p,h,y,l(),d,z,V)}function S(e){typeof e=="object"&&e!==null&&e.$$typeof===O&&e._store&&(e._store.validated=1)}var w=s,O=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),a=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),u=Symbol.for("react.profiler"),R=Symbol.for("react.consumer"),b=Symbol.for("react.context"),k=Symbol.for("react.forward_ref"),A=Symbol.for("react.suspense"),x=Symbol.for("react.suspense_list"),L=Symbol.for("react.memo"),C=Symbol.for("react.lazy"),M=Symbol.for("react.activity"),Z=Symbol.for("react.client.reference"),I=w.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,F=Object.prototype.hasOwnProperty,ie=Array.isArray,J=console.createTask?console.createTask:function(){return null};w={react_stack_bottom_frame:function(e){return e()}};var X,H={},B=w.react_stack_bottom_frame.bind(w,c)(),Q=J(i(c)),K={};$.Fragment=a,$.jsx=function(e,r,d,E,y){var h=1e4>I.recentlyCreatedOwnerStacks++;return _(e,r,d,!1,E,y,h?Error("react-stack-top-frame"):B,h?J(i(e)):Q)},$.jsxs=function(e,r,d,E,y){var h=1e4>I.recentlyCreatedOwnerStacks++;return _(e,r,d,!0,E,y,h?Error("react-stack-top-frame"):B,h?J(i(e)):Q)}})()),$}var ne;function be(){return ne||(ne=1,process.env.NODE_ENV==="production"?q.exports=fe():q.exports=de()),q.exports}var D=be();const W=s.createContext(null),oe=({children:n})=>{const[f,m]=s.useState({}),i=s.useRef({}),l=s.useRef({}),c=s.useRef({}),T=s.useCallback((t,a)=>{var o;return!!((o=c.current[t])!=null&&o.has(a))},[]),g=s.useCallback((t,a,o)=>{m(u=>({...u,[t]:{origin:a,frameRef:o}}))},[]),P=s.useCallback(t=>{m(a=>{const o={...a};return delete o[t],o}),delete c.current[t]},[]);s.useEffect(()=>{const t=(o=[],u)=>{o.forEach(R=>R(u))},a=o=>{var k,A,x,L,C;if(!((k=o==null?void 0:o.data)!=null&&k.instanceId))return;const{instanceId:u,type:R}=o.data,b=i.current;if(R==="response"){const{callbackId:M,response:Z,error:I}=o.data,F=l.current[M];F&&(F(Z,I),delete l.current[M]);return}if(R==="mark-registered"){const{requestType:M}=o.data;c.current[u]||(c.current[u]=new Set),c.current[u].add(M);return}t((A=b[u])==null?void 0:A[R],o.data),t((x=b["*"])==null?void 0:x[R],o.data),t((L=b[u])==null?void 0:L["*"],o.data),t((C=b["*"])==null?void 0:C["*"],o.data)};return window.addEventListener("message",a),()=>{window.removeEventListener("message",a)}},[f]);const v=s.useCallback((t,a,o)=>{var R,b;const u=f[t];if(!u){console.warn(`Origin not set for id: ${t}. Unable to send message.`);return}(b=(R=u==null?void 0:u.frameRef)==null?void 0:R.current)!=null&&b.contentWindow&&u.frameRef.current.contentWindow.postMessage({type:a,...o,instanceId:t},u.origin)},[f]),_=s.useCallback(async(t,a,o={})=>new Promise((u,R)=>{const b=crypto.randomUUID(),k=(A,x)=>{delete l.current[b],x?R(x):u(A)};l.current[b]=k,v(t,"request",{callbackId:b,requestType:a,data:o})}),[v]),S=s.useCallback((t,a)=>{v(t,"load-options",a)},[v]),w=s.useCallback((t,a)=>{v(t,"validate",a)},[v]),O=s.useMemo(()=>({registerFrame:g,unregisterFrame:P,sendMessage:v,sendRequest:_,loadOptions:S,validate:w,hasHandler:T,addListener:(t,a,o)=>(i.current[t]||(i.current[t]={}),i.current[t][a]||(i.current[t][a]=[]),i.current[t][a].push(o),()=>{i.current[t][a]=i.current[t][a].filter(u=>u!==o)})}),[g,P,v,_,S,w,T]);return D.jsx(W.Provider,{value:O,children:n})},U={},se=async n=>{try{const f=new URL(n).origin;if(U[f]!==void 0)return U[f];const i=await(await fetch(`${f}/mm-app-manifest.json`)).json();if(!i.version)throw new Error("Invalid manifest");return U[f]=i,i}catch{}return U[origin]=!1,!1},ae=async n=>!!await se(n),ce=(n,f,m)=>{const i=s.useContext(W);if(i===null)throw new Error("useEmbeddedEffect must be used within a MMEmbeddableZoneProvider");const l=s.useRef(m);s.useEffect(()=>{l.current=m},[m]),s.useEffect(()=>{if(!(!n||!f))return i.addListener(n,f,(...c)=>l.current(...c))},[i,n,f])};oe.propTypes={children:Y.node.isRequired};const me=ee.default||ee,Ee=me.iframe`
|
|
23
23
|
width: 100%;
|
|
24
24
|
height: 100%;
|
|
25
25
|
border: none;
|
|
26
26
|
visibility: ${n=>n.$isReady?"visible":"hidden"};
|
|
27
|
-
`,
|
|
27
|
+
`,ue=({id:n,src:f,path:m,onInit:i=()=>{},context:l={},params:c={},...T})=>{if("isConfiguring"in T)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 g=s.useRef(),[P,v]=s.useState(),[_,S]=s.useState(0),{registerFrame:w,unregisterFrame:O,sendMessage:t}=s.useContext(W),[a,o]=s.useState(!0),[u,R]=s.useState();return s.useEffect(()=>{_&&t(n,"set-context",{context:{...l,colorMode:c.colorMode,isFullScreen:c.isFullScreen}})},[l,c.colorMode,c.isFullScreen,n,_]),s.useEffect(()=>{_&&(t(n,"set-params",{params:c}),t(n,"set-configuring",{isConfiguring:c.isConfiguring}))},[c,n,_]),s.useEffect(()=>{m!==void 0&&R(m||"/")},[m]),s.useEffect(()=>{u===void 0||!_||t(n,"navigate",{path:u})},[u,_,n,t]),s.useEffect(()=>{if(!(!f||!n||!g))return(async()=>{const b=await ae(f);if(o(b),b){const k=new URL(f);w(n,k.origin,g),i(),v(`${k.origin}/mm-embedded-interop?id=${n}&origin=${window.location.origin}`);return}})(),()=>{O(n)}},[f,n,w,g]),ce(n,"ready",()=>S(b=>b+1)),a?D.jsx(Ee,{$isReady:_,ref:g,src:P,...T}):D.jsx("div",{style:{height:"100%",display:"flex",flex:1,alignItems:"center",justifyContent:"center"},children:D.jsx("div",{style:{textAlign:"center"},children:"Application must adhere to the MM App Manifest specification to be embedded."})})};ue.propTypes={id:Y.string,src:Y.string.isRequired,path:Y.string,onInit:Y.func};exports.MMEmbeddableZone=ue;exports.MMEmbeddableZoneContext=W;exports.MMEmbeddableZoneProvider=oe;exports.getAppInfo=se;exports.testIsEmbeddable=ae;exports.useEmbeddedEffect=ce;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import le, { createContext as fe, useState as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
var
|
|
1
|
+
import le, { createContext as fe, useState as L, useRef as D, useCallback as O, useEffect as k, useMemo as de, useContext as ie } from "react";
|
|
2
|
+
import U from "prop-types";
|
|
3
|
+
import ne from "styled-components";
|
|
4
|
+
var W = { exports: {} }, $ = {};
|
|
5
5
|
/**
|
|
6
6
|
* @license React
|
|
7
7
|
* react-jsx-runtime.production.js
|
|
@@ -11,29 +11,29 @@ var L = { exports: {} }, C = {};
|
|
|
11
11
|
* This source code is licensed under the MIT license found in the
|
|
12
12
|
* LICENSE file in the root directory of this source tree.
|
|
13
13
|
*/
|
|
14
|
-
var
|
|
14
|
+
var oe;
|
|
15
15
|
function me() {
|
|
16
|
-
if (
|
|
17
|
-
|
|
16
|
+
if (oe) return $;
|
|
17
|
+
oe = 1;
|
|
18
18
|
var n = Symbol.for("react.transitional.element"), l = Symbol.for("react.fragment");
|
|
19
|
-
function
|
|
19
|
+
function m(c, u, a) {
|
|
20
20
|
var v = null;
|
|
21
|
-
if (
|
|
22
|
-
|
|
23
|
-
for (var
|
|
24
|
-
|
|
25
|
-
} else
|
|
26
|
-
return
|
|
21
|
+
if (a !== void 0 && (v = "" + a), u.key !== void 0 && (v = "" + u.key), "key" in u) {
|
|
22
|
+
a = {};
|
|
23
|
+
for (var R in u)
|
|
24
|
+
R !== "key" && (a[R] = u[R]);
|
|
25
|
+
} else a = u;
|
|
26
|
+
return u = a.ref, {
|
|
27
27
|
$$typeof: n,
|
|
28
|
-
type:
|
|
28
|
+
type: c,
|
|
29
29
|
key: v,
|
|
30
|
-
ref:
|
|
31
|
-
props:
|
|
30
|
+
ref: u !== void 0 ? u : null,
|
|
31
|
+
props: a
|
|
32
32
|
};
|
|
33
33
|
}
|
|
34
|
-
return
|
|
34
|
+
return $.Fragment = l, $.jsx = m, $.jsxs = m, $;
|
|
35
35
|
}
|
|
36
|
-
var
|
|
36
|
+
var Y = {};
|
|
37
37
|
/**
|
|
38
38
|
* @license React
|
|
39
39
|
* react-jsx-runtime.development.js
|
|
@@ -43,26 +43,26 @@ var I = {};
|
|
|
43
43
|
* This source code is licensed under the MIT license found in the
|
|
44
44
|
* LICENSE file in the root directory of this source tree.
|
|
45
45
|
*/
|
|
46
|
-
var
|
|
46
|
+
var se;
|
|
47
47
|
function be() {
|
|
48
|
-
return
|
|
48
|
+
return se || (se = 1, process.env.NODE_ENV !== "production" && (function() {
|
|
49
49
|
function n(e) {
|
|
50
50
|
if (e == null) return null;
|
|
51
51
|
if (typeof e == "function")
|
|
52
|
-
return e.$$typeof ===
|
|
52
|
+
return e.$$typeof === z ? null : e.displayName || e.name || null;
|
|
53
53
|
if (typeof e == "string") return e;
|
|
54
54
|
switch (e) {
|
|
55
|
-
case
|
|
55
|
+
case s:
|
|
56
56
|
return "Fragment";
|
|
57
|
-
case
|
|
57
|
+
case i:
|
|
58
58
|
return "Profiler";
|
|
59
|
-
case
|
|
59
|
+
case o:
|
|
60
60
|
return "StrictMode";
|
|
61
|
-
case
|
|
61
|
+
case j:
|
|
62
62
|
return "Suspense";
|
|
63
|
-
case
|
|
63
|
+
case S:
|
|
64
64
|
return "SuspenseList";
|
|
65
|
-
case
|
|
65
|
+
case M:
|
|
66
66
|
return "Activity";
|
|
67
67
|
}
|
|
68
68
|
if (typeof e == "object")
|
|
@@ -71,16 +71,16 @@ function be() {
|
|
|
71
71
|
), e.$$typeof) {
|
|
72
72
|
case t:
|
|
73
73
|
return "Portal";
|
|
74
|
-
case
|
|
74
|
+
case d:
|
|
75
75
|
return (e.displayName || "Context") + ".Provider";
|
|
76
|
-
case
|
|
76
|
+
case p:
|
|
77
77
|
return (e._context.displayName || "Context") + ".Consumer";
|
|
78
|
-
case
|
|
78
|
+
case h:
|
|
79
79
|
var r = e.render;
|
|
80
80
|
return e = e.displayName, e || (e = r.displayName || r.name || "", e = e !== "" ? "ForwardRef(" + e + ")" : "ForwardRef"), e;
|
|
81
|
-
case
|
|
81
|
+
case q:
|
|
82
82
|
return r = e.displayName || null, r !== null ? r : n(e.type) || "Memo";
|
|
83
|
-
case
|
|
83
|
+
case I:
|
|
84
84
|
r = e._payload, e = e._init;
|
|
85
85
|
try {
|
|
86
86
|
return n(e(r));
|
|
@@ -92,7 +92,7 @@ function be() {
|
|
|
92
92
|
function l(e) {
|
|
93
93
|
return "" + e;
|
|
94
94
|
}
|
|
95
|
-
function
|
|
95
|
+
function m(e) {
|
|
96
96
|
try {
|
|
97
97
|
l(e);
|
|
98
98
|
var r = !1;
|
|
@@ -101,17 +101,17 @@ function be() {
|
|
|
101
101
|
}
|
|
102
102
|
if (r) {
|
|
103
103
|
r = console;
|
|
104
|
-
var f = r.error,
|
|
104
|
+
var f = r.error, b = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
|
|
105
105
|
return f.call(
|
|
106
106
|
r,
|
|
107
107
|
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
|
|
108
|
-
|
|
108
|
+
b
|
|
109
109
|
), l(e);
|
|
110
110
|
}
|
|
111
111
|
}
|
|
112
|
-
function
|
|
113
|
-
if (e ===
|
|
114
|
-
if (typeof e == "object" && e !== null && e.$$typeof ===
|
|
112
|
+
function c(e) {
|
|
113
|
+
if (e === s) return "<>";
|
|
114
|
+
if (typeof e == "object" && e !== null && e.$$typeof === I)
|
|
115
115
|
return "<...>";
|
|
116
116
|
try {
|
|
117
117
|
var r = n(e);
|
|
@@ -120,23 +120,23 @@ function be() {
|
|
|
120
120
|
return "<...>";
|
|
121
121
|
}
|
|
122
122
|
}
|
|
123
|
-
function
|
|
124
|
-
var e =
|
|
123
|
+
function u() {
|
|
124
|
+
var e = F.A;
|
|
125
125
|
return e === null ? null : e.getOwner();
|
|
126
126
|
}
|
|
127
|
-
function
|
|
127
|
+
function a() {
|
|
128
128
|
return Error("react-stack-top-frame");
|
|
129
129
|
}
|
|
130
130
|
function v(e) {
|
|
131
|
-
if (
|
|
131
|
+
if (N.call(e, "key")) {
|
|
132
132
|
var r = Object.getOwnPropertyDescriptor(e, "key").get;
|
|
133
133
|
if (r && r.isReactWarning) return !1;
|
|
134
134
|
}
|
|
135
135
|
return e.key !== void 0;
|
|
136
136
|
}
|
|
137
|
-
function
|
|
137
|
+
function R(e, r) {
|
|
138
138
|
function f() {
|
|
139
|
-
|
|
139
|
+
Q || (Q = !0, console.error(
|
|
140
140
|
"%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://react.dev/link/special-props)",
|
|
141
141
|
r
|
|
142
142
|
));
|
|
@@ -146,22 +146,22 @@ function be() {
|
|
|
146
146
|
configurable: !0
|
|
147
147
|
});
|
|
148
148
|
}
|
|
149
|
-
function
|
|
149
|
+
function P() {
|
|
150
150
|
var e = n(this.type);
|
|
151
|
-
return
|
|
151
|
+
return K[e] || (K[e] = !0, console.error(
|
|
152
152
|
"Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
|
|
153
153
|
)), e = this.props.ref, e !== void 0 ? e : null;
|
|
154
154
|
}
|
|
155
|
-
function
|
|
156
|
-
return f =
|
|
157
|
-
$$typeof:
|
|
155
|
+
function _(e, r, f, b, y, w, G, X) {
|
|
156
|
+
return f = w.ref, e = {
|
|
157
|
+
$$typeof: A,
|
|
158
158
|
type: e,
|
|
159
159
|
key: r,
|
|
160
|
-
props:
|
|
160
|
+
props: w,
|
|
161
161
|
_owner: y
|
|
162
162
|
}, (f !== void 0 ? f : null) !== null ? Object.defineProperty(e, "ref", {
|
|
163
163
|
enumerable: !1,
|
|
164
|
-
get:
|
|
164
|
+
get: P
|
|
165
165
|
}) : Object.defineProperty(e, "ref", { enumerable: !1, value: null }), e._store = {}, Object.defineProperty(e._store, "validated", {
|
|
166
166
|
configurable: !1,
|
|
167
167
|
enumerable: !1,
|
|
@@ -176,232 +176,237 @@ function be() {
|
|
|
176
176
|
configurable: !1,
|
|
177
177
|
enumerable: !1,
|
|
178
178
|
writable: !0,
|
|
179
|
-
value:
|
|
179
|
+
value: G
|
|
180
180
|
}), Object.defineProperty(e, "_debugTask", {
|
|
181
181
|
configurable: !1,
|
|
182
182
|
enumerable: !1,
|
|
183
183
|
writable: !0,
|
|
184
|
-
value:
|
|
184
|
+
value: X
|
|
185
185
|
}), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
|
|
186
186
|
}
|
|
187
|
-
function
|
|
188
|
-
var
|
|
189
|
-
if (
|
|
190
|
-
if (
|
|
191
|
-
if (ce(
|
|
192
|
-
for (
|
|
193
|
-
x(b
|
|
194
|
-
Object.freeze && Object.freeze(
|
|
187
|
+
function g(e, r, f, b, y, w, G, X) {
|
|
188
|
+
var E = r.children;
|
|
189
|
+
if (E !== void 0)
|
|
190
|
+
if (b)
|
|
191
|
+
if (ce(E)) {
|
|
192
|
+
for (b = 0; b < E.length; b++)
|
|
193
|
+
x(E[b]);
|
|
194
|
+
Object.freeze && Object.freeze(E);
|
|
195
195
|
} else
|
|
196
196
|
console.error(
|
|
197
197
|
"React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
|
|
198
198
|
);
|
|
199
|
-
else x(
|
|
200
|
-
if (
|
|
201
|
-
|
|
202
|
-
var
|
|
199
|
+
else x(E);
|
|
200
|
+
if (N.call(r, "key")) {
|
|
201
|
+
E = n(e);
|
|
202
|
+
var C = Object.keys(r).filter(function(ue) {
|
|
203
203
|
return ue !== "key";
|
|
204
204
|
});
|
|
205
|
-
|
|
205
|
+
b = 0 < C.length ? "{key: someKey, " + C.join(": ..., ") + ": ...}" : "{key: someKey}", te[E + b] || (C = 0 < C.length ? "{" + C.join(": ..., ") + ": ...}" : "{}", console.error(
|
|
206
206
|
`A props object containing a "key" prop is being spread into JSX:
|
|
207
207
|
let props = %s;
|
|
208
208
|
<%s {...props} />
|
|
209
209
|
React keys must be passed directly to JSX without using spread:
|
|
210
210
|
let props = %s;
|
|
211
211
|
<%s key={someKey} {...props} />`,
|
|
212
|
-
m,
|
|
213
212
|
b,
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
213
|
+
E,
|
|
214
|
+
C,
|
|
215
|
+
E
|
|
216
|
+
), te[E + b] = !0);
|
|
217
217
|
}
|
|
218
|
-
if (
|
|
218
|
+
if (E = null, f !== void 0 && (m(f), E = "" + f), v(r) && (m(r.key), E = "" + r.key), "key" in r) {
|
|
219
219
|
f = {};
|
|
220
|
-
for (var
|
|
221
|
-
|
|
220
|
+
for (var H in r)
|
|
221
|
+
H !== "key" && (f[H] = r[H]);
|
|
222
222
|
} else f = r;
|
|
223
|
-
return
|
|
223
|
+
return E && R(
|
|
224
224
|
f,
|
|
225
225
|
typeof e == "function" ? e.displayName || e.name || "Unknown" : e
|
|
226
|
-
),
|
|
226
|
+
), _(
|
|
227
227
|
e,
|
|
228
|
-
|
|
229
|
-
|
|
228
|
+
E,
|
|
229
|
+
w,
|
|
230
230
|
y,
|
|
231
|
-
|
|
231
|
+
u(),
|
|
232
232
|
f,
|
|
233
|
-
|
|
234
|
-
|
|
233
|
+
G,
|
|
234
|
+
X
|
|
235
235
|
);
|
|
236
236
|
}
|
|
237
237
|
function x(e) {
|
|
238
|
-
typeof e == "object" && e !== null && e.$$typeof ===
|
|
238
|
+
typeof e == "object" && e !== null && e.$$typeof === A && e._store && (e._store.validated = 1);
|
|
239
239
|
}
|
|
240
|
-
var
|
|
240
|
+
var T = le, A = Symbol.for("react.transitional.element"), t = Symbol.for("react.portal"), s = Symbol.for("react.fragment"), o = Symbol.for("react.strict_mode"), i = Symbol.for("react.profiler"), p = Symbol.for("react.consumer"), d = Symbol.for("react.context"), h = Symbol.for("react.forward_ref"), j = Symbol.for("react.suspense"), S = Symbol.for("react.suspense_list"), q = Symbol.for("react.memo"), I = Symbol.for("react.lazy"), M = Symbol.for("react.activity"), z = Symbol.for("react.client.reference"), F = T.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, N = Object.prototype.hasOwnProperty, ce = Array.isArray, V = console.createTask ? console.createTask : function() {
|
|
241
241
|
return null;
|
|
242
242
|
};
|
|
243
|
-
|
|
243
|
+
T = {
|
|
244
244
|
react_stack_bottom_frame: function(e) {
|
|
245
245
|
return e();
|
|
246
246
|
}
|
|
247
247
|
};
|
|
248
|
-
var
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
)(),
|
|
252
|
-
|
|
253
|
-
var
|
|
254
|
-
return
|
|
248
|
+
var Q, K = {}, ee = T.react_stack_bottom_frame.bind(
|
|
249
|
+
T,
|
|
250
|
+
a
|
|
251
|
+
)(), re = V(c(a)), te = {};
|
|
252
|
+
Y.Fragment = s, Y.jsx = function(e, r, f, b, y) {
|
|
253
|
+
var w = 1e4 > F.recentlyCreatedOwnerStacks++;
|
|
254
|
+
return g(
|
|
255
255
|
e,
|
|
256
256
|
r,
|
|
257
257
|
f,
|
|
258
258
|
!1,
|
|
259
|
-
|
|
259
|
+
b,
|
|
260
260
|
y,
|
|
261
|
-
|
|
262
|
-
|
|
261
|
+
w ? Error("react-stack-top-frame") : ee,
|
|
262
|
+
w ? V(c(e)) : re
|
|
263
263
|
);
|
|
264
|
-
},
|
|
265
|
-
var
|
|
266
|
-
return
|
|
264
|
+
}, Y.jsxs = function(e, r, f, b, y) {
|
|
265
|
+
var w = 1e4 > F.recentlyCreatedOwnerStacks++;
|
|
266
|
+
return g(
|
|
267
267
|
e,
|
|
268
268
|
r,
|
|
269
269
|
f,
|
|
270
270
|
!0,
|
|
271
|
-
|
|
271
|
+
b,
|
|
272
272
|
y,
|
|
273
|
-
|
|
274
|
-
|
|
273
|
+
w ? Error("react-stack-top-frame") : ee,
|
|
274
|
+
w ? V(c(e)) : re
|
|
275
275
|
);
|
|
276
276
|
};
|
|
277
|
-
})()),
|
|
277
|
+
})()), Y;
|
|
278
278
|
}
|
|
279
|
-
var
|
|
279
|
+
var ae;
|
|
280
280
|
function Ee() {
|
|
281
|
-
return
|
|
281
|
+
return ae || (ae = 1, process.env.NODE_ENV === "production" ? W.exports = me() : W.exports = be()), W.exports;
|
|
282
282
|
}
|
|
283
|
-
var
|
|
284
|
-
const
|
|
285
|
-
const [l,
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
283
|
+
var J = Ee();
|
|
284
|
+
const B = fe(null), pe = ({ children: n }) => {
|
|
285
|
+
const [l, m] = L({}), c = D({}), u = D({}), a = D({}), v = O((t, s) => {
|
|
286
|
+
var o;
|
|
287
|
+
return !!((o = a.current[t]) != null && o.has(s));
|
|
288
|
+
}, []), R = O((t, s, o) => {
|
|
289
|
+
m((i) => ({ ...i, [t]: { origin: s, frameRef: o } }));
|
|
290
|
+
}, []), P = O((t) => {
|
|
291
|
+
m((s) => {
|
|
292
|
+
const o = { ...s };
|
|
293
|
+
return delete o[t], o;
|
|
294
|
+
}), delete a.current[t];
|
|
292
295
|
}, []);
|
|
293
296
|
k(() => {
|
|
294
|
-
const t = (
|
|
295
|
-
|
|
296
|
-
},
|
|
297
|
-
|
|
297
|
+
const t = (o = [], i) => {
|
|
298
|
+
o.forEach((p) => p(i));
|
|
299
|
+
}, s = (o) => {
|
|
300
|
+
var h, j, S, q, I;
|
|
301
|
+
if (!((h = o == null ? void 0 : o.data) != null && h.instanceId))
|
|
298
302
|
return;
|
|
299
|
-
const { instanceId:
|
|
300
|
-
if (
|
|
301
|
-
const { callbackId:
|
|
302
|
-
|
|
303
|
+
const { instanceId: i, type: p } = o.data, d = c.current;
|
|
304
|
+
if (p === "response") {
|
|
305
|
+
const { callbackId: M, response: z, error: F } = o.data, N = u.current[M];
|
|
306
|
+
N && (N(z, F), delete u.current[M]);
|
|
303
307
|
return;
|
|
304
308
|
}
|
|
305
|
-
if (
|
|
306
|
-
const { requestType:
|
|
307
|
-
|
|
309
|
+
if (p === "mark-registered") {
|
|
310
|
+
const { requestType: M } = o.data;
|
|
311
|
+
a.current[i] || (a.current[i] = /* @__PURE__ */ new Set()), a.current[i].add(M);
|
|
308
312
|
return;
|
|
309
313
|
}
|
|
310
|
-
t(
|
|
314
|
+
t((j = d[i]) == null ? void 0 : j[p], o.data), t((S = d["*"]) == null ? void 0 : S[p], o.data), t((q = d[i]) == null ? void 0 : q["*"], o.data), t((I = d["*"]) == null ? void 0 : I["*"], o.data);
|
|
311
315
|
};
|
|
312
|
-
return window.addEventListener("message",
|
|
313
|
-
window.removeEventListener("message",
|
|
316
|
+
return window.addEventListener("message", s), () => {
|
|
317
|
+
window.removeEventListener("message", s);
|
|
314
318
|
};
|
|
315
319
|
}, [l]);
|
|
316
|
-
const
|
|
317
|
-
(t,
|
|
318
|
-
|
|
319
|
-
|
|
320
|
+
const _ = O(
|
|
321
|
+
(t, s, o) => {
|
|
322
|
+
var p, d;
|
|
323
|
+
const i = l[t];
|
|
324
|
+
if (!i) {
|
|
320
325
|
console.warn(`Origin not set for id: ${t}. Unable to send message.`);
|
|
321
326
|
return;
|
|
322
327
|
}
|
|
323
|
-
|
|
324
|
-
{ type:
|
|
325
|
-
|
|
328
|
+
(d = (p = i == null ? void 0 : i.frameRef) == null ? void 0 : p.current) != null && d.contentWindow && i.frameRef.current.contentWindow.postMessage(
|
|
329
|
+
{ type: s, ...o, instanceId: t },
|
|
330
|
+
i.origin
|
|
326
331
|
);
|
|
327
332
|
},
|
|
328
333
|
[l]
|
|
329
|
-
),
|
|
330
|
-
async (t,
|
|
331
|
-
const
|
|
332
|
-
delete
|
|
334
|
+
), g = O(
|
|
335
|
+
async (t, s, o = {}) => new Promise((i, p) => {
|
|
336
|
+
const d = crypto.randomUUID(), h = (j, S) => {
|
|
337
|
+
delete u.current[d], S ? p(S) : i(j);
|
|
333
338
|
};
|
|
334
|
-
|
|
339
|
+
u.current[d] = h, _(t, "request", { callbackId: d, requestType: s, data: o });
|
|
335
340
|
}),
|
|
336
|
-
[
|
|
337
|
-
), x =
|
|
338
|
-
(t,
|
|
339
|
-
|
|
341
|
+
[_]
|
|
342
|
+
), x = O(
|
|
343
|
+
(t, s) => {
|
|
344
|
+
_(t, "load-options", s);
|
|
340
345
|
},
|
|
341
|
-
[
|
|
342
|
-
),
|
|
343
|
-
(t,
|
|
344
|
-
|
|
346
|
+
[_]
|
|
347
|
+
), T = O(
|
|
348
|
+
(t, s) => {
|
|
349
|
+
_(t, "validate", s);
|
|
345
350
|
},
|
|
346
|
-
[
|
|
347
|
-
),
|
|
351
|
+
[_]
|
|
352
|
+
), A = de(
|
|
348
353
|
() => ({
|
|
349
|
-
registerFrame:
|
|
350
|
-
unregisterFrame:
|
|
351
|
-
sendMessage:
|
|
352
|
-
sendRequest:
|
|
354
|
+
registerFrame: R,
|
|
355
|
+
unregisterFrame: P,
|
|
356
|
+
sendMessage: _,
|
|
357
|
+
sendRequest: g,
|
|
353
358
|
loadOptions: x,
|
|
354
|
-
validate:
|
|
359
|
+
validate: T,
|
|
355
360
|
hasHandler: v,
|
|
356
|
-
addListener: (t,
|
|
357
|
-
|
|
361
|
+
addListener: (t, s, o) => (c.current[t] || (c.current[t] = {}), c.current[t][s] || (c.current[t][s] = []), c.current[t][s].push(o), () => {
|
|
362
|
+
c.current[t][s] = c.current[t][s].filter((i) => i !== o);
|
|
358
363
|
})
|
|
359
364
|
}),
|
|
360
365
|
[
|
|
361
|
-
p,
|
|
362
|
-
O,
|
|
363
|
-
g,
|
|
364
366
|
R,
|
|
367
|
+
P,
|
|
368
|
+
_,
|
|
369
|
+
g,
|
|
365
370
|
x,
|
|
366
|
-
|
|
371
|
+
T,
|
|
367
372
|
v
|
|
368
373
|
]
|
|
369
374
|
);
|
|
370
|
-
return /* @__PURE__ */
|
|
371
|
-
},
|
|
375
|
+
return /* @__PURE__ */ J.jsx(B.Provider, { value: A, children: n });
|
|
376
|
+
}, Z = {}, Re = async (n) => {
|
|
372
377
|
try {
|
|
373
378
|
const l = new URL(n).origin;
|
|
374
|
-
if (
|
|
375
|
-
return
|
|
376
|
-
const
|
|
377
|
-
if (!
|
|
379
|
+
if (Z[l] !== void 0)
|
|
380
|
+
return Z[l];
|
|
381
|
+
const c = await (await fetch(`${l}/mm-app-manifest.json`)).json();
|
|
382
|
+
if (!c.version)
|
|
378
383
|
throw new Error("Invalid manifest");
|
|
379
|
-
return
|
|
384
|
+
return Z[l] = c, c;
|
|
380
385
|
} catch {
|
|
381
386
|
}
|
|
382
|
-
return
|
|
383
|
-
}, ge = async (n) => !!await Re(n), _e = (n, l,
|
|
384
|
-
const
|
|
385
|
-
if (
|
|
387
|
+
return Z[origin] = !1, !1;
|
|
388
|
+
}, ge = async (n) => !!await Re(n), _e = (n, l, m) => {
|
|
389
|
+
const c = ie(B);
|
|
390
|
+
if (c === null)
|
|
386
391
|
throw new Error(
|
|
387
392
|
"useEmbeddedEffect must be used within a MMEmbeddableZoneProvider"
|
|
388
393
|
);
|
|
389
|
-
const
|
|
394
|
+
const u = D(m);
|
|
390
395
|
k(() => {
|
|
391
|
-
|
|
392
|
-
}, [
|
|
396
|
+
u.current = m;
|
|
397
|
+
}, [m]), k(() => {
|
|
393
398
|
if (!(!n || !l))
|
|
394
|
-
return
|
|
399
|
+
return c.addListener(
|
|
395
400
|
n,
|
|
396
401
|
l,
|
|
397
|
-
(...
|
|
402
|
+
(...a) => u.current(...a)
|
|
398
403
|
);
|
|
399
|
-
}, [
|
|
404
|
+
}, [c, n, l]);
|
|
400
405
|
};
|
|
401
406
|
pe.propTypes = {
|
|
402
|
-
children:
|
|
407
|
+
children: U.node.isRequired
|
|
403
408
|
};
|
|
404
|
-
const ve =
|
|
409
|
+
const ve = ne.default || ne, Te = ve.iframe`
|
|
405
410
|
width: 100%;
|
|
406
411
|
height: 100%;
|
|
407
412
|
border: none;
|
|
@@ -409,58 +414,58 @@ const ve = re.default || re, Te = ve.iframe`
|
|
|
409
414
|
`, we = ({
|
|
410
415
|
id: n,
|
|
411
416
|
src: l,
|
|
412
|
-
path:
|
|
413
|
-
onInit:
|
|
417
|
+
path: m,
|
|
418
|
+
onInit: c = () => {
|
|
414
419
|
},
|
|
415
|
-
context:
|
|
416
|
-
params:
|
|
420
|
+
context: u = {},
|
|
421
|
+
params: a = {},
|
|
417
422
|
...v
|
|
418
423
|
}) => {
|
|
419
424
|
if ("isConfiguring" in v)
|
|
420
425
|
return console.error(
|
|
421
426
|
"isConfiguring must be passed via the params prop to MMEmbeddableZone"
|
|
422
427
|
), null;
|
|
423
|
-
if ("colorMode" in
|
|
428
|
+
if ("colorMode" in u)
|
|
424
429
|
return console.error(
|
|
425
430
|
"colorMode must be passed via the params prop to MMEmbeddableZone"
|
|
426
431
|
), null;
|
|
427
|
-
if ("isFullScreen" in
|
|
432
|
+
if ("isFullScreen" in u)
|
|
428
433
|
return console.error(
|
|
429
434
|
"isFullScreen must be passed via the params prop to MMEmbeddableZone"
|
|
430
435
|
), null;
|
|
431
|
-
const
|
|
432
|
-
|
|
433
|
-
), [
|
|
436
|
+
const R = D(), [P, _] = L(), [g, x] = L(0), { registerFrame: T, unregisterFrame: A, sendMessage: t } = ie(
|
|
437
|
+
B
|
|
438
|
+
), [s, o] = L(!0), [i, p] = L();
|
|
434
439
|
return k(() => {
|
|
435
|
-
|
|
440
|
+
g && t(n, "set-context", {
|
|
436
441
|
context: {
|
|
437
|
-
...
|
|
442
|
+
...u,
|
|
438
443
|
// TODO: Remove this once everything is migrated to params
|
|
439
|
-
colorMode:
|
|
440
|
-
isFullScreen:
|
|
444
|
+
colorMode: a.colorMode,
|
|
445
|
+
isFullScreen: a.isFullScreen
|
|
441
446
|
}
|
|
442
447
|
});
|
|
443
|
-
}, [
|
|
444
|
-
|
|
445
|
-
}, [
|
|
446
|
-
|
|
447
|
-
}, [
|
|
448
|
-
|
|
449
|
-
}, [
|
|
450
|
-
if (!(!l || !n || !
|
|
448
|
+
}, [u, a.colorMode, a.isFullScreen, n, g]), k(() => {
|
|
449
|
+
g && (t(n, "set-params", { params: a }), t(n, "set-configuring", { isConfiguring: a.isConfiguring }));
|
|
450
|
+
}, [a, n, g]), k(() => {
|
|
451
|
+
m !== void 0 && p(m || "/");
|
|
452
|
+
}, [m]), k(() => {
|
|
453
|
+
i === void 0 || !g || t(n, "navigate", { path: i });
|
|
454
|
+
}, [i, g, n, t]), k(() => {
|
|
455
|
+
if (!(!l || !n || !R))
|
|
451
456
|
return (async () => {
|
|
452
|
-
const
|
|
453
|
-
if (
|
|
454
|
-
const
|
|
455
|
-
|
|
456
|
-
`${
|
|
457
|
+
const d = await ge(l);
|
|
458
|
+
if (o(d), d) {
|
|
459
|
+
const h = new URL(l);
|
|
460
|
+
T(n, h.origin, R), c(), _(
|
|
461
|
+
`${h.origin}/mm-embedded-interop?id=${n}&origin=${window.location.origin}`
|
|
457
462
|
);
|
|
458
463
|
return;
|
|
459
464
|
}
|
|
460
465
|
})(), () => {
|
|
461
|
-
|
|
466
|
+
A(n);
|
|
462
467
|
};
|
|
463
|
-
}, [l, n,
|
|
468
|
+
}, [l, n, T, R]), _e(n, "ready", () => x((d) => d + 1)), s ? /* @__PURE__ */ J.jsx(Te, { $isReady: g, ref: R, src: P, ...v }) : /* @__PURE__ */ J.jsx(
|
|
464
469
|
"div",
|
|
465
470
|
{
|
|
466
471
|
style: {
|
|
@@ -470,19 +475,19 @@ const ve = re.default || re, Te = ve.iframe`
|
|
|
470
475
|
alignItems: "center",
|
|
471
476
|
justifyContent: "center"
|
|
472
477
|
},
|
|
473
|
-
children: /* @__PURE__ */
|
|
478
|
+
children: /* @__PURE__ */ J.jsx("div", { style: { textAlign: "center" }, children: "Application must adhere to the MM App Manifest specification to be embedded." })
|
|
474
479
|
}
|
|
475
480
|
);
|
|
476
481
|
};
|
|
477
482
|
we.propTypes = {
|
|
478
|
-
id:
|
|
479
|
-
src:
|
|
480
|
-
path:
|
|
481
|
-
onInit:
|
|
483
|
+
id: U.string,
|
|
484
|
+
src: U.string.isRequired,
|
|
485
|
+
path: U.string,
|
|
486
|
+
onInit: U.func
|
|
482
487
|
};
|
|
483
488
|
export {
|
|
484
489
|
we as MMEmbeddableZone,
|
|
485
|
-
|
|
490
|
+
B as MMEmbeddableZoneContext,
|
|
486
491
|
pe as MMEmbeddableZoneProvider,
|
|
487
492
|
Re as getAppInfo,
|
|
488
493
|
ge as testIsEmbeddable,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(g,n){typeof exports=="object"&&typeof module!="undefined"?n(exports,require("react"),require("prop-types"),require("styled-components")):typeof define=="function"&&define.amd?define(["exports","react","prop-types","styled-components"],n):(g=typeof globalThis!="undefined"?globalThis:g||self,n(g["mm-react-embeddable"]={},g.React,g.PropTypes,g.styled))})(this,(function(g,n,I,Q){"use strict";var D={exports:{}},F={};/**
|
|
2
2
|
* @license React
|
|
3
3
|
* react-jsx-runtime.production.js
|
|
4
4
|
*
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* This source code is licensed under the MIT license found in the
|
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var
|
|
9
|
+
*/var K;function le(){if(K)return F;K=1;var o=Symbol.for("react.transitional.element"),f=Symbol.for("react.fragment");function b(u,l,c){var T=null;if(c!==void 0&&(T=""+c),l.key!==void 0&&(T=""+l.key),"key"in l){c={};for(var _ in l)_!=="key"&&(c[_]=l[_])}else c=l;return l=c.ref,{$$typeof:o,type:u,key:T,ref:l!==void 0?l:null,props:c}}return F.Fragment=f,F.jsx=b,F.jsxs=b,F}var N={};/**
|
|
10
10
|
* @license React
|
|
11
11
|
* react-jsx-runtime.development.js
|
|
12
12
|
*
|
|
@@ -14,14 +14,14 @@
|
|
|
14
14
|
*
|
|
15
15
|
* This source code is licensed under the MIT license found in the
|
|
16
16
|
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/var
|
|
17
|
+
*/var q;function fe(){return q||(q=1,process.env.NODE_ENV!=="production"&&(function(){function o(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===V?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case a:return"Fragment";case i:return"Profiler";case s:return"StrictMode";case M:return"Suspense";case A:return"SuspenseList";case P:return"Activity"}if(typeof e=="object")switch(typeof e.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),e.$$typeof){case t:return"Portal";case m:return(e.displayName||"Context")+".Provider";case R:return(e._context.displayName||"Context")+".Consumer";case y:var r=e.render;return e=e.displayName,e||(e=r.displayName||r.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case z:return r=e.displayName||null,r!==null?r:o(e.type)||"Memo";case Y:r=e._payload,e=e._init;try{return o(e(r))}catch{}}return null}function f(e){return""+e}function b(e){try{f(e);var r=!1}catch{r=!0}if(r){r=console;var d=r.error,E=typeof Symbol=="function"&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object";return d.call(r,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",E),f(e)}}function u(e){if(e===a)return"<>";if(typeof e=="object"&&e!==null&&e.$$typeof===Y)return"<...>";try{var r=o(e);return r?"<"+r+">":"<...>"}catch{return"<...>"}}function l(){var e=L.A;return e===null?null:e.getOwner()}function c(){return Error("react-stack-top-frame")}function T(e){if(U.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return!1}return e.key!==void 0}function _(e,r){function d(){se||(se=!0,console.error("%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://react.dev/link/special-props)",r))}d.isReactWarning=!0,Object.defineProperty(e,"key",{get:d,configurable:!0})}function j(){var e=o(this.type);return ae[e]||(ae[e]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),e=this.props.ref,e!==void 0?e:null}function h(e,r,d,E,S,k,X,H){return d=k.ref,e={$$typeof:x,type:e,key:r,props:k,_owner:S},(d!==void 0?d:null)!==null?Object.defineProperty(e,"ref",{enumerable:!1,get:j}):Object.defineProperty(e,"ref",{enumerable:!1,value:null}),e._store={},Object.defineProperty(e._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(e,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(e,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:X}),Object.defineProperty(e,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:H}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}function v(e,r,d,E,S,k,X,H){var p=r.children;if(p!==void 0)if(E)if(be(p)){for(E=0;E<p.length;E++)O(p[E]);Object.freeze&&Object.freeze(p)}else console.error("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 O(p);if(U.call(r,"key")){p=o(e);var C=Object.keys(r).filter(function(Ee){return Ee!=="key"});E=0<C.length?"{key: someKey, "+C.join(": ..., ")+": ...}":"{key: someKey}",ue[p+E]||(C=0<C.length?"{"+C.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
18
18
|
let props = %s;
|
|
19
19
|
<%s {...props} />
|
|
20
20
|
React keys must be passed directly to JSX without using spread:
|
|
21
21
|
let props = %s;
|
|
22
|
-
<%s key={someKey} {...props} />`,
|
|
22
|
+
<%s key={someKey} {...props} />`,E,p,C,p),ue[p+E]=!0)}if(p=null,d!==void 0&&(b(d),p=""+d),T(r)&&(b(r.key),p=""+r.key),"key"in r){d={};for(var B in r)B!=="key"&&(d[B]=r[B])}else d=r;return p&&_(d,typeof e=="function"?e.displayName||e.name||"Unknown":e),h(e,p,k,S,l(),d,X,H)}function O(e){typeof e=="object"&&e!==null&&e.$$typeof===x&&e._store&&(e._store.validated=1)}var w=n,x=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),a=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),R=Symbol.for("react.consumer"),m=Symbol.for("react.context"),y=Symbol.for("react.forward_ref"),M=Symbol.for("react.suspense"),A=Symbol.for("react.suspense_list"),z=Symbol.for("react.memo"),Y=Symbol.for("react.lazy"),P=Symbol.for("react.activity"),V=Symbol.for("react.client.reference"),L=w.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,U=Object.prototype.hasOwnProperty,be=Array.isArray,G=console.createTask?console.createTask:function(){return null};w={react_stack_bottom_frame:function(e){return e()}};var se,ae={},ce=w.react_stack_bottom_frame.bind(w,c)(),ie=G(u(c)),ue={};N.Fragment=a,N.jsx=function(e,r,d,E,S){var k=1e4>L.recentlyCreatedOwnerStacks++;return v(e,r,d,!1,E,S,k?Error("react-stack-top-frame"):ce,k?G(u(e)):ie)},N.jsxs=function(e,r,d,E,S){var k=1e4>L.recentlyCreatedOwnerStacks++;return v(e,r,d,!0,E,S,k?Error("react-stack-top-frame"):ce,k?G(u(e)):ie)}})()),N}var $;function de(){return $||($=1,process.env.NODE_ENV==="production"?D.exports=le():D.exports=fe()),D.exports}var W=de();const Z=n.createContext(null),ee=({children:o})=>{const[f,b]=n.useState({}),u=n.useRef({}),l=n.useRef({}),c=n.useRef({}),T=n.useCallback((t,a)=>{var s;return!!((s=c.current[t])!=null&&s.has(a))},[]),_=n.useCallback((t,a,s)=>{b(i=>({...i,[t]:{origin:a,frameRef:s}}))},[]),j=n.useCallback(t=>{b(a=>{const s={...a};return delete s[t],s}),delete c.current[t]},[]);n.useEffect(()=>{const t=(s=[],i)=>{s.forEach(R=>R(i))},a=s=>{var y,M,A,z,Y;if(!((y=s==null?void 0:s.data)!=null&&y.instanceId))return;const{instanceId:i,type:R}=s.data,m=u.current;if(R==="response"){const{callbackId:P,response:V,error:L}=s.data,U=l.current[P];U&&(U(V,L),delete l.current[P]);return}if(R==="mark-registered"){const{requestType:P}=s.data;c.current[i]||(c.current[i]=new Set),c.current[i].add(P);return}t((M=m[i])==null?void 0:M[R],s.data),t((A=m["*"])==null?void 0:A[R],s.data),t((z=m[i])==null?void 0:z["*"],s.data),t((Y=m["*"])==null?void 0:Y["*"],s.data)};return window.addEventListener("message",a),()=>{window.removeEventListener("message",a)}},[f]);const h=n.useCallback((t,a,s)=>{var R,m;const i=f[t];if(!i){console.warn(`Origin not set for id: ${t}. Unable to send message.`);return}(m=(R=i==null?void 0:i.frameRef)==null?void 0:R.current)!=null&&m.contentWindow&&i.frameRef.current.contentWindow.postMessage({type:a,...s,instanceId:t},i.origin)},[f]),v=n.useCallback(async(t,a,s={})=>new Promise((i,R)=>{const m=crypto.randomUUID(),y=(M,A)=>{delete l.current[m],A?R(A):i(M)};l.current[m]=y,h(t,"request",{callbackId:m,requestType:a,data:s})}),[h]),O=n.useCallback((t,a)=>{h(t,"load-options",a)},[h]),w=n.useCallback((t,a)=>{h(t,"validate",a)},[h]),x=n.useMemo(()=>({registerFrame:_,unregisterFrame:j,sendMessage:h,sendRequest:v,loadOptions:O,validate:w,hasHandler:T,addListener:(t,a,s)=>(u.current[t]||(u.current[t]={}),u.current[t][a]||(u.current[t][a]=[]),u.current[t][a].push(s),()=>{u.current[t][a]=u.current[t][a].filter(i=>i!==s)})}),[_,j,h,v,O,w,T]);return W.jsx(Z.Provider,{value:x,children:o})},J={},re=async o=>{try{const f=new URL(o).origin;if(J[f]!==void 0)return J[f];const u=await(await fetch(`${f}/mm-app-manifest.json`)).json();if(!u.version)throw new Error("Invalid manifest");return J[f]=u,u}catch{}return J[origin]=!1,!1},te=async o=>!!await re(o),ne=(o,f,b)=>{const u=n.useContext(Z);if(u===null)throw new Error("useEmbeddedEffect must be used within a MMEmbeddableZoneProvider");const l=n.useRef(b);n.useEffect(()=>{l.current=b},[b]),n.useEffect(()=>{if(!(!o||!f))return u.addListener(o,f,(...c)=>l.current(...c))},[u,o,f])};ee.propTypes={children:I.node.isRequired};const me=(Q.default||Q).iframe`
|
|
23
23
|
width: 100%;
|
|
24
24
|
height: 100%;
|
|
25
25
|
border: none;
|
|
26
26
|
visibility: ${o=>o.$isReady?"visible":"hidden"};
|
|
27
|
-
`,
|
|
27
|
+
`,oe=({id:o,src:f,path:b,onInit:u=()=>{},context:l={},params:c={},...T})=>{if("isConfiguring"in T)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 _=n.useRef(),[j,h]=n.useState(),[v,O]=n.useState(0),{registerFrame:w,unregisterFrame:x,sendMessage:t}=n.useContext(Z),[a,s]=n.useState(!0),[i,R]=n.useState();return n.useEffect(()=>{v&&t(o,"set-context",{context:{...l,colorMode:c.colorMode,isFullScreen:c.isFullScreen}})},[l,c.colorMode,c.isFullScreen,o,v]),n.useEffect(()=>{v&&(t(o,"set-params",{params:c}),t(o,"set-configuring",{isConfiguring:c.isConfiguring}))},[c,o,v]),n.useEffect(()=>{b!==void 0&&R(b||"/")},[b]),n.useEffect(()=>{i===void 0||!v||t(o,"navigate",{path:i})},[i,v,o,t]),n.useEffect(()=>{if(!(!f||!o||!_))return(async()=>{const m=await te(f);if(s(m),m){const y=new URL(f);w(o,y.origin,_),u(),h(`${y.origin}/mm-embedded-interop?id=${o}&origin=${window.location.origin}`);return}})(),()=>{x(o)}},[f,o,w,_]),ne(o,"ready",()=>O(m=>m+1)),a?W.jsx(me,{$isReady:v,ref:_,src:j,...T}):W.jsx("div",{style:{height:"100%",display:"flex",flex:1,alignItems:"center",justifyContent:"center"},children:W.jsx("div",{style:{textAlign:"center"},children:"Application must adhere to the MM App Manifest specification to be embedded."})})};oe.propTypes={id:I.string,src:I.string.isRequired,path:I.string,onInit:I.func},g.MMEmbeddableZone=oe,g.MMEmbeddableZoneContext=Z,g.MMEmbeddableZoneProvider=ee,g.getAppInfo=re,g.testIsEmbeddable=te,g.useEmbeddedEffect=ne,Object.defineProperty(g,Symbol.toStringTag,{value:"Module"})}));
|