@saas-support/react 0.7.0 → 0.7.2
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.d.ts +1 -0
- package/dist/react.cjs +592 -301
- package/dist/react.d.ts +11 -0
- package/dist/react.js +1725 -1038
- package/package.json +1 -1
package/dist/react.js
CHANGED
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
import { jsx as e, jsxs as
|
|
2
|
-
import { createContext as ma, useContext as
|
|
3
|
-
import { SaaSSupport as
|
|
4
|
-
import { SaaSError as
|
|
5
|
-
import { createPortal as
|
|
1
|
+
import { jsx as e, jsxs as t, Fragment as j } from "react/jsx-runtime";
|
|
2
|
+
import { createContext as ma, useContext as fa, useState as g, useEffect as U, useRef as _, useCallback as k, useMemo as G } from "react";
|
|
3
|
+
import { SaaSSupport as ba, isMfaRequired as xa, BillingClient as ya, Transport as Q, ReportClient as ta } from "./index.js";
|
|
4
|
+
import { SaaSError as Ne } from "./index.js";
|
|
5
|
+
import { createPortal as va } from "react-dom";
|
|
6
6
|
const ra = ma(null);
|
|
7
|
-
function
|
|
8
|
-
const a =
|
|
7
|
+
function A() {
|
|
8
|
+
const a = fa(ra);
|
|
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
|
|
13
|
+
function te({ publishableKey: a, apiKey: s, baseUrl: r, appearance: o, children: n }) {
|
|
14
|
+
const [u] = g(() => new ba({ publishableKey: a, apiKey: s, baseUrl: r })), [i, l] = g(null), [d, c] = g(!1), [f, p] = g(null);
|
|
15
|
+
return U(() => {
|
|
16
16
|
let m = !1;
|
|
17
17
|
u.load().then(async () => {
|
|
18
18
|
if (m) return;
|
|
19
19
|
const w = await u.auth.getUser(), y = await u.auth.getSettings();
|
|
20
|
-
|
|
20
|
+
l(w), p(y), c(!0);
|
|
21
21
|
});
|
|
22
22
|
const b = u.auth.onAuthStateChange((w) => {
|
|
23
|
-
m ||
|
|
23
|
+
m || l(w);
|
|
24
24
|
});
|
|
25
25
|
return () => {
|
|
26
26
|
m = !0, b(), u.destroy();
|
|
27
27
|
};
|
|
28
|
-
}, [u]), /* @__PURE__ */ e(ra.Provider, { value: { client: u, user:
|
|
28
|
+
}, [u]), /* @__PURE__ */ e(ra.Provider, { value: { client: u, user: i, isLoaded: d, appearance: o, settings: f }, children: n });
|
|
29
29
|
}
|
|
30
|
-
const
|
|
30
|
+
const wa = {
|
|
31
31
|
// Legacy (unchanged)
|
|
32
32
|
colorPrimary: "#6366f1",
|
|
33
33
|
colorPrimaryHover: "#4f46e5",
|
|
@@ -61,7 +61,7 @@ const Na = {
|
|
|
61
61
|
authSuccess: "#22c55e",
|
|
62
62
|
authFontHeadline: "'Manrope', sans-serif",
|
|
63
63
|
authFontBody: "'Inter', sans-serif"
|
|
64
|
-
},
|
|
64
|
+
}, Na = {
|
|
65
65
|
// Legacy (unchanged)
|
|
66
66
|
colorPrimary: "#818cf8",
|
|
67
67
|
colorPrimaryHover: "#6366f1",
|
|
@@ -96,53 +96,53 @@ const Na = {
|
|
|
96
96
|
authFontHeadline: "'Manrope', sans-serif",
|
|
97
97
|
authFontBody: "'Inter', sans-serif"
|
|
98
98
|
};
|
|
99
|
-
function
|
|
100
|
-
const s = (a == null ? void 0 : a.baseTheme) === "dark" ?
|
|
99
|
+
function aa(a) {
|
|
100
|
+
const s = (a == null ? void 0 : a.baseTheme) === "dark" ? Na : wa, r = a == null ? void 0 : a.variables, o = (r == null ? void 0 : r.colorPrimary) ?? s.authPrimary;
|
|
101
101
|
return {
|
|
102
102
|
// Legacy
|
|
103
|
-
colorPrimary: (
|
|
104
|
-
colorPrimaryHover:
|
|
105
|
-
colorBackground: (
|
|
106
|
-
colorText: (
|
|
103
|
+
colorPrimary: (r == null ? void 0 : r.colorPrimary) ?? s.colorPrimary,
|
|
104
|
+
colorPrimaryHover: r != null && r.colorPrimary ? Sa(r.colorPrimary, 10) : s.colorPrimaryHover,
|
|
105
|
+
colorBackground: (r == null ? void 0 : r.colorBackground) ?? s.colorBackground,
|
|
106
|
+
colorText: (r == null ? void 0 : r.colorText) ?? s.colorText,
|
|
107
107
|
colorTextSecondary: s.colorTextSecondary,
|
|
108
|
-
colorInputBackground: (
|
|
109
|
-
colorInputBorder: (
|
|
110
|
-
colorError: (
|
|
111
|
-
colorSuccess: (
|
|
112
|
-
colorWarning: (
|
|
113
|
-
fontFamily: (
|
|
114
|
-
borderRadius: (
|
|
108
|
+
colorInputBackground: (r == null ? void 0 : r.colorInputBackground) ?? s.colorInputBackground,
|
|
109
|
+
colorInputBorder: (r == null ? void 0 : r.colorInputBorder) ?? s.colorInputBorder,
|
|
110
|
+
colorError: (r == null ? void 0 : r.colorError) ?? s.colorError,
|
|
111
|
+
colorSuccess: (r == null ? void 0 : r.colorSuccess) ?? s.colorSuccess,
|
|
112
|
+
colorWarning: (r == null ? void 0 : r.colorWarning) ?? s.colorWarning,
|
|
113
|
+
fontFamily: (r == null ? void 0 : r.fontFamily) ?? s.fontFamily,
|
|
114
|
+
borderRadius: (r == null ? void 0 : r.borderRadius) ?? s.borderRadius,
|
|
115
115
|
// MD3 auth — derive from user overrides where applicable
|
|
116
116
|
authPrimary: o,
|
|
117
|
-
authPrimaryContainer:
|
|
117
|
+
authPrimaryContainer: r != null && r.colorPrimary ? $a(o, 15) : s.authPrimaryContainer,
|
|
118
118
|
authOnPrimary: s.authOnPrimary,
|
|
119
119
|
authPrimaryFixed: s.authPrimaryFixed,
|
|
120
|
-
authSurface: (
|
|
120
|
+
authSurface: (r == null ? void 0 : r.colorBackground) ?? s.authSurface,
|
|
121
121
|
authSurfaceContainerLowest: s.authSurfaceContainerLowest,
|
|
122
|
-
authSurfaceContainerLow: (
|
|
122
|
+
authSurfaceContainerLow: (r == null ? void 0 : r.colorInputBackground) ?? s.authSurfaceContainerLow,
|
|
123
123
|
authSurfaceContainer: s.authSurfaceContainer,
|
|
124
124
|
authSurfaceContainerHigh: s.authSurfaceContainerHigh,
|
|
125
125
|
authSurfaceContainerHighest: s.authSurfaceContainerHighest,
|
|
126
|
-
authOnSurface: (
|
|
126
|
+
authOnSurface: (r == null ? void 0 : r.colorText) ?? s.authOnSurface,
|
|
127
127
|
authOnSurfaceVariant: s.authOnSurfaceVariant,
|
|
128
128
|
authOutline: s.authOutline,
|
|
129
|
-
authOutlineVariant: (
|
|
130
|
-
authError: (
|
|
129
|
+
authOutlineVariant: (r == null ? void 0 : r.colorInputBorder) ?? s.authOutlineVariant,
|
|
130
|
+
authError: (r == null ? void 0 : r.colorError) ?? s.authError,
|
|
131
131
|
authErrorContainer: s.authErrorContainer,
|
|
132
|
-
authSuccess: (
|
|
133
|
-
authFontHeadline: (
|
|
134
|
-
authFontBody: (
|
|
132
|
+
authSuccess: (r == null ? void 0 : r.colorSuccess) ?? s.authSuccess,
|
|
133
|
+
authFontHeadline: (r == null ? void 0 : r.fontFamily) ?? s.authFontHeadline,
|
|
134
|
+
authFontBody: (r == null ? void 0 : r.fontFamily) ?? s.authFontBody
|
|
135
135
|
};
|
|
136
136
|
}
|
|
137
137
|
function Sa(a, s) {
|
|
138
|
-
const
|
|
138
|
+
const r = parseInt(a.replace("#", ""), 16), o = Math.max(0, (r >> 16) - Math.round(2.55 * s)), n = Math.max(0, (r >> 8 & 255) - Math.round(2.55 * s)), u = Math.max(0, (r & 255) - Math.round(2.55 * s));
|
|
139
139
|
return `#${(o << 16 | n << 8 | u).toString(16).padStart(6, "0")}`;
|
|
140
140
|
}
|
|
141
|
-
function
|
|
142
|
-
const
|
|
141
|
+
function $a(a, s) {
|
|
142
|
+
const r = parseInt(a.replace("#", ""), 16), o = Math.min(255, (r >> 16) + Math.round(2.55 * s)), n = Math.min(255, (r >> 8 & 255) + Math.round(2.55 * s)), u = Math.min(255, (r & 255) + Math.round(2.55 * s));
|
|
143
143
|
return `#${(o << 16 | n << 8 | u).toString(16).padStart(6, "0")}`;
|
|
144
144
|
}
|
|
145
|
-
function
|
|
145
|
+
function ea(a) {
|
|
146
146
|
return `
|
|
147
147
|
:host {
|
|
148
148
|
all: initial;
|
|
@@ -1412,6 +1412,38 @@ function aa(a) {
|
|
|
1412
1412
|
overflow: hidden;
|
|
1413
1413
|
}
|
|
1414
1414
|
|
|
1415
|
+
/* User Trigger (avatar + org name pill) */
|
|
1416
|
+
.ss-auth-user-trigger {
|
|
1417
|
+
display: inline-flex;
|
|
1418
|
+
align-items: center;
|
|
1419
|
+
gap: 8px;
|
|
1420
|
+
padding: 4px 12px 4px 4px;
|
|
1421
|
+
border-radius: 999px;
|
|
1422
|
+
border: 1px solid ${a.authOutlineVariant}33;
|
|
1423
|
+
background: ${a.authSurfaceContainerLow};
|
|
1424
|
+
cursor: pointer;
|
|
1425
|
+
transition: background 0.15s, box-shadow 0.15s;
|
|
1426
|
+
font-family: ${a.authFontBody};
|
|
1427
|
+
}
|
|
1428
|
+
|
|
1429
|
+
.ss-auth-user-trigger:hover {
|
|
1430
|
+
background: ${a.authSurfaceContainer};
|
|
1431
|
+
box-shadow: 0 0 0 2px ${a.authPrimary}33;
|
|
1432
|
+
}
|
|
1433
|
+
|
|
1434
|
+
.ss-auth-user-trigger:active { transform: scale(0.98); }
|
|
1435
|
+
|
|
1436
|
+
.ss-auth-trigger-org-name {
|
|
1437
|
+
font-size: 13px;
|
|
1438
|
+
font-weight: 600;
|
|
1439
|
+
color: ${a.authOnSurface};
|
|
1440
|
+
max-width: 140px;
|
|
1441
|
+
overflow: hidden;
|
|
1442
|
+
text-overflow: ellipsis;
|
|
1443
|
+
white-space: nowrap;
|
|
1444
|
+
letter-spacing: -0.01em;
|
|
1445
|
+
}
|
|
1446
|
+
|
|
1415
1447
|
/* Avatar Trigger */
|
|
1416
1448
|
.ss-auth-avatar-trigger {
|
|
1417
1449
|
width: 40px;
|
|
@@ -1419,20 +1451,12 @@ function aa(a) {
|
|
|
1419
1451
|
border-radius: 50%;
|
|
1420
1452
|
border: 2px solid ${a.authPrimary};
|
|
1421
1453
|
overflow: hidden;
|
|
1422
|
-
cursor: pointer;
|
|
1423
1454
|
transition: transform 0.15s, box-shadow 0.15s;
|
|
1424
1455
|
padding: 0;
|
|
1425
1456
|
background: none;
|
|
1426
1457
|
flex-shrink: 0;
|
|
1427
1458
|
}
|
|
1428
1459
|
|
|
1429
|
-
.ss-auth-avatar-trigger:hover {
|
|
1430
|
-
transform: scale(1.05);
|
|
1431
|
-
box-shadow: 0 0 0 3px ${a.authPrimary}33;
|
|
1432
|
-
}
|
|
1433
|
-
|
|
1434
|
-
.ss-auth-avatar-trigger:active { transform: scale(0.95); }
|
|
1435
|
-
|
|
1436
1460
|
.ss-auth-avatar-trigger img {
|
|
1437
1461
|
width: 100%;
|
|
1438
1462
|
height: 100%;
|
|
@@ -1600,6 +1624,24 @@ function aa(a) {
|
|
|
1600
1624
|
font-variation-settings: 'FILL' 1;
|
|
1601
1625
|
}
|
|
1602
1626
|
|
|
1627
|
+
/* Plan Badge */
|
|
1628
|
+
.ss-auth-plan-badge {
|
|
1629
|
+
display: inline-block;
|
|
1630
|
+
font-size: 10px;
|
|
1631
|
+
font-weight: 700;
|
|
1632
|
+
text-transform: uppercase;
|
|
1633
|
+
letter-spacing: 0.05em;
|
|
1634
|
+
padding: 2px 8px;
|
|
1635
|
+
border-radius: 999px;
|
|
1636
|
+
background: ${a.authPrimary}1a;
|
|
1637
|
+
color: ${a.authPrimary};
|
|
1638
|
+
border: 1px solid ${a.authPrimary}33;
|
|
1639
|
+
margin-left: auto;
|
|
1640
|
+
white-space: nowrap;
|
|
1641
|
+
flex-shrink: 0;
|
|
1642
|
+
font-family: ${a.authFontBody};
|
|
1643
|
+
}
|
|
1644
|
+
|
|
1603
1645
|
/* Modal Overlay */
|
|
1604
1646
|
.ss-auth-modal-overlay {
|
|
1605
1647
|
position: fixed;
|
|
@@ -2171,6 +2213,250 @@ function aa(a) {
|
|
|
2171
2213
|
animation: ss-spin 0.6s linear infinite;
|
|
2172
2214
|
}
|
|
2173
2215
|
|
|
2216
|
+
/* Settings Panel (full page) */
|
|
2217
|
+
.ss-auth-settings-page {
|
|
2218
|
+
position: fixed;
|
|
2219
|
+
inset: 0;
|
|
2220
|
+
z-index: 99999;
|
|
2221
|
+
display: flex;
|
|
2222
|
+
flex-direction: column;
|
|
2223
|
+
background: ${a.authSurface};
|
|
2224
|
+
animation: ss-auth-fade-in 0.2s ease-out;
|
|
2225
|
+
}
|
|
2226
|
+
|
|
2227
|
+
.ss-auth-settings-header {
|
|
2228
|
+
display: flex;
|
|
2229
|
+
align-items: center;
|
|
2230
|
+
justify-content: space-between;
|
|
2231
|
+
padding: 20px 32px;
|
|
2232
|
+
border-bottom: 1px solid ${a.authOutlineVariant}1a;
|
|
2233
|
+
background: ${a.authSurfaceContainerHigh}80;
|
|
2234
|
+
flex-shrink: 0;
|
|
2235
|
+
}
|
|
2236
|
+
|
|
2237
|
+
.ss-auth-settings-header h2 {
|
|
2238
|
+
font-family: ${a.authFontHeadline};
|
|
2239
|
+
font-size: 20px;
|
|
2240
|
+
font-weight: 700;
|
|
2241
|
+
letter-spacing: -0.02em;
|
|
2242
|
+
color: ${a.authOnSurface};
|
|
2243
|
+
margin: 0;
|
|
2244
|
+
}
|
|
2245
|
+
|
|
2246
|
+
.ss-auth-settings-layout {
|
|
2247
|
+
display: flex;
|
|
2248
|
+
flex: 1;
|
|
2249
|
+
overflow: hidden;
|
|
2250
|
+
}
|
|
2251
|
+
|
|
2252
|
+
.ss-auth-settings-nav {
|
|
2253
|
+
width: 220px;
|
|
2254
|
+
padding: 16px;
|
|
2255
|
+
border-right: 1px solid ${a.authOutlineVariant}1a;
|
|
2256
|
+
display: flex;
|
|
2257
|
+
flex-direction: column;
|
|
2258
|
+
gap: 4px;
|
|
2259
|
+
flex-shrink: 0;
|
|
2260
|
+
background: ${a.authSurfaceContainerLow};
|
|
2261
|
+
}
|
|
2262
|
+
|
|
2263
|
+
.ss-auth-settings-nav-item {
|
|
2264
|
+
display: flex;
|
|
2265
|
+
align-items: center;
|
|
2266
|
+
gap: 10px;
|
|
2267
|
+
padding: 10px 14px;
|
|
2268
|
+
border-radius: 8px;
|
|
2269
|
+
cursor: pointer;
|
|
2270
|
+
transition: background 0.15s, color 0.15s;
|
|
2271
|
+
background: none;
|
|
2272
|
+
border: none;
|
|
2273
|
+
width: 100%;
|
|
2274
|
+
font-family: ${a.authFontBody};
|
|
2275
|
+
font-size: 14px;
|
|
2276
|
+
font-weight: 500;
|
|
2277
|
+
color: ${a.authOnSurfaceVariant};
|
|
2278
|
+
text-align: left;
|
|
2279
|
+
}
|
|
2280
|
+
|
|
2281
|
+
.ss-auth-settings-nav-item:hover {
|
|
2282
|
+
background: ${a.authSurfaceContainer};
|
|
2283
|
+
color: ${a.authOnSurface};
|
|
2284
|
+
}
|
|
2285
|
+
|
|
2286
|
+
.ss-auth-settings-nav-item-active {
|
|
2287
|
+
background: ${a.authPrimaryFixed}4d;
|
|
2288
|
+
color: ${a.authPrimary};
|
|
2289
|
+
font-weight: 600;
|
|
2290
|
+
}
|
|
2291
|
+
|
|
2292
|
+
.ss-auth-settings-nav-item-active:hover {
|
|
2293
|
+
background: ${a.authPrimaryFixed}4d;
|
|
2294
|
+
}
|
|
2295
|
+
|
|
2296
|
+
.ss-auth-settings-nav-item .material-symbols-outlined {
|
|
2297
|
+
font-size: 20px;
|
|
2298
|
+
}
|
|
2299
|
+
|
|
2300
|
+
.ss-auth-settings-content {
|
|
2301
|
+
flex: 1;
|
|
2302
|
+
overflow-y: auto;
|
|
2303
|
+
padding: 32px;
|
|
2304
|
+
}
|
|
2305
|
+
|
|
2306
|
+
.ss-auth-settings-content h3 {
|
|
2307
|
+
font-family: ${a.authFontHeadline};
|
|
2308
|
+
font-size: 18px;
|
|
2309
|
+
font-weight: 700;
|
|
2310
|
+
color: ${a.authOnSurface};
|
|
2311
|
+
letter-spacing: -0.01em;
|
|
2312
|
+
margin: 0 0 24px 0;
|
|
2313
|
+
}
|
|
2314
|
+
|
|
2315
|
+
.ss-auth-settings-card {
|
|
2316
|
+
background: ${a.authSurfaceContainer};
|
|
2317
|
+
border: 1px solid ${a.authOutlineVariant}1a;
|
|
2318
|
+
border-radius: 12px;
|
|
2319
|
+
padding: 24px;
|
|
2320
|
+
margin-bottom: 24px;
|
|
2321
|
+
}
|
|
2322
|
+
|
|
2323
|
+
.ss-auth-settings-card h4 {
|
|
2324
|
+
font-family: ${a.authFontHeadline};
|
|
2325
|
+
font-size: 15px;
|
|
2326
|
+
font-weight: 700;
|
|
2327
|
+
color: ${a.authOnSurface};
|
|
2328
|
+
margin: 0 0 16px 0;
|
|
2329
|
+
display: flex;
|
|
2330
|
+
align-items: center;
|
|
2331
|
+
gap: 8px;
|
|
2332
|
+
}
|
|
2333
|
+
|
|
2334
|
+
.ss-auth-settings-card h4 .material-symbols-outlined {
|
|
2335
|
+
color: ${a.authPrimary};
|
|
2336
|
+
font-size: 20px;
|
|
2337
|
+
}
|
|
2338
|
+
|
|
2339
|
+
/* Settings Table */
|
|
2340
|
+
.ss-auth-settings-table {
|
|
2341
|
+
width: 100%;
|
|
2342
|
+
border-collapse: collapse;
|
|
2343
|
+
font-family: ${a.authFontBody};
|
|
2344
|
+
font-size: 14px;
|
|
2345
|
+
}
|
|
2346
|
+
|
|
2347
|
+
.ss-auth-settings-table th {
|
|
2348
|
+
text-align: left;
|
|
2349
|
+
padding: 8px 12px;
|
|
2350
|
+
font-size: 11px;
|
|
2351
|
+
font-weight: 700;
|
|
2352
|
+
text-transform: uppercase;
|
|
2353
|
+
letter-spacing: 0.08em;
|
|
2354
|
+
color: ${a.authOnSurfaceVariant};
|
|
2355
|
+
border-bottom: 1px solid ${a.authOutlineVariant}33;
|
|
2356
|
+
}
|
|
2357
|
+
|
|
2358
|
+
.ss-auth-settings-table td {
|
|
2359
|
+
padding: 10px 12px;
|
|
2360
|
+
color: ${a.authOnSurface};
|
|
2361
|
+
border-bottom: 1px solid ${a.authOutlineVariant}1a;
|
|
2362
|
+
}
|
|
2363
|
+
|
|
2364
|
+
.ss-auth-settings-table tr:last-child td {
|
|
2365
|
+
border-bottom: none;
|
|
2366
|
+
}
|
|
2367
|
+
|
|
2368
|
+
.ss-auth-settings-table tr:hover td {
|
|
2369
|
+
background: ${a.authSurfaceContainerLow};
|
|
2370
|
+
}
|
|
2371
|
+
|
|
2372
|
+
/* Settings Role Badges */
|
|
2373
|
+
.ss-auth-role-badge {
|
|
2374
|
+
display: inline-block;
|
|
2375
|
+
font-size: 10px;
|
|
2376
|
+
font-weight: 700;
|
|
2377
|
+
text-transform: uppercase;
|
|
2378
|
+
letter-spacing: 0.05em;
|
|
2379
|
+
padding: 2px 8px;
|
|
2380
|
+
border-radius: 999px;
|
|
2381
|
+
font-family: ${a.authFontBody};
|
|
2382
|
+
}
|
|
2383
|
+
|
|
2384
|
+
.ss-auth-role-badge-owner {
|
|
2385
|
+
background: #8b5cf633;
|
|
2386
|
+
color: #8b5cf6;
|
|
2387
|
+
border: 1px solid #8b5cf64d;
|
|
2388
|
+
}
|
|
2389
|
+
|
|
2390
|
+
.ss-auth-role-badge-admin {
|
|
2391
|
+
background: #3b82f633;
|
|
2392
|
+
color: #3b82f6;
|
|
2393
|
+
border: 1px solid #3b82f64d;
|
|
2394
|
+
}
|
|
2395
|
+
|
|
2396
|
+
.ss-auth-role-badge-member {
|
|
2397
|
+
background: ${a.authOnSurfaceVariant}1a;
|
|
2398
|
+
color: ${a.authOnSurfaceVariant};
|
|
2399
|
+
border: 1px solid ${a.authOutlineVariant}33;
|
|
2400
|
+
}
|
|
2401
|
+
|
|
2402
|
+
/* Settings icon buttons */
|
|
2403
|
+
.ss-auth-icon-btn {
|
|
2404
|
+
background: none;
|
|
2405
|
+
border: none;
|
|
2406
|
+
cursor: pointer;
|
|
2407
|
+
padding: 4px;
|
|
2408
|
+
border-radius: 6px;
|
|
2409
|
+
color: ${a.authOnSurfaceVariant};
|
|
2410
|
+
display: inline-flex;
|
|
2411
|
+
align-items: center;
|
|
2412
|
+
justify-content: center;
|
|
2413
|
+
transition: background 0.15s, color 0.15s;
|
|
2414
|
+
}
|
|
2415
|
+
|
|
2416
|
+
.ss-auth-icon-btn:hover {
|
|
2417
|
+
background: ${a.authSurfaceContainerHigh};
|
|
2418
|
+
color: ${a.authOnSurface};
|
|
2419
|
+
}
|
|
2420
|
+
|
|
2421
|
+
.ss-auth-icon-btn-danger:hover {
|
|
2422
|
+
background: ${a.authError}1a;
|
|
2423
|
+
color: ${a.authError};
|
|
2424
|
+
}
|
|
2425
|
+
|
|
2426
|
+
.ss-auth-icon-btn .material-symbols-outlined {
|
|
2427
|
+
font-size: 18px;
|
|
2428
|
+
}
|
|
2429
|
+
|
|
2430
|
+
/* Settings Empty State */
|
|
2431
|
+
.ss-auth-settings-empty {
|
|
2432
|
+
text-align: center;
|
|
2433
|
+
padding: 40px 20px;
|
|
2434
|
+
color: ${a.authOnSurfaceVariant};
|
|
2435
|
+
font-size: 14px;
|
|
2436
|
+
}
|
|
2437
|
+
|
|
2438
|
+
.ss-auth-settings-empty .material-symbols-outlined {
|
|
2439
|
+
font-size: 40px;
|
|
2440
|
+
margin-bottom: 12px;
|
|
2441
|
+
opacity: 0.4;
|
|
2442
|
+
}
|
|
2443
|
+
|
|
2444
|
+
/* Settings action row */
|
|
2445
|
+
.ss-auth-settings-actions {
|
|
2446
|
+
display: flex;
|
|
2447
|
+
align-items: center;
|
|
2448
|
+
gap: 8px;
|
|
2449
|
+
}
|
|
2450
|
+
|
|
2451
|
+
/* Settings Danger Card */
|
|
2452
|
+
.ss-auth-settings-danger {
|
|
2453
|
+
border-color: ${a.authError}33;
|
|
2454
|
+
}
|
|
2455
|
+
|
|
2456
|
+
.ss-auth-settings-danger h4 {
|
|
2457
|
+
color: ${a.authError};
|
|
2458
|
+
}
|
|
2459
|
+
|
|
2174
2460
|
/* Responsive overrides */
|
|
2175
2461
|
@media (max-width: 640px) {
|
|
2176
2462
|
.ss-auth-profile-header {
|
|
@@ -2184,18 +2470,23 @@ function aa(a) {
|
|
|
2184
2470
|
|
|
2185
2471
|
.ss-auth-signout-row { flex-direction: column; text-align: center; }
|
|
2186
2472
|
.ss-auth-signout-info { flex-direction: column; }
|
|
2473
|
+
|
|
2474
|
+
.ss-auth-settings-nav { width: 180px; padding: 12px; }
|
|
2475
|
+
.ss-auth-settings-content { padding: 24px; }
|
|
2476
|
+
.ss-auth-trigger-org-name { display: none; }
|
|
2477
|
+
.ss-auth-user-trigger { padding: 0; border: none; background: none; }
|
|
2187
2478
|
}
|
|
2188
2479
|
`;
|
|
2189
2480
|
}
|
|
2190
|
-
function
|
|
2191
|
-
const
|
|
2192
|
-
|
|
2481
|
+
function H({ children: a, appearance: s }) {
|
|
2482
|
+
const r = _(null), [o, n] = g(null);
|
|
2483
|
+
U(() => {
|
|
2193
2484
|
var f;
|
|
2194
|
-
if (!
|
|
2195
|
-
n(((f =
|
|
2485
|
+
if (!r.current || r.current.shadowRoot) {
|
|
2486
|
+
n(((f = r.current) == null ? void 0 : f.shadowRoot) ?? null);
|
|
2196
2487
|
return;
|
|
2197
2488
|
}
|
|
2198
|
-
const
|
|
2489
|
+
const i = r.current.attachShadow({ mode: "open" });
|
|
2199
2490
|
if ((s == null ? void 0 : s.fontUrl) !== null) {
|
|
2200
2491
|
const p = (s == null ? void 0 : s.fontUrl) ?? "https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&family=Inter:wght@400;500;600&family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200&display=swap";
|
|
2201
2492
|
if (!document.querySelector(`link[href="${p}"]`)) {
|
|
@@ -2203,183 +2494,183 @@ function q({ children: a, appearance: s }) {
|
|
|
2203
2494
|
b.rel = "stylesheet", b.href = p, document.head.appendChild(b);
|
|
2204
2495
|
}
|
|
2205
2496
|
const m = document.createElement("link");
|
|
2206
|
-
m.rel = "stylesheet", m.href = p,
|
|
2497
|
+
m.rel = "stylesheet", m.href = p, i.appendChild(m);
|
|
2207
2498
|
}
|
|
2208
|
-
const
|
|
2209
|
-
d.textContent =
|
|
2210
|
-
const
|
|
2211
|
-
|
|
2212
|
-
}, []),
|
|
2499
|
+
const l = aa(s), d = document.createElement("style");
|
|
2500
|
+
d.textContent = ea(l), i.appendChild(d);
|
|
2501
|
+
const c = document.createElement("div");
|
|
2502
|
+
i.appendChild(c), n(i);
|
|
2503
|
+
}, []), U(() => {
|
|
2213
2504
|
if (!o) return;
|
|
2214
|
-
const
|
|
2215
|
-
if (
|
|
2216
|
-
const
|
|
2217
|
-
|
|
2505
|
+
const i = o.querySelector("style");
|
|
2506
|
+
if (i) {
|
|
2507
|
+
const l = aa(s);
|
|
2508
|
+
i.textContent = ea(l);
|
|
2218
2509
|
}
|
|
2219
2510
|
}, [s, o]);
|
|
2220
2511
|
const u = (o == null ? void 0 : o.querySelector("div")) ?? null;
|
|
2221
|
-
return /* @__PURE__ */ e("div", { ref:
|
|
2512
|
+
return /* @__PURE__ */ e("div", { ref: r, style: { display: "contents" }, children: u && va(a, u) });
|
|
2222
2513
|
}
|
|
2223
|
-
function
|
|
2224
|
-
const { client: a, user: s, isLoaded:
|
|
2514
|
+
function sa() {
|
|
2515
|
+
const { client: a, user: s, isLoaded: r } = A();
|
|
2225
2516
|
return {
|
|
2226
|
-
isLoaded:
|
|
2517
|
+
isLoaded: r,
|
|
2227
2518
|
isSignedIn: !!s,
|
|
2228
2519
|
user: s,
|
|
2229
|
-
signOut:
|
|
2230
|
-
getToken:
|
|
2231
|
-
refreshUser:
|
|
2520
|
+
signOut: k(() => a.auth.signOut(), [a]),
|
|
2521
|
+
getToken: k(() => a.auth.getToken(), [a]),
|
|
2522
|
+
refreshUser: k(() => a.auth.refreshUser(), [a])
|
|
2232
2523
|
};
|
|
2233
2524
|
}
|
|
2234
|
-
function
|
|
2235
|
-
const { user: a, isLoaded: s } =
|
|
2525
|
+
function se() {
|
|
2526
|
+
const { user: a, isLoaded: s } = A();
|
|
2236
2527
|
return { user: a, isLoaded: s };
|
|
2237
2528
|
}
|
|
2238
|
-
function
|
|
2239
|
-
const { client: a } =
|
|
2240
|
-
async (d,
|
|
2241
|
-
|
|
2529
|
+
function na() {
|
|
2530
|
+
const { client: a } = A(), [s, r] = g(!1), [o, n] = g(null), u = k(
|
|
2531
|
+
async (d, c) => {
|
|
2532
|
+
r(!0), n(null);
|
|
2242
2533
|
try {
|
|
2243
|
-
return await a.auth.signIn(d,
|
|
2534
|
+
return await a.auth.signIn(d, c);
|
|
2244
2535
|
} catch (f) {
|
|
2245
2536
|
return n(f instanceof Error ? f.message : "Sign in failed"), null;
|
|
2246
2537
|
} finally {
|
|
2247
|
-
|
|
2538
|
+
r(!1);
|
|
2248
2539
|
}
|
|
2249
2540
|
},
|
|
2250
2541
|
[a]
|
|
2251
|
-
),
|
|
2542
|
+
), i = k(
|
|
2252
2543
|
async (d) => {
|
|
2253
|
-
|
|
2544
|
+
r(!0), n(null);
|
|
2254
2545
|
try {
|
|
2255
2546
|
return await a.auth.signInWithOAuth(d);
|
|
2256
|
-
} catch (
|
|
2257
|
-
return n(
|
|
2547
|
+
} catch (c) {
|
|
2548
|
+
return n(c instanceof Error ? c.message : "OAuth sign in failed"), null;
|
|
2258
2549
|
} finally {
|
|
2259
|
-
|
|
2550
|
+
r(!1);
|
|
2260
2551
|
}
|
|
2261
2552
|
},
|
|
2262
2553
|
[a]
|
|
2263
|
-
),
|
|
2264
|
-
async (d,
|
|
2265
|
-
|
|
2554
|
+
), l = k(
|
|
2555
|
+
async (d, c) => {
|
|
2556
|
+
r(!0), n(null);
|
|
2266
2557
|
try {
|
|
2267
|
-
return await a.auth.submitMfaCode(d,
|
|
2558
|
+
return await a.auth.submitMfaCode(d, c);
|
|
2268
2559
|
} catch (f) {
|
|
2269
2560
|
return n(f instanceof Error ? f.message : "MFA verification failed"), null;
|
|
2270
2561
|
} finally {
|
|
2271
|
-
|
|
2562
|
+
r(!1);
|
|
2272
2563
|
}
|
|
2273
2564
|
},
|
|
2274
2565
|
[a]
|
|
2275
2566
|
);
|
|
2276
|
-
return { signIn: u, signInWithOAuth:
|
|
2567
|
+
return { signIn: u, signInWithOAuth: i, submitMfaCode: l, isLoading: s, error: o, setError: n };
|
|
2277
2568
|
}
|
|
2278
|
-
function
|
|
2279
|
-
const { client: a } =
|
|
2280
|
-
return { signUp:
|
|
2281
|
-
async (
|
|
2282
|
-
|
|
2569
|
+
function ka() {
|
|
2570
|
+
const { client: a } = A(), [s, r] = g(!1), [o, n] = g(null);
|
|
2571
|
+
return { signUp: k(
|
|
2572
|
+
async (i, l) => {
|
|
2573
|
+
r(!0), n(null);
|
|
2283
2574
|
try {
|
|
2284
|
-
return await a.auth.signUp(
|
|
2575
|
+
return await a.auth.signUp(i, l);
|
|
2285
2576
|
} catch (d) {
|
|
2286
2577
|
return n(d instanceof Error ? d.message : "Sign up failed"), null;
|
|
2287
2578
|
} finally {
|
|
2288
|
-
|
|
2579
|
+
r(!1);
|
|
2289
2580
|
}
|
|
2290
2581
|
},
|
|
2291
2582
|
[a]
|
|
2292
2583
|
), isLoading: s, error: o, setError: n };
|
|
2293
2584
|
}
|
|
2294
|
-
function
|
|
2295
|
-
const { client: a } =
|
|
2585
|
+
function Y() {
|
|
2586
|
+
const { client: a } = A(), [s, r] = g([]), [o, n] = g(null), [u, i] = g([]), [l, d] = g([]), [c, f] = g(!1), [p, m] = g(null), b = k(async () => {
|
|
2296
2587
|
f(!0), m(null);
|
|
2297
2588
|
try {
|
|
2298
|
-
const
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2589
|
+
const $ = await a.auth.listOrgs();
|
|
2590
|
+
if (r($), !o && $.length > 0) {
|
|
2591
|
+
const x = typeof window < "u" ? localStorage.getItem("ss_selected_org") : null, E = (x ? $.find((D) => D.id === x) : null) ?? ($.length === 1 ? $[0] : null);
|
|
2592
|
+
if (E) {
|
|
2593
|
+
n(E), typeof window < "u" && localStorage.setItem("ss_selected_org", E.id);
|
|
2594
|
+
try {
|
|
2595
|
+
const D = await a.auth.listMembers(E.id);
|
|
2596
|
+
i(D);
|
|
2597
|
+
} catch {
|
|
2598
|
+
}
|
|
2308
2599
|
}
|
|
2309
2600
|
}
|
|
2310
|
-
} catch (
|
|
2311
|
-
m(
|
|
2601
|
+
} catch ($) {
|
|
2602
|
+
m($ instanceof Error ? $.message : "Failed to load organizations");
|
|
2312
2603
|
} finally {
|
|
2313
2604
|
f(!1);
|
|
2314
2605
|
}
|
|
2315
2606
|
}, [a, o]);
|
|
2316
|
-
|
|
2607
|
+
U(() => {
|
|
2317
2608
|
b();
|
|
2318
2609
|
}, [b]);
|
|
2319
|
-
const w =
|
|
2610
|
+
const w = k(async ($) => {
|
|
2320
2611
|
try {
|
|
2321
|
-
const x = await a.auth.getOrg(
|
|
2322
|
-
n(x), typeof window < "u" && localStorage.setItem("ss_selected_org",
|
|
2323
|
-
const
|
|
2324
|
-
|
|
2612
|
+
const x = await a.auth.getOrg($);
|
|
2613
|
+
n(x), typeof window < "u" && localStorage.setItem("ss_selected_org", $);
|
|
2614
|
+
const S = await a.auth.listMembers($);
|
|
2615
|
+
i(S);
|
|
2325
2616
|
} catch (x) {
|
|
2326
2617
|
m(x instanceof Error ? x.message : "Failed to load organization");
|
|
2327
2618
|
}
|
|
2328
|
-
}, [a]), y =
|
|
2619
|
+
}, [a]), y = k(async ($, x) => {
|
|
2329
2620
|
try {
|
|
2330
|
-
const
|
|
2331
|
-
return
|
|
2332
|
-
} catch (
|
|
2333
|
-
return m(
|
|
2621
|
+
const S = await a.auth.createOrg($, x);
|
|
2622
|
+
return r((E) => [...E, S]), S;
|
|
2623
|
+
} catch (S) {
|
|
2624
|
+
return m(S instanceof Error ? S.message : "Failed to create organization"), null;
|
|
2334
2625
|
}
|
|
2335
|
-
}, [a]),
|
|
2626
|
+
}, [a]), O = k(async ($, x) => {
|
|
2336
2627
|
try {
|
|
2337
|
-
const
|
|
2338
|
-
return
|
|
2339
|
-
} catch (
|
|
2340
|
-
return m(
|
|
2628
|
+
const S = await a.auth.updateOrg($, x);
|
|
2629
|
+
return r((E) => E.map((D) => D.id === $ ? S : D)), (o == null ? void 0 : o.id) === $ && n(S), S;
|
|
2630
|
+
} catch (S) {
|
|
2631
|
+
return m(S instanceof Error ? S.message : "Failed to update organization"), null;
|
|
2341
2632
|
}
|
|
2342
|
-
}, [a, o]), h =
|
|
2633
|
+
}, [a, o]), h = k(async ($) => {
|
|
2343
2634
|
try {
|
|
2344
|
-
return await a.auth.deleteOrg(
|
|
2635
|
+
return await a.auth.deleteOrg($), r((x) => x.filter((S) => S.id !== $)), (o == null ? void 0 : o.id) === $ && (n(null), i([]), d([]), typeof window < "u" && localStorage.removeItem("ss_selected_org")), !0;
|
|
2345
2636
|
} catch (x) {
|
|
2346
2637
|
return m(x instanceof Error ? x.message : "Failed to delete organization"), !1;
|
|
2347
2638
|
}
|
|
2348
|
-
}, [a, o]), N =
|
|
2639
|
+
}, [a, o]), N = k(async ($, x, S) => {
|
|
2349
2640
|
try {
|
|
2350
|
-
return await a.auth.sendInvite(
|
|
2351
|
-
} catch (
|
|
2352
|
-
return m(
|
|
2641
|
+
return await a.auth.sendInvite($, x, S);
|
|
2642
|
+
} catch (E) {
|
|
2643
|
+
return m(E instanceof Error ? E.message : "Failed to send invite"), null;
|
|
2353
2644
|
}
|
|
2354
|
-
}, [a]),
|
|
2645
|
+
}, [a]), C = k(async ($) => {
|
|
2355
2646
|
try {
|
|
2356
|
-
const x = await a.auth.listInvites(
|
|
2647
|
+
const x = await a.auth.listInvites($);
|
|
2357
2648
|
d(x);
|
|
2358
2649
|
} catch (x) {
|
|
2359
2650
|
m(x instanceof Error ? x.message : "Failed to load invites");
|
|
2360
2651
|
}
|
|
2361
|
-
}, [a]),
|
|
2652
|
+
}, [a]), P = k(async ($, x) => {
|
|
2362
2653
|
try {
|
|
2363
|
-
return await a.auth.revokeInvite(
|
|
2364
|
-
} catch (
|
|
2365
|
-
return m(
|
|
2654
|
+
return await a.auth.revokeInvite($, x), d((S) => S.filter((E) => E.id !== x)), !0;
|
|
2655
|
+
} catch (S) {
|
|
2656
|
+
return m(S instanceof Error ? S.message : "Failed to revoke invite"), !1;
|
|
2366
2657
|
}
|
|
2367
|
-
}, [a]),
|
|
2658
|
+
}, [a]), I = k(async ($, x, S) => {
|
|
2368
2659
|
try {
|
|
2369
|
-
return await a.auth.updateMemberRole(
|
|
2370
|
-
} catch (
|
|
2371
|
-
return m(
|
|
2660
|
+
return await a.auth.updateMemberRole($, x, S), i((E) => E.map((D) => D.userId === x ? { ...D, role: S } : D)), !0;
|
|
2661
|
+
} catch (E) {
|
|
2662
|
+
return m(E instanceof Error ? E.message : "Failed to update member role"), !1;
|
|
2372
2663
|
}
|
|
2373
|
-
}, [a]),
|
|
2664
|
+
}, [a]), F = k(async ($, x) => {
|
|
2374
2665
|
try {
|
|
2375
|
-
return await a.auth.removeMember(
|
|
2376
|
-
} catch (
|
|
2377
|
-
return m(
|
|
2666
|
+
return await a.auth.removeMember($, x), i((S) => S.filter((E) => E.userId !== x)), !0;
|
|
2667
|
+
} catch (S) {
|
|
2668
|
+
return m(S instanceof Error ? S.message : "Failed to remove member"), !1;
|
|
2378
2669
|
}
|
|
2379
|
-
}, [a]),
|
|
2670
|
+
}, [a]), B = k(async ($) => {
|
|
2380
2671
|
try {
|
|
2381
|
-
const x = await a.auth.listMembers(
|
|
2382
|
-
|
|
2672
|
+
const x = await a.auth.listMembers($);
|
|
2673
|
+
i(x);
|
|
2383
2674
|
} catch (x) {
|
|
2384
2675
|
m(x instanceof Error ? x.message : "Failed to load members");
|
|
2385
2676
|
}
|
|
@@ -2388,43 +2679,43 @@ function na() {
|
|
|
2388
2679
|
orgs: s,
|
|
2389
2680
|
selectedOrg: o,
|
|
2390
2681
|
members: u,
|
|
2391
|
-
invites:
|
|
2392
|
-
isLoading:
|
|
2682
|
+
invites: l,
|
|
2683
|
+
isLoading: c,
|
|
2393
2684
|
error: p,
|
|
2394
2685
|
setError: m,
|
|
2395
2686
|
refresh: b,
|
|
2396
2687
|
selectOrg: w,
|
|
2397
2688
|
createOrg: y,
|
|
2398
|
-
updateOrg:
|
|
2689
|
+
updateOrg: O,
|
|
2399
2690
|
deleteOrg: h,
|
|
2400
2691
|
sendInvite: N,
|
|
2401
|
-
refreshInvites:
|
|
2402
|
-
revokeInvite:
|
|
2403
|
-
updateMemberRole:
|
|
2404
|
-
removeMember:
|
|
2405
|
-
refreshMembers:
|
|
2692
|
+
refreshInvites: C,
|
|
2693
|
+
revokeInvite: P,
|
|
2694
|
+
updateMemberRole: I,
|
|
2695
|
+
removeMember: F,
|
|
2696
|
+
refreshMembers: B
|
|
2406
2697
|
};
|
|
2407
2698
|
}
|
|
2408
|
-
function
|
|
2409
|
-
const { client: a } =
|
|
2410
|
-
return { deleteAccount:
|
|
2411
|
-
|
|
2699
|
+
function Ca() {
|
|
2700
|
+
const { client: a } = A(), [s, r] = g(!1), [o, n] = g(null);
|
|
2701
|
+
return { deleteAccount: k(async () => {
|
|
2702
|
+
r(!0), n(null);
|
|
2412
2703
|
try {
|
|
2413
2704
|
return await a.auth.deleteAccount(), !0;
|
|
2414
|
-
} catch (
|
|
2415
|
-
return n(
|
|
2705
|
+
} catch (i) {
|
|
2706
|
+
return n(i instanceof Error ? i.message : "Failed to delete account"), !1;
|
|
2416
2707
|
} finally {
|
|
2417
|
-
|
|
2708
|
+
r(!1);
|
|
2418
2709
|
}
|
|
2419
2710
|
}, [a]), isLoading: s, error: o, setError: n };
|
|
2420
2711
|
}
|
|
2421
2712
|
function oa() {
|
|
2422
|
-
const { client: a, user: s } =
|
|
2713
|
+
const { client: a, user: s } = A(), [r, o] = g(!1), [n, u] = g(null), [i, l] = g(null), d = k(
|
|
2423
2714
|
async (p) => {
|
|
2424
|
-
o(!0), u(null),
|
|
2715
|
+
o(!0), u(null), l(null);
|
|
2425
2716
|
try {
|
|
2426
2717
|
const m = await a.auth.updateProfile(p);
|
|
2427
|
-
return
|
|
2718
|
+
return l("Profile updated"), m;
|
|
2428
2719
|
} catch (m) {
|
|
2429
2720
|
return u(m instanceof Error ? m.message : "Failed to update profile"), null;
|
|
2430
2721
|
} finally {
|
|
@@ -2432,11 +2723,11 @@ function oa() {
|
|
|
2432
2723
|
}
|
|
2433
2724
|
},
|
|
2434
2725
|
[a]
|
|
2435
|
-
),
|
|
2726
|
+
), c = k(
|
|
2436
2727
|
async (p, m) => {
|
|
2437
|
-
o(!0), u(null),
|
|
2728
|
+
o(!0), u(null), l(null);
|
|
2438
2729
|
try {
|
|
2439
|
-
return await a.auth.changePassword(p, m),
|
|
2730
|
+
return await a.auth.changePassword(p, m), l("Password changed successfully"), !0;
|
|
2440
2731
|
} catch (b) {
|
|
2441
2732
|
return u(b instanceof Error ? b.message : "Failed to change password"), !1;
|
|
2442
2733
|
} finally {
|
|
@@ -2444,12 +2735,12 @@ function oa() {
|
|
|
2444
2735
|
}
|
|
2445
2736
|
},
|
|
2446
2737
|
[a]
|
|
2447
|
-
), f =
|
|
2738
|
+
), f = k(
|
|
2448
2739
|
async (p) => {
|
|
2449
|
-
o(!0), u(null),
|
|
2740
|
+
o(!0), u(null), l(null);
|
|
2450
2741
|
try {
|
|
2451
2742
|
const m = await a.auth.uploadAvatar(p);
|
|
2452
|
-
return
|
|
2743
|
+
return l("Avatar updated"), m;
|
|
2453
2744
|
} catch (m) {
|
|
2454
2745
|
return u(m instanceof Error ? m.message : "Failed to upload avatar"), null;
|
|
2455
2746
|
} finally {
|
|
@@ -2458,9 +2749,9 @@ function oa() {
|
|
|
2458
2749
|
},
|
|
2459
2750
|
[a]
|
|
2460
2751
|
);
|
|
2461
|
-
return { user: s, updateProfile: d, uploadAvatar: f, changePassword:
|
|
2752
|
+
return { user: s, updateProfile: d, uploadAvatar: f, changePassword: c, isLoading: r, error: n, success: i, setError: u, setSuccess: l };
|
|
2462
2753
|
}
|
|
2463
|
-
const ia = '<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>', la = '<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>',
|
|
2754
|
+
const ia = '<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>', la = '<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>', v = {
|
|
2464
2755
|
close: "close",
|
|
2465
2756
|
person: "person",
|
|
2466
2757
|
logout: "logout",
|
|
@@ -2485,50 +2776,56 @@ const ia = '<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d=
|
|
|
2485
2776
|
corporateFare: "corporate_fare",
|
|
2486
2777
|
cloudDone: "cloud_done",
|
|
2487
2778
|
check: "check",
|
|
2488
|
-
image: "image"
|
|
2779
|
+
image: "image",
|
|
2780
|
+
settings: "settings",
|
|
2781
|
+
group: "group",
|
|
2782
|
+
creditCard: "credit_card",
|
|
2783
|
+
edit: "edit",
|
|
2784
|
+
send: "send",
|
|
2785
|
+
personRemove: "person_remove"
|
|
2489
2786
|
};
|
|
2490
|
-
function
|
|
2491
|
-
const { appearance: o, settings: n } =
|
|
2787
|
+
function re({ appearance: a, signUpUrl: s, onSignUp: r }) {
|
|
2788
|
+
const { appearance: o, settings: n } = A(), { signIn: u, signInWithOAuth: i, submitMfaCode: l, isLoading: d, error: c, setError: f } = na(), p = a ?? o, [m, b] = g(""), [w, y] = g(""), [O, h] = g(!1), [N, C] = g(!1), [P, I] = g(""), [F, B] = g(["", "", "", "", "", ""]), $ = _([]), x = k(
|
|
2492
2789
|
async (T) => {
|
|
2493
2790
|
if (T.preventDefault(), N) {
|
|
2494
|
-
await
|
|
2791
|
+
await l(P, F.join(""));
|
|
2495
2792
|
return;
|
|
2496
2793
|
}
|
|
2497
|
-
const
|
|
2498
|
-
|
|
2794
|
+
const z = await u(m, w);
|
|
2795
|
+
z && xa(z) && (I(z.mfaToken), C(!0), f(null));
|
|
2499
2796
|
},
|
|
2500
|
-
[m, w, N,
|
|
2501
|
-
),
|
|
2797
|
+
[m, w, N, P, F, u, l, f]
|
|
2798
|
+
), S = k(
|
|
2502
2799
|
async (T) => {
|
|
2503
|
-
await
|
|
2800
|
+
await i(T);
|
|
2504
2801
|
},
|
|
2505
|
-
[
|
|
2506
|
-
),
|
|
2507
|
-
var
|
|
2508
|
-
if (!/^\d*$/.test(
|
|
2509
|
-
const
|
|
2510
|
-
|
|
2511
|
-
const
|
|
2512
|
-
return
|
|
2513
|
-
}),
|
|
2514
|
-
}, []), D =
|
|
2515
|
-
var
|
|
2516
|
-
|
|
2517
|
-
}, [
|
|
2518
|
-
return /* @__PURE__ */ e(
|
|
2519
|
-
/* @__PURE__ */
|
|
2520
|
-
/* @__PURE__ */ e("div", { className: "ss-auth-brand-icon", children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children:
|
|
2802
|
+
[i]
|
|
2803
|
+
), E = k((T, z) => {
|
|
2804
|
+
var W;
|
|
2805
|
+
if (!/^\d*$/.test(z)) return;
|
|
2806
|
+
const L = z.slice(-1);
|
|
2807
|
+
B((K) => {
|
|
2808
|
+
const J = [...K];
|
|
2809
|
+
return J[T] = L, J;
|
|
2810
|
+
}), L && T < 5 && ((W = $.current[T + 1]) == null || W.focus());
|
|
2811
|
+
}, []), D = k((T, z) => {
|
|
2812
|
+
var L;
|
|
2813
|
+
z.key === "Backspace" && !F[T] && T > 0 && ((L = $.current[T - 1]) == null || L.focus());
|
|
2814
|
+
}, [F]), V = (n == null ? void 0 : n.googleEnabled) || (n == null ? void 0 : n.githubEnabled);
|
|
2815
|
+
return /* @__PURE__ */ e(H, { appearance: p, children: /* @__PURE__ */ e("div", { className: "ss-auth-card", children: /* @__PURE__ */ t("div", { className: "ss-auth-card-body", children: [
|
|
2816
|
+
/* @__PURE__ */ t("div", { className: "ss-auth-header", children: [
|
|
2817
|
+
/* @__PURE__ */ e("div", { className: "ss-auth-brand-icon", children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: v.token }) }),
|
|
2521
2818
|
/* @__PURE__ */ e("h1", { className: "ss-auth-title", children: "Sign in to your account" }),
|
|
2522
2819
|
/* @__PURE__ */ e("p", { className: "ss-auth-subtitle", children: "Welcome back to your workspace" })
|
|
2523
2820
|
] }),
|
|
2524
|
-
!N &&
|
|
2525
|
-
/* @__PURE__ */
|
|
2526
|
-
(n == null ? void 0 : n.googleEnabled) && /* @__PURE__ */
|
|
2821
|
+
!N && V && /* @__PURE__ */ t(j, { children: [
|
|
2822
|
+
/* @__PURE__ */ t("div", { className: "ss-auth-oauth-grid", children: [
|
|
2823
|
+
(n == null ? void 0 : n.googleEnabled) && /* @__PURE__ */ t(
|
|
2527
2824
|
"button",
|
|
2528
2825
|
{
|
|
2529
2826
|
type: "button",
|
|
2530
2827
|
className: "ss-auth-btn-social",
|
|
2531
|
-
onClick: () =>
|
|
2828
|
+
onClick: () => S("google"),
|
|
2532
2829
|
disabled: d,
|
|
2533
2830
|
children: [
|
|
2534
2831
|
/* @__PURE__ */ e("span", { dangerouslySetInnerHTML: { __html: ia } }),
|
|
@@ -2536,12 +2833,12 @@ function ee({ appearance: a, signUpUrl: s, onSignUp: t }) {
|
|
|
2536
2833
|
]
|
|
2537
2834
|
}
|
|
2538
2835
|
),
|
|
2539
|
-
(n == null ? void 0 : n.githubEnabled) && /* @__PURE__ */
|
|
2836
|
+
(n == null ? void 0 : n.githubEnabled) && /* @__PURE__ */ t(
|
|
2540
2837
|
"button",
|
|
2541
2838
|
{
|
|
2542
2839
|
type: "button",
|
|
2543
2840
|
className: "ss-auth-btn-social",
|
|
2544
|
-
onClick: () =>
|
|
2841
|
+
onClick: () => S("github"),
|
|
2545
2842
|
disabled: d,
|
|
2546
2843
|
children: [
|
|
2547
2844
|
/* @__PURE__ */ e("span", { dangerouslySetInnerHTML: { __html: la } }),
|
|
@@ -2552,36 +2849,36 @@ function ee({ appearance: a, signUpUrl: s, onSignUp: t }) {
|
|
|
2552
2849
|
] }),
|
|
2553
2850
|
/* @__PURE__ */ e("div", { className: "ss-auth-divider", children: "or continue with" })
|
|
2554
2851
|
] }),
|
|
2555
|
-
|
|
2556
|
-
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children:
|
|
2557
|
-
/* @__PURE__ */ e("span", { children:
|
|
2852
|
+
c && /* @__PURE__ */ t("div", { className: "ss-auth-error", children: [
|
|
2853
|
+
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: v.errorOutline }),
|
|
2854
|
+
/* @__PURE__ */ e("span", { children: c })
|
|
2558
2855
|
] }),
|
|
2559
|
-
/* @__PURE__ */
|
|
2560
|
-
N ? /* @__PURE__ */
|
|
2856
|
+
/* @__PURE__ */ t("form", { onSubmit: x, children: [
|
|
2857
|
+
N ? /* @__PURE__ */ t(j, { children: [
|
|
2561
2858
|
/* @__PURE__ */ e("div", { className: "ss-auth-mfa-divider", children: /* @__PURE__ */ e("span", { children: "Verification Required" }) }),
|
|
2562
|
-
/* @__PURE__ */
|
|
2859
|
+
/* @__PURE__ */ t("div", { className: "ss-auth-field", children: [
|
|
2563
2860
|
/* @__PURE__ */ e("label", { className: "ss-auth-label", children: "6-Digit Code" }),
|
|
2564
|
-
/* @__PURE__ */ e("div", { className: "ss-auth-mfa-group", children:
|
|
2861
|
+
/* @__PURE__ */ e("div", { className: "ss-auth-mfa-group", children: F.map((T, z) => /* @__PURE__ */ e(
|
|
2565
2862
|
"input",
|
|
2566
2863
|
{
|
|
2567
|
-
ref: (
|
|
2568
|
-
|
|
2864
|
+
ref: (L) => {
|
|
2865
|
+
$.current[z] = L;
|
|
2569
2866
|
},
|
|
2570
2867
|
className: "ss-auth-mfa-digit",
|
|
2571
2868
|
type: "text",
|
|
2572
2869
|
inputMode: "numeric",
|
|
2573
2870
|
maxLength: 1,
|
|
2574
2871
|
value: T,
|
|
2575
|
-
onChange: (
|
|
2576
|
-
onKeyDown: (
|
|
2577
|
-
autoFocus:
|
|
2872
|
+
onChange: (L) => E(z, L.target.value),
|
|
2873
|
+
onKeyDown: (L) => D(z, L),
|
|
2874
|
+
autoFocus: z === 0
|
|
2578
2875
|
},
|
|
2579
|
-
|
|
2876
|
+
z
|
|
2580
2877
|
)) }),
|
|
2581
2878
|
/* @__PURE__ */ e("p", { className: "ss-auth-mfa-hint", children: "We sent a 6-digit code to your registered email." })
|
|
2582
2879
|
] })
|
|
2583
|
-
] }) : /* @__PURE__ */
|
|
2584
|
-
/* @__PURE__ */
|
|
2880
|
+
] }) : /* @__PURE__ */ t(j, { children: [
|
|
2881
|
+
/* @__PURE__ */ t("div", { className: "ss-auth-field", children: [
|
|
2585
2882
|
/* @__PURE__ */ e("label", { className: "ss-auth-label", htmlFor: "ss-email", children: "Email Address" }),
|
|
2586
2883
|
/* @__PURE__ */ e(
|
|
2587
2884
|
"input",
|
|
@@ -2597,18 +2894,18 @@ function ee({ appearance: a, signUpUrl: s, onSignUp: t }) {
|
|
|
2597
2894
|
}
|
|
2598
2895
|
)
|
|
2599
2896
|
] }),
|
|
2600
|
-
/* @__PURE__ */
|
|
2601
|
-
/* @__PURE__ */
|
|
2897
|
+
/* @__PURE__ */ t("div", { className: "ss-auth-field", children: [
|
|
2898
|
+
/* @__PURE__ */ t("div", { className: "ss-auth-field-row", children: [
|
|
2602
2899
|
/* @__PURE__ */ e("label", { className: "ss-auth-label", htmlFor: "ss-password", style: { marginBottom: 0 }, children: "Password" }),
|
|
2603
2900
|
/* @__PURE__ */ e("span", { className: "ss-auth-link", style: { fontSize: "12px" }, children: "Forgot?" })
|
|
2604
2901
|
] }),
|
|
2605
|
-
/* @__PURE__ */
|
|
2902
|
+
/* @__PURE__ */ t("div", { style: { position: "relative" }, children: [
|
|
2606
2903
|
/* @__PURE__ */ e(
|
|
2607
2904
|
"input",
|
|
2608
2905
|
{
|
|
2609
2906
|
id: "ss-password",
|
|
2610
2907
|
className: "ss-auth-input",
|
|
2611
|
-
type:
|
|
2908
|
+
type: O ? "text" : "password",
|
|
2612
2909
|
autoComplete: "current-password",
|
|
2613
2910
|
placeholder: "••••••••",
|
|
2614
2911
|
value: w,
|
|
@@ -2621,17 +2918,17 @@ function ee({ appearance: a, signUpUrl: s, onSignUp: t }) {
|
|
|
2621
2918
|
{
|
|
2622
2919
|
type: "button",
|
|
2623
2920
|
className: "ss-auth-visibility-toggle",
|
|
2624
|
-
onClick: () => h(!
|
|
2625
|
-
children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children:
|
|
2921
|
+
onClick: () => h(!O),
|
|
2922
|
+
children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: O ? v.visibilityOff : v.visibility })
|
|
2626
2923
|
}
|
|
2627
2924
|
)
|
|
2628
2925
|
] })
|
|
2629
2926
|
] })
|
|
2630
2927
|
] }),
|
|
2631
|
-
/* @__PURE__ */
|
|
2928
|
+
/* @__PURE__ */ t("button", { type: "submit", className: "ss-auth-btn-primary", disabled: d, children: [
|
|
2632
2929
|
d && /* @__PURE__ */ e("span", { className: "ss-auth-spinner" }),
|
|
2633
2930
|
N ? "Verify" : "Sign in",
|
|
2634
|
-
!d && /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children:
|
|
2931
|
+
!d && /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: v.arrowForward })
|
|
2635
2932
|
] })
|
|
2636
2933
|
] }),
|
|
2637
2934
|
N ? /* @__PURE__ */ e("div", { className: "ss-auth-footer", children: /* @__PURE__ */ e(
|
|
@@ -2639,67 +2936,67 @@ function ee({ appearance: a, signUpUrl: s, onSignUp: t }) {
|
|
|
2639
2936
|
{
|
|
2640
2937
|
className: "ss-auth-link",
|
|
2641
2938
|
onClick: () => {
|
|
2642
|
-
|
|
2939
|
+
C(!1), B(["", "", "", "", "", ""]), f(null);
|
|
2643
2940
|
},
|
|
2644
2941
|
children: "Back to sign in"
|
|
2645
2942
|
}
|
|
2646
|
-
) }) : /* @__PURE__ */
|
|
2943
|
+
) }) : /* @__PURE__ */ t("div", { className: "ss-auth-footer", children: [
|
|
2647
2944
|
"Don't have an account?",
|
|
2648
2945
|
" ",
|
|
2649
|
-
|
|
2946
|
+
r ? /* @__PURE__ */ e("span", { className: "ss-auth-link", onClick: r, children: "Sign up" }) : s ? /* @__PURE__ */ e("a", { className: "ss-auth-link", href: s, children: "Sign up" }) : /* @__PURE__ */ e("span", { className: "ss-auth-link", children: "Sign up" })
|
|
2650
2947
|
] })
|
|
2651
2948
|
] }) }) });
|
|
2652
2949
|
}
|
|
2653
|
-
function
|
|
2654
|
-
const { appearance: o, settings: n } =
|
|
2950
|
+
function ne({ appearance: a, signInUrl: s, onSignIn: r }) {
|
|
2951
|
+
const { appearance: o, settings: n } = A(), { signUp: u, isLoading: i, error: l, setError: d } = ka(), { signInWithOAuth: c } = na(), f = a ?? o, [p, m] = g(""), [b, w] = g(""), [y, O] = g(""), [h, N] = g(!1), [C, P] = g(null), I = k(
|
|
2655
2952
|
async (x) => {
|
|
2656
|
-
if (x.preventDefault(),
|
|
2657
|
-
|
|
2953
|
+
if (x.preventDefault(), P(null), b !== y) {
|
|
2954
|
+
P("Passwords do not match");
|
|
2658
2955
|
return;
|
|
2659
2956
|
}
|
|
2660
|
-
const
|
|
2661
|
-
if (b.length <
|
|
2662
|
-
|
|
2957
|
+
const S = (n == null ? void 0 : n.passwordMinLength) ?? 8;
|
|
2958
|
+
if (b.length < S) {
|
|
2959
|
+
P(`Password must be at least ${S} characters`);
|
|
2663
2960
|
return;
|
|
2664
2961
|
}
|
|
2665
2962
|
await u(p, b);
|
|
2666
2963
|
},
|
|
2667
2964
|
[p, b, y, n, u]
|
|
2668
|
-
),
|
|
2965
|
+
), F = k(
|
|
2669
2966
|
async (x) => {
|
|
2670
|
-
await
|
|
2967
|
+
await c(x);
|
|
2671
2968
|
},
|
|
2672
|
-
[
|
|
2673
|
-
),
|
|
2674
|
-
return /* @__PURE__ */ e(
|
|
2675
|
-
/* @__PURE__ */
|
|
2676
|
-
/* @__PURE__ */ e("div", { className: "ss-auth-brand-icon-gradient", children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children:
|
|
2969
|
+
[c]
|
|
2970
|
+
), B = (n == null ? void 0 : n.googleEnabled) || (n == null ? void 0 : n.githubEnabled), $ = C || l;
|
|
2971
|
+
return /* @__PURE__ */ e(H, { appearance: f, children: /* @__PURE__ */ t("div", { style: { display: "flex", flexDirection: "column", alignItems: "center", width: "100%", maxWidth: "520px" }, children: [
|
|
2972
|
+
/* @__PURE__ */ t("div", { className: "ss-auth-header", children: [
|
|
2973
|
+
/* @__PURE__ */ e("div", { className: "ss-auth-brand-icon-gradient", children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: v.autoAwesome }) }),
|
|
2677
2974
|
/* @__PURE__ */ e("h1", { className: "ss-auth-title ss-auth-title-lg", children: "Create your account" }),
|
|
2678
2975
|
/* @__PURE__ */ e("p", { className: "ss-auth-subtitle", children: "Join the ecosystem" })
|
|
2679
2976
|
] }),
|
|
2680
|
-
/* @__PURE__ */ e("div", { className: "ss-auth-card", children: /* @__PURE__ */
|
|
2681
|
-
|
|
2682
|
-
/* @__PURE__ */
|
|
2683
|
-
(n == null ? void 0 : n.googleEnabled) && /* @__PURE__ */
|
|
2977
|
+
/* @__PURE__ */ e("div", { className: "ss-auth-card", children: /* @__PURE__ */ t("div", { className: "ss-auth-card-body", children: [
|
|
2978
|
+
B && /* @__PURE__ */ t(j, { children: [
|
|
2979
|
+
/* @__PURE__ */ t("div", { className: "ss-auth-oauth-grid", children: [
|
|
2980
|
+
(n == null ? void 0 : n.googleEnabled) && /* @__PURE__ */ t(
|
|
2684
2981
|
"button",
|
|
2685
2982
|
{
|
|
2686
2983
|
type: "button",
|
|
2687
2984
|
className: "ss-auth-btn-social",
|
|
2688
|
-
onClick: () =>
|
|
2689
|
-
disabled:
|
|
2985
|
+
onClick: () => F("google"),
|
|
2986
|
+
disabled: i,
|
|
2690
2987
|
children: [
|
|
2691
2988
|
/* @__PURE__ */ e("span", { dangerouslySetInnerHTML: { __html: ia } }),
|
|
2692
2989
|
"Google"
|
|
2693
2990
|
]
|
|
2694
2991
|
}
|
|
2695
2992
|
),
|
|
2696
|
-
(n == null ? void 0 : n.githubEnabled) && /* @__PURE__ */
|
|
2993
|
+
(n == null ? void 0 : n.githubEnabled) && /* @__PURE__ */ t(
|
|
2697
2994
|
"button",
|
|
2698
2995
|
{
|
|
2699
2996
|
type: "button",
|
|
2700
2997
|
className: "ss-auth-btn-social",
|
|
2701
|
-
onClick: () =>
|
|
2702
|
-
disabled:
|
|
2998
|
+
onClick: () => F("github"),
|
|
2999
|
+
disabled: i,
|
|
2703
3000
|
children: [
|
|
2704
3001
|
/* @__PURE__ */ e("span", { dangerouslySetInnerHTML: { __html: la } }),
|
|
2705
3002
|
"GitHub"
|
|
@@ -2709,12 +3006,12 @@ function te({ appearance: a, signInUrl: s, onSignIn: t }) {
|
|
|
2709
3006
|
] }),
|
|
2710
3007
|
/* @__PURE__ */ e("div", { className: "ss-auth-divider", children: "or sign up with email" })
|
|
2711
3008
|
] }),
|
|
2712
|
-
|
|
2713
|
-
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children:
|
|
2714
|
-
/* @__PURE__ */ e("span", { children:
|
|
3009
|
+
$ && /* @__PURE__ */ t("div", { className: "ss-auth-error", children: [
|
|
3010
|
+
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: v.errorOutline }),
|
|
3011
|
+
/* @__PURE__ */ e("span", { children: $ })
|
|
2715
3012
|
] }),
|
|
2716
|
-
/* @__PURE__ */
|
|
2717
|
-
/* @__PURE__ */
|
|
3013
|
+
/* @__PURE__ */ t("form", { onSubmit: I, children: [
|
|
3014
|
+
/* @__PURE__ */ t("div", { className: "ss-auth-field", children: [
|
|
2718
3015
|
/* @__PURE__ */ e("label", { className: "ss-auth-label", htmlFor: "ss-signup-email", children: "Email" }),
|
|
2719
3016
|
/* @__PURE__ */ e(
|
|
2720
3017
|
"input",
|
|
@@ -2730,9 +3027,9 @@ function te({ appearance: a, signInUrl: s, onSignIn: t }) {
|
|
|
2730
3027
|
}
|
|
2731
3028
|
)
|
|
2732
3029
|
] }),
|
|
2733
|
-
/* @__PURE__ */
|
|
3030
|
+
/* @__PURE__ */ t("div", { className: "ss-auth-field", children: [
|
|
2734
3031
|
/* @__PURE__ */ e("label", { className: "ss-auth-label", htmlFor: "ss-signup-password", children: "Password" }),
|
|
2735
|
-
/* @__PURE__ */
|
|
3032
|
+
/* @__PURE__ */ t("div", { style: { position: "relative" }, children: [
|
|
2736
3033
|
/* @__PURE__ */ e(
|
|
2737
3034
|
"input",
|
|
2738
3035
|
{
|
|
@@ -2743,7 +3040,7 @@ function te({ appearance: a, signInUrl: s, onSignIn: t }) {
|
|
|
2743
3040
|
placeholder: "••••••••",
|
|
2744
3041
|
value: b,
|
|
2745
3042
|
onChange: (x) => {
|
|
2746
|
-
w(x.target.value),
|
|
3043
|
+
w(x.target.value), P(null);
|
|
2747
3044
|
},
|
|
2748
3045
|
required: !0
|
|
2749
3046
|
}
|
|
@@ -2754,12 +3051,12 @@ function te({ appearance: a, signInUrl: s, onSignIn: t }) {
|
|
|
2754
3051
|
type: "button",
|
|
2755
3052
|
className: "ss-auth-visibility-toggle",
|
|
2756
3053
|
onClick: () => N(!h),
|
|
2757
|
-
children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: h ?
|
|
3054
|
+
children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: h ? v.visibilityOff : v.visibility })
|
|
2758
3055
|
}
|
|
2759
3056
|
)
|
|
2760
3057
|
] })
|
|
2761
3058
|
] }),
|
|
2762
|
-
/* @__PURE__ */
|
|
3059
|
+
/* @__PURE__ */ t("div", { className: "ss-auth-field", children: [
|
|
2763
3060
|
/* @__PURE__ */ e("label", { className: "ss-auth-label", htmlFor: "ss-signup-confirm", children: "Confirm Password" }),
|
|
2764
3061
|
/* @__PURE__ */ e(
|
|
2765
3062
|
"input",
|
|
@@ -2771,85 +3068,85 @@ function te({ appearance: a, signInUrl: s, onSignIn: t }) {
|
|
|
2771
3068
|
placeholder: "••••••••",
|
|
2772
3069
|
value: y,
|
|
2773
3070
|
onChange: (x) => {
|
|
2774
|
-
|
|
3071
|
+
O(x.target.value), P(null);
|
|
2775
3072
|
},
|
|
2776
3073
|
required: !0
|
|
2777
3074
|
}
|
|
2778
3075
|
)
|
|
2779
3076
|
] }),
|
|
2780
|
-
/* @__PURE__ */
|
|
2781
|
-
|
|
3077
|
+
/* @__PURE__ */ t("button", { type: "submit", className: "ss-auth-btn-primary", disabled: i, children: [
|
|
3078
|
+
i && /* @__PURE__ */ e("span", { className: "ss-auth-spinner" }),
|
|
2782
3079
|
"Sign up",
|
|
2783
|
-
!
|
|
3080
|
+
!i && /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: v.arrowForward })
|
|
2784
3081
|
] })
|
|
2785
3082
|
] }),
|
|
2786
|
-
/* @__PURE__ */
|
|
3083
|
+
/* @__PURE__ */ t("div", { className: "ss-auth-footer", children: [
|
|
2787
3084
|
"Already have an account?",
|
|
2788
3085
|
" ",
|
|
2789
|
-
|
|
3086
|
+
r ? /* @__PURE__ */ e("span", { className: "ss-auth-link", onClick: r, children: "Sign in" }) : s ? /* @__PURE__ */ e("a", { className: "ss-auth-link", href: s, children: "Sign in" }) : /* @__PURE__ */ e("span", { className: "ss-auth-link", children: "Sign in" })
|
|
2790
3087
|
] })
|
|
2791
3088
|
] }) })
|
|
2792
3089
|
] }) });
|
|
2793
3090
|
}
|
|
2794
|
-
const
|
|
2795
|
-
function
|
|
2796
|
-
const o =
|
|
2797
|
-
|
|
3091
|
+
const M = 320, q = 128;
|
|
3092
|
+
function za({ file: a, onCrop: s, onCancel: r }) {
|
|
3093
|
+
const o = _(null), n = _(null), [u, i] = g(1), [l, d] = g({ x: 0, y: 0 }), [c, f] = g(!1), p = _({ x: 0, y: 0, ox: 0, oy: 0 }), [m, b] = g(!1);
|
|
3094
|
+
U(() => {
|
|
2798
3095
|
const h = new Image(), N = URL.createObjectURL(a);
|
|
2799
3096
|
return h.onload = () => {
|
|
2800
|
-
n.current = h, b(!0), d({ x: 0, y: 0 }),
|
|
3097
|
+
n.current = h, b(!0), d({ x: 0, y: 0 }), i(1);
|
|
2801
3098
|
}, h.src = N, () => URL.revokeObjectURL(N);
|
|
2802
|
-
}, [a]),
|
|
3099
|
+
}, [a]), U(() => {
|
|
2803
3100
|
if (!m || !n.current || !o.current) return;
|
|
2804
3101
|
const h = o.current.getContext("2d");
|
|
2805
3102
|
if (!h) return;
|
|
2806
3103
|
const N = n.current;
|
|
2807
|
-
h.clearRect(0, 0,
|
|
2808
|
-
const
|
|
2809
|
-
h.save(), h.beginPath(), h.arc(
|
|
2810
|
-
}, [u,
|
|
2811
|
-
const w =
|
|
3104
|
+
h.clearRect(0, 0, M, M), h.fillStyle = "#111", h.fillRect(0, 0, M, M);
|
|
3105
|
+
const C = Math.max(M / N.width, M / N.height) * u, P = N.width * C, I = N.height * C, F = (M - P) / 2 + l.x, B = (M - I) / 2 + l.y;
|
|
3106
|
+
h.save(), h.beginPath(), h.arc(M / 2, M / 2, q, 0, Math.PI * 2), h.clip(), h.drawImage(N, F, B, P, I), h.restore(), h.save(), h.fillStyle = "rgba(0, 0, 0, 0.6)", h.fillRect(0, 0, M, M), h.globalCompositeOperation = "destination-out", h.beginPath(), h.arc(M / 2, M / 2, q, 0, Math.PI * 2), h.fill(), h.restore(), h.save(), h.beginPath(), h.arc(M / 2, M / 2, q, 0, Math.PI * 2), h.clip(), h.drawImage(N, F, B, P, I), h.restore(), h.strokeStyle = "rgba(255, 255, 255, 0.4)", h.lineWidth = 2, h.beginPath(), h.arc(M / 2, M / 2, q, 0, Math.PI * 2), h.stroke();
|
|
3107
|
+
}, [u, l, m]);
|
|
3108
|
+
const w = k(
|
|
2812
3109
|
(h) => {
|
|
2813
|
-
f(!0), p.current = { x: h.clientX, y: h.clientY, ox:
|
|
3110
|
+
f(!0), p.current = { x: h.clientX, y: h.clientY, ox: l.x, oy: l.y }, h.target.setPointerCapture(h.pointerId);
|
|
2814
3111
|
},
|
|
2815
|
-
[
|
|
2816
|
-
), y =
|
|
3112
|
+
[l]
|
|
3113
|
+
), y = k(
|
|
2817
3114
|
(h) => {
|
|
2818
|
-
|
|
3115
|
+
c && d({
|
|
2819
3116
|
x: p.current.ox + (h.clientX - p.current.x),
|
|
2820
3117
|
y: p.current.oy + (h.clientY - p.current.y)
|
|
2821
3118
|
});
|
|
2822
3119
|
},
|
|
2823
|
-
[
|
|
2824
|
-
),
|
|
2825
|
-
return
|
|
3120
|
+
[c]
|
|
3121
|
+
), O = k(() => f(!1), []);
|
|
3122
|
+
return k(() => {
|
|
2826
3123
|
if (!n.current) return;
|
|
2827
|
-
const h = document.createElement("canvas"), N =
|
|
3124
|
+
const h = document.createElement("canvas"), N = q * 2;
|
|
2828
3125
|
h.width = N, h.height = N;
|
|
2829
|
-
const
|
|
2830
|
-
if (!
|
|
2831
|
-
const
|
|
2832
|
-
|
|
2833
|
-
|
|
3126
|
+
const C = h.getContext("2d");
|
|
3127
|
+
if (!C) return;
|
|
3128
|
+
const P = n.current, I = Math.max(M / P.width, M / P.height) * u, F = P.width * I, B = P.height * I, $ = (M - F) / 2 + l.x - (M / 2 - q), x = (M - B) / 2 + l.y - (M / 2 - q);
|
|
3129
|
+
C.beginPath(), C.arc(q, q, q, 0, Math.PI * 2), C.clip(), C.drawImage(P, $, x, F, B), h.toBlob((S) => {
|
|
3130
|
+
S && s(S);
|
|
2834
3131
|
}, "image/png");
|
|
2835
|
-
}, [u,
|
|
2836
|
-
/* @__PURE__ */
|
|
3132
|
+
}, [u, l, s]), /* @__PURE__ */ t("div", { style: { display: "flex", flexDirection: "column", alignItems: "center", gap: "24px" }, children: [
|
|
3133
|
+
/* @__PURE__ */ t("div", { className: "ss-auth-crop-area", children: [
|
|
2837
3134
|
/* @__PURE__ */ e(
|
|
2838
3135
|
"canvas",
|
|
2839
3136
|
{
|
|
2840
3137
|
ref: o,
|
|
2841
|
-
width:
|
|
2842
|
-
height:
|
|
2843
|
-
style: { cursor:
|
|
3138
|
+
width: M,
|
|
3139
|
+
height: M,
|
|
3140
|
+
style: { cursor: c ? "grabbing" : "grab", width: "100%", height: "100%" },
|
|
2844
3141
|
onPointerDown: w,
|
|
2845
3142
|
onPointerMove: y,
|
|
2846
|
-
onPointerUp:
|
|
3143
|
+
onPointerUp: O
|
|
2847
3144
|
}
|
|
2848
3145
|
),
|
|
2849
3146
|
/* @__PURE__ */ e("div", { className: "ss-auth-crop-size-badge", children: "256 x 256 px" })
|
|
2850
3147
|
] }),
|
|
2851
|
-
/* @__PURE__ */
|
|
2852
|
-
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children:
|
|
3148
|
+
/* @__PURE__ */ t("div", { className: "ss-auth-zoom-control", style: { width: "100%", maxWidth: "280px" }, children: [
|
|
3149
|
+
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: v.zoomOut }),
|
|
2853
3150
|
/* @__PURE__ */ e(
|
|
2854
3151
|
"input",
|
|
2855
3152
|
{
|
|
@@ -2858,16 +3155,16 @@ function Pa({ file: a, onCrop: s, onCancel: t }) {
|
|
|
2858
3155
|
max: "3",
|
|
2859
3156
|
step: "0.01",
|
|
2860
3157
|
value: u,
|
|
2861
|
-
onChange: (h) =>
|
|
3158
|
+
onChange: (h) => i(parseFloat(h.target.value)),
|
|
2862
3159
|
className: "ss-auth-zoom-slider"
|
|
2863
3160
|
}
|
|
2864
3161
|
),
|
|
2865
|
-
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children:
|
|
3162
|
+
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: v.zoomIn })
|
|
2866
3163
|
] })
|
|
2867
3164
|
] });
|
|
2868
3165
|
}
|
|
2869
|
-
function ca({ onUpload: a, onClose: s, isLoading:
|
|
2870
|
-
const [o, n] = g(null), [u,
|
|
3166
|
+
function ca({ onUpload: a, onClose: s, isLoading: r }) {
|
|
3167
|
+
const [o, n] = g(null), [u, i] = g(!1), [l, d] = g(null), c = _(null), f = k((b) => {
|
|
2871
3168
|
if (!b.type.startsWith("image/")) {
|
|
2872
3169
|
d("Please select an image file");
|
|
2873
3170
|
return;
|
|
@@ -2877,14 +3174,14 @@ function ca({ onUpload: a, onClose: s, isLoading: t }) {
|
|
|
2877
3174
|
return;
|
|
2878
3175
|
}
|
|
2879
3176
|
d(null), n(b);
|
|
2880
|
-
}, []), p =
|
|
3177
|
+
}, []), p = k(
|
|
2881
3178
|
(b) => {
|
|
2882
|
-
b.preventDefault(),
|
|
3179
|
+
b.preventDefault(), i(!1);
|
|
2883
3180
|
const w = b.dataTransfer.files[0];
|
|
2884
3181
|
w && f(w);
|
|
2885
3182
|
},
|
|
2886
3183
|
[f]
|
|
2887
|
-
), m =
|
|
3184
|
+
), m = k(
|
|
2888
3185
|
async (b) => {
|
|
2889
3186
|
await a(b);
|
|
2890
3187
|
},
|
|
@@ -2892,18 +3189,18 @@ function ca({ onUpload: a, onClose: s, isLoading: t }) {
|
|
|
2892
3189
|
);
|
|
2893
3190
|
return /* @__PURE__ */ e("div", { className: "ss-auth-modal-overlay", onClick: (b) => {
|
|
2894
3191
|
b.target === b.currentTarget && s();
|
|
2895
|
-
}, children: /* @__PURE__ */
|
|
2896
|
-
/* @__PURE__ */
|
|
3192
|
+
}, children: /* @__PURE__ */ t("div", { className: "ss-auth-modal ss-auth-card-wide", children: [
|
|
3193
|
+
/* @__PURE__ */ t("div", { className: "ss-auth-modal-header", children: [
|
|
2897
3194
|
/* @__PURE__ */ e("h2", { children: "Upload avatar" }),
|
|
2898
|
-
/* @__PURE__ */ e("button", { type: "button", className: "ss-auth-modal-close", onClick: s, children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children:
|
|
3195
|
+
/* @__PURE__ */ e("button", { type: "button", className: "ss-auth-modal-close", onClick: s, children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: v.close }) })
|
|
2899
3196
|
] }),
|
|
2900
|
-
/* @__PURE__ */
|
|
2901
|
-
|
|
2902
|
-
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children:
|
|
2903
|
-
/* @__PURE__ */ e("span", { children:
|
|
3197
|
+
/* @__PURE__ */ t("div", { className: "ss-auth-modal-body", children: [
|
|
3198
|
+
l && /* @__PURE__ */ t("div", { className: "ss-auth-error", style: { marginBottom: "24px" }, children: [
|
|
3199
|
+
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: v.errorOutline }),
|
|
3200
|
+
/* @__PURE__ */ e("span", { children: l })
|
|
2904
3201
|
] }),
|
|
2905
|
-
/* @__PURE__ */
|
|
2906
|
-
/* @__PURE__ */ e("div", { children: o ? /* @__PURE__ */ e(
|
|
3202
|
+
/* @__PURE__ */ t("div", { className: "ss-auth-upload-grid", children: [
|
|
3203
|
+
/* @__PURE__ */ e("div", { children: o ? /* @__PURE__ */ e(za, { file: o, onCrop: m, onCancel: () => n(null) }) : /* @__PURE__ */ t(
|
|
2907
3204
|
"div",
|
|
2908
3205
|
{
|
|
2909
3206
|
className: "ss-auth-crop-area",
|
|
@@ -2917,30 +3214,30 @@ function ca({ onUpload: a, onClose: s, isLoading: t }) {
|
|
|
2917
3214
|
aspectRatio: "1"
|
|
2918
3215
|
},
|
|
2919
3216
|
children: [
|
|
2920
|
-
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", style: { fontSize: "48px", opacity: 0.3 }, children:
|
|
3217
|
+
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", style: { fontSize: "48px", opacity: 0.3 }, children: v.image }),
|
|
2921
3218
|
/* @__PURE__ */ e("span", { style: { fontSize: "12px", opacity: 0.4 }, children: "No image selected" })
|
|
2922
3219
|
]
|
|
2923
3220
|
}
|
|
2924
3221
|
) }),
|
|
2925
|
-
/* @__PURE__ */
|
|
2926
|
-
/* @__PURE__ */
|
|
3222
|
+
/* @__PURE__ */ t("div", { style: { display: "flex", flexDirection: "column", gap: "16px" }, children: [
|
|
3223
|
+
/* @__PURE__ */ t(
|
|
2927
3224
|
"div",
|
|
2928
3225
|
{
|
|
2929
3226
|
className: `ss-auth-dropzone${u ? " ss-auth-dropzone-active" : ""}`,
|
|
2930
3227
|
onDragOver: (b) => {
|
|
2931
|
-
b.preventDefault(),
|
|
3228
|
+
b.preventDefault(), i(!0);
|
|
2932
3229
|
},
|
|
2933
|
-
onDragLeave: () =>
|
|
3230
|
+
onDragLeave: () => i(!1),
|
|
2934
3231
|
onDrop: p,
|
|
2935
3232
|
onClick: () => {
|
|
2936
3233
|
var b;
|
|
2937
|
-
return (b =
|
|
3234
|
+
return (b = c.current) == null ? void 0 : b.click();
|
|
2938
3235
|
},
|
|
2939
3236
|
style: { minHeight: "180px" },
|
|
2940
3237
|
children: [
|
|
2941
|
-
/* @__PURE__ */ e("div", { className: "ss-auth-dropzone-icon", children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children:
|
|
3238
|
+
/* @__PURE__ */ e("div", { className: "ss-auth-dropzone-icon", children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: v.cloudUpload }) }),
|
|
2942
3239
|
/* @__PURE__ */ e("span", { className: "ss-auth-dropzone-title", children: "Drag and drop" }),
|
|
2943
|
-
/* @__PURE__ */
|
|
3240
|
+
/* @__PURE__ */ t("span", { className: "ss-auth-dropzone-desc", children: [
|
|
2944
3241
|
"JPG, PNG or WEBP",
|
|
2945
3242
|
/* @__PURE__ */ e("br", {}),
|
|
2946
3243
|
"Max file size 5 MB"
|
|
@@ -2949,7 +3246,7 @@ function ca({ onUpload: a, onClose: s, isLoading: t }) {
|
|
|
2949
3246
|
/* @__PURE__ */ e(
|
|
2950
3247
|
"input",
|
|
2951
3248
|
{
|
|
2952
|
-
ref:
|
|
3249
|
+
ref: c,
|
|
2953
3250
|
type: "file",
|
|
2954
3251
|
accept: "image/*",
|
|
2955
3252
|
style: { display: "none" },
|
|
@@ -2962,92 +3259,682 @@ function ca({ onUpload: a, onClose: s, isLoading: t }) {
|
|
|
2962
3259
|
]
|
|
2963
3260
|
}
|
|
2964
3261
|
),
|
|
2965
|
-
/* @__PURE__ */
|
|
2966
|
-
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children:
|
|
3262
|
+
/* @__PURE__ */ t("div", { className: "ss-auth-info-box", children: [
|
|
3263
|
+
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: v.info }),
|
|
2967
3264
|
/* @__PURE__ */ e("span", { children: "Your profile photo will be visible to all members of your organization." })
|
|
2968
3265
|
] })
|
|
2969
3266
|
] })
|
|
2970
3267
|
] })
|
|
2971
3268
|
] }),
|
|
2972
|
-
/* @__PURE__ */
|
|
3269
|
+
/* @__PURE__ */ t("div", { className: "ss-auth-modal-footer", children: [
|
|
2973
3270
|
/* @__PURE__ */ e("button", { type: "button", className: "ss-auth-btn-ghost", onClick: s, children: "Cancel" }),
|
|
2974
|
-
/* @__PURE__ */
|
|
3271
|
+
/* @__PURE__ */ t(
|
|
2975
3272
|
"button",
|
|
2976
3273
|
{
|
|
2977
3274
|
type: "button",
|
|
2978
3275
|
className: "ss-auth-btn-primary ss-auth-btn-sm",
|
|
2979
3276
|
onClick: () => {
|
|
2980
3277
|
},
|
|
2981
|
-
disabled: !o ||
|
|
3278
|
+
disabled: !o || r,
|
|
2982
3279
|
style: { width: "auto" },
|
|
2983
3280
|
children: [
|
|
2984
|
-
|
|
3281
|
+
r && /* @__PURE__ */ e("span", { className: "ss-auth-spinner" }),
|
|
2985
3282
|
"Save Profile",
|
|
2986
|
-
!
|
|
3283
|
+
!r && /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: v.check })
|
|
2987
3284
|
]
|
|
2988
3285
|
}
|
|
2989
3286
|
)
|
|
2990
3287
|
] })
|
|
2991
3288
|
] }) });
|
|
2992
3289
|
}
|
|
2993
|
-
function
|
|
2994
|
-
|
|
2995
|
-
|
|
2996
|
-
|
|
3290
|
+
function Pa({ onClose: a, afterDeleteAccountUrl: s, defaultTab: r = "profile" }) {
|
|
3291
|
+
const [o, n] = g(r), u = [
|
|
3292
|
+
{ key: "profile", label: "Profile", icon: v.person },
|
|
3293
|
+
{ key: "organization", label: "Organization", icon: v.corporateFare },
|
|
3294
|
+
{ key: "people", label: "People", icon: v.group },
|
|
3295
|
+
{ key: "billing", label: "Billing", icon: v.creditCard }
|
|
3296
|
+
];
|
|
3297
|
+
return /* @__PURE__ */ t("div", { className: "ss-auth-settings-page", children: [
|
|
3298
|
+
/* @__PURE__ */ t("div", { className: "ss-auth-settings-header", children: [
|
|
3299
|
+
/* @__PURE__ */ e("h2", { children: "Settings" }),
|
|
3300
|
+
/* @__PURE__ */ e("button", { type: "button", className: "ss-auth-modal-close", onClick: a, children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: v.close }) })
|
|
3301
|
+
] }),
|
|
3302
|
+
/* @__PURE__ */ t("div", { className: "ss-auth-settings-layout", children: [
|
|
3303
|
+
/* @__PURE__ */ e("nav", { className: "ss-auth-settings-nav", children: u.map((i) => /* @__PURE__ */ t(
|
|
3304
|
+
"button",
|
|
3305
|
+
{
|
|
3306
|
+
type: "button",
|
|
3307
|
+
className: `ss-auth-settings-nav-item${o === i.key ? " ss-auth-settings-nav-item-active" : ""}`,
|
|
3308
|
+
onClick: () => n(i.key),
|
|
3309
|
+
children: [
|
|
3310
|
+
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: i.icon }),
|
|
3311
|
+
i.label
|
|
3312
|
+
]
|
|
3313
|
+
},
|
|
3314
|
+
i.key
|
|
3315
|
+
)) }),
|
|
3316
|
+
/* @__PURE__ */ t("div", { className: "ss-auth-settings-content", children: [
|
|
3317
|
+
o === "profile" && /* @__PURE__ */ e(Oa, { afterDeleteAccountUrl: s }),
|
|
3318
|
+
o === "organization" && /* @__PURE__ */ e(Ea, {}),
|
|
3319
|
+
o === "people" && /* @__PURE__ */ e(Ia, {}),
|
|
3320
|
+
o === "billing" && /* @__PURE__ */ e(Fa, {})
|
|
3321
|
+
] })
|
|
3322
|
+
] })
|
|
3323
|
+
] });
|
|
3324
|
+
}
|
|
3325
|
+
function Oa({ afterDeleteAccountUrl: a }) {
|
|
3326
|
+
const { user: s, updateProfile: r, uploadAvatar: o, changePassword: n, isLoading: u, error: i, success: l, setError: d, setSuccess: c } = oa(), { signOut: f } = sa(), { deleteAccount: p, isLoading: m, error: b, setError: w } = Ca(), [y, O] = g((s == null ? void 0 : s.name) ?? ""), [h, N] = g((s == null ? void 0 : s.avatarUrl) ?? ""), [C, P] = g(!1), [I, F] = g(""), [B, $] = g(""), [x, S] = g(""), [E, D] = g(null), [V, T] = g(!1), [z, L] = g(""), W = k(
|
|
3327
|
+
async (R) => {
|
|
3328
|
+
R.preventDefault(), d(null), c(null), await r({ name: y, avatarUrl: h || void 0 });
|
|
3329
|
+
},
|
|
3330
|
+
[y, h, r, d, c]
|
|
3331
|
+
), K = k(
|
|
3332
|
+
async (R) => {
|
|
3333
|
+
const X = await o(R);
|
|
3334
|
+
X && (N(X.avatarUrl), P(!1));
|
|
3335
|
+
},
|
|
3336
|
+
[o]
|
|
3337
|
+
), J = k(
|
|
3338
|
+
async (R) => {
|
|
3339
|
+
if (R.preventDefault(), D(null), d(null), c(null), B !== x) {
|
|
3340
|
+
D("Passwords do not match");
|
|
3341
|
+
return;
|
|
3342
|
+
}
|
|
3343
|
+
if (B.length < 8) {
|
|
3344
|
+
D("Password must be at least 8 characters");
|
|
3345
|
+
return;
|
|
3346
|
+
}
|
|
3347
|
+
await n(I, B) && (F(""), $(""), S(""));
|
|
3348
|
+
},
|
|
3349
|
+
[I, B, x, n, d, c]
|
|
3350
|
+
), ua = k(async () => {
|
|
3351
|
+
await p() && (await f(), a && (window.location.href = a));
|
|
3352
|
+
}, [p, f, a]), pa = (s == null ? void 0 : s.provider) === "email", ha = z === (s == null ? void 0 : s.email), ga = ((s == null ? void 0 : s.name) || (s == null ? void 0 : s.email) || "?").charAt(0).toUpperCase();
|
|
3353
|
+
return /* @__PURE__ */ t(j, { children: [
|
|
3354
|
+
/* @__PURE__ */ e("h3", { children: "Profile" }),
|
|
3355
|
+
/* @__PURE__ */ t("div", { className: "ss-auth-settings-card", children: [
|
|
3356
|
+
/* @__PURE__ */ t("div", { className: "ss-auth-profile-header", style: { border: "none", background: "none", padding: 0, marginBottom: 16 }, children: [
|
|
3357
|
+
/* @__PURE__ */ t("div", { className: "ss-auth-avatar-lg", onClick: () => P(!0), children: [
|
|
3358
|
+
h ? /* @__PURE__ */ e("img", { src: h, alt: "" }) : /* @__PURE__ */ e("div", { style: {
|
|
3359
|
+
width: "100%",
|
|
3360
|
+
height: "100%",
|
|
3361
|
+
display: "flex",
|
|
3362
|
+
alignItems: "center",
|
|
3363
|
+
justifyContent: "center",
|
|
3364
|
+
fontSize: "48px",
|
|
3365
|
+
fontWeight: 800,
|
|
3366
|
+
opacity: 0.4
|
|
3367
|
+
}, children: ga }),
|
|
3368
|
+
/* @__PURE__ */ t("div", { className: "ss-auth-avatar-overlay", children: [
|
|
3369
|
+
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: v.camera }),
|
|
3370
|
+
/* @__PURE__ */ e("span", { children: "Edit" })
|
|
3371
|
+
] })
|
|
3372
|
+
] }),
|
|
3373
|
+
/* @__PURE__ */ t("div", { className: "ss-auth-profile-info", children: [
|
|
3374
|
+
/* @__PURE__ */ t("h2", { className: "ss-auth-profile-name", children: [
|
|
3375
|
+
(s == null ? void 0 : s.name) || "Unnamed User",
|
|
3376
|
+
(s == null ? void 0 : s.emailVerified) && /* @__PURE__ */ t("span", { className: "ss-auth-badge ss-auth-badge-success", children: [
|
|
3377
|
+
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", style: { fontSize: "12px", fontVariationSettings: "'FILL' 1" }, children: v.verified }),
|
|
3378
|
+
"Verified"
|
|
3379
|
+
] })
|
|
3380
|
+
] }),
|
|
3381
|
+
/* @__PURE__ */ e("p", { className: "ss-auth-profile-desc", children: s == null ? void 0 : s.email })
|
|
3382
|
+
] })
|
|
3383
|
+
] }),
|
|
3384
|
+
i && /* @__PURE__ */ t("div", { className: "ss-auth-error", children: [
|
|
3385
|
+
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: v.errorOutline }),
|
|
3386
|
+
/* @__PURE__ */ e("span", { children: i })
|
|
3387
|
+
] }),
|
|
3388
|
+
l && /* @__PURE__ */ t("div", { className: "ss-auth-info-box", style: { marginBottom: "16px" }, children: [
|
|
3389
|
+
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: v.check }),
|
|
3390
|
+
/* @__PURE__ */ e("span", { children: l })
|
|
3391
|
+
] }),
|
|
3392
|
+
/* @__PURE__ */ t("form", { onSubmit: W, children: [
|
|
3393
|
+
/* @__PURE__ */ t("div", { className: "ss-auth-field", children: [
|
|
3394
|
+
/* @__PURE__ */ e("label", { className: "ss-auth-label", children: "Full Name" }),
|
|
3395
|
+
/* @__PURE__ */ e(
|
|
3396
|
+
"input",
|
|
3397
|
+
{
|
|
3398
|
+
className: "ss-auth-input",
|
|
3399
|
+
type: "text",
|
|
3400
|
+
placeholder: "Your name",
|
|
3401
|
+
value: y,
|
|
3402
|
+
onChange: (R) => O(R.target.value)
|
|
3403
|
+
}
|
|
3404
|
+
)
|
|
3405
|
+
] }),
|
|
3406
|
+
/* @__PURE__ */ t("div", { className: "ss-auth-profile-grid", style: { marginBottom: "16px" }, children: [
|
|
3407
|
+
/* @__PURE__ */ t("div", { children: [
|
|
3408
|
+
/* @__PURE__ */ e("label", { className: "ss-auth-label", children: "Email Address" }),
|
|
3409
|
+
/* @__PURE__ */ t("div", { style: { position: "relative" }, children: [
|
|
3410
|
+
/* @__PURE__ */ e("input", { className: "ss-auth-input ss-auth-input-readonly", type: "email", value: (s == null ? void 0 : s.email) ?? "", readOnly: !0 }),
|
|
3411
|
+
/* @__PURE__ */ e("span", { className: "ss-auth-visibility-toggle", style: { cursor: "default" }, children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", style: { fontSize: "18px" }, children: v.lock }) })
|
|
3412
|
+
] })
|
|
3413
|
+
] }),
|
|
3414
|
+
/* @__PURE__ */ t("div", { children: [
|
|
3415
|
+
/* @__PURE__ */ e("label", { className: "ss-auth-label", children: "Auth Provider" }),
|
|
3416
|
+
/* @__PURE__ */ e("input", { className: "ss-auth-input ss-auth-input-readonly", type: "text", value: (s == null ? void 0 : s.provider) ?? "", readOnly: !0 })
|
|
3417
|
+
] })
|
|
3418
|
+
] }),
|
|
3419
|
+
/* @__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: [
|
|
3420
|
+
u && /* @__PURE__ */ e("span", { className: "ss-auth-spinner" }),
|
|
3421
|
+
"Save changes"
|
|
3422
|
+
] }) })
|
|
3423
|
+
] })
|
|
3424
|
+
] }),
|
|
3425
|
+
pa && /* @__PURE__ */ t("div", { className: "ss-auth-settings-card", children: [
|
|
3426
|
+
/* @__PURE__ */ t("h4", { children: [
|
|
3427
|
+
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: v.security }),
|
|
3428
|
+
"Security Credentials"
|
|
3429
|
+
] }),
|
|
3430
|
+
E && /* @__PURE__ */ t("div", { className: "ss-auth-error", style: { marginBottom: "16px" }, children: [
|
|
3431
|
+
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: v.errorOutline }),
|
|
3432
|
+
/* @__PURE__ */ e("span", { children: E })
|
|
3433
|
+
] }),
|
|
3434
|
+
/* @__PURE__ */ t("form", { onSubmit: J, children: [
|
|
3435
|
+
/* @__PURE__ */ t("div", { className: "ss-auth-field", children: [
|
|
3436
|
+
/* @__PURE__ */ e("label", { className: "ss-auth-label", children: "Current Password" }),
|
|
3437
|
+
/* @__PURE__ */ e("input", { className: "ss-auth-input", type: "password", placeholder: "••••••••••••", value: I, onChange: (R) => F(R.target.value), required: !0 })
|
|
3438
|
+
] }),
|
|
3439
|
+
/* @__PURE__ */ t("div", { className: "ss-auth-profile-grid", style: { marginBottom: "16px" }, children: [
|
|
3440
|
+
/* @__PURE__ */ t("div", { children: [
|
|
3441
|
+
/* @__PURE__ */ e("label", { className: "ss-auth-label", children: "New Password" }),
|
|
3442
|
+
/* @__PURE__ */ e("input", { className: "ss-auth-input", type: "password", placeholder: "Min. 8 characters", value: B, onChange: (R) => $(R.target.value), required: !0 })
|
|
3443
|
+
] }),
|
|
3444
|
+
/* @__PURE__ */ t("div", { children: [
|
|
3445
|
+
/* @__PURE__ */ e("label", { className: "ss-auth-label", children: "Confirm New Password" }),
|
|
3446
|
+
/* @__PURE__ */ e("input", { className: "ss-auth-input", type: "password", placeholder: "Repeat new password", value: x, onChange: (R) => S(R.target.value), required: !0 })
|
|
3447
|
+
] })
|
|
3448
|
+
] }),
|
|
3449
|
+
/* @__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" }) })
|
|
3450
|
+
] })
|
|
3451
|
+
] }),
|
|
3452
|
+
/* @__PURE__ */ t("div", { className: "ss-auth-settings-card ss-auth-settings-danger", children: [
|
|
3453
|
+
/* @__PURE__ */ e("h4", { children: "Danger Zone" }),
|
|
3454
|
+
/* @__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." }),
|
|
3455
|
+
b && /* @__PURE__ */ t("div", { className: "ss-auth-error", children: [
|
|
3456
|
+
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: v.errorOutline }),
|
|
3457
|
+
/* @__PURE__ */ e("span", { children: b })
|
|
3458
|
+
] }),
|
|
3459
|
+
V ? /* @__PURE__ */ t("div", { children: [
|
|
3460
|
+
/* @__PURE__ */ t("div", { className: "ss-auth-field", children: [
|
|
3461
|
+
/* @__PURE__ */ e("label", { className: "ss-auth-label", children: "Type your email to confirm" }),
|
|
3462
|
+
/* @__PURE__ */ e(
|
|
3463
|
+
"input",
|
|
3464
|
+
{
|
|
3465
|
+
className: "ss-auth-input",
|
|
3466
|
+
type: "email",
|
|
3467
|
+
placeholder: s == null ? void 0 : s.email,
|
|
3468
|
+
value: z,
|
|
3469
|
+
onChange: (R) => L(R.target.value),
|
|
3470
|
+
autoFocus: !0
|
|
3471
|
+
}
|
|
3472
|
+
)
|
|
3473
|
+
] }),
|
|
3474
|
+
/* @__PURE__ */ t("div", { style: { display: "flex", gap: "8px", justifyContent: "flex-end" }, children: [
|
|
3475
|
+
/* @__PURE__ */ e(
|
|
3476
|
+
"button",
|
|
3477
|
+
{
|
|
3478
|
+
type: "button",
|
|
3479
|
+
className: "ss-auth-btn-ghost",
|
|
3480
|
+
onClick: () => {
|
|
3481
|
+
T(!1), L(""), w(null);
|
|
3482
|
+
},
|
|
3483
|
+
children: "Cancel"
|
|
3484
|
+
}
|
|
3485
|
+
),
|
|
3486
|
+
/* @__PURE__ */ t(
|
|
3487
|
+
"button",
|
|
3488
|
+
{
|
|
3489
|
+
type: "button",
|
|
3490
|
+
className: "ss-auth-btn-primary ss-auth-btn-sm",
|
|
3491
|
+
style: { width: "auto", background: "linear-gradient(135deg, #ef4444, #dc2626)" },
|
|
3492
|
+
disabled: !ha || m,
|
|
3493
|
+
onClick: ua,
|
|
3494
|
+
children: [
|
|
3495
|
+
m && /* @__PURE__ */ e("span", { className: "ss-auth-spinner" }),
|
|
3496
|
+
"Delete account"
|
|
3497
|
+
]
|
|
3498
|
+
}
|
|
3499
|
+
)
|
|
3500
|
+
] })
|
|
3501
|
+
] }) : /* @__PURE__ */ e(
|
|
3502
|
+
"button",
|
|
3503
|
+
{
|
|
3504
|
+
type: "button",
|
|
3505
|
+
className: "ss-auth-btn-outline",
|
|
3506
|
+
style: { borderColor: "currentColor", width: "auto" },
|
|
3507
|
+
onClick: () => T(!0),
|
|
3508
|
+
children: "Delete my account"
|
|
3509
|
+
}
|
|
3510
|
+
)
|
|
3511
|
+
] }),
|
|
3512
|
+
C && /* @__PURE__ */ e(
|
|
3513
|
+
ca,
|
|
3514
|
+
{
|
|
3515
|
+
onUpload: K,
|
|
3516
|
+
onClose: () => P(!1),
|
|
3517
|
+
isLoading: u
|
|
3518
|
+
}
|
|
3519
|
+
)
|
|
3520
|
+
] });
|
|
3521
|
+
}
|
|
3522
|
+
function Ea() {
|
|
3523
|
+
const { selectedOrg: a, updateOrg: s, deleteOrg: r, isLoading: o, error: n, setError: u } = Y(), [i, l] = g((a == null ? void 0 : a.name) ?? ""), [d, c] = g(!1), [f, p] = g(!1), [m, b] = g(!1), [w, y] = g("");
|
|
3524
|
+
if (U(() => {
|
|
3525
|
+
a && l(a.name);
|
|
3526
|
+
}, [a]), !a)
|
|
3527
|
+
return /* @__PURE__ */ t(j, { children: [
|
|
3528
|
+
/* @__PURE__ */ e("h3", { children: "Organization" }),
|
|
3529
|
+
/* @__PURE__ */ t("div", { className: "ss-auth-settings-empty", children: [
|
|
3530
|
+
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: v.corporateFare }),
|
|
3531
|
+
/* @__PURE__ */ e("div", { children: "Select an organization from the user menu to manage its settings." })
|
|
3532
|
+
] })
|
|
3533
|
+
] });
|
|
3534
|
+
const O = async (N) => {
|
|
3535
|
+
if (N.preventDefault(), !i.trim()) return;
|
|
3536
|
+
c(!0), p(!1);
|
|
3537
|
+
const C = await s(a.id, { name: i.trim() });
|
|
3538
|
+
c(!1), C && p(!0);
|
|
3539
|
+
}, h = async () => {
|
|
3540
|
+
await r(a.id) && b(!1);
|
|
3541
|
+
};
|
|
3542
|
+
return /* @__PURE__ */ t(j, { children: [
|
|
3543
|
+
/* @__PURE__ */ e("h3", { children: "Organization" }),
|
|
3544
|
+
/* @__PURE__ */ t("div", { className: "ss-auth-settings-card", children: [
|
|
3545
|
+
/* @__PURE__ */ t("h4", { children: [
|
|
3546
|
+
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: v.corporateFare }),
|
|
3547
|
+
"General"
|
|
3548
|
+
] }),
|
|
3549
|
+
n && /* @__PURE__ */ t("div", { className: "ss-auth-error", style: { marginBottom: "16px" }, children: [
|
|
3550
|
+
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: v.errorOutline }),
|
|
3551
|
+
/* @__PURE__ */ e("span", { children: n })
|
|
3552
|
+
] }),
|
|
3553
|
+
f && /* @__PURE__ */ t("div", { className: "ss-auth-info-box", style: { marginBottom: "16px" }, children: [
|
|
3554
|
+
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: v.check }),
|
|
3555
|
+
/* @__PURE__ */ e("span", { children: "Organization updated" })
|
|
3556
|
+
] }),
|
|
3557
|
+
/* @__PURE__ */ t("form", { onSubmit: O, children: [
|
|
3558
|
+
/* @__PURE__ */ t("div", { className: "ss-auth-field", children: [
|
|
3559
|
+
/* @__PURE__ */ e("label", { className: "ss-auth-label", children: "Organization Name" }),
|
|
3560
|
+
/* @__PURE__ */ e(
|
|
3561
|
+
"input",
|
|
3562
|
+
{
|
|
3563
|
+
className: "ss-auth-input",
|
|
3564
|
+
type: "text",
|
|
3565
|
+
value: i,
|
|
3566
|
+
onChange: (N) => {
|
|
3567
|
+
l(N.target.value), p(!1);
|
|
3568
|
+
}
|
|
3569
|
+
}
|
|
3570
|
+
)
|
|
3571
|
+
] }),
|
|
3572
|
+
/* @__PURE__ */ t("div", { className: "ss-auth-field", children: [
|
|
3573
|
+
/* @__PURE__ */ e("label", { className: "ss-auth-label", children: "Slug" }),
|
|
3574
|
+
/* @__PURE__ */ e("input", { className: "ss-auth-input ss-auth-input-readonly", type: "text", value: a.slug, readOnly: !0 })
|
|
3575
|
+
] }),
|
|
3576
|
+
/* @__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: [
|
|
3577
|
+
d && /* @__PURE__ */ e("span", { className: "ss-auth-spinner" }),
|
|
3578
|
+
"Save"
|
|
3579
|
+
] }) })
|
|
3580
|
+
] })
|
|
3581
|
+
] }),
|
|
3582
|
+
/* @__PURE__ */ t("div", { className: "ss-auth-settings-card ss-auth-settings-danger", children: [
|
|
3583
|
+
/* @__PURE__ */ e("h4", { children: "Danger Zone" }),
|
|
3584
|
+
/* @__PURE__ */ e("p", { className: "ss-auth-section-desc", style: { marginBottom: "16px" }, children: "Deleting this organization is permanent and will remove all members." }),
|
|
3585
|
+
m ? /* @__PURE__ */ t("div", { children: [
|
|
3586
|
+
/* @__PURE__ */ t("div", { className: "ss-auth-field", children: [
|
|
3587
|
+
/* @__PURE__ */ e("label", { className: "ss-auth-label", children: "Type the organization name to confirm" }),
|
|
3588
|
+
/* @__PURE__ */ e(
|
|
3589
|
+
"input",
|
|
3590
|
+
{
|
|
3591
|
+
className: "ss-auth-input",
|
|
3592
|
+
type: "text",
|
|
3593
|
+
placeholder: a.name,
|
|
3594
|
+
value: w,
|
|
3595
|
+
onChange: (N) => y(N.target.value),
|
|
3596
|
+
autoFocus: !0
|
|
3597
|
+
}
|
|
3598
|
+
)
|
|
3599
|
+
] }),
|
|
3600
|
+
/* @__PURE__ */ t("div", { style: { display: "flex", gap: "8px", justifyContent: "flex-end" }, children: [
|
|
3601
|
+
/* @__PURE__ */ e("button", { type: "button", className: "ss-auth-btn-ghost", onClick: () => {
|
|
3602
|
+
b(!1), y("");
|
|
3603
|
+
}, children: "Cancel" }),
|
|
3604
|
+
/* @__PURE__ */ t(
|
|
3605
|
+
"button",
|
|
3606
|
+
{
|
|
3607
|
+
type: "button",
|
|
3608
|
+
className: "ss-auth-btn-primary ss-auth-btn-sm",
|
|
3609
|
+
style: { width: "auto", background: "linear-gradient(135deg, #ef4444, #dc2626)" },
|
|
3610
|
+
disabled: w !== a.name || o,
|
|
3611
|
+
onClick: h,
|
|
3612
|
+
children: [
|
|
3613
|
+
o && /* @__PURE__ */ e("span", { className: "ss-auth-spinner" }),
|
|
3614
|
+
"Delete organization"
|
|
3615
|
+
]
|
|
3616
|
+
}
|
|
3617
|
+
)
|
|
3618
|
+
] })
|
|
3619
|
+
] }) : /* @__PURE__ */ e(
|
|
3620
|
+
"button",
|
|
3621
|
+
{
|
|
3622
|
+
type: "button",
|
|
3623
|
+
className: "ss-auth-btn-outline",
|
|
3624
|
+
style: { borderColor: "currentColor", width: "auto" },
|
|
3625
|
+
onClick: () => b(!0),
|
|
3626
|
+
children: "Delete this organization"
|
|
3627
|
+
}
|
|
3628
|
+
)
|
|
3629
|
+
] })
|
|
3630
|
+
] });
|
|
3631
|
+
}
|
|
3632
|
+
function Ia() {
|
|
3633
|
+
const {
|
|
3634
|
+
selectedOrg: a,
|
|
3635
|
+
members: s,
|
|
3636
|
+
invites: r,
|
|
3637
|
+
isLoading: o,
|
|
3638
|
+
error: n,
|
|
3639
|
+
setError: u,
|
|
3640
|
+
sendInvite: i,
|
|
3641
|
+
refreshInvites: l,
|
|
3642
|
+
revokeInvite: d,
|
|
3643
|
+
updateMemberRole: c,
|
|
3644
|
+
removeMember: f,
|
|
3645
|
+
refreshMembers: p
|
|
3646
|
+
} = Y(), [m, b] = g(""), [w, y] = g("member"), [O, h] = g(!1), [N, C] = g(!1), [P, I] = g(null), [F, B] = g(""), [$, x] = g(null);
|
|
3647
|
+
if (U(() => {
|
|
3648
|
+
a && (p(a.id), l(a.id));
|
|
3649
|
+
}, [a, p, l]), !a)
|
|
3650
|
+
return /* @__PURE__ */ t(j, { children: [
|
|
3651
|
+
/* @__PURE__ */ e("h3", { children: "People" }),
|
|
3652
|
+
/* @__PURE__ */ t("div", { className: "ss-auth-settings-empty", children: [
|
|
3653
|
+
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: v.group }),
|
|
3654
|
+
/* @__PURE__ */ e("div", { children: "Select an organization from the user menu to manage members." })
|
|
3655
|
+
] })
|
|
3656
|
+
] });
|
|
3657
|
+
const S = async (z) => {
|
|
3658
|
+
z.preventDefault(), C(!1), await i(a.id, m, w) && (b(""), y("member"), C(!0), h(!1), l(a.id));
|
|
3659
|
+
}, E = async () => {
|
|
3660
|
+
if (!P) return;
|
|
3661
|
+
await c(a.id, P.userId, F) && I(null);
|
|
3662
|
+
}, D = async () => {
|
|
3663
|
+
if (!$) return;
|
|
3664
|
+
await f(a.id, $.userId) && x(null);
|
|
3665
|
+
}, V = async (z) => {
|
|
3666
|
+
await d(a.id, z);
|
|
3667
|
+
}, T = (z) => z === "owner" ? "ss-auth-role-badge ss-auth-role-badge-owner" : z === "admin" ? "ss-auth-role-badge ss-auth-role-badge-admin" : "ss-auth-role-badge ss-auth-role-badge-member";
|
|
3668
|
+
return /* @__PURE__ */ t(j, { children: [
|
|
3669
|
+
/* @__PURE__ */ e("h3", { children: "People" }),
|
|
3670
|
+
n && /* @__PURE__ */ t("div", { className: "ss-auth-error", style: { marginBottom: "16px" }, children: [
|
|
3671
|
+
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: v.errorOutline }),
|
|
3672
|
+
/* @__PURE__ */ e("span", { children: n })
|
|
3673
|
+
] }),
|
|
3674
|
+
N && /* @__PURE__ */ t("div", { className: "ss-auth-info-box", style: { marginBottom: "16px" }, children: [
|
|
3675
|
+
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: v.check }),
|
|
3676
|
+
/* @__PURE__ */ e("span", { children: "Invitation sent" })
|
|
3677
|
+
] }),
|
|
3678
|
+
/* @__PURE__ */ t("div", { className: "ss-auth-settings-card", children: [
|
|
3679
|
+
/* @__PURE__ */ t("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", marginBottom: "16px" }, children: [
|
|
3680
|
+
/* @__PURE__ */ t("h4", { style: { margin: 0 }, children: [
|
|
3681
|
+
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: v.group }),
|
|
3682
|
+
"Members"
|
|
3683
|
+
] }),
|
|
3684
|
+
/* @__PURE__ */ t(
|
|
3685
|
+
"button",
|
|
3686
|
+
{
|
|
3687
|
+
type: "button",
|
|
3688
|
+
className: "ss-auth-btn-primary ss-auth-btn-sm",
|
|
3689
|
+
style: { width: "auto" },
|
|
3690
|
+
onClick: () => h(!O),
|
|
3691
|
+
children: [
|
|
3692
|
+
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", style: { fontSize: "16px" }, children: v.add }),
|
|
3693
|
+
"Invite"
|
|
3694
|
+
]
|
|
3695
|
+
}
|
|
3696
|
+
)
|
|
3697
|
+
] }),
|
|
3698
|
+
O && /* @__PURE__ */ e("form", { onSubmit: S, 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: [
|
|
3699
|
+
/* @__PURE__ */ t("div", { style: { flex: 1 }, children: [
|
|
3700
|
+
/* @__PURE__ */ e("label", { className: "ss-auth-label", children: "Email" }),
|
|
3701
|
+
/* @__PURE__ */ e(
|
|
3702
|
+
"input",
|
|
3703
|
+
{
|
|
3704
|
+
className: "ss-auth-input",
|
|
3705
|
+
type: "email",
|
|
3706
|
+
placeholder: "member@example.com",
|
|
3707
|
+
value: m,
|
|
3708
|
+
onChange: (z) => b(z.target.value),
|
|
3709
|
+
required: !0
|
|
3710
|
+
}
|
|
3711
|
+
)
|
|
3712
|
+
] }),
|
|
3713
|
+
/* @__PURE__ */ t("div", { style: { width: "120px" }, children: [
|
|
3714
|
+
/* @__PURE__ */ e("label", { className: "ss-auth-label", children: "Role" }),
|
|
3715
|
+
/* @__PURE__ */ t(
|
|
3716
|
+
"select",
|
|
3717
|
+
{
|
|
3718
|
+
className: "ss-auth-input",
|
|
3719
|
+
value: w,
|
|
3720
|
+
onChange: (z) => y(z.target.value),
|
|
3721
|
+
style: { cursor: "pointer" },
|
|
3722
|
+
children: [
|
|
3723
|
+
/* @__PURE__ */ e("option", { value: "admin", children: "Admin" }),
|
|
3724
|
+
/* @__PURE__ */ e("option", { value: "member", children: "Member" })
|
|
3725
|
+
]
|
|
3726
|
+
}
|
|
3727
|
+
)
|
|
3728
|
+
] }),
|
|
3729
|
+
/* @__PURE__ */ e("button", { type: "submit", className: "ss-auth-btn-primary ss-auth-btn-sm", disabled: o, style: { width: "auto", marginBottom: "0" }, children: "Send" })
|
|
3730
|
+
] }) }),
|
|
3731
|
+
s.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: [
|
|
3732
|
+
/* @__PURE__ */ e("thead", { children: /* @__PURE__ */ t("tr", { children: [
|
|
3733
|
+
/* @__PURE__ */ e("th", { children: "Email" }),
|
|
3734
|
+
/* @__PURE__ */ e("th", { children: "Role" }),
|
|
3735
|
+
/* @__PURE__ */ e("th", { style: { width: "80px" }, children: "Actions" })
|
|
3736
|
+
] }) }),
|
|
3737
|
+
/* @__PURE__ */ e("tbody", { children: s.map((z) => /* @__PURE__ */ t("tr", { children: [
|
|
3738
|
+
/* @__PURE__ */ e("td", { children: z.email }),
|
|
3739
|
+
/* @__PURE__ */ e("td", { children: /* @__PURE__ */ e("span", { className: T(z.role), children: z.role }) }),
|
|
3740
|
+
/* @__PURE__ */ e("td", { children: z.role === "owner" ? /* @__PURE__ */ e("span", { style: { fontSize: "12px", opacity: 0.4 }, children: "—" }) : /* @__PURE__ */ t("div", { className: "ss-auth-settings-actions", children: [
|
|
3741
|
+
/* @__PURE__ */ e(
|
|
3742
|
+
"button",
|
|
3743
|
+
{
|
|
3744
|
+
type: "button",
|
|
3745
|
+
className: "ss-auth-icon-btn",
|
|
3746
|
+
title: "Edit role",
|
|
3747
|
+
onClick: () => {
|
|
3748
|
+
I(z), B(z.role);
|
|
3749
|
+
},
|
|
3750
|
+
children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: v.edit })
|
|
3751
|
+
}
|
|
3752
|
+
),
|
|
3753
|
+
/* @__PURE__ */ e(
|
|
3754
|
+
"button",
|
|
3755
|
+
{
|
|
3756
|
+
type: "button",
|
|
3757
|
+
className: "ss-auth-icon-btn ss-auth-icon-btn-danger",
|
|
3758
|
+
title: "Remove member",
|
|
3759
|
+
onClick: () => x(z),
|
|
3760
|
+
children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: v.personRemove })
|
|
3761
|
+
}
|
|
3762
|
+
)
|
|
3763
|
+
] }) })
|
|
3764
|
+
] }, z.userId)) })
|
|
3765
|
+
] })
|
|
3766
|
+
] }),
|
|
3767
|
+
r.length > 0 && /* @__PURE__ */ t("div", { className: "ss-auth-settings-card", children: [
|
|
3768
|
+
/* @__PURE__ */ t("h4", { children: [
|
|
3769
|
+
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: v.send }),
|
|
3770
|
+
"Pending Invites"
|
|
3771
|
+
] }),
|
|
3772
|
+
/* @__PURE__ */ t("table", { className: "ss-auth-settings-table", children: [
|
|
3773
|
+
/* @__PURE__ */ e("thead", { children: /* @__PURE__ */ t("tr", { children: [
|
|
3774
|
+
/* @__PURE__ */ e("th", { children: "Email" }),
|
|
3775
|
+
/* @__PURE__ */ e("th", { children: "Role" }),
|
|
3776
|
+
/* @__PURE__ */ e("th", { style: { width: "80px" }, children: "Actions" })
|
|
3777
|
+
] }) }),
|
|
3778
|
+
/* @__PURE__ */ e("tbody", { children: r.map((z) => /* @__PURE__ */ t("tr", { children: [
|
|
3779
|
+
/* @__PURE__ */ e("td", { children: z.email }),
|
|
3780
|
+
/* @__PURE__ */ e("td", { children: /* @__PURE__ */ e("span", { className: T(z.role), children: z.role }) }),
|
|
3781
|
+
/* @__PURE__ */ e("td", { children: /* @__PURE__ */ e(
|
|
3782
|
+
"button",
|
|
3783
|
+
{
|
|
3784
|
+
type: "button",
|
|
3785
|
+
className: "ss-auth-icon-btn ss-auth-icon-btn-danger",
|
|
3786
|
+
title: "Revoke invite",
|
|
3787
|
+
onClick: () => V(z.id),
|
|
3788
|
+
children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: v.close })
|
|
3789
|
+
}
|
|
3790
|
+
) })
|
|
3791
|
+
] }, z.id)) })
|
|
3792
|
+
] })
|
|
3793
|
+
] }),
|
|
3794
|
+
P && /* @__PURE__ */ e("div", { className: "ss-auth-modal-overlay", onClick: (z) => {
|
|
3795
|
+
z.target === z.currentTarget && I(null);
|
|
3796
|
+
}, children: /* @__PURE__ */ t("div", { className: "ss-auth-modal", style: { maxWidth: "400px" }, children: [
|
|
3797
|
+
/* @__PURE__ */ t("div", { className: "ss-auth-modal-header", children: [
|
|
3798
|
+
/* @__PURE__ */ e("h2", { children: "Edit Role" }),
|
|
3799
|
+
/* @__PURE__ */ e("button", { type: "button", className: "ss-auth-modal-close", onClick: () => I(null), children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: v.close }) })
|
|
3800
|
+
] }),
|
|
3801
|
+
/* @__PURE__ */ t("div", { className: "ss-auth-modal-body", children: [
|
|
3802
|
+
/* @__PURE__ */ t("p", { style: { fontSize: "14px", marginBottom: "16px", margin: "0 0 16px 0" }, children: [
|
|
3803
|
+
"Change role for ",
|
|
3804
|
+
/* @__PURE__ */ e("strong", { children: P.email })
|
|
3805
|
+
] }),
|
|
3806
|
+
/* @__PURE__ */ t("div", { className: "ss-auth-field", children: [
|
|
3807
|
+
/* @__PURE__ */ e("label", { className: "ss-auth-label", children: "Role" }),
|
|
3808
|
+
/* @__PURE__ */ t(
|
|
3809
|
+
"select",
|
|
3810
|
+
{
|
|
3811
|
+
className: "ss-auth-input",
|
|
3812
|
+
value: F,
|
|
3813
|
+
onChange: (z) => B(z.target.value),
|
|
3814
|
+
style: { cursor: "pointer" },
|
|
3815
|
+
children: [
|
|
3816
|
+
/* @__PURE__ */ e("option", { value: "admin", children: "Admin" }),
|
|
3817
|
+
/* @__PURE__ */ e("option", { value: "member", children: "Member" })
|
|
3818
|
+
]
|
|
3819
|
+
}
|
|
3820
|
+
)
|
|
3821
|
+
] }),
|
|
3822
|
+
/* @__PURE__ */ t("div", { style: { display: "flex", gap: "8px", justifyContent: "flex-end" }, children: [
|
|
3823
|
+
/* @__PURE__ */ e("button", { type: "button", className: "ss-auth-btn-ghost", onClick: () => I(null), children: "Cancel" }),
|
|
3824
|
+
/* @__PURE__ */ e("button", { type: "button", className: "ss-auth-btn-primary ss-auth-btn-sm", style: { width: "auto" }, onClick: E, children: "Save" })
|
|
3825
|
+
] })
|
|
3826
|
+
] })
|
|
3827
|
+
] }) }),
|
|
3828
|
+
$ && /* @__PURE__ */ e("div", { className: "ss-auth-modal-overlay", onClick: (z) => {
|
|
3829
|
+
z.target === z.currentTarget && x(null);
|
|
3830
|
+
}, children: /* @__PURE__ */ t("div", { className: "ss-auth-modal", style: { maxWidth: "400px" }, children: [
|
|
3831
|
+
/* @__PURE__ */ t("div", { className: "ss-auth-modal-header", children: [
|
|
3832
|
+
/* @__PURE__ */ e("h2", { children: "Remove Member" }),
|
|
3833
|
+
/* @__PURE__ */ e("button", { type: "button", className: "ss-auth-modal-close", onClick: () => x(null), children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: v.close }) })
|
|
3834
|
+
] }),
|
|
3835
|
+
/* @__PURE__ */ t("div", { className: "ss-auth-modal-body", children: [
|
|
3836
|
+
/* @__PURE__ */ t("p", { style: { fontSize: "14px", margin: "0 0 16px 0" }, children: [
|
|
3837
|
+
"Are you sure you want to remove ",
|
|
3838
|
+
/* @__PURE__ */ e("strong", { children: $.email }),
|
|
3839
|
+
" from the organization?"
|
|
3840
|
+
] }),
|
|
3841
|
+
/* @__PURE__ */ t("div", { style: { display: "flex", gap: "8px", justifyContent: "flex-end" }, children: [
|
|
3842
|
+
/* @__PURE__ */ e("button", { type: "button", className: "ss-auth-btn-ghost", onClick: () => x(null), children: "Cancel" }),
|
|
3843
|
+
/* @__PURE__ */ e(
|
|
3844
|
+
"button",
|
|
3845
|
+
{
|
|
3846
|
+
type: "button",
|
|
3847
|
+
className: "ss-auth-btn-primary ss-auth-btn-sm",
|
|
3848
|
+
style: { width: "auto", background: "linear-gradient(135deg, #ef4444, #dc2626)" },
|
|
3849
|
+
onClick: D,
|
|
3850
|
+
children: "Remove"
|
|
3851
|
+
}
|
|
3852
|
+
)
|
|
3853
|
+
] })
|
|
3854
|
+
] })
|
|
3855
|
+
] }) })
|
|
3856
|
+
] });
|
|
3857
|
+
}
|
|
3858
|
+
function Fa() {
|
|
3859
|
+
const { selectedOrg: a } = Y();
|
|
3860
|
+
return a ? /* @__PURE__ */ t(j, { children: [
|
|
3861
|
+
/* @__PURE__ */ e("h3", { children: "Billing" }),
|
|
3862
|
+
/* @__PURE__ */ t("div", { className: "ss-auth-settings-card", children: [
|
|
3863
|
+
/* @__PURE__ */ t("h4", { children: [
|
|
3864
|
+
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: v.creditCard }),
|
|
3865
|
+
"Plan & Billing"
|
|
3866
|
+
] }),
|
|
3867
|
+
/* @__PURE__ */ e("div", { className: "ss-auth-settings-empty", style: { padding: "20px" }, children: /* @__PURE__ */ e("div", { children: "No billing plan configured for this organization." }) })
|
|
3868
|
+
] })
|
|
3869
|
+
] }) : /* @__PURE__ */ t(j, { children: [
|
|
3870
|
+
/* @__PURE__ */ e("h3", { children: "Billing" }),
|
|
3871
|
+
/* @__PURE__ */ t("div", { className: "ss-auth-settings-empty", children: [
|
|
3872
|
+
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: v.creditCard }),
|
|
3873
|
+
/* @__PURE__ */ e("div", { children: "Select an organization from the user menu to manage billing." })
|
|
3874
|
+
] })
|
|
3875
|
+
] });
|
|
3876
|
+
}
|
|
3877
|
+
function oe({
|
|
3878
|
+
appearance: a,
|
|
3879
|
+
afterSignOutUrl: s,
|
|
3880
|
+
afterDeleteAccountUrl: r,
|
|
2997
3881
|
showOrgSwitcher: o = !0,
|
|
2998
3882
|
onOrgChange: n,
|
|
2999
3883
|
onOrgSettingsClick: u
|
|
3000
3884
|
}) {
|
|
3001
|
-
const { appearance:
|
|
3002
|
-
|
|
3885
|
+
const { appearance: i } = A(), { user: l, signOut: d } = sa(), c = a ?? i, [f, p] = g(!1), [m, b] = g(!1), [w, y] = g(""), [O, h] = g(null), [N, C] = g(!1), P = _(null), { orgs: I, selectedOrg: F, selectOrg: B, createOrg: $ } = Y(), x = k((E) => {
|
|
3886
|
+
P.current && !E.composedPath().includes(P.current) && p(!1);
|
|
3003
3887
|
}, []);
|
|
3004
|
-
|
|
3888
|
+
U(() => {
|
|
3005
3889
|
if (f) {
|
|
3006
|
-
const
|
|
3890
|
+
const E = setTimeout(() => {
|
|
3007
3891
|
document.addEventListener("click", x);
|
|
3008
3892
|
}, 0);
|
|
3009
3893
|
return () => {
|
|
3010
|
-
clearTimeout(
|
|
3894
|
+
clearTimeout(E), document.removeEventListener("click", x);
|
|
3011
3895
|
};
|
|
3012
3896
|
}
|
|
3013
3897
|
}, [f, x]);
|
|
3014
|
-
const
|
|
3015
|
-
async (
|
|
3016
|
-
|
|
3898
|
+
const S = k(
|
|
3899
|
+
async (E) => {
|
|
3900
|
+
E.preventDefault(), h(null), C(!0);
|
|
3017
3901
|
const D = w.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "");
|
|
3018
3902
|
try {
|
|
3019
|
-
const
|
|
3020
|
-
|
|
3021
|
-
} catch (
|
|
3022
|
-
h(
|
|
3903
|
+
const V = await $(w, D);
|
|
3904
|
+
V && (await B(V.id), n == null || n(V), y(""), p(!1));
|
|
3905
|
+
} catch (V) {
|
|
3906
|
+
h(V instanceof Error ? V.message : "Failed to create organization");
|
|
3023
3907
|
} finally {
|
|
3024
|
-
|
|
3908
|
+
C(!1);
|
|
3025
3909
|
}
|
|
3026
3910
|
},
|
|
3027
|
-
[w,
|
|
3911
|
+
[w, $, B, n]
|
|
3028
3912
|
);
|
|
3029
|
-
return
|
|
3030
|
-
/* @__PURE__ */
|
|
3913
|
+
return l ? /* @__PURE__ */ e(H, { appearance: c, children: /* @__PURE__ */ t("div", { style: { position: "relative", display: "inline-block" }, ref: P, children: [
|
|
3914
|
+
/* @__PURE__ */ t(
|
|
3031
3915
|
"button",
|
|
3032
3916
|
{
|
|
3033
3917
|
type: "button",
|
|
3034
|
-
className: "ss-auth-
|
|
3918
|
+
className: "ss-auth-user-trigger",
|
|
3035
3919
|
onClick: () => p(!f),
|
|
3036
3920
|
"aria-label": "User menu",
|
|
3037
|
-
children:
|
|
3038
|
-
|
|
3039
|
-
|
|
3040
|
-
|
|
3041
|
-
|
|
3042
|
-
|
|
3043
|
-
|
|
3044
|
-
|
|
3045
|
-
|
|
3921
|
+
children: [
|
|
3922
|
+
/* @__PURE__ */ e("span", { className: "ss-auth-avatar-trigger", children: l.avatarUrl ? /* @__PURE__ */ e("img", { src: l.avatarUrl, alt: "" }) : /* @__PURE__ */ e("div", { style: {
|
|
3923
|
+
width: "100%",
|
|
3924
|
+
height: "100%",
|
|
3925
|
+
display: "flex",
|
|
3926
|
+
alignItems: "center",
|
|
3927
|
+
justifyContent: "center",
|
|
3928
|
+
fontSize: "16px",
|
|
3929
|
+
fontWeight: 700
|
|
3930
|
+
}, children: (l.name || l.email).charAt(0).toUpperCase() }) }),
|
|
3931
|
+
F && /* @__PURE__ */ e("span", { className: "ss-auth-trigger-org-name", children: F.name })
|
|
3932
|
+
]
|
|
3046
3933
|
}
|
|
3047
3934
|
),
|
|
3048
|
-
f && /* @__PURE__ */
|
|
3049
|
-
/* @__PURE__ */
|
|
3050
|
-
/* @__PURE__ */ e("div", { className: "ss-auth-dropdown-avatar", children:
|
|
3935
|
+
f && /* @__PURE__ */ t("div", { className: "ss-auth-dropdown ss-auth-glass-panel", style: { minWidth: "320px" }, children: [
|
|
3936
|
+
/* @__PURE__ */ t("div", { className: "ss-auth-dropdown-header", children: [
|
|
3937
|
+
/* @__PURE__ */ e("div", { className: "ss-auth-dropdown-avatar", children: l.avatarUrl ? /* @__PURE__ */ e("img", { src: l.avatarUrl, alt: "" }) : /* @__PURE__ */ e("div", { style: {
|
|
3051
3938
|
width: "100%",
|
|
3052
3939
|
height: "100%",
|
|
3053
3940
|
display: "flex",
|
|
@@ -3055,13 +3942,13 @@ function re({
|
|
|
3055
3942
|
justifyContent: "center",
|
|
3056
3943
|
fontSize: "20px",
|
|
3057
3944
|
fontWeight: 800
|
|
3058
|
-
}, children: (
|
|
3059
|
-
/* @__PURE__ */
|
|
3060
|
-
|
|
3061
|
-
/* @__PURE__ */ e("div", { className: "ss-auth-dropdown-email", children:
|
|
3945
|
+
}, children: (l.name || l.email).charAt(0).toUpperCase() }) }),
|
|
3946
|
+
/* @__PURE__ */ t("div", { children: [
|
|
3947
|
+
l.name && /* @__PURE__ */ e("div", { className: "ss-auth-dropdown-name", children: l.name }),
|
|
3948
|
+
/* @__PURE__ */ e("div", { className: "ss-auth-dropdown-email", children: l.email })
|
|
3062
3949
|
] })
|
|
3063
3950
|
] }),
|
|
3064
|
-
/* @__PURE__ */ e("div", { style: { padding: "4px 8px" }, children: /* @__PURE__ */
|
|
3951
|
+
/* @__PURE__ */ e("div", { style: { padding: "4px 8px" }, children: /* @__PURE__ */ t(
|
|
3065
3952
|
"button",
|
|
3066
3953
|
{
|
|
3067
3954
|
type: "button",
|
|
@@ -3070,37 +3957,38 @@ function re({
|
|
|
3070
3957
|
p(!1), b(!0);
|
|
3071
3958
|
},
|
|
3072
3959
|
children: [
|
|
3073
|
-
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children:
|
|
3074
|
-
"
|
|
3960
|
+
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: v.settings }),
|
|
3961
|
+
"Settings"
|
|
3075
3962
|
]
|
|
3076
3963
|
}
|
|
3077
3964
|
) }),
|
|
3078
|
-
o && /* @__PURE__ */
|
|
3965
|
+
o && /* @__PURE__ */ t(j, { children: [
|
|
3079
3966
|
/* @__PURE__ */ e("div", { className: "ss-auth-section-label", children: "Organizations" }),
|
|
3080
|
-
/* @__PURE__ */ e("div", { style: { padding: "0 8px 4px" }, children:
|
|
3081
|
-
const D = (
|
|
3082
|
-
return /* @__PURE__ */
|
|
3967
|
+
/* @__PURE__ */ e("div", { style: { padding: "0 8px 4px" }, children: I.map((E) => {
|
|
3968
|
+
const D = (F == null ? void 0 : F.id) === E.id, V = E.name.split(" ").map((T) => T[0]).join("").slice(0, 2).toUpperCase();
|
|
3969
|
+
return /* @__PURE__ */ t(
|
|
3083
3970
|
"button",
|
|
3084
3971
|
{
|
|
3085
3972
|
type: "button",
|
|
3086
3973
|
className: `ss-auth-org-item${D ? " ss-auth-org-item-active" : ""}`,
|
|
3087
3974
|
onClick: async () => {
|
|
3088
|
-
p(!1), await
|
|
3975
|
+
p(!1), await B(E.id), n == null || n(E);
|
|
3089
3976
|
},
|
|
3090
3977
|
children: [
|
|
3091
|
-
/* @__PURE__ */
|
|
3092
|
-
/* @__PURE__ */ e("div", { className: `ss-auth-org-avatar${D ? "" : " ss-auth-org-avatar-inactive"}`, children:
|
|
3093
|
-
/* @__PURE__ */ e("span", { style: { fontFamily: "'Manrope', sans-serif", letterSpacing: "-0.01em" }, children:
|
|
3978
|
+
/* @__PURE__ */ t("div", { className: "ss-auth-org-item-inner", children: [
|
|
3979
|
+
/* @__PURE__ */ e("div", { className: `ss-auth-org-avatar${D ? "" : " ss-auth-org-avatar-inactive"}`, children: V }),
|
|
3980
|
+
/* @__PURE__ */ e("span", { style: { fontFamily: "'Manrope', sans-serif", letterSpacing: "-0.01em" }, children: E.name }),
|
|
3981
|
+
E.planName && /* @__PURE__ */ e("span", { className: "ss-auth-plan-badge", children: E.planName })
|
|
3094
3982
|
] }),
|
|
3095
|
-
D && /* @__PURE__ */ e("span", { className: "material-symbols-outlined ss-auth-org-check", style: { fontSize: "18px" }, children:
|
|
3983
|
+
D && /* @__PURE__ */ e("span", { className: "material-symbols-outlined ss-auth-org-check", style: { fontSize: "18px" }, children: v.checkCircle })
|
|
3096
3984
|
]
|
|
3097
3985
|
},
|
|
3098
|
-
|
|
3986
|
+
E.id
|
|
3099
3987
|
);
|
|
3100
3988
|
}) }),
|
|
3101
|
-
/* @__PURE__ */
|
|
3102
|
-
|
|
3103
|
-
/* @__PURE__ */ e("form", { onSubmit:
|
|
3989
|
+
/* @__PURE__ */ t("div", { className: "ss-auth-inline-create", children: [
|
|
3990
|
+
O && /* @__PURE__ */ e("div", { className: "ss-auth-error", style: { marginBottom: "8px", fontSize: "12px" }, children: /* @__PURE__ */ e("span", { children: O }) }),
|
|
3991
|
+
/* @__PURE__ */ e("form", { onSubmit: S, children: /* @__PURE__ */ t("div", { className: "ss-auth-inline-create-input", children: [
|
|
3104
3992
|
/* @__PURE__ */ e(
|
|
3105
3993
|
"input",
|
|
3106
3994
|
{
|
|
@@ -3108,7 +3996,7 @@ function re({
|
|
|
3108
3996
|
type: "text",
|
|
3109
3997
|
placeholder: "New organization name",
|
|
3110
3998
|
value: w,
|
|
3111
|
-
onChange: (
|
|
3999
|
+
onChange: (E) => y(E.target.value),
|
|
3112
4000
|
required: !0,
|
|
3113
4001
|
style: { fontSize: "13px", padding: "10px 40px 10px 12px" }
|
|
3114
4002
|
}
|
|
@@ -3119,27 +4007,27 @@ function re({
|
|
|
3119
4007
|
type: "submit",
|
|
3120
4008
|
className: "ss-auth-inline-create-btn",
|
|
3121
4009
|
disabled: N || !w.trim(),
|
|
3122
|
-
children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", style: { fontSize: "20px" }, children:
|
|
4010
|
+
children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", style: { fontSize: "20px" }, children: v.add })
|
|
3123
4011
|
}
|
|
3124
4012
|
)
|
|
3125
4013
|
] }) })
|
|
3126
4014
|
] }),
|
|
3127
|
-
|
|
4015
|
+
F && u && /* @__PURE__ */ e("div", { style: { padding: "0 8px 4px" }, children: /* @__PURE__ */ t(
|
|
3128
4016
|
"button",
|
|
3129
4017
|
{
|
|
3130
4018
|
type: "button",
|
|
3131
4019
|
className: "ss-auth-dropdown-action",
|
|
3132
4020
|
onClick: () => {
|
|
3133
|
-
p(!1), u(
|
|
4021
|
+
p(!1), u(F);
|
|
3134
4022
|
},
|
|
3135
4023
|
children: [
|
|
3136
|
-
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children:
|
|
4024
|
+
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: v.corporateFare }),
|
|
3137
4025
|
"Org settings"
|
|
3138
4026
|
]
|
|
3139
4027
|
}
|
|
3140
4028
|
) })
|
|
3141
4029
|
] }),
|
|
3142
|
-
/* @__PURE__ */ e("div", { className: "ss-auth-signout-section", style: { padding: "8px" }, children: /* @__PURE__ */
|
|
4030
|
+
/* @__PURE__ */ e("div", { className: "ss-auth-signout-section", style: { padding: "8px" }, children: /* @__PURE__ */ t(
|
|
3143
4031
|
"button",
|
|
3144
4032
|
{
|
|
3145
4033
|
type: "button",
|
|
@@ -3149,254 +4037,52 @@ function re({
|
|
|
3149
4037
|
},
|
|
3150
4038
|
style: { color: "inherit" },
|
|
3151
4039
|
children: [
|
|
3152
|
-
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", style: { color: "inherit" }, children:
|
|
4040
|
+
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", style: { color: "inherit" }, children: v.logout }),
|
|
3153
4041
|
"Sign out"
|
|
3154
4042
|
]
|
|
3155
4043
|
}
|
|
3156
4044
|
) })
|
|
3157
4045
|
] }),
|
|
3158
4046
|
m && /* @__PURE__ */ e(
|
|
3159
|
-
|
|
4047
|
+
Pa,
|
|
3160
4048
|
{
|
|
3161
4049
|
onClose: () => b(!1),
|
|
3162
|
-
afterDeleteAccountUrl:
|
|
4050
|
+
afterDeleteAccountUrl: r
|
|
3163
4051
|
}
|
|
3164
4052
|
)
|
|
3165
4053
|
] }) }) : null;
|
|
3166
4054
|
}
|
|
3167
|
-
function
|
|
3168
|
-
const { user:
|
|
3169
|
-
async (
|
|
3170
|
-
|
|
3171
|
-
},
|
|
3172
|
-
[C, N, o, i, f]
|
|
3173
|
-
), Y = $(
|
|
3174
|
-
async (U) => {
|
|
3175
|
-
const K = await n(U);
|
|
3176
|
-
K && (k(K.avatarUrl), E(!1));
|
|
3177
|
-
},
|
|
3178
|
-
[n]
|
|
3179
|
-
), ua = $(
|
|
3180
|
-
async (U) => {
|
|
3181
|
-
if (U.preventDefault(), H(null), i(null), f(null), S !== v) {
|
|
3182
|
-
H("Passwords do not match");
|
|
3183
|
-
return;
|
|
3184
|
-
}
|
|
3185
|
-
if (S.length < 8) {
|
|
3186
|
-
H("Password must be at least 8 characters");
|
|
3187
|
-
return;
|
|
3188
|
-
}
|
|
3189
|
-
await u(I, S) && (A(""), x(""), O(""));
|
|
3190
|
-
},
|
|
3191
|
-
[I, S, v, u, i, f]
|
|
3192
|
-
), pa = $(async () => {
|
|
3193
|
-
await m() && (await p(), s && (window.location.href = s));
|
|
3194
|
-
}, [m, p, s]), ha = (t == null ? void 0 : t.provider) === "email", ga = F === (t == null ? void 0 : t.email), fa = ((t == null ? void 0 : t.name) || (t == null ? void 0 : t.email) || "?").charAt(0).toUpperCase();
|
|
3195
|
-
return /* @__PURE__ */ e("div", { className: "ss-auth-modal-overlay", onClick: (U) => {
|
|
3196
|
-
U.target === U.currentTarget && a();
|
|
3197
|
-
}, children: /* @__PURE__ */ r("div", { className: "ss-auth-modal", style: { maxWidth: "640px" }, children: [
|
|
3198
|
-
/* @__PURE__ */ r("div", { className: "ss-auth-modal-header", children: [
|
|
3199
|
-
/* @__PURE__ */ e("h2", { children: "Profile" }),
|
|
3200
|
-
/* @__PURE__ */ e("button", { type: "button", className: "ss-auth-modal-close", onClick: a, children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: P.close }) })
|
|
3201
|
-
] }),
|
|
3202
|
-
/* @__PURE__ */ r("div", { className: "ss-auth-profile-header", children: [
|
|
3203
|
-
/* @__PURE__ */ r("div", { className: "ss-auth-avatar-lg", onClick: () => E(!0), children: [
|
|
3204
|
-
N ? /* @__PURE__ */ e("img", { src: N, alt: "" }) : /* @__PURE__ */ e("div", { style: {
|
|
3205
|
-
width: "100%",
|
|
3206
|
-
height: "100%",
|
|
3207
|
-
display: "flex",
|
|
3208
|
-
alignItems: "center",
|
|
3209
|
-
justifyContent: "center",
|
|
3210
|
-
fontSize: "48px",
|
|
3211
|
-
fontWeight: 800,
|
|
3212
|
-
opacity: 0.4
|
|
3213
|
-
}, children: fa }),
|
|
3214
|
-
/* @__PURE__ */ r("div", { className: "ss-auth-avatar-overlay", children: [
|
|
3215
|
-
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: P.camera }),
|
|
3216
|
-
/* @__PURE__ */ e("span", { children: "Edit" })
|
|
3217
|
-
] })
|
|
3218
|
-
] }),
|
|
3219
|
-
/* @__PURE__ */ r("div", { className: "ss-auth-profile-info", children: [
|
|
3220
|
-
/* @__PURE__ */ r("h2", { className: "ss-auth-profile-name", children: [
|
|
3221
|
-
(t == null ? void 0 : t.name) || "Unnamed User",
|
|
3222
|
-
(t == null ? void 0 : t.emailVerified) && /* @__PURE__ */ r("span", { className: "ss-auth-badge ss-auth-badge-success", children: [
|
|
3223
|
-
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", style: { fontSize: "12px", fontVariationSettings: "'FILL' 1" }, children: P.verified }),
|
|
3224
|
-
"Verified"
|
|
3225
|
-
] })
|
|
3226
|
-
] }),
|
|
3227
|
-
/* @__PURE__ */ e("p", { className: "ss-auth-profile-desc", children: t == null ? void 0 : t.email })
|
|
3228
|
-
] })
|
|
3229
|
-
] }),
|
|
3230
|
-
/* @__PURE__ */ r("div", { className: "ss-auth-modal-body", children: [
|
|
3231
|
-
c && /* @__PURE__ */ r("div", { className: "ss-auth-error", children: [
|
|
3232
|
-
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: P.errorOutline }),
|
|
3233
|
-
/* @__PURE__ */ e("span", { children: c })
|
|
3234
|
-
] }),
|
|
3235
|
-
d && /* @__PURE__ */ r("div", { className: "ss-auth-info-box", style: { marginBottom: "16px" }, children: [
|
|
3236
|
-
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: P.check }),
|
|
3237
|
-
/* @__PURE__ */ e("span", { children: d })
|
|
3238
|
-
] }),
|
|
3239
|
-
/* @__PURE__ */ r("form", { onSubmit: Z, children: [
|
|
3240
|
-
/* @__PURE__ */ r("div", { className: "ss-auth-field", children: [
|
|
3241
|
-
/* @__PURE__ */ e("label", { className: "ss-auth-label", children: "Full Name" }),
|
|
3242
|
-
/* @__PURE__ */ e(
|
|
3243
|
-
"input",
|
|
3244
|
-
{
|
|
3245
|
-
className: "ss-auth-input",
|
|
3246
|
-
type: "text",
|
|
3247
|
-
placeholder: "Your name",
|
|
3248
|
-
value: C,
|
|
3249
|
-
onChange: (U) => h(U.target.value)
|
|
3250
|
-
}
|
|
3251
|
-
)
|
|
3252
|
-
] }),
|
|
3253
|
-
/* @__PURE__ */ r("div", { className: "ss-auth-profile-grid", style: { marginBottom: "16px" }, children: [
|
|
3254
|
-
/* @__PURE__ */ r("div", { children: [
|
|
3255
|
-
/* @__PURE__ */ e("label", { className: "ss-auth-label", children: "Email Address" }),
|
|
3256
|
-
/* @__PURE__ */ r("div", { style: { position: "relative" }, children: [
|
|
3257
|
-
/* @__PURE__ */ e("input", { className: "ss-auth-input ss-auth-input-readonly", type: "email", value: (t == null ? void 0 : t.email) ?? "", readOnly: !0 }),
|
|
3258
|
-
/* @__PURE__ */ e("span", { className: "ss-auth-visibility-toggle", style: { cursor: "default" }, children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", style: { fontSize: "18px" }, children: P.lock }) })
|
|
3259
|
-
] })
|
|
3260
|
-
] }),
|
|
3261
|
-
/* @__PURE__ */ r("div", { children: [
|
|
3262
|
-
/* @__PURE__ */ e("label", { className: "ss-auth-label", children: "Auth Provider" }),
|
|
3263
|
-
/* @__PURE__ */ e("input", { className: "ss-auth-input ss-auth-input-readonly", type: "text", value: (t == null ? void 0 : t.provider) ?? "", readOnly: !0 })
|
|
3264
|
-
] })
|
|
3265
|
-
] }),
|
|
3266
|
-
/* @__PURE__ */ e("div", { style: { display: "flex", justifyContent: "flex-end" }, children: /* @__PURE__ */ r("button", { type: "submit", className: "ss-auth-btn-primary ss-auth-btn-sm", disabled: l, style: { width: "auto" }, children: [
|
|
3267
|
-
l && /* @__PURE__ */ e("span", { className: "ss-auth-spinner" }),
|
|
3268
|
-
"Save changes"
|
|
3269
|
-
] }) })
|
|
3270
|
-
] }),
|
|
3271
|
-
ha && /* @__PURE__ */ r("div", { className: "ss-auth-section", children: [
|
|
3272
|
-
/* @__PURE__ */ r("div", { className: "ss-auth-section-title", children: [
|
|
3273
|
-
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: P.security }),
|
|
3274
|
-
"Security Credentials"
|
|
3275
|
-
] }),
|
|
3276
|
-
D && /* @__PURE__ */ r("div", { className: "ss-auth-error", style: { marginTop: "16px" }, children: [
|
|
3277
|
-
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: P.errorOutline }),
|
|
3278
|
-
/* @__PURE__ */ e("span", { children: D })
|
|
3279
|
-
] }),
|
|
3280
|
-
/* @__PURE__ */ r("form", { onSubmit: ua, style: { marginTop: "16px" }, children: [
|
|
3281
|
-
/* @__PURE__ */ r("div", { className: "ss-auth-field", children: [
|
|
3282
|
-
/* @__PURE__ */ e("label", { className: "ss-auth-label", children: "Current Password" }),
|
|
3283
|
-
/* @__PURE__ */ e("input", { className: "ss-auth-input", type: "password", placeholder: "••••••••••••", value: I, onChange: (U) => A(U.target.value), required: !0 })
|
|
3284
|
-
] }),
|
|
3285
|
-
/* @__PURE__ */ r("div", { className: "ss-auth-profile-grid", style: { marginBottom: "16px" }, children: [
|
|
3286
|
-
/* @__PURE__ */ r("div", { children: [
|
|
3287
|
-
/* @__PURE__ */ e("label", { className: "ss-auth-label", children: "New Password" }),
|
|
3288
|
-
/* @__PURE__ */ e("input", { className: "ss-auth-input", type: "password", placeholder: "Min. 8 characters", value: S, onChange: (U) => x(U.target.value), required: !0 })
|
|
3289
|
-
] }),
|
|
3290
|
-
/* @__PURE__ */ r("div", { children: [
|
|
3291
|
-
/* @__PURE__ */ e("label", { className: "ss-auth-label", children: "Confirm New Password" }),
|
|
3292
|
-
/* @__PURE__ */ e("input", { className: "ss-auth-input", type: "password", placeholder: "Repeat new password", value: v, onChange: (U) => O(U.target.value), required: !0 })
|
|
3293
|
-
] })
|
|
3294
|
-
] }),
|
|
3295
|
-
/* @__PURE__ */ e("div", { style: { display: "flex", justifyContent: "flex-end" }, children: /* @__PURE__ */ e("button", { type: "submit", className: "ss-auth-btn-ghost", disabled: l, children: "Update Security" }) })
|
|
3296
|
-
] })
|
|
3297
|
-
] }),
|
|
3298
|
-
/* @__PURE__ */ r("div", { className: "ss-auth-section", children: [
|
|
3299
|
-
/* @__PURE__ */ e("div", { className: "ss-auth-section-title", style: { color: "inherit" }, children: "Danger Zone" }),
|
|
3300
|
-
/* @__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." }),
|
|
3301
|
-
w && /* @__PURE__ */ r("div", { className: "ss-auth-error", children: [
|
|
3302
|
-
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: P.errorOutline }),
|
|
3303
|
-
/* @__PURE__ */ e("span", { children: w })
|
|
3304
|
-
] }),
|
|
3305
|
-
T ? /* @__PURE__ */ r("div", { children: [
|
|
3306
|
-
/* @__PURE__ */ r("div", { className: "ss-auth-field", children: [
|
|
3307
|
-
/* @__PURE__ */ e("label", { className: "ss-auth-label", children: "Type your email to confirm" }),
|
|
3308
|
-
/* @__PURE__ */ e(
|
|
3309
|
-
"input",
|
|
3310
|
-
{
|
|
3311
|
-
className: "ss-auth-input",
|
|
3312
|
-
type: "email",
|
|
3313
|
-
placeholder: t == null ? void 0 : t.email,
|
|
3314
|
-
value: F,
|
|
3315
|
-
onChange: (U) => R(U.target.value),
|
|
3316
|
-
autoFocus: !0
|
|
3317
|
-
}
|
|
3318
|
-
)
|
|
3319
|
-
] }),
|
|
3320
|
-
/* @__PURE__ */ r("div", { style: { display: "flex", gap: "8px", justifyContent: "flex-end" }, children: [
|
|
3321
|
-
/* @__PURE__ */ e(
|
|
3322
|
-
"button",
|
|
3323
|
-
{
|
|
3324
|
-
type: "button",
|
|
3325
|
-
className: "ss-auth-btn-ghost",
|
|
3326
|
-
onClick: () => {
|
|
3327
|
-
M(!1), R(""), y(null);
|
|
3328
|
-
},
|
|
3329
|
-
children: "Cancel"
|
|
3330
|
-
}
|
|
3331
|
-
),
|
|
3332
|
-
/* @__PURE__ */ r(
|
|
3333
|
-
"button",
|
|
3334
|
-
{
|
|
3335
|
-
type: "button",
|
|
3336
|
-
className: "ss-auth-btn-primary ss-auth-btn-sm",
|
|
3337
|
-
style: { width: "auto", background: "linear-gradient(135deg, #ef4444, #dc2626)" },
|
|
3338
|
-
disabled: !ga || b,
|
|
3339
|
-
onClick: pa,
|
|
3340
|
-
children: [
|
|
3341
|
-
b && /* @__PURE__ */ e("span", { className: "ss-auth-spinner" }),
|
|
3342
|
-
"Delete account"
|
|
3343
|
-
]
|
|
3344
|
-
}
|
|
3345
|
-
)
|
|
3346
|
-
] })
|
|
3347
|
-
] }) : /* @__PURE__ */ e(
|
|
3348
|
-
"button",
|
|
3349
|
-
{
|
|
3350
|
-
type: "button",
|
|
3351
|
-
className: "ss-auth-btn-outline",
|
|
3352
|
-
style: { borderColor: "currentColor", width: "auto" },
|
|
3353
|
-
onClick: () => M(!0),
|
|
3354
|
-
children: "Delete my account"
|
|
3355
|
-
}
|
|
3356
|
-
)
|
|
3357
|
-
] })
|
|
3358
|
-
] }),
|
|
3359
|
-
z && /* @__PURE__ */ e(
|
|
3360
|
-
ca,
|
|
3361
|
-
{
|
|
3362
|
-
onUpload: Y,
|
|
3363
|
-
onClose: () => E(!1),
|
|
3364
|
-
isLoading: l
|
|
3365
|
-
}
|
|
3366
|
-
)
|
|
3367
|
-
] }) });
|
|
3368
|
-
}
|
|
3369
|
-
function se({ appearance: a }) {
|
|
3370
|
-
const { appearance: s } = L(), { user: t, signOut: o } = ta(), { updateProfile: n, uploadAvatar: u, changePassword: l, isLoading: c, error: d, success: i, setError: f, setSuccess: p } = oa(), m = a ?? s, [b, w] = g((t == null ? void 0 : t.name) ?? ""), [y, C] = g((t == null ? void 0 : t.avatarUrl) ?? ""), [h, N] = g(!1), [k, z] = g(""), [E, I] = g(""), [A, S] = g(""), [x, v] = g(null), O = $(
|
|
3371
|
-
async (F) => {
|
|
3372
|
-
F.preventDefault(), f(null), p(null), await n({ name: b, avatarUrl: y || void 0 });
|
|
4055
|
+
function ie({ appearance: a }) {
|
|
4056
|
+
const { appearance: s } = A(), { user: r, signOut: o } = sa(), { updateProfile: n, uploadAvatar: u, changePassword: i, isLoading: l, error: d, success: c, setError: f, setSuccess: p } = oa(), m = a ?? s, [b, w] = g((r == null ? void 0 : r.name) ?? ""), [y, O] = g((r == null ? void 0 : r.avatarUrl) ?? ""), [h, N] = g(!1), [C, P] = g(""), [I, F] = g(""), [B, $] = g(""), [x, S] = g(null), E = k(
|
|
4057
|
+
async (L) => {
|
|
4058
|
+
L.preventDefault(), f(null), p(null), await n({ name: b, avatarUrl: y || void 0 });
|
|
3373
4059
|
},
|
|
3374
4060
|
[b, y, n, f, p]
|
|
3375
|
-
), D =
|
|
3376
|
-
async (
|
|
3377
|
-
const
|
|
3378
|
-
|
|
4061
|
+
), D = k(
|
|
4062
|
+
async (L) => {
|
|
4063
|
+
const W = await u(L);
|
|
4064
|
+
W && (O(W.avatarUrl), N(!1));
|
|
3379
4065
|
},
|
|
3380
4066
|
[u]
|
|
3381
|
-
),
|
|
3382
|
-
async (
|
|
3383
|
-
if (
|
|
3384
|
-
|
|
4067
|
+
), V = k(
|
|
4068
|
+
async (L) => {
|
|
4069
|
+
if (L.preventDefault(), S(null), f(null), p(null), I !== B) {
|
|
4070
|
+
S("Passwords do not match");
|
|
3385
4071
|
return;
|
|
3386
4072
|
}
|
|
3387
|
-
if (
|
|
3388
|
-
|
|
4073
|
+
if (I.length < 8) {
|
|
4074
|
+
S("Password must be at least 8 characters");
|
|
3389
4075
|
return;
|
|
3390
4076
|
}
|
|
3391
|
-
await
|
|
4077
|
+
await i(C, I) && (P(""), F(""), $(""));
|
|
3392
4078
|
},
|
|
3393
|
-
[
|
|
4079
|
+
[C, I, B, i, f, p]
|
|
3394
4080
|
);
|
|
3395
|
-
if (!
|
|
3396
|
-
const T =
|
|
3397
|
-
return /* @__PURE__ */ e(
|
|
3398
|
-
/* @__PURE__ */
|
|
3399
|
-
/* @__PURE__ */
|
|
4081
|
+
if (!r) return null;
|
|
4082
|
+
const T = r.provider === "email", z = (r.name || r.email).charAt(0).toUpperCase();
|
|
4083
|
+
return /* @__PURE__ */ e(H, { appearance: m, children: /* @__PURE__ */ t("div", { className: "ss-auth-card", style: { maxWidth: "640px" }, children: [
|
|
4084
|
+
/* @__PURE__ */ t("div", { className: "ss-auth-profile-header", children: [
|
|
4085
|
+
/* @__PURE__ */ t("div", { className: "ss-auth-avatar-lg", onClick: () => N(!0), children: [
|
|
3400
4086
|
y ? /* @__PURE__ */ e("img", { src: y, alt: "" }) : /* @__PURE__ */ e("div", { style: {
|
|
3401
4087
|
width: "100%",
|
|
3402
4088
|
height: "100%",
|
|
@@ -3406,34 +4092,34 @@ function se({ appearance: a }) {
|
|
|
3406
4092
|
fontSize: "48px",
|
|
3407
4093
|
fontWeight: 800,
|
|
3408
4094
|
opacity: 0.4
|
|
3409
|
-
}, children:
|
|
3410
|
-
/* @__PURE__ */
|
|
3411
|
-
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children:
|
|
4095
|
+
}, children: z }),
|
|
4096
|
+
/* @__PURE__ */ t("div", { className: "ss-auth-avatar-overlay", children: [
|
|
4097
|
+
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: v.camera }),
|
|
3412
4098
|
/* @__PURE__ */ e("span", { children: "Edit" })
|
|
3413
4099
|
] })
|
|
3414
4100
|
] }),
|
|
3415
|
-
/* @__PURE__ */
|
|
3416
|
-
/* @__PURE__ */
|
|
3417
|
-
|
|
3418
|
-
|
|
3419
|
-
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", style: { fontSize: "12px", fontVariationSettings: "'FILL' 1" }, children:
|
|
4101
|
+
/* @__PURE__ */ t("div", { className: "ss-auth-profile-info", children: [
|
|
4102
|
+
/* @__PURE__ */ t("h2", { className: "ss-auth-profile-name", children: [
|
|
4103
|
+
r.name || "Unnamed User",
|
|
4104
|
+
r.emailVerified && /* @__PURE__ */ t("span", { className: "ss-auth-badge ss-auth-badge-success", children: [
|
|
4105
|
+
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", style: { fontSize: "12px", fontVariationSettings: "'FILL' 1" }, children: v.verified }),
|
|
3420
4106
|
"Verified"
|
|
3421
4107
|
] })
|
|
3422
4108
|
] }),
|
|
3423
|
-
/* @__PURE__ */ e("p", { className: "ss-auth-profile-desc", children:
|
|
4109
|
+
/* @__PURE__ */ e("p", { className: "ss-auth-profile-desc", children: r.email })
|
|
3424
4110
|
] })
|
|
3425
4111
|
] }),
|
|
3426
|
-
/* @__PURE__ */
|
|
3427
|
-
d && /* @__PURE__ */
|
|
3428
|
-
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children:
|
|
4112
|
+
/* @__PURE__ */ t("div", { className: "ss-auth-card-body", children: [
|
|
4113
|
+
d && /* @__PURE__ */ t("div", { className: "ss-auth-error", children: [
|
|
4114
|
+
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: v.errorOutline }),
|
|
3429
4115
|
/* @__PURE__ */ e("span", { children: d })
|
|
3430
4116
|
] }),
|
|
3431
|
-
|
|
3432
|
-
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children:
|
|
3433
|
-
/* @__PURE__ */ e("span", { children:
|
|
4117
|
+
c && /* @__PURE__ */ t("div", { className: "ss-auth-info-box", style: { marginBottom: "16px" }, children: [
|
|
4118
|
+
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: v.check }),
|
|
4119
|
+
/* @__PURE__ */ e("span", { children: c })
|
|
3434
4120
|
] }),
|
|
3435
|
-
/* @__PURE__ */
|
|
3436
|
-
/* @__PURE__ */
|
|
4121
|
+
/* @__PURE__ */ t("form", { onSubmit: E, children: [
|
|
4122
|
+
/* @__PURE__ */ t("div", { className: "ss-auth-field", children: [
|
|
3437
4123
|
/* @__PURE__ */ e("label", { className: "ss-auth-label", children: "Full Name" }),
|
|
3438
4124
|
/* @__PURE__ */ e(
|
|
3439
4125
|
"input",
|
|
@@ -3442,43 +4128,43 @@ function se({ appearance: a }) {
|
|
|
3442
4128
|
type: "text",
|
|
3443
4129
|
placeholder: "Your name",
|
|
3444
4130
|
value: b,
|
|
3445
|
-
onChange: (
|
|
4131
|
+
onChange: (L) => w(L.target.value)
|
|
3446
4132
|
}
|
|
3447
4133
|
)
|
|
3448
4134
|
] }),
|
|
3449
|
-
/* @__PURE__ */
|
|
3450
|
-
/* @__PURE__ */
|
|
4135
|
+
/* @__PURE__ */ t("div", { className: "ss-auth-profile-grid", style: { marginBottom: "16px" }, children: [
|
|
4136
|
+
/* @__PURE__ */ t("div", { children: [
|
|
3451
4137
|
/* @__PURE__ */ e("label", { className: "ss-auth-label", children: "Email Address" }),
|
|
3452
|
-
/* @__PURE__ */
|
|
3453
|
-
/* @__PURE__ */ e("input", { className: "ss-auth-input ss-auth-input-readonly", type: "email", value:
|
|
3454
|
-
/* @__PURE__ */ e("span", { className: "ss-auth-visibility-toggle", style: { cursor: "default" }, children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", style: { fontSize: "18px" }, children:
|
|
4138
|
+
/* @__PURE__ */ t("div", { style: { position: "relative" }, children: [
|
|
4139
|
+
/* @__PURE__ */ e("input", { className: "ss-auth-input ss-auth-input-readonly", type: "email", value: r.email, readOnly: !0 }),
|
|
4140
|
+
/* @__PURE__ */ e("span", { className: "ss-auth-visibility-toggle", style: { cursor: "default" }, children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", style: { fontSize: "18px" }, children: v.lock }) })
|
|
3455
4141
|
] })
|
|
3456
4142
|
] }),
|
|
3457
|
-
/* @__PURE__ */
|
|
4143
|
+
/* @__PURE__ */ t("div", { children: [
|
|
3458
4144
|
/* @__PURE__ */ e("label", { className: "ss-auth-label", children: "Auth Provider" }),
|
|
3459
|
-
/* @__PURE__ */
|
|
3460
|
-
/* @__PURE__ */ e("input", { className: "ss-auth-input ss-auth-input-readonly", type: "text", value:
|
|
3461
|
-
/* @__PURE__ */ e("span", { className: "ss-auth-visibility-toggle", style: { cursor: "default" }, children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", style: { fontSize: "18px" }, children:
|
|
4145
|
+
/* @__PURE__ */ t("div", { style: { position: "relative" }, children: [
|
|
4146
|
+
/* @__PURE__ */ e("input", { className: "ss-auth-input ss-auth-input-readonly", type: "text", value: r.provider, readOnly: !0 }),
|
|
4147
|
+
/* @__PURE__ */ e("span", { className: "ss-auth-visibility-toggle", style: { cursor: "default" }, children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", style: { fontSize: "18px" }, children: v.cloudDone }) })
|
|
3462
4148
|
] })
|
|
3463
4149
|
] })
|
|
3464
4150
|
] }),
|
|
3465
|
-
/* @__PURE__ */ e("div", { style: { display: "flex", justifyContent: "flex-end" }, children: /* @__PURE__ */
|
|
3466
|
-
|
|
4151
|
+
/* @__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: l, style: { width: "auto" }, children: [
|
|
4152
|
+
l && /* @__PURE__ */ e("span", { className: "ss-auth-spinner" }),
|
|
3467
4153
|
"Save changes"
|
|
3468
4154
|
] }) })
|
|
3469
4155
|
] }),
|
|
3470
|
-
T && /* @__PURE__ */
|
|
3471
|
-
/* @__PURE__ */
|
|
3472
|
-
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children:
|
|
4156
|
+
T && /* @__PURE__ */ t("div", { className: "ss-auth-section", children: [
|
|
4157
|
+
/* @__PURE__ */ t("div", { className: "ss-auth-section-title", children: [
|
|
4158
|
+
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: v.security }),
|
|
3473
4159
|
"Security Credentials"
|
|
3474
4160
|
] }),
|
|
3475
4161
|
/* @__PURE__ */ e("p", { className: "ss-auth-section-desc", style: { marginBottom: "24px" }, children: "Update your password to keep your account secure." }),
|
|
3476
|
-
x && /* @__PURE__ */
|
|
3477
|
-
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children:
|
|
4162
|
+
x && /* @__PURE__ */ t("div", { className: "ss-auth-error", children: [
|
|
4163
|
+
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: v.errorOutline }),
|
|
3478
4164
|
/* @__PURE__ */ e("span", { children: x })
|
|
3479
4165
|
] }),
|
|
3480
|
-
/* @__PURE__ */
|
|
3481
|
-
/* @__PURE__ */
|
|
4166
|
+
/* @__PURE__ */ t("form", { onSubmit: V, children: [
|
|
4167
|
+
/* @__PURE__ */ t("div", { className: "ss-auth-field", children: [
|
|
3482
4168
|
/* @__PURE__ */ e("label", { className: "ss-auth-label", children: "Current Password" }),
|
|
3483
4169
|
/* @__PURE__ */ e(
|
|
3484
4170
|
"input",
|
|
@@ -3486,14 +4172,14 @@ function se({ appearance: a }) {
|
|
|
3486
4172
|
className: "ss-auth-input",
|
|
3487
4173
|
type: "password",
|
|
3488
4174
|
placeholder: "••••••••••••",
|
|
3489
|
-
value:
|
|
3490
|
-
onChange: (
|
|
4175
|
+
value: C,
|
|
4176
|
+
onChange: (L) => P(L.target.value),
|
|
3491
4177
|
required: !0
|
|
3492
4178
|
}
|
|
3493
4179
|
)
|
|
3494
4180
|
] }),
|
|
3495
|
-
/* @__PURE__ */
|
|
3496
|
-
/* @__PURE__ */
|
|
4181
|
+
/* @__PURE__ */ t("div", { className: "ss-auth-profile-grid", style: { marginBottom: "16px" }, children: [
|
|
4182
|
+
/* @__PURE__ */ t("div", { children: [
|
|
3497
4183
|
/* @__PURE__ */ e("label", { className: "ss-auth-label", children: "New Password" }),
|
|
3498
4184
|
/* @__PURE__ */ e(
|
|
3499
4185
|
"input",
|
|
@@ -3501,13 +4187,13 @@ function se({ appearance: a }) {
|
|
|
3501
4187
|
className: "ss-auth-input",
|
|
3502
4188
|
type: "password",
|
|
3503
4189
|
placeholder: "Min. 8 characters",
|
|
3504
|
-
value:
|
|
3505
|
-
onChange: (
|
|
4190
|
+
value: I,
|
|
4191
|
+
onChange: (L) => F(L.target.value),
|
|
3506
4192
|
required: !0
|
|
3507
4193
|
}
|
|
3508
4194
|
)
|
|
3509
4195
|
] }),
|
|
3510
|
-
/* @__PURE__ */
|
|
4196
|
+
/* @__PURE__ */ t("div", { children: [
|
|
3511
4197
|
/* @__PURE__ */ e("label", { className: "ss-auth-label", children: "Confirm New Password" }),
|
|
3512
4198
|
/* @__PURE__ */ e(
|
|
3513
4199
|
"input",
|
|
@@ -3515,24 +4201,24 @@ function se({ appearance: a }) {
|
|
|
3515
4201
|
className: "ss-auth-input",
|
|
3516
4202
|
type: "password",
|
|
3517
4203
|
placeholder: "Repeat new password",
|
|
3518
|
-
value:
|
|
3519
|
-
onChange: (
|
|
4204
|
+
value: B,
|
|
4205
|
+
onChange: (L) => $(L.target.value),
|
|
3520
4206
|
required: !0
|
|
3521
4207
|
}
|
|
3522
4208
|
)
|
|
3523
4209
|
] })
|
|
3524
4210
|
] }),
|
|
3525
|
-
/* @__PURE__ */
|
|
3526
|
-
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children:
|
|
4211
|
+
/* @__PURE__ */ t("div", { className: "ss-auth-info-box", style: { marginBottom: "16px" }, children: [
|
|
4212
|
+
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: v.info }),
|
|
3527
4213
|
/* @__PURE__ */ e("span", { children: "Password must be at least 8 characters long." })
|
|
3528
4214
|
] }),
|
|
3529
|
-
/* @__PURE__ */ e("div", { style: { display: "flex", justifyContent: "flex-end" }, children: /* @__PURE__ */ e("button", { type: "submit", className: "ss-auth-btn-ghost", disabled:
|
|
4215
|
+
/* @__PURE__ */ e("div", { style: { display: "flex", justifyContent: "flex-end" }, children: /* @__PURE__ */ e("button", { type: "submit", className: "ss-auth-btn-ghost", disabled: l, children: "Update Security" }) })
|
|
3530
4216
|
] })
|
|
3531
4217
|
] }),
|
|
3532
|
-
/* @__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__ */
|
|
3533
|
-
/* @__PURE__ */
|
|
3534
|
-
/* @__PURE__ */ e("div", { className: "ss-auth-signout-icon", children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children:
|
|
3535
|
-
/* @__PURE__ */
|
|
4218
|
+
/* @__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: [
|
|
4219
|
+
/* @__PURE__ */ t("div", { className: "ss-auth-signout-info", children: [
|
|
4220
|
+
/* @__PURE__ */ e("div", { className: "ss-auth-signout-icon", children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: v.logout }) }),
|
|
4221
|
+
/* @__PURE__ */ t("div", { children: [
|
|
3536
4222
|
/* @__PURE__ */ e("div", { className: "ss-auth-signout-title", children: "End Session" }),
|
|
3537
4223
|
/* @__PURE__ */ e("div", { className: "ss-auth-signout-desc", children: "Terminate your active session" })
|
|
3538
4224
|
] })
|
|
@@ -3554,93 +4240,93 @@ function se({ appearance: a }) {
|
|
|
3554
4240
|
{
|
|
3555
4241
|
onUpload: D,
|
|
3556
4242
|
onClose: () => N(!1),
|
|
3557
|
-
isLoading:
|
|
4243
|
+
isLoading: l
|
|
3558
4244
|
}
|
|
3559
4245
|
)
|
|
3560
4246
|
] }) });
|
|
3561
4247
|
}
|
|
3562
|
-
function
|
|
3563
|
-
const { appearance:
|
|
3564
|
-
|
|
4248
|
+
function le({ appearance: a, onOrgChange: s }) {
|
|
4249
|
+
const { appearance: r } = A(), { orgs: o, selectedOrg: n, selectOrg: u, createOrg: i, isLoading: l } = Y(), d = a ?? r, [c, f] = g(!1), [p, m] = g(""), [b, w] = g(""), [y, O] = g(null), [h, N] = g(!1), C = _(null), P = k((x) => {
|
|
4250
|
+
C.current && !x.composedPath().includes(C.current) && f(!1);
|
|
3565
4251
|
}, []);
|
|
3566
|
-
|
|
3567
|
-
if (
|
|
4252
|
+
U(() => {
|
|
4253
|
+
if (c) {
|
|
3568
4254
|
const x = setTimeout(() => {
|
|
3569
|
-
document.addEventListener("click",
|
|
4255
|
+
document.addEventListener("click", P);
|
|
3570
4256
|
}, 0);
|
|
3571
4257
|
return () => {
|
|
3572
|
-
clearTimeout(x), document.removeEventListener("click",
|
|
4258
|
+
clearTimeout(x), document.removeEventListener("click", P);
|
|
3573
4259
|
};
|
|
3574
4260
|
}
|
|
3575
|
-
}, [
|
|
3576
|
-
const
|
|
4261
|
+
}, [c, P]);
|
|
4262
|
+
const I = k((x) => {
|
|
3577
4263
|
m(x), w(x.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, ""));
|
|
3578
|
-
}, []),
|
|
4264
|
+
}, []), F = k(
|
|
3579
4265
|
async (x) => {
|
|
3580
|
-
x.preventDefault(),
|
|
4266
|
+
x.preventDefault(), O(null), N(!0);
|
|
3581
4267
|
try {
|
|
3582
|
-
const
|
|
3583
|
-
|
|
3584
|
-
} catch (
|
|
3585
|
-
|
|
4268
|
+
const S = await i(p, b);
|
|
4269
|
+
S && (await u(S.id), s == null || s(S), m(""), w(""), f(!1));
|
|
4270
|
+
} catch (S) {
|
|
4271
|
+
O(S instanceof Error ? S.message : "Failed to create organization");
|
|
3586
4272
|
} finally {
|
|
3587
4273
|
N(!1);
|
|
3588
4274
|
}
|
|
3589
4275
|
},
|
|
3590
|
-
[p, b,
|
|
4276
|
+
[p, b, i, u, s]
|
|
3591
4277
|
);
|
|
3592
|
-
if (
|
|
3593
|
-
const
|
|
3594
|
-
return /* @__PURE__ */ e(
|
|
3595
|
-
/* @__PURE__ */
|
|
4278
|
+
if (l) return null;
|
|
4279
|
+
const B = (n == null ? void 0 : n.name) ?? (o.length === 0 ? "No organization" : "Select organization"), $ = n ? n.name.split(" ").map((x) => x[0]).join("").slice(0, 2).toUpperCase() : "--";
|
|
4280
|
+
return /* @__PURE__ */ e(H, { appearance: d, children: /* @__PURE__ */ t("div", { style: { position: "relative", display: "inline-block", width: "100%", maxWidth: "360px" }, ref: C, children: [
|
|
4281
|
+
/* @__PURE__ */ t(
|
|
3596
4282
|
"button",
|
|
3597
4283
|
{
|
|
3598
4284
|
type: "button",
|
|
3599
4285
|
className: "ss-auth-org-trigger",
|
|
3600
|
-
onClick: () => f(!
|
|
4286
|
+
onClick: () => f(!c),
|
|
3601
4287
|
children: [
|
|
3602
|
-
/* @__PURE__ */
|
|
3603
|
-
/* @__PURE__ */ e("div", { className: "ss-auth-org-avatar", children:
|
|
3604
|
-
/* @__PURE__ */
|
|
4288
|
+
/* @__PURE__ */ t("div", { className: "ss-auth-org-trigger-inner", children: [
|
|
4289
|
+
/* @__PURE__ */ e("div", { className: "ss-auth-org-avatar", children: $ }),
|
|
4290
|
+
/* @__PURE__ */ t("div", { style: { textAlign: "left" }, children: [
|
|
3605
4291
|
/* @__PURE__ */ e("div", { className: "ss-auth-org-trigger-label", children: "Current Organization" }),
|
|
3606
|
-
/* @__PURE__ */ e("div", { className: "ss-auth-org-trigger-name", children:
|
|
4292
|
+
/* @__PURE__ */ e("div", { className: "ss-auth-org-trigger-name", children: B })
|
|
3607
4293
|
] })
|
|
3608
4294
|
] }),
|
|
3609
|
-
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children:
|
|
4295
|
+
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: v.unfoldMore })
|
|
3610
4296
|
]
|
|
3611
4297
|
}
|
|
3612
4298
|
),
|
|
3613
|
-
|
|
4299
|
+
c && /* @__PURE__ */ t("div", { className: "ss-auth-dropdown ss-auth-dropdown-left ss-auth-glass-panel", style: { width: "100%" }, children: [
|
|
3614
4300
|
/* @__PURE__ */ e("div", { className: "ss-auth-section-label", children: "Your Organizations" }),
|
|
3615
4301
|
/* @__PURE__ */ e("div", { style: { padding: "0 8px 4px" }, children: o.map((x) => {
|
|
3616
|
-
const
|
|
3617
|
-
return /* @__PURE__ */
|
|
4302
|
+
const S = (n == null ? void 0 : n.id) === x.id, E = x.name.split(" ").map((D) => D[0]).join("").slice(0, 2).toUpperCase();
|
|
4303
|
+
return /* @__PURE__ */ t(
|
|
3618
4304
|
"button",
|
|
3619
4305
|
{
|
|
3620
4306
|
type: "button",
|
|
3621
|
-
className: `ss-auth-org-item${
|
|
4307
|
+
className: `ss-auth-org-item${S ? " ss-auth-org-item-active" : ""}`,
|
|
3622
4308
|
onClick: async () => {
|
|
3623
4309
|
f(!1), await u(x.id), s == null || s(x);
|
|
3624
4310
|
},
|
|
3625
4311
|
children: [
|
|
3626
|
-
/* @__PURE__ */
|
|
3627
|
-
/* @__PURE__ */ e("div", { className: `ss-auth-org-avatar${
|
|
4312
|
+
/* @__PURE__ */ t("div", { className: "ss-auth-org-item-inner", children: [
|
|
4313
|
+
/* @__PURE__ */ e("div", { className: `ss-auth-org-avatar${S ? "" : " ss-auth-org-avatar-inactive"}`, children: E }),
|
|
3628
4314
|
/* @__PURE__ */ e("span", { style: { fontFamily: "'Manrope', sans-serif", letterSpacing: "-0.01em" }, children: x.name })
|
|
3629
4315
|
] }),
|
|
3630
|
-
|
|
4316
|
+
S && /* @__PURE__ */ e("span", { className: "material-symbols-outlined ss-auth-org-check", style: { fontSize: "18px" }, children: v.checkCircle })
|
|
3631
4317
|
]
|
|
3632
4318
|
},
|
|
3633
4319
|
x.id
|
|
3634
4320
|
);
|
|
3635
4321
|
}) }),
|
|
3636
|
-
/* @__PURE__ */
|
|
3637
|
-
/* @__PURE__ */
|
|
3638
|
-
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children:
|
|
4322
|
+
/* @__PURE__ */ t("div", { className: "ss-auth-org-create", children: [
|
|
4323
|
+
/* @__PURE__ */ t("div", { className: "ss-auth-org-create-header", children: [
|
|
4324
|
+
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: v.addCircle }),
|
|
3639
4325
|
/* @__PURE__ */ e("span", { children: "Create organization" })
|
|
3640
4326
|
] }),
|
|
3641
4327
|
y && /* @__PURE__ */ e("div", { className: "ss-auth-error", style: { marginBottom: "12px", fontSize: "12px" }, children: /* @__PURE__ */ e("span", { children: y }) }),
|
|
3642
|
-
/* @__PURE__ */
|
|
3643
|
-
/* @__PURE__ */
|
|
4328
|
+
/* @__PURE__ */ t("form", { onSubmit: F, children: [
|
|
4329
|
+
/* @__PURE__ */ t("div", { className: "ss-auth-field", children: [
|
|
3644
4330
|
/* @__PURE__ */ e("label", { className: "ss-auth-label", style: { fontSize: "10px" }, children: "Org Name" }),
|
|
3645
4331
|
/* @__PURE__ */ e(
|
|
3646
4332
|
"input",
|
|
@@ -3649,15 +4335,15 @@ function ne({ appearance: a, onOrgChange: s }) {
|
|
|
3649
4335
|
type: "text",
|
|
3650
4336
|
placeholder: "e.g. Nexus Dynamics",
|
|
3651
4337
|
value: p,
|
|
3652
|
-
onChange: (x) =>
|
|
4338
|
+
onChange: (x) => I(x.target.value),
|
|
3653
4339
|
required: !0,
|
|
3654
4340
|
style: { fontSize: "13px", padding: "10px 12px" }
|
|
3655
4341
|
}
|
|
3656
4342
|
)
|
|
3657
4343
|
] }),
|
|
3658
|
-
/* @__PURE__ */
|
|
4344
|
+
/* @__PURE__ */ t("div", { className: "ss-auth-field", children: [
|
|
3659
4345
|
/* @__PURE__ */ e("label", { className: "ss-auth-label", style: { fontSize: "10px" }, children: "Workspace Slug" }),
|
|
3660
|
-
/* @__PURE__ */
|
|
4346
|
+
/* @__PURE__ */ t("div", { style: { position: "relative" }, children: [
|
|
3661
4347
|
/* @__PURE__ */ e("span", { className: "ss-auth-org-slug-prefix", children: "/" }),
|
|
3662
4348
|
/* @__PURE__ */ e(
|
|
3663
4349
|
"input",
|
|
@@ -3673,7 +4359,7 @@ function ne({ appearance: a, onOrgChange: s }) {
|
|
|
3673
4359
|
)
|
|
3674
4360
|
] })
|
|
3675
4361
|
] }),
|
|
3676
|
-
/* @__PURE__ */
|
|
4362
|
+
/* @__PURE__ */ t(
|
|
3677
4363
|
"button",
|
|
3678
4364
|
{
|
|
3679
4365
|
type: "submit",
|
|
@@ -3691,35 +4377,35 @@ function ne({ appearance: a, onOrgChange: s }) {
|
|
|
3691
4377
|
] })
|
|
3692
4378
|
] }) });
|
|
3693
4379
|
}
|
|
3694
|
-
function
|
|
4380
|
+
function Ba(a, s = "USD") {
|
|
3695
4381
|
return new Intl.NumberFormat("en-US", {
|
|
3696
4382
|
style: "currency",
|
|
3697
4383
|
currency: s,
|
|
3698
4384
|
minimumFractionDigits: a % 100 === 0 ? 0 : 2
|
|
3699
4385
|
}).format(a / 100);
|
|
3700
4386
|
}
|
|
3701
|
-
function
|
|
3702
|
-
const { appearance: u } =
|
|
3703
|
-
return /* @__PURE__ */ e(
|
|
3704
|
-
const
|
|
3705
|
-
return /* @__PURE__ */
|
|
3706
|
-
/* @__PURE__ */
|
|
4387
|
+
function ce({ plans: a, currentPlanId: s, onSelectPlan: r, interval: o, appearance: n }) {
|
|
4388
|
+
const { appearance: u } = A(), i = n ?? u, l = o ? a.filter((d) => d.interval === o || d.isFree) : a;
|
|
4389
|
+
return /* @__PURE__ */ e(H, { appearance: i, children: /* @__PURE__ */ e("div", { className: "ss-pricing-grid", children: l.map((d) => {
|
|
4390
|
+
const c = d.id === s;
|
|
4391
|
+
return /* @__PURE__ */ t("div", { className: `ss-pricing-card ${c ? "ss-pricing-card-current" : ""}`, children: [
|
|
4392
|
+
/* @__PURE__ */ t("div", { className: "ss-pricing-header", children: [
|
|
3707
4393
|
/* @__PURE__ */ e("h3", { className: "ss-pricing-name", children: d.name }),
|
|
3708
|
-
d.trialDays > 0 && /* @__PURE__ */
|
|
4394
|
+
d.trialDays > 0 && /* @__PURE__ */ t("span", { className: "ss-badge ss-badge-trialing", children: [
|
|
3709
4395
|
d.trialDays,
|
|
3710
4396
|
"-day trial"
|
|
3711
4397
|
] }),
|
|
3712
4398
|
d.isFree && /* @__PURE__ */ e("span", { className: "ss-badge ss-badge-active", children: "Free" })
|
|
3713
4399
|
] }),
|
|
3714
|
-
/* @__PURE__ */ e("div", { className: "ss-pricing-price", children: d.isFree ? /* @__PURE__ */ e("span", { className: "ss-pricing-amount", children: "Free" }) : /* @__PURE__ */
|
|
3715
|
-
/* @__PURE__ */ e("span", { className: "ss-pricing-amount", children:
|
|
3716
|
-
/* @__PURE__ */
|
|
4400
|
+
/* @__PURE__ */ e("div", { className: "ss-pricing-price", children: d.isFree ? /* @__PURE__ */ e("span", { className: "ss-pricing-amount", children: "Free" }) : /* @__PURE__ */ t(j, { children: [
|
|
4401
|
+
/* @__PURE__ */ e("span", { className: "ss-pricing-amount", children: Ba(d.amountCents, d.currency) }),
|
|
4402
|
+
/* @__PURE__ */ t("span", { className: "ss-pricing-interval", children: [
|
|
3717
4403
|
"/",
|
|
3718
4404
|
d.interval
|
|
3719
4405
|
] })
|
|
3720
4406
|
] }) }),
|
|
3721
4407
|
d.description && /* @__PURE__ */ e("p", { className: "ss-pricing-desc", children: d.description }),
|
|
3722
|
-
d.features.length > 0 && /* @__PURE__ */ e("ul", { className: "ss-pricing-features", children: d.features.map((f, p) => /* @__PURE__ */
|
|
4408
|
+
d.features.length > 0 && /* @__PURE__ */ e("ul", { className: "ss-pricing-features", children: d.features.map((f, p) => /* @__PURE__ */ t("li", { className: "ss-pricing-feature", children: [
|
|
3723
4409
|
/* @__PURE__ */ e("span", { className: "ss-check", children: "✓" }),
|
|
3724
4410
|
" ",
|
|
3725
4411
|
f
|
|
@@ -3728,167 +4414,167 @@ function oe({ plans: a, currentPlanId: s, onSelectPlan: t, interval: o, appearan
|
|
|
3728
4414
|
"button",
|
|
3729
4415
|
{
|
|
3730
4416
|
type: "button",
|
|
3731
|
-
className: `ss-btn ${
|
|
3732
|
-
disabled:
|
|
3733
|
-
onClick: () =>
|
|
3734
|
-
children:
|
|
4417
|
+
className: `ss-btn ${c ? "ss-btn-current" : "ss-btn-primary"}`,
|
|
4418
|
+
disabled: c,
|
|
4419
|
+
onClick: () => r(d.id),
|
|
4420
|
+
children: c ? "Current plan" : "Select plan"
|
|
3735
4421
|
}
|
|
3736
4422
|
)
|
|
3737
4423
|
] }, d.id);
|
|
3738
4424
|
}) }) });
|
|
3739
4425
|
}
|
|
3740
|
-
function
|
|
3741
|
-
const { client: a } =
|
|
4426
|
+
function de() {
|
|
4427
|
+
const { client: a } = A();
|
|
3742
4428
|
return { billing: a.billing };
|
|
3743
4429
|
}
|
|
3744
|
-
function
|
|
3745
|
-
const { client: s } =
|
|
3746
|
-
return
|
|
4430
|
+
function Z(a) {
|
|
4431
|
+
const { client: s } = A();
|
|
4432
|
+
return G(() => {
|
|
3747
4433
|
if (a) {
|
|
3748
|
-
const
|
|
3749
|
-
return new
|
|
4434
|
+
const r = new Q("https://api.saas-support.com/v1", { type: "portalToken", token: a });
|
|
4435
|
+
return new ya(r);
|
|
3750
4436
|
}
|
|
3751
4437
|
return s.billing;
|
|
3752
4438
|
}, [s, a]);
|
|
3753
4439
|
}
|
|
3754
|
-
function
|
|
3755
|
-
const
|
|
3756
|
-
|
|
4440
|
+
function La(a, s) {
|
|
4441
|
+
const r = Z(s), [o, n] = g(null), [u, i] = g(!0), [l, d] = g(null), c = k(async () => {
|
|
4442
|
+
i(!0), d(null);
|
|
3757
4443
|
try {
|
|
3758
|
-
const f = await
|
|
4444
|
+
const f = await r.getCustomer(a);
|
|
3759
4445
|
n(f);
|
|
3760
4446
|
} catch (f) {
|
|
3761
4447
|
d(f instanceof Error ? f.message : "Failed to load subscription");
|
|
3762
4448
|
} finally {
|
|
3763
|
-
|
|
4449
|
+
i(!1);
|
|
3764
4450
|
}
|
|
3765
|
-
}, [
|
|
3766
|
-
return
|
|
3767
|
-
|
|
3768
|
-
}, [
|
|
4451
|
+
}, [r, a]);
|
|
4452
|
+
return U(() => {
|
|
4453
|
+
c();
|
|
4454
|
+
}, [c]), { customer: o, isLoading: u, error: l, refresh: c };
|
|
3769
4455
|
}
|
|
3770
|
-
function
|
|
3771
|
-
const
|
|
3772
|
-
|
|
4456
|
+
function Aa(a, s) {
|
|
4457
|
+
const r = Z(s), [o, n] = g([]), [u, i] = g(!0), [l, d] = g(null), c = k(async () => {
|
|
4458
|
+
i(!0), d(null);
|
|
3773
4459
|
try {
|
|
3774
|
-
const f = await
|
|
4460
|
+
const f = await r.getInvoices(a);
|
|
3775
4461
|
n(f);
|
|
3776
4462
|
} catch (f) {
|
|
3777
4463
|
d(f instanceof Error ? f.message : "Failed to load invoices");
|
|
3778
4464
|
} finally {
|
|
3779
|
-
|
|
4465
|
+
i(!1);
|
|
3780
4466
|
}
|
|
3781
|
-
}, [
|
|
3782
|
-
return
|
|
3783
|
-
|
|
3784
|
-
}, [
|
|
4467
|
+
}, [r, a]);
|
|
4468
|
+
return U(() => {
|
|
4469
|
+
c();
|
|
4470
|
+
}, [c]), { invoices: o, isLoading: u, error: l, refresh: c };
|
|
3785
4471
|
}
|
|
3786
|
-
function
|
|
3787
|
-
const
|
|
3788
|
-
|
|
4472
|
+
function Da(a, s) {
|
|
4473
|
+
const r = Z(s), [o, n] = g([]), [u, i] = g(!0), [l, d] = g(null), c = k(async () => {
|
|
4474
|
+
i(!0), d(null);
|
|
3789
4475
|
try {
|
|
3790
|
-
const f = await
|
|
4476
|
+
const f = await r.getCurrentUsage(a);
|
|
3791
4477
|
n(f);
|
|
3792
4478
|
} catch (f) {
|
|
3793
4479
|
d(f instanceof Error ? f.message : "Failed to load usage");
|
|
3794
4480
|
} finally {
|
|
3795
|
-
|
|
4481
|
+
i(!1);
|
|
3796
4482
|
}
|
|
3797
|
-
}, [
|
|
3798
|
-
return
|
|
3799
|
-
|
|
3800
|
-
}, [
|
|
4483
|
+
}, [r, a]);
|
|
4484
|
+
return U(() => {
|
|
4485
|
+
c();
|
|
4486
|
+
}, [c]), { usage: o, isLoading: u, error: l, refresh: c };
|
|
3801
4487
|
}
|
|
3802
|
-
const
|
|
4488
|
+
const Ta = {
|
|
3803
4489
|
active: "ss-badge-active"
|
|
3804
4490
|
};
|
|
3805
|
-
function
|
|
4491
|
+
function Ma({
|
|
3806
4492
|
customerId: a,
|
|
3807
4493
|
portalToken: s,
|
|
3808
|
-
onChangePlan:
|
|
4494
|
+
onChangePlan: r,
|
|
3809
4495
|
onCancel: o,
|
|
3810
4496
|
appearance: n
|
|
3811
4497
|
}) {
|
|
3812
|
-
const { appearance: u } =
|
|
3813
|
-
return /* @__PURE__ */ e(
|
|
4498
|
+
const { appearance: u } = A(), { customer: i, isLoading: l, error: d } = La(a, s);
|
|
4499
|
+
return /* @__PURE__ */ e(H, { appearance: n ?? u, children: /* @__PURE__ */ t("div", { className: "ss-card", children: [
|
|
3814
4500
|
/* @__PURE__ */ e("h2", { className: "ss-title", children: "Subscription" }),
|
|
3815
|
-
|
|
4501
|
+
l && /* @__PURE__ */ t("div", { className: "ss-loading", children: [
|
|
3816
4502
|
/* @__PURE__ */ e("span", { className: "ss-spinner" }),
|
|
3817
4503
|
" Loading..."
|
|
3818
4504
|
] }),
|
|
3819
4505
|
d && /* @__PURE__ */ e("div", { className: "ss-global-error", children: d }),
|
|
3820
|
-
|
|
3821
|
-
/* @__PURE__ */
|
|
4506
|
+
i && !l && /* @__PURE__ */ t(j, { children: [
|
|
4507
|
+
/* @__PURE__ */ t("div", { className: "ss-field", children: [
|
|
3822
4508
|
/* @__PURE__ */ e("label", { className: "ss-label", children: "Customer" }),
|
|
3823
|
-
/* @__PURE__ */ e("input", { className: "ss-input", value:
|
|
4509
|
+
/* @__PURE__ */ e("input", { className: "ss-input", value: i.name || i.email, disabled: !0, readOnly: !0 })
|
|
3824
4510
|
] }),
|
|
3825
|
-
/* @__PURE__ */
|
|
4511
|
+
/* @__PURE__ */ t("div", { className: "ss-field", children: [
|
|
3826
4512
|
/* @__PURE__ */ e("label", { className: "ss-label", children: "Status" }),
|
|
3827
|
-
/* @__PURE__ */ e("div", { children: /* @__PURE__ */ e("span", { className: `ss-badge ${
|
|
4513
|
+
/* @__PURE__ */ e("div", { children: /* @__PURE__ */ e("span", { className: `ss-badge ${Ta.active}`, children: "Active" }) })
|
|
3828
4514
|
] }),
|
|
3829
|
-
/* @__PURE__ */
|
|
3830
|
-
|
|
4515
|
+
/* @__PURE__ */ t("div", { className: "ss-btn-group", children: [
|
|
4516
|
+
r && /* @__PURE__ */ e("button", { type: "button", className: "ss-btn ss-btn-primary", onClick: r, children: "Change plan" }),
|
|
3831
4517
|
o && /* @__PURE__ */ e("button", { type: "button", className: "ss-btn ss-btn-danger", onClick: o, children: "Cancel subscription" })
|
|
3832
4518
|
] })
|
|
3833
4519
|
] })
|
|
3834
4520
|
] }) });
|
|
3835
4521
|
}
|
|
3836
|
-
const
|
|
4522
|
+
const Ua = {
|
|
3837
4523
|
paid: "ss-badge-active",
|
|
3838
4524
|
open: "ss-badge-trialing",
|
|
3839
4525
|
draft: "ss-badge-paused",
|
|
3840
4526
|
void: "ss-badge-canceled",
|
|
3841
4527
|
uncollectible: "ss-badge-past-due"
|
|
3842
4528
|
};
|
|
3843
|
-
function
|
|
4529
|
+
function Va(a) {
|
|
3844
4530
|
return new Date(a).toLocaleDateString("en-US", { year: "numeric", month: "short", day: "numeric" });
|
|
3845
4531
|
}
|
|
3846
|
-
function
|
|
4532
|
+
function Ra(a) {
|
|
3847
4533
|
return new Intl.NumberFormat("en-US", { style: "currency", currency: "USD", minimumFractionDigits: 2 }).format(a / 100);
|
|
3848
4534
|
}
|
|
3849
|
-
function
|
|
3850
|
-
const { appearance: o } =
|
|
3851
|
-
return /* @__PURE__ */ e(
|
|
4535
|
+
function Ha({ customerId: a, portalToken: s, appearance: r }) {
|
|
4536
|
+
const { appearance: o } = A(), { invoices: n, isLoading: u, error: i } = Aa(a, s), l = r ?? o, d = [...n].sort((c, f) => new Date(f.createdAt).getTime() - new Date(c.createdAt).getTime());
|
|
4537
|
+
return /* @__PURE__ */ e(H, { appearance: l, children: /* @__PURE__ */ t("div", { className: "ss-card ss-card-wide", children: [
|
|
3852
4538
|
/* @__PURE__ */ e("h2", { className: "ss-title", children: "Invoices" }),
|
|
3853
|
-
u && /* @__PURE__ */
|
|
4539
|
+
u && /* @__PURE__ */ t("div", { className: "ss-loading", children: [
|
|
3854
4540
|
/* @__PURE__ */ e("span", { className: "ss-spinner" }),
|
|
3855
4541
|
" Loading..."
|
|
3856
4542
|
] }),
|
|
3857
|
-
|
|
4543
|
+
i && /* @__PURE__ */ e("div", { className: "ss-global-error", children: i }),
|
|
3858
4544
|
!u && d.length === 0 && /* @__PURE__ */ e("p", { className: "ss-empty", children: "No invoices yet." }),
|
|
3859
|
-
!u && d.length > 0 && /* @__PURE__ */
|
|
3860
|
-
/* @__PURE__ */ e("thead", { children: /* @__PURE__ */
|
|
4545
|
+
!u && d.length > 0 && /* @__PURE__ */ t("table", { className: "ss-table", children: [
|
|
4546
|
+
/* @__PURE__ */ e("thead", { children: /* @__PURE__ */ t("tr", { children: [
|
|
3861
4547
|
/* @__PURE__ */ e("th", { className: "ss-th", children: "Date" }),
|
|
3862
4548
|
/* @__PURE__ */ e("th", { className: "ss-th", children: "Amount" }),
|
|
3863
4549
|
/* @__PURE__ */ e("th", { className: "ss-th", children: "Status" }),
|
|
3864
4550
|
/* @__PURE__ */ e("th", { className: "ss-th", children: "PDF" })
|
|
3865
4551
|
] }) }),
|
|
3866
|
-
/* @__PURE__ */ e("tbody", { children: d.map((
|
|
3867
|
-
/* @__PURE__ */ e("td", { className: "ss-td", children:
|
|
3868
|
-
/* @__PURE__ */ e("td", { className: "ss-td", children:
|
|
3869
|
-
/* @__PURE__ */ e("td", { className: "ss-td", children: /* @__PURE__ */ e("span", { className: `ss-badge ${
|
|
3870
|
-
/* @__PURE__ */ e("td", { className: "ss-td", children:
|
|
3871
|
-
] },
|
|
4552
|
+
/* @__PURE__ */ e("tbody", { children: d.map((c) => /* @__PURE__ */ t("tr", { className: "ss-tr", children: [
|
|
4553
|
+
/* @__PURE__ */ e("td", { className: "ss-td", children: Va(c.createdAt) }),
|
|
4554
|
+
/* @__PURE__ */ e("td", { className: "ss-td", children: Ra(c.amountCents) }),
|
|
4555
|
+
/* @__PURE__ */ e("td", { className: "ss-td", children: /* @__PURE__ */ e("span", { className: `ss-badge ${Ua[c.status] || ""}`, children: c.status }) }),
|
|
4556
|
+
/* @__PURE__ */ e("td", { className: "ss-td", children: c.pdfUrl ? /* @__PURE__ */ e("a", { className: "ss-link", href: c.pdfUrl, target: "_blank", rel: "noopener noreferrer", children: "Download" }) : "—" })
|
|
4557
|
+
] }, c.id)) })
|
|
3872
4558
|
] })
|
|
3873
4559
|
] }) });
|
|
3874
4560
|
}
|
|
3875
|
-
function
|
|
3876
|
-
const { appearance: n } =
|
|
3877
|
-
return /* @__PURE__ */ e(
|
|
4561
|
+
function ja({ customerId: a, limits: s, portalToken: r, appearance: o }) {
|
|
4562
|
+
const { appearance: n } = A(), { usage: u, isLoading: i, error: l } = Da(a, r);
|
|
4563
|
+
return /* @__PURE__ */ e(H, { appearance: o ?? n, children: /* @__PURE__ */ t("div", { className: "ss-card", children: [
|
|
3878
4564
|
/* @__PURE__ */ e("h2", { className: "ss-title", children: "Usage" }),
|
|
3879
|
-
|
|
4565
|
+
i && /* @__PURE__ */ t("div", { className: "ss-loading", children: [
|
|
3880
4566
|
/* @__PURE__ */ e("span", { className: "ss-spinner" }),
|
|
3881
4567
|
" Loading..."
|
|
3882
4568
|
] }),
|
|
3883
|
-
|
|
3884
|
-
!
|
|
3885
|
-
!
|
|
3886
|
-
const f = s == null ? void 0 : s[
|
|
3887
|
-
return /* @__PURE__ */
|
|
3888
|
-
/* @__PURE__ */
|
|
3889
|
-
/* @__PURE__ */ e("span", { className: "ss-usage-metric", children:
|
|
3890
|
-
/* @__PURE__ */
|
|
3891
|
-
|
|
4569
|
+
l && /* @__PURE__ */ e("div", { className: "ss-global-error", children: l }),
|
|
4570
|
+
!i && u.length === 0 && /* @__PURE__ */ e("p", { className: "ss-empty", children: "No usage data." }),
|
|
4571
|
+
!i && u.map((c) => {
|
|
4572
|
+
const f = s == null ? void 0 : s[c.metric], p = f ? Math.min(100, c.total / f * 100) : null;
|
|
4573
|
+
return /* @__PURE__ */ t("div", { className: "ss-usage-item", children: [
|
|
4574
|
+
/* @__PURE__ */ t("div", { className: "ss-usage-header", children: [
|
|
4575
|
+
/* @__PURE__ */ e("span", { className: "ss-usage-metric", children: c.metric }),
|
|
4576
|
+
/* @__PURE__ */ t("span", { className: "ss-usage-value", children: [
|
|
4577
|
+
c.total.toLocaleString(),
|
|
3892
4578
|
f ? ` / ${f.toLocaleString()}` : ""
|
|
3893
4579
|
] })
|
|
3894
4580
|
] }),
|
|
@@ -3899,20 +4585,20 @@ function Va({ customerId: a, limits: s, portalToken: t, appearance: o }) {
|
|
|
3899
4585
|
style: { width: `${p}%` }
|
|
3900
4586
|
}
|
|
3901
4587
|
) })
|
|
3902
|
-
] },
|
|
4588
|
+
] }, c.metric);
|
|
3903
4589
|
})
|
|
3904
4590
|
] }) });
|
|
3905
4591
|
}
|
|
3906
|
-
function
|
|
4592
|
+
function ue({
|
|
3907
4593
|
customerId: a,
|
|
3908
4594
|
portalToken: s,
|
|
3909
|
-
limits:
|
|
4595
|
+
limits: r,
|
|
3910
4596
|
onChangePlan: o,
|
|
3911
4597
|
onCancel: n,
|
|
3912
4598
|
appearance: u
|
|
3913
4599
|
}) {
|
|
3914
|
-
const { appearance:
|
|
3915
|
-
return /* @__PURE__ */ e(
|
|
4600
|
+
const { appearance: i } = A(), l = u ?? i, [d, c] = g("subscription");
|
|
4601
|
+
return /* @__PURE__ */ e(H, { appearance: l, children: /* @__PURE__ */ t("div", { className: "ss-card ss-card-wide", children: [
|
|
3916
4602
|
/* @__PURE__ */ e("h2", { className: "ss-title", children: "Billing" }),
|
|
3917
4603
|
/* @__PURE__ */ e("div", { className: "ss-tab-group", children: [
|
|
3918
4604
|
{ id: "subscription", label: "Subscription" },
|
|
@@ -3923,14 +4609,14 @@ function le({
|
|
|
3923
4609
|
{
|
|
3924
4610
|
type: "button",
|
|
3925
4611
|
className: `ss-tab ${d === p.id ? "ss-tab-active" : ""}`,
|
|
3926
|
-
onClick: () =>
|
|
4612
|
+
onClick: () => c(p.id),
|
|
3927
4613
|
children: p.label
|
|
3928
4614
|
},
|
|
3929
4615
|
p.id
|
|
3930
4616
|
)) }),
|
|
3931
|
-
/* @__PURE__ */
|
|
4617
|
+
/* @__PURE__ */ t("div", { className: "ss-tab-content", children: [
|
|
3932
4618
|
d === "subscription" && /* @__PURE__ */ e(
|
|
3933
|
-
|
|
4619
|
+
Ma,
|
|
3934
4620
|
{
|
|
3935
4621
|
customerId: a,
|
|
3936
4622
|
portalToken: s,
|
|
@@ -3938,31 +4624,31 @@ function le({
|
|
|
3938
4624
|
onCancel: n
|
|
3939
4625
|
}
|
|
3940
4626
|
),
|
|
3941
|
-
d === "invoices" && /* @__PURE__ */ e(
|
|
3942
|
-
d === "usage" && /* @__PURE__ */ e(
|
|
4627
|
+
d === "invoices" && /* @__PURE__ */ e(Ha, { customerId: a, portalToken: s }),
|
|
4628
|
+
d === "usage" && /* @__PURE__ */ e(ja, { customerId: a, portalToken: s, limits: r })
|
|
3943
4629
|
] })
|
|
3944
4630
|
] }) });
|
|
3945
4631
|
}
|
|
3946
|
-
function
|
|
3947
|
-
const { appearance: n } =
|
|
3948
|
-
if (
|
|
4632
|
+
function pe({ customerId: a, portalToken: s, onApplied: r, appearance: o }) {
|
|
4633
|
+
const { appearance: n } = A(), u = Z(s), i = o ?? n, [l, d] = g(""), [c, f] = g(!1), [p, m] = g(null), [b, w] = g(null), y = k(async (O) => {
|
|
4634
|
+
if (O.preventDefault(), !!l.trim()) {
|
|
3949
4635
|
f(!0), m(null), w(null);
|
|
3950
4636
|
try {
|
|
3951
|
-
const h = await u.applyCoupon(a,
|
|
3952
|
-
w(`Coupon applied! ${h.discountType === "percent" ? `${h.amount}% off` : `$${(h.amount / 100).toFixed(2)} off`}`), d(""),
|
|
4637
|
+
const h = await u.applyCoupon(a, l.trim());
|
|
4638
|
+
w(`Coupon applied! ${h.discountType === "percent" ? `${h.amount}% off` : `$${(h.amount / 100).toFixed(2)} off`}`), d(""), r == null || r(h);
|
|
3953
4639
|
} catch (h) {
|
|
3954
4640
|
m(h instanceof Error ? h.message : "Invalid coupon code");
|
|
3955
4641
|
} finally {
|
|
3956
4642
|
f(!1);
|
|
3957
4643
|
}
|
|
3958
4644
|
}
|
|
3959
|
-
}, [u, a,
|
|
3960
|
-
return /* @__PURE__ */ e(
|
|
4645
|
+
}, [u, a, l, r]);
|
|
4646
|
+
return /* @__PURE__ */ e(H, { appearance: i, children: /* @__PURE__ */ t("div", { className: "ss-card", children: [
|
|
3961
4647
|
/* @__PURE__ */ e("h2", { className: "ss-title", children: "Apply coupon" }),
|
|
3962
4648
|
p && /* @__PURE__ */ e("div", { className: "ss-global-error", children: p }),
|
|
3963
4649
|
b && /* @__PURE__ */ e("div", { className: "ss-success-msg", children: b }),
|
|
3964
|
-
/* @__PURE__ */
|
|
3965
|
-
/* @__PURE__ */
|
|
4650
|
+
/* @__PURE__ */ t("form", { onSubmit: y, children: [
|
|
4651
|
+
/* @__PURE__ */ t("div", { className: "ss-field", children: [
|
|
3966
4652
|
/* @__PURE__ */ e("label", { className: "ss-label", htmlFor: "ss-coupon-code", children: "Coupon code" }),
|
|
3967
4653
|
/* @__PURE__ */ e(
|
|
3968
4654
|
"input",
|
|
@@ -3971,96 +4657,96 @@ function ce({ customerId: a, portalToken: s, onApplied: t, appearance: o }) {
|
|
|
3971
4657
|
className: "ss-input",
|
|
3972
4658
|
type: "text",
|
|
3973
4659
|
placeholder: "Enter coupon code",
|
|
3974
|
-
value:
|
|
3975
|
-
onChange: (
|
|
4660
|
+
value: l,
|
|
4661
|
+
onChange: (O) => d(O.target.value),
|
|
3976
4662
|
required: !0
|
|
3977
4663
|
}
|
|
3978
4664
|
)
|
|
3979
4665
|
] }),
|
|
3980
|
-
/* @__PURE__ */
|
|
3981
|
-
|
|
4666
|
+
/* @__PURE__ */ t("button", { type: "submit", className: "ss-btn ss-btn-primary", disabled: c || !l.trim(), children: [
|
|
4667
|
+
c && /* @__PURE__ */ e("span", { className: "ss-spinner" }),
|
|
3982
4668
|
"Apply"
|
|
3983
4669
|
] })
|
|
3984
4670
|
] })
|
|
3985
4671
|
] }) });
|
|
3986
4672
|
}
|
|
3987
|
-
function
|
|
3988
|
-
const { client: a } =
|
|
4673
|
+
function he() {
|
|
4674
|
+
const { client: a } = A();
|
|
3989
4675
|
return { report: a.report };
|
|
3990
4676
|
}
|
|
3991
4677
|
function da() {
|
|
3992
|
-
const { client: a } =
|
|
3993
|
-
n(!0),
|
|
4678
|
+
const { client: a } = A(), [s, r] = g(null), [o, n] = g(!1), [u, i] = g(null), l = k(async (d) => {
|
|
4679
|
+
n(!0), i(null);
|
|
3994
4680
|
try {
|
|
3995
|
-
const
|
|
3996
|
-
return
|
|
3997
|
-
} catch (
|
|
3998
|
-
return
|
|
4681
|
+
const c = await a.report.executeQuery(d);
|
|
4682
|
+
return r(c), c;
|
|
4683
|
+
} catch (c) {
|
|
4684
|
+
return i(c instanceof Error ? c.message : "Query failed"), null;
|
|
3999
4685
|
} finally {
|
|
4000
4686
|
n(!1);
|
|
4001
4687
|
}
|
|
4002
4688
|
}, [a]);
|
|
4003
|
-
return { result: s, execute:
|
|
4689
|
+
return { result: s, execute: l, isLoading: o, error: u };
|
|
4004
4690
|
}
|
|
4005
|
-
function
|
|
4006
|
-
const { client: s } =
|
|
4007
|
-
u(!0),
|
|
4691
|
+
function qa(a) {
|
|
4692
|
+
const { client: s } = A(), [r, o] = g(null), [n, u] = g(!0), [i, l] = g(null), d = k(async () => {
|
|
4693
|
+
u(!0), l(null);
|
|
4008
4694
|
try {
|
|
4009
|
-
const
|
|
4010
|
-
o(
|
|
4011
|
-
} catch (
|
|
4012
|
-
c
|
|
4695
|
+
const c = await s.report.listQueries(a);
|
|
4696
|
+
o(c);
|
|
4697
|
+
} catch (c) {
|
|
4698
|
+
l(c instanceof Error ? c.message : "Failed to load queries");
|
|
4013
4699
|
} finally {
|
|
4014
4700
|
u(!1);
|
|
4015
4701
|
}
|
|
4016
4702
|
}, [s, a]);
|
|
4017
|
-
return
|
|
4703
|
+
return U(() => {
|
|
4018
4704
|
d();
|
|
4019
|
-
}, [d]), { queries: (
|
|
4705
|
+
}, [d]), { queries: (r == null ? void 0 : r.data) ?? [], meta: r == null ? void 0 : r.meta, isLoading: n, error: i, refresh: d };
|
|
4020
4706
|
}
|
|
4021
|
-
function
|
|
4022
|
-
const { client: s } =
|
|
4023
|
-
u(!0),
|
|
4707
|
+
function ge(a) {
|
|
4708
|
+
const { client: s } = A(), [r, o] = g(null), [n, u] = g(!0), [i, l] = g(null), d = k(async () => {
|
|
4709
|
+
u(!0), l(null);
|
|
4024
4710
|
try {
|
|
4025
|
-
const
|
|
4026
|
-
o(
|
|
4027
|
-
} catch (
|
|
4028
|
-
c
|
|
4711
|
+
const c = await s.report.getDashboard(a);
|
|
4712
|
+
o(c);
|
|
4713
|
+
} catch (c) {
|
|
4714
|
+
l(c instanceof Error ? c.message : "Failed to load dashboard");
|
|
4029
4715
|
} finally {
|
|
4030
4716
|
u(!1);
|
|
4031
4717
|
}
|
|
4032
4718
|
}, [s, a]);
|
|
4033
|
-
return
|
|
4719
|
+
return U(() => {
|
|
4034
4720
|
d();
|
|
4035
|
-
}, [d]), { dashboard:
|
|
4721
|
+
}, [d]), { dashboard: r, isLoading: n, error: i, refresh: d };
|
|
4036
4722
|
}
|
|
4037
|
-
function
|
|
4038
|
-
const o =
|
|
4039
|
-
const p = new
|
|
4040
|
-
return new
|
|
4041
|
-
}, [a,
|
|
4042
|
-
|
|
4723
|
+
function me(a, s, r = "https://api.saas-support.com/v1") {
|
|
4724
|
+
const o = G(() => {
|
|
4725
|
+
const p = new Q(r, { type: "embedToken", token: a });
|
|
4726
|
+
return new ta(p);
|
|
4727
|
+
}, [a, r]), [n, u] = g(null), [i, l] = g(!0), [d, c] = g(null), f = k(async () => {
|
|
4728
|
+
l(!0), c(null);
|
|
4043
4729
|
try {
|
|
4044
4730
|
const p = await o.getDashboard(s);
|
|
4045
4731
|
u(p);
|
|
4046
4732
|
} catch (p) {
|
|
4047
|
-
|
|
4733
|
+
c(p instanceof Error ? p.message : "Failed to load dashboard");
|
|
4048
4734
|
} finally {
|
|
4049
|
-
|
|
4735
|
+
l(!1);
|
|
4050
4736
|
}
|
|
4051
4737
|
}, [o, s]);
|
|
4052
|
-
return
|
|
4738
|
+
return U(() => {
|
|
4053
4739
|
f();
|
|
4054
|
-
}, [f]), { dashboard: n, reportClient: o, isLoading:
|
|
4740
|
+
}, [f]), { dashboard: n, reportClient: o, isLoading: i, error: d, refresh: f };
|
|
4055
4741
|
}
|
|
4056
|
-
function
|
|
4057
|
-
const { appearance: n } =
|
|
4058
|
-
if (w.preventDefault(), !
|
|
4059
|
-
const
|
|
4060
|
-
|
|
4061
|
-
}, [
|
|
4062
|
-
return /* @__PURE__ */ e(
|
|
4063
|
-
s === "both" && /* @__PURE__ */
|
|
4742
|
+
function fe({ onResult: a, mode: s = "both", placeholder: r, appearance: o }) {
|
|
4743
|
+
const { appearance: n } = A(), { execute: u, isLoading: i, error: l } = da(), d = o ?? n, [c, f] = g(""), [p, m] = g(s === "sql" ? "sql" : "nl"), b = k(async (w) => {
|
|
4744
|
+
if (w.preventDefault(), !c.trim()) return;
|
|
4745
|
+
const O = await u(p === "sql" ? { sql: c } : { naturalLanguage: c });
|
|
4746
|
+
O && (a == null || a(O));
|
|
4747
|
+
}, [c, p, u, a]);
|
|
4748
|
+
return /* @__PURE__ */ e(H, { appearance: d, children: /* @__PURE__ */ t("div", { className: "ss-card ss-card-wide", children: [
|
|
4749
|
+
s === "both" && /* @__PURE__ */ t("div", { className: "ss-tab-group ss-tab-group-sm", children: [
|
|
4064
4750
|
/* @__PURE__ */ e(
|
|
4065
4751
|
"button",
|
|
4066
4752
|
{
|
|
@@ -4080,58 +4766,58 @@ function he({ onResult: a, mode: s = "both", placeholder: t, appearance: o }) {
|
|
|
4080
4766
|
}
|
|
4081
4767
|
)
|
|
4082
4768
|
] }),
|
|
4083
|
-
|
|
4084
|
-
/* @__PURE__ */
|
|
4769
|
+
l && /* @__PURE__ */ e("div", { className: "ss-global-error", children: l }),
|
|
4770
|
+
/* @__PURE__ */ t("form", { onSubmit: b, children: [
|
|
4085
4771
|
/* @__PURE__ */ e("div", { className: "ss-field", children: /* @__PURE__ */ e(
|
|
4086
4772
|
"textarea",
|
|
4087
4773
|
{
|
|
4088
4774
|
className: "ss-input ss-query-textarea",
|
|
4089
|
-
placeholder:
|
|
4090
|
-
value:
|
|
4775
|
+
placeholder: r ?? (p === "sql" ? "SELECT ..." : "Ask a question about your data..."),
|
|
4776
|
+
value: c,
|
|
4091
4777
|
onChange: (w) => f(w.target.value),
|
|
4092
4778
|
rows: 3
|
|
4093
4779
|
}
|
|
4094
4780
|
) }),
|
|
4095
|
-
/* @__PURE__ */
|
|
4096
|
-
|
|
4781
|
+
/* @__PURE__ */ t("button", { type: "submit", className: "ss-btn ss-btn-primary", disabled: i || !c.trim(), children: [
|
|
4782
|
+
i && /* @__PURE__ */ e("span", { className: "ss-spinner" }),
|
|
4097
4783
|
"Run query"
|
|
4098
4784
|
] })
|
|
4099
4785
|
] })
|
|
4100
4786
|
] }) });
|
|
4101
4787
|
}
|
|
4102
|
-
function
|
|
4103
|
-
const { appearance: u } =
|
|
4104
|
-
const h = y[
|
|
4788
|
+
function Wa({ columns: a, rows: s, sortable: r = !0, maxRows: o, appearance: n }) {
|
|
4789
|
+
const { appearance: u } = A(), i = n ?? u, [l, d] = g(null), [c, f] = g("asc"), p = G(() => l ? [...s].sort((y, O) => {
|
|
4790
|
+
const h = y[l], N = O[l];
|
|
4105
4791
|
if (h == null && N == null) return 0;
|
|
4106
4792
|
if (h == null) return 1;
|
|
4107
4793
|
if (N == null) return -1;
|
|
4108
4794
|
if (typeof h == "number" && typeof N == "number")
|
|
4109
|
-
return
|
|
4110
|
-
const
|
|
4111
|
-
return
|
|
4112
|
-
}) : s, [s,
|
|
4113
|
-
|
|
4795
|
+
return c === "asc" ? h - N : N - h;
|
|
4796
|
+
const C = String(h), P = String(N);
|
|
4797
|
+
return c === "asc" ? C.localeCompare(P) : P.localeCompare(C);
|
|
4798
|
+
}) : s, [s, l, c]), m = o ? p.slice(0, o) : p, b = (y) => {
|
|
4799
|
+
r && (l === y ? f((O) => O === "asc" ? "desc" : "asc") : (d(y), f("asc")));
|
|
4114
4800
|
};
|
|
4115
4801
|
function w(y) {
|
|
4116
4802
|
return y == null ? "" : typeof y == "object" ? JSON.stringify(y) : String(y);
|
|
4117
4803
|
}
|
|
4118
|
-
return /* @__PURE__ */ e(
|
|
4119
|
-
/* @__PURE__ */
|
|
4120
|
-
/* @__PURE__ */ e("thead", { children: /* @__PURE__ */ e("tr", { children: a.map((y) => /* @__PURE__ */
|
|
4804
|
+
return /* @__PURE__ */ e(H, { appearance: i, children: /* @__PURE__ */ t("div", { className: "ss-table-container", children: [
|
|
4805
|
+
/* @__PURE__ */ t("table", { className: "ss-table", children: [
|
|
4806
|
+
/* @__PURE__ */ e("thead", { children: /* @__PURE__ */ e("tr", { children: a.map((y) => /* @__PURE__ */ t(
|
|
4121
4807
|
"th",
|
|
4122
4808
|
{
|
|
4123
|
-
className: `ss-th ${
|
|
4809
|
+
className: `ss-th ${r ? "ss-th-sortable" : ""} ${l === y ? c === "asc" ? "ss-sorted-asc" : "ss-sorted-desc" : ""}`,
|
|
4124
4810
|
onClick: () => b(y),
|
|
4125
4811
|
children: [
|
|
4126
4812
|
y,
|
|
4127
|
-
|
|
4813
|
+
l === y && /* @__PURE__ */ e("span", { className: "ss-sort-indicator", children: c === "asc" ? " ▲" : " ▼" })
|
|
4128
4814
|
]
|
|
4129
4815
|
},
|
|
4130
4816
|
y
|
|
4131
4817
|
)) }) }),
|
|
4132
|
-
/* @__PURE__ */ e("tbody", { children: m.map((y,
|
|
4818
|
+
/* @__PURE__ */ e("tbody", { children: m.map((y, O) => /* @__PURE__ */ e("tr", { className: "ss-tr", children: a.map((h) => /* @__PURE__ */ e("td", { className: "ss-td", children: w(y[h]) }, h)) }, O)) })
|
|
4133
4819
|
] }),
|
|
4134
|
-
o && s.length > o && /* @__PURE__ */
|
|
4820
|
+
o && s.length > o && /* @__PURE__ */ t("div", { className: "ss-table-footer", children: [
|
|
4135
4821
|
"Showing ",
|
|
4136
4822
|
o,
|
|
4137
4823
|
" of ",
|
|
@@ -4140,139 +4826,139 @@ function qa({ columns: a, rows: s, sortable: t = !0, maxRows: o, appearance: n }
|
|
|
4140
4826
|
] })
|
|
4141
4827
|
] }) });
|
|
4142
4828
|
}
|
|
4143
|
-
function
|
|
4144
|
-
const
|
|
4829
|
+
function _a(a, s = "#6366f1") {
|
|
4830
|
+
const r = parseInt(s.replace("#", "").slice(0, 2), 16), o = [];
|
|
4145
4831
|
for (let n = 0; n < a; n++) {
|
|
4146
|
-
const u = (
|
|
4832
|
+
const u = (r + n * Math.floor(360 / Math.max(a, 1))) % 360;
|
|
4147
4833
|
o.push(`hsl(${u}, 65%, 55%)`);
|
|
4148
4834
|
}
|
|
4149
4835
|
return o;
|
|
4150
4836
|
}
|
|
4151
|
-
function
|
|
4152
|
-
const u = Math.max(...s, 1),
|
|
4153
|
-
return /* @__PURE__ */
|
|
4154
|
-
/* @__PURE__ */ e("line", { x1:
|
|
4837
|
+
function Ga({ labels: a, values: s, w: r, h: o, colors: n }) {
|
|
4838
|
+
const u = Math.max(...s, 1), i = 40, l = r - i * 2, d = o - i * 2, c = Math.max(1, l / a.length - 4);
|
|
4839
|
+
return /* @__PURE__ */ t("g", { children: [
|
|
4840
|
+
/* @__PURE__ */ e("line", { x1: i, y1: o - i, x2: r - i, y2: o - i, stroke: "#ccc", strokeWidth: 1 }),
|
|
4155
4841
|
s.map((f, p) => {
|
|
4156
|
-
const m = f / u * d, b =
|
|
4157
|
-
return /* @__PURE__ */
|
|
4158
|
-
/* @__PURE__ */ e("rect", { x: b, y: w, width:
|
|
4159
|
-
/* @__PURE__ */ e("text", { x: b +
|
|
4842
|
+
const m = f / u * d, b = i + l / a.length * p + 2, w = o - i - m;
|
|
4843
|
+
return /* @__PURE__ */ t("g", { children: [
|
|
4844
|
+
/* @__PURE__ */ e("rect", { x: b, y: w, width: c, height: m, fill: n[p % n.length], rx: 2 }),
|
|
4845
|
+
/* @__PURE__ */ e("text", { x: b + c / 2, y: o - i + 14, textAnchor: "middle", fontSize: 10, fill: "#666", children: a[p].length > 8 ? a[p].slice(0, 8) + "..." : a[p] })
|
|
4160
4846
|
] }, p);
|
|
4161
4847
|
})
|
|
4162
4848
|
] });
|
|
4163
4849
|
}
|
|
4164
|
-
function
|
|
4165
|
-
const u = Math.max(...s, 1),
|
|
4166
|
-
const b =
|
|
4850
|
+
function Ya({ labels: a, values: s, w: r, h: o, colors: n }) {
|
|
4851
|
+
const u = Math.max(...s, 1), i = 40, l = r - i * 2, d = o - i * 2, c = a.length > 1 ? l / (a.length - 1) : 0, f = s.map((p, m) => {
|
|
4852
|
+
const b = i + c * m, w = o - i - p / u * d;
|
|
4167
4853
|
return `${b},${w}`;
|
|
4168
4854
|
});
|
|
4169
|
-
return /* @__PURE__ */
|
|
4855
|
+
return /* @__PURE__ */ t("g", { children: [
|
|
4170
4856
|
[0.25, 0.5, 0.75, 1].map((p) => {
|
|
4171
|
-
const m = o -
|
|
4172
|
-
return /* @__PURE__ */ e("line", { x1:
|
|
4857
|
+
const m = o - i - p * d;
|
|
4858
|
+
return /* @__PURE__ */ e("line", { x1: i, y1: m, x2: r - i, y2: m, stroke: "#eee", strokeWidth: 1 }, p);
|
|
4173
4859
|
}),
|
|
4174
4860
|
/* @__PURE__ */ e("polyline", { points: f.join(" "), fill: "none", stroke: n[0], strokeWidth: 2 }),
|
|
4175
4861
|
s.map((p, m) => {
|
|
4176
|
-
const b =
|
|
4862
|
+
const b = i + c * m, w = o - i - p / u * d;
|
|
4177
4863
|
return /* @__PURE__ */ e("circle", { cx: b, cy: w, r: 4, fill: n[0] }, m);
|
|
4178
4864
|
})
|
|
4179
4865
|
] });
|
|
4180
4866
|
}
|
|
4181
|
-
function
|
|
4182
|
-
const u = s.reduce((m, b) => m + b, 0) || 1,
|
|
4867
|
+
function Ja({ labels: a, values: s, w: r, h: o, colors: n }) {
|
|
4868
|
+
const u = s.reduce((m, b) => m + b, 0) || 1, i = r / 2, l = o / 2 - 20, d = Math.min(r, o) / 2 - 40, c = 2 * Math.PI * d;
|
|
4183
4869
|
let f = 0;
|
|
4184
4870
|
const p = s.map((m, b) => {
|
|
4185
|
-
const w = m / u, y = w *
|
|
4186
|
-
return f += y,
|
|
4871
|
+
const w = m / u, y = w * c, O = { dash: y, offset: f, color: n[b % n.length], label: a[b], pct: w };
|
|
4872
|
+
return f += y, O;
|
|
4187
4873
|
});
|
|
4188
|
-
return /* @__PURE__ */
|
|
4874
|
+
return /* @__PURE__ */ t("g", { children: [
|
|
4189
4875
|
p.map((m, b) => /* @__PURE__ */ e(
|
|
4190
4876
|
"circle",
|
|
4191
4877
|
{
|
|
4192
|
-
cx:
|
|
4193
|
-
cy:
|
|
4878
|
+
cx: i,
|
|
4879
|
+
cy: l,
|
|
4194
4880
|
r: d,
|
|
4195
4881
|
fill: "none",
|
|
4196
4882
|
stroke: m.color,
|
|
4197
4883
|
strokeWidth: d * 0.6,
|
|
4198
|
-
strokeDasharray: `${m.dash} ${
|
|
4884
|
+
strokeDasharray: `${m.dash} ${c - m.dash}`,
|
|
4199
4885
|
strokeDashoffset: -m.offset,
|
|
4200
|
-
transform: `rotate(-90 ${
|
|
4886
|
+
transform: `rotate(-90 ${i} ${l})`
|
|
4201
4887
|
},
|
|
4202
4888
|
b
|
|
4203
4889
|
)),
|
|
4204
|
-
/* @__PURE__ */ e("g", { transform: `translate(${
|
|
4890
|
+
/* @__PURE__ */ e("g", { transform: `translate(${i - a.length * 30}, ${o - 20})`, children: p.slice(0, 6).map((m, b) => /* @__PURE__ */ t("g", { transform: `translate(${b * 60}, 0)`, children: [
|
|
4205
4891
|
/* @__PURE__ */ e("rect", { width: 10, height: 10, fill: m.color, rx: 2 }),
|
|
4206
4892
|
/* @__PURE__ */ e("text", { x: 14, y: 9, fontSize: 9, fill: "#666", children: m.label.length > 6 ? m.label.slice(0, 6) + ".." : m.label })
|
|
4207
4893
|
] }, b)) })
|
|
4208
4894
|
] });
|
|
4209
4895
|
}
|
|
4210
|
-
function
|
|
4211
|
-
const { appearance:
|
|
4212
|
-
return /* @__PURE__ */ e(
|
|
4213
|
-
|
|
4214
|
-
/* @__PURE__ */
|
|
4215
|
-
a === "bar" && /* @__PURE__ */ e(
|
|
4216
|
-
a === "line" && /* @__PURE__ */ e(
|
|
4217
|
-
a === "pie" && /* @__PURE__ */ e(
|
|
4896
|
+
function Qa({ type: a, data: s, title: r, width: o = 400, height: n = 300, appearance: u }) {
|
|
4897
|
+
const { appearance: i } = A(), l = u ?? i, d = G(() => _a(s.labels.length), [s.labels.length]);
|
|
4898
|
+
return /* @__PURE__ */ e(H, { appearance: l, children: /* @__PURE__ */ t("div", { className: "ss-chart-container", children: [
|
|
4899
|
+
r && /* @__PURE__ */ e("h3", { className: "ss-chart-title", children: r }),
|
|
4900
|
+
/* @__PURE__ */ t("svg", { viewBox: `0 0 ${o} ${n}`, width: "100%", style: { maxWidth: o }, children: [
|
|
4901
|
+
a === "bar" && /* @__PURE__ */ e(Ga, { labels: s.labels, values: s.values, w: o, h: n, colors: d }),
|
|
4902
|
+
a === "line" && /* @__PURE__ */ e(Ya, { labels: s.labels, values: s.values, w: o, h: n, colors: d }),
|
|
4903
|
+
a === "pie" && /* @__PURE__ */ e(Ja, { labels: s.labels, values: s.values, w: o, h: n, colors: d })
|
|
4218
4904
|
] })
|
|
4219
4905
|
] }) });
|
|
4220
4906
|
}
|
|
4221
|
-
function
|
|
4222
|
-
const u =
|
|
4907
|
+
function be({ dashboardId: a, embedToken: s, baseUrl: r, refreshInterval: o, appearance: n }) {
|
|
4908
|
+
const u = A(), i = n ?? (u == null ? void 0 : u.appearance), l = G(() => {
|
|
4223
4909
|
if (s) {
|
|
4224
|
-
const h =
|
|
4225
|
-
return new
|
|
4910
|
+
const h = r ?? "https://api.saas-support.com/v1", N = new Q(h, { type: "embedToken", token: s });
|
|
4911
|
+
return new ta(N);
|
|
4226
4912
|
}
|
|
4227
4913
|
return u.client.report;
|
|
4228
|
-
}, [s,
|
|
4914
|
+
}, [s, r, u]), [d, c] = g([]), [f, p] = g({}), [m, b] = g(!0), [w, y] = g(null), O = k(async () => {
|
|
4229
4915
|
b(!0), y(null);
|
|
4230
4916
|
try {
|
|
4231
|
-
const h = await
|
|
4232
|
-
|
|
4233
|
-
const
|
|
4234
|
-
for (const
|
|
4917
|
+
const h = await l.getDashboard(a), N = JSON.parse(h.layoutJson || "[]");
|
|
4918
|
+
c(N);
|
|
4919
|
+
const C = {};
|
|
4920
|
+
for (const P of N)
|
|
4235
4921
|
try {
|
|
4236
|
-
const
|
|
4237
|
-
if (
|
|
4238
|
-
const
|
|
4239
|
-
|
|
4922
|
+
const I = await l.listQueries({ search: P.queryId, perPage: 1 });
|
|
4923
|
+
if (I.data.length > 0 && I.data[0].generatedSql) {
|
|
4924
|
+
const F = await l.executeQuery({ sql: I.data[0].generatedSql });
|
|
4925
|
+
C[P.queryId] = F;
|
|
4240
4926
|
}
|
|
4241
4927
|
} catch {
|
|
4242
4928
|
}
|
|
4243
|
-
p(
|
|
4929
|
+
p(C);
|
|
4244
4930
|
} catch (h) {
|
|
4245
4931
|
y(h instanceof Error ? h.message : "Failed to load dashboard");
|
|
4246
4932
|
} finally {
|
|
4247
4933
|
b(!1);
|
|
4248
4934
|
}
|
|
4249
|
-
}, [
|
|
4250
|
-
return
|
|
4251
|
-
|
|
4252
|
-
}, [
|
|
4935
|
+
}, [l, a]);
|
|
4936
|
+
return U(() => {
|
|
4937
|
+
O();
|
|
4938
|
+
}, [O]), U(() => {
|
|
4253
4939
|
if (!o || o <= 0) return;
|
|
4254
|
-
const h = setInterval(
|
|
4940
|
+
const h = setInterval(O, o * 1e3);
|
|
4255
4941
|
return () => clearInterval(h);
|
|
4256
|
-
}, [o,
|
|
4257
|
-
m && /* @__PURE__ */
|
|
4942
|
+
}, [o, O]), /* @__PURE__ */ e(H, { appearance: i, children: /* @__PURE__ */ t("div", { className: "ss-dashboard-grid", children: [
|
|
4943
|
+
m && /* @__PURE__ */ t("div", { className: "ss-loading", children: [
|
|
4258
4944
|
/* @__PURE__ */ e("span", { className: "ss-spinner" }),
|
|
4259
4945
|
" Loading dashboard..."
|
|
4260
4946
|
] }),
|
|
4261
4947
|
w && /* @__PURE__ */ e("div", { className: "ss-global-error", children: w }),
|
|
4262
4948
|
!m && d.map((h, N) => {
|
|
4263
|
-
const
|
|
4264
|
-
if (!
|
|
4265
|
-
const
|
|
4266
|
-
labels:
|
|
4267
|
-
values:
|
|
4949
|
+
const C = f[h.queryId];
|
|
4950
|
+
if (!C) return null;
|
|
4951
|
+
const P = C.columns.length >= 2 ? {
|
|
4952
|
+
labels: C.rows.map((I) => String(I[C.columns[0]] ?? "")),
|
|
4953
|
+
values: C.rows.map((I) => Number(I[C.columns[1]] ?? 0))
|
|
4268
4954
|
} : { labels: [], values: [] };
|
|
4269
|
-
return /* @__PURE__ */
|
|
4955
|
+
return /* @__PURE__ */ t("div", { className: "ss-widget", children: [
|
|
4270
4956
|
h.title && /* @__PURE__ */ e("h4", { className: "ss-widget-header", children: h.title }),
|
|
4271
|
-
h.chartType === "table" ? /* @__PURE__ */ e(
|
|
4272
|
-
|
|
4957
|
+
h.chartType === "table" ? /* @__PURE__ */ e(Wa, { columns: C.columns, rows: C.rows, maxRows: 50 }) : /* @__PURE__ */ e(
|
|
4958
|
+
Qa,
|
|
4273
4959
|
{
|
|
4274
4960
|
type: h.chartType || "bar",
|
|
4275
|
-
data:
|
|
4961
|
+
data: P,
|
|
4276
4962
|
width: h.w,
|
|
4277
4963
|
height: h.h
|
|
4278
4964
|
}
|
|
@@ -4281,36 +4967,36 @@ function ge({ dashboardId: a, embedToken: s, baseUrl: t, refreshInterval: o, app
|
|
|
4281
4967
|
})
|
|
4282
4968
|
] }) });
|
|
4283
4969
|
}
|
|
4284
|
-
function
|
|
4970
|
+
function Za(a) {
|
|
4285
4971
|
return new Date(a).toLocaleDateString("en-US", { year: "numeric", month: "short", day: "numeric" });
|
|
4286
4972
|
}
|
|
4287
|
-
function
|
|
4288
|
-
const { appearance: o } =
|
|
4973
|
+
function xe({ onSelectQuery: a, onRunQuery: s, appearance: r }) {
|
|
4974
|
+
const { appearance: o } = A(), { queries: n, isLoading: u, error: i } = qa(), { execute: l, isLoading: d } = da(), c = r ?? o, f = k(async (p) => {
|
|
4289
4975
|
if (!p.generatedSql) return;
|
|
4290
|
-
const m = await
|
|
4976
|
+
const m = await l({ sql: p.generatedSql });
|
|
4291
4977
|
m && (s == null || s(m));
|
|
4292
|
-
}, [
|
|
4293
|
-
return /* @__PURE__ */ e(
|
|
4978
|
+
}, [l, s]);
|
|
4979
|
+
return /* @__PURE__ */ e(H, { appearance: c, children: /* @__PURE__ */ t("div", { className: "ss-card ss-card-wide", children: [
|
|
4294
4980
|
/* @__PURE__ */ e("h2", { className: "ss-title", children: "Saved Queries" }),
|
|
4295
|
-
u && /* @__PURE__ */
|
|
4981
|
+
u && /* @__PURE__ */ t("div", { className: "ss-loading", children: [
|
|
4296
4982
|
/* @__PURE__ */ e("span", { className: "ss-spinner" }),
|
|
4297
4983
|
" Loading..."
|
|
4298
4984
|
] }),
|
|
4299
|
-
|
|
4985
|
+
i && /* @__PURE__ */ e("div", { className: "ss-global-error", children: i }),
|
|
4300
4986
|
!u && n.length === 0 && /* @__PURE__ */ e("p", { className: "ss-empty", children: "No saved queries." }),
|
|
4301
|
-
!u && n.map((p) => /* @__PURE__ */
|
|
4987
|
+
!u && n.map((p) => /* @__PURE__ */ t(
|
|
4302
4988
|
"div",
|
|
4303
4989
|
{
|
|
4304
4990
|
className: "ss-saved-query-card",
|
|
4305
4991
|
onClick: () => a == null ? void 0 : a(p),
|
|
4306
4992
|
children: [
|
|
4307
|
-
/* @__PURE__ */
|
|
4993
|
+
/* @__PURE__ */ t("div", { className: "ss-saved-query-header", children: [
|
|
4308
4994
|
/* @__PURE__ */ e("span", { className: "ss-saved-query-name", children: p.name }),
|
|
4309
4995
|
p.chartType && /* @__PURE__ */ e("span", { className: "ss-badge", children: p.chartType })
|
|
4310
4996
|
] }),
|
|
4311
4997
|
p.naturalLanguage && /* @__PURE__ */ e("p", { className: "ss-saved-query-desc", children: p.naturalLanguage }),
|
|
4312
|
-
/* @__PURE__ */
|
|
4313
|
-
/* @__PURE__ */ e("span", { className: "ss-saved-query-date", children:
|
|
4998
|
+
/* @__PURE__ */ t("div", { className: "ss-saved-query-footer", children: [
|
|
4999
|
+
/* @__PURE__ */ e("span", { className: "ss-saved-query-date", children: Za(p.createdAt) }),
|
|
4314
5000
|
/* @__PURE__ */ e(
|
|
4315
5001
|
"button",
|
|
4316
5002
|
{
|
|
@@ -4330,36 +5016,36 @@ function fe({ onSelectQuery: a, onRunQuery: s, appearance: t }) {
|
|
|
4330
5016
|
))
|
|
4331
5017
|
] }) });
|
|
4332
5018
|
}
|
|
4333
|
-
function
|
|
4334
|
-
const u =
|
|
4335
|
-
const y = new
|
|
4336
|
-
return new
|
|
4337
|
-
}, [a,
|
|
4338
|
-
|
|
5019
|
+
function ye({ embedToken: a, dashboardId: s, baseUrl: r = "https://api.saas-support.com/v1", refreshInterval: o, appearance: n }) {
|
|
5020
|
+
const u = G(() => {
|
|
5021
|
+
const y = new Q(r, { type: "embedToken", token: a });
|
|
5022
|
+
return new ta(y);
|
|
5023
|
+
}, [a, r]), [i, l] = g([]), [d, c] = g(!0), [f, p] = g(null), m = G(() => aa(n), [n]), b = G(() => ea(m), [m]), w = k(async () => {
|
|
5024
|
+
c(!0), p(null);
|
|
4339
5025
|
try {
|
|
4340
|
-
const y = await u.getDashboard(s),
|
|
4341
|
-
|
|
5026
|
+
const y = await u.getDashboard(s), O = JSON.parse(y.layoutJson || "[]"), h = await Promise.all(
|
|
5027
|
+
O.map(async (N) => {
|
|
4342
5028
|
try {
|
|
4343
|
-
const
|
|
4344
|
-
if (
|
|
4345
|
-
const
|
|
4346
|
-
return { ...N, result:
|
|
5029
|
+
const C = await u.listQueries({ search: N.queryId, perPage: 1 });
|
|
5030
|
+
if (C.data.length > 0 && C.data[0].generatedSql) {
|
|
5031
|
+
const P = await u.executeQuery({ sql: C.data[0].generatedSql });
|
|
5032
|
+
return { ...N, result: P };
|
|
4347
5033
|
}
|
|
4348
5034
|
} catch {
|
|
4349
5035
|
}
|
|
4350
5036
|
return N;
|
|
4351
5037
|
})
|
|
4352
5038
|
);
|
|
4353
|
-
|
|
5039
|
+
l(h);
|
|
4354
5040
|
} catch (y) {
|
|
4355
5041
|
p(y instanceof Error ? y.message : "Failed to load dashboard");
|
|
4356
5042
|
} finally {
|
|
4357
|
-
|
|
5043
|
+
c(!1);
|
|
4358
5044
|
}
|
|
4359
5045
|
}, [u, s]);
|
|
4360
|
-
return
|
|
5046
|
+
return U(() => {
|
|
4361
5047
|
w();
|
|
4362
|
-
}, [w]),
|
|
5048
|
+
}, [w]), U(() => {
|
|
4363
5049
|
if (!o || o <= 0) return;
|
|
4364
5050
|
const y = setInterval(w, o * 1e3);
|
|
4365
5051
|
return () => clearInterval(y);
|
|
@@ -4368,68 +5054,69 @@ function me({ embedToken: a, dashboardId: s, baseUrl: t = "https://api.saas-supp
|
|
|
4368
5054
|
{
|
|
4369
5055
|
ref: (y) => {
|
|
4370
5056
|
if (!y || y.shadowRoot) return;
|
|
4371
|
-
const
|
|
4372
|
-
h.textContent = b,
|
|
5057
|
+
const O = y.attachShadow({ mode: "open" }), h = document.createElement("style");
|
|
5058
|
+
h.textContent = b, O.appendChild(h);
|
|
4373
5059
|
const N = document.createElement("div");
|
|
4374
|
-
|
|
5060
|
+
O.appendChild(N);
|
|
4375
5061
|
},
|
|
4376
5062
|
style: { display: "contents" },
|
|
4377
|
-
children: /* @__PURE__ */
|
|
5063
|
+
children: /* @__PURE__ */ t("div", { className: "ss-dashboard-grid", children: [
|
|
4378
5064
|
d && /* @__PURE__ */ e("div", { className: "ss-loading", children: "Loading dashboard..." }),
|
|
4379
5065
|
f && /* @__PURE__ */ e("div", { className: "ss-global-error", children: f }),
|
|
4380
|
-
!d &&
|
|
5066
|
+
!d && i.map((y, O) => {
|
|
4381
5067
|
if (!y.result) return null;
|
|
4382
5068
|
const { columns: h, rows: N } = y.result;
|
|
4383
|
-
return /* @__PURE__ */
|
|
5069
|
+
return /* @__PURE__ */ t("div", { className: "ss-widget", children: [
|
|
4384
5070
|
y.title && /* @__PURE__ */ e("h4", { className: "ss-widget-header", children: y.title }),
|
|
4385
|
-
/* @__PURE__ */
|
|
4386
|
-
/* @__PURE__ */ e("thead", { children: /* @__PURE__ */ e("tr", { children: h.map((
|
|
4387
|
-
/* @__PURE__ */ e("tbody", { children: N.slice(0, 50).map((
|
|
5071
|
+
/* @__PURE__ */ t("table", { className: "ss-table", children: [
|
|
5072
|
+
/* @__PURE__ */ e("thead", { children: /* @__PURE__ */ e("tr", { children: h.map((C) => /* @__PURE__ */ e("th", { className: "ss-th", children: C }, C)) }) }),
|
|
5073
|
+
/* @__PURE__ */ e("tbody", { children: N.slice(0, 50).map((C, P) => /* @__PURE__ */ e("tr", { className: "ss-tr", children: h.map((I) => /* @__PURE__ */ e("td", { className: "ss-td", children: String(C[I] ?? "") }, I)) }, P)) })
|
|
4388
5074
|
] })
|
|
4389
|
-
] },
|
|
5075
|
+
] }, O);
|
|
4390
5076
|
})
|
|
4391
5077
|
] })
|
|
4392
5078
|
}
|
|
4393
5079
|
);
|
|
4394
5080
|
}
|
|
4395
5081
|
export {
|
|
4396
|
-
|
|
4397
|
-
|
|
4398
|
-
|
|
4399
|
-
|
|
4400
|
-
|
|
4401
|
-
|
|
4402
|
-
|
|
4403
|
-
|
|
4404
|
-
|
|
4405
|
-
|
|
5082
|
+
Qa as Chart,
|
|
5083
|
+
pe as CouponInput,
|
|
5084
|
+
be as DashboardView,
|
|
5085
|
+
Wa as DataTable,
|
|
5086
|
+
Ha as InvoiceHistory,
|
|
5087
|
+
le as OrgSwitcher,
|
|
5088
|
+
ue as PaymentPortal,
|
|
5089
|
+
ce as PricingTable,
|
|
5090
|
+
fe as QueryInput,
|
|
5091
|
+
ye as ReportEmbed,
|
|
4406
5092
|
ra as SaaSContext,
|
|
4407
|
-
|
|
4408
|
-
|
|
4409
|
-
|
|
4410
|
-
|
|
4411
|
-
|
|
4412
|
-
|
|
4413
|
-
|
|
4414
|
-
|
|
4415
|
-
|
|
4416
|
-
|
|
4417
|
-
|
|
4418
|
-
|
|
4419
|
-
|
|
4420
|
-
|
|
4421
|
-
|
|
4422
|
-
|
|
4423
|
-
|
|
4424
|
-
|
|
5093
|
+
Ne as SaaSError,
|
|
5094
|
+
te as SaaSProvider,
|
|
5095
|
+
ba as SaaSSupport,
|
|
5096
|
+
xe as SavedQueryList,
|
|
5097
|
+
Pa as SettingsPanel,
|
|
5098
|
+
re as SignIn,
|
|
5099
|
+
ne as SignUp,
|
|
5100
|
+
Ma as SubscriptionStatus,
|
|
5101
|
+
ja as UsageDisplay,
|
|
5102
|
+
oe as UserButton,
|
|
5103
|
+
ie as UserProfile,
|
|
5104
|
+
xa as isMfaRequired,
|
|
5105
|
+
sa as useAuth,
|
|
5106
|
+
de as useBilling,
|
|
5107
|
+
ge as useDashboard,
|
|
5108
|
+
Ca as useDeleteAccount,
|
|
5109
|
+
me as useEmbedDashboard,
|
|
5110
|
+
Aa as useInvoices,
|
|
5111
|
+
Y as useOrg,
|
|
4425
5112
|
oa as useProfile,
|
|
4426
5113
|
da as useQuery,
|
|
4427
|
-
|
|
4428
|
-
|
|
4429
|
-
|
|
4430
|
-
|
|
4431
|
-
|
|
4432
|
-
|
|
4433
|
-
|
|
4434
|
-
|
|
5114
|
+
he as useReport,
|
|
5115
|
+
A as useSaaSContext,
|
|
5116
|
+
qa as useSavedQueries,
|
|
5117
|
+
na as useSignIn,
|
|
5118
|
+
ka as useSignUp,
|
|
5119
|
+
La as useSubscription,
|
|
5120
|
+
Da as useUsage,
|
|
5121
|
+
se as useUser
|
|
4435
5122
|
};
|