@streamoid/settings 0.7.8 → 0.7.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +176 -2
- package/dist/index.d.ts +176 -2
- package/dist/index.js +1599 -714
- package/dist/index.mjs +1583 -697
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -319,11 +319,11 @@ function useWorkspaceOrganization({
|
|
|
319
319
|
// src/settings-content.tsx
|
|
320
320
|
import {
|
|
321
321
|
Fragment as Fragment11,
|
|
322
|
-
useState as
|
|
323
|
-
useEffect as
|
|
324
|
-
useRef as
|
|
325
|
-
useCallback as
|
|
326
|
-
useMemo as
|
|
322
|
+
useState as useState17,
|
|
323
|
+
useEffect as useEffect15,
|
|
324
|
+
useRef as useRef8,
|
|
325
|
+
useCallback as useCallback8,
|
|
326
|
+
useMemo as useMemo5
|
|
327
327
|
} from "react";
|
|
328
328
|
import {
|
|
329
329
|
ScSidebarMenu,
|
|
@@ -331,7 +331,7 @@ import {
|
|
|
331
331
|
ScMenuOptions
|
|
332
332
|
} from "@streamoid/ui";
|
|
333
333
|
import { ScTextField } from "@streamoid/ui";
|
|
334
|
-
import { ScButton as
|
|
334
|
+
import { ScButton as ScButton10 } from "@streamoid/ui";
|
|
335
335
|
import { ScWorkspaceSwitchCard } from "@streamoid/ui";
|
|
336
336
|
import {
|
|
337
337
|
SiconTeam,
|
|
@@ -352,7 +352,7 @@ import {
|
|
|
352
352
|
SiconLock,
|
|
353
353
|
SiconDown,
|
|
354
354
|
SiconGlobe as SiconGlobe3,
|
|
355
|
-
SiconClose as
|
|
355
|
+
SiconClose as SiconClose9,
|
|
356
356
|
SiconSwitch
|
|
357
357
|
} from "@streamoid/icons";
|
|
358
358
|
|
|
@@ -6838,14 +6838,37 @@ function isBillingWorkspaceMissing(failure) {
|
|
|
6838
6838
|
};
|
|
6839
6839
|
return visit(failure, 0);
|
|
6840
6840
|
}
|
|
6841
|
+
var LIMIT_BELOW_USAGE = "LIMIT_BELOW_USAGE";
|
|
6842
|
+
function isLimitBelowUsage(failure) {
|
|
6843
|
+
return findLimitBelowUsage(failure) !== null;
|
|
6844
|
+
}
|
|
6845
|
+
function limitBelowUsageUsed(failure) {
|
|
6846
|
+
const used = findLimitBelowUsage(failure)?.used;
|
|
6847
|
+
return typeof used === "number" && Number.isFinite(used) ? used : null;
|
|
6848
|
+
}
|
|
6849
|
+
function findLimitBelowUsage(failure) {
|
|
6850
|
+
const seen = /* @__PURE__ */ new Set();
|
|
6851
|
+
const visit = (value, depth) => {
|
|
6852
|
+
if (depth > 4 || value == null || typeof value !== "object" || seen.has(value)) return null;
|
|
6853
|
+
seen.add(value);
|
|
6854
|
+
const error = value;
|
|
6855
|
+
if (error.code === LIMIT_BELOW_USAGE) return error;
|
|
6856
|
+
for (const child of [error.error, error.data, error.body, error.cause, error.publicError]) {
|
|
6857
|
+
const found = visit(child, depth + 1);
|
|
6858
|
+
if (found) return found;
|
|
6859
|
+
}
|
|
6860
|
+
return null;
|
|
6861
|
+
};
|
|
6862
|
+
return visit(failure, 0);
|
|
6863
|
+
}
|
|
6841
6864
|
|
|
6842
6865
|
// src/billing-content.tsx
|
|
6843
6866
|
import {
|
|
6844
|
-
useState as
|
|
6845
|
-
useEffect as
|
|
6846
|
-
useCallback as
|
|
6847
|
-
useMemo as
|
|
6848
|
-
useRef as
|
|
6867
|
+
useState as useState15,
|
|
6868
|
+
useEffect as useEffect13,
|
|
6869
|
+
useCallback as useCallback6,
|
|
6870
|
+
useMemo as useMemo4,
|
|
6871
|
+
useRef as useRef7
|
|
6849
6872
|
} from "react";
|
|
6850
6873
|
import {
|
|
6851
6874
|
ScPlanDetailsCard,
|
|
@@ -6856,13 +6879,14 @@ import {
|
|
|
6856
6879
|
ScHeader,
|
|
6857
6880
|
ScPlanCard,
|
|
6858
6881
|
ScPlanComparison,
|
|
6859
|
-
ScUsageMeterCard
|
|
6882
|
+
ScUsageMeterCard,
|
|
6883
|
+
ScButton as ScButton8
|
|
6860
6884
|
} from "@streamoid/ui";
|
|
6861
6885
|
import {
|
|
6862
6886
|
SiconDownload,
|
|
6863
6887
|
SiconLeft as SiconLeft2,
|
|
6864
6888
|
SiconDoubleArrow,
|
|
6865
|
-
SiconClose as
|
|
6889
|
+
SiconClose as SiconClose7
|
|
6866
6890
|
} from "@streamoid/icons";
|
|
6867
6891
|
|
|
6868
6892
|
// src/plan-comparison-data.ts
|
|
@@ -6883,7 +6907,7 @@ var PLAN_COMPARISON_SECTIONS = [
|
|
|
6883
6907
|
{ label: "Vectorization & colorways", values: ["Up to 60 images", "Up to 200 images", "Unlimited"] },
|
|
6884
6908
|
{ label: "Background removal", values: ["Up to 300 images", "Up to 1,000 images", "Unlimited"] },
|
|
6885
6909
|
{ label: "Range planning", values: ["Up to 3 plans", "Up to 10 plans", "Unlimited"] },
|
|
6886
|
-
{ label: "
|
|
6910
|
+
{ label: "Techpacks", values: ["Manual fill", "Up to 5 techpacks", "Unlimited"] },
|
|
6887
6911
|
{ label: "Automated moodboards", values: ["Up to 20 moodboards", "Up to 66 moodboards", "Unlimited"] },
|
|
6888
6912
|
{ label: "Export & download vector assets", values: ["Free", "Free", "Free"] }
|
|
6889
6913
|
]
|
|
@@ -7765,174 +7789,881 @@ function BuyCreditsModal({
|
|
|
7765
7789
|
);
|
|
7766
7790
|
}
|
|
7767
7791
|
|
|
7768
|
-
// src/
|
|
7769
|
-
import {
|
|
7770
|
-
|
|
7771
|
-
|
|
7772
|
-
|
|
7773
|
-
|
|
7774
|
-
|
|
7775
|
-
|
|
7776
|
-
|
|
7777
|
-
|
|
7778
|
-
|
|
7779
|
-
|
|
7780
|
-
|
|
7781
|
-
|
|
7782
|
-
|
|
7792
|
+
// src/per-user-limits-view.tsx
|
|
7793
|
+
import { useCallback as useCallback5, useEffect as useEffect12, useMemo as useMemo3, useRef as useRef6, useState as useState14 } from "react";
|
|
7794
|
+
import { ScButton as ScButton7 } from "@streamoid/ui";
|
|
7795
|
+
|
|
7796
|
+
// src/member-credit-limit-modal.tsx
|
|
7797
|
+
import { useEffect as useEffect11, useState as useState13 } from "react";
|
|
7798
|
+
import { ScButton as ScButton6, ScPairtext } from "@streamoid/ui";
|
|
7799
|
+
import { SiconClose as SiconClose6 } from "@streamoid/icons";
|
|
7800
|
+
|
|
7801
|
+
// src/credit-limits.ts
|
|
7802
|
+
var DAY_MS = 24 * 60 * 60 * 1e3;
|
|
7803
|
+
function creditCycleUnit(cycle) {
|
|
7804
|
+
if (!cycle) return "month";
|
|
7805
|
+
const days = (Date.parse(cycle.end) - Date.parse(cycle.start)) / DAY_MS;
|
|
7806
|
+
return Number.isFinite(days) && days > 200 ? "year" : "month";
|
|
7783
7807
|
}
|
|
7784
|
-
function
|
|
7785
|
-
if (
|
|
7786
|
-
|
|
7787
|
-
}
|
|
7788
|
-
return `$${(cents / 100).toFixed(2)}`;
|
|
7808
|
+
function formatCreditLimit(limit, unit) {
|
|
7809
|
+
if (limit === null) return "Unlimited";
|
|
7810
|
+
return `${limit.toLocaleString("en-US")} ${limit === 1 ? "credit" : "credits"} / ${unit}`;
|
|
7789
7811
|
}
|
|
7790
|
-
function
|
|
7791
|
-
return
|
|
7812
|
+
function roundCredits(value) {
|
|
7813
|
+
return Number(value.toFixed(2));
|
|
7792
7814
|
}
|
|
7793
|
-
function
|
|
7794
|
-
return
|
|
7815
|
+
function minimumCreditLimit(used) {
|
|
7816
|
+
return Math.ceil(roundCredits(used));
|
|
7795
7817
|
}
|
|
7796
|
-
function
|
|
7797
|
-
|
|
7798
|
-
|
|
7799
|
-
|
|
7800
|
-
|
|
7801
|
-
|
|
7802
|
-
|
|
7803
|
-
|
|
7804
|
-
|
|
7805
|
-
|
|
7818
|
+
function formatCredits(value) {
|
|
7819
|
+
return roundCredits(value).toLocaleString("en-US", { maximumFractionDigits: 2 });
|
|
7820
|
+
}
|
|
7821
|
+
function validateDefaultCreditLimitInput(raw) {
|
|
7822
|
+
return validateCreditLimitInput(raw, 0);
|
|
7823
|
+
}
|
|
7824
|
+
function validateCreditLimitInput(raw, used) {
|
|
7825
|
+
const trimmed = raw.trim();
|
|
7826
|
+
if (!trimmed) return { ok: false, reason: "Enter a credit limit" };
|
|
7827
|
+
if (!/^\d+$/.test(trimmed)) {
|
|
7828
|
+
return { ok: false, reason: "Enter a whole number of credits" };
|
|
7806
7829
|
}
|
|
7807
|
-
const
|
|
7808
|
-
|
|
7809
|
-
|
|
7810
|
-
|
|
7811
|
-
|
|
7812
|
-
|
|
7813
|
-
}
|
|
7830
|
+
const value = Number(trimmed);
|
|
7831
|
+
if (!Number.isSafeInteger(value)) {
|
|
7832
|
+
return { ok: false, reason: "Enter a smaller number" };
|
|
7833
|
+
}
|
|
7834
|
+
if (value < roundCredits(used)) {
|
|
7835
|
+
return { ok: false, reason: belowUsageReason(used) };
|
|
7836
|
+
}
|
|
7837
|
+
return { ok: true, value };
|
|
7814
7838
|
}
|
|
7815
|
-
function
|
|
7816
|
-
|
|
7817
|
-
const parsed = typeof value === "number" ? new Date(value < 1e10 ? value * 1e3 : value) : new Date(value);
|
|
7818
|
-
if (Number.isNaN(parsed.getTime())) return "";
|
|
7819
|
-
return parsed.toLocaleDateString("en-US", {
|
|
7820
|
-
month: "short",
|
|
7821
|
-
day: "numeric",
|
|
7822
|
-
year: "numeric"
|
|
7823
|
-
});
|
|
7839
|
+
function belowUsageReason(used) {
|
|
7840
|
+
return `Must be at least ${minimumCreditLimit(used).toLocaleString("en-US")} \u2014 ${formatCredits(used)} already used this cycle`;
|
|
7824
7841
|
}
|
|
7825
|
-
function
|
|
7826
|
-
|
|
7827
|
-
const [isLight, setIsLight] = useState13(read);
|
|
7828
|
-
useEffect11(() => {
|
|
7829
|
-
if (typeof document === "undefined") return;
|
|
7830
|
-
const target = document.documentElement;
|
|
7831
|
-
const observer = new MutationObserver(() => setIsLight(read()));
|
|
7832
|
-
observer.observe(target, {
|
|
7833
|
-
attributes: true,
|
|
7834
|
-
attributeFilter: ["data-theme"]
|
|
7835
|
-
});
|
|
7836
|
-
setIsLight(read());
|
|
7837
|
-
return () => observer.disconnect();
|
|
7838
|
-
}, []);
|
|
7839
|
-
return isLight;
|
|
7842
|
+
function describeDefaultLimit(response, unit) {
|
|
7843
|
+
return formatCreditLimit(response?.default?.limit ?? null, unit);
|
|
7840
7844
|
}
|
|
7841
|
-
function
|
|
7845
|
+
function describeMemberLimit(row, unit) {
|
|
7846
|
+
return formatCreditLimit(row.limit, unit);
|
|
7847
|
+
}
|
|
7848
|
+
function limitSourceLabel(row) {
|
|
7849
|
+
if (row.source === "override") return "Custom";
|
|
7850
|
+
if (row.source === "default") return "Default";
|
|
7851
|
+
return null;
|
|
7852
|
+
}
|
|
7853
|
+
function joinMembersWithLimits(members, response) {
|
|
7854
|
+
const byUser = /* @__PURE__ */ new Map();
|
|
7855
|
+
for (const entry of response?.users ?? []) byUser.set(entry.userId, entry);
|
|
7856
|
+
const def = response?.default ?? null;
|
|
7857
|
+
return members.map((member) => {
|
|
7858
|
+
const userId = member.user._id;
|
|
7859
|
+
const entry = byUser.get(userId);
|
|
7860
|
+
if (!entry) {
|
|
7861
|
+
return {
|
|
7862
|
+
member,
|
|
7863
|
+
userId,
|
|
7864
|
+
limit: def ? def.limit ?? null : null,
|
|
7865
|
+
source: def ? "default" : "none",
|
|
7866
|
+
hasLimit: false,
|
|
7867
|
+
used: 0,
|
|
7868
|
+
lastCycleUsed: 0
|
|
7869
|
+
};
|
|
7870
|
+
}
|
|
7871
|
+
const hasLimit = Boolean(entry.hasLimit);
|
|
7872
|
+
return {
|
|
7873
|
+
member,
|
|
7874
|
+
userId,
|
|
7875
|
+
limit: entry.limit ?? null,
|
|
7876
|
+
source: entry.source ?? (hasLimit ? "override" : def ? "default" : "none"),
|
|
7877
|
+
hasLimit,
|
|
7878
|
+
used: entry.used ?? 0,
|
|
7879
|
+
lastCycleUsed: entry.lastCycleUsed ?? 0
|
|
7880
|
+
};
|
|
7881
|
+
});
|
|
7882
|
+
}
|
|
7883
|
+
|
|
7884
|
+
// src/member-credit-limit-modal.tsx
|
|
7885
|
+
import { jsx as jsx20, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
7886
|
+
var T12 = {
|
|
7887
|
+
primary: "var(--alias-text---icons-primary)",
|
|
7888
|
+
tertiary: "var(--alias-text---icons-tertiary)",
|
|
7889
|
+
muted: "var(--alias-text---icons-muted)",
|
|
7890
|
+
error: "var(--alias-text---icons-error, var(--alias-text-and-icons-error, #ff6b6b))",
|
|
7891
|
+
surface: "var(--primitives-neutral-825)",
|
|
7892
|
+
fillPlus: "var(--alias-fill-neutral-neutralplus)",
|
|
7893
|
+
borderSubtle: "var(--alias-border-subtle)",
|
|
7894
|
+
borderDivider: "var(--alias-border-divider)",
|
|
7895
|
+
font: "var(--font-family-font-family-body)",
|
|
7896
|
+
fsSm: "var(--font-size-font-size-sm)",
|
|
7897
|
+
fsLg: "var(--font-size-font-size-lg)",
|
|
7898
|
+
lhSm: "var(--line-height-line-height-sm)",
|
|
7899
|
+
lhLg: "var(--line-height-line-height-lg)",
|
|
7900
|
+
spXs: "var(--spacing-xs)",
|
|
7901
|
+
spXl: "var(--spacing-xl)",
|
|
7902
|
+
sp3xl: "var(--spacing-3xl)",
|
|
7903
|
+
sp6xl: "var(--spacing-6xl)",
|
|
7904
|
+
r3xl: "var(--radius-3xl)",
|
|
7905
|
+
r4xl: "var(--radius-4xl)"
|
|
7906
|
+
};
|
|
7907
|
+
function MemberCreditLimitModal({
|
|
7842
7908
|
open,
|
|
7843
|
-
|
|
7844
|
-
|
|
7845
|
-
|
|
7846
|
-
|
|
7847
|
-
|
|
7848
|
-
|
|
7909
|
+
title = "Set custom usage limit",
|
|
7910
|
+
description,
|
|
7911
|
+
subject,
|
|
7912
|
+
resetKey,
|
|
7913
|
+
used,
|
|
7914
|
+
initialLimit,
|
|
7915
|
+
isSet,
|
|
7916
|
+
unit,
|
|
7917
|
+
onSave,
|
|
7918
|
+
onRemove,
|
|
7919
|
+
removeLabel = "Remove",
|
|
7920
|
+
removeHint,
|
|
7921
|
+
saveSuccessMessage = "Usage limit updated",
|
|
7922
|
+
removeSuccessMessage = "Usage limit removed",
|
|
7849
7923
|
onClose,
|
|
7850
|
-
|
|
7924
|
+
onSaved,
|
|
7925
|
+
onStale
|
|
7851
7926
|
}) {
|
|
7852
|
-
const
|
|
7853
|
-
const
|
|
7854
|
-
const
|
|
7927
|
+
const { toast } = useSettingsAdapters();
|
|
7928
|
+
const initialUnlimited = initialLimit === null;
|
|
7929
|
+
const [unlimited, setUnlimited] = useState13(initialUnlimited);
|
|
7930
|
+
const [raw, setRaw] = useState13("");
|
|
7931
|
+
const [touched, setTouched] = useState13(false);
|
|
7932
|
+
const [saving, setSaving] = useState13(false);
|
|
7933
|
+
const [serverHint, setServerHint] = useState13(null);
|
|
7934
|
+
const [serverUsed, setServerUsed] = useState13(null);
|
|
7935
|
+
const close = () => {
|
|
7936
|
+
if (!saving) onClose();
|
|
7937
|
+
};
|
|
7938
|
+
useOverlayOpen(open, close);
|
|
7939
|
+
useEffect11(() => {
|
|
7940
|
+
if (!open) return;
|
|
7941
|
+
setUnlimited(initialUnlimited);
|
|
7942
|
+
setRaw(initialLimit !== null ? String(initialLimit) : "");
|
|
7943
|
+
setTouched(false);
|
|
7944
|
+
setSaving(false);
|
|
7945
|
+
setServerHint(null);
|
|
7946
|
+
setServerUsed(null);
|
|
7947
|
+
}, [open, resetKey, initialLimit, isSet, initialUnlimited]);
|
|
7855
7948
|
if (!open) return null;
|
|
7949
|
+
const usedNow = Math.max(used, serverUsed ?? 0);
|
|
7950
|
+
const validation = validateCreditLimitInput(raw, usedNow);
|
|
7951
|
+
const changed = !isSet || (unlimited ? !initialUnlimited : initialUnlimited || validation.ok && validation.value !== initialLimit);
|
|
7952
|
+
const canSave = !saving && changed && (unlimited || validation.ok);
|
|
7953
|
+
const hint = serverHint ?? (!unlimited && touched && !validation.ok ? validation.reason : null);
|
|
7954
|
+
const handleSave = async () => {
|
|
7955
|
+
if (!canSave) return;
|
|
7956
|
+
const next = unlimited ? null : validation.ok ? validation.value : null;
|
|
7957
|
+
setSaving(true);
|
|
7958
|
+
try {
|
|
7959
|
+
await onSave(next);
|
|
7960
|
+
toast.success(saveSuccessMessage);
|
|
7961
|
+
onSaved();
|
|
7962
|
+
onClose();
|
|
7963
|
+
} catch (err) {
|
|
7964
|
+
if (isLimitBelowUsage(err)) {
|
|
7965
|
+
const fresh = limitBelowUsageUsed(err) ?? usedNow;
|
|
7966
|
+
setServerUsed(fresh);
|
|
7967
|
+
setUnlimited(false);
|
|
7968
|
+
setServerHint(belowUsageReason(fresh));
|
|
7969
|
+
if (fresh !== used) onStale?.();
|
|
7970
|
+
} else {
|
|
7971
|
+
toast.error(errorMessage(err, { method: "PUT" }));
|
|
7972
|
+
}
|
|
7973
|
+
setSaving(false);
|
|
7974
|
+
}
|
|
7975
|
+
};
|
|
7976
|
+
const handleRemove = async () => {
|
|
7977
|
+
if (saving || !onRemove) return;
|
|
7978
|
+
setSaving(true);
|
|
7979
|
+
try {
|
|
7980
|
+
await onRemove();
|
|
7981
|
+
toast.success(removeSuccessMessage);
|
|
7982
|
+
onSaved();
|
|
7983
|
+
onClose();
|
|
7984
|
+
} catch (err) {
|
|
7985
|
+
toast.error(errorMessage(err, { method: "DELETE" }));
|
|
7986
|
+
setSaving(false);
|
|
7987
|
+
}
|
|
7988
|
+
};
|
|
7989
|
+
const bodyText = {
|
|
7990
|
+
fontFamily: T12.font,
|
|
7991
|
+
fontSize: T12.fsSm,
|
|
7992
|
+
lineHeight: T12.lhSm
|
|
7993
|
+
};
|
|
7856
7994
|
return /* @__PURE__ */ jsx20(
|
|
7857
7995
|
"div",
|
|
7858
7996
|
{
|
|
7859
7997
|
className: "fixed inset-0 z-50 flex items-center justify-center",
|
|
7860
7998
|
style: { backgroundColor: "rgba(0, 0, 0, 0.6)" },
|
|
7861
|
-
onClick: (
|
|
7862
|
-
if (
|
|
7999
|
+
onClick: (e) => {
|
|
8000
|
+
if (e.target === e.currentTarget) close();
|
|
7863
8001
|
},
|
|
7864
8002
|
children: /* @__PURE__ */ jsxs17(
|
|
7865
8003
|
"div",
|
|
7866
8004
|
{
|
|
7867
|
-
className: "flex flex-col
|
|
8005
|
+
className: "flex flex-col items-start",
|
|
7868
8006
|
style: {
|
|
7869
|
-
backgroundColor:
|
|
7870
|
-
borderRadius:
|
|
7871
|
-
border:
|
|
7872
|
-
|
|
7873
|
-
|
|
7874
|
-
maxHeight: "
|
|
7875
|
-
overflowY: "auto"
|
|
8007
|
+
backgroundColor: T12.surface,
|
|
8008
|
+
borderRadius: T12.r4xl,
|
|
8009
|
+
border: `1px solid ${T12.borderSubtle}`,
|
|
8010
|
+
width: 480,
|
|
8011
|
+
maxWidth: "calc(100vw - 32px)",
|
|
8012
|
+
maxHeight: "85vh"
|
|
7876
8013
|
},
|
|
7877
8014
|
children: [
|
|
7878
|
-
/* @__PURE__ */ jsxs17("div", { className: "
|
|
8015
|
+
/* @__PURE__ */ jsxs17("div", { className: "shrink-0 w-full relative", children: [
|
|
7879
8016
|
/* @__PURE__ */ jsx20(
|
|
7880
|
-
"
|
|
8017
|
+
"div",
|
|
7881
8018
|
{
|
|
7882
|
-
|
|
7883
|
-
|
|
7884
|
-
|
|
7885
|
-
fontSize: "var(--font-size-font-size-xxl)",
|
|
7886
|
-
fontWeight: 600,
|
|
7887
|
-
lineHeight: "var(--line-height-line-height-xxl)",
|
|
7888
|
-
color: "var(--alias-text---icons-primary)"
|
|
7889
|
-
},
|
|
7890
|
-
children: "Update Subscription"
|
|
8019
|
+
"aria-hidden": true,
|
|
8020
|
+
className: "absolute inset-0 pointer-events-none",
|
|
8021
|
+
style: { borderBottom: `1px solid ${T12.borderDivider}` }
|
|
7891
8022
|
}
|
|
7892
8023
|
),
|
|
7893
|
-
/* @__PURE__ */
|
|
7894
|
-
"
|
|
8024
|
+
/* @__PURE__ */ jsxs17(
|
|
8025
|
+
"div",
|
|
7895
8026
|
{
|
|
7896
|
-
|
|
7897
|
-
|
|
7898
|
-
|
|
7899
|
-
|
|
8027
|
+
className: "flex items-center w-full",
|
|
8028
|
+
style: { gap: T12.sp3xl, padding: `${T12.sp3xl} ${T12.sp6xl}` },
|
|
8029
|
+
children: [
|
|
8030
|
+
/* @__PURE__ */ jsx20(
|
|
8031
|
+
"p",
|
|
8032
|
+
{
|
|
8033
|
+
className: "flex-1 min-w-0 overflow-hidden text-ellipsis whitespace-nowrap",
|
|
8034
|
+
style: {
|
|
8035
|
+
color: T12.primary,
|
|
8036
|
+
fontFamily: T12.font,
|
|
8037
|
+
fontSize: T12.fsLg,
|
|
8038
|
+
fontWeight: 600,
|
|
8039
|
+
lineHeight: T12.lhLg
|
|
8040
|
+
},
|
|
8041
|
+
children: title
|
|
8042
|
+
}
|
|
8043
|
+
),
|
|
8044
|
+
/* @__PURE__ */ jsx20("div", { className: "shrink-0 cursor-pointer", onClick: close, children: /* @__PURE__ */ jsx20(SiconClose6, { className: "w-6 h-6", color: T12.primary }) })
|
|
8045
|
+
]
|
|
7900
8046
|
}
|
|
7901
8047
|
)
|
|
7902
8048
|
] }),
|
|
7903
|
-
/* @__PURE__ */ jsx20(
|
|
7904
|
-
"div",
|
|
7905
|
-
{
|
|
7906
|
-
className: "w-full",
|
|
7907
|
-
style: {
|
|
7908
|
-
height: "1px",
|
|
7909
|
-
backgroundColor: "var(--alias-border-divider)"
|
|
7910
|
-
}
|
|
7911
|
-
}
|
|
7912
|
-
),
|
|
7913
|
-
/* @__PURE__ */ jsxs17(
|
|
8049
|
+
/* @__PURE__ */ jsx20("div", { className: "flex-1 min-h-0 w-full overflow-y-auto", children: /* @__PURE__ */ jsxs17(
|
|
7914
8050
|
"div",
|
|
7915
8051
|
{
|
|
7916
|
-
className: "flex flex-col w-full",
|
|
7917
|
-
style: { gap:
|
|
8052
|
+
className: "flex flex-col items-start w-full",
|
|
8053
|
+
style: { padding: `${T12.sp3xl} ${T12.sp6xl}`, gap: T12.sp3xl },
|
|
7918
8054
|
children: [
|
|
8055
|
+
(subject || description) && /* @__PURE__ */ jsxs17("div", { className: "flex flex-col w-full min-w-0", children: [
|
|
8056
|
+
subject?.name?.trim() && /* @__PURE__ */ jsx20(
|
|
8057
|
+
"span",
|
|
8058
|
+
{
|
|
8059
|
+
className: "truncate",
|
|
8060
|
+
style: { ...bodyText, fontWeight: 500, color: T12.primary },
|
|
8061
|
+
children: subject.name
|
|
8062
|
+
}
|
|
8063
|
+
),
|
|
8064
|
+
subject && /* @__PURE__ */ jsx20(
|
|
8065
|
+
"span",
|
|
8066
|
+
{
|
|
8067
|
+
className: "truncate",
|
|
8068
|
+
style: {
|
|
8069
|
+
...bodyText,
|
|
8070
|
+
color: subject.name?.trim() ? T12.muted : T12.primary
|
|
8071
|
+
},
|
|
8072
|
+
children: subject.email
|
|
8073
|
+
}
|
|
8074
|
+
),
|
|
8075
|
+
subject && /* @__PURE__ */ jsxs17("span", { style: { ...bodyText, color: T12.tertiary, marginTop: T12.spXs }, children: [
|
|
8076
|
+
"Used this cycle: ",
|
|
8077
|
+
formatCredits(usedNow),
|
|
8078
|
+
" credits"
|
|
8079
|
+
] }),
|
|
8080
|
+
description && /* @__PURE__ */ jsx20("span", { style: { ...bodyText, color: T12.tertiary }, children: description })
|
|
8081
|
+
] }),
|
|
8082
|
+
/* @__PURE__ */ jsxs17("div", { className: "flex flex-col w-full", style: { gap: T12.spXs }, children: [
|
|
8083
|
+
/* @__PURE__ */ jsxs17("div", { className: "flex items-center w-full", style: { gap: T12.sp3xl }, children: [
|
|
8084
|
+
/* @__PURE__ */ jsx20(
|
|
8085
|
+
ScPairtext,
|
|
8086
|
+
{
|
|
8087
|
+
type: "radio",
|
|
8088
|
+
content: "",
|
|
8089
|
+
checked: !unlimited,
|
|
8090
|
+
onChange: () => setUnlimited(false)
|
|
8091
|
+
}
|
|
8092
|
+
),
|
|
8093
|
+
/* @__PURE__ */ jsxs17(
|
|
8094
|
+
"div",
|
|
8095
|
+
{
|
|
8096
|
+
className: "flex-1 min-w-0 flex items-center",
|
|
8097
|
+
style: {
|
|
8098
|
+
background: T12.fillPlus,
|
|
8099
|
+
height: 48,
|
|
8100
|
+
borderRadius: T12.r3xl,
|
|
8101
|
+
padding: `${T12.spXl} ${T12.sp3xl}`,
|
|
8102
|
+
gap: T12.spXl,
|
|
8103
|
+
border: hint ? `1px solid ${T12.error}` : "1px solid transparent",
|
|
8104
|
+
opacity: unlimited ? 0.6 : 1
|
|
8105
|
+
},
|
|
8106
|
+
children: [
|
|
8107
|
+
/* @__PURE__ */ jsx20(
|
|
8108
|
+
"input",
|
|
8109
|
+
{
|
|
8110
|
+
inputMode: "numeric",
|
|
8111
|
+
"aria-label": "Credit limit",
|
|
8112
|
+
"aria-invalid": hint ? true : void 0,
|
|
8113
|
+
placeholder: "Enter credits",
|
|
8114
|
+
value: raw,
|
|
8115
|
+
disabled: saving,
|
|
8116
|
+
onFocus: () => setUnlimited(false),
|
|
8117
|
+
onChange: (e) => {
|
|
8118
|
+
setRaw(e.target.value.replace(/[^\d]/g, ""));
|
|
8119
|
+
setTouched(true);
|
|
8120
|
+
setServerHint(null);
|
|
8121
|
+
},
|
|
8122
|
+
className: "flex-1 min-w-0",
|
|
8123
|
+
style: {
|
|
8124
|
+
...bodyText,
|
|
8125
|
+
background: "transparent",
|
|
8126
|
+
border: "none",
|
|
8127
|
+
outline: "none",
|
|
8128
|
+
color: T12.primary,
|
|
8129
|
+
padding: 0
|
|
8130
|
+
}
|
|
8131
|
+
}
|
|
8132
|
+
),
|
|
8133
|
+
/* @__PURE__ */ jsxs17("span", { className: "shrink-0", style: { ...bodyText, color: T12.muted }, children: [
|
|
8134
|
+
"credits / ",
|
|
8135
|
+
unit
|
|
8136
|
+
] })
|
|
8137
|
+
]
|
|
8138
|
+
}
|
|
8139
|
+
)
|
|
8140
|
+
] }),
|
|
8141
|
+
hint && /* @__PURE__ */ jsx20("span", { role: "alert", style: { ...bodyText, color: T12.error }, children: hint })
|
|
8142
|
+
] }),
|
|
7919
8143
|
/* @__PURE__ */ jsx20(
|
|
7920
|
-
|
|
8144
|
+
ScPairtext,
|
|
7921
8145
|
{
|
|
7922
|
-
|
|
7923
|
-
|
|
7924
|
-
|
|
7925
|
-
|
|
7926
|
-
|
|
7927
|
-
|
|
7928
|
-
}
|
|
7929
|
-
children: "Current billing plan"
|
|
8146
|
+
type: "radio",
|
|
8147
|
+
content: "Unlimited usage",
|
|
8148
|
+
checked: unlimited,
|
|
8149
|
+
onChange: () => {
|
|
8150
|
+
setUnlimited(true);
|
|
8151
|
+
setServerHint(null);
|
|
8152
|
+
}
|
|
7930
8153
|
}
|
|
7931
8154
|
),
|
|
7932
|
-
/* @__PURE__ */
|
|
7933
|
-
|
|
7934
|
-
|
|
7935
|
-
|
|
8155
|
+
onRemove && removeHint && /* @__PURE__ */ jsx20("span", { style: { ...bodyText, color: T12.muted }, children: removeHint })
|
|
8156
|
+
]
|
|
8157
|
+
}
|
|
8158
|
+
) }),
|
|
8159
|
+
/* @__PURE__ */ jsxs17("div", { className: "shrink-0 w-full relative", children: [
|
|
8160
|
+
/* @__PURE__ */ jsx20(
|
|
8161
|
+
"div",
|
|
8162
|
+
{
|
|
8163
|
+
"aria-hidden": true,
|
|
8164
|
+
className: "absolute inset-0 pointer-events-none",
|
|
8165
|
+
style: { borderTop: `1px solid ${T12.borderDivider}` }
|
|
8166
|
+
}
|
|
8167
|
+
),
|
|
8168
|
+
/* @__PURE__ */ jsxs17(
|
|
8169
|
+
"div",
|
|
8170
|
+
{
|
|
8171
|
+
className: "flex items-center w-full",
|
|
8172
|
+
style: {
|
|
8173
|
+
padding: `${T12.sp3xl} ${T12.sp6xl}`,
|
|
8174
|
+
justifyContent: onRemove ? "space-between" : "flex-end"
|
|
8175
|
+
},
|
|
8176
|
+
children: [
|
|
8177
|
+
onRemove && /* @__PURE__ */ jsx20(
|
|
8178
|
+
ScButton6,
|
|
8179
|
+
{
|
|
8180
|
+
text: removeLabel,
|
|
8181
|
+
variant: "error",
|
|
8182
|
+
size: "md",
|
|
8183
|
+
state: saving ? "disabled" : "default",
|
|
8184
|
+
onClick: saving ? void 0 : () => void handleRemove()
|
|
8185
|
+
}
|
|
8186
|
+
),
|
|
8187
|
+
/* @__PURE__ */ jsx20(
|
|
8188
|
+
ScButton6,
|
|
8189
|
+
{
|
|
8190
|
+
text: "Save",
|
|
8191
|
+
variant: "primary",
|
|
8192
|
+
size: "md",
|
|
8193
|
+
state: canSave ? "default" : "disabled",
|
|
8194
|
+
onClick: canSave ? () => void handleSave() : void 0
|
|
8195
|
+
}
|
|
8196
|
+
)
|
|
8197
|
+
]
|
|
8198
|
+
}
|
|
8199
|
+
)
|
|
8200
|
+
] })
|
|
8201
|
+
]
|
|
8202
|
+
}
|
|
8203
|
+
)
|
|
8204
|
+
}
|
|
8205
|
+
);
|
|
8206
|
+
}
|
|
8207
|
+
|
|
8208
|
+
// src/per-user-limits-view.tsx
|
|
8209
|
+
import { jsx as jsx21, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
8210
|
+
var T13 = {
|
|
8211
|
+
primary: "var(--alias-text---icons-primary)",
|
|
8212
|
+
muted: "var(--alias-text---icons-muted)",
|
|
8213
|
+
fillPlus: "var(--alias-fill-neutral-neutralplus)",
|
|
8214
|
+
surfaceBase: "var(--alias-surface-base)",
|
|
8215
|
+
borderSubtle: "var(--alias-border-subtle)",
|
|
8216
|
+
font: "var(--font-family-font-family-body)",
|
|
8217
|
+
fsSm: "var(--font-size-font-size-sm)",
|
|
8218
|
+
fsXl: "var(--font-size-font-size-xl)",
|
|
8219
|
+
lhSm: "var(--line-height-line-height-sm)",
|
|
8220
|
+
lhXl: "var(--line-height-line-height-xl)",
|
|
8221
|
+
spMd: "var(--spacing-md)",
|
|
8222
|
+
sp3xl: "var(--spacing-3xl)",
|
|
8223
|
+
sp6xl: "var(--spacing-6xl)",
|
|
8224
|
+
r3xl: "var(--radius-3xl)"
|
|
8225
|
+
};
|
|
8226
|
+
var COLUMNS = "minmax(200px, 1fr) 140px 150px 190px 80px";
|
|
8227
|
+
var cellText = {
|
|
8228
|
+
fontFamily: T13.font,
|
|
8229
|
+
fontSize: T13.fsSm,
|
|
8230
|
+
lineHeight: T13.lhSm,
|
|
8231
|
+
color: T13.primary
|
|
8232
|
+
};
|
|
8233
|
+
function LimitRow({
|
|
8234
|
+
row,
|
|
8235
|
+
unit,
|
|
8236
|
+
onEdit
|
|
8237
|
+
}) {
|
|
8238
|
+
const name = row.member.user.name?.trim() ?? "";
|
|
8239
|
+
const email = row.member.user.email || "";
|
|
8240
|
+
const displayIdent = name || email.split("@")[0] || "user";
|
|
8241
|
+
return /* @__PURE__ */ jsxs18(
|
|
8242
|
+
"div",
|
|
8243
|
+
{
|
|
8244
|
+
style: {
|
|
8245
|
+
borderBottom: `1px solid ${T13.borderSubtle}`,
|
|
8246
|
+
display: "grid",
|
|
8247
|
+
gridTemplateColumns: COLUMNS,
|
|
8248
|
+
alignItems: "center",
|
|
8249
|
+
padding: `8px ${T13.sp3xl}`,
|
|
8250
|
+
gap: 24
|
|
8251
|
+
},
|
|
8252
|
+
onMouseEnter: (e) => {
|
|
8253
|
+
e.currentTarget.style.background = T13.fillPlus;
|
|
8254
|
+
},
|
|
8255
|
+
onMouseLeave: (e) => {
|
|
8256
|
+
e.currentTarget.style.background = "transparent";
|
|
8257
|
+
},
|
|
8258
|
+
children: [
|
|
8259
|
+
/* @__PURE__ */ jsxs18("div", { className: "flex items-center min-w-0", style: { gap: T13.spMd }, children: [
|
|
8260
|
+
/* @__PURE__ */ jsx21(ProfileAvatar, { name: displayIdent, size: 32 }),
|
|
8261
|
+
/* @__PURE__ */ jsxs18("div", { className: "flex flex-col min-w-0", children: [
|
|
8262
|
+
name && /* @__PURE__ */ jsx21("span", { className: "truncate", style: { ...cellText, fontWeight: 500 }, children: name }),
|
|
8263
|
+
/* @__PURE__ */ jsx21(
|
|
8264
|
+
"span",
|
|
8265
|
+
{
|
|
8266
|
+
className: "truncate",
|
|
8267
|
+
style: { ...cellText, color: name ? T13.muted : T13.primary },
|
|
8268
|
+
children: email || "\u2014"
|
|
8269
|
+
}
|
|
8270
|
+
)
|
|
8271
|
+
] })
|
|
8272
|
+
] }),
|
|
8273
|
+
/* @__PURE__ */ jsx21("span", { style: cellText, children: formatCredits(row.used) }),
|
|
8274
|
+
/* @__PURE__ */ jsx21("span", { style: cellText, children: formatCredits(row.lastCycleUsed) }),
|
|
8275
|
+
/* @__PURE__ */ jsxs18("div", { className: "flex flex-col min-w-0", children: [
|
|
8276
|
+
/* @__PURE__ */ jsx21("span", { style: cellText, children: describeMemberLimit(row, unit) }),
|
|
8277
|
+
limitSourceLabel(row) && /* @__PURE__ */ jsx21("span", { style: { ...cellText, color: T13.muted }, children: limitSourceLabel(row) })
|
|
8278
|
+
] }),
|
|
8279
|
+
/* @__PURE__ */ jsx21("div", { className: "flex items-center", children: onEdit && /* @__PURE__ */ jsx21(ScButton7, { text: "Edit", variant: "secondary", size: "sm", onClick: onEdit }) })
|
|
8280
|
+
]
|
|
8281
|
+
}
|
|
8282
|
+
);
|
|
8283
|
+
}
|
|
8284
|
+
function PerUserLimitsView() {
|
|
8285
|
+
const { api, workspace, toast } = useSettingsAdapters();
|
|
8286
|
+
const workspaceId = workspace.current?.id ?? null;
|
|
8287
|
+
const [members, setMembers] = useState14([]);
|
|
8288
|
+
const [limits, setLimits] = useState14(null);
|
|
8289
|
+
const [loading, setLoading] = useState14(true);
|
|
8290
|
+
const [failed, setFailed] = useState14(false);
|
|
8291
|
+
const [searchQuery, setSearchQuery] = useState14("");
|
|
8292
|
+
const [editing, setEditing] = useState14(null);
|
|
8293
|
+
const [editingDefault, setEditingDefault] = useState14(false);
|
|
8294
|
+
const latestLoad = useRef6(0);
|
|
8295
|
+
const load = useCallback5(async ({ refresh = false } = {}) => {
|
|
8296
|
+
const loadId = ++latestLoad.current;
|
|
8297
|
+
if (!api.fetchMemberCreditLimits) {
|
|
8298
|
+
setLoading(false);
|
|
8299
|
+
setFailed(true);
|
|
8300
|
+
return;
|
|
8301
|
+
}
|
|
8302
|
+
const [nextMembers, nextLimits] = await Promise.all([
|
|
8303
|
+
api.fetchMembers().catch(() => null),
|
|
8304
|
+
api.fetchMemberCreditLimits().catch(() => null)
|
|
8305
|
+
]);
|
|
8306
|
+
if (loadId !== latestLoad.current) return;
|
|
8307
|
+
if (refresh && (!nextMembers || !nextLimits)) {
|
|
8308
|
+
toast.error("Couldn't refresh usage limits. Reopen this page to see the latest.");
|
|
8309
|
+
return;
|
|
8310
|
+
}
|
|
8311
|
+
setFailed(!nextMembers || !nextLimits);
|
|
8312
|
+
setMembers(nextMembers ?? []);
|
|
8313
|
+
setLimits(nextLimits);
|
|
8314
|
+
setLoading(false);
|
|
8315
|
+
}, [api, toast]);
|
|
8316
|
+
useEffect12(() => {
|
|
8317
|
+
setLoading(true);
|
|
8318
|
+
setFailed(false);
|
|
8319
|
+
setMembers([]);
|
|
8320
|
+
setLimits(null);
|
|
8321
|
+
setEditing(null);
|
|
8322
|
+
setEditingDefault(false);
|
|
8323
|
+
setSearchQuery("");
|
|
8324
|
+
void load();
|
|
8325
|
+
}, [workspaceId]);
|
|
8326
|
+
useEffect12(
|
|
8327
|
+
() => () => {
|
|
8328
|
+
latestLoad.current += 1;
|
|
8329
|
+
},
|
|
8330
|
+
[]
|
|
8331
|
+
);
|
|
8332
|
+
const unit = creditCycleUnit(limits?.cycle);
|
|
8333
|
+
const rows = useMemo3(
|
|
8334
|
+
() => joinMembersWithLimits(members, limits),
|
|
8335
|
+
[members, limits]
|
|
8336
|
+
);
|
|
8337
|
+
const filtered = useMemo3(() => {
|
|
8338
|
+
const q = searchQuery.trim().toLowerCase();
|
|
8339
|
+
if (!q) return rows;
|
|
8340
|
+
return rows.filter(
|
|
8341
|
+
({ member }) => (member.user.name ?? "").toLowerCase().includes(q) || (member.user.email ?? "").toLowerCase().includes(q)
|
|
8342
|
+
);
|
|
8343
|
+
}, [rows, searchQuery]);
|
|
8344
|
+
if (loading) {
|
|
8345
|
+
return /* @__PURE__ */ jsx21(
|
|
8346
|
+
"div",
|
|
8347
|
+
{
|
|
8348
|
+
className: "flex items-center justify-center w-full",
|
|
8349
|
+
style: {
|
|
8350
|
+
backgroundColor: T13.surfaceBase,
|
|
8351
|
+
borderRadius: T13.r3xl,
|
|
8352
|
+
padding: T13.sp6xl
|
|
8353
|
+
},
|
|
8354
|
+
children: /* @__PURE__ */ jsx21(
|
|
8355
|
+
"div",
|
|
8356
|
+
{
|
|
8357
|
+
className: "animate-spin",
|
|
8358
|
+
style: {
|
|
8359
|
+
width: 24,
|
|
8360
|
+
height: 24,
|
|
8361
|
+
borderRadius: "var(--radius-full)",
|
|
8362
|
+
border: "2px solid var(--alias-border-subtle)",
|
|
8363
|
+
borderTopColor: "var(--alias-text---icons-primary)"
|
|
8364
|
+
}
|
|
8365
|
+
}
|
|
8366
|
+
)
|
|
8367
|
+
}
|
|
8368
|
+
);
|
|
8369
|
+
}
|
|
8370
|
+
return /* @__PURE__ */ jsxs18("div", { className: "flex flex-col flex-1 min-h-0 w-full", style: { gap: 16 }, children: [
|
|
8371
|
+
/* @__PURE__ */ jsxs18("div", { className: "flex flex-col shrink-0", style: { gap: 4 }, children: [
|
|
8372
|
+
/* @__PURE__ */ jsx21(
|
|
8373
|
+
"span",
|
|
8374
|
+
{
|
|
8375
|
+
style: {
|
|
8376
|
+
fontFamily: T13.font,
|
|
8377
|
+
fontSize: T13.fsXl,
|
|
8378
|
+
fontWeight: 500,
|
|
8379
|
+
lineHeight: T13.lhXl,
|
|
8380
|
+
color: T13.primary
|
|
8381
|
+
},
|
|
8382
|
+
children: "Per-user usage limits"
|
|
8383
|
+
}
|
|
8384
|
+
),
|
|
8385
|
+
/* @__PURE__ */ jsx21("span", { style: { ...cellText, color: T13.muted }, children: "Set a default for every member, and override it for individuals." })
|
|
8386
|
+
] }),
|
|
8387
|
+
/* @__PURE__ */ jsxs18(
|
|
8388
|
+
"div",
|
|
8389
|
+
{
|
|
8390
|
+
className: "flex items-center justify-between shrink-0 w-full",
|
|
8391
|
+
style: {
|
|
8392
|
+
gap: 12,
|
|
8393
|
+
padding: 16,
|
|
8394
|
+
backgroundColor: T13.surfaceBase,
|
|
8395
|
+
border: `1px solid ${T13.borderSubtle}`,
|
|
8396
|
+
borderRadius: T13.r3xl
|
|
8397
|
+
},
|
|
8398
|
+
children: [
|
|
8399
|
+
/* @__PURE__ */ jsxs18("div", { className: "flex flex-col min-w-0", style: { gap: 4 }, children: [
|
|
8400
|
+
/* @__PURE__ */ jsx21("span", { style: { ...cellText, fontWeight: 500 }, children: "Default limit per member" }),
|
|
8401
|
+
/* @__PURE__ */ jsx21("span", { style: { ...cellText, color: T13.muted }, children: failed ? "\u2014" : describeDefaultLimit(limits, unit) })
|
|
8402
|
+
] }),
|
|
8403
|
+
api.setDefaultCreditLimit && !failed && /* @__PURE__ */ jsx21(
|
|
8404
|
+
ScButton7,
|
|
8405
|
+
{
|
|
8406
|
+
text: "Edit",
|
|
8407
|
+
variant: "secondary",
|
|
8408
|
+
size: "sm",
|
|
8409
|
+
onClick: () => setEditingDefault(true)
|
|
8410
|
+
}
|
|
8411
|
+
)
|
|
8412
|
+
]
|
|
8413
|
+
}
|
|
8414
|
+
),
|
|
8415
|
+
/* @__PURE__ */ jsx21(
|
|
8416
|
+
MemberListToolbar,
|
|
8417
|
+
{
|
|
8418
|
+
activeTab: "active",
|
|
8419
|
+
onTabChange: () => {
|
|
8420
|
+
},
|
|
8421
|
+
activeLabel: "Members",
|
|
8422
|
+
activeCount: failed ? null : filtered.length,
|
|
8423
|
+
searchQuery,
|
|
8424
|
+
onSearchChange: setSearchQuery
|
|
8425
|
+
}
|
|
8426
|
+
),
|
|
8427
|
+
/* @__PURE__ */ jsx21(
|
|
8428
|
+
MemberListFrame,
|
|
8429
|
+
{
|
|
8430
|
+
contentMinWidth: 860,
|
|
8431
|
+
header: /* @__PURE__ */ jsx21(
|
|
8432
|
+
"div",
|
|
8433
|
+
{
|
|
8434
|
+
style: {
|
|
8435
|
+
display: "grid",
|
|
8436
|
+
gridTemplateColumns: COLUMNS,
|
|
8437
|
+
gap: 24,
|
|
8438
|
+
padding: "8px 16px",
|
|
8439
|
+
fontSize: 11,
|
|
8440
|
+
color: T13.muted,
|
|
8441
|
+
textTransform: "uppercase"
|
|
8442
|
+
},
|
|
8443
|
+
children: ["Name", "Used this cycle", "Last cycle's usage", "Limit", "Actions"].map(
|
|
8444
|
+
(label) => /* @__PURE__ */ jsx21("span", { children: label }, label)
|
|
8445
|
+
)
|
|
8446
|
+
}
|
|
8447
|
+
),
|
|
8448
|
+
isEmpty: failed || filtered.length === 0,
|
|
8449
|
+
emptyText: failed ? "Couldn't load usage limits. Try again later." : searchQuery.trim() ? "No members match your search" : "No members yet",
|
|
8450
|
+
children: filtered.map((row) => /* @__PURE__ */ jsx21(
|
|
8451
|
+
LimitRow,
|
|
8452
|
+
{
|
|
8453
|
+
row,
|
|
8454
|
+
unit,
|
|
8455
|
+
onEdit: api.setMemberCreditLimit ? () => setEditing(row) : void 0
|
|
8456
|
+
},
|
|
8457
|
+
row.userId
|
|
8458
|
+
))
|
|
8459
|
+
}
|
|
8460
|
+
),
|
|
8461
|
+
editing && /* @__PURE__ */ jsx21(
|
|
8462
|
+
MemberCreditLimitModal,
|
|
8463
|
+
{
|
|
8464
|
+
open: true,
|
|
8465
|
+
resetKey: editing.userId,
|
|
8466
|
+
subject: { name: editing.member.user.name, email: editing.member.user.email },
|
|
8467
|
+
used: editing.used,
|
|
8468
|
+
initialLimit: editing.limit,
|
|
8469
|
+
isSet: editing.hasLimit,
|
|
8470
|
+
unit,
|
|
8471
|
+
onSave: (limit) => api.setMemberCreditLimit({ userId: editing.userId, limit }),
|
|
8472
|
+
onRemove: editing.hasLimit && api.removeMemberCreditLimit ? () => api.removeMemberCreditLimit(editing.userId) : void 0,
|
|
8473
|
+
removeLabel: limits?.default ? "Use default" : "Remove",
|
|
8474
|
+
removeHint: limits?.default ? `Falls back to the default: ${describeDefaultLimit(limits, unit)}` : "No default is set, so the member becomes unlimited.",
|
|
8475
|
+
onClose: () => setEditing(null),
|
|
8476
|
+
onSaved: () => void load({ refresh: true }),
|
|
8477
|
+
onStale: () => void load({ refresh: true })
|
|
8478
|
+
}
|
|
8479
|
+
),
|
|
8480
|
+
editingDefault && api.setDefaultCreditLimit && /* @__PURE__ */ jsx21(
|
|
8481
|
+
MemberCreditLimitModal,
|
|
8482
|
+
{
|
|
8483
|
+
open: true,
|
|
8484
|
+
title: "Default usage limit",
|
|
8485
|
+
description: "Applies to every member without their own limit, including new members.",
|
|
8486
|
+
used: 0,
|
|
8487
|
+
initialLimit: limits?.default?.limit ?? null,
|
|
8488
|
+
isSet: Boolean(limits?.default),
|
|
8489
|
+
unit,
|
|
8490
|
+
onSave: (limit) => api.setDefaultCreditLimit(limit),
|
|
8491
|
+
saveSuccessMessage: "Default usage limit updated",
|
|
8492
|
+
onClose: () => setEditingDefault(false),
|
|
8493
|
+
onSaved: () => void load({ refresh: true })
|
|
8494
|
+
}
|
|
8495
|
+
)
|
|
8496
|
+
] });
|
|
8497
|
+
}
|
|
8498
|
+
|
|
8499
|
+
// src/billing-content.tsx
|
|
8500
|
+
import { Fragment as Fragment9, jsx as jsx22, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
8501
|
+
var DEFAULT_TOPUP_SERVICE = "catalogix";
|
|
8502
|
+
var PRIMARY_COLOR2 = "var(--alias-text---icons-primary)";
|
|
8503
|
+
var MUTED_COLOR = "var(--alias-text---icons-muted)";
|
|
8504
|
+
function formatDate2(iso) {
|
|
8505
|
+
try {
|
|
8506
|
+
return new Date(iso).toLocaleDateString("en-US", {
|
|
8507
|
+
month: "short",
|
|
8508
|
+
day: "numeric",
|
|
8509
|
+
year: "numeric"
|
|
8510
|
+
});
|
|
8511
|
+
} catch {
|
|
8512
|
+
return iso;
|
|
8513
|
+
}
|
|
8514
|
+
}
|
|
8515
|
+
function formatCurrency(cents, currency) {
|
|
8516
|
+
if (currency === "inr") {
|
|
8517
|
+
return `\u20B9${(cents / 100).toFixed(2)}`;
|
|
8518
|
+
}
|
|
8519
|
+
return `$${(cents / 100).toFixed(2)}`;
|
|
8520
|
+
}
|
|
8521
|
+
function getCurrencySymbolByCountry(country) {
|
|
8522
|
+
return country?.trim().toUpperCase() === "IN" ? "\u20B9" : "$";
|
|
8523
|
+
}
|
|
8524
|
+
function formatCredits2(n) {
|
|
8525
|
+
return n.toLocaleString("en-US");
|
|
8526
|
+
}
|
|
8527
|
+
function formatNextBillingDateLabel(iso) {
|
|
8528
|
+
if (iso) {
|
|
8529
|
+
const parsed = new Date(iso);
|
|
8530
|
+
if (!Number.isNaN(parsed.getTime())) {
|
|
8531
|
+
return parsed.toLocaleDateString("en-US", {
|
|
8532
|
+
month: "short",
|
|
8533
|
+
day: "numeric",
|
|
8534
|
+
year: "numeric"
|
|
8535
|
+
});
|
|
8536
|
+
}
|
|
8537
|
+
}
|
|
8538
|
+
const fallback = /* @__PURE__ */ new Date();
|
|
8539
|
+
fallback.setMonth(fallback.getMonth() + 1);
|
|
8540
|
+
return fallback.toLocaleDateString("en-US", {
|
|
8541
|
+
month: "short",
|
|
8542
|
+
day: "numeric",
|
|
8543
|
+
year: "numeric"
|
|
8544
|
+
});
|
|
8545
|
+
}
|
|
8546
|
+
function formatEffectiveDateLabel(value) {
|
|
8547
|
+
if (value == null) return "";
|
|
8548
|
+
const parsed = typeof value === "number" ? new Date(value < 1e10 ? value * 1e3 : value) : new Date(value);
|
|
8549
|
+
if (Number.isNaN(parsed.getTime())) return "";
|
|
8550
|
+
return parsed.toLocaleDateString("en-US", {
|
|
8551
|
+
month: "short",
|
|
8552
|
+
day: "numeric",
|
|
8553
|
+
year: "numeric"
|
|
8554
|
+
});
|
|
8555
|
+
}
|
|
8556
|
+
function useIsLightTheme() {
|
|
8557
|
+
const read = () => typeof document !== "undefined" && document.documentElement.getAttribute("data-theme") === "Light";
|
|
8558
|
+
const [isLight, setIsLight] = useState15(read);
|
|
8559
|
+
useEffect13(() => {
|
|
8560
|
+
if (typeof document === "undefined") return;
|
|
8561
|
+
const target = document.documentElement;
|
|
8562
|
+
const observer = new MutationObserver(() => setIsLight(read()));
|
|
8563
|
+
observer.observe(target, {
|
|
8564
|
+
attributes: true,
|
|
8565
|
+
attributeFilter: ["data-theme"]
|
|
8566
|
+
});
|
|
8567
|
+
setIsLight(read());
|
|
8568
|
+
return () => observer.disconnect();
|
|
8569
|
+
}, []);
|
|
8570
|
+
return isLight;
|
|
8571
|
+
}
|
|
8572
|
+
function UpdateSubscriptionModal({
|
|
8573
|
+
open,
|
|
8574
|
+
currentPlanName,
|
|
8575
|
+
currentPlanAmount,
|
|
8576
|
+
nextPlanName,
|
|
8577
|
+
nextPlanAmount,
|
|
8578
|
+
nextBillingDateLabel,
|
|
8579
|
+
loading,
|
|
8580
|
+
onClose,
|
|
8581
|
+
onProceed
|
|
8582
|
+
}) {
|
|
8583
|
+
const isLight = useIsLightTheme();
|
|
8584
|
+
const modalSurface = isLight ? "#ffffff" : "var(--alias-surface-base)";
|
|
8585
|
+
const cardBorder = isLight ? "1px solid var(--alias-border-subtle)" : "1px solid var(--alias-border-divider)";
|
|
8586
|
+
if (!open) return null;
|
|
8587
|
+
return /* @__PURE__ */ jsx22(
|
|
8588
|
+
"div",
|
|
8589
|
+
{
|
|
8590
|
+
className: "fixed inset-0 z-50 flex items-center justify-center",
|
|
8591
|
+
style: { backgroundColor: "rgba(0, 0, 0, 0.6)" },
|
|
8592
|
+
onClick: (event) => {
|
|
8593
|
+
if (event.target === event.currentTarget) onClose();
|
|
8594
|
+
},
|
|
8595
|
+
children: /* @__PURE__ */ jsxs19(
|
|
8596
|
+
"div",
|
|
8597
|
+
{
|
|
8598
|
+
className: "flex flex-col w-full max-w-xl",
|
|
8599
|
+
style: {
|
|
8600
|
+
backgroundColor: modalSurface,
|
|
8601
|
+
borderRadius: "var(--radius-3xl)",
|
|
8602
|
+
border: "1px solid var(--alias-border-subtle)",
|
|
8603
|
+
padding: "var(--spacing-6xl)",
|
|
8604
|
+
gap: "var(--spacing-6xl)",
|
|
8605
|
+
maxHeight: "90vh",
|
|
8606
|
+
overflowY: "auto"
|
|
8607
|
+
},
|
|
8608
|
+
children: [
|
|
8609
|
+
/* @__PURE__ */ jsxs19("div", { className: "flex items-center w-full", children: [
|
|
8610
|
+
/* @__PURE__ */ jsx22(
|
|
8611
|
+
"p",
|
|
8612
|
+
{
|
|
8613
|
+
className: "flex-1 min-w-0",
|
|
8614
|
+
style: {
|
|
8615
|
+
fontFamily: "var(--font-family-font-family-display)",
|
|
8616
|
+
fontSize: "var(--font-size-font-size-xxl)",
|
|
8617
|
+
fontWeight: 600,
|
|
8618
|
+
lineHeight: "var(--line-height-line-height-xxl)",
|
|
8619
|
+
color: "var(--alias-text---icons-primary)"
|
|
8620
|
+
},
|
|
8621
|
+
children: "Update Subscription"
|
|
8622
|
+
}
|
|
8623
|
+
),
|
|
8624
|
+
/* @__PURE__ */ jsx22(
|
|
8625
|
+
"button",
|
|
8626
|
+
{
|
|
8627
|
+
type: "button",
|
|
8628
|
+
onClick: onClose,
|
|
8629
|
+
style: { background: "transparent", border: "none" },
|
|
8630
|
+
children: /* @__PURE__ */ jsx22(SiconClose7, { className: "w-6 h-6", color: MUTED_COLOR })
|
|
8631
|
+
}
|
|
8632
|
+
)
|
|
8633
|
+
] }),
|
|
8634
|
+
/* @__PURE__ */ jsx22(
|
|
8635
|
+
"div",
|
|
8636
|
+
{
|
|
8637
|
+
className: "w-full",
|
|
8638
|
+
style: {
|
|
8639
|
+
height: "1px",
|
|
8640
|
+
backgroundColor: "var(--alias-border-divider)"
|
|
8641
|
+
}
|
|
8642
|
+
}
|
|
8643
|
+
),
|
|
8644
|
+
/* @__PURE__ */ jsxs19(
|
|
8645
|
+
"div",
|
|
8646
|
+
{
|
|
8647
|
+
className: "flex flex-col w-full",
|
|
8648
|
+
style: { gap: "var(--spacing-3xl)" },
|
|
8649
|
+
children: [
|
|
8650
|
+
/* @__PURE__ */ jsx22(
|
|
8651
|
+
"p",
|
|
8652
|
+
{
|
|
8653
|
+
style: {
|
|
8654
|
+
fontFamily: "var(--font-family-font-family-body)",
|
|
8655
|
+
fontSize: "var(--font-size-font-size-sm)",
|
|
8656
|
+
fontWeight: 500,
|
|
8657
|
+
lineHeight: "var(--line-height-line-height-sm)",
|
|
8658
|
+
color: "var(--alias-text---icons-primary)"
|
|
8659
|
+
},
|
|
8660
|
+
children: "Current billing plan"
|
|
8661
|
+
}
|
|
8662
|
+
),
|
|
8663
|
+
/* @__PURE__ */ jsxs19(
|
|
8664
|
+
"div",
|
|
8665
|
+
{
|
|
8666
|
+
className: "flex items-center w-full",
|
|
7936
8667
|
style: {
|
|
7937
8668
|
backgroundColor: "var(--alias-fill-neutral-neutral)",
|
|
7938
8669
|
border: cardBorder,
|
|
@@ -7940,7 +8671,7 @@ function UpdateSubscriptionModal({
|
|
|
7940
8671
|
padding: "var(--spacing-3xl)"
|
|
7941
8672
|
},
|
|
7942
8673
|
children: [
|
|
7943
|
-
/* @__PURE__ */
|
|
8674
|
+
/* @__PURE__ */ jsx22(
|
|
7944
8675
|
"p",
|
|
7945
8676
|
{
|
|
7946
8677
|
className: "flex-1 min-w-0",
|
|
@@ -7954,8 +8685,8 @@ function UpdateSubscriptionModal({
|
|
|
7954
8685
|
children: currentPlanName || "Free"
|
|
7955
8686
|
}
|
|
7956
8687
|
),
|
|
7957
|
-
/* @__PURE__ */
|
|
7958
|
-
/* @__PURE__ */
|
|
8688
|
+
/* @__PURE__ */ jsxs19("div", { className: "flex flex-col items-end", children: [
|
|
8689
|
+
/* @__PURE__ */ jsx22(
|
|
7959
8690
|
"p",
|
|
7960
8691
|
{
|
|
7961
8692
|
style: {
|
|
@@ -7968,7 +8699,7 @@ function UpdateSubscriptionModal({
|
|
|
7968
8699
|
children: currentPlanAmount
|
|
7969
8700
|
}
|
|
7970
8701
|
),
|
|
7971
|
-
/* @__PURE__ */
|
|
8702
|
+
/* @__PURE__ */ jsx22(
|
|
7972
8703
|
"p",
|
|
7973
8704
|
{
|
|
7974
8705
|
style: {
|
|
@@ -7985,7 +8716,7 @@ function UpdateSubscriptionModal({
|
|
|
7985
8716
|
]
|
|
7986
8717
|
}
|
|
7987
8718
|
),
|
|
7988
|
-
/* @__PURE__ */
|
|
8719
|
+
/* @__PURE__ */ jsx22("div", { className: "w-full flex items-center justify-center", children: /* @__PURE__ */ jsx22(
|
|
7989
8720
|
"div",
|
|
7990
8721
|
{
|
|
7991
8722
|
className: "flex items-center justify-center",
|
|
@@ -7996,10 +8727,10 @@ function UpdateSubscriptionModal({
|
|
|
7996
8727
|
backgroundColor: "var(--alias-fill-neutral-neutral)",
|
|
7997
8728
|
border: cardBorder
|
|
7998
8729
|
},
|
|
7999
|
-
children: /* @__PURE__ */
|
|
8730
|
+
children: /* @__PURE__ */ jsx22(SiconDoubleArrow, { className: "w-4 h-4", color: MUTED_COLOR })
|
|
8000
8731
|
}
|
|
8001
8732
|
) }),
|
|
8002
|
-
/* @__PURE__ */
|
|
8733
|
+
/* @__PURE__ */ jsxs19(
|
|
8003
8734
|
"p",
|
|
8004
8735
|
{
|
|
8005
8736
|
style: {
|
|
@@ -8015,7 +8746,7 @@ function UpdateSubscriptionModal({
|
|
|
8015
8746
|
]
|
|
8016
8747
|
}
|
|
8017
8748
|
),
|
|
8018
|
-
/* @__PURE__ */
|
|
8749
|
+
/* @__PURE__ */ jsxs19(
|
|
8019
8750
|
"div",
|
|
8020
8751
|
{
|
|
8021
8752
|
className: "flex items-center w-full",
|
|
@@ -8026,7 +8757,7 @@ function UpdateSubscriptionModal({
|
|
|
8026
8757
|
padding: "var(--spacing-3xl)"
|
|
8027
8758
|
},
|
|
8028
8759
|
children: [
|
|
8029
|
-
/* @__PURE__ */
|
|
8760
|
+
/* @__PURE__ */ jsx22(
|
|
8030
8761
|
"p",
|
|
8031
8762
|
{
|
|
8032
8763
|
className: "flex-1 min-w-0",
|
|
@@ -8040,8 +8771,8 @@ function UpdateSubscriptionModal({
|
|
|
8040
8771
|
children: nextPlanName || "Pro"
|
|
8041
8772
|
}
|
|
8042
8773
|
),
|
|
8043
|
-
/* @__PURE__ */
|
|
8044
|
-
/* @__PURE__ */
|
|
8774
|
+
/* @__PURE__ */ jsxs19("div", { className: "flex flex-col items-end", children: [
|
|
8775
|
+
/* @__PURE__ */ jsx22(
|
|
8045
8776
|
"p",
|
|
8046
8777
|
{
|
|
8047
8778
|
style: {
|
|
@@ -8054,7 +8785,7 @@ function UpdateSubscriptionModal({
|
|
|
8054
8785
|
children: nextPlanAmount
|
|
8055
8786
|
}
|
|
8056
8787
|
),
|
|
8057
|
-
/* @__PURE__ */
|
|
8788
|
+
/* @__PURE__ */ jsx22(
|
|
8058
8789
|
"p",
|
|
8059
8790
|
{
|
|
8060
8791
|
style: {
|
|
@@ -8071,7 +8802,7 @@ function UpdateSubscriptionModal({
|
|
|
8071
8802
|
]
|
|
8072
8803
|
}
|
|
8073
8804
|
),
|
|
8074
|
-
/* @__PURE__ */
|
|
8805
|
+
/* @__PURE__ */ jsx22(
|
|
8075
8806
|
"div",
|
|
8076
8807
|
{
|
|
8077
8808
|
className: "w-full",
|
|
@@ -8081,8 +8812,8 @@ function UpdateSubscriptionModal({
|
|
|
8081
8812
|
}
|
|
8082
8813
|
}
|
|
8083
8814
|
),
|
|
8084
|
-
/* @__PURE__ */
|
|
8085
|
-
/* @__PURE__ */
|
|
8815
|
+
/* @__PURE__ */ jsxs19("div", { className: "flex items-center w-full", children: [
|
|
8816
|
+
/* @__PURE__ */ jsx22(
|
|
8086
8817
|
"p",
|
|
8087
8818
|
{
|
|
8088
8819
|
className: "flex-1 min-w-0",
|
|
@@ -8096,7 +8827,7 @@ function UpdateSubscriptionModal({
|
|
|
8096
8827
|
children: "Amount Due Today"
|
|
8097
8828
|
}
|
|
8098
8829
|
),
|
|
8099
|
-
/* @__PURE__ */
|
|
8830
|
+
/* @__PURE__ */ jsx22(
|
|
8100
8831
|
"p",
|
|
8101
8832
|
{
|
|
8102
8833
|
style: {
|
|
@@ -8113,7 +8844,7 @@ function UpdateSubscriptionModal({
|
|
|
8113
8844
|
]
|
|
8114
8845
|
}
|
|
8115
8846
|
),
|
|
8116
|
-
/* @__PURE__ */
|
|
8847
|
+
/* @__PURE__ */ jsx22(
|
|
8117
8848
|
"button",
|
|
8118
8849
|
{
|
|
8119
8850
|
type: "button",
|
|
@@ -8128,7 +8859,7 @@ function UpdateSubscriptionModal({
|
|
|
8128
8859
|
},
|
|
8129
8860
|
disabled: loading,
|
|
8130
8861
|
onClick: onProceed,
|
|
8131
|
-
children: /* @__PURE__ */
|
|
8862
|
+
children: /* @__PURE__ */ jsx22(
|
|
8132
8863
|
"span",
|
|
8133
8864
|
{
|
|
8134
8865
|
style: {
|
|
@@ -8168,7 +8899,7 @@ function PlansView({
|
|
|
8168
8899
|
const workspaceCurrencySymbol = getCurrencySymbolByCountry(
|
|
8169
8900
|
workspace?.country
|
|
8170
8901
|
);
|
|
8171
|
-
const allPlans =
|
|
8902
|
+
const allPlans = useMemo4(() => {
|
|
8172
8903
|
if (products.length > 0) {
|
|
8173
8904
|
return products.flatMap(
|
|
8174
8905
|
(product) => product.prices.filter((price) => Boolean(price.metadata?.credits)).map((price) => ({
|
|
@@ -8186,7 +8917,7 @@ function PlansView({
|
|
|
8186
8917
|
}
|
|
8187
8918
|
return [];
|
|
8188
8919
|
}, [products, currentPlanId]);
|
|
8189
|
-
const sortedPlans =
|
|
8920
|
+
const sortedPlans = useMemo4(
|
|
8190
8921
|
() => [...allPlans].sort((a, b) => a.amount - b.amount),
|
|
8191
8922
|
[allPlans]
|
|
8192
8923
|
);
|
|
@@ -8203,8 +8934,8 @@ function PlansView({
|
|
|
8203
8934
|
const currentPlan = sortedPlans.find((plan) => plan.isCurrent) ?? freePlan;
|
|
8204
8935
|
const middlePlans = sortedPlans.filter((plan) => plan.amount > 0);
|
|
8205
8936
|
const currentPlanAmount = currentPlan?.amount ?? 0;
|
|
8206
|
-
const [selectedMiddlePlanKey, setSelectedMiddlePlanKey] =
|
|
8207
|
-
|
|
8937
|
+
const [selectedMiddlePlanKey, setSelectedMiddlePlanKey] = useState15("");
|
|
8938
|
+
useEffect13(() => {
|
|
8208
8939
|
if (middlePlans.length === 0) {
|
|
8209
8940
|
setSelectedMiddlePlanKey("");
|
|
8210
8941
|
return;
|
|
@@ -8218,9 +8949,9 @@ function PlansView({
|
|
|
8218
8949
|
const isMiddleActionLoading = Boolean(
|
|
8219
8950
|
selectedMiddlePlan && actionInFlight === selectedMiddlePlan.key
|
|
8220
8951
|
);
|
|
8221
|
-
const [isPlanSelectorOpen, setIsPlanSelectorOpen] =
|
|
8222
|
-
const planDropdownRef =
|
|
8223
|
-
|
|
8952
|
+
const [isPlanSelectorOpen, setIsPlanSelectorOpen] = useState15(false);
|
|
8953
|
+
const planDropdownRef = useRef7(null);
|
|
8954
|
+
useEffect13(() => {
|
|
8224
8955
|
if (!isPlanSelectorOpen) return;
|
|
8225
8956
|
const handleClickOutside = (event) => {
|
|
8226
8957
|
const target = event.target;
|
|
@@ -8238,8 +8969,8 @@ function PlansView({
|
|
|
8238
8969
|
const isCurrentWithDowngrade = Boolean(
|
|
8239
8970
|
currentPlan?.isCurrent && downgradeScheduled
|
|
8240
8971
|
);
|
|
8241
|
-
const [showUpgradeConfirmModal, setShowUpgradeConfirmModal] =
|
|
8242
|
-
return /* @__PURE__ */
|
|
8972
|
+
const [showUpgradeConfirmModal, setShowUpgradeConfirmModal] = useState15(false);
|
|
8973
|
+
return /* @__PURE__ */ jsxs19(
|
|
8243
8974
|
"div",
|
|
8244
8975
|
{
|
|
8245
8976
|
className: "flex flex-col items-start relative size-full overflow-y-auto",
|
|
@@ -8250,12 +8981,12 @@ function PlansView({
|
|
|
8250
8981
|
backgroundSize: "24px 24px"
|
|
8251
8982
|
},
|
|
8252
8983
|
children: [
|
|
8253
|
-
!hideHeader && /* @__PURE__ */
|
|
8984
|
+
!hideHeader && /* @__PURE__ */ jsx22(
|
|
8254
8985
|
"div",
|
|
8255
8986
|
{
|
|
8256
8987
|
className: "flex items-center justify-end shrink-0 w-full",
|
|
8257
8988
|
style: { gap: "var(--spacing-lg)" },
|
|
8258
|
-
children: /* @__PURE__ */
|
|
8989
|
+
children: /* @__PURE__ */ jsxs19(
|
|
8259
8990
|
"div",
|
|
8260
8991
|
{
|
|
8261
8992
|
className: "flex items-center shrink-0 cursor-pointer",
|
|
@@ -8269,8 +9000,8 @@ function PlansView({
|
|
|
8269
9000
|
},
|
|
8270
9001
|
onClick: onBack,
|
|
8271
9002
|
children: [
|
|
8272
|
-
/* @__PURE__ */
|
|
8273
|
-
/* @__PURE__ */
|
|
9003
|
+
/* @__PURE__ */ jsx22(SiconLeft2, { className: "w-4 h-4", color: MUTED_COLOR }),
|
|
9004
|
+
/* @__PURE__ */ jsx22(
|
|
8274
9005
|
"span",
|
|
8275
9006
|
{
|
|
8276
9007
|
style: {
|
|
@@ -8288,13 +9019,13 @@ function PlansView({
|
|
|
8288
9019
|
)
|
|
8289
9020
|
}
|
|
8290
9021
|
),
|
|
8291
|
-
/* @__PURE__ */
|
|
9022
|
+
/* @__PURE__ */ jsxs19(
|
|
8292
9023
|
"div",
|
|
8293
9024
|
{
|
|
8294
9025
|
className: "grid w-full grid-cols-1 md:grid-cols-2 xl:grid-cols-3 items-stretch",
|
|
8295
9026
|
style: { gap: "var(--spacing-8xl)" },
|
|
8296
9027
|
children: [
|
|
8297
|
-
/* @__PURE__ */
|
|
9028
|
+
/* @__PURE__ */ jsx22("div", { className: "h-full", children: /* @__PURE__ */ jsx22(
|
|
8298
9029
|
ScPlanCard,
|
|
8299
9030
|
{
|
|
8300
9031
|
planName: freePlan?.planName || "Free",
|
|
@@ -8324,7 +9055,7 @@ function PlansView({
|
|
|
8324
9055
|
className: "h-full"
|
|
8325
9056
|
}
|
|
8326
9057
|
) }),
|
|
8327
|
-
/* @__PURE__ */
|
|
9058
|
+
/* @__PURE__ */ jsx22("div", { className: "h-full", children: /* @__PURE__ */ jsx22(
|
|
8328
9059
|
ScPlanCard,
|
|
8329
9060
|
{
|
|
8330
9061
|
planName: "Pro",
|
|
@@ -8345,7 +9076,7 @@ function PlansView({
|
|
|
8345
9076
|
setShowUpgradeConfirmModal(true);
|
|
8346
9077
|
},
|
|
8347
9078
|
onIncreaseCredits: () => setIsPlanSelectorOpen((prev) => !prev),
|
|
8348
|
-
creditsDropdown: isPlanSelectorOpen ? /* @__PURE__ */
|
|
9079
|
+
creditsDropdown: isPlanSelectorOpen ? /* @__PURE__ */ jsx22(
|
|
8349
9080
|
"div",
|
|
8350
9081
|
{
|
|
8351
9082
|
ref: planDropdownRef,
|
|
@@ -8362,7 +9093,7 @@ function PlansView({
|
|
|
8362
9093
|
},
|
|
8363
9094
|
children: middlePlans.map((plan) => {
|
|
8364
9095
|
const selected = plan.key === selectedMiddlePlanKey;
|
|
8365
|
-
return /* @__PURE__ */
|
|
9096
|
+
return /* @__PURE__ */ jsxs19(
|
|
8366
9097
|
"button",
|
|
8367
9098
|
{
|
|
8368
9099
|
type: "button",
|
|
@@ -8380,7 +9111,7 @@ function PlansView({
|
|
|
8380
9111
|
setIsPlanSelectorOpen(false);
|
|
8381
9112
|
},
|
|
8382
9113
|
children: [
|
|
8383
|
-
/* @__PURE__ */
|
|
9114
|
+
/* @__PURE__ */ jsx22(
|
|
8384
9115
|
"span",
|
|
8385
9116
|
{
|
|
8386
9117
|
className: "flex-1 min-w-0 truncate",
|
|
@@ -8394,7 +9125,7 @@ function PlansView({
|
|
|
8394
9125
|
children: plan.credits
|
|
8395
9126
|
}
|
|
8396
9127
|
),
|
|
8397
|
-
/* @__PURE__ */
|
|
9128
|
+
/* @__PURE__ */ jsx22(
|
|
8398
9129
|
"span",
|
|
8399
9130
|
{
|
|
8400
9131
|
style: {
|
|
@@ -8417,7 +9148,7 @@ function PlansView({
|
|
|
8417
9148
|
className: "h-full"
|
|
8418
9149
|
}
|
|
8419
9150
|
) }),
|
|
8420
|
-
/* @__PURE__ */
|
|
9151
|
+
/* @__PURE__ */ jsx22("div", { className: "h-full", children: /* @__PURE__ */ jsx22(
|
|
8421
9152
|
ScPlanCard,
|
|
8422
9153
|
{
|
|
8423
9154
|
planName: "Enterprise",
|
|
@@ -8434,7 +9165,7 @@ function PlansView({
|
|
|
8434
9165
|
]
|
|
8435
9166
|
}
|
|
8436
9167
|
),
|
|
8437
|
-
/* @__PURE__ */
|
|
9168
|
+
/* @__PURE__ */ jsx22(
|
|
8438
9169
|
ScPlanComparison,
|
|
8439
9170
|
{
|
|
8440
9171
|
layout: "table",
|
|
@@ -8444,7 +9175,7 @@ function PlansView({
|
|
|
8444
9175
|
highlightColumnIndex: 1
|
|
8445
9176
|
}
|
|
8446
9177
|
),
|
|
8447
|
-
/* @__PURE__ */
|
|
9178
|
+
/* @__PURE__ */ jsx22(
|
|
8448
9179
|
UpdateSubscriptionModal,
|
|
8449
9180
|
{
|
|
8450
9181
|
open: showUpgradeConfirmModal,
|
|
@@ -8479,7 +9210,7 @@ function BillingTabBar({
|
|
|
8479
9210
|
activeTab,
|
|
8480
9211
|
onTabChange
|
|
8481
9212
|
}) {
|
|
8482
|
-
return /* @__PURE__ */
|
|
9213
|
+
return /* @__PURE__ */ jsxs19(
|
|
8483
9214
|
"div",
|
|
8484
9215
|
{
|
|
8485
9216
|
className: "flex items-center shrink-0 relative",
|
|
@@ -8491,7 +9222,7 @@ function BillingTabBar({
|
|
|
8491
9222
|
border: "0.5px solid var(--alias-border-subtle)"
|
|
8492
9223
|
},
|
|
8493
9224
|
children: [
|
|
8494
|
-
/* @__PURE__ */
|
|
9225
|
+
/* @__PURE__ */ jsx22(
|
|
8495
9226
|
ScTabComp2,
|
|
8496
9227
|
{
|
|
8497
9228
|
text: "Invoice history",
|
|
@@ -8501,7 +9232,7 @@ function BillingTabBar({
|
|
|
8501
9232
|
style: { flex: 1 }
|
|
8502
9233
|
}
|
|
8503
9234
|
),
|
|
8504
|
-
/* @__PURE__ */
|
|
9235
|
+
/* @__PURE__ */ jsx22(
|
|
8505
9236
|
ScTabComp2,
|
|
8506
9237
|
{
|
|
8507
9238
|
text: "Usage logs",
|
|
@@ -8563,7 +9294,7 @@ function InvoiceHistoryTable({
|
|
|
8563
9294
|
}
|
|
8564
9295
|
};
|
|
8565
9296
|
if (loading) {
|
|
8566
|
-
return /* @__PURE__ */
|
|
9297
|
+
return /* @__PURE__ */ jsx22(
|
|
8567
9298
|
"div",
|
|
8568
9299
|
{
|
|
8569
9300
|
className: "flex items-center justify-center w-full",
|
|
@@ -8572,7 +9303,7 @@ function InvoiceHistoryTable({
|
|
|
8572
9303
|
borderRadius: "var(--radius-3xl)",
|
|
8573
9304
|
padding: "var(--spacing-6xl)"
|
|
8574
9305
|
},
|
|
8575
|
-
children: /* @__PURE__ */
|
|
9306
|
+
children: /* @__PURE__ */ jsx22(
|
|
8576
9307
|
"div",
|
|
8577
9308
|
{
|
|
8578
9309
|
className: "animate-spin",
|
|
@@ -8588,7 +9319,7 @@ function InvoiceHistoryTable({
|
|
|
8588
9319
|
}
|
|
8589
9320
|
);
|
|
8590
9321
|
}
|
|
8591
|
-
return /* @__PURE__ */
|
|
9322
|
+
return /* @__PURE__ */ jsxs19(
|
|
8592
9323
|
"div",
|
|
8593
9324
|
{
|
|
8594
9325
|
className: "flex-1 min-h-0 w-full relative",
|
|
@@ -8599,7 +9330,7 @@ function InvoiceHistoryTable({
|
|
|
8599
9330
|
overflowY: "auto"
|
|
8600
9331
|
},
|
|
8601
9332
|
children: [
|
|
8602
|
-
/* @__PURE__ */
|
|
9333
|
+
/* @__PURE__ */ jsx22(
|
|
8603
9334
|
"div",
|
|
8604
9335
|
{
|
|
8605
9336
|
style: {
|
|
@@ -8608,15 +9339,15 @@ function InvoiceHistoryTable({
|
|
|
8608
9339
|
zIndex: 1,
|
|
8609
9340
|
backgroundColor: "var(--alias-surface-base)"
|
|
8610
9341
|
},
|
|
8611
|
-
children: /* @__PURE__ */
|
|
9342
|
+
children: /* @__PURE__ */ jsx22(ScBillingHistoryHeader, {})
|
|
8612
9343
|
}
|
|
8613
9344
|
),
|
|
8614
|
-
invoices.length === 0 && /* @__PURE__ */
|
|
9345
|
+
invoices.length === 0 && /* @__PURE__ */ jsx22(
|
|
8615
9346
|
"div",
|
|
8616
9347
|
{
|
|
8617
9348
|
className: "flex items-center justify-center w-full",
|
|
8618
9349
|
style: { padding: "var(--spacing-6xl)" },
|
|
8619
|
-
children: /* @__PURE__ */
|
|
9350
|
+
children: /* @__PURE__ */ jsx22(
|
|
8620
9351
|
"span",
|
|
8621
9352
|
{
|
|
8622
9353
|
style: {
|
|
@@ -8631,7 +9362,7 @@ function InvoiceHistoryTable({
|
|
|
8631
9362
|
)
|
|
8632
9363
|
}
|
|
8633
9364
|
),
|
|
8634
|
-
invoices.map((inv) => /* @__PURE__ */
|
|
9365
|
+
invoices.map((inv) => /* @__PURE__ */ jsx22(
|
|
8635
9366
|
ScBillingHistoryTableList,
|
|
8636
9367
|
{
|
|
8637
9368
|
invoiceNumber: inv.transactionId ? `# ${inv.transactionId.slice(0, 16).toUpperCase()}` : "# INV-UNKNOWN",
|
|
@@ -8652,7 +9383,7 @@ function UsageLogsTable({
|
|
|
8652
9383
|
loading
|
|
8653
9384
|
}) {
|
|
8654
9385
|
if (loading) {
|
|
8655
|
-
return /* @__PURE__ */
|
|
9386
|
+
return /* @__PURE__ */ jsx22(
|
|
8656
9387
|
"div",
|
|
8657
9388
|
{
|
|
8658
9389
|
className: "flex items-center justify-center w-full",
|
|
@@ -8661,7 +9392,7 @@ function UsageLogsTable({
|
|
|
8661
9392
|
borderRadius: "var(--radius-3xl)",
|
|
8662
9393
|
padding: "var(--spacing-6xl)"
|
|
8663
9394
|
},
|
|
8664
|
-
children: /* @__PURE__ */
|
|
9395
|
+
children: /* @__PURE__ */ jsx22(
|
|
8665
9396
|
"div",
|
|
8666
9397
|
{
|
|
8667
9398
|
className: "animate-spin",
|
|
@@ -8677,7 +9408,7 @@ function UsageLogsTable({
|
|
|
8677
9408
|
}
|
|
8678
9409
|
);
|
|
8679
9410
|
}
|
|
8680
|
-
return /* @__PURE__ */
|
|
9411
|
+
return /* @__PURE__ */ jsxs19(
|
|
8681
9412
|
"div",
|
|
8682
9413
|
{
|
|
8683
9414
|
className: "flex-1 min-h-0 w-full relative",
|
|
@@ -8688,7 +9419,7 @@ function UsageLogsTable({
|
|
|
8688
9419
|
overflowY: "auto"
|
|
8689
9420
|
},
|
|
8690
9421
|
children: [
|
|
8691
|
-
/* @__PURE__ */
|
|
9422
|
+
/* @__PURE__ */ jsxs19(
|
|
8692
9423
|
"div",
|
|
8693
9424
|
{
|
|
8694
9425
|
style: {
|
|
@@ -8703,7 +9434,7 @@ function UsageLogsTable({
|
|
|
8703
9434
|
alignItems: "center"
|
|
8704
9435
|
},
|
|
8705
9436
|
children: [
|
|
8706
|
-
/* @__PURE__ */
|
|
9437
|
+
/* @__PURE__ */ jsx22(
|
|
8707
9438
|
ScHeader,
|
|
8708
9439
|
{
|
|
8709
9440
|
text: "App",
|
|
@@ -8711,7 +9442,7 @@ function UsageLogsTable({
|
|
|
8711
9442
|
style: { flex: 1, alignItems: "flex-start", gap: "0.25rem" }
|
|
8712
9443
|
}
|
|
8713
9444
|
),
|
|
8714
|
-
/* @__PURE__ */
|
|
9445
|
+
/* @__PURE__ */ jsx22(
|
|
8715
9446
|
ScHeader,
|
|
8716
9447
|
{
|
|
8717
9448
|
text: "Activity",
|
|
@@ -8719,7 +9450,7 @@ function UsageLogsTable({
|
|
|
8719
9450
|
style: { flex: 1, alignItems: "flex-start", gap: "0.25rem" }
|
|
8720
9451
|
}
|
|
8721
9452
|
),
|
|
8722
|
-
/* @__PURE__ */
|
|
9453
|
+
/* @__PURE__ */ jsx22(
|
|
8723
9454
|
ScHeader,
|
|
8724
9455
|
{
|
|
8725
9456
|
text: "Used by",
|
|
@@ -8727,7 +9458,7 @@ function UsageLogsTable({
|
|
|
8727
9458
|
style: { flexShrink: 0, width: "7.5rem" }
|
|
8728
9459
|
}
|
|
8729
9460
|
),
|
|
8730
|
-
/* @__PURE__ */
|
|
9461
|
+
/* @__PURE__ */ jsx22(
|
|
8731
9462
|
ScHeader,
|
|
8732
9463
|
{
|
|
8733
9464
|
text: "Date",
|
|
@@ -8735,7 +9466,7 @@ function UsageLogsTable({
|
|
|
8735
9466
|
style: { flexShrink: 0, width: "7.5rem" }
|
|
8736
9467
|
}
|
|
8737
9468
|
),
|
|
8738
|
-
/* @__PURE__ */
|
|
9469
|
+
/* @__PURE__ */ jsx22(
|
|
8739
9470
|
ScHeader,
|
|
8740
9471
|
{
|
|
8741
9472
|
text: "Credits",
|
|
@@ -8750,12 +9481,12 @@ function UsageLogsTable({
|
|
|
8750
9481
|
]
|
|
8751
9482
|
}
|
|
8752
9483
|
),
|
|
8753
|
-
logs.length === 0 && /* @__PURE__ */
|
|
9484
|
+
logs.length === 0 && /* @__PURE__ */ jsx22(
|
|
8754
9485
|
"div",
|
|
8755
9486
|
{
|
|
8756
9487
|
className: "flex items-center justify-center w-full",
|
|
8757
9488
|
style: { padding: "var(--spacing-6xl)" },
|
|
8758
|
-
children: /* @__PURE__ */
|
|
9489
|
+
children: /* @__PURE__ */ jsx22(
|
|
8759
9490
|
"span",
|
|
8760
9491
|
{
|
|
8761
9492
|
style: {
|
|
@@ -8787,7 +9518,7 @@ function UsageLogsTable({
|
|
|
8787
9518
|
overflow: "hidden",
|
|
8788
9519
|
whiteSpace: "nowrap"
|
|
8789
9520
|
};
|
|
8790
|
-
return /* @__PURE__ */
|
|
9521
|
+
return /* @__PURE__ */ jsxs19(
|
|
8791
9522
|
"div",
|
|
8792
9523
|
{
|
|
8793
9524
|
style: {
|
|
@@ -8799,11 +9530,11 @@ function UsageLogsTable({
|
|
|
8799
9530
|
alignItems: "center"
|
|
8800
9531
|
},
|
|
8801
9532
|
children: [
|
|
8802
|
-
/* @__PURE__ */
|
|
8803
|
-
/* @__PURE__ */
|
|
8804
|
-
/* @__PURE__ */
|
|
8805
|
-
/* @__PURE__ */
|
|
8806
|
-
/* @__PURE__ */
|
|
9533
|
+
/* @__PURE__ */ jsx22("div", { style: { ...rowCellRegular, flex: 1 }, children: app }),
|
|
9534
|
+
/* @__PURE__ */ jsx22("div", { style: { ...rowCellRegular, flex: 1 }, children: activity }),
|
|
9535
|
+
/* @__PURE__ */ jsx22("div", { style: { ...rowCellRegular, width: "7.5rem" }, children: userName }),
|
|
9536
|
+
/* @__PURE__ */ jsx22("div", { style: { ...rowCellRegular, width: "7.5rem" }, children: formatDate2(log.createdAt) }),
|
|
9537
|
+
/* @__PURE__ */ jsx22(
|
|
8807
9538
|
"div",
|
|
8808
9539
|
{
|
|
8809
9540
|
style: {
|
|
@@ -8833,7 +9564,9 @@ function UsageLogsTable({
|
|
|
8833
9564
|
function BillingContent({
|
|
8834
9565
|
embedded = false,
|
|
8835
9566
|
showPlans: showPlansProp,
|
|
8836
|
-
onShowPlansChange
|
|
9567
|
+
onShowPlansChange,
|
|
9568
|
+
showPerUserLimits: showPerUserLimitsProp,
|
|
9569
|
+
onShowPerUserLimitsChange
|
|
8837
9570
|
} = {}) {
|
|
8838
9571
|
const { auth, workspace, api, toast, navigation } = useSettingsAdapters();
|
|
8839
9572
|
const user = auth.user;
|
|
@@ -8845,35 +9578,41 @@ function BillingContent({
|
|
|
8845
9578
|
if (typeof window === "undefined") return "";
|
|
8846
9579
|
return `${window.location.origin}${window.location.pathname}`;
|
|
8847
9580
|
};
|
|
8848
|
-
const [activeTab, setActiveTab] =
|
|
8849
|
-
const [showPlansInternal, setShowPlansInternal] =
|
|
9581
|
+
const [activeTab, setActiveTab] = useState15("invoice");
|
|
9582
|
+
const [showPlansInternal, setShowPlansInternal] = useState15(false);
|
|
8850
9583
|
const showPlans = showPlansProp ?? showPlansInternal;
|
|
8851
9584
|
const setShowPlans = (next) => {
|
|
8852
9585
|
if (onShowPlansChange) onShowPlansChange(next);
|
|
8853
9586
|
else setShowPlansInternal(next);
|
|
8854
9587
|
};
|
|
8855
|
-
const [
|
|
8856
|
-
const
|
|
8857
|
-
const
|
|
8858
|
-
|
|
8859
|
-
|
|
8860
|
-
|
|
8861
|
-
const [
|
|
8862
|
-
const [
|
|
8863
|
-
const [
|
|
8864
|
-
const [
|
|
9588
|
+
const [showPerUserLimitsInternal, setShowPerUserLimitsInternal] = useState15(false);
|
|
9589
|
+
const showPerUserLimits = (showPerUserLimitsProp ?? showPerUserLimitsInternal) && Boolean(api.fetchMemberCreditLimits);
|
|
9590
|
+
const setShowPerUserLimits = (next) => {
|
|
9591
|
+
if (onShowPerUserLimitsChange) onShowPerUserLimitsChange(next);
|
|
9592
|
+
else setShowPerUserLimitsInternal(next);
|
|
9593
|
+
};
|
|
9594
|
+
const [showExportModal, setShowExportModal] = useState15(false);
|
|
9595
|
+
const [showBuyCreditsModal, setShowBuyCreditsModal] = useState15(false);
|
|
9596
|
+
const [subscription, setSubscription] = useState15(null);
|
|
9597
|
+
const [availableCredits, setAvailableCredits] = useState15(null);
|
|
9598
|
+
const [products, setProducts] = useState15([]);
|
|
9599
|
+
const [invoices, setInvoices] = useState15([]);
|
|
9600
|
+
const [totalCredits, setTotalCredits] = useState15(null);
|
|
9601
|
+
const [usageLogs, setUsageLogs] = useState15([]);
|
|
9602
|
+
const [userMap, setUserMap] = useState15({});
|
|
9603
|
+
const [customPlanCredits, setCustomPlanCredits] = useState15(
|
|
8865
9604
|
null
|
|
8866
9605
|
);
|
|
8867
|
-
const [planActionInFlight, setPlanActionInFlight] =
|
|
9606
|
+
const [planActionInFlight, setPlanActionInFlight] = useState15(
|
|
8868
9607
|
null
|
|
8869
9608
|
);
|
|
8870
|
-
const [buyCreditsInFlight, setBuyCreditsInFlight] =
|
|
8871
|
-
const [loadingBilling, setLoadingBilling] =
|
|
8872
|
-
const [billingOverviewLoaded, setBillingOverviewLoaded] =
|
|
8873
|
-
const [loadingTable, setLoadingTable] =
|
|
8874
|
-
const [showInitialLoader, setShowInitialLoader] =
|
|
8875
|
-
const [initialFetchTriggered, setInitialFetchTriggered] =
|
|
8876
|
-
const logBillingEvent =
|
|
9609
|
+
const [buyCreditsInFlight, setBuyCreditsInFlight] = useState15(false);
|
|
9610
|
+
const [loadingBilling, setLoadingBilling] = useState15(false);
|
|
9611
|
+
const [billingOverviewLoaded, setBillingOverviewLoaded] = useState15(false);
|
|
9612
|
+
const [loadingTable, setLoadingTable] = useState15(false);
|
|
9613
|
+
const [showInitialLoader, setShowInitialLoader] = useState15(true);
|
|
9614
|
+
const [initialFetchTriggered, setInitialFetchTriggered] = useState15(false);
|
|
9615
|
+
const logBillingEvent = useCallback6(
|
|
8877
9616
|
async (eventName, description, metadata) => {
|
|
8878
9617
|
if (!api.sendBillingEvent) return;
|
|
8879
9618
|
try {
|
|
@@ -8883,7 +9622,7 @@ function BillingContent({
|
|
|
8883
9622
|
},
|
|
8884
9623
|
[api]
|
|
8885
9624
|
);
|
|
8886
|
-
const ensureWorkspaceOnBilling =
|
|
9625
|
+
const ensureWorkspaceOnBilling = useCallback6(async () => {
|
|
8887
9626
|
if (!api.createWorkspaceOnBilling) return false;
|
|
8888
9627
|
try {
|
|
8889
9628
|
await api.createWorkspaceOnBilling({ serviceNames: [] });
|
|
@@ -8892,7 +9631,7 @@ function BillingContent({
|
|
|
8892
9631
|
return false;
|
|
8893
9632
|
}
|
|
8894
9633
|
}, [api]);
|
|
8895
|
-
const fetchBillingOverview =
|
|
9634
|
+
const fetchBillingOverview = useCallback6(async () => {
|
|
8896
9635
|
setLoadingBilling(true);
|
|
8897
9636
|
setBillingOverviewLoaded(false);
|
|
8898
9637
|
try {
|
|
@@ -8926,7 +9665,7 @@ function BillingContent({
|
|
|
8926
9665
|
setBillingOverviewLoaded(true);
|
|
8927
9666
|
}
|
|
8928
9667
|
}, [api, workspace.current?.country]);
|
|
8929
|
-
const fetchUserMap =
|
|
9668
|
+
const fetchUserMap = useCallback6(async () => {
|
|
8930
9669
|
try {
|
|
8931
9670
|
const members = await api.fetchMembers();
|
|
8932
9671
|
if (members && members.length) {
|
|
@@ -8939,7 +9678,7 @@ function BillingContent({
|
|
|
8939
9678
|
} catch {
|
|
8940
9679
|
}
|
|
8941
9680
|
}, [api]);
|
|
8942
|
-
const fetchTableData =
|
|
9681
|
+
const fetchTableData = useCallback6(
|
|
8943
9682
|
async (tab) => {
|
|
8944
9683
|
setLoadingTable(true);
|
|
8945
9684
|
try {
|
|
@@ -8967,7 +9706,7 @@ function BillingContent({
|
|
|
8967
9706
|
},
|
|
8968
9707
|
[api]
|
|
8969
9708
|
);
|
|
8970
|
-
const handlePlanAction =
|
|
9709
|
+
const handlePlanAction = useCallback6(
|
|
8971
9710
|
async ({ productId, priceId, planName: planName2 }) => {
|
|
8972
9711
|
if (!workspaceId || !user?.id || !user.email) {
|
|
8973
9712
|
toast.error("Missing account details for plan update");
|
|
@@ -9036,7 +9775,7 @@ function BillingContent({
|
|
|
9036
9775
|
toast
|
|
9037
9776
|
]
|
|
9038
9777
|
);
|
|
9039
|
-
const handleCancelDowngrade =
|
|
9778
|
+
const handleCancelDowngrade = useCallback6(async () => {
|
|
9040
9779
|
if (!api.revertDowngrade) {
|
|
9041
9780
|
toast.error("Cancel downgrade is not available in this workspace");
|
|
9042
9781
|
return;
|
|
@@ -9062,7 +9801,7 @@ function BillingContent({
|
|
|
9062
9801
|
setPlanActionInFlight(null);
|
|
9063
9802
|
}
|
|
9064
9803
|
}, [api, fetchBillingOverview, logBillingEvent, toast]);
|
|
9065
|
-
|
|
9804
|
+
useEffect13(() => {
|
|
9066
9805
|
setShowInitialLoader(true);
|
|
9067
9806
|
setInitialFetchTriggered(false);
|
|
9068
9807
|
setBillingOverviewLoaded(false);
|
|
@@ -9072,22 +9811,22 @@ function BillingContent({
|
|
|
9072
9811
|
setTotalCredits(null);
|
|
9073
9812
|
setCustomPlanCredits(null);
|
|
9074
9813
|
}, [workspaceId]);
|
|
9075
|
-
|
|
9814
|
+
useEffect13(() => {
|
|
9076
9815
|
setInitialFetchTriggered(true);
|
|
9077
9816
|
fetchBillingOverview();
|
|
9078
9817
|
fetchUserMap();
|
|
9079
9818
|
}, [fetchBillingOverview, fetchUserMap]);
|
|
9080
9819
|
const usage = workspace.current?.usage ?? null;
|
|
9081
|
-
|
|
9820
|
+
useEffect13(() => {
|
|
9082
9821
|
void logBillingEvent("billing_page_viewed", "Billing page viewed", {
|
|
9083
9822
|
action: "view"
|
|
9084
9823
|
});
|
|
9085
9824
|
}, [logBillingEvent]);
|
|
9086
|
-
|
|
9825
|
+
useEffect13(() => {
|
|
9087
9826
|
setInitialFetchTriggered(true);
|
|
9088
9827
|
fetchTableData(activeTab);
|
|
9089
9828
|
}, [activeTab, fetchTableData]);
|
|
9090
|
-
|
|
9829
|
+
useEffect13(() => {
|
|
9091
9830
|
if (!showInitialLoader) return;
|
|
9092
9831
|
if (!initialFetchTriggered) return;
|
|
9093
9832
|
if (!billingOverviewLoaded) return;
|
|
@@ -9117,7 +9856,7 @@ function BillingContent({
|
|
|
9117
9856
|
preDowngradePlan?.credits ?? currentPlanPrice?.metadata?.credits
|
|
9118
9857
|
);
|
|
9119
9858
|
const currentPlanCredits = Number.isFinite(planCreditsFromPrice) ? planCreditsFromPrice : customPlanCredits;
|
|
9120
|
-
const planCreditsText = currentPlanCredits != null ? `${
|
|
9859
|
+
const planCreditsText = currentPlanCredits != null ? `${formatCredits2(currentPlanCredits)} credits` : "";
|
|
9121
9860
|
const scheduledDowngradeDateLabel = formatEffectiveDateLabel(
|
|
9122
9861
|
subscription?.scheduledDowngradeEffectiveDate
|
|
9123
9862
|
);
|
|
@@ -9126,7 +9865,7 @@ function BillingContent({
|
|
|
9126
9865
|
const usedCredits = availableCredits != null && totalCredits != null ? Math.max(0, totalCredits - availableCredits) : null;
|
|
9127
9866
|
const progressPct = usedCredits != null && totalCredits != null && totalCredits > 0 ? Math.min(100, Math.round(usedCredits / totalCredits * 100)) : 0;
|
|
9128
9867
|
const remainingPct = 100 - progressPct;
|
|
9129
|
-
const usageText = usedCredits != null ?
|
|
9868
|
+
const usageText = usedCredits != null ? formatCredits2(usedCredits) : availableCredits != null ? `${formatCredits2(availableCredits)} available` : customPlanCredits != null ? `${formatCredits2(customPlanCredits)} credits` : "\u2014";
|
|
9130
9869
|
const handleExport = async (startDate, endDate) => {
|
|
9131
9870
|
const end = new Date(endDate);
|
|
9132
9871
|
end.setHours(23, 59, 59, 999);
|
|
@@ -9254,7 +9993,7 @@ function BillingContent({
|
|
|
9254
9993
|
}
|
|
9255
9994
|
}
|
|
9256
9995
|
if (showInitialLoader) {
|
|
9257
|
-
const loader = /* @__PURE__ */
|
|
9996
|
+
const loader = /* @__PURE__ */ jsx22(
|
|
9258
9997
|
"div",
|
|
9259
9998
|
{
|
|
9260
9999
|
className: "flex items-center justify-center w-full",
|
|
@@ -9264,7 +10003,7 @@ function BillingContent({
|
|
|
9264
10003
|
border: "1px solid var(--alias-border-subtle)",
|
|
9265
10004
|
borderRadius: "var(--radius-3xl)"
|
|
9266
10005
|
},
|
|
9267
|
-
children: /* @__PURE__ */
|
|
10006
|
+
children: /* @__PURE__ */ jsx22(
|
|
9268
10007
|
"div",
|
|
9269
10008
|
{
|
|
9270
10009
|
className: "animate-spin",
|
|
@@ -9280,7 +10019,7 @@ function BillingContent({
|
|
|
9280
10019
|
}
|
|
9281
10020
|
);
|
|
9282
10021
|
if (embedded) return loader;
|
|
9283
|
-
return /* @__PURE__ */
|
|
10022
|
+
return /* @__PURE__ */ jsx22("div", { className: "flex-1 h-full min-h-0 min-w-0 relative", children: /* @__PURE__ */ jsxs19(
|
|
9284
10023
|
"div",
|
|
9285
10024
|
{
|
|
9286
10025
|
className: "flex flex-col items-start relative size-full overflow-y-auto",
|
|
@@ -9291,7 +10030,7 @@ function BillingContent({
|
|
|
9291
10030
|
backgroundSize: "24px 24px"
|
|
9292
10031
|
},
|
|
9293
10032
|
children: [
|
|
9294
|
-
/* @__PURE__ */
|
|
10033
|
+
/* @__PURE__ */ jsx22("div", { className: "flex items-center justify-between shrink-0 w-full", children: /* @__PURE__ */ jsx22(
|
|
9295
10034
|
"p",
|
|
9296
10035
|
{
|
|
9297
10036
|
className: "flex-1 min-w-0 truncate",
|
|
@@ -9310,8 +10049,47 @@ function BillingContent({
|
|
|
9310
10049
|
}
|
|
9311
10050
|
) });
|
|
9312
10051
|
}
|
|
10052
|
+
if (showPerUserLimits) {
|
|
10053
|
+
const limitsView = /* @__PURE__ */ jsxs19("div", { className: "flex flex-col flex-1 h-full min-h-0 min-w-0 w-full", style: { gap: 16 }, children: [
|
|
10054
|
+
!onShowPerUserLimitsChange && /* @__PURE__ */ jsxs19(
|
|
10055
|
+
"div",
|
|
10056
|
+
{
|
|
10057
|
+
className: "flex items-center shrink-0 cursor-pointer",
|
|
10058
|
+
style: {
|
|
10059
|
+
gap: "var(--spacing-sm)",
|
|
10060
|
+
padding: "var(--spacing-xs) var(--spacing-lg)",
|
|
10061
|
+
borderRadius: "var(--radius-xl)",
|
|
10062
|
+
height: 32,
|
|
10063
|
+
width: "fit-content",
|
|
10064
|
+
border: "1px solid var(--alias-border-subtle)",
|
|
10065
|
+
backgroundColor: "var(--alias-surface-base)"
|
|
10066
|
+
},
|
|
10067
|
+
onClick: () => setShowPerUserLimits(false),
|
|
10068
|
+
children: [
|
|
10069
|
+
/* @__PURE__ */ jsx22(SiconLeft2, { className: "w-4 h-4", color: "var(--alias-text---icons-muted)" }),
|
|
10070
|
+
/* @__PURE__ */ jsx22(
|
|
10071
|
+
"span",
|
|
10072
|
+
{
|
|
10073
|
+
style: {
|
|
10074
|
+
fontFamily: "var(--font-family-font-family-body)",
|
|
10075
|
+
fontSize: "var(--font-size-font-size-sm)",
|
|
10076
|
+
fontWeight: 500,
|
|
10077
|
+
lineHeight: "var(--line-height-line-height-sm)",
|
|
10078
|
+
color: "var(--alias-text---icons-muted)"
|
|
10079
|
+
},
|
|
10080
|
+
children: "Back to billing"
|
|
10081
|
+
}
|
|
10082
|
+
)
|
|
10083
|
+
]
|
|
10084
|
+
}
|
|
10085
|
+
),
|
|
10086
|
+
/* @__PURE__ */ jsx22(PerUserLimitsView, {})
|
|
10087
|
+
] });
|
|
10088
|
+
if (embedded) return limitsView;
|
|
10089
|
+
return /* @__PURE__ */ jsx22("div", { className: "flex-1 h-full min-h-0 min-w-0 relative", children: limitsView });
|
|
10090
|
+
}
|
|
9313
10091
|
if (showPlans) {
|
|
9314
|
-
const plansView = /* @__PURE__ */
|
|
10092
|
+
const plansView = /* @__PURE__ */ jsx22(
|
|
9315
10093
|
PlansView,
|
|
9316
10094
|
{
|
|
9317
10095
|
onBack: () => setShowPlans(false),
|
|
@@ -9328,16 +10106,16 @@ function BillingContent({
|
|
|
9328
10106
|
}
|
|
9329
10107
|
);
|
|
9330
10108
|
if (embedded) return plansView;
|
|
9331
|
-
return /* @__PURE__ */
|
|
10109
|
+
return /* @__PURE__ */ jsx22("div", { className: "flex-1 h-full min-h-0 min-w-0 relative", children: plansView });
|
|
9332
10110
|
}
|
|
9333
|
-
const billingInnerContent = /* @__PURE__ */
|
|
9334
|
-
/* @__PURE__ */
|
|
10111
|
+
const billingInnerContent = /* @__PURE__ */ jsxs19(Fragment9, { children: [
|
|
10112
|
+
/* @__PURE__ */ jsxs19(
|
|
9335
10113
|
"div",
|
|
9336
10114
|
{
|
|
9337
10115
|
className: "flex items-start shrink-0 w-full",
|
|
9338
10116
|
style: { gap: 12 },
|
|
9339
10117
|
children: [
|
|
9340
|
-
/* @__PURE__ */
|
|
10118
|
+
/* @__PURE__ */ jsx22(
|
|
9341
10119
|
ScPlanDetailsCard,
|
|
9342
10120
|
{
|
|
9343
10121
|
planName,
|
|
@@ -9362,12 +10140,12 @@ function BillingContent({
|
|
|
9362
10140
|
}
|
|
9363
10141
|
}
|
|
9364
10142
|
),
|
|
9365
|
-
/* @__PURE__ */
|
|
10143
|
+
/* @__PURE__ */ jsx22(
|
|
9366
10144
|
ScCreditsUsageCard,
|
|
9367
10145
|
{
|
|
9368
10146
|
usageLabel: "Credits used",
|
|
9369
10147
|
usageText,
|
|
9370
|
-
remainingText: availableCredits != null ? `${
|
|
10148
|
+
remainingText: availableCredits != null ? `${formatCredits2(availableCredits)} (${remainingPct}%) Remaining` : `${remainingPct}% Remaining`,
|
|
9371
10149
|
buyButtonText: "Buy credits",
|
|
9372
10150
|
buyButtonState: isFreePlan ? "disabled" : "default",
|
|
9373
10151
|
buyButtonHoverText: isFreePlan ? "Pro plan required" : void 0,
|
|
@@ -9387,7 +10165,7 @@ function BillingContent({
|
|
|
9387
10165
|
]
|
|
9388
10166
|
}
|
|
9389
10167
|
),
|
|
9390
|
-
usage ? /* @__PURE__ */
|
|
10168
|
+
usage ? /* @__PURE__ */ jsxs19(
|
|
9391
10169
|
"div",
|
|
9392
10170
|
{
|
|
9393
10171
|
className: "grid shrink-0 w-full",
|
|
@@ -9396,8 +10174,8 @@ function BillingContent({
|
|
|
9396
10174
|
gridTemplateColumns: "repeat(auto-fit, minmax(18rem, 1fr))"
|
|
9397
10175
|
},
|
|
9398
10176
|
children: [
|
|
9399
|
-
/* @__PURE__ */
|
|
9400
|
-
/* @__PURE__ */
|
|
10177
|
+
/* @__PURE__ */ jsx22(ScUsageMeterCard, { kind: "storage", plan: usage.plan, status: usage.storage }),
|
|
10178
|
+
/* @__PURE__ */ jsx22(
|
|
9401
10179
|
ScUsageMeterCard,
|
|
9402
10180
|
{
|
|
9403
10181
|
kind: "bandwidth",
|
|
@@ -9409,9 +10187,60 @@ function BillingContent({
|
|
|
9409
10187
|
]
|
|
9410
10188
|
}
|
|
9411
10189
|
) : null,
|
|
9412
|
-
/* @__PURE__ */
|
|
9413
|
-
|
|
9414
|
-
|
|
10190
|
+
api.fetchMemberCreditLimits ? /* @__PURE__ */ jsxs19(
|
|
10191
|
+
"div",
|
|
10192
|
+
{
|
|
10193
|
+
className: "flex items-center justify-between shrink-0 w-full",
|
|
10194
|
+
style: {
|
|
10195
|
+
gap: 12,
|
|
10196
|
+
padding: 16,
|
|
10197
|
+
backgroundColor: "var(--alias-surface-base)",
|
|
10198
|
+
border: "1px solid var(--alias-border-subtle)",
|
|
10199
|
+
borderRadius: "var(--radius-3xl)"
|
|
10200
|
+
},
|
|
10201
|
+
children: [
|
|
10202
|
+
/* @__PURE__ */ jsxs19("div", { className: "flex flex-col min-w-0", style: { gap: 4 }, children: [
|
|
10203
|
+
/* @__PURE__ */ jsx22(
|
|
10204
|
+
"span",
|
|
10205
|
+
{
|
|
10206
|
+
style: {
|
|
10207
|
+
fontFamily: "var(--font-family-font-family-body)",
|
|
10208
|
+
fontSize: "var(--font-size-font-size-sm)",
|
|
10209
|
+
fontWeight: 500,
|
|
10210
|
+
lineHeight: "var(--line-height-line-height-sm)",
|
|
10211
|
+
color: "var(--alias-text---icons-primary)"
|
|
10212
|
+
},
|
|
10213
|
+
children: "Per-user usage limits"
|
|
10214
|
+
}
|
|
10215
|
+
),
|
|
10216
|
+
/* @__PURE__ */ jsx22(
|
|
10217
|
+
"span",
|
|
10218
|
+
{
|
|
10219
|
+
style: {
|
|
10220
|
+
fontFamily: "var(--font-family-font-family-body)",
|
|
10221
|
+
fontSize: "var(--font-size-font-size-sm)",
|
|
10222
|
+
lineHeight: "var(--line-height-line-height-sm)",
|
|
10223
|
+
color: "var(--alias-text---icons-muted)"
|
|
10224
|
+
},
|
|
10225
|
+
children: "Set a default and per-member limits on credits per billing cycle"
|
|
10226
|
+
}
|
|
10227
|
+
)
|
|
10228
|
+
] }),
|
|
10229
|
+
/* @__PURE__ */ jsx22(
|
|
10230
|
+
ScButton8,
|
|
10231
|
+
{
|
|
10232
|
+
text: "Manage",
|
|
10233
|
+
variant: "secondary",
|
|
10234
|
+
size: "md",
|
|
10235
|
+
onClick: () => setShowPerUserLimits(true)
|
|
10236
|
+
}
|
|
10237
|
+
)
|
|
10238
|
+
]
|
|
10239
|
+
}
|
|
10240
|
+
) : null,
|
|
10241
|
+
/* @__PURE__ */ jsxs19("div", { className: "flex items-center justify-between shrink-0 w-full", children: [
|
|
10242
|
+
/* @__PURE__ */ jsx22(BillingTabBar, { activeTab, onTabChange: setActiveTab }),
|
|
10243
|
+
/* @__PURE__ */ jsxs19(
|
|
9415
10244
|
"div",
|
|
9416
10245
|
{
|
|
9417
10246
|
className: "flex items-center shrink-0 cursor-pointer",
|
|
@@ -9423,8 +10252,8 @@ function BillingContent({
|
|
|
9423
10252
|
},
|
|
9424
10253
|
onClick: () => setShowExportModal(true),
|
|
9425
10254
|
children: [
|
|
9426
|
-
/* @__PURE__ */
|
|
9427
|
-
/* @__PURE__ */
|
|
10255
|
+
/* @__PURE__ */ jsx22(SiconDownload, { className: "w-5 h-5", color: PRIMARY_COLOR2 }),
|
|
10256
|
+
/* @__PURE__ */ jsx22(
|
|
9428
10257
|
"span",
|
|
9429
10258
|
{
|
|
9430
10259
|
style: {
|
|
@@ -9441,14 +10270,14 @@ function BillingContent({
|
|
|
9441
10270
|
}
|
|
9442
10271
|
)
|
|
9443
10272
|
] }),
|
|
9444
|
-
activeTab === "invoice" ? /* @__PURE__ */
|
|
10273
|
+
activeTab === "invoice" ? /* @__PURE__ */ jsx22(
|
|
9445
10274
|
InvoiceHistoryTable,
|
|
9446
10275
|
{
|
|
9447
10276
|
invoices,
|
|
9448
10277
|
loading: loadingTable,
|
|
9449
10278
|
workspaceCountry: workspace.current?.country
|
|
9450
10279
|
}
|
|
9451
|
-
) : /* @__PURE__ */
|
|
10280
|
+
) : /* @__PURE__ */ jsx22(
|
|
9452
10281
|
UsageLogsTable,
|
|
9453
10282
|
{
|
|
9454
10283
|
logs: usageLogs,
|
|
@@ -9456,7 +10285,7 @@ function BillingContent({
|
|
|
9456
10285
|
loading: loadingTable
|
|
9457
10286
|
}
|
|
9458
10287
|
),
|
|
9459
|
-
showExportModal && /* @__PURE__ */
|
|
10288
|
+
showExportModal && /* @__PURE__ */ jsx22(
|
|
9460
10289
|
ExportDateModal,
|
|
9461
10290
|
{
|
|
9462
10291
|
title: activeTab === "invoice" ? "Export invoices" : "Export log",
|
|
@@ -9464,7 +10293,7 @@ function BillingContent({
|
|
|
9464
10293
|
onExport: handleExport
|
|
9465
10294
|
}
|
|
9466
10295
|
),
|
|
9467
|
-
showBuyCreditsModal && /* @__PURE__ */
|
|
10296
|
+
showBuyCreditsModal && /* @__PURE__ */ jsx22(
|
|
9468
10297
|
BuyCreditsModal,
|
|
9469
10298
|
{
|
|
9470
10299
|
country: workspace.current?.country,
|
|
@@ -9479,7 +10308,7 @@ function BillingContent({
|
|
|
9479
10308
|
)
|
|
9480
10309
|
] });
|
|
9481
10310
|
if (embedded) {
|
|
9482
|
-
return /* @__PURE__ */
|
|
10311
|
+
return /* @__PURE__ */ jsx22(
|
|
9483
10312
|
"div",
|
|
9484
10313
|
{
|
|
9485
10314
|
className: "flex flex-col flex-1 min-w-0 min-h-0 w-full",
|
|
@@ -9488,7 +10317,7 @@ function BillingContent({
|
|
|
9488
10317
|
}
|
|
9489
10318
|
);
|
|
9490
10319
|
}
|
|
9491
|
-
return /* @__PURE__ */
|
|
10320
|
+
return /* @__PURE__ */ jsx22("div", { className: "flex-1 h-full min-h-0 min-w-0 relative", children: /* @__PURE__ */ jsxs19(
|
|
9492
10321
|
"div",
|
|
9493
10322
|
{
|
|
9494
10323
|
className: "flex flex-col items-start relative size-full overflow-y-auto",
|
|
@@ -9499,7 +10328,7 @@ function BillingContent({
|
|
|
9499
10328
|
backgroundSize: "24px 24px"
|
|
9500
10329
|
},
|
|
9501
10330
|
children: [
|
|
9502
|
-
/* @__PURE__ */
|
|
10331
|
+
/* @__PURE__ */ jsx22("div", { className: "flex items-center justify-between shrink-0 w-full", children: /* @__PURE__ */ jsx22(
|
|
9503
10332
|
"p",
|
|
9504
10333
|
{
|
|
9505
10334
|
className: "flex-1 min-w-0 truncate",
|
|
@@ -9520,16 +10349,16 @@ function BillingContent({
|
|
|
9520
10349
|
}
|
|
9521
10350
|
|
|
9522
10351
|
// src/tokens-content.tsx
|
|
9523
|
-
import { useState as
|
|
10352
|
+
import { useState as useState16, useEffect as useEffect14, useCallback as useCallback7 } from "react";
|
|
9524
10353
|
import {
|
|
9525
|
-
ScButton as
|
|
10354
|
+
ScButton as ScButton9,
|
|
9526
10355
|
ScBadges
|
|
9527
10356
|
} from "@streamoid/ui";
|
|
9528
10357
|
import {
|
|
9529
10358
|
SiconPlus as SiconPlus2,
|
|
9530
|
-
SiconClose as
|
|
10359
|
+
SiconClose as SiconClose8
|
|
9531
10360
|
} from "@streamoid/icons";
|
|
9532
|
-
import { Fragment as Fragment10, jsx as
|
|
10361
|
+
import { Fragment as Fragment10, jsx as jsx23, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
9533
10362
|
var EXPIRY_OPTIONS = [
|
|
9534
10363
|
{ label: "30 days", value: "30d" },
|
|
9535
10364
|
{ label: "60 days", value: "60d" },
|
|
@@ -9549,7 +10378,7 @@ function isExpired(expiresAt) {
|
|
|
9549
10378
|
if (!expiresAt) return false;
|
|
9550
10379
|
return /* @__PURE__ */ new Date() > new Date(expiresAt);
|
|
9551
10380
|
}
|
|
9552
|
-
var
|
|
10381
|
+
var T14 = {
|
|
9553
10382
|
primary: "var(--alias-text---icons-primary)",
|
|
9554
10383
|
muted: "var(--alias-text---icons-muted)",
|
|
9555
10384
|
warning: "var(--alias-text---icons-warning)",
|
|
@@ -9571,9 +10400,9 @@ var T12 = {
|
|
|
9571
10400
|
};
|
|
9572
10401
|
function CreateTokenModal({ onClose, onCreated }) {
|
|
9573
10402
|
const { api, toast } = useSettingsAdapters();
|
|
9574
|
-
const [name, setName] =
|
|
9575
|
-
const [expiry, setExpiry] =
|
|
9576
|
-
const [loading, setLoading] =
|
|
10403
|
+
const [name, setName] = useState16("");
|
|
10404
|
+
const [expiry, setExpiry] = useState16("never");
|
|
10405
|
+
const [loading, setLoading] = useState16(false);
|
|
9577
10406
|
async function handleCreate() {
|
|
9578
10407
|
if (!name.trim()) {
|
|
9579
10408
|
toast.error("Token name is required.");
|
|
@@ -9589,96 +10418,96 @@ function CreateTokenModal({ onClose, onCreated }) {
|
|
|
9589
10418
|
setLoading(false);
|
|
9590
10419
|
}
|
|
9591
10420
|
}
|
|
9592
|
-
return /* @__PURE__ */
|
|
10421
|
+
return /* @__PURE__ */ jsx23(
|
|
9593
10422
|
"div",
|
|
9594
10423
|
{
|
|
9595
10424
|
className: "fixed inset-0 flex items-center justify-center",
|
|
9596
10425
|
style: { backgroundColor: "rgba(0,0,0,0.6)", zIndex: 1e3 },
|
|
9597
10426
|
onClick: onClose,
|
|
9598
|
-
children: /* @__PURE__ */
|
|
10427
|
+
children: /* @__PURE__ */ jsxs20(
|
|
9599
10428
|
"div",
|
|
9600
10429
|
{
|
|
9601
10430
|
className: "flex flex-col items-start relative",
|
|
9602
10431
|
style: {
|
|
9603
|
-
backgroundColor:
|
|
9604
|
-
borderRadius:
|
|
10432
|
+
backgroundColor: T14.neutral825,
|
|
10433
|
+
borderRadius: T14.r4xl,
|
|
9605
10434
|
width: "min(40vw, 500px)",
|
|
9606
|
-
border: `1px solid ${
|
|
10435
|
+
border: `1px solid ${T14.borderSubtle}`
|
|
9607
10436
|
},
|
|
9608
10437
|
onClick: (e) => e.stopPropagation(),
|
|
9609
10438
|
children: [
|
|
9610
|
-
/* @__PURE__ */
|
|
10439
|
+
/* @__PURE__ */ jsx23(
|
|
9611
10440
|
"div",
|
|
9612
10441
|
{
|
|
9613
10442
|
className: "relative shrink-0 w-full",
|
|
9614
|
-
style: { borderBottom: `1px solid ${
|
|
9615
|
-
children: /* @__PURE__ */
|
|
10443
|
+
style: { borderBottom: `1px solid ${T14.borderDivider}` },
|
|
10444
|
+
children: /* @__PURE__ */ jsxs20(
|
|
9616
10445
|
"div",
|
|
9617
10446
|
{
|
|
9618
10447
|
className: "flex items-center w-full",
|
|
9619
|
-
style: { padding: `${
|
|
10448
|
+
style: { padding: `${T14.spXl} ${T14.sp3xl}` },
|
|
9620
10449
|
children: [
|
|
9621
|
-
/* @__PURE__ */
|
|
10450
|
+
/* @__PURE__ */ jsx23(
|
|
9622
10451
|
"p",
|
|
9623
10452
|
{
|
|
9624
10453
|
className: "flex-1 min-w-0 truncate",
|
|
9625
10454
|
style: {
|
|
9626
|
-
fontFamily:
|
|
9627
|
-
fontSize:
|
|
10455
|
+
fontFamily: T14.fontDisplay,
|
|
10456
|
+
fontSize: T14.fsLg,
|
|
9628
10457
|
fontWeight: 600,
|
|
9629
|
-
lineHeight:
|
|
9630
|
-
color:
|
|
10458
|
+
lineHeight: T14.lhLg,
|
|
10459
|
+
color: T14.primary,
|
|
9631
10460
|
margin: 0
|
|
9632
10461
|
},
|
|
9633
10462
|
children: "Create New Token"
|
|
9634
10463
|
}
|
|
9635
10464
|
),
|
|
9636
|
-
/* @__PURE__ */
|
|
10465
|
+
/* @__PURE__ */ jsx23("div", { className: "cursor-pointer", onClick: onClose, children: /* @__PURE__ */ jsx23(SiconClose8, { className: "w-6 h-6", color: T14.primary }) })
|
|
9637
10466
|
]
|
|
9638
10467
|
}
|
|
9639
10468
|
)
|
|
9640
10469
|
}
|
|
9641
10470
|
),
|
|
9642
|
-
/* @__PURE__ */
|
|
10471
|
+
/* @__PURE__ */ jsxs20(
|
|
9643
10472
|
"div",
|
|
9644
10473
|
{
|
|
9645
10474
|
className: "flex flex-col items-start shrink-0 w-full",
|
|
9646
|
-
style: { padding:
|
|
10475
|
+
style: { padding: T14.sp3xl, gap: T14.sp3xl },
|
|
9647
10476
|
children: [
|
|
9648
|
-
/* @__PURE__ */
|
|
10477
|
+
/* @__PURE__ */ jsxs20(
|
|
9649
10478
|
"div",
|
|
9650
10479
|
{
|
|
9651
10480
|
className: "flex flex-col items-start shrink-0 w-full",
|
|
9652
10481
|
style: { gap: "var(--spacing-xs)" },
|
|
9653
10482
|
children: [
|
|
9654
|
-
/* @__PURE__ */
|
|
10483
|
+
/* @__PURE__ */ jsx23("div", { className: "flex items-center shrink-0 w-full", style: { height: 24 }, children: /* @__PURE__ */ jsx23(
|
|
9655
10484
|
"span",
|
|
9656
10485
|
{
|
|
9657
10486
|
style: {
|
|
9658
|
-
fontFamily:
|
|
9659
|
-
fontSize:
|
|
10487
|
+
fontFamily: T14.font,
|
|
10488
|
+
fontSize: T14.fsSm,
|
|
9660
10489
|
fontWeight: 400,
|
|
9661
|
-
lineHeight:
|
|
9662
|
-
color:
|
|
10490
|
+
lineHeight: T14.lhSm,
|
|
10491
|
+
color: T14.muted
|
|
9663
10492
|
},
|
|
9664
10493
|
children: "Token name"
|
|
9665
10494
|
}
|
|
9666
10495
|
) }),
|
|
9667
|
-
/* @__PURE__ */
|
|
10496
|
+
/* @__PURE__ */ jsx23(
|
|
9668
10497
|
"div",
|
|
9669
10498
|
{
|
|
9670
10499
|
className: "shrink-0 w-full",
|
|
9671
10500
|
style: {
|
|
9672
|
-
backgroundColor:
|
|
9673
|
-
borderRadius:
|
|
10501
|
+
backgroundColor: T14.neutral875,
|
|
10502
|
+
borderRadius: T14.rXl,
|
|
9674
10503
|
height: 48
|
|
9675
10504
|
},
|
|
9676
|
-
children: /* @__PURE__ */
|
|
10505
|
+
children: /* @__PURE__ */ jsx23(
|
|
9677
10506
|
"div",
|
|
9678
10507
|
{
|
|
9679
10508
|
className: "flex items-center size-full",
|
|
9680
|
-
style: { padding: `var(--spacing-lg) ${
|
|
9681
|
-
children: /* @__PURE__ */
|
|
10509
|
+
style: { padding: `var(--spacing-lg) ${T14.spXl}` },
|
|
10510
|
+
children: /* @__PURE__ */ jsx23(
|
|
9682
10511
|
"input",
|
|
9683
10512
|
{
|
|
9684
10513
|
type: "text",
|
|
@@ -9687,11 +10516,11 @@ function CreateTokenModal({ onClose, onCreated }) {
|
|
|
9687
10516
|
placeholder: "Name your token...",
|
|
9688
10517
|
className: "flex-1 min-w-0 bg-transparent border-none outline-none",
|
|
9689
10518
|
style: {
|
|
9690
|
-
fontFamily:
|
|
9691
|
-
fontSize:
|
|
10519
|
+
fontFamily: T14.font,
|
|
10520
|
+
fontSize: T14.fsSm,
|
|
9692
10521
|
fontWeight: 400,
|
|
9693
|
-
lineHeight:
|
|
9694
|
-
color: name ?
|
|
10522
|
+
lineHeight: T14.lhSm,
|
|
10523
|
+
color: name ? T14.primary : T14.neutral500
|
|
9695
10524
|
}
|
|
9696
10525
|
}
|
|
9697
10526
|
)
|
|
@@ -9702,27 +10531,27 @@ function CreateTokenModal({ onClose, onCreated }) {
|
|
|
9702
10531
|
]
|
|
9703
10532
|
}
|
|
9704
10533
|
),
|
|
9705
|
-
/* @__PURE__ */
|
|
10534
|
+
/* @__PURE__ */ jsxs20(
|
|
9706
10535
|
"div",
|
|
9707
10536
|
{
|
|
9708
10537
|
className: "flex flex-col items-start shrink-0 w-full",
|
|
9709
10538
|
style: { gap: "var(--spacing-xs)" },
|
|
9710
10539
|
children: [
|
|
9711
|
-
/* @__PURE__ */
|
|
10540
|
+
/* @__PURE__ */ jsx23("div", { className: "flex items-center shrink-0 w-full", style: { height: 24 }, children: /* @__PURE__ */ jsx23(
|
|
9712
10541
|
"span",
|
|
9713
10542
|
{
|
|
9714
10543
|
style: {
|
|
9715
|
-
fontFamily:
|
|
9716
|
-
fontSize:
|
|
10544
|
+
fontFamily: T14.font,
|
|
10545
|
+
fontSize: T14.fsSm,
|
|
9717
10546
|
fontWeight: 400,
|
|
9718
|
-
lineHeight:
|
|
9719
|
-
color:
|
|
10547
|
+
lineHeight: T14.lhSm,
|
|
10548
|
+
color: T14.muted
|
|
9720
10549
|
},
|
|
9721
10550
|
children: "Expiry"
|
|
9722
10551
|
}
|
|
9723
10552
|
) }),
|
|
9724
|
-
/* @__PURE__ */
|
|
9725
|
-
|
|
10553
|
+
/* @__PURE__ */ jsx23("div", { style: { display: "flex", gap: "var(--spacing-md)", flexWrap: "wrap" }, children: EXPIRY_OPTIONS.map((opt) => /* @__PURE__ */ jsx23(
|
|
10554
|
+
ScButton9,
|
|
9726
10555
|
{
|
|
9727
10556
|
text: opt.label,
|
|
9728
10557
|
variant: expiry === opt.value ? "secondary" : "outline",
|
|
@@ -9734,8 +10563,8 @@ function CreateTokenModal({ onClose, onCreated }) {
|
|
|
9734
10563
|
]
|
|
9735
10564
|
}
|
|
9736
10565
|
),
|
|
9737
|
-
/* @__PURE__ */
|
|
9738
|
-
|
|
10566
|
+
/* @__PURE__ */ jsx23(
|
|
10567
|
+
ScButton9,
|
|
9739
10568
|
{
|
|
9740
10569
|
text: loading ? "Creating..." : "Create token",
|
|
9741
10570
|
variant: "secondary",
|
|
@@ -9756,7 +10585,7 @@ function CreateTokenModal({ onClose, onCreated }) {
|
|
|
9756
10585
|
}
|
|
9757
10586
|
function TokenCreatedModal({ token, onClose }) {
|
|
9758
10587
|
const { toast } = useSettingsAdapters();
|
|
9759
|
-
const [copied, setCopied] =
|
|
10588
|
+
const [copied, setCopied] = useState16(false);
|
|
9760
10589
|
function handleCopy() {
|
|
9761
10590
|
navigator.clipboard.writeText(token.token).then(() => {
|
|
9762
10591
|
setCopied(true);
|
|
@@ -9766,101 +10595,101 @@ function TokenCreatedModal({ token, onClose }) {
|
|
|
9766
10595
|
toast.error("Failed to copy token. Please copy it manually.");
|
|
9767
10596
|
});
|
|
9768
10597
|
}
|
|
9769
|
-
return /* @__PURE__ */
|
|
10598
|
+
return /* @__PURE__ */ jsx23(
|
|
9770
10599
|
"div",
|
|
9771
10600
|
{
|
|
9772
10601
|
className: "fixed inset-0 flex items-center justify-center",
|
|
9773
10602
|
style: { backgroundColor: "rgba(0,0,0,0.6)", zIndex: 1e3 },
|
|
9774
|
-
children: /* @__PURE__ */
|
|
10603
|
+
children: /* @__PURE__ */ jsxs20(
|
|
9775
10604
|
"div",
|
|
9776
10605
|
{
|
|
9777
10606
|
className: "flex flex-col items-start relative",
|
|
9778
10607
|
style: {
|
|
9779
|
-
backgroundColor:
|
|
9780
|
-
borderRadius:
|
|
10608
|
+
backgroundColor: T14.neutral825,
|
|
10609
|
+
borderRadius: T14.r4xl,
|
|
9781
10610
|
width: "min(40vw, 500px)",
|
|
9782
|
-
border: `1px solid ${
|
|
10611
|
+
border: `1px solid ${T14.borderSubtle}`
|
|
9783
10612
|
},
|
|
9784
10613
|
children: [
|
|
9785
|
-
/* @__PURE__ */
|
|
10614
|
+
/* @__PURE__ */ jsx23(
|
|
9786
10615
|
"div",
|
|
9787
10616
|
{
|
|
9788
10617
|
className: "relative shrink-0 w-full",
|
|
9789
|
-
style: { borderBottom: `1px solid ${
|
|
9790
|
-
children: /* @__PURE__ */
|
|
10618
|
+
style: { borderBottom: `1px solid ${T14.borderDivider}` },
|
|
10619
|
+
children: /* @__PURE__ */ jsxs20(
|
|
9791
10620
|
"div",
|
|
9792
10621
|
{
|
|
9793
10622
|
className: "flex items-center w-full",
|
|
9794
|
-
style: { padding: `${
|
|
10623
|
+
style: { padding: `${T14.spXl} ${T14.sp3xl}` },
|
|
9795
10624
|
children: [
|
|
9796
|
-
/* @__PURE__ */
|
|
10625
|
+
/* @__PURE__ */ jsx23(
|
|
9797
10626
|
"p",
|
|
9798
10627
|
{
|
|
9799
10628
|
className: "flex-1 min-w-0 truncate",
|
|
9800
10629
|
style: {
|
|
9801
|
-
fontFamily:
|
|
9802
|
-
fontSize:
|
|
10630
|
+
fontFamily: T14.fontDisplay,
|
|
10631
|
+
fontSize: T14.fsLg,
|
|
9803
10632
|
fontWeight: 600,
|
|
9804
|
-
lineHeight:
|
|
9805
|
-
color:
|
|
10633
|
+
lineHeight: T14.lhLg,
|
|
10634
|
+
color: T14.primary,
|
|
9806
10635
|
margin: 0
|
|
9807
10636
|
},
|
|
9808
10637
|
children: "Token Created"
|
|
9809
10638
|
}
|
|
9810
10639
|
),
|
|
9811
|
-
/* @__PURE__ */
|
|
10640
|
+
/* @__PURE__ */ jsx23("div", { className: "cursor-pointer", onClick: onClose, children: /* @__PURE__ */ jsx23(SiconClose8, { className: "w-6 h-6", color: T14.primary }) })
|
|
9812
10641
|
]
|
|
9813
10642
|
}
|
|
9814
10643
|
)
|
|
9815
10644
|
}
|
|
9816
10645
|
),
|
|
9817
|
-
/* @__PURE__ */
|
|
10646
|
+
/* @__PURE__ */ jsxs20(
|
|
9818
10647
|
"div",
|
|
9819
10648
|
{
|
|
9820
10649
|
className: "flex flex-col items-start shrink-0 w-full",
|
|
9821
|
-
style: { padding:
|
|
10650
|
+
style: { padding: T14.sp3xl, gap: T14.sp3xl },
|
|
9822
10651
|
children: [
|
|
9823
|
-
/* @__PURE__ */
|
|
10652
|
+
/* @__PURE__ */ jsx23(
|
|
9824
10653
|
"p",
|
|
9825
10654
|
{
|
|
9826
10655
|
style: {
|
|
9827
|
-
fontFamily:
|
|
9828
|
-
fontSize:
|
|
10656
|
+
fontFamily: T14.font,
|
|
10657
|
+
fontSize: T14.fsSm,
|
|
9829
10658
|
fontWeight: 400,
|
|
9830
|
-
lineHeight:
|
|
9831
|
-
color:
|
|
10659
|
+
lineHeight: T14.lhSm,
|
|
10660
|
+
color: T14.warning,
|
|
9832
10661
|
margin: 0
|
|
9833
10662
|
},
|
|
9834
10663
|
children: "Copy this token now. You won't be able to see it again."
|
|
9835
10664
|
}
|
|
9836
10665
|
),
|
|
9837
|
-
/* @__PURE__ */
|
|
10666
|
+
/* @__PURE__ */ jsx23(
|
|
9838
10667
|
"div",
|
|
9839
10668
|
{
|
|
9840
10669
|
className: "w-full",
|
|
9841
10670
|
style: {
|
|
9842
|
-
backgroundColor:
|
|
9843
|
-
borderRadius:
|
|
9844
|
-
padding: `var(--spacing-lg) ${
|
|
10671
|
+
backgroundColor: T14.neutral875,
|
|
10672
|
+
borderRadius: T14.rXl,
|
|
10673
|
+
padding: `var(--spacing-lg) ${T14.spXl}`
|
|
9845
10674
|
},
|
|
9846
|
-
children: /* @__PURE__ */
|
|
10675
|
+
children: /* @__PURE__ */ jsx23(
|
|
9847
10676
|
"code",
|
|
9848
10677
|
{
|
|
9849
10678
|
style: {
|
|
9850
10679
|
fontFamily: "monospace",
|
|
9851
|
-
fontSize:
|
|
9852
|
-
color:
|
|
10680
|
+
fontSize: T14.fsSm,
|
|
10681
|
+
color: T14.primary,
|
|
9853
10682
|
wordBreak: "break-all",
|
|
9854
|
-
lineHeight:
|
|
10683
|
+
lineHeight: T14.lhSm
|
|
9855
10684
|
},
|
|
9856
10685
|
children: token.token
|
|
9857
10686
|
}
|
|
9858
10687
|
)
|
|
9859
10688
|
}
|
|
9860
10689
|
),
|
|
9861
|
-
/* @__PURE__ */
|
|
9862
|
-
/* @__PURE__ */
|
|
9863
|
-
|
|
10690
|
+
/* @__PURE__ */ jsxs20("div", { style: { display: "flex", gap: "var(--spacing-md)", width: "100%" }, children: [
|
|
10691
|
+
/* @__PURE__ */ jsx23(
|
|
10692
|
+
ScButton9,
|
|
9864
10693
|
{
|
|
9865
10694
|
text: copied ? "Copied!" : "Copy token",
|
|
9866
10695
|
variant: "secondary",
|
|
@@ -9869,8 +10698,8 @@ function TokenCreatedModal({ token, onClose }) {
|
|
|
9869
10698
|
className: "flex-1"
|
|
9870
10699
|
}
|
|
9871
10700
|
),
|
|
9872
|
-
/* @__PURE__ */
|
|
9873
|
-
|
|
10701
|
+
/* @__PURE__ */ jsx23(
|
|
10702
|
+
ScButton9,
|
|
9874
10703
|
{
|
|
9875
10704
|
text: "Done",
|
|
9876
10705
|
variant: "outline",
|
|
@@ -9897,22 +10726,22 @@ function TokensContent({
|
|
|
9897
10726
|
onCreateOpenChange
|
|
9898
10727
|
} = {}) {
|
|
9899
10728
|
const { api, toast } = useSettingsAdapters();
|
|
9900
|
-
const [tokens, setTokens] =
|
|
9901
|
-
const [loading, setLoading] =
|
|
9902
|
-
const [showRevoked, setShowRevoked] =
|
|
9903
|
-
const [showCreateModal, setShowCreateModal] =
|
|
9904
|
-
const [createdToken, setCreatedToken] =
|
|
9905
|
-
const [deletingId, setDeletingId] =
|
|
9906
|
-
|
|
10729
|
+
const [tokens, setTokens] = useState16([]);
|
|
10730
|
+
const [loading, setLoading] = useState16(true);
|
|
10731
|
+
const [showRevoked, setShowRevoked] = useState16(false);
|
|
10732
|
+
const [showCreateModal, setShowCreateModal] = useState16(false);
|
|
10733
|
+
const [createdToken, setCreatedToken] = useState16(null);
|
|
10734
|
+
const [deletingId, setDeletingId] = useState16(null);
|
|
10735
|
+
useEffect14(() => {
|
|
9907
10736
|
if (showRevokedOverride !== void 0) setShowRevoked(showRevokedOverride);
|
|
9908
10737
|
}, [showRevokedOverride]);
|
|
9909
|
-
|
|
10738
|
+
useEffect14(() => {
|
|
9910
10739
|
if (createOpenOverride) {
|
|
9911
10740
|
setShowCreateModal(true);
|
|
9912
10741
|
onCreateOpenChange?.(false);
|
|
9913
10742
|
}
|
|
9914
10743
|
}, [createOpenOverride, onCreateOpenChange]);
|
|
9915
|
-
const fetchTokens =
|
|
10744
|
+
const fetchTokens = useCallback7(async () => {
|
|
9916
10745
|
setLoading(true);
|
|
9917
10746
|
try {
|
|
9918
10747
|
const data = await api.fetchTokens({ showRevoked });
|
|
@@ -9923,7 +10752,7 @@ function TokensContent({
|
|
|
9923
10752
|
setLoading(false);
|
|
9924
10753
|
}
|
|
9925
10754
|
}, [api, showRevoked]);
|
|
9926
|
-
|
|
10755
|
+
useEffect14(() => {
|
|
9927
10756
|
fetchTokens();
|
|
9928
10757
|
}, [fetchTokens]);
|
|
9929
10758
|
async function handleRevoke(tokenId) {
|
|
@@ -9961,8 +10790,8 @@ function TokensContent({
|
|
|
9961
10790
|
setCreatedToken(token);
|
|
9962
10791
|
fetchTokens();
|
|
9963
10792
|
}
|
|
9964
|
-
const tokensInnerContent = /* @__PURE__ */
|
|
9965
|
-
!embedded && /* @__PURE__ */
|
|
10793
|
+
const tokensInnerContent = /* @__PURE__ */ jsxs20(Fragment10, { children: [
|
|
10794
|
+
!embedded && /* @__PURE__ */ jsxs20(
|
|
9966
10795
|
"div",
|
|
9967
10796
|
{
|
|
9968
10797
|
style: {
|
|
@@ -9974,8 +10803,8 @@ function TokensContent({
|
|
|
9974
10803
|
gap: "var(--spacing-md)"
|
|
9975
10804
|
},
|
|
9976
10805
|
children: [
|
|
9977
|
-
/* @__PURE__ */
|
|
9978
|
-
|
|
10806
|
+
/* @__PURE__ */ jsx23(
|
|
10807
|
+
ScButton9,
|
|
9979
10808
|
{
|
|
9980
10809
|
text: showRevoked ? "Hide Revoked" : "Show Revoked",
|
|
9981
10810
|
variant: "outline",
|
|
@@ -9983,21 +10812,21 @@ function TokensContent({
|
|
|
9983
10812
|
onClick: () => setShowRevoked((v) => !v)
|
|
9984
10813
|
}
|
|
9985
10814
|
),
|
|
9986
|
-
/* @__PURE__ */
|
|
9987
|
-
|
|
10815
|
+
/* @__PURE__ */ jsx23(
|
|
10816
|
+
ScButton9,
|
|
9988
10817
|
{
|
|
9989
10818
|
text: "New Token",
|
|
9990
10819
|
variant: "primary",
|
|
9991
10820
|
size: "md",
|
|
9992
10821
|
styleVariant: "icon-left",
|
|
9993
|
-
icon: /* @__PURE__ */
|
|
10822
|
+
icon: /* @__PURE__ */ jsx23(SiconPlus2, {}),
|
|
9994
10823
|
onClick: () => setShowCreateModal(true)
|
|
9995
10824
|
}
|
|
9996
10825
|
)
|
|
9997
10826
|
]
|
|
9998
10827
|
}
|
|
9999
10828
|
),
|
|
10000
|
-
loading ? /* @__PURE__ */
|
|
10829
|
+
loading ? /* @__PURE__ */ jsx23(
|
|
10001
10830
|
"div",
|
|
10002
10831
|
{
|
|
10003
10832
|
style: {
|
|
@@ -10011,7 +10840,7 @@ function TokensContent({
|
|
|
10011
10840
|
},
|
|
10012
10841
|
children: "Loading tokens..."
|
|
10013
10842
|
}
|
|
10014
|
-
) : tokens.length === 0 ? /* @__PURE__ */
|
|
10843
|
+
) : tokens.length === 0 ? /* @__PURE__ */ jsxs20(
|
|
10015
10844
|
"div",
|
|
10016
10845
|
{
|
|
10017
10846
|
style: {
|
|
@@ -10023,8 +10852,8 @@ function TokensContent({
|
|
|
10023
10852
|
gap: "var(--spacing-xl)"
|
|
10024
10853
|
},
|
|
10025
10854
|
children: [
|
|
10026
|
-
/* @__PURE__ */
|
|
10027
|
-
/* @__PURE__ */
|
|
10855
|
+
/* @__PURE__ */ jsx23(SiconKey_default, { size: 48, color: "var(--alias-text---icons-muted)", strokeWidth: 1 }),
|
|
10856
|
+
/* @__PURE__ */ jsx23(
|
|
10028
10857
|
"p",
|
|
10029
10858
|
{
|
|
10030
10859
|
style: {
|
|
@@ -10038,7 +10867,7 @@ function TokensContent({
|
|
|
10038
10867
|
)
|
|
10039
10868
|
]
|
|
10040
10869
|
}
|
|
10041
|
-
) : /* @__PURE__ */
|
|
10870
|
+
) : /* @__PURE__ */ jsx23(
|
|
10042
10871
|
TokenTable,
|
|
10043
10872
|
{
|
|
10044
10873
|
tokens,
|
|
@@ -10047,14 +10876,14 @@ function TokensContent({
|
|
|
10047
10876
|
onDelete: handleDelete
|
|
10048
10877
|
}
|
|
10049
10878
|
),
|
|
10050
|
-
showCreateModal && /* @__PURE__ */
|
|
10879
|
+
showCreateModal && /* @__PURE__ */ jsx23(
|
|
10051
10880
|
CreateTokenModal,
|
|
10052
10881
|
{
|
|
10053
10882
|
onClose: () => setShowCreateModal(false),
|
|
10054
10883
|
onCreated: handleTokenCreated
|
|
10055
10884
|
}
|
|
10056
10885
|
),
|
|
10057
|
-
createdToken && /* @__PURE__ */
|
|
10886
|
+
createdToken && /* @__PURE__ */ jsx23(
|
|
10058
10887
|
TokenCreatedModal,
|
|
10059
10888
|
{
|
|
10060
10889
|
token: createdToken,
|
|
@@ -10063,7 +10892,7 @@ function TokensContent({
|
|
|
10063
10892
|
)
|
|
10064
10893
|
] });
|
|
10065
10894
|
if (embedded) {
|
|
10066
|
-
return /* @__PURE__ */
|
|
10895
|
+
return /* @__PURE__ */ jsx23(
|
|
10067
10896
|
"div",
|
|
10068
10897
|
{
|
|
10069
10898
|
className: "flex flex-col flex-1 min-w-0 min-h-0 w-full",
|
|
@@ -10072,7 +10901,7 @@ function TokensContent({
|
|
|
10072
10901
|
}
|
|
10073
10902
|
);
|
|
10074
10903
|
}
|
|
10075
|
-
return /* @__PURE__ */
|
|
10904
|
+
return /* @__PURE__ */ jsx23("div", { className: "flex-1 min-h-0 min-w-0 relative", style: { height: "100%" }, children: /* @__PURE__ */ jsxs20(
|
|
10076
10905
|
"div",
|
|
10077
10906
|
{
|
|
10078
10907
|
className: "flex flex-col items-stretch size-full overflow-y-auto",
|
|
@@ -10083,7 +10912,7 @@ function TokensContent({
|
|
|
10083
10912
|
backgroundSize: "24px 24px"
|
|
10084
10913
|
},
|
|
10085
10914
|
children: [
|
|
10086
|
-
/* @__PURE__ */
|
|
10915
|
+
/* @__PURE__ */ jsxs20(
|
|
10087
10916
|
"div",
|
|
10088
10917
|
{
|
|
10089
10918
|
style: {
|
|
@@ -10094,7 +10923,7 @@ function TokensContent({
|
|
|
10094
10923
|
width: "100%"
|
|
10095
10924
|
},
|
|
10096
10925
|
children: [
|
|
10097
|
-
/* @__PURE__ */
|
|
10926
|
+
/* @__PURE__ */ jsx23(
|
|
10098
10927
|
"p",
|
|
10099
10928
|
{
|
|
10100
10929
|
style: {
|
|
@@ -10108,9 +10937,9 @@ function TokensContent({
|
|
|
10108
10937
|
children: "API Tokens"
|
|
10109
10938
|
}
|
|
10110
10939
|
),
|
|
10111
|
-
/* @__PURE__ */
|
|
10112
|
-
/* @__PURE__ */
|
|
10113
|
-
|
|
10940
|
+
/* @__PURE__ */ jsxs20("div", { style: { display: "flex", gap: "var(--spacing-md)", alignItems: "center" }, children: [
|
|
10941
|
+
/* @__PURE__ */ jsx23(
|
|
10942
|
+
ScButton9,
|
|
10114
10943
|
{
|
|
10115
10944
|
text: showRevoked ? "Hide Revoked" : "Show Revoked",
|
|
10116
10945
|
variant: "outline",
|
|
@@ -10118,14 +10947,14 @@ function TokensContent({
|
|
|
10118
10947
|
onClick: () => setShowRevoked((v) => !v)
|
|
10119
10948
|
}
|
|
10120
10949
|
),
|
|
10121
|
-
/* @__PURE__ */
|
|
10122
|
-
|
|
10950
|
+
/* @__PURE__ */ jsx23(
|
|
10951
|
+
ScButton9,
|
|
10123
10952
|
{
|
|
10124
10953
|
text: "New Token",
|
|
10125
10954
|
variant: "primary",
|
|
10126
10955
|
size: "md",
|
|
10127
10956
|
styleVariant: "icon-left",
|
|
10128
|
-
icon: /* @__PURE__ */
|
|
10957
|
+
icon: /* @__PURE__ */ jsx23(SiconPlus2, {}),
|
|
10129
10958
|
onClick: () => setShowCreateModal(true)
|
|
10130
10959
|
}
|
|
10131
10960
|
)
|
|
@@ -10139,7 +10968,7 @@ function TokensContent({
|
|
|
10139
10968
|
) });
|
|
10140
10969
|
}
|
|
10141
10970
|
function TokenTable({ tokens, deletingId, onRevoke, onDelete }) {
|
|
10142
|
-
return /* @__PURE__ */
|
|
10971
|
+
return /* @__PURE__ */ jsx23(
|
|
10143
10972
|
"div",
|
|
10144
10973
|
{
|
|
10145
10974
|
style: {
|
|
@@ -10150,7 +10979,7 @@ function TokenTable({ tokens, deletingId, onRevoke, onDelete }) {
|
|
|
10150
10979
|
overflow: "hidden",
|
|
10151
10980
|
width: "100%"
|
|
10152
10981
|
},
|
|
10153
|
-
children: /* @__PURE__ */
|
|
10982
|
+
children: /* @__PURE__ */ jsxs20(
|
|
10154
10983
|
"div",
|
|
10155
10984
|
{
|
|
10156
10985
|
style: {
|
|
@@ -10163,7 +10992,7 @@ function TokenTable({ tokens, deletingId, onRevoke, onDelete }) {
|
|
|
10163
10992
|
minHeight: 0
|
|
10164
10993
|
},
|
|
10165
10994
|
children: [
|
|
10166
|
-
/* @__PURE__ */
|
|
10995
|
+
/* @__PURE__ */ jsx23(
|
|
10167
10996
|
"div",
|
|
10168
10997
|
{
|
|
10169
10998
|
style: {
|
|
@@ -10174,7 +11003,7 @@ function TokenTable({ tokens, deletingId, onRevoke, onDelete }) {
|
|
|
10174
11003
|
borderBottom: "0.5px solid var(--alias-border-subtle)",
|
|
10175
11004
|
flexShrink: 0
|
|
10176
11005
|
},
|
|
10177
|
-
children: ["Name", "Token", "Expires", "Last Used", "Created", "Actions"].map((h) => /* @__PURE__ */
|
|
11006
|
+
children: ["Name", "Token", "Expires", "Last Used", "Created", "Actions"].map((h) => /* @__PURE__ */ jsx23(
|
|
10178
11007
|
"span",
|
|
10179
11008
|
{
|
|
10180
11009
|
style: {
|
|
@@ -10190,7 +11019,7 @@ function TokenTable({ tokens, deletingId, onRevoke, onDelete }) {
|
|
|
10190
11019
|
))
|
|
10191
11020
|
}
|
|
10192
11021
|
),
|
|
10193
|
-
/* @__PURE__ */
|
|
11022
|
+
/* @__PURE__ */ jsx23("div", { style: { flex: 1, minHeight: 0, overflowY: "auto" }, children: tokens.map((token, idx) => /* @__PURE__ */ jsxs20(
|
|
10194
11023
|
"div",
|
|
10195
11024
|
{
|
|
10196
11025
|
style: {
|
|
@@ -10201,8 +11030,8 @@ function TokenTable({ tokens, deletingId, onRevoke, onDelete }) {
|
|
|
10201
11030
|
borderBottom: idx < tokens.length - 1 ? "0.5px solid var(--alias-border-subtle)" : "none"
|
|
10202
11031
|
},
|
|
10203
11032
|
children: [
|
|
10204
|
-
/* @__PURE__ */
|
|
10205
|
-
/* @__PURE__ */
|
|
11033
|
+
/* @__PURE__ */ jsxs20("div", { style: { display: "flex", alignItems: "center", gap: "var(--spacing-md)", minWidth: 0 }, children: [
|
|
11034
|
+
/* @__PURE__ */ jsx23(
|
|
10206
11035
|
"span",
|
|
10207
11036
|
{
|
|
10208
11037
|
style: {
|
|
@@ -10218,9 +11047,9 @@ function TokenTable({ tokens, deletingId, onRevoke, onDelete }) {
|
|
|
10218
11047
|
children: token.name
|
|
10219
11048
|
}
|
|
10220
11049
|
),
|
|
10221
|
-
token.status === "revoked" && /* @__PURE__ */
|
|
11050
|
+
token.status === "revoked" && /* @__PURE__ */ jsx23(ScBadges, { text: "Revoked", variant: "error" })
|
|
10222
11051
|
] }),
|
|
10223
|
-
/* @__PURE__ */
|
|
11052
|
+
/* @__PURE__ */ jsx23("div", { style: { minWidth: 0 }, children: /* @__PURE__ */ jsxs20(
|
|
10224
11053
|
"code",
|
|
10225
11054
|
{
|
|
10226
11055
|
style: {
|
|
@@ -10243,7 +11072,7 @@ function TokenTable({ tokens, deletingId, onRevoke, onDelete }) {
|
|
|
10243
11072
|
]
|
|
10244
11073
|
}
|
|
10245
11074
|
) }),
|
|
10246
|
-
/* @__PURE__ */
|
|
11075
|
+
/* @__PURE__ */ jsx23(
|
|
10247
11076
|
"span",
|
|
10248
11077
|
{
|
|
10249
11078
|
style: {
|
|
@@ -10255,7 +11084,7 @@ function TokenTable({ tokens, deletingId, onRevoke, onDelete }) {
|
|
|
10255
11084
|
children: formatDate3(token.expiresAt)
|
|
10256
11085
|
}
|
|
10257
11086
|
),
|
|
10258
|
-
/* @__PURE__ */
|
|
11087
|
+
/* @__PURE__ */ jsx23(
|
|
10259
11088
|
"span",
|
|
10260
11089
|
{
|
|
10261
11090
|
style: {
|
|
@@ -10267,7 +11096,7 @@ function TokenTable({ tokens, deletingId, onRevoke, onDelete }) {
|
|
|
10267
11096
|
children: token.lastUsedAt ? formatDate3(token.lastUsedAt) : "Never"
|
|
10268
11097
|
}
|
|
10269
11098
|
),
|
|
10270
|
-
/* @__PURE__ */
|
|
11099
|
+
/* @__PURE__ */ jsx23(
|
|
10271
11100
|
"span",
|
|
10272
11101
|
{
|
|
10273
11102
|
style: {
|
|
@@ -10279,9 +11108,9 @@ function TokenTable({ tokens, deletingId, onRevoke, onDelete }) {
|
|
|
10279
11108
|
children: formatDate3(token.createdAt)
|
|
10280
11109
|
}
|
|
10281
11110
|
),
|
|
10282
|
-
/* @__PURE__ */
|
|
10283
|
-
/* @__PURE__ */
|
|
10284
|
-
|
|
11111
|
+
/* @__PURE__ */ jsxs20("div", { style: { display: "flex", gap: "var(--spacing-sm)" }, children: [
|
|
11112
|
+
/* @__PURE__ */ jsx23(
|
|
11113
|
+
ScButton9,
|
|
10285
11114
|
{
|
|
10286
11115
|
text: deletingId === token._id ? "..." : "Revoke",
|
|
10287
11116
|
variant: "outline",
|
|
@@ -10290,8 +11119,8 @@ function TokenTable({ tokens, deletingId, onRevoke, onDelete }) {
|
|
|
10290
11119
|
onClick: () => onRevoke(token._id)
|
|
10291
11120
|
}
|
|
10292
11121
|
),
|
|
10293
|
-
/* @__PURE__ */
|
|
10294
|
-
|
|
11122
|
+
/* @__PURE__ */ jsx23(
|
|
11123
|
+
ScButton9,
|
|
10295
11124
|
{
|
|
10296
11125
|
text: deletingId === token._id ? "..." : "Delete",
|
|
10297
11126
|
variant: "error",
|
|
@@ -10313,7 +11142,7 @@ function TokenTable({ tokens, deletingId, onRevoke, onDelete }) {
|
|
|
10313
11142
|
}
|
|
10314
11143
|
|
|
10315
11144
|
// src/settings-content.tsx
|
|
10316
|
-
import { Fragment as Fragment12, jsx as
|
|
11145
|
+
import { Fragment as Fragment12, jsx as jsx24, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
10317
11146
|
function deriveInitials(name) {
|
|
10318
11147
|
return name.split(/\s+/).slice(0, 2).map((part) => part[0]?.toUpperCase() ?? "").join("") || "WS";
|
|
10319
11148
|
}
|
|
@@ -10349,7 +11178,7 @@ function SettingsNavItem({
|
|
|
10349
11178
|
onTabChange
|
|
10350
11179
|
}) {
|
|
10351
11180
|
const isActive = activeTab === tab;
|
|
10352
|
-
return /* @__PURE__ */
|
|
11181
|
+
return /* @__PURE__ */ jsx24(SettingsTooltip, { content: TAB_DESCRIPTIONS[tab], placement: "right", children: /* @__PURE__ */ jsx24("div", { children: /* @__PURE__ */ jsx24(
|
|
10353
11182
|
ScSidebarMenu,
|
|
10354
11183
|
{
|
|
10355
11184
|
icon: icon(isActive ? PRIMARY_COLOR3 : MUTED_COLOR2),
|
|
@@ -10378,7 +11207,7 @@ function SettingsNav({
|
|
|
10378
11207
|
hasOrganization,
|
|
10379
11208
|
isWorkspaceAdmin
|
|
10380
11209
|
}) {
|
|
10381
|
-
const item = (tab, icon) => /* @__PURE__ */
|
|
11210
|
+
const item = (tab, icon) => /* @__PURE__ */ jsx24(
|
|
10382
11211
|
SettingsNavItem,
|
|
10383
11212
|
{
|
|
10384
11213
|
tab,
|
|
@@ -10388,7 +11217,7 @@ function SettingsNav({
|
|
|
10388
11217
|
onTabChange
|
|
10389
11218
|
}
|
|
10390
11219
|
);
|
|
10391
|
-
return /* @__PURE__ */
|
|
11220
|
+
return /* @__PURE__ */ jsxs21(
|
|
10392
11221
|
"div",
|
|
10393
11222
|
{
|
|
10394
11223
|
className: "flex flex-col items-start shrink-0 relative overflow-y-auto",
|
|
@@ -10411,33 +11240,33 @@ function SettingsNav({
|
|
|
10411
11240
|
gap: "var(--spacing-5xl)"
|
|
10412
11241
|
},
|
|
10413
11242
|
children: [
|
|
10414
|
-
/* @__PURE__ */
|
|
10415
|
-
/* @__PURE__ */
|
|
10416
|
-
item("profile", (color) => /* @__PURE__ */
|
|
10417
|
-
item("workspaceList", (color) => /* @__PURE__ */
|
|
11243
|
+
/* @__PURE__ */ jsxs21("div", { className: "flex flex-col w-full", style: { gap: "var(--spacing-md)" }, children: [
|
|
11244
|
+
/* @__PURE__ */ jsx24("div", { style: { padding: "4px 12px", fontSize: 11, fontWeight: 500, color: MUTED_COLOR2, textTransform: "uppercase", letterSpacing: "0.08em" }, children: "Account" }),
|
|
11245
|
+
item("profile", (color) => /* @__PURE__ */ jsx24(SiconUser, { className: "w-5 h-5", color })),
|
|
11246
|
+
item("workspaceList", (color) => /* @__PURE__ */ jsx24(SiconSwitch, { className: "w-5 h-5", color }))
|
|
10418
11247
|
] }),
|
|
10419
|
-
/* @__PURE__ */
|
|
10420
|
-
/* @__PURE__ */
|
|
10421
|
-
/* @__PURE__ */
|
|
10422
|
-
item("workspace", (color) => /* @__PURE__ */
|
|
10423
|
-
item("workspaceMembers", (color) => /* @__PURE__ */
|
|
10424
|
-
isWorkspaceAdmin && /* @__PURE__ */
|
|
10425
|
-
item("billing", (color) => /* @__PURE__ */
|
|
10426
|
-
item("apikey", (color) => /* @__PURE__ */
|
|
11248
|
+
/* @__PURE__ */ jsx24(ScHDivider, {}),
|
|
11249
|
+
/* @__PURE__ */ jsxs21("div", { className: "flex flex-col w-full", style: { gap: "var(--spacing-md)" }, children: [
|
|
11250
|
+
/* @__PURE__ */ jsx24("div", { title: workspaceName ?? void 0, style: { padding: "4px 12px", fontSize: 11, fontWeight: 500, color: MUTED_COLOR2, textTransform: "uppercase", letterSpacing: "0.08em" }, children: "Workspace" }),
|
|
11251
|
+
item("workspace", (color) => /* @__PURE__ */ jsx24(SiconSettings2, { className: "w-5 h-5", color })),
|
|
11252
|
+
item("workspaceMembers", (color) => /* @__PURE__ */ jsx24(SiconTeam, { className: "w-5 h-5", color })),
|
|
11253
|
+
isWorkspaceAdmin && /* @__PURE__ */ jsxs21(Fragment12, { children: [
|
|
11254
|
+
item("billing", (color) => /* @__PURE__ */ jsx24(SiconBilling, { className: "w-5 h-5", color })),
|
|
11255
|
+
item("apikey", (color) => /* @__PURE__ */ jsx24(SiconKey_default, { className: "w-5 h-5", color }))
|
|
10427
11256
|
] }),
|
|
10428
|
-
!isWorkspaceAdmin && /* @__PURE__ */
|
|
11257
|
+
!isWorkspaceAdmin && /* @__PURE__ */ jsx24("p", { style: { margin: "4px 12px", fontSize: 12, lineHeight: "18px", color: MUTED_COLOR2 }, children: "Contact your workspace admin for credit top-ups and billing history." })
|
|
10429
11258
|
] }),
|
|
10430
|
-
/* @__PURE__ */
|
|
10431
|
-
/* @__PURE__ */
|
|
10432
|
-
/* @__PURE__ */
|
|
10433
|
-
item("organization", (color) => /* @__PURE__ */
|
|
10434
|
-
item("organizationWorkspaces", (color) => /* @__PURE__ */
|
|
10435
|
-
] }) : /* @__PURE__ */
|
|
11259
|
+
/* @__PURE__ */ jsx24(ScHDivider, {}),
|
|
11260
|
+
/* @__PURE__ */ jsx24("div", { className: "flex flex-col w-full", style: { gap: "var(--spacing-md)" }, children: hasOrganization ? /* @__PURE__ */ jsxs21(Fragment12, { children: [
|
|
11261
|
+
/* @__PURE__ */ jsx24("div", { style: { padding: "4px 12px", fontSize: 11, fontWeight: 500, color: MUTED_COLOR2, textTransform: "uppercase", letterSpacing: "0.08em" }, children: "Organization" }),
|
|
11262
|
+
item("organization", (color) => /* @__PURE__ */ jsx24(SiconTeam, { className: "w-5 h-5", color })),
|
|
11263
|
+
item("organizationWorkspaces", (color) => /* @__PURE__ */ jsx24(SiconWorkspace2, { className: "w-5 h-5", color }))
|
|
11264
|
+
] }) : /* @__PURE__ */ jsx24(
|
|
10436
11265
|
SettingsNavItem,
|
|
10437
11266
|
{
|
|
10438
11267
|
tab: "organization",
|
|
10439
11268
|
label: "Organization",
|
|
10440
|
-
icon: (color) => /* @__PURE__ */
|
|
11269
|
+
icon: (color) => /* @__PURE__ */ jsx24(SiconGlobe3, { className: "w-5 h-5", color }),
|
|
10441
11270
|
activeTab,
|
|
10442
11271
|
onTabChange
|
|
10443
11272
|
}
|
|
@@ -10449,7 +11278,7 @@ function SettingsNav({
|
|
|
10449
11278
|
var SPECIALIZATION_ICON_SIZE = 24;
|
|
10450
11279
|
function SpecializationIcon({ iconUrl }) {
|
|
10451
11280
|
if (iconUrl) {
|
|
10452
|
-
return /* @__PURE__ */
|
|
11281
|
+
return /* @__PURE__ */ jsx24(
|
|
10453
11282
|
"img",
|
|
10454
11283
|
{
|
|
10455
11284
|
src: iconUrl,
|
|
@@ -10462,7 +11291,7 @@ function SpecializationIcon({ iconUrl }) {
|
|
|
10462
11291
|
}
|
|
10463
11292
|
);
|
|
10464
11293
|
}
|
|
10465
|
-
return /* @__PURE__ */
|
|
11294
|
+
return /* @__PURE__ */ jsx24(
|
|
10466
11295
|
SiconBolt,
|
|
10467
11296
|
{
|
|
10468
11297
|
style: {
|
|
@@ -10494,10 +11323,10 @@ function SpecializationDropdown({
|
|
|
10494
11323
|
disabled
|
|
10495
11324
|
}) {
|
|
10496
11325
|
const { auth } = useSettingsAdapters();
|
|
10497
|
-
const [open, setOpen] =
|
|
10498
|
-
const containerRef =
|
|
10499
|
-
const [options, setOptions] =
|
|
10500
|
-
|
|
11326
|
+
const [open, setOpen] = useState17(false);
|
|
11327
|
+
const containerRef = useRef8(null);
|
|
11328
|
+
const [options, setOptions] = useState17([]);
|
|
11329
|
+
useEffect15(() => {
|
|
10501
11330
|
if (!auth.getSpecializations) return;
|
|
10502
11331
|
let cancelled = false;
|
|
10503
11332
|
auth.getSpecializations().then((items) => {
|
|
@@ -10517,7 +11346,7 @@ function SpecializationDropdown({
|
|
|
10517
11346
|
cancelled = true;
|
|
10518
11347
|
};
|
|
10519
11348
|
}, [auth]);
|
|
10520
|
-
|
|
11349
|
+
useEffect15(() => {
|
|
10521
11350
|
if (!open) return;
|
|
10522
11351
|
function handleMouseDown(e) {
|
|
10523
11352
|
if (containerRef.current && !containerRef.current.contains(e.target)) {
|
|
@@ -10535,15 +11364,15 @@ function SpecializationDropdown({
|
|
|
10535
11364
|
};
|
|
10536
11365
|
}, [open]);
|
|
10537
11366
|
const selected = options.find((o) => o.id === value);
|
|
10538
|
-
return /* @__PURE__ */
|
|
11367
|
+
return /* @__PURE__ */ jsxs21(
|
|
10539
11368
|
"div",
|
|
10540
11369
|
{
|
|
10541
11370
|
ref: containerRef,
|
|
10542
11371
|
className: "w-full",
|
|
10543
11372
|
style: { position: "relative" },
|
|
10544
11373
|
children: [
|
|
10545
|
-
/* @__PURE__ */
|
|
10546
|
-
/* @__PURE__ */
|
|
11374
|
+
/* @__PURE__ */ jsx24("style", { children: DROPDOWN_TRIGGER_STYLES }),
|
|
11375
|
+
/* @__PURE__ */ jsx24(
|
|
10547
11376
|
"div",
|
|
10548
11377
|
{
|
|
10549
11378
|
className: "spec-dropdown-trigger",
|
|
@@ -10551,7 +11380,7 @@ function SpecializationDropdown({
|
|
|
10551
11380
|
onClick: () => !disabled && setOpen((v) => !v),
|
|
10552
11381
|
"aria-haspopup": "listbox",
|
|
10553
11382
|
"aria-expanded": open,
|
|
10554
|
-
children: /* @__PURE__ */
|
|
11383
|
+
children: /* @__PURE__ */ jsx24(
|
|
10555
11384
|
ScTextField,
|
|
10556
11385
|
{
|
|
10557
11386
|
label: "Specialization",
|
|
@@ -10559,8 +11388,8 @@ function SpecializationDropdown({
|
|
|
10559
11388
|
value: selected?.label ?? "",
|
|
10560
11389
|
placeholderFilled: "Select specialization",
|
|
10561
11390
|
tfGroup: "icon-left-right",
|
|
10562
|
-
tfLeftIcon: /* @__PURE__ */
|
|
10563
|
-
tfRightIcon: /* @__PURE__ */
|
|
11391
|
+
tfLeftIcon: /* @__PURE__ */ jsx24(SpecializationIcon, { iconUrl: selected?.iconUrl }),
|
|
11392
|
+
tfRightIcon: /* @__PURE__ */ jsx24(
|
|
10564
11393
|
"span",
|
|
10565
11394
|
{
|
|
10566
11395
|
style: {
|
|
@@ -10570,7 +11399,7 @@ function SpecializationDropdown({
|
|
|
10570
11399
|
transform: open ? "rotate(180deg)" : "none",
|
|
10571
11400
|
transition: "transform 120ms ease-out"
|
|
10572
11401
|
},
|
|
10573
|
-
children: /* @__PURE__ */
|
|
11402
|
+
children: /* @__PURE__ */ jsx24(SiconDown, {})
|
|
10574
11403
|
}
|
|
10575
11404
|
),
|
|
10576
11405
|
className: "sc-text-field-full-width",
|
|
@@ -10581,7 +11410,7 @@ function SpecializationDropdown({
|
|
|
10581
11410
|
)
|
|
10582
11411
|
}
|
|
10583
11412
|
),
|
|
10584
|
-
open && /* @__PURE__ */
|
|
11413
|
+
open && /* @__PURE__ */ jsx24(
|
|
10585
11414
|
"div",
|
|
10586
11415
|
{
|
|
10587
11416
|
role: "listbox",
|
|
@@ -10603,11 +11432,11 @@ function SpecializationDropdown({
|
|
|
10603
11432
|
},
|
|
10604
11433
|
children: options.map((opt) => {
|
|
10605
11434
|
const isActive = opt.id === value;
|
|
10606
|
-
return /* @__PURE__ */
|
|
11435
|
+
return /* @__PURE__ */ jsx24(
|
|
10607
11436
|
ScMenuOptions,
|
|
10608
11437
|
{
|
|
10609
11438
|
text: opt.label,
|
|
10610
|
-
icon: /* @__PURE__ */
|
|
11439
|
+
icon: /* @__PURE__ */ jsx24(SpecializationIcon, { iconUrl: opt.iconUrl }),
|
|
10611
11440
|
hover: isActive ? "true" : "false",
|
|
10612
11441
|
variant: "default",
|
|
10613
11442
|
role: "option",
|
|
@@ -10632,9 +11461,9 @@ function LanguageDropdown({
|
|
|
10632
11461
|
onChange,
|
|
10633
11462
|
disabled
|
|
10634
11463
|
}) {
|
|
10635
|
-
const [open, setOpen] =
|
|
10636
|
-
const containerRef =
|
|
10637
|
-
|
|
11464
|
+
const [open, setOpen] = useState17(false);
|
|
11465
|
+
const containerRef = useRef8(null);
|
|
11466
|
+
useEffect15(() => {
|
|
10638
11467
|
if (!open) return;
|
|
10639
11468
|
function handleMouseDown(e) {
|
|
10640
11469
|
if (containerRef.current && !containerRef.current.contains(e.target)) {
|
|
@@ -10651,15 +11480,15 @@ function LanguageDropdown({
|
|
|
10651
11480
|
document.removeEventListener("keydown", handleKeyDown);
|
|
10652
11481
|
};
|
|
10653
11482
|
}, [open]);
|
|
10654
|
-
return /* @__PURE__ */
|
|
11483
|
+
return /* @__PURE__ */ jsxs21(
|
|
10655
11484
|
"div",
|
|
10656
11485
|
{
|
|
10657
11486
|
ref: containerRef,
|
|
10658
11487
|
className: "w-full",
|
|
10659
11488
|
style: { position: "relative" },
|
|
10660
11489
|
children: [
|
|
10661
|
-
/* @__PURE__ */
|
|
10662
|
-
/* @__PURE__ */
|
|
11490
|
+
/* @__PURE__ */ jsx24("style", { children: DROPDOWN_TRIGGER_STYLES }),
|
|
11491
|
+
/* @__PURE__ */ jsx24(
|
|
10663
11492
|
"div",
|
|
10664
11493
|
{
|
|
10665
11494
|
className: "spec-dropdown-trigger",
|
|
@@ -10667,7 +11496,7 @@ function LanguageDropdown({
|
|
|
10667
11496
|
onClick: () => !disabled && setOpen((v) => !v),
|
|
10668
11497
|
"aria-haspopup": "listbox",
|
|
10669
11498
|
"aria-expanded": open,
|
|
10670
|
-
children: /* @__PURE__ */
|
|
11499
|
+
children: /* @__PURE__ */ jsx24(
|
|
10671
11500
|
ScTextField,
|
|
10672
11501
|
{
|
|
10673
11502
|
label: "Language",
|
|
@@ -10675,7 +11504,7 @@ function LanguageDropdown({
|
|
|
10675
11504
|
value: userLanguageLabel(value),
|
|
10676
11505
|
placeholderFilled: "Select language",
|
|
10677
11506
|
tfGroup: "icon-right",
|
|
10678
|
-
tfRightIcon: /* @__PURE__ */
|
|
11507
|
+
tfRightIcon: /* @__PURE__ */ jsx24(
|
|
10679
11508
|
"span",
|
|
10680
11509
|
{
|
|
10681
11510
|
style: {
|
|
@@ -10685,7 +11514,7 @@ function LanguageDropdown({
|
|
|
10685
11514
|
transform: open ? "rotate(180deg)" : "none",
|
|
10686
11515
|
transition: "transform 120ms ease-out"
|
|
10687
11516
|
},
|
|
10688
|
-
children: /* @__PURE__ */
|
|
11517
|
+
children: /* @__PURE__ */ jsx24(SiconDown, {})
|
|
10689
11518
|
}
|
|
10690
11519
|
),
|
|
10691
11520
|
className: "sc-text-field-full-width",
|
|
@@ -10696,7 +11525,7 @@ function LanguageDropdown({
|
|
|
10696
11525
|
)
|
|
10697
11526
|
}
|
|
10698
11527
|
),
|
|
10699
|
-
open && /* @__PURE__ */
|
|
11528
|
+
open && /* @__PURE__ */ jsx24(
|
|
10700
11529
|
"div",
|
|
10701
11530
|
{
|
|
10702
11531
|
role: "listbox",
|
|
@@ -10722,11 +11551,11 @@ function LanguageDropdown({
|
|
|
10722
11551
|
},
|
|
10723
11552
|
children: USER_LANGUAGES.map((lang) => {
|
|
10724
11553
|
const isActive = lang.code === value;
|
|
10725
|
-
return /* @__PURE__ */
|
|
11554
|
+
return /* @__PURE__ */ jsx24(
|
|
10726
11555
|
ScMenuOptions,
|
|
10727
11556
|
{
|
|
10728
11557
|
text: lang.label,
|
|
10729
|
-
icon: /* @__PURE__ */
|
|
11558
|
+
icon: /* @__PURE__ */ jsx24(Fragment12, {}),
|
|
10730
11559
|
hover: isActive ? "true" : "false",
|
|
10731
11560
|
variant: "default",
|
|
10732
11561
|
role: "option",
|
|
@@ -10752,28 +11581,28 @@ function ProfileTab() {
|
|
|
10752
11581
|
const derivedName = user?.name ?? "";
|
|
10753
11582
|
const derivedSpec = user?.userSpecialization ?? "";
|
|
10754
11583
|
const derivedLanguage = user?.language?.trim() || DEFAULT_USER_LANGUAGE;
|
|
10755
|
-
const [fullName, setFullName] =
|
|
10756
|
-
const [selectedSpec, setSelectedSpec] =
|
|
10757
|
-
const [selectedLanguage, setSelectedLanguage] =
|
|
10758
|
-
const [saving, setSaving] =
|
|
10759
|
-
const [imageSaving, setImageSaving] =
|
|
10760
|
-
const [imagePreview, setImagePreview] =
|
|
11584
|
+
const [fullName, setFullName] = useState17(derivedName);
|
|
11585
|
+
const [selectedSpec, setSelectedSpec] = useState17(derivedSpec);
|
|
11586
|
+
const [selectedLanguage, setSelectedLanguage] = useState17(derivedLanguage);
|
|
11587
|
+
const [saving, setSaving] = useState17(false);
|
|
11588
|
+
const [imageSaving, setImageSaving] = useState17(false);
|
|
11589
|
+
const [imagePreview, setImagePreview] = useState17(
|
|
10761
11590
|
void 0
|
|
10762
11591
|
);
|
|
10763
|
-
const fileInputRef =
|
|
11592
|
+
const fileInputRef = useRef8(null);
|
|
10764
11593
|
const profileDisplayName = fullName || user?.email || "User";
|
|
10765
11594
|
const profileImage = imagePreview ?? getUserProfileImage(user);
|
|
10766
11595
|
const profileInitial = profileDisplayName.charAt(0).toUpperCase();
|
|
10767
11596
|
const disableAllActions = saving || imageSaving;
|
|
10768
11597
|
const dirty = fullName.trim() !== derivedName || selectedSpec !== derivedSpec || selectedLanguage !== derivedLanguage;
|
|
10769
|
-
|
|
11598
|
+
useEffect15(() => {
|
|
10770
11599
|
setFullName(derivedName);
|
|
10771
11600
|
setImagePreview(void 0);
|
|
10772
11601
|
}, [derivedName]);
|
|
10773
|
-
|
|
11602
|
+
useEffect15(() => {
|
|
10774
11603
|
setSelectedSpec(derivedSpec);
|
|
10775
11604
|
}, [derivedSpec]);
|
|
10776
|
-
|
|
11605
|
+
useEffect15(() => {
|
|
10777
11606
|
setSelectedLanguage(derivedLanguage);
|
|
10778
11607
|
}, [derivedLanguage]);
|
|
10779
11608
|
const handleSave = async () => {
|
|
@@ -10855,13 +11684,13 @@ function ProfileTab() {
|
|
|
10855
11684
|
}
|
|
10856
11685
|
auth.clearAuth();
|
|
10857
11686
|
};
|
|
10858
|
-
return /* @__PURE__ */
|
|
11687
|
+
return /* @__PURE__ */ jsxs21(
|
|
10859
11688
|
"div",
|
|
10860
11689
|
{
|
|
10861
11690
|
className: "flex flex-col items-start flex-1 min-w-0 min-h-0 overflow-y-auto",
|
|
10862
11691
|
style: { gap: "var(--spacing-3xl)" },
|
|
10863
11692
|
children: [
|
|
10864
|
-
/* @__PURE__ */
|
|
11693
|
+
/* @__PURE__ */ jsxs21(
|
|
10865
11694
|
"div",
|
|
10866
11695
|
{
|
|
10867
11696
|
className: "sc-profile-card flex flex-col items-start w-full",
|
|
@@ -10874,13 +11703,13 @@ function ProfileTab() {
|
|
|
10874
11703
|
gap: "var(--spacing-6xl)"
|
|
10875
11704
|
},
|
|
10876
11705
|
children: [
|
|
10877
|
-
/* @__PURE__ */
|
|
11706
|
+
/* @__PURE__ */ jsxs21(
|
|
10878
11707
|
"div",
|
|
10879
11708
|
{
|
|
10880
11709
|
className: "flex items-center shrink-0 w-full",
|
|
10881
11710
|
style: { gap: 24, flexWrap: "wrap" },
|
|
10882
11711
|
children: [
|
|
10883
|
-
profileImage ? /* @__PURE__ */
|
|
11712
|
+
profileImage ? /* @__PURE__ */ jsx24(
|
|
10884
11713
|
"img",
|
|
10885
11714
|
{
|
|
10886
11715
|
src: profileImage,
|
|
@@ -10893,7 +11722,7 @@ function ProfileTab() {
|
|
|
10893
11722
|
flexShrink: 0
|
|
10894
11723
|
}
|
|
10895
11724
|
}
|
|
10896
|
-
) : /* @__PURE__ */
|
|
11725
|
+
) : /* @__PURE__ */ jsx24(
|
|
10897
11726
|
"div",
|
|
10898
11727
|
{
|
|
10899
11728
|
"aria-label": "Profile",
|
|
@@ -10906,7 +11735,7 @@ function ProfileTab() {
|
|
|
10906
11735
|
border: "1px solid var(--alias-border-subtle)",
|
|
10907
11736
|
flexShrink: 0
|
|
10908
11737
|
},
|
|
10909
|
-
children: /* @__PURE__ */
|
|
11738
|
+
children: /* @__PURE__ */ jsx24(
|
|
10910
11739
|
"span",
|
|
10911
11740
|
{
|
|
10912
11741
|
style: {
|
|
@@ -10921,7 +11750,7 @@ function ProfileTab() {
|
|
|
10921
11750
|
)
|
|
10922
11751
|
}
|
|
10923
11752
|
),
|
|
10924
|
-
/* @__PURE__ */
|
|
11753
|
+
/* @__PURE__ */ jsx24(
|
|
10925
11754
|
"input",
|
|
10926
11755
|
{
|
|
10927
11756
|
ref: fileInputRef,
|
|
@@ -10931,17 +11760,17 @@ function ProfileTab() {
|
|
|
10931
11760
|
onChange: handleImageChange
|
|
10932
11761
|
}
|
|
10933
11762
|
),
|
|
10934
|
-
/* @__PURE__ */
|
|
11763
|
+
/* @__PURE__ */ jsxs21(
|
|
10935
11764
|
"div",
|
|
10936
11765
|
{
|
|
10937
11766
|
className: "flex items-center",
|
|
10938
11767
|
style: { gap: 12, flexWrap: "wrap" },
|
|
10939
11768
|
children: [
|
|
10940
|
-
/* @__PURE__ */
|
|
10941
|
-
|
|
11769
|
+
/* @__PURE__ */ jsx24(
|
|
11770
|
+
ScButton10,
|
|
10942
11771
|
{
|
|
10943
11772
|
text: "Upload photo",
|
|
10944
|
-
icon: /* @__PURE__ */
|
|
11773
|
+
icon: /* @__PURE__ */ jsx24(SiconUpload2, { className: "w-5 h-5", color: PRIMARY_COLOR3 }),
|
|
10945
11774
|
styleVariant: "icon-left",
|
|
10946
11775
|
variant: "outline",
|
|
10947
11776
|
size: "md",
|
|
@@ -10949,11 +11778,11 @@ function ProfileTab() {
|
|
|
10949
11778
|
onClick: handleUploadClick
|
|
10950
11779
|
}
|
|
10951
11780
|
),
|
|
10952
|
-
/* @__PURE__ */
|
|
10953
|
-
|
|
11781
|
+
/* @__PURE__ */ jsx24(
|
|
11782
|
+
ScButton10,
|
|
10954
11783
|
{
|
|
10955
11784
|
text: "Remove photo",
|
|
10956
|
-
icon: /* @__PURE__ */
|
|
11785
|
+
icon: /* @__PURE__ */ jsx24(
|
|
10957
11786
|
SiconDelete,
|
|
10958
11787
|
{
|
|
10959
11788
|
className: "w-5 h-5",
|
|
@@ -10973,15 +11802,15 @@ function ProfileTab() {
|
|
|
10973
11802
|
]
|
|
10974
11803
|
}
|
|
10975
11804
|
),
|
|
10976
|
-
/* @__PURE__ */
|
|
10977
|
-
/* @__PURE__ */
|
|
11805
|
+
/* @__PURE__ */ jsx24(ScHDivider, {}),
|
|
11806
|
+
/* @__PURE__ */ jsxs21(
|
|
10978
11807
|
"div",
|
|
10979
11808
|
{
|
|
10980
11809
|
className: "sc-profile-fields flex flex-col min-w-0 w-full",
|
|
10981
11810
|
style: { gap: 24 },
|
|
10982
11811
|
children: [
|
|
10983
|
-
/* @__PURE__ */
|
|
10984
|
-
/* @__PURE__ */
|
|
11812
|
+
/* @__PURE__ */ jsxs21("div", { style: { display: "grid", width: "100%", gridTemplateColumns: "repeat(auto-fit, minmax(min(100%, 240px), 1fr))", gap: 24 }, children: [
|
|
11813
|
+
/* @__PURE__ */ jsx24("div", { className: "flex-1 min-w-0", style: { overflow: "hidden" }, children: /* @__PURE__ */ jsx24(
|
|
10985
11814
|
ScTextField,
|
|
10986
11815
|
{
|
|
10987
11816
|
label: "Full Name",
|
|
@@ -10995,7 +11824,7 @@ function ProfileTab() {
|
|
|
10995
11824
|
onChange: (e) => setFullName(e.target.value)
|
|
10996
11825
|
}
|
|
10997
11826
|
) }),
|
|
10998
|
-
/* @__PURE__ */
|
|
11827
|
+
/* @__PURE__ */ jsx24("div", { className: "flex-1 min-w-0", children: /* @__PURE__ */ jsx24(
|
|
10999
11828
|
SpecializationDropdown,
|
|
11000
11829
|
{
|
|
11001
11830
|
value: selectedSpec,
|
|
@@ -11004,8 +11833,8 @@ function ProfileTab() {
|
|
|
11004
11833
|
}
|
|
11005
11834
|
) })
|
|
11006
11835
|
] }),
|
|
11007
|
-
/* @__PURE__ */
|
|
11008
|
-
/* @__PURE__ */
|
|
11836
|
+
/* @__PURE__ */ jsxs21("div", { className: "flex items-start w-full", style: { gap: "var(--spacing-3xl)" }, children: [
|
|
11837
|
+
/* @__PURE__ */ jsx24("div", { className: "flex-1 min-w-0", children: /* @__PURE__ */ jsx24(
|
|
11009
11838
|
LanguageDropdown,
|
|
11010
11839
|
{
|
|
11011
11840
|
value: selectedLanguage,
|
|
@@ -11013,9 +11842,9 @@ function ProfileTab() {
|
|
|
11013
11842
|
disabled: disableAllActions
|
|
11014
11843
|
}
|
|
11015
11844
|
) }),
|
|
11016
|
-
/* @__PURE__ */
|
|
11845
|
+
/* @__PURE__ */ jsx24("div", { className: "flex-1 min-w-0" })
|
|
11017
11846
|
] }),
|
|
11018
|
-
/* @__PURE__ */
|
|
11847
|
+
/* @__PURE__ */ jsx24("div", { className: "w-full", style: { overflow: "hidden" }, children: /* @__PURE__ */ jsx24(
|
|
11019
11848
|
ScTextField,
|
|
11020
11849
|
{
|
|
11021
11850
|
label: "Email ID",
|
|
@@ -11024,7 +11853,7 @@ function ProfileTab() {
|
|
|
11024
11853
|
value: user?.email ?? "",
|
|
11025
11854
|
placeholderFilled: user?.email ?? "chris@kepler.com",
|
|
11026
11855
|
tfGroup: "icon-right",
|
|
11027
|
-
tfRightIcon: /* @__PURE__ */
|
|
11856
|
+
tfRightIcon: /* @__PURE__ */ jsx24(
|
|
11028
11857
|
SiconLock,
|
|
11029
11858
|
{
|
|
11030
11859
|
className: "w-6 h-6",
|
|
@@ -11036,13 +11865,13 @@ function ProfileTab() {
|
|
|
11036
11865
|
readOnly: true
|
|
11037
11866
|
}
|
|
11038
11867
|
) }),
|
|
11039
|
-
/* @__PURE__ */
|
|
11868
|
+
/* @__PURE__ */ jsx24(
|
|
11040
11869
|
"div",
|
|
11041
11870
|
{
|
|
11042
11871
|
className: "flex items-center w-full",
|
|
11043
11872
|
style: { justifyContent: "flex-end", paddingTop: "var(--spacing-md)" },
|
|
11044
|
-
children: /* @__PURE__ */
|
|
11045
|
-
|
|
11873
|
+
children: /* @__PURE__ */ jsx24(
|
|
11874
|
+
ScButton10,
|
|
11046
11875
|
{
|
|
11047
11876
|
text: saving ? "Saving..." : "Save changes",
|
|
11048
11877
|
variant: "secondary",
|
|
@@ -11059,7 +11888,7 @@ function ProfileTab() {
|
|
|
11059
11888
|
]
|
|
11060
11889
|
}
|
|
11061
11890
|
),
|
|
11062
|
-
/* @__PURE__ */
|
|
11891
|
+
/* @__PURE__ */ jsxs21(
|
|
11063
11892
|
"div",
|
|
11064
11893
|
{
|
|
11065
11894
|
className: "flex items-center w-full",
|
|
@@ -11071,8 +11900,8 @@ function ProfileTab() {
|
|
|
11071
11900
|
gap: "var(--spacing-3xl)"
|
|
11072
11901
|
},
|
|
11073
11902
|
children: [
|
|
11074
|
-
/* @__PURE__ */
|
|
11075
|
-
/* @__PURE__ */
|
|
11903
|
+
/* @__PURE__ */ jsxs21("div", { className: "flex flex-col min-w-0 flex-1", style: { gap: "var(--spacing-xs)" }, children: [
|
|
11904
|
+
/* @__PURE__ */ jsx24(
|
|
11076
11905
|
"span",
|
|
11077
11906
|
{
|
|
11078
11907
|
style: {
|
|
@@ -11085,7 +11914,7 @@ function ProfileTab() {
|
|
|
11085
11914
|
children: "Session"
|
|
11086
11915
|
}
|
|
11087
11916
|
),
|
|
11088
|
-
/* @__PURE__ */
|
|
11917
|
+
/* @__PURE__ */ jsx24(
|
|
11089
11918
|
"span",
|
|
11090
11919
|
{
|
|
11091
11920
|
className: "truncate",
|
|
@@ -11100,8 +11929,8 @@ function ProfileTab() {
|
|
|
11100
11929
|
}
|
|
11101
11930
|
)
|
|
11102
11931
|
] }),
|
|
11103
|
-
/* @__PURE__ */
|
|
11104
|
-
|
|
11932
|
+
/* @__PURE__ */ jsx24(
|
|
11933
|
+
ScButton10,
|
|
11105
11934
|
{
|
|
11106
11935
|
text: "Log out",
|
|
11107
11936
|
variant: "outline",
|
|
@@ -11164,11 +11993,11 @@ function WorkspaceListTab({
|
|
|
11164
11993
|
const currentOrganization = organizations.find(
|
|
11165
11994
|
(org) => org._id && org._id === currentWorkspace?.organizationId
|
|
11166
11995
|
);
|
|
11167
|
-
const [page, setPage] =
|
|
11168
|
-
const [serverPage, setServerPage] =
|
|
11169
|
-
const [serverFailed, setServerFailed] =
|
|
11996
|
+
const [page, setPage] = useState17(0);
|
|
11997
|
+
const [serverPage, setServerPage] = useState17(null);
|
|
11998
|
+
const [serverFailed, setServerFailed] = useState17(false);
|
|
11170
11999
|
const serverMode = !!listPage && !serverFailed;
|
|
11171
|
-
|
|
12000
|
+
useEffect15(() => {
|
|
11172
12001
|
if (!listPage || serverFailed) return;
|
|
11173
12002
|
let cancelled = false;
|
|
11174
12003
|
listPage({ limit: pageSize, offset: page * pageSize }).then((result) => {
|
|
@@ -11209,21 +12038,21 @@ function WorkspaceListTab({
|
|
|
11209
12038
|
const pageRows = serverMode ? (serverPage?.items ?? []).map((ws) => ({ ws, group: serverGroupOf(ws) })) : rows.slice(pageStart, pageStart + pageSize);
|
|
11210
12039
|
const pageWorkspaces = pageRows.map((row) => row.ws);
|
|
11211
12040
|
const listLoading = loading || serverMode && !serverPage;
|
|
11212
|
-
const [plans, setPlans] =
|
|
11213
|
-
const requestedPlans =
|
|
12041
|
+
const [plans, setPlans] = useState17({});
|
|
12042
|
+
const requestedPlans = useRef8(/* @__PURE__ */ new Set());
|
|
11214
12043
|
const visibleIds = [
|
|
11215
12044
|
...currentWorkspace ? [currentWorkspace._id] : [],
|
|
11216
12045
|
...pageWorkspaces.map((ws) => ws._id)
|
|
11217
12046
|
];
|
|
11218
12047
|
const visibleKey = visibleIds.join(",");
|
|
11219
|
-
const mounted =
|
|
11220
|
-
|
|
12048
|
+
const mounted = useRef8(true);
|
|
12049
|
+
useEffect15(() => {
|
|
11221
12050
|
mounted.current = true;
|
|
11222
12051
|
return () => {
|
|
11223
12052
|
mounted.current = false;
|
|
11224
12053
|
};
|
|
11225
12054
|
}, []);
|
|
11226
|
-
|
|
12055
|
+
useEffect15(() => {
|
|
11227
12056
|
if (!fetchPlans || listLoading) return;
|
|
11228
12057
|
const missing = visibleKey.split(",").filter((id) => id && !requestedPlans.current.has(id));
|
|
11229
12058
|
if (!missing.length) return;
|
|
@@ -11234,13 +12063,13 @@ function WorkspaceListTab({
|
|
|
11234
12063
|
});
|
|
11235
12064
|
}, [fetchPlans, listLoading, visibleKey]);
|
|
11236
12065
|
const planOf = (ws) => fetchPlans ? plans[ws._id] ?? "" : ws.plan ?? "";
|
|
11237
|
-
return /* @__PURE__ */
|
|
12066
|
+
return /* @__PURE__ */ jsxs21(
|
|
11238
12067
|
"div",
|
|
11239
12068
|
{
|
|
11240
12069
|
className: "flex flex-col items-start flex-1 min-w-0",
|
|
11241
12070
|
style: { gap: "var(--spacing-3xl)", height: "100%" },
|
|
11242
12071
|
children: [
|
|
11243
|
-
/* @__PURE__ */
|
|
12072
|
+
/* @__PURE__ */ jsx24(
|
|
11244
12073
|
"p",
|
|
11245
12074
|
{
|
|
11246
12075
|
className: "shrink-0 w-full",
|
|
@@ -11253,7 +12082,7 @@ function WorkspaceListTab({
|
|
|
11253
12082
|
children: "Switching changes which workspace the rest of Settings acts on."
|
|
11254
12083
|
}
|
|
11255
12084
|
),
|
|
11256
|
-
listLoading && /* @__PURE__ */
|
|
12085
|
+
listLoading && /* @__PURE__ */ jsx24(
|
|
11257
12086
|
"p",
|
|
11258
12087
|
{
|
|
11259
12088
|
style: {
|
|
@@ -11264,13 +12093,13 @@ function WorkspaceListTab({
|
|
|
11264
12093
|
children: "Loading workspaces\u2026"
|
|
11265
12094
|
}
|
|
11266
12095
|
),
|
|
11267
|
-
!listLoading && currentWorkspace && /* @__PURE__ */
|
|
12096
|
+
!listLoading && currentWorkspace && /* @__PURE__ */ jsxs21(
|
|
11268
12097
|
"div",
|
|
11269
12098
|
{
|
|
11270
12099
|
className: "flex flex-col items-start shrink-0 w-full",
|
|
11271
12100
|
style: { gap: 16, padding: "var(--spacing-md) 0" },
|
|
11272
12101
|
children: [
|
|
11273
|
-
/* @__PURE__ */
|
|
12102
|
+
/* @__PURE__ */ jsxs21(
|
|
11274
12103
|
"p",
|
|
11275
12104
|
{
|
|
11276
12105
|
className: "w-full overflow-hidden text-ellipsis whitespace-nowrap",
|
|
@@ -11287,7 +12116,7 @@ function WorkspaceListTab({
|
|
|
11287
12116
|
]
|
|
11288
12117
|
}
|
|
11289
12118
|
),
|
|
11290
|
-
/* @__PURE__ */
|
|
12119
|
+
/* @__PURE__ */ jsx24(
|
|
11291
12120
|
ScWorkspaceSwitchCard,
|
|
11292
12121
|
{
|
|
11293
12122
|
wsName: currentWorkspace.name,
|
|
@@ -11304,7 +12133,7 @@ function WorkspaceListTab({
|
|
|
11304
12133
|
]
|
|
11305
12134
|
}
|
|
11306
12135
|
),
|
|
11307
|
-
!listLoading && currentWorkspace && listTotal > 0 && /* @__PURE__ */
|
|
12136
|
+
!listLoading && currentWorkspace && listTotal > 0 && /* @__PURE__ */ jsx24(
|
|
11308
12137
|
"div",
|
|
11309
12138
|
{
|
|
11310
12139
|
className: "shrink-0 w-full",
|
|
@@ -11314,19 +12143,19 @@ function WorkspaceListTab({
|
|
|
11314
12143
|
}
|
|
11315
12144
|
}
|
|
11316
12145
|
),
|
|
11317
|
-
!listLoading && listTotal > 0 && /* @__PURE__ */
|
|
12146
|
+
!listLoading && listTotal > 0 && /* @__PURE__ */ jsxs21(
|
|
11318
12147
|
"div",
|
|
11319
12148
|
{
|
|
11320
12149
|
className: "flex flex-col items-start flex-1 min-h-0 w-full",
|
|
11321
12150
|
style: { gap: 16, overflowY: "auto" },
|
|
11322
12151
|
children: [
|
|
11323
|
-
/* @__PURE__ */
|
|
12152
|
+
/* @__PURE__ */ jsx24(
|
|
11324
12153
|
"div",
|
|
11325
12154
|
{
|
|
11326
12155
|
className: "flex flex-col items-start w-full",
|
|
11327
12156
|
style: { gap: 16 },
|
|
11328
|
-
children: pageRows.map(({ ws, group }, index) => /* @__PURE__ */
|
|
11329
|
-
(index === 0 || pageRows[index - 1].group.key !== group.key) && /* @__PURE__ */
|
|
12157
|
+
children: pageRows.map(({ ws, group }, index) => /* @__PURE__ */ jsxs21(Fragment11, { children: [
|
|
12158
|
+
(index === 0 || pageRows[index - 1].group.key !== group.key) && /* @__PURE__ */ jsx24(
|
|
11330
12159
|
"p",
|
|
11331
12160
|
{
|
|
11332
12161
|
className: "w-full overflow-hidden text-ellipsis whitespace-nowrap shrink-0",
|
|
@@ -11341,7 +12170,7 @@ function WorkspaceListTab({
|
|
|
11341
12170
|
children: group.label
|
|
11342
12171
|
}
|
|
11343
12172
|
),
|
|
11344
|
-
/* @__PURE__ */
|
|
12173
|
+
/* @__PURE__ */ jsx24(
|
|
11345
12174
|
ScWorkspaceSwitchCard,
|
|
11346
12175
|
{
|
|
11347
12176
|
wsName: ws.name,
|
|
@@ -11359,13 +12188,13 @@ function WorkspaceListTab({
|
|
|
11359
12188
|
] }, ws._id))
|
|
11360
12189
|
}
|
|
11361
12190
|
),
|
|
11362
|
-
pageCount > 1 && /* @__PURE__ */
|
|
12191
|
+
pageCount > 1 && /* @__PURE__ */ jsxs21(
|
|
11363
12192
|
"div",
|
|
11364
12193
|
{
|
|
11365
12194
|
className: "flex items-center justify-between shrink-0 w-full",
|
|
11366
12195
|
style: { gap: "var(--spacing-md)" },
|
|
11367
12196
|
children: [
|
|
11368
|
-
/* @__PURE__ */
|
|
12197
|
+
/* @__PURE__ */ jsxs21(
|
|
11369
12198
|
"span",
|
|
11370
12199
|
{
|
|
11371
12200
|
style: {
|
|
@@ -11384,9 +12213,9 @@ function WorkspaceListTab({
|
|
|
11384
12213
|
]
|
|
11385
12214
|
}
|
|
11386
12215
|
),
|
|
11387
|
-
/* @__PURE__ */
|
|
11388
|
-
/* @__PURE__ */
|
|
11389
|
-
|
|
12216
|
+
/* @__PURE__ */ jsxs21("div", { className: "flex items-center", style: { gap: "var(--spacing-md)" }, children: [
|
|
12217
|
+
/* @__PURE__ */ jsx24(
|
|
12218
|
+
ScButton10,
|
|
11390
12219
|
{
|
|
11391
12220
|
text: "Previous",
|
|
11392
12221
|
variant: "tertiary",
|
|
@@ -11395,8 +12224,8 @@ function WorkspaceListTab({
|
|
|
11395
12224
|
onClick: safePage === 0 ? void 0 : () => setPage(safePage - 1)
|
|
11396
12225
|
}
|
|
11397
12226
|
),
|
|
11398
|
-
/* @__PURE__ */
|
|
11399
|
-
|
|
12227
|
+
/* @__PURE__ */ jsx24(
|
|
12228
|
+
ScButton10,
|
|
11400
12229
|
{
|
|
11401
12230
|
text: "Next",
|
|
11402
12231
|
variant: "tertiary",
|
|
@@ -11423,12 +12252,12 @@ function ReferralTab() {
|
|
|
11423
12252
|
const referralCode = (user?.referralCode ?? user?.referral_code ?? user?.referalCode ?? user?.referal_code ?? "").trim();
|
|
11424
12253
|
const domain = typeof window !== "undefined" ? window.location.origin : "";
|
|
11425
12254
|
const referralLink = referralCode && domain ? `${domain}?referral_code=${encodeURIComponent(referralCode)}` : "";
|
|
11426
|
-
return /* @__PURE__ */
|
|
12255
|
+
return /* @__PURE__ */ jsx24(
|
|
11427
12256
|
"div",
|
|
11428
12257
|
{
|
|
11429
12258
|
className: "flex flex-col items-start flex-1 min-w-0",
|
|
11430
12259
|
style: { gap: "var(--spacing-3xl)" },
|
|
11431
|
-
children: /* @__PURE__ */
|
|
12260
|
+
children: /* @__PURE__ */ jsx24(
|
|
11432
12261
|
"div",
|
|
11433
12262
|
{
|
|
11434
12263
|
className: "w-full relative",
|
|
@@ -11437,13 +12266,13 @@ function ReferralTab() {
|
|
|
11437
12266
|
borderRadius: "var(--radius-3xl)",
|
|
11438
12267
|
padding: "var(--spacing-6xl)"
|
|
11439
12268
|
},
|
|
11440
|
-
children: /* @__PURE__ */
|
|
12269
|
+
children: /* @__PURE__ */ jsxs21(
|
|
11441
12270
|
"div",
|
|
11442
12271
|
{
|
|
11443
12272
|
className: "flex items-start w-full",
|
|
11444
12273
|
style: { gap: "var(--spacing-3xl)" },
|
|
11445
12274
|
children: [
|
|
11446
|
-
/* @__PURE__ */
|
|
12275
|
+
/* @__PURE__ */ jsx24(
|
|
11447
12276
|
ScTextField,
|
|
11448
12277
|
{
|
|
11449
12278
|
label: "Your Referral Link",
|
|
@@ -11452,7 +12281,7 @@ function ReferralTab() {
|
|
|
11452
12281
|
value: referralLink,
|
|
11453
12282
|
placeholderFilled: "https://your-domain.com?referral_code=ABC123",
|
|
11454
12283
|
tfGroup: "icon-right",
|
|
11455
|
-
tfRightIcon: /* @__PURE__ */
|
|
12284
|
+
tfRightIcon: /* @__PURE__ */ jsx24(
|
|
11456
12285
|
SiconBolt,
|
|
11457
12286
|
{
|
|
11458
12287
|
className: "w-6 h-6",
|
|
@@ -11463,7 +12292,7 @@ function ReferralTab() {
|
|
|
11463
12292
|
readOnly: true
|
|
11464
12293
|
}
|
|
11465
12294
|
),
|
|
11466
|
-
/* @__PURE__ */
|
|
12295
|
+
/* @__PURE__ */ jsx24(
|
|
11467
12296
|
ScTextField,
|
|
11468
12297
|
{
|
|
11469
12298
|
label: "Invite through email",
|
|
@@ -11472,7 +12301,7 @@ function ReferralTab() {
|
|
|
11472
12301
|
value: user?.email ?? "",
|
|
11473
12302
|
placeholderFilled: "chris@kepler.com",
|
|
11474
12303
|
tfGroup: "icon-right",
|
|
11475
|
-
tfRightIcon: /* @__PURE__ */
|
|
12304
|
+
tfRightIcon: /* @__PURE__ */ jsx24(
|
|
11476
12305
|
SiconSend,
|
|
11477
12306
|
{
|
|
11478
12307
|
className: "w-6 h-6",
|
|
@@ -11497,7 +12326,7 @@ function SettingsContent({
|
|
|
11497
12326
|
onBack,
|
|
11498
12327
|
hiddenApps
|
|
11499
12328
|
}) {
|
|
11500
|
-
return /* @__PURE__ */
|
|
12329
|
+
return /* @__PURE__ */ jsx24(SettingsAdaptersProvider, { adapters, children: /* @__PURE__ */ jsx24(
|
|
11501
12330
|
SettingsContentInner,
|
|
11502
12331
|
{
|
|
11503
12332
|
activeTab,
|
|
@@ -11526,11 +12355,11 @@ function SettingsContentInner({
|
|
|
11526
12355
|
const workspaceId = workspace.current?.id ?? null;
|
|
11527
12356
|
const workspaceOwner = useWorkspaceOrganization({ workspaceId, request: workspace.organizationRequest ?? unavailableOrganizationRequest, enabled: !!workspace.organizationRequest });
|
|
11528
12357
|
const workspaceOwnerName = workspace.organizationRequest ? workspaceOwner.organizationName : void 0;
|
|
11529
|
-
const [workspaceList, setWorkspaceList] =
|
|
12358
|
+
const [workspaceList, setWorkspaceList] = useState17([]);
|
|
11530
12359
|
const currentWorkspaceRole = workspace.current?.role ?? workspaceList.find((item) => item._id === workspaceId)?.role;
|
|
11531
12360
|
const isWorkspaceAdmin = currentWorkspaceRole?.trim().toLowerCase() === "admin";
|
|
11532
|
-
const [workspaceListLoading, setWorkspaceListLoading] =
|
|
11533
|
-
const refreshWorkspaceList =
|
|
12361
|
+
const [workspaceListLoading, setWorkspaceListLoading] = useState17(false);
|
|
12362
|
+
const refreshWorkspaceList = useCallback8(async () => {
|
|
11534
12363
|
setWorkspaceListLoading(true);
|
|
11535
12364
|
try {
|
|
11536
12365
|
const items = await workspace.list();
|
|
@@ -11551,11 +12380,11 @@ function SettingsContentInner({
|
|
|
11551
12380
|
setWorkspaceListLoading(false);
|
|
11552
12381
|
}
|
|
11553
12382
|
}, [workspace, workspaceId]);
|
|
11554
|
-
|
|
12383
|
+
useEffect15(() => {
|
|
11555
12384
|
void refreshWorkspaceList();
|
|
11556
12385
|
}, [refreshWorkspaceList]);
|
|
11557
12386
|
const hostListPage = workspace.listPage;
|
|
11558
|
-
const listWorkspacePage =
|
|
12387
|
+
const listWorkspacePage = useMemo5(
|
|
11559
12388
|
() => hostListPage ? async (params) => {
|
|
11560
12389
|
const result = await hostListPage(params);
|
|
11561
12390
|
return {
|
|
@@ -11572,8 +12401,8 @@ function SettingsContentInner({
|
|
|
11572
12401
|
} : void 0,
|
|
11573
12402
|
[hostListPage, workspaceId]
|
|
11574
12403
|
);
|
|
11575
|
-
const [listOrganizations, setListOrganizations] =
|
|
11576
|
-
|
|
12404
|
+
const [listOrganizations, setListOrganizations] = useState17([]);
|
|
12405
|
+
useEffect15(() => {
|
|
11577
12406
|
if (activeTab !== "workspaceList" || typeof organization?.list !== "function") {
|
|
11578
12407
|
return;
|
|
11579
12408
|
}
|
|
@@ -11594,7 +12423,7 @@ function SettingsContentInner({
|
|
|
11594
12423
|
cancelled = true;
|
|
11595
12424
|
};
|
|
11596
12425
|
}, [activeTab, organization]);
|
|
11597
|
-
const switchWorkspace =
|
|
12426
|
+
const switchWorkspace = useCallback8(
|
|
11598
12427
|
async (id) => {
|
|
11599
12428
|
await workspace.switch(id);
|
|
11600
12429
|
},
|
|
@@ -11603,17 +12432,27 @@ function SettingsContentInner({
|
|
|
11603
12432
|
const setActiveTab = (tab) => {
|
|
11604
12433
|
navigation.navigateToTab(tab);
|
|
11605
12434
|
};
|
|
11606
|
-
const [creatingWorkspace, setCreatingWorkspace] =
|
|
11607
|
-
const [updatingWorkspace, setUpdatingWorkspace] =
|
|
11608
|
-
const [teamInviteOpen, setTeamInviteOpen] =
|
|
11609
|
-
const [tokenShowRevoked, setTokenShowRevoked] =
|
|
11610
|
-
const [tokenCreateOpen, setTokenCreateOpen] =
|
|
11611
|
-
const [billingShowPlans, setBillingShowPlans] =
|
|
12435
|
+
const [creatingWorkspace, setCreatingWorkspace] = useState17(false);
|
|
12436
|
+
const [updatingWorkspace, setUpdatingWorkspace] = useState17(false);
|
|
12437
|
+
const [teamInviteOpen, setTeamInviteOpen] = useState17(false);
|
|
12438
|
+
const [tokenShowRevoked, setTokenShowRevoked] = useState17(false);
|
|
12439
|
+
const [tokenCreateOpen, setTokenCreateOpen] = useState17(false);
|
|
12440
|
+
const [billingShowPlans, setBillingShowPlans] = useState17(false);
|
|
11612
12441
|
const isBillingPlans = activeTab === "billing" && isWorkspaceAdmin && billingShowPlans;
|
|
11613
|
-
|
|
11614
|
-
|
|
11615
|
-
|
|
11616
|
-
|
|
12442
|
+
const [billingShowPerUserLimits, setBillingShowPerUserLimits] = useState17(false);
|
|
12443
|
+
const isBillingPerUserLimits = activeTab === "billing" && isWorkspaceAdmin && billingShowPerUserLimits && !billingShowPlans;
|
|
12444
|
+
const isBillingSubView = isBillingPlans || isBillingPerUserLimits;
|
|
12445
|
+
useEffect15(() => {
|
|
12446
|
+
if (activeTab !== "billing" || !isWorkspaceAdmin) {
|
|
12447
|
+
setBillingShowPlans(false);
|
|
12448
|
+
setBillingShowPerUserLimits(false);
|
|
12449
|
+
}
|
|
12450
|
+
}, [activeTab, isWorkspaceAdmin]);
|
|
12451
|
+
useEffect15(() => {
|
|
12452
|
+
setBillingShowPlans(false);
|
|
12453
|
+
setBillingShowPerUserLimits(false);
|
|
12454
|
+
}, [workspaceId]);
|
|
12455
|
+
useEffect15(() => {
|
|
11617
12456
|
if (!onClose) return;
|
|
11618
12457
|
const handleKeyDown = (e) => {
|
|
11619
12458
|
if (e.key !== "Escape" || e.defaultPrevented) return;
|
|
@@ -11622,19 +12461,23 @@ function SettingsContentInner({
|
|
|
11622
12461
|
setBillingShowPlans(false);
|
|
11623
12462
|
return;
|
|
11624
12463
|
}
|
|
12464
|
+
if (billingShowPerUserLimits) {
|
|
12465
|
+
setBillingShowPerUserLimits(false);
|
|
12466
|
+
return;
|
|
12467
|
+
}
|
|
11625
12468
|
onClose();
|
|
11626
12469
|
};
|
|
11627
12470
|
document.addEventListener("keydown", handleKeyDown);
|
|
11628
12471
|
return () => document.removeEventListener("keydown", handleKeyDown);
|
|
11629
|
-
}, [onClose, billingShowPlans]);
|
|
11630
|
-
const [localWorkspaces, setLocalWorkspaces] =
|
|
11631
|
-
const [wsModalOpen, setWsModalOpen] =
|
|
11632
|
-
const [wsModalMode, setWsModalMode] =
|
|
11633
|
-
const [editingWorkspace, setEditingWorkspace] =
|
|
11634
|
-
const [confirmLeaveOpen, setConfirmLeaveOpen] =
|
|
11635
|
-
const [leavingWorkspace, setLeavingWorkspace] =
|
|
11636
|
-
const [confirmDeleteOpen, setConfirmDeleteOpen] =
|
|
11637
|
-
const [deletingWorkspace, setDeletingWorkspace] =
|
|
12472
|
+
}, [onClose, billingShowPlans, billingShowPerUserLimits]);
|
|
12473
|
+
const [localWorkspaces, setLocalWorkspaces] = useState17(null);
|
|
12474
|
+
const [wsModalOpen, setWsModalOpen] = useState17(false);
|
|
12475
|
+
const [wsModalMode, setWsModalMode] = useState17("create");
|
|
12476
|
+
const [editingWorkspace, setEditingWorkspace] = useState17(null);
|
|
12477
|
+
const [confirmLeaveOpen, setConfirmLeaveOpen] = useState17(false);
|
|
12478
|
+
const [leavingWorkspace, setLeavingWorkspace] = useState17(null);
|
|
12479
|
+
const [confirmDeleteOpen, setConfirmDeleteOpen] = useState17(false);
|
|
12480
|
+
const [deletingWorkspace, setDeletingWorkspace] = useState17(null);
|
|
11638
12481
|
const toWorkspaceData = (ws) => ({
|
|
11639
12482
|
id: ws._id,
|
|
11640
12483
|
name: ws.name ?? "",
|
|
@@ -11724,7 +12567,7 @@ function SettingsContentInner({
|
|
|
11724
12567
|
}
|
|
11725
12568
|
return true;
|
|
11726
12569
|
};
|
|
11727
|
-
|
|
12570
|
+
useEffect15(() => {
|
|
11728
12571
|
if (workspaceList.length > 0 && localWorkspaces === null) {
|
|
11729
12572
|
setLocalWorkspaces(workspaceList.map(toWorkspaceData));
|
|
11730
12573
|
}
|
|
@@ -11898,7 +12741,7 @@ function SettingsContentInner({
|
|
|
11898
12741
|
setConfirmLeaveOpen(true);
|
|
11899
12742
|
return false;
|
|
11900
12743
|
}
|
|
11901
|
-
return /* @__PURE__ */
|
|
12744
|
+
return /* @__PURE__ */ jsxs21(
|
|
11902
12745
|
"div",
|
|
11903
12746
|
{
|
|
11904
12747
|
"data-streamoid-settings": "",
|
|
@@ -11908,8 +12751,8 @@ function SettingsContentInner({
|
|
|
11908
12751
|
backgroundSize: "24px 24px"
|
|
11909
12752
|
},
|
|
11910
12753
|
children: [
|
|
11911
|
-
/* @__PURE__ */
|
|
11912
|
-
/* @__PURE__ */
|
|
12754
|
+
/* @__PURE__ */ jsx24(SettingsAppearance, {}),
|
|
12755
|
+
/* @__PURE__ */ jsx24(
|
|
11913
12756
|
"div",
|
|
11914
12757
|
{
|
|
11915
12758
|
className: "flex flex-col items-start relative h-full overflow-hidden",
|
|
@@ -11919,8 +12762,8 @@ function SettingsContentInner({
|
|
|
11919
12762
|
maxWidth: 1200,
|
|
11920
12763
|
width: "100%"
|
|
11921
12764
|
},
|
|
11922
|
-
children: /* @__PURE__ */
|
|
11923
|
-
onBack !== null && /* @__PURE__ */
|
|
12765
|
+
children: /* @__PURE__ */ jsxs21("div", { className: "flex flex-col w-full flex-1 min-h-0", style: { gap: 20, paddingTop: 16 }, children: [
|
|
12766
|
+
onBack !== null && /* @__PURE__ */ jsx24("div", { className: "flex items-center shrink-0", style: { paddingLeft: 20 }, children: /* @__PURE__ */ jsxs21(
|
|
11924
12767
|
"button",
|
|
11925
12768
|
{
|
|
11926
12769
|
type: "button",
|
|
@@ -11942,12 +12785,12 @@ function SettingsContentInner({
|
|
|
11942
12785
|
},
|
|
11943
12786
|
onClick: () => onBack ? onBack() : window.history.back(),
|
|
11944
12787
|
children: [
|
|
11945
|
-
/* @__PURE__ */
|
|
12788
|
+
/* @__PURE__ */ jsx24(SiconLeft3, { className: "w-4 h-4 shrink-0", color: "var(--alias-text---icons-muted)" }),
|
|
11946
12789
|
"Back"
|
|
11947
12790
|
]
|
|
11948
12791
|
}
|
|
11949
12792
|
) }),
|
|
11950
|
-
/* @__PURE__ */
|
|
12793
|
+
/* @__PURE__ */ jsxs21(
|
|
11951
12794
|
"div",
|
|
11952
12795
|
{
|
|
11953
12796
|
className: "flex items-center shrink-0 w-full",
|
|
@@ -11957,9 +12800,9 @@ function SettingsContentInner({
|
|
|
11957
12800
|
gap: 16
|
|
11958
12801
|
},
|
|
11959
12802
|
children: [
|
|
11960
|
-
/* @__PURE__ */
|
|
11961
|
-
/* @__PURE__ */
|
|
11962
|
-
/* @__PURE__ */
|
|
12803
|
+
/* @__PURE__ */ jsxs21("div", { className: "flex items-center flex-1 min-w-0", style: { gap: 8, paddingLeft: 20 }, children: [
|
|
12804
|
+
/* @__PURE__ */ jsx24(SiconSettings2, { className: "w-6 h-6 shrink-0", color: "var(--alias-text---icons-primary)" }),
|
|
12805
|
+
/* @__PURE__ */ jsx24(
|
|
11963
12806
|
"span",
|
|
11964
12807
|
{
|
|
11965
12808
|
style: {
|
|
@@ -11972,9 +12815,9 @@ function SettingsContentInner({
|
|
|
11972
12815
|
children: "Settings"
|
|
11973
12816
|
}
|
|
11974
12817
|
),
|
|
11975
|
-
scopeCrumb && /* @__PURE__ */
|
|
11976
|
-
/* @__PURE__ */
|
|
11977
|
-
/* @__PURE__ */
|
|
12818
|
+
scopeCrumb && /* @__PURE__ */ jsxs21(Fragment12, { children: [
|
|
12819
|
+
/* @__PURE__ */ jsx24(SiconRight2, { className: "w-6 h-6 shrink-0", color: "var(--alias-text---icons-primary)" }),
|
|
12820
|
+
/* @__PURE__ */ jsx24(
|
|
11978
12821
|
"span",
|
|
11979
12822
|
{
|
|
11980
12823
|
className: "truncate",
|
|
@@ -11991,8 +12834,8 @@ function SettingsContentInner({
|
|
|
11991
12834
|
}
|
|
11992
12835
|
)
|
|
11993
12836
|
] }),
|
|
11994
|
-
/* @__PURE__ */
|
|
11995
|
-
/* @__PURE__ */
|
|
12837
|
+
/* @__PURE__ */ jsx24(SiconRight2, { className: "w-6 h-6 shrink-0", color: "var(--alias-text---icons-primary)" }),
|
|
12838
|
+
/* @__PURE__ */ jsx24(
|
|
11996
12839
|
"span",
|
|
11997
12840
|
{
|
|
11998
12841
|
style: {
|
|
@@ -12005,9 +12848,9 @@ function SettingsContentInner({
|
|
|
12005
12848
|
children: leafLabel
|
|
12006
12849
|
}
|
|
12007
12850
|
),
|
|
12008
|
-
isBillingPlans && /* @__PURE__ */
|
|
12009
|
-
/* @__PURE__ */
|
|
12010
|
-
/* @__PURE__ */
|
|
12851
|
+
isBillingPlans && /* @__PURE__ */ jsxs21(Fragment12, { children: [
|
|
12852
|
+
/* @__PURE__ */ jsx24(SiconRight2, { className: "w-6 h-6 shrink-0", color: "var(--alias-text---icons-primary)" }),
|
|
12853
|
+
/* @__PURE__ */ jsx24(
|
|
12011
12854
|
"span",
|
|
12012
12855
|
{
|
|
12013
12856
|
style: {
|
|
@@ -12020,9 +12863,25 @@ function SettingsContentInner({
|
|
|
12020
12863
|
children: "Plans"
|
|
12021
12864
|
}
|
|
12022
12865
|
)
|
|
12866
|
+
] }),
|
|
12867
|
+
isBillingPerUserLimits && /* @__PURE__ */ jsxs21(Fragment12, { children: [
|
|
12868
|
+
/* @__PURE__ */ jsx24(SiconRight2, { className: "w-6 h-6 shrink-0", color: "var(--alias-text---icons-primary)" }),
|
|
12869
|
+
/* @__PURE__ */ jsx24(
|
|
12870
|
+
"span",
|
|
12871
|
+
{
|
|
12872
|
+
style: {
|
|
12873
|
+
fontFamily: "var(--font-family-font-family-body)",
|
|
12874
|
+
fontSize: "var(--font-size-font-size-xl)",
|
|
12875
|
+
fontWeight: 500,
|
|
12876
|
+
lineHeight: "var(--line-height-line-height-xl)",
|
|
12877
|
+
color: "var(--alias-text---icons-primary)"
|
|
12878
|
+
},
|
|
12879
|
+
children: "Per-user limits"
|
|
12880
|
+
}
|
|
12881
|
+
)
|
|
12023
12882
|
] })
|
|
12024
12883
|
] }),
|
|
12025
|
-
|
|
12884
|
+
isBillingSubView && /* @__PURE__ */ jsxs21(
|
|
12026
12885
|
"div",
|
|
12027
12886
|
{
|
|
12028
12887
|
className: "flex items-center shrink-0 cursor-pointer",
|
|
@@ -12034,10 +12893,13 @@ function SettingsContentInner({
|
|
|
12034
12893
|
border: "1px solid var(--alias-border-subtle)",
|
|
12035
12894
|
backgroundColor: "var(--alias-surface-base)"
|
|
12036
12895
|
},
|
|
12037
|
-
onClick: () =>
|
|
12896
|
+
onClick: () => {
|
|
12897
|
+
setBillingShowPlans(false);
|
|
12898
|
+
setBillingShowPerUserLimits(false);
|
|
12899
|
+
},
|
|
12038
12900
|
children: [
|
|
12039
|
-
/* @__PURE__ */
|
|
12040
|
-
/* @__PURE__ */
|
|
12901
|
+
/* @__PURE__ */ jsx24(SiconLeft3, { className: "w-4 h-4", color: "var(--alias-text---icons-muted)" }),
|
|
12902
|
+
/* @__PURE__ */ jsx24(
|
|
12041
12903
|
"span",
|
|
12042
12904
|
{
|
|
12043
12905
|
style: {
|
|
@@ -12053,20 +12915,20 @@ function SettingsContentInner({
|
|
|
12053
12915
|
]
|
|
12054
12916
|
}
|
|
12055
12917
|
),
|
|
12056
|
-
activeTab === "workspaceList" && /* @__PURE__ */
|
|
12918
|
+
activeTab === "workspaceList" && /* @__PURE__ */ jsx24(
|
|
12057
12919
|
SettingsTooltip,
|
|
12058
12920
|
{
|
|
12059
12921
|
content: "Start a new workspace with its own team, members and billing",
|
|
12060
12922
|
placement: "bottom",
|
|
12061
12923
|
inline: true,
|
|
12062
|
-
children: /* @__PURE__ */
|
|
12063
|
-
|
|
12924
|
+
children: /* @__PURE__ */ jsx24(
|
|
12925
|
+
ScButton10,
|
|
12064
12926
|
{
|
|
12065
12927
|
text: "Create Workspace",
|
|
12066
12928
|
variant: "secondary",
|
|
12067
12929
|
size: "md",
|
|
12068
12930
|
styleVariant: "icon-left",
|
|
12069
|
-
icon: /* @__PURE__ */
|
|
12931
|
+
icon: /* @__PURE__ */ jsx24(
|
|
12070
12932
|
SiconWorkspace2,
|
|
12071
12933
|
{
|
|
12072
12934
|
className: "w-5 h-5",
|
|
@@ -12078,20 +12940,20 @@ function SettingsContentInner({
|
|
|
12078
12940
|
)
|
|
12079
12941
|
}
|
|
12080
12942
|
),
|
|
12081
|
-
activeTab === "workspaceMembers" && /* @__PURE__ */
|
|
12943
|
+
activeTab === "workspaceMembers" && /* @__PURE__ */ jsx24(
|
|
12082
12944
|
SettingsTooltip,
|
|
12083
12945
|
{
|
|
12084
12946
|
content: "Send someone an invite to join this workspace",
|
|
12085
12947
|
placement: "bottom",
|
|
12086
12948
|
inline: true,
|
|
12087
|
-
children: /* @__PURE__ */
|
|
12088
|
-
|
|
12949
|
+
children: /* @__PURE__ */ jsx24(
|
|
12950
|
+
ScButton10,
|
|
12089
12951
|
{
|
|
12090
12952
|
text: "Invite user",
|
|
12091
12953
|
variant: "secondary",
|
|
12092
12954
|
size: "md",
|
|
12093
12955
|
styleVariant: "icon-left",
|
|
12094
|
-
icon: /* @__PURE__ */
|
|
12956
|
+
icon: /* @__PURE__ */ jsx24(
|
|
12095
12957
|
SiconUserAdd2,
|
|
12096
12958
|
{
|
|
12097
12959
|
className: "w-5 h-5",
|
|
@@ -12103,15 +12965,15 @@ function SettingsContentInner({
|
|
|
12103
12965
|
)
|
|
12104
12966
|
}
|
|
12105
12967
|
),
|
|
12106
|
-
activeTab === "apikey" && isWorkspaceAdmin && /* @__PURE__ */
|
|
12107
|
-
/* @__PURE__ */
|
|
12968
|
+
activeTab === "apikey" && isWorkspaceAdmin && /* @__PURE__ */ jsxs21("div", { className: "flex items-center shrink-0", style: { gap: "var(--spacing-md)" }, children: [
|
|
12969
|
+
/* @__PURE__ */ jsx24(
|
|
12108
12970
|
SettingsTooltip,
|
|
12109
12971
|
{
|
|
12110
12972
|
content: "Include keys you have already revoked in the list below",
|
|
12111
12973
|
placement: "bottom",
|
|
12112
12974
|
inline: true,
|
|
12113
|
-
children: /* @__PURE__ */
|
|
12114
|
-
|
|
12975
|
+
children: /* @__PURE__ */ jsx24(
|
|
12976
|
+
ScButton10,
|
|
12115
12977
|
{
|
|
12116
12978
|
text: tokenShowRevoked ? "Hide Revoked" : "Show Revoked",
|
|
12117
12979
|
variant: "outline",
|
|
@@ -12121,20 +12983,20 @@ function SettingsContentInner({
|
|
|
12121
12983
|
)
|
|
12122
12984
|
}
|
|
12123
12985
|
),
|
|
12124
|
-
/* @__PURE__ */
|
|
12986
|
+
/* @__PURE__ */ jsx24(
|
|
12125
12987
|
SettingsTooltip,
|
|
12126
12988
|
{
|
|
12127
12989
|
content: "Generate a key for calling the Streamoid APIs from your own code",
|
|
12128
12990
|
placement: "bottom",
|
|
12129
12991
|
inline: true,
|
|
12130
|
-
children: /* @__PURE__ */
|
|
12131
|
-
|
|
12992
|
+
children: /* @__PURE__ */ jsx24(
|
|
12993
|
+
ScButton10,
|
|
12132
12994
|
{
|
|
12133
12995
|
text: "New API Key",
|
|
12134
12996
|
variant: "secondary",
|
|
12135
12997
|
size: "md",
|
|
12136
12998
|
styleVariant: "icon-left",
|
|
12137
|
-
icon: /* @__PURE__ */
|
|
12999
|
+
icon: /* @__PURE__ */ jsx24(
|
|
12138
13000
|
SiconPlus3,
|
|
12139
13001
|
{
|
|
12140
13002
|
className: "w-5 h-5",
|
|
@@ -12147,7 +13009,7 @@ function SettingsContentInner({
|
|
|
12147
13009
|
}
|
|
12148
13010
|
)
|
|
12149
13011
|
] }),
|
|
12150
|
-
onClose && /* @__PURE__ */
|
|
13012
|
+
onClose && /* @__PURE__ */ jsx24(SettingsTooltip, { content: "Close settings (Esc)", placement: "bottom", inline: true, children: /* @__PURE__ */ jsx24(
|
|
12151
13013
|
"button",
|
|
12152
13014
|
{
|
|
12153
13015
|
type: "button",
|
|
@@ -12163,8 +13025,8 @@ function SettingsContentInner({
|
|
|
12163
13025
|
border: "1px solid var(--alias-border-subtle)",
|
|
12164
13026
|
backgroundColor: "var(--alias-surface-base)"
|
|
12165
13027
|
},
|
|
12166
|
-
children: /* @__PURE__ */
|
|
12167
|
-
|
|
13028
|
+
children: /* @__PURE__ */ jsx24(
|
|
13029
|
+
SiconClose9,
|
|
12168
13030
|
{
|
|
12169
13031
|
className: "w-5 h-5",
|
|
12170
13032
|
color: "var(--alias-text---icons-muted)"
|
|
@@ -12175,13 +13037,13 @@ function SettingsContentInner({
|
|
|
12175
13037
|
]
|
|
12176
13038
|
}
|
|
12177
13039
|
),
|
|
12178
|
-
/* @__PURE__ */
|
|
13040
|
+
/* @__PURE__ */ jsxs21(
|
|
12179
13041
|
"div",
|
|
12180
13042
|
{
|
|
12181
13043
|
className: "flex items-start flex-1 min-h-0 w-full overflow-hidden",
|
|
12182
13044
|
style: { gap: 20 },
|
|
12183
13045
|
children: [
|
|
12184
|
-
!
|
|
13046
|
+
!isBillingSubView && /* @__PURE__ */ jsx24(
|
|
12185
13047
|
SettingsNav,
|
|
12186
13048
|
{
|
|
12187
13049
|
isWorkspaceAdmin,
|
|
@@ -12192,8 +13054,8 @@ function SettingsContentInner({
|
|
|
12192
13054
|
hasOrganization
|
|
12193
13055
|
}
|
|
12194
13056
|
),
|
|
12195
|
-
activeTab === "profile" && /* @__PURE__ */
|
|
12196
|
-
activeTab === "workspace" && /* @__PURE__ */
|
|
13057
|
+
activeTab === "profile" && /* @__PURE__ */ jsx24(ProfileTab, {}),
|
|
13058
|
+
activeTab === "workspace" && /* @__PURE__ */ jsx24("div", { className: "flex flex-col flex-1 min-w-0 min-h-0 h-full", children: /* @__PURE__ */ jsx24(
|
|
12197
13059
|
WorkspaceGeneralTab,
|
|
12198
13060
|
{
|
|
12199
13061
|
workspace: currentWorkspaceData,
|
|
@@ -12215,7 +13077,7 @@ function SettingsContentInner({
|
|
|
12215
13077
|
}
|
|
12216
13078
|
}
|
|
12217
13079
|
) }),
|
|
12218
|
-
activeTab === "workspaceMembers" && /* @__PURE__ */
|
|
13080
|
+
activeTab === "workspaceMembers" && /* @__PURE__ */ jsx24("div", { className: "flex flex-col flex-1 min-w-0 min-h-0 h-full", children: /* @__PURE__ */ jsx24(
|
|
12219
13081
|
TeamsContent,
|
|
12220
13082
|
{
|
|
12221
13083
|
embedded: true,
|
|
@@ -12227,7 +13089,7 @@ function SettingsContentInner({
|
|
|
12227
13089
|
hiddenApps
|
|
12228
13090
|
}
|
|
12229
13091
|
) }),
|
|
12230
|
-
activeTab === "workspaceList" && /* @__PURE__ */
|
|
13092
|
+
activeTab === "workspaceList" && /* @__PURE__ */ jsx24(
|
|
12231
13093
|
WorkspaceListTab,
|
|
12232
13094
|
{
|
|
12233
13095
|
workspaces: displayWorkspaces,
|
|
@@ -12252,8 +13114,8 @@ function SettingsContentInner({
|
|
|
12252
13114
|
}
|
|
12253
13115
|
}
|
|
12254
13116
|
),
|
|
12255
|
-
activeTab === "referral" && /* @__PURE__ */
|
|
12256
|
-
(activeTab === "organization" || activeTab === "organizationWorkspaces" || activeTab === "organizationDomains") && /* @__PURE__ */
|
|
13117
|
+
activeTab === "referral" && /* @__PURE__ */ jsx24(ReferralTab, {}),
|
|
13118
|
+
(activeTab === "organization" || activeTab === "organizationWorkspaces" || activeTab === "organizationDomains") && /* @__PURE__ */ jsx24("div", { className: "flex flex-col flex-1 min-w-0 min-h-0 h-full", children: organization.managementUrl ? /* @__PURE__ */ jsx24(
|
|
12257
13119
|
ManagedOrganizationSummary,
|
|
12258
13120
|
{
|
|
12259
13121
|
name: workspaceOwner.organizationName,
|
|
@@ -12261,29 +13123,37 @@ function SettingsContentInner({
|
|
|
12261
13123
|
status: workspaceOwner.organizationStatus,
|
|
12262
13124
|
managementUrl: organization.managementUrl
|
|
12263
13125
|
}
|
|
12264
|
-
) : /* @__PURE__ */
|
|
13126
|
+
) : /* @__PURE__ */ jsx24(
|
|
12265
13127
|
OrganizationContent,
|
|
12266
13128
|
{
|
|
12267
13129
|
embedded: true,
|
|
12268
13130
|
view: activeTab === "organizationWorkspaces" || activeTab === "organizationDomains" ? "workspaces" : "people"
|
|
12269
13131
|
}
|
|
12270
13132
|
) }),
|
|
12271
|
-
activeTab === "billing" && isWorkspaceAdmin && /* @__PURE__ */
|
|
13133
|
+
activeTab === "billing" && isWorkspaceAdmin && /* @__PURE__ */ jsx24("div", { className: "flex flex-col flex-1 min-w-0 min-h-0 h-full", children: /* @__PURE__ */ jsx24(
|
|
12272
13134
|
BillingContent,
|
|
12273
13135
|
{
|
|
12274
13136
|
embedded: true,
|
|
12275
13137
|
showPlans: billingShowPlans,
|
|
12276
|
-
onShowPlansChange:
|
|
13138
|
+
onShowPlansChange: (open) => {
|
|
13139
|
+
setBillingShowPlans(open);
|
|
13140
|
+
if (open) setBillingShowPerUserLimits(false);
|
|
13141
|
+
},
|
|
13142
|
+
showPerUserLimits: billingShowPerUserLimits,
|
|
13143
|
+
onShowPerUserLimitsChange: (open) => {
|
|
13144
|
+
setBillingShowPerUserLimits(open);
|
|
13145
|
+
if (open) setBillingShowPlans(false);
|
|
13146
|
+
}
|
|
12277
13147
|
}
|
|
12278
13148
|
) }),
|
|
12279
|
-
(activeTab === "billing" || activeTab === "apikey") && !isWorkspaceAdmin && /* @__PURE__ */
|
|
12280
|
-
/* @__PURE__ */
|
|
12281
|
-
/* @__PURE__ */
|
|
12282
|
-
/* @__PURE__ */
|
|
12283
|
-
/* @__PURE__ */
|
|
13149
|
+
(activeTab === "billing" || activeTab === "apikey") && !isWorkspaceAdmin && /* @__PURE__ */ jsxs21("section", { role: "status", className: "flex flex-col flex-1 min-w-0", style: { padding: 28, gap: 12, background: "var(--alias-surface-base)", border: "1px solid var(--alias-border-default)", borderRadius: "var(--radius-3xl, 16px)" }, children: [
|
|
13150
|
+
/* @__PURE__ */ jsx24(SiconLock, { size: 24, color: MUTED_COLOR2 }),
|
|
13151
|
+
/* @__PURE__ */ jsx24("h2", { style: { margin: 0, fontSize: 18, fontWeight: 600, color: PRIMARY_COLOR3 }, children: "Contact your workspace admin" }),
|
|
13152
|
+
/* @__PURE__ */ jsx24("p", { style: { margin: 0, fontSize: 14, lineHeight: "22px", color: MUTED_COLOR2, maxWidth: 480 }, children: activeTab === "billing" ? "Your workspace admin manages credit top-ups, plans and billing history. Get in touch with them to add credits or request billing details." : "API Keys are available to workspace Admins only. Get in touch with your workspace admin to manage API access." }),
|
|
13153
|
+
/* @__PURE__ */ jsx24("button", { type: "button", onClick: () => setActiveTab("workspaceMembers"), style: { alignSelf: "flex-start", marginTop: 8, padding: "8px 12px", background: "transparent", color: PRIMARY_COLOR3, border: "1px solid var(--alias-border-default)", borderRadius: 8, cursor: "pointer" }, children: "View workspace members" })
|
|
12284
13154
|
] }),
|
|
12285
|
-
activeTab === "apikey" && isWorkspaceAdmin && /* @__PURE__ */
|
|
12286
|
-
/* @__PURE__ */
|
|
13155
|
+
activeTab === "apikey" && isWorkspaceAdmin && /* @__PURE__ */ jsxs21("div", { className: "flex flex-col flex-1 min-w-0 min-h-0 h-full", children: [
|
|
13156
|
+
/* @__PURE__ */ jsxs21(
|
|
12287
13157
|
"a",
|
|
12288
13158
|
{
|
|
12289
13159
|
href: "https://docs.streamoid.com",
|
|
@@ -12293,19 +13163,19 @@ function SettingsContentInner({
|
|
|
12293
13163
|
className: "flex items-center shrink-0",
|
|
12294
13164
|
style: { gap: 14, padding: "16px 20px", marginBottom: 16, border: "1px solid var(--alias-border-default)", borderRadius: "var(--radius-3xl, 16px)", background: "var(--alias-surface-base)", color: PRIMARY_COLOR3, textDecoration: "none" },
|
|
12295
13165
|
children: [
|
|
12296
|
-
/* @__PURE__ */
|
|
12297
|
-
/* @__PURE__ */
|
|
12298
|
-
/* @__PURE__ */
|
|
12299
|
-
/* @__PURE__ */
|
|
13166
|
+
/* @__PURE__ */ jsx24(SiconBookOpen, { size: 24 }),
|
|
13167
|
+
/* @__PURE__ */ jsxs21("span", { style: { display: "flex", flexDirection: "column", gap: 4, flex: 1 }, children: [
|
|
13168
|
+
/* @__PURE__ */ jsx24("span", { style: { fontSize: 14, fontWeight: 600 }, children: "Build with the Streamoid API" }),
|
|
13169
|
+
/* @__PURE__ */ jsx24("span", { style: { fontSize: 13, lineHeight: "20px", color: MUTED_COLOR2 }, children: "Explore authentication, API references and integration guides." })
|
|
12300
13170
|
] }),
|
|
12301
|
-
/* @__PURE__ */
|
|
13171
|
+
/* @__PURE__ */ jsxs21("span", { style: { display: "inline-flex", alignItems: "center", gap: 6, fontSize: 13, whiteSpace: "nowrap" }, children: [
|
|
12302
13172
|
"View docs ",
|
|
12303
|
-
/* @__PURE__ */
|
|
13173
|
+
/* @__PURE__ */ jsx24(SiconExternalLink2, { size: 16 })
|
|
12304
13174
|
] })
|
|
12305
13175
|
]
|
|
12306
13176
|
}
|
|
12307
13177
|
),
|
|
12308
|
-
/* @__PURE__ */
|
|
13178
|
+
/* @__PURE__ */ jsx24(
|
|
12309
13179
|
TokensContent,
|
|
12310
13180
|
{
|
|
12311
13181
|
embedded: true,
|
|
@@ -12322,7 +13192,7 @@ function SettingsContentInner({
|
|
|
12322
13192
|
] })
|
|
12323
13193
|
}
|
|
12324
13194
|
),
|
|
12325
|
-
/* @__PURE__ */
|
|
13195
|
+
/* @__PURE__ */ jsx24(
|
|
12326
13196
|
WorkspaceModal,
|
|
12327
13197
|
{
|
|
12328
13198
|
open: wsModalOpen,
|
|
@@ -12341,7 +13211,7 @@ function SettingsContentInner({
|
|
|
12341
13211
|
}
|
|
12342
13212
|
}
|
|
12343
13213
|
),
|
|
12344
|
-
/* @__PURE__ */
|
|
13214
|
+
/* @__PURE__ */ jsx24(
|
|
12345
13215
|
ConfirmLeaveModal,
|
|
12346
13216
|
{
|
|
12347
13217
|
open: confirmLeaveOpen,
|
|
@@ -12374,7 +13244,7 @@ function SettingsContentInner({
|
|
|
12374
13244
|
}
|
|
12375
13245
|
}
|
|
12376
13246
|
),
|
|
12377
|
-
/* @__PURE__ */
|
|
13247
|
+
/* @__PURE__ */ jsx24(
|
|
12378
13248
|
ConfirmDeleteModal,
|
|
12379
13249
|
{
|
|
12380
13250
|
open: confirmDeleteOpen,
|
|
@@ -12404,10 +13274,10 @@ function SettingsContentInner({
|
|
|
12404
13274
|
}
|
|
12405
13275
|
|
|
12406
13276
|
// src/workspace-picker.tsx
|
|
12407
|
-
import { useState as
|
|
12408
|
-
import { ScButton as
|
|
12409
|
-
import { jsx as
|
|
12410
|
-
var
|
|
13277
|
+
import { useState as useState18 } from "react";
|
|
13278
|
+
import { ScButton as ScButton11, ScCheckbox } from "@streamoid/ui";
|
|
13279
|
+
import { jsx as jsx25, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
13280
|
+
var T15 = {
|
|
12411
13281
|
primary: "var(--alias-text---icons-primary)",
|
|
12412
13282
|
muted: "var(--alias-text---icons-muted)",
|
|
12413
13283
|
tertiary: "var(--alias-text---icons-tertiary)",
|
|
@@ -12437,10 +13307,10 @@ function WorkspacePicker({
|
|
|
12437
13307
|
onJoin,
|
|
12438
13308
|
onCreate
|
|
12439
13309
|
}) {
|
|
12440
|
-
const [selected, setSelected] =
|
|
12441
|
-
const [creating, setCreating] =
|
|
12442
|
-
const [name, setName] =
|
|
12443
|
-
const [busy, setBusy] =
|
|
13310
|
+
const [selected, setSelected] = useState18(/* @__PURE__ */ new Set());
|
|
13311
|
+
const [creating, setCreating] = useState18(false);
|
|
13312
|
+
const [name, setName] = useState18("");
|
|
13313
|
+
const [busy, setBusy] = useState18(false);
|
|
12444
13314
|
const hasWorkspaces = workspaces.length > 0;
|
|
12445
13315
|
const showCreate = creating || !loading && !hasWorkspaces;
|
|
12446
13316
|
const orgLabel = organizationName || "your organization";
|
|
@@ -12459,48 +13329,48 @@ function WorkspacePicker({
|
|
|
12459
13329
|
setBusy(false);
|
|
12460
13330
|
}
|
|
12461
13331
|
};
|
|
12462
|
-
return /* @__PURE__ */
|
|
13332
|
+
return /* @__PURE__ */ jsxs22(
|
|
12463
13333
|
"div",
|
|
12464
13334
|
{
|
|
12465
13335
|
className: "flex flex-col w-full",
|
|
12466
|
-
style: { maxWidth: 520, gap:
|
|
13336
|
+
style: { maxWidth: 520, gap: T15.sp5xl, fontFamily: T15.font },
|
|
12467
13337
|
children: [
|
|
12468
|
-
/* @__PURE__ */
|
|
12469
|
-
/* @__PURE__ */
|
|
13338
|
+
/* @__PURE__ */ jsxs22("div", { className: "flex flex-col", style: { gap: T15.spMd }, children: [
|
|
13339
|
+
/* @__PURE__ */ jsx25(
|
|
12470
13340
|
"p",
|
|
12471
13341
|
{
|
|
12472
13342
|
style: {
|
|
12473
|
-
color:
|
|
12474
|
-
fontSize:
|
|
13343
|
+
color: T15.primary,
|
|
13344
|
+
fontSize: T15.fsXl,
|
|
12475
13345
|
fontWeight: 600,
|
|
12476
|
-
lineHeight:
|
|
13346
|
+
lineHeight: T15.lhXl,
|
|
12477
13347
|
margin: 0
|
|
12478
13348
|
},
|
|
12479
13349
|
children: "Choose your workspaces"
|
|
12480
13350
|
}
|
|
12481
13351
|
),
|
|
12482
|
-
/* @__PURE__ */
|
|
13352
|
+
/* @__PURE__ */ jsx25("p", { style: { color: T15.muted, fontSize: T15.fsSm, lineHeight: T15.lhSm, margin: 0 }, children: hasWorkspaces || loading ? `Join one or more workspaces in ${orgLabel} as a member, or create your own.` : `There are no workspaces to join in ${orgLabel} yet. Create one to get started.` })
|
|
12483
13353
|
] }),
|
|
12484
|
-
(loading || hasWorkspaces) && /* @__PURE__ */
|
|
13354
|
+
(loading || hasWorkspaces) && /* @__PURE__ */ jsx25(
|
|
12485
13355
|
"div",
|
|
12486
13356
|
{
|
|
12487
13357
|
className: "flex flex-col w-full overflow-y-auto",
|
|
12488
13358
|
style: {
|
|
12489
13359
|
maxHeight: 360,
|
|
12490
|
-
background:
|
|
12491
|
-
border: `1px solid ${
|
|
12492
|
-
borderRadius:
|
|
13360
|
+
background: T15.surface,
|
|
13361
|
+
border: `1px solid ${T15.borderSubtle}`,
|
|
13362
|
+
borderRadius: T15.r3xl
|
|
12493
13363
|
},
|
|
12494
|
-
children: loading ? /* @__PURE__ */
|
|
13364
|
+
children: loading ? /* @__PURE__ */ jsx25(
|
|
12495
13365
|
"div",
|
|
12496
13366
|
{
|
|
12497
13367
|
className: "flex items-center justify-center",
|
|
12498
|
-
style: { padding:
|
|
13368
|
+
style: { padding: T15.sp6xl, color: T15.muted, fontSize: T15.fsSm },
|
|
12499
13369
|
children: "Loading workspaces\u2026"
|
|
12500
13370
|
}
|
|
12501
13371
|
) : workspaces.map((workspace, index) => {
|
|
12502
13372
|
const checked = selected.has(workspace._id);
|
|
12503
|
-
return /* @__PURE__ */
|
|
13373
|
+
return /* @__PURE__ */ jsxs22(
|
|
12504
13374
|
"div",
|
|
12505
13375
|
{
|
|
12506
13376
|
role: "checkbox",
|
|
@@ -12508,9 +13378,9 @@ function WorkspacePicker({
|
|
|
12508
13378
|
tabIndex: 0,
|
|
12509
13379
|
className: "flex items-center cursor-pointer",
|
|
12510
13380
|
style: {
|
|
12511
|
-
gap:
|
|
12512
|
-
padding: `${
|
|
12513
|
-
borderTop: index ? `1px solid ${
|
|
13381
|
+
gap: T15.spXl,
|
|
13382
|
+
padding: `${T15.spXl} ${T15.sp3xl}`,
|
|
13383
|
+
borderTop: index ? `1px solid ${T15.borderSubtle}` : "none"
|
|
12514
13384
|
},
|
|
12515
13385
|
onClick: () => toggle(workspace._id),
|
|
12516
13386
|
onKeyDown: (e) => {
|
|
@@ -12520,35 +13390,35 @@ function WorkspacePicker({
|
|
|
12520
13390
|
}
|
|
12521
13391
|
},
|
|
12522
13392
|
children: [
|
|
12523
|
-
/* @__PURE__ */
|
|
12524
|
-
/* @__PURE__ */
|
|
13393
|
+
/* @__PURE__ */ jsx25(ScCheckbox, { checked }),
|
|
13394
|
+
/* @__PURE__ */ jsx25(
|
|
12525
13395
|
ProfileAvatar,
|
|
12526
13396
|
{
|
|
12527
13397
|
name: workspace.name,
|
|
12528
13398
|
profileImage: workspace.imageUrl,
|
|
12529
13399
|
size: 32,
|
|
12530
|
-
borderRadius:
|
|
13400
|
+
borderRadius: T15.rLg
|
|
12531
13401
|
}
|
|
12532
13402
|
),
|
|
12533
|
-
/* @__PURE__ */
|
|
12534
|
-
/* @__PURE__ */
|
|
13403
|
+
/* @__PURE__ */ jsxs22("div", { className: "flex flex-col min-w-0", children: [
|
|
13404
|
+
/* @__PURE__ */ jsx25(
|
|
12535
13405
|
"span",
|
|
12536
13406
|
{
|
|
12537
13407
|
className: "truncate",
|
|
12538
13408
|
style: {
|
|
12539
|
-
color:
|
|
12540
|
-
fontSize:
|
|
13409
|
+
color: T15.primary,
|
|
13410
|
+
fontSize: T15.fsSm,
|
|
12541
13411
|
fontWeight: 500,
|
|
12542
|
-
lineHeight:
|
|
13412
|
+
lineHeight: T15.lhSm
|
|
12543
13413
|
},
|
|
12544
13414
|
children: workspace.name
|
|
12545
13415
|
}
|
|
12546
13416
|
),
|
|
12547
|
-
workspace.ownerName && /* @__PURE__ */
|
|
13417
|
+
workspace.ownerName && /* @__PURE__ */ jsxs22(
|
|
12548
13418
|
"span",
|
|
12549
13419
|
{
|
|
12550
13420
|
className: "truncate",
|
|
12551
|
-
style: { color:
|
|
13421
|
+
style: { color: T15.muted, fontSize: T15.fsXs, lineHeight: T15.lhXs },
|
|
12552
13422
|
children: [
|
|
12553
13423
|
"Created by ",
|
|
12554
13424
|
workspace.ownerName
|
|
@@ -12563,16 +13433,16 @@ function WorkspacePicker({
|
|
|
12563
13433
|
})
|
|
12564
13434
|
}
|
|
12565
13435
|
),
|
|
12566
|
-
showCreate ? /* @__PURE__ */
|
|
12567
|
-
/* @__PURE__ */
|
|
13436
|
+
showCreate ? /* @__PURE__ */ jsxs22("div", { className: "flex flex-col w-full", style: { gap: T15.spMd }, children: [
|
|
13437
|
+
/* @__PURE__ */ jsx25(
|
|
12568
13438
|
"label",
|
|
12569
13439
|
{
|
|
12570
13440
|
htmlFor: "workspace-picker-name",
|
|
12571
|
-
style: { color:
|
|
13441
|
+
style: { color: T15.tertiary, fontSize: T15.fsSm, lineHeight: T15.lhSm },
|
|
12572
13442
|
children: "New workspace name"
|
|
12573
13443
|
}
|
|
12574
13444
|
),
|
|
12575
|
-
/* @__PURE__ */
|
|
13445
|
+
/* @__PURE__ */ jsx25(
|
|
12576
13446
|
"input",
|
|
12577
13447
|
{
|
|
12578
13448
|
id: "workspace-picker-name",
|
|
@@ -12587,20 +13457,20 @@ function WorkspacePicker({
|
|
|
12587
13457
|
placeholder: "e.g. Marketing",
|
|
12588
13458
|
style: {
|
|
12589
13459
|
height: 48,
|
|
12590
|
-
padding: `0 ${
|
|
12591
|
-
background:
|
|
13460
|
+
padding: `0 ${T15.sp3xl}`,
|
|
13461
|
+
background: T15.fillPlus,
|
|
12592
13462
|
border: "none",
|
|
12593
13463
|
outline: "none",
|
|
12594
|
-
borderRadius:
|
|
12595
|
-
color:
|
|
12596
|
-
fontFamily:
|
|
12597
|
-
fontSize:
|
|
13464
|
+
borderRadius: T15.r3xl,
|
|
13465
|
+
color: T15.primary,
|
|
13466
|
+
fontFamily: T15.font,
|
|
13467
|
+
fontSize: T15.fsSm
|
|
12598
13468
|
}
|
|
12599
13469
|
}
|
|
12600
13470
|
),
|
|
12601
|
-
/* @__PURE__ */
|
|
12602
|
-
hasWorkspaces && /* @__PURE__ */
|
|
12603
|
-
|
|
13471
|
+
/* @__PURE__ */ jsxs22("div", { className: "flex items-center justify-end w-full", style: { gap: T15.spMd }, children: [
|
|
13472
|
+
hasWorkspaces && /* @__PURE__ */ jsx25(
|
|
13473
|
+
ScButton11,
|
|
12604
13474
|
{
|
|
12605
13475
|
text: "Back",
|
|
12606
13476
|
variant: "tertiary",
|
|
@@ -12608,8 +13478,8 @@ function WorkspacePicker({
|
|
|
12608
13478
|
onClick: () => setCreating(false)
|
|
12609
13479
|
}
|
|
12610
13480
|
),
|
|
12611
|
-
/* @__PURE__ */
|
|
12612
|
-
|
|
13481
|
+
/* @__PURE__ */ jsx25(
|
|
13482
|
+
ScButton11,
|
|
12613
13483
|
{
|
|
12614
13484
|
text: busy ? "Creating\u2026" : "Create workspace",
|
|
12615
13485
|
variant: "primary",
|
|
@@ -12619,9 +13489,9 @@ function WorkspacePicker({
|
|
|
12619
13489
|
}
|
|
12620
13490
|
)
|
|
12621
13491
|
] })
|
|
12622
|
-
] }) : /* @__PURE__ */
|
|
12623
|
-
/* @__PURE__ */
|
|
12624
|
-
|
|
13492
|
+
] }) : /* @__PURE__ */ jsxs22("div", { className: "flex flex-wrap items-center justify-between w-full", style: { gap: T15.spMd }, children: [
|
|
13493
|
+
/* @__PURE__ */ jsx25(
|
|
13494
|
+
ScButton11,
|
|
12625
13495
|
{
|
|
12626
13496
|
text: "Create a workspace",
|
|
12627
13497
|
variant: "tertiary",
|
|
@@ -12630,8 +13500,8 @@ function WorkspacePicker({
|
|
|
12630
13500
|
onClick: loading || busy ? void 0 : () => setCreating(true)
|
|
12631
13501
|
}
|
|
12632
13502
|
),
|
|
12633
|
-
/* @__PURE__ */
|
|
12634
|
-
|
|
13503
|
+
/* @__PURE__ */ jsx25(
|
|
13504
|
+
ScButton11,
|
|
12635
13505
|
{
|
|
12636
13506
|
text: busy ? "Joining\u2026" : selected.size > 1 ? `Join ${selected.size} workspaces` : "Join workspace",
|
|
12637
13507
|
variant: "primary",
|
|
@@ -12655,11 +13525,13 @@ export {
|
|
|
12655
13525
|
DEFAULT_USER_LANGUAGE,
|
|
12656
13526
|
ExportDateModal,
|
|
12657
13527
|
InviteUpdateModal,
|
|
13528
|
+
MemberCreditLimitModal,
|
|
12658
13529
|
MemberListFrame,
|
|
12659
13530
|
MemberListToolbar,
|
|
12660
13531
|
OrganizationContent,
|
|
12661
13532
|
OrganizationMemberModal,
|
|
12662
13533
|
OrganizationModal,
|
|
13534
|
+
PerUserLimitsView,
|
|
12663
13535
|
ProfileAvatar,
|
|
12664
13536
|
ProfileTab,
|
|
12665
13537
|
ReferralTab,
|
|
@@ -12683,11 +13555,25 @@ export {
|
|
|
12683
13555
|
WorkspaceModal,
|
|
12684
13556
|
WorkspacePicker,
|
|
12685
13557
|
WorkspaceTab,
|
|
13558
|
+
belowUsageReason,
|
|
12686
13559
|
countLabel,
|
|
13560
|
+
creditCycleUnit,
|
|
13561
|
+
describeDefaultLimit,
|
|
13562
|
+
describeMemberLimit,
|
|
13563
|
+
formatCreditLimit,
|
|
13564
|
+
formatCredits,
|
|
12687
13565
|
groupWorkspaceList,
|
|
13566
|
+
isLimitBelowUsage,
|
|
13567
|
+
joinMembersWithLimits,
|
|
13568
|
+
limitBelowUsageUsed,
|
|
13569
|
+
limitSourceLabel,
|
|
12688
13570
|
loadWorkspaceOrganization,
|
|
13571
|
+
minimumCreditLimit,
|
|
12689
13572
|
resolveSettingsTabFromPath,
|
|
13573
|
+
roundCredits,
|
|
12690
13574
|
useSettingsAdapters,
|
|
12691
13575
|
useWorkspaceOrganization,
|
|
12692
|
-
userLanguageLabel
|
|
13576
|
+
userLanguageLabel,
|
|
13577
|
+
validateCreditLimitInput,
|
|
13578
|
+
validateDefaultCreditLimitInput
|
|
12693
13579
|
};
|