@sensorario/sg-components 0.0.68 → 0.0.69
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.
- package/dist/index.es.js +24 -15
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -145,39 +145,48 @@ var a = ({ label: e, ...t }) => /* @__PURE__ */ r("button", {
|
|
|
145
145
|
]
|
|
146
146
|
})
|
|
147
147
|
});
|
|
148
|
-
}, g = "simonegentili.com-access-token", _ = (e) => document.cookie.split("; ").some((t) => t.startsWith(`${e}=`) && t.slice(e.length + 1).length > 0), v = (
|
|
149
|
-
let
|
|
148
|
+
}, g = "simonegentili.com-access-token", _ = (e) => document.cookie.split("; ").some((t) => t.startsWith(`${e}=`) && t.slice(e.length + 1).length > 0), v = (e) => {
|
|
149
|
+
let t = document.cookie.split("; ").find((t) => t.startsWith(`${e}=`));
|
|
150
|
+
return t ? t.slice(e.length + 1) : null;
|
|
151
|
+
}, y = (e, t) => {
|
|
152
|
+
try {
|
|
153
|
+
return JSON.parse(atob(e.split(".")[1].replace(/-/g, "+").replace(/_/g, "/")))[t] ?? null;
|
|
154
|
+
} catch {
|
|
155
|
+
return null;
|
|
156
|
+
}
|
|
157
|
+
}, b = ({ title: a = "Quadrato", homePageKey: o = "home", onNavigate: s, cookieName: c = g, username: u = null, usernameJwtField: f = "sub", onLogin: p, onLogout: m, onUserAuthenticated: b }) => {
|
|
158
|
+
let [x, S] = t(() => _(c)), [C, w] = t(!1), T = u ?? (x ? y(v(c) ?? "", f) : null);
|
|
150
159
|
return e(() => {
|
|
151
|
-
|
|
160
|
+
b?.(x, x ? T : null);
|
|
152
161
|
}, []), /* @__PURE__ */ i(n, { children: [/* @__PURE__ */ r(l, {
|
|
153
162
|
onNavigate: s,
|
|
154
163
|
title: a,
|
|
155
164
|
homePageKey: o,
|
|
156
165
|
children: /* @__PURE__ */ i("div", {
|
|
157
166
|
className: "quadrato-header-auth",
|
|
158
|
-
children: [
|
|
167
|
+
children: [x && T && /* @__PURE__ */ r("span", {
|
|
159
168
|
className: "quadrato-header-username",
|
|
160
|
-
children:
|
|
169
|
+
children: T
|
|
161
170
|
}), /* @__PURE__ */ r(d, {
|
|
162
|
-
isLoggedIn:
|
|
163
|
-
handleLogin: () =>
|
|
171
|
+
isLoggedIn: x,
|
|
172
|
+
handleLogin: () => w(!0),
|
|
164
173
|
handleLogout: () => {
|
|
165
|
-
|
|
174
|
+
m?.();
|
|
166
175
|
let e = _(c);
|
|
167
|
-
|
|
176
|
+
S(e), b?.(e, null);
|
|
168
177
|
}
|
|
169
178
|
})]
|
|
170
179
|
})
|
|
171
180
|
}), /* @__PURE__ */ r(h, {
|
|
172
|
-
open:
|
|
173
|
-
onClose: () =>
|
|
181
|
+
open: C,
|
|
182
|
+
onClose: () => w(!1),
|
|
174
183
|
onLogin: async (e, t) => {
|
|
175
|
-
await
|
|
184
|
+
await p(e, t);
|
|
176
185
|
let n = _(c);
|
|
177
|
-
|
|
186
|
+
S(n), w(!1), b?.(n, n ? u ?? e : null);
|
|
178
187
|
}
|
|
179
188
|
})] });
|
|
180
|
-
},
|
|
189
|
+
}, x = ({ open: e, onClose: n, onSubmit: o }) => {
|
|
181
190
|
let [s, c] = t(""), [l, u] = t(""), [d, p] = t("");
|
|
182
191
|
return /* @__PURE__ */ r(f, {
|
|
183
192
|
open: e,
|
|
@@ -222,4 +231,4 @@ var a = ({ label: e, ...t }) => /* @__PURE__ */ r("button", {
|
|
|
222
231
|
});
|
|
223
232
|
};
|
|
224
233
|
//#endregion
|
|
225
|
-
export { d as Authenticator, a as Button, o as Footer, l as Header,
|
|
234
|
+
export { d as Authenticator, a as Button, o as Footer, l as Header, b as QuadratoHeader, c as SGFooter, u as SGHeader, x as SetPasswordModal };
|