@akinon/app-client
Advanced tools
Comparing version 0.3.0 to 0.3.1
@@ -8,2 +8,6 @@ import { AppClientConfig, ApplicationData } from '@akinon/app-shared'; | ||
navigate: (path: string) => void; | ||
showModalDialog?: (title: string, content: string) => void; | ||
showConfirmationDialog?: (title: string, content: string) => boolean; | ||
showToast?: (content: string, type: 'success' | 'warning' | 'error' | 'loading' | 'destroy') => void; | ||
showErrorMessage?: (title: string, content: string) => void; | ||
} | ||
@@ -10,0 +14,0 @@ interface AppClientProviderProps { |
@@ -1,12 +0,12 @@ | ||
import { jsx as z } from "react/jsx-runtime"; | ||
import { createContext as H, useContext as K, useState as j, useEffect as Q } from "react"; | ||
var p = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}; | ||
function X(r) { | ||
import { jsx as G } from "react/jsx-runtime"; | ||
import { createContext as J, useContext as z, useState as E, useEffect as H } from "react"; | ||
var v = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}; | ||
function Q(r) { | ||
return r && r.__esModule && Object.prototype.hasOwnProperty.call(r, "default") ? r.default : r; | ||
} | ||
var D = {}, h = {}, q; | ||
function Y() { | ||
if (q) | ||
var x = {}, h = {}, C; | ||
function X() { | ||
if (C) | ||
return h; | ||
q = 1, Object.defineProperty(h, "__esModule", { value: !0 }), h.detach = h.attach = void 0; | ||
C = 1, Object.defineProperty(h, "__esModule", { value: !0 }), h.detach = h.attach = void 0; | ||
var r = d(), o = !1; | ||
@@ -22,7 +22,7 @@ function n() { | ||
} | ||
var v = {}, R; | ||
function Z() { | ||
if (R) | ||
return v; | ||
R = 1, Object.defineProperty(v, "__esModule", { value: !0 }), v.broadcastToChildWindows = void 0; | ||
var b = {}, j; | ||
function Y() { | ||
if (j) | ||
return b; | ||
j = 1, Object.defineProperty(b, "__esModule", { value: !0 }), b.broadcastToChildWindows = void 0; | ||
var r = d(); | ||
@@ -38,9 +38,9 @@ function o(n, t, e) { | ||
} | ||
return v.broadcastToChildWindows = o, v; | ||
return b.broadcastToChildWindows = o, b; | ||
} | ||
var b = {}, S; | ||
function N() { | ||
if (S) | ||
return b; | ||
S = 1, Object.defineProperty(b, "__esModule", { value: !0 }), b.broadcast = void 0; | ||
var g = {}, q; | ||
function Z() { | ||
if (q) | ||
return g; | ||
q = 1, Object.defineProperty(g, "__esModule", { value: !0 }), g.broadcast = void 0; | ||
var r = d(); | ||
@@ -61,3 +61,3 @@ function o(n, t) { | ||
} | ||
return b.broadcast = o, b; | ||
return g.broadcast = o, g; | ||
} | ||
@@ -70,7 +70,7 @@ var l = {}; | ||
l.subscribers = {}; | ||
var g = {}, C; | ||
var y = {}, R; | ||
function ee() { | ||
if (C) | ||
return g; | ||
C = 1, Object.defineProperty(g, "__esModule", { value: !0 }), g.dispatch = void 0; | ||
if (R) | ||
return y; | ||
R = 1, Object.defineProperty(y, "__esModule", { value: !0 }), y.dispatch = void 0; | ||
var r = d(); | ||
@@ -85,3 +85,3 @@ function o(n, t, e, i, s) { | ||
} | ||
return g.dispatch = o, g; | ||
return y.dispatch = o, y; | ||
} | ||
@@ -95,14 +95,14 @@ var M = {}; | ||
M.hasOpener = re; | ||
var O = {}; | ||
Object.defineProperty(O, "__esModule", { value: !0 }); | ||
O.isntString = void 0; | ||
var T = {}; | ||
Object.defineProperty(T, "__esModule", { value: !0 }); | ||
T.isntString = void 0; | ||
function te(r) { | ||
return typeof r != "string"; | ||
} | ||
O.isntString = te; | ||
var y = {}, E; | ||
T.isntString = te; | ||
var m = {}, S; | ||
function ie() { | ||
if (E) | ||
return y; | ||
E = 1, Object.defineProperty(y, "__esModule", { value: !0 }), y.onMessage = void 0; | ||
if (S) | ||
return m; | ||
S = 1, Object.defineProperty(m, "__esModule", { value: !0 }), m.onMessage = void 0; | ||
var r = d(); | ||
@@ -118,9 +118,9 @@ function o(n) { | ||
} | ||
return y.onMessage = o, y; | ||
return m.onMessage = o, m; | ||
} | ||
var m = {}, k; | ||
var _ = {}, I; | ||
function ne() { | ||
if (k) | ||
return m; | ||
k = 1, Object.defineProperty(m, "__esModule", { value: !0 }), m.packagePayload = void 0; | ||
if (I) | ||
return _; | ||
I = 1, Object.defineProperty(_, "__esModule", { value: !0 }), _.packagePayload = void 0; | ||
var r = d(); | ||
@@ -140,7 +140,7 @@ function o(n, t, e, i) { | ||
} | ||
return m.packagePayload = o, m; | ||
return _.packagePayload = o, _; | ||
} | ||
var F = {}; | ||
Object.defineProperty(F, "__esModule", { value: !0 }); | ||
F.sendMessage = void 0; | ||
var D = {}; | ||
Object.defineProperty(D, "__esModule", { value: !0 }); | ||
D.sendMessage = void 0; | ||
function ae(r, o, n) { | ||
@@ -152,8 +152,8 @@ try { | ||
} | ||
F.sendMessage = ae; | ||
var _ = {}, w = {}, B; | ||
function V() { | ||
if (B) | ||
return w; | ||
B = 1, Object.defineProperty(w, "__esModule", { value: !0 }), w.Framebus = void 0; | ||
D.sendMessage = ae; | ||
var w = {}, P = {}, k; | ||
function K() { | ||
if (k) | ||
return P; | ||
k = 1, Object.defineProperty(P, "__esModule", { value: !0 }), P.Framebus = void 0; | ||
var r = d(), o = typeof window < "u" && window.Promise, n = ( | ||
@@ -264,3 +264,3 @@ /** @class */ | ||
); | ||
return w.Framebus = n, w; | ||
return P.Framebus = n, P; | ||
} | ||
@@ -273,12 +273,12 @@ function se() { | ||
} | ||
var oe = se, I; | ||
var oe = se, L; | ||
function ue() { | ||
if (I) | ||
return _; | ||
I = 1; | ||
var r = p && p.__importDefault || function(e) { | ||
if (L) | ||
return w; | ||
L = 1; | ||
var r = v && v.__importDefault || function(e) { | ||
return e && e.__esModule ? e : { default: e }; | ||
}; | ||
Object.defineProperty(_, "__esModule", { value: !0 }), _.subscribeReplier = void 0; | ||
var o = V(), n = r(oe); | ||
Object.defineProperty(w, "__esModule", { value: !0 }), w.subscribeReplier = void 0; | ||
var o = K(), n = r(oe); | ||
function t(e, i) { | ||
@@ -295,9 +295,9 @@ var s = (0, n.default)(); | ||
} | ||
return _.subscribeReplier = t, _; | ||
return w.subscribeReplier = t, w; | ||
} | ||
var P = {}, L; | ||
var A = {}, B; | ||
function ce() { | ||
if (L) | ||
return P; | ||
L = 1, Object.defineProperty(P, "__esModule", { value: !0 }), P.subscriptionArgsInvalid = void 0; | ||
if (B) | ||
return A; | ||
B = 1, Object.defineProperty(A, "__esModule", { value: !0 }), A.subscriptionArgsInvalid = void 0; | ||
var r = d(); | ||
@@ -307,11 +307,11 @@ function o(n, t, e) { | ||
} | ||
return P.subscriptionArgsInvalid = o, P; | ||
return A.subscriptionArgsInvalid = o, A; | ||
} | ||
var U = {}; | ||
Object.defineProperty(U, "__esModule", { value: !0 }); | ||
var A = {}, W; | ||
var V = {}; | ||
Object.defineProperty(V, "__esModule", { value: !0 }); | ||
var O = {}, W; | ||
function fe() { | ||
if (W) | ||
return A; | ||
W = 1, Object.defineProperty(A, "__esModule", { value: !0 }), A.unpackPayload = void 0; | ||
return O; | ||
W = 1, Object.defineProperty(O, "__esModule", { value: !0 }), O.unpackPayload = void 0; | ||
var r = d(); | ||
@@ -338,3 +338,3 @@ function o(n) { | ||
} | ||
return A.unpackPayload = o, A; | ||
return O.unpackPayload = o, O; | ||
} | ||
@@ -344,3 +344,3 @@ var $; | ||
return $ || ($ = 1, function(r) { | ||
var o = p && p.__createBinding || (Object.create ? function(t, e, i, s) { | ||
var o = v && v.__createBinding || (Object.create ? function(t, e, i, s) { | ||
s === void 0 && (s = i); | ||
@@ -353,13 +353,13 @@ var a = Object.getOwnPropertyDescriptor(e, i); | ||
s === void 0 && (s = i), t[s] = e[i]; | ||
}), n = p && p.__exportStar || function(t, e) { | ||
}), n = v && v.__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(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); | ||
}(D)), D; | ||
Object.defineProperty(r, "__esModule", { value: !0 }), n(X(), r), n(Y(), r), n(Z(), r), n(l, r), n(ee(), r), n(M, r), n(T, r), n(ie(), r), n(ne(), r), n(D, r), n(ue(), r), n(ce(), r), n(V, r), n(fe(), r); | ||
}(x)), x; | ||
} | ||
var de = d(), le = V(); | ||
var de = d(), le = K(); | ||
(0, de.attach)(); | ||
var he = le.Framebus; | ||
const T = /* @__PURE__ */ X(he), pe = { | ||
const p = /* @__PURE__ */ Q(he), pe = { | ||
isLoading: !0, | ||
@@ -370,10 +370,28 @@ invokeAction: async () => Promise.reject("Action functionality not initialized."), | ||
}, ve = (r) => { | ||
new T().emit("NAVIGATE", { path: r }); | ||
}, G = H(pe), me = () => K(G), _e = ({ children: r, config: o }) => { | ||
const [n, t] = j(void 0), [e, i] = j(!0), s = (u, ...c) => new Promise((f, J) => { | ||
new T().emit("INVOKE_ACTION", { actionKey: u, args: c }, (x) => { | ||
x.success ? f(x.result) : J(new Error(x.error)); | ||
new p().emit("NAVIGATE", { path: r }); | ||
}, be = (r, o) => { | ||
new p().emit("INVOKE_DEFAULT_ACTION", { | ||
actionKey: "showModalDialog", | ||
args: [r, o] | ||
}); | ||
}, ge = (r, o) => new p().emit("INVOKE_DEFAULT_ACTION", { | ||
actionKey: "showConfirmationDialog", | ||
args: [r, o] | ||
}), ye = (r, o) => { | ||
new p().emit("INVOKE_DEFAULT_ACTION", { | ||
actionKey: "showToast", | ||
args: [r, o] | ||
}); | ||
}, me = (r, o) => { | ||
new p().emit("INVOKE_DEFAULT_ACTION", { | ||
actionKey: "showErrorMessage", | ||
args: [r, o] | ||
}); | ||
}, U = J(pe), Ae = () => z(U), Oe = ({ children: r, config: o }) => { | ||
const [n, t] = E(void 0), [e, i] = E(!0), s = (u, ...c) => new Promise((f, N) => { | ||
new p().emit("INVOKE_ACTION", { actionKey: u, args: c }, (F) => { | ||
F.success ? f(F.result) : N(new Error(F.error)); | ||
}); | ||
}); | ||
Q(() => { | ||
H(() => { | ||
if (o.forceRedirect && !o.isDev && window.self === window.top) { | ||
@@ -385,3 +403,3 @@ console.error( | ||
} | ||
const u = new T(); | ||
const u = new p(); | ||
return u.on("DATA_RESPONSE", (c) => { | ||
@@ -397,9 +415,13 @@ t(c), i(!1); | ||
invokeAction: s, | ||
navigate: ve | ||
navigate: ve, | ||
showModalDialog: be, | ||
showConfirmationDialog: ge, | ||
showToast: ye, | ||
showErrorMessage: me | ||
}; | ||
return /* @__PURE__ */ z(G.Provider, { value: a, children: r }); | ||
return /* @__PURE__ */ G(U.Provider, { value: a, children: r }); | ||
}; | ||
export { | ||
_e as AppClientProvider, | ||
me as useAppClient | ||
Oe as AppClientProvider, | ||
Ae 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.0", | ||
"version": "0.3.1", | ||
"private": false, | ||
@@ -16,3 +16,3 @@ "type": "module", | ||
"use-immer": "^0.9.0", | ||
"@akinon/app-shared": "^0.2.0" | ||
"@akinon/app-shared": "^0.2.1" | ||
}, | ||
@@ -23,4 +23,4 @@ "devDependencies": { | ||
"@akinon/vite-config": "^0.1.1", | ||
"tsconfig": "0.0.0", | ||
"eslint-config-custom": "0.1.0" | ||
"eslint-config-custom": "0.1.0", | ||
"tsconfig": "0.0.0" | ||
}, | ||
@@ -27,0 +27,0 @@ "peerDependencies": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
26771
468
0
Updated@akinon/app-shared@^0.2.1