@streamoid/settings 0.7.9 → 0.7.11
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 +183 -2
- package/dist/index.d.ts +183 -2
- package/dist/index.js +1603 -711
- package/dist/index.mjs +1587 -694
- 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
|
|
@@ -7765,172 +7789,885 @@ 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 cleanCreditLimitInput(value) {
|
|
7825
|
+
return value.replace(/[^\d.]/g, "");
|
|
7826
|
+
}
|
|
7827
|
+
function validateCreditLimitInput(raw, used) {
|
|
7828
|
+
const trimmed = raw.trim();
|
|
7829
|
+
if (!trimmed) return { ok: false, reason: "Enter a credit limit" };
|
|
7830
|
+
if (!/^\d+$/.test(trimmed)) {
|
|
7831
|
+
return { ok: false, reason: "Enter a whole number of credits" };
|
|
7806
7832
|
}
|
|
7807
|
-
const
|
|
7808
|
-
|
|
7809
|
-
|
|
7810
|
-
|
|
7811
|
-
|
|
7812
|
-
|
|
7813
|
-
}
|
|
7833
|
+
const value = Number(trimmed);
|
|
7834
|
+
if (!Number.isSafeInteger(value)) {
|
|
7835
|
+
return { ok: false, reason: "Enter a smaller number" };
|
|
7836
|
+
}
|
|
7837
|
+
if (value < roundCredits(used)) {
|
|
7838
|
+
return { ok: false, reason: belowUsageReason(used) };
|
|
7839
|
+
}
|
|
7840
|
+
return { ok: true, value };
|
|
7814
7841
|
}
|
|
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
|
-
});
|
|
7842
|
+
function belowUsageReason(used) {
|
|
7843
|
+
return `Must be at least ${minimumCreditLimit(used).toLocaleString("en-US")} \u2014 ${formatCredits(used)} already used this cycle`;
|
|
7824
7844
|
}
|
|
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;
|
|
7845
|
+
function describeDefaultLimit(response, unit) {
|
|
7846
|
+
return formatCreditLimit(response?.default?.limit ?? null, unit);
|
|
7840
7847
|
}
|
|
7841
|
-
function
|
|
7848
|
+
function describeMemberLimit(row, unit) {
|
|
7849
|
+
return formatCreditLimit(row.limit, unit);
|
|
7850
|
+
}
|
|
7851
|
+
function limitSourceLabel(row) {
|
|
7852
|
+
if (row.source === "override") return "Custom";
|
|
7853
|
+
if (row.source === "default") return "Default";
|
|
7854
|
+
return null;
|
|
7855
|
+
}
|
|
7856
|
+
function joinMembersWithLimits(members, response) {
|
|
7857
|
+
const byUser = /* @__PURE__ */ new Map();
|
|
7858
|
+
for (const entry of response?.users ?? []) byUser.set(entry.userId, entry);
|
|
7859
|
+
const def = response?.default ?? null;
|
|
7860
|
+
return members.map((member) => {
|
|
7861
|
+
const userId = member.user._id;
|
|
7862
|
+
const entry = byUser.get(userId);
|
|
7863
|
+
if (!entry) {
|
|
7864
|
+
return {
|
|
7865
|
+
member,
|
|
7866
|
+
userId,
|
|
7867
|
+
limit: def ? def.limit ?? null : null,
|
|
7868
|
+
source: def ? "default" : "none",
|
|
7869
|
+
hasLimit: false,
|
|
7870
|
+
used: 0,
|
|
7871
|
+
lastCycleUsed: 0
|
|
7872
|
+
};
|
|
7873
|
+
}
|
|
7874
|
+
const hasLimit = Boolean(entry.hasLimit);
|
|
7875
|
+
return {
|
|
7876
|
+
member,
|
|
7877
|
+
userId,
|
|
7878
|
+
limit: entry.limit ?? null,
|
|
7879
|
+
source: entry.source ?? (hasLimit ? "override" : def ? "default" : "none"),
|
|
7880
|
+
hasLimit,
|
|
7881
|
+
used: entry.used ?? 0,
|
|
7882
|
+
lastCycleUsed: entry.lastCycleUsed ?? 0
|
|
7883
|
+
};
|
|
7884
|
+
});
|
|
7885
|
+
}
|
|
7886
|
+
|
|
7887
|
+
// src/member-credit-limit-modal.tsx
|
|
7888
|
+
import { jsx as jsx20, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
7889
|
+
var T12 = {
|
|
7890
|
+
primary: "var(--alias-text---icons-primary)",
|
|
7891
|
+
tertiary: "var(--alias-text---icons-tertiary)",
|
|
7892
|
+
muted: "var(--alias-text---icons-muted)",
|
|
7893
|
+
error: "var(--alias-text---icons-error, var(--alias-text-and-icons-error, #ff6b6b))",
|
|
7894
|
+
surface: "var(--primitives-neutral-825)",
|
|
7895
|
+
fillPlus: "var(--alias-fill-neutral-neutralplus)",
|
|
7896
|
+
borderSubtle: "var(--alias-border-subtle)",
|
|
7897
|
+
borderDivider: "var(--alias-border-divider)",
|
|
7898
|
+
font: "var(--font-family-font-family-body)",
|
|
7899
|
+
fsSm: "var(--font-size-font-size-sm)",
|
|
7900
|
+
fsLg: "var(--font-size-font-size-lg)",
|
|
7901
|
+
lhSm: "var(--line-height-line-height-sm)",
|
|
7902
|
+
lhLg: "var(--line-height-line-height-lg)",
|
|
7903
|
+
spXs: "var(--spacing-xs)",
|
|
7904
|
+
spXl: "var(--spacing-xl)",
|
|
7905
|
+
sp3xl: "var(--spacing-3xl)",
|
|
7906
|
+
sp6xl: "var(--spacing-6xl)",
|
|
7907
|
+
r3xl: "var(--radius-3xl)",
|
|
7908
|
+
r4xl: "var(--radius-4xl)"
|
|
7909
|
+
};
|
|
7910
|
+
function MemberCreditLimitModal({
|
|
7842
7911
|
open,
|
|
7843
|
-
|
|
7844
|
-
|
|
7845
|
-
|
|
7846
|
-
|
|
7847
|
-
|
|
7848
|
-
|
|
7912
|
+
title = "Set custom usage limit",
|
|
7913
|
+
description,
|
|
7914
|
+
subject,
|
|
7915
|
+
resetKey,
|
|
7916
|
+
used,
|
|
7917
|
+
initialLimit,
|
|
7918
|
+
isSet,
|
|
7919
|
+
unit,
|
|
7920
|
+
onSave,
|
|
7921
|
+
onRemove,
|
|
7922
|
+
removeLabel = "Remove",
|
|
7923
|
+
removeHint,
|
|
7924
|
+
saveSuccessMessage = "Usage limit updated",
|
|
7925
|
+
removeSuccessMessage = "Usage limit removed",
|
|
7849
7926
|
onClose,
|
|
7850
|
-
|
|
7927
|
+
onSaved,
|
|
7928
|
+
onStale
|
|
7851
7929
|
}) {
|
|
7852
|
-
const
|
|
7853
|
-
const
|
|
7854
|
-
const
|
|
7930
|
+
const { toast } = useSettingsAdapters();
|
|
7931
|
+
const initialUnlimited = initialLimit === null;
|
|
7932
|
+
const [unlimited, setUnlimited] = useState13(initialUnlimited);
|
|
7933
|
+
const [raw, setRaw] = useState13("");
|
|
7934
|
+
const [touched, setTouched] = useState13(false);
|
|
7935
|
+
const [saving, setSaving] = useState13(false);
|
|
7936
|
+
const [serverHint, setServerHint] = useState13(null);
|
|
7937
|
+
const [serverUsed, setServerUsed] = useState13(null);
|
|
7938
|
+
const close = () => {
|
|
7939
|
+
if (!saving) onClose();
|
|
7940
|
+
};
|
|
7941
|
+
useOverlayOpen(open, close);
|
|
7942
|
+
useEffect11(() => {
|
|
7943
|
+
if (!open) return;
|
|
7944
|
+
setUnlimited(initialUnlimited);
|
|
7945
|
+
setRaw(initialLimit !== null ? String(initialLimit) : "");
|
|
7946
|
+
setTouched(false);
|
|
7947
|
+
setSaving(false);
|
|
7948
|
+
setServerHint(null);
|
|
7949
|
+
setServerUsed(null);
|
|
7950
|
+
}, [open, resetKey, initialLimit, isSet, initialUnlimited]);
|
|
7855
7951
|
if (!open) return null;
|
|
7952
|
+
const usedNow = Math.max(used, serverUsed ?? 0);
|
|
7953
|
+
const validation = validateCreditLimitInput(raw, usedNow);
|
|
7954
|
+
const changed = !isSet || (unlimited ? !initialUnlimited : initialUnlimited || validation.ok && validation.value !== initialLimit);
|
|
7955
|
+
const canSave = !saving && changed && (unlimited || validation.ok);
|
|
7956
|
+
const hint = serverHint ?? (!unlimited && touched && !validation.ok ? validation.reason : null);
|
|
7957
|
+
const handleSave = async () => {
|
|
7958
|
+
if (!canSave) return;
|
|
7959
|
+
const next = unlimited ? null : validation.ok ? validation.value : null;
|
|
7960
|
+
setSaving(true);
|
|
7961
|
+
try {
|
|
7962
|
+
await onSave(next);
|
|
7963
|
+
toast.success(saveSuccessMessage);
|
|
7964
|
+
onSaved();
|
|
7965
|
+
onClose();
|
|
7966
|
+
} catch (err) {
|
|
7967
|
+
if (isLimitBelowUsage(err)) {
|
|
7968
|
+
const fresh = limitBelowUsageUsed(err) ?? usedNow;
|
|
7969
|
+
setServerUsed(fresh);
|
|
7970
|
+
setUnlimited(false);
|
|
7971
|
+
setServerHint(belowUsageReason(fresh));
|
|
7972
|
+
if (fresh !== used) onStale?.();
|
|
7973
|
+
} else {
|
|
7974
|
+
toast.error(errorMessage(err, { method: "PUT" }));
|
|
7975
|
+
}
|
|
7976
|
+
setSaving(false);
|
|
7977
|
+
}
|
|
7978
|
+
};
|
|
7979
|
+
const handleRemove = async () => {
|
|
7980
|
+
if (saving || !onRemove) return;
|
|
7981
|
+
setSaving(true);
|
|
7982
|
+
try {
|
|
7983
|
+
await onRemove();
|
|
7984
|
+
toast.success(removeSuccessMessage);
|
|
7985
|
+
onSaved();
|
|
7986
|
+
onClose();
|
|
7987
|
+
} catch (err) {
|
|
7988
|
+
toast.error(errorMessage(err, { method: "DELETE" }));
|
|
7989
|
+
setSaving(false);
|
|
7990
|
+
}
|
|
7991
|
+
};
|
|
7992
|
+
const bodyText = {
|
|
7993
|
+
fontFamily: T12.font,
|
|
7994
|
+
fontSize: T12.fsSm,
|
|
7995
|
+
lineHeight: T12.lhSm
|
|
7996
|
+
};
|
|
7856
7997
|
return /* @__PURE__ */ jsx20(
|
|
7857
7998
|
"div",
|
|
7858
7999
|
{
|
|
7859
8000
|
className: "fixed inset-0 z-50 flex items-center justify-center",
|
|
7860
8001
|
style: { backgroundColor: "rgba(0, 0, 0, 0.6)" },
|
|
7861
|
-
onClick: (
|
|
7862
|
-
if (
|
|
8002
|
+
onClick: (e) => {
|
|
8003
|
+
if (e.target === e.currentTarget) close();
|
|
7863
8004
|
},
|
|
7864
8005
|
children: /* @__PURE__ */ jsxs17(
|
|
7865
8006
|
"div",
|
|
7866
8007
|
{
|
|
7867
|
-
className: "flex flex-col
|
|
8008
|
+
className: "flex flex-col items-start",
|
|
7868
8009
|
style: {
|
|
7869
|
-
backgroundColor:
|
|
7870
|
-
borderRadius:
|
|
7871
|
-
border:
|
|
7872
|
-
|
|
7873
|
-
|
|
7874
|
-
maxHeight: "
|
|
7875
|
-
overflowY: "auto"
|
|
8010
|
+
backgroundColor: T12.surface,
|
|
8011
|
+
borderRadius: T12.r4xl,
|
|
8012
|
+
border: `1px solid ${T12.borderSubtle}`,
|
|
8013
|
+
width: 480,
|
|
8014
|
+
maxWidth: "calc(100vw - 32px)",
|
|
8015
|
+
maxHeight: "85vh"
|
|
7876
8016
|
},
|
|
7877
8017
|
children: [
|
|
7878
|
-
/* @__PURE__ */ jsxs17("div", { className: "
|
|
8018
|
+
/* @__PURE__ */ jsxs17("div", { className: "shrink-0 w-full relative", children: [
|
|
7879
8019
|
/* @__PURE__ */ jsx20(
|
|
7880
|
-
"
|
|
8020
|
+
"div",
|
|
7881
8021
|
{
|
|
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"
|
|
8022
|
+
"aria-hidden": true,
|
|
8023
|
+
className: "absolute inset-0 pointer-events-none",
|
|
8024
|
+
style: { borderBottom: `1px solid ${T12.borderDivider}` }
|
|
7891
8025
|
}
|
|
7892
8026
|
),
|
|
7893
|
-
/* @__PURE__ */
|
|
7894
|
-
"
|
|
8027
|
+
/* @__PURE__ */ jsxs17(
|
|
8028
|
+
"div",
|
|
7895
8029
|
{
|
|
7896
|
-
|
|
7897
|
-
|
|
7898
|
-
|
|
7899
|
-
|
|
8030
|
+
className: "flex items-center w-full",
|
|
8031
|
+
style: { gap: T12.sp3xl, padding: `${T12.sp3xl} ${T12.sp6xl}` },
|
|
8032
|
+
children: [
|
|
8033
|
+
/* @__PURE__ */ jsx20(
|
|
8034
|
+
"p",
|
|
8035
|
+
{
|
|
8036
|
+
className: "flex-1 min-w-0 overflow-hidden text-ellipsis whitespace-nowrap",
|
|
8037
|
+
style: {
|
|
8038
|
+
color: T12.primary,
|
|
8039
|
+
fontFamily: T12.font,
|
|
8040
|
+
fontSize: T12.fsLg,
|
|
8041
|
+
fontWeight: 600,
|
|
8042
|
+
lineHeight: T12.lhLg
|
|
8043
|
+
},
|
|
8044
|
+
children: title
|
|
8045
|
+
}
|
|
8046
|
+
),
|
|
8047
|
+
/* @__PURE__ */ jsx20("div", { className: "shrink-0 cursor-pointer", onClick: close, children: /* @__PURE__ */ jsx20(SiconClose6, { className: "w-6 h-6", color: T12.primary }) })
|
|
8048
|
+
]
|
|
7900
8049
|
}
|
|
7901
8050
|
)
|
|
7902
8051
|
] }),
|
|
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(
|
|
8052
|
+
/* @__PURE__ */ jsx20("div", { className: "flex-1 min-h-0 w-full overflow-y-auto", children: /* @__PURE__ */ jsxs17(
|
|
7914
8053
|
"div",
|
|
7915
8054
|
{
|
|
7916
|
-
className: "flex flex-col w-full",
|
|
7917
|
-
style: { gap:
|
|
8055
|
+
className: "flex flex-col items-start w-full",
|
|
8056
|
+
style: { padding: `${T12.sp3xl} ${T12.sp6xl}`, gap: T12.sp3xl },
|
|
7918
8057
|
children: [
|
|
8058
|
+
(subject || description) && /* @__PURE__ */ jsxs17("div", { className: "flex flex-col w-full min-w-0", children: [
|
|
8059
|
+
subject?.name?.trim() && /* @__PURE__ */ jsx20(
|
|
8060
|
+
"span",
|
|
8061
|
+
{
|
|
8062
|
+
className: "truncate",
|
|
8063
|
+
style: { ...bodyText, fontWeight: 500, color: T12.primary },
|
|
8064
|
+
children: subject.name
|
|
8065
|
+
}
|
|
8066
|
+
),
|
|
8067
|
+
subject && /* @__PURE__ */ jsx20(
|
|
8068
|
+
"span",
|
|
8069
|
+
{
|
|
8070
|
+
className: "truncate",
|
|
8071
|
+
style: {
|
|
8072
|
+
...bodyText,
|
|
8073
|
+
color: subject.name?.trim() ? T12.muted : T12.primary
|
|
8074
|
+
},
|
|
8075
|
+
children: subject.email
|
|
8076
|
+
}
|
|
8077
|
+
),
|
|
8078
|
+
subject && /* @__PURE__ */ jsxs17("span", { style: { ...bodyText, color: T12.tertiary, marginTop: T12.spXs }, children: [
|
|
8079
|
+
"Used this cycle: ",
|
|
8080
|
+
formatCredits(usedNow),
|
|
8081
|
+
" credits"
|
|
8082
|
+
] }),
|
|
8083
|
+
description && /* @__PURE__ */ jsx20("span", { style: { ...bodyText, color: T12.tertiary }, children: description })
|
|
8084
|
+
] }),
|
|
8085
|
+
/* @__PURE__ */ jsxs17("div", { className: "flex flex-col w-full", style: { gap: T12.spXs }, children: [
|
|
8086
|
+
/* @__PURE__ */ jsxs17("div", { className: "flex items-center w-full", style: { gap: T12.sp3xl }, children: [
|
|
8087
|
+
/* @__PURE__ */ jsx20(
|
|
8088
|
+
ScPairtext,
|
|
8089
|
+
{
|
|
8090
|
+
type: "radio",
|
|
8091
|
+
content: "",
|
|
8092
|
+
checked: !unlimited,
|
|
8093
|
+
onChange: () => {
|
|
8094
|
+
if (!saving) setUnlimited(false);
|
|
8095
|
+
}
|
|
8096
|
+
}
|
|
8097
|
+
),
|
|
8098
|
+
/* @__PURE__ */ jsxs17(
|
|
8099
|
+
"div",
|
|
8100
|
+
{
|
|
8101
|
+
className: "flex-1 min-w-0 flex items-center",
|
|
8102
|
+
style: {
|
|
8103
|
+
background: T12.fillPlus,
|
|
8104
|
+
height: 48,
|
|
8105
|
+
borderRadius: T12.r3xl,
|
|
8106
|
+
padding: `${T12.spXl} ${T12.sp3xl}`,
|
|
8107
|
+
gap: T12.spXl,
|
|
8108
|
+
border: hint ? `1px solid ${T12.error}` : "1px solid transparent",
|
|
8109
|
+
opacity: unlimited ? 0.6 : 1
|
|
8110
|
+
},
|
|
8111
|
+
children: [
|
|
8112
|
+
/* @__PURE__ */ jsx20(
|
|
8113
|
+
"input",
|
|
8114
|
+
{
|
|
8115
|
+
inputMode: "numeric",
|
|
8116
|
+
"aria-label": "Credit limit",
|
|
8117
|
+
"aria-invalid": hint ? true : void 0,
|
|
8118
|
+
placeholder: "Enter credits",
|
|
8119
|
+
value: raw,
|
|
8120
|
+
disabled: saving,
|
|
8121
|
+
onFocus: () => setUnlimited(false),
|
|
8122
|
+
onChange: (e) => {
|
|
8123
|
+
setRaw(cleanCreditLimitInput(e.target.value));
|
|
8124
|
+
setTouched(true);
|
|
8125
|
+
setServerHint(null);
|
|
8126
|
+
},
|
|
8127
|
+
className: "flex-1 min-w-0",
|
|
8128
|
+
style: {
|
|
8129
|
+
...bodyText,
|
|
8130
|
+
background: "transparent",
|
|
8131
|
+
border: "none",
|
|
8132
|
+
outline: "none",
|
|
8133
|
+
color: T12.primary,
|
|
8134
|
+
padding: 0
|
|
8135
|
+
}
|
|
8136
|
+
}
|
|
8137
|
+
),
|
|
8138
|
+
/* @__PURE__ */ jsxs17("span", { className: "shrink-0", style: { ...bodyText, color: T12.muted }, children: [
|
|
8139
|
+
"credits / ",
|
|
8140
|
+
unit
|
|
8141
|
+
] })
|
|
8142
|
+
]
|
|
8143
|
+
}
|
|
8144
|
+
)
|
|
8145
|
+
] }),
|
|
8146
|
+
hint && /* @__PURE__ */ jsx20("span", { role: "alert", style: { ...bodyText, color: T12.error }, children: hint })
|
|
8147
|
+
] }),
|
|
7919
8148
|
/* @__PURE__ */ jsx20(
|
|
7920
|
-
|
|
8149
|
+
ScPairtext,
|
|
7921
8150
|
{
|
|
7922
|
-
|
|
7923
|
-
|
|
7924
|
-
|
|
7925
|
-
|
|
7926
|
-
|
|
7927
|
-
|
|
7928
|
-
|
|
7929
|
-
|
|
8151
|
+
type: "radio",
|
|
8152
|
+
content: "Unlimited usage",
|
|
8153
|
+
checked: unlimited,
|
|
8154
|
+
onChange: () => {
|
|
8155
|
+
if (saving) return;
|
|
8156
|
+
setUnlimited(true);
|
|
8157
|
+
setServerHint(null);
|
|
8158
|
+
}
|
|
7930
8159
|
}
|
|
7931
8160
|
),
|
|
7932
|
-
/* @__PURE__ */
|
|
7933
|
-
|
|
8161
|
+
onRemove && removeHint && /* @__PURE__ */ jsx20("span", { style: { ...bodyText, color: T12.muted }, children: removeHint })
|
|
8162
|
+
]
|
|
8163
|
+
}
|
|
8164
|
+
) }),
|
|
8165
|
+
/* @__PURE__ */ jsxs17("div", { className: "shrink-0 w-full relative", children: [
|
|
8166
|
+
/* @__PURE__ */ jsx20(
|
|
8167
|
+
"div",
|
|
8168
|
+
{
|
|
8169
|
+
"aria-hidden": true,
|
|
8170
|
+
className: "absolute inset-0 pointer-events-none",
|
|
8171
|
+
style: { borderTop: `1px solid ${T12.borderDivider}` }
|
|
8172
|
+
}
|
|
8173
|
+
),
|
|
8174
|
+
/* @__PURE__ */ jsxs17(
|
|
8175
|
+
"div",
|
|
8176
|
+
{
|
|
8177
|
+
className: "flex items-center w-full",
|
|
8178
|
+
style: {
|
|
8179
|
+
padding: `${T12.sp3xl} ${T12.sp6xl}`,
|
|
8180
|
+
justifyContent: onRemove ? "space-between" : "flex-end"
|
|
8181
|
+
},
|
|
8182
|
+
children: [
|
|
8183
|
+
onRemove && /* @__PURE__ */ jsx20(
|
|
8184
|
+
ScButton6,
|
|
8185
|
+
{
|
|
8186
|
+
text: removeLabel,
|
|
8187
|
+
variant: "error",
|
|
8188
|
+
size: "md",
|
|
8189
|
+
state: saving ? "disabled" : "default",
|
|
8190
|
+
onClick: saving ? void 0 : () => void handleRemove()
|
|
8191
|
+
}
|
|
8192
|
+
),
|
|
8193
|
+
/* @__PURE__ */ jsx20(
|
|
8194
|
+
ScButton6,
|
|
8195
|
+
{
|
|
8196
|
+
text: "Save",
|
|
8197
|
+
variant: "primary",
|
|
8198
|
+
size: "md",
|
|
8199
|
+
state: canSave ? "default" : "disabled",
|
|
8200
|
+
onClick: canSave ? () => void handleSave() : void 0
|
|
8201
|
+
}
|
|
8202
|
+
)
|
|
8203
|
+
]
|
|
8204
|
+
}
|
|
8205
|
+
)
|
|
8206
|
+
] })
|
|
8207
|
+
]
|
|
8208
|
+
}
|
|
8209
|
+
)
|
|
8210
|
+
}
|
|
8211
|
+
);
|
|
8212
|
+
}
|
|
8213
|
+
|
|
8214
|
+
// src/per-user-limits-view.tsx
|
|
8215
|
+
import { jsx as jsx21, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
8216
|
+
var T13 = {
|
|
8217
|
+
primary: "var(--alias-text---icons-primary)",
|
|
8218
|
+
muted: "var(--alias-text---icons-muted)",
|
|
8219
|
+
fillPlus: "var(--alias-fill-neutral-neutralplus)",
|
|
8220
|
+
surfaceBase: "var(--alias-surface-base)",
|
|
8221
|
+
borderSubtle: "var(--alias-border-subtle)",
|
|
8222
|
+
font: "var(--font-family-font-family-body)",
|
|
8223
|
+
fsSm: "var(--font-size-font-size-sm)",
|
|
8224
|
+
fsXl: "var(--font-size-font-size-xl)",
|
|
8225
|
+
lhSm: "var(--line-height-line-height-sm)",
|
|
8226
|
+
lhXl: "var(--line-height-line-height-xl)",
|
|
8227
|
+
spMd: "var(--spacing-md)",
|
|
8228
|
+
sp3xl: "var(--spacing-3xl)",
|
|
8229
|
+
sp6xl: "var(--spacing-6xl)",
|
|
8230
|
+
r3xl: "var(--radius-3xl)"
|
|
8231
|
+
};
|
|
8232
|
+
var COLUMNS = "minmax(200px, 1fr) 140px 150px 190px 80px";
|
|
8233
|
+
var cellText = {
|
|
8234
|
+
fontFamily: T13.font,
|
|
8235
|
+
fontSize: T13.fsSm,
|
|
8236
|
+
lineHeight: T13.lhSm,
|
|
8237
|
+
color: T13.primary
|
|
8238
|
+
};
|
|
8239
|
+
function LimitRow({
|
|
8240
|
+
row,
|
|
8241
|
+
unit,
|
|
8242
|
+
onEdit
|
|
8243
|
+
}) {
|
|
8244
|
+
const name = row.member.user.name?.trim() ?? "";
|
|
8245
|
+
const email = row.member.user.email || "";
|
|
8246
|
+
const displayIdent = name || email.split("@")[0] || "user";
|
|
8247
|
+
return /* @__PURE__ */ jsxs18(
|
|
8248
|
+
"div",
|
|
8249
|
+
{
|
|
8250
|
+
style: {
|
|
8251
|
+
borderBottom: `1px solid ${T13.borderSubtle}`,
|
|
8252
|
+
display: "grid",
|
|
8253
|
+
gridTemplateColumns: COLUMNS,
|
|
8254
|
+
alignItems: "center",
|
|
8255
|
+
padding: `8px ${T13.sp3xl}`,
|
|
8256
|
+
gap: 24
|
|
8257
|
+
},
|
|
8258
|
+
onMouseEnter: (e) => {
|
|
8259
|
+
e.currentTarget.style.background = T13.fillPlus;
|
|
8260
|
+
},
|
|
8261
|
+
onMouseLeave: (e) => {
|
|
8262
|
+
e.currentTarget.style.background = "transparent";
|
|
8263
|
+
},
|
|
8264
|
+
children: [
|
|
8265
|
+
/* @__PURE__ */ jsxs18("div", { className: "flex items-center min-w-0", style: { gap: T13.spMd }, children: [
|
|
8266
|
+
/* @__PURE__ */ jsx21(ProfileAvatar, { name: displayIdent, size: 32 }),
|
|
8267
|
+
/* @__PURE__ */ jsxs18("div", { className: "flex flex-col min-w-0", children: [
|
|
8268
|
+
name && /* @__PURE__ */ jsx21("span", { className: "truncate", style: { ...cellText, fontWeight: 500 }, children: name }),
|
|
8269
|
+
/* @__PURE__ */ jsx21(
|
|
8270
|
+
"span",
|
|
8271
|
+
{
|
|
8272
|
+
className: "truncate",
|
|
8273
|
+
style: { ...cellText, color: name ? T13.muted : T13.primary },
|
|
8274
|
+
children: email || "\u2014"
|
|
8275
|
+
}
|
|
8276
|
+
)
|
|
8277
|
+
] })
|
|
8278
|
+
] }),
|
|
8279
|
+
/* @__PURE__ */ jsx21("span", { style: cellText, children: formatCredits(row.used) }),
|
|
8280
|
+
/* @__PURE__ */ jsx21("span", { style: cellText, children: formatCredits(row.lastCycleUsed) }),
|
|
8281
|
+
/* @__PURE__ */ jsxs18("div", { className: "flex flex-col min-w-0", children: [
|
|
8282
|
+
/* @__PURE__ */ jsx21("span", { style: cellText, children: describeMemberLimit(row, unit) }),
|
|
8283
|
+
limitSourceLabel(row) && /* @__PURE__ */ jsx21("span", { style: { ...cellText, color: T13.muted }, children: limitSourceLabel(row) })
|
|
8284
|
+
] }),
|
|
8285
|
+
/* @__PURE__ */ jsx21("div", { className: "flex items-center", children: onEdit && /* @__PURE__ */ jsx21(ScButton7, { text: "Edit", variant: "secondary", size: "sm", onClick: onEdit }) })
|
|
8286
|
+
]
|
|
8287
|
+
}
|
|
8288
|
+
);
|
|
8289
|
+
}
|
|
8290
|
+
function PerUserLimitsView() {
|
|
8291
|
+
const { api, workspace, toast } = useSettingsAdapters();
|
|
8292
|
+
const workspaceId = workspace.current?.id ?? null;
|
|
8293
|
+
const [members, setMembers] = useState14([]);
|
|
8294
|
+
const [limits, setLimits] = useState14(null);
|
|
8295
|
+
const [loading, setLoading] = useState14(true);
|
|
8296
|
+
const [failed, setFailed] = useState14(false);
|
|
8297
|
+
const [searchQuery, setSearchQuery] = useState14("");
|
|
8298
|
+
const [editing, setEditing] = useState14(null);
|
|
8299
|
+
const [editingDefault, setEditingDefault] = useState14(false);
|
|
8300
|
+
const latestLoad = useRef6(0);
|
|
8301
|
+
const load = useCallback5(async ({ refresh = false } = {}) => {
|
|
8302
|
+
const loadId = ++latestLoad.current;
|
|
8303
|
+
if (!api.fetchMemberCreditLimits) {
|
|
8304
|
+
setLoading(false);
|
|
8305
|
+
setFailed(true);
|
|
8306
|
+
return;
|
|
8307
|
+
}
|
|
8308
|
+
const [nextMembers, nextLimits] = await Promise.all([
|
|
8309
|
+
api.fetchMembers().catch(() => null),
|
|
8310
|
+
api.fetchMemberCreditLimits().catch(() => null)
|
|
8311
|
+
]);
|
|
8312
|
+
if (loadId !== latestLoad.current) return;
|
|
8313
|
+
if (refresh && (!nextMembers || !nextLimits)) {
|
|
8314
|
+
toast.error("Couldn't refresh usage limits. Reopen this page to see the latest.");
|
|
8315
|
+
return;
|
|
8316
|
+
}
|
|
8317
|
+
setFailed(!nextMembers || !nextLimits);
|
|
8318
|
+
setMembers(nextMembers ?? []);
|
|
8319
|
+
setLimits(nextLimits);
|
|
8320
|
+
setLoading(false);
|
|
8321
|
+
}, [api, toast]);
|
|
8322
|
+
useEffect12(() => {
|
|
8323
|
+
setLoading(true);
|
|
8324
|
+
setFailed(false);
|
|
8325
|
+
setMembers([]);
|
|
8326
|
+
setLimits(null);
|
|
8327
|
+
setEditing(null);
|
|
8328
|
+
setEditingDefault(false);
|
|
8329
|
+
setSearchQuery("");
|
|
8330
|
+
void load();
|
|
8331
|
+
}, [workspaceId]);
|
|
8332
|
+
useEffect12(
|
|
8333
|
+
() => () => {
|
|
8334
|
+
latestLoad.current += 1;
|
|
8335
|
+
},
|
|
8336
|
+
[]
|
|
8337
|
+
);
|
|
8338
|
+
const unit = creditCycleUnit(limits?.cycle);
|
|
8339
|
+
const rows = useMemo3(
|
|
8340
|
+
() => joinMembersWithLimits(members, limits),
|
|
8341
|
+
[members, limits]
|
|
8342
|
+
);
|
|
8343
|
+
const filtered = useMemo3(() => {
|
|
8344
|
+
const q = searchQuery.trim().toLowerCase();
|
|
8345
|
+
if (!q) return rows;
|
|
8346
|
+
return rows.filter(
|
|
8347
|
+
({ member }) => (member.user.name ?? "").toLowerCase().includes(q) || (member.user.email ?? "").toLowerCase().includes(q)
|
|
8348
|
+
);
|
|
8349
|
+
}, [rows, searchQuery]);
|
|
8350
|
+
if (loading) {
|
|
8351
|
+
return /* @__PURE__ */ jsx21(
|
|
8352
|
+
"div",
|
|
8353
|
+
{
|
|
8354
|
+
className: "flex items-center justify-center w-full",
|
|
8355
|
+
style: {
|
|
8356
|
+
backgroundColor: T13.surfaceBase,
|
|
8357
|
+
borderRadius: T13.r3xl,
|
|
8358
|
+
padding: T13.sp6xl
|
|
8359
|
+
},
|
|
8360
|
+
children: /* @__PURE__ */ jsx21(
|
|
8361
|
+
"div",
|
|
8362
|
+
{
|
|
8363
|
+
className: "animate-spin",
|
|
8364
|
+
style: {
|
|
8365
|
+
width: 24,
|
|
8366
|
+
height: 24,
|
|
8367
|
+
borderRadius: "var(--radius-full)",
|
|
8368
|
+
border: "2px solid var(--alias-border-subtle)",
|
|
8369
|
+
borderTopColor: "var(--alias-text---icons-primary)"
|
|
8370
|
+
}
|
|
8371
|
+
}
|
|
8372
|
+
)
|
|
8373
|
+
}
|
|
8374
|
+
);
|
|
8375
|
+
}
|
|
8376
|
+
return /* @__PURE__ */ jsxs18("div", { className: "flex flex-col flex-1 min-h-0 w-full", style: { gap: 16 }, children: [
|
|
8377
|
+
/* @__PURE__ */ jsxs18("div", { className: "flex flex-col shrink-0", style: { gap: 4 }, children: [
|
|
8378
|
+
/* @__PURE__ */ jsx21(
|
|
8379
|
+
"span",
|
|
8380
|
+
{
|
|
8381
|
+
style: {
|
|
8382
|
+
fontFamily: T13.font,
|
|
8383
|
+
fontSize: T13.fsXl,
|
|
8384
|
+
fontWeight: 500,
|
|
8385
|
+
lineHeight: T13.lhXl,
|
|
8386
|
+
color: T13.primary
|
|
8387
|
+
},
|
|
8388
|
+
children: "Per-user usage limits"
|
|
8389
|
+
}
|
|
8390
|
+
),
|
|
8391
|
+
/* @__PURE__ */ jsx21("span", { style: { ...cellText, color: T13.muted }, children: "Set a default for every member, and override it for individuals." })
|
|
8392
|
+
] }),
|
|
8393
|
+
/* @__PURE__ */ jsxs18(
|
|
8394
|
+
"div",
|
|
8395
|
+
{
|
|
8396
|
+
className: "flex items-center justify-between shrink-0 w-full",
|
|
8397
|
+
style: {
|
|
8398
|
+
gap: 12,
|
|
8399
|
+
padding: 16,
|
|
8400
|
+
backgroundColor: T13.surfaceBase,
|
|
8401
|
+
border: `1px solid ${T13.borderSubtle}`,
|
|
8402
|
+
borderRadius: T13.r3xl
|
|
8403
|
+
},
|
|
8404
|
+
children: [
|
|
8405
|
+
/* @__PURE__ */ jsxs18("div", { className: "flex flex-col min-w-0", style: { gap: 4 }, children: [
|
|
8406
|
+
/* @__PURE__ */ jsx21("span", { style: { ...cellText, fontWeight: 500 }, children: "Default limit per member" }),
|
|
8407
|
+
/* @__PURE__ */ jsx21("span", { style: { ...cellText, color: T13.muted }, children: failed ? "\u2014" : describeDefaultLimit(limits, unit) })
|
|
8408
|
+
] }),
|
|
8409
|
+
api.setDefaultCreditLimit && !failed && /* @__PURE__ */ jsx21(
|
|
8410
|
+
ScButton7,
|
|
8411
|
+
{
|
|
8412
|
+
text: "Edit",
|
|
8413
|
+
variant: "secondary",
|
|
8414
|
+
size: "sm",
|
|
8415
|
+
onClick: () => setEditingDefault(true)
|
|
8416
|
+
}
|
|
8417
|
+
)
|
|
8418
|
+
]
|
|
8419
|
+
}
|
|
8420
|
+
),
|
|
8421
|
+
/* @__PURE__ */ jsx21(
|
|
8422
|
+
MemberListToolbar,
|
|
8423
|
+
{
|
|
8424
|
+
activeTab: "active",
|
|
8425
|
+
onTabChange: () => {
|
|
8426
|
+
},
|
|
8427
|
+
activeLabel: "Members",
|
|
8428
|
+
activeCount: failed ? null : filtered.length,
|
|
8429
|
+
searchQuery,
|
|
8430
|
+
onSearchChange: setSearchQuery
|
|
8431
|
+
}
|
|
8432
|
+
),
|
|
8433
|
+
/* @__PURE__ */ jsx21(
|
|
8434
|
+
MemberListFrame,
|
|
8435
|
+
{
|
|
8436
|
+
contentMinWidth: 860,
|
|
8437
|
+
header: /* @__PURE__ */ jsx21(
|
|
8438
|
+
"div",
|
|
8439
|
+
{
|
|
8440
|
+
style: {
|
|
8441
|
+
display: "grid",
|
|
8442
|
+
gridTemplateColumns: COLUMNS,
|
|
8443
|
+
gap: 24,
|
|
8444
|
+
padding: "8px 16px",
|
|
8445
|
+
fontSize: 11,
|
|
8446
|
+
color: T13.muted,
|
|
8447
|
+
textTransform: "uppercase"
|
|
8448
|
+
},
|
|
8449
|
+
children: ["Name", "Used this cycle", "Last cycle's usage", "Limit", "Actions"].map(
|
|
8450
|
+
(label) => /* @__PURE__ */ jsx21("span", { children: label }, label)
|
|
8451
|
+
)
|
|
8452
|
+
}
|
|
8453
|
+
),
|
|
8454
|
+
isEmpty: failed || filtered.length === 0,
|
|
8455
|
+
emptyText: failed ? "Couldn't load usage limits. Try again later." : searchQuery.trim() ? "No members match your search" : "No members yet",
|
|
8456
|
+
children: filtered.map((row) => /* @__PURE__ */ jsx21(
|
|
8457
|
+
LimitRow,
|
|
8458
|
+
{
|
|
8459
|
+
row,
|
|
8460
|
+
unit,
|
|
8461
|
+
onEdit: api.setMemberCreditLimit ? () => setEditing(row) : void 0
|
|
8462
|
+
},
|
|
8463
|
+
row.userId
|
|
8464
|
+
))
|
|
8465
|
+
}
|
|
8466
|
+
),
|
|
8467
|
+
editing && /* @__PURE__ */ jsx21(
|
|
8468
|
+
MemberCreditLimitModal,
|
|
8469
|
+
{
|
|
8470
|
+
open: true,
|
|
8471
|
+
resetKey: editing.userId,
|
|
8472
|
+
subject: { name: editing.member.user.name, email: editing.member.user.email },
|
|
8473
|
+
used: editing.used,
|
|
8474
|
+
initialLimit: editing.limit,
|
|
8475
|
+
isSet: editing.hasLimit,
|
|
8476
|
+
unit,
|
|
8477
|
+
onSave: (limit) => api.setMemberCreditLimit({ userId: editing.userId, limit }),
|
|
8478
|
+
onRemove: editing.hasLimit && api.removeMemberCreditLimit ? () => api.removeMemberCreditLimit(editing.userId) : void 0,
|
|
8479
|
+
removeLabel: limits?.default ? "Use default" : "Remove",
|
|
8480
|
+
removeHint: limits?.default ? `Falls back to the default: ${describeDefaultLimit(limits, unit)}` : "No default is set, so the member becomes unlimited.",
|
|
8481
|
+
onClose: () => setEditing(null),
|
|
8482
|
+
onSaved: () => void load({ refresh: true }),
|
|
8483
|
+
onStale: () => void load({ refresh: true })
|
|
8484
|
+
}
|
|
8485
|
+
),
|
|
8486
|
+
editingDefault && api.setDefaultCreditLimit && /* @__PURE__ */ jsx21(
|
|
8487
|
+
MemberCreditLimitModal,
|
|
8488
|
+
{
|
|
8489
|
+
open: true,
|
|
8490
|
+
title: "Default usage limit",
|
|
8491
|
+
description: "Applies to every member without their own limit, including new members.",
|
|
8492
|
+
used: 0,
|
|
8493
|
+
initialLimit: limits?.default?.limit ?? null,
|
|
8494
|
+
isSet: Boolean(limits?.default),
|
|
8495
|
+
unit,
|
|
8496
|
+
onSave: (limit) => api.setDefaultCreditLimit(limit),
|
|
8497
|
+
saveSuccessMessage: "Default usage limit updated",
|
|
8498
|
+
onClose: () => setEditingDefault(false),
|
|
8499
|
+
onSaved: () => void load({ refresh: true })
|
|
8500
|
+
}
|
|
8501
|
+
)
|
|
8502
|
+
] });
|
|
8503
|
+
}
|
|
8504
|
+
|
|
8505
|
+
// src/billing-content.tsx
|
|
8506
|
+
import { Fragment as Fragment9, jsx as jsx22, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
8507
|
+
var DEFAULT_TOPUP_SERVICE = "catalogix";
|
|
8508
|
+
var PRIMARY_COLOR2 = "var(--alias-text---icons-primary)";
|
|
8509
|
+
var MUTED_COLOR = "var(--alias-text---icons-muted)";
|
|
8510
|
+
function formatDate2(iso) {
|
|
8511
|
+
try {
|
|
8512
|
+
return new Date(iso).toLocaleDateString("en-US", {
|
|
8513
|
+
month: "short",
|
|
8514
|
+
day: "numeric",
|
|
8515
|
+
year: "numeric"
|
|
8516
|
+
});
|
|
8517
|
+
} catch {
|
|
8518
|
+
return iso;
|
|
8519
|
+
}
|
|
8520
|
+
}
|
|
8521
|
+
function formatCurrency(cents, currency) {
|
|
8522
|
+
if (currency === "inr") {
|
|
8523
|
+
return `\u20B9${(cents / 100).toFixed(2)}`;
|
|
8524
|
+
}
|
|
8525
|
+
return `$${(cents / 100).toFixed(2)}`;
|
|
8526
|
+
}
|
|
8527
|
+
function getCurrencySymbolByCountry(country) {
|
|
8528
|
+
return country?.trim().toUpperCase() === "IN" ? "\u20B9" : "$";
|
|
8529
|
+
}
|
|
8530
|
+
function formatCredits2(n) {
|
|
8531
|
+
return n.toLocaleString("en-US");
|
|
8532
|
+
}
|
|
8533
|
+
function formatNextBillingDateLabel(iso) {
|
|
8534
|
+
if (iso) {
|
|
8535
|
+
const parsed = new Date(iso);
|
|
8536
|
+
if (!Number.isNaN(parsed.getTime())) {
|
|
8537
|
+
return parsed.toLocaleDateString("en-US", {
|
|
8538
|
+
month: "short",
|
|
8539
|
+
day: "numeric",
|
|
8540
|
+
year: "numeric"
|
|
8541
|
+
});
|
|
8542
|
+
}
|
|
8543
|
+
}
|
|
8544
|
+
const fallback = /* @__PURE__ */ new Date();
|
|
8545
|
+
fallback.setMonth(fallback.getMonth() + 1);
|
|
8546
|
+
return fallback.toLocaleDateString("en-US", {
|
|
8547
|
+
month: "short",
|
|
8548
|
+
day: "numeric",
|
|
8549
|
+
year: "numeric"
|
|
8550
|
+
});
|
|
8551
|
+
}
|
|
8552
|
+
function formatEffectiveDateLabel(value) {
|
|
8553
|
+
if (value == null) return "";
|
|
8554
|
+
const parsed = typeof value === "number" ? new Date(value < 1e10 ? value * 1e3 : value) : new Date(value);
|
|
8555
|
+
if (Number.isNaN(parsed.getTime())) return "";
|
|
8556
|
+
return parsed.toLocaleDateString("en-US", {
|
|
8557
|
+
month: "short",
|
|
8558
|
+
day: "numeric",
|
|
8559
|
+
year: "numeric"
|
|
8560
|
+
});
|
|
8561
|
+
}
|
|
8562
|
+
function useIsLightTheme() {
|
|
8563
|
+
const read = () => typeof document !== "undefined" && document.documentElement.getAttribute("data-theme") === "Light";
|
|
8564
|
+
const [isLight, setIsLight] = useState15(read);
|
|
8565
|
+
useEffect13(() => {
|
|
8566
|
+
if (typeof document === "undefined") return;
|
|
8567
|
+
const target = document.documentElement;
|
|
8568
|
+
const observer = new MutationObserver(() => setIsLight(read()));
|
|
8569
|
+
observer.observe(target, {
|
|
8570
|
+
attributes: true,
|
|
8571
|
+
attributeFilter: ["data-theme"]
|
|
8572
|
+
});
|
|
8573
|
+
setIsLight(read());
|
|
8574
|
+
return () => observer.disconnect();
|
|
8575
|
+
}, []);
|
|
8576
|
+
return isLight;
|
|
8577
|
+
}
|
|
8578
|
+
function UpdateSubscriptionModal({
|
|
8579
|
+
open,
|
|
8580
|
+
currentPlanName,
|
|
8581
|
+
currentPlanAmount,
|
|
8582
|
+
nextPlanName,
|
|
8583
|
+
nextPlanAmount,
|
|
8584
|
+
nextBillingDateLabel,
|
|
8585
|
+
loading,
|
|
8586
|
+
onClose,
|
|
8587
|
+
onProceed
|
|
8588
|
+
}) {
|
|
8589
|
+
const isLight = useIsLightTheme();
|
|
8590
|
+
const modalSurface = isLight ? "#ffffff" : "var(--alias-surface-base)";
|
|
8591
|
+
const cardBorder = isLight ? "1px solid var(--alias-border-subtle)" : "1px solid var(--alias-border-divider)";
|
|
8592
|
+
if (!open) return null;
|
|
8593
|
+
return /* @__PURE__ */ jsx22(
|
|
8594
|
+
"div",
|
|
8595
|
+
{
|
|
8596
|
+
className: "fixed inset-0 z-50 flex items-center justify-center",
|
|
8597
|
+
style: { backgroundColor: "rgba(0, 0, 0, 0.6)" },
|
|
8598
|
+
onClick: (event) => {
|
|
8599
|
+
if (event.target === event.currentTarget) onClose();
|
|
8600
|
+
},
|
|
8601
|
+
children: /* @__PURE__ */ jsxs19(
|
|
8602
|
+
"div",
|
|
8603
|
+
{
|
|
8604
|
+
className: "flex flex-col w-full max-w-xl",
|
|
8605
|
+
style: {
|
|
8606
|
+
backgroundColor: modalSurface,
|
|
8607
|
+
borderRadius: "var(--radius-3xl)",
|
|
8608
|
+
border: "1px solid var(--alias-border-subtle)",
|
|
8609
|
+
padding: "var(--spacing-6xl)",
|
|
8610
|
+
gap: "var(--spacing-6xl)",
|
|
8611
|
+
maxHeight: "90vh",
|
|
8612
|
+
overflowY: "auto"
|
|
8613
|
+
},
|
|
8614
|
+
children: [
|
|
8615
|
+
/* @__PURE__ */ jsxs19("div", { className: "flex items-center w-full", children: [
|
|
8616
|
+
/* @__PURE__ */ jsx22(
|
|
8617
|
+
"p",
|
|
8618
|
+
{
|
|
8619
|
+
className: "flex-1 min-w-0",
|
|
8620
|
+
style: {
|
|
8621
|
+
fontFamily: "var(--font-family-font-family-display)",
|
|
8622
|
+
fontSize: "var(--font-size-font-size-xxl)",
|
|
8623
|
+
fontWeight: 600,
|
|
8624
|
+
lineHeight: "var(--line-height-line-height-xxl)",
|
|
8625
|
+
color: "var(--alias-text---icons-primary)"
|
|
8626
|
+
},
|
|
8627
|
+
children: "Update Subscription"
|
|
8628
|
+
}
|
|
8629
|
+
),
|
|
8630
|
+
/* @__PURE__ */ jsx22(
|
|
8631
|
+
"button",
|
|
8632
|
+
{
|
|
8633
|
+
type: "button",
|
|
8634
|
+
onClick: onClose,
|
|
8635
|
+
style: { background: "transparent", border: "none" },
|
|
8636
|
+
children: /* @__PURE__ */ jsx22(SiconClose7, { className: "w-6 h-6", color: MUTED_COLOR })
|
|
8637
|
+
}
|
|
8638
|
+
)
|
|
8639
|
+
] }),
|
|
8640
|
+
/* @__PURE__ */ jsx22(
|
|
8641
|
+
"div",
|
|
8642
|
+
{
|
|
8643
|
+
className: "w-full",
|
|
8644
|
+
style: {
|
|
8645
|
+
height: "1px",
|
|
8646
|
+
backgroundColor: "var(--alias-border-divider)"
|
|
8647
|
+
}
|
|
8648
|
+
}
|
|
8649
|
+
),
|
|
8650
|
+
/* @__PURE__ */ jsxs19(
|
|
8651
|
+
"div",
|
|
8652
|
+
{
|
|
8653
|
+
className: "flex flex-col w-full",
|
|
8654
|
+
style: { gap: "var(--spacing-3xl)" },
|
|
8655
|
+
children: [
|
|
8656
|
+
/* @__PURE__ */ jsx22(
|
|
8657
|
+
"p",
|
|
8658
|
+
{
|
|
8659
|
+
style: {
|
|
8660
|
+
fontFamily: "var(--font-family-font-family-body)",
|
|
8661
|
+
fontSize: "var(--font-size-font-size-sm)",
|
|
8662
|
+
fontWeight: 500,
|
|
8663
|
+
lineHeight: "var(--line-height-line-height-sm)",
|
|
8664
|
+
color: "var(--alias-text---icons-primary)"
|
|
8665
|
+
},
|
|
8666
|
+
children: "Current billing plan"
|
|
8667
|
+
}
|
|
8668
|
+
),
|
|
8669
|
+
/* @__PURE__ */ jsxs19(
|
|
8670
|
+
"div",
|
|
7934
8671
|
{
|
|
7935
8672
|
className: "flex items-center w-full",
|
|
7936
8673
|
style: {
|
|
@@ -7940,7 +8677,7 @@ function UpdateSubscriptionModal({
|
|
|
7940
8677
|
padding: "var(--spacing-3xl)"
|
|
7941
8678
|
},
|
|
7942
8679
|
children: [
|
|
7943
|
-
/* @__PURE__ */
|
|
8680
|
+
/* @__PURE__ */ jsx22(
|
|
7944
8681
|
"p",
|
|
7945
8682
|
{
|
|
7946
8683
|
className: "flex-1 min-w-0",
|
|
@@ -7954,8 +8691,8 @@ function UpdateSubscriptionModal({
|
|
|
7954
8691
|
children: currentPlanName || "Free"
|
|
7955
8692
|
}
|
|
7956
8693
|
),
|
|
7957
|
-
/* @__PURE__ */
|
|
7958
|
-
/* @__PURE__ */
|
|
8694
|
+
/* @__PURE__ */ jsxs19("div", { className: "flex flex-col items-end", children: [
|
|
8695
|
+
/* @__PURE__ */ jsx22(
|
|
7959
8696
|
"p",
|
|
7960
8697
|
{
|
|
7961
8698
|
style: {
|
|
@@ -7968,7 +8705,7 @@ function UpdateSubscriptionModal({
|
|
|
7968
8705
|
children: currentPlanAmount
|
|
7969
8706
|
}
|
|
7970
8707
|
),
|
|
7971
|
-
/* @__PURE__ */
|
|
8708
|
+
/* @__PURE__ */ jsx22(
|
|
7972
8709
|
"p",
|
|
7973
8710
|
{
|
|
7974
8711
|
style: {
|
|
@@ -7985,7 +8722,7 @@ function UpdateSubscriptionModal({
|
|
|
7985
8722
|
]
|
|
7986
8723
|
}
|
|
7987
8724
|
),
|
|
7988
|
-
/* @__PURE__ */
|
|
8725
|
+
/* @__PURE__ */ jsx22("div", { className: "w-full flex items-center justify-center", children: /* @__PURE__ */ jsx22(
|
|
7989
8726
|
"div",
|
|
7990
8727
|
{
|
|
7991
8728
|
className: "flex items-center justify-center",
|
|
@@ -7996,10 +8733,10 @@ function UpdateSubscriptionModal({
|
|
|
7996
8733
|
backgroundColor: "var(--alias-fill-neutral-neutral)",
|
|
7997
8734
|
border: cardBorder
|
|
7998
8735
|
},
|
|
7999
|
-
children: /* @__PURE__ */
|
|
8736
|
+
children: /* @__PURE__ */ jsx22(SiconDoubleArrow, { className: "w-4 h-4", color: MUTED_COLOR })
|
|
8000
8737
|
}
|
|
8001
8738
|
) }),
|
|
8002
|
-
/* @__PURE__ */
|
|
8739
|
+
/* @__PURE__ */ jsxs19(
|
|
8003
8740
|
"p",
|
|
8004
8741
|
{
|
|
8005
8742
|
style: {
|
|
@@ -8015,7 +8752,7 @@ function UpdateSubscriptionModal({
|
|
|
8015
8752
|
]
|
|
8016
8753
|
}
|
|
8017
8754
|
),
|
|
8018
|
-
/* @__PURE__ */
|
|
8755
|
+
/* @__PURE__ */ jsxs19(
|
|
8019
8756
|
"div",
|
|
8020
8757
|
{
|
|
8021
8758
|
className: "flex items-center w-full",
|
|
@@ -8026,7 +8763,7 @@ function UpdateSubscriptionModal({
|
|
|
8026
8763
|
padding: "var(--spacing-3xl)"
|
|
8027
8764
|
},
|
|
8028
8765
|
children: [
|
|
8029
|
-
/* @__PURE__ */
|
|
8766
|
+
/* @__PURE__ */ jsx22(
|
|
8030
8767
|
"p",
|
|
8031
8768
|
{
|
|
8032
8769
|
className: "flex-1 min-w-0",
|
|
@@ -8040,8 +8777,8 @@ function UpdateSubscriptionModal({
|
|
|
8040
8777
|
children: nextPlanName || "Pro"
|
|
8041
8778
|
}
|
|
8042
8779
|
),
|
|
8043
|
-
/* @__PURE__ */
|
|
8044
|
-
/* @__PURE__ */
|
|
8780
|
+
/* @__PURE__ */ jsxs19("div", { className: "flex flex-col items-end", children: [
|
|
8781
|
+
/* @__PURE__ */ jsx22(
|
|
8045
8782
|
"p",
|
|
8046
8783
|
{
|
|
8047
8784
|
style: {
|
|
@@ -8054,7 +8791,7 @@ function UpdateSubscriptionModal({
|
|
|
8054
8791
|
children: nextPlanAmount
|
|
8055
8792
|
}
|
|
8056
8793
|
),
|
|
8057
|
-
/* @__PURE__ */
|
|
8794
|
+
/* @__PURE__ */ jsx22(
|
|
8058
8795
|
"p",
|
|
8059
8796
|
{
|
|
8060
8797
|
style: {
|
|
@@ -8071,7 +8808,7 @@ function UpdateSubscriptionModal({
|
|
|
8071
8808
|
]
|
|
8072
8809
|
}
|
|
8073
8810
|
),
|
|
8074
|
-
/* @__PURE__ */
|
|
8811
|
+
/* @__PURE__ */ jsx22(
|
|
8075
8812
|
"div",
|
|
8076
8813
|
{
|
|
8077
8814
|
className: "w-full",
|
|
@@ -8081,8 +8818,8 @@ function UpdateSubscriptionModal({
|
|
|
8081
8818
|
}
|
|
8082
8819
|
}
|
|
8083
8820
|
),
|
|
8084
|
-
/* @__PURE__ */
|
|
8085
|
-
/* @__PURE__ */
|
|
8821
|
+
/* @__PURE__ */ jsxs19("div", { className: "flex items-center w-full", children: [
|
|
8822
|
+
/* @__PURE__ */ jsx22(
|
|
8086
8823
|
"p",
|
|
8087
8824
|
{
|
|
8088
8825
|
className: "flex-1 min-w-0",
|
|
@@ -8096,7 +8833,7 @@ function UpdateSubscriptionModal({
|
|
|
8096
8833
|
children: "Amount Due Today"
|
|
8097
8834
|
}
|
|
8098
8835
|
),
|
|
8099
|
-
/* @__PURE__ */
|
|
8836
|
+
/* @__PURE__ */ jsx22(
|
|
8100
8837
|
"p",
|
|
8101
8838
|
{
|
|
8102
8839
|
style: {
|
|
@@ -8113,7 +8850,7 @@ function UpdateSubscriptionModal({
|
|
|
8113
8850
|
]
|
|
8114
8851
|
}
|
|
8115
8852
|
),
|
|
8116
|
-
/* @__PURE__ */
|
|
8853
|
+
/* @__PURE__ */ jsx22(
|
|
8117
8854
|
"button",
|
|
8118
8855
|
{
|
|
8119
8856
|
type: "button",
|
|
@@ -8128,7 +8865,7 @@ function UpdateSubscriptionModal({
|
|
|
8128
8865
|
},
|
|
8129
8866
|
disabled: loading,
|
|
8130
8867
|
onClick: onProceed,
|
|
8131
|
-
children: /* @__PURE__ */
|
|
8868
|
+
children: /* @__PURE__ */ jsx22(
|
|
8132
8869
|
"span",
|
|
8133
8870
|
{
|
|
8134
8871
|
style: {
|
|
@@ -8168,7 +8905,7 @@ function PlansView({
|
|
|
8168
8905
|
const workspaceCurrencySymbol = getCurrencySymbolByCountry(
|
|
8169
8906
|
workspace?.country
|
|
8170
8907
|
);
|
|
8171
|
-
const allPlans =
|
|
8908
|
+
const allPlans = useMemo4(() => {
|
|
8172
8909
|
if (products.length > 0) {
|
|
8173
8910
|
return products.flatMap(
|
|
8174
8911
|
(product) => product.prices.filter((price) => Boolean(price.metadata?.credits)).map((price) => ({
|
|
@@ -8186,7 +8923,7 @@ function PlansView({
|
|
|
8186
8923
|
}
|
|
8187
8924
|
return [];
|
|
8188
8925
|
}, [products, currentPlanId]);
|
|
8189
|
-
const sortedPlans =
|
|
8926
|
+
const sortedPlans = useMemo4(
|
|
8190
8927
|
() => [...allPlans].sort((a, b) => a.amount - b.amount),
|
|
8191
8928
|
[allPlans]
|
|
8192
8929
|
);
|
|
@@ -8203,8 +8940,8 @@ function PlansView({
|
|
|
8203
8940
|
const currentPlan = sortedPlans.find((plan) => plan.isCurrent) ?? freePlan;
|
|
8204
8941
|
const middlePlans = sortedPlans.filter((plan) => plan.amount > 0);
|
|
8205
8942
|
const currentPlanAmount = currentPlan?.amount ?? 0;
|
|
8206
|
-
const [selectedMiddlePlanKey, setSelectedMiddlePlanKey] =
|
|
8207
|
-
|
|
8943
|
+
const [selectedMiddlePlanKey, setSelectedMiddlePlanKey] = useState15("");
|
|
8944
|
+
useEffect13(() => {
|
|
8208
8945
|
if (middlePlans.length === 0) {
|
|
8209
8946
|
setSelectedMiddlePlanKey("");
|
|
8210
8947
|
return;
|
|
@@ -8218,9 +8955,9 @@ function PlansView({
|
|
|
8218
8955
|
const isMiddleActionLoading = Boolean(
|
|
8219
8956
|
selectedMiddlePlan && actionInFlight === selectedMiddlePlan.key
|
|
8220
8957
|
);
|
|
8221
|
-
const [isPlanSelectorOpen, setIsPlanSelectorOpen] =
|
|
8222
|
-
const planDropdownRef =
|
|
8223
|
-
|
|
8958
|
+
const [isPlanSelectorOpen, setIsPlanSelectorOpen] = useState15(false);
|
|
8959
|
+
const planDropdownRef = useRef7(null);
|
|
8960
|
+
useEffect13(() => {
|
|
8224
8961
|
if (!isPlanSelectorOpen) return;
|
|
8225
8962
|
const handleClickOutside = (event) => {
|
|
8226
8963
|
const target = event.target;
|
|
@@ -8238,8 +8975,8 @@ function PlansView({
|
|
|
8238
8975
|
const isCurrentWithDowngrade = Boolean(
|
|
8239
8976
|
currentPlan?.isCurrent && downgradeScheduled
|
|
8240
8977
|
);
|
|
8241
|
-
const [showUpgradeConfirmModal, setShowUpgradeConfirmModal] =
|
|
8242
|
-
return /* @__PURE__ */
|
|
8978
|
+
const [showUpgradeConfirmModal, setShowUpgradeConfirmModal] = useState15(false);
|
|
8979
|
+
return /* @__PURE__ */ jsxs19(
|
|
8243
8980
|
"div",
|
|
8244
8981
|
{
|
|
8245
8982
|
className: "flex flex-col items-start relative size-full overflow-y-auto",
|
|
@@ -8250,12 +8987,12 @@ function PlansView({
|
|
|
8250
8987
|
backgroundSize: "24px 24px"
|
|
8251
8988
|
},
|
|
8252
8989
|
children: [
|
|
8253
|
-
!hideHeader && /* @__PURE__ */
|
|
8990
|
+
!hideHeader && /* @__PURE__ */ jsx22(
|
|
8254
8991
|
"div",
|
|
8255
8992
|
{
|
|
8256
8993
|
className: "flex items-center justify-end shrink-0 w-full",
|
|
8257
8994
|
style: { gap: "var(--spacing-lg)" },
|
|
8258
|
-
children: /* @__PURE__ */
|
|
8995
|
+
children: /* @__PURE__ */ jsxs19(
|
|
8259
8996
|
"div",
|
|
8260
8997
|
{
|
|
8261
8998
|
className: "flex items-center shrink-0 cursor-pointer",
|
|
@@ -8269,8 +9006,8 @@ function PlansView({
|
|
|
8269
9006
|
},
|
|
8270
9007
|
onClick: onBack,
|
|
8271
9008
|
children: [
|
|
8272
|
-
/* @__PURE__ */
|
|
8273
|
-
/* @__PURE__ */
|
|
9009
|
+
/* @__PURE__ */ jsx22(SiconLeft2, { className: "w-4 h-4", color: MUTED_COLOR }),
|
|
9010
|
+
/* @__PURE__ */ jsx22(
|
|
8274
9011
|
"span",
|
|
8275
9012
|
{
|
|
8276
9013
|
style: {
|
|
@@ -8288,13 +9025,13 @@ function PlansView({
|
|
|
8288
9025
|
)
|
|
8289
9026
|
}
|
|
8290
9027
|
),
|
|
8291
|
-
/* @__PURE__ */
|
|
9028
|
+
/* @__PURE__ */ jsxs19(
|
|
8292
9029
|
"div",
|
|
8293
9030
|
{
|
|
8294
9031
|
className: "grid w-full grid-cols-1 md:grid-cols-2 xl:grid-cols-3 items-stretch",
|
|
8295
9032
|
style: { gap: "var(--spacing-8xl)" },
|
|
8296
9033
|
children: [
|
|
8297
|
-
/* @__PURE__ */
|
|
9034
|
+
/* @__PURE__ */ jsx22("div", { className: "h-full", children: /* @__PURE__ */ jsx22(
|
|
8298
9035
|
ScPlanCard,
|
|
8299
9036
|
{
|
|
8300
9037
|
planName: freePlan?.planName || "Free",
|
|
@@ -8324,7 +9061,7 @@ function PlansView({
|
|
|
8324
9061
|
className: "h-full"
|
|
8325
9062
|
}
|
|
8326
9063
|
) }),
|
|
8327
|
-
/* @__PURE__ */
|
|
9064
|
+
/* @__PURE__ */ jsx22("div", { className: "h-full", children: /* @__PURE__ */ jsx22(
|
|
8328
9065
|
ScPlanCard,
|
|
8329
9066
|
{
|
|
8330
9067
|
planName: "Pro",
|
|
@@ -8345,7 +9082,7 @@ function PlansView({
|
|
|
8345
9082
|
setShowUpgradeConfirmModal(true);
|
|
8346
9083
|
},
|
|
8347
9084
|
onIncreaseCredits: () => setIsPlanSelectorOpen((prev) => !prev),
|
|
8348
|
-
creditsDropdown: isPlanSelectorOpen ? /* @__PURE__ */
|
|
9085
|
+
creditsDropdown: isPlanSelectorOpen ? /* @__PURE__ */ jsx22(
|
|
8349
9086
|
"div",
|
|
8350
9087
|
{
|
|
8351
9088
|
ref: planDropdownRef,
|
|
@@ -8362,7 +9099,7 @@ function PlansView({
|
|
|
8362
9099
|
},
|
|
8363
9100
|
children: middlePlans.map((plan) => {
|
|
8364
9101
|
const selected = plan.key === selectedMiddlePlanKey;
|
|
8365
|
-
return /* @__PURE__ */
|
|
9102
|
+
return /* @__PURE__ */ jsxs19(
|
|
8366
9103
|
"button",
|
|
8367
9104
|
{
|
|
8368
9105
|
type: "button",
|
|
@@ -8380,7 +9117,7 @@ function PlansView({
|
|
|
8380
9117
|
setIsPlanSelectorOpen(false);
|
|
8381
9118
|
},
|
|
8382
9119
|
children: [
|
|
8383
|
-
/* @__PURE__ */
|
|
9120
|
+
/* @__PURE__ */ jsx22(
|
|
8384
9121
|
"span",
|
|
8385
9122
|
{
|
|
8386
9123
|
className: "flex-1 min-w-0 truncate",
|
|
@@ -8394,7 +9131,7 @@ function PlansView({
|
|
|
8394
9131
|
children: plan.credits
|
|
8395
9132
|
}
|
|
8396
9133
|
),
|
|
8397
|
-
/* @__PURE__ */
|
|
9134
|
+
/* @__PURE__ */ jsx22(
|
|
8398
9135
|
"span",
|
|
8399
9136
|
{
|
|
8400
9137
|
style: {
|
|
@@ -8417,7 +9154,7 @@ function PlansView({
|
|
|
8417
9154
|
className: "h-full"
|
|
8418
9155
|
}
|
|
8419
9156
|
) }),
|
|
8420
|
-
/* @__PURE__ */
|
|
9157
|
+
/* @__PURE__ */ jsx22("div", { className: "h-full", children: /* @__PURE__ */ jsx22(
|
|
8421
9158
|
ScPlanCard,
|
|
8422
9159
|
{
|
|
8423
9160
|
planName: "Enterprise",
|
|
@@ -8434,7 +9171,7 @@ function PlansView({
|
|
|
8434
9171
|
]
|
|
8435
9172
|
}
|
|
8436
9173
|
),
|
|
8437
|
-
/* @__PURE__ */
|
|
9174
|
+
/* @__PURE__ */ jsx22(
|
|
8438
9175
|
ScPlanComparison,
|
|
8439
9176
|
{
|
|
8440
9177
|
layout: "table",
|
|
@@ -8444,7 +9181,7 @@ function PlansView({
|
|
|
8444
9181
|
highlightColumnIndex: 1
|
|
8445
9182
|
}
|
|
8446
9183
|
),
|
|
8447
|
-
/* @__PURE__ */
|
|
9184
|
+
/* @__PURE__ */ jsx22(
|
|
8448
9185
|
UpdateSubscriptionModal,
|
|
8449
9186
|
{
|
|
8450
9187
|
open: showUpgradeConfirmModal,
|
|
@@ -8479,7 +9216,7 @@ function BillingTabBar({
|
|
|
8479
9216
|
activeTab,
|
|
8480
9217
|
onTabChange
|
|
8481
9218
|
}) {
|
|
8482
|
-
return /* @__PURE__ */
|
|
9219
|
+
return /* @__PURE__ */ jsxs19(
|
|
8483
9220
|
"div",
|
|
8484
9221
|
{
|
|
8485
9222
|
className: "flex items-center shrink-0 relative",
|
|
@@ -8491,7 +9228,7 @@ function BillingTabBar({
|
|
|
8491
9228
|
border: "0.5px solid var(--alias-border-subtle)"
|
|
8492
9229
|
},
|
|
8493
9230
|
children: [
|
|
8494
|
-
/* @__PURE__ */
|
|
9231
|
+
/* @__PURE__ */ jsx22(
|
|
8495
9232
|
ScTabComp2,
|
|
8496
9233
|
{
|
|
8497
9234
|
text: "Invoice history",
|
|
@@ -8501,7 +9238,7 @@ function BillingTabBar({
|
|
|
8501
9238
|
style: { flex: 1 }
|
|
8502
9239
|
}
|
|
8503
9240
|
),
|
|
8504
|
-
/* @__PURE__ */
|
|
9241
|
+
/* @__PURE__ */ jsx22(
|
|
8505
9242
|
ScTabComp2,
|
|
8506
9243
|
{
|
|
8507
9244
|
text: "Usage logs",
|
|
@@ -8563,7 +9300,7 @@ function InvoiceHistoryTable({
|
|
|
8563
9300
|
}
|
|
8564
9301
|
};
|
|
8565
9302
|
if (loading) {
|
|
8566
|
-
return /* @__PURE__ */
|
|
9303
|
+
return /* @__PURE__ */ jsx22(
|
|
8567
9304
|
"div",
|
|
8568
9305
|
{
|
|
8569
9306
|
className: "flex items-center justify-center w-full",
|
|
@@ -8572,7 +9309,7 @@ function InvoiceHistoryTable({
|
|
|
8572
9309
|
borderRadius: "var(--radius-3xl)",
|
|
8573
9310
|
padding: "var(--spacing-6xl)"
|
|
8574
9311
|
},
|
|
8575
|
-
children: /* @__PURE__ */
|
|
9312
|
+
children: /* @__PURE__ */ jsx22(
|
|
8576
9313
|
"div",
|
|
8577
9314
|
{
|
|
8578
9315
|
className: "animate-spin",
|
|
@@ -8588,7 +9325,7 @@ function InvoiceHistoryTable({
|
|
|
8588
9325
|
}
|
|
8589
9326
|
);
|
|
8590
9327
|
}
|
|
8591
|
-
return /* @__PURE__ */
|
|
9328
|
+
return /* @__PURE__ */ jsxs19(
|
|
8592
9329
|
"div",
|
|
8593
9330
|
{
|
|
8594
9331
|
className: "flex-1 min-h-0 w-full relative",
|
|
@@ -8599,7 +9336,7 @@ function InvoiceHistoryTable({
|
|
|
8599
9336
|
overflowY: "auto"
|
|
8600
9337
|
},
|
|
8601
9338
|
children: [
|
|
8602
|
-
/* @__PURE__ */
|
|
9339
|
+
/* @__PURE__ */ jsx22(
|
|
8603
9340
|
"div",
|
|
8604
9341
|
{
|
|
8605
9342
|
style: {
|
|
@@ -8608,15 +9345,15 @@ function InvoiceHistoryTable({
|
|
|
8608
9345
|
zIndex: 1,
|
|
8609
9346
|
backgroundColor: "var(--alias-surface-base)"
|
|
8610
9347
|
},
|
|
8611
|
-
children: /* @__PURE__ */
|
|
9348
|
+
children: /* @__PURE__ */ jsx22(ScBillingHistoryHeader, {})
|
|
8612
9349
|
}
|
|
8613
9350
|
),
|
|
8614
|
-
invoices.length === 0 && /* @__PURE__ */
|
|
9351
|
+
invoices.length === 0 && /* @__PURE__ */ jsx22(
|
|
8615
9352
|
"div",
|
|
8616
9353
|
{
|
|
8617
9354
|
className: "flex items-center justify-center w-full",
|
|
8618
9355
|
style: { padding: "var(--spacing-6xl)" },
|
|
8619
|
-
children: /* @__PURE__ */
|
|
9356
|
+
children: /* @__PURE__ */ jsx22(
|
|
8620
9357
|
"span",
|
|
8621
9358
|
{
|
|
8622
9359
|
style: {
|
|
@@ -8631,7 +9368,7 @@ function InvoiceHistoryTable({
|
|
|
8631
9368
|
)
|
|
8632
9369
|
}
|
|
8633
9370
|
),
|
|
8634
|
-
invoices.map((inv) => /* @__PURE__ */
|
|
9371
|
+
invoices.map((inv) => /* @__PURE__ */ jsx22(
|
|
8635
9372
|
ScBillingHistoryTableList,
|
|
8636
9373
|
{
|
|
8637
9374
|
invoiceNumber: inv.transactionId ? `# ${inv.transactionId.slice(0, 16).toUpperCase()}` : "# INV-UNKNOWN",
|
|
@@ -8652,7 +9389,7 @@ function UsageLogsTable({
|
|
|
8652
9389
|
loading
|
|
8653
9390
|
}) {
|
|
8654
9391
|
if (loading) {
|
|
8655
|
-
return /* @__PURE__ */
|
|
9392
|
+
return /* @__PURE__ */ jsx22(
|
|
8656
9393
|
"div",
|
|
8657
9394
|
{
|
|
8658
9395
|
className: "flex items-center justify-center w-full",
|
|
@@ -8661,7 +9398,7 @@ function UsageLogsTable({
|
|
|
8661
9398
|
borderRadius: "var(--radius-3xl)",
|
|
8662
9399
|
padding: "var(--spacing-6xl)"
|
|
8663
9400
|
},
|
|
8664
|
-
children: /* @__PURE__ */
|
|
9401
|
+
children: /* @__PURE__ */ jsx22(
|
|
8665
9402
|
"div",
|
|
8666
9403
|
{
|
|
8667
9404
|
className: "animate-spin",
|
|
@@ -8677,7 +9414,7 @@ function UsageLogsTable({
|
|
|
8677
9414
|
}
|
|
8678
9415
|
);
|
|
8679
9416
|
}
|
|
8680
|
-
return /* @__PURE__ */
|
|
9417
|
+
return /* @__PURE__ */ jsxs19(
|
|
8681
9418
|
"div",
|
|
8682
9419
|
{
|
|
8683
9420
|
className: "flex-1 min-h-0 w-full relative",
|
|
@@ -8688,7 +9425,7 @@ function UsageLogsTable({
|
|
|
8688
9425
|
overflowY: "auto"
|
|
8689
9426
|
},
|
|
8690
9427
|
children: [
|
|
8691
|
-
/* @__PURE__ */
|
|
9428
|
+
/* @__PURE__ */ jsxs19(
|
|
8692
9429
|
"div",
|
|
8693
9430
|
{
|
|
8694
9431
|
style: {
|
|
@@ -8703,7 +9440,7 @@ function UsageLogsTable({
|
|
|
8703
9440
|
alignItems: "center"
|
|
8704
9441
|
},
|
|
8705
9442
|
children: [
|
|
8706
|
-
/* @__PURE__ */
|
|
9443
|
+
/* @__PURE__ */ jsx22(
|
|
8707
9444
|
ScHeader,
|
|
8708
9445
|
{
|
|
8709
9446
|
text: "App",
|
|
@@ -8711,7 +9448,7 @@ function UsageLogsTable({
|
|
|
8711
9448
|
style: { flex: 1, alignItems: "flex-start", gap: "0.25rem" }
|
|
8712
9449
|
}
|
|
8713
9450
|
),
|
|
8714
|
-
/* @__PURE__ */
|
|
9451
|
+
/* @__PURE__ */ jsx22(
|
|
8715
9452
|
ScHeader,
|
|
8716
9453
|
{
|
|
8717
9454
|
text: "Activity",
|
|
@@ -8719,7 +9456,7 @@ function UsageLogsTable({
|
|
|
8719
9456
|
style: { flex: 1, alignItems: "flex-start", gap: "0.25rem" }
|
|
8720
9457
|
}
|
|
8721
9458
|
),
|
|
8722
|
-
/* @__PURE__ */
|
|
9459
|
+
/* @__PURE__ */ jsx22(
|
|
8723
9460
|
ScHeader,
|
|
8724
9461
|
{
|
|
8725
9462
|
text: "Used by",
|
|
@@ -8727,7 +9464,7 @@ function UsageLogsTable({
|
|
|
8727
9464
|
style: { flexShrink: 0, width: "7.5rem" }
|
|
8728
9465
|
}
|
|
8729
9466
|
),
|
|
8730
|
-
/* @__PURE__ */
|
|
9467
|
+
/* @__PURE__ */ jsx22(
|
|
8731
9468
|
ScHeader,
|
|
8732
9469
|
{
|
|
8733
9470
|
text: "Date",
|
|
@@ -8735,7 +9472,7 @@ function UsageLogsTable({
|
|
|
8735
9472
|
style: { flexShrink: 0, width: "7.5rem" }
|
|
8736
9473
|
}
|
|
8737
9474
|
),
|
|
8738
|
-
/* @__PURE__ */
|
|
9475
|
+
/* @__PURE__ */ jsx22(
|
|
8739
9476
|
ScHeader,
|
|
8740
9477
|
{
|
|
8741
9478
|
text: "Credits",
|
|
@@ -8750,12 +9487,12 @@ function UsageLogsTable({
|
|
|
8750
9487
|
]
|
|
8751
9488
|
}
|
|
8752
9489
|
),
|
|
8753
|
-
logs.length === 0 && /* @__PURE__ */
|
|
9490
|
+
logs.length === 0 && /* @__PURE__ */ jsx22(
|
|
8754
9491
|
"div",
|
|
8755
9492
|
{
|
|
8756
9493
|
className: "flex items-center justify-center w-full",
|
|
8757
9494
|
style: { padding: "var(--spacing-6xl)" },
|
|
8758
|
-
children: /* @__PURE__ */
|
|
9495
|
+
children: /* @__PURE__ */ jsx22(
|
|
8759
9496
|
"span",
|
|
8760
9497
|
{
|
|
8761
9498
|
style: {
|
|
@@ -8787,7 +9524,7 @@ function UsageLogsTable({
|
|
|
8787
9524
|
overflow: "hidden",
|
|
8788
9525
|
whiteSpace: "nowrap"
|
|
8789
9526
|
};
|
|
8790
|
-
return /* @__PURE__ */
|
|
9527
|
+
return /* @__PURE__ */ jsxs19(
|
|
8791
9528
|
"div",
|
|
8792
9529
|
{
|
|
8793
9530
|
style: {
|
|
@@ -8799,11 +9536,11 @@ function UsageLogsTable({
|
|
|
8799
9536
|
alignItems: "center"
|
|
8800
9537
|
},
|
|
8801
9538
|
children: [
|
|
8802
|
-
/* @__PURE__ */
|
|
8803
|
-
/* @__PURE__ */
|
|
8804
|
-
/* @__PURE__ */
|
|
8805
|
-
/* @__PURE__ */
|
|
8806
|
-
/* @__PURE__ */
|
|
9539
|
+
/* @__PURE__ */ jsx22("div", { style: { ...rowCellRegular, flex: 1 }, children: app }),
|
|
9540
|
+
/* @__PURE__ */ jsx22("div", { style: { ...rowCellRegular, flex: 1 }, children: activity }),
|
|
9541
|
+
/* @__PURE__ */ jsx22("div", { style: { ...rowCellRegular, width: "7.5rem" }, children: userName }),
|
|
9542
|
+
/* @__PURE__ */ jsx22("div", { style: { ...rowCellRegular, width: "7.5rem" }, children: formatDate2(log.createdAt) }),
|
|
9543
|
+
/* @__PURE__ */ jsx22(
|
|
8807
9544
|
"div",
|
|
8808
9545
|
{
|
|
8809
9546
|
style: {
|
|
@@ -8833,7 +9570,9 @@ function UsageLogsTable({
|
|
|
8833
9570
|
function BillingContent({
|
|
8834
9571
|
embedded = false,
|
|
8835
9572
|
showPlans: showPlansProp,
|
|
8836
|
-
onShowPlansChange
|
|
9573
|
+
onShowPlansChange,
|
|
9574
|
+
showPerUserLimits: showPerUserLimitsProp,
|
|
9575
|
+
onShowPerUserLimitsChange
|
|
8837
9576
|
} = {}) {
|
|
8838
9577
|
const { auth, workspace, api, toast, navigation } = useSettingsAdapters();
|
|
8839
9578
|
const user = auth.user;
|
|
@@ -8845,35 +9584,41 @@ function BillingContent({
|
|
|
8845
9584
|
if (typeof window === "undefined") return "";
|
|
8846
9585
|
return `${window.location.origin}${window.location.pathname}`;
|
|
8847
9586
|
};
|
|
8848
|
-
const [activeTab, setActiveTab] =
|
|
8849
|
-
const [showPlansInternal, setShowPlansInternal] =
|
|
9587
|
+
const [activeTab, setActiveTab] = useState15("invoice");
|
|
9588
|
+
const [showPlansInternal, setShowPlansInternal] = useState15(false);
|
|
8850
9589
|
const showPlans = showPlansProp ?? showPlansInternal;
|
|
8851
9590
|
const setShowPlans = (next) => {
|
|
8852
9591
|
if (onShowPlansChange) onShowPlansChange(next);
|
|
8853
9592
|
else setShowPlansInternal(next);
|
|
8854
9593
|
};
|
|
8855
|
-
const [
|
|
8856
|
-
const
|
|
8857
|
-
const
|
|
8858
|
-
|
|
8859
|
-
|
|
8860
|
-
|
|
8861
|
-
const [
|
|
8862
|
-
const [
|
|
8863
|
-
const [
|
|
8864
|
-
const [
|
|
9594
|
+
const [showPerUserLimitsInternal, setShowPerUserLimitsInternal] = useState15(false);
|
|
9595
|
+
const showPerUserLimits = (showPerUserLimitsProp ?? showPerUserLimitsInternal) && Boolean(api.fetchMemberCreditLimits);
|
|
9596
|
+
const setShowPerUserLimits = (next) => {
|
|
9597
|
+
if (onShowPerUserLimitsChange) onShowPerUserLimitsChange(next);
|
|
9598
|
+
else setShowPerUserLimitsInternal(next);
|
|
9599
|
+
};
|
|
9600
|
+
const [showExportModal, setShowExportModal] = useState15(false);
|
|
9601
|
+
const [showBuyCreditsModal, setShowBuyCreditsModal] = useState15(false);
|
|
9602
|
+
const [subscription, setSubscription] = useState15(null);
|
|
9603
|
+
const [availableCredits, setAvailableCredits] = useState15(null);
|
|
9604
|
+
const [products, setProducts] = useState15([]);
|
|
9605
|
+
const [invoices, setInvoices] = useState15([]);
|
|
9606
|
+
const [totalCredits, setTotalCredits] = useState15(null);
|
|
9607
|
+
const [usageLogs, setUsageLogs] = useState15([]);
|
|
9608
|
+
const [userMap, setUserMap] = useState15({});
|
|
9609
|
+
const [customPlanCredits, setCustomPlanCredits] = useState15(
|
|
8865
9610
|
null
|
|
8866
9611
|
);
|
|
8867
|
-
const [planActionInFlight, setPlanActionInFlight] =
|
|
9612
|
+
const [planActionInFlight, setPlanActionInFlight] = useState15(
|
|
8868
9613
|
null
|
|
8869
9614
|
);
|
|
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 =
|
|
9615
|
+
const [buyCreditsInFlight, setBuyCreditsInFlight] = useState15(false);
|
|
9616
|
+
const [loadingBilling, setLoadingBilling] = useState15(false);
|
|
9617
|
+
const [billingOverviewLoaded, setBillingOverviewLoaded] = useState15(false);
|
|
9618
|
+
const [loadingTable, setLoadingTable] = useState15(false);
|
|
9619
|
+
const [showInitialLoader, setShowInitialLoader] = useState15(true);
|
|
9620
|
+
const [initialFetchTriggered, setInitialFetchTriggered] = useState15(false);
|
|
9621
|
+
const logBillingEvent = useCallback6(
|
|
8877
9622
|
async (eventName, description, metadata) => {
|
|
8878
9623
|
if (!api.sendBillingEvent) return;
|
|
8879
9624
|
try {
|
|
@@ -8883,7 +9628,7 @@ function BillingContent({
|
|
|
8883
9628
|
},
|
|
8884
9629
|
[api]
|
|
8885
9630
|
);
|
|
8886
|
-
const ensureWorkspaceOnBilling =
|
|
9631
|
+
const ensureWorkspaceOnBilling = useCallback6(async () => {
|
|
8887
9632
|
if (!api.createWorkspaceOnBilling) return false;
|
|
8888
9633
|
try {
|
|
8889
9634
|
await api.createWorkspaceOnBilling({ serviceNames: [] });
|
|
@@ -8892,7 +9637,7 @@ function BillingContent({
|
|
|
8892
9637
|
return false;
|
|
8893
9638
|
}
|
|
8894
9639
|
}, [api]);
|
|
8895
|
-
const fetchBillingOverview =
|
|
9640
|
+
const fetchBillingOverview = useCallback6(async () => {
|
|
8896
9641
|
setLoadingBilling(true);
|
|
8897
9642
|
setBillingOverviewLoaded(false);
|
|
8898
9643
|
try {
|
|
@@ -8926,7 +9671,7 @@ function BillingContent({
|
|
|
8926
9671
|
setBillingOverviewLoaded(true);
|
|
8927
9672
|
}
|
|
8928
9673
|
}, [api, workspace.current?.country]);
|
|
8929
|
-
const fetchUserMap =
|
|
9674
|
+
const fetchUserMap = useCallback6(async () => {
|
|
8930
9675
|
try {
|
|
8931
9676
|
const members = await api.fetchMembers();
|
|
8932
9677
|
if (members && members.length) {
|
|
@@ -8939,7 +9684,7 @@ function BillingContent({
|
|
|
8939
9684
|
} catch {
|
|
8940
9685
|
}
|
|
8941
9686
|
}, [api]);
|
|
8942
|
-
const fetchTableData =
|
|
9687
|
+
const fetchTableData = useCallback6(
|
|
8943
9688
|
async (tab) => {
|
|
8944
9689
|
setLoadingTable(true);
|
|
8945
9690
|
try {
|
|
@@ -8967,7 +9712,7 @@ function BillingContent({
|
|
|
8967
9712
|
},
|
|
8968
9713
|
[api]
|
|
8969
9714
|
);
|
|
8970
|
-
const handlePlanAction =
|
|
9715
|
+
const handlePlanAction = useCallback6(
|
|
8971
9716
|
async ({ productId, priceId, planName: planName2 }) => {
|
|
8972
9717
|
if (!workspaceId || !user?.id || !user.email) {
|
|
8973
9718
|
toast.error("Missing account details for plan update");
|
|
@@ -9036,7 +9781,7 @@ function BillingContent({
|
|
|
9036
9781
|
toast
|
|
9037
9782
|
]
|
|
9038
9783
|
);
|
|
9039
|
-
const handleCancelDowngrade =
|
|
9784
|
+
const handleCancelDowngrade = useCallback6(async () => {
|
|
9040
9785
|
if (!api.revertDowngrade) {
|
|
9041
9786
|
toast.error("Cancel downgrade is not available in this workspace");
|
|
9042
9787
|
return;
|
|
@@ -9062,7 +9807,7 @@ function BillingContent({
|
|
|
9062
9807
|
setPlanActionInFlight(null);
|
|
9063
9808
|
}
|
|
9064
9809
|
}, [api, fetchBillingOverview, logBillingEvent, toast]);
|
|
9065
|
-
|
|
9810
|
+
useEffect13(() => {
|
|
9066
9811
|
setShowInitialLoader(true);
|
|
9067
9812
|
setInitialFetchTriggered(false);
|
|
9068
9813
|
setBillingOverviewLoaded(false);
|
|
@@ -9072,22 +9817,22 @@ function BillingContent({
|
|
|
9072
9817
|
setTotalCredits(null);
|
|
9073
9818
|
setCustomPlanCredits(null);
|
|
9074
9819
|
}, [workspaceId]);
|
|
9075
|
-
|
|
9820
|
+
useEffect13(() => {
|
|
9076
9821
|
setInitialFetchTriggered(true);
|
|
9077
9822
|
fetchBillingOverview();
|
|
9078
9823
|
fetchUserMap();
|
|
9079
9824
|
}, [fetchBillingOverview, fetchUserMap]);
|
|
9080
9825
|
const usage = workspace.current?.usage ?? null;
|
|
9081
|
-
|
|
9826
|
+
useEffect13(() => {
|
|
9082
9827
|
void logBillingEvent("billing_page_viewed", "Billing page viewed", {
|
|
9083
9828
|
action: "view"
|
|
9084
9829
|
});
|
|
9085
9830
|
}, [logBillingEvent]);
|
|
9086
|
-
|
|
9831
|
+
useEffect13(() => {
|
|
9087
9832
|
setInitialFetchTriggered(true);
|
|
9088
9833
|
fetchTableData(activeTab);
|
|
9089
9834
|
}, [activeTab, fetchTableData]);
|
|
9090
|
-
|
|
9835
|
+
useEffect13(() => {
|
|
9091
9836
|
if (!showInitialLoader) return;
|
|
9092
9837
|
if (!initialFetchTriggered) return;
|
|
9093
9838
|
if (!billingOverviewLoaded) return;
|
|
@@ -9117,7 +9862,7 @@ function BillingContent({
|
|
|
9117
9862
|
preDowngradePlan?.credits ?? currentPlanPrice?.metadata?.credits
|
|
9118
9863
|
);
|
|
9119
9864
|
const currentPlanCredits = Number.isFinite(planCreditsFromPrice) ? planCreditsFromPrice : customPlanCredits;
|
|
9120
|
-
const planCreditsText = currentPlanCredits != null ? `${
|
|
9865
|
+
const planCreditsText = currentPlanCredits != null ? `${formatCredits2(currentPlanCredits)} credits` : "";
|
|
9121
9866
|
const scheduledDowngradeDateLabel = formatEffectiveDateLabel(
|
|
9122
9867
|
subscription?.scheduledDowngradeEffectiveDate
|
|
9123
9868
|
);
|
|
@@ -9126,7 +9871,7 @@ function BillingContent({
|
|
|
9126
9871
|
const usedCredits = availableCredits != null && totalCredits != null ? Math.max(0, totalCredits - availableCredits) : null;
|
|
9127
9872
|
const progressPct = usedCredits != null && totalCredits != null && totalCredits > 0 ? Math.min(100, Math.round(usedCredits / totalCredits * 100)) : 0;
|
|
9128
9873
|
const remainingPct = 100 - progressPct;
|
|
9129
|
-
const usageText = usedCredits != null ?
|
|
9874
|
+
const usageText = usedCredits != null ? formatCredits2(usedCredits) : availableCredits != null ? `${formatCredits2(availableCredits)} available` : customPlanCredits != null ? `${formatCredits2(customPlanCredits)} credits` : "\u2014";
|
|
9130
9875
|
const handleExport = async (startDate, endDate) => {
|
|
9131
9876
|
const end = new Date(endDate);
|
|
9132
9877
|
end.setHours(23, 59, 59, 999);
|
|
@@ -9254,7 +9999,7 @@ function BillingContent({
|
|
|
9254
9999
|
}
|
|
9255
10000
|
}
|
|
9256
10001
|
if (showInitialLoader) {
|
|
9257
|
-
const loader = /* @__PURE__ */
|
|
10002
|
+
const loader = /* @__PURE__ */ jsx22(
|
|
9258
10003
|
"div",
|
|
9259
10004
|
{
|
|
9260
10005
|
className: "flex items-center justify-center w-full",
|
|
@@ -9264,7 +10009,7 @@ function BillingContent({
|
|
|
9264
10009
|
border: "1px solid var(--alias-border-subtle)",
|
|
9265
10010
|
borderRadius: "var(--radius-3xl)"
|
|
9266
10011
|
},
|
|
9267
|
-
children: /* @__PURE__ */
|
|
10012
|
+
children: /* @__PURE__ */ jsx22(
|
|
9268
10013
|
"div",
|
|
9269
10014
|
{
|
|
9270
10015
|
className: "animate-spin",
|
|
@@ -9280,7 +10025,7 @@ function BillingContent({
|
|
|
9280
10025
|
}
|
|
9281
10026
|
);
|
|
9282
10027
|
if (embedded) return loader;
|
|
9283
|
-
return /* @__PURE__ */
|
|
10028
|
+
return /* @__PURE__ */ jsx22("div", { className: "flex-1 h-full min-h-0 min-w-0 relative", children: /* @__PURE__ */ jsxs19(
|
|
9284
10029
|
"div",
|
|
9285
10030
|
{
|
|
9286
10031
|
className: "flex flex-col items-start relative size-full overflow-y-auto",
|
|
@@ -9291,7 +10036,7 @@ function BillingContent({
|
|
|
9291
10036
|
backgroundSize: "24px 24px"
|
|
9292
10037
|
},
|
|
9293
10038
|
children: [
|
|
9294
|
-
/* @__PURE__ */
|
|
10039
|
+
/* @__PURE__ */ jsx22("div", { className: "flex items-center justify-between shrink-0 w-full", children: /* @__PURE__ */ jsx22(
|
|
9295
10040
|
"p",
|
|
9296
10041
|
{
|
|
9297
10042
|
className: "flex-1 min-w-0 truncate",
|
|
@@ -9310,8 +10055,47 @@ function BillingContent({
|
|
|
9310
10055
|
}
|
|
9311
10056
|
) });
|
|
9312
10057
|
}
|
|
10058
|
+
if (showPerUserLimits) {
|
|
10059
|
+
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: [
|
|
10060
|
+
!onShowPerUserLimitsChange && /* @__PURE__ */ jsxs19(
|
|
10061
|
+
"div",
|
|
10062
|
+
{
|
|
10063
|
+
className: "flex items-center shrink-0 cursor-pointer",
|
|
10064
|
+
style: {
|
|
10065
|
+
gap: "var(--spacing-sm)",
|
|
10066
|
+
padding: "var(--spacing-xs) var(--spacing-lg)",
|
|
10067
|
+
borderRadius: "var(--radius-xl)",
|
|
10068
|
+
height: 32,
|
|
10069
|
+
width: "fit-content",
|
|
10070
|
+
border: "1px solid var(--alias-border-subtle)",
|
|
10071
|
+
backgroundColor: "var(--alias-surface-base)"
|
|
10072
|
+
},
|
|
10073
|
+
onClick: () => setShowPerUserLimits(false),
|
|
10074
|
+
children: [
|
|
10075
|
+
/* @__PURE__ */ jsx22(SiconLeft2, { className: "w-4 h-4", color: "var(--alias-text---icons-muted)" }),
|
|
10076
|
+
/* @__PURE__ */ jsx22(
|
|
10077
|
+
"span",
|
|
10078
|
+
{
|
|
10079
|
+
style: {
|
|
10080
|
+
fontFamily: "var(--font-family-font-family-body)",
|
|
10081
|
+
fontSize: "var(--font-size-font-size-sm)",
|
|
10082
|
+
fontWeight: 500,
|
|
10083
|
+
lineHeight: "var(--line-height-line-height-sm)",
|
|
10084
|
+
color: "var(--alias-text---icons-muted)"
|
|
10085
|
+
},
|
|
10086
|
+
children: "Back to billing"
|
|
10087
|
+
}
|
|
10088
|
+
)
|
|
10089
|
+
]
|
|
10090
|
+
}
|
|
10091
|
+
),
|
|
10092
|
+
/* @__PURE__ */ jsx22(PerUserLimitsView, {})
|
|
10093
|
+
] });
|
|
10094
|
+
if (embedded) return limitsView;
|
|
10095
|
+
return /* @__PURE__ */ jsx22("div", { className: "flex-1 h-full min-h-0 min-w-0 relative", children: limitsView });
|
|
10096
|
+
}
|
|
9313
10097
|
if (showPlans) {
|
|
9314
|
-
const plansView = /* @__PURE__ */
|
|
10098
|
+
const plansView = /* @__PURE__ */ jsx22(
|
|
9315
10099
|
PlansView,
|
|
9316
10100
|
{
|
|
9317
10101
|
onBack: () => setShowPlans(false),
|
|
@@ -9328,16 +10112,16 @@ function BillingContent({
|
|
|
9328
10112
|
}
|
|
9329
10113
|
);
|
|
9330
10114
|
if (embedded) return plansView;
|
|
9331
|
-
return /* @__PURE__ */
|
|
10115
|
+
return /* @__PURE__ */ jsx22("div", { className: "flex-1 h-full min-h-0 min-w-0 relative", children: plansView });
|
|
9332
10116
|
}
|
|
9333
|
-
const billingInnerContent = /* @__PURE__ */
|
|
9334
|
-
/* @__PURE__ */
|
|
10117
|
+
const billingInnerContent = /* @__PURE__ */ jsxs19(Fragment9, { children: [
|
|
10118
|
+
/* @__PURE__ */ jsxs19(
|
|
9335
10119
|
"div",
|
|
9336
10120
|
{
|
|
9337
10121
|
className: "flex items-start shrink-0 w-full",
|
|
9338
10122
|
style: { gap: 12 },
|
|
9339
10123
|
children: [
|
|
9340
|
-
/* @__PURE__ */
|
|
10124
|
+
/* @__PURE__ */ jsx22(
|
|
9341
10125
|
ScPlanDetailsCard,
|
|
9342
10126
|
{
|
|
9343
10127
|
planName,
|
|
@@ -9362,12 +10146,12 @@ function BillingContent({
|
|
|
9362
10146
|
}
|
|
9363
10147
|
}
|
|
9364
10148
|
),
|
|
9365
|
-
/* @__PURE__ */
|
|
10149
|
+
/* @__PURE__ */ jsx22(
|
|
9366
10150
|
ScCreditsUsageCard,
|
|
9367
10151
|
{
|
|
9368
10152
|
usageLabel: "Credits used",
|
|
9369
10153
|
usageText,
|
|
9370
|
-
remainingText: availableCredits != null ? `${
|
|
10154
|
+
remainingText: availableCredits != null ? `${formatCredits2(availableCredits)} (${remainingPct}%) Remaining` : `${remainingPct}% Remaining`,
|
|
9371
10155
|
buyButtonText: "Buy credits",
|
|
9372
10156
|
buyButtonState: isFreePlan ? "disabled" : "default",
|
|
9373
10157
|
buyButtonHoverText: isFreePlan ? "Pro plan required" : void 0,
|
|
@@ -9387,7 +10171,7 @@ function BillingContent({
|
|
|
9387
10171
|
]
|
|
9388
10172
|
}
|
|
9389
10173
|
),
|
|
9390
|
-
usage ? /* @__PURE__ */
|
|
10174
|
+
usage ? /* @__PURE__ */ jsxs19(
|
|
9391
10175
|
"div",
|
|
9392
10176
|
{
|
|
9393
10177
|
className: "grid shrink-0 w-full",
|
|
@@ -9396,8 +10180,8 @@ function BillingContent({
|
|
|
9396
10180
|
gridTemplateColumns: "repeat(auto-fit, minmax(18rem, 1fr))"
|
|
9397
10181
|
},
|
|
9398
10182
|
children: [
|
|
9399
|
-
/* @__PURE__ */
|
|
9400
|
-
/* @__PURE__ */
|
|
10183
|
+
/* @__PURE__ */ jsx22(ScUsageMeterCard, { kind: "storage", plan: usage.plan, status: usage.storage }),
|
|
10184
|
+
/* @__PURE__ */ jsx22(
|
|
9401
10185
|
ScUsageMeterCard,
|
|
9402
10186
|
{
|
|
9403
10187
|
kind: "bandwidth",
|
|
@@ -9409,9 +10193,60 @@ function BillingContent({
|
|
|
9409
10193
|
]
|
|
9410
10194
|
}
|
|
9411
10195
|
) : null,
|
|
9412
|
-
/* @__PURE__ */
|
|
9413
|
-
|
|
9414
|
-
|
|
10196
|
+
api.fetchMemberCreditLimits ? /* @__PURE__ */ jsxs19(
|
|
10197
|
+
"div",
|
|
10198
|
+
{
|
|
10199
|
+
className: "flex items-center justify-between shrink-0 w-full",
|
|
10200
|
+
style: {
|
|
10201
|
+
gap: 12,
|
|
10202
|
+
padding: 16,
|
|
10203
|
+
backgroundColor: "var(--alias-surface-base)",
|
|
10204
|
+
border: "1px solid var(--alias-border-subtle)",
|
|
10205
|
+
borderRadius: "var(--radius-3xl)"
|
|
10206
|
+
},
|
|
10207
|
+
children: [
|
|
10208
|
+
/* @__PURE__ */ jsxs19("div", { className: "flex flex-col min-w-0", style: { gap: 4 }, children: [
|
|
10209
|
+
/* @__PURE__ */ jsx22(
|
|
10210
|
+
"span",
|
|
10211
|
+
{
|
|
10212
|
+
style: {
|
|
10213
|
+
fontFamily: "var(--font-family-font-family-body)",
|
|
10214
|
+
fontSize: "var(--font-size-font-size-sm)",
|
|
10215
|
+
fontWeight: 500,
|
|
10216
|
+
lineHeight: "var(--line-height-line-height-sm)",
|
|
10217
|
+
color: "var(--alias-text---icons-primary)"
|
|
10218
|
+
},
|
|
10219
|
+
children: "Per-user usage limits"
|
|
10220
|
+
}
|
|
10221
|
+
),
|
|
10222
|
+
/* @__PURE__ */ jsx22(
|
|
10223
|
+
"span",
|
|
10224
|
+
{
|
|
10225
|
+
style: {
|
|
10226
|
+
fontFamily: "var(--font-family-font-family-body)",
|
|
10227
|
+
fontSize: "var(--font-size-font-size-sm)",
|
|
10228
|
+
lineHeight: "var(--line-height-line-height-sm)",
|
|
10229
|
+
color: "var(--alias-text---icons-muted)"
|
|
10230
|
+
},
|
|
10231
|
+
children: "Set a default and per-member limits on credits per billing cycle"
|
|
10232
|
+
}
|
|
10233
|
+
)
|
|
10234
|
+
] }),
|
|
10235
|
+
/* @__PURE__ */ jsx22(
|
|
10236
|
+
ScButton8,
|
|
10237
|
+
{
|
|
10238
|
+
text: "Manage",
|
|
10239
|
+
variant: "secondary",
|
|
10240
|
+
size: "md",
|
|
10241
|
+
onClick: () => setShowPerUserLimits(true)
|
|
10242
|
+
}
|
|
10243
|
+
)
|
|
10244
|
+
]
|
|
10245
|
+
}
|
|
10246
|
+
) : null,
|
|
10247
|
+
/* @__PURE__ */ jsxs19("div", { className: "flex items-center justify-between shrink-0 w-full", children: [
|
|
10248
|
+
/* @__PURE__ */ jsx22(BillingTabBar, { activeTab, onTabChange: setActiveTab }),
|
|
10249
|
+
/* @__PURE__ */ jsxs19(
|
|
9415
10250
|
"div",
|
|
9416
10251
|
{
|
|
9417
10252
|
className: "flex items-center shrink-0 cursor-pointer",
|
|
@@ -9423,8 +10258,8 @@ function BillingContent({
|
|
|
9423
10258
|
},
|
|
9424
10259
|
onClick: () => setShowExportModal(true),
|
|
9425
10260
|
children: [
|
|
9426
|
-
/* @__PURE__ */
|
|
9427
|
-
/* @__PURE__ */
|
|
10261
|
+
/* @__PURE__ */ jsx22(SiconDownload, { className: "w-5 h-5", color: PRIMARY_COLOR2 }),
|
|
10262
|
+
/* @__PURE__ */ jsx22(
|
|
9428
10263
|
"span",
|
|
9429
10264
|
{
|
|
9430
10265
|
style: {
|
|
@@ -9441,14 +10276,14 @@ function BillingContent({
|
|
|
9441
10276
|
}
|
|
9442
10277
|
)
|
|
9443
10278
|
] }),
|
|
9444
|
-
activeTab === "invoice" ? /* @__PURE__ */
|
|
10279
|
+
activeTab === "invoice" ? /* @__PURE__ */ jsx22(
|
|
9445
10280
|
InvoiceHistoryTable,
|
|
9446
10281
|
{
|
|
9447
10282
|
invoices,
|
|
9448
10283
|
loading: loadingTable,
|
|
9449
10284
|
workspaceCountry: workspace.current?.country
|
|
9450
10285
|
}
|
|
9451
|
-
) : /* @__PURE__ */
|
|
10286
|
+
) : /* @__PURE__ */ jsx22(
|
|
9452
10287
|
UsageLogsTable,
|
|
9453
10288
|
{
|
|
9454
10289
|
logs: usageLogs,
|
|
@@ -9456,7 +10291,7 @@ function BillingContent({
|
|
|
9456
10291
|
loading: loadingTable
|
|
9457
10292
|
}
|
|
9458
10293
|
),
|
|
9459
|
-
showExportModal && /* @__PURE__ */
|
|
10294
|
+
showExportModal && /* @__PURE__ */ jsx22(
|
|
9460
10295
|
ExportDateModal,
|
|
9461
10296
|
{
|
|
9462
10297
|
title: activeTab === "invoice" ? "Export invoices" : "Export log",
|
|
@@ -9464,7 +10299,7 @@ function BillingContent({
|
|
|
9464
10299
|
onExport: handleExport
|
|
9465
10300
|
}
|
|
9466
10301
|
),
|
|
9467
|
-
showBuyCreditsModal && /* @__PURE__ */
|
|
10302
|
+
showBuyCreditsModal && /* @__PURE__ */ jsx22(
|
|
9468
10303
|
BuyCreditsModal,
|
|
9469
10304
|
{
|
|
9470
10305
|
country: workspace.current?.country,
|
|
@@ -9479,7 +10314,7 @@ function BillingContent({
|
|
|
9479
10314
|
)
|
|
9480
10315
|
] });
|
|
9481
10316
|
if (embedded) {
|
|
9482
|
-
return /* @__PURE__ */
|
|
10317
|
+
return /* @__PURE__ */ jsx22(
|
|
9483
10318
|
"div",
|
|
9484
10319
|
{
|
|
9485
10320
|
className: "flex flex-col flex-1 min-w-0 min-h-0 w-full",
|
|
@@ -9488,7 +10323,7 @@ function BillingContent({
|
|
|
9488
10323
|
}
|
|
9489
10324
|
);
|
|
9490
10325
|
}
|
|
9491
|
-
return /* @__PURE__ */
|
|
10326
|
+
return /* @__PURE__ */ jsx22("div", { className: "flex-1 h-full min-h-0 min-w-0 relative", children: /* @__PURE__ */ jsxs19(
|
|
9492
10327
|
"div",
|
|
9493
10328
|
{
|
|
9494
10329
|
className: "flex flex-col items-start relative size-full overflow-y-auto",
|
|
@@ -9499,7 +10334,7 @@ function BillingContent({
|
|
|
9499
10334
|
backgroundSize: "24px 24px"
|
|
9500
10335
|
},
|
|
9501
10336
|
children: [
|
|
9502
|
-
/* @__PURE__ */
|
|
10337
|
+
/* @__PURE__ */ jsx22("div", { className: "flex items-center justify-between shrink-0 w-full", children: /* @__PURE__ */ jsx22(
|
|
9503
10338
|
"p",
|
|
9504
10339
|
{
|
|
9505
10340
|
className: "flex-1 min-w-0 truncate",
|
|
@@ -9520,16 +10355,16 @@ function BillingContent({
|
|
|
9520
10355
|
}
|
|
9521
10356
|
|
|
9522
10357
|
// src/tokens-content.tsx
|
|
9523
|
-
import { useState as
|
|
10358
|
+
import { useState as useState16, useEffect as useEffect14, useCallback as useCallback7 } from "react";
|
|
9524
10359
|
import {
|
|
9525
|
-
ScButton as
|
|
10360
|
+
ScButton as ScButton9,
|
|
9526
10361
|
ScBadges
|
|
9527
10362
|
} from "@streamoid/ui";
|
|
9528
10363
|
import {
|
|
9529
10364
|
SiconPlus as SiconPlus2,
|
|
9530
|
-
SiconClose as
|
|
10365
|
+
SiconClose as SiconClose8
|
|
9531
10366
|
} from "@streamoid/icons";
|
|
9532
|
-
import { Fragment as Fragment10, jsx as
|
|
10367
|
+
import { Fragment as Fragment10, jsx as jsx23, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
9533
10368
|
var EXPIRY_OPTIONS = [
|
|
9534
10369
|
{ label: "30 days", value: "30d" },
|
|
9535
10370
|
{ label: "60 days", value: "60d" },
|
|
@@ -9549,7 +10384,7 @@ function isExpired(expiresAt) {
|
|
|
9549
10384
|
if (!expiresAt) return false;
|
|
9550
10385
|
return /* @__PURE__ */ new Date() > new Date(expiresAt);
|
|
9551
10386
|
}
|
|
9552
|
-
var
|
|
10387
|
+
var T14 = {
|
|
9553
10388
|
primary: "var(--alias-text---icons-primary)",
|
|
9554
10389
|
muted: "var(--alias-text---icons-muted)",
|
|
9555
10390
|
warning: "var(--alias-text---icons-warning)",
|
|
@@ -9571,9 +10406,9 @@ var T12 = {
|
|
|
9571
10406
|
};
|
|
9572
10407
|
function CreateTokenModal({ onClose, onCreated }) {
|
|
9573
10408
|
const { api, toast } = useSettingsAdapters();
|
|
9574
|
-
const [name, setName] =
|
|
9575
|
-
const [expiry, setExpiry] =
|
|
9576
|
-
const [loading, setLoading] =
|
|
10409
|
+
const [name, setName] = useState16("");
|
|
10410
|
+
const [expiry, setExpiry] = useState16("never");
|
|
10411
|
+
const [loading, setLoading] = useState16(false);
|
|
9577
10412
|
async function handleCreate() {
|
|
9578
10413
|
if (!name.trim()) {
|
|
9579
10414
|
toast.error("Token name is required.");
|
|
@@ -9589,96 +10424,96 @@ function CreateTokenModal({ onClose, onCreated }) {
|
|
|
9589
10424
|
setLoading(false);
|
|
9590
10425
|
}
|
|
9591
10426
|
}
|
|
9592
|
-
return /* @__PURE__ */
|
|
10427
|
+
return /* @__PURE__ */ jsx23(
|
|
9593
10428
|
"div",
|
|
9594
10429
|
{
|
|
9595
10430
|
className: "fixed inset-0 flex items-center justify-center",
|
|
9596
10431
|
style: { backgroundColor: "rgba(0,0,0,0.6)", zIndex: 1e3 },
|
|
9597
10432
|
onClick: onClose,
|
|
9598
|
-
children: /* @__PURE__ */
|
|
10433
|
+
children: /* @__PURE__ */ jsxs20(
|
|
9599
10434
|
"div",
|
|
9600
10435
|
{
|
|
9601
10436
|
className: "flex flex-col items-start relative",
|
|
9602
10437
|
style: {
|
|
9603
|
-
backgroundColor:
|
|
9604
|
-
borderRadius:
|
|
10438
|
+
backgroundColor: T14.neutral825,
|
|
10439
|
+
borderRadius: T14.r4xl,
|
|
9605
10440
|
width: "min(40vw, 500px)",
|
|
9606
|
-
border: `1px solid ${
|
|
10441
|
+
border: `1px solid ${T14.borderSubtle}`
|
|
9607
10442
|
},
|
|
9608
10443
|
onClick: (e) => e.stopPropagation(),
|
|
9609
10444
|
children: [
|
|
9610
|
-
/* @__PURE__ */
|
|
10445
|
+
/* @__PURE__ */ jsx23(
|
|
9611
10446
|
"div",
|
|
9612
10447
|
{
|
|
9613
10448
|
className: "relative shrink-0 w-full",
|
|
9614
|
-
style: { borderBottom: `1px solid ${
|
|
9615
|
-
children: /* @__PURE__ */
|
|
10449
|
+
style: { borderBottom: `1px solid ${T14.borderDivider}` },
|
|
10450
|
+
children: /* @__PURE__ */ jsxs20(
|
|
9616
10451
|
"div",
|
|
9617
10452
|
{
|
|
9618
10453
|
className: "flex items-center w-full",
|
|
9619
|
-
style: { padding: `${
|
|
10454
|
+
style: { padding: `${T14.spXl} ${T14.sp3xl}` },
|
|
9620
10455
|
children: [
|
|
9621
|
-
/* @__PURE__ */
|
|
10456
|
+
/* @__PURE__ */ jsx23(
|
|
9622
10457
|
"p",
|
|
9623
10458
|
{
|
|
9624
10459
|
className: "flex-1 min-w-0 truncate",
|
|
9625
10460
|
style: {
|
|
9626
|
-
fontFamily:
|
|
9627
|
-
fontSize:
|
|
10461
|
+
fontFamily: T14.fontDisplay,
|
|
10462
|
+
fontSize: T14.fsLg,
|
|
9628
10463
|
fontWeight: 600,
|
|
9629
|
-
lineHeight:
|
|
9630
|
-
color:
|
|
10464
|
+
lineHeight: T14.lhLg,
|
|
10465
|
+
color: T14.primary,
|
|
9631
10466
|
margin: 0
|
|
9632
10467
|
},
|
|
9633
10468
|
children: "Create New Token"
|
|
9634
10469
|
}
|
|
9635
10470
|
),
|
|
9636
|
-
/* @__PURE__ */
|
|
10471
|
+
/* @__PURE__ */ jsx23("div", { className: "cursor-pointer", onClick: onClose, children: /* @__PURE__ */ jsx23(SiconClose8, { className: "w-6 h-6", color: T14.primary }) })
|
|
9637
10472
|
]
|
|
9638
10473
|
}
|
|
9639
10474
|
)
|
|
9640
10475
|
}
|
|
9641
10476
|
),
|
|
9642
|
-
/* @__PURE__ */
|
|
10477
|
+
/* @__PURE__ */ jsxs20(
|
|
9643
10478
|
"div",
|
|
9644
10479
|
{
|
|
9645
10480
|
className: "flex flex-col items-start shrink-0 w-full",
|
|
9646
|
-
style: { padding:
|
|
10481
|
+
style: { padding: T14.sp3xl, gap: T14.sp3xl },
|
|
9647
10482
|
children: [
|
|
9648
|
-
/* @__PURE__ */
|
|
10483
|
+
/* @__PURE__ */ jsxs20(
|
|
9649
10484
|
"div",
|
|
9650
10485
|
{
|
|
9651
10486
|
className: "flex flex-col items-start shrink-0 w-full",
|
|
9652
10487
|
style: { gap: "var(--spacing-xs)" },
|
|
9653
10488
|
children: [
|
|
9654
|
-
/* @__PURE__ */
|
|
10489
|
+
/* @__PURE__ */ jsx23("div", { className: "flex items-center shrink-0 w-full", style: { height: 24 }, children: /* @__PURE__ */ jsx23(
|
|
9655
10490
|
"span",
|
|
9656
10491
|
{
|
|
9657
10492
|
style: {
|
|
9658
|
-
fontFamily:
|
|
9659
|
-
fontSize:
|
|
10493
|
+
fontFamily: T14.font,
|
|
10494
|
+
fontSize: T14.fsSm,
|
|
9660
10495
|
fontWeight: 400,
|
|
9661
|
-
lineHeight:
|
|
9662
|
-
color:
|
|
10496
|
+
lineHeight: T14.lhSm,
|
|
10497
|
+
color: T14.muted
|
|
9663
10498
|
},
|
|
9664
10499
|
children: "Token name"
|
|
9665
10500
|
}
|
|
9666
10501
|
) }),
|
|
9667
|
-
/* @__PURE__ */
|
|
10502
|
+
/* @__PURE__ */ jsx23(
|
|
9668
10503
|
"div",
|
|
9669
10504
|
{
|
|
9670
10505
|
className: "shrink-0 w-full",
|
|
9671
10506
|
style: {
|
|
9672
|
-
backgroundColor:
|
|
9673
|
-
borderRadius:
|
|
10507
|
+
backgroundColor: T14.neutral875,
|
|
10508
|
+
borderRadius: T14.rXl,
|
|
9674
10509
|
height: 48
|
|
9675
10510
|
},
|
|
9676
|
-
children: /* @__PURE__ */
|
|
10511
|
+
children: /* @__PURE__ */ jsx23(
|
|
9677
10512
|
"div",
|
|
9678
10513
|
{
|
|
9679
10514
|
className: "flex items-center size-full",
|
|
9680
|
-
style: { padding: `var(--spacing-lg) ${
|
|
9681
|
-
children: /* @__PURE__ */
|
|
10515
|
+
style: { padding: `var(--spacing-lg) ${T14.spXl}` },
|
|
10516
|
+
children: /* @__PURE__ */ jsx23(
|
|
9682
10517
|
"input",
|
|
9683
10518
|
{
|
|
9684
10519
|
type: "text",
|
|
@@ -9687,11 +10522,11 @@ function CreateTokenModal({ onClose, onCreated }) {
|
|
|
9687
10522
|
placeholder: "Name your token...",
|
|
9688
10523
|
className: "flex-1 min-w-0 bg-transparent border-none outline-none",
|
|
9689
10524
|
style: {
|
|
9690
|
-
fontFamily:
|
|
9691
|
-
fontSize:
|
|
10525
|
+
fontFamily: T14.font,
|
|
10526
|
+
fontSize: T14.fsSm,
|
|
9692
10527
|
fontWeight: 400,
|
|
9693
|
-
lineHeight:
|
|
9694
|
-
color: name ?
|
|
10528
|
+
lineHeight: T14.lhSm,
|
|
10529
|
+
color: name ? T14.primary : T14.neutral500
|
|
9695
10530
|
}
|
|
9696
10531
|
}
|
|
9697
10532
|
)
|
|
@@ -9702,27 +10537,27 @@ function CreateTokenModal({ onClose, onCreated }) {
|
|
|
9702
10537
|
]
|
|
9703
10538
|
}
|
|
9704
10539
|
),
|
|
9705
|
-
/* @__PURE__ */
|
|
10540
|
+
/* @__PURE__ */ jsxs20(
|
|
9706
10541
|
"div",
|
|
9707
10542
|
{
|
|
9708
10543
|
className: "flex flex-col items-start shrink-0 w-full",
|
|
9709
10544
|
style: { gap: "var(--spacing-xs)" },
|
|
9710
10545
|
children: [
|
|
9711
|
-
/* @__PURE__ */
|
|
10546
|
+
/* @__PURE__ */ jsx23("div", { className: "flex items-center shrink-0 w-full", style: { height: 24 }, children: /* @__PURE__ */ jsx23(
|
|
9712
10547
|
"span",
|
|
9713
10548
|
{
|
|
9714
10549
|
style: {
|
|
9715
|
-
fontFamily:
|
|
9716
|
-
fontSize:
|
|
10550
|
+
fontFamily: T14.font,
|
|
10551
|
+
fontSize: T14.fsSm,
|
|
9717
10552
|
fontWeight: 400,
|
|
9718
|
-
lineHeight:
|
|
9719
|
-
color:
|
|
10553
|
+
lineHeight: T14.lhSm,
|
|
10554
|
+
color: T14.muted
|
|
9720
10555
|
},
|
|
9721
10556
|
children: "Expiry"
|
|
9722
10557
|
}
|
|
9723
10558
|
) }),
|
|
9724
|
-
/* @__PURE__ */
|
|
9725
|
-
|
|
10559
|
+
/* @__PURE__ */ jsx23("div", { style: { display: "flex", gap: "var(--spacing-md)", flexWrap: "wrap" }, children: EXPIRY_OPTIONS.map((opt) => /* @__PURE__ */ jsx23(
|
|
10560
|
+
ScButton9,
|
|
9726
10561
|
{
|
|
9727
10562
|
text: opt.label,
|
|
9728
10563
|
variant: expiry === opt.value ? "secondary" : "outline",
|
|
@@ -9734,8 +10569,8 @@ function CreateTokenModal({ onClose, onCreated }) {
|
|
|
9734
10569
|
]
|
|
9735
10570
|
}
|
|
9736
10571
|
),
|
|
9737
|
-
/* @__PURE__ */
|
|
9738
|
-
|
|
10572
|
+
/* @__PURE__ */ jsx23(
|
|
10573
|
+
ScButton9,
|
|
9739
10574
|
{
|
|
9740
10575
|
text: loading ? "Creating..." : "Create token",
|
|
9741
10576
|
variant: "secondary",
|
|
@@ -9756,7 +10591,7 @@ function CreateTokenModal({ onClose, onCreated }) {
|
|
|
9756
10591
|
}
|
|
9757
10592
|
function TokenCreatedModal({ token, onClose }) {
|
|
9758
10593
|
const { toast } = useSettingsAdapters();
|
|
9759
|
-
const [copied, setCopied] =
|
|
10594
|
+
const [copied, setCopied] = useState16(false);
|
|
9760
10595
|
function handleCopy() {
|
|
9761
10596
|
navigator.clipboard.writeText(token.token).then(() => {
|
|
9762
10597
|
setCopied(true);
|
|
@@ -9766,101 +10601,101 @@ function TokenCreatedModal({ token, onClose }) {
|
|
|
9766
10601
|
toast.error("Failed to copy token. Please copy it manually.");
|
|
9767
10602
|
});
|
|
9768
10603
|
}
|
|
9769
|
-
return /* @__PURE__ */
|
|
10604
|
+
return /* @__PURE__ */ jsx23(
|
|
9770
10605
|
"div",
|
|
9771
10606
|
{
|
|
9772
10607
|
className: "fixed inset-0 flex items-center justify-center",
|
|
9773
10608
|
style: { backgroundColor: "rgba(0,0,0,0.6)", zIndex: 1e3 },
|
|
9774
|
-
children: /* @__PURE__ */
|
|
10609
|
+
children: /* @__PURE__ */ jsxs20(
|
|
9775
10610
|
"div",
|
|
9776
10611
|
{
|
|
9777
10612
|
className: "flex flex-col items-start relative",
|
|
9778
10613
|
style: {
|
|
9779
|
-
backgroundColor:
|
|
9780
|
-
borderRadius:
|
|
10614
|
+
backgroundColor: T14.neutral825,
|
|
10615
|
+
borderRadius: T14.r4xl,
|
|
9781
10616
|
width: "min(40vw, 500px)",
|
|
9782
|
-
border: `1px solid ${
|
|
10617
|
+
border: `1px solid ${T14.borderSubtle}`
|
|
9783
10618
|
},
|
|
9784
10619
|
children: [
|
|
9785
|
-
/* @__PURE__ */
|
|
10620
|
+
/* @__PURE__ */ jsx23(
|
|
9786
10621
|
"div",
|
|
9787
10622
|
{
|
|
9788
10623
|
className: "relative shrink-0 w-full",
|
|
9789
|
-
style: { borderBottom: `1px solid ${
|
|
9790
|
-
children: /* @__PURE__ */
|
|
10624
|
+
style: { borderBottom: `1px solid ${T14.borderDivider}` },
|
|
10625
|
+
children: /* @__PURE__ */ jsxs20(
|
|
9791
10626
|
"div",
|
|
9792
10627
|
{
|
|
9793
10628
|
className: "flex items-center w-full",
|
|
9794
|
-
style: { padding: `${
|
|
10629
|
+
style: { padding: `${T14.spXl} ${T14.sp3xl}` },
|
|
9795
10630
|
children: [
|
|
9796
|
-
/* @__PURE__ */
|
|
10631
|
+
/* @__PURE__ */ jsx23(
|
|
9797
10632
|
"p",
|
|
9798
10633
|
{
|
|
9799
10634
|
className: "flex-1 min-w-0 truncate",
|
|
9800
10635
|
style: {
|
|
9801
|
-
fontFamily:
|
|
9802
|
-
fontSize:
|
|
10636
|
+
fontFamily: T14.fontDisplay,
|
|
10637
|
+
fontSize: T14.fsLg,
|
|
9803
10638
|
fontWeight: 600,
|
|
9804
|
-
lineHeight:
|
|
9805
|
-
color:
|
|
10639
|
+
lineHeight: T14.lhLg,
|
|
10640
|
+
color: T14.primary,
|
|
9806
10641
|
margin: 0
|
|
9807
10642
|
},
|
|
9808
10643
|
children: "Token Created"
|
|
9809
10644
|
}
|
|
9810
10645
|
),
|
|
9811
|
-
/* @__PURE__ */
|
|
10646
|
+
/* @__PURE__ */ jsx23("div", { className: "cursor-pointer", onClick: onClose, children: /* @__PURE__ */ jsx23(SiconClose8, { className: "w-6 h-6", color: T14.primary }) })
|
|
9812
10647
|
]
|
|
9813
10648
|
}
|
|
9814
10649
|
)
|
|
9815
10650
|
}
|
|
9816
10651
|
),
|
|
9817
|
-
/* @__PURE__ */
|
|
10652
|
+
/* @__PURE__ */ jsxs20(
|
|
9818
10653
|
"div",
|
|
9819
10654
|
{
|
|
9820
10655
|
className: "flex flex-col items-start shrink-0 w-full",
|
|
9821
|
-
style: { padding:
|
|
10656
|
+
style: { padding: T14.sp3xl, gap: T14.sp3xl },
|
|
9822
10657
|
children: [
|
|
9823
|
-
/* @__PURE__ */
|
|
10658
|
+
/* @__PURE__ */ jsx23(
|
|
9824
10659
|
"p",
|
|
9825
10660
|
{
|
|
9826
10661
|
style: {
|
|
9827
|
-
fontFamily:
|
|
9828
|
-
fontSize:
|
|
10662
|
+
fontFamily: T14.font,
|
|
10663
|
+
fontSize: T14.fsSm,
|
|
9829
10664
|
fontWeight: 400,
|
|
9830
|
-
lineHeight:
|
|
9831
|
-
color:
|
|
10665
|
+
lineHeight: T14.lhSm,
|
|
10666
|
+
color: T14.warning,
|
|
9832
10667
|
margin: 0
|
|
9833
10668
|
},
|
|
9834
10669
|
children: "Copy this token now. You won't be able to see it again."
|
|
9835
10670
|
}
|
|
9836
10671
|
),
|
|
9837
|
-
/* @__PURE__ */
|
|
10672
|
+
/* @__PURE__ */ jsx23(
|
|
9838
10673
|
"div",
|
|
9839
10674
|
{
|
|
9840
10675
|
className: "w-full",
|
|
9841
10676
|
style: {
|
|
9842
|
-
backgroundColor:
|
|
9843
|
-
borderRadius:
|
|
9844
|
-
padding: `var(--spacing-lg) ${
|
|
10677
|
+
backgroundColor: T14.neutral875,
|
|
10678
|
+
borderRadius: T14.rXl,
|
|
10679
|
+
padding: `var(--spacing-lg) ${T14.spXl}`
|
|
9845
10680
|
},
|
|
9846
|
-
children: /* @__PURE__ */
|
|
10681
|
+
children: /* @__PURE__ */ jsx23(
|
|
9847
10682
|
"code",
|
|
9848
10683
|
{
|
|
9849
10684
|
style: {
|
|
9850
10685
|
fontFamily: "monospace",
|
|
9851
|
-
fontSize:
|
|
9852
|
-
color:
|
|
10686
|
+
fontSize: T14.fsSm,
|
|
10687
|
+
color: T14.primary,
|
|
9853
10688
|
wordBreak: "break-all",
|
|
9854
|
-
lineHeight:
|
|
10689
|
+
lineHeight: T14.lhSm
|
|
9855
10690
|
},
|
|
9856
10691
|
children: token.token
|
|
9857
10692
|
}
|
|
9858
10693
|
)
|
|
9859
10694
|
}
|
|
9860
10695
|
),
|
|
9861
|
-
/* @__PURE__ */
|
|
9862
|
-
/* @__PURE__ */
|
|
9863
|
-
|
|
10696
|
+
/* @__PURE__ */ jsxs20("div", { style: { display: "flex", gap: "var(--spacing-md)", width: "100%" }, children: [
|
|
10697
|
+
/* @__PURE__ */ jsx23(
|
|
10698
|
+
ScButton9,
|
|
9864
10699
|
{
|
|
9865
10700
|
text: copied ? "Copied!" : "Copy token",
|
|
9866
10701
|
variant: "secondary",
|
|
@@ -9869,8 +10704,8 @@ function TokenCreatedModal({ token, onClose }) {
|
|
|
9869
10704
|
className: "flex-1"
|
|
9870
10705
|
}
|
|
9871
10706
|
),
|
|
9872
|
-
/* @__PURE__ */
|
|
9873
|
-
|
|
10707
|
+
/* @__PURE__ */ jsx23(
|
|
10708
|
+
ScButton9,
|
|
9874
10709
|
{
|
|
9875
10710
|
text: "Done",
|
|
9876
10711
|
variant: "outline",
|
|
@@ -9897,22 +10732,22 @@ function TokensContent({
|
|
|
9897
10732
|
onCreateOpenChange
|
|
9898
10733
|
} = {}) {
|
|
9899
10734
|
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
|
-
|
|
10735
|
+
const [tokens, setTokens] = useState16([]);
|
|
10736
|
+
const [loading, setLoading] = useState16(true);
|
|
10737
|
+
const [showRevoked, setShowRevoked] = useState16(false);
|
|
10738
|
+
const [showCreateModal, setShowCreateModal] = useState16(false);
|
|
10739
|
+
const [createdToken, setCreatedToken] = useState16(null);
|
|
10740
|
+
const [deletingId, setDeletingId] = useState16(null);
|
|
10741
|
+
useEffect14(() => {
|
|
9907
10742
|
if (showRevokedOverride !== void 0) setShowRevoked(showRevokedOverride);
|
|
9908
10743
|
}, [showRevokedOverride]);
|
|
9909
|
-
|
|
10744
|
+
useEffect14(() => {
|
|
9910
10745
|
if (createOpenOverride) {
|
|
9911
10746
|
setShowCreateModal(true);
|
|
9912
10747
|
onCreateOpenChange?.(false);
|
|
9913
10748
|
}
|
|
9914
10749
|
}, [createOpenOverride, onCreateOpenChange]);
|
|
9915
|
-
const fetchTokens =
|
|
10750
|
+
const fetchTokens = useCallback7(async () => {
|
|
9916
10751
|
setLoading(true);
|
|
9917
10752
|
try {
|
|
9918
10753
|
const data = await api.fetchTokens({ showRevoked });
|
|
@@ -9923,7 +10758,7 @@ function TokensContent({
|
|
|
9923
10758
|
setLoading(false);
|
|
9924
10759
|
}
|
|
9925
10760
|
}, [api, showRevoked]);
|
|
9926
|
-
|
|
10761
|
+
useEffect14(() => {
|
|
9927
10762
|
fetchTokens();
|
|
9928
10763
|
}, [fetchTokens]);
|
|
9929
10764
|
async function handleRevoke(tokenId) {
|
|
@@ -9961,8 +10796,8 @@ function TokensContent({
|
|
|
9961
10796
|
setCreatedToken(token);
|
|
9962
10797
|
fetchTokens();
|
|
9963
10798
|
}
|
|
9964
|
-
const tokensInnerContent = /* @__PURE__ */
|
|
9965
|
-
!embedded && /* @__PURE__ */
|
|
10799
|
+
const tokensInnerContent = /* @__PURE__ */ jsxs20(Fragment10, { children: [
|
|
10800
|
+
!embedded && /* @__PURE__ */ jsxs20(
|
|
9966
10801
|
"div",
|
|
9967
10802
|
{
|
|
9968
10803
|
style: {
|
|
@@ -9974,8 +10809,8 @@ function TokensContent({
|
|
|
9974
10809
|
gap: "var(--spacing-md)"
|
|
9975
10810
|
},
|
|
9976
10811
|
children: [
|
|
9977
|
-
/* @__PURE__ */
|
|
9978
|
-
|
|
10812
|
+
/* @__PURE__ */ jsx23(
|
|
10813
|
+
ScButton9,
|
|
9979
10814
|
{
|
|
9980
10815
|
text: showRevoked ? "Hide Revoked" : "Show Revoked",
|
|
9981
10816
|
variant: "outline",
|
|
@@ -9983,21 +10818,21 @@ function TokensContent({
|
|
|
9983
10818
|
onClick: () => setShowRevoked((v) => !v)
|
|
9984
10819
|
}
|
|
9985
10820
|
),
|
|
9986
|
-
/* @__PURE__ */
|
|
9987
|
-
|
|
10821
|
+
/* @__PURE__ */ jsx23(
|
|
10822
|
+
ScButton9,
|
|
9988
10823
|
{
|
|
9989
10824
|
text: "New Token",
|
|
9990
10825
|
variant: "primary",
|
|
9991
10826
|
size: "md",
|
|
9992
10827
|
styleVariant: "icon-left",
|
|
9993
|
-
icon: /* @__PURE__ */
|
|
10828
|
+
icon: /* @__PURE__ */ jsx23(SiconPlus2, {}),
|
|
9994
10829
|
onClick: () => setShowCreateModal(true)
|
|
9995
10830
|
}
|
|
9996
10831
|
)
|
|
9997
10832
|
]
|
|
9998
10833
|
}
|
|
9999
10834
|
),
|
|
10000
|
-
loading ? /* @__PURE__ */
|
|
10835
|
+
loading ? /* @__PURE__ */ jsx23(
|
|
10001
10836
|
"div",
|
|
10002
10837
|
{
|
|
10003
10838
|
style: {
|
|
@@ -10011,7 +10846,7 @@ function TokensContent({
|
|
|
10011
10846
|
},
|
|
10012
10847
|
children: "Loading tokens..."
|
|
10013
10848
|
}
|
|
10014
|
-
) : tokens.length === 0 ? /* @__PURE__ */
|
|
10849
|
+
) : tokens.length === 0 ? /* @__PURE__ */ jsxs20(
|
|
10015
10850
|
"div",
|
|
10016
10851
|
{
|
|
10017
10852
|
style: {
|
|
@@ -10023,8 +10858,8 @@ function TokensContent({
|
|
|
10023
10858
|
gap: "var(--spacing-xl)"
|
|
10024
10859
|
},
|
|
10025
10860
|
children: [
|
|
10026
|
-
/* @__PURE__ */
|
|
10027
|
-
/* @__PURE__ */
|
|
10861
|
+
/* @__PURE__ */ jsx23(SiconKey_default, { size: 48, color: "var(--alias-text---icons-muted)", strokeWidth: 1 }),
|
|
10862
|
+
/* @__PURE__ */ jsx23(
|
|
10028
10863
|
"p",
|
|
10029
10864
|
{
|
|
10030
10865
|
style: {
|
|
@@ -10038,7 +10873,7 @@ function TokensContent({
|
|
|
10038
10873
|
)
|
|
10039
10874
|
]
|
|
10040
10875
|
}
|
|
10041
|
-
) : /* @__PURE__ */
|
|
10876
|
+
) : /* @__PURE__ */ jsx23(
|
|
10042
10877
|
TokenTable,
|
|
10043
10878
|
{
|
|
10044
10879
|
tokens,
|
|
@@ -10047,14 +10882,14 @@ function TokensContent({
|
|
|
10047
10882
|
onDelete: handleDelete
|
|
10048
10883
|
}
|
|
10049
10884
|
),
|
|
10050
|
-
showCreateModal && /* @__PURE__ */
|
|
10885
|
+
showCreateModal && /* @__PURE__ */ jsx23(
|
|
10051
10886
|
CreateTokenModal,
|
|
10052
10887
|
{
|
|
10053
10888
|
onClose: () => setShowCreateModal(false),
|
|
10054
10889
|
onCreated: handleTokenCreated
|
|
10055
10890
|
}
|
|
10056
10891
|
),
|
|
10057
|
-
createdToken && /* @__PURE__ */
|
|
10892
|
+
createdToken && /* @__PURE__ */ jsx23(
|
|
10058
10893
|
TokenCreatedModal,
|
|
10059
10894
|
{
|
|
10060
10895
|
token: createdToken,
|
|
@@ -10063,7 +10898,7 @@ function TokensContent({
|
|
|
10063
10898
|
)
|
|
10064
10899
|
] });
|
|
10065
10900
|
if (embedded) {
|
|
10066
|
-
return /* @__PURE__ */
|
|
10901
|
+
return /* @__PURE__ */ jsx23(
|
|
10067
10902
|
"div",
|
|
10068
10903
|
{
|
|
10069
10904
|
className: "flex flex-col flex-1 min-w-0 min-h-0 w-full",
|
|
@@ -10072,7 +10907,7 @@ function TokensContent({
|
|
|
10072
10907
|
}
|
|
10073
10908
|
);
|
|
10074
10909
|
}
|
|
10075
|
-
return /* @__PURE__ */
|
|
10910
|
+
return /* @__PURE__ */ jsx23("div", { className: "flex-1 min-h-0 min-w-0 relative", style: { height: "100%" }, children: /* @__PURE__ */ jsxs20(
|
|
10076
10911
|
"div",
|
|
10077
10912
|
{
|
|
10078
10913
|
className: "flex flex-col items-stretch size-full overflow-y-auto",
|
|
@@ -10083,7 +10918,7 @@ function TokensContent({
|
|
|
10083
10918
|
backgroundSize: "24px 24px"
|
|
10084
10919
|
},
|
|
10085
10920
|
children: [
|
|
10086
|
-
/* @__PURE__ */
|
|
10921
|
+
/* @__PURE__ */ jsxs20(
|
|
10087
10922
|
"div",
|
|
10088
10923
|
{
|
|
10089
10924
|
style: {
|
|
@@ -10094,7 +10929,7 @@ function TokensContent({
|
|
|
10094
10929
|
width: "100%"
|
|
10095
10930
|
},
|
|
10096
10931
|
children: [
|
|
10097
|
-
/* @__PURE__ */
|
|
10932
|
+
/* @__PURE__ */ jsx23(
|
|
10098
10933
|
"p",
|
|
10099
10934
|
{
|
|
10100
10935
|
style: {
|
|
@@ -10108,9 +10943,9 @@ function TokensContent({
|
|
|
10108
10943
|
children: "API Tokens"
|
|
10109
10944
|
}
|
|
10110
10945
|
),
|
|
10111
|
-
/* @__PURE__ */
|
|
10112
|
-
/* @__PURE__ */
|
|
10113
|
-
|
|
10946
|
+
/* @__PURE__ */ jsxs20("div", { style: { display: "flex", gap: "var(--spacing-md)", alignItems: "center" }, children: [
|
|
10947
|
+
/* @__PURE__ */ jsx23(
|
|
10948
|
+
ScButton9,
|
|
10114
10949
|
{
|
|
10115
10950
|
text: showRevoked ? "Hide Revoked" : "Show Revoked",
|
|
10116
10951
|
variant: "outline",
|
|
@@ -10118,14 +10953,14 @@ function TokensContent({
|
|
|
10118
10953
|
onClick: () => setShowRevoked((v) => !v)
|
|
10119
10954
|
}
|
|
10120
10955
|
),
|
|
10121
|
-
/* @__PURE__ */
|
|
10122
|
-
|
|
10956
|
+
/* @__PURE__ */ jsx23(
|
|
10957
|
+
ScButton9,
|
|
10123
10958
|
{
|
|
10124
10959
|
text: "New Token",
|
|
10125
10960
|
variant: "primary",
|
|
10126
10961
|
size: "md",
|
|
10127
10962
|
styleVariant: "icon-left",
|
|
10128
|
-
icon: /* @__PURE__ */
|
|
10963
|
+
icon: /* @__PURE__ */ jsx23(SiconPlus2, {}),
|
|
10129
10964
|
onClick: () => setShowCreateModal(true)
|
|
10130
10965
|
}
|
|
10131
10966
|
)
|
|
@@ -10139,7 +10974,7 @@ function TokensContent({
|
|
|
10139
10974
|
) });
|
|
10140
10975
|
}
|
|
10141
10976
|
function TokenTable({ tokens, deletingId, onRevoke, onDelete }) {
|
|
10142
|
-
return /* @__PURE__ */
|
|
10977
|
+
return /* @__PURE__ */ jsx23(
|
|
10143
10978
|
"div",
|
|
10144
10979
|
{
|
|
10145
10980
|
style: {
|
|
@@ -10150,7 +10985,7 @@ function TokenTable({ tokens, deletingId, onRevoke, onDelete }) {
|
|
|
10150
10985
|
overflow: "hidden",
|
|
10151
10986
|
width: "100%"
|
|
10152
10987
|
},
|
|
10153
|
-
children: /* @__PURE__ */
|
|
10988
|
+
children: /* @__PURE__ */ jsxs20(
|
|
10154
10989
|
"div",
|
|
10155
10990
|
{
|
|
10156
10991
|
style: {
|
|
@@ -10163,7 +10998,7 @@ function TokenTable({ tokens, deletingId, onRevoke, onDelete }) {
|
|
|
10163
10998
|
minHeight: 0
|
|
10164
10999
|
},
|
|
10165
11000
|
children: [
|
|
10166
|
-
/* @__PURE__ */
|
|
11001
|
+
/* @__PURE__ */ jsx23(
|
|
10167
11002
|
"div",
|
|
10168
11003
|
{
|
|
10169
11004
|
style: {
|
|
@@ -10174,7 +11009,7 @@ function TokenTable({ tokens, deletingId, onRevoke, onDelete }) {
|
|
|
10174
11009
|
borderBottom: "0.5px solid var(--alias-border-subtle)",
|
|
10175
11010
|
flexShrink: 0
|
|
10176
11011
|
},
|
|
10177
|
-
children: ["Name", "Token", "Expires", "Last Used", "Created", "Actions"].map((h) => /* @__PURE__ */
|
|
11012
|
+
children: ["Name", "Token", "Expires", "Last Used", "Created", "Actions"].map((h) => /* @__PURE__ */ jsx23(
|
|
10178
11013
|
"span",
|
|
10179
11014
|
{
|
|
10180
11015
|
style: {
|
|
@@ -10190,7 +11025,7 @@ function TokenTable({ tokens, deletingId, onRevoke, onDelete }) {
|
|
|
10190
11025
|
))
|
|
10191
11026
|
}
|
|
10192
11027
|
),
|
|
10193
|
-
/* @__PURE__ */
|
|
11028
|
+
/* @__PURE__ */ jsx23("div", { style: { flex: 1, minHeight: 0, overflowY: "auto" }, children: tokens.map((token, idx) => /* @__PURE__ */ jsxs20(
|
|
10194
11029
|
"div",
|
|
10195
11030
|
{
|
|
10196
11031
|
style: {
|
|
@@ -10201,8 +11036,8 @@ function TokenTable({ tokens, deletingId, onRevoke, onDelete }) {
|
|
|
10201
11036
|
borderBottom: idx < tokens.length - 1 ? "0.5px solid var(--alias-border-subtle)" : "none"
|
|
10202
11037
|
},
|
|
10203
11038
|
children: [
|
|
10204
|
-
/* @__PURE__ */
|
|
10205
|
-
/* @__PURE__ */
|
|
11039
|
+
/* @__PURE__ */ jsxs20("div", { style: { display: "flex", alignItems: "center", gap: "var(--spacing-md)", minWidth: 0 }, children: [
|
|
11040
|
+
/* @__PURE__ */ jsx23(
|
|
10206
11041
|
"span",
|
|
10207
11042
|
{
|
|
10208
11043
|
style: {
|
|
@@ -10218,9 +11053,9 @@ function TokenTable({ tokens, deletingId, onRevoke, onDelete }) {
|
|
|
10218
11053
|
children: token.name
|
|
10219
11054
|
}
|
|
10220
11055
|
),
|
|
10221
|
-
token.status === "revoked" && /* @__PURE__ */
|
|
11056
|
+
token.status === "revoked" && /* @__PURE__ */ jsx23(ScBadges, { text: "Revoked", variant: "error" })
|
|
10222
11057
|
] }),
|
|
10223
|
-
/* @__PURE__ */
|
|
11058
|
+
/* @__PURE__ */ jsx23("div", { style: { minWidth: 0 }, children: /* @__PURE__ */ jsxs20(
|
|
10224
11059
|
"code",
|
|
10225
11060
|
{
|
|
10226
11061
|
style: {
|
|
@@ -10243,7 +11078,7 @@ function TokenTable({ tokens, deletingId, onRevoke, onDelete }) {
|
|
|
10243
11078
|
]
|
|
10244
11079
|
}
|
|
10245
11080
|
) }),
|
|
10246
|
-
/* @__PURE__ */
|
|
11081
|
+
/* @__PURE__ */ jsx23(
|
|
10247
11082
|
"span",
|
|
10248
11083
|
{
|
|
10249
11084
|
style: {
|
|
@@ -10255,7 +11090,7 @@ function TokenTable({ tokens, deletingId, onRevoke, onDelete }) {
|
|
|
10255
11090
|
children: formatDate3(token.expiresAt)
|
|
10256
11091
|
}
|
|
10257
11092
|
),
|
|
10258
|
-
/* @__PURE__ */
|
|
11093
|
+
/* @__PURE__ */ jsx23(
|
|
10259
11094
|
"span",
|
|
10260
11095
|
{
|
|
10261
11096
|
style: {
|
|
@@ -10267,7 +11102,7 @@ function TokenTable({ tokens, deletingId, onRevoke, onDelete }) {
|
|
|
10267
11102
|
children: token.lastUsedAt ? formatDate3(token.lastUsedAt) : "Never"
|
|
10268
11103
|
}
|
|
10269
11104
|
),
|
|
10270
|
-
/* @__PURE__ */
|
|
11105
|
+
/* @__PURE__ */ jsx23(
|
|
10271
11106
|
"span",
|
|
10272
11107
|
{
|
|
10273
11108
|
style: {
|
|
@@ -10279,9 +11114,9 @@ function TokenTable({ tokens, deletingId, onRevoke, onDelete }) {
|
|
|
10279
11114
|
children: formatDate3(token.createdAt)
|
|
10280
11115
|
}
|
|
10281
11116
|
),
|
|
10282
|
-
/* @__PURE__ */
|
|
10283
|
-
/* @__PURE__ */
|
|
10284
|
-
|
|
11117
|
+
/* @__PURE__ */ jsxs20("div", { style: { display: "flex", gap: "var(--spacing-sm)" }, children: [
|
|
11118
|
+
/* @__PURE__ */ jsx23(
|
|
11119
|
+
ScButton9,
|
|
10285
11120
|
{
|
|
10286
11121
|
text: deletingId === token._id ? "..." : "Revoke",
|
|
10287
11122
|
variant: "outline",
|
|
@@ -10290,8 +11125,8 @@ function TokenTable({ tokens, deletingId, onRevoke, onDelete }) {
|
|
|
10290
11125
|
onClick: () => onRevoke(token._id)
|
|
10291
11126
|
}
|
|
10292
11127
|
),
|
|
10293
|
-
/* @__PURE__ */
|
|
10294
|
-
|
|
11128
|
+
/* @__PURE__ */ jsx23(
|
|
11129
|
+
ScButton9,
|
|
10295
11130
|
{
|
|
10296
11131
|
text: deletingId === token._id ? "..." : "Delete",
|
|
10297
11132
|
variant: "error",
|
|
@@ -10313,7 +11148,7 @@ function TokenTable({ tokens, deletingId, onRevoke, onDelete }) {
|
|
|
10313
11148
|
}
|
|
10314
11149
|
|
|
10315
11150
|
// src/settings-content.tsx
|
|
10316
|
-
import { Fragment as Fragment12, jsx as
|
|
11151
|
+
import { Fragment as Fragment12, jsx as jsx24, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
10317
11152
|
function deriveInitials(name) {
|
|
10318
11153
|
return name.split(/\s+/).slice(0, 2).map((part) => part[0]?.toUpperCase() ?? "").join("") || "WS";
|
|
10319
11154
|
}
|
|
@@ -10349,7 +11184,7 @@ function SettingsNavItem({
|
|
|
10349
11184
|
onTabChange
|
|
10350
11185
|
}) {
|
|
10351
11186
|
const isActive = activeTab === tab;
|
|
10352
|
-
return /* @__PURE__ */
|
|
11187
|
+
return /* @__PURE__ */ jsx24(SettingsTooltip, { content: TAB_DESCRIPTIONS[tab], placement: "right", children: /* @__PURE__ */ jsx24("div", { children: /* @__PURE__ */ jsx24(
|
|
10353
11188
|
ScSidebarMenu,
|
|
10354
11189
|
{
|
|
10355
11190
|
icon: icon(isActive ? PRIMARY_COLOR3 : MUTED_COLOR2),
|
|
@@ -10378,7 +11213,7 @@ function SettingsNav({
|
|
|
10378
11213
|
hasOrganization,
|
|
10379
11214
|
isWorkspaceAdmin
|
|
10380
11215
|
}) {
|
|
10381
|
-
const item = (tab, icon) => /* @__PURE__ */
|
|
11216
|
+
const item = (tab, icon) => /* @__PURE__ */ jsx24(
|
|
10382
11217
|
SettingsNavItem,
|
|
10383
11218
|
{
|
|
10384
11219
|
tab,
|
|
@@ -10388,7 +11223,7 @@ function SettingsNav({
|
|
|
10388
11223
|
onTabChange
|
|
10389
11224
|
}
|
|
10390
11225
|
);
|
|
10391
|
-
return /* @__PURE__ */
|
|
11226
|
+
return /* @__PURE__ */ jsxs21(
|
|
10392
11227
|
"div",
|
|
10393
11228
|
{
|
|
10394
11229
|
className: "flex flex-col items-start shrink-0 relative overflow-y-auto",
|
|
@@ -10411,33 +11246,33 @@ function SettingsNav({
|
|
|
10411
11246
|
gap: "var(--spacing-5xl)"
|
|
10412
11247
|
},
|
|
10413
11248
|
children: [
|
|
10414
|
-
/* @__PURE__ */
|
|
10415
|
-
/* @__PURE__ */
|
|
10416
|
-
item("profile", (color) => /* @__PURE__ */
|
|
10417
|
-
item("workspaceList", (color) => /* @__PURE__ */
|
|
11249
|
+
/* @__PURE__ */ jsxs21("div", { className: "flex flex-col w-full", style: { gap: "var(--spacing-md)" }, children: [
|
|
11250
|
+
/* @__PURE__ */ jsx24("div", { style: { padding: "4px 12px", fontSize: 11, fontWeight: 500, color: MUTED_COLOR2, textTransform: "uppercase", letterSpacing: "0.08em" }, children: "Account" }),
|
|
11251
|
+
item("profile", (color) => /* @__PURE__ */ jsx24(SiconUser, { className: "w-5 h-5", color })),
|
|
11252
|
+
item("workspaceList", (color) => /* @__PURE__ */ jsx24(SiconSwitch, { className: "w-5 h-5", color }))
|
|
10418
11253
|
] }),
|
|
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__ */
|
|
11254
|
+
/* @__PURE__ */ jsx24(ScHDivider, {}),
|
|
11255
|
+
/* @__PURE__ */ jsxs21("div", { className: "flex flex-col w-full", style: { gap: "var(--spacing-md)" }, children: [
|
|
11256
|
+
/* @__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" }),
|
|
11257
|
+
item("workspace", (color) => /* @__PURE__ */ jsx24(SiconSettings2, { className: "w-5 h-5", color })),
|
|
11258
|
+
item("workspaceMembers", (color) => /* @__PURE__ */ jsx24(SiconTeam, { className: "w-5 h-5", color })),
|
|
11259
|
+
isWorkspaceAdmin && /* @__PURE__ */ jsxs21(Fragment12, { children: [
|
|
11260
|
+
item("billing", (color) => /* @__PURE__ */ jsx24(SiconBilling, { className: "w-5 h-5", color })),
|
|
11261
|
+
item("apikey", (color) => /* @__PURE__ */ jsx24(SiconKey_default, { className: "w-5 h-5", color }))
|
|
10427
11262
|
] }),
|
|
10428
|
-
!isWorkspaceAdmin && /* @__PURE__ */
|
|
11263
|
+
!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
11264
|
] }),
|
|
10430
|
-
/* @__PURE__ */
|
|
10431
|
-
/* @__PURE__ */
|
|
10432
|
-
/* @__PURE__ */
|
|
10433
|
-
item("organization", (color) => /* @__PURE__ */
|
|
10434
|
-
item("organizationWorkspaces", (color) => /* @__PURE__ */
|
|
10435
|
-
] }) : /* @__PURE__ */
|
|
11265
|
+
/* @__PURE__ */ jsx24(ScHDivider, {}),
|
|
11266
|
+
/* @__PURE__ */ jsx24("div", { className: "flex flex-col w-full", style: { gap: "var(--spacing-md)" }, children: hasOrganization ? /* @__PURE__ */ jsxs21(Fragment12, { children: [
|
|
11267
|
+
/* @__PURE__ */ jsx24("div", { style: { padding: "4px 12px", fontSize: 11, fontWeight: 500, color: MUTED_COLOR2, textTransform: "uppercase", letterSpacing: "0.08em" }, children: "Organization" }),
|
|
11268
|
+
item("organization", (color) => /* @__PURE__ */ jsx24(SiconTeam, { className: "w-5 h-5", color })),
|
|
11269
|
+
item("organizationWorkspaces", (color) => /* @__PURE__ */ jsx24(SiconWorkspace2, { className: "w-5 h-5", color }))
|
|
11270
|
+
] }) : /* @__PURE__ */ jsx24(
|
|
10436
11271
|
SettingsNavItem,
|
|
10437
11272
|
{
|
|
10438
11273
|
tab: "organization",
|
|
10439
11274
|
label: "Organization",
|
|
10440
|
-
icon: (color) => /* @__PURE__ */
|
|
11275
|
+
icon: (color) => /* @__PURE__ */ jsx24(SiconGlobe3, { className: "w-5 h-5", color }),
|
|
10441
11276
|
activeTab,
|
|
10442
11277
|
onTabChange
|
|
10443
11278
|
}
|
|
@@ -10449,7 +11284,7 @@ function SettingsNav({
|
|
|
10449
11284
|
var SPECIALIZATION_ICON_SIZE = 24;
|
|
10450
11285
|
function SpecializationIcon({ iconUrl }) {
|
|
10451
11286
|
if (iconUrl) {
|
|
10452
|
-
return /* @__PURE__ */
|
|
11287
|
+
return /* @__PURE__ */ jsx24(
|
|
10453
11288
|
"img",
|
|
10454
11289
|
{
|
|
10455
11290
|
src: iconUrl,
|
|
@@ -10462,7 +11297,7 @@ function SpecializationIcon({ iconUrl }) {
|
|
|
10462
11297
|
}
|
|
10463
11298
|
);
|
|
10464
11299
|
}
|
|
10465
|
-
return /* @__PURE__ */
|
|
11300
|
+
return /* @__PURE__ */ jsx24(
|
|
10466
11301
|
SiconBolt,
|
|
10467
11302
|
{
|
|
10468
11303
|
style: {
|
|
@@ -10494,10 +11329,10 @@ function SpecializationDropdown({
|
|
|
10494
11329
|
disabled
|
|
10495
11330
|
}) {
|
|
10496
11331
|
const { auth } = useSettingsAdapters();
|
|
10497
|
-
const [open, setOpen] =
|
|
10498
|
-
const containerRef =
|
|
10499
|
-
const [options, setOptions] =
|
|
10500
|
-
|
|
11332
|
+
const [open, setOpen] = useState17(false);
|
|
11333
|
+
const containerRef = useRef8(null);
|
|
11334
|
+
const [options, setOptions] = useState17([]);
|
|
11335
|
+
useEffect15(() => {
|
|
10501
11336
|
if (!auth.getSpecializations) return;
|
|
10502
11337
|
let cancelled = false;
|
|
10503
11338
|
auth.getSpecializations().then((items) => {
|
|
@@ -10517,7 +11352,7 @@ function SpecializationDropdown({
|
|
|
10517
11352
|
cancelled = true;
|
|
10518
11353
|
};
|
|
10519
11354
|
}, [auth]);
|
|
10520
|
-
|
|
11355
|
+
useEffect15(() => {
|
|
10521
11356
|
if (!open) return;
|
|
10522
11357
|
function handleMouseDown(e) {
|
|
10523
11358
|
if (containerRef.current && !containerRef.current.contains(e.target)) {
|
|
@@ -10535,15 +11370,15 @@ function SpecializationDropdown({
|
|
|
10535
11370
|
};
|
|
10536
11371
|
}, [open]);
|
|
10537
11372
|
const selected = options.find((o) => o.id === value);
|
|
10538
|
-
return /* @__PURE__ */
|
|
11373
|
+
return /* @__PURE__ */ jsxs21(
|
|
10539
11374
|
"div",
|
|
10540
11375
|
{
|
|
10541
11376
|
ref: containerRef,
|
|
10542
11377
|
className: "w-full",
|
|
10543
11378
|
style: { position: "relative" },
|
|
10544
11379
|
children: [
|
|
10545
|
-
/* @__PURE__ */
|
|
10546
|
-
/* @__PURE__ */
|
|
11380
|
+
/* @__PURE__ */ jsx24("style", { children: DROPDOWN_TRIGGER_STYLES }),
|
|
11381
|
+
/* @__PURE__ */ jsx24(
|
|
10547
11382
|
"div",
|
|
10548
11383
|
{
|
|
10549
11384
|
className: "spec-dropdown-trigger",
|
|
@@ -10551,7 +11386,7 @@ function SpecializationDropdown({
|
|
|
10551
11386
|
onClick: () => !disabled && setOpen((v) => !v),
|
|
10552
11387
|
"aria-haspopup": "listbox",
|
|
10553
11388
|
"aria-expanded": open,
|
|
10554
|
-
children: /* @__PURE__ */
|
|
11389
|
+
children: /* @__PURE__ */ jsx24(
|
|
10555
11390
|
ScTextField,
|
|
10556
11391
|
{
|
|
10557
11392
|
label: "Specialization",
|
|
@@ -10559,8 +11394,8 @@ function SpecializationDropdown({
|
|
|
10559
11394
|
value: selected?.label ?? "",
|
|
10560
11395
|
placeholderFilled: "Select specialization",
|
|
10561
11396
|
tfGroup: "icon-left-right",
|
|
10562
|
-
tfLeftIcon: /* @__PURE__ */
|
|
10563
|
-
tfRightIcon: /* @__PURE__ */
|
|
11397
|
+
tfLeftIcon: /* @__PURE__ */ jsx24(SpecializationIcon, { iconUrl: selected?.iconUrl }),
|
|
11398
|
+
tfRightIcon: /* @__PURE__ */ jsx24(
|
|
10564
11399
|
"span",
|
|
10565
11400
|
{
|
|
10566
11401
|
style: {
|
|
@@ -10570,7 +11405,7 @@ function SpecializationDropdown({
|
|
|
10570
11405
|
transform: open ? "rotate(180deg)" : "none",
|
|
10571
11406
|
transition: "transform 120ms ease-out"
|
|
10572
11407
|
},
|
|
10573
|
-
children: /* @__PURE__ */
|
|
11408
|
+
children: /* @__PURE__ */ jsx24(SiconDown, {})
|
|
10574
11409
|
}
|
|
10575
11410
|
),
|
|
10576
11411
|
className: "sc-text-field-full-width",
|
|
@@ -10581,7 +11416,7 @@ function SpecializationDropdown({
|
|
|
10581
11416
|
)
|
|
10582
11417
|
}
|
|
10583
11418
|
),
|
|
10584
|
-
open && /* @__PURE__ */
|
|
11419
|
+
open && /* @__PURE__ */ jsx24(
|
|
10585
11420
|
"div",
|
|
10586
11421
|
{
|
|
10587
11422
|
role: "listbox",
|
|
@@ -10603,11 +11438,11 @@ function SpecializationDropdown({
|
|
|
10603
11438
|
},
|
|
10604
11439
|
children: options.map((opt) => {
|
|
10605
11440
|
const isActive = opt.id === value;
|
|
10606
|
-
return /* @__PURE__ */
|
|
11441
|
+
return /* @__PURE__ */ jsx24(
|
|
10607
11442
|
ScMenuOptions,
|
|
10608
11443
|
{
|
|
10609
11444
|
text: opt.label,
|
|
10610
|
-
icon: /* @__PURE__ */
|
|
11445
|
+
icon: /* @__PURE__ */ jsx24(SpecializationIcon, { iconUrl: opt.iconUrl }),
|
|
10611
11446
|
hover: isActive ? "true" : "false",
|
|
10612
11447
|
variant: "default",
|
|
10613
11448
|
role: "option",
|
|
@@ -10632,9 +11467,9 @@ function LanguageDropdown({
|
|
|
10632
11467
|
onChange,
|
|
10633
11468
|
disabled
|
|
10634
11469
|
}) {
|
|
10635
|
-
const [open, setOpen] =
|
|
10636
|
-
const containerRef =
|
|
10637
|
-
|
|
11470
|
+
const [open, setOpen] = useState17(false);
|
|
11471
|
+
const containerRef = useRef8(null);
|
|
11472
|
+
useEffect15(() => {
|
|
10638
11473
|
if (!open) return;
|
|
10639
11474
|
function handleMouseDown(e) {
|
|
10640
11475
|
if (containerRef.current && !containerRef.current.contains(e.target)) {
|
|
@@ -10651,15 +11486,15 @@ function LanguageDropdown({
|
|
|
10651
11486
|
document.removeEventListener("keydown", handleKeyDown);
|
|
10652
11487
|
};
|
|
10653
11488
|
}, [open]);
|
|
10654
|
-
return /* @__PURE__ */
|
|
11489
|
+
return /* @__PURE__ */ jsxs21(
|
|
10655
11490
|
"div",
|
|
10656
11491
|
{
|
|
10657
11492
|
ref: containerRef,
|
|
10658
11493
|
className: "w-full",
|
|
10659
11494
|
style: { position: "relative" },
|
|
10660
11495
|
children: [
|
|
10661
|
-
/* @__PURE__ */
|
|
10662
|
-
/* @__PURE__ */
|
|
11496
|
+
/* @__PURE__ */ jsx24("style", { children: DROPDOWN_TRIGGER_STYLES }),
|
|
11497
|
+
/* @__PURE__ */ jsx24(
|
|
10663
11498
|
"div",
|
|
10664
11499
|
{
|
|
10665
11500
|
className: "spec-dropdown-trigger",
|
|
@@ -10667,7 +11502,7 @@ function LanguageDropdown({
|
|
|
10667
11502
|
onClick: () => !disabled && setOpen((v) => !v),
|
|
10668
11503
|
"aria-haspopup": "listbox",
|
|
10669
11504
|
"aria-expanded": open,
|
|
10670
|
-
children: /* @__PURE__ */
|
|
11505
|
+
children: /* @__PURE__ */ jsx24(
|
|
10671
11506
|
ScTextField,
|
|
10672
11507
|
{
|
|
10673
11508
|
label: "Language",
|
|
@@ -10675,7 +11510,7 @@ function LanguageDropdown({
|
|
|
10675
11510
|
value: userLanguageLabel(value),
|
|
10676
11511
|
placeholderFilled: "Select language",
|
|
10677
11512
|
tfGroup: "icon-right",
|
|
10678
|
-
tfRightIcon: /* @__PURE__ */
|
|
11513
|
+
tfRightIcon: /* @__PURE__ */ jsx24(
|
|
10679
11514
|
"span",
|
|
10680
11515
|
{
|
|
10681
11516
|
style: {
|
|
@@ -10685,7 +11520,7 @@ function LanguageDropdown({
|
|
|
10685
11520
|
transform: open ? "rotate(180deg)" : "none",
|
|
10686
11521
|
transition: "transform 120ms ease-out"
|
|
10687
11522
|
},
|
|
10688
|
-
children: /* @__PURE__ */
|
|
11523
|
+
children: /* @__PURE__ */ jsx24(SiconDown, {})
|
|
10689
11524
|
}
|
|
10690
11525
|
),
|
|
10691
11526
|
className: "sc-text-field-full-width",
|
|
@@ -10696,7 +11531,7 @@ function LanguageDropdown({
|
|
|
10696
11531
|
)
|
|
10697
11532
|
}
|
|
10698
11533
|
),
|
|
10699
|
-
open && /* @__PURE__ */
|
|
11534
|
+
open && /* @__PURE__ */ jsx24(
|
|
10700
11535
|
"div",
|
|
10701
11536
|
{
|
|
10702
11537
|
role: "listbox",
|
|
@@ -10722,11 +11557,11 @@ function LanguageDropdown({
|
|
|
10722
11557
|
},
|
|
10723
11558
|
children: USER_LANGUAGES.map((lang) => {
|
|
10724
11559
|
const isActive = lang.code === value;
|
|
10725
|
-
return /* @__PURE__ */
|
|
11560
|
+
return /* @__PURE__ */ jsx24(
|
|
10726
11561
|
ScMenuOptions,
|
|
10727
11562
|
{
|
|
10728
11563
|
text: lang.label,
|
|
10729
|
-
icon: /* @__PURE__ */
|
|
11564
|
+
icon: /* @__PURE__ */ jsx24(Fragment12, {}),
|
|
10730
11565
|
hover: isActive ? "true" : "false",
|
|
10731
11566
|
variant: "default",
|
|
10732
11567
|
role: "option",
|
|
@@ -10752,28 +11587,28 @@ function ProfileTab() {
|
|
|
10752
11587
|
const derivedName = user?.name ?? "";
|
|
10753
11588
|
const derivedSpec = user?.userSpecialization ?? "";
|
|
10754
11589
|
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] =
|
|
11590
|
+
const [fullName, setFullName] = useState17(derivedName);
|
|
11591
|
+
const [selectedSpec, setSelectedSpec] = useState17(derivedSpec);
|
|
11592
|
+
const [selectedLanguage, setSelectedLanguage] = useState17(derivedLanguage);
|
|
11593
|
+
const [saving, setSaving] = useState17(false);
|
|
11594
|
+
const [imageSaving, setImageSaving] = useState17(false);
|
|
11595
|
+
const [imagePreview, setImagePreview] = useState17(
|
|
10761
11596
|
void 0
|
|
10762
11597
|
);
|
|
10763
|
-
const fileInputRef =
|
|
11598
|
+
const fileInputRef = useRef8(null);
|
|
10764
11599
|
const profileDisplayName = fullName || user?.email || "User";
|
|
10765
11600
|
const profileImage = imagePreview ?? getUserProfileImage(user);
|
|
10766
11601
|
const profileInitial = profileDisplayName.charAt(0).toUpperCase();
|
|
10767
11602
|
const disableAllActions = saving || imageSaving;
|
|
10768
11603
|
const dirty = fullName.trim() !== derivedName || selectedSpec !== derivedSpec || selectedLanguage !== derivedLanguage;
|
|
10769
|
-
|
|
11604
|
+
useEffect15(() => {
|
|
10770
11605
|
setFullName(derivedName);
|
|
10771
11606
|
setImagePreview(void 0);
|
|
10772
11607
|
}, [derivedName]);
|
|
10773
|
-
|
|
11608
|
+
useEffect15(() => {
|
|
10774
11609
|
setSelectedSpec(derivedSpec);
|
|
10775
11610
|
}, [derivedSpec]);
|
|
10776
|
-
|
|
11611
|
+
useEffect15(() => {
|
|
10777
11612
|
setSelectedLanguage(derivedLanguage);
|
|
10778
11613
|
}, [derivedLanguage]);
|
|
10779
11614
|
const handleSave = async () => {
|
|
@@ -10855,13 +11690,13 @@ function ProfileTab() {
|
|
|
10855
11690
|
}
|
|
10856
11691
|
auth.clearAuth();
|
|
10857
11692
|
};
|
|
10858
|
-
return /* @__PURE__ */
|
|
11693
|
+
return /* @__PURE__ */ jsxs21(
|
|
10859
11694
|
"div",
|
|
10860
11695
|
{
|
|
10861
11696
|
className: "flex flex-col items-start flex-1 min-w-0 min-h-0 overflow-y-auto",
|
|
10862
11697
|
style: { gap: "var(--spacing-3xl)" },
|
|
10863
11698
|
children: [
|
|
10864
|
-
/* @__PURE__ */
|
|
11699
|
+
/* @__PURE__ */ jsxs21(
|
|
10865
11700
|
"div",
|
|
10866
11701
|
{
|
|
10867
11702
|
className: "sc-profile-card flex flex-col items-start w-full",
|
|
@@ -10874,13 +11709,13 @@ function ProfileTab() {
|
|
|
10874
11709
|
gap: "var(--spacing-6xl)"
|
|
10875
11710
|
},
|
|
10876
11711
|
children: [
|
|
10877
|
-
/* @__PURE__ */
|
|
11712
|
+
/* @__PURE__ */ jsxs21(
|
|
10878
11713
|
"div",
|
|
10879
11714
|
{
|
|
10880
11715
|
className: "flex items-center shrink-0 w-full",
|
|
10881
11716
|
style: { gap: 24, flexWrap: "wrap" },
|
|
10882
11717
|
children: [
|
|
10883
|
-
profileImage ? /* @__PURE__ */
|
|
11718
|
+
profileImage ? /* @__PURE__ */ jsx24(
|
|
10884
11719
|
"img",
|
|
10885
11720
|
{
|
|
10886
11721
|
src: profileImage,
|
|
@@ -10893,7 +11728,7 @@ function ProfileTab() {
|
|
|
10893
11728
|
flexShrink: 0
|
|
10894
11729
|
}
|
|
10895
11730
|
}
|
|
10896
|
-
) : /* @__PURE__ */
|
|
11731
|
+
) : /* @__PURE__ */ jsx24(
|
|
10897
11732
|
"div",
|
|
10898
11733
|
{
|
|
10899
11734
|
"aria-label": "Profile",
|
|
@@ -10906,7 +11741,7 @@ function ProfileTab() {
|
|
|
10906
11741
|
border: "1px solid var(--alias-border-subtle)",
|
|
10907
11742
|
flexShrink: 0
|
|
10908
11743
|
},
|
|
10909
|
-
children: /* @__PURE__ */
|
|
11744
|
+
children: /* @__PURE__ */ jsx24(
|
|
10910
11745
|
"span",
|
|
10911
11746
|
{
|
|
10912
11747
|
style: {
|
|
@@ -10921,7 +11756,7 @@ function ProfileTab() {
|
|
|
10921
11756
|
)
|
|
10922
11757
|
}
|
|
10923
11758
|
),
|
|
10924
|
-
/* @__PURE__ */
|
|
11759
|
+
/* @__PURE__ */ jsx24(
|
|
10925
11760
|
"input",
|
|
10926
11761
|
{
|
|
10927
11762
|
ref: fileInputRef,
|
|
@@ -10931,17 +11766,17 @@ function ProfileTab() {
|
|
|
10931
11766
|
onChange: handleImageChange
|
|
10932
11767
|
}
|
|
10933
11768
|
),
|
|
10934
|
-
/* @__PURE__ */
|
|
11769
|
+
/* @__PURE__ */ jsxs21(
|
|
10935
11770
|
"div",
|
|
10936
11771
|
{
|
|
10937
11772
|
className: "flex items-center",
|
|
10938
11773
|
style: { gap: 12, flexWrap: "wrap" },
|
|
10939
11774
|
children: [
|
|
10940
|
-
/* @__PURE__ */
|
|
10941
|
-
|
|
11775
|
+
/* @__PURE__ */ jsx24(
|
|
11776
|
+
ScButton10,
|
|
10942
11777
|
{
|
|
10943
11778
|
text: "Upload photo",
|
|
10944
|
-
icon: /* @__PURE__ */
|
|
11779
|
+
icon: /* @__PURE__ */ jsx24(SiconUpload2, { className: "w-5 h-5", color: PRIMARY_COLOR3 }),
|
|
10945
11780
|
styleVariant: "icon-left",
|
|
10946
11781
|
variant: "outline",
|
|
10947
11782
|
size: "md",
|
|
@@ -10949,11 +11784,11 @@ function ProfileTab() {
|
|
|
10949
11784
|
onClick: handleUploadClick
|
|
10950
11785
|
}
|
|
10951
11786
|
),
|
|
10952
|
-
/* @__PURE__ */
|
|
10953
|
-
|
|
11787
|
+
/* @__PURE__ */ jsx24(
|
|
11788
|
+
ScButton10,
|
|
10954
11789
|
{
|
|
10955
11790
|
text: "Remove photo",
|
|
10956
|
-
icon: /* @__PURE__ */
|
|
11791
|
+
icon: /* @__PURE__ */ jsx24(
|
|
10957
11792
|
SiconDelete,
|
|
10958
11793
|
{
|
|
10959
11794
|
className: "w-5 h-5",
|
|
@@ -10973,15 +11808,15 @@ function ProfileTab() {
|
|
|
10973
11808
|
]
|
|
10974
11809
|
}
|
|
10975
11810
|
),
|
|
10976
|
-
/* @__PURE__ */
|
|
10977
|
-
/* @__PURE__ */
|
|
11811
|
+
/* @__PURE__ */ jsx24(ScHDivider, {}),
|
|
11812
|
+
/* @__PURE__ */ jsxs21(
|
|
10978
11813
|
"div",
|
|
10979
11814
|
{
|
|
10980
11815
|
className: "sc-profile-fields flex flex-col min-w-0 w-full",
|
|
10981
11816
|
style: { gap: 24 },
|
|
10982
11817
|
children: [
|
|
10983
|
-
/* @__PURE__ */
|
|
10984
|
-
/* @__PURE__ */
|
|
11818
|
+
/* @__PURE__ */ jsxs21("div", { style: { display: "grid", width: "100%", gridTemplateColumns: "repeat(auto-fit, minmax(min(100%, 240px), 1fr))", gap: 24 }, children: [
|
|
11819
|
+
/* @__PURE__ */ jsx24("div", { className: "flex-1 min-w-0", style: { overflow: "hidden" }, children: /* @__PURE__ */ jsx24(
|
|
10985
11820
|
ScTextField,
|
|
10986
11821
|
{
|
|
10987
11822
|
label: "Full Name",
|
|
@@ -10995,7 +11830,7 @@ function ProfileTab() {
|
|
|
10995
11830
|
onChange: (e) => setFullName(e.target.value)
|
|
10996
11831
|
}
|
|
10997
11832
|
) }),
|
|
10998
|
-
/* @__PURE__ */
|
|
11833
|
+
/* @__PURE__ */ jsx24("div", { className: "flex-1 min-w-0", children: /* @__PURE__ */ jsx24(
|
|
10999
11834
|
SpecializationDropdown,
|
|
11000
11835
|
{
|
|
11001
11836
|
value: selectedSpec,
|
|
@@ -11004,8 +11839,8 @@ function ProfileTab() {
|
|
|
11004
11839
|
}
|
|
11005
11840
|
) })
|
|
11006
11841
|
] }),
|
|
11007
|
-
/* @__PURE__ */
|
|
11008
|
-
/* @__PURE__ */
|
|
11842
|
+
/* @__PURE__ */ jsxs21("div", { className: "flex items-start w-full", style: { gap: "var(--spacing-3xl)" }, children: [
|
|
11843
|
+
/* @__PURE__ */ jsx24("div", { className: "flex-1 min-w-0", children: /* @__PURE__ */ jsx24(
|
|
11009
11844
|
LanguageDropdown,
|
|
11010
11845
|
{
|
|
11011
11846
|
value: selectedLanguage,
|
|
@@ -11013,9 +11848,9 @@ function ProfileTab() {
|
|
|
11013
11848
|
disabled: disableAllActions
|
|
11014
11849
|
}
|
|
11015
11850
|
) }),
|
|
11016
|
-
/* @__PURE__ */
|
|
11851
|
+
/* @__PURE__ */ jsx24("div", { className: "flex-1 min-w-0" })
|
|
11017
11852
|
] }),
|
|
11018
|
-
/* @__PURE__ */
|
|
11853
|
+
/* @__PURE__ */ jsx24("div", { className: "w-full", style: { overflow: "hidden" }, children: /* @__PURE__ */ jsx24(
|
|
11019
11854
|
ScTextField,
|
|
11020
11855
|
{
|
|
11021
11856
|
label: "Email ID",
|
|
@@ -11024,7 +11859,7 @@ function ProfileTab() {
|
|
|
11024
11859
|
value: user?.email ?? "",
|
|
11025
11860
|
placeholderFilled: user?.email ?? "chris@kepler.com",
|
|
11026
11861
|
tfGroup: "icon-right",
|
|
11027
|
-
tfRightIcon: /* @__PURE__ */
|
|
11862
|
+
tfRightIcon: /* @__PURE__ */ jsx24(
|
|
11028
11863
|
SiconLock,
|
|
11029
11864
|
{
|
|
11030
11865
|
className: "w-6 h-6",
|
|
@@ -11036,13 +11871,13 @@ function ProfileTab() {
|
|
|
11036
11871
|
readOnly: true
|
|
11037
11872
|
}
|
|
11038
11873
|
) }),
|
|
11039
|
-
/* @__PURE__ */
|
|
11874
|
+
/* @__PURE__ */ jsx24(
|
|
11040
11875
|
"div",
|
|
11041
11876
|
{
|
|
11042
11877
|
className: "flex items-center w-full",
|
|
11043
11878
|
style: { justifyContent: "flex-end", paddingTop: "var(--spacing-md)" },
|
|
11044
|
-
children: /* @__PURE__ */
|
|
11045
|
-
|
|
11879
|
+
children: /* @__PURE__ */ jsx24(
|
|
11880
|
+
ScButton10,
|
|
11046
11881
|
{
|
|
11047
11882
|
text: saving ? "Saving..." : "Save changes",
|
|
11048
11883
|
variant: "secondary",
|
|
@@ -11059,7 +11894,7 @@ function ProfileTab() {
|
|
|
11059
11894
|
]
|
|
11060
11895
|
}
|
|
11061
11896
|
),
|
|
11062
|
-
/* @__PURE__ */
|
|
11897
|
+
/* @__PURE__ */ jsxs21(
|
|
11063
11898
|
"div",
|
|
11064
11899
|
{
|
|
11065
11900
|
className: "flex items-center w-full",
|
|
@@ -11071,8 +11906,8 @@ function ProfileTab() {
|
|
|
11071
11906
|
gap: "var(--spacing-3xl)"
|
|
11072
11907
|
},
|
|
11073
11908
|
children: [
|
|
11074
|
-
/* @__PURE__ */
|
|
11075
|
-
/* @__PURE__ */
|
|
11909
|
+
/* @__PURE__ */ jsxs21("div", { className: "flex flex-col min-w-0 flex-1", style: { gap: "var(--spacing-xs)" }, children: [
|
|
11910
|
+
/* @__PURE__ */ jsx24(
|
|
11076
11911
|
"span",
|
|
11077
11912
|
{
|
|
11078
11913
|
style: {
|
|
@@ -11085,7 +11920,7 @@ function ProfileTab() {
|
|
|
11085
11920
|
children: "Session"
|
|
11086
11921
|
}
|
|
11087
11922
|
),
|
|
11088
|
-
/* @__PURE__ */
|
|
11923
|
+
/* @__PURE__ */ jsx24(
|
|
11089
11924
|
"span",
|
|
11090
11925
|
{
|
|
11091
11926
|
className: "truncate",
|
|
@@ -11100,8 +11935,8 @@ function ProfileTab() {
|
|
|
11100
11935
|
}
|
|
11101
11936
|
)
|
|
11102
11937
|
] }),
|
|
11103
|
-
/* @__PURE__ */
|
|
11104
|
-
|
|
11938
|
+
/* @__PURE__ */ jsx24(
|
|
11939
|
+
ScButton10,
|
|
11105
11940
|
{
|
|
11106
11941
|
text: "Log out",
|
|
11107
11942
|
variant: "outline",
|
|
@@ -11164,11 +11999,11 @@ function WorkspaceListTab({
|
|
|
11164
11999
|
const currentOrganization = organizations.find(
|
|
11165
12000
|
(org) => org._id && org._id === currentWorkspace?.organizationId
|
|
11166
12001
|
);
|
|
11167
|
-
const [page, setPage] =
|
|
11168
|
-
const [serverPage, setServerPage] =
|
|
11169
|
-
const [serverFailed, setServerFailed] =
|
|
12002
|
+
const [page, setPage] = useState17(0);
|
|
12003
|
+
const [serverPage, setServerPage] = useState17(null);
|
|
12004
|
+
const [serverFailed, setServerFailed] = useState17(false);
|
|
11170
12005
|
const serverMode = !!listPage && !serverFailed;
|
|
11171
|
-
|
|
12006
|
+
useEffect15(() => {
|
|
11172
12007
|
if (!listPage || serverFailed) return;
|
|
11173
12008
|
let cancelled = false;
|
|
11174
12009
|
listPage({ limit: pageSize, offset: page * pageSize }).then((result) => {
|
|
@@ -11209,21 +12044,21 @@ function WorkspaceListTab({
|
|
|
11209
12044
|
const pageRows = serverMode ? (serverPage?.items ?? []).map((ws) => ({ ws, group: serverGroupOf(ws) })) : rows.slice(pageStart, pageStart + pageSize);
|
|
11210
12045
|
const pageWorkspaces = pageRows.map((row) => row.ws);
|
|
11211
12046
|
const listLoading = loading || serverMode && !serverPage;
|
|
11212
|
-
const [plans, setPlans] =
|
|
11213
|
-
const requestedPlans =
|
|
12047
|
+
const [plans, setPlans] = useState17({});
|
|
12048
|
+
const requestedPlans = useRef8(/* @__PURE__ */ new Set());
|
|
11214
12049
|
const visibleIds = [
|
|
11215
12050
|
...currentWorkspace ? [currentWorkspace._id] : [],
|
|
11216
12051
|
...pageWorkspaces.map((ws) => ws._id)
|
|
11217
12052
|
];
|
|
11218
12053
|
const visibleKey = visibleIds.join(",");
|
|
11219
|
-
const mounted =
|
|
11220
|
-
|
|
12054
|
+
const mounted = useRef8(true);
|
|
12055
|
+
useEffect15(() => {
|
|
11221
12056
|
mounted.current = true;
|
|
11222
12057
|
return () => {
|
|
11223
12058
|
mounted.current = false;
|
|
11224
12059
|
};
|
|
11225
12060
|
}, []);
|
|
11226
|
-
|
|
12061
|
+
useEffect15(() => {
|
|
11227
12062
|
if (!fetchPlans || listLoading) return;
|
|
11228
12063
|
const missing = visibleKey.split(",").filter((id) => id && !requestedPlans.current.has(id));
|
|
11229
12064
|
if (!missing.length) return;
|
|
@@ -11234,13 +12069,13 @@ function WorkspaceListTab({
|
|
|
11234
12069
|
});
|
|
11235
12070
|
}, [fetchPlans, listLoading, visibleKey]);
|
|
11236
12071
|
const planOf = (ws) => fetchPlans ? plans[ws._id] ?? "" : ws.plan ?? "";
|
|
11237
|
-
return /* @__PURE__ */
|
|
12072
|
+
return /* @__PURE__ */ jsxs21(
|
|
11238
12073
|
"div",
|
|
11239
12074
|
{
|
|
11240
12075
|
className: "flex flex-col items-start flex-1 min-w-0",
|
|
11241
12076
|
style: { gap: "var(--spacing-3xl)", height: "100%" },
|
|
11242
12077
|
children: [
|
|
11243
|
-
/* @__PURE__ */
|
|
12078
|
+
/* @__PURE__ */ jsx24(
|
|
11244
12079
|
"p",
|
|
11245
12080
|
{
|
|
11246
12081
|
className: "shrink-0 w-full",
|
|
@@ -11253,7 +12088,7 @@ function WorkspaceListTab({
|
|
|
11253
12088
|
children: "Switching changes which workspace the rest of Settings acts on."
|
|
11254
12089
|
}
|
|
11255
12090
|
),
|
|
11256
|
-
listLoading && /* @__PURE__ */
|
|
12091
|
+
listLoading && /* @__PURE__ */ jsx24(
|
|
11257
12092
|
"p",
|
|
11258
12093
|
{
|
|
11259
12094
|
style: {
|
|
@@ -11264,13 +12099,13 @@ function WorkspaceListTab({
|
|
|
11264
12099
|
children: "Loading workspaces\u2026"
|
|
11265
12100
|
}
|
|
11266
12101
|
),
|
|
11267
|
-
!listLoading && currentWorkspace && /* @__PURE__ */
|
|
12102
|
+
!listLoading && currentWorkspace && /* @__PURE__ */ jsxs21(
|
|
11268
12103
|
"div",
|
|
11269
12104
|
{
|
|
11270
12105
|
className: "flex flex-col items-start shrink-0 w-full",
|
|
11271
12106
|
style: { gap: 16, padding: "var(--spacing-md) 0" },
|
|
11272
12107
|
children: [
|
|
11273
|
-
/* @__PURE__ */
|
|
12108
|
+
/* @__PURE__ */ jsxs21(
|
|
11274
12109
|
"p",
|
|
11275
12110
|
{
|
|
11276
12111
|
className: "w-full overflow-hidden text-ellipsis whitespace-nowrap",
|
|
@@ -11287,7 +12122,7 @@ function WorkspaceListTab({
|
|
|
11287
12122
|
]
|
|
11288
12123
|
}
|
|
11289
12124
|
),
|
|
11290
|
-
/* @__PURE__ */
|
|
12125
|
+
/* @__PURE__ */ jsx24(
|
|
11291
12126
|
ScWorkspaceSwitchCard,
|
|
11292
12127
|
{
|
|
11293
12128
|
wsName: currentWorkspace.name,
|
|
@@ -11304,7 +12139,7 @@ function WorkspaceListTab({
|
|
|
11304
12139
|
]
|
|
11305
12140
|
}
|
|
11306
12141
|
),
|
|
11307
|
-
!listLoading && currentWorkspace && listTotal > 0 && /* @__PURE__ */
|
|
12142
|
+
!listLoading && currentWorkspace && listTotal > 0 && /* @__PURE__ */ jsx24(
|
|
11308
12143
|
"div",
|
|
11309
12144
|
{
|
|
11310
12145
|
className: "shrink-0 w-full",
|
|
@@ -11314,19 +12149,19 @@ function WorkspaceListTab({
|
|
|
11314
12149
|
}
|
|
11315
12150
|
}
|
|
11316
12151
|
),
|
|
11317
|
-
!listLoading && listTotal > 0 && /* @__PURE__ */
|
|
12152
|
+
!listLoading && listTotal > 0 && /* @__PURE__ */ jsxs21(
|
|
11318
12153
|
"div",
|
|
11319
12154
|
{
|
|
11320
12155
|
className: "flex flex-col items-start flex-1 min-h-0 w-full",
|
|
11321
12156
|
style: { gap: 16, overflowY: "auto" },
|
|
11322
12157
|
children: [
|
|
11323
|
-
/* @__PURE__ */
|
|
12158
|
+
/* @__PURE__ */ jsx24(
|
|
11324
12159
|
"div",
|
|
11325
12160
|
{
|
|
11326
12161
|
className: "flex flex-col items-start w-full",
|
|
11327
12162
|
style: { gap: 16 },
|
|
11328
|
-
children: pageRows.map(({ ws, group }, index) => /* @__PURE__ */
|
|
11329
|
-
(index === 0 || pageRows[index - 1].group.key !== group.key) && /* @__PURE__ */
|
|
12163
|
+
children: pageRows.map(({ ws, group }, index) => /* @__PURE__ */ jsxs21(Fragment11, { children: [
|
|
12164
|
+
(index === 0 || pageRows[index - 1].group.key !== group.key) && /* @__PURE__ */ jsx24(
|
|
11330
12165
|
"p",
|
|
11331
12166
|
{
|
|
11332
12167
|
className: "w-full overflow-hidden text-ellipsis whitespace-nowrap shrink-0",
|
|
@@ -11341,7 +12176,7 @@ function WorkspaceListTab({
|
|
|
11341
12176
|
children: group.label
|
|
11342
12177
|
}
|
|
11343
12178
|
),
|
|
11344
|
-
/* @__PURE__ */
|
|
12179
|
+
/* @__PURE__ */ jsx24(
|
|
11345
12180
|
ScWorkspaceSwitchCard,
|
|
11346
12181
|
{
|
|
11347
12182
|
wsName: ws.name,
|
|
@@ -11359,13 +12194,13 @@ function WorkspaceListTab({
|
|
|
11359
12194
|
] }, ws._id))
|
|
11360
12195
|
}
|
|
11361
12196
|
),
|
|
11362
|
-
pageCount > 1 && /* @__PURE__ */
|
|
12197
|
+
pageCount > 1 && /* @__PURE__ */ jsxs21(
|
|
11363
12198
|
"div",
|
|
11364
12199
|
{
|
|
11365
12200
|
className: "flex items-center justify-between shrink-0 w-full",
|
|
11366
12201
|
style: { gap: "var(--spacing-md)" },
|
|
11367
12202
|
children: [
|
|
11368
|
-
/* @__PURE__ */
|
|
12203
|
+
/* @__PURE__ */ jsxs21(
|
|
11369
12204
|
"span",
|
|
11370
12205
|
{
|
|
11371
12206
|
style: {
|
|
@@ -11384,9 +12219,9 @@ function WorkspaceListTab({
|
|
|
11384
12219
|
]
|
|
11385
12220
|
}
|
|
11386
12221
|
),
|
|
11387
|
-
/* @__PURE__ */
|
|
11388
|
-
/* @__PURE__ */
|
|
11389
|
-
|
|
12222
|
+
/* @__PURE__ */ jsxs21("div", { className: "flex items-center", style: { gap: "var(--spacing-md)" }, children: [
|
|
12223
|
+
/* @__PURE__ */ jsx24(
|
|
12224
|
+
ScButton10,
|
|
11390
12225
|
{
|
|
11391
12226
|
text: "Previous",
|
|
11392
12227
|
variant: "tertiary",
|
|
@@ -11395,8 +12230,8 @@ function WorkspaceListTab({
|
|
|
11395
12230
|
onClick: safePage === 0 ? void 0 : () => setPage(safePage - 1)
|
|
11396
12231
|
}
|
|
11397
12232
|
),
|
|
11398
|
-
/* @__PURE__ */
|
|
11399
|
-
|
|
12233
|
+
/* @__PURE__ */ jsx24(
|
|
12234
|
+
ScButton10,
|
|
11400
12235
|
{
|
|
11401
12236
|
text: "Next",
|
|
11402
12237
|
variant: "tertiary",
|
|
@@ -11423,12 +12258,12 @@ function ReferralTab() {
|
|
|
11423
12258
|
const referralCode = (user?.referralCode ?? user?.referral_code ?? user?.referalCode ?? user?.referal_code ?? "").trim();
|
|
11424
12259
|
const domain = typeof window !== "undefined" ? window.location.origin : "";
|
|
11425
12260
|
const referralLink = referralCode && domain ? `${domain}?referral_code=${encodeURIComponent(referralCode)}` : "";
|
|
11426
|
-
return /* @__PURE__ */
|
|
12261
|
+
return /* @__PURE__ */ jsx24(
|
|
11427
12262
|
"div",
|
|
11428
12263
|
{
|
|
11429
12264
|
className: "flex flex-col items-start flex-1 min-w-0",
|
|
11430
12265
|
style: { gap: "var(--spacing-3xl)" },
|
|
11431
|
-
children: /* @__PURE__ */
|
|
12266
|
+
children: /* @__PURE__ */ jsx24(
|
|
11432
12267
|
"div",
|
|
11433
12268
|
{
|
|
11434
12269
|
className: "w-full relative",
|
|
@@ -11437,13 +12272,13 @@ function ReferralTab() {
|
|
|
11437
12272
|
borderRadius: "var(--radius-3xl)",
|
|
11438
12273
|
padding: "var(--spacing-6xl)"
|
|
11439
12274
|
},
|
|
11440
|
-
children: /* @__PURE__ */
|
|
12275
|
+
children: /* @__PURE__ */ jsxs21(
|
|
11441
12276
|
"div",
|
|
11442
12277
|
{
|
|
11443
12278
|
className: "flex items-start w-full",
|
|
11444
12279
|
style: { gap: "var(--spacing-3xl)" },
|
|
11445
12280
|
children: [
|
|
11446
|
-
/* @__PURE__ */
|
|
12281
|
+
/* @__PURE__ */ jsx24(
|
|
11447
12282
|
ScTextField,
|
|
11448
12283
|
{
|
|
11449
12284
|
label: "Your Referral Link",
|
|
@@ -11452,7 +12287,7 @@ function ReferralTab() {
|
|
|
11452
12287
|
value: referralLink,
|
|
11453
12288
|
placeholderFilled: "https://your-domain.com?referral_code=ABC123",
|
|
11454
12289
|
tfGroup: "icon-right",
|
|
11455
|
-
tfRightIcon: /* @__PURE__ */
|
|
12290
|
+
tfRightIcon: /* @__PURE__ */ jsx24(
|
|
11456
12291
|
SiconBolt,
|
|
11457
12292
|
{
|
|
11458
12293
|
className: "w-6 h-6",
|
|
@@ -11463,7 +12298,7 @@ function ReferralTab() {
|
|
|
11463
12298
|
readOnly: true
|
|
11464
12299
|
}
|
|
11465
12300
|
),
|
|
11466
|
-
/* @__PURE__ */
|
|
12301
|
+
/* @__PURE__ */ jsx24(
|
|
11467
12302
|
ScTextField,
|
|
11468
12303
|
{
|
|
11469
12304
|
label: "Invite through email",
|
|
@@ -11472,7 +12307,7 @@ function ReferralTab() {
|
|
|
11472
12307
|
value: user?.email ?? "",
|
|
11473
12308
|
placeholderFilled: "chris@kepler.com",
|
|
11474
12309
|
tfGroup: "icon-right",
|
|
11475
|
-
tfRightIcon: /* @__PURE__ */
|
|
12310
|
+
tfRightIcon: /* @__PURE__ */ jsx24(
|
|
11476
12311
|
SiconSend,
|
|
11477
12312
|
{
|
|
11478
12313
|
className: "w-6 h-6",
|
|
@@ -11497,7 +12332,7 @@ function SettingsContent({
|
|
|
11497
12332
|
onBack,
|
|
11498
12333
|
hiddenApps
|
|
11499
12334
|
}) {
|
|
11500
|
-
return /* @__PURE__ */
|
|
12335
|
+
return /* @__PURE__ */ jsx24(SettingsAdaptersProvider, { adapters, children: /* @__PURE__ */ jsx24(
|
|
11501
12336
|
SettingsContentInner,
|
|
11502
12337
|
{
|
|
11503
12338
|
activeTab,
|
|
@@ -11526,11 +12361,11 @@ function SettingsContentInner({
|
|
|
11526
12361
|
const workspaceId = workspace.current?.id ?? null;
|
|
11527
12362
|
const workspaceOwner = useWorkspaceOrganization({ workspaceId, request: workspace.organizationRequest ?? unavailableOrganizationRequest, enabled: !!workspace.organizationRequest });
|
|
11528
12363
|
const workspaceOwnerName = workspace.organizationRequest ? workspaceOwner.organizationName : void 0;
|
|
11529
|
-
const [workspaceList, setWorkspaceList] =
|
|
12364
|
+
const [workspaceList, setWorkspaceList] = useState17([]);
|
|
11530
12365
|
const currentWorkspaceRole = workspace.current?.role ?? workspaceList.find((item) => item._id === workspaceId)?.role;
|
|
11531
12366
|
const isWorkspaceAdmin = currentWorkspaceRole?.trim().toLowerCase() === "admin";
|
|
11532
|
-
const [workspaceListLoading, setWorkspaceListLoading] =
|
|
11533
|
-
const refreshWorkspaceList =
|
|
12367
|
+
const [workspaceListLoading, setWorkspaceListLoading] = useState17(false);
|
|
12368
|
+
const refreshWorkspaceList = useCallback8(async () => {
|
|
11534
12369
|
setWorkspaceListLoading(true);
|
|
11535
12370
|
try {
|
|
11536
12371
|
const items = await workspace.list();
|
|
@@ -11551,11 +12386,11 @@ function SettingsContentInner({
|
|
|
11551
12386
|
setWorkspaceListLoading(false);
|
|
11552
12387
|
}
|
|
11553
12388
|
}, [workspace, workspaceId]);
|
|
11554
|
-
|
|
12389
|
+
useEffect15(() => {
|
|
11555
12390
|
void refreshWorkspaceList();
|
|
11556
12391
|
}, [refreshWorkspaceList]);
|
|
11557
12392
|
const hostListPage = workspace.listPage;
|
|
11558
|
-
const listWorkspacePage =
|
|
12393
|
+
const listWorkspacePage = useMemo5(
|
|
11559
12394
|
() => hostListPage ? async (params) => {
|
|
11560
12395
|
const result = await hostListPage(params);
|
|
11561
12396
|
return {
|
|
@@ -11572,8 +12407,8 @@ function SettingsContentInner({
|
|
|
11572
12407
|
} : void 0,
|
|
11573
12408
|
[hostListPage, workspaceId]
|
|
11574
12409
|
);
|
|
11575
|
-
const [listOrganizations, setListOrganizations] =
|
|
11576
|
-
|
|
12410
|
+
const [listOrganizations, setListOrganizations] = useState17([]);
|
|
12411
|
+
useEffect15(() => {
|
|
11577
12412
|
if (activeTab !== "workspaceList" || typeof organization?.list !== "function") {
|
|
11578
12413
|
return;
|
|
11579
12414
|
}
|
|
@@ -11594,7 +12429,7 @@ function SettingsContentInner({
|
|
|
11594
12429
|
cancelled = true;
|
|
11595
12430
|
};
|
|
11596
12431
|
}, [activeTab, organization]);
|
|
11597
|
-
const switchWorkspace =
|
|
12432
|
+
const switchWorkspace = useCallback8(
|
|
11598
12433
|
async (id) => {
|
|
11599
12434
|
await workspace.switch(id);
|
|
11600
12435
|
},
|
|
@@ -11603,17 +12438,27 @@ function SettingsContentInner({
|
|
|
11603
12438
|
const setActiveTab = (tab) => {
|
|
11604
12439
|
navigation.navigateToTab(tab);
|
|
11605
12440
|
};
|
|
11606
|
-
const [creatingWorkspace, setCreatingWorkspace] =
|
|
11607
|
-
const [updatingWorkspace, setUpdatingWorkspace] =
|
|
11608
|
-
const [teamInviteOpen, setTeamInviteOpen] =
|
|
11609
|
-
const [tokenShowRevoked, setTokenShowRevoked] =
|
|
11610
|
-
const [tokenCreateOpen, setTokenCreateOpen] =
|
|
11611
|
-
const [billingShowPlans, setBillingShowPlans] =
|
|
12441
|
+
const [creatingWorkspace, setCreatingWorkspace] = useState17(false);
|
|
12442
|
+
const [updatingWorkspace, setUpdatingWorkspace] = useState17(false);
|
|
12443
|
+
const [teamInviteOpen, setTeamInviteOpen] = useState17(false);
|
|
12444
|
+
const [tokenShowRevoked, setTokenShowRevoked] = useState17(false);
|
|
12445
|
+
const [tokenCreateOpen, setTokenCreateOpen] = useState17(false);
|
|
12446
|
+
const [billingShowPlans, setBillingShowPlans] = useState17(false);
|
|
11612
12447
|
const isBillingPlans = activeTab === "billing" && isWorkspaceAdmin && billingShowPlans;
|
|
11613
|
-
|
|
11614
|
-
|
|
11615
|
-
|
|
11616
|
-
|
|
12448
|
+
const [billingShowPerUserLimits, setBillingShowPerUserLimits] = useState17(false);
|
|
12449
|
+
const isBillingPerUserLimits = activeTab === "billing" && isWorkspaceAdmin && billingShowPerUserLimits && !billingShowPlans;
|
|
12450
|
+
const isBillingSubView = isBillingPlans || isBillingPerUserLimits;
|
|
12451
|
+
useEffect15(() => {
|
|
12452
|
+
if (activeTab !== "billing" || !isWorkspaceAdmin) {
|
|
12453
|
+
setBillingShowPlans(false);
|
|
12454
|
+
setBillingShowPerUserLimits(false);
|
|
12455
|
+
}
|
|
12456
|
+
}, [activeTab, isWorkspaceAdmin]);
|
|
12457
|
+
useEffect15(() => {
|
|
12458
|
+
setBillingShowPlans(false);
|
|
12459
|
+
setBillingShowPerUserLimits(false);
|
|
12460
|
+
}, [workspaceId]);
|
|
12461
|
+
useEffect15(() => {
|
|
11617
12462
|
if (!onClose) return;
|
|
11618
12463
|
const handleKeyDown = (e) => {
|
|
11619
12464
|
if (e.key !== "Escape" || e.defaultPrevented) return;
|
|
@@ -11622,19 +12467,23 @@ function SettingsContentInner({
|
|
|
11622
12467
|
setBillingShowPlans(false);
|
|
11623
12468
|
return;
|
|
11624
12469
|
}
|
|
12470
|
+
if (billingShowPerUserLimits) {
|
|
12471
|
+
setBillingShowPerUserLimits(false);
|
|
12472
|
+
return;
|
|
12473
|
+
}
|
|
11625
12474
|
onClose();
|
|
11626
12475
|
};
|
|
11627
12476
|
document.addEventListener("keydown", handleKeyDown);
|
|
11628
12477
|
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] =
|
|
12478
|
+
}, [onClose, billingShowPlans, billingShowPerUserLimits]);
|
|
12479
|
+
const [localWorkspaces, setLocalWorkspaces] = useState17(null);
|
|
12480
|
+
const [wsModalOpen, setWsModalOpen] = useState17(false);
|
|
12481
|
+
const [wsModalMode, setWsModalMode] = useState17("create");
|
|
12482
|
+
const [editingWorkspace, setEditingWorkspace] = useState17(null);
|
|
12483
|
+
const [confirmLeaveOpen, setConfirmLeaveOpen] = useState17(false);
|
|
12484
|
+
const [leavingWorkspace, setLeavingWorkspace] = useState17(null);
|
|
12485
|
+
const [confirmDeleteOpen, setConfirmDeleteOpen] = useState17(false);
|
|
12486
|
+
const [deletingWorkspace, setDeletingWorkspace] = useState17(null);
|
|
11638
12487
|
const toWorkspaceData = (ws) => ({
|
|
11639
12488
|
id: ws._id,
|
|
11640
12489
|
name: ws.name ?? "",
|
|
@@ -11724,7 +12573,7 @@ function SettingsContentInner({
|
|
|
11724
12573
|
}
|
|
11725
12574
|
return true;
|
|
11726
12575
|
};
|
|
11727
|
-
|
|
12576
|
+
useEffect15(() => {
|
|
11728
12577
|
if (workspaceList.length > 0 && localWorkspaces === null) {
|
|
11729
12578
|
setLocalWorkspaces(workspaceList.map(toWorkspaceData));
|
|
11730
12579
|
}
|
|
@@ -11898,7 +12747,7 @@ function SettingsContentInner({
|
|
|
11898
12747
|
setConfirmLeaveOpen(true);
|
|
11899
12748
|
return false;
|
|
11900
12749
|
}
|
|
11901
|
-
return /* @__PURE__ */
|
|
12750
|
+
return /* @__PURE__ */ jsxs21(
|
|
11902
12751
|
"div",
|
|
11903
12752
|
{
|
|
11904
12753
|
"data-streamoid-settings": "",
|
|
@@ -11908,8 +12757,8 @@ function SettingsContentInner({
|
|
|
11908
12757
|
backgroundSize: "24px 24px"
|
|
11909
12758
|
},
|
|
11910
12759
|
children: [
|
|
11911
|
-
/* @__PURE__ */
|
|
11912
|
-
/* @__PURE__ */
|
|
12760
|
+
/* @__PURE__ */ jsx24(SettingsAppearance, {}),
|
|
12761
|
+
/* @__PURE__ */ jsx24(
|
|
11913
12762
|
"div",
|
|
11914
12763
|
{
|
|
11915
12764
|
className: "flex flex-col items-start relative h-full overflow-hidden",
|
|
@@ -11919,8 +12768,8 @@ function SettingsContentInner({
|
|
|
11919
12768
|
maxWidth: 1200,
|
|
11920
12769
|
width: "100%"
|
|
11921
12770
|
},
|
|
11922
|
-
children: /* @__PURE__ */
|
|
11923
|
-
onBack !== null && /* @__PURE__ */
|
|
12771
|
+
children: /* @__PURE__ */ jsxs21("div", { className: "flex flex-col w-full flex-1 min-h-0", style: { gap: 20, paddingTop: 16 }, children: [
|
|
12772
|
+
onBack !== null && /* @__PURE__ */ jsx24("div", { className: "flex items-center shrink-0", style: { paddingLeft: 20 }, children: /* @__PURE__ */ jsxs21(
|
|
11924
12773
|
"button",
|
|
11925
12774
|
{
|
|
11926
12775
|
type: "button",
|
|
@@ -11942,12 +12791,12 @@ function SettingsContentInner({
|
|
|
11942
12791
|
},
|
|
11943
12792
|
onClick: () => onBack ? onBack() : window.history.back(),
|
|
11944
12793
|
children: [
|
|
11945
|
-
/* @__PURE__ */
|
|
12794
|
+
/* @__PURE__ */ jsx24(SiconLeft3, { className: "w-4 h-4 shrink-0", color: "var(--alias-text---icons-muted)" }),
|
|
11946
12795
|
"Back"
|
|
11947
12796
|
]
|
|
11948
12797
|
}
|
|
11949
12798
|
) }),
|
|
11950
|
-
/* @__PURE__ */
|
|
12799
|
+
/* @__PURE__ */ jsxs21(
|
|
11951
12800
|
"div",
|
|
11952
12801
|
{
|
|
11953
12802
|
className: "flex items-center shrink-0 w-full",
|
|
@@ -11957,9 +12806,9 @@ function SettingsContentInner({
|
|
|
11957
12806
|
gap: 16
|
|
11958
12807
|
},
|
|
11959
12808
|
children: [
|
|
11960
|
-
/* @__PURE__ */
|
|
11961
|
-
/* @__PURE__ */
|
|
11962
|
-
/* @__PURE__ */
|
|
12809
|
+
/* @__PURE__ */ jsxs21("div", { className: "flex items-center flex-1 min-w-0", style: { gap: 8, paddingLeft: 20 }, children: [
|
|
12810
|
+
/* @__PURE__ */ jsx24(SiconSettings2, { className: "w-6 h-6 shrink-0", color: "var(--alias-text---icons-primary)" }),
|
|
12811
|
+
/* @__PURE__ */ jsx24(
|
|
11963
12812
|
"span",
|
|
11964
12813
|
{
|
|
11965
12814
|
style: {
|
|
@@ -11972,9 +12821,9 @@ function SettingsContentInner({
|
|
|
11972
12821
|
children: "Settings"
|
|
11973
12822
|
}
|
|
11974
12823
|
),
|
|
11975
|
-
scopeCrumb && /* @__PURE__ */
|
|
11976
|
-
/* @__PURE__ */
|
|
11977
|
-
/* @__PURE__ */
|
|
12824
|
+
scopeCrumb && /* @__PURE__ */ jsxs21(Fragment12, { children: [
|
|
12825
|
+
/* @__PURE__ */ jsx24(SiconRight2, { className: "w-6 h-6 shrink-0", color: "var(--alias-text---icons-primary)" }),
|
|
12826
|
+
/* @__PURE__ */ jsx24(
|
|
11978
12827
|
"span",
|
|
11979
12828
|
{
|
|
11980
12829
|
className: "truncate",
|
|
@@ -11991,8 +12840,8 @@ function SettingsContentInner({
|
|
|
11991
12840
|
}
|
|
11992
12841
|
)
|
|
11993
12842
|
] }),
|
|
11994
|
-
/* @__PURE__ */
|
|
11995
|
-
/* @__PURE__ */
|
|
12843
|
+
/* @__PURE__ */ jsx24(SiconRight2, { className: "w-6 h-6 shrink-0", color: "var(--alias-text---icons-primary)" }),
|
|
12844
|
+
/* @__PURE__ */ jsx24(
|
|
11996
12845
|
"span",
|
|
11997
12846
|
{
|
|
11998
12847
|
style: {
|
|
@@ -12005,9 +12854,9 @@ function SettingsContentInner({
|
|
|
12005
12854
|
children: leafLabel
|
|
12006
12855
|
}
|
|
12007
12856
|
),
|
|
12008
|
-
isBillingPlans && /* @__PURE__ */
|
|
12009
|
-
/* @__PURE__ */
|
|
12010
|
-
/* @__PURE__ */
|
|
12857
|
+
isBillingPlans && /* @__PURE__ */ jsxs21(Fragment12, { children: [
|
|
12858
|
+
/* @__PURE__ */ jsx24(SiconRight2, { className: "w-6 h-6 shrink-0", color: "var(--alias-text---icons-primary)" }),
|
|
12859
|
+
/* @__PURE__ */ jsx24(
|
|
12011
12860
|
"span",
|
|
12012
12861
|
{
|
|
12013
12862
|
style: {
|
|
@@ -12020,9 +12869,25 @@ function SettingsContentInner({
|
|
|
12020
12869
|
children: "Plans"
|
|
12021
12870
|
}
|
|
12022
12871
|
)
|
|
12872
|
+
] }),
|
|
12873
|
+
isBillingPerUserLimits && /* @__PURE__ */ jsxs21(Fragment12, { children: [
|
|
12874
|
+
/* @__PURE__ */ jsx24(SiconRight2, { className: "w-6 h-6 shrink-0", color: "var(--alias-text---icons-primary)" }),
|
|
12875
|
+
/* @__PURE__ */ jsx24(
|
|
12876
|
+
"span",
|
|
12877
|
+
{
|
|
12878
|
+
style: {
|
|
12879
|
+
fontFamily: "var(--font-family-font-family-body)",
|
|
12880
|
+
fontSize: "var(--font-size-font-size-xl)",
|
|
12881
|
+
fontWeight: 500,
|
|
12882
|
+
lineHeight: "var(--line-height-line-height-xl)",
|
|
12883
|
+
color: "var(--alias-text---icons-primary)"
|
|
12884
|
+
},
|
|
12885
|
+
children: "Per-user limits"
|
|
12886
|
+
}
|
|
12887
|
+
)
|
|
12023
12888
|
] })
|
|
12024
12889
|
] }),
|
|
12025
|
-
|
|
12890
|
+
isBillingSubView && /* @__PURE__ */ jsxs21(
|
|
12026
12891
|
"div",
|
|
12027
12892
|
{
|
|
12028
12893
|
className: "flex items-center shrink-0 cursor-pointer",
|
|
@@ -12034,10 +12899,13 @@ function SettingsContentInner({
|
|
|
12034
12899
|
border: "1px solid var(--alias-border-subtle)",
|
|
12035
12900
|
backgroundColor: "var(--alias-surface-base)"
|
|
12036
12901
|
},
|
|
12037
|
-
onClick: () =>
|
|
12902
|
+
onClick: () => {
|
|
12903
|
+
setBillingShowPlans(false);
|
|
12904
|
+
setBillingShowPerUserLimits(false);
|
|
12905
|
+
},
|
|
12038
12906
|
children: [
|
|
12039
|
-
/* @__PURE__ */
|
|
12040
|
-
/* @__PURE__ */
|
|
12907
|
+
/* @__PURE__ */ jsx24(SiconLeft3, { className: "w-4 h-4", color: "var(--alias-text---icons-muted)" }),
|
|
12908
|
+
/* @__PURE__ */ jsx24(
|
|
12041
12909
|
"span",
|
|
12042
12910
|
{
|
|
12043
12911
|
style: {
|
|
@@ -12053,20 +12921,20 @@ function SettingsContentInner({
|
|
|
12053
12921
|
]
|
|
12054
12922
|
}
|
|
12055
12923
|
),
|
|
12056
|
-
activeTab === "workspaceList" && /* @__PURE__ */
|
|
12924
|
+
activeTab === "workspaceList" && /* @__PURE__ */ jsx24(
|
|
12057
12925
|
SettingsTooltip,
|
|
12058
12926
|
{
|
|
12059
12927
|
content: "Start a new workspace with its own team, members and billing",
|
|
12060
12928
|
placement: "bottom",
|
|
12061
12929
|
inline: true,
|
|
12062
|
-
children: /* @__PURE__ */
|
|
12063
|
-
|
|
12930
|
+
children: /* @__PURE__ */ jsx24(
|
|
12931
|
+
ScButton10,
|
|
12064
12932
|
{
|
|
12065
12933
|
text: "Create Workspace",
|
|
12066
12934
|
variant: "secondary",
|
|
12067
12935
|
size: "md",
|
|
12068
12936
|
styleVariant: "icon-left",
|
|
12069
|
-
icon: /* @__PURE__ */
|
|
12937
|
+
icon: /* @__PURE__ */ jsx24(
|
|
12070
12938
|
SiconWorkspace2,
|
|
12071
12939
|
{
|
|
12072
12940
|
className: "w-5 h-5",
|
|
@@ -12078,20 +12946,20 @@ function SettingsContentInner({
|
|
|
12078
12946
|
)
|
|
12079
12947
|
}
|
|
12080
12948
|
),
|
|
12081
|
-
activeTab === "workspaceMembers" && /* @__PURE__ */
|
|
12949
|
+
activeTab === "workspaceMembers" && /* @__PURE__ */ jsx24(
|
|
12082
12950
|
SettingsTooltip,
|
|
12083
12951
|
{
|
|
12084
12952
|
content: "Send someone an invite to join this workspace",
|
|
12085
12953
|
placement: "bottom",
|
|
12086
12954
|
inline: true,
|
|
12087
|
-
children: /* @__PURE__ */
|
|
12088
|
-
|
|
12955
|
+
children: /* @__PURE__ */ jsx24(
|
|
12956
|
+
ScButton10,
|
|
12089
12957
|
{
|
|
12090
12958
|
text: "Invite user",
|
|
12091
12959
|
variant: "secondary",
|
|
12092
12960
|
size: "md",
|
|
12093
12961
|
styleVariant: "icon-left",
|
|
12094
|
-
icon: /* @__PURE__ */
|
|
12962
|
+
icon: /* @__PURE__ */ jsx24(
|
|
12095
12963
|
SiconUserAdd2,
|
|
12096
12964
|
{
|
|
12097
12965
|
className: "w-5 h-5",
|
|
@@ -12103,15 +12971,15 @@ function SettingsContentInner({
|
|
|
12103
12971
|
)
|
|
12104
12972
|
}
|
|
12105
12973
|
),
|
|
12106
|
-
activeTab === "apikey" && isWorkspaceAdmin && /* @__PURE__ */
|
|
12107
|
-
/* @__PURE__ */
|
|
12974
|
+
activeTab === "apikey" && isWorkspaceAdmin && /* @__PURE__ */ jsxs21("div", { className: "flex items-center shrink-0", style: { gap: "var(--spacing-md)" }, children: [
|
|
12975
|
+
/* @__PURE__ */ jsx24(
|
|
12108
12976
|
SettingsTooltip,
|
|
12109
12977
|
{
|
|
12110
12978
|
content: "Include keys you have already revoked in the list below",
|
|
12111
12979
|
placement: "bottom",
|
|
12112
12980
|
inline: true,
|
|
12113
|
-
children: /* @__PURE__ */
|
|
12114
|
-
|
|
12981
|
+
children: /* @__PURE__ */ jsx24(
|
|
12982
|
+
ScButton10,
|
|
12115
12983
|
{
|
|
12116
12984
|
text: tokenShowRevoked ? "Hide Revoked" : "Show Revoked",
|
|
12117
12985
|
variant: "outline",
|
|
@@ -12121,20 +12989,20 @@ function SettingsContentInner({
|
|
|
12121
12989
|
)
|
|
12122
12990
|
}
|
|
12123
12991
|
),
|
|
12124
|
-
/* @__PURE__ */
|
|
12992
|
+
/* @__PURE__ */ jsx24(
|
|
12125
12993
|
SettingsTooltip,
|
|
12126
12994
|
{
|
|
12127
12995
|
content: "Generate a key for calling the Streamoid APIs from your own code",
|
|
12128
12996
|
placement: "bottom",
|
|
12129
12997
|
inline: true,
|
|
12130
|
-
children: /* @__PURE__ */
|
|
12131
|
-
|
|
12998
|
+
children: /* @__PURE__ */ jsx24(
|
|
12999
|
+
ScButton10,
|
|
12132
13000
|
{
|
|
12133
13001
|
text: "New API Key",
|
|
12134
13002
|
variant: "secondary",
|
|
12135
13003
|
size: "md",
|
|
12136
13004
|
styleVariant: "icon-left",
|
|
12137
|
-
icon: /* @__PURE__ */
|
|
13005
|
+
icon: /* @__PURE__ */ jsx24(
|
|
12138
13006
|
SiconPlus3,
|
|
12139
13007
|
{
|
|
12140
13008
|
className: "w-5 h-5",
|
|
@@ -12147,7 +13015,7 @@ function SettingsContentInner({
|
|
|
12147
13015
|
}
|
|
12148
13016
|
)
|
|
12149
13017
|
] }),
|
|
12150
|
-
onClose && /* @__PURE__ */
|
|
13018
|
+
onClose && /* @__PURE__ */ jsx24(SettingsTooltip, { content: "Close settings (Esc)", placement: "bottom", inline: true, children: /* @__PURE__ */ jsx24(
|
|
12151
13019
|
"button",
|
|
12152
13020
|
{
|
|
12153
13021
|
type: "button",
|
|
@@ -12163,8 +13031,8 @@ function SettingsContentInner({
|
|
|
12163
13031
|
border: "1px solid var(--alias-border-subtle)",
|
|
12164
13032
|
backgroundColor: "var(--alias-surface-base)"
|
|
12165
13033
|
},
|
|
12166
|
-
children: /* @__PURE__ */
|
|
12167
|
-
|
|
13034
|
+
children: /* @__PURE__ */ jsx24(
|
|
13035
|
+
SiconClose9,
|
|
12168
13036
|
{
|
|
12169
13037
|
className: "w-5 h-5",
|
|
12170
13038
|
color: "var(--alias-text---icons-muted)"
|
|
@@ -12175,13 +13043,13 @@ function SettingsContentInner({
|
|
|
12175
13043
|
]
|
|
12176
13044
|
}
|
|
12177
13045
|
),
|
|
12178
|
-
/* @__PURE__ */
|
|
13046
|
+
/* @__PURE__ */ jsxs21(
|
|
12179
13047
|
"div",
|
|
12180
13048
|
{
|
|
12181
13049
|
className: "flex items-start flex-1 min-h-0 w-full overflow-hidden",
|
|
12182
13050
|
style: { gap: 20 },
|
|
12183
13051
|
children: [
|
|
12184
|
-
!
|
|
13052
|
+
!isBillingSubView && /* @__PURE__ */ jsx24(
|
|
12185
13053
|
SettingsNav,
|
|
12186
13054
|
{
|
|
12187
13055
|
isWorkspaceAdmin,
|
|
@@ -12192,8 +13060,8 @@ function SettingsContentInner({
|
|
|
12192
13060
|
hasOrganization
|
|
12193
13061
|
}
|
|
12194
13062
|
),
|
|
12195
|
-
activeTab === "profile" && /* @__PURE__ */
|
|
12196
|
-
activeTab === "workspace" && /* @__PURE__ */
|
|
13063
|
+
activeTab === "profile" && /* @__PURE__ */ jsx24(ProfileTab, {}),
|
|
13064
|
+
activeTab === "workspace" && /* @__PURE__ */ jsx24("div", { className: "flex flex-col flex-1 min-w-0 min-h-0 h-full", children: /* @__PURE__ */ jsx24(
|
|
12197
13065
|
WorkspaceGeneralTab,
|
|
12198
13066
|
{
|
|
12199
13067
|
workspace: currentWorkspaceData,
|
|
@@ -12215,7 +13083,7 @@ function SettingsContentInner({
|
|
|
12215
13083
|
}
|
|
12216
13084
|
}
|
|
12217
13085
|
) }),
|
|
12218
|
-
activeTab === "workspaceMembers" && /* @__PURE__ */
|
|
13086
|
+
activeTab === "workspaceMembers" && /* @__PURE__ */ jsx24("div", { className: "flex flex-col flex-1 min-w-0 min-h-0 h-full", children: /* @__PURE__ */ jsx24(
|
|
12219
13087
|
TeamsContent,
|
|
12220
13088
|
{
|
|
12221
13089
|
embedded: true,
|
|
@@ -12227,7 +13095,7 @@ function SettingsContentInner({
|
|
|
12227
13095
|
hiddenApps
|
|
12228
13096
|
}
|
|
12229
13097
|
) }),
|
|
12230
|
-
activeTab === "workspaceList" && /* @__PURE__ */
|
|
13098
|
+
activeTab === "workspaceList" && /* @__PURE__ */ jsx24(
|
|
12231
13099
|
WorkspaceListTab,
|
|
12232
13100
|
{
|
|
12233
13101
|
workspaces: displayWorkspaces,
|
|
@@ -12252,8 +13120,8 @@ function SettingsContentInner({
|
|
|
12252
13120
|
}
|
|
12253
13121
|
}
|
|
12254
13122
|
),
|
|
12255
|
-
activeTab === "referral" && /* @__PURE__ */
|
|
12256
|
-
(activeTab === "organization" || activeTab === "organizationWorkspaces" || activeTab === "organizationDomains") && /* @__PURE__ */
|
|
13123
|
+
activeTab === "referral" && /* @__PURE__ */ jsx24(ReferralTab, {}),
|
|
13124
|
+
(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
13125
|
ManagedOrganizationSummary,
|
|
12258
13126
|
{
|
|
12259
13127
|
name: workspaceOwner.organizationName,
|
|
@@ -12261,29 +13129,37 @@ function SettingsContentInner({
|
|
|
12261
13129
|
status: workspaceOwner.organizationStatus,
|
|
12262
13130
|
managementUrl: organization.managementUrl
|
|
12263
13131
|
}
|
|
12264
|
-
) : /* @__PURE__ */
|
|
13132
|
+
) : /* @__PURE__ */ jsx24(
|
|
12265
13133
|
OrganizationContent,
|
|
12266
13134
|
{
|
|
12267
13135
|
embedded: true,
|
|
12268
13136
|
view: activeTab === "organizationWorkspaces" || activeTab === "organizationDomains" ? "workspaces" : "people"
|
|
12269
13137
|
}
|
|
12270
13138
|
) }),
|
|
12271
|
-
activeTab === "billing" && isWorkspaceAdmin && /* @__PURE__ */
|
|
13139
|
+
activeTab === "billing" && isWorkspaceAdmin && /* @__PURE__ */ jsx24("div", { className: "flex flex-col flex-1 min-w-0 min-h-0 h-full", children: /* @__PURE__ */ jsx24(
|
|
12272
13140
|
BillingContent,
|
|
12273
13141
|
{
|
|
12274
13142
|
embedded: true,
|
|
12275
13143
|
showPlans: billingShowPlans,
|
|
12276
|
-
onShowPlansChange:
|
|
13144
|
+
onShowPlansChange: (open) => {
|
|
13145
|
+
setBillingShowPlans(open);
|
|
13146
|
+
if (open) setBillingShowPerUserLimits(false);
|
|
13147
|
+
},
|
|
13148
|
+
showPerUserLimits: billingShowPerUserLimits,
|
|
13149
|
+
onShowPerUserLimitsChange: (open) => {
|
|
13150
|
+
setBillingShowPerUserLimits(open);
|
|
13151
|
+
if (open) setBillingShowPlans(false);
|
|
13152
|
+
}
|
|
12277
13153
|
}
|
|
12278
13154
|
) }),
|
|
12279
|
-
(activeTab === "billing" || activeTab === "apikey") && !isWorkspaceAdmin && /* @__PURE__ */
|
|
12280
|
-
/* @__PURE__ */
|
|
12281
|
-
/* @__PURE__ */
|
|
12282
|
-
/* @__PURE__ */
|
|
12283
|
-
/* @__PURE__ */
|
|
13155
|
+
(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: [
|
|
13156
|
+
/* @__PURE__ */ jsx24(SiconLock, { size: 24, color: MUTED_COLOR2 }),
|
|
13157
|
+
/* @__PURE__ */ jsx24("h2", { style: { margin: 0, fontSize: 18, fontWeight: 600, color: PRIMARY_COLOR3 }, children: "Contact your workspace admin" }),
|
|
13158
|
+
/* @__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." }),
|
|
13159
|
+
/* @__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
13160
|
] }),
|
|
12285
|
-
activeTab === "apikey" && isWorkspaceAdmin && /* @__PURE__ */
|
|
12286
|
-
/* @__PURE__ */
|
|
13161
|
+
activeTab === "apikey" && isWorkspaceAdmin && /* @__PURE__ */ jsxs21("div", { className: "flex flex-col flex-1 min-w-0 min-h-0 h-full", children: [
|
|
13162
|
+
/* @__PURE__ */ jsxs21(
|
|
12287
13163
|
"a",
|
|
12288
13164
|
{
|
|
12289
13165
|
href: "https://docs.streamoid.com",
|
|
@@ -12293,19 +13169,19 @@ function SettingsContentInner({
|
|
|
12293
13169
|
className: "flex items-center shrink-0",
|
|
12294
13170
|
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
13171
|
children: [
|
|
12296
|
-
/* @__PURE__ */
|
|
12297
|
-
/* @__PURE__ */
|
|
12298
|
-
/* @__PURE__ */
|
|
12299
|
-
/* @__PURE__ */
|
|
13172
|
+
/* @__PURE__ */ jsx24(SiconBookOpen, { size: 24 }),
|
|
13173
|
+
/* @__PURE__ */ jsxs21("span", { style: { display: "flex", flexDirection: "column", gap: 4, flex: 1 }, children: [
|
|
13174
|
+
/* @__PURE__ */ jsx24("span", { style: { fontSize: 14, fontWeight: 600 }, children: "Build with the Streamoid API" }),
|
|
13175
|
+
/* @__PURE__ */ jsx24("span", { style: { fontSize: 13, lineHeight: "20px", color: MUTED_COLOR2 }, children: "Explore authentication, API references and integration guides." })
|
|
12300
13176
|
] }),
|
|
12301
|
-
/* @__PURE__ */
|
|
13177
|
+
/* @__PURE__ */ jsxs21("span", { style: { display: "inline-flex", alignItems: "center", gap: 6, fontSize: 13, whiteSpace: "nowrap" }, children: [
|
|
12302
13178
|
"View docs ",
|
|
12303
|
-
/* @__PURE__ */
|
|
13179
|
+
/* @__PURE__ */ jsx24(SiconExternalLink2, { size: 16 })
|
|
12304
13180
|
] })
|
|
12305
13181
|
]
|
|
12306
13182
|
}
|
|
12307
13183
|
),
|
|
12308
|
-
/* @__PURE__ */
|
|
13184
|
+
/* @__PURE__ */ jsx24(
|
|
12309
13185
|
TokensContent,
|
|
12310
13186
|
{
|
|
12311
13187
|
embedded: true,
|
|
@@ -12322,7 +13198,7 @@ function SettingsContentInner({
|
|
|
12322
13198
|
] })
|
|
12323
13199
|
}
|
|
12324
13200
|
),
|
|
12325
|
-
/* @__PURE__ */
|
|
13201
|
+
/* @__PURE__ */ jsx24(
|
|
12326
13202
|
WorkspaceModal,
|
|
12327
13203
|
{
|
|
12328
13204
|
open: wsModalOpen,
|
|
@@ -12341,7 +13217,7 @@ function SettingsContentInner({
|
|
|
12341
13217
|
}
|
|
12342
13218
|
}
|
|
12343
13219
|
),
|
|
12344
|
-
/* @__PURE__ */
|
|
13220
|
+
/* @__PURE__ */ jsx24(
|
|
12345
13221
|
ConfirmLeaveModal,
|
|
12346
13222
|
{
|
|
12347
13223
|
open: confirmLeaveOpen,
|
|
@@ -12374,7 +13250,7 @@ function SettingsContentInner({
|
|
|
12374
13250
|
}
|
|
12375
13251
|
}
|
|
12376
13252
|
),
|
|
12377
|
-
/* @__PURE__ */
|
|
13253
|
+
/* @__PURE__ */ jsx24(
|
|
12378
13254
|
ConfirmDeleteModal,
|
|
12379
13255
|
{
|
|
12380
13256
|
open: confirmDeleteOpen,
|
|
@@ -12404,10 +13280,10 @@ function SettingsContentInner({
|
|
|
12404
13280
|
}
|
|
12405
13281
|
|
|
12406
13282
|
// src/workspace-picker.tsx
|
|
12407
|
-
import { useState as
|
|
12408
|
-
import { ScButton as
|
|
12409
|
-
import { jsx as
|
|
12410
|
-
var
|
|
13283
|
+
import { useState as useState18 } from "react";
|
|
13284
|
+
import { ScButton as ScButton11, ScCheckbox } from "@streamoid/ui";
|
|
13285
|
+
import { jsx as jsx25, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
13286
|
+
var T15 = {
|
|
12411
13287
|
primary: "var(--alias-text---icons-primary)",
|
|
12412
13288
|
muted: "var(--alias-text---icons-muted)",
|
|
12413
13289
|
tertiary: "var(--alias-text---icons-tertiary)",
|
|
@@ -12437,10 +13313,10 @@ function WorkspacePicker({
|
|
|
12437
13313
|
onJoin,
|
|
12438
13314
|
onCreate
|
|
12439
13315
|
}) {
|
|
12440
|
-
const [selected, setSelected] =
|
|
12441
|
-
const [creating, setCreating] =
|
|
12442
|
-
const [name, setName] =
|
|
12443
|
-
const [busy, setBusy] =
|
|
13316
|
+
const [selected, setSelected] = useState18(/* @__PURE__ */ new Set());
|
|
13317
|
+
const [creating, setCreating] = useState18(false);
|
|
13318
|
+
const [name, setName] = useState18("");
|
|
13319
|
+
const [busy, setBusy] = useState18(false);
|
|
12444
13320
|
const hasWorkspaces = workspaces.length > 0;
|
|
12445
13321
|
const showCreate = creating || !loading && !hasWorkspaces;
|
|
12446
13322
|
const orgLabel = organizationName || "your organization";
|
|
@@ -12459,48 +13335,48 @@ function WorkspacePicker({
|
|
|
12459
13335
|
setBusy(false);
|
|
12460
13336
|
}
|
|
12461
13337
|
};
|
|
12462
|
-
return /* @__PURE__ */
|
|
13338
|
+
return /* @__PURE__ */ jsxs22(
|
|
12463
13339
|
"div",
|
|
12464
13340
|
{
|
|
12465
13341
|
className: "flex flex-col w-full",
|
|
12466
|
-
style: { maxWidth: 520, gap:
|
|
13342
|
+
style: { maxWidth: 520, gap: T15.sp5xl, fontFamily: T15.font },
|
|
12467
13343
|
children: [
|
|
12468
|
-
/* @__PURE__ */
|
|
12469
|
-
/* @__PURE__ */
|
|
13344
|
+
/* @__PURE__ */ jsxs22("div", { className: "flex flex-col", style: { gap: T15.spMd }, children: [
|
|
13345
|
+
/* @__PURE__ */ jsx25(
|
|
12470
13346
|
"p",
|
|
12471
13347
|
{
|
|
12472
13348
|
style: {
|
|
12473
|
-
color:
|
|
12474
|
-
fontSize:
|
|
13349
|
+
color: T15.primary,
|
|
13350
|
+
fontSize: T15.fsXl,
|
|
12475
13351
|
fontWeight: 600,
|
|
12476
|
-
lineHeight:
|
|
13352
|
+
lineHeight: T15.lhXl,
|
|
12477
13353
|
margin: 0
|
|
12478
13354
|
},
|
|
12479
13355
|
children: "Choose your workspaces"
|
|
12480
13356
|
}
|
|
12481
13357
|
),
|
|
12482
|
-
/* @__PURE__ */
|
|
13358
|
+
/* @__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
13359
|
] }),
|
|
12484
|
-
(loading || hasWorkspaces) && /* @__PURE__ */
|
|
13360
|
+
(loading || hasWorkspaces) && /* @__PURE__ */ jsx25(
|
|
12485
13361
|
"div",
|
|
12486
13362
|
{
|
|
12487
13363
|
className: "flex flex-col w-full overflow-y-auto",
|
|
12488
13364
|
style: {
|
|
12489
13365
|
maxHeight: 360,
|
|
12490
|
-
background:
|
|
12491
|
-
border: `1px solid ${
|
|
12492
|
-
borderRadius:
|
|
13366
|
+
background: T15.surface,
|
|
13367
|
+
border: `1px solid ${T15.borderSubtle}`,
|
|
13368
|
+
borderRadius: T15.r3xl
|
|
12493
13369
|
},
|
|
12494
|
-
children: loading ? /* @__PURE__ */
|
|
13370
|
+
children: loading ? /* @__PURE__ */ jsx25(
|
|
12495
13371
|
"div",
|
|
12496
13372
|
{
|
|
12497
13373
|
className: "flex items-center justify-center",
|
|
12498
|
-
style: { padding:
|
|
13374
|
+
style: { padding: T15.sp6xl, color: T15.muted, fontSize: T15.fsSm },
|
|
12499
13375
|
children: "Loading workspaces\u2026"
|
|
12500
13376
|
}
|
|
12501
13377
|
) : workspaces.map((workspace, index) => {
|
|
12502
13378
|
const checked = selected.has(workspace._id);
|
|
12503
|
-
return /* @__PURE__ */
|
|
13379
|
+
return /* @__PURE__ */ jsxs22(
|
|
12504
13380
|
"div",
|
|
12505
13381
|
{
|
|
12506
13382
|
role: "checkbox",
|
|
@@ -12508,9 +13384,9 @@ function WorkspacePicker({
|
|
|
12508
13384
|
tabIndex: 0,
|
|
12509
13385
|
className: "flex items-center cursor-pointer",
|
|
12510
13386
|
style: {
|
|
12511
|
-
gap:
|
|
12512
|
-
padding: `${
|
|
12513
|
-
borderTop: index ? `1px solid ${
|
|
13387
|
+
gap: T15.spXl,
|
|
13388
|
+
padding: `${T15.spXl} ${T15.sp3xl}`,
|
|
13389
|
+
borderTop: index ? `1px solid ${T15.borderSubtle}` : "none"
|
|
12514
13390
|
},
|
|
12515
13391
|
onClick: () => toggle(workspace._id),
|
|
12516
13392
|
onKeyDown: (e) => {
|
|
@@ -12520,35 +13396,35 @@ function WorkspacePicker({
|
|
|
12520
13396
|
}
|
|
12521
13397
|
},
|
|
12522
13398
|
children: [
|
|
12523
|
-
/* @__PURE__ */
|
|
12524
|
-
/* @__PURE__ */
|
|
13399
|
+
/* @__PURE__ */ jsx25(ScCheckbox, { checked }),
|
|
13400
|
+
/* @__PURE__ */ jsx25(
|
|
12525
13401
|
ProfileAvatar,
|
|
12526
13402
|
{
|
|
12527
13403
|
name: workspace.name,
|
|
12528
13404
|
profileImage: workspace.imageUrl,
|
|
12529
13405
|
size: 32,
|
|
12530
|
-
borderRadius:
|
|
13406
|
+
borderRadius: T15.rLg
|
|
12531
13407
|
}
|
|
12532
13408
|
),
|
|
12533
|
-
/* @__PURE__ */
|
|
12534
|
-
/* @__PURE__ */
|
|
13409
|
+
/* @__PURE__ */ jsxs22("div", { className: "flex flex-col min-w-0", children: [
|
|
13410
|
+
/* @__PURE__ */ jsx25(
|
|
12535
13411
|
"span",
|
|
12536
13412
|
{
|
|
12537
13413
|
className: "truncate",
|
|
12538
13414
|
style: {
|
|
12539
|
-
color:
|
|
12540
|
-
fontSize:
|
|
13415
|
+
color: T15.primary,
|
|
13416
|
+
fontSize: T15.fsSm,
|
|
12541
13417
|
fontWeight: 500,
|
|
12542
|
-
lineHeight:
|
|
13418
|
+
lineHeight: T15.lhSm
|
|
12543
13419
|
},
|
|
12544
13420
|
children: workspace.name
|
|
12545
13421
|
}
|
|
12546
13422
|
),
|
|
12547
|
-
workspace.ownerName && /* @__PURE__ */
|
|
13423
|
+
workspace.ownerName && /* @__PURE__ */ jsxs22(
|
|
12548
13424
|
"span",
|
|
12549
13425
|
{
|
|
12550
13426
|
className: "truncate",
|
|
12551
|
-
style: { color:
|
|
13427
|
+
style: { color: T15.muted, fontSize: T15.fsXs, lineHeight: T15.lhXs },
|
|
12552
13428
|
children: [
|
|
12553
13429
|
"Created by ",
|
|
12554
13430
|
workspace.ownerName
|
|
@@ -12563,16 +13439,16 @@ function WorkspacePicker({
|
|
|
12563
13439
|
})
|
|
12564
13440
|
}
|
|
12565
13441
|
),
|
|
12566
|
-
showCreate ? /* @__PURE__ */
|
|
12567
|
-
/* @__PURE__ */
|
|
13442
|
+
showCreate ? /* @__PURE__ */ jsxs22("div", { className: "flex flex-col w-full", style: { gap: T15.spMd }, children: [
|
|
13443
|
+
/* @__PURE__ */ jsx25(
|
|
12568
13444
|
"label",
|
|
12569
13445
|
{
|
|
12570
13446
|
htmlFor: "workspace-picker-name",
|
|
12571
|
-
style: { color:
|
|
13447
|
+
style: { color: T15.tertiary, fontSize: T15.fsSm, lineHeight: T15.lhSm },
|
|
12572
13448
|
children: "New workspace name"
|
|
12573
13449
|
}
|
|
12574
13450
|
),
|
|
12575
|
-
/* @__PURE__ */
|
|
13451
|
+
/* @__PURE__ */ jsx25(
|
|
12576
13452
|
"input",
|
|
12577
13453
|
{
|
|
12578
13454
|
id: "workspace-picker-name",
|
|
@@ -12587,20 +13463,20 @@ function WorkspacePicker({
|
|
|
12587
13463
|
placeholder: "e.g. Marketing",
|
|
12588
13464
|
style: {
|
|
12589
13465
|
height: 48,
|
|
12590
|
-
padding: `0 ${
|
|
12591
|
-
background:
|
|
13466
|
+
padding: `0 ${T15.sp3xl}`,
|
|
13467
|
+
background: T15.fillPlus,
|
|
12592
13468
|
border: "none",
|
|
12593
13469
|
outline: "none",
|
|
12594
|
-
borderRadius:
|
|
12595
|
-
color:
|
|
12596
|
-
fontFamily:
|
|
12597
|
-
fontSize:
|
|
13470
|
+
borderRadius: T15.r3xl,
|
|
13471
|
+
color: T15.primary,
|
|
13472
|
+
fontFamily: T15.font,
|
|
13473
|
+
fontSize: T15.fsSm
|
|
12598
13474
|
}
|
|
12599
13475
|
}
|
|
12600
13476
|
),
|
|
12601
|
-
/* @__PURE__ */
|
|
12602
|
-
hasWorkspaces && /* @__PURE__ */
|
|
12603
|
-
|
|
13477
|
+
/* @__PURE__ */ jsxs22("div", { className: "flex items-center justify-end w-full", style: { gap: T15.spMd }, children: [
|
|
13478
|
+
hasWorkspaces && /* @__PURE__ */ jsx25(
|
|
13479
|
+
ScButton11,
|
|
12604
13480
|
{
|
|
12605
13481
|
text: "Back",
|
|
12606
13482
|
variant: "tertiary",
|
|
@@ -12608,8 +13484,8 @@ function WorkspacePicker({
|
|
|
12608
13484
|
onClick: () => setCreating(false)
|
|
12609
13485
|
}
|
|
12610
13486
|
),
|
|
12611
|
-
/* @__PURE__ */
|
|
12612
|
-
|
|
13487
|
+
/* @__PURE__ */ jsx25(
|
|
13488
|
+
ScButton11,
|
|
12613
13489
|
{
|
|
12614
13490
|
text: busy ? "Creating\u2026" : "Create workspace",
|
|
12615
13491
|
variant: "primary",
|
|
@@ -12619,9 +13495,9 @@ function WorkspacePicker({
|
|
|
12619
13495
|
}
|
|
12620
13496
|
)
|
|
12621
13497
|
] })
|
|
12622
|
-
] }) : /* @__PURE__ */
|
|
12623
|
-
/* @__PURE__ */
|
|
12624
|
-
|
|
13498
|
+
] }) : /* @__PURE__ */ jsxs22("div", { className: "flex flex-wrap items-center justify-between w-full", style: { gap: T15.spMd }, children: [
|
|
13499
|
+
/* @__PURE__ */ jsx25(
|
|
13500
|
+
ScButton11,
|
|
12625
13501
|
{
|
|
12626
13502
|
text: "Create a workspace",
|
|
12627
13503
|
variant: "tertiary",
|
|
@@ -12630,8 +13506,8 @@ function WorkspacePicker({
|
|
|
12630
13506
|
onClick: loading || busy ? void 0 : () => setCreating(true)
|
|
12631
13507
|
}
|
|
12632
13508
|
),
|
|
12633
|
-
/* @__PURE__ */
|
|
12634
|
-
|
|
13509
|
+
/* @__PURE__ */ jsx25(
|
|
13510
|
+
ScButton11,
|
|
12635
13511
|
{
|
|
12636
13512
|
text: busy ? "Joining\u2026" : selected.size > 1 ? `Join ${selected.size} workspaces` : "Join workspace",
|
|
12637
13513
|
variant: "primary",
|
|
@@ -12655,11 +13531,13 @@ export {
|
|
|
12655
13531
|
DEFAULT_USER_LANGUAGE,
|
|
12656
13532
|
ExportDateModal,
|
|
12657
13533
|
InviteUpdateModal,
|
|
13534
|
+
MemberCreditLimitModal,
|
|
12658
13535
|
MemberListFrame,
|
|
12659
13536
|
MemberListToolbar,
|
|
12660
13537
|
OrganizationContent,
|
|
12661
13538
|
OrganizationMemberModal,
|
|
12662
13539
|
OrganizationModal,
|
|
13540
|
+
PerUserLimitsView,
|
|
12663
13541
|
ProfileAvatar,
|
|
12664
13542
|
ProfileTab,
|
|
12665
13543
|
ReferralTab,
|
|
@@ -12683,11 +13561,26 @@ export {
|
|
|
12683
13561
|
WorkspaceModal,
|
|
12684
13562
|
WorkspacePicker,
|
|
12685
13563
|
WorkspaceTab,
|
|
13564
|
+
belowUsageReason,
|
|
13565
|
+
cleanCreditLimitInput,
|
|
12686
13566
|
countLabel,
|
|
13567
|
+
creditCycleUnit,
|
|
13568
|
+
describeDefaultLimit,
|
|
13569
|
+
describeMemberLimit,
|
|
13570
|
+
formatCreditLimit,
|
|
13571
|
+
formatCredits,
|
|
12687
13572
|
groupWorkspaceList,
|
|
13573
|
+
isLimitBelowUsage,
|
|
13574
|
+
joinMembersWithLimits,
|
|
13575
|
+
limitBelowUsageUsed,
|
|
13576
|
+
limitSourceLabel,
|
|
12688
13577
|
loadWorkspaceOrganization,
|
|
13578
|
+
minimumCreditLimit,
|
|
12689
13579
|
resolveSettingsTabFromPath,
|
|
13580
|
+
roundCredits,
|
|
12690
13581
|
useSettingsAdapters,
|
|
12691
13582
|
useWorkspaceOrganization,
|
|
12692
|
-
userLanguageLabel
|
|
13583
|
+
userLanguageLabel,
|
|
13584
|
+
validateCreditLimitInput,
|
|
13585
|
+
validateDefaultCreditLimitInput
|
|
12693
13586
|
};
|