@saas-support/react 0.7.1 → 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/react.cjs +7 -6
- package/dist/react.js +354 -355
- package/package.json +1 -1
package/dist/react.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
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
|
|
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
3
|
import { SaaSSupport as ba, isMfaRequired as xa, BillingClient as ya, Transport as Q, ReportClient as ta } from "./index.js";
|
|
4
4
|
import { SaaSError as Ne } from "./index.js";
|
|
5
5
|
import { createPortal as va } from "react-dom";
|
|
@@ -16,11 +16,11 @@ function te({ publishableKey: a, apiKey: s, baseUrl: r, appearance: o, children:
|
|
|
16
16
|
let m = !1;
|
|
17
17
|
u.load().then(async () => {
|
|
18
18
|
if (m) return;
|
|
19
|
-
const
|
|
20
|
-
l(
|
|
19
|
+
const w = await u.auth.getUser(), y = await u.auth.getSettings();
|
|
20
|
+
l(w), p(y), c(!0);
|
|
21
21
|
});
|
|
22
|
-
const b = u.auth.onAuthStateChange((
|
|
23
|
-
m || l(
|
|
22
|
+
const b = u.auth.onAuthStateChange((w) => {
|
|
23
|
+
m || l(w);
|
|
24
24
|
});
|
|
25
25
|
return () => {
|
|
26
26
|
m = !0, b(), u.destroy();
|
|
@@ -2213,14 +2213,15 @@ function ea(a) {
|
|
|
2213
2213
|
animation: ss-spin 0.6s linear infinite;
|
|
2214
2214
|
}
|
|
2215
2215
|
|
|
2216
|
-
/* Settings Panel (full
|
|
2216
|
+
/* Settings Panel (full page) */
|
|
2217
2217
|
.ss-auth-settings-page {
|
|
2218
|
-
|
|
2219
|
-
|
|
2218
|
+
position: fixed;
|
|
2219
|
+
inset: 0;
|
|
2220
|
+
z-index: 99999;
|
|
2220
2221
|
display: flex;
|
|
2221
2222
|
flex-direction: column;
|
|
2222
2223
|
background: ${a.authSurface};
|
|
2223
|
-
animation: ss-auth-
|
|
2224
|
+
animation: ss-auth-fade-in 0.2s ease-out;
|
|
2224
2225
|
}
|
|
2225
2226
|
|
|
2226
2227
|
.ss-auth-settings-header {
|
|
@@ -2516,9 +2517,9 @@ function sa() {
|
|
|
2516
2517
|
isLoaded: r,
|
|
2517
2518
|
isSignedIn: !!s,
|
|
2518
2519
|
user: s,
|
|
2519
|
-
signOut:
|
|
2520
|
-
getToken:
|
|
2521
|
-
refreshUser:
|
|
2520
|
+
signOut: k(() => a.auth.signOut(), [a]),
|
|
2521
|
+
getToken: k(() => a.auth.getToken(), [a]),
|
|
2522
|
+
refreshUser: k(() => a.auth.refreshUser(), [a])
|
|
2522
2523
|
};
|
|
2523
2524
|
}
|
|
2524
2525
|
function se() {
|
|
@@ -2526,7 +2527,7 @@ function se() {
|
|
|
2526
2527
|
return { user: a, isLoaded: s };
|
|
2527
2528
|
}
|
|
2528
2529
|
function na() {
|
|
2529
|
-
const { client: a } = A(), [s, r] = g(!1), [o, n] = g(null), u =
|
|
2530
|
+
const { client: a } = A(), [s, r] = g(!1), [o, n] = g(null), u = k(
|
|
2530
2531
|
async (d, c) => {
|
|
2531
2532
|
r(!0), n(null);
|
|
2532
2533
|
try {
|
|
@@ -2538,7 +2539,7 @@ function na() {
|
|
|
2538
2539
|
}
|
|
2539
2540
|
},
|
|
2540
2541
|
[a]
|
|
2541
|
-
), i =
|
|
2542
|
+
), i = k(
|
|
2542
2543
|
async (d) => {
|
|
2543
2544
|
r(!0), n(null);
|
|
2544
2545
|
try {
|
|
@@ -2550,7 +2551,7 @@ function na() {
|
|
|
2550
2551
|
}
|
|
2551
2552
|
},
|
|
2552
2553
|
[a]
|
|
2553
|
-
), l =
|
|
2554
|
+
), l = k(
|
|
2554
2555
|
async (d, c) => {
|
|
2555
2556
|
r(!0), n(null);
|
|
2556
2557
|
try {
|
|
@@ -2567,7 +2568,7 @@ function na() {
|
|
|
2567
2568
|
}
|
|
2568
2569
|
function ka() {
|
|
2569
2570
|
const { client: a } = A(), [s, r] = g(!1), [o, n] = g(null);
|
|
2570
|
-
return { signUp:
|
|
2571
|
+
return { signUp: k(
|
|
2571
2572
|
async (i, l) => {
|
|
2572
2573
|
r(!0), n(null);
|
|
2573
2574
|
try {
|
|
@@ -2582,23 +2583,23 @@ function ka() {
|
|
|
2582
2583
|
), isLoading: s, error: o, setError: n };
|
|
2583
2584
|
}
|
|
2584
2585
|
function Y() {
|
|
2585
|
-
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 =
|
|
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 () => {
|
|
2586
2587
|
f(!0), m(null);
|
|
2587
2588
|
try {
|
|
2588
|
-
const
|
|
2589
|
-
r(
|
|
2590
|
-
|
|
2591
|
-
|
|
2592
|
-
|
|
2593
|
-
|
|
2594
|
-
|
|
2595
|
-
|
|
2596
|
-
|
|
2597
|
-
|
|
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
|
+
}
|
|
2598
2599
|
}
|
|
2599
2600
|
}
|
|
2600
|
-
} catch (
|
|
2601
|
-
m(
|
|
2601
|
+
} catch ($) {
|
|
2602
|
+
m($ instanceof Error ? $.message : "Failed to load organizations");
|
|
2602
2603
|
} finally {
|
|
2603
2604
|
f(!1);
|
|
2604
2605
|
}
|
|
@@ -2606,69 +2607,69 @@ function Y() {
|
|
|
2606
2607
|
U(() => {
|
|
2607
2608
|
b();
|
|
2608
2609
|
}, [b]);
|
|
2609
|
-
const
|
|
2610
|
+
const w = k(async ($) => {
|
|
2610
2611
|
try {
|
|
2611
|
-
const x = await a.auth.getOrg(
|
|
2612
|
-
n(x), typeof window < "u" && localStorage.setItem("ss_selected_org",
|
|
2613
|
-
const
|
|
2614
|
-
i(
|
|
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);
|
|
2615
2616
|
} catch (x) {
|
|
2616
2617
|
m(x instanceof Error ? x.message : "Failed to load organization");
|
|
2617
2618
|
}
|
|
2618
|
-
}, [a]), y =
|
|
2619
|
+
}, [a]), y = k(async ($, x) => {
|
|
2619
2620
|
try {
|
|
2620
|
-
const
|
|
2621
|
-
return r((E) => [...E,
|
|
2622
|
-
} catch (
|
|
2623
|
-
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;
|
|
2624
2625
|
}
|
|
2625
|
-
}, [a]), O =
|
|
2626
|
+
}, [a]), O = k(async ($, x) => {
|
|
2626
2627
|
try {
|
|
2627
|
-
const
|
|
2628
|
-
return r((E) => E.map((
|
|
2629
|
-
} catch (
|
|
2630
|
-
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;
|
|
2631
2632
|
}
|
|
2632
|
-
}, [a, o]), h =
|
|
2633
|
+
}, [a, o]), h = k(async ($) => {
|
|
2633
2634
|
try {
|
|
2634
|
-
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;
|
|
2635
2636
|
} catch (x) {
|
|
2636
2637
|
return m(x instanceof Error ? x.message : "Failed to delete organization"), !1;
|
|
2637
2638
|
}
|
|
2638
|
-
}, [a, o]),
|
|
2639
|
+
}, [a, o]), N = k(async ($, x, S) => {
|
|
2639
2640
|
try {
|
|
2640
|
-
return await a.auth.sendInvite(
|
|
2641
|
+
return await a.auth.sendInvite($, x, S);
|
|
2641
2642
|
} catch (E) {
|
|
2642
2643
|
return m(E instanceof Error ? E.message : "Failed to send invite"), null;
|
|
2643
2644
|
}
|
|
2644
|
-
}, [a]),
|
|
2645
|
+
}, [a]), C = k(async ($) => {
|
|
2645
2646
|
try {
|
|
2646
|
-
const x = await a.auth.listInvites(
|
|
2647
|
+
const x = await a.auth.listInvites($);
|
|
2647
2648
|
d(x);
|
|
2648
2649
|
} catch (x) {
|
|
2649
2650
|
m(x instanceof Error ? x.message : "Failed to load invites");
|
|
2650
2651
|
}
|
|
2651
|
-
}, [a]), P =
|
|
2652
|
+
}, [a]), P = k(async ($, x) => {
|
|
2652
2653
|
try {
|
|
2653
|
-
return await a.auth.revokeInvite(
|
|
2654
|
-
} catch (
|
|
2655
|
-
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;
|
|
2656
2657
|
}
|
|
2657
|
-
}, [a]), I =
|
|
2658
|
+
}, [a]), I = k(async ($, x, S) => {
|
|
2658
2659
|
try {
|
|
2659
|
-
return await a.auth.updateMemberRole(
|
|
2660
|
+
return await a.auth.updateMemberRole($, x, S), i((E) => E.map((D) => D.userId === x ? { ...D, role: S } : D)), !0;
|
|
2660
2661
|
} catch (E) {
|
|
2661
2662
|
return m(E instanceof Error ? E.message : "Failed to update member role"), !1;
|
|
2662
2663
|
}
|
|
2663
|
-
}, [a]), F =
|
|
2664
|
+
}, [a]), F = k(async ($, x) => {
|
|
2664
2665
|
try {
|
|
2665
|
-
return await a.auth.removeMember(
|
|
2666
|
-
} catch (
|
|
2667
|
-
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;
|
|
2668
2669
|
}
|
|
2669
|
-
}, [a]), B =
|
|
2670
|
+
}, [a]), B = k(async ($) => {
|
|
2670
2671
|
try {
|
|
2671
|
-
const x = await a.auth.listMembers(
|
|
2672
|
+
const x = await a.auth.listMembers($);
|
|
2672
2673
|
i(x);
|
|
2673
2674
|
} catch (x) {
|
|
2674
2675
|
m(x instanceof Error ? x.message : "Failed to load members");
|
|
@@ -2683,12 +2684,12 @@ function Y() {
|
|
|
2683
2684
|
error: p,
|
|
2684
2685
|
setError: m,
|
|
2685
2686
|
refresh: b,
|
|
2686
|
-
selectOrg:
|
|
2687
|
+
selectOrg: w,
|
|
2687
2688
|
createOrg: y,
|
|
2688
2689
|
updateOrg: O,
|
|
2689
2690
|
deleteOrg: h,
|
|
2690
|
-
sendInvite:
|
|
2691
|
-
refreshInvites:
|
|
2691
|
+
sendInvite: N,
|
|
2692
|
+
refreshInvites: C,
|
|
2692
2693
|
revokeInvite: P,
|
|
2693
2694
|
updateMemberRole: I,
|
|
2694
2695
|
removeMember: F,
|
|
@@ -2697,7 +2698,7 @@ function Y() {
|
|
|
2697
2698
|
}
|
|
2698
2699
|
function Ca() {
|
|
2699
2700
|
const { client: a } = A(), [s, r] = g(!1), [o, n] = g(null);
|
|
2700
|
-
return { deleteAccount:
|
|
2701
|
+
return { deleteAccount: k(async () => {
|
|
2701
2702
|
r(!0), n(null);
|
|
2702
2703
|
try {
|
|
2703
2704
|
return await a.auth.deleteAccount(), !0;
|
|
@@ -2709,7 +2710,7 @@ function Ca() {
|
|
|
2709
2710
|
}, [a]), isLoading: s, error: o, setError: n };
|
|
2710
2711
|
}
|
|
2711
2712
|
function oa() {
|
|
2712
|
-
const { client: a, user: s } = A(), [r, o] = g(!1), [n, u] = g(null), [i, l] = g(null), d =
|
|
2713
|
+
const { client: a, user: s } = A(), [r, o] = g(!1), [n, u] = g(null), [i, l] = g(null), d = k(
|
|
2713
2714
|
async (p) => {
|
|
2714
2715
|
o(!0), u(null), l(null);
|
|
2715
2716
|
try {
|
|
@@ -2722,7 +2723,7 @@ function oa() {
|
|
|
2722
2723
|
}
|
|
2723
2724
|
},
|
|
2724
2725
|
[a]
|
|
2725
|
-
), c =
|
|
2726
|
+
), c = k(
|
|
2726
2727
|
async (p, m) => {
|
|
2727
2728
|
o(!0), u(null), l(null);
|
|
2728
2729
|
try {
|
|
@@ -2734,7 +2735,7 @@ function oa() {
|
|
|
2734
2735
|
}
|
|
2735
2736
|
},
|
|
2736
2737
|
[a]
|
|
2737
|
-
), f =
|
|
2738
|
+
), f = k(
|
|
2738
2739
|
async (p) => {
|
|
2739
2740
|
o(!0), u(null), l(null);
|
|
2740
2741
|
try {
|
|
@@ -2750,7 +2751,7 @@ function oa() {
|
|
|
2750
2751
|
);
|
|
2751
2752
|
return { user: s, updateProfile: d, uploadAvatar: f, changePassword: c, isLoading: r, error: n, success: i, setError: u, setSuccess: l };
|
|
2752
2753
|
}
|
|
2753
|
-
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 = {
|
|
2754
2755
|
close: "close",
|
|
2755
2756
|
person: "person",
|
|
2756
2757
|
logout: "logout",
|
|
@@ -2784,47 +2785,47 @@ const ia = '<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d=
|
|
|
2784
2785
|
personRemove: "person_remove"
|
|
2785
2786
|
};
|
|
2786
2787
|
function re({ appearance: a, signUpUrl: s, onSignUp: r }) {
|
|
2787
|
-
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(""), [
|
|
2788
|
-
async (
|
|
2789
|
-
if (
|
|
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(
|
|
2789
|
+
async (T) => {
|
|
2790
|
+
if (T.preventDefault(), N) {
|
|
2790
2791
|
await l(P, F.join(""));
|
|
2791
2792
|
return;
|
|
2792
2793
|
}
|
|
2793
|
-
const z = await u(m,
|
|
2794
|
-
z && xa(z) && (I(z.mfaToken),
|
|
2794
|
+
const z = await u(m, w);
|
|
2795
|
+
z && xa(z) && (I(z.mfaToken), C(!0), f(null));
|
|
2795
2796
|
},
|
|
2796
|
-
[m,
|
|
2797
|
-
),
|
|
2798
|
-
async (
|
|
2799
|
-
await i(
|
|
2797
|
+
[m, w, N, P, F, u, l, f]
|
|
2798
|
+
), S = k(
|
|
2799
|
+
async (T) => {
|
|
2800
|
+
await i(T);
|
|
2800
2801
|
},
|
|
2801
2802
|
[i]
|
|
2802
|
-
), E =
|
|
2803
|
+
), E = k((T, z) => {
|
|
2803
2804
|
var W;
|
|
2804
2805
|
if (!/^\d*$/.test(z)) return;
|
|
2805
2806
|
const L = z.slice(-1);
|
|
2806
2807
|
B((K) => {
|
|
2807
2808
|
const J = [...K];
|
|
2808
|
-
return J[
|
|
2809
|
-
}), L &&
|
|
2810
|
-
}, []),
|
|
2809
|
+
return J[T] = L, J;
|
|
2810
|
+
}), L && T < 5 && ((W = $.current[T + 1]) == null || W.focus());
|
|
2811
|
+
}, []), D = k((T, z) => {
|
|
2811
2812
|
var L;
|
|
2812
|
-
z.key === "Backspace" && !F[
|
|
2813
|
+
z.key === "Backspace" && !F[T] && T > 0 && ((L = $.current[T - 1]) == null || L.focus());
|
|
2813
2814
|
}, [F]), V = (n == null ? void 0 : n.googleEnabled) || (n == null ? void 0 : n.githubEnabled);
|
|
2814
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: [
|
|
2815
2816
|
/* @__PURE__ */ t("div", { className: "ss-auth-header", children: [
|
|
2816
|
-
/* @__PURE__ */ e("div", { className: "ss-auth-brand-icon", children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children:
|
|
2817
|
+
/* @__PURE__ */ e("div", { className: "ss-auth-brand-icon", children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: v.token }) }),
|
|
2817
2818
|
/* @__PURE__ */ e("h1", { className: "ss-auth-title", children: "Sign in to your account" }),
|
|
2818
2819
|
/* @__PURE__ */ e("p", { className: "ss-auth-subtitle", children: "Welcome back to your workspace" })
|
|
2819
2820
|
] }),
|
|
2820
|
-
!
|
|
2821
|
+
!N && V && /* @__PURE__ */ t(j, { children: [
|
|
2821
2822
|
/* @__PURE__ */ t("div", { className: "ss-auth-oauth-grid", children: [
|
|
2822
2823
|
(n == null ? void 0 : n.googleEnabled) && /* @__PURE__ */ t(
|
|
2823
2824
|
"button",
|
|
2824
2825
|
{
|
|
2825
2826
|
type: "button",
|
|
2826
2827
|
className: "ss-auth-btn-social",
|
|
2827
|
-
onClick: () =>
|
|
2828
|
+
onClick: () => S("google"),
|
|
2828
2829
|
disabled: d,
|
|
2829
2830
|
children: [
|
|
2830
2831
|
/* @__PURE__ */ e("span", { dangerouslySetInnerHTML: { __html: ia } }),
|
|
@@ -2837,7 +2838,7 @@ function re({ appearance: a, signUpUrl: s, onSignUp: r }) {
|
|
|
2837
2838
|
{
|
|
2838
2839
|
type: "button",
|
|
2839
2840
|
className: "ss-auth-btn-social",
|
|
2840
|
-
onClick: () =>
|
|
2841
|
+
onClick: () => S("github"),
|
|
2841
2842
|
disabled: d,
|
|
2842
2843
|
children: [
|
|
2843
2844
|
/* @__PURE__ */ e("span", { dangerouslySetInnerHTML: { __html: la } }),
|
|
@@ -2849,27 +2850,27 @@ function re({ appearance: a, signUpUrl: s, onSignUp: r }) {
|
|
|
2849
2850
|
/* @__PURE__ */ e("div", { className: "ss-auth-divider", children: "or continue with" })
|
|
2850
2851
|
] }),
|
|
2851
2852
|
c && /* @__PURE__ */ t("div", { className: "ss-auth-error", children: [
|
|
2852
|
-
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children:
|
|
2853
|
+
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: v.errorOutline }),
|
|
2853
2854
|
/* @__PURE__ */ e("span", { children: c })
|
|
2854
2855
|
] }),
|
|
2855
2856
|
/* @__PURE__ */ t("form", { onSubmit: x, children: [
|
|
2856
|
-
|
|
2857
|
+
N ? /* @__PURE__ */ t(j, { children: [
|
|
2857
2858
|
/* @__PURE__ */ e("div", { className: "ss-auth-mfa-divider", children: /* @__PURE__ */ e("span", { children: "Verification Required" }) }),
|
|
2858
2859
|
/* @__PURE__ */ t("div", { className: "ss-auth-field", children: [
|
|
2859
2860
|
/* @__PURE__ */ e("label", { className: "ss-auth-label", children: "6-Digit Code" }),
|
|
2860
|
-
/* @__PURE__ */ e("div", { className: "ss-auth-mfa-group", children: F.map((
|
|
2861
|
+
/* @__PURE__ */ e("div", { className: "ss-auth-mfa-group", children: F.map((T, z) => /* @__PURE__ */ e(
|
|
2861
2862
|
"input",
|
|
2862
2863
|
{
|
|
2863
2864
|
ref: (L) => {
|
|
2864
|
-
|
|
2865
|
+
$.current[z] = L;
|
|
2865
2866
|
},
|
|
2866
2867
|
className: "ss-auth-mfa-digit",
|
|
2867
2868
|
type: "text",
|
|
2868
2869
|
inputMode: "numeric",
|
|
2869
2870
|
maxLength: 1,
|
|
2870
|
-
value:
|
|
2871
|
+
value: T,
|
|
2871
2872
|
onChange: (L) => E(z, L.target.value),
|
|
2872
|
-
onKeyDown: (L) =>
|
|
2873
|
+
onKeyDown: (L) => D(z, L),
|
|
2873
2874
|
autoFocus: z === 0
|
|
2874
2875
|
},
|
|
2875
2876
|
z
|
|
@@ -2888,7 +2889,7 @@ function re({ appearance: a, signUpUrl: s, onSignUp: r }) {
|
|
|
2888
2889
|
autoComplete: "email",
|
|
2889
2890
|
placeholder: "name@company.com",
|
|
2890
2891
|
value: m,
|
|
2891
|
-
onChange: (
|
|
2892
|
+
onChange: (T) => b(T.target.value),
|
|
2892
2893
|
required: !0
|
|
2893
2894
|
}
|
|
2894
2895
|
)
|
|
@@ -2907,8 +2908,8 @@ function re({ appearance: a, signUpUrl: s, onSignUp: r }) {
|
|
|
2907
2908
|
type: O ? "text" : "password",
|
|
2908
2909
|
autoComplete: "current-password",
|
|
2909
2910
|
placeholder: "••••••••",
|
|
2910
|
-
value:
|
|
2911
|
-
onChange: (
|
|
2911
|
+
value: w,
|
|
2912
|
+
onChange: (T) => y(T.target.value),
|
|
2912
2913
|
required: !0
|
|
2913
2914
|
}
|
|
2914
2915
|
),
|
|
@@ -2918,7 +2919,7 @@ function re({ appearance: a, signUpUrl: s, onSignUp: r }) {
|
|
|
2918
2919
|
type: "button",
|
|
2919
2920
|
className: "ss-auth-visibility-toggle",
|
|
2920
2921
|
onClick: () => h(!O),
|
|
2921
|
-
children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: O ?
|
|
2922
|
+
children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: O ? v.visibilityOff : v.visibility })
|
|
2922
2923
|
}
|
|
2923
2924
|
)
|
|
2924
2925
|
] })
|
|
@@ -2926,16 +2927,16 @@ function re({ appearance: a, signUpUrl: s, onSignUp: r }) {
|
|
|
2926
2927
|
] }),
|
|
2927
2928
|
/* @__PURE__ */ t("button", { type: "submit", className: "ss-auth-btn-primary", disabled: d, children: [
|
|
2928
2929
|
d && /* @__PURE__ */ e("span", { className: "ss-auth-spinner" }),
|
|
2929
|
-
|
|
2930
|
-
!d && /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children:
|
|
2930
|
+
N ? "Verify" : "Sign in",
|
|
2931
|
+
!d && /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: v.arrowForward })
|
|
2931
2932
|
] })
|
|
2932
2933
|
] }),
|
|
2933
|
-
|
|
2934
|
+
N ? /* @__PURE__ */ e("div", { className: "ss-auth-footer", children: /* @__PURE__ */ e(
|
|
2934
2935
|
"span",
|
|
2935
2936
|
{
|
|
2936
2937
|
className: "ss-auth-link",
|
|
2937
2938
|
onClick: () => {
|
|
2938
|
-
|
|
2939
|
+
C(!1), B(["", "", "", "", "", ""]), f(null);
|
|
2939
2940
|
},
|
|
2940
2941
|
children: "Back to sign in"
|
|
2941
2942
|
}
|
|
@@ -2947,29 +2948,29 @@ function re({ appearance: a, signUpUrl: s, onSignUp: r }) {
|
|
|
2947
2948
|
] }) }) });
|
|
2948
2949
|
}
|
|
2949
2950
|
function ne({ appearance: a, signInUrl: s, onSignIn: r }) {
|
|
2950
|
-
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,
|
|
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(
|
|
2951
2952
|
async (x) => {
|
|
2952
2953
|
if (x.preventDefault(), P(null), b !== y) {
|
|
2953
2954
|
P("Passwords do not match");
|
|
2954
2955
|
return;
|
|
2955
2956
|
}
|
|
2956
|
-
const
|
|
2957
|
-
if (b.length <
|
|
2958
|
-
P(`Password must be at least ${
|
|
2957
|
+
const S = (n == null ? void 0 : n.passwordMinLength) ?? 8;
|
|
2958
|
+
if (b.length < S) {
|
|
2959
|
+
P(`Password must be at least ${S} characters`);
|
|
2959
2960
|
return;
|
|
2960
2961
|
}
|
|
2961
2962
|
await u(p, b);
|
|
2962
2963
|
},
|
|
2963
2964
|
[p, b, y, n, u]
|
|
2964
|
-
), F =
|
|
2965
|
+
), F = k(
|
|
2965
2966
|
async (x) => {
|
|
2966
2967
|
await c(x);
|
|
2967
2968
|
},
|
|
2968
2969
|
[c]
|
|
2969
|
-
), B = (n == null ? void 0 : n.googleEnabled) || (n == null ? void 0 : n.githubEnabled),
|
|
2970
|
+
), B = (n == null ? void 0 : n.googleEnabled) || (n == null ? void 0 : n.githubEnabled), $ = C || l;
|
|
2970
2971
|
return /* @__PURE__ */ e(H, { appearance: f, children: /* @__PURE__ */ t("div", { style: { display: "flex", flexDirection: "column", alignItems: "center", width: "100%", maxWidth: "520px" }, children: [
|
|
2971
2972
|
/* @__PURE__ */ t("div", { className: "ss-auth-header", children: [
|
|
2972
|
-
/* @__PURE__ */ e("div", { className: "ss-auth-brand-icon-gradient", children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children:
|
|
2973
|
+
/* @__PURE__ */ e("div", { className: "ss-auth-brand-icon-gradient", children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: v.autoAwesome }) }),
|
|
2973
2974
|
/* @__PURE__ */ e("h1", { className: "ss-auth-title ss-auth-title-lg", children: "Create your account" }),
|
|
2974
2975
|
/* @__PURE__ */ e("p", { className: "ss-auth-subtitle", children: "Join the ecosystem" })
|
|
2975
2976
|
] }),
|
|
@@ -3005,9 +3006,9 @@ function ne({ appearance: a, signInUrl: s, onSignIn: r }) {
|
|
|
3005
3006
|
] }),
|
|
3006
3007
|
/* @__PURE__ */ e("div", { className: "ss-auth-divider", children: "or sign up with email" })
|
|
3007
3008
|
] }),
|
|
3008
|
-
|
|
3009
|
-
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children:
|
|
3010
|
-
/* @__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: $ })
|
|
3011
3012
|
] }),
|
|
3012
3013
|
/* @__PURE__ */ t("form", { onSubmit: I, children: [
|
|
3013
3014
|
/* @__PURE__ */ t("div", { className: "ss-auth-field", children: [
|
|
@@ -3039,7 +3040,7 @@ function ne({ appearance: a, signInUrl: s, onSignIn: r }) {
|
|
|
3039
3040
|
placeholder: "••••••••",
|
|
3040
3041
|
value: b,
|
|
3041
3042
|
onChange: (x) => {
|
|
3042
|
-
|
|
3043
|
+
w(x.target.value), P(null);
|
|
3043
3044
|
},
|
|
3044
3045
|
required: !0
|
|
3045
3046
|
}
|
|
@@ -3049,8 +3050,8 @@ function ne({ appearance: a, signInUrl: s, onSignIn: r }) {
|
|
|
3049
3050
|
{
|
|
3050
3051
|
type: "button",
|
|
3051
3052
|
className: "ss-auth-visibility-toggle",
|
|
3052
|
-
onClick: () =>
|
|
3053
|
-
children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: h ?
|
|
3053
|
+
onClick: () => N(!h),
|
|
3054
|
+
children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: h ? v.visibilityOff : v.visibility })
|
|
3054
3055
|
}
|
|
3055
3056
|
)
|
|
3056
3057
|
] })
|
|
@@ -3076,7 +3077,7 @@ function ne({ appearance: a, signInUrl: s, onSignIn: r }) {
|
|
|
3076
3077
|
/* @__PURE__ */ t("button", { type: "submit", className: "ss-auth-btn-primary", disabled: i, children: [
|
|
3077
3078
|
i && /* @__PURE__ */ e("span", { className: "ss-auth-spinner" }),
|
|
3078
3079
|
"Sign up",
|
|
3079
|
-
!i && /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children:
|
|
3080
|
+
!i && /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: v.arrowForward })
|
|
3080
3081
|
] })
|
|
3081
3082
|
] }),
|
|
3082
3083
|
/* @__PURE__ */ t("div", { className: "ss-auth-footer", children: [
|
|
@@ -3087,29 +3088,29 @@ function ne({ appearance: a, signInUrl: s, onSignIn: r }) {
|
|
|
3087
3088
|
] }) })
|
|
3088
3089
|
] }) });
|
|
3089
3090
|
}
|
|
3090
|
-
const
|
|
3091
|
+
const M = 320, q = 128;
|
|
3091
3092
|
function za({ file: a, onCrop: s, onCancel: r }) {
|
|
3092
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);
|
|
3093
3094
|
U(() => {
|
|
3094
|
-
const h = new Image(),
|
|
3095
|
+
const h = new Image(), N = URL.createObjectURL(a);
|
|
3095
3096
|
return h.onload = () => {
|
|
3096
3097
|
n.current = h, b(!0), d({ x: 0, y: 0 }), i(1);
|
|
3097
|
-
}, h.src =
|
|
3098
|
+
}, h.src = N, () => URL.revokeObjectURL(N);
|
|
3098
3099
|
}, [a]), U(() => {
|
|
3099
3100
|
if (!m || !n.current || !o.current) return;
|
|
3100
3101
|
const h = o.current.getContext("2d");
|
|
3101
3102
|
if (!h) return;
|
|
3102
|
-
const
|
|
3103
|
-
h.clearRect(0, 0,
|
|
3104
|
-
const
|
|
3105
|
-
h.save(), h.beginPath(), h.arc(
|
|
3103
|
+
const N = n.current;
|
|
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();
|
|
3106
3107
|
}, [u, l, m]);
|
|
3107
|
-
const
|
|
3108
|
+
const w = k(
|
|
3108
3109
|
(h) => {
|
|
3109
3110
|
f(!0), p.current = { x: h.clientX, y: h.clientY, ox: l.x, oy: l.y }, h.target.setPointerCapture(h.pointerId);
|
|
3110
3111
|
},
|
|
3111
3112
|
[l]
|
|
3112
|
-
), y =
|
|
3113
|
+
), y = k(
|
|
3113
3114
|
(h) => {
|
|
3114
3115
|
c && d({
|
|
3115
3116
|
x: p.current.ox + (h.clientX - p.current.x),
|
|
@@ -3117,16 +3118,16 @@ function za({ file: a, onCrop: s, onCancel: r }) {
|
|
|
3117
3118
|
});
|
|
3118
3119
|
},
|
|
3119
3120
|
[c]
|
|
3120
|
-
), O =
|
|
3121
|
-
return
|
|
3121
|
+
), O = k(() => f(!1), []);
|
|
3122
|
+
return k(() => {
|
|
3122
3123
|
if (!n.current) return;
|
|
3123
|
-
const h = document.createElement("canvas"),
|
|
3124
|
-
h.width =
|
|
3125
|
-
const
|
|
3126
|
-
if (!
|
|
3127
|
-
const P = n.current, I = Math.max(
|
|
3128
|
-
|
|
3129
|
-
|
|
3124
|
+
const h = document.createElement("canvas"), N = q * 2;
|
|
3125
|
+
h.width = N, h.height = N;
|
|
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);
|
|
3130
3131
|
}, "image/png");
|
|
3131
3132
|
}, [u, l, s]), /* @__PURE__ */ t("div", { style: { display: "flex", flexDirection: "column", alignItems: "center", gap: "24px" }, children: [
|
|
3132
3133
|
/* @__PURE__ */ t("div", { className: "ss-auth-crop-area", children: [
|
|
@@ -3134,10 +3135,10 @@ function za({ file: a, onCrop: s, onCancel: r }) {
|
|
|
3134
3135
|
"canvas",
|
|
3135
3136
|
{
|
|
3136
3137
|
ref: o,
|
|
3137
|
-
width:
|
|
3138
|
-
height:
|
|
3138
|
+
width: M,
|
|
3139
|
+
height: M,
|
|
3139
3140
|
style: { cursor: c ? "grabbing" : "grab", width: "100%", height: "100%" },
|
|
3140
|
-
onPointerDown:
|
|
3141
|
+
onPointerDown: w,
|
|
3141
3142
|
onPointerMove: y,
|
|
3142
3143
|
onPointerUp: O
|
|
3143
3144
|
}
|
|
@@ -3145,7 +3146,7 @@ function za({ file: a, onCrop: s, onCancel: r }) {
|
|
|
3145
3146
|
/* @__PURE__ */ e("div", { className: "ss-auth-crop-size-badge", children: "256 x 256 px" })
|
|
3146
3147
|
] }),
|
|
3147
3148
|
/* @__PURE__ */ t("div", { className: "ss-auth-zoom-control", style: { width: "100%", maxWidth: "280px" }, children: [
|
|
3148
|
-
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children:
|
|
3149
|
+
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: v.zoomOut }),
|
|
3149
3150
|
/* @__PURE__ */ e(
|
|
3150
3151
|
"input",
|
|
3151
3152
|
{
|
|
@@ -3158,12 +3159,12 @@ function za({ file: a, onCrop: s, onCancel: r }) {
|
|
|
3158
3159
|
className: "ss-auth-zoom-slider"
|
|
3159
3160
|
}
|
|
3160
3161
|
),
|
|
3161
|
-
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children:
|
|
3162
|
+
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: v.zoomIn })
|
|
3162
3163
|
] })
|
|
3163
3164
|
] });
|
|
3164
3165
|
}
|
|
3165
3166
|
function ca({ onUpload: a, onClose: s, isLoading: r }) {
|
|
3166
|
-
const [o, n] = g(null), [u, i] = g(!1), [l, d] = g(null), c = _(null), f =
|
|
3167
|
+
const [o, n] = g(null), [u, i] = g(!1), [l, d] = g(null), c = _(null), f = k((b) => {
|
|
3167
3168
|
if (!b.type.startsWith("image/")) {
|
|
3168
3169
|
d("Please select an image file");
|
|
3169
3170
|
return;
|
|
@@ -3173,14 +3174,14 @@ function ca({ onUpload: a, onClose: s, isLoading: r }) {
|
|
|
3173
3174
|
return;
|
|
3174
3175
|
}
|
|
3175
3176
|
d(null), n(b);
|
|
3176
|
-
}, []), p =
|
|
3177
|
+
}, []), p = k(
|
|
3177
3178
|
(b) => {
|
|
3178
3179
|
b.preventDefault(), i(!1);
|
|
3179
|
-
const
|
|
3180
|
-
|
|
3180
|
+
const w = b.dataTransfer.files[0];
|
|
3181
|
+
w && f(w);
|
|
3181
3182
|
},
|
|
3182
3183
|
[f]
|
|
3183
|
-
), m =
|
|
3184
|
+
), m = k(
|
|
3184
3185
|
async (b) => {
|
|
3185
3186
|
await a(b);
|
|
3186
3187
|
},
|
|
@@ -3191,11 +3192,11 @@ function ca({ onUpload: a, onClose: s, isLoading: r }) {
|
|
|
3191
3192
|
}, children: /* @__PURE__ */ t("div", { className: "ss-auth-modal ss-auth-card-wide", children: [
|
|
3192
3193
|
/* @__PURE__ */ t("div", { className: "ss-auth-modal-header", children: [
|
|
3193
3194
|
/* @__PURE__ */ e("h2", { children: "Upload avatar" }),
|
|
3194
|
-
/* @__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 }) })
|
|
3195
3196
|
] }),
|
|
3196
3197
|
/* @__PURE__ */ t("div", { className: "ss-auth-modal-body", children: [
|
|
3197
3198
|
l && /* @__PURE__ */ t("div", { className: "ss-auth-error", style: { marginBottom: "24px" }, children: [
|
|
3198
|
-
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children:
|
|
3199
|
+
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: v.errorOutline }),
|
|
3199
3200
|
/* @__PURE__ */ e("span", { children: l })
|
|
3200
3201
|
] }),
|
|
3201
3202
|
/* @__PURE__ */ t("div", { className: "ss-auth-upload-grid", children: [
|
|
@@ -3213,7 +3214,7 @@ function ca({ onUpload: a, onClose: s, isLoading: r }) {
|
|
|
3213
3214
|
aspectRatio: "1"
|
|
3214
3215
|
},
|
|
3215
3216
|
children: [
|
|
3216
|
-
/* @__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 }),
|
|
3217
3218
|
/* @__PURE__ */ e("span", { style: { fontSize: "12px", opacity: 0.4 }, children: "No image selected" })
|
|
3218
3219
|
]
|
|
3219
3220
|
}
|
|
@@ -3234,7 +3235,7 @@ function ca({ onUpload: a, onClose: s, isLoading: r }) {
|
|
|
3234
3235
|
},
|
|
3235
3236
|
style: { minHeight: "180px" },
|
|
3236
3237
|
children: [
|
|
3237
|
-
/* @__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 }) }),
|
|
3238
3239
|
/* @__PURE__ */ e("span", { className: "ss-auth-dropzone-title", children: "Drag and drop" }),
|
|
3239
3240
|
/* @__PURE__ */ t("span", { className: "ss-auth-dropzone-desc", children: [
|
|
3240
3241
|
"JPG, PNG or WEBP",
|
|
@@ -3250,8 +3251,8 @@ function ca({ onUpload: a, onClose: s, isLoading: r }) {
|
|
|
3250
3251
|
accept: "image/*",
|
|
3251
3252
|
style: { display: "none" },
|
|
3252
3253
|
onChange: (b) => {
|
|
3253
|
-
var
|
|
3254
|
-
(
|
|
3254
|
+
var w;
|
|
3255
|
+
(w = b.target.files) != null && w[0] && f(b.target.files[0]);
|
|
3255
3256
|
}
|
|
3256
3257
|
}
|
|
3257
3258
|
)
|
|
@@ -3259,7 +3260,7 @@ function ca({ onUpload: a, onClose: s, isLoading: r }) {
|
|
|
3259
3260
|
}
|
|
3260
3261
|
),
|
|
3261
3262
|
/* @__PURE__ */ t("div", { className: "ss-auth-info-box", children: [
|
|
3262
|
-
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children:
|
|
3263
|
+
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: v.info }),
|
|
3263
3264
|
/* @__PURE__ */ e("span", { children: "Your profile photo will be visible to all members of your organization." })
|
|
3264
3265
|
] })
|
|
3265
3266
|
] })
|
|
@@ -3279,7 +3280,7 @@ function ca({ onUpload: a, onClose: s, isLoading: r }) {
|
|
|
3279
3280
|
children: [
|
|
3280
3281
|
r && /* @__PURE__ */ e("span", { className: "ss-auth-spinner" }),
|
|
3281
3282
|
"Save Profile",
|
|
3282
|
-
!r && /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children:
|
|
3283
|
+
!r && /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: v.check })
|
|
3283
3284
|
]
|
|
3284
3285
|
}
|
|
3285
3286
|
)
|
|
@@ -3288,17 +3289,15 @@ function ca({ onUpload: a, onClose: s, isLoading: r }) {
|
|
|
3288
3289
|
}
|
|
3289
3290
|
function Pa({ onClose: a, afterDeleteAccountUrl: s, defaultTab: r = "profile" }) {
|
|
3290
3291
|
const [o, n] = g(r), u = [
|
|
3291
|
-
{ key: "profile", label: "Profile", icon:
|
|
3292
|
-
{ key: "organization", label: "Organization", icon:
|
|
3293
|
-
{ key: "people", label: "People", icon:
|
|
3294
|
-
{ key: "billing", label: "Billing", icon:
|
|
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 }
|
|
3295
3296
|
];
|
|
3296
|
-
return /* @__PURE__ */
|
|
3297
|
-
i.target === i.currentTarget && a();
|
|
3298
|
-
}, children: /* @__PURE__ */ t("div", { className: "ss-auth-settings-page", children: [
|
|
3297
|
+
return /* @__PURE__ */ t("div", { className: "ss-auth-settings-page", children: [
|
|
3299
3298
|
/* @__PURE__ */ t("div", { className: "ss-auth-settings-header", children: [
|
|
3300
3299
|
/* @__PURE__ */ e("h2", { children: "Settings" }),
|
|
3301
|
-
/* @__PURE__ */ e("button", { type: "button", className: "ss-auth-modal-close", onClick: a, children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children:
|
|
3300
|
+
/* @__PURE__ */ e("button", { type: "button", className: "ss-auth-modal-close", onClick: a, children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: v.close }) })
|
|
3302
3301
|
] }),
|
|
3303
3302
|
/* @__PURE__ */ t("div", { className: "ss-auth-settings-layout", children: [
|
|
3304
3303
|
/* @__PURE__ */ e("nav", { className: "ss-auth-settings-nav", children: u.map((i) => /* @__PURE__ */ t(
|
|
@@ -3321,34 +3320,34 @@ function Pa({ onClose: a, afterDeleteAccountUrl: s, defaultTab: r = "profile" })
|
|
|
3321
3320
|
o === "billing" && /* @__PURE__ */ e(Fa, {})
|
|
3322
3321
|
] })
|
|
3323
3322
|
] })
|
|
3324
|
-
] })
|
|
3323
|
+
] });
|
|
3325
3324
|
}
|
|
3326
3325
|
function Oa({ afterDeleteAccountUrl: a }) {
|
|
3327
|
-
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:
|
|
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(
|
|
3328
3327
|
async (R) => {
|
|
3329
3328
|
R.preventDefault(), d(null), c(null), await r({ name: y, avatarUrl: h || void 0 });
|
|
3330
3329
|
},
|
|
3331
3330
|
[y, h, r, d, c]
|
|
3332
|
-
), K =
|
|
3331
|
+
), K = k(
|
|
3333
3332
|
async (R) => {
|
|
3334
3333
|
const X = await o(R);
|
|
3335
|
-
X && (
|
|
3334
|
+
X && (N(X.avatarUrl), P(!1));
|
|
3336
3335
|
},
|
|
3337
3336
|
[o]
|
|
3338
|
-
), J =
|
|
3337
|
+
), J = k(
|
|
3339
3338
|
async (R) => {
|
|
3340
|
-
if (R.preventDefault(),
|
|
3341
|
-
|
|
3339
|
+
if (R.preventDefault(), D(null), d(null), c(null), B !== x) {
|
|
3340
|
+
D("Passwords do not match");
|
|
3342
3341
|
return;
|
|
3343
3342
|
}
|
|
3344
3343
|
if (B.length < 8) {
|
|
3345
|
-
|
|
3344
|
+
D("Password must be at least 8 characters");
|
|
3346
3345
|
return;
|
|
3347
3346
|
}
|
|
3348
|
-
await n(I, B) && (F(""),
|
|
3347
|
+
await n(I, B) && (F(""), $(""), S(""));
|
|
3349
3348
|
},
|
|
3350
3349
|
[I, B, x, n, d, c]
|
|
3351
|
-
), ua =
|
|
3350
|
+
), ua = k(async () => {
|
|
3352
3351
|
await p() && (await f(), a && (window.location.href = a));
|
|
3353
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();
|
|
3354
3353
|
return /* @__PURE__ */ t(j, { children: [
|
|
@@ -3367,7 +3366,7 @@ function Oa({ afterDeleteAccountUrl: a }) {
|
|
|
3367
3366
|
opacity: 0.4
|
|
3368
3367
|
}, children: ga }),
|
|
3369
3368
|
/* @__PURE__ */ t("div", { className: "ss-auth-avatar-overlay", children: [
|
|
3370
|
-
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children:
|
|
3369
|
+
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: v.camera }),
|
|
3371
3370
|
/* @__PURE__ */ e("span", { children: "Edit" })
|
|
3372
3371
|
] })
|
|
3373
3372
|
] }),
|
|
@@ -3375,7 +3374,7 @@ function Oa({ afterDeleteAccountUrl: a }) {
|
|
|
3375
3374
|
/* @__PURE__ */ t("h2", { className: "ss-auth-profile-name", children: [
|
|
3376
3375
|
(s == null ? void 0 : s.name) || "Unnamed User",
|
|
3377
3376
|
(s == null ? void 0 : s.emailVerified) && /* @__PURE__ */ t("span", { className: "ss-auth-badge ss-auth-badge-success", children: [
|
|
3378
|
-
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", style: { fontSize: "12px", fontVariationSettings: "'FILL' 1" }, children:
|
|
3377
|
+
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", style: { fontSize: "12px", fontVariationSettings: "'FILL' 1" }, children: v.verified }),
|
|
3379
3378
|
"Verified"
|
|
3380
3379
|
] })
|
|
3381
3380
|
] }),
|
|
@@ -3383,11 +3382,11 @@ function Oa({ afterDeleteAccountUrl: a }) {
|
|
|
3383
3382
|
] })
|
|
3384
3383
|
] }),
|
|
3385
3384
|
i && /* @__PURE__ */ t("div", { className: "ss-auth-error", children: [
|
|
3386
|
-
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children:
|
|
3385
|
+
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: v.errorOutline }),
|
|
3387
3386
|
/* @__PURE__ */ e("span", { children: i })
|
|
3388
3387
|
] }),
|
|
3389
3388
|
l && /* @__PURE__ */ t("div", { className: "ss-auth-info-box", style: { marginBottom: "16px" }, children: [
|
|
3390
|
-
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children:
|
|
3389
|
+
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: v.check }),
|
|
3391
3390
|
/* @__PURE__ */ e("span", { children: l })
|
|
3392
3391
|
] }),
|
|
3393
3392
|
/* @__PURE__ */ t("form", { onSubmit: W, children: [
|
|
@@ -3409,7 +3408,7 @@ function Oa({ afterDeleteAccountUrl: a }) {
|
|
|
3409
3408
|
/* @__PURE__ */ e("label", { className: "ss-auth-label", children: "Email Address" }),
|
|
3410
3409
|
/* @__PURE__ */ t("div", { style: { position: "relative" }, children: [
|
|
3411
3410
|
/* @__PURE__ */ e("input", { className: "ss-auth-input ss-auth-input-readonly", type: "email", value: (s == null ? void 0 : s.email) ?? "", readOnly: !0 }),
|
|
3412
|
-
/* @__PURE__ */ e("span", { className: "ss-auth-visibility-toggle", style: { cursor: "default" }, children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", style: { fontSize: "18px" }, children:
|
|
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 }) })
|
|
3413
3412
|
] })
|
|
3414
3413
|
] }),
|
|
3415
3414
|
/* @__PURE__ */ t("div", { children: [
|
|
@@ -3425,11 +3424,11 @@ function Oa({ afterDeleteAccountUrl: a }) {
|
|
|
3425
3424
|
] }),
|
|
3426
3425
|
pa && /* @__PURE__ */ t("div", { className: "ss-auth-settings-card", children: [
|
|
3427
3426
|
/* @__PURE__ */ t("h4", { children: [
|
|
3428
|
-
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children:
|
|
3427
|
+
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: v.security }),
|
|
3429
3428
|
"Security Credentials"
|
|
3430
3429
|
] }),
|
|
3431
3430
|
E && /* @__PURE__ */ t("div", { className: "ss-auth-error", style: { marginBottom: "16px" }, children: [
|
|
3432
|
-
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children:
|
|
3431
|
+
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: v.errorOutline }),
|
|
3433
3432
|
/* @__PURE__ */ e("span", { children: E })
|
|
3434
3433
|
] }),
|
|
3435
3434
|
/* @__PURE__ */ t("form", { onSubmit: J, children: [
|
|
@@ -3440,11 +3439,11 @@ function Oa({ afterDeleteAccountUrl: a }) {
|
|
|
3440
3439
|
/* @__PURE__ */ t("div", { className: "ss-auth-profile-grid", style: { marginBottom: "16px" }, children: [
|
|
3441
3440
|
/* @__PURE__ */ t("div", { children: [
|
|
3442
3441
|
/* @__PURE__ */ e("label", { className: "ss-auth-label", children: "New Password" }),
|
|
3443
|
-
/* @__PURE__ */ e("input", { className: "ss-auth-input", type: "password", placeholder: "Min. 8 characters", value: B, onChange: (R) =>
|
|
3442
|
+
/* @__PURE__ */ e("input", { className: "ss-auth-input", type: "password", placeholder: "Min. 8 characters", value: B, onChange: (R) => $(R.target.value), required: !0 })
|
|
3444
3443
|
] }),
|
|
3445
3444
|
/* @__PURE__ */ t("div", { children: [
|
|
3446
3445
|
/* @__PURE__ */ e("label", { className: "ss-auth-label", children: "Confirm New Password" }),
|
|
3447
|
-
/* @__PURE__ */ e("input", { className: "ss-auth-input", type: "password", placeholder: "Repeat new password", value: x, onChange: (R) =>
|
|
3446
|
+
/* @__PURE__ */ e("input", { className: "ss-auth-input", type: "password", placeholder: "Repeat new password", value: x, onChange: (R) => S(R.target.value), required: !0 })
|
|
3448
3447
|
] })
|
|
3449
3448
|
] }),
|
|
3450
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" }) })
|
|
@@ -3454,7 +3453,7 @@ function Oa({ afterDeleteAccountUrl: a }) {
|
|
|
3454
3453
|
/* @__PURE__ */ e("h4", { children: "Danger Zone" }),
|
|
3455
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." }),
|
|
3456
3455
|
b && /* @__PURE__ */ t("div", { className: "ss-auth-error", children: [
|
|
3457
|
-
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children:
|
|
3456
|
+
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: v.errorOutline }),
|
|
3458
3457
|
/* @__PURE__ */ e("span", { children: b })
|
|
3459
3458
|
] }),
|
|
3460
3459
|
V ? /* @__PURE__ */ t("div", { children: [
|
|
@@ -3479,7 +3478,7 @@ function Oa({ afterDeleteAccountUrl: a }) {
|
|
|
3479
3478
|
type: "button",
|
|
3480
3479
|
className: "ss-auth-btn-ghost",
|
|
3481
3480
|
onClick: () => {
|
|
3482
|
-
|
|
3481
|
+
T(!1), L(""), w(null);
|
|
3483
3482
|
},
|
|
3484
3483
|
children: "Cancel"
|
|
3485
3484
|
}
|
|
@@ -3505,12 +3504,12 @@ function Oa({ afterDeleteAccountUrl: a }) {
|
|
|
3505
3504
|
type: "button",
|
|
3506
3505
|
className: "ss-auth-btn-outline",
|
|
3507
3506
|
style: { borderColor: "currentColor", width: "auto" },
|
|
3508
|
-
onClick: () =>
|
|
3507
|
+
onClick: () => T(!0),
|
|
3509
3508
|
children: "Delete my account"
|
|
3510
3509
|
}
|
|
3511
3510
|
)
|
|
3512
3511
|
] }),
|
|
3513
|
-
|
|
3512
|
+
C && /* @__PURE__ */ e(
|
|
3514
3513
|
ca,
|
|
3515
3514
|
{
|
|
3516
3515
|
onUpload: K,
|
|
@@ -3521,22 +3520,22 @@ function Oa({ afterDeleteAccountUrl: a }) {
|
|
|
3521
3520
|
] });
|
|
3522
3521
|
}
|
|
3523
3522
|
function Ea() {
|
|
3524
|
-
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), [
|
|
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("");
|
|
3525
3524
|
if (U(() => {
|
|
3526
3525
|
a && l(a.name);
|
|
3527
3526
|
}, [a]), !a)
|
|
3528
3527
|
return /* @__PURE__ */ t(j, { children: [
|
|
3529
3528
|
/* @__PURE__ */ e("h3", { children: "Organization" }),
|
|
3530
3529
|
/* @__PURE__ */ t("div", { className: "ss-auth-settings-empty", children: [
|
|
3531
|
-
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children:
|
|
3530
|
+
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: v.corporateFare }),
|
|
3532
3531
|
/* @__PURE__ */ e("div", { children: "Select an organization from the user menu to manage its settings." })
|
|
3533
3532
|
] })
|
|
3534
3533
|
] });
|
|
3535
|
-
const O = async (
|
|
3536
|
-
if (
|
|
3534
|
+
const O = async (N) => {
|
|
3535
|
+
if (N.preventDefault(), !i.trim()) return;
|
|
3537
3536
|
c(!0), p(!1);
|
|
3538
|
-
const
|
|
3539
|
-
c(!1),
|
|
3537
|
+
const C = await s(a.id, { name: i.trim() });
|
|
3538
|
+
c(!1), C && p(!0);
|
|
3540
3539
|
}, h = async () => {
|
|
3541
3540
|
await r(a.id) && b(!1);
|
|
3542
3541
|
};
|
|
@@ -3544,15 +3543,15 @@ function Ea() {
|
|
|
3544
3543
|
/* @__PURE__ */ e("h3", { children: "Organization" }),
|
|
3545
3544
|
/* @__PURE__ */ t("div", { className: "ss-auth-settings-card", children: [
|
|
3546
3545
|
/* @__PURE__ */ t("h4", { children: [
|
|
3547
|
-
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children:
|
|
3546
|
+
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: v.corporateFare }),
|
|
3548
3547
|
"General"
|
|
3549
3548
|
] }),
|
|
3550
3549
|
n && /* @__PURE__ */ t("div", { className: "ss-auth-error", style: { marginBottom: "16px" }, children: [
|
|
3551
|
-
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children:
|
|
3550
|
+
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: v.errorOutline }),
|
|
3552
3551
|
/* @__PURE__ */ e("span", { children: n })
|
|
3553
3552
|
] }),
|
|
3554
3553
|
f && /* @__PURE__ */ t("div", { className: "ss-auth-info-box", style: { marginBottom: "16px" }, children: [
|
|
3555
|
-
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children:
|
|
3554
|
+
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: v.check }),
|
|
3556
3555
|
/* @__PURE__ */ e("span", { children: "Organization updated" })
|
|
3557
3556
|
] }),
|
|
3558
3557
|
/* @__PURE__ */ t("form", { onSubmit: O, children: [
|
|
@@ -3564,8 +3563,8 @@ function Ea() {
|
|
|
3564
3563
|
className: "ss-auth-input",
|
|
3565
3564
|
type: "text",
|
|
3566
3565
|
value: i,
|
|
3567
|
-
onChange: (
|
|
3568
|
-
l(
|
|
3566
|
+
onChange: (N) => {
|
|
3567
|
+
l(N.target.value), p(!1);
|
|
3569
3568
|
}
|
|
3570
3569
|
}
|
|
3571
3570
|
)
|
|
@@ -3592,8 +3591,8 @@ function Ea() {
|
|
|
3592
3591
|
className: "ss-auth-input",
|
|
3593
3592
|
type: "text",
|
|
3594
3593
|
placeholder: a.name,
|
|
3595
|
-
value:
|
|
3596
|
-
onChange: (
|
|
3594
|
+
value: w,
|
|
3595
|
+
onChange: (N) => y(N.target.value),
|
|
3597
3596
|
autoFocus: !0
|
|
3598
3597
|
}
|
|
3599
3598
|
)
|
|
@@ -3608,7 +3607,7 @@ function Ea() {
|
|
|
3608
3607
|
type: "button",
|
|
3609
3608
|
className: "ss-auth-btn-primary ss-auth-btn-sm",
|
|
3610
3609
|
style: { width: "auto", background: "linear-gradient(135deg, #ef4444, #dc2626)" },
|
|
3611
|
-
disabled:
|
|
3610
|
+
disabled: w !== a.name || o,
|
|
3612
3611
|
onClick: h,
|
|
3613
3612
|
children: [
|
|
3614
3613
|
o && /* @__PURE__ */ e("span", { className: "ss-auth-spinner" }),
|
|
@@ -3644,42 +3643,42 @@ function Ia() {
|
|
|
3644
3643
|
updateMemberRole: c,
|
|
3645
3644
|
removeMember: f,
|
|
3646
3645
|
refreshMembers: p
|
|
3647
|
-
} = Y(), [m, b] = g(""), [
|
|
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);
|
|
3648
3647
|
if (U(() => {
|
|
3649
3648
|
a && (p(a.id), l(a.id));
|
|
3650
3649
|
}, [a, p, l]), !a)
|
|
3651
3650
|
return /* @__PURE__ */ t(j, { children: [
|
|
3652
3651
|
/* @__PURE__ */ e("h3", { children: "People" }),
|
|
3653
3652
|
/* @__PURE__ */ t("div", { className: "ss-auth-settings-empty", children: [
|
|
3654
|
-
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children:
|
|
3653
|
+
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: v.group }),
|
|
3655
3654
|
/* @__PURE__ */ e("div", { children: "Select an organization from the user menu to manage members." })
|
|
3656
3655
|
] })
|
|
3657
3656
|
] });
|
|
3658
|
-
const
|
|
3659
|
-
z.preventDefault(),
|
|
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));
|
|
3660
3659
|
}, E = async () => {
|
|
3661
3660
|
if (!P) return;
|
|
3662
3661
|
await c(a.id, P.userId, F) && I(null);
|
|
3663
|
-
},
|
|
3664
|
-
if (
|
|
3665
|
-
await f(a.id,
|
|
3662
|
+
}, D = async () => {
|
|
3663
|
+
if (!$) return;
|
|
3664
|
+
await f(a.id, $.userId) && x(null);
|
|
3666
3665
|
}, V = async (z) => {
|
|
3667
3666
|
await d(a.id, z);
|
|
3668
|
-
},
|
|
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";
|
|
3669
3668
|
return /* @__PURE__ */ t(j, { children: [
|
|
3670
3669
|
/* @__PURE__ */ e("h3", { children: "People" }),
|
|
3671
3670
|
n && /* @__PURE__ */ t("div", { className: "ss-auth-error", style: { marginBottom: "16px" }, children: [
|
|
3672
|
-
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children:
|
|
3671
|
+
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: v.errorOutline }),
|
|
3673
3672
|
/* @__PURE__ */ e("span", { children: n })
|
|
3674
3673
|
] }),
|
|
3675
|
-
|
|
3676
|
-
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children:
|
|
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 }),
|
|
3677
3676
|
/* @__PURE__ */ e("span", { children: "Invitation sent" })
|
|
3678
3677
|
] }),
|
|
3679
3678
|
/* @__PURE__ */ t("div", { className: "ss-auth-settings-card", children: [
|
|
3680
3679
|
/* @__PURE__ */ t("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", marginBottom: "16px" }, children: [
|
|
3681
3680
|
/* @__PURE__ */ t("h4", { style: { margin: 0 }, children: [
|
|
3682
|
-
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children:
|
|
3681
|
+
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: v.group }),
|
|
3683
3682
|
"Members"
|
|
3684
3683
|
] }),
|
|
3685
3684
|
/* @__PURE__ */ t(
|
|
@@ -3690,13 +3689,13 @@ function Ia() {
|
|
|
3690
3689
|
style: { width: "auto" },
|
|
3691
3690
|
onClick: () => h(!O),
|
|
3692
3691
|
children: [
|
|
3693
|
-
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", style: { fontSize: "16px" }, children:
|
|
3692
|
+
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", style: { fontSize: "16px" }, children: v.add }),
|
|
3694
3693
|
"Invite"
|
|
3695
3694
|
]
|
|
3696
3695
|
}
|
|
3697
3696
|
)
|
|
3698
3697
|
] }),
|
|
3699
|
-
O && /* @__PURE__ */ e("form", { onSubmit:
|
|
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: [
|
|
3700
3699
|
/* @__PURE__ */ t("div", { style: { flex: 1 }, children: [
|
|
3701
3700
|
/* @__PURE__ */ e("label", { className: "ss-auth-label", children: "Email" }),
|
|
3702
3701
|
/* @__PURE__ */ e(
|
|
@@ -3717,7 +3716,7 @@ function Ia() {
|
|
|
3717
3716
|
"select",
|
|
3718
3717
|
{
|
|
3719
3718
|
className: "ss-auth-input",
|
|
3720
|
-
value:
|
|
3719
|
+
value: w,
|
|
3721
3720
|
onChange: (z) => y(z.target.value),
|
|
3722
3721
|
style: { cursor: "pointer" },
|
|
3723
3722
|
children: [
|
|
@@ -3737,7 +3736,7 @@ function Ia() {
|
|
|
3737
3736
|
] }) }),
|
|
3738
3737
|
/* @__PURE__ */ e("tbody", { children: s.map((z) => /* @__PURE__ */ t("tr", { children: [
|
|
3739
3738
|
/* @__PURE__ */ e("td", { children: z.email }),
|
|
3740
|
-
/* @__PURE__ */ e("td", { children: /* @__PURE__ */ e("span", { className:
|
|
3739
|
+
/* @__PURE__ */ e("td", { children: /* @__PURE__ */ e("span", { className: T(z.role), children: z.role }) }),
|
|
3741
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: [
|
|
3742
3741
|
/* @__PURE__ */ e(
|
|
3743
3742
|
"button",
|
|
@@ -3748,7 +3747,7 @@ function Ia() {
|
|
|
3748
3747
|
onClick: () => {
|
|
3749
3748
|
I(z), B(z.role);
|
|
3750
3749
|
},
|
|
3751
|
-
children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children:
|
|
3750
|
+
children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: v.edit })
|
|
3752
3751
|
}
|
|
3753
3752
|
),
|
|
3754
3753
|
/* @__PURE__ */ e(
|
|
@@ -3758,7 +3757,7 @@ function Ia() {
|
|
|
3758
3757
|
className: "ss-auth-icon-btn ss-auth-icon-btn-danger",
|
|
3759
3758
|
title: "Remove member",
|
|
3760
3759
|
onClick: () => x(z),
|
|
3761
|
-
children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children:
|
|
3760
|
+
children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: v.personRemove })
|
|
3762
3761
|
}
|
|
3763
3762
|
)
|
|
3764
3763
|
] }) })
|
|
@@ -3767,7 +3766,7 @@ function Ia() {
|
|
|
3767
3766
|
] }),
|
|
3768
3767
|
r.length > 0 && /* @__PURE__ */ t("div", { className: "ss-auth-settings-card", children: [
|
|
3769
3768
|
/* @__PURE__ */ t("h4", { children: [
|
|
3770
|
-
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children:
|
|
3769
|
+
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: v.send }),
|
|
3771
3770
|
"Pending Invites"
|
|
3772
3771
|
] }),
|
|
3773
3772
|
/* @__PURE__ */ t("table", { className: "ss-auth-settings-table", children: [
|
|
@@ -3778,7 +3777,7 @@ function Ia() {
|
|
|
3778
3777
|
] }) }),
|
|
3779
3778
|
/* @__PURE__ */ e("tbody", { children: r.map((z) => /* @__PURE__ */ t("tr", { children: [
|
|
3780
3779
|
/* @__PURE__ */ e("td", { children: z.email }),
|
|
3781
|
-
/* @__PURE__ */ e("td", { children: /* @__PURE__ */ e("span", { className:
|
|
3780
|
+
/* @__PURE__ */ e("td", { children: /* @__PURE__ */ e("span", { className: T(z.role), children: z.role }) }),
|
|
3782
3781
|
/* @__PURE__ */ e("td", { children: /* @__PURE__ */ e(
|
|
3783
3782
|
"button",
|
|
3784
3783
|
{
|
|
@@ -3786,7 +3785,7 @@ function Ia() {
|
|
|
3786
3785
|
className: "ss-auth-icon-btn ss-auth-icon-btn-danger",
|
|
3787
3786
|
title: "Revoke invite",
|
|
3788
3787
|
onClick: () => V(z.id),
|
|
3789
|
-
children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children:
|
|
3788
|
+
children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: v.close })
|
|
3790
3789
|
}
|
|
3791
3790
|
) })
|
|
3792
3791
|
] }, z.id)) })
|
|
@@ -3797,7 +3796,7 @@ function Ia() {
|
|
|
3797
3796
|
}, children: /* @__PURE__ */ t("div", { className: "ss-auth-modal", style: { maxWidth: "400px" }, children: [
|
|
3798
3797
|
/* @__PURE__ */ t("div", { className: "ss-auth-modal-header", children: [
|
|
3799
3798
|
/* @__PURE__ */ e("h2", { children: "Edit Role" }),
|
|
3800
|
-
/* @__PURE__ */ e("button", { type: "button", className: "ss-auth-modal-close", onClick: () => I(null), children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children:
|
|
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 }) })
|
|
3801
3800
|
] }),
|
|
3802
3801
|
/* @__PURE__ */ t("div", { className: "ss-auth-modal-body", children: [
|
|
3803
3802
|
/* @__PURE__ */ t("p", { style: { fontSize: "14px", marginBottom: "16px", margin: "0 0 16px 0" }, children: [
|
|
@@ -3826,17 +3825,17 @@ function Ia() {
|
|
|
3826
3825
|
] })
|
|
3827
3826
|
] })
|
|
3828
3827
|
] }) }),
|
|
3829
|
-
|
|
3828
|
+
$ && /* @__PURE__ */ e("div", { className: "ss-auth-modal-overlay", onClick: (z) => {
|
|
3830
3829
|
z.target === z.currentTarget && x(null);
|
|
3831
3830
|
}, children: /* @__PURE__ */ t("div", { className: "ss-auth-modal", style: { maxWidth: "400px" }, children: [
|
|
3832
3831
|
/* @__PURE__ */ t("div", { className: "ss-auth-modal-header", children: [
|
|
3833
3832
|
/* @__PURE__ */ e("h2", { children: "Remove Member" }),
|
|
3834
|
-
/* @__PURE__ */ e("button", { type: "button", className: "ss-auth-modal-close", onClick: () => x(null), children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children:
|
|
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 }) })
|
|
3835
3834
|
] }),
|
|
3836
3835
|
/* @__PURE__ */ t("div", { className: "ss-auth-modal-body", children: [
|
|
3837
3836
|
/* @__PURE__ */ t("p", { style: { fontSize: "14px", margin: "0 0 16px 0" }, children: [
|
|
3838
3837
|
"Are you sure you want to remove ",
|
|
3839
|
-
/* @__PURE__ */ e("strong", { children:
|
|
3838
|
+
/* @__PURE__ */ e("strong", { children: $.email }),
|
|
3840
3839
|
" from the organization?"
|
|
3841
3840
|
] }),
|
|
3842
3841
|
/* @__PURE__ */ t("div", { style: { display: "flex", gap: "8px", justifyContent: "flex-end" }, children: [
|
|
@@ -3847,7 +3846,7 @@ function Ia() {
|
|
|
3847
3846
|
type: "button",
|
|
3848
3847
|
className: "ss-auth-btn-primary ss-auth-btn-sm",
|
|
3849
3848
|
style: { width: "auto", background: "linear-gradient(135deg, #ef4444, #dc2626)" },
|
|
3850
|
-
onClick:
|
|
3849
|
+
onClick: D,
|
|
3851
3850
|
children: "Remove"
|
|
3852
3851
|
}
|
|
3853
3852
|
)
|
|
@@ -3862,7 +3861,7 @@ function Fa() {
|
|
|
3862
3861
|
/* @__PURE__ */ e("h3", { children: "Billing" }),
|
|
3863
3862
|
/* @__PURE__ */ t("div", { className: "ss-auth-settings-card", children: [
|
|
3864
3863
|
/* @__PURE__ */ t("h4", { children: [
|
|
3865
|
-
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children:
|
|
3864
|
+
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: v.creditCard }),
|
|
3866
3865
|
"Plan & Billing"
|
|
3867
3866
|
] }),
|
|
3868
3867
|
/* @__PURE__ */ e("div", { className: "ss-auth-settings-empty", style: { padding: "20px" }, children: /* @__PURE__ */ e("div", { children: "No billing plan configured for this organization." }) })
|
|
@@ -3870,7 +3869,7 @@ function Fa() {
|
|
|
3870
3869
|
] }) : /* @__PURE__ */ t(j, { children: [
|
|
3871
3870
|
/* @__PURE__ */ e("h3", { children: "Billing" }),
|
|
3872
3871
|
/* @__PURE__ */ t("div", { className: "ss-auth-settings-empty", children: [
|
|
3873
|
-
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children:
|
|
3872
|
+
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: v.creditCard }),
|
|
3874
3873
|
/* @__PURE__ */ e("div", { children: "Select an organization from the user menu to manage billing." })
|
|
3875
3874
|
] })
|
|
3876
3875
|
] });
|
|
@@ -3883,7 +3882,7 @@ function oe({
|
|
|
3883
3882
|
onOrgChange: n,
|
|
3884
3883
|
onOrgSettingsClick: u
|
|
3885
3884
|
}) {
|
|
3886
|
-
const { appearance: i } = A(), { user: l, signOut: d } = sa(), c = a ?? i, [f, p] = g(!1), [m, b] = g(!1), [
|
|
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) => {
|
|
3887
3886
|
P.current && !E.composedPath().includes(P.current) && p(!1);
|
|
3888
3887
|
}, []);
|
|
3889
3888
|
U(() => {
|
|
@@ -3896,20 +3895,20 @@ function oe({
|
|
|
3896
3895
|
};
|
|
3897
3896
|
}
|
|
3898
3897
|
}, [f, x]);
|
|
3899
|
-
const
|
|
3898
|
+
const S = k(
|
|
3900
3899
|
async (E) => {
|
|
3901
|
-
E.preventDefault(), h(null),
|
|
3902
|
-
const
|
|
3900
|
+
E.preventDefault(), h(null), C(!0);
|
|
3901
|
+
const D = w.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "");
|
|
3903
3902
|
try {
|
|
3904
|
-
const V = await
|
|
3903
|
+
const V = await $(w, D);
|
|
3905
3904
|
V && (await B(V.id), n == null || n(V), y(""), p(!1));
|
|
3906
3905
|
} catch (V) {
|
|
3907
3906
|
h(V instanceof Error ? V.message : "Failed to create organization");
|
|
3908
3907
|
} finally {
|
|
3909
|
-
|
|
3908
|
+
C(!1);
|
|
3910
3909
|
}
|
|
3911
3910
|
},
|
|
3912
|
-
[
|
|
3911
|
+
[w, $, B, n]
|
|
3913
3912
|
);
|
|
3914
3913
|
return l ? /* @__PURE__ */ e(H, { appearance: c, children: /* @__PURE__ */ t("div", { style: { position: "relative", display: "inline-block" }, ref: P, children: [
|
|
3915
3914
|
/* @__PURE__ */ t(
|
|
@@ -3958,7 +3957,7 @@ function oe({
|
|
|
3958
3957
|
p(!1), b(!0);
|
|
3959
3958
|
},
|
|
3960
3959
|
children: [
|
|
3961
|
-
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children:
|
|
3960
|
+
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: v.settings }),
|
|
3962
3961
|
"Settings"
|
|
3963
3962
|
]
|
|
3964
3963
|
}
|
|
@@ -3966,22 +3965,22 @@ function oe({
|
|
|
3966
3965
|
o && /* @__PURE__ */ t(j, { children: [
|
|
3967
3966
|
/* @__PURE__ */ e("div", { className: "ss-auth-section-label", children: "Organizations" }),
|
|
3968
3967
|
/* @__PURE__ */ e("div", { style: { padding: "0 8px 4px" }, children: I.map((E) => {
|
|
3969
|
-
const
|
|
3968
|
+
const D = (F == null ? void 0 : F.id) === E.id, V = E.name.split(" ").map((T) => T[0]).join("").slice(0, 2).toUpperCase();
|
|
3970
3969
|
return /* @__PURE__ */ t(
|
|
3971
3970
|
"button",
|
|
3972
3971
|
{
|
|
3973
3972
|
type: "button",
|
|
3974
|
-
className: `ss-auth-org-item${
|
|
3973
|
+
className: `ss-auth-org-item${D ? " ss-auth-org-item-active" : ""}`,
|
|
3975
3974
|
onClick: async () => {
|
|
3976
3975
|
p(!1), await B(E.id), n == null || n(E);
|
|
3977
3976
|
},
|
|
3978
3977
|
children: [
|
|
3979
3978
|
/* @__PURE__ */ t("div", { className: "ss-auth-org-item-inner", children: [
|
|
3980
|
-
/* @__PURE__ */ e("div", { className: `ss-auth-org-avatar${
|
|
3979
|
+
/* @__PURE__ */ e("div", { className: `ss-auth-org-avatar${D ? "" : " ss-auth-org-avatar-inactive"}`, children: V }),
|
|
3981
3980
|
/* @__PURE__ */ e("span", { style: { fontFamily: "'Manrope', sans-serif", letterSpacing: "-0.01em" }, children: E.name }),
|
|
3982
3981
|
E.planName && /* @__PURE__ */ e("span", { className: "ss-auth-plan-badge", children: E.planName })
|
|
3983
3982
|
] }),
|
|
3984
|
-
|
|
3983
|
+
D && /* @__PURE__ */ e("span", { className: "material-symbols-outlined ss-auth-org-check", style: { fontSize: "18px" }, children: v.checkCircle })
|
|
3985
3984
|
]
|
|
3986
3985
|
},
|
|
3987
3986
|
E.id
|
|
@@ -3989,14 +3988,14 @@ function oe({
|
|
|
3989
3988
|
}) }),
|
|
3990
3989
|
/* @__PURE__ */ t("div", { className: "ss-auth-inline-create", children: [
|
|
3991
3990
|
O && /* @__PURE__ */ e("div", { className: "ss-auth-error", style: { marginBottom: "8px", fontSize: "12px" }, children: /* @__PURE__ */ e("span", { children: O }) }),
|
|
3992
|
-
/* @__PURE__ */ e("form", { onSubmit:
|
|
3991
|
+
/* @__PURE__ */ e("form", { onSubmit: S, children: /* @__PURE__ */ t("div", { className: "ss-auth-inline-create-input", children: [
|
|
3993
3992
|
/* @__PURE__ */ e(
|
|
3994
3993
|
"input",
|
|
3995
3994
|
{
|
|
3996
3995
|
className: "ss-auth-input",
|
|
3997
3996
|
type: "text",
|
|
3998
3997
|
placeholder: "New organization name",
|
|
3999
|
-
value:
|
|
3998
|
+
value: w,
|
|
4000
3999
|
onChange: (E) => y(E.target.value),
|
|
4001
4000
|
required: !0,
|
|
4002
4001
|
style: { fontSize: "13px", padding: "10px 40px 10px 12px" }
|
|
@@ -4007,8 +4006,8 @@ function oe({
|
|
|
4007
4006
|
{
|
|
4008
4007
|
type: "submit",
|
|
4009
4008
|
className: "ss-auth-inline-create-btn",
|
|
4010
|
-
disabled:
|
|
4011
|
-
children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", style: { fontSize: "20px" }, children:
|
|
4009
|
+
disabled: N || !w.trim(),
|
|
4010
|
+
children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", style: { fontSize: "20px" }, children: v.add })
|
|
4012
4011
|
}
|
|
4013
4012
|
)
|
|
4014
4013
|
] }) })
|
|
@@ -4022,7 +4021,7 @@ function oe({
|
|
|
4022
4021
|
p(!1), u(F);
|
|
4023
4022
|
},
|
|
4024
4023
|
children: [
|
|
4025
|
-
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children:
|
|
4024
|
+
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: v.corporateFare }),
|
|
4026
4025
|
"Org settings"
|
|
4027
4026
|
]
|
|
4028
4027
|
}
|
|
@@ -4038,7 +4037,7 @@ function oe({
|
|
|
4038
4037
|
},
|
|
4039
4038
|
style: { color: "inherit" },
|
|
4040
4039
|
children: [
|
|
4041
|
-
/* @__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 }),
|
|
4042
4041
|
"Sign out"
|
|
4043
4042
|
]
|
|
4044
4043
|
}
|
|
@@ -4054,36 +4053,36 @@ function oe({
|
|
|
4054
4053
|
] }) }) : null;
|
|
4055
4054
|
}
|
|
4056
4055
|
function ie({ appearance: a }) {
|
|
4057
|
-
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,
|
|
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(
|
|
4058
4057
|
async (L) => {
|
|
4059
4058
|
L.preventDefault(), f(null), p(null), await n({ name: b, avatarUrl: y || void 0 });
|
|
4060
4059
|
},
|
|
4061
4060
|
[b, y, n, f, p]
|
|
4062
|
-
),
|
|
4061
|
+
), D = k(
|
|
4063
4062
|
async (L) => {
|
|
4064
4063
|
const W = await u(L);
|
|
4065
|
-
W && (O(W.avatarUrl),
|
|
4064
|
+
W && (O(W.avatarUrl), N(!1));
|
|
4066
4065
|
},
|
|
4067
4066
|
[u]
|
|
4068
|
-
), V =
|
|
4067
|
+
), V = k(
|
|
4069
4068
|
async (L) => {
|
|
4070
|
-
if (L.preventDefault(),
|
|
4071
|
-
|
|
4069
|
+
if (L.preventDefault(), S(null), f(null), p(null), I !== B) {
|
|
4070
|
+
S("Passwords do not match");
|
|
4072
4071
|
return;
|
|
4073
4072
|
}
|
|
4074
4073
|
if (I.length < 8) {
|
|
4075
|
-
|
|
4074
|
+
S("Password must be at least 8 characters");
|
|
4076
4075
|
return;
|
|
4077
4076
|
}
|
|
4078
|
-
await i(
|
|
4077
|
+
await i(C, I) && (P(""), F(""), $(""));
|
|
4079
4078
|
},
|
|
4080
|
-
[
|
|
4079
|
+
[C, I, B, i, f, p]
|
|
4081
4080
|
);
|
|
4082
4081
|
if (!r) return null;
|
|
4083
|
-
const
|
|
4082
|
+
const T = r.provider === "email", z = (r.name || r.email).charAt(0).toUpperCase();
|
|
4084
4083
|
return /* @__PURE__ */ e(H, { appearance: m, children: /* @__PURE__ */ t("div", { className: "ss-auth-card", style: { maxWidth: "640px" }, children: [
|
|
4085
4084
|
/* @__PURE__ */ t("div", { className: "ss-auth-profile-header", children: [
|
|
4086
|
-
/* @__PURE__ */ t("div", { className: "ss-auth-avatar-lg", onClick: () =>
|
|
4085
|
+
/* @__PURE__ */ t("div", { className: "ss-auth-avatar-lg", onClick: () => N(!0), children: [
|
|
4087
4086
|
y ? /* @__PURE__ */ e("img", { src: y, alt: "" }) : /* @__PURE__ */ e("div", { style: {
|
|
4088
4087
|
width: "100%",
|
|
4089
4088
|
height: "100%",
|
|
@@ -4095,7 +4094,7 @@ function ie({ appearance: a }) {
|
|
|
4095
4094
|
opacity: 0.4
|
|
4096
4095
|
}, children: z }),
|
|
4097
4096
|
/* @__PURE__ */ t("div", { className: "ss-auth-avatar-overlay", children: [
|
|
4098
|
-
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children:
|
|
4097
|
+
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: v.camera }),
|
|
4099
4098
|
/* @__PURE__ */ e("span", { children: "Edit" })
|
|
4100
4099
|
] })
|
|
4101
4100
|
] }),
|
|
@@ -4103,7 +4102,7 @@ function ie({ appearance: a }) {
|
|
|
4103
4102
|
/* @__PURE__ */ t("h2", { className: "ss-auth-profile-name", children: [
|
|
4104
4103
|
r.name || "Unnamed User",
|
|
4105
4104
|
r.emailVerified && /* @__PURE__ */ t("span", { className: "ss-auth-badge ss-auth-badge-success", children: [
|
|
4106
|
-
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", style: { fontSize: "12px", fontVariationSettings: "'FILL' 1" }, children:
|
|
4105
|
+
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", style: { fontSize: "12px", fontVariationSettings: "'FILL' 1" }, children: v.verified }),
|
|
4107
4106
|
"Verified"
|
|
4108
4107
|
] })
|
|
4109
4108
|
] }),
|
|
@@ -4112,11 +4111,11 @@ function ie({ appearance: a }) {
|
|
|
4112
4111
|
] }),
|
|
4113
4112
|
/* @__PURE__ */ t("div", { className: "ss-auth-card-body", children: [
|
|
4114
4113
|
d && /* @__PURE__ */ t("div", { className: "ss-auth-error", children: [
|
|
4115
|
-
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children:
|
|
4114
|
+
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: v.errorOutline }),
|
|
4116
4115
|
/* @__PURE__ */ e("span", { children: d })
|
|
4117
4116
|
] }),
|
|
4118
4117
|
c && /* @__PURE__ */ t("div", { className: "ss-auth-info-box", style: { marginBottom: "16px" }, children: [
|
|
4119
|
-
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children:
|
|
4118
|
+
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: v.check }),
|
|
4120
4119
|
/* @__PURE__ */ e("span", { children: c })
|
|
4121
4120
|
] }),
|
|
4122
4121
|
/* @__PURE__ */ t("form", { onSubmit: E, children: [
|
|
@@ -4129,7 +4128,7 @@ function ie({ appearance: a }) {
|
|
|
4129
4128
|
type: "text",
|
|
4130
4129
|
placeholder: "Your name",
|
|
4131
4130
|
value: b,
|
|
4132
|
-
onChange: (L) =>
|
|
4131
|
+
onChange: (L) => w(L.target.value)
|
|
4133
4132
|
}
|
|
4134
4133
|
)
|
|
4135
4134
|
] }),
|
|
@@ -4138,14 +4137,14 @@ function ie({ appearance: a }) {
|
|
|
4138
4137
|
/* @__PURE__ */ e("label", { className: "ss-auth-label", children: "Email Address" }),
|
|
4139
4138
|
/* @__PURE__ */ t("div", { style: { position: "relative" }, children: [
|
|
4140
4139
|
/* @__PURE__ */ e("input", { className: "ss-auth-input ss-auth-input-readonly", type: "email", value: r.email, readOnly: !0 }),
|
|
4141
|
-
/* @__PURE__ */ e("span", { className: "ss-auth-visibility-toggle", style: { cursor: "default" }, children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", style: { fontSize: "18px" }, children:
|
|
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 }) })
|
|
4142
4141
|
] })
|
|
4143
4142
|
] }),
|
|
4144
4143
|
/* @__PURE__ */ t("div", { children: [
|
|
4145
4144
|
/* @__PURE__ */ e("label", { className: "ss-auth-label", children: "Auth Provider" }),
|
|
4146
4145
|
/* @__PURE__ */ t("div", { style: { position: "relative" }, children: [
|
|
4147
4146
|
/* @__PURE__ */ e("input", { className: "ss-auth-input ss-auth-input-readonly", type: "text", value: r.provider, readOnly: !0 }),
|
|
4148
|
-
/* @__PURE__ */ e("span", { className: "ss-auth-visibility-toggle", style: { cursor: "default" }, children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", style: { fontSize: "18px" }, children:
|
|
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 }) })
|
|
4149
4148
|
] })
|
|
4150
4149
|
] })
|
|
4151
4150
|
] }),
|
|
@@ -4154,14 +4153,14 @@ function ie({ appearance: a }) {
|
|
|
4154
4153
|
"Save changes"
|
|
4155
4154
|
] }) })
|
|
4156
4155
|
] }),
|
|
4157
|
-
|
|
4156
|
+
T && /* @__PURE__ */ t("div", { className: "ss-auth-section", children: [
|
|
4158
4157
|
/* @__PURE__ */ t("div", { className: "ss-auth-section-title", children: [
|
|
4159
|
-
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children:
|
|
4158
|
+
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: v.security }),
|
|
4160
4159
|
"Security Credentials"
|
|
4161
4160
|
] }),
|
|
4162
4161
|
/* @__PURE__ */ e("p", { className: "ss-auth-section-desc", style: { marginBottom: "24px" }, children: "Update your password to keep your account secure." }),
|
|
4163
4162
|
x && /* @__PURE__ */ t("div", { className: "ss-auth-error", children: [
|
|
4164
|
-
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children:
|
|
4163
|
+
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: v.errorOutline }),
|
|
4165
4164
|
/* @__PURE__ */ e("span", { children: x })
|
|
4166
4165
|
] }),
|
|
4167
4166
|
/* @__PURE__ */ t("form", { onSubmit: V, children: [
|
|
@@ -4173,7 +4172,7 @@ function ie({ appearance: a }) {
|
|
|
4173
4172
|
className: "ss-auth-input",
|
|
4174
4173
|
type: "password",
|
|
4175
4174
|
placeholder: "••••••••••••",
|
|
4176
|
-
value:
|
|
4175
|
+
value: C,
|
|
4177
4176
|
onChange: (L) => P(L.target.value),
|
|
4178
4177
|
required: !0
|
|
4179
4178
|
}
|
|
@@ -4203,14 +4202,14 @@ function ie({ appearance: a }) {
|
|
|
4203
4202
|
type: "password",
|
|
4204
4203
|
placeholder: "Repeat new password",
|
|
4205
4204
|
value: B,
|
|
4206
|
-
onChange: (L) =>
|
|
4205
|
+
onChange: (L) => $(L.target.value),
|
|
4207
4206
|
required: !0
|
|
4208
4207
|
}
|
|
4209
4208
|
)
|
|
4210
4209
|
] })
|
|
4211
4210
|
] }),
|
|
4212
4211
|
/* @__PURE__ */ t("div", { className: "ss-auth-info-box", style: { marginBottom: "16px" }, children: [
|
|
4213
|
-
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children:
|
|
4212
|
+
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: v.info }),
|
|
4214
4213
|
/* @__PURE__ */ e("span", { children: "Password must be at least 8 characters long." })
|
|
4215
4214
|
] }),
|
|
4216
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" }) })
|
|
@@ -4218,7 +4217,7 @@ function ie({ appearance: a }) {
|
|
|
4218
4217
|
] }),
|
|
4219
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: [
|
|
4220
4219
|
/* @__PURE__ */ t("div", { className: "ss-auth-signout-info", children: [
|
|
4221
|
-
/* @__PURE__ */ e("div", { className: "ss-auth-signout-icon", children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children:
|
|
4220
|
+
/* @__PURE__ */ e("div", { className: "ss-auth-signout-icon", children: /* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: v.logout }) }),
|
|
4222
4221
|
/* @__PURE__ */ t("div", { children: [
|
|
4223
4222
|
/* @__PURE__ */ e("div", { className: "ss-auth-signout-title", children: "End Session" }),
|
|
4224
4223
|
/* @__PURE__ */ e("div", { className: "ss-auth-signout-desc", children: "Terminate your active session" })
|
|
@@ -4239,16 +4238,16 @@ function ie({ appearance: a }) {
|
|
|
4239
4238
|
h && /* @__PURE__ */ e(
|
|
4240
4239
|
ca,
|
|
4241
4240
|
{
|
|
4242
|
-
onUpload:
|
|
4243
|
-
onClose: () =>
|
|
4241
|
+
onUpload: D,
|
|
4242
|
+
onClose: () => N(!1),
|
|
4244
4243
|
isLoading: l
|
|
4245
4244
|
}
|
|
4246
4245
|
)
|
|
4247
4246
|
] }) });
|
|
4248
4247
|
}
|
|
4249
4248
|
function le({ appearance: a, onOrgChange: s }) {
|
|
4250
|
-
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,
|
|
4251
|
-
|
|
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);
|
|
4252
4251
|
}, []);
|
|
4253
4252
|
U(() => {
|
|
4254
4253
|
if (c) {
|
|
@@ -4260,25 +4259,25 @@ function le({ appearance: a, onOrgChange: s }) {
|
|
|
4260
4259
|
};
|
|
4261
4260
|
}
|
|
4262
4261
|
}, [c, P]);
|
|
4263
|
-
const I =
|
|
4264
|
-
m(x),
|
|
4265
|
-
}, []), F =
|
|
4262
|
+
const I = k((x) => {
|
|
4263
|
+
m(x), w(x.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, ""));
|
|
4264
|
+
}, []), F = k(
|
|
4266
4265
|
async (x) => {
|
|
4267
|
-
x.preventDefault(), O(null),
|
|
4266
|
+
x.preventDefault(), O(null), N(!0);
|
|
4268
4267
|
try {
|
|
4269
|
-
const
|
|
4270
|
-
|
|
4271
|
-
} catch (
|
|
4272
|
-
O(
|
|
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");
|
|
4273
4272
|
} finally {
|
|
4274
|
-
|
|
4273
|
+
N(!1);
|
|
4275
4274
|
}
|
|
4276
4275
|
},
|
|
4277
4276
|
[p, b, i, u, s]
|
|
4278
4277
|
);
|
|
4279
4278
|
if (l) return null;
|
|
4280
|
-
const B = (n == null ? void 0 : n.name) ?? (o.length === 0 ? "No organization" : "Select organization"),
|
|
4281
|
-
return /* @__PURE__ */ e(H, { appearance: d, children: /* @__PURE__ */ t("div", { style: { position: "relative", display: "inline-block", width: "100%", maxWidth: "360px" }, ref:
|
|
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: [
|
|
4282
4281
|
/* @__PURE__ */ t(
|
|
4283
4282
|
"button",
|
|
4284
4283
|
{
|
|
@@ -4287,34 +4286,34 @@ function le({ appearance: a, onOrgChange: s }) {
|
|
|
4287
4286
|
onClick: () => f(!c),
|
|
4288
4287
|
children: [
|
|
4289
4288
|
/* @__PURE__ */ t("div", { className: "ss-auth-org-trigger-inner", children: [
|
|
4290
|
-
/* @__PURE__ */ e("div", { className: "ss-auth-org-avatar", children:
|
|
4289
|
+
/* @__PURE__ */ e("div", { className: "ss-auth-org-avatar", children: $ }),
|
|
4291
4290
|
/* @__PURE__ */ t("div", { style: { textAlign: "left" }, children: [
|
|
4292
4291
|
/* @__PURE__ */ e("div", { className: "ss-auth-org-trigger-label", children: "Current Organization" }),
|
|
4293
4292
|
/* @__PURE__ */ e("div", { className: "ss-auth-org-trigger-name", children: B })
|
|
4294
4293
|
] })
|
|
4295
4294
|
] }),
|
|
4296
|
-
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children:
|
|
4295
|
+
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: v.unfoldMore })
|
|
4297
4296
|
]
|
|
4298
4297
|
}
|
|
4299
4298
|
),
|
|
4300
4299
|
c && /* @__PURE__ */ t("div", { className: "ss-auth-dropdown ss-auth-dropdown-left ss-auth-glass-panel", style: { width: "100%" }, children: [
|
|
4301
4300
|
/* @__PURE__ */ e("div", { className: "ss-auth-section-label", children: "Your Organizations" }),
|
|
4302
4301
|
/* @__PURE__ */ e("div", { style: { padding: "0 8px 4px" }, children: o.map((x) => {
|
|
4303
|
-
const
|
|
4302
|
+
const S = (n == null ? void 0 : n.id) === x.id, E = x.name.split(" ").map((D) => D[0]).join("").slice(0, 2).toUpperCase();
|
|
4304
4303
|
return /* @__PURE__ */ t(
|
|
4305
4304
|
"button",
|
|
4306
4305
|
{
|
|
4307
4306
|
type: "button",
|
|
4308
|
-
className: `ss-auth-org-item${
|
|
4307
|
+
className: `ss-auth-org-item${S ? " ss-auth-org-item-active" : ""}`,
|
|
4309
4308
|
onClick: async () => {
|
|
4310
4309
|
f(!1), await u(x.id), s == null || s(x);
|
|
4311
4310
|
},
|
|
4312
4311
|
children: [
|
|
4313
4312
|
/* @__PURE__ */ t("div", { className: "ss-auth-org-item-inner", children: [
|
|
4314
|
-
/* @__PURE__ */ e("div", { className: `ss-auth-org-avatar${
|
|
4313
|
+
/* @__PURE__ */ e("div", { className: `ss-auth-org-avatar${S ? "" : " ss-auth-org-avatar-inactive"}`, children: E }),
|
|
4315
4314
|
/* @__PURE__ */ e("span", { style: { fontFamily: "'Manrope', sans-serif", letterSpacing: "-0.01em" }, children: x.name })
|
|
4316
4315
|
] }),
|
|
4317
|
-
|
|
4316
|
+
S && /* @__PURE__ */ e("span", { className: "material-symbols-outlined ss-auth-org-check", style: { fontSize: "18px" }, children: v.checkCircle })
|
|
4318
4317
|
]
|
|
4319
4318
|
},
|
|
4320
4319
|
x.id
|
|
@@ -4322,7 +4321,7 @@ function le({ appearance: a, onOrgChange: s }) {
|
|
|
4322
4321
|
}) }),
|
|
4323
4322
|
/* @__PURE__ */ t("div", { className: "ss-auth-org-create", children: [
|
|
4324
4323
|
/* @__PURE__ */ t("div", { className: "ss-auth-org-create-header", children: [
|
|
4325
|
-
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children:
|
|
4324
|
+
/* @__PURE__ */ e("span", { className: "material-symbols-outlined", children: v.addCircle }),
|
|
4326
4325
|
/* @__PURE__ */ e("span", { children: "Create organization" })
|
|
4327
4326
|
] }),
|
|
4328
4327
|
y && /* @__PURE__ */ e("div", { className: "ss-auth-error", style: { marginBottom: "12px", fontSize: "12px" }, children: /* @__PURE__ */ e("span", { children: y }) }),
|
|
@@ -4353,7 +4352,7 @@ function le({ appearance: a, onOrgChange: s }) {
|
|
|
4353
4352
|
type: "text",
|
|
4354
4353
|
placeholder: "nexus-dynamics",
|
|
4355
4354
|
value: b,
|
|
4356
|
-
onChange: (x) =>
|
|
4355
|
+
onChange: (x) => w(x.target.value),
|
|
4357
4356
|
required: !0,
|
|
4358
4357
|
style: { fontSize: "13px", padding: "10px 12px 10px 22px" }
|
|
4359
4358
|
}
|
|
@@ -4439,7 +4438,7 @@ function Z(a) {
|
|
|
4439
4438
|
}, [s, a]);
|
|
4440
4439
|
}
|
|
4441
4440
|
function La(a, s) {
|
|
4442
|
-
const r = Z(s), [o, n] = g(null), [u, i] = g(!0), [l, d] = g(null), c =
|
|
4441
|
+
const r = Z(s), [o, n] = g(null), [u, i] = g(!0), [l, d] = g(null), c = k(async () => {
|
|
4443
4442
|
i(!0), d(null);
|
|
4444
4443
|
try {
|
|
4445
4444
|
const f = await r.getCustomer(a);
|
|
@@ -4455,7 +4454,7 @@ function La(a, s) {
|
|
|
4455
4454
|
}, [c]), { customer: o, isLoading: u, error: l, refresh: c };
|
|
4456
4455
|
}
|
|
4457
4456
|
function Aa(a, s) {
|
|
4458
|
-
const r = Z(s), [o, n] = g([]), [u, i] = g(!0), [l, d] = g(null), c =
|
|
4457
|
+
const r = Z(s), [o, n] = g([]), [u, i] = g(!0), [l, d] = g(null), c = k(async () => {
|
|
4459
4458
|
i(!0), d(null);
|
|
4460
4459
|
try {
|
|
4461
4460
|
const f = await r.getInvoices(a);
|
|
@@ -4471,7 +4470,7 @@ function Aa(a, s) {
|
|
|
4471
4470
|
}, [c]), { invoices: o, isLoading: u, error: l, refresh: c };
|
|
4472
4471
|
}
|
|
4473
4472
|
function Da(a, s) {
|
|
4474
|
-
const r = Z(s), [o, n] = g([]), [u, i] = g(!0), [l, d] = g(null), c =
|
|
4473
|
+
const r = Z(s), [o, n] = g([]), [u, i] = g(!0), [l, d] = g(null), c = k(async () => {
|
|
4475
4474
|
i(!0), d(null);
|
|
4476
4475
|
try {
|
|
4477
4476
|
const f = await r.getCurrentUsage(a);
|
|
@@ -4631,12 +4630,12 @@ function ue({
|
|
|
4631
4630
|
] }) });
|
|
4632
4631
|
}
|
|
4633
4632
|
function pe({ customerId: a, portalToken: s, onApplied: r, appearance: o }) {
|
|
4634
|
-
const { appearance: n } = A(), u = Z(s), i = o ?? n, [l, d] = g(""), [c, f] = g(!1), [p, m] = g(null), [b,
|
|
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) => {
|
|
4635
4634
|
if (O.preventDefault(), !!l.trim()) {
|
|
4636
|
-
f(!0), m(null),
|
|
4635
|
+
f(!0), m(null), w(null);
|
|
4637
4636
|
try {
|
|
4638
4637
|
const h = await u.applyCoupon(a, l.trim());
|
|
4639
|
-
|
|
4638
|
+
w(`Coupon applied! ${h.discountType === "percent" ? `${h.amount}% off` : `$${(h.amount / 100).toFixed(2)} off`}`), d(""), r == null || r(h);
|
|
4640
4639
|
} catch (h) {
|
|
4641
4640
|
m(h instanceof Error ? h.message : "Invalid coupon code");
|
|
4642
4641
|
} finally {
|
|
@@ -4676,7 +4675,7 @@ function he() {
|
|
|
4676
4675
|
return { report: a.report };
|
|
4677
4676
|
}
|
|
4678
4677
|
function da() {
|
|
4679
|
-
const { client: a } = A(), [s, r] = g(null), [o, n] = g(!1), [u, i] = g(null), l =
|
|
4678
|
+
const { client: a } = A(), [s, r] = g(null), [o, n] = g(!1), [u, i] = g(null), l = k(async (d) => {
|
|
4680
4679
|
n(!0), i(null);
|
|
4681
4680
|
try {
|
|
4682
4681
|
const c = await a.report.executeQuery(d);
|
|
@@ -4690,7 +4689,7 @@ function da() {
|
|
|
4690
4689
|
return { result: s, execute: l, isLoading: o, error: u };
|
|
4691
4690
|
}
|
|
4692
4691
|
function qa(a) {
|
|
4693
|
-
const { client: s } = A(), [r, o] = g(null), [n, u] = g(!0), [i, l] = g(null), d =
|
|
4692
|
+
const { client: s } = A(), [r, o] = g(null), [n, u] = g(!0), [i, l] = g(null), d = k(async () => {
|
|
4694
4693
|
u(!0), l(null);
|
|
4695
4694
|
try {
|
|
4696
4695
|
const c = await s.report.listQueries(a);
|
|
@@ -4706,7 +4705,7 @@ function qa(a) {
|
|
|
4706
4705
|
}, [d]), { queries: (r == null ? void 0 : r.data) ?? [], meta: r == null ? void 0 : r.meta, isLoading: n, error: i, refresh: d };
|
|
4707
4706
|
}
|
|
4708
4707
|
function ge(a) {
|
|
4709
|
-
const { client: s } = A(), [r, o] = g(null), [n, u] = g(!0), [i, l] = g(null), d =
|
|
4708
|
+
const { client: s } = A(), [r, o] = g(null), [n, u] = g(!0), [i, l] = g(null), d = k(async () => {
|
|
4710
4709
|
u(!0), l(null);
|
|
4711
4710
|
try {
|
|
4712
4711
|
const c = await s.report.getDashboard(a);
|
|
@@ -4725,7 +4724,7 @@ function me(a, s, r = "https://api.saas-support.com/v1") {
|
|
|
4725
4724
|
const o = G(() => {
|
|
4726
4725
|
const p = new Q(r, { type: "embedToken", token: a });
|
|
4727
4726
|
return new ta(p);
|
|
4728
|
-
}, [a, r]), [n, u] = g(null), [i, l] = g(!0), [d, c] = g(null), f =
|
|
4727
|
+
}, [a, r]), [n, u] = g(null), [i, l] = g(!0), [d, c] = g(null), f = k(async () => {
|
|
4729
4728
|
l(!0), c(null);
|
|
4730
4729
|
try {
|
|
4731
4730
|
const p = await o.getDashboard(s);
|
|
@@ -4741,8 +4740,8 @@ function me(a, s, r = "https://api.saas-support.com/v1") {
|
|
|
4741
4740
|
}, [f]), { dashboard: n, reportClient: o, isLoading: i, error: d, refresh: f };
|
|
4742
4741
|
}
|
|
4743
4742
|
function fe({ onResult: a, mode: s = "both", placeholder: r, appearance: o }) {
|
|
4744
|
-
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 =
|
|
4745
|
-
if (
|
|
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;
|
|
4746
4745
|
const O = await u(p === "sql" ? { sql: c } : { naturalLanguage: c });
|
|
4747
4746
|
O && (a == null || a(O));
|
|
4748
4747
|
}, [c, p, u, a]);
|
|
@@ -4775,7 +4774,7 @@ function fe({ onResult: a, mode: s = "both", placeholder: r, appearance: o }) {
|
|
|
4775
4774
|
className: "ss-input ss-query-textarea",
|
|
4776
4775
|
placeholder: r ?? (p === "sql" ? "SELECT ..." : "Ask a question about your data..."),
|
|
4777
4776
|
value: c,
|
|
4778
|
-
onChange: (
|
|
4777
|
+
onChange: (w) => f(w.target.value),
|
|
4779
4778
|
rows: 3
|
|
4780
4779
|
}
|
|
4781
4780
|
) }),
|
|
@@ -4788,18 +4787,18 @@ function fe({ onResult: a, mode: s = "both", placeholder: r, appearance: o }) {
|
|
|
4788
4787
|
}
|
|
4789
4788
|
function Wa({ columns: a, rows: s, sortable: r = !0, maxRows: o, appearance: n }) {
|
|
4790
4789
|
const { appearance: u } = A(), i = n ?? u, [l, d] = g(null), [c, f] = g("asc"), p = G(() => l ? [...s].sort((y, O) => {
|
|
4791
|
-
const h = y[l],
|
|
4792
|
-
if (h == null &&
|
|
4790
|
+
const h = y[l], N = O[l];
|
|
4791
|
+
if (h == null && N == null) return 0;
|
|
4793
4792
|
if (h == null) return 1;
|
|
4794
|
-
if (
|
|
4795
|
-
if (typeof h == "number" && typeof
|
|
4796
|
-
return c === "asc" ? h -
|
|
4797
|
-
const
|
|
4798
|
-
return c === "asc" ?
|
|
4793
|
+
if (N == null) return -1;
|
|
4794
|
+
if (typeof h == "number" && typeof N == "number")
|
|
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);
|
|
4799
4798
|
}) : s, [s, l, c]), m = o ? p.slice(0, o) : p, b = (y) => {
|
|
4800
4799
|
r && (l === y ? f((O) => O === "asc" ? "desc" : "asc") : (d(y), f("asc")));
|
|
4801
4800
|
};
|
|
4802
|
-
function
|
|
4801
|
+
function w(y) {
|
|
4803
4802
|
return y == null ? "" : typeof y == "object" ? JSON.stringify(y) : String(y);
|
|
4804
4803
|
}
|
|
4805
4804
|
return /* @__PURE__ */ e(H, { appearance: i, children: /* @__PURE__ */ t("div", { className: "ss-table-container", children: [
|
|
@@ -4816,7 +4815,7 @@ function Wa({ columns: a, rows: s, sortable: r = !0, maxRows: o, appearance: n }
|
|
|
4816
4815
|
},
|
|
4817
4816
|
y
|
|
4818
4817
|
)) }) }),
|
|
4819
|
-
/* @__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:
|
|
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)) })
|
|
4820
4819
|
] }),
|
|
4821
4820
|
o && s.length > o && /* @__PURE__ */ t("div", { className: "ss-table-footer", children: [
|
|
4822
4821
|
"Showing ",
|
|
@@ -4840,9 +4839,9 @@ function Ga({ labels: a, values: s, w: r, h: o, colors: n }) {
|
|
|
4840
4839
|
return /* @__PURE__ */ t("g", { children: [
|
|
4841
4840
|
/* @__PURE__ */ e("line", { x1: i, y1: o - i, x2: r - i, y2: o - i, stroke: "#ccc", strokeWidth: 1 }),
|
|
4842
4841
|
s.map((f, p) => {
|
|
4843
|
-
const m = f / u * d, b = i + l / a.length * p + 2,
|
|
4842
|
+
const m = f / u * d, b = i + l / a.length * p + 2, w = o - i - m;
|
|
4844
4843
|
return /* @__PURE__ */ t("g", { children: [
|
|
4845
|
-
/* @__PURE__ */ e("rect", { x: b, y:
|
|
4844
|
+
/* @__PURE__ */ e("rect", { x: b, y: w, width: c, height: m, fill: n[p % n.length], rx: 2 }),
|
|
4846
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] })
|
|
4847
4846
|
] }, p);
|
|
4848
4847
|
})
|
|
@@ -4850,8 +4849,8 @@ function Ga({ labels: a, values: s, w: r, h: o, colors: n }) {
|
|
|
4850
4849
|
}
|
|
4851
4850
|
function Ya({ labels: a, values: s, w: r, h: o, colors: n }) {
|
|
4852
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) => {
|
|
4853
|
-
const b = i + c * m,
|
|
4854
|
-
return `${b},${
|
|
4852
|
+
const b = i + c * m, w = o - i - p / u * d;
|
|
4853
|
+
return `${b},${w}`;
|
|
4855
4854
|
});
|
|
4856
4855
|
return /* @__PURE__ */ t("g", { children: [
|
|
4857
4856
|
[0.25, 0.5, 0.75, 1].map((p) => {
|
|
@@ -4860,8 +4859,8 @@ function Ya({ labels: a, values: s, w: r, h: o, colors: n }) {
|
|
|
4860
4859
|
}),
|
|
4861
4860
|
/* @__PURE__ */ e("polyline", { points: f.join(" "), fill: "none", stroke: n[0], strokeWidth: 2 }),
|
|
4862
4861
|
s.map((p, m) => {
|
|
4863
|
-
const b = i + c * m,
|
|
4864
|
-
return /* @__PURE__ */ e("circle", { cx: b, cy:
|
|
4862
|
+
const b = i + c * m, w = o - i - p / u * d;
|
|
4863
|
+
return /* @__PURE__ */ e("circle", { cx: b, cy: w, r: 4, fill: n[0] }, m);
|
|
4865
4864
|
})
|
|
4866
4865
|
] });
|
|
4867
4866
|
}
|
|
@@ -4869,7 +4868,7 @@ function Ja({ labels: a, values: s, w: r, h: o, colors: n }) {
|
|
|
4869
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;
|
|
4870
4869
|
let f = 0;
|
|
4871
4870
|
const p = s.map((m, b) => {
|
|
4872
|
-
const
|
|
4871
|
+
const w = m / u, y = w * c, O = { dash: y, offset: f, color: n[b % n.length], label: a[b], pct: w };
|
|
4873
4872
|
return f += y, O;
|
|
4874
4873
|
});
|
|
4875
4874
|
return /* @__PURE__ */ t("g", { children: [
|
|
@@ -4908,26 +4907,26 @@ function Qa({ type: a, data: s, title: r, width: o = 400, height: n = 300, appea
|
|
|
4908
4907
|
function be({ dashboardId: a, embedToken: s, baseUrl: r, refreshInterval: o, appearance: n }) {
|
|
4909
4908
|
const u = A(), i = n ?? (u == null ? void 0 : u.appearance), l = G(() => {
|
|
4910
4909
|
if (s) {
|
|
4911
|
-
const h = r ?? "https://api.saas-support.com/v1",
|
|
4912
|
-
return new ta(
|
|
4910
|
+
const h = r ?? "https://api.saas-support.com/v1", N = new Q(h, { type: "embedToken", token: s });
|
|
4911
|
+
return new ta(N);
|
|
4913
4912
|
}
|
|
4914
4913
|
return u.client.report;
|
|
4915
|
-
}, [s, r, u]), [d, c] = g([]), [f, p] = g({}), [m, b] = g(!0), [
|
|
4914
|
+
}, [s, r, u]), [d, c] = g([]), [f, p] = g({}), [m, b] = g(!0), [w, y] = g(null), O = k(async () => {
|
|
4916
4915
|
b(!0), y(null);
|
|
4917
4916
|
try {
|
|
4918
|
-
const h = await l.getDashboard(a),
|
|
4919
|
-
c(
|
|
4920
|
-
const
|
|
4921
|
-
for (const P of
|
|
4917
|
+
const h = await l.getDashboard(a), N = JSON.parse(h.layoutJson || "[]");
|
|
4918
|
+
c(N);
|
|
4919
|
+
const C = {};
|
|
4920
|
+
for (const P of N)
|
|
4922
4921
|
try {
|
|
4923
4922
|
const I = await l.listQueries({ search: P.queryId, perPage: 1 });
|
|
4924
4923
|
if (I.data.length > 0 && I.data[0].generatedSql) {
|
|
4925
4924
|
const F = await l.executeQuery({ sql: I.data[0].generatedSql });
|
|
4926
|
-
|
|
4925
|
+
C[P.queryId] = F;
|
|
4927
4926
|
}
|
|
4928
4927
|
} catch {
|
|
4929
4928
|
}
|
|
4930
|
-
p(
|
|
4929
|
+
p(C);
|
|
4931
4930
|
} catch (h) {
|
|
4932
4931
|
y(h instanceof Error ? h.message : "Failed to load dashboard");
|
|
4933
4932
|
} finally {
|
|
@@ -4945,17 +4944,17 @@ function be({ dashboardId: a, embedToken: s, baseUrl: r, refreshInterval: o, app
|
|
|
4945
4944
|
/* @__PURE__ */ e("span", { className: "ss-spinner" }),
|
|
4946
4945
|
" Loading dashboard..."
|
|
4947
4946
|
] }),
|
|
4948
|
-
|
|
4949
|
-
!m && d.map((h,
|
|
4950
|
-
const
|
|
4951
|
-
if (!
|
|
4952
|
-
const P =
|
|
4953
|
-
labels:
|
|
4954
|
-
values:
|
|
4947
|
+
w && /* @__PURE__ */ e("div", { className: "ss-global-error", children: w }),
|
|
4948
|
+
!m && d.map((h, N) => {
|
|
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))
|
|
4955
4954
|
} : { labels: [], values: [] };
|
|
4956
4955
|
return /* @__PURE__ */ t("div", { className: "ss-widget", children: [
|
|
4957
4956
|
h.title && /* @__PURE__ */ e("h4", { className: "ss-widget-header", children: h.title }),
|
|
4958
|
-
h.chartType === "table" ? /* @__PURE__ */ e(Wa, { columns:
|
|
4957
|
+
h.chartType === "table" ? /* @__PURE__ */ e(Wa, { columns: C.columns, rows: C.rows, maxRows: 50 }) : /* @__PURE__ */ e(
|
|
4959
4958
|
Qa,
|
|
4960
4959
|
{
|
|
4961
4960
|
type: h.chartType || "bar",
|
|
@@ -4964,7 +4963,7 @@ function be({ dashboardId: a, embedToken: s, baseUrl: r, refreshInterval: o, app
|
|
|
4964
4963
|
height: h.h
|
|
4965
4964
|
}
|
|
4966
4965
|
)
|
|
4967
|
-
] },
|
|
4966
|
+
] }, N);
|
|
4968
4967
|
})
|
|
4969
4968
|
] }) });
|
|
4970
4969
|
}
|
|
@@ -4972,7 +4971,7 @@ function Za(a) {
|
|
|
4972
4971
|
return new Date(a).toLocaleDateString("en-US", { year: "numeric", month: "short", day: "numeric" });
|
|
4973
4972
|
}
|
|
4974
4973
|
function xe({ onSelectQuery: a, onRunQuery: s, appearance: r }) {
|
|
4975
|
-
const { appearance: o } = A(), { queries: n, isLoading: u, error: i } = qa(), { execute: l, isLoading: d } = da(), c = r ?? o, f =
|
|
4974
|
+
const { appearance: o } = A(), { queries: n, isLoading: u, error: i } = qa(), { execute: l, isLoading: d } = da(), c = r ?? o, f = k(async (p) => {
|
|
4976
4975
|
if (!p.generatedSql) return;
|
|
4977
4976
|
const m = await l({ sql: p.generatedSql });
|
|
4978
4977
|
m && (s == null || s(m));
|
|
@@ -5021,20 +5020,20 @@ function ye({ embedToken: a, dashboardId: s, baseUrl: r = "https://api.saas-supp
|
|
|
5021
5020
|
const u = G(() => {
|
|
5022
5021
|
const y = new Q(r, { type: "embedToken", token: a });
|
|
5023
5022
|
return new ta(y);
|
|
5024
|
-
}, [a, r]), [i, l] = g([]), [d, c] = g(!0), [f, p] = g(null), m = G(() => aa(n), [n]), b = G(() => ea(m), [m]),
|
|
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 () => {
|
|
5025
5024
|
c(!0), p(null);
|
|
5026
5025
|
try {
|
|
5027
5026
|
const y = await u.getDashboard(s), O = JSON.parse(y.layoutJson || "[]"), h = await Promise.all(
|
|
5028
|
-
O.map(async (
|
|
5027
|
+
O.map(async (N) => {
|
|
5029
5028
|
try {
|
|
5030
|
-
const
|
|
5031
|
-
if (
|
|
5032
|
-
const P = await u.executeQuery({ sql:
|
|
5033
|
-
return { ...
|
|
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 };
|
|
5034
5033
|
}
|
|
5035
5034
|
} catch {
|
|
5036
5035
|
}
|
|
5037
|
-
return
|
|
5036
|
+
return N;
|
|
5038
5037
|
})
|
|
5039
5038
|
);
|
|
5040
5039
|
l(h);
|
|
@@ -5045,20 +5044,20 @@ function ye({ embedToken: a, dashboardId: s, baseUrl: r = "https://api.saas-supp
|
|
|
5045
5044
|
}
|
|
5046
5045
|
}, [u, s]);
|
|
5047
5046
|
return U(() => {
|
|
5048
|
-
|
|
5049
|
-
}, [
|
|
5047
|
+
w();
|
|
5048
|
+
}, [w]), U(() => {
|
|
5050
5049
|
if (!o || o <= 0) return;
|
|
5051
|
-
const y = setInterval(
|
|
5050
|
+
const y = setInterval(w, o * 1e3);
|
|
5052
5051
|
return () => clearInterval(y);
|
|
5053
|
-
}, [o,
|
|
5052
|
+
}, [o, w]), /* @__PURE__ */ e(
|
|
5054
5053
|
"div",
|
|
5055
5054
|
{
|
|
5056
5055
|
ref: (y) => {
|
|
5057
5056
|
if (!y || y.shadowRoot) return;
|
|
5058
5057
|
const O = y.attachShadow({ mode: "open" }), h = document.createElement("style");
|
|
5059
5058
|
h.textContent = b, O.appendChild(h);
|
|
5060
|
-
const
|
|
5061
|
-
O.appendChild(
|
|
5059
|
+
const N = document.createElement("div");
|
|
5060
|
+
O.appendChild(N);
|
|
5062
5061
|
},
|
|
5063
5062
|
style: { display: "contents" },
|
|
5064
5063
|
children: /* @__PURE__ */ t("div", { className: "ss-dashboard-grid", children: [
|
|
@@ -5066,12 +5065,12 @@ function ye({ embedToken: a, dashboardId: s, baseUrl: r = "https://api.saas-supp
|
|
|
5066
5065
|
f && /* @__PURE__ */ e("div", { className: "ss-global-error", children: f }),
|
|
5067
5066
|
!d && i.map((y, O) => {
|
|
5068
5067
|
if (!y.result) return null;
|
|
5069
|
-
const { columns: h, rows:
|
|
5068
|
+
const { columns: h, rows: N } = y.result;
|
|
5070
5069
|
return /* @__PURE__ */ t("div", { className: "ss-widget", children: [
|
|
5071
5070
|
y.title && /* @__PURE__ */ e("h4", { className: "ss-widget-header", children: y.title }),
|
|
5072
5071
|
/* @__PURE__ */ t("table", { className: "ss-table", children: [
|
|
5073
|
-
/* @__PURE__ */ e("thead", { children: /* @__PURE__ */ e("tr", { children: h.map((
|
|
5074
|
-
/* @__PURE__ */ e("tbody", { 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)) })
|
|
5075
5074
|
] })
|
|
5076
5075
|
] }, O);
|
|
5077
5076
|
})
|