@saas-support/react 0.7.3 → 0.7.6
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 +18 -0
- package/dist/index.js +46 -24
- package/dist/react.cjs +23 -3
- package/dist/react.d.ts +35 -2
- package/dist/react.js +1364 -1237
- package/package.json +1 -1
package/dist/react.js
CHANGED
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
import { jsx as e, jsxs as t, Fragment as
|
|
2
|
-
import { createContext as
|
|
3
|
-
import { SaaSSupport as
|
|
4
|
-
import { SaaSError as
|
|
5
|
-
import { createPortal as
|
|
6
|
-
const
|
|
7
|
-
function
|
|
8
|
-
const a =
|
|
1
|
+
import { jsx as e, jsxs as t, Fragment as R } from "react/jsx-runtime";
|
|
2
|
+
import { createContext as fa, useContext as ba, useState as g, useEffect as U, useRef as W, useCallback as k, forwardRef as xa, useImperativeHandle as ya, useMemo as G } from "react";
|
|
3
|
+
import { SaaSSupport as va, isMfaRequired as wa, BillingClient as Na, Transport as Q, ReportClient as ta } from "./index.js";
|
|
4
|
+
import { SaaSError as Ce } from "./index.js";
|
|
5
|
+
import { createPortal as Sa } from "react-dom";
|
|
6
|
+
const na = fa(null);
|
|
7
|
+
function M() {
|
|
8
|
+
const a = ba(na);
|
|
9
9
|
if (!a)
|
|
10
10
|
throw new Error("useSaaSContext must be used within a <SaaSProvider>");
|
|
11
11
|
return a;
|
|
12
12
|
}
|
|
13
|
-
function
|
|
14
|
-
const [u] = g(() => new
|
|
15
|
-
return
|
|
16
|
-
let
|
|
13
|
+
function oe({ publishableKey: a, apiKey: r, baseUrl: s, appearance: i, children: n }) {
|
|
14
|
+
const [u] = g(() => new va({ publishableKey: a, apiKey: r, baseUrl: s })), [l, d] = g(null), [c, o] = g(!1), [m, p] = g(null);
|
|
15
|
+
return U(() => {
|
|
16
|
+
let h = !1;
|
|
17
17
|
u.load().then(async () => {
|
|
18
|
-
if (
|
|
19
|
-
const
|
|
20
|
-
|
|
18
|
+
if (h) return;
|
|
19
|
+
const x = await u.auth.getUser(), v = await u.auth.getSettings();
|
|
20
|
+
d(x), p(v), o(!0);
|
|
21
21
|
});
|
|
22
|
-
const
|
|
23
|
-
|
|
22
|
+
const y = u.auth.onAuthStateChange((x) => {
|
|
23
|
+
h || d(x);
|
|
24
24
|
});
|
|
25
25
|
return () => {
|
|
26
|
-
|
|
26
|
+
h = !0, y(), u.destroy();
|
|
27
27
|
};
|
|
28
|
-
}, [u]), /* @__PURE__ */ e(
|
|
28
|
+
}, [u]), /* @__PURE__ */ e(na.Provider, { value: { client: u, user: l, isLoaded: c, appearance: i, settings: m }, children: n });
|
|
29
29
|
}
|
|
30
|
-
const
|
|
30
|
+
const $a = {
|
|
31
31
|
// Legacy (unchanged)
|
|
32
32
|
colorPrimary: "#6366f1",
|
|
33
33
|
colorPrimaryHover: "#4f46e5",
|
|
@@ -61,7 +61,7 @@ const wa = {
|
|
|
61
61
|
authSuccess: "#22c55e",
|
|
62
62
|
authFontHeadline: "'Manrope', sans-serif",
|
|
63
63
|
authFontBody: "'Inter', sans-serif"
|
|
64
|
-
},
|
|
64
|
+
}, ka = {
|
|
65
65
|
// Legacy (unchanged)
|
|
66
66
|
colorPrimary: "#818cf8",
|
|
67
67
|
colorPrimaryHover: "#6366f1",
|
|
@@ -97,50 +97,50 @@ const wa = {
|
|
|
97
97
|
authFontBody: "'Inter', sans-serif"
|
|
98
98
|
};
|
|
99
99
|
function aa(a) {
|
|
100
|
-
const
|
|
100
|
+
const r = (a == null ? void 0 : a.baseTheme) === "dark" ? ka : $a, s = a == null ? void 0 : a.variables, i = (s == null ? void 0 : s.colorPrimary) ?? r.authPrimary;
|
|
101
101
|
return {
|
|
102
102
|
// Legacy
|
|
103
|
-
colorPrimary: (
|
|
104
|
-
colorPrimaryHover:
|
|
105
|
-
colorBackground: (
|
|
106
|
-
colorText: (
|
|
107
|
-
colorTextSecondary:
|
|
108
|
-
colorInputBackground: (
|
|
109
|
-
colorInputBorder: (
|
|
110
|
-
colorError: (
|
|
111
|
-
colorSuccess: (
|
|
112
|
-
colorWarning: (
|
|
113
|
-
fontFamily: (
|
|
114
|
-
borderRadius: (
|
|
103
|
+
colorPrimary: (s == null ? void 0 : s.colorPrimary) ?? r.colorPrimary,
|
|
104
|
+
colorPrimaryHover: s != null && s.colorPrimary ? Ca(s.colorPrimary, 10) : r.colorPrimaryHover,
|
|
105
|
+
colorBackground: (s == null ? void 0 : s.colorBackground) ?? r.colorBackground,
|
|
106
|
+
colorText: (s == null ? void 0 : s.colorText) ?? r.colorText,
|
|
107
|
+
colorTextSecondary: r.colorTextSecondary,
|
|
108
|
+
colorInputBackground: (s == null ? void 0 : s.colorInputBackground) ?? r.colorInputBackground,
|
|
109
|
+
colorInputBorder: (s == null ? void 0 : s.colorInputBorder) ?? r.colorInputBorder,
|
|
110
|
+
colorError: (s == null ? void 0 : s.colorError) ?? r.colorError,
|
|
111
|
+
colorSuccess: (s == null ? void 0 : s.colorSuccess) ?? r.colorSuccess,
|
|
112
|
+
colorWarning: (s == null ? void 0 : s.colorWarning) ?? r.colorWarning,
|
|
113
|
+
fontFamily: (s == null ? void 0 : s.fontFamily) ?? r.fontFamily,
|
|
114
|
+
borderRadius: (s == null ? void 0 : s.borderRadius) ?? r.borderRadius,
|
|
115
115
|
// MD3 auth — derive from user overrides where applicable
|
|
116
|
-
authPrimary:
|
|
117
|
-
authPrimaryContainer:
|
|
118
|
-
authOnPrimary:
|
|
119
|
-
authPrimaryFixed:
|
|
120
|
-
authSurface: (
|
|
121
|
-
authSurfaceContainerLowest:
|
|
122
|
-
authSurfaceContainerLow: (
|
|
123
|
-
authSurfaceContainer:
|
|
124
|
-
authSurfaceContainerHigh:
|
|
125
|
-
authSurfaceContainerHighest:
|
|
126
|
-
authOnSurface: (
|
|
127
|
-
authOnSurfaceVariant:
|
|
128
|
-
authOutline:
|
|
129
|
-
authOutlineVariant: (
|
|
130
|
-
authError: (
|
|
131
|
-
authErrorContainer:
|
|
132
|
-
authSuccess: (
|
|
133
|
-
authFontHeadline: (
|
|
134
|
-
authFontBody: (
|
|
116
|
+
authPrimary: i,
|
|
117
|
+
authPrimaryContainer: s != null && s.colorPrimary ? za(i, 15) : r.authPrimaryContainer,
|
|
118
|
+
authOnPrimary: r.authOnPrimary,
|
|
119
|
+
authPrimaryFixed: r.authPrimaryFixed,
|
|
120
|
+
authSurface: (s == null ? void 0 : s.colorBackground) ?? r.authSurface,
|
|
121
|
+
authSurfaceContainerLowest: r.authSurfaceContainerLowest,
|
|
122
|
+
authSurfaceContainerLow: (s == null ? void 0 : s.colorInputBackground) ?? r.authSurfaceContainerLow,
|
|
123
|
+
authSurfaceContainer: r.authSurfaceContainer,
|
|
124
|
+
authSurfaceContainerHigh: r.authSurfaceContainerHigh,
|
|
125
|
+
authSurfaceContainerHighest: r.authSurfaceContainerHighest,
|
|
126
|
+
authOnSurface: (s == null ? void 0 : s.colorText) ?? r.authOnSurface,
|
|
127
|
+
authOnSurfaceVariant: r.authOnSurfaceVariant,
|
|
128
|
+
authOutline: r.authOutline,
|
|
129
|
+
authOutlineVariant: (s == null ? void 0 : s.colorInputBorder) ?? r.authOutlineVariant,
|
|
130
|
+
authError: (s == null ? void 0 : s.colorError) ?? r.authError,
|
|
131
|
+
authErrorContainer: r.authErrorContainer,
|
|
132
|
+
authSuccess: (s == null ? void 0 : s.colorSuccess) ?? r.authSuccess,
|
|
133
|
+
authFontHeadline: (s == null ? void 0 : s.fontFamily) ?? r.authFontHeadline,
|
|
134
|
+
authFontBody: (s == null ? void 0 : s.fontFamily) ?? r.authFontBody
|
|
135
135
|
};
|
|
136
136
|
}
|
|
137
|
-
function
|
|
138
|
-
const
|
|
139
|
-
return `#${(
|
|
137
|
+
function Ca(a, r) {
|
|
138
|
+
const s = parseInt(a.replace("#", ""), 16), i = Math.max(0, (s >> 16) - Math.round(2.55 * r)), n = Math.max(0, (s >> 8 & 255) - Math.round(2.55 * r)), u = Math.max(0, (s & 255) - Math.round(2.55 * r));
|
|
139
|
+
return `#${(i << 16 | n << 8 | u).toString(16).padStart(6, "0")}`;
|
|
140
140
|
}
|
|
141
|
-
function
|
|
142
|
-
const
|
|
143
|
-
return `#${(
|
|
141
|
+
function za(a, r) {
|
|
142
|
+
const s = parseInt(a.replace("#", ""), 16), i = Math.min(255, (s >> 16) + Math.round(2.55 * r)), n = Math.min(255, (s >> 8 & 255) + Math.round(2.55 * r)), u = Math.min(255, (s & 255) + Math.round(2.55 * r));
|
|
143
|
+
return `#${(i << 16 | n << 8 | u).toString(16).padStart(6, "0")}`;
|
|
144
144
|
}
|
|
145
145
|
function ea(a) {
|
|
146
146
|
return `
|
|
@@ -1451,11 +1451,31 @@ function ea(a) {
|
|
|
1451
1451
|
height: 40px;
|
|
1452
1452
|
border-radius: 50%;
|
|
1453
1453
|
border: 2px solid ${a.authPrimary};
|
|
1454
|
-
overflow:
|
|
1454
|
+
overflow: visible;
|
|
1455
1455
|
transition: transform 0.15s, box-shadow 0.15s;
|
|
1456
1456
|
padding: 0;
|
|
1457
1457
|
background: none;
|
|
1458
1458
|
flex-shrink: 0;
|
|
1459
|
+
position: relative;
|
|
1460
|
+
}
|
|
1461
|
+
|
|
1462
|
+
.ss-auth-invite-badge {
|
|
1463
|
+
position: absolute;
|
|
1464
|
+
top: -4px;
|
|
1465
|
+
right: -4px;
|
|
1466
|
+
min-width: 18px;
|
|
1467
|
+
height: 18px;
|
|
1468
|
+
border-radius: 9px;
|
|
1469
|
+
font-size: 10px;
|
|
1470
|
+
font-weight: 700;
|
|
1471
|
+
display: flex;
|
|
1472
|
+
align-items: center;
|
|
1473
|
+
justify-content: center;
|
|
1474
|
+
background: ${a.authError || "#ef4444"};
|
|
1475
|
+
color: #fff;
|
|
1476
|
+
padding: 0 4px;
|
|
1477
|
+
line-height: 1;
|
|
1478
|
+
pointer-events: none;
|
|
1459
1479
|
}
|
|
1460
1480
|
|
|
1461
1481
|
.ss-auth-avatar-trigger img {
|
|
@@ -2501,280 +2521,311 @@ function ea(a) {
|
|
|
2501
2521
|
}
|
|
2502
2522
|
`;
|
|
2503
2523
|
}
|
|
2504
|
-
function
|
|
2505
|
-
const
|
|
2506
|
-
|
|
2507
|
-
var
|
|
2508
|
-
if (!
|
|
2509
|
-
n(((
|
|
2524
|
+
function j({ children: a, appearance: r }) {
|
|
2525
|
+
const s = W(null), [i, n] = g(null);
|
|
2526
|
+
U(() => {
|
|
2527
|
+
var m;
|
|
2528
|
+
if (!s.current || s.current.shadowRoot) {
|
|
2529
|
+
n(((m = s.current) == null ? void 0 : m.shadowRoot) ?? null);
|
|
2510
2530
|
return;
|
|
2511
2531
|
}
|
|
2512
|
-
const
|
|
2513
|
-
if ((
|
|
2514
|
-
const p = (
|
|
2532
|
+
const l = s.current.attachShadow({ mode: "open" });
|
|
2533
|
+
if ((r == null ? void 0 : r.fontUrl) !== null) {
|
|
2534
|
+
const p = (r == null ? void 0 : r.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";
|
|
2515
2535
|
if (!document.querySelector(`link[href="${p}"]`)) {
|
|
2516
|
-
const
|
|
2517
|
-
|
|
2536
|
+
const y = document.createElement("link");
|
|
2537
|
+
y.rel = "stylesheet", y.href = p, document.head.appendChild(y);
|
|
2518
2538
|
}
|
|
2519
|
-
const
|
|
2520
|
-
|
|
2521
|
-
}
|
|
2522
|
-
const
|
|
2523
|
-
|
|
2524
|
-
const
|
|
2525
|
-
|
|
2526
|
-
}, []),
|
|
2527
|
-
if (!
|
|
2528
|
-
const
|
|
2529
|
-
if (
|
|
2530
|
-
const
|
|
2531
|
-
|
|
2532
|
-
}
|
|
2533
|
-
}, [
|
|
2534
|
-
const u = (
|
|
2535
|
-
return /* @__PURE__ */ e("div", { ref:
|
|
2539
|
+
const h = document.createElement("link");
|
|
2540
|
+
h.rel = "stylesheet", h.href = p, l.appendChild(h);
|
|
2541
|
+
}
|
|
2542
|
+
const d = aa(r), c = document.createElement("style");
|
|
2543
|
+
c.textContent = ea(d), l.appendChild(c);
|
|
2544
|
+
const o = document.createElement("div");
|
|
2545
|
+
l.appendChild(o), n(l);
|
|
2546
|
+
}, []), U(() => {
|
|
2547
|
+
if (!i) return;
|
|
2548
|
+
const l = i.querySelector("style");
|
|
2549
|
+
if (l) {
|
|
2550
|
+
const d = aa(r);
|
|
2551
|
+
l.textContent = ea(d);
|
|
2552
|
+
}
|
|
2553
|
+
}, [r, i]);
|
|
2554
|
+
const u = (i == null ? void 0 : i.querySelector("div")) ?? null;
|
|
2555
|
+
return /* @__PURE__ */ e("div", { ref: s, style: { display: "contents" }, children: u && Sa(a, u) });
|
|
2536
2556
|
}
|
|
2537
2557
|
function sa() {
|
|
2538
|
-
const { client: a, user:
|
|
2558
|
+
const { client: a, user: r, isLoaded: s } = M();
|
|
2539
2559
|
return {
|
|
2540
|
-
isLoaded:
|
|
2541
|
-
isSignedIn: !!
|
|
2542
|
-
user:
|
|
2560
|
+
isLoaded: s,
|
|
2561
|
+
isSignedIn: !!r,
|
|
2562
|
+
user: r,
|
|
2543
2563
|
signOut: k(() => a.auth.signOut(), [a]),
|
|
2544
2564
|
getToken: k(() => a.auth.getToken(), [a]),
|
|
2545
2565
|
refreshUser: k(() => a.auth.refreshUser(), [a])
|
|
2546
2566
|
};
|
|
2547
2567
|
}
|
|
2548
|
-
function
|
|
2549
|
-
const { user: a, isLoaded:
|
|
2550
|
-
return { user: a, isLoaded:
|
|
2568
|
+
function ie() {
|
|
2569
|
+
const { user: a, isLoaded: r } = M();
|
|
2570
|
+
return { user: a, isLoaded: r };
|
|
2551
2571
|
}
|
|
2552
|
-
function
|
|
2553
|
-
const { client: a } =
|
|
2554
|
-
async (
|
|
2555
|
-
|
|
2572
|
+
function oa() {
|
|
2573
|
+
const { client: a } = M(), [r, s] = g(!1), [i, n] = g(null), u = k(
|
|
2574
|
+
async (c, o) => {
|
|
2575
|
+
s(!0), n(null);
|
|
2556
2576
|
try {
|
|
2557
|
-
return await a.auth.signIn(
|
|
2558
|
-
} catch (
|
|
2559
|
-
return n(
|
|
2577
|
+
return await a.auth.signIn(c, o);
|
|
2578
|
+
} catch (m) {
|
|
2579
|
+
return n(m instanceof Error ? m.message : "Sign in failed"), null;
|
|
2560
2580
|
} finally {
|
|
2561
|
-
|
|
2581
|
+
s(!1);
|
|
2562
2582
|
}
|
|
2563
2583
|
},
|
|
2564
2584
|
[a]
|
|
2565
|
-
),
|
|
2566
|
-
async (
|
|
2567
|
-
|
|
2585
|
+
), l = k(
|
|
2586
|
+
async (c) => {
|
|
2587
|
+
s(!0), n(null);
|
|
2568
2588
|
try {
|
|
2569
|
-
return await a.auth.signInWithOAuth(
|
|
2570
|
-
} catch (
|
|
2571
|
-
return n(
|
|
2589
|
+
return await a.auth.signInWithOAuth(c);
|
|
2590
|
+
} catch (o) {
|
|
2591
|
+
return n(o instanceof Error ? o.message : "OAuth sign in failed"), null;
|
|
2572
2592
|
} finally {
|
|
2573
|
-
|
|
2593
|
+
s(!1);
|
|
2574
2594
|
}
|
|
2575
2595
|
},
|
|
2576
2596
|
[a]
|
|
2577
|
-
),
|
|
2578
|
-
async (
|
|
2579
|
-
|
|
2597
|
+
), d = k(
|
|
2598
|
+
async (c, o) => {
|
|
2599
|
+
s(!0), n(null);
|
|
2580
2600
|
try {
|
|
2581
|
-
return await a.auth.submitMfaCode(
|
|
2582
|
-
} catch (
|
|
2583
|
-
return n(
|
|
2601
|
+
return await a.auth.submitMfaCode(c, o);
|
|
2602
|
+
} catch (m) {
|
|
2603
|
+
return n(m instanceof Error ? m.message : "MFA verification failed"), null;
|
|
2584
2604
|
} finally {
|
|
2585
|
-
|
|
2605
|
+
s(!1);
|
|
2586
2606
|
}
|
|
2587
2607
|
},
|
|
2588
2608
|
[a]
|
|
2589
2609
|
);
|
|
2590
|
-
return { signIn: u, signInWithOAuth:
|
|
2610
|
+
return { signIn: u, signInWithOAuth: l, submitMfaCode: d, isLoading: r, error: i, setError: n };
|
|
2591
2611
|
}
|
|
2592
|
-
function
|
|
2593
|
-
const { client: a } =
|
|
2612
|
+
function Pa() {
|
|
2613
|
+
const { client: a } = M(), [r, s] = g(!1), [i, n] = g(null);
|
|
2594
2614
|
return { signUp: k(
|
|
2595
|
-
async (
|
|
2596
|
-
|
|
2615
|
+
async (l, d) => {
|
|
2616
|
+
s(!0), n(null);
|
|
2597
2617
|
try {
|
|
2598
|
-
return await a.auth.signUp(
|
|
2599
|
-
} catch (
|
|
2600
|
-
return n(
|
|
2618
|
+
return await a.auth.signUp(l, d);
|
|
2619
|
+
} catch (c) {
|
|
2620
|
+
return n(c instanceof Error ? c.message : "Sign up failed"), null;
|
|
2601
2621
|
} finally {
|
|
2602
|
-
|
|
2622
|
+
s(!1);
|
|
2603
2623
|
}
|
|
2604
2624
|
},
|
|
2605
2625
|
[a]
|
|
2606
|
-
), isLoading:
|
|
2626
|
+
), isLoading: r, error: i, setError: n };
|
|
2607
2627
|
}
|
|
2608
2628
|
function Y() {
|
|
2609
|
-
const { client: a } =
|
|
2610
|
-
|
|
2629
|
+
const { client: a } = M(), [r, s] = g([]), [i, n] = g(null), [u, l] = g([]), [d, c] = g([]), [o, m] = g(!1), [p, h] = g(null), y = W(!1), x = k(async () => {
|
|
2630
|
+
m(!0), h(null);
|
|
2611
2631
|
try {
|
|
2612
|
-
const
|
|
2613
|
-
if (
|
|
2614
|
-
const
|
|
2615
|
-
if (
|
|
2616
|
-
n(
|
|
2632
|
+
const b = await a.auth.listOrgs();
|
|
2633
|
+
if (s(b), n((w) => w && (b.find((B) => B.id === w.id) ?? null)), !y.current && b.length > 0) {
|
|
2634
|
+
const w = typeof window < "u" ? localStorage.getItem("ss_selected_org") : null, B = (w ? b.find((F) => F.id === w) : null) ?? (b.length === 1 ? b[0] : null);
|
|
2635
|
+
if (B) {
|
|
2636
|
+
y.current = !0, n(B), typeof window < "u" && localStorage.setItem("ss_selected_org", B.id);
|
|
2617
2637
|
try {
|
|
2618
|
-
const
|
|
2619
|
-
|
|
2638
|
+
const F = await a.auth.listMembers(B.id);
|
|
2639
|
+
l(F);
|
|
2620
2640
|
} catch {
|
|
2621
2641
|
}
|
|
2622
2642
|
}
|
|
2623
2643
|
}
|
|
2624
|
-
} catch (
|
|
2625
|
-
|
|
2644
|
+
} catch (b) {
|
|
2645
|
+
h(b instanceof Error ? b.message : "Failed to load organizations");
|
|
2626
2646
|
} finally {
|
|
2627
|
-
|
|
2647
|
+
m(!1);
|
|
2628
2648
|
}
|
|
2629
|
-
}, [a
|
|
2630
|
-
|
|
2631
|
-
|
|
2632
|
-
}, [
|
|
2633
|
-
const
|
|
2649
|
+
}, [a]);
|
|
2650
|
+
U(() => {
|
|
2651
|
+
x();
|
|
2652
|
+
}, [x]);
|
|
2653
|
+
const v = k(async (b) => {
|
|
2634
2654
|
try {
|
|
2635
|
-
const
|
|
2636
|
-
n(
|
|
2637
|
-
const
|
|
2638
|
-
|
|
2639
|
-
} catch (
|
|
2640
|
-
|
|
2641
|
-
}
|
|
2642
|
-
}, [a]),
|
|
2655
|
+
const w = await a.auth.getOrg(b);
|
|
2656
|
+
n(w), typeof window < "u" && localStorage.setItem("ss_selected_org", b);
|
|
2657
|
+
const E = await a.auth.listMembers(b);
|
|
2658
|
+
l(E);
|
|
2659
|
+
} catch (w) {
|
|
2660
|
+
h(w instanceof Error ? w.message : "Failed to load organization");
|
|
2661
|
+
}
|
|
2662
|
+
}, [a]), z = k(async (b, w) => {
|
|
2643
2663
|
try {
|
|
2644
|
-
const
|
|
2645
|
-
return
|
|
2646
|
-
} catch (
|
|
2647
|
-
return
|
|
2664
|
+
const E = await a.auth.createOrg(b, w);
|
|
2665
|
+
return s((B) => [...B, E]), E;
|
|
2666
|
+
} catch (E) {
|
|
2667
|
+
return h(E instanceof Error ? E.message : "Failed to create organization"), null;
|
|
2648
2668
|
}
|
|
2649
|
-
}, [a]),
|
|
2669
|
+
}, [a]), N = k(async (b, w) => {
|
|
2650
2670
|
try {
|
|
2651
|
-
const
|
|
2652
|
-
return
|
|
2653
|
-
} catch (
|
|
2654
|
-
return
|
|
2671
|
+
const E = await a.auth.updateOrg(b, w);
|
|
2672
|
+
return s((B) => B.map((F) => F.id === b ? E : F)), (i == null ? void 0 : i.id) === b && n(E), E;
|
|
2673
|
+
} catch (E) {
|
|
2674
|
+
return h(E instanceof Error ? E.message : "Failed to update organization"), null;
|
|
2655
2675
|
}
|
|
2656
|
-
}, [a,
|
|
2676
|
+
}, [a, i]), O = k(async (b) => {
|
|
2657
2677
|
try {
|
|
2658
|
-
return await a.auth.deleteOrg(
|
|
2659
|
-
} catch (
|
|
2660
|
-
return
|
|
2678
|
+
return await a.auth.deleteOrg(b), s((w) => w.filter((E) => E.id !== b)), (i == null ? void 0 : i.id) === b && (n(null), l([]), c([]), typeof window < "u" && localStorage.removeItem("ss_selected_org")), !0;
|
|
2679
|
+
} catch (w) {
|
|
2680
|
+
return h(w instanceof Error ? w.message : "Failed to delete organization"), !1;
|
|
2661
2681
|
}
|
|
2662
|
-
}, [a,
|
|
2682
|
+
}, [a, i]), C = k(async (b, w, E) => {
|
|
2663
2683
|
try {
|
|
2664
|
-
return await a.auth.sendInvite(
|
|
2665
|
-
} catch (
|
|
2666
|
-
return
|
|
2684
|
+
return await a.auth.sendInvite(b, w, E);
|
|
2685
|
+
} catch (B) {
|
|
2686
|
+
return h(B instanceof Error ? B.message : "Failed to send invite"), null;
|
|
2667
2687
|
}
|
|
2668
|
-
}, [a]),
|
|
2688
|
+
}, [a]), f = k(async (b) => {
|
|
2669
2689
|
try {
|
|
2670
|
-
const
|
|
2671
|
-
|
|
2672
|
-
} catch (
|
|
2673
|
-
|
|
2690
|
+
const w = await a.auth.listInvites(b);
|
|
2691
|
+
c(w);
|
|
2692
|
+
} catch (w) {
|
|
2693
|
+
h(w instanceof Error ? w.message : "Failed to load invites");
|
|
2674
2694
|
}
|
|
2675
|
-
}, [a]), P = k(async (
|
|
2695
|
+
}, [a]), P = k(async (b, w) => {
|
|
2676
2696
|
try {
|
|
2677
|
-
return await a.auth.revokeInvite(
|
|
2678
|
-
} catch (
|
|
2679
|
-
return
|
|
2697
|
+
return await a.auth.revokeInvite(b, w), c((E) => E.filter((B) => B.id !== w)), !0;
|
|
2698
|
+
} catch (E) {
|
|
2699
|
+
return h(E instanceof Error ? E.message : "Failed to revoke invite"), !1;
|
|
2680
2700
|
}
|
|
2681
|
-
}, [a]), I = k(async (
|
|
2701
|
+
}, [a]), I = k(async (b, w, E) => {
|
|
2682
2702
|
try {
|
|
2683
|
-
return await a.auth.updateMemberRole(
|
|
2684
|
-
} catch (
|
|
2685
|
-
return
|
|
2703
|
+
return await a.auth.updateMemberRole(b, w, E), l((B) => B.map((F) => F.userId === w ? { ...F, role: E } : F)), !0;
|
|
2704
|
+
} catch (B) {
|
|
2705
|
+
return h(B instanceof Error ? B.message : "Failed to update member role"), !1;
|
|
2686
2706
|
}
|
|
2687
|
-
}, [a]),
|
|
2707
|
+
}, [a]), L = k(async (b, w) => {
|
|
2688
2708
|
try {
|
|
2689
|
-
return await a.auth.removeMember(
|
|
2690
|
-
} catch (
|
|
2691
|
-
return
|
|
2709
|
+
return await a.auth.removeMember(b, w), l((E) => E.filter((B) => B.userId !== w)), !0;
|
|
2710
|
+
} catch (E) {
|
|
2711
|
+
return h(E instanceof Error ? E.message : "Failed to remove member"), !1;
|
|
2692
2712
|
}
|
|
2693
|
-
}, [a]),
|
|
2713
|
+
}, [a]), A = k(async (b) => {
|
|
2694
2714
|
try {
|
|
2695
|
-
const
|
|
2696
|
-
|
|
2697
|
-
} catch (
|
|
2698
|
-
|
|
2715
|
+
const w = await a.auth.listMembers(b);
|
|
2716
|
+
l(w);
|
|
2717
|
+
} catch (w) {
|
|
2718
|
+
h(w instanceof Error ? w.message : "Failed to load members");
|
|
2699
2719
|
}
|
|
2700
2720
|
}, [a]);
|
|
2701
2721
|
return {
|
|
2702
|
-
orgs:
|
|
2703
|
-
selectedOrg:
|
|
2722
|
+
orgs: r,
|
|
2723
|
+
selectedOrg: i,
|
|
2704
2724
|
members: u,
|
|
2705
|
-
invites:
|
|
2706
|
-
isLoading:
|
|
2725
|
+
invites: d,
|
|
2726
|
+
isLoading: o,
|
|
2707
2727
|
error: p,
|
|
2708
|
-
setError:
|
|
2709
|
-
refresh:
|
|
2710
|
-
selectOrg:
|
|
2711
|
-
createOrg:
|
|
2712
|
-
updateOrg:
|
|
2713
|
-
deleteOrg:
|
|
2714
|
-
sendInvite:
|
|
2715
|
-
refreshInvites:
|
|
2728
|
+
setError: h,
|
|
2729
|
+
refresh: x,
|
|
2730
|
+
selectOrg: v,
|
|
2731
|
+
createOrg: z,
|
|
2732
|
+
updateOrg: N,
|
|
2733
|
+
deleteOrg: O,
|
|
2734
|
+
sendInvite: C,
|
|
2735
|
+
refreshInvites: f,
|
|
2716
2736
|
revokeInvite: P,
|
|
2717
2737
|
updateMemberRole: I,
|
|
2718
|
-
removeMember:
|
|
2719
|
-
refreshMembers:
|
|
2738
|
+
removeMember: L,
|
|
2739
|
+
refreshMembers: A
|
|
2720
2740
|
};
|
|
2721
2741
|
}
|
|
2722
|
-
function
|
|
2723
|
-
const { client: a } =
|
|
2742
|
+
function Oa() {
|
|
2743
|
+
const { client: a } = M(), [r, s] = g(!1), [i, n] = g(null);
|
|
2724
2744
|
return { deleteAccount: k(async () => {
|
|
2725
|
-
|
|
2745
|
+
s(!0), n(null);
|
|
2726
2746
|
try {
|
|
2727
2747
|
return await a.auth.deleteAccount(), !0;
|
|
2728
|
-
} catch (
|
|
2729
|
-
return n(
|
|
2748
|
+
} catch (l) {
|
|
2749
|
+
return n(l instanceof Error ? l.message : "Failed to delete account"), !1;
|
|
2730
2750
|
} finally {
|
|
2731
|
-
|
|
2751
|
+
s(!1);
|
|
2732
2752
|
}
|
|
2733
|
-
}, [a]), isLoading:
|
|
2753
|
+
}, [a]), isLoading: r, error: i, setError: n };
|
|
2734
2754
|
}
|
|
2735
|
-
function
|
|
2736
|
-
const { client: a, user:
|
|
2755
|
+
function ia() {
|
|
2756
|
+
const { client: a, user: r } = M(), [s, i] = g(!1), [n, u] = g(null), [l, d] = g(null), c = k(
|
|
2737
2757
|
async (p) => {
|
|
2738
|
-
|
|
2758
|
+
i(!0), u(null), d(null);
|
|
2739
2759
|
try {
|
|
2740
|
-
const
|
|
2741
|
-
return
|
|
2742
|
-
} catch (
|
|
2743
|
-
return u(
|
|
2760
|
+
const h = await a.auth.updateProfile(p);
|
|
2761
|
+
return d("Profile updated"), h;
|
|
2762
|
+
} catch (h) {
|
|
2763
|
+
return u(h instanceof Error ? h.message : "Failed to update profile"), null;
|
|
2744
2764
|
} finally {
|
|
2745
|
-
|
|
2765
|
+
i(!1);
|
|
2746
2766
|
}
|
|
2747
2767
|
},
|
|
2748
2768
|
[a]
|
|
2749
|
-
),
|
|
2750
|
-
async (p,
|
|
2751
|
-
|
|
2769
|
+
), o = k(
|
|
2770
|
+
async (p, h) => {
|
|
2771
|
+
i(!0), u(null), d(null);
|
|
2752
2772
|
try {
|
|
2753
|
-
return await a.auth.changePassword(p,
|
|
2754
|
-
} catch (
|
|
2755
|
-
return u(
|
|
2773
|
+
return await a.auth.changePassword(p, h), d("Password changed successfully"), !0;
|
|
2774
|
+
} catch (y) {
|
|
2775
|
+
return u(y instanceof Error ? y.message : "Failed to change password"), !1;
|
|
2756
2776
|
} finally {
|
|
2757
|
-
|
|
2777
|
+
i(!1);
|
|
2758
2778
|
}
|
|
2759
2779
|
},
|
|
2760
2780
|
[a]
|
|
2761
|
-
),
|
|
2781
|
+
), m = k(
|
|
2762
2782
|
async (p) => {
|
|
2763
|
-
|
|
2783
|
+
i(!0), u(null), d(null);
|
|
2764
2784
|
try {
|
|
2765
|
-
const
|
|
2766
|
-
return
|
|
2767
|
-
} catch (
|
|
2768
|
-
return u(
|
|
2785
|
+
const h = await a.auth.uploadAvatar(p);
|
|
2786
|
+
return d("Avatar updated"), h;
|
|
2787
|
+
} catch (h) {
|
|
2788
|
+
return u(h instanceof Error ? h.message : "Failed to upload avatar"), null;
|
|
2769
2789
|
} finally {
|
|
2770
|
-
|
|
2790
|
+
i(!1);
|
|
2771
2791
|
}
|
|
2772
2792
|
},
|
|
2773
2793
|
[a]
|
|
2774
2794
|
);
|
|
2775
|
-
return { user:
|
|
2795
|
+
return { user: r, updateProfile: c, uploadAvatar: m, changePassword: o, isLoading: s, error: n, success: l, setError: u, setSuccess: d };
|
|
2776
2796
|
}
|
|
2777
|
-
|
|
2797
|
+
function ra() {
|
|
2798
|
+
const { client: a } = M(), [r, s] = g([]), [i, n] = g(!1), [u, l] = g(null), d = k(async () => {
|
|
2799
|
+
n(!0), l(null);
|
|
2800
|
+
try {
|
|
2801
|
+
const m = await a.auth.listMyInvites();
|
|
2802
|
+
s(m);
|
|
2803
|
+
} catch (m) {
|
|
2804
|
+
l(m instanceof Error ? m.message : "Failed to load invites");
|
|
2805
|
+
} finally {
|
|
2806
|
+
n(!1);
|
|
2807
|
+
}
|
|
2808
|
+
}, [a]);
|
|
2809
|
+
U(() => {
|
|
2810
|
+
d();
|
|
2811
|
+
}, [d]);
|
|
2812
|
+
const c = k(async (m) => {
|
|
2813
|
+
try {
|
|
2814
|
+
const p = await a.auth.acceptInviteById(m);
|
|
2815
|
+
return s((h) => h.filter((y) => y.id !== m)), p;
|
|
2816
|
+
} catch (p) {
|
|
2817
|
+
return l(p instanceof Error ? p.message : "Failed to accept invite"), null;
|
|
2818
|
+
}
|
|
2819
|
+
}, [a]), o = k(async (m) => {
|
|
2820
|
+
try {
|
|
2821
|
+
return await a.auth.declineInvite(m), s((p) => p.filter((h) => h.id !== m)), !0;
|
|
2822
|
+
} catch (p) {
|
|
2823
|
+
return l(p instanceof Error ? p.message : "Failed to decline invite"), !1;
|
|
2824
|
+
}
|
|
2825
|
+
}, [a]);
|
|
2826
|
+
return { invites: r, isLoading: i, error: u, setError: l, refresh: d, accept: c, decline: o };
|
|
2827
|
+
}
|
|
2828
|
+
const la = '<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92a5.06 5.06 0 0 1-2.2 3.32v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.1z" fill="#4285F4"/><path d="M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z" fill="#34A853"/><path d="M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z" fill="#FBBC05"/><path d="M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z" fill="#EA4335"/></svg>', ca = '<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M12 0C5.37 0 0 5.37 0 12c0 5.31 3.435 9.795 8.205 11.385.6.105.825-.255.825-.57 0-.285-.015-1.23-.015-2.235-3.015.555-3.795-.735-4.035-1.41-.135-.345-.72-1.41-1.23-1.695-.42-.225-1.02-.78-.015-.795.945-.015 1.62.87 1.845 1.23 1.08 1.815 2.805 1.305 3.495.99.105-.78.42-1.305.765-1.605-2.67-.3-5.46-1.335-5.46-5.925 0-1.305.465-2.385 1.23-3.225-.12-.3-.54-1.53.12-3.18 0 0 1.005-.315 3.3 1.23.96-.27 1.98-.405 3-.405s2.04.135 3 .405c2.295-1.56 3.3-1.23 3.3-1.23.66 1.65.24 2.88.12 3.18.765.84 1.23 1.905 1.23 3.225 0 4.605-2.805 5.625-5.475 5.925.435.375.81 1.095.81 2.22 0 1.605-.015 2.895-.015 3.3 0 .315.225.69.825.57A12.02 12.02 0 0 0 24 12c0-6.63-5.37-12-12-12z" fill="currentColor"/></svg>', S = {
|
|
2778
2829
|
close: "close",
|
|
2779
2830
|
person: "person",
|
|
2780
2831
|
logout: "logout",
|
|
@@ -2798,6 +2849,7 @@ const ia = '<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d=
|
|
|
2798
2849
|
token: "token",
|
|
2799
2850
|
autoAwesome: "auto_awesome",
|
|
2800
2851
|
corporateFare: "corporate_fare",
|
|
2852
|
+
mail: "mail",
|
|
2801
2853
|
cloudDone: "cloud_done",
|
|
2802
2854
|
check: "check",
|
|
2803
2855
|
image: "image",
|
|
@@ -2808,51 +2860,51 @@ const ia = '<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d=
|
|
|
2808
2860
|
send: "send",
|
|
2809
2861
|
personRemove: "person_remove"
|
|
2810
2862
|
};
|
|
2811
|
-
function
|
|
2812
|
-
const { appearance:
|
|
2813
|
-
async (
|
|
2814
|
-
if (
|
|
2815
|
-
await
|
|
2863
|
+
function le({ appearance: a, signUpUrl: r, onSignUp: s }) {
|
|
2864
|
+
const { appearance: i, settings: n } = M(), { signIn: u, signInWithOAuth: l, submitMfaCode: d, isLoading: c, error: o, setError: m } = oa(), p = a ?? i, [h, y] = g(""), [x, v] = g(""), [z, N] = g(!1), [O, C] = g(!1), [f, P] = g(""), [I, L] = g(["", "", "", "", "", ""]), A = W([]), b = k(
|
|
2865
|
+
async (D) => {
|
|
2866
|
+
if (D.preventDefault(), O) {
|
|
2867
|
+
await d(f, I.join(""));
|
|
2816
2868
|
return;
|
|
2817
2869
|
}
|
|
2818
|
-
const
|
|
2819
|
-
|
|
2870
|
+
const $ = await u(h, x);
|
|
2871
|
+
$ && wa($) && (P($.mfaToken), C(!0), m(null));
|
|
2820
2872
|
},
|
|
2821
|
-
[
|
|
2822
|
-
),
|
|
2823
|
-
async (
|
|
2824
|
-
await
|
|
2873
|
+
[h, x, O, f, I, u, d, m]
|
|
2874
|
+
), w = k(
|
|
2875
|
+
async (D) => {
|
|
2876
|
+
await l(D);
|
|
2825
2877
|
},
|
|
2826
|
-
[
|
|
2827
|
-
), E = k((
|
|
2828
|
-
var
|
|
2829
|
-
if (!/^\d*$/.test(
|
|
2830
|
-
const
|
|
2831
|
-
|
|
2878
|
+
[l]
|
|
2879
|
+
), E = k((D, $) => {
|
|
2880
|
+
var _;
|
|
2881
|
+
if (!/^\d*$/.test($)) return;
|
|
2882
|
+
const T = $.slice(-1);
|
|
2883
|
+
L((K) => {
|
|
2832
2884
|
const J = [...K];
|
|
2833
|
-
return J[
|
|
2834
|
-
}),
|
|
2835
|
-
}, []),
|
|
2836
|
-
var
|
|
2837
|
-
|
|
2838
|
-
}, [
|
|
2839
|
-
return /* @__PURE__ */ e(
|
|
2885
|
+
return J[D] = T, J;
|
|
2886
|
+
}), T && D < 5 && ((_ = A.current[D + 1]) == null || _.focus());
|
|
2887
|
+
}, []), B = k((D, $) => {
|
|
2888
|
+
var T;
|
|
2889
|
+
$.key === "Backspace" && !I[D] && D > 0 && ((T = A.current[D - 1]) == null || T.focus());
|
|
2890
|
+
}, [I]), F = (n == null ? void 0 : n.googleEnabled) || (n == null ? void 0 : n.githubEnabled);
|
|
2891
|
+
return /* @__PURE__ */ e(j, { appearance: p, children: /* @__PURE__ */ e("div", { className: "ss-auth-card", children: /* @__PURE__ */ t("div", { className: "ss-auth-card-body", children: [
|
|
2840
2892
|
/* @__PURE__ */ t("div", { className: "ss-auth-header", children: [
|
|
2841
|
-
/* @__PURE__ */ e("div", { className: "ss-auth-brand-icon", children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children:
|
|
2893
|
+
/* @__PURE__ */ e("div", { className: "ss-auth-brand-icon", children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: S.token }) }),
|
|
2842
2894
|
/* @__PURE__ */ e("h1", { className: "ss-auth-title", children: "Sign in to your account" }),
|
|
2843
2895
|
/* @__PURE__ */ e("p", { className: "ss-auth-subtitle", children: "Welcome back to your workspace" })
|
|
2844
2896
|
] }),
|
|
2845
|
-
!
|
|
2897
|
+
!O && F && /* @__PURE__ */ t(R, { children: [
|
|
2846
2898
|
/* @__PURE__ */ t("div", { className: "ss-auth-oauth-grid", children: [
|
|
2847
2899
|
(n == null ? void 0 : n.googleEnabled) && /* @__PURE__ */ t(
|
|
2848
2900
|
"button",
|
|
2849
2901
|
{
|
|
2850
2902
|
type: "button",
|
|
2851
2903
|
className: "ss-auth-btn-social",
|
|
2852
|
-
onClick: () =>
|
|
2853
|
-
disabled:
|
|
2904
|
+
onClick: () => w("google"),
|
|
2905
|
+
disabled: c,
|
|
2854
2906
|
children: [
|
|
2855
|
-
/* @__PURE__ */ e("span", { dangerouslySetInnerHTML: { __html:
|
|
2907
|
+
/* @__PURE__ */ e("span", { dangerouslySetInnerHTML: { __html: la } }),
|
|
2856
2908
|
"Google"
|
|
2857
2909
|
]
|
|
2858
2910
|
}
|
|
@@ -2862,10 +2914,10 @@ function re({ appearance: a, signUpUrl: s, onSignUp: r }) {
|
|
|
2862
2914
|
{
|
|
2863
2915
|
type: "button",
|
|
2864
2916
|
className: "ss-auth-btn-social",
|
|
2865
|
-
onClick: () =>
|
|
2866
|
-
disabled:
|
|
2917
|
+
onClick: () => w("github"),
|
|
2918
|
+
disabled: c,
|
|
2867
2919
|
children: [
|
|
2868
|
-
/* @__PURE__ */ e("span", { dangerouslySetInnerHTML: { __html:
|
|
2920
|
+
/* @__PURE__ */ e("span", { dangerouslySetInnerHTML: { __html: ca } }),
|
|
2869
2921
|
"GitHub"
|
|
2870
2922
|
]
|
|
2871
2923
|
}
|
|
@@ -2873,35 +2925,35 @@ function re({ appearance: a, signUpUrl: s, onSignUp: r }) {
|
|
|
2873
2925
|
] }),
|
|
2874
2926
|
/* @__PURE__ */ e("div", { className: "ss-auth-divider", children: "or continue with" })
|
|
2875
2927
|
] }),
|
|
2876
|
-
|
|
2877
|
-
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children:
|
|
2878
|
-
/* @__PURE__ */ e("span", { children:
|
|
2928
|
+
o && /* @__PURE__ */ t("div", { className: "ss-auth-error", children: [
|
|
2929
|
+
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: S.errorOutline }),
|
|
2930
|
+
/* @__PURE__ */ e("span", { children: o })
|
|
2879
2931
|
] }),
|
|
2880
|
-
/* @__PURE__ */ t("form", { onSubmit:
|
|
2881
|
-
|
|
2932
|
+
/* @__PURE__ */ t("form", { onSubmit: b, children: [
|
|
2933
|
+
O ? /* @__PURE__ */ t(R, { children: [
|
|
2882
2934
|
/* @__PURE__ */ e("div", { className: "ss-auth-mfa-divider", children: /* @__PURE__ */ e("span", { children: "Verification Required" }) }),
|
|
2883
2935
|
/* @__PURE__ */ t("div", { className: "ss-auth-field", children: [
|
|
2884
2936
|
/* @__PURE__ */ e("label", { className: "ss-auth-label", children: "6-Digit Code" }),
|
|
2885
|
-
/* @__PURE__ */ e("div", { className: "ss-auth-mfa-group", children:
|
|
2937
|
+
/* @__PURE__ */ e("div", { className: "ss-auth-mfa-group", children: I.map((D, $) => /* @__PURE__ */ e(
|
|
2886
2938
|
"input",
|
|
2887
2939
|
{
|
|
2888
|
-
ref: (
|
|
2889
|
-
|
|
2940
|
+
ref: (T) => {
|
|
2941
|
+
A.current[$] = T;
|
|
2890
2942
|
},
|
|
2891
2943
|
className: "ss-auth-mfa-digit",
|
|
2892
2944
|
type: "text",
|
|
2893
2945
|
inputMode: "numeric",
|
|
2894
2946
|
maxLength: 1,
|
|
2895
|
-
value:
|
|
2896
|
-
onChange: (
|
|
2897
|
-
onKeyDown: (
|
|
2898
|
-
autoFocus:
|
|
2947
|
+
value: D,
|
|
2948
|
+
onChange: (T) => E($, T.target.value),
|
|
2949
|
+
onKeyDown: (T) => B($, T),
|
|
2950
|
+
autoFocus: $ === 0
|
|
2899
2951
|
},
|
|
2900
|
-
|
|
2952
|
+
$
|
|
2901
2953
|
)) }),
|
|
2902
2954
|
/* @__PURE__ */ e("p", { className: "ss-auth-mfa-hint", children: "We sent a 6-digit code to your registered email." })
|
|
2903
2955
|
] })
|
|
2904
|
-
] }) : /* @__PURE__ */ t(
|
|
2956
|
+
] }) : /* @__PURE__ */ t(R, { children: [
|
|
2905
2957
|
/* @__PURE__ */ t("div", { className: "ss-auth-field", children: [
|
|
2906
2958
|
/* @__PURE__ */ e("label", { className: "ss-auth-label", htmlFor: "ss-email", children: "Email Address" }),
|
|
2907
2959
|
/* @__PURE__ */ e(
|
|
@@ -2912,8 +2964,8 @@ function re({ appearance: a, signUpUrl: s, onSignUp: r }) {
|
|
|
2912
2964
|
type: "email",
|
|
2913
2965
|
autoComplete: "email",
|
|
2914
2966
|
placeholder: "name@company.com",
|
|
2915
|
-
value:
|
|
2916
|
-
onChange: (
|
|
2967
|
+
value: h,
|
|
2968
|
+
onChange: (D) => y(D.target.value),
|
|
2917
2969
|
required: !0
|
|
2918
2970
|
}
|
|
2919
2971
|
)
|
|
@@ -2929,11 +2981,11 @@ function re({ appearance: a, signUpUrl: s, onSignUp: r }) {
|
|
|
2929
2981
|
{
|
|
2930
2982
|
id: "ss-password",
|
|
2931
2983
|
className: "ss-auth-input",
|
|
2932
|
-
type:
|
|
2984
|
+
type: z ? "text" : "password",
|
|
2933
2985
|
autoComplete: "current-password",
|
|
2934
2986
|
placeholder: "••••••••",
|
|
2935
|
-
value:
|
|
2936
|
-
onChange: (
|
|
2987
|
+
value: x,
|
|
2988
|
+
onChange: (D) => v(D.target.value),
|
|
2937
2989
|
required: !0
|
|
2938
2990
|
}
|
|
2939
2991
|
),
|
|
@@ -2942,74 +2994,74 @@ function re({ appearance: a, signUpUrl: s, onSignUp: r }) {
|
|
|
2942
2994
|
{
|
|
2943
2995
|
type: "button",
|
|
2944
2996
|
className: "ss-auth-visibility-toggle",
|
|
2945
|
-
onClick: () =>
|
|
2946
|
-
children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children:
|
|
2997
|
+
onClick: () => N(!z),
|
|
2998
|
+
children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: z ? S.visibilityOff : S.visibility })
|
|
2947
2999
|
}
|
|
2948
3000
|
)
|
|
2949
3001
|
] })
|
|
2950
3002
|
] })
|
|
2951
3003
|
] }),
|
|
2952
|
-
/* @__PURE__ */ t("button", { type: "submit", className: "ss-auth-btn-primary", disabled:
|
|
2953
|
-
|
|
2954
|
-
|
|
2955
|
-
!
|
|
3004
|
+
/* @__PURE__ */ t("button", { type: "submit", className: "ss-auth-btn-primary", disabled: c, children: [
|
|
3005
|
+
c && /* @__PURE__ */ e("span", { className: "ss-auth-spinner" }),
|
|
3006
|
+
O ? "Verify" : "Sign in",
|
|
3007
|
+
!c && /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: S.arrowForward })
|
|
2956
3008
|
] })
|
|
2957
3009
|
] }),
|
|
2958
|
-
|
|
3010
|
+
O ? /* @__PURE__ */ e("div", { className: "ss-auth-footer", children: /* @__PURE__ */ e(
|
|
2959
3011
|
"span",
|
|
2960
3012
|
{
|
|
2961
3013
|
className: "ss-auth-link",
|
|
2962
3014
|
onClick: () => {
|
|
2963
|
-
C(!1),
|
|
3015
|
+
C(!1), L(["", "", "", "", "", ""]), m(null);
|
|
2964
3016
|
},
|
|
2965
3017
|
children: "Back to sign in"
|
|
2966
3018
|
}
|
|
2967
3019
|
) }) : /* @__PURE__ */ t("div", { className: "ss-auth-footer", children: [
|
|
2968
3020
|
"Don't have an account?",
|
|
2969
3021
|
" ",
|
|
2970
|
-
|
|
3022
|
+
s ? /* @__PURE__ */ e("span", { className: "ss-auth-link", onClick: s, children: "Sign up" }) : r ? /* @__PURE__ */ e("a", { className: "ss-auth-link", href: r, children: "Sign up" }) : /* @__PURE__ */ e("span", { className: "ss-auth-link", children: "Sign up" })
|
|
2971
3023
|
] })
|
|
2972
3024
|
] }) }) });
|
|
2973
3025
|
}
|
|
2974
|
-
function
|
|
2975
|
-
const { appearance:
|
|
2976
|
-
async (
|
|
2977
|
-
if (
|
|
2978
|
-
|
|
3026
|
+
function ce({ appearance: a, signInUrl: r, onSignIn: s }) {
|
|
3027
|
+
const { appearance: i, settings: n } = M(), { signUp: u, isLoading: l, error: d, setError: c } = Pa(), { signInWithOAuth: o } = oa(), m = a ?? i, [p, h] = g(""), [y, x] = g(""), [v, z] = g(""), [N, O] = g(!1), [C, f] = g(null), P = k(
|
|
3028
|
+
async (b) => {
|
|
3029
|
+
if (b.preventDefault(), f(null), y !== v) {
|
|
3030
|
+
f("Passwords do not match");
|
|
2979
3031
|
return;
|
|
2980
3032
|
}
|
|
2981
|
-
const
|
|
2982
|
-
if (
|
|
2983
|
-
|
|
3033
|
+
const w = (n == null ? void 0 : n.passwordMinLength) ?? 8;
|
|
3034
|
+
if (y.length < w) {
|
|
3035
|
+
f(`Password must be at least ${w} characters`);
|
|
2984
3036
|
return;
|
|
2985
3037
|
}
|
|
2986
|
-
await u(p,
|
|
3038
|
+
await u(p, y);
|
|
2987
3039
|
},
|
|
2988
|
-
[p,
|
|
2989
|
-
),
|
|
2990
|
-
async (
|
|
2991
|
-
await
|
|
3040
|
+
[p, y, v, n, u]
|
|
3041
|
+
), I = k(
|
|
3042
|
+
async (b) => {
|
|
3043
|
+
await o(b);
|
|
2992
3044
|
},
|
|
2993
|
-
[
|
|
2994
|
-
),
|
|
2995
|
-
return /* @__PURE__ */ e(
|
|
3045
|
+
[o]
|
|
3046
|
+
), L = (n == null ? void 0 : n.googleEnabled) || (n == null ? void 0 : n.githubEnabled), A = C || d;
|
|
3047
|
+
return /* @__PURE__ */ e(j, { appearance: m, children: /* @__PURE__ */ t("div", { style: { display: "flex", flexDirection: "column", alignItems: "center", width: "100%", maxWidth: "520px" }, children: [
|
|
2996
3048
|
/* @__PURE__ */ t("div", { className: "ss-auth-header", children: [
|
|
2997
|
-
/* @__PURE__ */ e("div", { className: "ss-auth-brand-icon-gradient", children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children:
|
|
3049
|
+
/* @__PURE__ */ e("div", { className: "ss-auth-brand-icon-gradient", children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: S.autoAwesome }) }),
|
|
2998
3050
|
/* @__PURE__ */ e("h1", { className: "ss-auth-title ss-auth-title-lg", children: "Create your account" }),
|
|
2999
3051
|
/* @__PURE__ */ e("p", { className: "ss-auth-subtitle", children: "Join the ecosystem" })
|
|
3000
3052
|
] }),
|
|
3001
3053
|
/* @__PURE__ */ e("div", { className: "ss-auth-card", children: /* @__PURE__ */ t("div", { className: "ss-auth-card-body", children: [
|
|
3002
|
-
|
|
3054
|
+
L && /* @__PURE__ */ t(R, { children: [
|
|
3003
3055
|
/* @__PURE__ */ t("div", { className: "ss-auth-oauth-grid", children: [
|
|
3004
3056
|
(n == null ? void 0 : n.googleEnabled) && /* @__PURE__ */ t(
|
|
3005
3057
|
"button",
|
|
3006
3058
|
{
|
|
3007
3059
|
type: "button",
|
|
3008
3060
|
className: "ss-auth-btn-social",
|
|
3009
|
-
onClick: () =>
|
|
3010
|
-
disabled:
|
|
3061
|
+
onClick: () => I("google"),
|
|
3062
|
+
disabled: l,
|
|
3011
3063
|
children: [
|
|
3012
|
-
/* @__PURE__ */ e("span", { dangerouslySetInnerHTML: { __html:
|
|
3064
|
+
/* @__PURE__ */ e("span", { dangerouslySetInnerHTML: { __html: la } }),
|
|
3013
3065
|
"Google"
|
|
3014
3066
|
]
|
|
3015
3067
|
}
|
|
@@ -3019,10 +3071,10 @@ function ne({ appearance: a, signInUrl: s, onSignIn: r }) {
|
|
|
3019
3071
|
{
|
|
3020
3072
|
type: "button",
|
|
3021
3073
|
className: "ss-auth-btn-social",
|
|
3022
|
-
onClick: () =>
|
|
3023
|
-
disabled:
|
|
3074
|
+
onClick: () => I("github"),
|
|
3075
|
+
disabled: l,
|
|
3024
3076
|
children: [
|
|
3025
|
-
/* @__PURE__ */ e("span", { dangerouslySetInnerHTML: { __html:
|
|
3077
|
+
/* @__PURE__ */ e("span", { dangerouslySetInnerHTML: { __html: ca } }),
|
|
3026
3078
|
"GitHub"
|
|
3027
3079
|
]
|
|
3028
3080
|
}
|
|
@@ -3030,11 +3082,11 @@ function ne({ appearance: a, signInUrl: s, onSignIn: r }) {
|
|
|
3030
3082
|
] }),
|
|
3031
3083
|
/* @__PURE__ */ e("div", { className: "ss-auth-divider", children: "or sign up with email" })
|
|
3032
3084
|
] }),
|
|
3033
|
-
|
|
3034
|
-
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children:
|
|
3035
|
-
/* @__PURE__ */ e("span", { children:
|
|
3085
|
+
A && /* @__PURE__ */ t("div", { className: "ss-auth-error", children: [
|
|
3086
|
+
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: S.errorOutline }),
|
|
3087
|
+
/* @__PURE__ */ e("span", { children: A })
|
|
3036
3088
|
] }),
|
|
3037
|
-
/* @__PURE__ */ t("form", { onSubmit:
|
|
3089
|
+
/* @__PURE__ */ t("form", { onSubmit: P, children: [
|
|
3038
3090
|
/* @__PURE__ */ t("div", { className: "ss-auth-field", children: [
|
|
3039
3091
|
/* @__PURE__ */ e("label", { className: "ss-auth-label", htmlFor: "ss-signup-email", children: "Email" }),
|
|
3040
3092
|
/* @__PURE__ */ e(
|
|
@@ -3046,7 +3098,7 @@ function ne({ appearance: a, signInUrl: s, onSignIn: r }) {
|
|
|
3046
3098
|
autoComplete: "email",
|
|
3047
3099
|
placeholder: "name@company.com",
|
|
3048
3100
|
value: p,
|
|
3049
|
-
onChange: (
|
|
3101
|
+
onChange: (b) => h(b.target.value),
|
|
3050
3102
|
required: !0
|
|
3051
3103
|
}
|
|
3052
3104
|
)
|
|
@@ -3059,12 +3111,12 @@ function ne({ appearance: a, signInUrl: s, onSignIn: r }) {
|
|
|
3059
3111
|
{
|
|
3060
3112
|
id: "ss-signup-password",
|
|
3061
3113
|
className: "ss-auth-input",
|
|
3062
|
-
type:
|
|
3114
|
+
type: N ? "text" : "password",
|
|
3063
3115
|
autoComplete: "new-password",
|
|
3064
3116
|
placeholder: "••••••••",
|
|
3065
|
-
value:
|
|
3066
|
-
onChange: (
|
|
3067
|
-
|
|
3117
|
+
value: y,
|
|
3118
|
+
onChange: (b) => {
|
|
3119
|
+
x(b.target.value), f(null);
|
|
3068
3120
|
},
|
|
3069
3121
|
required: !0
|
|
3070
3122
|
}
|
|
@@ -3074,8 +3126,8 @@ function ne({ appearance: a, signInUrl: s, onSignIn: r }) {
|
|
|
3074
3126
|
{
|
|
3075
3127
|
type: "button",
|
|
3076
3128
|
className: "ss-auth-visibility-toggle",
|
|
3077
|
-
onClick: () =>
|
|
3078
|
-
children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children:
|
|
3129
|
+
onClick: () => O(!N),
|
|
3130
|
+
children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: N ? S.visibilityOff : S.visibility })
|
|
3079
3131
|
}
|
|
3080
3132
|
)
|
|
3081
3133
|
] })
|
|
@@ -3090,87 +3142,86 @@ function ne({ appearance: a, signInUrl: s, onSignIn: r }) {
|
|
|
3090
3142
|
type: "password",
|
|
3091
3143
|
autoComplete: "new-password",
|
|
3092
3144
|
placeholder: "••••••••",
|
|
3093
|
-
value:
|
|
3094
|
-
onChange: (
|
|
3095
|
-
|
|
3145
|
+
value: v,
|
|
3146
|
+
onChange: (b) => {
|
|
3147
|
+
z(b.target.value), f(null);
|
|
3096
3148
|
},
|
|
3097
3149
|
required: !0
|
|
3098
3150
|
}
|
|
3099
3151
|
)
|
|
3100
3152
|
] }),
|
|
3101
|
-
/* @__PURE__ */ t("button", { type: "submit", className: "ss-auth-btn-primary", disabled:
|
|
3102
|
-
|
|
3153
|
+
/* @__PURE__ */ t("button", { type: "submit", className: "ss-auth-btn-primary", disabled: l, children: [
|
|
3154
|
+
l && /* @__PURE__ */ e("span", { className: "ss-auth-spinner" }),
|
|
3103
3155
|
"Sign up",
|
|
3104
|
-
!
|
|
3156
|
+
!l && /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: S.arrowForward })
|
|
3105
3157
|
] })
|
|
3106
3158
|
] }),
|
|
3107
3159
|
/* @__PURE__ */ t("div", { className: "ss-auth-footer", children: [
|
|
3108
3160
|
"Already have an account?",
|
|
3109
3161
|
" ",
|
|
3110
|
-
|
|
3162
|
+
s ? /* @__PURE__ */ e("span", { className: "ss-auth-link", onClick: s, children: "Sign in" }) : r ? /* @__PURE__ */ e("a", { className: "ss-auth-link", href: r, children: "Sign in" }) : /* @__PURE__ */ e("span", { className: "ss-auth-link", children: "Sign in" })
|
|
3111
3163
|
] })
|
|
3112
3164
|
] }) })
|
|
3113
3165
|
] }) });
|
|
3114
3166
|
}
|
|
3115
|
-
const
|
|
3116
|
-
|
|
3117
|
-
|
|
3118
|
-
|
|
3119
|
-
|
|
3120
|
-
|
|
3121
|
-
|
|
3122
|
-
|
|
3123
|
-
|
|
3124
|
-
|
|
3125
|
-
|
|
3126
|
-
|
|
3127
|
-
|
|
3128
|
-
|
|
3129
|
-
|
|
3130
|
-
|
|
3131
|
-
|
|
3132
|
-
|
|
3133
|
-
|
|
3134
|
-
f(!0), p.current = { x: h.clientX, y: h.clientY, ox: l.x, oy: l.y }, h.target.setPointerCapture(h.pointerId);
|
|
3167
|
+
const V = 320, q = 128, Ea = xa(function({ file: r, onCrop: s, onCancel: i }, n) {
|
|
3168
|
+
const u = W(null), l = W(null), [d, c] = g(1), [o, m] = g({ x: 0, y: 0 }), [p, h] = g(!1), y = W({ x: 0, y: 0, ox: 0, oy: 0 }), [x, v] = g(!1);
|
|
3169
|
+
U(() => {
|
|
3170
|
+
const f = new Image(), P = URL.createObjectURL(r);
|
|
3171
|
+
return f.onload = () => {
|
|
3172
|
+
l.current = f, v(!0), m({ x: 0, y: 0 }), c(1);
|
|
3173
|
+
}, f.src = P, () => URL.revokeObjectURL(P);
|
|
3174
|
+
}, [r]), U(() => {
|
|
3175
|
+
if (!x || !l.current || !u.current) return;
|
|
3176
|
+
const f = u.current.getContext("2d");
|
|
3177
|
+
if (!f) return;
|
|
3178
|
+
const P = l.current;
|
|
3179
|
+
f.clearRect(0, 0, V, V), f.fillStyle = "#111", f.fillRect(0, 0, V, V);
|
|
3180
|
+
const I = Math.max(V / P.width, V / P.height) * d, L = P.width * I, A = P.height * I, b = (V - L) / 2 + o.x, w = (V - A) / 2 + o.y;
|
|
3181
|
+
f.save(), f.beginPath(), f.arc(V / 2, V / 2, q, 0, Math.PI * 2), f.clip(), f.drawImage(P, b, w, L, A), f.restore(), f.save(), f.fillStyle = "rgba(0, 0, 0, 0.6)", f.fillRect(0, 0, V, V), f.globalCompositeOperation = "destination-out", f.beginPath(), f.arc(V / 2, V / 2, q, 0, Math.PI * 2), f.fill(), f.restore(), f.save(), f.beginPath(), f.arc(V / 2, V / 2, q, 0, Math.PI * 2), f.clip(), f.drawImage(P, b, w, L, A), f.restore(), f.strokeStyle = "rgba(255, 255, 255, 0.4)", f.lineWidth = 2, f.beginPath(), f.arc(V / 2, V / 2, q, 0, Math.PI * 2), f.stroke();
|
|
3182
|
+
}, [d, o, x]);
|
|
3183
|
+
const z = k(
|
|
3184
|
+
(f) => {
|
|
3185
|
+
h(!0), y.current = { x: f.clientX, y: f.clientY, ox: o.x, oy: o.y }, f.target.setPointerCapture(f.pointerId);
|
|
3135
3186
|
},
|
|
3136
|
-
[
|
|
3137
|
-
),
|
|
3138
|
-
(
|
|
3139
|
-
|
|
3140
|
-
x:
|
|
3141
|
-
y:
|
|
3187
|
+
[o]
|
|
3188
|
+
), N = k(
|
|
3189
|
+
(f) => {
|
|
3190
|
+
p && m({
|
|
3191
|
+
x: y.current.ox + (f.clientX - y.current.x),
|
|
3192
|
+
y: y.current.oy + (f.clientY - y.current.y)
|
|
3142
3193
|
});
|
|
3143
3194
|
},
|
|
3144
|
-
[
|
|
3145
|
-
), O = k(() =>
|
|
3146
|
-
|
|
3147
|
-
|
|
3148
|
-
|
|
3149
|
-
|
|
3150
|
-
|
|
3151
|
-
|
|
3152
|
-
|
|
3153
|
-
|
|
3154
|
-
S && s(S);
|
|
3195
|
+
[p]
|
|
3196
|
+
), O = k(() => h(!1), []), C = k(() => {
|
|
3197
|
+
if (!l.current) return;
|
|
3198
|
+
const f = document.createElement("canvas"), P = q * 2;
|
|
3199
|
+
f.width = P, f.height = P;
|
|
3200
|
+
const I = f.getContext("2d");
|
|
3201
|
+
if (!I) return;
|
|
3202
|
+
const L = l.current, A = Math.max(V / L.width, V / L.height) * d, b = L.width * A, w = L.height * A, E = (V - b) / 2 + o.x - (V / 2 - q), B = (V - w) / 2 + o.y - (V / 2 - q);
|
|
3203
|
+
I.beginPath(), I.arc(q, q, q, 0, Math.PI * 2), I.clip(), I.drawImage(L, E, B, b, w), f.toBlob((F) => {
|
|
3204
|
+
F && s(F);
|
|
3155
3205
|
}, "image/png");
|
|
3156
|
-
}, [
|
|
3206
|
+
}, [d, o, s]);
|
|
3207
|
+
return ya(n, () => ({ triggerCrop: () => C() }), [C]), /* @__PURE__ */ t("div", { style: { display: "flex", flexDirection: "column", alignItems: "center", gap: "24px" }, children: [
|
|
3157
3208
|
/* @__PURE__ */ t("div", { className: "ss-auth-crop-area", children: [
|
|
3158
3209
|
/* @__PURE__ */ e(
|
|
3159
3210
|
"canvas",
|
|
3160
3211
|
{
|
|
3161
|
-
ref:
|
|
3162
|
-
width:
|
|
3163
|
-
height:
|
|
3164
|
-
style: { cursor:
|
|
3165
|
-
onPointerDown:
|
|
3166
|
-
onPointerMove:
|
|
3212
|
+
ref: u,
|
|
3213
|
+
width: V,
|
|
3214
|
+
height: V,
|
|
3215
|
+
style: { cursor: p ? "grabbing" : "grab", width: "100%", height: "100%" },
|
|
3216
|
+
onPointerDown: z,
|
|
3217
|
+
onPointerMove: N,
|
|
3167
3218
|
onPointerUp: O
|
|
3168
3219
|
}
|
|
3169
3220
|
),
|
|
3170
3221
|
/* @__PURE__ */ e("div", { className: "ss-auth-crop-size-badge", children: "256 x 256 px" })
|
|
3171
3222
|
] }),
|
|
3172
3223
|
/* @__PURE__ */ t("div", { className: "ss-auth-zoom-control", style: { width: "100%", maxWidth: "280px" }, children: [
|
|
3173
|
-
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children:
|
|
3224
|
+
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: S.zoomOut }),
|
|
3174
3225
|
/* @__PURE__ */ e(
|
|
3175
3226
|
"input",
|
|
3176
3227
|
{
|
|
@@ -3178,211 +3229,211 @@ function za({ file: a, onCrop: s, onCancel: r }) {
|
|
|
3178
3229
|
min: "1",
|
|
3179
3230
|
max: "3",
|
|
3180
3231
|
step: "0.01",
|
|
3181
|
-
value:
|
|
3182
|
-
onChange: (
|
|
3232
|
+
value: d,
|
|
3233
|
+
onChange: (f) => c(parseFloat(f.target.value)),
|
|
3183
3234
|
className: "ss-auth-zoom-slider"
|
|
3184
3235
|
}
|
|
3185
3236
|
),
|
|
3186
|
-
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children:
|
|
3237
|
+
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: S.zoomIn })
|
|
3187
3238
|
] })
|
|
3188
3239
|
] });
|
|
3189
|
-
}
|
|
3190
|
-
function
|
|
3191
|
-
const [
|
|
3192
|
-
if (!
|
|
3193
|
-
|
|
3240
|
+
});
|
|
3241
|
+
function da({ onUpload: a, onClose: r, isLoading: s }) {
|
|
3242
|
+
const [i, n] = g(null), [u, l] = g(!1), [d, c] = g(null), o = W(null), m = W(null), p = k((x) => {
|
|
3243
|
+
if (!x.type.startsWith("image/")) {
|
|
3244
|
+
c("Please select an image file");
|
|
3194
3245
|
return;
|
|
3195
3246
|
}
|
|
3196
|
-
if (
|
|
3197
|
-
|
|
3247
|
+
if (x.size > 5 * 1024 * 1024) {
|
|
3248
|
+
c("Image must be smaller than 5 MB");
|
|
3198
3249
|
return;
|
|
3199
3250
|
}
|
|
3200
|
-
|
|
3201
|
-
}, []),
|
|
3202
|
-
(
|
|
3203
|
-
|
|
3204
|
-
const
|
|
3205
|
-
|
|
3251
|
+
c(null), n(x);
|
|
3252
|
+
}, []), h = k(
|
|
3253
|
+
(x) => {
|
|
3254
|
+
x.preventDefault(), l(!1);
|
|
3255
|
+
const v = x.dataTransfer.files[0];
|
|
3256
|
+
v && p(v);
|
|
3206
3257
|
},
|
|
3207
|
-
[
|
|
3208
|
-
),
|
|
3209
|
-
async (
|
|
3210
|
-
await a(
|
|
3258
|
+
[p]
|
|
3259
|
+
), y = k(
|
|
3260
|
+
async (x) => {
|
|
3261
|
+
await a(x);
|
|
3211
3262
|
},
|
|
3212
3263
|
[a]
|
|
3213
3264
|
);
|
|
3214
|
-
return /* @__PURE__ */ e("div", { className: "ss-auth-modal-overlay", onClick: (
|
|
3215
|
-
|
|
3216
|
-
}, children: /* @__PURE__ */ t("div", { className: "ss-auth-modal
|
|
3265
|
+
return /* @__PURE__ */ e("div", { className: "ss-auth-modal-overlay", onClick: (x) => {
|
|
3266
|
+
x.target === x.currentTarget && r();
|
|
3267
|
+
}, children: /* @__PURE__ */ t("div", { className: "ss-auth-modal", style: { maxWidth: "480px" }, children: [
|
|
3217
3268
|
/* @__PURE__ */ t("div", { className: "ss-auth-modal-header", children: [
|
|
3218
3269
|
/* @__PURE__ */ e("h2", { children: "Upload avatar" }),
|
|
3219
|
-
/* @__PURE__ */ e("button", { type: "button", className: "ss-auth-modal-close", onClick:
|
|
3270
|
+
/* @__PURE__ */ e("button", { type: "button", className: "ss-auth-modal-close", onClick: r, children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: S.close }) })
|
|
3220
3271
|
] }),
|
|
3221
3272
|
/* @__PURE__ */ t("div", { className: "ss-auth-modal-body", children: [
|
|
3222
|
-
|
|
3223
|
-
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children:
|
|
3224
|
-
/* @__PURE__ */ e("span", { children:
|
|
3273
|
+
d && /* @__PURE__ */ t("div", { className: "ss-auth-error", style: { marginBottom: "16px" }, children: [
|
|
3274
|
+
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: S.errorOutline }),
|
|
3275
|
+
/* @__PURE__ */ e("span", { children: d })
|
|
3225
3276
|
] }),
|
|
3226
|
-
/* @__PURE__ */ t(
|
|
3227
|
-
/* @__PURE__ */ e(
|
|
3228
|
-
|
|
3277
|
+
i ? /* @__PURE__ */ t(R, { children: [
|
|
3278
|
+
/* @__PURE__ */ e(Ea, { ref: m, file: i, onCrop: y, onCancel: () => n(null) }),
|
|
3279
|
+
/* @__PURE__ */ e("div", { style: { textAlign: "center", marginTop: "8px" }, children: /* @__PURE__ */ t(
|
|
3280
|
+
"button",
|
|
3229
3281
|
{
|
|
3230
|
-
|
|
3231
|
-
|
|
3232
|
-
|
|
3233
|
-
|
|
3234
|
-
|
|
3235
|
-
|
|
3236
|
-
gap: "8px",
|
|
3237
|
-
width: "100%",
|
|
3238
|
-
aspectRatio: "1"
|
|
3282
|
+
type: "button",
|
|
3283
|
+
className: "ss-auth-btn-ghost",
|
|
3284
|
+
style: { fontSize: "13px" },
|
|
3285
|
+
onClick: () => {
|
|
3286
|
+
var x;
|
|
3287
|
+
return (x = o.current) == null ? void 0 : x.click();
|
|
3239
3288
|
},
|
|
3240
3289
|
children: [
|
|
3241
|
-
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", style: { fontSize: "
|
|
3242
|
-
|
|
3290
|
+
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", style: { fontSize: "16px" }, children: S.image }),
|
|
3291
|
+
"Change image"
|
|
3243
3292
|
]
|
|
3244
3293
|
}
|
|
3245
|
-
) })
|
|
3246
|
-
|
|
3247
|
-
|
|
3248
|
-
|
|
3249
|
-
|
|
3250
|
-
|
|
3251
|
-
|
|
3252
|
-
|
|
3253
|
-
|
|
3254
|
-
|
|
3255
|
-
|
|
3256
|
-
|
|
3257
|
-
|
|
3258
|
-
|
|
3259
|
-
|
|
3260
|
-
|
|
3261
|
-
|
|
3262
|
-
|
|
3263
|
-
|
|
3264
|
-
|
|
3265
|
-
|
|
3266
|
-
|
|
3267
|
-
|
|
3268
|
-
|
|
3269
|
-
|
|
3270
|
-
|
|
3271
|
-
|
|
3272
|
-
|
|
3273
|
-
|
|
3274
|
-
|
|
3275
|
-
|
|
3276
|
-
|
|
3277
|
-
|
|
3278
|
-
|
|
3279
|
-
|
|
3280
|
-
|
|
3281
|
-
|
|
3282
|
-
|
|
3283
|
-
|
|
3284
|
-
|
|
3285
|
-
|
|
3286
|
-
|
|
3287
|
-
|
|
3288
|
-
/* @__PURE__ */ e("span", { children: "Your profile photo will be visible to all members of your organization." })
|
|
3289
|
-
] })
|
|
3290
|
-
] })
|
|
3294
|
+
) })
|
|
3295
|
+
] }) : /* @__PURE__ */ t(
|
|
3296
|
+
"div",
|
|
3297
|
+
{
|
|
3298
|
+
className: `ss-auth-dropzone${u ? " ss-auth-dropzone-active" : ""}`,
|
|
3299
|
+
onDragOver: (x) => {
|
|
3300
|
+
x.preventDefault(), l(!0);
|
|
3301
|
+
},
|
|
3302
|
+
onDragLeave: () => l(!1),
|
|
3303
|
+
onDrop: h,
|
|
3304
|
+
onClick: () => {
|
|
3305
|
+
var x;
|
|
3306
|
+
return (x = o.current) == null ? void 0 : x.click();
|
|
3307
|
+
},
|
|
3308
|
+
style: { minHeight: "240px" },
|
|
3309
|
+
children: [
|
|
3310
|
+
/* @__PURE__ */ e("div", { className: "ss-auth-dropzone-icon", children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: S.cloudUpload }) }),
|
|
3311
|
+
/* @__PURE__ */ e("span", { className: "ss-auth-dropzone-title", children: "Drag and drop" }),
|
|
3312
|
+
/* @__PURE__ */ t("span", { className: "ss-auth-dropzone-desc", children: [
|
|
3313
|
+
"JPG, PNG or WEBP",
|
|
3314
|
+
/* @__PURE__ */ e("br", {}),
|
|
3315
|
+
"Max file size 5 MB"
|
|
3316
|
+
] }),
|
|
3317
|
+
/* @__PURE__ */ e("button", { type: "button", className: "ss-auth-dropzone-btn", children: "Choose File" })
|
|
3318
|
+
]
|
|
3319
|
+
}
|
|
3320
|
+
),
|
|
3321
|
+
/* @__PURE__ */ e(
|
|
3322
|
+
"input",
|
|
3323
|
+
{
|
|
3324
|
+
ref: o,
|
|
3325
|
+
type: "file",
|
|
3326
|
+
accept: "image/*",
|
|
3327
|
+
style: { display: "none" },
|
|
3328
|
+
onChange: (x) => {
|
|
3329
|
+
var v;
|
|
3330
|
+
(v = x.target.files) != null && v[0] && p(x.target.files[0]);
|
|
3331
|
+
}
|
|
3332
|
+
}
|
|
3333
|
+
),
|
|
3334
|
+
/* @__PURE__ */ t("div", { className: "ss-auth-info-box", style: { marginTop: "16px" }, children: [
|
|
3335
|
+
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: S.info }),
|
|
3336
|
+
/* @__PURE__ */ e("span", { children: "Your profile photo will be visible to all members of your organization." })
|
|
3291
3337
|
] })
|
|
3292
3338
|
] }),
|
|
3293
3339
|
/* @__PURE__ */ t("div", { className: "ss-auth-modal-footer", children: [
|
|
3294
|
-
/* @__PURE__ */ e("button", { type: "button", className: "ss-auth-btn-ghost", onClick:
|
|
3340
|
+
/* @__PURE__ */ e("button", { type: "button", className: "ss-auth-btn-ghost", onClick: r, children: "Cancel" }),
|
|
3295
3341
|
/* @__PURE__ */ t(
|
|
3296
3342
|
"button",
|
|
3297
3343
|
{
|
|
3298
3344
|
type: "button",
|
|
3299
3345
|
className: "ss-auth-btn-primary ss-auth-btn-sm",
|
|
3300
3346
|
onClick: () => {
|
|
3347
|
+
var x;
|
|
3348
|
+
return (x = m.current) == null ? void 0 : x.triggerCrop();
|
|
3301
3349
|
},
|
|
3302
|
-
disabled: !
|
|
3350
|
+
disabled: !i || s,
|
|
3303
3351
|
style: { width: "auto" },
|
|
3304
3352
|
children: [
|
|
3305
|
-
|
|
3353
|
+
s && /* @__PURE__ */ e("span", { className: "ss-auth-spinner" }),
|
|
3306
3354
|
"Save Profile",
|
|
3307
|
-
!
|
|
3355
|
+
!s && /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: S.check })
|
|
3308
3356
|
]
|
|
3309
3357
|
}
|
|
3310
3358
|
)
|
|
3311
3359
|
] })
|
|
3312
3360
|
] }) });
|
|
3313
3361
|
}
|
|
3314
|
-
function
|
|
3315
|
-
const [
|
|
3316
|
-
{ key: "profile", label: "Profile", icon:
|
|
3317
|
-
{ key: "organization", label: "Organization", icon:
|
|
3318
|
-
{ key: "people", label: "People", icon:
|
|
3319
|
-
{ key: "
|
|
3362
|
+
function Ia({ onClose: a, afterDeleteAccountUrl: r, defaultTab: s = "profile", onOrgDeleted: i, onOrgUpdated: n }) {
|
|
3363
|
+
const [u, l] = g(s), { invites: d } = ra(), c = [
|
|
3364
|
+
{ key: "profile", label: "Profile", icon: S.person },
|
|
3365
|
+
{ key: "organization", label: "Organization", icon: S.corporateFare },
|
|
3366
|
+
{ key: "people", label: "People", icon: S.group },
|
|
3367
|
+
{ key: "invites", label: "Invites", icon: S.mail, badge: d.length || void 0 },
|
|
3368
|
+
{ key: "billing", label: "Billing", icon: S.creditCard }
|
|
3320
3369
|
];
|
|
3321
3370
|
return /* @__PURE__ */ t("div", { className: "ss-auth-settings-page", children: [
|
|
3322
3371
|
/* @__PURE__ */ t("div", { className: "ss-auth-settings-header", children: [
|
|
3323
3372
|
/* @__PURE__ */ t("div", { style: { display: "flex", alignItems: "center", gap: "12px" }, children: [
|
|
3324
|
-
/* @__PURE__ */ e("button", { type: "button", className: "ss-auth-settings-back", onClick: a, children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children:
|
|
3373
|
+
/* @__PURE__ */ e("button", { type: "button", className: "ss-auth-settings-back", onClick: a, children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: S.arrowBack }) }),
|
|
3325
3374
|
/* @__PURE__ */ e("h2", { children: "Settings" })
|
|
3326
3375
|
] }),
|
|
3327
|
-
/* @__PURE__ */ e("button", { type: "button", className: "ss-auth-modal-close", onClick: a, children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children:
|
|
3376
|
+
/* @__PURE__ */ e("button", { type: "button", className: "ss-auth-modal-close", onClick: a, children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: S.close }) })
|
|
3328
3377
|
] }),
|
|
3329
3378
|
/* @__PURE__ */ t("div", { className: "ss-auth-settings-layout", children: [
|
|
3330
|
-
/* @__PURE__ */ e("nav", { className: "ss-auth-settings-nav", children:
|
|
3379
|
+
/* @__PURE__ */ e("nav", { className: "ss-auth-settings-nav", children: c.map((o) => /* @__PURE__ */ t(
|
|
3331
3380
|
"button",
|
|
3332
3381
|
{
|
|
3333
3382
|
type: "button",
|
|
3334
|
-
className: `ss-auth-settings-nav-item${
|
|
3335
|
-
onClick: () =>
|
|
3383
|
+
className: `ss-auth-settings-nav-item${u === o.key ? " ss-auth-settings-nav-item-active" : ""}`,
|
|
3384
|
+
onClick: () => l(o.key),
|
|
3336
3385
|
children: [
|
|
3337
|
-
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children:
|
|
3338
|
-
|
|
3386
|
+
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: o.icon }),
|
|
3387
|
+
o.label,
|
|
3388
|
+
o.badge != null && o.badge > 0 && /* @__PURE__ */ e("span", { className: "ss-auth-invite-badge", style: { position: "static", marginLeft: "6px" }, children: o.badge })
|
|
3339
3389
|
]
|
|
3340
3390
|
},
|
|
3341
|
-
|
|
3391
|
+
o.key
|
|
3342
3392
|
)) }),
|
|
3343
3393
|
/* @__PURE__ */ t("div", { className: "ss-auth-settings-content", children: [
|
|
3344
|
-
|
|
3345
|
-
|
|
3346
|
-
|
|
3347
|
-
|
|
3394
|
+
u === "profile" && /* @__PURE__ */ e(Ba, { afterDeleteAccountUrl: r }),
|
|
3395
|
+
u === "organization" && /* @__PURE__ */ e(Fa, { onOrgDeleted: i, onOrgUpdated: n }),
|
|
3396
|
+
u === "people" && /* @__PURE__ */ e(La, {}),
|
|
3397
|
+
u === "invites" && /* @__PURE__ */ e(Aa, {}),
|
|
3398
|
+
u === "billing" && /* @__PURE__ */ e(Da, {})
|
|
3348
3399
|
] })
|
|
3349
3400
|
] })
|
|
3350
3401
|
] });
|
|
3351
3402
|
}
|
|
3352
|
-
function
|
|
3353
|
-
const { user:
|
|
3354
|
-
async (
|
|
3355
|
-
|
|
3403
|
+
function Ba({ afterDeleteAccountUrl: a }) {
|
|
3404
|
+
const { user: r, updateProfile: s, uploadAvatar: i, changePassword: n, isLoading: u, error: l, success: d, setError: c, setSuccess: o } = ia(), { signOut: m } = sa(), { deleteAccount: p, isLoading: h, error: y, setError: x } = Oa(), [v, z] = g((r == null ? void 0 : r.name) ?? ""), [N, O] = g((r == null ? void 0 : r.avatarUrl) ?? ""), [C, f] = g(!1), [P, I] = g(""), [L, A] = g(""), [b, w] = g(""), [E, B] = g(null), [F, D] = g(!1), [$, T] = g(""), _ = k(
|
|
3405
|
+
async (H) => {
|
|
3406
|
+
H.preventDefault(), c(null), o(null), await s({ name: v, avatarUrl: N || void 0 });
|
|
3356
3407
|
},
|
|
3357
|
-
[
|
|
3408
|
+
[v, N, s, c, o]
|
|
3358
3409
|
), K = k(
|
|
3359
|
-
async (
|
|
3360
|
-
const X = await
|
|
3361
|
-
X && (
|
|
3410
|
+
async (H) => {
|
|
3411
|
+
const X = await i(H);
|
|
3412
|
+
X && (O(X.avatarUrl), f(!1));
|
|
3362
3413
|
},
|
|
3363
|
-
[
|
|
3414
|
+
[i]
|
|
3364
3415
|
), J = k(
|
|
3365
|
-
async (
|
|
3366
|
-
if (
|
|
3367
|
-
|
|
3416
|
+
async (H) => {
|
|
3417
|
+
if (H.preventDefault(), B(null), c(null), o(null), L !== b) {
|
|
3418
|
+
B("Passwords do not match");
|
|
3368
3419
|
return;
|
|
3369
3420
|
}
|
|
3370
|
-
if (
|
|
3371
|
-
|
|
3421
|
+
if (L.length < 8) {
|
|
3422
|
+
B("Password must be at least 8 characters");
|
|
3372
3423
|
return;
|
|
3373
3424
|
}
|
|
3374
|
-
await n(
|
|
3425
|
+
await n(P, L) && (I(""), A(""), w(""));
|
|
3375
3426
|
},
|
|
3376
|
-
[
|
|
3377
|
-
),
|
|
3378
|
-
await p() && (await
|
|
3379
|
-
}, [p,
|
|
3380
|
-
return /* @__PURE__ */ t(
|
|
3427
|
+
[P, L, b, n, c, o]
|
|
3428
|
+
), pa = k(async () => {
|
|
3429
|
+
await p() && (await m(), a && (window.location.href = a));
|
|
3430
|
+
}, [p, m, a]), ha = (r == null ? void 0 : r.provider) === "email", ga = $ === (r == null ? void 0 : r.email), ma = ((r == null ? void 0 : r.name) || (r == null ? void 0 : r.email) || "?").charAt(0).toUpperCase();
|
|
3431
|
+
return /* @__PURE__ */ t(R, { children: [
|
|
3381
3432
|
/* @__PURE__ */ e("h3", { children: "Profile" }),
|
|
3382
3433
|
/* @__PURE__ */ t("div", { className: "ss-auth-settings-card", children: [
|
|
3383
3434
|
/* @__PURE__ */ t("div", { className: "ss-auth-profile-header", style: { border: "none", background: "none", padding: 0, marginBottom: 16 }, children: [
|
|
3384
|
-
/* @__PURE__ */ t("div", { className: "ss-auth-avatar-lg", onClick: () =>
|
|
3385
|
-
|
|
3435
|
+
/* @__PURE__ */ t("div", { className: "ss-auth-avatar-lg", onClick: () => f(!0), children: [
|
|
3436
|
+
N ? /* @__PURE__ */ e("img", { src: N, alt: "" }) : /* @__PURE__ */ e("div", { style: {
|
|
3386
3437
|
width: "100%",
|
|
3387
3438
|
height: "100%",
|
|
3388
3439
|
display: "flex",
|
|
@@ -3391,32 +3442,32 @@ function Oa({ afterDeleteAccountUrl: a }) {
|
|
|
3391
3442
|
fontSize: "48px",
|
|
3392
3443
|
fontWeight: 800,
|
|
3393
3444
|
opacity: 0.4
|
|
3394
|
-
}, children:
|
|
3445
|
+
}, children: ma }),
|
|
3395
3446
|
/* @__PURE__ */ t("div", { className: "ss-auth-avatar-overlay", children: [
|
|
3396
|
-
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children:
|
|
3447
|
+
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: S.camera }),
|
|
3397
3448
|
/* @__PURE__ */ e("span", { children: "Edit" })
|
|
3398
3449
|
] })
|
|
3399
3450
|
] }),
|
|
3400
3451
|
/* @__PURE__ */ t("div", { className: "ss-auth-profile-info", children: [
|
|
3401
3452
|
/* @__PURE__ */ t("h2", { className: "ss-auth-profile-name", children: [
|
|
3402
|
-
(
|
|
3403
|
-
(
|
|
3404
|
-
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", style: { fontSize: "12px", fontVariationSettings: "'FILL' 1" }, children:
|
|
3453
|
+
(r == null ? void 0 : r.name) || "Unnamed User",
|
|
3454
|
+
(r == null ? void 0 : r.emailVerified) && /* @__PURE__ */ t("span", { className: "ss-auth-badge ss-auth-badge-success", children: [
|
|
3455
|
+
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", style: { fontSize: "12px", fontVariationSettings: "'FILL' 1" }, children: S.verified }),
|
|
3405
3456
|
"Verified"
|
|
3406
3457
|
] })
|
|
3407
3458
|
] }),
|
|
3408
|
-
/* @__PURE__ */ e("p", { className: "ss-auth-profile-desc", children:
|
|
3459
|
+
/* @__PURE__ */ e("p", { className: "ss-auth-profile-desc", children: r == null ? void 0 : r.email })
|
|
3409
3460
|
] })
|
|
3410
3461
|
] }),
|
|
3411
|
-
|
|
3412
|
-
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children:
|
|
3413
|
-
/* @__PURE__ */ e("span", { children: i })
|
|
3414
|
-
] }),
|
|
3415
|
-
l && /* @__PURE__ */ t("div", { className: "ss-auth-info-box", style: { marginBottom: "16px" }, children: [
|
|
3416
|
-
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: v.check }),
|
|
3462
|
+
l && /* @__PURE__ */ t("div", { className: "ss-auth-error", children: [
|
|
3463
|
+
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: S.errorOutline }),
|
|
3417
3464
|
/* @__PURE__ */ e("span", { children: l })
|
|
3418
3465
|
] }),
|
|
3419
|
-
/* @__PURE__ */ t("
|
|
3466
|
+
d && /* @__PURE__ */ t("div", { className: "ss-auth-info-box", style: { marginBottom: "16px" }, children: [
|
|
3467
|
+
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: S.check }),
|
|
3468
|
+
/* @__PURE__ */ e("span", { children: d })
|
|
3469
|
+
] }),
|
|
3470
|
+
/* @__PURE__ */ t("form", { onSubmit: _, children: [
|
|
3420
3471
|
/* @__PURE__ */ t("div", { className: "ss-auth-field", children: [
|
|
3421
3472
|
/* @__PURE__ */ e("label", { className: "ss-auth-label", children: "Full Name" }),
|
|
3422
3473
|
/* @__PURE__ */ e(
|
|
@@ -3425,8 +3476,8 @@ function Oa({ afterDeleteAccountUrl: a }) {
|
|
|
3425
3476
|
className: "ss-auth-input",
|
|
3426
3477
|
type: "text",
|
|
3427
3478
|
placeholder: "Your name",
|
|
3428
|
-
value:
|
|
3429
|
-
onChange: (
|
|
3479
|
+
value: v,
|
|
3480
|
+
onChange: (H) => z(H.target.value)
|
|
3430
3481
|
}
|
|
3431
3482
|
)
|
|
3432
3483
|
] }),
|
|
@@ -3434,13 +3485,13 @@ function Oa({ afterDeleteAccountUrl: a }) {
|
|
|
3434
3485
|
/* @__PURE__ */ t("div", { children: [
|
|
3435
3486
|
/* @__PURE__ */ e("label", { className: "ss-auth-label", children: "Email Address" }),
|
|
3436
3487
|
/* @__PURE__ */ t("div", { style: { position: "relative" }, children: [
|
|
3437
|
-
/* @__PURE__ */ e("input", { className: "ss-auth-input ss-auth-input-readonly", type: "email", value: (
|
|
3438
|
-
/* @__PURE__ */ e("span", { className: "ss-auth-visibility-toggle", style: { cursor: "default" }, children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", style: { fontSize: "18px" }, children:
|
|
3488
|
+
/* @__PURE__ */ e("input", { className: "ss-auth-input ss-auth-input-readonly", type: "email", value: (r == null ? void 0 : r.email) ?? "", readOnly: !0 }),
|
|
3489
|
+
/* @__PURE__ */ e("span", { className: "ss-auth-visibility-toggle", style: { cursor: "default" }, children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", style: { fontSize: "18px" }, children: S.lock }) })
|
|
3439
3490
|
] })
|
|
3440
3491
|
] }),
|
|
3441
3492
|
/* @__PURE__ */ t("div", { children: [
|
|
3442
3493
|
/* @__PURE__ */ e("label", { className: "ss-auth-label", children: "Auth Provider" }),
|
|
3443
|
-
/* @__PURE__ */ e("input", { className: "ss-auth-input ss-auth-input-readonly", type: "text", value: (
|
|
3494
|
+
/* @__PURE__ */ e("input", { className: "ss-auth-input ss-auth-input-readonly", type: "text", value: (r == null ? void 0 : r.provider) ?? "", readOnly: !0 })
|
|
3444
3495
|
] })
|
|
3445
3496
|
] }),
|
|
3446
3497
|
/* @__PURE__ */ e("div", { style: { display: "flex", justifyContent: "flex-end" }, children: /* @__PURE__ */ t("button", { type: "submit", className: "ss-auth-btn-primary ss-auth-btn-sm", disabled: u, style: { width: "auto" }, children: [
|
|
@@ -3449,28 +3500,28 @@ function Oa({ afterDeleteAccountUrl: a }) {
|
|
|
3449
3500
|
] }) })
|
|
3450
3501
|
] })
|
|
3451
3502
|
] }),
|
|
3452
|
-
|
|
3503
|
+
ha && /* @__PURE__ */ t("div", { className: "ss-auth-settings-card", children: [
|
|
3453
3504
|
/* @__PURE__ */ t("h4", { children: [
|
|
3454
|
-
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children:
|
|
3505
|
+
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: S.security }),
|
|
3455
3506
|
"Security Credentials"
|
|
3456
3507
|
] }),
|
|
3457
3508
|
E && /* @__PURE__ */ t("div", { className: "ss-auth-error", style: { marginBottom: "16px" }, children: [
|
|
3458
|
-
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children:
|
|
3509
|
+
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: S.errorOutline }),
|
|
3459
3510
|
/* @__PURE__ */ e("span", { children: E })
|
|
3460
3511
|
] }),
|
|
3461
3512
|
/* @__PURE__ */ t("form", { onSubmit: J, children: [
|
|
3462
3513
|
/* @__PURE__ */ t("div", { className: "ss-auth-field", children: [
|
|
3463
3514
|
/* @__PURE__ */ e("label", { className: "ss-auth-label", children: "Current Password" }),
|
|
3464
|
-
/* @__PURE__ */ e("input", { className: "ss-auth-input", type: "password", placeholder: "••••••••••••", value:
|
|
3515
|
+
/* @__PURE__ */ e("input", { className: "ss-auth-input", type: "password", placeholder: "••••••••••••", value: P, onChange: (H) => I(H.target.value), required: !0 })
|
|
3465
3516
|
] }),
|
|
3466
3517
|
/* @__PURE__ */ t("div", { className: "ss-auth-profile-grid", style: { marginBottom: "16px" }, children: [
|
|
3467
3518
|
/* @__PURE__ */ t("div", { children: [
|
|
3468
3519
|
/* @__PURE__ */ e("label", { className: "ss-auth-label", children: "New Password" }),
|
|
3469
|
-
/* @__PURE__ */ e("input", { className: "ss-auth-input", type: "password", placeholder: "Min. 8 characters", value:
|
|
3520
|
+
/* @__PURE__ */ e("input", { className: "ss-auth-input", type: "password", placeholder: "Min. 8 characters", value: L, onChange: (H) => A(H.target.value), required: !0 })
|
|
3470
3521
|
] }),
|
|
3471
3522
|
/* @__PURE__ */ t("div", { children: [
|
|
3472
3523
|
/* @__PURE__ */ e("label", { className: "ss-auth-label", children: "Confirm New Password" }),
|
|
3473
|
-
/* @__PURE__ */ e("input", { className: "ss-auth-input", type: "password", placeholder: "Repeat new password", value:
|
|
3524
|
+
/* @__PURE__ */ e("input", { className: "ss-auth-input", type: "password", placeholder: "Repeat new password", value: b, onChange: (H) => w(H.target.value), required: !0 })
|
|
3474
3525
|
] })
|
|
3475
3526
|
] }),
|
|
3476
3527
|
/* @__PURE__ */ e("div", { style: { display: "flex", justifyContent: "flex-end" }, children: /* @__PURE__ */ e("button", { type: "submit", className: "ss-auth-btn-ghost", disabled: u, children: "Update Security" }) })
|
|
@@ -3479,11 +3530,11 @@ function Oa({ afterDeleteAccountUrl: a }) {
|
|
|
3479
3530
|
/* @__PURE__ */ t("div", { className: "ss-auth-settings-card ss-auth-settings-danger", children: [
|
|
3480
3531
|
/* @__PURE__ */ e("h4", { children: "Danger Zone" }),
|
|
3481
3532
|
/* @__PURE__ */ e("p", { className: "ss-auth-section-desc", style: { marginBottom: "16px" }, children: "Deleting your account is permanent. All organizations you own will also be deleted." }),
|
|
3482
|
-
|
|
3483
|
-
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children:
|
|
3484
|
-
/* @__PURE__ */ e("span", { children:
|
|
3533
|
+
y && /* @__PURE__ */ t("div", { className: "ss-auth-error", children: [
|
|
3534
|
+
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: S.errorOutline }),
|
|
3535
|
+
/* @__PURE__ */ e("span", { children: y })
|
|
3485
3536
|
] }),
|
|
3486
|
-
|
|
3537
|
+
F ? /* @__PURE__ */ t("div", { children: [
|
|
3487
3538
|
/* @__PURE__ */ t("div", { className: "ss-auth-field", children: [
|
|
3488
3539
|
/* @__PURE__ */ e("label", { className: "ss-auth-label", children: "Type your email to confirm" }),
|
|
3489
3540
|
/* @__PURE__ */ e(
|
|
@@ -3491,9 +3542,9 @@ function Oa({ afterDeleteAccountUrl: a }) {
|
|
|
3491
3542
|
{
|
|
3492
3543
|
className: "ss-auth-input",
|
|
3493
3544
|
type: "email",
|
|
3494
|
-
placeholder:
|
|
3495
|
-
value:
|
|
3496
|
-
onChange: (
|
|
3545
|
+
placeholder: r == null ? void 0 : r.email,
|
|
3546
|
+
value: $,
|
|
3547
|
+
onChange: (H) => T(H.target.value),
|
|
3497
3548
|
autoFocus: !0
|
|
3498
3549
|
}
|
|
3499
3550
|
)
|
|
@@ -3505,7 +3556,7 @@ function Oa({ afterDeleteAccountUrl: a }) {
|
|
|
3505
3556
|
type: "button",
|
|
3506
3557
|
className: "ss-auth-btn-ghost",
|
|
3507
3558
|
onClick: () => {
|
|
3508
|
-
|
|
3559
|
+
D(!1), T(""), x(null);
|
|
3509
3560
|
},
|
|
3510
3561
|
children: "Cancel"
|
|
3511
3562
|
}
|
|
@@ -3516,10 +3567,10 @@ function Oa({ afterDeleteAccountUrl: a }) {
|
|
|
3516
3567
|
type: "button",
|
|
3517
3568
|
className: "ss-auth-btn-primary ss-auth-btn-sm",
|
|
3518
3569
|
style: { width: "auto", background: "linear-gradient(135deg, #ef4444, #dc2626)" },
|
|
3519
|
-
disabled: !
|
|
3520
|
-
onClick:
|
|
3570
|
+
disabled: !ga || h,
|
|
3571
|
+
onClick: pa,
|
|
3521
3572
|
children: [
|
|
3522
|
-
|
|
3573
|
+
h && /* @__PURE__ */ e("span", { className: "ss-auth-spinner" }),
|
|
3523
3574
|
"Delete account"
|
|
3524
3575
|
]
|
|
3525
3576
|
}
|
|
@@ -3531,57 +3582,66 @@ function Oa({ afterDeleteAccountUrl: a }) {
|
|
|
3531
3582
|
type: "button",
|
|
3532
3583
|
className: "ss-auth-btn-outline",
|
|
3533
3584
|
style: { borderColor: "currentColor", width: "auto" },
|
|
3534
|
-
onClick: () =>
|
|
3585
|
+
onClick: () => D(!0),
|
|
3535
3586
|
children: "Delete my account"
|
|
3536
3587
|
}
|
|
3537
3588
|
)
|
|
3538
3589
|
] }),
|
|
3539
3590
|
C && /* @__PURE__ */ e(
|
|
3540
|
-
|
|
3591
|
+
da,
|
|
3541
3592
|
{
|
|
3542
3593
|
onUpload: K,
|
|
3543
|
-
onClose: () =>
|
|
3594
|
+
onClose: () => f(!1),
|
|
3544
3595
|
isLoading: u
|
|
3545
3596
|
}
|
|
3546
3597
|
)
|
|
3547
3598
|
] });
|
|
3548
3599
|
}
|
|
3549
|
-
function
|
|
3550
|
-
const { selectedOrg:
|
|
3551
|
-
if (
|
|
3552
|
-
|
|
3553
|
-
}, [
|
|
3554
|
-
return /* @__PURE__ */ t(
|
|
3600
|
+
function Fa({ onOrgDeleted: a, onOrgUpdated: r }) {
|
|
3601
|
+
const { selectedOrg: s, updateOrg: i, deleteOrg: n, isLoading: u, error: l, setError: d } = Y(), [c, o] = g((s == null ? void 0 : s.name) ?? ""), [m, p] = g(!1), [h, y] = g(!1), [x, v] = g(!1), [z, N] = g(!1), [O, C] = g("");
|
|
3602
|
+
if (U(() => {
|
|
3603
|
+
s && (o(s.name), v(!1));
|
|
3604
|
+
}, [s]), x)
|
|
3605
|
+
return /* @__PURE__ */ t(R, { children: [
|
|
3606
|
+
/* @__PURE__ */ e("h3", { children: "Organization" }),
|
|
3607
|
+
/* @__PURE__ */ t("div", { className: "ss-auth-settings-card", style: { textAlign: "center", padding: "48px 24px" }, children: [
|
|
3608
|
+
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", style: { fontSize: "48px", opacity: 0.4, marginBottom: "16px", display: "block" }, children: S.check }),
|
|
3609
|
+
/* @__PURE__ */ e("h4", { style: { margin: "0 0 8px" }, children: "Organization deleted" }),
|
|
3610
|
+
/* @__PURE__ */ e("p", { className: "ss-auth-section-desc", children: "The organization has been permanently deleted." })
|
|
3611
|
+
] })
|
|
3612
|
+
] });
|
|
3613
|
+
if (!s)
|
|
3614
|
+
return /* @__PURE__ */ t(R, { children: [
|
|
3555
3615
|
/* @__PURE__ */ e("h3", { children: "Organization" }),
|
|
3556
3616
|
/* @__PURE__ */ t("div", { className: "ss-auth-settings-empty", children: [
|
|
3557
|
-
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children:
|
|
3617
|
+
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: S.corporateFare }),
|
|
3558
3618
|
/* @__PURE__ */ e("div", { children: "Select an organization from the user menu to manage its settings." })
|
|
3559
3619
|
] })
|
|
3560
3620
|
] });
|
|
3561
|
-
const
|
|
3562
|
-
if (
|
|
3563
|
-
|
|
3564
|
-
const
|
|
3565
|
-
|
|
3566
|
-
},
|
|
3567
|
-
await
|
|
3621
|
+
const f = async (I) => {
|
|
3622
|
+
if (I.preventDefault(), !c.trim()) return;
|
|
3623
|
+
p(!0), y(!1);
|
|
3624
|
+
const L = await i(s.id, { name: c.trim() });
|
|
3625
|
+
p(!1), L && (y(!0), r == null || r());
|
|
3626
|
+
}, P = async () => {
|
|
3627
|
+
await n(s.id) && (N(!1), v(!0), a == null || a());
|
|
3568
3628
|
};
|
|
3569
|
-
return /* @__PURE__ */ t(
|
|
3629
|
+
return /* @__PURE__ */ t(R, { children: [
|
|
3570
3630
|
/* @__PURE__ */ e("h3", { children: "Organization" }),
|
|
3571
3631
|
/* @__PURE__ */ t("div", { className: "ss-auth-settings-card", children: [
|
|
3572
3632
|
/* @__PURE__ */ t("h4", { children: [
|
|
3573
|
-
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children:
|
|
3633
|
+
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: S.corporateFare }),
|
|
3574
3634
|
"General"
|
|
3575
3635
|
] }),
|
|
3576
|
-
|
|
3577
|
-
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children:
|
|
3578
|
-
/* @__PURE__ */ e("span", { children:
|
|
3636
|
+
l && /* @__PURE__ */ t("div", { className: "ss-auth-error", style: { marginBottom: "16px" }, children: [
|
|
3637
|
+
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: S.errorOutline }),
|
|
3638
|
+
/* @__PURE__ */ e("span", { children: l })
|
|
3579
3639
|
] }),
|
|
3580
|
-
|
|
3581
|
-
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children:
|
|
3640
|
+
h && /* @__PURE__ */ t("div", { className: "ss-auth-info-box", style: { marginBottom: "16px" }, children: [
|
|
3641
|
+
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: S.check }),
|
|
3582
3642
|
/* @__PURE__ */ e("span", { children: "Organization updated" })
|
|
3583
3643
|
] }),
|
|
3584
|
-
/* @__PURE__ */ t("form", { onSubmit:
|
|
3644
|
+
/* @__PURE__ */ t("form", { onSubmit: f, children: [
|
|
3585
3645
|
/* @__PURE__ */ t("div", { className: "ss-auth-field", children: [
|
|
3586
3646
|
/* @__PURE__ */ e("label", { className: "ss-auth-label", children: "Organization Name" }),
|
|
3587
3647
|
/* @__PURE__ */ e(
|
|
@@ -3589,19 +3649,19 @@ function Ea() {
|
|
|
3589
3649
|
{
|
|
3590
3650
|
className: "ss-auth-input",
|
|
3591
3651
|
type: "text",
|
|
3592
|
-
value:
|
|
3593
|
-
onChange: (
|
|
3594
|
-
|
|
3652
|
+
value: c,
|
|
3653
|
+
onChange: (I) => {
|
|
3654
|
+
o(I.target.value), y(!1);
|
|
3595
3655
|
}
|
|
3596
3656
|
}
|
|
3597
3657
|
)
|
|
3598
3658
|
] }),
|
|
3599
3659
|
/* @__PURE__ */ t("div", { className: "ss-auth-field", children: [
|
|
3600
3660
|
/* @__PURE__ */ e("label", { className: "ss-auth-label", children: "Slug" }),
|
|
3601
|
-
/* @__PURE__ */ e("input", { className: "ss-auth-input ss-auth-input-readonly", type: "text", value:
|
|
3661
|
+
/* @__PURE__ */ e("input", { className: "ss-auth-input ss-auth-input-readonly", type: "text", value: s.slug, readOnly: !0 })
|
|
3602
3662
|
] }),
|
|
3603
|
-
/* @__PURE__ */ e("div", { style: { display: "flex", justifyContent: "flex-end" }, children: /* @__PURE__ */ t("button", { type: "submit", className: "ss-auth-btn-primary ss-auth-btn-sm", disabled:
|
|
3604
|
-
|
|
3663
|
+
/* @__PURE__ */ e("div", { style: { display: "flex", justifyContent: "flex-end" }, children: /* @__PURE__ */ t("button", { type: "submit", className: "ss-auth-btn-primary ss-auth-btn-sm", disabled: m, style: { width: "auto" }, children: [
|
|
3664
|
+
m && /* @__PURE__ */ e("span", { className: "ss-auth-spinner" }),
|
|
3605
3665
|
"Save"
|
|
3606
3666
|
] }) })
|
|
3607
3667
|
] })
|
|
@@ -3609,7 +3669,7 @@ function Ea() {
|
|
|
3609
3669
|
/* @__PURE__ */ t("div", { className: "ss-auth-settings-card ss-auth-settings-danger", children: [
|
|
3610
3670
|
/* @__PURE__ */ e("h4", { children: "Danger Zone" }),
|
|
3611
3671
|
/* @__PURE__ */ e("p", { className: "ss-auth-section-desc", style: { marginBottom: "16px" }, children: "Deleting this organization is permanent and will remove all members." }),
|
|
3612
|
-
|
|
3672
|
+
z ? /* @__PURE__ */ t("div", { children: [
|
|
3613
3673
|
/* @__PURE__ */ t("div", { className: "ss-auth-field", children: [
|
|
3614
3674
|
/* @__PURE__ */ e("label", { className: "ss-auth-label", children: "Type the organization name to confirm" }),
|
|
3615
3675
|
/* @__PURE__ */ e(
|
|
@@ -3617,16 +3677,16 @@ function Ea() {
|
|
|
3617
3677
|
{
|
|
3618
3678
|
className: "ss-auth-input",
|
|
3619
3679
|
type: "text",
|
|
3620
|
-
placeholder:
|
|
3621
|
-
value:
|
|
3622
|
-
onChange: (
|
|
3680
|
+
placeholder: s.name,
|
|
3681
|
+
value: O,
|
|
3682
|
+
onChange: (I) => C(I.target.value),
|
|
3623
3683
|
autoFocus: !0
|
|
3624
3684
|
}
|
|
3625
3685
|
)
|
|
3626
3686
|
] }),
|
|
3627
3687
|
/* @__PURE__ */ t("div", { style: { display: "flex", gap: "8px", justifyContent: "flex-end" }, children: [
|
|
3628
3688
|
/* @__PURE__ */ e("button", { type: "button", className: "ss-auth-btn-ghost", onClick: () => {
|
|
3629
|
-
|
|
3689
|
+
N(!1), C("");
|
|
3630
3690
|
}, children: "Cancel" }),
|
|
3631
3691
|
/* @__PURE__ */ t(
|
|
3632
3692
|
"button",
|
|
@@ -3634,10 +3694,10 @@ function Ea() {
|
|
|
3634
3694
|
type: "button",
|
|
3635
3695
|
className: "ss-auth-btn-primary ss-auth-btn-sm",
|
|
3636
3696
|
style: { width: "auto", background: "linear-gradient(135deg, #ef4444, #dc2626)" },
|
|
3637
|
-
disabled:
|
|
3638
|
-
onClick:
|
|
3697
|
+
disabled: O !== s.name || u,
|
|
3698
|
+
onClick: P,
|
|
3639
3699
|
children: [
|
|
3640
|
-
|
|
3700
|
+
u && /* @__PURE__ */ e("span", { className: "ss-auth-spinner" }),
|
|
3641
3701
|
"Delete organization"
|
|
3642
3702
|
]
|
|
3643
3703
|
}
|
|
@@ -3649,63 +3709,63 @@ function Ea() {
|
|
|
3649
3709
|
type: "button",
|
|
3650
3710
|
className: "ss-auth-btn-outline",
|
|
3651
3711
|
style: { borderColor: "currentColor", width: "auto" },
|
|
3652
|
-
onClick: () =>
|
|
3712
|
+
onClick: () => N(!0),
|
|
3653
3713
|
children: "Delete this organization"
|
|
3654
3714
|
}
|
|
3655
3715
|
)
|
|
3656
3716
|
] })
|
|
3657
3717
|
] });
|
|
3658
3718
|
}
|
|
3659
|
-
function
|
|
3719
|
+
function La() {
|
|
3660
3720
|
const {
|
|
3661
3721
|
selectedOrg: a,
|
|
3662
|
-
members:
|
|
3663
|
-
invites:
|
|
3664
|
-
isLoading:
|
|
3722
|
+
members: r,
|
|
3723
|
+
invites: s,
|
|
3724
|
+
isLoading: i,
|
|
3665
3725
|
error: n,
|
|
3666
3726
|
setError: u,
|
|
3667
|
-
sendInvite:
|
|
3668
|
-
refreshInvites:
|
|
3669
|
-
revokeInvite:
|
|
3670
|
-
updateMemberRole:
|
|
3671
|
-
removeMember:
|
|
3727
|
+
sendInvite: l,
|
|
3728
|
+
refreshInvites: d,
|
|
3729
|
+
revokeInvite: c,
|
|
3730
|
+
updateMemberRole: o,
|
|
3731
|
+
removeMember: m,
|
|
3672
3732
|
refreshMembers: p
|
|
3673
|
-
} = Y(), [
|
|
3674
|
-
if (
|
|
3675
|
-
a && (p(a.id),
|
|
3676
|
-
}, [a, p,
|
|
3677
|
-
return /* @__PURE__ */ t(
|
|
3733
|
+
} = Y(), [h, y] = g(""), [x, v] = g("member"), [z, N] = g(!1), [O, C] = g(!1), [f, P] = g(null), [I, L] = g(""), [A, b] = g(null);
|
|
3734
|
+
if (U(() => {
|
|
3735
|
+
a && (p(a.id), d(a.id));
|
|
3736
|
+
}, [a, p, d]), !a)
|
|
3737
|
+
return /* @__PURE__ */ t(R, { children: [
|
|
3678
3738
|
/* @__PURE__ */ e("h3", { children: "People" }),
|
|
3679
3739
|
/* @__PURE__ */ t("div", { className: "ss-auth-settings-empty", children: [
|
|
3680
|
-
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children:
|
|
3740
|
+
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: S.group }),
|
|
3681
3741
|
/* @__PURE__ */ e("div", { children: "Select an organization from the user menu to manage members." })
|
|
3682
3742
|
] })
|
|
3683
3743
|
] });
|
|
3684
|
-
const
|
|
3685
|
-
|
|
3744
|
+
const w = async ($) => {
|
|
3745
|
+
$.preventDefault(), C(!1), await l(a.id, h, x) && (y(""), v("member"), C(!0), N(!1), d(a.id));
|
|
3686
3746
|
}, E = async () => {
|
|
3687
|
-
if (!
|
|
3688
|
-
await
|
|
3689
|
-
},
|
|
3690
|
-
if (
|
|
3691
|
-
await
|
|
3692
|
-
},
|
|
3693
|
-
await
|
|
3694
|
-
},
|
|
3695
|
-
return /* @__PURE__ */ t(
|
|
3747
|
+
if (!f) return;
|
|
3748
|
+
await o(a.id, f.userId, I) && P(null);
|
|
3749
|
+
}, B = async () => {
|
|
3750
|
+
if (!A) return;
|
|
3751
|
+
await m(a.id, A.userId) && b(null);
|
|
3752
|
+
}, F = async ($) => {
|
|
3753
|
+
await c(a.id, $);
|
|
3754
|
+
}, D = ($) => $ === "owner" ? "ss-auth-role-badge ss-auth-role-badge-owner" : $ === "admin" ? "ss-auth-role-badge ss-auth-role-badge-admin" : "ss-auth-role-badge ss-auth-role-badge-member";
|
|
3755
|
+
return /* @__PURE__ */ t(R, { children: [
|
|
3696
3756
|
/* @__PURE__ */ e("h3", { children: "People" }),
|
|
3697
3757
|
n && /* @__PURE__ */ t("div", { className: "ss-auth-error", style: { marginBottom: "16px" }, children: [
|
|
3698
|
-
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children:
|
|
3758
|
+
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: S.errorOutline }),
|
|
3699
3759
|
/* @__PURE__ */ e("span", { children: n })
|
|
3700
3760
|
] }),
|
|
3701
|
-
|
|
3702
|
-
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children:
|
|
3761
|
+
O && /* @__PURE__ */ t("div", { className: "ss-auth-info-box", style: { marginBottom: "16px" }, children: [
|
|
3762
|
+
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: S.check }),
|
|
3703
3763
|
/* @__PURE__ */ e("span", { children: "Invitation sent" })
|
|
3704
3764
|
] }),
|
|
3705
3765
|
/* @__PURE__ */ t("div", { className: "ss-auth-settings-card", children: [
|
|
3706
3766
|
/* @__PURE__ */ t("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", marginBottom: "16px" }, children: [
|
|
3707
3767
|
/* @__PURE__ */ t("h4", { style: { margin: 0 }, children: [
|
|
3708
|
-
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children:
|
|
3768
|
+
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: S.group }),
|
|
3709
3769
|
"Members"
|
|
3710
3770
|
] }),
|
|
3711
3771
|
/* @__PURE__ */ t(
|
|
@@ -3714,15 +3774,15 @@ function Ia() {
|
|
|
3714
3774
|
type: "button",
|
|
3715
3775
|
className: "ss-auth-btn-primary ss-auth-btn-sm",
|
|
3716
3776
|
style: { width: "auto" },
|
|
3717
|
-
onClick: () =>
|
|
3777
|
+
onClick: () => N(!z),
|
|
3718
3778
|
children: [
|
|
3719
|
-
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", style: { fontSize: "16px" }, children:
|
|
3779
|
+
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", style: { fontSize: "16px" }, children: S.add }),
|
|
3720
3780
|
"Invite"
|
|
3721
3781
|
]
|
|
3722
3782
|
}
|
|
3723
3783
|
)
|
|
3724
3784
|
] }),
|
|
3725
|
-
|
|
3785
|
+
z && /* @__PURE__ */ e("form", { onSubmit: w, style: { marginBottom: "16px", padding: "16px", background: "rgba(0,0,0,0.05)", borderRadius: "8px" }, children: /* @__PURE__ */ t("div", { style: { display: "flex", gap: "8px", alignItems: "flex-end" }, children: [
|
|
3726
3786
|
/* @__PURE__ */ t("div", { style: { flex: 1 }, children: [
|
|
3727
3787
|
/* @__PURE__ */ e("label", { className: "ss-auth-label", children: "Email" }),
|
|
3728
3788
|
/* @__PURE__ */ e(
|
|
@@ -3731,8 +3791,8 @@ function Ia() {
|
|
|
3731
3791
|
className: "ss-auth-input",
|
|
3732
3792
|
type: "email",
|
|
3733
3793
|
placeholder: "member@example.com",
|
|
3734
|
-
value:
|
|
3735
|
-
onChange: (
|
|
3794
|
+
value: h,
|
|
3795
|
+
onChange: ($) => y($.target.value),
|
|
3736
3796
|
required: !0
|
|
3737
3797
|
}
|
|
3738
3798
|
)
|
|
@@ -3743,8 +3803,8 @@ function Ia() {
|
|
|
3743
3803
|
"select",
|
|
3744
3804
|
{
|
|
3745
3805
|
className: "ss-auth-input",
|
|
3746
|
-
value:
|
|
3747
|
-
onChange: (
|
|
3806
|
+
value: x,
|
|
3807
|
+
onChange: ($) => v($.target.value),
|
|
3748
3808
|
style: { cursor: "pointer" },
|
|
3749
3809
|
children: [
|
|
3750
3810
|
/* @__PURE__ */ e("option", { value: "admin", children: "Admin" }),
|
|
@@ -3753,18 +3813,18 @@ function Ia() {
|
|
|
3753
3813
|
}
|
|
3754
3814
|
)
|
|
3755
3815
|
] }),
|
|
3756
|
-
/* @__PURE__ */ e("button", { type: "submit", className: "ss-auth-btn-primary ss-auth-btn-sm", disabled:
|
|
3816
|
+
/* @__PURE__ */ e("button", { type: "submit", className: "ss-auth-btn-primary ss-auth-btn-sm", disabled: i, style: { width: "auto", marginBottom: "0" }, children: "Send" })
|
|
3757
3817
|
] }) }),
|
|
3758
|
-
|
|
3818
|
+
r.length === 0 ? /* @__PURE__ */ e("div", { className: "ss-auth-settings-empty", style: { padding: "20px" }, children: /* @__PURE__ */ e("div", { children: "No members yet." }) }) : /* @__PURE__ */ t("table", { className: "ss-auth-settings-table", children: [
|
|
3759
3819
|
/* @__PURE__ */ e("thead", { children: /* @__PURE__ */ t("tr", { children: [
|
|
3760
3820
|
/* @__PURE__ */ e("th", { children: "Email" }),
|
|
3761
3821
|
/* @__PURE__ */ e("th", { children: "Role" }),
|
|
3762
3822
|
/* @__PURE__ */ e("th", { style: { width: "80px" }, children: "Actions" })
|
|
3763
3823
|
] }) }),
|
|
3764
|
-
/* @__PURE__ */ e("tbody", { children:
|
|
3765
|
-
/* @__PURE__ */ e("td", { children:
|
|
3766
|
-
/* @__PURE__ */ e("td", { children: /* @__PURE__ */ e("span", { className:
|
|
3767
|
-
/* @__PURE__ */ e("td", { children:
|
|
3824
|
+
/* @__PURE__ */ e("tbody", { children: r.map(($) => /* @__PURE__ */ t("tr", { children: [
|
|
3825
|
+
/* @__PURE__ */ e("td", { children: $.email }),
|
|
3826
|
+
/* @__PURE__ */ e("td", { children: /* @__PURE__ */ e("span", { className: D($.role), children: $.role }) }),
|
|
3827
|
+
/* @__PURE__ */ e("td", { children: $.role === "owner" ? /* @__PURE__ */ e("span", { style: { fontSize: "12px", opacity: 0.4 }, children: "—" }) : /* @__PURE__ */ t("div", { className: "ss-auth-settings-actions", children: [
|
|
3768
3828
|
/* @__PURE__ */ e(
|
|
3769
3829
|
"button",
|
|
3770
3830
|
{
|
|
@@ -3772,9 +3832,9 @@ function Ia() {
|
|
|
3772
3832
|
className: "ss-auth-icon-btn",
|
|
3773
3833
|
title: "Edit role",
|
|
3774
3834
|
onClick: () => {
|
|
3775
|
-
|
|
3835
|
+
P($), L($.role);
|
|
3776
3836
|
},
|
|
3777
|
-
children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children:
|
|
3837
|
+
children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: S.edit })
|
|
3778
3838
|
}
|
|
3779
3839
|
),
|
|
3780
3840
|
/* @__PURE__ */ e(
|
|
@@ -3783,17 +3843,17 @@ function Ia() {
|
|
|
3783
3843
|
type: "button",
|
|
3784
3844
|
className: "ss-auth-icon-btn ss-auth-icon-btn-danger",
|
|
3785
3845
|
title: "Remove member",
|
|
3786
|
-
onClick: () =>
|
|
3787
|
-
children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children:
|
|
3846
|
+
onClick: () => b($),
|
|
3847
|
+
children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: S.personRemove })
|
|
3788
3848
|
}
|
|
3789
3849
|
)
|
|
3790
3850
|
] }) })
|
|
3791
|
-
] },
|
|
3851
|
+
] }, $.userId)) })
|
|
3792
3852
|
] })
|
|
3793
3853
|
] }),
|
|
3794
|
-
|
|
3854
|
+
s.length > 0 && /* @__PURE__ */ t("div", { className: "ss-auth-settings-card", children: [
|
|
3795
3855
|
/* @__PURE__ */ t("h4", { children: [
|
|
3796
|
-
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children:
|
|
3856
|
+
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: S.send }),
|
|
3797
3857
|
"Pending Invites"
|
|
3798
3858
|
] }),
|
|
3799
3859
|
/* @__PURE__ */ t("table", { className: "ss-auth-settings-table", children: [
|
|
@@ -3802,33 +3862,33 @@ function Ia() {
|
|
|
3802
3862
|
/* @__PURE__ */ e("th", { children: "Role" }),
|
|
3803
3863
|
/* @__PURE__ */ e("th", { style: { width: "80px" }, children: "Actions" })
|
|
3804
3864
|
] }) }),
|
|
3805
|
-
/* @__PURE__ */ e("tbody", { children:
|
|
3806
|
-
/* @__PURE__ */ e("td", { children:
|
|
3807
|
-
/* @__PURE__ */ e("td", { children: /* @__PURE__ */ e("span", { className:
|
|
3865
|
+
/* @__PURE__ */ e("tbody", { children: s.map(($) => /* @__PURE__ */ t("tr", { children: [
|
|
3866
|
+
/* @__PURE__ */ e("td", { children: $.email }),
|
|
3867
|
+
/* @__PURE__ */ e("td", { children: /* @__PURE__ */ e("span", { className: D($.role), children: $.role }) }),
|
|
3808
3868
|
/* @__PURE__ */ e("td", { children: /* @__PURE__ */ e(
|
|
3809
3869
|
"button",
|
|
3810
3870
|
{
|
|
3811
3871
|
type: "button",
|
|
3812
3872
|
className: "ss-auth-icon-btn ss-auth-icon-btn-danger",
|
|
3813
3873
|
title: "Revoke invite",
|
|
3814
|
-
onClick: () =>
|
|
3815
|
-
children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children:
|
|
3874
|
+
onClick: () => F($.id),
|
|
3875
|
+
children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: S.close })
|
|
3816
3876
|
}
|
|
3817
3877
|
) })
|
|
3818
|
-
] },
|
|
3878
|
+
] }, $.id)) })
|
|
3819
3879
|
] })
|
|
3820
3880
|
] }),
|
|
3821
|
-
|
|
3822
|
-
|
|
3881
|
+
f && /* @__PURE__ */ e("div", { className: "ss-auth-modal-overlay", onClick: ($) => {
|
|
3882
|
+
$.target === $.currentTarget && P(null);
|
|
3823
3883
|
}, children: /* @__PURE__ */ t("div", { className: "ss-auth-modal", style: { maxWidth: "400px" }, children: [
|
|
3824
3884
|
/* @__PURE__ */ t("div", { className: "ss-auth-modal-header", children: [
|
|
3825
3885
|
/* @__PURE__ */ e("h2", { children: "Edit Role" }),
|
|
3826
|
-
/* @__PURE__ */ e("button", { type: "button", className: "ss-auth-modal-close", onClick: () =>
|
|
3886
|
+
/* @__PURE__ */ e("button", { type: "button", className: "ss-auth-modal-close", onClick: () => P(null), children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: S.close }) })
|
|
3827
3887
|
] }),
|
|
3828
3888
|
/* @__PURE__ */ t("div", { className: "ss-auth-modal-body", children: [
|
|
3829
3889
|
/* @__PURE__ */ t("p", { style: { fontSize: "14px", marginBottom: "16px", margin: "0 0 16px 0" }, children: [
|
|
3830
3890
|
"Change role for ",
|
|
3831
|
-
/* @__PURE__ */ e("strong", { children:
|
|
3891
|
+
/* @__PURE__ */ e("strong", { children: f.email })
|
|
3832
3892
|
] }),
|
|
3833
3893
|
/* @__PURE__ */ t("div", { className: "ss-auth-field", children: [
|
|
3834
3894
|
/* @__PURE__ */ e("label", { className: "ss-auth-label", children: "Role" }),
|
|
@@ -3836,8 +3896,8 @@ function Ia() {
|
|
|
3836
3896
|
"select",
|
|
3837
3897
|
{
|
|
3838
3898
|
className: "ss-auth-input",
|
|
3839
|
-
value:
|
|
3840
|
-
onChange: (
|
|
3899
|
+
value: I,
|
|
3900
|
+
onChange: ($) => L($.target.value),
|
|
3841
3901
|
style: { cursor: "pointer" },
|
|
3842
3902
|
children: [
|
|
3843
3903
|
/* @__PURE__ */ e("option", { value: "admin", children: "Admin" }),
|
|
@@ -3847,33 +3907,33 @@ function Ia() {
|
|
|
3847
3907
|
)
|
|
3848
3908
|
] }),
|
|
3849
3909
|
/* @__PURE__ */ t("div", { style: { display: "flex", gap: "8px", justifyContent: "flex-end" }, children: [
|
|
3850
|
-
/* @__PURE__ */ e("button", { type: "button", className: "ss-auth-btn-ghost", onClick: () =>
|
|
3910
|
+
/* @__PURE__ */ e("button", { type: "button", className: "ss-auth-btn-ghost", onClick: () => P(null), children: "Cancel" }),
|
|
3851
3911
|
/* @__PURE__ */ e("button", { type: "button", className: "ss-auth-btn-primary ss-auth-btn-sm", style: { width: "auto" }, onClick: E, children: "Save" })
|
|
3852
3912
|
] })
|
|
3853
3913
|
] })
|
|
3854
3914
|
] }) }),
|
|
3855
|
-
|
|
3856
|
-
|
|
3915
|
+
A && /* @__PURE__ */ e("div", { className: "ss-auth-modal-overlay", onClick: ($) => {
|
|
3916
|
+
$.target === $.currentTarget && b(null);
|
|
3857
3917
|
}, children: /* @__PURE__ */ t("div", { className: "ss-auth-modal", style: { maxWidth: "400px" }, children: [
|
|
3858
3918
|
/* @__PURE__ */ t("div", { className: "ss-auth-modal-header", children: [
|
|
3859
3919
|
/* @__PURE__ */ e("h2", { children: "Remove Member" }),
|
|
3860
|
-
/* @__PURE__ */ e("button", { type: "button", className: "ss-auth-modal-close", onClick: () =>
|
|
3920
|
+
/* @__PURE__ */ e("button", { type: "button", className: "ss-auth-modal-close", onClick: () => b(null), children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: S.close }) })
|
|
3861
3921
|
] }),
|
|
3862
3922
|
/* @__PURE__ */ t("div", { className: "ss-auth-modal-body", children: [
|
|
3863
3923
|
/* @__PURE__ */ t("p", { style: { fontSize: "14px", margin: "0 0 16px 0" }, children: [
|
|
3864
3924
|
"Are you sure you want to remove ",
|
|
3865
|
-
/* @__PURE__ */ e("strong", { children:
|
|
3925
|
+
/* @__PURE__ */ e("strong", { children: A.email }),
|
|
3866
3926
|
" from the organization?"
|
|
3867
3927
|
] }),
|
|
3868
3928
|
/* @__PURE__ */ t("div", { style: { display: "flex", gap: "8px", justifyContent: "flex-end" }, children: [
|
|
3869
|
-
/* @__PURE__ */ e("button", { type: "button", className: "ss-auth-btn-ghost", onClick: () =>
|
|
3929
|
+
/* @__PURE__ */ e("button", { type: "button", className: "ss-auth-btn-ghost", onClick: () => b(null), children: "Cancel" }),
|
|
3870
3930
|
/* @__PURE__ */ e(
|
|
3871
3931
|
"button",
|
|
3872
3932
|
{
|
|
3873
3933
|
type: "button",
|
|
3874
3934
|
className: "ss-auth-btn-primary ss-auth-btn-sm",
|
|
3875
3935
|
style: { width: "auto", background: "linear-gradient(135deg, #ef4444, #dc2626)" },
|
|
3876
|
-
onClick:
|
|
3936
|
+
onClick: B,
|
|
3877
3937
|
children: "Remove"
|
|
3878
3938
|
}
|
|
3879
3939
|
)
|
|
@@ -3882,86 +3942,150 @@ function Ia() {
|
|
|
3882
3942
|
] }) })
|
|
3883
3943
|
] });
|
|
3884
3944
|
}
|
|
3885
|
-
function
|
|
3945
|
+
function Aa() {
|
|
3946
|
+
const { invites: a, isLoading: r, error: s, setError: i, accept: n, decline: u, refresh: l } = ra(), { refresh: d } = Y(), [c, o] = g(null), m = async (h) => {
|
|
3947
|
+
o(h), i(null);
|
|
3948
|
+
const y = await n(h);
|
|
3949
|
+
o(null), y && d();
|
|
3950
|
+
}, p = async (h) => {
|
|
3951
|
+
o(h), i(null), await u(h), o(null);
|
|
3952
|
+
};
|
|
3953
|
+
return /* @__PURE__ */ t(R, { children: [
|
|
3954
|
+
/* @__PURE__ */ e("h3", { children: "Invites" }),
|
|
3955
|
+
s && /* @__PURE__ */ t("div", { className: "ss-auth-error", style: { marginBottom: "16px" }, children: [
|
|
3956
|
+
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: S.errorOutline }),
|
|
3957
|
+
/* @__PURE__ */ e("span", { children: s })
|
|
3958
|
+
] }),
|
|
3959
|
+
r ? /* @__PURE__ */ e("div", { className: "ss-auth-settings-empty", style: { padding: "40px" }, children: /* @__PURE__ */ e("span", { className: "ss-auth-spinner" }) }) : a.length === 0 ? /* @__PURE__ */ t("div", { className: "ss-auth-settings-empty", children: [
|
|
3960
|
+
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: S.mail }),
|
|
3961
|
+
/* @__PURE__ */ e("div", { children: "No pending invitations" })
|
|
3962
|
+
] }) : /* @__PURE__ */ e("div", { style: { display: "flex", flexDirection: "column", gap: "12px" }, children: a.map((h) => /* @__PURE__ */ e("div", { className: "ss-auth-settings-card", style: { marginBottom: 0 }, children: /* @__PURE__ */ t("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", gap: "16px", flexWrap: "wrap" }, children: [
|
|
3963
|
+
/* @__PURE__ */ t("div", { style: { display: "flex", alignItems: "center", gap: "12px", flex: 1, minWidth: 0 }, children: [
|
|
3964
|
+
/* @__PURE__ */ e("div", { className: "ss-auth-org-avatar", style: { width: "40px", height: "40px", fontSize: "14px", flexShrink: 0 }, children: h.orgName.split(" ").map((y) => y[0]).join("").slice(0, 2).toUpperCase() }),
|
|
3965
|
+
/* @__PURE__ */ t("div", { style: { minWidth: 0 }, children: [
|
|
3966
|
+
/* @__PURE__ */ e("div", { style: { fontWeight: 600, fontSize: "14px", overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }, children: h.orgName }),
|
|
3967
|
+
/* @__PURE__ */ t("div", { style: { fontSize: "12px", opacity: 0.6, display: "flex", gap: "8px", alignItems: "center" }, children: [
|
|
3968
|
+
/* @__PURE__ */ e("span", { className: "ss-auth-role-badge ss-auth-role-badge-member", children: h.role }),
|
|
3969
|
+
/* @__PURE__ */ t("span", { children: [
|
|
3970
|
+
"Expires ",
|
|
3971
|
+
new Date(h.expiresAt).toLocaleDateString()
|
|
3972
|
+
] })
|
|
3973
|
+
] })
|
|
3974
|
+
] })
|
|
3975
|
+
] }),
|
|
3976
|
+
/* @__PURE__ */ t("div", { style: { display: "flex", gap: "8px", flexShrink: 0 }, children: [
|
|
3977
|
+
/* @__PURE__ */ e(
|
|
3978
|
+
"button",
|
|
3979
|
+
{
|
|
3980
|
+
type: "button",
|
|
3981
|
+
className: "ss-auth-btn-ghost",
|
|
3982
|
+
style: { padding: "6px 12px", fontSize: "13px" },
|
|
3983
|
+
onClick: () => p(h.id),
|
|
3984
|
+
disabled: c === h.id,
|
|
3985
|
+
children: "Decline"
|
|
3986
|
+
}
|
|
3987
|
+
),
|
|
3988
|
+
/* @__PURE__ */ t(
|
|
3989
|
+
"button",
|
|
3990
|
+
{
|
|
3991
|
+
type: "button",
|
|
3992
|
+
className: "ss-auth-btn-primary ss-auth-btn-sm",
|
|
3993
|
+
style: { width: "auto", padding: "6px 16px", fontSize: "13px" },
|
|
3994
|
+
onClick: () => m(h.id),
|
|
3995
|
+
disabled: c === h.id,
|
|
3996
|
+
children: [
|
|
3997
|
+
c === h.id && /* @__PURE__ */ e("span", { className: "ss-auth-spinner" }),
|
|
3998
|
+
"Accept"
|
|
3999
|
+
]
|
|
4000
|
+
}
|
|
4001
|
+
)
|
|
4002
|
+
] })
|
|
4003
|
+
] }) }, h.id)) })
|
|
4004
|
+
] });
|
|
4005
|
+
}
|
|
4006
|
+
function Da() {
|
|
3886
4007
|
const { selectedOrg: a } = Y();
|
|
3887
|
-
return a ? /* @__PURE__ */ t(
|
|
4008
|
+
return a ? /* @__PURE__ */ t(R, { children: [
|
|
3888
4009
|
/* @__PURE__ */ e("h3", { children: "Billing" }),
|
|
3889
4010
|
/* @__PURE__ */ t("div", { className: "ss-auth-settings-card", children: [
|
|
3890
4011
|
/* @__PURE__ */ t("h4", { children: [
|
|
3891
|
-
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children:
|
|
4012
|
+
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: S.creditCard }),
|
|
3892
4013
|
"Plan & Billing"
|
|
3893
4014
|
] }),
|
|
3894
4015
|
/* @__PURE__ */ e("div", { className: "ss-auth-settings-empty", style: { padding: "20px" }, children: /* @__PURE__ */ e("div", { children: "No billing plan configured for this organization." }) })
|
|
3895
4016
|
] })
|
|
3896
|
-
] }) : /* @__PURE__ */ t(
|
|
4017
|
+
] }) : /* @__PURE__ */ t(R, { children: [
|
|
3897
4018
|
/* @__PURE__ */ e("h3", { children: "Billing" }),
|
|
3898
4019
|
/* @__PURE__ */ t("div", { className: "ss-auth-settings-empty", children: [
|
|
3899
|
-
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children:
|
|
4020
|
+
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: S.creditCard }),
|
|
3900
4021
|
/* @__PURE__ */ e("div", { children: "Select an organization from the user menu to manage billing." })
|
|
3901
4022
|
] })
|
|
3902
4023
|
] });
|
|
3903
4024
|
}
|
|
3904
|
-
function
|
|
4025
|
+
function de({
|
|
3905
4026
|
appearance: a,
|
|
3906
|
-
afterSignOutUrl:
|
|
3907
|
-
afterDeleteAccountUrl:
|
|
3908
|
-
showOrgSwitcher:
|
|
4027
|
+
afterSignOutUrl: r,
|
|
4028
|
+
afterDeleteAccountUrl: s,
|
|
4029
|
+
showOrgSwitcher: i = !0,
|
|
3909
4030
|
onOrgChange: n,
|
|
3910
4031
|
onOrgSettingsClick: u
|
|
3911
4032
|
}) {
|
|
3912
|
-
const { appearance:
|
|
3913
|
-
|
|
4033
|
+
const { appearance: l } = M(), { user: d, signOut: c } = sa(), o = a ?? l, [m, p] = g(!1), [h, y] = g(!1), [x, v] = g(""), [z, N] = g(null), [O, C] = g(!1), f = W(null), { orgs: P, selectedOrg: I, selectOrg: L, createOrg: A, refresh: b } = Y(), { invites: w } = ra(), E = k((F) => {
|
|
4034
|
+
f.current && !F.composedPath().includes(f.current) && p(!1);
|
|
3914
4035
|
}, []);
|
|
3915
|
-
|
|
3916
|
-
if (
|
|
3917
|
-
const
|
|
3918
|
-
document.addEventListener("click",
|
|
4036
|
+
U(() => {
|
|
4037
|
+
if (m) {
|
|
4038
|
+
const F = setTimeout(() => {
|
|
4039
|
+
document.addEventListener("click", E);
|
|
3919
4040
|
}, 0);
|
|
3920
4041
|
return () => {
|
|
3921
|
-
clearTimeout(
|
|
4042
|
+
clearTimeout(F), document.removeEventListener("click", E);
|
|
3922
4043
|
};
|
|
3923
4044
|
}
|
|
3924
|
-
}, [
|
|
3925
|
-
const
|
|
3926
|
-
async (
|
|
3927
|
-
|
|
3928
|
-
const D =
|
|
4045
|
+
}, [m, E]);
|
|
4046
|
+
const B = k(
|
|
4047
|
+
async (F) => {
|
|
4048
|
+
F.preventDefault(), N(null), C(!0);
|
|
4049
|
+
const D = x.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "");
|
|
3929
4050
|
try {
|
|
3930
|
-
const
|
|
3931
|
-
|
|
3932
|
-
} catch (
|
|
3933
|
-
|
|
4051
|
+
const $ = await A(x, D);
|
|
4052
|
+
$ && (await L($.id), n == null || n($), v(""), p(!1));
|
|
4053
|
+
} catch ($) {
|
|
4054
|
+
N($ instanceof Error ? $.message : "Failed to create organization");
|
|
3934
4055
|
} finally {
|
|
3935
4056
|
C(!1);
|
|
3936
4057
|
}
|
|
3937
4058
|
},
|
|
3938
|
-
[
|
|
4059
|
+
[x, A, L, n]
|
|
3939
4060
|
);
|
|
3940
|
-
return
|
|
4061
|
+
return d ? /* @__PURE__ */ e(j, { appearance: o, children: /* @__PURE__ */ t("div", { style: { position: "relative", display: "inline-block" }, ref: f, children: [
|
|
3941
4062
|
/* @__PURE__ */ t(
|
|
3942
4063
|
"button",
|
|
3943
4064
|
{
|
|
3944
4065
|
type: "button",
|
|
3945
4066
|
className: "ss-auth-user-trigger",
|
|
3946
|
-
onClick: () => p(!
|
|
4067
|
+
onClick: () => p(!m),
|
|
3947
4068
|
"aria-label": "User menu",
|
|
3948
4069
|
children: [
|
|
3949
|
-
/* @__PURE__ */
|
|
3950
|
-
|
|
3951
|
-
|
|
3952
|
-
|
|
3953
|
-
|
|
3954
|
-
|
|
3955
|
-
|
|
3956
|
-
|
|
3957
|
-
|
|
3958
|
-
|
|
4070
|
+
/* @__PURE__ */ t("span", { className: "ss-auth-avatar-trigger", children: [
|
|
4071
|
+
d.avatarUrl ? /* @__PURE__ */ e("img", { src: d.avatarUrl, alt: "" }) : /* @__PURE__ */ e("div", { style: {
|
|
4072
|
+
width: "100%",
|
|
4073
|
+
height: "100%",
|
|
4074
|
+
display: "flex",
|
|
4075
|
+
alignItems: "center",
|
|
4076
|
+
justifyContent: "center",
|
|
4077
|
+
fontSize: "16px",
|
|
4078
|
+
fontWeight: 700
|
|
4079
|
+
}, children: (d.name || d.email).charAt(0).toUpperCase() }),
|
|
4080
|
+
w.length > 0 && /* @__PURE__ */ e("span", { className: "ss-auth-invite-badge", children: w.length })
|
|
4081
|
+
] }),
|
|
4082
|
+
I && /* @__PURE__ */ e("span", { className: "ss-auth-trigger-org-name", children: I.name })
|
|
3959
4083
|
]
|
|
3960
4084
|
}
|
|
3961
4085
|
),
|
|
3962
|
-
|
|
4086
|
+
m && /* @__PURE__ */ t("div", { className: "ss-auth-dropdown ss-auth-glass-panel", style: { minWidth: "320px" }, children: [
|
|
3963
4087
|
/* @__PURE__ */ t("div", { className: "ss-auth-dropdown-header", children: [
|
|
3964
|
-
/* @__PURE__ */ e("div", { className: "ss-auth-dropdown-avatar", children:
|
|
4088
|
+
/* @__PURE__ */ e("div", { className: "ss-auth-dropdown-avatar", children: d.avatarUrl ? /* @__PURE__ */ e("img", { src: d.avatarUrl, alt: "" }) : /* @__PURE__ */ e("div", { style: {
|
|
3965
4089
|
width: "100%",
|
|
3966
4090
|
height: "100%",
|
|
3967
4091
|
display: "flex",
|
|
@@ -3969,10 +4093,10 @@ function oe({
|
|
|
3969
4093
|
justifyContent: "center",
|
|
3970
4094
|
fontSize: "20px",
|
|
3971
4095
|
fontWeight: 800
|
|
3972
|
-
}, children: (
|
|
4096
|
+
}, children: (d.name || d.email).charAt(0).toUpperCase() }) }),
|
|
3973
4097
|
/* @__PURE__ */ t("div", { children: [
|
|
3974
|
-
|
|
3975
|
-
/* @__PURE__ */ e("div", { className: "ss-auth-dropdown-email", children:
|
|
4098
|
+
d.name && /* @__PURE__ */ e("div", { className: "ss-auth-dropdown-name", children: d.name }),
|
|
4099
|
+
/* @__PURE__ */ e("div", { className: "ss-auth-dropdown-email", children: d.email })
|
|
3976
4100
|
] })
|
|
3977
4101
|
] }),
|
|
3978
4102
|
/* @__PURE__ */ e("div", { style: { padding: "4px 8px" }, children: /* @__PURE__ */ t(
|
|
@@ -3981,49 +4105,49 @@ function oe({
|
|
|
3981
4105
|
type: "button",
|
|
3982
4106
|
className: "ss-auth-dropdown-action",
|
|
3983
4107
|
onClick: () => {
|
|
3984
|
-
p(!1),
|
|
4108
|
+
p(!1), y(!0);
|
|
3985
4109
|
},
|
|
3986
4110
|
children: [
|
|
3987
|
-
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children:
|
|
4111
|
+
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: S.settings }),
|
|
3988
4112
|
"Settings"
|
|
3989
4113
|
]
|
|
3990
4114
|
}
|
|
3991
4115
|
) }),
|
|
3992
|
-
|
|
4116
|
+
i && /* @__PURE__ */ t(R, { children: [
|
|
3993
4117
|
/* @__PURE__ */ e("div", { className: "ss-auth-section-label", children: "Organizations" }),
|
|
3994
|
-
/* @__PURE__ */ e("div", { style: { padding: "0 8px 4px" }, children:
|
|
3995
|
-
const D = (
|
|
4118
|
+
/* @__PURE__ */ e("div", { style: { padding: "0 8px 4px" }, children: P.map((F) => {
|
|
4119
|
+
const D = (I == null ? void 0 : I.id) === F.id, $ = F.name.split(" ").map((T) => T[0]).join("").slice(0, 2).toUpperCase();
|
|
3996
4120
|
return /* @__PURE__ */ t(
|
|
3997
4121
|
"button",
|
|
3998
4122
|
{
|
|
3999
4123
|
type: "button",
|
|
4000
4124
|
className: `ss-auth-org-item${D ? " ss-auth-org-item-active" : ""}`,
|
|
4001
4125
|
onClick: async () => {
|
|
4002
|
-
p(!1), await F
|
|
4126
|
+
p(!1), await L(F.id), n == null || n(F);
|
|
4003
4127
|
},
|
|
4004
4128
|
children: [
|
|
4005
4129
|
/* @__PURE__ */ t("div", { className: "ss-auth-org-item-inner", children: [
|
|
4006
|
-
/* @__PURE__ */ e("div", { className: `ss-auth-org-avatar${D ? "" : " ss-auth-org-avatar-inactive"}`, children:
|
|
4007
|
-
/* @__PURE__ */ e("span", { style: { fontFamily: "'Manrope', sans-serif", letterSpacing: "-0.01em" }, children:
|
|
4008
|
-
|
|
4130
|
+
/* @__PURE__ */ e("div", { className: `ss-auth-org-avatar${D ? "" : " ss-auth-org-avatar-inactive"}`, children: $ }),
|
|
4131
|
+
/* @__PURE__ */ e("span", { style: { fontFamily: "'Manrope', sans-serif", letterSpacing: "-0.01em" }, children: F.name }),
|
|
4132
|
+
F.planName && /* @__PURE__ */ e("span", { className: "ss-auth-plan-badge", children: F.planName })
|
|
4009
4133
|
] }),
|
|
4010
|
-
D && /* @__PURE__ */ e("span", { className: "material-symbols-outlined ss-auth-org-check", style: { fontSize: "18px" }, children:
|
|
4134
|
+
D && /* @__PURE__ */ e("span", { className: "material-symbols-outlined ss-auth-org-check", style: { fontSize: "18px" }, children: S.checkCircle })
|
|
4011
4135
|
]
|
|
4012
4136
|
},
|
|
4013
|
-
|
|
4137
|
+
F.id
|
|
4014
4138
|
);
|
|
4015
4139
|
}) }),
|
|
4016
4140
|
/* @__PURE__ */ t("div", { className: "ss-auth-inline-create", children: [
|
|
4017
|
-
|
|
4018
|
-
/* @__PURE__ */ e("form", { onSubmit:
|
|
4141
|
+
z && /* @__PURE__ */ e("div", { className: "ss-auth-error", style: { marginBottom: "8px", fontSize: "12px" }, children: /* @__PURE__ */ e("span", { children: z }) }),
|
|
4142
|
+
/* @__PURE__ */ e("form", { onSubmit: B, children: /* @__PURE__ */ t("div", { className: "ss-auth-inline-create-input", children: [
|
|
4019
4143
|
/* @__PURE__ */ e(
|
|
4020
4144
|
"input",
|
|
4021
4145
|
{
|
|
4022
4146
|
className: "ss-auth-input",
|
|
4023
4147
|
type: "text",
|
|
4024
4148
|
placeholder: "New organization name",
|
|
4025
|
-
value:
|
|
4026
|
-
onChange: (
|
|
4149
|
+
value: x,
|
|
4150
|
+
onChange: (F) => v(F.target.value),
|
|
4027
4151
|
required: !0,
|
|
4028
4152
|
style: { fontSize: "13px", padding: "10px 40px 10px 12px" }
|
|
4029
4153
|
}
|
|
@@ -4033,22 +4157,22 @@ function oe({
|
|
|
4033
4157
|
{
|
|
4034
4158
|
type: "submit",
|
|
4035
4159
|
className: "ss-auth-inline-create-btn",
|
|
4036
|
-
disabled:
|
|
4037
|
-
children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", style: { fontSize: "20px" }, children:
|
|
4160
|
+
disabled: O || !x.trim(),
|
|
4161
|
+
children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", style: { fontSize: "20px" }, children: S.add })
|
|
4038
4162
|
}
|
|
4039
4163
|
)
|
|
4040
4164
|
] }) })
|
|
4041
4165
|
] }),
|
|
4042
|
-
|
|
4166
|
+
I && u && /* @__PURE__ */ e("div", { style: { padding: "0 8px 4px" }, children: /* @__PURE__ */ t(
|
|
4043
4167
|
"button",
|
|
4044
4168
|
{
|
|
4045
4169
|
type: "button",
|
|
4046
4170
|
className: "ss-auth-dropdown-action",
|
|
4047
4171
|
onClick: () => {
|
|
4048
|
-
p(!1), u(
|
|
4172
|
+
p(!1), u(I);
|
|
4049
4173
|
},
|
|
4050
4174
|
children: [
|
|
4051
|
-
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children:
|
|
4175
|
+
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: S.corporateFare }),
|
|
4052
4176
|
"Org settings"
|
|
4053
4177
|
]
|
|
4054
4178
|
}
|
|
@@ -4060,57 +4184,59 @@ function oe({
|
|
|
4060
4184
|
type: "button",
|
|
4061
4185
|
className: "ss-auth-dropdown-action",
|
|
4062
4186
|
onClick: async () => {
|
|
4063
|
-
p(!1), await
|
|
4187
|
+
p(!1), await c(), r && (window.location.href = r);
|
|
4064
4188
|
},
|
|
4065
4189
|
style: { color: "inherit" },
|
|
4066
4190
|
children: [
|
|
4067
|
-
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", style: { color: "inherit" }, children:
|
|
4191
|
+
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", style: { color: "inherit" }, children: S.logout }),
|
|
4068
4192
|
"Sign out"
|
|
4069
4193
|
]
|
|
4070
4194
|
}
|
|
4071
4195
|
) })
|
|
4072
4196
|
] }),
|
|
4073
|
-
|
|
4074
|
-
|
|
4197
|
+
h && /* @__PURE__ */ e(
|
|
4198
|
+
Ia,
|
|
4075
4199
|
{
|
|
4076
|
-
onClose: () =>
|
|
4077
|
-
afterDeleteAccountUrl:
|
|
4200
|
+
onClose: () => y(!1),
|
|
4201
|
+
afterDeleteAccountUrl: s,
|
|
4202
|
+
onOrgDeleted: b,
|
|
4203
|
+
onOrgUpdated: b
|
|
4078
4204
|
}
|
|
4079
4205
|
)
|
|
4080
4206
|
] }) }) : null;
|
|
4081
4207
|
}
|
|
4082
|
-
function
|
|
4083
|
-
const { appearance:
|
|
4084
|
-
async (
|
|
4085
|
-
|
|
4208
|
+
function ue({ appearance: a }) {
|
|
4209
|
+
const { appearance: r } = M(), { user: s, signOut: i } = sa(), { updateProfile: n, uploadAvatar: u, changePassword: l, isLoading: d, error: c, success: o, setError: m, setSuccess: p } = ia(), h = a ?? r, [y, x] = g((s == null ? void 0 : s.name) ?? ""), [v, z] = g((s == null ? void 0 : s.avatarUrl) ?? ""), [N, O] = g(!1), [C, f] = g(""), [P, I] = g(""), [L, A] = g(""), [b, w] = g(null), E = k(
|
|
4210
|
+
async (T) => {
|
|
4211
|
+
T.preventDefault(), m(null), p(null), await n({ name: y, avatarUrl: v || void 0 });
|
|
4086
4212
|
},
|
|
4087
|
-
[
|
|
4088
|
-
),
|
|
4089
|
-
async (
|
|
4090
|
-
const
|
|
4091
|
-
|
|
4213
|
+
[y, v, n, m, p]
|
|
4214
|
+
), B = k(
|
|
4215
|
+
async (T) => {
|
|
4216
|
+
const _ = await u(T);
|
|
4217
|
+
_ && (z(_.avatarUrl), O(!1));
|
|
4092
4218
|
},
|
|
4093
4219
|
[u]
|
|
4094
|
-
),
|
|
4095
|
-
async (
|
|
4096
|
-
if (
|
|
4097
|
-
|
|
4220
|
+
), F = k(
|
|
4221
|
+
async (T) => {
|
|
4222
|
+
if (T.preventDefault(), w(null), m(null), p(null), P !== L) {
|
|
4223
|
+
w("Passwords do not match");
|
|
4098
4224
|
return;
|
|
4099
4225
|
}
|
|
4100
|
-
if (
|
|
4101
|
-
|
|
4226
|
+
if (P.length < 8) {
|
|
4227
|
+
w("Password must be at least 8 characters");
|
|
4102
4228
|
return;
|
|
4103
4229
|
}
|
|
4104
|
-
await
|
|
4230
|
+
await l(C, P) && (f(""), I(""), A(""));
|
|
4105
4231
|
},
|
|
4106
|
-
[C,
|
|
4232
|
+
[C, P, L, l, m, p]
|
|
4107
4233
|
);
|
|
4108
|
-
if (!
|
|
4109
|
-
const
|
|
4110
|
-
return /* @__PURE__ */ e(
|
|
4234
|
+
if (!s) return null;
|
|
4235
|
+
const D = s.provider === "email", $ = (s.name || s.email).charAt(0).toUpperCase();
|
|
4236
|
+
return /* @__PURE__ */ e(j, { appearance: h, children: /* @__PURE__ */ t("div", { className: "ss-auth-card", style: { maxWidth: "640px" }, children: [
|
|
4111
4237
|
/* @__PURE__ */ t("div", { className: "ss-auth-profile-header", children: [
|
|
4112
|
-
/* @__PURE__ */ t("div", { className: "ss-auth-avatar-lg", onClick: () =>
|
|
4113
|
-
|
|
4238
|
+
/* @__PURE__ */ t("div", { className: "ss-auth-avatar-lg", onClick: () => O(!0), children: [
|
|
4239
|
+
v ? /* @__PURE__ */ e("img", { src: v, alt: "" }) : /* @__PURE__ */ e("div", { style: {
|
|
4114
4240
|
width: "100%",
|
|
4115
4241
|
height: "100%",
|
|
4116
4242
|
display: "flex",
|
|
@@ -4119,32 +4245,32 @@ function ie({ appearance: a }) {
|
|
|
4119
4245
|
fontSize: "48px",
|
|
4120
4246
|
fontWeight: 800,
|
|
4121
4247
|
opacity: 0.4
|
|
4122
|
-
}, children:
|
|
4248
|
+
}, children: $ }),
|
|
4123
4249
|
/* @__PURE__ */ t("div", { className: "ss-auth-avatar-overlay", children: [
|
|
4124
|
-
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children:
|
|
4250
|
+
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: S.camera }),
|
|
4125
4251
|
/* @__PURE__ */ e("span", { children: "Edit" })
|
|
4126
4252
|
] })
|
|
4127
4253
|
] }),
|
|
4128
4254
|
/* @__PURE__ */ t("div", { className: "ss-auth-profile-info", children: [
|
|
4129
4255
|
/* @__PURE__ */ t("h2", { className: "ss-auth-profile-name", children: [
|
|
4130
|
-
|
|
4131
|
-
|
|
4132
|
-
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", style: { fontSize: "12px", fontVariationSettings: "'FILL' 1" }, children:
|
|
4256
|
+
s.name || "Unnamed User",
|
|
4257
|
+
s.emailVerified && /* @__PURE__ */ t("span", { className: "ss-auth-badge ss-auth-badge-success", children: [
|
|
4258
|
+
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", style: { fontSize: "12px", fontVariationSettings: "'FILL' 1" }, children: S.verified }),
|
|
4133
4259
|
"Verified"
|
|
4134
4260
|
] })
|
|
4135
4261
|
] }),
|
|
4136
|
-
/* @__PURE__ */ e("p", { className: "ss-auth-profile-desc", children:
|
|
4262
|
+
/* @__PURE__ */ e("p", { className: "ss-auth-profile-desc", children: s.email })
|
|
4137
4263
|
] })
|
|
4138
4264
|
] }),
|
|
4139
4265
|
/* @__PURE__ */ t("div", { className: "ss-auth-card-body", children: [
|
|
4140
|
-
|
|
4141
|
-
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children:
|
|
4142
|
-
/* @__PURE__ */ e("span", { children: d })
|
|
4143
|
-
] }),
|
|
4144
|
-
c && /* @__PURE__ */ t("div", { className: "ss-auth-info-box", style: { marginBottom: "16px" }, children: [
|
|
4145
|
-
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: v.check }),
|
|
4266
|
+
c && /* @__PURE__ */ t("div", { className: "ss-auth-error", children: [
|
|
4267
|
+
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: S.errorOutline }),
|
|
4146
4268
|
/* @__PURE__ */ e("span", { children: c })
|
|
4147
4269
|
] }),
|
|
4270
|
+
o && /* @__PURE__ */ t("div", { className: "ss-auth-info-box", style: { marginBottom: "16px" }, children: [
|
|
4271
|
+
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: S.check }),
|
|
4272
|
+
/* @__PURE__ */ e("span", { children: o })
|
|
4273
|
+
] }),
|
|
4148
4274
|
/* @__PURE__ */ t("form", { onSubmit: E, children: [
|
|
4149
4275
|
/* @__PURE__ */ t("div", { className: "ss-auth-field", children: [
|
|
4150
4276
|
/* @__PURE__ */ e("label", { className: "ss-auth-label", children: "Full Name" }),
|
|
@@ -4154,8 +4280,8 @@ function ie({ appearance: a }) {
|
|
|
4154
4280
|
className: "ss-auth-input",
|
|
4155
4281
|
type: "text",
|
|
4156
4282
|
placeholder: "Your name",
|
|
4157
|
-
value:
|
|
4158
|
-
onChange: (
|
|
4283
|
+
value: y,
|
|
4284
|
+
onChange: (T) => x(T.target.value)
|
|
4159
4285
|
}
|
|
4160
4286
|
)
|
|
4161
4287
|
] }),
|
|
@@ -4163,34 +4289,34 @@ function ie({ appearance: a }) {
|
|
|
4163
4289
|
/* @__PURE__ */ t("div", { children: [
|
|
4164
4290
|
/* @__PURE__ */ e("label", { className: "ss-auth-label", children: "Email Address" }),
|
|
4165
4291
|
/* @__PURE__ */ t("div", { style: { position: "relative" }, children: [
|
|
4166
|
-
/* @__PURE__ */ e("input", { className: "ss-auth-input ss-auth-input-readonly", type: "email", value:
|
|
4167
|
-
/* @__PURE__ */ e("span", { className: "ss-auth-visibility-toggle", style: { cursor: "default" }, children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", style: { fontSize: "18px" }, children:
|
|
4292
|
+
/* @__PURE__ */ e("input", { className: "ss-auth-input ss-auth-input-readonly", type: "email", value: s.email, readOnly: !0 }),
|
|
4293
|
+
/* @__PURE__ */ e("span", { className: "ss-auth-visibility-toggle", style: { cursor: "default" }, children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", style: { fontSize: "18px" }, children: S.lock }) })
|
|
4168
4294
|
] })
|
|
4169
4295
|
] }),
|
|
4170
4296
|
/* @__PURE__ */ t("div", { children: [
|
|
4171
4297
|
/* @__PURE__ */ e("label", { className: "ss-auth-label", children: "Auth Provider" }),
|
|
4172
4298
|
/* @__PURE__ */ t("div", { style: { position: "relative" }, children: [
|
|
4173
|
-
/* @__PURE__ */ e("input", { className: "ss-auth-input ss-auth-input-readonly", type: "text", value:
|
|
4174
|
-
/* @__PURE__ */ e("span", { className: "ss-auth-visibility-toggle", style: { cursor: "default" }, children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", style: { fontSize: "18px" }, children:
|
|
4299
|
+
/* @__PURE__ */ e("input", { className: "ss-auth-input ss-auth-input-readonly", type: "text", value: s.provider, readOnly: !0 }),
|
|
4300
|
+
/* @__PURE__ */ e("span", { className: "ss-auth-visibility-toggle", style: { cursor: "default" }, children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", style: { fontSize: "18px" }, children: S.cloudDone }) })
|
|
4175
4301
|
] })
|
|
4176
4302
|
] })
|
|
4177
4303
|
] }),
|
|
4178
|
-
/* @__PURE__ */ e("div", { style: { display: "flex", justifyContent: "flex-end" }, children: /* @__PURE__ */ t("button", { type: "submit", className: "ss-auth-btn-primary ss-auth-btn-sm", disabled:
|
|
4179
|
-
|
|
4304
|
+
/* @__PURE__ */ e("div", { style: { display: "flex", justifyContent: "flex-end" }, children: /* @__PURE__ */ t("button", { type: "submit", className: "ss-auth-btn-primary ss-auth-btn-sm", disabled: d, style: { width: "auto" }, children: [
|
|
4305
|
+
d && /* @__PURE__ */ e("span", { className: "ss-auth-spinner" }),
|
|
4180
4306
|
"Save changes"
|
|
4181
4307
|
] }) })
|
|
4182
4308
|
] }),
|
|
4183
|
-
|
|
4309
|
+
D && /* @__PURE__ */ t("div", { className: "ss-auth-section", children: [
|
|
4184
4310
|
/* @__PURE__ */ t("div", { className: "ss-auth-section-title", children: [
|
|
4185
|
-
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children:
|
|
4311
|
+
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: S.security }),
|
|
4186
4312
|
"Security Credentials"
|
|
4187
4313
|
] }),
|
|
4188
4314
|
/* @__PURE__ */ e("p", { className: "ss-auth-section-desc", style: { marginBottom: "24px" }, children: "Update your password to keep your account secure." }),
|
|
4189
|
-
|
|
4190
|
-
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children:
|
|
4191
|
-
/* @__PURE__ */ e("span", { children:
|
|
4315
|
+
b && /* @__PURE__ */ t("div", { className: "ss-auth-error", children: [
|
|
4316
|
+
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: S.errorOutline }),
|
|
4317
|
+
/* @__PURE__ */ e("span", { children: b })
|
|
4192
4318
|
] }),
|
|
4193
|
-
/* @__PURE__ */ t("form", { onSubmit:
|
|
4319
|
+
/* @__PURE__ */ t("form", { onSubmit: F, children: [
|
|
4194
4320
|
/* @__PURE__ */ t("div", { className: "ss-auth-field", children: [
|
|
4195
4321
|
/* @__PURE__ */ e("label", { className: "ss-auth-label", children: "Current Password" }),
|
|
4196
4322
|
/* @__PURE__ */ e(
|
|
@@ -4200,7 +4326,7 @@ function ie({ appearance: a }) {
|
|
|
4200
4326
|
type: "password",
|
|
4201
4327
|
placeholder: "••••••••••••",
|
|
4202
4328
|
value: C,
|
|
4203
|
-
onChange: (
|
|
4329
|
+
onChange: (T) => f(T.target.value),
|
|
4204
4330
|
required: !0
|
|
4205
4331
|
}
|
|
4206
4332
|
)
|
|
@@ -4214,8 +4340,8 @@ function ie({ appearance: a }) {
|
|
|
4214
4340
|
className: "ss-auth-input",
|
|
4215
4341
|
type: "password",
|
|
4216
4342
|
placeholder: "Min. 8 characters",
|
|
4217
|
-
value:
|
|
4218
|
-
onChange: (
|
|
4343
|
+
value: P,
|
|
4344
|
+
onChange: (T) => I(T.target.value),
|
|
4219
4345
|
required: !0
|
|
4220
4346
|
}
|
|
4221
4347
|
)
|
|
@@ -4228,23 +4354,23 @@ function ie({ appearance: a }) {
|
|
|
4228
4354
|
className: "ss-auth-input",
|
|
4229
4355
|
type: "password",
|
|
4230
4356
|
placeholder: "Repeat new password",
|
|
4231
|
-
value:
|
|
4232
|
-
onChange: (
|
|
4357
|
+
value: L,
|
|
4358
|
+
onChange: (T) => A(T.target.value),
|
|
4233
4359
|
required: !0
|
|
4234
4360
|
}
|
|
4235
4361
|
)
|
|
4236
4362
|
] })
|
|
4237
4363
|
] }),
|
|
4238
4364
|
/* @__PURE__ */ t("div", { className: "ss-auth-info-box", style: { marginBottom: "16px" }, children: [
|
|
4239
|
-
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children:
|
|
4365
|
+
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: S.info }),
|
|
4240
4366
|
/* @__PURE__ */ e("span", { children: "Password must be at least 8 characters long." })
|
|
4241
4367
|
] }),
|
|
4242
|
-
/* @__PURE__ */ e("div", { style: { display: "flex", justifyContent: "flex-end" }, children: /* @__PURE__ */ e("button", { type: "submit", className: "ss-auth-btn-ghost", disabled:
|
|
4368
|
+
/* @__PURE__ */ e("div", { style: { display: "flex", justifyContent: "flex-end" }, children: /* @__PURE__ */ e("button", { type: "submit", className: "ss-auth-btn-ghost", disabled: d, children: "Update Security" }) })
|
|
4243
4369
|
] })
|
|
4244
4370
|
] }),
|
|
4245
4371
|
/* @__PURE__ */ e("div", { className: "ss-auth-section", style: { borderTop: "none", paddingTop: 0, marginTop: "24px" }, children: /* @__PURE__ */ e("div", { className: "ss-auth-signout-section", style: { borderRadius: "12px", padding: "16px 20px" }, children: /* @__PURE__ */ t("div", { className: "ss-auth-signout-row", children: [
|
|
4246
4372
|
/* @__PURE__ */ t("div", { className: "ss-auth-signout-info", children: [
|
|
4247
|
-
/* @__PURE__ */ e("div", { className: "ss-auth-signout-icon", children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children:
|
|
4373
|
+
/* @__PURE__ */ e("div", { className: "ss-auth-signout-icon", children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: S.logout }) }),
|
|
4248
4374
|
/* @__PURE__ */ t("div", { children: [
|
|
4249
4375
|
/* @__PURE__ */ e("div", { className: "ss-auth-signout-title", children: "End Session" }),
|
|
4250
4376
|
/* @__PURE__ */ e("div", { className: "ss-auth-signout-desc", children: "Terminate your active session" })
|
|
@@ -4255,104 +4381,104 @@ function ie({ appearance: a }) {
|
|
|
4255
4381
|
{
|
|
4256
4382
|
type: "button",
|
|
4257
4383
|
className: "ss-auth-btn-outline",
|
|
4258
|
-
onClick: () =>
|
|
4384
|
+
onClick: () => i(),
|
|
4259
4385
|
style: { width: "auto", flexShrink: 0 },
|
|
4260
4386
|
children: "Sign out"
|
|
4261
4387
|
}
|
|
4262
4388
|
)
|
|
4263
4389
|
] }) }) })
|
|
4264
4390
|
] }),
|
|
4265
|
-
|
|
4266
|
-
|
|
4391
|
+
N && /* @__PURE__ */ e(
|
|
4392
|
+
da,
|
|
4267
4393
|
{
|
|
4268
|
-
onUpload:
|
|
4269
|
-
onClose: () =>
|
|
4270
|
-
isLoading:
|
|
4394
|
+
onUpload: B,
|
|
4395
|
+
onClose: () => O(!1),
|
|
4396
|
+
isLoading: d
|
|
4271
4397
|
}
|
|
4272
4398
|
)
|
|
4273
4399
|
] }) });
|
|
4274
4400
|
}
|
|
4275
|
-
function
|
|
4276
|
-
const { appearance:
|
|
4277
|
-
C.current && !
|
|
4401
|
+
function pe({ appearance: a, onOrgChange: r }) {
|
|
4402
|
+
const { appearance: s } = M(), { orgs: i, selectedOrg: n, selectOrg: u, createOrg: l, isLoading: d } = Y(), c = a ?? s, [o, m] = g(!1), [p, h] = g(""), [y, x] = g(""), [v, z] = g(null), [N, O] = g(!1), C = W(null), f = k((b) => {
|
|
4403
|
+
C.current && !b.composedPath().includes(C.current) && m(!1);
|
|
4278
4404
|
}, []);
|
|
4279
|
-
|
|
4280
|
-
if (
|
|
4281
|
-
const
|
|
4282
|
-
document.addEventListener("click",
|
|
4405
|
+
U(() => {
|
|
4406
|
+
if (o) {
|
|
4407
|
+
const b = setTimeout(() => {
|
|
4408
|
+
document.addEventListener("click", f);
|
|
4283
4409
|
}, 0);
|
|
4284
4410
|
return () => {
|
|
4285
|
-
clearTimeout(
|
|
4411
|
+
clearTimeout(b), document.removeEventListener("click", f);
|
|
4286
4412
|
};
|
|
4287
4413
|
}
|
|
4288
|
-
}, [
|
|
4289
|
-
const
|
|
4290
|
-
|
|
4291
|
-
}, []),
|
|
4292
|
-
async (
|
|
4293
|
-
|
|
4414
|
+
}, [o, f]);
|
|
4415
|
+
const P = k((b) => {
|
|
4416
|
+
h(b), x(b.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, ""));
|
|
4417
|
+
}, []), I = k(
|
|
4418
|
+
async (b) => {
|
|
4419
|
+
b.preventDefault(), z(null), O(!0);
|
|
4294
4420
|
try {
|
|
4295
|
-
const
|
|
4296
|
-
|
|
4297
|
-
} catch (
|
|
4298
|
-
|
|
4421
|
+
const w = await l(p, y);
|
|
4422
|
+
w && (await u(w.id), r == null || r(w), h(""), x(""), m(!1));
|
|
4423
|
+
} catch (w) {
|
|
4424
|
+
z(w instanceof Error ? w.message : "Failed to create organization");
|
|
4299
4425
|
} finally {
|
|
4300
|
-
|
|
4426
|
+
O(!1);
|
|
4301
4427
|
}
|
|
4302
4428
|
},
|
|
4303
|
-
[p,
|
|
4429
|
+
[p, y, l, u, r]
|
|
4304
4430
|
);
|
|
4305
|
-
if (
|
|
4306
|
-
const
|
|
4307
|
-
return /* @__PURE__ */ e(
|
|
4431
|
+
if (d) return null;
|
|
4432
|
+
const L = (n == null ? void 0 : n.name) ?? (i.length === 0 ? "No organization" : "Select organization"), A = n ? n.name.split(" ").map((b) => b[0]).join("").slice(0, 2).toUpperCase() : "--";
|
|
4433
|
+
return /* @__PURE__ */ e(j, { appearance: c, children: /* @__PURE__ */ t("div", { style: { position: "relative", display: "inline-block", width: "100%", maxWidth: "360px" }, ref: C, children: [
|
|
4308
4434
|
/* @__PURE__ */ t(
|
|
4309
4435
|
"button",
|
|
4310
4436
|
{
|
|
4311
4437
|
type: "button",
|
|
4312
4438
|
className: "ss-auth-org-trigger",
|
|
4313
|
-
onClick: () =>
|
|
4439
|
+
onClick: () => m(!o),
|
|
4314
4440
|
children: [
|
|
4315
4441
|
/* @__PURE__ */ t("div", { className: "ss-auth-org-trigger-inner", children: [
|
|
4316
|
-
/* @__PURE__ */ e("div", { className: "ss-auth-org-avatar", children:
|
|
4442
|
+
/* @__PURE__ */ e("div", { className: "ss-auth-org-avatar", children: A }),
|
|
4317
4443
|
/* @__PURE__ */ t("div", { style: { textAlign: "left" }, children: [
|
|
4318
4444
|
/* @__PURE__ */ e("div", { className: "ss-auth-org-trigger-label", children: "Current Organization" }),
|
|
4319
|
-
/* @__PURE__ */ e("div", { className: "ss-auth-org-trigger-name", children:
|
|
4445
|
+
/* @__PURE__ */ e("div", { className: "ss-auth-org-trigger-name", children: L })
|
|
4320
4446
|
] })
|
|
4321
4447
|
] }),
|
|
4322
|
-
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children:
|
|
4448
|
+
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: S.unfoldMore })
|
|
4323
4449
|
]
|
|
4324
4450
|
}
|
|
4325
4451
|
),
|
|
4326
|
-
|
|
4452
|
+
o && /* @__PURE__ */ t("div", { className: "ss-auth-dropdown ss-auth-dropdown-left ss-auth-glass-panel", style: { width: "100%" }, children: [
|
|
4327
4453
|
/* @__PURE__ */ e("div", { className: "ss-auth-section-label", children: "Your Organizations" }),
|
|
4328
|
-
/* @__PURE__ */ e("div", { style: { padding: "0 8px 4px" }, children:
|
|
4329
|
-
const
|
|
4454
|
+
/* @__PURE__ */ e("div", { style: { padding: "0 8px 4px" }, children: i.map((b) => {
|
|
4455
|
+
const w = (n == null ? void 0 : n.id) === b.id, E = b.name.split(" ").map((B) => B[0]).join("").slice(0, 2).toUpperCase();
|
|
4330
4456
|
return /* @__PURE__ */ t(
|
|
4331
4457
|
"button",
|
|
4332
4458
|
{
|
|
4333
4459
|
type: "button",
|
|
4334
|
-
className: `ss-auth-org-item${
|
|
4460
|
+
className: `ss-auth-org-item${w ? " ss-auth-org-item-active" : ""}`,
|
|
4335
4461
|
onClick: async () => {
|
|
4336
|
-
|
|
4462
|
+
m(!1), await u(b.id), r == null || r(b);
|
|
4337
4463
|
},
|
|
4338
4464
|
children: [
|
|
4339
4465
|
/* @__PURE__ */ t("div", { className: "ss-auth-org-item-inner", children: [
|
|
4340
|
-
/* @__PURE__ */ e("div", { className: `ss-auth-org-avatar${
|
|
4341
|
-
/* @__PURE__ */ e("span", { style: { fontFamily: "'Manrope', sans-serif", letterSpacing: "-0.01em" }, children:
|
|
4466
|
+
/* @__PURE__ */ e("div", { className: `ss-auth-org-avatar${w ? "" : " ss-auth-org-avatar-inactive"}`, children: E }),
|
|
4467
|
+
/* @__PURE__ */ e("span", { style: { fontFamily: "'Manrope', sans-serif", letterSpacing: "-0.01em" }, children: b.name })
|
|
4342
4468
|
] }),
|
|
4343
|
-
|
|
4469
|
+
w && /* @__PURE__ */ e("span", { className: "material-symbols-outlined ss-auth-org-check", style: { fontSize: "18px" }, children: S.checkCircle })
|
|
4344
4470
|
]
|
|
4345
4471
|
},
|
|
4346
|
-
|
|
4472
|
+
b.id
|
|
4347
4473
|
);
|
|
4348
4474
|
}) }),
|
|
4349
4475
|
/* @__PURE__ */ t("div", { className: "ss-auth-org-create", children: [
|
|
4350
4476
|
/* @__PURE__ */ t("div", { className: "ss-auth-org-create-header", children: [
|
|
4351
|
-
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children:
|
|
4477
|
+
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: S.addCircle }),
|
|
4352
4478
|
/* @__PURE__ */ e("span", { children: "Create organization" })
|
|
4353
4479
|
] }),
|
|
4354
|
-
|
|
4355
|
-
/* @__PURE__ */ t("form", { onSubmit:
|
|
4480
|
+
v && /* @__PURE__ */ e("div", { className: "ss-auth-error", style: { marginBottom: "12px", fontSize: "12px" }, children: /* @__PURE__ */ e("span", { children: v }) }),
|
|
4481
|
+
/* @__PURE__ */ t("form", { onSubmit: I, children: [
|
|
4356
4482
|
/* @__PURE__ */ t("div", { className: "ss-auth-field", children: [
|
|
4357
4483
|
/* @__PURE__ */ e("label", { className: "ss-auth-label", style: { fontSize: "10px" }, children: "Org Name" }),
|
|
4358
4484
|
/* @__PURE__ */ e(
|
|
@@ -4362,7 +4488,7 @@ function le({ appearance: a, onOrgChange: s }) {
|
|
|
4362
4488
|
type: "text",
|
|
4363
4489
|
placeholder: "e.g. Nexus Dynamics",
|
|
4364
4490
|
value: p,
|
|
4365
|
-
onChange: (
|
|
4491
|
+
onChange: (b) => P(b.target.value),
|
|
4366
4492
|
required: !0,
|
|
4367
4493
|
style: { fontSize: "13px", padding: "10px 12px" }
|
|
4368
4494
|
}
|
|
@@ -4378,8 +4504,8 @@ function le({ appearance: a, onOrgChange: s }) {
|
|
|
4378
4504
|
className: "ss-auth-input",
|
|
4379
4505
|
type: "text",
|
|
4380
4506
|
placeholder: "nexus-dynamics",
|
|
4381
|
-
value:
|
|
4382
|
-
onChange: (
|
|
4507
|
+
value: y,
|
|
4508
|
+
onChange: (b) => x(b.target.value),
|
|
4383
4509
|
required: !0,
|
|
4384
4510
|
style: { fontSize: "13px", padding: "10px 12px 10px 22px" }
|
|
4385
4511
|
}
|
|
@@ -4391,10 +4517,10 @@ function le({ appearance: a, onOrgChange: s }) {
|
|
|
4391
4517
|
{
|
|
4392
4518
|
type: "submit",
|
|
4393
4519
|
className: "ss-auth-btn-primary",
|
|
4394
|
-
disabled:
|
|
4520
|
+
disabled: N || !p.trim(),
|
|
4395
4521
|
style: { marginTop: "8px" },
|
|
4396
4522
|
children: [
|
|
4397
|
-
|
|
4523
|
+
N && /* @__PURE__ */ e("span", { className: "ss-auth-spinner" }),
|
|
4398
4524
|
"Initialize Organization"
|
|
4399
4525
|
]
|
|
4400
4526
|
}
|
|
@@ -4404,205 +4530,205 @@ function le({ appearance: a, onOrgChange: s }) {
|
|
|
4404
4530
|
] })
|
|
4405
4531
|
] }) });
|
|
4406
4532
|
}
|
|
4407
|
-
function
|
|
4533
|
+
function Ta(a, r = "USD") {
|
|
4408
4534
|
return new Intl.NumberFormat("en-US", {
|
|
4409
4535
|
style: "currency",
|
|
4410
|
-
currency:
|
|
4536
|
+
currency: r,
|
|
4411
4537
|
minimumFractionDigits: a % 100 === 0 ? 0 : 2
|
|
4412
4538
|
}).format(a / 100);
|
|
4413
4539
|
}
|
|
4414
|
-
function
|
|
4415
|
-
const { appearance: u } =
|
|
4416
|
-
return /* @__PURE__ */ e(
|
|
4417
|
-
const
|
|
4418
|
-
return /* @__PURE__ */ t("div", { className: `ss-pricing-card ${
|
|
4540
|
+
function he({ plans: a, currentPlanId: r, onSelectPlan: s, interval: i, appearance: n }) {
|
|
4541
|
+
const { appearance: u } = M(), l = n ?? u, d = i ? a.filter((c) => c.interval === i || c.isFree) : a;
|
|
4542
|
+
return /* @__PURE__ */ e(j, { appearance: l, children: /* @__PURE__ */ e("div", { className: "ss-pricing-grid", children: d.map((c) => {
|
|
4543
|
+
const o = c.id === r;
|
|
4544
|
+
return /* @__PURE__ */ t("div", { className: `ss-pricing-card ${o ? "ss-pricing-card-current" : ""}`, children: [
|
|
4419
4545
|
/* @__PURE__ */ t("div", { className: "ss-pricing-header", children: [
|
|
4420
|
-
/* @__PURE__ */ e("h3", { className: "ss-pricing-name", children:
|
|
4421
|
-
|
|
4422
|
-
|
|
4546
|
+
/* @__PURE__ */ e("h3", { className: "ss-pricing-name", children: c.name }),
|
|
4547
|
+
c.trialDays > 0 && /* @__PURE__ */ t("span", { className: "ss-badge ss-badge-trialing", children: [
|
|
4548
|
+
c.trialDays,
|
|
4423
4549
|
"-day trial"
|
|
4424
4550
|
] }),
|
|
4425
|
-
|
|
4551
|
+
c.isFree && /* @__PURE__ */ e("span", { className: "ss-badge ss-badge-active", children: "Free" })
|
|
4426
4552
|
] }),
|
|
4427
|
-
/* @__PURE__ */ e("div", { className: "ss-pricing-price", children:
|
|
4428
|
-
/* @__PURE__ */ e("span", { className: "ss-pricing-amount", children:
|
|
4553
|
+
/* @__PURE__ */ e("div", { className: "ss-pricing-price", children: c.isFree ? /* @__PURE__ */ e("span", { className: "ss-pricing-amount", children: "Free" }) : /* @__PURE__ */ t(R, { children: [
|
|
4554
|
+
/* @__PURE__ */ e("span", { className: "ss-pricing-amount", children: Ta(c.amountCents, c.currency) }),
|
|
4429
4555
|
/* @__PURE__ */ t("span", { className: "ss-pricing-interval", children: [
|
|
4430
4556
|
"/",
|
|
4431
|
-
|
|
4557
|
+
c.interval
|
|
4432
4558
|
] })
|
|
4433
4559
|
] }) }),
|
|
4434
|
-
|
|
4435
|
-
|
|
4560
|
+
c.description && /* @__PURE__ */ e("p", { className: "ss-pricing-desc", children: c.description }),
|
|
4561
|
+
c.features.length > 0 && /* @__PURE__ */ e("ul", { className: "ss-pricing-features", children: c.features.map((m, p) => /* @__PURE__ */ t("li", { className: "ss-pricing-feature", children: [
|
|
4436
4562
|
/* @__PURE__ */ e("span", { className: "ss-check", children: "✓" }),
|
|
4437
4563
|
" ",
|
|
4438
|
-
|
|
4564
|
+
m
|
|
4439
4565
|
] }, p)) }),
|
|
4440
4566
|
/* @__PURE__ */ e(
|
|
4441
4567
|
"button",
|
|
4442
4568
|
{
|
|
4443
4569
|
type: "button",
|
|
4444
|
-
className: `ss-btn ${
|
|
4445
|
-
disabled:
|
|
4446
|
-
onClick: () =>
|
|
4447
|
-
children:
|
|
4570
|
+
className: `ss-btn ${o ? "ss-btn-current" : "ss-btn-primary"}`,
|
|
4571
|
+
disabled: o,
|
|
4572
|
+
onClick: () => s(c.id),
|
|
4573
|
+
children: o ? "Current plan" : "Select plan"
|
|
4448
4574
|
}
|
|
4449
4575
|
)
|
|
4450
|
-
] },
|
|
4576
|
+
] }, c.id);
|
|
4451
4577
|
}) }) });
|
|
4452
4578
|
}
|
|
4453
|
-
function
|
|
4454
|
-
const { client: a } =
|
|
4579
|
+
function ge() {
|
|
4580
|
+
const { client: a } = M();
|
|
4455
4581
|
return { billing: a.billing };
|
|
4456
4582
|
}
|
|
4457
4583
|
function Z(a) {
|
|
4458
|
-
const { client:
|
|
4584
|
+
const { client: r } = M();
|
|
4459
4585
|
return G(() => {
|
|
4460
4586
|
if (a) {
|
|
4461
|
-
const
|
|
4462
|
-
return new
|
|
4587
|
+
const s = new Q("https://api.saas-support.com/v1", { type: "portalToken", token: a });
|
|
4588
|
+
return new Na(s);
|
|
4463
4589
|
}
|
|
4464
|
-
return
|
|
4465
|
-
}, [
|
|
4590
|
+
return r.billing;
|
|
4591
|
+
}, [r, a]);
|
|
4466
4592
|
}
|
|
4467
|
-
function
|
|
4468
|
-
const
|
|
4469
|
-
|
|
4593
|
+
function Ma(a, r) {
|
|
4594
|
+
const s = Z(r), [i, n] = g(null), [u, l] = g(!0), [d, c] = g(null), o = k(async () => {
|
|
4595
|
+
l(!0), c(null);
|
|
4470
4596
|
try {
|
|
4471
|
-
const
|
|
4472
|
-
n(
|
|
4473
|
-
} catch (
|
|
4474
|
-
|
|
4597
|
+
const m = await s.getCustomer(a);
|
|
4598
|
+
n(m);
|
|
4599
|
+
} catch (m) {
|
|
4600
|
+
c(m instanceof Error ? m.message : "Failed to load subscription");
|
|
4475
4601
|
} finally {
|
|
4476
|
-
|
|
4602
|
+
l(!1);
|
|
4477
4603
|
}
|
|
4478
|
-
}, [
|
|
4479
|
-
return
|
|
4480
|
-
|
|
4481
|
-
}, [
|
|
4604
|
+
}, [s, a]);
|
|
4605
|
+
return U(() => {
|
|
4606
|
+
o();
|
|
4607
|
+
}, [o]), { customer: i, isLoading: u, error: d, refresh: o };
|
|
4482
4608
|
}
|
|
4483
|
-
function
|
|
4484
|
-
const
|
|
4485
|
-
|
|
4609
|
+
function Va(a, r) {
|
|
4610
|
+
const s = Z(r), [i, n] = g([]), [u, l] = g(!0), [d, c] = g(null), o = k(async () => {
|
|
4611
|
+
l(!0), c(null);
|
|
4486
4612
|
try {
|
|
4487
|
-
const
|
|
4488
|
-
n(
|
|
4489
|
-
} catch (
|
|
4490
|
-
|
|
4613
|
+
const m = await s.getInvoices(a);
|
|
4614
|
+
n(m);
|
|
4615
|
+
} catch (m) {
|
|
4616
|
+
c(m instanceof Error ? m.message : "Failed to load invoices");
|
|
4491
4617
|
} finally {
|
|
4492
|
-
|
|
4618
|
+
l(!1);
|
|
4493
4619
|
}
|
|
4494
|
-
}, [
|
|
4495
|
-
return
|
|
4496
|
-
|
|
4497
|
-
}, [
|
|
4620
|
+
}, [s, a]);
|
|
4621
|
+
return U(() => {
|
|
4622
|
+
o();
|
|
4623
|
+
}, [o]), { invoices: i, isLoading: u, error: d, refresh: o };
|
|
4498
4624
|
}
|
|
4499
|
-
function
|
|
4500
|
-
const
|
|
4501
|
-
|
|
4625
|
+
function Ua(a, r) {
|
|
4626
|
+
const s = Z(r), [i, n] = g([]), [u, l] = g(!0), [d, c] = g(null), o = k(async () => {
|
|
4627
|
+
l(!0), c(null);
|
|
4502
4628
|
try {
|
|
4503
|
-
const
|
|
4504
|
-
n(
|
|
4505
|
-
} catch (
|
|
4506
|
-
|
|
4629
|
+
const m = await s.getCurrentUsage(a);
|
|
4630
|
+
n(m);
|
|
4631
|
+
} catch (m) {
|
|
4632
|
+
c(m instanceof Error ? m.message : "Failed to load usage");
|
|
4507
4633
|
} finally {
|
|
4508
|
-
|
|
4634
|
+
l(!1);
|
|
4509
4635
|
}
|
|
4510
|
-
}, [
|
|
4511
|
-
return
|
|
4512
|
-
|
|
4513
|
-
}, [
|
|
4636
|
+
}, [s, a]);
|
|
4637
|
+
return U(() => {
|
|
4638
|
+
o();
|
|
4639
|
+
}, [o]), { usage: i, isLoading: u, error: d, refresh: o };
|
|
4514
4640
|
}
|
|
4515
|
-
const
|
|
4641
|
+
const Ra = {
|
|
4516
4642
|
active: "ss-badge-active"
|
|
4517
4643
|
};
|
|
4518
|
-
function
|
|
4644
|
+
function Ha({
|
|
4519
4645
|
customerId: a,
|
|
4520
|
-
portalToken:
|
|
4521
|
-
onChangePlan:
|
|
4522
|
-
onCancel:
|
|
4646
|
+
portalToken: r,
|
|
4647
|
+
onChangePlan: s,
|
|
4648
|
+
onCancel: i,
|
|
4523
4649
|
appearance: n
|
|
4524
4650
|
}) {
|
|
4525
|
-
const { appearance: u } =
|
|
4526
|
-
return /* @__PURE__ */ e(
|
|
4651
|
+
const { appearance: u } = M(), { customer: l, isLoading: d, error: c } = Ma(a, r);
|
|
4652
|
+
return /* @__PURE__ */ e(j, { appearance: n ?? u, children: /* @__PURE__ */ t("div", { className: "ss-card", children: [
|
|
4527
4653
|
/* @__PURE__ */ e("h2", { className: "ss-title", children: "Subscription" }),
|
|
4528
|
-
|
|
4654
|
+
d && /* @__PURE__ */ t("div", { className: "ss-loading", children: [
|
|
4529
4655
|
/* @__PURE__ */ e("span", { className: "ss-spinner" }),
|
|
4530
4656
|
" Loading..."
|
|
4531
4657
|
] }),
|
|
4532
|
-
|
|
4533
|
-
|
|
4658
|
+
c && /* @__PURE__ */ e("div", { className: "ss-global-error", children: c }),
|
|
4659
|
+
l && !d && /* @__PURE__ */ t(R, { children: [
|
|
4534
4660
|
/* @__PURE__ */ t("div", { className: "ss-field", children: [
|
|
4535
4661
|
/* @__PURE__ */ e("label", { className: "ss-label", children: "Customer" }),
|
|
4536
|
-
/* @__PURE__ */ e("input", { className: "ss-input", value:
|
|
4662
|
+
/* @__PURE__ */ e("input", { className: "ss-input", value: l.name || l.email, disabled: !0, readOnly: !0 })
|
|
4537
4663
|
] }),
|
|
4538
4664
|
/* @__PURE__ */ t("div", { className: "ss-field", children: [
|
|
4539
4665
|
/* @__PURE__ */ e("label", { className: "ss-label", children: "Status" }),
|
|
4540
|
-
/* @__PURE__ */ e("div", { children: /* @__PURE__ */ e("span", { className: `ss-badge ${
|
|
4666
|
+
/* @__PURE__ */ e("div", { children: /* @__PURE__ */ e("span", { className: `ss-badge ${Ra.active}`, children: "Active" }) })
|
|
4541
4667
|
] }),
|
|
4542
4668
|
/* @__PURE__ */ t("div", { className: "ss-btn-group", children: [
|
|
4543
|
-
|
|
4544
|
-
|
|
4669
|
+
s && /* @__PURE__ */ e("button", { type: "button", className: "ss-btn ss-btn-primary", onClick: s, children: "Change plan" }),
|
|
4670
|
+
i && /* @__PURE__ */ e("button", { type: "button", className: "ss-btn ss-btn-danger", onClick: i, children: "Cancel subscription" })
|
|
4545
4671
|
] })
|
|
4546
4672
|
] })
|
|
4547
4673
|
] }) });
|
|
4548
4674
|
}
|
|
4549
|
-
const
|
|
4675
|
+
const ja = {
|
|
4550
4676
|
paid: "ss-badge-active",
|
|
4551
4677
|
open: "ss-badge-trialing",
|
|
4552
4678
|
draft: "ss-badge-paused",
|
|
4553
4679
|
void: "ss-badge-canceled",
|
|
4554
4680
|
uncollectible: "ss-badge-past-due"
|
|
4555
4681
|
};
|
|
4556
|
-
function
|
|
4682
|
+
function qa(a) {
|
|
4557
4683
|
return new Date(a).toLocaleDateString("en-US", { year: "numeric", month: "short", day: "numeric" });
|
|
4558
4684
|
}
|
|
4559
|
-
function
|
|
4685
|
+
function Wa(a) {
|
|
4560
4686
|
return new Intl.NumberFormat("en-US", { style: "currency", currency: "USD", minimumFractionDigits: 2 }).format(a / 100);
|
|
4561
4687
|
}
|
|
4562
|
-
function
|
|
4563
|
-
const { appearance:
|
|
4564
|
-
return /* @__PURE__ */ e(
|
|
4688
|
+
function _a({ customerId: a, portalToken: r, appearance: s }) {
|
|
4689
|
+
const { appearance: i } = M(), { invoices: n, isLoading: u, error: l } = Va(a, r), d = s ?? i, c = [...n].sort((o, m) => new Date(m.createdAt).getTime() - new Date(o.createdAt).getTime());
|
|
4690
|
+
return /* @__PURE__ */ e(j, { appearance: d, children: /* @__PURE__ */ t("div", { className: "ss-card ss-card-wide", children: [
|
|
4565
4691
|
/* @__PURE__ */ e("h2", { className: "ss-title", children: "Invoices" }),
|
|
4566
4692
|
u && /* @__PURE__ */ t("div", { className: "ss-loading", children: [
|
|
4567
4693
|
/* @__PURE__ */ e("span", { className: "ss-spinner" }),
|
|
4568
4694
|
" Loading..."
|
|
4569
4695
|
] }),
|
|
4570
|
-
|
|
4571
|
-
!u &&
|
|
4572
|
-
!u &&
|
|
4696
|
+
l && /* @__PURE__ */ e("div", { className: "ss-global-error", children: l }),
|
|
4697
|
+
!u && c.length === 0 && /* @__PURE__ */ e("p", { className: "ss-empty", children: "No invoices yet." }),
|
|
4698
|
+
!u && c.length > 0 && /* @__PURE__ */ t("table", { className: "ss-table", children: [
|
|
4573
4699
|
/* @__PURE__ */ e("thead", { children: /* @__PURE__ */ t("tr", { children: [
|
|
4574
4700
|
/* @__PURE__ */ e("th", { className: "ss-th", children: "Date" }),
|
|
4575
4701
|
/* @__PURE__ */ e("th", { className: "ss-th", children: "Amount" }),
|
|
4576
4702
|
/* @__PURE__ */ e("th", { className: "ss-th", children: "Status" }),
|
|
4577
4703
|
/* @__PURE__ */ e("th", { className: "ss-th", children: "PDF" })
|
|
4578
4704
|
] }) }),
|
|
4579
|
-
/* @__PURE__ */ e("tbody", { children:
|
|
4580
|
-
/* @__PURE__ */ e("td", { className: "ss-td", children:
|
|
4581
|
-
/* @__PURE__ */ e("td", { className: "ss-td", children:
|
|
4582
|
-
/* @__PURE__ */ e("td", { className: "ss-td", children: /* @__PURE__ */ e("span", { className: `ss-badge ${
|
|
4583
|
-
/* @__PURE__ */ e("td", { className: "ss-td", children:
|
|
4584
|
-
] },
|
|
4705
|
+
/* @__PURE__ */ e("tbody", { children: c.map((o) => /* @__PURE__ */ t("tr", { className: "ss-tr", children: [
|
|
4706
|
+
/* @__PURE__ */ e("td", { className: "ss-td", children: qa(o.createdAt) }),
|
|
4707
|
+
/* @__PURE__ */ e("td", { className: "ss-td", children: Wa(o.amountCents) }),
|
|
4708
|
+
/* @__PURE__ */ e("td", { className: "ss-td", children: /* @__PURE__ */ e("span", { className: `ss-badge ${ja[o.status] || ""}`, children: o.status }) }),
|
|
4709
|
+
/* @__PURE__ */ e("td", { className: "ss-td", children: o.pdfUrl ? /* @__PURE__ */ e("a", { className: "ss-link", href: o.pdfUrl, target: "_blank", rel: "noopener noreferrer", children: "Download" }) : "—" })
|
|
4710
|
+
] }, o.id)) })
|
|
4585
4711
|
] })
|
|
4586
4712
|
] }) });
|
|
4587
4713
|
}
|
|
4588
|
-
function
|
|
4589
|
-
const { appearance: n } =
|
|
4590
|
-
return /* @__PURE__ */ e(
|
|
4714
|
+
function Ga({ customerId: a, limits: r, portalToken: s, appearance: i }) {
|
|
4715
|
+
const { appearance: n } = M(), { usage: u, isLoading: l, error: d } = Ua(a, s);
|
|
4716
|
+
return /* @__PURE__ */ e(j, { appearance: i ?? n, children: /* @__PURE__ */ t("div", { className: "ss-card", children: [
|
|
4591
4717
|
/* @__PURE__ */ e("h2", { className: "ss-title", children: "Usage" }),
|
|
4592
|
-
|
|
4718
|
+
l && /* @__PURE__ */ t("div", { className: "ss-loading", children: [
|
|
4593
4719
|
/* @__PURE__ */ e("span", { className: "ss-spinner" }),
|
|
4594
4720
|
" Loading..."
|
|
4595
4721
|
] }),
|
|
4596
|
-
|
|
4597
|
-
!
|
|
4598
|
-
!
|
|
4599
|
-
const
|
|
4722
|
+
d && /* @__PURE__ */ e("div", { className: "ss-global-error", children: d }),
|
|
4723
|
+
!l && u.length === 0 && /* @__PURE__ */ e("p", { className: "ss-empty", children: "No usage data." }),
|
|
4724
|
+
!l && u.map((o) => {
|
|
4725
|
+
const m = r == null ? void 0 : r[o.metric], p = m ? Math.min(100, o.total / m * 100) : null;
|
|
4600
4726
|
return /* @__PURE__ */ t("div", { className: "ss-usage-item", children: [
|
|
4601
4727
|
/* @__PURE__ */ t("div", { className: "ss-usage-header", children: [
|
|
4602
|
-
/* @__PURE__ */ e("span", { className: "ss-usage-metric", children:
|
|
4728
|
+
/* @__PURE__ */ e("span", { className: "ss-usage-metric", children: o.metric }),
|
|
4603
4729
|
/* @__PURE__ */ t("span", { className: "ss-usage-value", children: [
|
|
4604
|
-
|
|
4605
|
-
|
|
4730
|
+
o.total.toLocaleString(),
|
|
4731
|
+
m ? ` / ${m.toLocaleString()}` : ""
|
|
4606
4732
|
] })
|
|
4607
4733
|
] }),
|
|
4608
4734
|
p !== null && /* @__PURE__ */ e("div", { className: "ss-progress-bar", children: /* @__PURE__ */ e(
|
|
@@ -4612,20 +4738,20 @@ function ja({ customerId: a, limits: s, portalToken: r, appearance: o }) {
|
|
|
4612
4738
|
style: { width: `${p}%` }
|
|
4613
4739
|
}
|
|
4614
4740
|
) })
|
|
4615
|
-
] },
|
|
4741
|
+
] }, o.metric);
|
|
4616
4742
|
})
|
|
4617
4743
|
] }) });
|
|
4618
4744
|
}
|
|
4619
|
-
function
|
|
4745
|
+
function me({
|
|
4620
4746
|
customerId: a,
|
|
4621
|
-
portalToken:
|
|
4622
|
-
limits:
|
|
4623
|
-
onChangePlan:
|
|
4747
|
+
portalToken: r,
|
|
4748
|
+
limits: s,
|
|
4749
|
+
onChangePlan: i,
|
|
4624
4750
|
onCancel: n,
|
|
4625
4751
|
appearance: u
|
|
4626
4752
|
}) {
|
|
4627
|
-
const { appearance:
|
|
4628
|
-
return /* @__PURE__ */ e(
|
|
4753
|
+
const { appearance: l } = M(), d = u ?? l, [c, o] = g("subscription");
|
|
4754
|
+
return /* @__PURE__ */ e(j, { appearance: d, children: /* @__PURE__ */ t("div", { className: "ss-card ss-card-wide", children: [
|
|
4629
4755
|
/* @__PURE__ */ e("h2", { className: "ss-title", children: "Billing" }),
|
|
4630
4756
|
/* @__PURE__ */ e("div", { className: "ss-tab-group", children: [
|
|
4631
4757
|
{ id: "subscription", label: "Subscription" },
|
|
@@ -4635,46 +4761,46 @@ function ue({
|
|
|
4635
4761
|
"button",
|
|
4636
4762
|
{
|
|
4637
4763
|
type: "button",
|
|
4638
|
-
className: `ss-tab ${
|
|
4639
|
-
onClick: () =>
|
|
4764
|
+
className: `ss-tab ${c === p.id ? "ss-tab-active" : ""}`,
|
|
4765
|
+
onClick: () => o(p.id),
|
|
4640
4766
|
children: p.label
|
|
4641
4767
|
},
|
|
4642
4768
|
p.id
|
|
4643
4769
|
)) }),
|
|
4644
4770
|
/* @__PURE__ */ t("div", { className: "ss-tab-content", children: [
|
|
4645
|
-
|
|
4646
|
-
|
|
4771
|
+
c === "subscription" && /* @__PURE__ */ e(
|
|
4772
|
+
Ha,
|
|
4647
4773
|
{
|
|
4648
4774
|
customerId: a,
|
|
4649
|
-
portalToken:
|
|
4650
|
-
onChangePlan:
|
|
4775
|
+
portalToken: r,
|
|
4776
|
+
onChangePlan: i,
|
|
4651
4777
|
onCancel: n
|
|
4652
4778
|
}
|
|
4653
4779
|
),
|
|
4654
|
-
|
|
4655
|
-
|
|
4780
|
+
c === "invoices" && /* @__PURE__ */ e(_a, { customerId: a, portalToken: r }),
|
|
4781
|
+
c === "usage" && /* @__PURE__ */ e(Ga, { customerId: a, portalToken: r, limits: s })
|
|
4656
4782
|
] })
|
|
4657
4783
|
] }) });
|
|
4658
4784
|
}
|
|
4659
|
-
function
|
|
4660
|
-
const { appearance: n } =
|
|
4661
|
-
if (
|
|
4662
|
-
|
|
4785
|
+
function fe({ customerId: a, portalToken: r, onApplied: s, appearance: i }) {
|
|
4786
|
+
const { appearance: n } = M(), u = Z(r), l = i ?? n, [d, c] = g(""), [o, m] = g(!1), [p, h] = g(null), [y, x] = g(null), v = k(async (z) => {
|
|
4787
|
+
if (z.preventDefault(), !!d.trim()) {
|
|
4788
|
+
m(!0), h(null), x(null);
|
|
4663
4789
|
try {
|
|
4664
|
-
const
|
|
4665
|
-
|
|
4666
|
-
} catch (
|
|
4667
|
-
|
|
4790
|
+
const N = await u.applyCoupon(a, d.trim());
|
|
4791
|
+
x(`Coupon applied! ${N.discountType === "percent" ? `${N.amount}% off` : `$${(N.amount / 100).toFixed(2)} off`}`), c(""), s == null || s(N);
|
|
4792
|
+
} catch (N) {
|
|
4793
|
+
h(N instanceof Error ? N.message : "Invalid coupon code");
|
|
4668
4794
|
} finally {
|
|
4669
|
-
|
|
4795
|
+
m(!1);
|
|
4670
4796
|
}
|
|
4671
4797
|
}
|
|
4672
|
-
}, [u, a,
|
|
4673
|
-
return /* @__PURE__ */ e(
|
|
4798
|
+
}, [u, a, d, s]);
|
|
4799
|
+
return /* @__PURE__ */ e(j, { appearance: l, children: /* @__PURE__ */ t("div", { className: "ss-card", children: [
|
|
4674
4800
|
/* @__PURE__ */ e("h2", { className: "ss-title", children: "Apply coupon" }),
|
|
4675
4801
|
p && /* @__PURE__ */ e("div", { className: "ss-global-error", children: p }),
|
|
4676
|
-
|
|
4677
|
-
/* @__PURE__ */ t("form", { onSubmit:
|
|
4802
|
+
y && /* @__PURE__ */ e("div", { className: "ss-success-msg", children: y }),
|
|
4803
|
+
/* @__PURE__ */ t("form", { onSubmit: v, children: [
|
|
4678
4804
|
/* @__PURE__ */ t("div", { className: "ss-field", children: [
|
|
4679
4805
|
/* @__PURE__ */ e("label", { className: "ss-label", htmlFor: "ss-coupon-code", children: "Coupon code" }),
|
|
4680
4806
|
/* @__PURE__ */ e(
|
|
@@ -4684,102 +4810,102 @@ function pe({ customerId: a, portalToken: s, onApplied: r, appearance: o }) {
|
|
|
4684
4810
|
className: "ss-input",
|
|
4685
4811
|
type: "text",
|
|
4686
4812
|
placeholder: "Enter coupon code",
|
|
4687
|
-
value:
|
|
4688
|
-
onChange: (
|
|
4813
|
+
value: d,
|
|
4814
|
+
onChange: (z) => c(z.target.value),
|
|
4689
4815
|
required: !0
|
|
4690
4816
|
}
|
|
4691
4817
|
)
|
|
4692
4818
|
] }),
|
|
4693
|
-
/* @__PURE__ */ t("button", { type: "submit", className: "ss-btn ss-btn-primary", disabled:
|
|
4694
|
-
|
|
4819
|
+
/* @__PURE__ */ t("button", { type: "submit", className: "ss-btn ss-btn-primary", disabled: o || !d.trim(), children: [
|
|
4820
|
+
o && /* @__PURE__ */ e("span", { className: "ss-spinner" }),
|
|
4695
4821
|
"Apply"
|
|
4696
4822
|
] })
|
|
4697
4823
|
] })
|
|
4698
4824
|
] }) });
|
|
4699
4825
|
}
|
|
4700
|
-
function
|
|
4701
|
-
const { client: a } =
|
|
4826
|
+
function be() {
|
|
4827
|
+
const { client: a } = M();
|
|
4702
4828
|
return { report: a.report };
|
|
4703
4829
|
}
|
|
4704
|
-
function
|
|
4705
|
-
const { client: a } =
|
|
4706
|
-
n(!0),
|
|
4830
|
+
function ua() {
|
|
4831
|
+
const { client: a } = M(), [r, s] = g(null), [i, n] = g(!1), [u, l] = g(null), d = k(async (c) => {
|
|
4832
|
+
n(!0), l(null);
|
|
4707
4833
|
try {
|
|
4708
|
-
const
|
|
4709
|
-
return
|
|
4710
|
-
} catch (
|
|
4711
|
-
return
|
|
4834
|
+
const o = await a.report.executeQuery(c);
|
|
4835
|
+
return s(o), o;
|
|
4836
|
+
} catch (o) {
|
|
4837
|
+
return l(o instanceof Error ? o.message : "Query failed"), null;
|
|
4712
4838
|
} finally {
|
|
4713
4839
|
n(!1);
|
|
4714
4840
|
}
|
|
4715
4841
|
}, [a]);
|
|
4716
|
-
return { result:
|
|
4842
|
+
return { result: r, execute: d, isLoading: i, error: u };
|
|
4717
4843
|
}
|
|
4718
|
-
function
|
|
4719
|
-
const { client:
|
|
4720
|
-
u(!0),
|
|
4844
|
+
function Ya(a) {
|
|
4845
|
+
const { client: r } = M(), [s, i] = g(null), [n, u] = g(!0), [l, d] = g(null), c = k(async () => {
|
|
4846
|
+
u(!0), d(null);
|
|
4721
4847
|
try {
|
|
4722
|
-
const
|
|
4723
|
-
o
|
|
4724
|
-
} catch (
|
|
4725
|
-
|
|
4848
|
+
const o = await r.report.listQueries(a);
|
|
4849
|
+
i(o);
|
|
4850
|
+
} catch (o) {
|
|
4851
|
+
d(o instanceof Error ? o.message : "Failed to load queries");
|
|
4726
4852
|
} finally {
|
|
4727
4853
|
u(!1);
|
|
4728
4854
|
}
|
|
4729
|
-
}, [
|
|
4730
|
-
return
|
|
4731
|
-
|
|
4732
|
-
}, [
|
|
4855
|
+
}, [r, a]);
|
|
4856
|
+
return U(() => {
|
|
4857
|
+
c();
|
|
4858
|
+
}, [c]), { queries: (s == null ? void 0 : s.data) ?? [], meta: s == null ? void 0 : s.meta, isLoading: n, error: l, refresh: c };
|
|
4733
4859
|
}
|
|
4734
|
-
function
|
|
4735
|
-
const { client:
|
|
4736
|
-
u(!0),
|
|
4860
|
+
function xe(a) {
|
|
4861
|
+
const { client: r } = M(), [s, i] = g(null), [n, u] = g(!0), [l, d] = g(null), c = k(async () => {
|
|
4862
|
+
u(!0), d(null);
|
|
4737
4863
|
try {
|
|
4738
|
-
const
|
|
4739
|
-
o
|
|
4740
|
-
} catch (
|
|
4741
|
-
|
|
4864
|
+
const o = await r.report.getDashboard(a);
|
|
4865
|
+
i(o);
|
|
4866
|
+
} catch (o) {
|
|
4867
|
+
d(o instanceof Error ? o.message : "Failed to load dashboard");
|
|
4742
4868
|
} finally {
|
|
4743
4869
|
u(!1);
|
|
4744
4870
|
}
|
|
4745
|
-
}, [
|
|
4746
|
-
return
|
|
4747
|
-
|
|
4748
|
-
}, [
|
|
4871
|
+
}, [r, a]);
|
|
4872
|
+
return U(() => {
|
|
4873
|
+
c();
|
|
4874
|
+
}, [c]), { dashboard: s, isLoading: n, error: l, refresh: c };
|
|
4749
4875
|
}
|
|
4750
|
-
function
|
|
4751
|
-
const
|
|
4752
|
-
const p = new Q(
|
|
4876
|
+
function ye(a, r, s = "https://api.saas-support.com/v1") {
|
|
4877
|
+
const i = G(() => {
|
|
4878
|
+
const p = new Q(s, { type: "embedToken", token: a });
|
|
4753
4879
|
return new ta(p);
|
|
4754
|
-
}, [a,
|
|
4755
|
-
|
|
4880
|
+
}, [a, s]), [n, u] = g(null), [l, d] = g(!0), [c, o] = g(null), m = k(async () => {
|
|
4881
|
+
d(!0), o(null);
|
|
4756
4882
|
try {
|
|
4757
|
-
const p = await
|
|
4883
|
+
const p = await i.getDashboard(r);
|
|
4758
4884
|
u(p);
|
|
4759
4885
|
} catch (p) {
|
|
4760
|
-
|
|
4886
|
+
o(p instanceof Error ? p.message : "Failed to load dashboard");
|
|
4761
4887
|
} finally {
|
|
4762
|
-
|
|
4888
|
+
d(!1);
|
|
4763
4889
|
}
|
|
4764
|
-
}, [
|
|
4765
|
-
return
|
|
4766
|
-
|
|
4767
|
-
}, [
|
|
4890
|
+
}, [i, r]);
|
|
4891
|
+
return U(() => {
|
|
4892
|
+
m();
|
|
4893
|
+
}, [m]), { dashboard: n, reportClient: i, isLoading: l, error: c, refresh: m };
|
|
4768
4894
|
}
|
|
4769
|
-
function
|
|
4770
|
-
const { appearance: n } =
|
|
4771
|
-
if (
|
|
4772
|
-
const
|
|
4773
|
-
|
|
4774
|
-
}, [
|
|
4775
|
-
return /* @__PURE__ */ e(
|
|
4776
|
-
|
|
4895
|
+
function ve({ onResult: a, mode: r = "both", placeholder: s, appearance: i }) {
|
|
4896
|
+
const { appearance: n } = M(), { execute: u, isLoading: l, error: d } = ua(), c = i ?? n, [o, m] = g(""), [p, h] = g(r === "sql" ? "sql" : "nl"), y = k(async (x) => {
|
|
4897
|
+
if (x.preventDefault(), !o.trim()) return;
|
|
4898
|
+
const z = await u(p === "sql" ? { sql: o } : { naturalLanguage: o });
|
|
4899
|
+
z && (a == null || a(z));
|
|
4900
|
+
}, [o, p, u, a]);
|
|
4901
|
+
return /* @__PURE__ */ e(j, { appearance: c, children: /* @__PURE__ */ t("div", { className: "ss-card ss-card-wide", children: [
|
|
4902
|
+
r === "both" && /* @__PURE__ */ t("div", { className: "ss-tab-group ss-tab-group-sm", children: [
|
|
4777
4903
|
/* @__PURE__ */ e(
|
|
4778
4904
|
"button",
|
|
4779
4905
|
{
|
|
4780
4906
|
type: "button",
|
|
4781
4907
|
className: `ss-tab ${p === "nl" ? "ss-tab-active" : ""}`,
|
|
4782
|
-
onClick: () =>
|
|
4908
|
+
onClick: () => h("nl"),
|
|
4783
4909
|
children: "Natural Language"
|
|
4784
4910
|
}
|
|
4785
4911
|
),
|
|
@@ -4788,228 +4914,228 @@ function fe({ onResult: a, mode: s = "both", placeholder: r, appearance: o }) {
|
|
|
4788
4914
|
{
|
|
4789
4915
|
type: "button",
|
|
4790
4916
|
className: `ss-tab ${p === "sql" ? "ss-tab-active" : ""}`,
|
|
4791
|
-
onClick: () =>
|
|
4917
|
+
onClick: () => h("sql"),
|
|
4792
4918
|
children: "SQL"
|
|
4793
4919
|
}
|
|
4794
4920
|
)
|
|
4795
4921
|
] }),
|
|
4796
|
-
|
|
4797
|
-
/* @__PURE__ */ t("form", { onSubmit:
|
|
4922
|
+
d && /* @__PURE__ */ e("div", { className: "ss-global-error", children: d }),
|
|
4923
|
+
/* @__PURE__ */ t("form", { onSubmit: y, children: [
|
|
4798
4924
|
/* @__PURE__ */ e("div", { className: "ss-field", children: /* @__PURE__ */ e(
|
|
4799
4925
|
"textarea",
|
|
4800
4926
|
{
|
|
4801
4927
|
className: "ss-input ss-query-textarea",
|
|
4802
|
-
placeholder:
|
|
4803
|
-
value:
|
|
4804
|
-
onChange: (
|
|
4928
|
+
placeholder: s ?? (p === "sql" ? "SELECT ..." : "Ask a question about your data..."),
|
|
4929
|
+
value: o,
|
|
4930
|
+
onChange: (x) => m(x.target.value),
|
|
4805
4931
|
rows: 3
|
|
4806
4932
|
}
|
|
4807
4933
|
) }),
|
|
4808
|
-
/* @__PURE__ */ t("button", { type: "submit", className: "ss-btn ss-btn-primary", disabled:
|
|
4809
|
-
|
|
4934
|
+
/* @__PURE__ */ t("button", { type: "submit", className: "ss-btn ss-btn-primary", disabled: l || !o.trim(), children: [
|
|
4935
|
+
l && /* @__PURE__ */ e("span", { className: "ss-spinner" }),
|
|
4810
4936
|
"Run query"
|
|
4811
4937
|
] })
|
|
4812
4938
|
] })
|
|
4813
4939
|
] }) });
|
|
4814
4940
|
}
|
|
4815
|
-
function
|
|
4816
|
-
const { appearance: u } =
|
|
4817
|
-
const
|
|
4818
|
-
if (
|
|
4819
|
-
if (
|
|
4820
|
-
if (
|
|
4821
|
-
if (typeof
|
|
4822
|
-
return
|
|
4823
|
-
const C = String(
|
|
4824
|
-
return
|
|
4825
|
-
}) :
|
|
4826
|
-
|
|
4941
|
+
function Ja({ columns: a, rows: r, sortable: s = !0, maxRows: i, appearance: n }) {
|
|
4942
|
+
const { appearance: u } = M(), l = n ?? u, [d, c] = g(null), [o, m] = g("asc"), p = G(() => d ? [...r].sort((v, z) => {
|
|
4943
|
+
const N = v[d], O = z[d];
|
|
4944
|
+
if (N == null && O == null) return 0;
|
|
4945
|
+
if (N == null) return 1;
|
|
4946
|
+
if (O == null) return -1;
|
|
4947
|
+
if (typeof N == "number" && typeof O == "number")
|
|
4948
|
+
return o === "asc" ? N - O : O - N;
|
|
4949
|
+
const C = String(N), f = String(O);
|
|
4950
|
+
return o === "asc" ? C.localeCompare(f) : f.localeCompare(C);
|
|
4951
|
+
}) : r, [r, d, o]), h = i ? p.slice(0, i) : p, y = (v) => {
|
|
4952
|
+
s && (d === v ? m((z) => z === "asc" ? "desc" : "asc") : (c(v), m("asc")));
|
|
4827
4953
|
};
|
|
4828
|
-
function
|
|
4829
|
-
return
|
|
4954
|
+
function x(v) {
|
|
4955
|
+
return v == null ? "" : typeof v == "object" ? JSON.stringify(v) : String(v);
|
|
4830
4956
|
}
|
|
4831
|
-
return /* @__PURE__ */ e(
|
|
4957
|
+
return /* @__PURE__ */ e(j, { appearance: l, children: /* @__PURE__ */ t("div", { className: "ss-table-container", children: [
|
|
4832
4958
|
/* @__PURE__ */ t("table", { className: "ss-table", children: [
|
|
4833
|
-
/* @__PURE__ */ e("thead", { children: /* @__PURE__ */ e("tr", { children: a.map((
|
|
4959
|
+
/* @__PURE__ */ e("thead", { children: /* @__PURE__ */ e("tr", { children: a.map((v) => /* @__PURE__ */ t(
|
|
4834
4960
|
"th",
|
|
4835
4961
|
{
|
|
4836
|
-
className: `ss-th ${
|
|
4837
|
-
onClick: () =>
|
|
4962
|
+
className: `ss-th ${s ? "ss-th-sortable" : ""} ${d === v ? o === "asc" ? "ss-sorted-asc" : "ss-sorted-desc" : ""}`,
|
|
4963
|
+
onClick: () => y(v),
|
|
4838
4964
|
children: [
|
|
4839
|
-
|
|
4840
|
-
|
|
4965
|
+
v,
|
|
4966
|
+
d === v && /* @__PURE__ */ e("span", { className: "ss-sort-indicator", children: o === "asc" ? " ▲" : " ▼" })
|
|
4841
4967
|
]
|
|
4842
4968
|
},
|
|
4843
|
-
|
|
4969
|
+
v
|
|
4844
4970
|
)) }) }),
|
|
4845
|
-
/* @__PURE__ */ e("tbody", { children:
|
|
4971
|
+
/* @__PURE__ */ e("tbody", { children: h.map((v, z) => /* @__PURE__ */ e("tr", { className: "ss-tr", children: a.map((N) => /* @__PURE__ */ e("td", { className: "ss-td", children: x(v[N]) }, N)) }, z)) })
|
|
4846
4972
|
] }),
|
|
4847
|
-
|
|
4973
|
+
i && r.length > i && /* @__PURE__ */ t("div", { className: "ss-table-footer", children: [
|
|
4848
4974
|
"Showing ",
|
|
4849
|
-
|
|
4975
|
+
i,
|
|
4850
4976
|
" of ",
|
|
4851
|
-
|
|
4977
|
+
r.length,
|
|
4852
4978
|
" rows"
|
|
4853
4979
|
] })
|
|
4854
4980
|
] }) });
|
|
4855
4981
|
}
|
|
4856
|
-
function
|
|
4857
|
-
const
|
|
4982
|
+
function Qa(a, r = "#6366f1") {
|
|
4983
|
+
const s = parseInt(r.replace("#", "").slice(0, 2), 16), i = [];
|
|
4858
4984
|
for (let n = 0; n < a; n++) {
|
|
4859
|
-
const u = (
|
|
4860
|
-
|
|
4985
|
+
const u = (s + n * Math.floor(360 / Math.max(a, 1))) % 360;
|
|
4986
|
+
i.push(`hsl(${u}, 65%, 55%)`);
|
|
4861
4987
|
}
|
|
4862
|
-
return
|
|
4988
|
+
return i;
|
|
4863
4989
|
}
|
|
4864
|
-
function
|
|
4865
|
-
const u = Math.max(...
|
|
4990
|
+
function Za({ labels: a, values: r, w: s, h: i, colors: n }) {
|
|
4991
|
+
const u = Math.max(...r, 1), l = 40, d = s - l * 2, c = i - l * 2, o = Math.max(1, d / a.length - 4);
|
|
4866
4992
|
return /* @__PURE__ */ t("g", { children: [
|
|
4867
|
-
/* @__PURE__ */ e("line", { x1:
|
|
4868
|
-
|
|
4869
|
-
const
|
|
4993
|
+
/* @__PURE__ */ e("line", { x1: l, y1: i - l, x2: s - l, y2: i - l, stroke: "#ccc", strokeWidth: 1 }),
|
|
4994
|
+
r.map((m, p) => {
|
|
4995
|
+
const h = m / u * c, y = l + d / a.length * p + 2, x = i - l - h;
|
|
4870
4996
|
return /* @__PURE__ */ t("g", { children: [
|
|
4871
|
-
/* @__PURE__ */ e("rect", { x:
|
|
4872
|
-
/* @__PURE__ */ e("text", { x:
|
|
4997
|
+
/* @__PURE__ */ e("rect", { x: y, y: x, width: o, height: h, fill: n[p % n.length], rx: 2 }),
|
|
4998
|
+
/* @__PURE__ */ e("text", { x: y + o / 2, y: i - l + 14, textAnchor: "middle", fontSize: 10, fill: "#666", children: a[p].length > 8 ? a[p].slice(0, 8) + "..." : a[p] })
|
|
4873
4999
|
] }, p);
|
|
4874
5000
|
})
|
|
4875
5001
|
] });
|
|
4876
5002
|
}
|
|
4877
|
-
function
|
|
4878
|
-
const u = Math.max(...
|
|
4879
|
-
const
|
|
4880
|
-
return `${
|
|
5003
|
+
function Ka({ labels: a, values: r, w: s, h: i, colors: n }) {
|
|
5004
|
+
const u = Math.max(...r, 1), l = 40, d = s - l * 2, c = i - l * 2, o = a.length > 1 ? d / (a.length - 1) : 0, m = r.map((p, h) => {
|
|
5005
|
+
const y = l + o * h, x = i - l - p / u * c;
|
|
5006
|
+
return `${y},${x}`;
|
|
4881
5007
|
});
|
|
4882
5008
|
return /* @__PURE__ */ t("g", { children: [
|
|
4883
5009
|
[0.25, 0.5, 0.75, 1].map((p) => {
|
|
4884
|
-
const
|
|
4885
|
-
return /* @__PURE__ */ e("line", { x1:
|
|
5010
|
+
const h = i - l - p * c;
|
|
5011
|
+
return /* @__PURE__ */ e("line", { x1: l, y1: h, x2: s - l, y2: h, stroke: "#eee", strokeWidth: 1 }, p);
|
|
4886
5012
|
}),
|
|
4887
|
-
/* @__PURE__ */ e("polyline", { points:
|
|
4888
|
-
|
|
4889
|
-
const
|
|
4890
|
-
return /* @__PURE__ */ e("circle", { cx:
|
|
5013
|
+
/* @__PURE__ */ e("polyline", { points: m.join(" "), fill: "none", stroke: n[0], strokeWidth: 2 }),
|
|
5014
|
+
r.map((p, h) => {
|
|
5015
|
+
const y = l + o * h, x = i - l - p / u * c;
|
|
5016
|
+
return /* @__PURE__ */ e("circle", { cx: y, cy: x, r: 4, fill: n[0] }, h);
|
|
4891
5017
|
})
|
|
4892
5018
|
] });
|
|
4893
5019
|
}
|
|
4894
|
-
function
|
|
4895
|
-
const u =
|
|
4896
|
-
let
|
|
4897
|
-
const p =
|
|
4898
|
-
const
|
|
4899
|
-
return
|
|
5020
|
+
function Xa({ labels: a, values: r, w: s, h: i, colors: n }) {
|
|
5021
|
+
const u = r.reduce((h, y) => h + y, 0) || 1, l = s / 2, d = i / 2 - 20, c = Math.min(s, i) / 2 - 40, o = 2 * Math.PI * c;
|
|
5022
|
+
let m = 0;
|
|
5023
|
+
const p = r.map((h, y) => {
|
|
5024
|
+
const x = h / u, v = x * o, z = { dash: v, offset: m, color: n[y % n.length], label: a[y], pct: x };
|
|
5025
|
+
return m += v, z;
|
|
4900
5026
|
});
|
|
4901
5027
|
return /* @__PURE__ */ t("g", { children: [
|
|
4902
|
-
p.map((
|
|
5028
|
+
p.map((h, y) => /* @__PURE__ */ e(
|
|
4903
5029
|
"circle",
|
|
4904
5030
|
{
|
|
4905
|
-
cx:
|
|
4906
|
-
cy:
|
|
4907
|
-
r:
|
|
5031
|
+
cx: l,
|
|
5032
|
+
cy: d,
|
|
5033
|
+
r: c,
|
|
4908
5034
|
fill: "none",
|
|
4909
|
-
stroke:
|
|
4910
|
-
strokeWidth:
|
|
4911
|
-
strokeDasharray: `${
|
|
4912
|
-
strokeDashoffset: -
|
|
4913
|
-
transform: `rotate(-90 ${
|
|
5035
|
+
stroke: h.color,
|
|
5036
|
+
strokeWidth: c * 0.6,
|
|
5037
|
+
strokeDasharray: `${h.dash} ${o - h.dash}`,
|
|
5038
|
+
strokeDashoffset: -h.offset,
|
|
5039
|
+
transform: `rotate(-90 ${l} ${d})`
|
|
4914
5040
|
},
|
|
4915
|
-
|
|
5041
|
+
y
|
|
4916
5042
|
)),
|
|
4917
|
-
/* @__PURE__ */ e("g", { transform: `translate(${
|
|
4918
|
-
/* @__PURE__ */ e("rect", { width: 10, height: 10, fill:
|
|
4919
|
-
/* @__PURE__ */ e("text", { x: 14, y: 9, fontSize: 9, fill: "#666", children:
|
|
4920
|
-
] },
|
|
5043
|
+
/* @__PURE__ */ e("g", { transform: `translate(${l - a.length * 30}, ${i - 20})`, children: p.slice(0, 6).map((h, y) => /* @__PURE__ */ t("g", { transform: `translate(${y * 60}, 0)`, children: [
|
|
5044
|
+
/* @__PURE__ */ e("rect", { width: 10, height: 10, fill: h.color, rx: 2 }),
|
|
5045
|
+
/* @__PURE__ */ e("text", { x: 14, y: 9, fontSize: 9, fill: "#666", children: h.label.length > 6 ? h.label.slice(0, 6) + ".." : h.label })
|
|
5046
|
+
] }, y)) })
|
|
4921
5047
|
] });
|
|
4922
5048
|
}
|
|
4923
|
-
function
|
|
4924
|
-
const { appearance:
|
|
4925
|
-
return /* @__PURE__ */ e(
|
|
4926
|
-
|
|
4927
|
-
/* @__PURE__ */ t("svg", { viewBox: `0 0 ${
|
|
4928
|
-
a === "bar" && /* @__PURE__ */ e(
|
|
4929
|
-
a === "line" && /* @__PURE__ */ e(
|
|
4930
|
-
a === "pie" && /* @__PURE__ */ e(
|
|
5049
|
+
function ae({ type: a, data: r, title: s, width: i = 400, height: n = 300, appearance: u }) {
|
|
5050
|
+
const { appearance: l } = M(), d = u ?? l, c = G(() => Qa(r.labels.length), [r.labels.length]);
|
|
5051
|
+
return /* @__PURE__ */ e(j, { appearance: d, children: /* @__PURE__ */ t("div", { className: "ss-chart-container", children: [
|
|
5052
|
+
s && /* @__PURE__ */ e("h3", { className: "ss-chart-title", children: s }),
|
|
5053
|
+
/* @__PURE__ */ t("svg", { viewBox: `0 0 ${i} ${n}`, width: "100%", style: { maxWidth: i }, children: [
|
|
5054
|
+
a === "bar" && /* @__PURE__ */ e(Za, { labels: r.labels, values: r.values, w: i, h: n, colors: c }),
|
|
5055
|
+
a === "line" && /* @__PURE__ */ e(Ka, { labels: r.labels, values: r.values, w: i, h: n, colors: c }),
|
|
5056
|
+
a === "pie" && /* @__PURE__ */ e(Xa, { labels: r.labels, values: r.values, w: i, h: n, colors: c })
|
|
4931
5057
|
] })
|
|
4932
5058
|
] }) });
|
|
4933
5059
|
}
|
|
4934
|
-
function
|
|
4935
|
-
const u =
|
|
4936
|
-
if (
|
|
4937
|
-
const
|
|
4938
|
-
return new ta(
|
|
5060
|
+
function we({ dashboardId: a, embedToken: r, baseUrl: s, refreshInterval: i, appearance: n }) {
|
|
5061
|
+
const u = M(), l = n ?? (u == null ? void 0 : u.appearance), d = G(() => {
|
|
5062
|
+
if (r) {
|
|
5063
|
+
const N = s ?? "https://api.saas-support.com/v1", O = new Q(N, { type: "embedToken", token: r });
|
|
5064
|
+
return new ta(O);
|
|
4939
5065
|
}
|
|
4940
5066
|
return u.client.report;
|
|
4941
|
-
}, [
|
|
4942
|
-
|
|
5067
|
+
}, [r, s, u]), [c, o] = g([]), [m, p] = g({}), [h, y] = g(!0), [x, v] = g(null), z = k(async () => {
|
|
5068
|
+
y(!0), v(null);
|
|
4943
5069
|
try {
|
|
4944
|
-
const
|
|
4945
|
-
|
|
5070
|
+
const N = await d.getDashboard(a), O = JSON.parse(N.layoutJson || "[]");
|
|
5071
|
+
o(O);
|
|
4946
5072
|
const C = {};
|
|
4947
|
-
for (const
|
|
5073
|
+
for (const f of O)
|
|
4948
5074
|
try {
|
|
4949
|
-
const
|
|
4950
|
-
if (
|
|
4951
|
-
const
|
|
4952
|
-
C[
|
|
5075
|
+
const P = await d.listQueries({ search: f.queryId, perPage: 1 });
|
|
5076
|
+
if (P.data.length > 0 && P.data[0].generatedSql) {
|
|
5077
|
+
const I = await d.executeQuery({ sql: P.data[0].generatedSql });
|
|
5078
|
+
C[f.queryId] = I;
|
|
4953
5079
|
}
|
|
4954
5080
|
} catch {
|
|
4955
5081
|
}
|
|
4956
5082
|
p(C);
|
|
4957
|
-
} catch (
|
|
4958
|
-
|
|
5083
|
+
} catch (N) {
|
|
5084
|
+
v(N instanceof Error ? N.message : "Failed to load dashboard");
|
|
4959
5085
|
} finally {
|
|
4960
|
-
|
|
4961
|
-
}
|
|
4962
|
-
}, [
|
|
4963
|
-
return
|
|
4964
|
-
|
|
4965
|
-
}, [
|
|
4966
|
-
if (!
|
|
4967
|
-
const
|
|
4968
|
-
return () => clearInterval(
|
|
4969
|
-
}, [
|
|
4970
|
-
|
|
5086
|
+
y(!1);
|
|
5087
|
+
}
|
|
5088
|
+
}, [d, a]);
|
|
5089
|
+
return U(() => {
|
|
5090
|
+
z();
|
|
5091
|
+
}, [z]), U(() => {
|
|
5092
|
+
if (!i || i <= 0) return;
|
|
5093
|
+
const N = setInterval(z, i * 1e3);
|
|
5094
|
+
return () => clearInterval(N);
|
|
5095
|
+
}, [i, z]), /* @__PURE__ */ e(j, { appearance: l, children: /* @__PURE__ */ t("div", { className: "ss-dashboard-grid", children: [
|
|
5096
|
+
h && /* @__PURE__ */ t("div", { className: "ss-loading", children: [
|
|
4971
5097
|
/* @__PURE__ */ e("span", { className: "ss-spinner" }),
|
|
4972
5098
|
" Loading dashboard..."
|
|
4973
5099
|
] }),
|
|
4974
|
-
|
|
4975
|
-
!
|
|
4976
|
-
const C =
|
|
5100
|
+
x && /* @__PURE__ */ e("div", { className: "ss-global-error", children: x }),
|
|
5101
|
+
!h && c.map((N, O) => {
|
|
5102
|
+
const C = m[N.queryId];
|
|
4977
5103
|
if (!C) return null;
|
|
4978
|
-
const
|
|
4979
|
-
labels: C.rows.map((
|
|
4980
|
-
values: C.rows.map((
|
|
5104
|
+
const f = C.columns.length >= 2 ? {
|
|
5105
|
+
labels: C.rows.map((P) => String(P[C.columns[0]] ?? "")),
|
|
5106
|
+
values: C.rows.map((P) => Number(P[C.columns[1]] ?? 0))
|
|
4981
5107
|
} : { labels: [], values: [] };
|
|
4982
5108
|
return /* @__PURE__ */ t("div", { className: "ss-widget", children: [
|
|
4983
|
-
|
|
4984
|
-
|
|
4985
|
-
|
|
5109
|
+
N.title && /* @__PURE__ */ e("h4", { className: "ss-widget-header", children: N.title }),
|
|
5110
|
+
N.chartType === "table" ? /* @__PURE__ */ e(Ja, { columns: C.columns, rows: C.rows, maxRows: 50 }) : /* @__PURE__ */ e(
|
|
5111
|
+
ae,
|
|
4986
5112
|
{
|
|
4987
|
-
type:
|
|
4988
|
-
data:
|
|
4989
|
-
width:
|
|
4990
|
-
height:
|
|
5113
|
+
type: N.chartType || "bar",
|
|
5114
|
+
data: f,
|
|
5115
|
+
width: N.w,
|
|
5116
|
+
height: N.h
|
|
4991
5117
|
}
|
|
4992
5118
|
)
|
|
4993
|
-
] },
|
|
5119
|
+
] }, O);
|
|
4994
5120
|
})
|
|
4995
5121
|
] }) });
|
|
4996
5122
|
}
|
|
4997
|
-
function
|
|
5123
|
+
function ee(a) {
|
|
4998
5124
|
return new Date(a).toLocaleDateString("en-US", { year: "numeric", month: "short", day: "numeric" });
|
|
4999
5125
|
}
|
|
5000
|
-
function
|
|
5001
|
-
const { appearance:
|
|
5126
|
+
function Ne({ onSelectQuery: a, onRunQuery: r, appearance: s }) {
|
|
5127
|
+
const { appearance: i } = M(), { queries: n, isLoading: u, error: l } = Ya(), { execute: d, isLoading: c } = ua(), o = s ?? i, m = k(async (p) => {
|
|
5002
5128
|
if (!p.generatedSql) return;
|
|
5003
|
-
const
|
|
5004
|
-
|
|
5005
|
-
}, [
|
|
5006
|
-
return /* @__PURE__ */ e(
|
|
5129
|
+
const h = await d({ sql: p.generatedSql });
|
|
5130
|
+
h && (r == null || r(h));
|
|
5131
|
+
}, [d, r]);
|
|
5132
|
+
return /* @__PURE__ */ e(j, { appearance: o, children: /* @__PURE__ */ t("div", { className: "ss-card ss-card-wide", children: [
|
|
5007
5133
|
/* @__PURE__ */ e("h2", { className: "ss-title", children: "Saved Queries" }),
|
|
5008
5134
|
u && /* @__PURE__ */ t("div", { className: "ss-loading", children: [
|
|
5009
5135
|
/* @__PURE__ */ e("span", { className: "ss-spinner" }),
|
|
5010
5136
|
" Loading..."
|
|
5011
5137
|
] }),
|
|
5012
|
-
|
|
5138
|
+
l && /* @__PURE__ */ e("div", { className: "ss-global-error", children: l }),
|
|
5013
5139
|
!u && n.length === 0 && /* @__PURE__ */ e("p", { className: "ss-empty", children: "No saved queries." }),
|
|
5014
5140
|
!u && n.map((p) => /* @__PURE__ */ t(
|
|
5015
5141
|
"div",
|
|
@@ -5023,17 +5149,17 @@ function xe({ onSelectQuery: a, onRunQuery: s, appearance: r }) {
|
|
|
5023
5149
|
] }),
|
|
5024
5150
|
p.naturalLanguage && /* @__PURE__ */ e("p", { className: "ss-saved-query-desc", children: p.naturalLanguage }),
|
|
5025
5151
|
/* @__PURE__ */ t("div", { className: "ss-saved-query-footer", children: [
|
|
5026
|
-
/* @__PURE__ */ e("span", { className: "ss-saved-query-date", children:
|
|
5152
|
+
/* @__PURE__ */ e("span", { className: "ss-saved-query-date", children: ee(p.createdAt) }),
|
|
5027
5153
|
/* @__PURE__ */ e(
|
|
5028
5154
|
"button",
|
|
5029
5155
|
{
|
|
5030
5156
|
type: "button",
|
|
5031
5157
|
className: "ss-btn ss-btn-sm ss-btn-primary",
|
|
5032
|
-
disabled:
|
|
5033
|
-
onClick: (
|
|
5034
|
-
|
|
5158
|
+
disabled: c || !p.generatedSql,
|
|
5159
|
+
onClick: (h) => {
|
|
5160
|
+
h.stopPropagation(), m(p);
|
|
5035
5161
|
},
|
|
5036
|
-
children:
|
|
5162
|
+
children: c ? /* @__PURE__ */ e("span", { className: "ss-spinner" }) : "Run"
|
|
5037
5163
|
}
|
|
5038
5164
|
)
|
|
5039
5165
|
] })
|
|
@@ -5043,107 +5169,108 @@ function xe({ onSelectQuery: a, onRunQuery: s, appearance: r }) {
|
|
|
5043
5169
|
))
|
|
5044
5170
|
] }) });
|
|
5045
5171
|
}
|
|
5046
|
-
function
|
|
5172
|
+
function Se({ embedToken: a, dashboardId: r, baseUrl: s = "https://api.saas-support.com/v1", refreshInterval: i, appearance: n }) {
|
|
5047
5173
|
const u = G(() => {
|
|
5048
|
-
const
|
|
5049
|
-
return new ta(
|
|
5050
|
-
}, [a,
|
|
5051
|
-
|
|
5174
|
+
const v = new Q(s, { type: "embedToken", token: a });
|
|
5175
|
+
return new ta(v);
|
|
5176
|
+
}, [a, s]), [l, d] = g([]), [c, o] = g(!0), [m, p] = g(null), h = G(() => aa(n), [n]), y = G(() => ea(h), [h]), x = k(async () => {
|
|
5177
|
+
o(!0), p(null);
|
|
5052
5178
|
try {
|
|
5053
|
-
const
|
|
5054
|
-
|
|
5179
|
+
const v = await u.getDashboard(r), z = JSON.parse(v.layoutJson || "[]"), N = await Promise.all(
|
|
5180
|
+
z.map(async (O) => {
|
|
5055
5181
|
try {
|
|
5056
|
-
const C = await u.listQueries({ search:
|
|
5182
|
+
const C = await u.listQueries({ search: O.queryId, perPage: 1 });
|
|
5057
5183
|
if (C.data.length > 0 && C.data[0].generatedSql) {
|
|
5058
|
-
const
|
|
5059
|
-
return { ...
|
|
5184
|
+
const f = await u.executeQuery({ sql: C.data[0].generatedSql });
|
|
5185
|
+
return { ...O, result: f };
|
|
5060
5186
|
}
|
|
5061
5187
|
} catch {
|
|
5062
5188
|
}
|
|
5063
|
-
return
|
|
5189
|
+
return O;
|
|
5064
5190
|
})
|
|
5065
5191
|
);
|
|
5066
|
-
|
|
5067
|
-
} catch (
|
|
5068
|
-
p(
|
|
5192
|
+
d(N);
|
|
5193
|
+
} catch (v) {
|
|
5194
|
+
p(v instanceof Error ? v.message : "Failed to load dashboard");
|
|
5069
5195
|
} finally {
|
|
5070
|
-
|
|
5071
|
-
}
|
|
5072
|
-
}, [u,
|
|
5073
|
-
return
|
|
5074
|
-
|
|
5075
|
-
}, [
|
|
5076
|
-
if (!
|
|
5077
|
-
const
|
|
5078
|
-
return () => clearInterval(
|
|
5079
|
-
}, [
|
|
5196
|
+
o(!1);
|
|
5197
|
+
}
|
|
5198
|
+
}, [u, r]);
|
|
5199
|
+
return U(() => {
|
|
5200
|
+
x();
|
|
5201
|
+
}, [x]), U(() => {
|
|
5202
|
+
if (!i || i <= 0) return;
|
|
5203
|
+
const v = setInterval(x, i * 1e3);
|
|
5204
|
+
return () => clearInterval(v);
|
|
5205
|
+
}, [i, x]), /* @__PURE__ */ e(
|
|
5080
5206
|
"div",
|
|
5081
5207
|
{
|
|
5082
|
-
ref: (
|
|
5083
|
-
if (!
|
|
5084
|
-
const
|
|
5085
|
-
|
|
5086
|
-
const
|
|
5087
|
-
|
|
5208
|
+
ref: (v) => {
|
|
5209
|
+
if (!v || v.shadowRoot) return;
|
|
5210
|
+
const z = v.attachShadow({ mode: "open" }), N = document.createElement("style");
|
|
5211
|
+
N.textContent = y, z.appendChild(N);
|
|
5212
|
+
const O = document.createElement("div");
|
|
5213
|
+
z.appendChild(O);
|
|
5088
5214
|
},
|
|
5089
5215
|
style: { display: "contents" },
|
|
5090
5216
|
children: /* @__PURE__ */ t("div", { className: "ss-dashboard-grid", children: [
|
|
5091
|
-
|
|
5092
|
-
|
|
5093
|
-
!
|
|
5094
|
-
if (!
|
|
5095
|
-
const { columns:
|
|
5217
|
+
c && /* @__PURE__ */ e("div", { className: "ss-loading", children: "Loading dashboard..." }),
|
|
5218
|
+
m && /* @__PURE__ */ e("div", { className: "ss-global-error", children: m }),
|
|
5219
|
+
!c && l.map((v, z) => {
|
|
5220
|
+
if (!v.result) return null;
|
|
5221
|
+
const { columns: N, rows: O } = v.result;
|
|
5096
5222
|
return /* @__PURE__ */ t("div", { className: "ss-widget", children: [
|
|
5097
|
-
|
|
5223
|
+
v.title && /* @__PURE__ */ e("h4", { className: "ss-widget-header", children: v.title }),
|
|
5098
5224
|
/* @__PURE__ */ t("table", { className: "ss-table", children: [
|
|
5099
|
-
/* @__PURE__ */ e("thead", { children: /* @__PURE__ */ e("tr", { children:
|
|
5100
|
-
/* @__PURE__ */ e("tbody", { children:
|
|
5225
|
+
/* @__PURE__ */ e("thead", { children: /* @__PURE__ */ e("tr", { children: N.map((C) => /* @__PURE__ */ e("th", { className: "ss-th", children: C }, C)) }) }),
|
|
5226
|
+
/* @__PURE__ */ e("tbody", { children: O.slice(0, 50).map((C, f) => /* @__PURE__ */ e("tr", { className: "ss-tr", children: N.map((P) => /* @__PURE__ */ e("td", { className: "ss-td", children: String(C[P] ?? "") }, P)) }, f)) })
|
|
5101
5227
|
] })
|
|
5102
|
-
] },
|
|
5228
|
+
] }, z);
|
|
5103
5229
|
})
|
|
5104
5230
|
] })
|
|
5105
5231
|
}
|
|
5106
5232
|
);
|
|
5107
5233
|
}
|
|
5108
5234
|
export {
|
|
5109
|
-
|
|
5110
|
-
|
|
5111
|
-
|
|
5112
|
-
|
|
5113
|
-
|
|
5114
|
-
|
|
5115
|
-
|
|
5116
|
-
|
|
5117
|
-
|
|
5118
|
-
|
|
5119
|
-
|
|
5120
|
-
|
|
5121
|
-
|
|
5122
|
-
|
|
5123
|
-
|
|
5124
|
-
|
|
5125
|
-
|
|
5126
|
-
|
|
5127
|
-
|
|
5128
|
-
|
|
5129
|
-
|
|
5130
|
-
|
|
5131
|
-
|
|
5235
|
+
ae as Chart,
|
|
5236
|
+
fe as CouponInput,
|
|
5237
|
+
we as DashboardView,
|
|
5238
|
+
Ja as DataTable,
|
|
5239
|
+
_a as InvoiceHistory,
|
|
5240
|
+
pe as OrgSwitcher,
|
|
5241
|
+
me as PaymentPortal,
|
|
5242
|
+
he as PricingTable,
|
|
5243
|
+
ve as QueryInput,
|
|
5244
|
+
Se as ReportEmbed,
|
|
5245
|
+
na as SaaSContext,
|
|
5246
|
+
Ce as SaaSError,
|
|
5247
|
+
oe as SaaSProvider,
|
|
5248
|
+
va as SaaSSupport,
|
|
5249
|
+
Ne as SavedQueryList,
|
|
5250
|
+
Ia as SettingsPanel,
|
|
5251
|
+
le as SignIn,
|
|
5252
|
+
ce as SignUp,
|
|
5253
|
+
Ha as SubscriptionStatus,
|
|
5254
|
+
Ga as UsageDisplay,
|
|
5255
|
+
de as UserButton,
|
|
5256
|
+
ue as UserProfile,
|
|
5257
|
+
wa as isMfaRequired,
|
|
5132
5258
|
sa as useAuth,
|
|
5133
|
-
|
|
5134
|
-
|
|
5135
|
-
|
|
5136
|
-
|
|
5137
|
-
|
|
5259
|
+
ge as useBilling,
|
|
5260
|
+
xe as useDashboard,
|
|
5261
|
+
Oa as useDeleteAccount,
|
|
5262
|
+
ye as useEmbedDashboard,
|
|
5263
|
+
ra as useInvites,
|
|
5264
|
+
Va as useInvoices,
|
|
5138
5265
|
Y as useOrg,
|
|
5139
|
-
|
|
5140
|
-
|
|
5141
|
-
|
|
5142
|
-
|
|
5143
|
-
|
|
5144
|
-
|
|
5145
|
-
|
|
5146
|
-
|
|
5147
|
-
|
|
5148
|
-
|
|
5266
|
+
ia as useProfile,
|
|
5267
|
+
ua as useQuery,
|
|
5268
|
+
be as useReport,
|
|
5269
|
+
M as useSaaSContext,
|
|
5270
|
+
Ya as useSavedQueries,
|
|
5271
|
+
oa as useSignIn,
|
|
5272
|
+
Pa as useSignUp,
|
|
5273
|
+
Ma as useSubscription,
|
|
5274
|
+
Ua as useUsage,
|
|
5275
|
+
ie as useUser
|
|
5149
5276
|
};
|