@saas-support/react 0.6.0 → 0.7.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.
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +29 -20
- package/dist/react.cjs +3 -3
- package/dist/react.d.ts +2 -0
- package/dist/react.js +148 -142
- package/package.json +1 -1
package/dist/react.js
CHANGED
|
@@ -19,11 +19,11 @@ function Xa({ publishableKey: a, apiKey: s, baseUrl: t, appearance: o, children:
|
|
|
19
19
|
const w = await u.auth.getUser(), y = await u.auth.getSettings();
|
|
20
20
|
c(w), p(y), i(!0);
|
|
21
21
|
});
|
|
22
|
-
const
|
|
22
|
+
const b = u.auth.onAuthStateChange((w) => {
|
|
23
23
|
m || c(w);
|
|
24
24
|
});
|
|
25
25
|
return () => {
|
|
26
|
-
m = !0,
|
|
26
|
+
m = !0, b(), u.destroy();
|
|
27
27
|
};
|
|
28
28
|
}, [u]), /* @__PURE__ */ e(ra.Provider, { value: { client: u, user: l, isLoaded: d, appearance: o, settings: f }, children: n });
|
|
29
29
|
}
|
|
@@ -1024,7 +1024,7 @@ function aa(a) {
|
|
|
1024
1024
|
border: 1px solid ${a.authOutlineVariant}26;
|
|
1025
1025
|
box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
|
|
1026
1026
|
width: 100%;
|
|
1027
|
-
max-width:
|
|
1027
|
+
max-width: 520px;
|
|
1028
1028
|
overflow: hidden;
|
|
1029
1029
|
}
|
|
1030
1030
|
|
|
@@ -2197,8 +2197,13 @@ function q({ children: a, appearance: s }) {
|
|
|
2197
2197
|
}
|
|
2198
2198
|
const l = t.current.attachShadow({ mode: "open" });
|
|
2199
2199
|
if ((s == null ? void 0 : s.fontUrl) !== null) {
|
|
2200
|
-
const p =
|
|
2201
|
-
|
|
2200
|
+
const p = (s == null ? void 0 : s.fontUrl) ?? "https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&family=Inter:wght@400;500;600&family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200&display=swap";
|
|
2201
|
+
if (!document.querySelector(`link[href="${p}"]`)) {
|
|
2202
|
+
const b = document.createElement("link");
|
|
2203
|
+
b.rel = "stylesheet", b.href = p, document.head.appendChild(b);
|
|
2204
|
+
}
|
|
2205
|
+
const m = document.createElement("link");
|
|
2206
|
+
m.rel = "stylesheet", m.href = p, l.appendChild(m);
|
|
2202
2207
|
}
|
|
2203
2208
|
const c = X(s), d = document.createElement("style");
|
|
2204
2209
|
d.textContent = aa(c), l.appendChild(d);
|
|
@@ -2222,7 +2227,8 @@ function ta() {
|
|
|
2222
2227
|
isSignedIn: !!s,
|
|
2223
2228
|
user: s,
|
|
2224
2229
|
signOut: $(() => a.auth.signOut(), [a]),
|
|
2225
|
-
getToken: $(() => a.auth.getToken(), [a])
|
|
2230
|
+
getToken: $(() => a.auth.getToken(), [a]),
|
|
2231
|
+
refreshUser: $(() => a.auth.refreshUser(), [a])
|
|
2226
2232
|
};
|
|
2227
2233
|
}
|
|
2228
2234
|
function ae() {
|
|
@@ -2286,14 +2292,14 @@ function Ca() {
|
|
|
2286
2292
|
), isLoading: s, error: o, setError: n };
|
|
2287
2293
|
}
|
|
2288
2294
|
function na() {
|
|
2289
|
-
const { client: a } = L(), [s, t] = g([]), [o, n] = g(null), [u, l] = g([]), [c, d] = g([]), [i, f] = g(!1), [p, m] = g(null),
|
|
2295
|
+
const { client: a } = L(), [s, t] = g([]), [o, n] = g(null), [u, l] = g([]), [c, d] = g([]), [i, f] = g(!1), [p, m] = g(null), b = $(async () => {
|
|
2290
2296
|
f(!0), m(null);
|
|
2291
2297
|
try {
|
|
2292
2298
|
const S = await a.auth.listOrgs();
|
|
2293
2299
|
t(S);
|
|
2294
|
-
const
|
|
2295
|
-
if (
|
|
2296
|
-
const v = S.find((O) => O.id ===
|
|
2300
|
+
const x = typeof window < "u" ? localStorage.getItem("ss_selected_org") : null;
|
|
2301
|
+
if (x && S.some((v) => v.id === x) && !o) {
|
|
2302
|
+
const v = S.find((O) => O.id === x);
|
|
2297
2303
|
n(v);
|
|
2298
2304
|
try {
|
|
2299
2305
|
const O = await a.auth.listMembers(v.id);
|
|
@@ -2308,74 +2314,74 @@ function na() {
|
|
|
2308
2314
|
}
|
|
2309
2315
|
}, [a, o]);
|
|
2310
2316
|
V(() => {
|
|
2311
|
-
|
|
2312
|
-
}, [
|
|
2317
|
+
b();
|
|
2318
|
+
}, [b]);
|
|
2313
2319
|
const w = $(async (S) => {
|
|
2314
2320
|
try {
|
|
2315
|
-
const
|
|
2316
|
-
n(
|
|
2321
|
+
const x = await a.auth.getOrg(S);
|
|
2322
|
+
n(x), typeof window < "u" && localStorage.setItem("ss_selected_org", S);
|
|
2317
2323
|
const v = await a.auth.listMembers(S);
|
|
2318
2324
|
l(v);
|
|
2319
|
-
} catch (
|
|
2320
|
-
m(
|
|
2325
|
+
} catch (x) {
|
|
2326
|
+
m(x instanceof Error ? x.message : "Failed to load organization");
|
|
2321
2327
|
}
|
|
2322
|
-
}, [a]), y = $(async (S,
|
|
2328
|
+
}, [a]), y = $(async (S, x) => {
|
|
2323
2329
|
try {
|
|
2324
|
-
const v = await a.auth.createOrg(S,
|
|
2330
|
+
const v = await a.auth.createOrg(S, x);
|
|
2325
2331
|
return t((O) => [...O, v]), v;
|
|
2326
2332
|
} catch (v) {
|
|
2327
2333
|
return m(v instanceof Error ? v.message : "Failed to create organization"), null;
|
|
2328
2334
|
}
|
|
2329
|
-
}, [a]), C = $(async (S,
|
|
2335
|
+
}, [a]), C = $(async (S, x) => {
|
|
2330
2336
|
try {
|
|
2331
|
-
const v = await a.auth.updateOrg(S,
|
|
2337
|
+
const v = await a.auth.updateOrg(S, x);
|
|
2332
2338
|
return t((O) => O.map((D) => D.id === S ? v : D)), (o == null ? void 0 : o.id) === S && n(v), v;
|
|
2333
2339
|
} catch (v) {
|
|
2334
2340
|
return m(v instanceof Error ? v.message : "Failed to update organization"), null;
|
|
2335
2341
|
}
|
|
2336
2342
|
}, [a, o]), h = $(async (S) => {
|
|
2337
2343
|
try {
|
|
2338
|
-
return await a.auth.deleteOrg(S), t((
|
|
2339
|
-
} catch (
|
|
2340
|
-
return m(
|
|
2344
|
+
return await a.auth.deleteOrg(S), t((x) => x.filter((v) => v.id !== S)), (o == null ? void 0 : o.id) === S && (n(null), l([]), d([]), typeof window < "u" && localStorage.removeItem("ss_selected_org")), !0;
|
|
2345
|
+
} catch (x) {
|
|
2346
|
+
return m(x instanceof Error ? x.message : "Failed to delete organization"), !1;
|
|
2341
2347
|
}
|
|
2342
|
-
}, [a, o]), N = $(async (S,
|
|
2348
|
+
}, [a, o]), N = $(async (S, x, v) => {
|
|
2343
2349
|
try {
|
|
2344
|
-
return await a.auth.sendInvite(S,
|
|
2350
|
+
return await a.auth.sendInvite(S, x, v);
|
|
2345
2351
|
} catch (O) {
|
|
2346
2352
|
return m(O instanceof Error ? O.message : "Failed to send invite"), null;
|
|
2347
2353
|
}
|
|
2348
2354
|
}, [a]), k = $(async (S) => {
|
|
2349
2355
|
try {
|
|
2350
|
-
const
|
|
2351
|
-
d(
|
|
2352
|
-
} catch (
|
|
2353
|
-
m(
|
|
2356
|
+
const x = await a.auth.listInvites(S);
|
|
2357
|
+
d(x);
|
|
2358
|
+
} catch (x) {
|
|
2359
|
+
m(x instanceof Error ? x.message : "Failed to load invites");
|
|
2354
2360
|
}
|
|
2355
|
-
}, [a]), z = $(async (S,
|
|
2361
|
+
}, [a]), z = $(async (S, x) => {
|
|
2356
2362
|
try {
|
|
2357
|
-
return await a.auth.revokeInvite(S,
|
|
2363
|
+
return await a.auth.revokeInvite(S, x), d((v) => v.filter((O) => O.id !== x)), !0;
|
|
2358
2364
|
} catch (v) {
|
|
2359
2365
|
return m(v instanceof Error ? v.message : "Failed to revoke invite"), !1;
|
|
2360
2366
|
}
|
|
2361
|
-
}, [a]), E = $(async (S,
|
|
2367
|
+
}, [a]), E = $(async (S, x, v) => {
|
|
2362
2368
|
try {
|
|
2363
|
-
return await a.auth.updateMemberRole(S,
|
|
2369
|
+
return await a.auth.updateMemberRole(S, x, v), l((O) => O.map((D) => D.userId === x ? { ...D, role: v } : D)), !0;
|
|
2364
2370
|
} catch (O) {
|
|
2365
2371
|
return m(O instanceof Error ? O.message : "Failed to update member role"), !1;
|
|
2366
2372
|
}
|
|
2367
|
-
}, [a]), I = $(async (S,
|
|
2373
|
+
}, [a]), I = $(async (S, x) => {
|
|
2368
2374
|
try {
|
|
2369
|
-
return await a.auth.removeMember(S,
|
|
2375
|
+
return await a.auth.removeMember(S, x), l((v) => v.filter((O) => O.userId !== x)), !0;
|
|
2370
2376
|
} catch (v) {
|
|
2371
2377
|
return m(v instanceof Error ? v.message : "Failed to remove member"), !1;
|
|
2372
2378
|
}
|
|
2373
2379
|
}, [a]), A = $(async (S) => {
|
|
2374
2380
|
try {
|
|
2375
|
-
const
|
|
2376
|
-
l(
|
|
2377
|
-
} catch (
|
|
2378
|
-
m(
|
|
2381
|
+
const x = await a.auth.listMembers(S);
|
|
2382
|
+
l(x);
|
|
2383
|
+
} catch (x) {
|
|
2384
|
+
m(x instanceof Error ? x.message : "Failed to load members");
|
|
2379
2385
|
}
|
|
2380
2386
|
}, [a]);
|
|
2381
2387
|
return {
|
|
@@ -2386,7 +2392,7 @@ function na() {
|
|
|
2386
2392
|
isLoading: i,
|
|
2387
2393
|
error: p,
|
|
2388
2394
|
setError: m,
|
|
2389
|
-
refresh:
|
|
2395
|
+
refresh: b,
|
|
2390
2396
|
selectOrg: w,
|
|
2391
2397
|
createOrg: y,
|
|
2392
2398
|
updateOrg: C,
|
|
@@ -2431,8 +2437,8 @@ function oa() {
|
|
|
2431
2437
|
o(!0), u(null), c(null);
|
|
2432
2438
|
try {
|
|
2433
2439
|
return await a.auth.changePassword(p, m), c("Password changed successfully"), !0;
|
|
2434
|
-
} catch (
|
|
2435
|
-
return u(
|
|
2440
|
+
} catch (b) {
|
|
2441
|
+
return u(b instanceof Error ? b.message : "Failed to change password"), !1;
|
|
2436
2442
|
} finally {
|
|
2437
2443
|
o(!1);
|
|
2438
2444
|
}
|
|
@@ -2482,7 +2488,7 @@ const ia = '<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d=
|
|
|
2482
2488
|
image: "image"
|
|
2483
2489
|
};
|
|
2484
2490
|
function ee({ appearance: a, signUpUrl: s, onSignUp: t }) {
|
|
2485
|
-
const { appearance: o, settings: n } = L(), { signIn: u, signInWithOAuth: l, submitMfaCode: c, isLoading: d, error: i, setError: f } = sa(), p = a ?? o, [m,
|
|
2491
|
+
const { appearance: o, settings: n } = L(), { signIn: u, signInWithOAuth: l, submitMfaCode: c, isLoading: d, error: i, setError: f } = sa(), p = a ?? o, [m, b] = g(""), [w, y] = g(""), [C, h] = g(!1), [N, k] = g(!1), [z, E] = g(""), [I, A] = g(["", "", "", "", "", ""]), S = W([]), x = $(
|
|
2486
2492
|
async (T) => {
|
|
2487
2493
|
if (T.preventDefault(), N) {
|
|
2488
2494
|
await c(z, I.join(""));
|
|
@@ -2550,7 +2556,7 @@ function ee({ appearance: a, signUpUrl: s, onSignUp: t }) {
|
|
|
2550
2556
|
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: P.errorOutline }),
|
|
2551
2557
|
/* @__PURE__ */ e("span", { children: i })
|
|
2552
2558
|
] }),
|
|
2553
|
-
/* @__PURE__ */ r("form", { onSubmit:
|
|
2559
|
+
/* @__PURE__ */ r("form", { onSubmit: x, children: [
|
|
2554
2560
|
N ? /* @__PURE__ */ r(G, { children: [
|
|
2555
2561
|
/* @__PURE__ */ e("div", { className: "ss-auth-mfa-divider", children: /* @__PURE__ */ e("span", { children: "Verification Required" }) }),
|
|
2556
2562
|
/* @__PURE__ */ r("div", { className: "ss-auth-field", children: [
|
|
@@ -2586,7 +2592,7 @@ function ee({ appearance: a, signUpUrl: s, onSignUp: t }) {
|
|
|
2586
2592
|
autoComplete: "email",
|
|
2587
2593
|
placeholder: "name@company.com",
|
|
2588
2594
|
value: m,
|
|
2589
|
-
onChange: (T) =>
|
|
2595
|
+
onChange: (T) => b(T.target.value),
|
|
2590
2596
|
required: !0
|
|
2591
2597
|
}
|
|
2592
2598
|
)
|
|
@@ -2645,27 +2651,27 @@ function ee({ appearance: a, signUpUrl: s, onSignUp: t }) {
|
|
|
2645
2651
|
] }) }) });
|
|
2646
2652
|
}
|
|
2647
2653
|
function te({ appearance: a, signInUrl: s, onSignIn: t }) {
|
|
2648
|
-
const { appearance: o, settings: n } = L(), { signUp: u, isLoading: l, error: c, setError: d } = Ca(), { signInWithOAuth: i } = sa(), f = a ?? o, [p, m] = g(""), [
|
|
2649
|
-
async (
|
|
2650
|
-
if (
|
|
2654
|
+
const { appearance: o, settings: n } = L(), { signUp: u, isLoading: l, error: c, setError: d } = Ca(), { signInWithOAuth: i } = sa(), f = a ?? o, [p, m] = g(""), [b, w] = g(""), [y, C] = g(""), [h, N] = g(!1), [k, z] = g(null), E = $(
|
|
2655
|
+
async (x) => {
|
|
2656
|
+
if (x.preventDefault(), z(null), b !== y) {
|
|
2651
2657
|
z("Passwords do not match");
|
|
2652
2658
|
return;
|
|
2653
2659
|
}
|
|
2654
2660
|
const v = (n == null ? void 0 : n.passwordMinLength) ?? 8;
|
|
2655
|
-
if (
|
|
2661
|
+
if (b.length < v) {
|
|
2656
2662
|
z(`Password must be at least ${v} characters`);
|
|
2657
2663
|
return;
|
|
2658
2664
|
}
|
|
2659
|
-
await u(p,
|
|
2665
|
+
await u(p, b);
|
|
2660
2666
|
},
|
|
2661
|
-
[p,
|
|
2667
|
+
[p, b, y, n, u]
|
|
2662
2668
|
), I = $(
|
|
2663
|
-
async (
|
|
2664
|
-
await i(
|
|
2669
|
+
async (x) => {
|
|
2670
|
+
await i(x);
|
|
2665
2671
|
},
|
|
2666
2672
|
[i]
|
|
2667
2673
|
), A = (n == null ? void 0 : n.googleEnabled) || (n == null ? void 0 : n.githubEnabled), S = k || c;
|
|
2668
|
-
return /* @__PURE__ */ e(q, { appearance: f, children: /* @__PURE__ */ r("div", { style: { display: "flex", flexDirection: "column", alignItems: "center", width: "100%", maxWidth: "
|
|
2674
|
+
return /* @__PURE__ */ e(q, { appearance: f, children: /* @__PURE__ */ r("div", { style: { display: "flex", flexDirection: "column", alignItems: "center", width: "100%", maxWidth: "520px" }, children: [
|
|
2669
2675
|
/* @__PURE__ */ r("div", { className: "ss-auth-header", children: [
|
|
2670
2676
|
/* @__PURE__ */ e("div", { className: "ss-auth-brand-icon-gradient", children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: P.autoAwesome }) }),
|
|
2671
2677
|
/* @__PURE__ */ e("h1", { className: "ss-auth-title ss-auth-title-lg", children: "Create your account" }),
|
|
@@ -2719,7 +2725,7 @@ function te({ appearance: a, signInUrl: s, onSignIn: t }) {
|
|
|
2719
2725
|
autoComplete: "email",
|
|
2720
2726
|
placeholder: "name@company.com",
|
|
2721
2727
|
value: p,
|
|
2722
|
-
onChange: (
|
|
2728
|
+
onChange: (x) => m(x.target.value),
|
|
2723
2729
|
required: !0
|
|
2724
2730
|
}
|
|
2725
2731
|
)
|
|
@@ -2735,9 +2741,9 @@ function te({ appearance: a, signInUrl: s, onSignIn: t }) {
|
|
|
2735
2741
|
type: h ? "text" : "password",
|
|
2736
2742
|
autoComplete: "new-password",
|
|
2737
2743
|
placeholder: "••••••••",
|
|
2738
|
-
value:
|
|
2739
|
-
onChange: (
|
|
2740
|
-
w(
|
|
2744
|
+
value: b,
|
|
2745
|
+
onChange: (x) => {
|
|
2746
|
+
w(x.target.value), z(null);
|
|
2741
2747
|
},
|
|
2742
2748
|
required: !0
|
|
2743
2749
|
}
|
|
@@ -2764,8 +2770,8 @@ function te({ appearance: a, signInUrl: s, onSignIn: t }) {
|
|
|
2764
2770
|
autoComplete: "new-password",
|
|
2765
2771
|
placeholder: "••••••••",
|
|
2766
2772
|
value: y,
|
|
2767
|
-
onChange: (
|
|
2768
|
-
C(
|
|
2773
|
+
onChange: (x) => {
|
|
2774
|
+
C(x.target.value), z(null);
|
|
2769
2775
|
},
|
|
2770
2776
|
required: !0
|
|
2771
2777
|
}
|
|
@@ -2787,11 +2793,11 @@ function te({ appearance: a, signInUrl: s, onSignIn: t }) {
|
|
|
2787
2793
|
}
|
|
2788
2794
|
const B = 320, j = 128;
|
|
2789
2795
|
function Pa({ file: a, onCrop: s, onCancel: t }) {
|
|
2790
|
-
const o = W(null), n = W(null), [u, l] = g(1), [c, d] = g({ x: 0, y: 0 }), [i, f] = g(!1), p = W({ x: 0, y: 0, ox: 0, oy: 0 }), [m,
|
|
2796
|
+
const o = W(null), n = W(null), [u, l] = g(1), [c, d] = g({ x: 0, y: 0 }), [i, f] = g(!1), p = W({ x: 0, y: 0, ox: 0, oy: 0 }), [m, b] = g(!1);
|
|
2791
2797
|
V(() => {
|
|
2792
2798
|
const h = new Image(), N = URL.createObjectURL(a);
|
|
2793
2799
|
return h.onload = () => {
|
|
2794
|
-
n.current = h,
|
|
2800
|
+
n.current = h, b(!0), d({ x: 0, y: 0 }), l(1);
|
|
2795
2801
|
}, h.src = N, () => URL.revokeObjectURL(N);
|
|
2796
2802
|
}, [a]), V(() => {
|
|
2797
2803
|
if (!m || !n.current || !o.current) return;
|
|
@@ -2822,8 +2828,8 @@ function Pa({ file: a, onCrop: s, onCancel: t }) {
|
|
|
2822
2828
|
h.width = N, h.height = N;
|
|
2823
2829
|
const k = h.getContext("2d");
|
|
2824
2830
|
if (!k) return;
|
|
2825
|
-
const z = n.current, E = Math.max(B / z.width, B / z.height) * u, I = z.width * E, A = z.height * E, S = (B - I) / 2 + c.x - (B / 2 - j),
|
|
2826
|
-
k.beginPath(), k.arc(j, j, j, 0, Math.PI * 2), k.clip(), k.drawImage(z, S,
|
|
2831
|
+
const z = n.current, E = Math.max(B / z.width, B / z.height) * u, I = z.width * E, A = z.height * E, S = (B - I) / 2 + c.x - (B / 2 - j), x = (B - A) / 2 + c.y - (B / 2 - j);
|
|
2832
|
+
k.beginPath(), k.arc(j, j, j, 0, Math.PI * 2), k.clip(), k.drawImage(z, S, x, I, A), h.toBlob((v) => {
|
|
2827
2833
|
v && s(v);
|
|
2828
2834
|
}, "image/png");
|
|
2829
2835
|
}, [u, c, s]), /* @__PURE__ */ r("div", { style: { display: "flex", flexDirection: "column", alignItems: "center", gap: "24px" }, children: [
|
|
@@ -2861,31 +2867,31 @@ function Pa({ file: a, onCrop: s, onCancel: t }) {
|
|
|
2861
2867
|
] });
|
|
2862
2868
|
}
|
|
2863
2869
|
function ca({ onUpload: a, onClose: s, isLoading: t }) {
|
|
2864
|
-
const [o, n] = g(null), [u, l] = g(!1), [c, d] = g(null), i = W(null), f = $((
|
|
2865
|
-
if (!
|
|
2870
|
+
const [o, n] = g(null), [u, l] = g(!1), [c, d] = g(null), i = W(null), f = $((b) => {
|
|
2871
|
+
if (!b.type.startsWith("image/")) {
|
|
2866
2872
|
d("Please select an image file");
|
|
2867
2873
|
return;
|
|
2868
2874
|
}
|
|
2869
|
-
if (
|
|
2875
|
+
if (b.size > 5 * 1024 * 1024) {
|
|
2870
2876
|
d("Image must be smaller than 5 MB");
|
|
2871
2877
|
return;
|
|
2872
2878
|
}
|
|
2873
|
-
d(null), n(
|
|
2879
|
+
d(null), n(b);
|
|
2874
2880
|
}, []), p = $(
|
|
2875
|
-
(
|
|
2876
|
-
|
|
2877
|
-
const w =
|
|
2881
|
+
(b) => {
|
|
2882
|
+
b.preventDefault(), l(!1);
|
|
2883
|
+
const w = b.dataTransfer.files[0];
|
|
2878
2884
|
w && f(w);
|
|
2879
2885
|
},
|
|
2880
2886
|
[f]
|
|
2881
2887
|
), m = $(
|
|
2882
|
-
async (
|
|
2883
|
-
await a(
|
|
2888
|
+
async (b) => {
|
|
2889
|
+
await a(b);
|
|
2884
2890
|
},
|
|
2885
2891
|
[a]
|
|
2886
2892
|
);
|
|
2887
|
-
return /* @__PURE__ */ e("div", { className: "ss-auth-modal-overlay", onClick: (
|
|
2888
|
-
|
|
2893
|
+
return /* @__PURE__ */ e("div", { className: "ss-auth-modal-overlay", onClick: (b) => {
|
|
2894
|
+
b.target === b.currentTarget && s();
|
|
2889
2895
|
}, children: /* @__PURE__ */ r("div", { className: "ss-auth-modal ss-auth-card-wide", children: [
|
|
2890
2896
|
/* @__PURE__ */ r("div", { className: "ss-auth-modal-header", children: [
|
|
2891
2897
|
/* @__PURE__ */ e("h2", { children: "Upload avatar" }),
|
|
@@ -2921,14 +2927,14 @@ function ca({ onUpload: a, onClose: s, isLoading: t }) {
|
|
|
2921
2927
|
"div",
|
|
2922
2928
|
{
|
|
2923
2929
|
className: `ss-auth-dropzone${u ? " ss-auth-dropzone-active" : ""}`,
|
|
2924
|
-
onDragOver: (
|
|
2925
|
-
|
|
2930
|
+
onDragOver: (b) => {
|
|
2931
|
+
b.preventDefault(), l(!0);
|
|
2926
2932
|
},
|
|
2927
2933
|
onDragLeave: () => l(!1),
|
|
2928
2934
|
onDrop: p,
|
|
2929
2935
|
onClick: () => {
|
|
2930
|
-
var
|
|
2931
|
-
return (
|
|
2936
|
+
var b;
|
|
2937
|
+
return (b = i.current) == null ? void 0 : b.click();
|
|
2932
2938
|
},
|
|
2933
2939
|
style: { minHeight: "180px" },
|
|
2934
2940
|
children: [
|
|
@@ -2947,9 +2953,9 @@ function ca({ onUpload: a, onClose: s, isLoading: t }) {
|
|
|
2947
2953
|
type: "file",
|
|
2948
2954
|
accept: "image/*",
|
|
2949
2955
|
style: { display: "none" },
|
|
2950
|
-
onChange: (
|
|
2956
|
+
onChange: (b) => {
|
|
2951
2957
|
var w;
|
|
2952
|
-
(w =
|
|
2958
|
+
(w = b.target.files) != null && w[0] && f(b.target.files[0]);
|
|
2953
2959
|
}
|
|
2954
2960
|
}
|
|
2955
2961
|
)
|
|
@@ -2992,19 +2998,19 @@ function re({
|
|
|
2992
2998
|
onOrgChange: n,
|
|
2993
2999
|
onOrgSettingsClick: u
|
|
2994
3000
|
}) {
|
|
2995
|
-
const { appearance: l } = L(), { user: c, signOut: d } = ta(), i = a ?? l, [f, p] = g(!1), [m,
|
|
3001
|
+
const { appearance: l } = L(), { user: c, signOut: d } = ta(), i = a ?? l, [f, p] = g(!1), [m, b] = g(!1), [w, y] = g(""), [C, h] = g(null), [N, k] = g(!1), z = W(null), { orgs: E, selectedOrg: I, selectOrg: A, createOrg: S } = na(), x = $((O) => {
|
|
2996
3002
|
z.current && !O.composedPath().includes(z.current) && p(!1);
|
|
2997
3003
|
}, []);
|
|
2998
3004
|
V(() => {
|
|
2999
3005
|
if (f) {
|
|
3000
3006
|
const O = setTimeout(() => {
|
|
3001
|
-
document.addEventListener("click",
|
|
3007
|
+
document.addEventListener("click", x);
|
|
3002
3008
|
}, 0);
|
|
3003
3009
|
return () => {
|
|
3004
|
-
clearTimeout(O), document.removeEventListener("click",
|
|
3010
|
+
clearTimeout(O), document.removeEventListener("click", x);
|
|
3005
3011
|
};
|
|
3006
3012
|
}
|
|
3007
|
-
}, [f,
|
|
3013
|
+
}, [f, x]);
|
|
3008
3014
|
const v = $(
|
|
3009
3015
|
async (O) => {
|
|
3010
3016
|
O.preventDefault(), h(null), k(!0);
|
|
@@ -3061,7 +3067,7 @@ function re({
|
|
|
3061
3067
|
type: "button",
|
|
3062
3068
|
className: "ss-auth-dropdown-action",
|
|
3063
3069
|
onClick: () => {
|
|
3064
|
-
p(!1),
|
|
3070
|
+
p(!1), b(!0);
|
|
3065
3071
|
},
|
|
3066
3072
|
children: [
|
|
3067
3073
|
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: P.person }),
|
|
@@ -3152,14 +3158,14 @@ function re({
|
|
|
3152
3158
|
m && /* @__PURE__ */ e(
|
|
3153
3159
|
Oa,
|
|
3154
3160
|
{
|
|
3155
|
-
onClose: () =>
|
|
3161
|
+
onClose: () => b(!1),
|
|
3156
3162
|
afterDeleteAccountUrl: t
|
|
3157
3163
|
}
|
|
3158
3164
|
)
|
|
3159
3165
|
] }) }) : null;
|
|
3160
3166
|
}
|
|
3161
3167
|
function Oa({ onClose: a, afterDeleteAccountUrl: s }) {
|
|
3162
|
-
const { user: t, updateProfile: o, uploadAvatar: n, changePassword: u, isLoading: l, error: c, success: d, setError: i, setSuccess: f } = oa(), { signOut: p } = ta(), { deleteAccount: m, isLoading:
|
|
3168
|
+
const { user: t, updateProfile: o, uploadAvatar: n, changePassword: u, isLoading: l, error: c, success: d, setError: i, setSuccess: f } = oa(), { signOut: p } = ta(), { deleteAccount: m, isLoading: b, error: w, setError: y } = za(), [C, h] = g((t == null ? void 0 : t.name) ?? ""), [N, k] = g((t == null ? void 0 : t.avatarUrl) ?? ""), [z, E] = g(!1), [I, A] = g(""), [S, x] = g(""), [v, O] = g(""), [D, H] = g(null), [T, M] = g(!1), [F, R] = g(""), Z = $(
|
|
3163
3169
|
async (U) => {
|
|
3164
3170
|
U.preventDefault(), i(null), f(null), await o({ name: C, avatarUrl: N || void 0 });
|
|
3165
3171
|
},
|
|
@@ -3180,7 +3186,7 @@ function Oa({ onClose: a, afterDeleteAccountUrl: s }) {
|
|
|
3180
3186
|
H("Password must be at least 8 characters");
|
|
3181
3187
|
return;
|
|
3182
3188
|
}
|
|
3183
|
-
await u(I, S) && (A(""),
|
|
3189
|
+
await u(I, S) && (A(""), x(""), O(""));
|
|
3184
3190
|
},
|
|
3185
3191
|
[I, S, v, u, i, f]
|
|
3186
3192
|
), pa = $(async () => {
|
|
@@ -3279,7 +3285,7 @@ function Oa({ onClose: a, afterDeleteAccountUrl: s }) {
|
|
|
3279
3285
|
/* @__PURE__ */ r("div", { className: "ss-auth-profile-grid", style: { marginBottom: "16px" }, children: [
|
|
3280
3286
|
/* @__PURE__ */ r("div", { children: [
|
|
3281
3287
|
/* @__PURE__ */ e("label", { className: "ss-auth-label", children: "New Password" }),
|
|
3282
|
-
/* @__PURE__ */ e("input", { className: "ss-auth-input", type: "password", placeholder: "Min. 8 characters", value: S, onChange: (U) =>
|
|
3288
|
+
/* @__PURE__ */ e("input", { className: "ss-auth-input", type: "password", placeholder: "Min. 8 characters", value: S, onChange: (U) => x(U.target.value), required: !0 })
|
|
3283
3289
|
] }),
|
|
3284
3290
|
/* @__PURE__ */ r("div", { children: [
|
|
3285
3291
|
/* @__PURE__ */ e("label", { className: "ss-auth-label", children: "Confirm New Password" }),
|
|
@@ -3329,10 +3335,10 @@ function Oa({ onClose: a, afterDeleteAccountUrl: s }) {
|
|
|
3329
3335
|
type: "button",
|
|
3330
3336
|
className: "ss-auth-btn-primary ss-auth-btn-sm",
|
|
3331
3337
|
style: { width: "auto", background: "linear-gradient(135deg, #ef4444, #dc2626)" },
|
|
3332
|
-
disabled: !ga ||
|
|
3338
|
+
disabled: !ga || b,
|
|
3333
3339
|
onClick: pa,
|
|
3334
3340
|
children: [
|
|
3335
|
-
|
|
3341
|
+
b && /* @__PURE__ */ e("span", { className: "ss-auth-spinner" }),
|
|
3336
3342
|
"Delete account"
|
|
3337
3343
|
]
|
|
3338
3344
|
}
|
|
@@ -3361,11 +3367,11 @@ function Oa({ onClose: a, afterDeleteAccountUrl: s }) {
|
|
|
3361
3367
|
] }) });
|
|
3362
3368
|
}
|
|
3363
3369
|
function se({ appearance: a }) {
|
|
3364
|
-
const { appearance: s } = L(), { user: t, signOut: o } = ta(), { updateProfile: n, uploadAvatar: u, changePassword: l, isLoading: c, error: d, success: i, setError: f, setSuccess: p } = oa(), m = a ?? s, [
|
|
3370
|
+
const { appearance: s } = L(), { user: t, signOut: o } = ta(), { updateProfile: n, uploadAvatar: u, changePassword: l, isLoading: c, error: d, success: i, setError: f, setSuccess: p } = oa(), m = a ?? s, [b, w] = g((t == null ? void 0 : t.name) ?? ""), [y, C] = g((t == null ? void 0 : t.avatarUrl) ?? ""), [h, N] = g(!1), [k, z] = g(""), [E, I] = g(""), [A, S] = g(""), [x, v] = g(null), O = $(
|
|
3365
3371
|
async (F) => {
|
|
3366
|
-
F.preventDefault(), f(null), p(null), await n({ name:
|
|
3372
|
+
F.preventDefault(), f(null), p(null), await n({ name: b, avatarUrl: y || void 0 });
|
|
3367
3373
|
},
|
|
3368
|
-
[
|
|
3374
|
+
[b, y, n, f, p]
|
|
3369
3375
|
), D = $(
|
|
3370
3376
|
async (F) => {
|
|
3371
3377
|
const R = await u(F);
|
|
@@ -3435,7 +3441,7 @@ function se({ appearance: a }) {
|
|
|
3435
3441
|
className: "ss-auth-input",
|
|
3436
3442
|
type: "text",
|
|
3437
3443
|
placeholder: "Your name",
|
|
3438
|
-
value:
|
|
3444
|
+
value: b,
|
|
3439
3445
|
onChange: (F) => w(F.target.value)
|
|
3440
3446
|
}
|
|
3441
3447
|
)
|
|
@@ -3467,9 +3473,9 @@ function se({ appearance: a }) {
|
|
|
3467
3473
|
"Security Credentials"
|
|
3468
3474
|
] }),
|
|
3469
3475
|
/* @__PURE__ */ e("p", { className: "ss-auth-section-desc", style: { marginBottom: "24px" }, children: "Update your password to keep your account secure." }),
|
|
3470
|
-
|
|
3476
|
+
x && /* @__PURE__ */ r("div", { className: "ss-auth-error", children: [
|
|
3471
3477
|
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: P.errorOutline }),
|
|
3472
|
-
/* @__PURE__ */ e("span", { children:
|
|
3478
|
+
/* @__PURE__ */ e("span", { children: x })
|
|
3473
3479
|
] }),
|
|
3474
3480
|
/* @__PURE__ */ r("form", { onSubmit: H, children: [
|
|
3475
3481
|
/* @__PURE__ */ r("div", { className: "ss-auth-field", children: [
|
|
@@ -3554,26 +3560,26 @@ function se({ appearance: a }) {
|
|
|
3554
3560
|
] }) });
|
|
3555
3561
|
}
|
|
3556
3562
|
function ne({ appearance: a, onOrgChange: s }) {
|
|
3557
|
-
const { appearance: t } = L(), { orgs: o, selectedOrg: n, selectOrg: u, createOrg: l, isLoading: c } = na(), d = a ?? t, [i, f] = g(!1), [p, m] = g(""), [
|
|
3558
|
-
k.current && !
|
|
3563
|
+
const { appearance: t } = L(), { orgs: o, selectedOrg: n, selectOrg: u, createOrg: l, isLoading: c } = na(), d = a ?? t, [i, f] = g(!1), [p, m] = g(""), [b, w] = g(""), [y, C] = g(null), [h, N] = g(!1), k = W(null), z = $((x) => {
|
|
3564
|
+
k.current && !x.composedPath().includes(k.current) && f(!1);
|
|
3559
3565
|
}, []);
|
|
3560
3566
|
V(() => {
|
|
3561
3567
|
if (i) {
|
|
3562
|
-
const
|
|
3568
|
+
const x = setTimeout(() => {
|
|
3563
3569
|
document.addEventListener("click", z);
|
|
3564
3570
|
}, 0);
|
|
3565
3571
|
return () => {
|
|
3566
|
-
clearTimeout(
|
|
3572
|
+
clearTimeout(x), document.removeEventListener("click", z);
|
|
3567
3573
|
};
|
|
3568
3574
|
}
|
|
3569
3575
|
}, [i, z]);
|
|
3570
|
-
const E = $((
|
|
3571
|
-
m(
|
|
3576
|
+
const E = $((x) => {
|
|
3577
|
+
m(x), w(x.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, ""));
|
|
3572
3578
|
}, []), I = $(
|
|
3573
|
-
async (
|
|
3574
|
-
|
|
3579
|
+
async (x) => {
|
|
3580
|
+
x.preventDefault(), C(null), N(!0);
|
|
3575
3581
|
try {
|
|
3576
|
-
const v = await l(p,
|
|
3582
|
+
const v = await l(p, b);
|
|
3577
3583
|
v && (await u(v.id), s == null || s(v), m(""), w(""), f(!1));
|
|
3578
3584
|
} catch (v) {
|
|
3579
3585
|
C(v instanceof Error ? v.message : "Failed to create organization");
|
|
@@ -3581,10 +3587,10 @@ function ne({ appearance: a, onOrgChange: s }) {
|
|
|
3581
3587
|
N(!1);
|
|
3582
3588
|
}
|
|
3583
3589
|
},
|
|
3584
|
-
[p,
|
|
3590
|
+
[p, b, l, u, s]
|
|
3585
3591
|
);
|
|
3586
3592
|
if (c) return null;
|
|
3587
|
-
const A = (n == null ? void 0 : n.name) ?? (o.length === 0 ? "No organization" : "Select organization"), S = n ? n.name.split(" ").map((
|
|
3593
|
+
const A = (n == null ? void 0 : n.name) ?? (o.length === 0 ? "No organization" : "Select organization"), S = n ? n.name.split(" ").map((x) => x[0]).join("").slice(0, 2).toUpperCase() : "--";
|
|
3588
3594
|
return /* @__PURE__ */ e(q, { appearance: d, children: /* @__PURE__ */ r("div", { style: { position: "relative", display: "inline-block", width: "100%", maxWidth: "360px" }, ref: k, children: [
|
|
3589
3595
|
/* @__PURE__ */ r(
|
|
3590
3596
|
"button",
|
|
@@ -3606,25 +3612,25 @@ function ne({ appearance: a, onOrgChange: s }) {
|
|
|
3606
3612
|
),
|
|
3607
3613
|
i && /* @__PURE__ */ r("div", { className: "ss-auth-dropdown ss-auth-dropdown-left ss-auth-glass-panel", style: { width: "100%" }, children: [
|
|
3608
3614
|
/* @__PURE__ */ e("div", { className: "ss-auth-section-label", children: "Your Organizations" }),
|
|
3609
|
-
/* @__PURE__ */ e("div", { style: { padding: "0 8px 4px" }, children: o.map((
|
|
3610
|
-
const v = (n == null ? void 0 : n.id) ===
|
|
3615
|
+
/* @__PURE__ */ e("div", { style: { padding: "0 8px 4px" }, children: o.map((x) => {
|
|
3616
|
+
const v = (n == null ? void 0 : n.id) === x.id, O = x.name.split(" ").map((D) => D[0]).join("").slice(0, 2).toUpperCase();
|
|
3611
3617
|
return /* @__PURE__ */ r(
|
|
3612
3618
|
"button",
|
|
3613
3619
|
{
|
|
3614
3620
|
type: "button",
|
|
3615
3621
|
className: `ss-auth-org-item${v ? " ss-auth-org-item-active" : ""}`,
|
|
3616
3622
|
onClick: async () => {
|
|
3617
|
-
f(!1), await u(
|
|
3623
|
+
f(!1), await u(x.id), s == null || s(x);
|
|
3618
3624
|
},
|
|
3619
3625
|
children: [
|
|
3620
3626
|
/* @__PURE__ */ r("div", { className: "ss-auth-org-item-inner", children: [
|
|
3621
3627
|
/* @__PURE__ */ e("div", { className: `ss-auth-org-avatar${v ? "" : " ss-auth-org-avatar-inactive"}`, children: O }),
|
|
3622
|
-
/* @__PURE__ */ e("span", { style: { fontFamily: "'Manrope', sans-serif", letterSpacing: "-0.01em" }, children:
|
|
3628
|
+
/* @__PURE__ */ e("span", { style: { fontFamily: "'Manrope', sans-serif", letterSpacing: "-0.01em" }, children: x.name })
|
|
3623
3629
|
] }),
|
|
3624
3630
|
v && /* @__PURE__ */ e("span", { className: "material-symbols-outlined ss-auth-org-check", style: { fontSize: "18px" }, children: P.checkCircle })
|
|
3625
3631
|
]
|
|
3626
3632
|
},
|
|
3627
|
-
|
|
3633
|
+
x.id
|
|
3628
3634
|
);
|
|
3629
3635
|
}) }),
|
|
3630
3636
|
/* @__PURE__ */ r("div", { className: "ss-auth-org-create", children: [
|
|
@@ -3643,7 +3649,7 @@ function ne({ appearance: a, onOrgChange: s }) {
|
|
|
3643
3649
|
type: "text",
|
|
3644
3650
|
placeholder: "e.g. Nexus Dynamics",
|
|
3645
3651
|
value: p,
|
|
3646
|
-
onChange: (
|
|
3652
|
+
onChange: (x) => E(x.target.value),
|
|
3647
3653
|
required: !0,
|
|
3648
3654
|
style: { fontSize: "13px", padding: "10px 12px" }
|
|
3649
3655
|
}
|
|
@@ -3659,8 +3665,8 @@ function ne({ appearance: a, onOrgChange: s }) {
|
|
|
3659
3665
|
className: "ss-auth-input",
|
|
3660
3666
|
type: "text",
|
|
3661
3667
|
placeholder: "nexus-dynamics",
|
|
3662
|
-
value:
|
|
3663
|
-
onChange: (
|
|
3668
|
+
value: b,
|
|
3669
|
+
onChange: (x) => w(x.target.value),
|
|
3664
3670
|
required: !0,
|
|
3665
3671
|
style: { fontSize: "13px", padding: "10px 12px 10px 22px" }
|
|
3666
3672
|
}
|
|
@@ -3938,7 +3944,7 @@ function le({
|
|
|
3938
3944
|
] }) });
|
|
3939
3945
|
}
|
|
3940
3946
|
function ce({ customerId: a, portalToken: s, onApplied: t, appearance: o }) {
|
|
3941
|
-
const { appearance: n } = L(), u = Q(s), l = o ?? n, [c, d] = g(""), [i, f] = g(!1), [p, m] = g(null), [
|
|
3947
|
+
const { appearance: n } = L(), u = Q(s), l = o ?? n, [c, d] = g(""), [i, f] = g(!1), [p, m] = g(null), [b, w] = g(null), y = $(async (C) => {
|
|
3942
3948
|
if (C.preventDefault(), !!c.trim()) {
|
|
3943
3949
|
f(!0), m(null), w(null);
|
|
3944
3950
|
try {
|
|
@@ -3954,7 +3960,7 @@ function ce({ customerId: a, portalToken: s, onApplied: t, appearance: o }) {
|
|
|
3954
3960
|
return /* @__PURE__ */ e(q, { appearance: l, children: /* @__PURE__ */ r("div", { className: "ss-card", children: [
|
|
3955
3961
|
/* @__PURE__ */ e("h2", { className: "ss-title", children: "Apply coupon" }),
|
|
3956
3962
|
p && /* @__PURE__ */ e("div", { className: "ss-global-error", children: p }),
|
|
3957
|
-
|
|
3963
|
+
b && /* @__PURE__ */ e("div", { className: "ss-success-msg", children: b }),
|
|
3958
3964
|
/* @__PURE__ */ r("form", { onSubmit: y, children: [
|
|
3959
3965
|
/* @__PURE__ */ r("div", { className: "ss-field", children: [
|
|
3960
3966
|
/* @__PURE__ */ e("label", { className: "ss-label", htmlFor: "ss-coupon-code", children: "Coupon code" }),
|
|
@@ -4048,7 +4054,7 @@ function pe(a, s, t = "https://api.saas-support.com/v1") {
|
|
|
4048
4054
|
}, [f]), { dashboard: n, reportClient: o, isLoading: l, error: d, refresh: f };
|
|
4049
4055
|
}
|
|
4050
4056
|
function he({ onResult: a, mode: s = "both", placeholder: t, appearance: o }) {
|
|
4051
|
-
const { appearance: n } = L(), { execute: u, isLoading: l, error: c } = da(), d = o ?? n, [i, f] = g(""), [p, m] = g(s === "sql" ? "sql" : "nl"),
|
|
4057
|
+
const { appearance: n } = L(), { execute: u, isLoading: l, error: c } = da(), d = o ?? n, [i, f] = g(""), [p, m] = g(s === "sql" ? "sql" : "nl"), b = $(async (w) => {
|
|
4052
4058
|
if (w.preventDefault(), !i.trim()) return;
|
|
4053
4059
|
const C = await u(p === "sql" ? { sql: i } : { naturalLanguage: i });
|
|
4054
4060
|
C && (a == null || a(C));
|
|
@@ -4075,7 +4081,7 @@ function he({ onResult: a, mode: s = "both", placeholder: t, appearance: o }) {
|
|
|
4075
4081
|
)
|
|
4076
4082
|
] }),
|
|
4077
4083
|
c && /* @__PURE__ */ e("div", { className: "ss-global-error", children: c }),
|
|
4078
|
-
/* @__PURE__ */ r("form", { onSubmit:
|
|
4084
|
+
/* @__PURE__ */ r("form", { onSubmit: b, children: [
|
|
4079
4085
|
/* @__PURE__ */ e("div", { className: "ss-field", children: /* @__PURE__ */ e(
|
|
4080
4086
|
"textarea",
|
|
4081
4087
|
{
|
|
@@ -4103,7 +4109,7 @@ function qa({ columns: a, rows: s, sortable: t = !0, maxRows: o, appearance: n }
|
|
|
4103
4109
|
return i === "asc" ? h - N : N - h;
|
|
4104
4110
|
const k = String(h), z = String(N);
|
|
4105
4111
|
return i === "asc" ? k.localeCompare(z) : z.localeCompare(k);
|
|
4106
|
-
}) : s, [s, c, i]), m = o ? p.slice(0, o) : p,
|
|
4112
|
+
}) : s, [s, c, i]), m = o ? p.slice(0, o) : p, b = (y) => {
|
|
4107
4113
|
t && (c === y ? f((C) => C === "asc" ? "desc" : "asc") : (d(y), f("asc")));
|
|
4108
4114
|
};
|
|
4109
4115
|
function w(y) {
|
|
@@ -4115,7 +4121,7 @@ function qa({ columns: a, rows: s, sortable: t = !0, maxRows: o, appearance: n }
|
|
|
4115
4121
|
"th",
|
|
4116
4122
|
{
|
|
4117
4123
|
className: `ss-th ${t ? "ss-th-sortable" : ""} ${c === y ? i === "asc" ? "ss-sorted-asc" : "ss-sorted-desc" : ""}`,
|
|
4118
|
-
onClick: () =>
|
|
4124
|
+
onClick: () => b(y),
|
|
4119
4125
|
children: [
|
|
4120
4126
|
y,
|
|
4121
4127
|
c === y && /* @__PURE__ */ e("span", { className: "ss-sort-indicator", children: i === "asc" ? " ▲" : " ▼" })
|
|
@@ -4147,18 +4153,18 @@ function Ra({ labels: a, values: s, w: t, h: o, colors: n }) {
|
|
|
4147
4153
|
return /* @__PURE__ */ r("g", { children: [
|
|
4148
4154
|
/* @__PURE__ */ e("line", { x1: l, y1: o - l, x2: t - l, y2: o - l, stroke: "#ccc", strokeWidth: 1 }),
|
|
4149
4155
|
s.map((f, p) => {
|
|
4150
|
-
const m = f / u * d,
|
|
4156
|
+
const m = f / u * d, b = l + c / a.length * p + 2, w = o - l - m;
|
|
4151
4157
|
return /* @__PURE__ */ r("g", { children: [
|
|
4152
|
-
/* @__PURE__ */ e("rect", { x, y: w, width: i, height: m, fill: n[p % n.length], rx: 2 }),
|
|
4153
|
-
/* @__PURE__ */ e("text", { x:
|
|
4158
|
+
/* @__PURE__ */ e("rect", { x: b, y: w, width: i, height: m, fill: n[p % n.length], rx: 2 }),
|
|
4159
|
+
/* @__PURE__ */ e("text", { x: b + i / 2, y: o - l + 14, textAnchor: "middle", fontSize: 10, fill: "#666", children: a[p].length > 8 ? a[p].slice(0, 8) + "..." : a[p] })
|
|
4154
4160
|
] }, p);
|
|
4155
4161
|
})
|
|
4156
4162
|
] });
|
|
4157
4163
|
}
|
|
4158
4164
|
function Wa({ labels: a, values: s, w: t, h: o, colors: n }) {
|
|
4159
4165
|
const u = Math.max(...s, 1), l = 40, c = t - l * 2, d = o - l * 2, i = a.length > 1 ? c / (a.length - 1) : 0, f = s.map((p, m) => {
|
|
4160
|
-
const
|
|
4161
|
-
return `${
|
|
4166
|
+
const b = l + i * m, w = o - l - p / u * d;
|
|
4167
|
+
return `${b},${w}`;
|
|
4162
4168
|
});
|
|
4163
4169
|
return /* @__PURE__ */ r("g", { children: [
|
|
4164
4170
|
[0.25, 0.5, 0.75, 1].map((p) => {
|
|
@@ -4167,20 +4173,20 @@ function Wa({ labels: a, values: s, w: t, h: o, colors: n }) {
|
|
|
4167
4173
|
}),
|
|
4168
4174
|
/* @__PURE__ */ e("polyline", { points: f.join(" "), fill: "none", stroke: n[0], strokeWidth: 2 }),
|
|
4169
4175
|
s.map((p, m) => {
|
|
4170
|
-
const
|
|
4171
|
-
return /* @__PURE__ */ e("circle", { cx:
|
|
4176
|
+
const b = l + i * m, w = o - l - p / u * d;
|
|
4177
|
+
return /* @__PURE__ */ e("circle", { cx: b, cy: w, r: 4, fill: n[0] }, m);
|
|
4172
4178
|
})
|
|
4173
4179
|
] });
|
|
4174
4180
|
}
|
|
4175
4181
|
function _a({ labels: a, values: s, w: t, h: o, colors: n }) {
|
|
4176
|
-
const u = s.reduce((m,
|
|
4182
|
+
const u = s.reduce((m, b) => m + b, 0) || 1, l = t / 2, c = o / 2 - 20, d = Math.min(t, o) / 2 - 40, i = 2 * Math.PI * d;
|
|
4177
4183
|
let f = 0;
|
|
4178
|
-
const p = s.map((m,
|
|
4179
|
-
const w = m / u, y = w * i, C = { dash: y, offset: f, color: n[
|
|
4184
|
+
const p = s.map((m, b) => {
|
|
4185
|
+
const w = m / u, y = w * i, C = { dash: y, offset: f, color: n[b % n.length], label: a[b], pct: w };
|
|
4180
4186
|
return f += y, C;
|
|
4181
4187
|
});
|
|
4182
4188
|
return /* @__PURE__ */ r("g", { children: [
|
|
4183
|
-
p.map((m,
|
|
4189
|
+
p.map((m, b) => /* @__PURE__ */ e(
|
|
4184
4190
|
"circle",
|
|
4185
4191
|
{
|
|
4186
4192
|
cx: l,
|
|
@@ -4193,12 +4199,12 @@ function _a({ labels: a, values: s, w: t, h: o, colors: n }) {
|
|
|
4193
4199
|
strokeDashoffset: -m.offset,
|
|
4194
4200
|
transform: `rotate(-90 ${l} ${c})`
|
|
4195
4201
|
},
|
|
4196
|
-
|
|
4202
|
+
b
|
|
4197
4203
|
)),
|
|
4198
|
-
/* @__PURE__ */ e("g", { transform: `translate(${l - a.length * 30}, ${o - 20})`, children: p.slice(0, 6).map((m,
|
|
4204
|
+
/* @__PURE__ */ e("g", { transform: `translate(${l - a.length * 30}, ${o - 20})`, children: p.slice(0, 6).map((m, b) => /* @__PURE__ */ r("g", { transform: `translate(${b * 60}, 0)`, children: [
|
|
4199
4205
|
/* @__PURE__ */ e("rect", { width: 10, height: 10, fill: m.color, rx: 2 }),
|
|
4200
4206
|
/* @__PURE__ */ e("text", { x: 14, y: 9, fontSize: 9, fill: "#666", children: m.label.length > 6 ? m.label.slice(0, 6) + ".." : m.label })
|
|
4201
|
-
] },
|
|
4207
|
+
] }, b)) })
|
|
4202
4208
|
] });
|
|
4203
4209
|
}
|
|
4204
4210
|
function Ga({ type: a, data: s, title: t, width: o = 400, height: n = 300, appearance: u }) {
|
|
@@ -4219,8 +4225,8 @@ function ge({ dashboardId: a, embedToken: s, baseUrl: t, refreshInterval: o, app
|
|
|
4219
4225
|
return new ea(N);
|
|
4220
4226
|
}
|
|
4221
4227
|
return u.client.report;
|
|
4222
|
-
}, [s, t, u]), [d, i] = g([]), [f, p] = g({}), [m,
|
|
4223
|
-
|
|
4228
|
+
}, [s, t, u]), [d, i] = g([]), [f, p] = g({}), [m, b] = g(!0), [w, y] = g(null), C = $(async () => {
|
|
4229
|
+
b(!0), y(null);
|
|
4224
4230
|
try {
|
|
4225
4231
|
const h = await c.getDashboard(a), N = JSON.parse(h.layoutJson || "[]");
|
|
4226
4232
|
i(N);
|
|
@@ -4238,7 +4244,7 @@ function ge({ dashboardId: a, embedToken: s, baseUrl: t, refreshInterval: o, app
|
|
|
4238
4244
|
} catch (h) {
|
|
4239
4245
|
y(h instanceof Error ? h.message : "Failed to load dashboard");
|
|
4240
4246
|
} finally {
|
|
4241
|
-
|
|
4247
|
+
b(!1);
|
|
4242
4248
|
}
|
|
4243
4249
|
}, [c, a]);
|
|
4244
4250
|
return V(() => {
|
|
@@ -4328,7 +4334,7 @@ function me({ embedToken: a, dashboardId: s, baseUrl: t = "https://api.saas-supp
|
|
|
4328
4334
|
const u = _(() => {
|
|
4329
4335
|
const y = new J(t, { type: "embedToken", token: a });
|
|
4330
4336
|
return new ea(y);
|
|
4331
|
-
}, [a, t]), [l, c] = g([]), [d, i] = g(!0), [f, p] = g(null), m = _(() => X(n), [n]),
|
|
4337
|
+
}, [a, t]), [l, c] = g([]), [d, i] = g(!0), [f, p] = g(null), m = _(() => X(n), [n]), b = _(() => aa(m), [m]), w = $(async () => {
|
|
4332
4338
|
i(!0), p(null);
|
|
4333
4339
|
try {
|
|
4334
4340
|
const y = await u.getDashboard(s), C = JSON.parse(y.layoutJson || "[]"), h = await Promise.all(
|
|
@@ -4363,7 +4369,7 @@ function me({ embedToken: a, dashboardId: s, baseUrl: t = "https://api.saas-supp
|
|
|
4363
4369
|
ref: (y) => {
|
|
4364
4370
|
if (!y || y.shadowRoot) return;
|
|
4365
4371
|
const C = y.attachShadow({ mode: "open" }), h = document.createElement("style");
|
|
4366
|
-
h.textContent =
|
|
4372
|
+
h.textContent = b, C.appendChild(h);
|
|
4367
4373
|
const N = document.createElement("div");
|
|
4368
4374
|
C.appendChild(N);
|
|
4369
4375
|
},
|