Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@akinon/app-client

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@akinon/app-client - npm Package Compare versions

Comparing version 0.3.3 to 0.4.0

6

dist/app-client-provider.d.ts

@@ -1,2 +0,2 @@

import { ApplicationData, FullpageApplicationConfig, PluginApplicationConfig, RegisteredApp, RegisteredAppType } from '@akinon/app-shared';
import { ApplicationData, ApplicationNavigation, ApplicationParams, FullpageApplicationConfig, PluginApplicationConfig, RegisteredApp, RegisteredAppType } from '@akinon/app-shared';
import React from 'react';

@@ -8,2 +8,3 @@ /**

* @property {ApplicationData} [data] - Optional application data shared across micro frontends.
* @property {ApplicationParams} [params] - Optional. Additional parameters to be passed to the application.
* @property {boolean} isLoading - Indicates whether the application data is currently loading.

@@ -16,2 +17,3 @@ * @property {Function} invokeAction - Method to invoke an action defined in the AppShell.

data?: ApplicationData;
params?: ApplicationParams;
isLoading: boolean;

@@ -47,3 +49,3 @@ invokeAction: <T = any>(actionKey: string, ...args: any[]) => Promise<T>;

export { AppClientProvider, useAppClient };
export type { FullpageApplicationConfig, PluginApplicationConfig, RegisteredApp, RegisteredAppType };
export type { ApplicationNavigation, FullpageApplicationConfig, PluginApplicationConfig, RegisteredApp, RegisteredAppType };
//# sourceMappingURL=app-client-provider.d.ts.map

@@ -1,12 +0,12 @@

import { jsx as z } from "react/jsx-runtime";
import { createContext as H, useContext as Q, useState as C, useEffect as X } from "react";
var v = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
function Y(r) {
import { jsx as Y } from "react/jsx-runtime";
import { createContext as Z, useContext as ee, useState as C, useEffect as re } from "react";
var y = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
function te(r) {
return r && r.__esModule && Object.prototype.hasOwnProperty.call(r, "default") ? r.default : r;
}
var I = {}, h = {}, j;
function Z() {
if (j)
return h;
j = 1, Object.defineProperty(h, "__esModule", { value: !0 }), h.detach = h.attach = void 0;
var R = {}, g = {}, q;
function ie() {
if (q)
return g;
q = 1, Object.defineProperty(g, "__esModule", { value: !0 }), g.detach = g.attach = void 0;
var r = d(), o = !1;

@@ -16,13 +16,13 @@ function n() {

}
h.attach = n;
g.attach = n;
function t() {
o = !1, window.removeEventListener("message", r.onMessage, !1);
}
return h.detach = t, h;
return g.detach = t, g;
}
var g = {}, S;
function ee() {
if (S)
return g;
S = 1, Object.defineProperty(g, "__esModule", { value: !0 }), g.broadcastToChildWindows = void 0;
var _ = {}, L;
function ne() {
if (L)
return _;
L = 1, Object.defineProperty(_, "__esModule", { value: !0 }), _.broadcastToChildWindows = void 0;
var r = d();

@@ -38,9 +38,9 @@ function o(n, t, e) {

}
return g.broadcastToChildWindows = o, g;
return _.broadcastToChildWindows = o, _;
}
var y = {}, q;
function re() {
if (q)
return y;
q = 1, Object.defineProperty(y, "__esModule", { value: !0 }), y.broadcast = void 0;
var w = {}, k;
function ae() {
if (k)
return w;
k = 1, Object.defineProperty(w, "__esModule", { value: !0 }), w.broadcast = void 0;
var r = d();

@@ -61,15 +61,15 @@ function o(n, t) {

}
return y.broadcast = o, y;
return w.broadcast = o, w;
}
var l = {};
Object.defineProperty(l, "__esModule", { value: !0 });
l.subscribers = l.childWindows = l.prefix = void 0;
l.prefix = "/*framebus*/";
l.childWindows = [];
l.subscribers = {};
var m = {}, R;
function te() {
if (R)
return m;
R = 1, Object.defineProperty(m, "__esModule", { value: !0 }), m.dispatch = void 0;
var p = {};
Object.defineProperty(p, "__esModule", { value: !0 });
p.subscribers = p.childWindows = p.prefix = void 0;
p.prefix = "/*framebus*/";
p.childWindows = [];
p.subscribers = {};
var P = {}, B;
function se() {
if (B)
return P;
B = 1, Object.defineProperty(P, "__esModule", { value: !0 }), P.dispatch = void 0;
var r = d();

@@ -84,23 +84,23 @@ function o(n, t, e, i, s) {

}
return m.dispatch = o, m;
return P.dispatch = o, P;
}
var T = {};
Object.defineProperty(T, "__esModule", { value: !0 });
T.hasOpener = void 0;
function ie(r) {
var I = {};
Object.defineProperty(I, "__esModule", { value: !0 });
I.hasOpener = void 0;
function oe(r) {
return !(r.top !== r || r.opener == null || r.opener === r || r.opener.closed === !0);
}
T.hasOpener = ie;
var D = {};
Object.defineProperty(D, "__esModule", { value: !0 });
D.isntString = void 0;
function ne(r) {
I.hasOpener = oe;
var S = {};
Object.defineProperty(S, "__esModule", { value: !0 });
S.isntString = void 0;
function ue(r) {
return typeof r != "string";
}
D.isntString = ne;
var _ = {}, k;
function ae() {
if (k)
return _;
k = 1, Object.defineProperty(_, "__esModule", { value: !0 }), _.onMessage = void 0;
S.isntString = ue;
var A = {}, W;
function ce() {
if (W)
return A;
W = 1, Object.defineProperty(A, "__esModule", { value: !0 }), A.onMessage = void 0;
var r = d();

@@ -116,9 +116,9 @@ function o(n) {

}
return _.onMessage = o, _;
return A.onMessage = o, A;
}
var w = {}, L;
function se() {
if (L)
return w;
L = 1, Object.defineProperty(w, "__esModule", { value: !0 }), w.packagePayload = void 0;
var O = {}, $;
function fe() {
if ($)
return O;
$ = 1, Object.defineProperty(O, "__esModule", { value: !0 }), O.packagePayload = void 0;
var r = d();

@@ -138,8 +138,8 @@ function o(n, t, e, i) {

}
return w.packagePayload = o, w;
return O.packagePayload = o, O;
}
var F = {};
Object.defineProperty(F, "__esModule", { value: !0 });
F.sendMessage = void 0;
function oe(r, o, n) {
var j = {};
Object.defineProperty(j, "__esModule", { value: !0 });
j.sendMessage = void 0;
function de(r, o, n) {
try {

@@ -150,8 +150,8 @@ r.postMessage(o, n);

}
F.sendMessage = oe;
var P = {}, A = {}, B;
function U() {
if (B)
return A;
B = 1, Object.defineProperty(A, "__esModule", { value: !0 }), A.Framebus = void 0;
j.sendMessage = de;
var M = {}, T = {}, V;
function H() {
if (V)
return T;
V = 1, Object.defineProperty(T, "__esModule", { value: !0 }), T.Framebus = void 0;
var r = d(), o = typeof window < "u" && window.Promise, n = (

@@ -181,4 +181,4 @@ /** @class */

var u = (0, r.packagePayload)(e, a, i, s);
return u ? (this.limitBroadcastToFramesArray ? this.targetFramesAsWindows().forEach(function(f) {
(0, r.sendMessage)(f, u, a);
return u ? (this.limitBroadcastToFramesArray ? this.targetFramesAsWindows().forEach(function(c) {
(0, r.sendMessage)(c, u, a);
}) : (0, r.broadcast)(u, {

@@ -191,6 +191,6 @@ origin: a,

return new t.Promise(function(a, u) {
var f = s.emit(e, i, function(c) {
a(c);
var c = s.emit(e, i, function(f) {
a(f);
});
f || u(new Error('Listener not added for "'.concat(e, '"')));
c || u(new Error('Listener not added for "'.concat(e, '"')));
});

@@ -202,5 +202,5 @@ }, t.prototype.on = function(e, i) {

return e = this.namespaceEvent(e), (0, r.subscriptionArgsInvalid)(e, u, a) ? !1 : (this.hasAdditionalChecksForOnListeners && (u = function() {
for (var f = [], c = 0; c < arguments.length; c++)
f[c] = arguments[c];
s.passesVerifyDomainCheck(this && this.origin) && s.hasMatchingTargetFrame(this && this.source) && i.apply(void 0, f);
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({

@@ -221,11 +221,11 @@ eventName: e,

e = this.namespaceEvent(e);
var f = this.origin;
if ((0, r.subscriptionArgsInvalid)(e, s, f))
var c = this.origin;
if ((0, r.subscriptionArgsInvalid)(e, s, c))
return !1;
var c = r.subscribers[f] && r.subscribers[f][e];
if (!c)
var f = r.subscribers[c] && r.subscribers[c][e];
if (!f)
return !1;
for (var a = 0; a < c.length; a++)
if (c[a] === s)
return c.splice(a, 1), !0;
for (var a = 0; a < f.length; a++)
if (f[a] === s)
return f.splice(a, 1), !0;
return !1;

@@ -266,5 +266,5 @@ }, t.prototype.teardown = function() {

);
return A.Framebus = n, A;
return T.Framebus = n, T;
}
function ue() {
function le() {
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(r) {

@@ -275,16 +275,16 @@ var o = Math.random() * 16 | 0, n = r === "x" ? o : o & 3 | 8;

}
var ce = ue, W;
function fe() {
if (W)
return P;
W = 1;
var r = v && v.__importDefault || function(e) {
var he = le, K;
function pe() {
if (K)
return M;
K = 1;
var r = y && y.__importDefault || function(e) {
return e && e.__esModule ? e : { default: e };
};
Object.defineProperty(P, "__esModule", { value: !0 }), P.subscribeReplier = void 0;
var o = U(), n = r(ce);
Object.defineProperty(M, "__esModule", { value: !0 }), M.subscribeReplier = void 0;
var o = H(), n = r(he);
function t(e, i) {
var s = (0, n.default)();
function a(u, f) {
e(u, f), o.Framebus.target({
function a(u, c) {
e(u, c), o.Framebus.target({
origin: i

@@ -297,9 +297,9 @@ }).off(s, a);

}
return P.subscribeReplier = t, P;
return M.subscribeReplier = t, M;
}
var O = {}, $;
function de() {
if ($)
return O;
$ = 1, Object.defineProperty(O, "__esModule", { value: !0 }), O.subscriptionArgsInvalid = void 0;
var D = {}, U;
function ve() {
if (U)
return D;
U = 1, Object.defineProperty(D, "__esModule", { value: !0 }), D.subscriptionArgsInvalid = void 0;
var r = d();

@@ -309,11 +309,11 @@ function o(n, t, e) {

}
return O.subscriptionArgsInvalid = o, O;
return D.subscriptionArgsInvalid = o, D;
}
var N = {};
Object.defineProperty(N, "__esModule", { value: !0 });
var M = {}, K;
function le() {
if (K)
return M;
K = 1, Object.defineProperty(M, "__esModule", { value: !0 }), M.unpackPayload = void 0;
var J = {};
Object.defineProperty(J, "__esModule", { value: !0 });
var F = {}, N;
function ge() {
if (N)
return F;
N = 1, Object.defineProperty(F, "__esModule", { value: !0 }), F.unpackPayload = void 0;
var r = d();

@@ -333,4 +333,4 @@ function o(n) {

if (i) {
var f = (0, r.packagePayload)(s, e, u);
f && i.postMessage(f, e);
var c = (0, r.packagePayload)(s, e, u);
c && i.postMessage(c, e);
}

@@ -341,8 +341,8 @@ };

}
return M.unpackPayload = o, M;
return F.unpackPayload = o, F;
}
var V;
var G;
function d() {
return V || (V = 1, function(r) {
var o = v && v.__createBinding || (Object.create ? function(t, e, i, s) {
return G || (G = 1, function(r) {
var o = y && y.__createBinding || (Object.create ? function(t, e, i, s) {
s === void 0 && (s = i);

@@ -355,13 +355,13 @@ var a = Object.getOwnPropertyDescriptor(e, i);

s === void 0 && (s = i), t[s] = e[i];
}), n = v && v.__exportStar || function(t, e) {
}), n = y && y.__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(Z(), r), n(ee(), r), n(re(), r), n(l, r), n(te(), r), n(T, r), n(D, r), n(ae(), r), n(se(), r), n(F, r), n(fe(), r), n(de(), r), n(N, r), n(le(), r);
}(I)), I;
Object.defineProperty(r, "__esModule", { value: !0 }), n(ie(), r), n(ne(), r), n(ae(), r), n(p, r), n(se(), r), n(I, r), n(S, r), n(ce(), r), n(fe(), r), n(j, r), n(pe(), r), n(ve(), r), n(J, r), n(ge(), r);
}(R)), R;
}
var he = d(), pe = U();
(0, he.attach)();
var ve = pe.Framebus;
const p = /* @__PURE__ */ Y(ve), be = {
var be = d(), ye = H();
(0, be.attach)();
var me = ye.Framebus;
const v = /* @__PURE__ */ te(me), _e = {
isLoading: !0,

@@ -371,29 +371,34 @@ invokeAction: async () => Promise.reject("Action functionality not initialized."),

}
}, G = H(be), Me = () => Q(G), ge = (r) => {
new p().emit("NAVIGATE", { path: r });
}, ye = (r, o) => {
new p().emit("INVOKE_DEFAULT_ACTION", {
}, z = Z(_e), Fe = () => ee(z), we = (r) => {
new v().emit("NAVIGATE", { path: r });
}, Pe = (r, o) => {
new v().emit("INVOKE_DEFAULT_ACTION", {
actionKey: "showModalDialog",
args: [r, o]
});
}, me = (r, o) => new p().emit("INVOKE_DEFAULT_ACTION", {
}, Ae = (r, o) => new v().emit("INVOKE_DEFAULT_ACTION", {
actionKey: "showConfirmationDialog",
args: [r, o]
}), _e = (r, o) => {
new p().emit("INVOKE_DEFAULT_ACTION", {
}), Oe = (r, o) => {
new v().emit("INVOKE_DEFAULT_ACTION", {
actionKey: "showToast",
args: [r, o]
});
}, we = (r, o) => {
new p().emit("INVOKE_DEFAULT_ACTION", {
}, Me = (r, o) => {
new v().emit("INVOKE_DEFAULT_ACTION", {
actionKey: "showErrorMessage",
args: [r, o]
});
}, Te = ({ children: r, config: o }) => {
const [n, t] = C(void 0), [e, i] = C(void 0), [s, a] = C(!0), u = (c, ...b) => new Promise((x, J) => {
new p().emit("INVOKE_ACTION", { actionKey: c, args: b }, (E) => {
E.success ? x(E.result) : J(new Error(E.error));
}, Ee = ({ children: r, config: o }) => {
const [, n] = C(void 0), [t, e] = C(void 0), [i, s] = C(
void 0
), [a, u] = C(!0), c = (E, ...x) => new Promise((l, h) => {
new v().emit("INVOKE_ACTION", { actionKey: E, args: x }, (b) => {
b.success ? l(b.result) : h(new Error(b.error));
});
});
X(() => {
}), f = () => {
const E = o;
return Array.isArray(E.menu);
};
re(() => {
if (o.forceRedirect && !o.isDev && window.self === window.top) {

@@ -405,27 +410,37 @@ console.error(

}
const c = new p();
return c.emit("REQUEST_DATA", { config: o }), c.on("DATA_RESPONSE", (b) => {
i(b), a(!1);
}), c.on("SET_APP_ID", (b) => {
const { appId: x } = b;
t(x);
const x = new URL(window.location.href).searchParams.get("c");
let l;
return l = x ? new v({ channel: x }) : new v(), l.emit("REQUEST_DATA", { config: o }), l.on("DATA_RESPONSE", (h) => {
e(h), u(!1);
}), l.on("PARAMS_RESPONSE", (h) => {
s(h);
}), l.on("SET_APP_ID", (h) => {
const { appId: m } = h;
n(m);
}), f() && l.on("NAVIGATE_CHILD", (h) => {
const { path: m } = h, { navigation: b } = o;
if (b) {
const { navigate: X } = b;
X(m);
}
}), () => {
c.teardown();
l.teardown();
};
}, [o]);
const f = {
data: e,
isLoading: s,
invokeAction: u,
navigate: ge,
showModalDialog: ye,
showConfirmationDialog: me,
showToast: _e,
showErrorMessage: we
const Q = {
data: t,
params: i,
isLoading: a,
invokeAction: c,
navigate: we,
showModalDialog: Pe,
showConfirmationDialog: Ae,
showToast: Oe,
showErrorMessage: Me
};
return /* @__PURE__ */ z(G.Provider, { value: f, children: r });
return /* @__PURE__ */ Y(z.Provider, { value: Q, children: r });
};
export {
Te as AppClientProvider,
Me as useAppClient
Ee as AppClientProvider,
Fe as useAppClient
};
{
"name": "@akinon/app-client",
"description": "Akinon UI App Client. This library is used to create a new plugin or an application which will reside in Akinon's applications.",
"version": "0.3.3",
"version": "0.4.0",
"private": false,

@@ -16,3 +16,3 @@ "type": "module",

"use-immer": "^0.9.0",
"@akinon/app-shared": "^0.2.3"
"@akinon/app-shared": "^0.3.0"
},

@@ -19,0 +19,0 @@ "devDependencies": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc