@akinon/ui-shell-dev 1.3.2 → 1.3.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.
|
@@ -405,4 +405,4 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
405
405
|
* LICENSE.md file in the root directory of this source tree.
|
|
406
406
|
*
|
|
407
407
|
* @license MIT
|
|
408
|
-
*/function M7(e){return e===void 0&&(e=""),new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,r)=>{let n=e[r];return t.concat(Array.isArray(n)?n.map(o=>[r,o]):[[r,n]])},[]))}function ZY(e,t){let r=M7(e);return t&&t.forEach((n,o)=>{r.has(o)||t.getAll(o).forEach(i=>{r.append(o,i)})}),r}const eJ="6";try{window.__reactRouterVersion=eJ}catch{}const tJ="startTransition",Pv=_o[tJ];function rJ(e){let{basename:t,children:r,future:n,window:o}=e,i=c.useRef();i.current==null&&(i.current=cY({window:o,v5Compat:!0}));let a=i.current,[l,s]=c.useState({action:a.action,location:a.location}),{v7_startTransition:u}=n||{},d=c.useCallback(f=>{u&&Pv?Pv(()=>s(f)):s(f)},[s,u]);return c.useLayoutEffect(()=>a.listen(d),[a,d]),c.useEffect(()=>QY(n),[n]),c.createElement(YY,{basename:t,children:r,location:l.location,navigationType:l.action,navigator:a,future:n})}var Ov;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(Ov||(Ov={}));var Tv;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(Tv||(Tv={}));function nJ(e){let t=c.useRef(M7(e)),r=c.useRef(!1),n=E4(),o=c.useMemo(()=>ZY(n.search,r.current?null:t.current),[n.search]),i=k6(),a=c.useCallback((l,s)=>{const u=M7(typeof l=="function"?l(o):l);r.current=!0,i("?"+u,s)},[i,o]);return[o,a]}const oJ=()=>"1.3.2",iJ=({onToggleLeftSider:e,onToggleRightSider:t})=>me.jsxs(me.Fragment,{children:[me.jsx("div",{className:"flex items-center",children:me.jsx(Q3,{type:"text",icon:"outdent",iconSize:16,onClick:e,className:"mr-2"})}),me.jsx("div",{children:me.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[me.jsx("span",{style:{width:"10px",height:"10px",backgroundColor:"green",borderRadius:"50%"}}),me.jsxs("span",{style:{fontSize:"14px",color:"#999"},children:["Akinon UI Shell (v",oJ(),")"]})]})}),me.jsx("div",{className:"flex items-center",children:me.jsx(Q3,{type:"text",icon:"siralama",iconSize:16,onClick:t,className:"mr-2"})})]}),aJ="c",Kt={SET_APP_ID:"SET_APP_ID",SET_CONFIG:"SET_CONFIG",SET_DATA:"SET_DATA",SET_MODAL_CONTEXT:"SET_MODAL_CONTEXT",SET_HEIGHT:"SET_HEIGHT",SET_PARAMS:"SET_PARAMS",INVOKE_ACTION:"INVOKE_ACTION",INVOKE_DEFAULT_ACTION:"INVOKE_DEFAULT_ACTION",NAVIGATE:"NAVIGATE",NAVIGATE_CHILD:"NAVIGATE_CHILD",ACTION_CONFIRMED:"ACTION_CONFIRMED",ACTION_CANCELED:"ACTION_CANCELED",LOCALE_CHANGED:"LOCALE_CHANGED"},Ki={showConfirmationDialog:"showConfirmationDialog",showModalDialog:"showModalDialog",showToast:"showToast",showErrorMessage:"showErrorMessage",showRichModal:"showRichModal"},lJ=async e=>{const t=await crypto.subtle.digest("SHA-256",new TextEncoder().encode(JSON.stringify(e))),r=[],n=new DataView(t);for(let o=0;o<n.byteLength;o+=4)r.push(("00000000"+n.getUint32(o).toString(16)).slice(-8));return r.join("")},Rv=async e=>(await lJ(e)).slice(0,7),cJ=({basePath:e,channel:t})=>`${e||"/"}${t?`-${t}`:""}`;var fs={},bo={},Bv;function sJ(){if(Bv)return bo;Bv=1,Object.defineProperty(bo,"__esModule",{value:!0}),bo.detach=bo.attach=void 0;var e=cn(),t=!1;function r(){t||typeof window>"u"||(t=!0,window.addEventListener("message",e.onMessage,!1))}bo.attach=r;function n(){t=!1,window.removeEventListener("message",e.onMessage,!1)}return bo.detach=n,bo}var qi={},Nv;function uJ(){if(Nv)return qi;Nv=1,Object.defineProperty(qi,"__esModule",{value:!0}),qi.broadcastToChildWindows=void 0;var e=cn();function t(r,n,o){for(var i=e.childWindows.length-1;i>=0;i--){var a=e.childWindows[i];a.closed?e.childWindows.splice(i,1):o!==a&&(0,e.broadcast)(r,{origin:n,frame:a.top})}}return qi.broadcastToChildWindows=t,qi}var Xi={},kv;function dJ(){if(kv)return Xi;kv=1,Object.defineProperty(Xi,"__esModule",{value:!0}),Xi.broadcast=void 0;var e=cn();function t(r,n){var o=0,i,a=n.origin,l=n.frame;try{for(l.postMessage(r,a),(0,e.hasOpener)(l)&&l.opener.top!==window.top&&t(r,{origin:a,frame:l.opener.top});i=l.frames[o];)t(r,{origin:a,frame:i}),o++}catch{}}return Xi.broadcast=t,Xi}var oo={};Object.defineProperty(oo,"__esModule",{value:!0});oo.subscribers=oo.childWindows=oo.prefix=void 0;oo.prefix="/*framebus*/";oo.childWindows=[];oo.subscribers={};var Qi={},_v;function fJ(){if(_v)return Qi;_v=1,Object.defineProperty(Qi,"__esModule",{value:!0}),Qi.dispatch=void 0;var e=cn();function t(r,n,o,i,a){if(e.subscribers[r]&&e.subscribers[r][n]){var l=[];o&&l.push(o),i&&l.push(i);for(var s=0;s<e.subscribers[r][n].length;s++)e.subscribers[r][n][s].apply(a,l)}}return Qi.dispatch=t,Qi}var P4={};Object.defineProperty(P4,"__esModule",{value:!0});P4.hasOpener=void 0;function hJ(e){return!(e.top!==e||e.opener==null||e.opener===e||e.opener.closed===!0)}P4.hasOpener=hJ;var O4={};Object.defineProperty(O4,"__esModule",{value:!0});O4.isntString=void 0;function pJ(e){return typeof e!="string"}O4.isntString=pJ;var Yi={},jv;function vJ(){if(jv)return Yi;jv=1,Object.defineProperty(Yi,"__esModule",{value:!0}),Yi.onMessage=void 0;var e=cn();function t(r){if(!(0,e.isntString)(r.data)){var n=(0,e.unpackPayload)(r);if(n){var o=n.eventData,i=n.reply;(0,e.dispatch)("*",n.event,o,i,r),(0,e.dispatch)(r.origin,n.event,o,i,r),(0,e.broadcastToChildWindows)(r.data,n.origin,r.source)}}}return Yi.onMessage=t,Yi}var Ji={},Av;function gJ(){if(Av)return Ji;Av=1,Object.defineProperty(Ji,"__esModule",{value:!0}),Ji.packagePayload=void 0;var e=cn();function t(r,n,o,i){var a,l={event:r,origin:n};typeof i=="function"&&(l.reply=(0,e.subscribeReplier)(i,n)),l.eventData=o;try{a=e.prefix+JSON.stringify(l)}catch(s){throw new Error("Could not stringify event: ".concat(s.message))}return a}return Ji.packagePayload=t,Ji}var T4={};Object.defineProperty(T4,"__esModule",{value:!0});T4.sendMessage=void 0;function mJ(e,t,r){try{e.postMessage(t,r)}catch{}}T4.sendMessage=mJ;var Zi={},ea={},Lv;function $M(){if(Lv)return ea;Lv=1,Object.defineProperty(ea,"__esModule",{value:!0}),ea.Framebus=void 0;var e=cn(),t=typeof window<"u"&&window.Promise,r=function(){function n(o){o===void 0&&(o={}),this.origin=o.origin||"*",this.channel=o.channel||"",this.verifyDomain=o.verifyDomain,this.targetFrames=o.targetFrames||[],this.limitBroadcastToFramesArray=!!o.targetFrames,this.isDestroyed=!1,this.listeners=[],this.hasAdditionalChecksForOnListeners=!!(this.verifyDomain||this.limitBroadcastToFramesArray)}return n.setPromise=function(o){n.Promise=o},n.target=function(o){return new n(o)},n.prototype.addTargetFrame=function(o){this.limitBroadcastToFramesArray&&this.targetFrames.push(o)},n.prototype.include=function(o){return o==null||o.Window==null||o.constructor!==o.Window?!1:(e.childWindows.push(o),!0)},n.prototype.target=function(o){return n.target(o)},n.prototype.emit=function(o,i,a){if(this.isDestroyed)return!1;var l=this.origin;if(o=this.namespaceEvent(o),(0,e.isntString)(o)||(0,e.isntString)(l))return!1;typeof i=="function"&&(a=i,i=void 0);var s=(0,e.packagePayload)(o,l,i,a);return s?(this.limitBroadcastToFramesArray?this.targetFramesAsWindows().forEach(function(u){(0,e.sendMessage)(u,s,l)}):(0,e.broadcast)(s,{origin:l,frame:window.top||window.self}),!0):!1},n.prototype.emitAsPromise=function(o,i){var a=this;return new n.Promise(function(l,s){var u=a.emit(o,i,function(d){l(d)});u||s(new Error('Listener not added for "'.concat(o,'"')))})},n.prototype.on=function(o,i){if(this.isDestroyed)return!1;var a=this,l=this.origin,s=i;return o=this.namespaceEvent(o),(0,e.subscriptionArgsInvalid)(o,s,l)?!1:(this.hasAdditionalChecksForOnListeners&&(s=function(){for(var u=[],d=0;d<arguments.length;d++)u[d]=arguments[d];a.passesVerifyDomainCheck(this&&this.origin)&&a.hasMatchingTargetFrame(this&&this.source)&&i.apply(void 0,u)}),this.listeners.push({eventName:o,handler:s,originalHandler:i}),e.subscribers[l]=e.subscribers[l]||{},e.subscribers[l][o]=e.subscribers[l][o]||[],e.subscribers[l][o].push(s),!0)},n.prototype.off=function(o,i){var a=i;if(this.isDestroyed)return!1;if(this.verifyDomain)for(var l=0;l<this.listeners.length;l++){var s=this.listeners[l];s.originalHandler===i&&(a=s.handler)}o=this.namespaceEvent(o);var u=this.origin;if((0,e.subscriptionArgsInvalid)(o,a,u))return!1;var d=e.subscribers[u]&&e.subscribers[u][o];if(!d)return!1;for(var l=0;l<d.length;l++)if(d[l]===a)return d.splice(l,1),!0;return!1},n.prototype.teardown=function(){if(!this.isDestroyed){this.isDestroyed=!0;for(var o=0;o<this.listeners.length;o++){var i=this.listeners[o];this.off(i.eventName,i.handler)}this.listeners.length=0}},n.prototype.passesVerifyDomainCheck=function(o){return this.verifyDomain?this.checkOrigin(o):!0},n.prototype.targetFramesAsWindows=function(){return this.limitBroadcastToFramesArray?this.targetFrames.map(function(o){return o instanceof HTMLIFrameElement?o.contentWindow:o}).filter(function(o){return o}):[]},n.prototype.hasMatchingTargetFrame=function(o){if(!this.limitBroadcastToFramesArray)return!0;var i=this.targetFramesAsWindows().find(function(a){return a===o});return!!i},n.prototype.checkOrigin=function(o){var i,a=document.createElement("a");a.href=location.href,a.protocol==="https:"?i=a.host.replace(/:443$/,""):a.protocol==="http:"?i=a.host.replace(/:80$/,""):i=a.host;var l=a.protocol+"//"+i;return l===o?!0:this.verifyDomain?this.verifyDomain(o):!0},n.prototype.namespaceEvent=function(o){return this.channel?"".concat(this.channel,":").concat(o):o},n.Promise=t,n}();return ea.Framebus=r,ea}function yJ(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=Math.random()*16|0,r=e==="x"?t:t&3|8;return r.toString(16)})}var bJ=yJ,Fv;function CJ(){if(Fv)return Zi;Fv=1;var e=b0&&b0.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(Zi,"__esModule",{value:!0}),Zi.subscribeReplier=void 0;var t=$M(),r=e(bJ);function n(o,i){var a=(0,r.default)();function l(s,u){o(s,u),t.Framebus.target({origin:i}).off(a,l)}return t.Framebus.target({origin:i}).on(a,l),a}return Zi.subscribeReplier=n,Zi}var ta={},Dv;function xJ(){if(Dv)return ta;Dv=1,Object.defineProperty(ta,"__esModule",{value:!0}),ta.subscriptionArgsInvalid=void 0;var e=cn();function t(r,n,o){return(0,e.isntString)(r)||typeof n!="function"?!0:(0,e.isntString)(o)}return ta.subscriptionArgsInvalid=t,ta}var IM={};Object.defineProperty(IM,"__esModule",{value:!0});var ra={},Hv;function SJ(){if(Hv)return ra;Hv=1,Object.defineProperty(ra,"__esModule",{value:!0}),ra.unpackPayload=void 0;var e=cn();function t(r){var n;if(r.data.slice(0,e.prefix.length)!==e.prefix)return!1;try{n=JSON.parse(r.data.slice(e.prefix.length))}catch{return!1}if(n.reply){var o=r.origin,i=r.source,a=n.reply;n.reply=function(s){if(i){var u=(0,e.packagePayload)(a,o,s);u&&i.postMessage(u,o)}}}return n}return ra.unpackPayload=t,ra}var Wv;function cn(){return Wv||(Wv=1,function(e){var t=b0&&b0.__createBinding||(Object.create?function(n,o,i,a){a===void 0&&(a=i);var l=Object.getOwnPropertyDescriptor(o,i);(!l||("get"in l?!o.__esModule:l.writable||l.configurable))&&(l={enumerable:!0,get:function(){return o[i]}}),Object.defineProperty(n,a,l)}:function(n,o,i,a){a===void 0&&(a=i),n[a]=o[i]}),r=b0&&b0.__exportStar||function(n,o){for(var i in n)i!=="default"&&!Object.prototype.hasOwnProperty.call(o,i)&&t(o,n,i)};Object.defineProperty(e,"__esModule",{value:!0}),r(sJ(),e),r(uJ(),e),r(dJ(),e),r(oo,e),r(fJ(),e),r(P4,e),r(O4,e),r(vJ(),e),r(gJ(),e),r(T4,e),r(CJ(),e),r(xJ(),e),r(IM,e),r(SJ(),e)}(fs)),fs}var MJ=cn(),zJ=$M();(0,MJ.attach)();var wJ=zJ.Framebus;const Vv=fi(wJ),hs=(e,t,r)=>{const n=document.createElement("iframe");return n.id=e,n.src=`${t}${r??""}`,n.style.display="none",document.body.appendChild(n),n},EM={apps:[],configs:new Map,navigate:()=>{},instances:new Map},PM=c.createContext(EM),Pi=()=>c.useContext(PM),$J=({children:e,apps:t,actions:r,data:n,navigation:o})=>{const[i,a]=c.useState({...EM}),l=new Vv,s=c.useRef(new Map),u=c.useRef(new Map),d=(v,g,b,y,p,C)=>{const x=new URL(g).searchParams.get(aJ)??void 0,S=new Vv({origin:g,targetFrames:[b],channel:cJ({basePath:C,channel:x})});S.on(Kt.SET_CONFIG,M=>{const{config:z}=M;a(w=>({...w,configs:new Map(w.configs.set(v,z)),instances:new Map(w.instances).set(v,{id:v,basePath:C||"",config:z,iframe:b,bus:S})})),S.emit(Kt.SET_DATA,n),S.emit(Kt.SET_APP_ID,{appId:v}),typeof p<"u"&&S.emit(Kt.SET_MODAL_CONTEXT,p)}),S.on(Kt.SET_HEIGHT,M=>{const{height:z,id:w}=M,$=document.getElementById(w);$&&($.style.height=`${z}px`)}),S.on(Kt.INVOKE_ACTION,(M,z)=>{const{actionKey:w,args:$}=M;if(r&&r.actions[w])try{Promise.resolve(r.actions[w](...$)).then(I=>z({success:!0,result:I})).catch(I=>{const O=I instanceof Error?I.message:"An error occurred";z({success:!1,error:O})})}catch(I){const O=I instanceof Error?I.message:"An error occurred";z({success:!1,error:O})}else z({success:!1,error:"Action not found"})}),S.on(Kt.INVOKE_DEFAULT_ACTION,(M,z)=>{if(!r)return;const{actionKey:w,args:$}=M,{showConfirmationDialog:I,showErrorMessage:O,showModalDialog:N,showToast:R,showRichModal:B}=r;if(w===Ki.showConfirmationDialog){try{const[A,T]=[...$],E=I==null?void 0:I(A,T,P=>S.emit(Kt.ACTION_CONFIRMED,{data:P}),()=>S.emit(Kt.ACTION_CANCELED));z==null||z({success:!0,result:E})}catch(A){const T=A instanceof Error?A.message:"An error occurred";z==null||z({success:!1,error:T})}return}if(w===Ki.showErrorMessage){const[A,T]=[...$];try{const E=O==null?void 0:O(A,T);z==null||z({success:!0,result:E})}catch(E){const P=E instanceof Error?E.message:"An error occurred";z==null||z({success:!1,error:P})}return}if(w===Ki.showModalDialog){const[A,T]=[...$];try{const E=N==null?void 0:N(A,T);z==null||z({success:!0,result:E})}catch(E){const P=E instanceof Error?E.message:"An error occurred";z==null||z({success:!1,error:P})}return}if(w===Ki.showToast){const[A,T]=[...$];try{const E=R==null?void 0:R(A,T);z==null||z({success:!0,result:E})}catch(E){const P=E instanceof Error?E.message:"An error occurred";z==null||z({success:!1,error:P})}return}if(w===Ki.showRichModal){const[A,T,E,P]=[...$],j=window.crypto.randomUUID();try{const k=B==null?void 0:B(j,A,T,E,P);z==null||z({success:!0,result:k});const _=`app-shell-iframe-modal-${j}`,H=hs(_,g);s.current.set(j,H),d(j,g,H,v,T,C),a(W=>({...W,frames:s,modals:W.modals?W.modals.set(j,v):new Map([[j,v]]),modalContext:W.modalContext?W.modalContext.set(j,T):new Map([[j,T]])}))}catch(k){const _=k instanceof Error?k.message:"An error occurred";z==null||z({success:!1,error:_})}return}}),S.on(Kt.NAVIGATE,M=>{var I;const{navigate:z}=o,{path:w,external:$}=M;if(z){y&&((I=r==null?void 0:r.closeRichModal)==null||I.call(r,v));const O=C&&!$&&!w.startsWith(C)?`${C}${w}`:w;z({id:y||v,path:O,external:$})}}),u.current.set(v,S),a(M=>({...M,buses:u,confirmAction:z=>{S.emit(Kt.ACTION_CONFIRMED,{data:z})},cancelAction:()=>{S.emit(Kt.ACTION_CANCELED)}}))};c.useEffect(()=>(t.filter(b=>b.type==="full_page").forEach(b=>{const y=`app-shell-iframe-fullpage-${b.id}`,p=hs(y,b.url),C=b.subSlug??new URL(b.url).pathname;s.current.set(b.id,p),a(x=>({...x,frames:s})),d(b.id,b.url,p,void 0,void 0,C)}),t.filter(b=>b.type==="plugin").forEach(b=>{const y=`app-shell-iframe-plugin-${b.id}`,p=hs(y,b.url,b.subSlug),C=b.subSlug??new URL(b.url).pathname;s.current.set(b.id,p),a(x=>({...x,frames:s})),d(b.id,b.url,p,void 0,void 0,C)}),()=>{u.current.forEach(b=>b.teardown()),s.current.forEach(b=>b.remove()),a(b=>({...b,instances:new Map}))}),[t==null?void 0:t.length]),c.useEffect(()=>{a(v=>({...v,data:n})),n&&u.current&&u.current.forEach(v=>{v.emit(Kt.SET_DATA,n)})},[n]);const m={...i,apps:t,navigate:({path:v,id:g})=>{var b;g?(b=u.current.get(g))==null||b.emit(Kt.NAVIGATE_CHILD,{path:v}):l.emit(Kt.NAVIGATE_CHILD,{path:v})},updateLocale:v=>{u.current.forEach(g=>{g.emit(Kt.LOCALE_CHANGED,{locale:v})})}};return me.jsx(PM.Provider,{value:m,children:e})},IJ=({id:e,path:t})=>{const r=`app-shell-fullpage-container-${e}`,{frames:n,navigate:o}=Pi();return c.useEffect(()=>{if(n!=null&&n.current.has(e)){const i=n.current.get(e),a=document.getElementById(r),l=new URL(i.src).origin;t?i.src=`${l}${t}`:i.src=l;const s={display:"block",width:"100%",height:"100%",border:"none"};Object.assign(i.style,s),a&&(a.innerHTML="",a.appendChild(i))}},[e,n==null?void 0:n.current.has(e)]),c.useEffect(()=>{t&&o({path:t,id:e})},[t]),me.jsx("div",{id:r,className:"app-shell-fullpage-container"})},EJ=({placeholderId:e,params:t})=>{const{apps:r,configs:n,frames:o,buses:i}=Pi(),a=Math.random().toString(16).slice(2),l=Array.from(n.keys()).filter(m=>{var g;const v=n.get(m);return typeof v.placeholderId=="string"?(v==null?void 0:v.placeholderId)===e:(g=v==null?void 0:v.placeholderId)==null?void 0:g.includes(e)}),s=r.filter(m=>l.includes(m.id)),u=s[0];if(!u)return null;s.length>1&&console.warn(`PluginRenderer: Found multiple plugins with placeholderId: ${e}`);const d=`app-shell-plugin-container-${a}`,f=`app-shell-plugin-iframe-${a}`,h=i==null?void 0:i.current.get(u.id);return c.useEffect(()=>{(async()=>{const v=o==null?void 0:o.current.get(u.id);if(v){const g=document.getElementById(d),b=document.createElement("iframe");if(b.id=f,b.name=f,t){const p=await Rv(t);b.src=`${v.src}?c=${p}`}else b.src=v.src;const y={background:"transparent",display:"block",width:"100%",border:"none"};Object.assign(b.style,y),g&&g.appendChild(b),b.onload=async()=>{if(h==null||h.addTargetFrame(b),t){const p=await Rv(t);h==null||h.target({channel:p}).emit(Kt.SET_PARAMS,t)}}}})()},[e,o]),c.useEffect(()=>{(async()=>{var v;if(t){const g=document.querySelector(`#${d} iframe`),b=(v=g==null?void 0:g.src.split("?")[1])==null?void 0:v.split("=")[1];h==null||h.target({channel:b}).emit(Kt.SET_PARAMS,t)}})()},[t]),me.jsx("div",{id:d,className:"app-shell-plugin-container"})},PJ=[{key:"/",label:"Welcome",icon:"dashboard"},{key:"/placeholder-1",label:"Settings",icon:"ayarlar",disabled:!0},{key:"/placeholder-2",label:"Help & Support",icon:"bilgilendirme_servis",disabled:!0}],OJ=[{key:"/plugin-test",label:"Plugin Test",icon:"box"}],TJ=()=>PJ,RJ=(e,t)=>e.filter(r=>r.type==="full_page").map(r=>{var n,o;return{key:`/external/${r.slug}`,label:r.name,icon:"stoklistesi",children:(o=(n=t.get(r.id))==null?void 0:n.menu)==null?void 0:o.map(i=>i!=null&&i.child?!1:{key:`/external/${r.slug}${i.path}`,label:i.label,icon:"eksi"}).filter(Boolean)}}),BJ=()=>OJ,NJ=()=>{const{apps:e,configs:t}=Pi(),r=E4(),n=k6(),[o,i]=c.useState("/"),[a,l]=c.useState([]),s=TJ(),u=RJ(e,t),d=BJ();c.useEffect(()=>{i(r.pathname)},[r]);const f=m=>{m.key.includes("external")||l([]),n(m.key)},h=m=>{l([m.pop()||""])};return me.jsx("div",{children:me.jsx(RK,{mode:"inline",selectedKeys:[o],items:[...s,...u,...d],onClick:f,theme:"dark",openKeys:a,onOpenChange:h})})},kJ=({children:e})=>{const[t,r]=c.useState(!1),[n,o]=c.useState(!0),i=()=>r(!t),a=()=>o(!n);return me.jsxs(p0,{children:[me.jsx(p0.Sider,{collapsed:t,brandImageUrl:"/logo.png",iconUrl:"/symbol.png",children:me.jsx(NJ,{})}),me.jsxs(p0,{children:[me.jsx(p0.Header,{children:me.jsx(iJ,{onToggleLeftSider:i,onToggleRightSider:a})}),me.jsx(p0.Content,{children:e})]}),me.jsx(p0.Sider,{collapsed:n,collapsedWidth:0,position:"right",children:me.jsxs(hq,{className:"log-messages",children:[me.jsxs("div",{className:"log-messages-item",children:[me.jsx(Ml,{type:"success",children:"Development server running"}),me.jsx(Ml,{children:new Date().toLocaleTimeString()})]}),me.jsxs("div",{className:"log-messages-item",children:[me.jsx(Ml,{children:"Shell environment active"}),me.jsx(Ml,{children:"Ready for testing"})]})]})})]})},_J=({config:e,children:t})=>{const[r,n]=O9.useNotification(),[o]=nJ(),i=k6(),a=[{id:1,url:e.plugin.url,slug:e.plugin.name.toLowerCase().replace(/\s+/g,"-"),path:"",type:e.plugin.type==="fullpage"?"full_page":"plugin",name:e.plugin.name}],l={navigate:({id:h,path:m,external:v})=>{const g=a.find(y=>y.id===h);if(!g)return;const b=v?m:`/external/${g.slug}${m||""}`;i(b)}},s={lng:"en",username:"Developer",searchParams:Object.fromEntries([...o])},f={...{showModalDialog:()=>{},showToast:(h,m)=>{m==="loading"||m==="destroy"||r[m]({message:h,placement:"top"})},showErrorMessage:(h,m)=>{r.error({message:h,description:m,placement:"top"})},showRichModal:()=>{}},actions:{...{reloadPage:()=>window.location.reload(),logMessage:h=>{try{const m=JSON.parse(localStorage.getItem("logMessages")||"[]");localStorage.setItem("logMessages",JSON.stringify([...m,h]))}catch{}}}}};return me.jsxs($J,{apps:a,navigation:l,data:s,actions:f,children:[t,n]})},OM=({children:e})=>me.jsx("div",{className:"px-8 py-8",children:e}),jJ=({title:e,description:t,actions:r,className:n})=>me.jsxs(fS,{justify:"space-between",align:"flex-start",className:n,style:{padding:"18px 30px",borderBlockEnd:"solid 1px var(--color-gray-900)"},children:[me.jsxs(Ko,{direction:"vertical",size:4,children:[me.jsx(zn.Title,{level:4,style:{margin:0},children:e}),t&&me.jsx(zn.Paragraph,{type:"secondary",children:t})]}),r&&me.jsx(Ko,{children:r})]}),AJ=()=>{const e=k6(),{apps:t}=Pi(),r=t[0];return me.jsxs("div",{children:[me.jsx(ns,{title:"Application Configuration",style:{marginBottom:"24px"},children:me.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"16px"},children:[me.jsxs("div",{children:[me.jsx("strong",{children:"Application Name:"}),me.jsx("p",{style:{margin:"12px 0 4px 0"},children:(r==null?void 0:r.name)||"Development App"})]}),me.jsxs("div",{children:[me.jsx("strong",{children:"Application Type:"}),me.jsx("p",{style:{margin:"12px 0 4px 0"},children:me.jsx(_Q,{color:(r==null?void 0:r.type)==="full_page"?"blue":"green",children:(r==null?void 0:r.type)==="full_page"?"fullpage":"plugin"})})]}),me.jsxs("div",{children:[me.jsx("strong",{children:"Development URL:"}),me.jsx("p",{style:{margin:"12px 0 4px 0",color:"#999",fontFamily:"monospace",fontSize:"13px"},children:(r==null?void 0:r.url)||"http://localhost:4001"})]}),me.jsxs("div",{children:[me.jsx("strong",{children:"Shell Theme:"}),me.jsx("p",{style:{margin:"12px 0 4px 0",color:"#999"},children:"omnitron"})]})]})}),me.jsx(ns,{title:"Quick Actions",style:{marginBottom:"24px"},children:me.jsxs("div",{style:{display:"flex",gap:"16px",flexWrap:"wrap"},children:[me.jsx(Q3,{type:"primary",onClick:()=>e(`/external/${r==null?void 0:r.slug}`),children:"Launch Application"}),(r==null?void 0:r.type)==="plugin"&&me.jsx(Q3,{onClick:()=>e("/plugin-test"),children:"Test Plugin Integration"})]})}),me.jsx(ns,{title:"Development Instructions",children:me.jsxs("div",{style:{lineHeight:"1.6"},children:[me.jsx("h4",{style:{margin:"0 0 8px 0"},children:"Getting Started:"}),me.jsxs("ol",{style:{paddingLeft:"20px"},children:[me.jsxs("li",{children:["Make sure your application is running at"," ",me.jsx("code",{children:(r==null?void 0:r.url)||"http://localhost:4001"})]}),me.jsx("li",{children:'Click "Launch Application" to load your app in the shell environment'}),(r==null?void 0:r.type)==="plugin"&&me.jsx("li",{children:'Use "Test Plugin Integration" to test your plugin in different placeholder configurations'}),me.jsx("li",{children:"The shell provides a realistic integration environment for testing"})]}),me.jsx(tK,{}),me.jsxs("h4",{style:{margin:"16px 0 8px 0"},children:["Application Type:"," ",(r==null?void 0:r.type)==="full_page"?"fullpage":"plugin"]}),(r==null?void 0:r.type)==="full_page"?me.jsx("p",{style:{margin:0,color:"#666"},children:"Your fullpage application will render as complete pages within the shell environment, providing full control over the content area and routing."}):me.jsx("p",{style:{margin:0,color:"#666"},children:"Your plugin application will render within designated placeholders in the host application, providing component-level integration capabilities."})]})})]})},LJ=()=>me.jsxs("div",{className:"page-dashboard",children:[me.jsx("div",{className:"page-heading-container",children:me.jsx(jJ,{title:"Welcome",description:"Development environment for testing and integrating your applications"})}),me.jsx("div",{className:"page-content-container",children:me.jsx(OM,{children:me.jsx(AJ,{})})})]}),Uv=({id:e,path:t})=>me.jsx("div",{className:"page-plugin-external",children:me.jsx(IJ,{id:e,path:t})}),FJ=()=>{const e=k6(),{apps:t,configs:r}=Pi(),n=i=>{let a=null;if(Array.from(r.entries()).forEach(([u,d])=>{if("placeholderId"in d&&d.placeholderId===i){a=u;return}}),a===null)return"";const{url:l,subSlug:s}=t.find(({id:u})=>u===a)||{};return l?`[ ${l}${s??""} ]`:""},o=[];return Array.from(r.entries()).forEach(([,i])=>{"placeholderId"in i&&o.push(i.placeholderId)}),me.jsxs("div",{className:"page-plugin-basic",children:[me.jsx(hG,{items:[{onClick:()=>e("/"),title:"Dashboard"},{title:"Plugin Test"}]}),me.jsx("div",{className:"page-heading-container",children:me.jsx(bK,{title:"Plugin Test"})}),me.jsx("div",{className:"page-content-container",children:me.jsx(OM,{children:o.length>0?me.jsx(gK,{gutter:[20,20],children:o.map((i,a)=>me.jsx(mK,{span:12,children:me.jsx("div",{className:"plugin-placeholder","data-title":`${i} ${n(i)}`,children:me.jsx(EJ,{placeholderId:i})})},i))}):me.jsxs("div",{style:{textAlign:"center",padding:"48px",border:"1px dashed #d9d9d9",borderRadius:"8px",backgroundColor:"#fafafa"},children:[me.jsx("h3",{children:"No Plugin Configurations Found"}),me.jsx("p",{children:"No plugin applications with placeholder configurations were found."}),me.jsx("p",{children:"Make sure your shell configuration includes plugin apps with placeholder IDs."})]})})})]})},DJ=()=>me.jsx(FJ,{}),HJ=()=>{const{apps:e,configs:t}=Pi(),r=e.filter(n=>n.type==="full_page");return me.jsxs(JY,{children:[r.map(n=>{var o,i;return me.jsxs(y0,{path:`/external/${n.slug}`,children:[me.jsx(y0,{index:!0,element:me.jsx(Uv,{id:n.id,path:n.path})}),(i=(o=t.get(n.id))==null?void 0:o.menu)==null?void 0:i.map(a=>a.path!=="/"&&me.jsx(y0,{path:`/external/${n.slug}${a.path}`,element:me.jsx(Uv,{id:n.id,path:n.subSlug?`${n.subSlug}${a.path}`:a.path})},a.path))]},n.id)}),me.jsx(y0,{path:"/plugin-test",element:me.jsx(DJ,{})}),me.jsx(y0,{path:"/",element:me.jsx(LJ,{})})]})},WJ=({config:e})=>me.jsx(rJ,{children:me.jsx(vq,{children:me.jsx(_J,{config:e,children:me.jsx(kJ,{children:me.jsx(HJ,{})})})})}),VJ=window.__SHELL_CONFIG__||{plugin:{url:"http://localhost:4001",path:"./src",name:"Development App",type:"fullpage"},shell:{port:4e3,theme:"omnitron",title:"Development Shell"},sidebar:{items:[]}};ps.createRoot(document.getElementById("root")).render(me.jsx(K.StrictMode,{children:me.jsx(WJ,{config:VJ})}));
|
|
408
|
+
*/function M7(e){return e===void 0&&(e=""),new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,r)=>{let n=e[r];return t.concat(Array.isArray(n)?n.map(o=>[r,o]):[[r,n]])},[]))}function ZY(e,t){let r=M7(e);return t&&t.forEach((n,o)=>{r.has(o)||t.getAll(o).forEach(i=>{r.append(o,i)})}),r}const eJ="6";try{window.__reactRouterVersion=eJ}catch{}const tJ="startTransition",Pv=_o[tJ];function rJ(e){let{basename:t,children:r,future:n,window:o}=e,i=c.useRef();i.current==null&&(i.current=cY({window:o,v5Compat:!0}));let a=i.current,[l,s]=c.useState({action:a.action,location:a.location}),{v7_startTransition:u}=n||{},d=c.useCallback(f=>{u&&Pv?Pv(()=>s(f)):s(f)},[s,u]);return c.useLayoutEffect(()=>a.listen(d),[a,d]),c.useEffect(()=>QY(n),[n]),c.createElement(YY,{basename:t,children:r,location:l.location,navigationType:l.action,navigator:a,future:n})}var Ov;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(Ov||(Ov={}));var Tv;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(Tv||(Tv={}));function nJ(e){let t=c.useRef(M7(e)),r=c.useRef(!1),n=E4(),o=c.useMemo(()=>ZY(n.search,r.current?null:t.current),[n.search]),i=k6(),a=c.useCallback((l,s)=>{const u=M7(typeof l=="function"?l(o):l);r.current=!0,i("?"+u,s)},[i,o]);return[o,a]}const oJ=()=>"1.3.3",iJ=({onToggleLeftSider:e,onToggleRightSider:t})=>me.jsxs(me.Fragment,{children:[me.jsx("div",{className:"flex items-center",children:me.jsx(Q3,{type:"text",icon:"outdent",iconSize:16,onClick:e,className:"mr-2"})}),me.jsx("div",{children:me.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[me.jsx("span",{style:{width:"10px",height:"10px",backgroundColor:"green",borderRadius:"50%"}}),me.jsxs("span",{style:{fontSize:"14px",color:"#999"},children:["Akinon UI Shell (v",oJ(),")"]})]})}),me.jsx("div",{className:"flex items-center",children:me.jsx(Q3,{type:"text",icon:"siralama",iconSize:16,onClick:t,className:"mr-2"})})]}),aJ="c",Kt={SET_APP_ID:"SET_APP_ID",SET_CONFIG:"SET_CONFIG",SET_DATA:"SET_DATA",SET_MODAL_CONTEXT:"SET_MODAL_CONTEXT",SET_HEIGHT:"SET_HEIGHT",SET_PARAMS:"SET_PARAMS",INVOKE_ACTION:"INVOKE_ACTION",INVOKE_DEFAULT_ACTION:"INVOKE_DEFAULT_ACTION",NAVIGATE:"NAVIGATE",NAVIGATE_CHILD:"NAVIGATE_CHILD",ACTION_CONFIRMED:"ACTION_CONFIRMED",ACTION_CANCELED:"ACTION_CANCELED",LOCALE_CHANGED:"LOCALE_CHANGED"},Ki={showConfirmationDialog:"showConfirmationDialog",showModalDialog:"showModalDialog",showToast:"showToast",showErrorMessage:"showErrorMessage",showRichModal:"showRichModal"},lJ=async e=>{const t=await crypto.subtle.digest("SHA-256",new TextEncoder().encode(JSON.stringify(e))),r=[],n=new DataView(t);for(let o=0;o<n.byteLength;o+=4)r.push(("00000000"+n.getUint32(o).toString(16)).slice(-8));return r.join("")},Rv=async e=>(await lJ(e)).slice(0,7),cJ=({basePath:e,channel:t})=>`${e||"/"}${t?`-${t}`:""}`;var fs={},bo={},Bv;function sJ(){if(Bv)return bo;Bv=1,Object.defineProperty(bo,"__esModule",{value:!0}),bo.detach=bo.attach=void 0;var e=cn(),t=!1;function r(){t||typeof window>"u"||(t=!0,window.addEventListener("message",e.onMessage,!1))}bo.attach=r;function n(){t=!1,window.removeEventListener("message",e.onMessage,!1)}return bo.detach=n,bo}var qi={},Nv;function uJ(){if(Nv)return qi;Nv=1,Object.defineProperty(qi,"__esModule",{value:!0}),qi.broadcastToChildWindows=void 0;var e=cn();function t(r,n,o){for(var i=e.childWindows.length-1;i>=0;i--){var a=e.childWindows[i];a.closed?e.childWindows.splice(i,1):o!==a&&(0,e.broadcast)(r,{origin:n,frame:a.top})}}return qi.broadcastToChildWindows=t,qi}var Xi={},kv;function dJ(){if(kv)return Xi;kv=1,Object.defineProperty(Xi,"__esModule",{value:!0}),Xi.broadcast=void 0;var e=cn();function t(r,n){var o=0,i,a=n.origin,l=n.frame;try{for(l.postMessage(r,a),(0,e.hasOpener)(l)&&l.opener.top!==window.top&&t(r,{origin:a,frame:l.opener.top});i=l.frames[o];)t(r,{origin:a,frame:i}),o++}catch{}}return Xi.broadcast=t,Xi}var oo={};Object.defineProperty(oo,"__esModule",{value:!0});oo.subscribers=oo.childWindows=oo.prefix=void 0;oo.prefix="/*framebus*/";oo.childWindows=[];oo.subscribers={};var Qi={},_v;function fJ(){if(_v)return Qi;_v=1,Object.defineProperty(Qi,"__esModule",{value:!0}),Qi.dispatch=void 0;var e=cn();function t(r,n,o,i,a){if(e.subscribers[r]&&e.subscribers[r][n]){var l=[];o&&l.push(o),i&&l.push(i);for(var s=0;s<e.subscribers[r][n].length;s++)e.subscribers[r][n][s].apply(a,l)}}return Qi.dispatch=t,Qi}var P4={};Object.defineProperty(P4,"__esModule",{value:!0});P4.hasOpener=void 0;function hJ(e){return!(e.top!==e||e.opener==null||e.opener===e||e.opener.closed===!0)}P4.hasOpener=hJ;var O4={};Object.defineProperty(O4,"__esModule",{value:!0});O4.isntString=void 0;function pJ(e){return typeof e!="string"}O4.isntString=pJ;var Yi={},jv;function vJ(){if(jv)return Yi;jv=1,Object.defineProperty(Yi,"__esModule",{value:!0}),Yi.onMessage=void 0;var e=cn();function t(r){if(!(0,e.isntString)(r.data)){var n=(0,e.unpackPayload)(r);if(n){var o=n.eventData,i=n.reply;(0,e.dispatch)("*",n.event,o,i,r),(0,e.dispatch)(r.origin,n.event,o,i,r),(0,e.broadcastToChildWindows)(r.data,n.origin,r.source)}}}return Yi.onMessage=t,Yi}var Ji={},Av;function gJ(){if(Av)return Ji;Av=1,Object.defineProperty(Ji,"__esModule",{value:!0}),Ji.packagePayload=void 0;var e=cn();function t(r,n,o,i){var a,l={event:r,origin:n};typeof i=="function"&&(l.reply=(0,e.subscribeReplier)(i,n)),l.eventData=o;try{a=e.prefix+JSON.stringify(l)}catch(s){throw new Error("Could not stringify event: ".concat(s.message))}return a}return Ji.packagePayload=t,Ji}var T4={};Object.defineProperty(T4,"__esModule",{value:!0});T4.sendMessage=void 0;function mJ(e,t,r){try{e.postMessage(t,r)}catch{}}T4.sendMessage=mJ;var Zi={},ea={},Lv;function $M(){if(Lv)return ea;Lv=1,Object.defineProperty(ea,"__esModule",{value:!0}),ea.Framebus=void 0;var e=cn(),t=typeof window<"u"&&window.Promise,r=function(){function n(o){o===void 0&&(o={}),this.origin=o.origin||"*",this.channel=o.channel||"",this.verifyDomain=o.verifyDomain,this.targetFrames=o.targetFrames||[],this.limitBroadcastToFramesArray=!!o.targetFrames,this.isDestroyed=!1,this.listeners=[],this.hasAdditionalChecksForOnListeners=!!(this.verifyDomain||this.limitBroadcastToFramesArray)}return n.setPromise=function(o){n.Promise=o},n.target=function(o){return new n(o)},n.prototype.addTargetFrame=function(o){this.limitBroadcastToFramesArray&&this.targetFrames.push(o)},n.prototype.include=function(o){return o==null||o.Window==null||o.constructor!==o.Window?!1:(e.childWindows.push(o),!0)},n.prototype.target=function(o){return n.target(o)},n.prototype.emit=function(o,i,a){if(this.isDestroyed)return!1;var l=this.origin;if(o=this.namespaceEvent(o),(0,e.isntString)(o)||(0,e.isntString)(l))return!1;typeof i=="function"&&(a=i,i=void 0);var s=(0,e.packagePayload)(o,l,i,a);return s?(this.limitBroadcastToFramesArray?this.targetFramesAsWindows().forEach(function(u){(0,e.sendMessage)(u,s,l)}):(0,e.broadcast)(s,{origin:l,frame:window.top||window.self}),!0):!1},n.prototype.emitAsPromise=function(o,i){var a=this;return new n.Promise(function(l,s){var u=a.emit(o,i,function(d){l(d)});u||s(new Error('Listener not added for "'.concat(o,'"')))})},n.prototype.on=function(o,i){if(this.isDestroyed)return!1;var a=this,l=this.origin,s=i;return o=this.namespaceEvent(o),(0,e.subscriptionArgsInvalid)(o,s,l)?!1:(this.hasAdditionalChecksForOnListeners&&(s=function(){for(var u=[],d=0;d<arguments.length;d++)u[d]=arguments[d];a.passesVerifyDomainCheck(this&&this.origin)&&a.hasMatchingTargetFrame(this&&this.source)&&i.apply(void 0,u)}),this.listeners.push({eventName:o,handler:s,originalHandler:i}),e.subscribers[l]=e.subscribers[l]||{},e.subscribers[l][o]=e.subscribers[l][o]||[],e.subscribers[l][o].push(s),!0)},n.prototype.off=function(o,i){var a=i;if(this.isDestroyed)return!1;if(this.verifyDomain)for(var l=0;l<this.listeners.length;l++){var s=this.listeners[l];s.originalHandler===i&&(a=s.handler)}o=this.namespaceEvent(o);var u=this.origin;if((0,e.subscriptionArgsInvalid)(o,a,u))return!1;var d=e.subscribers[u]&&e.subscribers[u][o];if(!d)return!1;for(var l=0;l<d.length;l++)if(d[l]===a)return d.splice(l,1),!0;return!1},n.prototype.teardown=function(){if(!this.isDestroyed){this.isDestroyed=!0;for(var o=0;o<this.listeners.length;o++){var i=this.listeners[o];this.off(i.eventName,i.handler)}this.listeners.length=0}},n.prototype.passesVerifyDomainCheck=function(o){return this.verifyDomain?this.checkOrigin(o):!0},n.prototype.targetFramesAsWindows=function(){return this.limitBroadcastToFramesArray?this.targetFrames.map(function(o){return o instanceof HTMLIFrameElement?o.contentWindow:o}).filter(function(o){return o}):[]},n.prototype.hasMatchingTargetFrame=function(o){if(!this.limitBroadcastToFramesArray)return!0;var i=this.targetFramesAsWindows().find(function(a){return a===o});return!!i},n.prototype.checkOrigin=function(o){var i,a=document.createElement("a");a.href=location.href,a.protocol==="https:"?i=a.host.replace(/:443$/,""):a.protocol==="http:"?i=a.host.replace(/:80$/,""):i=a.host;var l=a.protocol+"//"+i;return l===o?!0:this.verifyDomain?this.verifyDomain(o):!0},n.prototype.namespaceEvent=function(o){return this.channel?"".concat(this.channel,":").concat(o):o},n.Promise=t,n}();return ea.Framebus=r,ea}function yJ(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=Math.random()*16|0,r=e==="x"?t:t&3|8;return r.toString(16)})}var bJ=yJ,Fv;function CJ(){if(Fv)return Zi;Fv=1;var e=b0&&b0.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(Zi,"__esModule",{value:!0}),Zi.subscribeReplier=void 0;var t=$M(),r=e(bJ);function n(o,i){var a=(0,r.default)();function l(s,u){o(s,u),t.Framebus.target({origin:i}).off(a,l)}return t.Framebus.target({origin:i}).on(a,l),a}return Zi.subscribeReplier=n,Zi}var ta={},Dv;function xJ(){if(Dv)return ta;Dv=1,Object.defineProperty(ta,"__esModule",{value:!0}),ta.subscriptionArgsInvalid=void 0;var e=cn();function t(r,n,o){return(0,e.isntString)(r)||typeof n!="function"?!0:(0,e.isntString)(o)}return ta.subscriptionArgsInvalid=t,ta}var IM={};Object.defineProperty(IM,"__esModule",{value:!0});var ra={},Hv;function SJ(){if(Hv)return ra;Hv=1,Object.defineProperty(ra,"__esModule",{value:!0}),ra.unpackPayload=void 0;var e=cn();function t(r){var n;if(r.data.slice(0,e.prefix.length)!==e.prefix)return!1;try{n=JSON.parse(r.data.slice(e.prefix.length))}catch{return!1}if(n.reply){var o=r.origin,i=r.source,a=n.reply;n.reply=function(s){if(i){var u=(0,e.packagePayload)(a,o,s);u&&i.postMessage(u,o)}}}return n}return ra.unpackPayload=t,ra}var Wv;function cn(){return Wv||(Wv=1,function(e){var t=b0&&b0.__createBinding||(Object.create?function(n,o,i,a){a===void 0&&(a=i);var l=Object.getOwnPropertyDescriptor(o,i);(!l||("get"in l?!o.__esModule:l.writable||l.configurable))&&(l={enumerable:!0,get:function(){return o[i]}}),Object.defineProperty(n,a,l)}:function(n,o,i,a){a===void 0&&(a=i),n[a]=o[i]}),r=b0&&b0.__exportStar||function(n,o){for(var i in n)i!=="default"&&!Object.prototype.hasOwnProperty.call(o,i)&&t(o,n,i)};Object.defineProperty(e,"__esModule",{value:!0}),r(sJ(),e),r(uJ(),e),r(dJ(),e),r(oo,e),r(fJ(),e),r(P4,e),r(O4,e),r(vJ(),e),r(gJ(),e),r(T4,e),r(CJ(),e),r(xJ(),e),r(IM,e),r(SJ(),e)}(fs)),fs}var MJ=cn(),zJ=$M();(0,MJ.attach)();var wJ=zJ.Framebus;const Vv=fi(wJ),hs=(e,t,r)=>{const n=document.createElement("iframe");return n.id=e,n.src=`${t}${r??""}`,n.style.display="none",document.body.appendChild(n),n},EM={apps:[],configs:new Map,navigate:()=>{},instances:new Map},PM=c.createContext(EM),Pi=()=>c.useContext(PM),$J=({children:e,apps:t,actions:r,data:n,navigation:o})=>{const[i,a]=c.useState({...EM}),l=new Vv,s=c.useRef(new Map),u=c.useRef(new Map),d=(v,g,b,y,p,C)=>{const x=new URL(g).searchParams.get(aJ)??void 0,S=new Vv({origin:g,targetFrames:[b],channel:cJ({basePath:C,channel:x})});S.on(Kt.SET_CONFIG,M=>{const{config:z}=M;a(w=>({...w,configs:new Map(w.configs.set(v,z)),instances:new Map(w.instances).set(v,{id:v,basePath:C||"",config:z,iframe:b,bus:S})})),S.emit(Kt.SET_DATA,n),S.emit(Kt.SET_APP_ID,{appId:v}),typeof p<"u"&&S.emit(Kt.SET_MODAL_CONTEXT,p)}),S.on(Kt.SET_HEIGHT,M=>{const{height:z,id:w}=M,$=document.getElementById(w);$&&($.style.height=`${z}px`)}),S.on(Kt.INVOKE_ACTION,(M,z)=>{const{actionKey:w,args:$}=M;if(r&&r.actions[w])try{Promise.resolve(r.actions[w](...$)).then(I=>z({success:!0,result:I})).catch(I=>{const O=I instanceof Error?I.message:"An error occurred";z({success:!1,error:O})})}catch(I){const O=I instanceof Error?I.message:"An error occurred";z({success:!1,error:O})}else z({success:!1,error:"Action not found"})}),S.on(Kt.INVOKE_DEFAULT_ACTION,(M,z)=>{if(!r)return;const{actionKey:w,args:$}=M,{showConfirmationDialog:I,showErrorMessage:O,showModalDialog:N,showToast:R,showRichModal:B}=r;if(w===Ki.showConfirmationDialog){try{const[A,T]=[...$],E=I==null?void 0:I(A,T,P=>S.emit(Kt.ACTION_CONFIRMED,{data:P}),()=>S.emit(Kt.ACTION_CANCELED));z==null||z({success:!0,result:E})}catch(A){const T=A instanceof Error?A.message:"An error occurred";z==null||z({success:!1,error:T})}return}if(w===Ki.showErrorMessage){const[A,T]=[...$];try{const E=O==null?void 0:O(A,T);z==null||z({success:!0,result:E})}catch(E){const P=E instanceof Error?E.message:"An error occurred";z==null||z({success:!1,error:P})}return}if(w===Ki.showModalDialog){const[A,T]=[...$];try{const E=N==null?void 0:N(A,T);z==null||z({success:!0,result:E})}catch(E){const P=E instanceof Error?E.message:"An error occurred";z==null||z({success:!1,error:P})}return}if(w===Ki.showToast){const[A,T]=[...$];try{const E=R==null?void 0:R(A,T);z==null||z({success:!0,result:E})}catch(E){const P=E instanceof Error?E.message:"An error occurred";z==null||z({success:!1,error:P})}return}if(w===Ki.showRichModal){const[A,T,E,P]=[...$],j=window.crypto.randomUUID();try{const k=B==null?void 0:B(j,A,T,E,P);z==null||z({success:!0,result:k});const _=`app-shell-iframe-modal-${j}`,H=hs(_,g);s.current.set(j,H),d(j,g,H,v,T,C),a(W=>({...W,frames:s,modals:W.modals?W.modals.set(j,v):new Map([[j,v]]),modalContext:W.modalContext?W.modalContext.set(j,T):new Map([[j,T]])}))}catch(k){const _=k instanceof Error?k.message:"An error occurred";z==null||z({success:!1,error:_})}return}}),S.on(Kt.NAVIGATE,M=>{var I;const{navigate:z}=o,{path:w,external:$}=M;if(z){y&&((I=r==null?void 0:r.closeRichModal)==null||I.call(r,v));const O=C&&!$&&!w.startsWith(C)?`${C}${w}`:w;z({id:y||v,path:O,external:$})}}),u.current.set(v,S),a(M=>({...M,buses:u,confirmAction:z=>{S.emit(Kt.ACTION_CONFIRMED,{data:z})},cancelAction:()=>{S.emit(Kt.ACTION_CANCELED)}}))};c.useEffect(()=>(t.filter(b=>b.type==="full_page").forEach(b=>{const y=`app-shell-iframe-fullpage-${b.id}`,p=hs(y,b.url),C=b.subSlug??new URL(b.url).pathname;s.current.set(b.id,p),a(x=>({...x,frames:s})),d(b.id,b.url,p,void 0,void 0,C)}),t.filter(b=>b.type==="plugin").forEach(b=>{const y=`app-shell-iframe-plugin-${b.id}`,p=hs(y,b.url,b.subSlug),C=b.subSlug??new URL(b.url).pathname;s.current.set(b.id,p),a(x=>({...x,frames:s})),d(b.id,b.url,p,void 0,void 0,C)}),()=>{u.current.forEach(b=>b.teardown()),s.current.forEach(b=>b.remove()),a(b=>({...b,instances:new Map}))}),[t==null?void 0:t.length]),c.useEffect(()=>{a(v=>({...v,data:n})),n&&u.current&&u.current.forEach(v=>{v.emit(Kt.SET_DATA,n)})},[n]);const m={...i,apps:t,navigate:({path:v,id:g})=>{var b;g?(b=u.current.get(g))==null||b.emit(Kt.NAVIGATE_CHILD,{path:v}):l.emit(Kt.NAVIGATE_CHILD,{path:v})},updateLocale:v=>{u.current.forEach(g=>{g.emit(Kt.LOCALE_CHANGED,{locale:v})})}};return me.jsx(PM.Provider,{value:m,children:e})},IJ=({id:e,path:t})=>{const r=`app-shell-fullpage-container-${e}`,{frames:n,navigate:o}=Pi();return c.useEffect(()=>{if(n!=null&&n.current.has(e)){const i=n.current.get(e),a=document.getElementById(r),l=new URL(i.src).origin;t?i.src=`${l}${t}`:i.src=l;const s={display:"block",width:"100%",height:"100%",border:"none"};Object.assign(i.style,s),a&&(a.innerHTML="",a.appendChild(i))}},[e,n==null?void 0:n.current.has(e)]),c.useEffect(()=>{t&&o({path:t,id:e})},[t]),me.jsx("div",{id:r,className:"app-shell-fullpage-container"})},EJ=({placeholderId:e,params:t})=>{const{apps:r,configs:n,frames:o,buses:i}=Pi(),a=Math.random().toString(16).slice(2),l=Array.from(n.keys()).filter(m=>{var g;const v=n.get(m);return typeof v.placeholderId=="string"?(v==null?void 0:v.placeholderId)===e:(g=v==null?void 0:v.placeholderId)==null?void 0:g.includes(e)}),s=r.filter(m=>l.includes(m.id)),u=s[0];if(!u)return null;s.length>1&&console.warn(`PluginRenderer: Found multiple plugins with placeholderId: ${e}`);const d=`app-shell-plugin-container-${a}`,f=`app-shell-plugin-iframe-${a}`,h=i==null?void 0:i.current.get(u.id);return c.useEffect(()=>{(async()=>{const v=o==null?void 0:o.current.get(u.id);if(v){const g=document.getElementById(d),b=document.createElement("iframe");if(b.id=f,b.name=f,t){const p=await Rv(t);b.src=`${v.src}?c=${p}`}else b.src=v.src;const y={background:"transparent",display:"block",width:"100%",border:"none"};Object.assign(b.style,y),g&&g.appendChild(b),b.onload=async()=>{if(h==null||h.addTargetFrame(b),t){const p=await Rv(t);h==null||h.target({channel:p}).emit(Kt.SET_PARAMS,t)}}}})()},[e,o]),c.useEffect(()=>{(async()=>{var v;if(t){const g=document.querySelector(`#${d} iframe`),b=(v=g==null?void 0:g.src.split("?")[1])==null?void 0:v.split("=")[1];h==null||h.target({channel:b}).emit(Kt.SET_PARAMS,t)}})()},[t]),me.jsx("div",{id:d,className:"app-shell-plugin-container"})},PJ=[{key:"/",label:"Welcome",icon:"dashboard"},{key:"/placeholder-1",label:"Settings",icon:"ayarlar",disabled:!0},{key:"/placeholder-2",label:"Help & Support",icon:"bilgilendirme_servis",disabled:!0}],OJ=[{key:"/plugin-test",label:"Plugin Test",icon:"box"}],TJ=()=>PJ,RJ=(e,t)=>e.filter(r=>r.type==="full_page").map(r=>{var n,o;return{key:`/external/${r.slug}`,label:r.name,icon:"stoklistesi",children:(o=(n=t.get(r.id))==null?void 0:n.menu)==null?void 0:o.map(i=>i!=null&&i.child?!1:{key:`/external/${r.slug}${i.path}`,label:i.label,icon:"eksi"}).filter(Boolean)}}),BJ=()=>OJ,NJ=()=>{const{apps:e,configs:t}=Pi(),r=E4(),n=k6(),[o,i]=c.useState("/"),[a,l]=c.useState([]),s=TJ(),u=RJ(e,t),d=BJ();c.useEffect(()=>{i(r.pathname)},[r]);const f=m=>{m.key.includes("external")||l([]),n(m.key)},h=m=>{l([m.pop()||""])};return me.jsx("div",{children:me.jsx(RK,{mode:"inline",selectedKeys:[o],items:[...s,...u,...d],onClick:f,theme:"dark",openKeys:a,onOpenChange:h})})},kJ=({children:e})=>{const[t,r]=c.useState(!1),[n,o]=c.useState(!0),i=()=>r(!t),a=()=>o(!n);return me.jsxs(p0,{children:[me.jsx(p0.Sider,{collapsed:t,brandImageUrl:"/logo.png",iconUrl:"/symbol.png",children:me.jsx(NJ,{})}),me.jsxs(p0,{children:[me.jsx(p0.Header,{children:me.jsx(iJ,{onToggleLeftSider:i,onToggleRightSider:a})}),me.jsx(p0.Content,{children:e})]}),me.jsx(p0.Sider,{collapsed:n,collapsedWidth:0,position:"right",children:me.jsxs(hq,{className:"log-messages",children:[me.jsxs("div",{className:"log-messages-item",children:[me.jsx(Ml,{type:"success",children:"Development server running"}),me.jsx(Ml,{children:new Date().toLocaleTimeString()})]}),me.jsxs("div",{className:"log-messages-item",children:[me.jsx(Ml,{children:"Shell environment active"}),me.jsx(Ml,{children:"Ready for testing"})]})]})})]})},_J=({config:e,children:t})=>{const[r,n]=O9.useNotification(),[o]=nJ(),i=k6(),a=[{id:1,url:e.plugin.url,slug:e.plugin.name.toLowerCase().replace(/\s+/g,"-"),path:"",type:e.plugin.type==="fullpage"?"full_page":"plugin",name:e.plugin.name}],l={navigate:({id:h,path:m,external:v})=>{const g=a.find(y=>y.id===h);if(!g)return;const b=v?m:`/external/${g.slug}${m||""}`;i(b)}},s={lng:"en",username:"Developer",searchParams:Object.fromEntries([...o])},f={...{showModalDialog:()=>{},showToast:(h,m)=>{m==="loading"||m==="destroy"||r[m]({message:h,placement:"top"})},showErrorMessage:(h,m)=>{r.error({message:h,description:m,placement:"top"})},showRichModal:()=>{}},actions:{...{reloadPage:()=>window.location.reload(),logMessage:h=>{try{const m=JSON.parse(localStorage.getItem("logMessages")||"[]");localStorage.setItem("logMessages",JSON.stringify([...m,h]))}catch{}}}}};return me.jsxs($J,{apps:a,navigation:l,data:s,actions:f,children:[t,n]})},OM=({children:e})=>me.jsx("div",{className:"px-8 py-8",children:e}),jJ=({title:e,description:t,actions:r,className:n})=>me.jsxs(fS,{justify:"space-between",align:"flex-start",className:n,style:{padding:"18px 30px",borderBlockEnd:"solid 1px var(--color-gray-900)"},children:[me.jsxs(Ko,{direction:"vertical",size:4,children:[me.jsx(zn.Title,{level:4,style:{margin:0},children:e}),t&&me.jsx(zn.Paragraph,{type:"secondary",children:t})]}),r&&me.jsx(Ko,{children:r})]}),AJ=()=>{const e=k6(),{apps:t}=Pi(),r=t[0];return me.jsxs("div",{children:[me.jsx(ns,{title:"Application Configuration",style:{marginBottom:"24px"},children:me.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"16px"},children:[me.jsxs("div",{children:[me.jsx("strong",{children:"Application Name:"}),me.jsx("p",{style:{margin:"12px 0 4px 0"},children:(r==null?void 0:r.name)||"Development App"})]}),me.jsxs("div",{children:[me.jsx("strong",{children:"Application Type:"}),me.jsx("p",{style:{margin:"12px 0 4px 0"},children:me.jsx(_Q,{color:(r==null?void 0:r.type)==="full_page"?"blue":"green",children:(r==null?void 0:r.type)==="full_page"?"fullpage":"plugin"})})]}),me.jsxs("div",{children:[me.jsx("strong",{children:"Development URL:"}),me.jsx("p",{style:{margin:"12px 0 4px 0",color:"#999",fontFamily:"monospace",fontSize:"13px"},children:(r==null?void 0:r.url)||"http://localhost:4001"})]}),me.jsxs("div",{children:[me.jsx("strong",{children:"Shell Theme:"}),me.jsx("p",{style:{margin:"12px 0 4px 0",color:"#999"},children:"omnitron"})]})]})}),me.jsx(ns,{title:"Quick Actions",style:{marginBottom:"24px"},children:me.jsxs("div",{style:{display:"flex",gap:"16px",flexWrap:"wrap"},children:[me.jsx(Q3,{type:"primary",onClick:()=>e(`/external/${r==null?void 0:r.slug}`),children:"Launch Application"}),(r==null?void 0:r.type)==="plugin"&&me.jsx(Q3,{onClick:()=>e("/plugin-test"),children:"Test Plugin Integration"})]})}),me.jsx(ns,{title:"Development Instructions",children:me.jsxs("div",{style:{lineHeight:"1.6"},children:[me.jsx("h4",{style:{margin:"0 0 8px 0"},children:"Getting Started:"}),me.jsxs("ol",{style:{paddingLeft:"20px"},children:[me.jsxs("li",{children:["Make sure your application is running at"," ",me.jsx("code",{children:(r==null?void 0:r.url)||"http://localhost:4001"})]}),me.jsx("li",{children:'Click "Launch Application" to load your app in the shell environment'}),(r==null?void 0:r.type)==="plugin"&&me.jsx("li",{children:'Use "Test Plugin Integration" to test your plugin in different placeholder configurations'}),me.jsx("li",{children:"The shell provides a realistic integration environment for testing"})]}),me.jsx(tK,{}),me.jsxs("h4",{style:{margin:"16px 0 8px 0"},children:["Application Type:"," ",(r==null?void 0:r.type)==="full_page"?"fullpage":"plugin"]}),(r==null?void 0:r.type)==="full_page"?me.jsx("p",{style:{margin:0,color:"#666"},children:"Your fullpage application will render as complete pages within the shell environment, providing full control over the content area and routing."}):me.jsx("p",{style:{margin:0,color:"#666"},children:"Your plugin application will render within designated placeholders in the host application, providing component-level integration capabilities."})]})})]})},LJ=()=>me.jsxs("div",{className:"page-dashboard",children:[me.jsx("div",{className:"page-heading-container",children:me.jsx(jJ,{title:"Welcome",description:"Development environment for testing and integrating your applications"})}),me.jsx("div",{className:"page-content-container",children:me.jsx(OM,{children:me.jsx(AJ,{})})})]}),Uv=({id:e,path:t})=>me.jsx("div",{className:"page-plugin-external",children:me.jsx(IJ,{id:e,path:t})}),FJ=()=>{const e=k6(),{apps:t,configs:r}=Pi(),n=i=>{let a=null;if(Array.from(r.entries()).forEach(([u,d])=>{if("placeholderId"in d&&d.placeholderId===i){a=u;return}}),a===null)return"";const{url:l,subSlug:s}=t.find(({id:u})=>u===a)||{};return l?`[ ${l}${s??""} ]`:""},o=[];return Array.from(r.entries()).forEach(([,i])=>{"placeholderId"in i&&o.push(i.placeholderId)}),me.jsxs("div",{className:"page-plugin-basic",children:[me.jsx(hG,{items:[{onClick:()=>e("/"),title:"Dashboard"},{title:"Plugin Test"}]}),me.jsx("div",{className:"page-heading-container",children:me.jsx(bK,{title:"Plugin Test"})}),me.jsx("div",{className:"page-content-container",children:me.jsx(OM,{children:o.length>0?me.jsx(gK,{gutter:[20,20],children:o.map((i,a)=>me.jsx(mK,{span:12,children:me.jsx("div",{className:"plugin-placeholder","data-title":`${i} ${n(i)}`,children:me.jsx(EJ,{placeholderId:i})})},i))}):me.jsxs("div",{style:{textAlign:"center",padding:"48px",border:"1px dashed #d9d9d9",borderRadius:"8px",backgroundColor:"#fafafa"},children:[me.jsx("h3",{children:"No Plugin Configurations Found"}),me.jsx("p",{children:"No plugin applications with placeholder configurations were found."}),me.jsx("p",{children:"Make sure your shell configuration includes plugin apps with placeholder IDs."})]})})})]})},DJ=()=>me.jsx(FJ,{}),HJ=()=>{const{apps:e,configs:t}=Pi(),r=e.filter(n=>n.type==="full_page");return me.jsxs(JY,{children:[r.map(n=>{var o,i;return me.jsxs(y0,{path:`/external/${n.slug}`,children:[me.jsx(y0,{index:!0,element:me.jsx(Uv,{id:n.id,path:n.path})}),(i=(o=t.get(n.id))==null?void 0:o.menu)==null?void 0:i.map(a=>a.path!=="/"&&me.jsx(y0,{path:`/external/${n.slug}${a.path}`,element:me.jsx(Uv,{id:n.id,path:n.subSlug?`${n.subSlug}${a.path}`:a.path})},a.path))]},n.id)}),me.jsx(y0,{path:"/plugin-test",element:me.jsx(DJ,{})}),me.jsx(y0,{path:"/",element:me.jsx(LJ,{})})]})},WJ=({config:e})=>me.jsx(rJ,{children:me.jsx(vq,{children:me.jsx(_J,{config:e,children:me.jsx(kJ,{children:me.jsx(HJ,{})})})})}),VJ=window.__SHELL_CONFIG__||{plugin:{url:"http://localhost:4001",path:"./src",name:"Development App",type:"fullpage"},shell:{port:4e3,theme:"omnitron",title:"Development Shell"},sidebar:{items:[]}};ps.createRoot(document.getElementById("root")).render(me.jsx(K.StrictMode,{children:me.jsx(WJ,{config:VJ})}));
|
package/dist/index.html
CHANGED
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
box-sizing: border-box;
|
|
25
25
|
}
|
|
26
26
|
</style>
|
|
27
|
-
<script type="module" crossorigin src="/assets/index-
|
|
27
|
+
<script type="module" crossorigin src="/assets/index-BGFvqk6X.js"></script>
|
|
28
28
|
<link rel="stylesheet" crossorigin href="/assets/index-BFs1gfY5.css">
|
|
29
29
|
</head>
|
|
30
30
|
<body>
|
package/package.json
CHANGED
package/vite.config.ts
CHANGED
|
@@ -30,7 +30,11 @@ export default defineConfig({
|
|
|
30
30
|
'rc-resize-observer',
|
|
31
31
|
'rc-resize-observer/es',
|
|
32
32
|
'rc-resize-observer/es/utils/observerUtil',
|
|
33
|
-
'react-input-mask'
|
|
33
|
+
'react-input-mask',
|
|
34
|
+
'hoist-non-react-statics',
|
|
35
|
+
'@emotion/react',
|
|
36
|
+
'@emotion/styled',
|
|
37
|
+
'antd-style'
|
|
34
38
|
],
|
|
35
39
|
force: true
|
|
36
40
|
},
|
|
@@ -46,7 +50,8 @@ export default defineConfig({
|
|
|
46
50
|
},
|
|
47
51
|
commonjsOptions: {
|
|
48
52
|
include: [/node_modules/],
|
|
49
|
-
transformMixedEsModules: true
|
|
53
|
+
transformMixedEsModules: true,
|
|
54
|
+
defaultIsModuleExports: 'auto'
|
|
50
55
|
},
|
|
51
56
|
// Ensure all assets are copied and referenced correctly
|
|
52
57
|
assetsInlineLimit: 0
|