@akinon/app-client 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,6 +3,8 @@ import React from 'react';
3
3
  interface AppClientContextState {
4
4
  data?: ApplicationData;
5
5
  isLoading: boolean;
6
+ invokeAction: <T = any>(actionKey: string, ...args: any[]) => Promise<T>;
7
+ navigate: (path: string) => void;
6
8
  }
7
9
  interface AppClientProviderProps {
8
10
  children: React.ReactNode;
@@ -1 +1 @@
1
- {"version":3,"file":"app-client-provider.d.ts","sourceRoot":"","sources":["../src/app-client-provider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,eAAe,EAAQ,MAAM,oBAAoB,CAAC;AAE5E,OAAO,KAAyD,MAAM,OAAO,CAAC;AAE9E,UAAU,qBAAqB;IAC7B,IAAI,CAAC,EAAE,eAAe,CAAC;IACvB,SAAS,EAAE,OAAO,CAAC;CACpB;AAMD,UAAU,sBAAsB;IAC9B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,MAAM,EAAE,eAAe,CAAC;CACzB;AAKD,QAAA,MAAM,YAAY,6BAAqC,CAAC;AAExD,QAAA,MAAM,iBAAiB,yBAA0B,sBAAsB,sBA+CtE,CAAC;AAEF,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAE,CAAC;AAC3C,YAAY,EAAE,eAAe,EAAE,CAAC"}
1
+ {"version":3,"file":"app-client-provider.d.ts","sourceRoot":"","sources":["../src/app-client-provider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAEtE,OAAO,KAAyD,MAAM,OAAO,CAAC;AAE9E,UAAU,qBAAqB;IAC7B,IAAI,CAAC,EAAE,eAAe,CAAC;IACvB,SAAS,EAAE,OAAO,CAAC;IACnB,YAAY,EAAE,CAAC,CAAC,GAAG,GAAG,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC;IACzE,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CAClC;AAeD,UAAU,sBAAsB;IAC9B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,MAAM,EAAE,eAAe,CAAC;CACzB;AAKD,QAAA,MAAM,YAAY,6BAAqC,CAAC;AAExD,QAAA,MAAM,iBAAiB,yBAA0B,sBAAsB,sBAyDtE,CAAC;AAEF,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAE,CAAC;AAC3C,YAAY,EAAE,eAAe,EAAE,CAAC"}
package/dist/index.cjs CHANGED
@@ -1,7 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const O=require("react/jsx-runtime"),u=require("react");/**
2
- postmate - A powerful, simple, promise-based postMessage library
3
- @version v1.5.2
4
- @link https://github.com/dollarshaveclub/postmate
5
- @author Jacob Kelley <jakie8@gmail.com>
6
- @license MIT
7
- **/var h="application/x-postmate-v1+json",w=5,C=0,_=function(){return++C},l=function(){var r;return p.debug?(r=console).log.apply(r,arguments):null},k=function(r){var t=document.createElement("a");t.href=r;var n=t.protocol.length>4?t.protocol:window.location.protocol,e=t.host.length?t.port==="80"||t.port==="443"?t.hostname:t.host:window.location.host;return t.origin||n+"//"+e},D={handshake:1,"handshake-reply":1,call:1,emit:1,reply:1,request:1},g=function(r,t){return!(typeof t=="string"&&r.origin!==t||!r.data||typeof r.data=="object"&&!("postmate"in r.data)||r.data.type!==h||!D[r.data.postmate])},V=function(r,t){var n=typeof r[t]=="function"?r[t]():r[t];return p.Promise.resolve(n)},A=function(){function s(t){var n=this;this.parent=t.parent,this.frame=t.frame,this.child=t.child,this.childOrigin=t.childOrigin,this.events={},process.env.NODE_ENV!=="production"&&(l("Parent: Registering API"),l("Parent: Awaiting messages...")),this.listener=function(e){if(!g(e,n.childOrigin))return!1;var o=((e||{}).data||{}).value||{},i=o.data,d=o.name;e.data.postmate==="emit"&&(process.env.NODE_ENV!=="production"&&l("Parent: Received event emission: "+d),d in n.events&&n.events[d].call(n,i))},this.parent.addEventListener("message",this.listener,!1),process.env.NODE_ENV!=="production"&&l("Parent: Awaiting event emissions from Child")}var r=s.prototype;return r.get=function(n){var e=this;return new p.Promise(function(o){var i=_(),d=function a(c){c.data.uid===i&&c.data.postmate==="reply"&&(e.parent.removeEventListener("message",a,!1),o(c.data.value))};e.parent.addEventListener("message",d,!1),e.child.postMessage({postmate:"request",type:h,property:n,uid:i},e.childOrigin)})},r.call=function(n,e){this.child.postMessage({postmate:"call",type:h,property:n,data:e},this.childOrigin)},r.on=function(n,e){this.events[n]=e},r.destroy=function(){process.env.NODE_ENV!=="production"&&l("Parent: Destroying Postmate instance"),window.removeEventListener("message",this.listener,!1),this.frame.parentNode.removeChild(this.frame)},s}(),L=function(){function s(t){var n=this;this.model=t.model,this.parent=t.parent,this.parentOrigin=t.parentOrigin,this.child=t.child,process.env.NODE_ENV!=="production"&&(l("Child: Registering API"),l("Child: Awaiting messages...")),this.child.addEventListener("message",function(e){if(g(e,n.parentOrigin)){process.env.NODE_ENV!=="production"&&l("Child: Received request",e.data);var o=e.data,i=o.property,d=o.uid,a=o.data;if(e.data.postmate==="call"){i in n.model&&typeof n.model[i]=="function"&&n.model[i](a);return}V(n.model,i).then(function(c){return e.source.postMessage({property:i,postmate:"reply",type:h,uid:d,value:c},e.origin)})}})}var r=s.prototype;return r.emit=function(n,e){process.env.NODE_ENV!=="production"&&l('Child: Emitting Event "'+n+'"',e),this.parent.postMessage({postmate:"emit",type:h,value:{name:n,data:e}},this.parentOrigin)},s}(),p=function(){function s(t){var n=t.container,e=n===void 0?typeof e<"u"?e:document.body:n,o=t.model,i=t.url,d=t.name,a=t.classListArray,c=a===void 0?[]:a;return this.parent=window,this.frame=document.createElement("iframe"),this.frame.name=d||"",this.frame.classList.add.apply(this.frame.classList,c),e.appendChild(this.frame),this.child=this.frame.contentWindow||this.frame.contentDocument.parentWindow,this.model=o||{},this.sendHandshake(i)}var r=s.prototype;return r.sendHandshake=function(n){var e=this,o=k(n),i=0,d;return new s.Promise(function(a,c){var f=function v(m){return g(m,o)?m.data.postmate==="handshake-reply"?(clearInterval(d),process.env.NODE_ENV!=="production"&&l("Parent: Received handshake reply from Child"),e.parent.removeEventListener("message",v,!1),e.childOrigin=m.origin,process.env.NODE_ENV!=="production"&&l("Parent: Saving Child origin",e.childOrigin),a(new A(e))):(process.env.NODE_ENV!=="production"&&l("Parent: Invalid handshake reply"),c("Failed handshake")):!1};e.parent.addEventListener("message",f,!1);var E=function(){i++,process.env.NODE_ENV!=="production"&&l("Parent: Sending handshake attempt "+i,{childOrigin:o}),e.child.postMessage({postmate:"handshake",type:h,model:e.model},o),i===w&&clearInterval(d)},y=function(){E(),d=setInterval(E,500)};e.frame.attachEvent?e.frame.attachEvent("onload",y):e.frame.onload=y,process.env.NODE_ENV!=="production"&&l("Parent: Loading frame",{url:n}),e.frame.src=n})},s}();p.debug=!1;p.Promise=function(){try{return window?window.Promise:Promise}catch{return null}}();p.Model=function(){function s(t){return this.child=window,this.model=t,this.parent=this.child.parent,this.sendHandshakeReply()}var r=s.prototype;return r.sendHandshakeReply=function(){var n=this;return new p.Promise(function(e,o){var i=function d(a){if(a.data.postmate){if(a.data.postmate==="handshake"){process.env.NODE_ENV!=="production"&&l("Child: Received handshake from Parent"),n.child.removeEventListener("message",d,!1),process.env.NODE_ENV!=="production"&&l("Child: Sending handshake reply to Parent"),a.source.postMessage({postmate:"handshake-reply",type:h},a.origin),n.parentOrigin=a.origin;var c=a.data.model;return c&&(Object.keys(c).forEach(function(f){n.model[f]=c[f]}),process.env.NODE_ENV!=="production"&&l("Child: Inherited and extended model from Parent")),process.env.NODE_ENV!=="production"&&l("Child: Saving Parent origin",n.parentOrigin),e(new L(n))}return o("Handshake Reply Failed")}};n.child.addEventListener("message",i,!1)})},s}();const P={isLoading:!0},N=u.createContext(P),I=()=>u.useContext(N),R=({children:s,config:r})=>{const[t,n]=u.useState({}),[e,o]=u.useState(P);u.useEffect(()=>{if(r.forceRedirect&&!r.isDev&&window.self===window.top){console.error("This app must be run inside an iframe when forceRedirect is true.");return}const d=new p.Model({setData:a=>{console.log("AppClientProvider: setData",a),n(a)}});d.then(a=>{console.log("AppClientProvider: handshake success",a),a.emit("init",r)}),d.catch(a=>{console.error("AppClientProvider: handshake error",a)}),o({isLoading:!1})},[r]);const i={...e,data:t};return console.log("client context value",i),O.jsx(N.Provider,{value:i,children:s})};exports.AppClientProvider=R;exports.useAppClient=I;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const z=require("react/jsx-runtime"),M=require("react");var p=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function H(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var T={},h={},S;function K(){if(S)return h;S=1,Object.defineProperty(h,"__esModule",{value:!0}),h.detach=h.attach=void 0;var r=d(),o=!1;function n(){o||typeof window>"u"||(o=!0,window.addEventListener("message",r.onMessage,!1))}h.attach=n;function t(){o=!1,window.removeEventListener("message",r.onMessage,!1)}return h.detach=t,h}var v={},q;function Q(){if(q)return v;q=1,Object.defineProperty(v,"__esModule",{value:!0}),v.broadcastToChildWindows=void 0;var r=d();function o(n,t,e){for(var i=r.childWindows.length-1;i>=0;i--){var s=r.childWindows[i];s.closed?r.childWindows.splice(i,1):e!==s&&(0,r.broadcast)(n,{origin:t,frame:s.top})}}return v.broadcastToChildWindows=o,v}var b={},C;function X(){if(C)return b;C=1,Object.defineProperty(b,"__esModule",{value:!0}),b.broadcast=void 0;var r=d();function o(n,t){var e=0,i,s=t.origin,a=t.frame;try{for(a.postMessage(n,s),(0,r.hasOpener)(a)&&a.opener.top!==window.top&&o(n,{origin:s,frame:a.opener.top});i=a.frames[e];)o(n,{origin:s,frame:i}),e++}catch{}}return b.broadcast=o,b}var l={};Object.defineProperty(l,"__esModule",{value:!0});l.subscribers=l.childWindows=l.prefix=void 0;l.prefix="/*framebus*/";l.childWindows=[];l.subscribers={};var g={},R;function Y(){if(R)return g;R=1,Object.defineProperty(g,"__esModule",{value:!0}),g.dispatch=void 0;var r=d();function o(n,t,e,i,s){if(r.subscribers[n]&&r.subscribers[n][t]){var a=[];e&&a.push(e),i&&a.push(i);for(var u=0;u<r.subscribers[n][t].length;u++)r.subscribers[n][t][u].apply(s,a)}}return g.dispatch=o,g}var O={};Object.defineProperty(O,"__esModule",{value:!0});O.hasOpener=void 0;function Z(r){return!(r.top!==r||r.opener==null||r.opener===r||r.opener.closed===!0)}O.hasOpener=Z;var F={};Object.defineProperty(F,"__esModule",{value:!0});F.isntString=void 0;function N(r){return typeof r!="string"}F.isntString=N;var y={},E;function ee(){if(E)return y;E=1,Object.defineProperty(y,"__esModule",{value:!0}),y.onMessage=void 0;var r=d();function o(n){if(!(0,r.isntString)(n.data)){var t=(0,r.unpackPayload)(n);if(t){var e=t.eventData,i=t.reply;(0,r.dispatch)("*",t.event,e,i,n),(0,r.dispatch)(n.origin,t.event,e,i,n),(0,r.broadcastToChildWindows)(n.data,t.origin,n.source)}}}return y.onMessage=o,y}var m={},k;function re(){if(k)return m;k=1,Object.defineProperty(m,"__esModule",{value:!0}),m.packagePayload=void 0;var r=d();function o(n,t,e,i){var s,a={event:n,origin:t};typeof i=="function"&&(a.reply=(0,r.subscribeReplier)(i,t)),a.eventData=e;try{s=r.prefix+JSON.stringify(a)}catch(u){throw new Error("Could not stringify event: ".concat(u.message))}return s}return m.packagePayload=o,m}var x={};Object.defineProperty(x,"__esModule",{value:!0});x.sendMessage=void 0;function te(r,o,n){try{r.postMessage(o,n)}catch{}}x.sendMessage=te;var _={},w={},B;function V(){if(B)return w;B=1,Object.defineProperty(w,"__esModule",{value:!0}),w.Framebus=void 0;var r=d(),o=typeof window<"u"&&window.Promise,n=function(){function t(e){e===void 0&&(e={}),this.origin=e.origin||"*",this.channel=e.channel||"",this.verifyDomain=e.verifyDomain,this.targetFrames=e.targetFrames||[],this.limitBroadcastToFramesArray=!!e.targetFrames,this.isDestroyed=!1,this.listeners=[],this.hasAdditionalChecksForOnListeners=!!(this.verifyDomain||this.limitBroadcastToFramesArray)}return t.setPromise=function(e){t.Promise=e},t.target=function(e){return new t(e)},t.prototype.addTargetFrame=function(e){this.limitBroadcastToFramesArray&&this.targetFrames.push(e)},t.prototype.include=function(e){return e==null||e.Window==null||e.constructor!==e.Window?!1:(r.childWindows.push(e),!0)},t.prototype.target=function(e){return t.target(e)},t.prototype.emit=function(e,i,s){if(this.isDestroyed)return!1;var a=this.origin;if(e=this.namespaceEvent(e),(0,r.isntString)(e)||(0,r.isntString)(a))return!1;typeof i=="function"&&(s=i,i=void 0);var u=(0,r.packagePayload)(e,a,i,s);return u?(this.limitBroadcastToFramesArray?this.targetFramesAsWindows().forEach(function(c){(0,r.sendMessage)(c,u,a)}):(0,r.broadcast)(u,{origin:a,frame:window.top||window.self}),!0):!1},t.prototype.emitAsPromise=function(e,i){var s=this;return new t.Promise(function(a,u){var c=s.emit(e,i,function(f){a(f)});c||u(new Error('Listener not added for "'.concat(e,'"')))})},t.prototype.on=function(e,i){if(this.isDestroyed)return!1;var s=this,a=this.origin,u=i;return e=this.namespaceEvent(e),(0,r.subscriptionArgsInvalid)(e,u,a)?!1:(this.hasAdditionalChecksForOnListeners&&(u=function(){for(var c=[],f=0;f<arguments.length;f++)c[f]=arguments[f];s.passesVerifyDomainCheck(this&&this.origin)&&s.hasMatchingTargetFrame(this&&this.source)&&i.apply(void 0,c)}),this.listeners.push({eventName:e,handler:u,originalHandler:i}),r.subscribers[a]=r.subscribers[a]||{},r.subscribers[a][e]=r.subscribers[a][e]||[],r.subscribers[a][e].push(u),!0)},t.prototype.off=function(e,i){var s=i;if(this.isDestroyed)return!1;if(this.verifyDomain)for(var a=0;a<this.listeners.length;a++){var u=this.listeners[a];u.originalHandler===i&&(s=u.handler)}e=this.namespaceEvent(e);var c=this.origin;if((0,r.subscriptionArgsInvalid)(e,s,c))return!1;var f=r.subscribers[c]&&r.subscribers[c][e];if(!f)return!1;for(var a=0;a<f.length;a++)if(f[a]===s)return f.splice(a,1),!0;return!1},t.prototype.teardown=function(){if(!this.isDestroyed){this.isDestroyed=!0;for(var e=0;e<this.listeners.length;e++){var i=this.listeners[e];this.off(i.eventName,i.handler)}this.listeners.length=0}},t.prototype.passesVerifyDomainCheck=function(e){return this.verifyDomain?this.checkOrigin(e):!0},t.prototype.targetFramesAsWindows=function(){return this.limitBroadcastToFramesArray?this.targetFrames.map(function(e){return e instanceof HTMLIFrameElement?e.contentWindow:e}).filter(function(e){return e}):[]},t.prototype.hasMatchingTargetFrame=function(e){if(!this.limitBroadcastToFramesArray)return!0;var i=this.targetFramesAsWindows().find(function(s){return s===e});return!!i},t.prototype.checkOrigin=function(e){var i,s=document.createElement("a");s.href=location.href,s.protocol==="https:"?i=s.host.replace(/:443$/,""):s.protocol==="http:"?i=s.host.replace(/:80$/,""):i=s.host;var a=s.protocol+"//"+i;return a===e?!0:this.verifyDomain?this.verifyDomain(e):!0},t.prototype.namespaceEvent=function(e){return this.channel?"".concat(this.channel,":").concat(e):e},t.Promise=o,t}();return w.Framebus=n,w}function ie(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(r){var o=Math.random()*16|0,n=r==="x"?o:o&3|8;return n.toString(16)})}var ne=ie,I;function ae(){if(I)return _;I=1;var r=p&&p.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(_,"__esModule",{value:!0}),_.subscribeReplier=void 0;var o=V(),n=r(ne);function t(e,i){var s=(0,n.default)();function a(u,c){e(u,c),o.Framebus.target({origin:i}).off(s,a)}return o.Framebus.target({origin:i}).on(s,a),s}return _.subscribeReplier=t,_}var P={},L;function se(){if(L)return P;L=1,Object.defineProperty(P,"__esModule",{value:!0}),P.subscriptionArgsInvalid=void 0;var r=d();function o(n,t,e){return(0,r.isntString)(n)||typeof t!="function"?!0:(0,r.isntString)(e)}return P.subscriptionArgsInvalid=o,P}var U={};Object.defineProperty(U,"__esModule",{value:!0});var A={},W;function oe(){if(W)return A;W=1,Object.defineProperty(A,"__esModule",{value:!0}),A.unpackPayload=void 0;var r=d();function o(n){var t;if(n.data.slice(0,r.prefix.length)!==r.prefix)return!1;try{t=JSON.parse(n.data.slice(r.prefix.length))}catch{return!1}if(t.reply){var e=n.origin,i=n.source,s=t.reply;t.reply=function(u){if(i){var c=(0,r.packagePayload)(s,e,u);c&&i.postMessage(c,e)}}}return t}return A.unpackPayload=o,A}var $;function d(){return $||($=1,function(r){var o=p&&p.__createBinding||(Object.create?function(t,e,i,s){s===void 0&&(s=i);var a=Object.getOwnPropertyDescriptor(e,i);(!a||("get"in a?!e.__esModule:a.writable||a.configurable))&&(a={enumerable:!0,get:function(){return e[i]}}),Object.defineProperty(t,s,a)}:function(t,e,i,s){s===void 0&&(s=i),t[s]=e[i]}),n=p&&p.__exportStar||function(t,e){for(var i in t)i!=="default"&&!Object.prototype.hasOwnProperty.call(e,i)&&o(e,t,i)};Object.defineProperty(r,"__esModule",{value:!0}),n(K(),r),n(Q(),r),n(X(),r),n(l,r),n(Y(),r),n(O,r),n(F,r),n(ee(),r),n(re(),r),n(x,r),n(ae(),r),n(se(),r),n(U,r),n(oe(),r)}(T)),T}var ue=d(),ce=V();(0,ue.attach)();var fe=ce.Framebus;const j=H(fe),de={isLoading:!0,invokeAction:async()=>Promise.reject("Action functionality not initialized."),navigate:()=>{}},le=r=>{new j().emit("NAVIGATE",{path:r})},G=M.createContext(de),he=()=>M.useContext(G),pe=({children:r,config:o})=>{const[n,t]=M.useState(void 0),[e,i]=M.useState(!0),s=(u,...c)=>new Promise((f,J)=>{new j().emit("INVOKE_ACTION",{actionKey:u,args:c},D=>{D.success?f(D.result):J(new Error(D.error))})});M.useEffect(()=>{if(o.forceRedirect&&!o.isDev&&window.self===window.top){console.error("This app must be run inside an iframe when forceRedirect is true.");return}const u=new j;return u.on("DATA_RESPONSE",c=>{t(c),i(!1)}),u.emit("REQUEST_DATA"),()=>{u.teardown()}},[o]);const a={data:n,isLoading:e,invokeAction:s,navigate:le};return z.jsx(G.Provider,{value:a,children:r})};exports.AppClientProvider=pe;exports.useAppClient=he;
package/dist/index.js CHANGED
@@ -1,206 +1,386 @@
1
- import { jsx as O } from "react/jsx-runtime";
2
- import { createContext as w, useContext as C, useState as y, useEffect as _ } from "react";
3
- /**
4
- postmate - A powerful, simple, promise-based postMessage library
5
- @version v1.5.2
6
- @link https://github.com/dollarshaveclub/postmate
7
- @author Jacob Kelley <jakie8@gmail.com>
8
- @license MIT
9
- **/
10
- var h = "application/x-postmate-v1+json", k = 5, D = 0, V = function() {
11
- return ++D;
12
- }, l = function() {
13
- var r;
14
- return p.debug ? (r = console).log.apply(r, arguments) : null;
15
- }, A = function(r) {
16
- var t = document.createElement("a");
17
- t.href = r;
18
- var n = t.protocol.length > 4 ? t.protocol : window.location.protocol, e = t.host.length ? t.port === "80" || t.port === "443" ? t.hostname : t.host : window.location.host;
19
- return t.origin || n + "//" + e;
20
- }, L = {
21
- handshake: 1,
22
- "handshake-reply": 1,
23
- call: 1,
24
- emit: 1,
25
- reply: 1,
26
- request: 1
27
- /**
28
- * Ensures that a message is safe to interpret
29
- * @param {Object} message The postmate message being sent
30
- * @param {String|Boolean} allowedOrigin The whitelisted origin or false to skip origin check
31
- * @return {Boolean}
32
- */
33
- }, m = function(r, t) {
34
- return !(typeof t == "string" && r.origin !== t || !r.data || typeof r.data == "object" && !("postmate" in r.data) || r.data.type !== h || !L[r.data.postmate]);
35
- }, I = function(r, t) {
36
- var n = typeof r[t] == "function" ? r[t]() : r[t];
37
- return p.Promise.resolve(n);
38
- }, x = /* @__PURE__ */ function() {
39
- function s(t) {
40
- var n = this;
41
- this.parent = t.parent, this.frame = t.frame, this.child = t.child, this.childOrigin = t.childOrigin, this.events = {}, process.env.NODE_ENV !== "production" && (l("Parent: Registering API"), l("Parent: Awaiting messages...")), this.listener = function(e) {
42
- if (!m(e, n.childOrigin))
43
- return !1;
44
- var o = ((e || {}).data || {}).value || {}, i = o.data, d = o.name;
45
- e.data.postmate === "emit" && (process.env.NODE_ENV !== "production" && l("Parent: Received event emission: " + d), d in n.events && n.events[d].call(n, i));
46
- }, this.parent.addEventListener("message", this.listener, !1), process.env.NODE_ENV !== "production" && l("Parent: Awaiting event emissions from Child");
1
+ import { jsx as z } from "react/jsx-runtime";
2
+ import { createContext as H, useContext as K, useState as j, useEffect as Q } from "react";
3
+ var p = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
4
+ function X(r) {
5
+ return r && r.__esModule && Object.prototype.hasOwnProperty.call(r, "default") ? r.default : r;
6
+ }
7
+ var D = {}, h = {}, q;
8
+ function Y() {
9
+ if (q)
10
+ return h;
11
+ q = 1, Object.defineProperty(h, "__esModule", { value: !0 }), h.detach = h.attach = void 0;
12
+ var r = d(), o = !1;
13
+ function n() {
14
+ o || typeof window > "u" || (o = !0, window.addEventListener("message", r.onMessage, !1));
47
15
  }
48
- var r = s.prototype;
49
- return r.get = function(n) {
50
- var e = this;
51
- return new p.Promise(function(o) {
52
- var i = V(), d = function a(c) {
53
- c.data.uid === i && c.data.postmate === "reply" && (e.parent.removeEventListener("message", a, !1), o(c.data.value));
54
- };
55
- e.parent.addEventListener("message", d, !1), e.child.postMessage({
56
- postmate: "request",
57
- type: h,
58
- property: n,
59
- uid: i
60
- }, e.childOrigin);
61
- });
62
- }, r.call = function(n, e) {
63
- this.child.postMessage({
64
- postmate: "call",
65
- type: h,
66
- property: n,
67
- data: e
68
- }, this.childOrigin);
69
- }, r.on = function(n, e) {
70
- this.events[n] = e;
71
- }, r.destroy = function() {
72
- process.env.NODE_ENV !== "production" && l("Parent: Destroying Postmate instance"), window.removeEventListener("message", this.listener, !1), this.frame.parentNode.removeChild(this.frame);
73
- }, s;
74
- }(), R = /* @__PURE__ */ function() {
75
- function s(t) {
76
- var n = this;
77
- this.model = t.model, this.parent = t.parent, this.parentOrigin = t.parentOrigin, this.child = t.child, process.env.NODE_ENV !== "production" && (l("Child: Registering API"), l("Child: Awaiting messages...")), this.child.addEventListener("message", function(e) {
78
- if (m(e, n.parentOrigin)) {
79
- process.env.NODE_ENV !== "production" && l("Child: Received request", e.data);
80
- var o = e.data, i = o.property, d = o.uid, a = o.data;
81
- if (e.data.postmate === "call") {
82
- i in n.model && typeof n.model[i] == "function" && n.model[i](a);
83
- return;
84
- }
85
- I(n.model, i).then(function(c) {
86
- return e.source.postMessage({
87
- property: i,
88
- postmate: "reply",
89
- type: h,
90
- uid: d,
91
- value: c
92
- }, e.origin);
93
- });
94
- }
95
- });
16
+ h.attach = n;
17
+ function t() {
18
+ o = !1, window.removeEventListener("message", r.onMessage, !1);
96
19
  }
97
- var r = s.prototype;
98
- return r.emit = function(n, e) {
99
- process.env.NODE_ENV !== "production" && l('Child: Emitting Event "' + n + '"', e), this.parent.postMessage({
100
- postmate: "emit",
101
- type: h,
102
- value: {
103
- name: n,
104
- data: e
20
+ return h.detach = t, h;
21
+ }
22
+ var v = {}, R;
23
+ function Z() {
24
+ if (R)
25
+ return v;
26
+ R = 1, Object.defineProperty(v, "__esModule", { value: !0 }), v.broadcastToChildWindows = void 0;
27
+ var r = d();
28
+ function o(n, t, e) {
29
+ for (var i = r.childWindows.length - 1; i >= 0; i--) {
30
+ var s = r.childWindows[i];
31
+ s.closed ? r.childWindows.splice(i, 1) : e !== s && (0, r.broadcast)(n, {
32
+ origin: t,
33
+ frame: s.top
34
+ });
35
+ }
36
+ }
37
+ return v.broadcastToChildWindows = o, v;
38
+ }
39
+ var b = {}, S;
40
+ function N() {
41
+ if (S)
42
+ return b;
43
+ S = 1, Object.defineProperty(b, "__esModule", { value: !0 }), b.broadcast = void 0;
44
+ var r = d();
45
+ function o(n, t) {
46
+ var e = 0, i, s = t.origin, a = t.frame;
47
+ try {
48
+ for (a.postMessage(n, s), (0, r.hasOpener)(a) && a.opener.top !== window.top && o(n, {
49
+ origin: s,
50
+ frame: a.opener.top
51
+ }); i = a.frames[e]; )
52
+ o(n, {
53
+ origin: s,
54
+ frame: i
55
+ }), e++;
56
+ } catch {
57
+ }
58
+ }
59
+ return b.broadcast = o, b;
60
+ }
61
+ var l = {};
62
+ Object.defineProperty(l, "__esModule", { value: !0 });
63
+ l.subscribers = l.childWindows = l.prefix = void 0;
64
+ l.prefix = "/*framebus*/";
65
+ l.childWindows = [];
66
+ l.subscribers = {};
67
+ var g = {}, C;
68
+ function ee() {
69
+ if (C)
70
+ return g;
71
+ C = 1, Object.defineProperty(g, "__esModule", { value: !0 }), g.dispatch = void 0;
72
+ var r = d();
73
+ function o(n, t, e, i, s) {
74
+ if (r.subscribers[n] && r.subscribers[n][t]) {
75
+ var a = [];
76
+ e && a.push(e), i && a.push(i);
77
+ for (var u = 0; u < r.subscribers[n][t].length; u++)
78
+ r.subscribers[n][t][u].apply(s, a);
79
+ }
80
+ }
81
+ return g.dispatch = o, g;
82
+ }
83
+ var M = {};
84
+ Object.defineProperty(M, "__esModule", { value: !0 });
85
+ M.hasOpener = void 0;
86
+ function re(r) {
87
+ return !(r.top !== r || r.opener == null || r.opener === r || r.opener.closed === !0);
88
+ }
89
+ M.hasOpener = re;
90
+ var O = {};
91
+ Object.defineProperty(O, "__esModule", { value: !0 });
92
+ O.isntString = void 0;
93
+ function te(r) {
94
+ return typeof r != "string";
95
+ }
96
+ O.isntString = te;
97
+ var y = {}, E;
98
+ function ie() {
99
+ if (E)
100
+ return y;
101
+ E = 1, Object.defineProperty(y, "__esModule", { value: !0 }), y.onMessage = void 0;
102
+ var r = d();
103
+ function o(n) {
104
+ if (!(0, r.isntString)(n.data)) {
105
+ var t = (0, r.unpackPayload)(n);
106
+ if (t) {
107
+ var e = t.eventData, i = t.reply;
108
+ (0, r.dispatch)("*", t.event, e, i, n), (0, r.dispatch)(n.origin, t.event, e, i, n), (0, r.broadcastToChildWindows)(n.data, t.origin, n.source);
105
109
  }
106
- }, this.parentOrigin);
107
- }, s;
108
- }(), p = /* @__PURE__ */ function() {
109
- function s(t) {
110
- var n = t.container, e = n === void 0 ? typeof e < "u" ? e : document.body : n, o = t.model, i = t.url, d = t.name, a = t.classListArray, c = a === void 0 ? [] : a;
111
- return this.parent = window, this.frame = document.createElement("iframe"), this.frame.name = d || "", this.frame.classList.add.apply(this.frame.classList, c), e.appendChild(this.frame), this.child = this.frame.contentWindow || this.frame.contentDocument.parentWindow, this.model = o || {}, this.sendHandshake(i);
110
+ }
112
111
  }
113
- var r = s.prototype;
114
- return r.sendHandshake = function(n) {
115
- var e = this, o = A(n), i = 0, d;
116
- return new s.Promise(function(a, c) {
117
- var u = function f(v) {
118
- return m(v, o) ? v.data.postmate === "handshake-reply" ? (clearInterval(d), process.env.NODE_ENV !== "production" && l("Parent: Received handshake reply from Child"), e.parent.removeEventListener("message", f, !1), e.childOrigin = v.origin, process.env.NODE_ENV !== "production" && l("Parent: Saving Child origin", e.childOrigin), a(new x(e))) : (process.env.NODE_ENV !== "production" && l("Parent: Invalid handshake reply"), c("Failed handshake")) : !1;
119
- };
120
- e.parent.addEventListener("message", u, !1);
121
- var g = function() {
122
- i++, process.env.NODE_ENV !== "production" && l("Parent: Sending handshake attempt " + i, {
123
- childOrigin: o
124
- }), e.child.postMessage({
125
- postmate: "handshake",
126
- type: h,
127
- model: e.model
128
- }, o), i === k && clearInterval(d);
129
- }, E = function() {
130
- g(), d = setInterval(g, 500);
131
- };
132
- e.frame.attachEvent ? e.frame.attachEvent("onload", E) : e.frame.onload = E, process.env.NODE_ENV !== "production" && l("Parent: Loading frame", {
133
- url: n
134
- }), e.frame.src = n;
135
- });
136
- }, s;
137
- }();
138
- p.debug = !1;
139
- p.Promise = function() {
112
+ return y.onMessage = o, y;
113
+ }
114
+ var m = {}, k;
115
+ function ne() {
116
+ if (k)
117
+ return m;
118
+ k = 1, Object.defineProperty(m, "__esModule", { value: !0 }), m.packagePayload = void 0;
119
+ var r = d();
120
+ function o(n, t, e, i) {
121
+ var s, a = {
122
+ event: n,
123
+ origin: t
124
+ };
125
+ typeof i == "function" && (a.reply = (0, r.subscribeReplier)(i, t)), a.eventData = e;
126
+ try {
127
+ s = r.prefix + JSON.stringify(a);
128
+ } catch (u) {
129
+ throw new Error("Could not stringify event: ".concat(u.message));
130
+ }
131
+ return s;
132
+ }
133
+ return m.packagePayload = o, m;
134
+ }
135
+ var F = {};
136
+ Object.defineProperty(F, "__esModule", { value: !0 });
137
+ F.sendMessage = void 0;
138
+ function ae(r, o, n) {
140
139
  try {
141
- return window ? window.Promise : Promise;
140
+ r.postMessage(o, n);
142
141
  } catch {
143
- return null;
144
142
  }
145
- }();
146
- p.Model = /* @__PURE__ */ function() {
147
- function s(t) {
148
- return this.child = window, this.model = t, this.parent = this.child.parent, this.sendHandshakeReply();
149
- }
150
- var r = s.prototype;
151
- return r.sendHandshakeReply = function() {
152
- var n = this;
153
- return new p.Promise(function(e, o) {
154
- var i = function d(a) {
155
- if (a.data.postmate) {
156
- if (a.data.postmate === "handshake") {
157
- process.env.NODE_ENV !== "production" && l("Child: Received handshake from Parent"), n.child.removeEventListener("message", d, !1), process.env.NODE_ENV !== "production" && l("Child: Sending handshake reply to Parent"), a.source.postMessage({
158
- postmate: "handshake-reply",
159
- type: h
160
- }, a.origin), n.parentOrigin = a.origin;
161
- var c = a.data.model;
162
- return c && (Object.keys(c).forEach(function(u) {
163
- n.model[u] = c[u];
164
- }), process.env.NODE_ENV !== "production" && l("Child: Inherited and extended model from Parent")), process.env.NODE_ENV !== "production" && l("Child: Saving Parent origin", n.parentOrigin), e(new R(n));
143
+ }
144
+ F.sendMessage = ae;
145
+ var _ = {}, w = {}, B;
146
+ function V() {
147
+ if (B)
148
+ return w;
149
+ B = 1, Object.defineProperty(w, "__esModule", { value: !0 }), w.Framebus = void 0;
150
+ var r = d(), o = typeof window < "u" && window.Promise, n = (
151
+ /** @class */
152
+ function() {
153
+ function t(e) {
154
+ e === void 0 && (e = {}), this.origin = e.origin || "*", this.channel = e.channel || "", this.verifyDomain = e.verifyDomain, this.targetFrames = e.targetFrames || [], this.limitBroadcastToFramesArray = !!e.targetFrames, this.isDestroyed = !1, this.listeners = [], this.hasAdditionalChecksForOnListeners = !!(this.verifyDomain || this.limitBroadcastToFramesArray);
155
+ }
156
+ return t.setPromise = function(e) {
157
+ t.Promise = e;
158
+ }, t.target = function(e) {
159
+ return new t(e);
160
+ }, t.prototype.addTargetFrame = function(e) {
161
+ this.limitBroadcastToFramesArray && this.targetFrames.push(e);
162
+ }, t.prototype.include = function(e) {
163
+ return e == null || e.Window == null || e.constructor !== e.Window ? !1 : (r.childWindows.push(e), !0);
164
+ }, t.prototype.target = function(e) {
165
+ return t.target(e);
166
+ }, t.prototype.emit = function(e, i, s) {
167
+ if (this.isDestroyed)
168
+ return !1;
169
+ var a = this.origin;
170
+ if (e = this.namespaceEvent(e), (0, r.isntString)(e) || (0, r.isntString)(a))
171
+ return !1;
172
+ typeof i == "function" && (s = i, i = void 0);
173
+ var u = (0, r.packagePayload)(e, a, i, s);
174
+ return u ? (this.limitBroadcastToFramesArray ? this.targetFramesAsWindows().forEach(function(c) {
175
+ (0, r.sendMessage)(c, u, a);
176
+ }) : (0, r.broadcast)(u, {
177
+ origin: a,
178
+ frame: window.top || window.self
179
+ }), !0) : !1;
180
+ }, t.prototype.emitAsPromise = function(e, i) {
181
+ var s = this;
182
+ return new t.Promise(function(a, u) {
183
+ var c = s.emit(e, i, function(f) {
184
+ a(f);
185
+ });
186
+ c || u(new Error('Listener not added for "'.concat(e, '"')));
187
+ });
188
+ }, t.prototype.on = function(e, i) {
189
+ if (this.isDestroyed)
190
+ return !1;
191
+ var s = this, a = this.origin, u = i;
192
+ return e = this.namespaceEvent(e), (0, r.subscriptionArgsInvalid)(e, u, a) ? !1 : (this.hasAdditionalChecksForOnListeners && (u = function() {
193
+ for (var c = [], f = 0; f < arguments.length; f++)
194
+ c[f] = arguments[f];
195
+ s.passesVerifyDomainCheck(this && this.origin) && s.hasMatchingTargetFrame(this && this.source) && i.apply(void 0, c);
196
+ }), this.listeners.push({
197
+ eventName: e,
198
+ handler: u,
199
+ originalHandler: i
200
+ }), r.subscribers[a] = r.subscribers[a] || {}, r.subscribers[a][e] = r.subscribers[a][e] || [], r.subscribers[a][e].push(u), !0);
201
+ }, t.prototype.off = function(e, i) {
202
+ var s = i;
203
+ if (this.isDestroyed)
204
+ return !1;
205
+ if (this.verifyDomain)
206
+ for (var a = 0; a < this.listeners.length; a++) {
207
+ var u = this.listeners[a];
208
+ u.originalHandler === i && (s = u.handler);
209
+ }
210
+ e = this.namespaceEvent(e);
211
+ var c = this.origin;
212
+ if ((0, r.subscriptionArgsInvalid)(e, s, c))
213
+ return !1;
214
+ var f = r.subscribers[c] && r.subscribers[c][e];
215
+ if (!f)
216
+ return !1;
217
+ for (var a = 0; a < f.length; a++)
218
+ if (f[a] === s)
219
+ return f.splice(a, 1), !0;
220
+ return !1;
221
+ }, t.prototype.teardown = function() {
222
+ if (!this.isDestroyed) {
223
+ this.isDestroyed = !0;
224
+ for (var e = 0; e < this.listeners.length; e++) {
225
+ var i = this.listeners[e];
226
+ this.off(i.eventName, i.handler);
165
227
  }
166
- return o("Handshake Reply Failed");
228
+ this.listeners.length = 0;
229
+ }
230
+ }, t.prototype.passesVerifyDomainCheck = function(e) {
231
+ return this.verifyDomain ? this.checkOrigin(e) : !0;
232
+ }, t.prototype.targetFramesAsWindows = function() {
233
+ return this.limitBroadcastToFramesArray ? this.targetFrames.map(function(e) {
234
+ return e instanceof HTMLIFrameElement ? e.contentWindow : e;
235
+ }).filter(function(e) {
236
+ return e;
237
+ }) : [];
238
+ }, t.prototype.hasMatchingTargetFrame = function(e) {
239
+ if (!this.limitBroadcastToFramesArray)
240
+ return !0;
241
+ var i = this.targetFramesAsWindows().find(function(s) {
242
+ return s === e;
243
+ });
244
+ return !!i;
245
+ }, t.prototype.checkOrigin = function(e) {
246
+ var i, s = document.createElement("a");
247
+ s.href = location.href, s.protocol === "https:" ? i = s.host.replace(/:443$/, "") : s.protocol === "http:" ? i = s.host.replace(/:80$/, "") : i = s.host;
248
+ var a = s.protocol + "//" + i;
249
+ return a === e ? !0 : this.verifyDomain ? this.verifyDomain(e) : !0;
250
+ }, t.prototype.namespaceEvent = function(e) {
251
+ return this.channel ? "".concat(this.channel, ":").concat(e) : e;
252
+ }, t.Promise = o, t;
253
+ }()
254
+ );
255
+ return w.Framebus = n, w;
256
+ }
257
+ function se() {
258
+ return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(r) {
259
+ var o = Math.random() * 16 | 0, n = r === "x" ? o : o & 3 | 8;
260
+ return n.toString(16);
261
+ });
262
+ }
263
+ var oe = se, I;
264
+ function ue() {
265
+ if (I)
266
+ return _;
267
+ I = 1;
268
+ var r = p && p.__importDefault || function(e) {
269
+ return e && e.__esModule ? e : { default: e };
270
+ };
271
+ Object.defineProperty(_, "__esModule", { value: !0 }), _.subscribeReplier = void 0;
272
+ var o = V(), n = r(oe);
273
+ function t(e, i) {
274
+ var s = (0, n.default)();
275
+ function a(u, c) {
276
+ e(u, c), o.Framebus.target({
277
+ origin: i
278
+ }).off(s, a);
279
+ }
280
+ return o.Framebus.target({
281
+ origin: i
282
+ }).on(s, a), s;
283
+ }
284
+ return _.subscribeReplier = t, _;
285
+ }
286
+ var P = {}, L;
287
+ function ce() {
288
+ if (L)
289
+ return P;
290
+ L = 1, Object.defineProperty(P, "__esModule", { value: !0 }), P.subscriptionArgsInvalid = void 0;
291
+ var r = d();
292
+ function o(n, t, e) {
293
+ return (0, r.isntString)(n) || typeof t != "function" ? !0 : (0, r.isntString)(e);
294
+ }
295
+ return P.subscriptionArgsInvalid = o, P;
296
+ }
297
+ var U = {};
298
+ Object.defineProperty(U, "__esModule", { value: !0 });
299
+ var A = {}, W;
300
+ function fe() {
301
+ if (W)
302
+ return A;
303
+ W = 1, Object.defineProperty(A, "__esModule", { value: !0 }), A.unpackPayload = void 0;
304
+ var r = d();
305
+ function o(n) {
306
+ var t;
307
+ if (n.data.slice(0, r.prefix.length) !== r.prefix)
308
+ return !1;
309
+ try {
310
+ t = JSON.parse(n.data.slice(r.prefix.length));
311
+ } catch {
312
+ return !1;
313
+ }
314
+ if (t.reply) {
315
+ var e = n.origin, i = n.source, s = t.reply;
316
+ t.reply = function(u) {
317
+ if (i) {
318
+ var c = (0, r.packagePayload)(s, e, u);
319
+ c && i.postMessage(c, e);
167
320
  }
168
321
  };
169
- n.child.addEventListener("message", i, !1);
322
+ }
323
+ return t;
324
+ }
325
+ return A.unpackPayload = o, A;
326
+ }
327
+ var $;
328
+ function d() {
329
+ return $ || ($ = 1, function(r) {
330
+ var o = p && p.__createBinding || (Object.create ? function(t, e, i, s) {
331
+ s === void 0 && (s = i);
332
+ var a = Object.getOwnPropertyDescriptor(e, i);
333
+ (!a || ("get" in a ? !e.__esModule : a.writable || a.configurable)) && (a = { enumerable: !0, get: function() {
334
+ return e[i];
335
+ } }), Object.defineProperty(t, s, a);
336
+ } : function(t, e, i, s) {
337
+ s === void 0 && (s = i), t[s] = e[i];
338
+ }), n = p && p.__exportStar || function(t, e) {
339
+ for (var i in t)
340
+ i !== "default" && !Object.prototype.hasOwnProperty.call(e, i) && o(e, t, i);
341
+ };
342
+ Object.defineProperty(r, "__esModule", { value: !0 }), n(Y(), r), n(Z(), r), n(N(), r), n(l, r), n(ee(), r), n(M, r), n(O, r), n(ie(), r), n(ne(), r), n(F, r), n(ue(), r), n(ce(), r), n(U, r), n(fe(), r);
343
+ }(D)), D;
344
+ }
345
+ var de = d(), le = V();
346
+ (0, de.attach)();
347
+ var he = le.Framebus;
348
+ const T = /* @__PURE__ */ X(he), pe = {
349
+ isLoading: !0,
350
+ invokeAction: async () => Promise.reject("Action functionality not initialized."),
351
+ navigate: () => {
352
+ }
353
+ }, ve = (r) => {
354
+ new T().emit("NAVIGATE", { path: r });
355
+ }, G = H(pe), me = () => K(G), _e = ({ children: r, config: o }) => {
356
+ const [n, t] = j(void 0), [e, i] = j(!0), s = (u, ...c) => new Promise((f, J) => {
357
+ new T().emit("INVOKE_ACTION", { actionKey: u, args: c }, (x) => {
358
+ x.success ? f(x.result) : J(new Error(x.error));
170
359
  });
171
- }, s;
172
- }();
173
- const P = {
174
- isLoading: !0
175
- }, N = w(P), S = () => C(N), b = ({ children: s, config: r }) => {
176
- const [t, n] = y({}), [e, o] = y(P);
177
- _(() => {
178
- if (r.forceRedirect && !r.isDev && window.self === window.top) {
360
+ });
361
+ Q(() => {
362
+ if (o.forceRedirect && !o.isDev && window.self === window.top) {
179
363
  console.error(
180
364
  "This app must be run inside an iframe when forceRedirect is true."
181
365
  );
182
366
  return;
183
367
  }
184
- const d = new p.Model({
185
- setData: (a) => {
186
- console.log("AppClientProvider: setData", a), n(a);
187
- }
188
- });
189
- d.then((a) => {
190
- console.log("AppClientProvider: handshake success", a), a.emit("init", r);
191
- }), d.catch((a) => {
192
- console.error("AppClientProvider: handshake error", a);
193
- }), o({
194
- isLoading: !1
195
- });
196
- }, [r]);
197
- const i = {
198
- ...e,
199
- data: t
368
+ const u = new T();
369
+ return u.on("DATA_RESPONSE", (c) => {
370
+ t(c), i(!1);
371
+ }), u.emit("REQUEST_DATA"), () => {
372
+ u.teardown();
373
+ };
374
+ }, [o]);
375
+ const a = {
376
+ data: n,
377
+ isLoading: e,
378
+ invokeAction: s,
379
+ navigate: ve
200
380
  };
201
- return console.log("client context value", i), /* @__PURE__ */ O(N.Provider, { value: i, children: s });
381
+ return /* @__PURE__ */ z(G.Provider, { value: a, children: r });
202
382
  };
203
383
  export {
204
- b as AppClientProvider,
205
- S as useAppClient
384
+ _e as AppClientProvider,
385
+ me as useAppClient
206
386
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@akinon/app-client",
3
3
  "description": "Akinon UI App Client. This library is used to create a new plugin or an application which will reside in Akinon's applications.",
4
- "version": "0.2.0",
4
+ "version": "0.3.0",
5
5
  "private": false,
6
6
  "type": "module",
7
7
  "main": "dist/index.js",
@@ -10,16 +10,17 @@
10
10
  "dist"
11
11
  ],
12
12
  "dependencies": {
13
+ "framebus": "^6.0.0",
13
14
  "postmate": "^1.5.2",
14
15
  "use-immer": "^0.9.0",
15
- "@akinon/app-shared": "^0.1.0"
16
+ "@akinon/app-shared": "^0.2.0"
16
17
  },
17
18
  "devDependencies": {
18
19
  "@types/postmate": "^1.5.3",
19
20
  "clean-package": "2.2.0",
20
21
  "@akinon/vite-config": "^0.1.1",
21
- "eslint-config-custom": "0.1.0",
22
- "tsconfig": "0.0.0"
22
+ "tsconfig": "0.0.0",
23
+ "eslint-config-custom": "0.1.0"
23
24
  },
24
25
  "peerDependencies": {
25
26
  "react": "18.x",