@streamoid/settings 0.7.9 → 0.7.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +176 -2
- package/dist/index.d.ts +176 -2
- package/dist/index.js +1598 -713
- package/dist/index.mjs +1582 -696
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -29,11 +29,13 @@ __export(index_exports, {
|
|
|
29
29
|
DEFAULT_USER_LANGUAGE: () => DEFAULT_USER_LANGUAGE,
|
|
30
30
|
ExportDateModal: () => ExportDateModal,
|
|
31
31
|
InviteUpdateModal: () => InviteUpdateModal,
|
|
32
|
+
MemberCreditLimitModal: () => MemberCreditLimitModal,
|
|
32
33
|
MemberListFrame: () => MemberListFrame,
|
|
33
34
|
MemberListToolbar: () => MemberListToolbar,
|
|
34
35
|
OrganizationContent: () => OrganizationContent,
|
|
35
36
|
OrganizationMemberModal: () => OrganizationMemberModal,
|
|
36
37
|
OrganizationModal: () => OrganizationModal,
|
|
38
|
+
PerUserLimitsView: () => PerUserLimitsView,
|
|
37
39
|
ProfileAvatar: () => ProfileAvatar,
|
|
38
40
|
ProfileTab: () => ProfileTab,
|
|
39
41
|
ReferralTab: () => ReferralTab,
|
|
@@ -57,13 +59,27 @@ __export(index_exports, {
|
|
|
57
59
|
WorkspaceModal: () => WorkspaceModal,
|
|
58
60
|
WorkspacePicker: () => WorkspacePicker,
|
|
59
61
|
WorkspaceTab: () => WorkspaceTab,
|
|
62
|
+
belowUsageReason: () => belowUsageReason,
|
|
60
63
|
countLabel: () => countLabel,
|
|
64
|
+
creditCycleUnit: () => creditCycleUnit,
|
|
65
|
+
describeDefaultLimit: () => describeDefaultLimit,
|
|
66
|
+
describeMemberLimit: () => describeMemberLimit,
|
|
67
|
+
formatCreditLimit: () => formatCreditLimit,
|
|
68
|
+
formatCredits: () => formatCredits,
|
|
61
69
|
groupWorkspaceList: () => groupWorkspaceList,
|
|
70
|
+
isLimitBelowUsage: () => isLimitBelowUsage,
|
|
71
|
+
joinMembersWithLimits: () => joinMembersWithLimits,
|
|
72
|
+
limitBelowUsageUsed: () => limitBelowUsageUsed,
|
|
73
|
+
limitSourceLabel: () => limitSourceLabel,
|
|
62
74
|
loadWorkspaceOrganization: () => loadWorkspaceOrganization,
|
|
75
|
+
minimumCreditLimit: () => minimumCreditLimit,
|
|
63
76
|
resolveSettingsTabFromPath: () => resolveSettingsTabFromPath,
|
|
77
|
+
roundCredits: () => roundCredits,
|
|
64
78
|
useSettingsAdapters: () => useSettingsAdapters,
|
|
65
79
|
useWorkspaceOrganization: () => useWorkspaceOrganization,
|
|
66
|
-
userLanguageLabel: () => userLanguageLabel
|
|
80
|
+
userLanguageLabel: () => userLanguageLabel,
|
|
81
|
+
validateCreditLimitInput: () => validateCreditLimitInput,
|
|
82
|
+
validateDefaultCreditLimitInput: () => validateDefaultCreditLimitInput
|
|
67
83
|
});
|
|
68
84
|
module.exports = __toCommonJS(index_exports);
|
|
69
85
|
|
|
@@ -386,12 +402,12 @@ function useWorkspaceOrganization({
|
|
|
386
402
|
}
|
|
387
403
|
|
|
388
404
|
// src/settings-content.tsx
|
|
389
|
-
var
|
|
390
|
-
var import_ui11 = require("@streamoid/ui");
|
|
391
|
-
var import_ui12 = require("@streamoid/ui");
|
|
405
|
+
var import_react19 = require("react");
|
|
392
406
|
var import_ui13 = require("@streamoid/ui");
|
|
393
407
|
var import_ui14 = require("@streamoid/ui");
|
|
394
|
-
var
|
|
408
|
+
var import_ui15 = require("@streamoid/ui");
|
|
409
|
+
var import_ui16 = require("@streamoid/ui");
|
|
410
|
+
var import_icons14 = require("@streamoid/icons");
|
|
395
411
|
|
|
396
412
|
// src/icons/SiconKey.tsx
|
|
397
413
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
@@ -6861,11 +6877,34 @@ function isBillingWorkspaceMissing(failure) {
|
|
|
6861
6877
|
};
|
|
6862
6878
|
return visit(failure, 0);
|
|
6863
6879
|
}
|
|
6880
|
+
var LIMIT_BELOW_USAGE = "LIMIT_BELOW_USAGE";
|
|
6881
|
+
function isLimitBelowUsage(failure) {
|
|
6882
|
+
return findLimitBelowUsage(failure) !== null;
|
|
6883
|
+
}
|
|
6884
|
+
function limitBelowUsageUsed(failure) {
|
|
6885
|
+
const used = findLimitBelowUsage(failure)?.used;
|
|
6886
|
+
return typeof used === "number" && Number.isFinite(used) ? used : null;
|
|
6887
|
+
}
|
|
6888
|
+
function findLimitBelowUsage(failure) {
|
|
6889
|
+
const seen = /* @__PURE__ */ new Set();
|
|
6890
|
+
const visit = (value, depth) => {
|
|
6891
|
+
if (depth > 4 || value == null || typeof value !== "object" || seen.has(value)) return null;
|
|
6892
|
+
seen.add(value);
|
|
6893
|
+
const error = value;
|
|
6894
|
+
if (error.code === LIMIT_BELOW_USAGE) return error;
|
|
6895
|
+
for (const child of [error.error, error.data, error.body, error.cause, error.publicError]) {
|
|
6896
|
+
const found = visit(child, depth + 1);
|
|
6897
|
+
if (found) return found;
|
|
6898
|
+
}
|
|
6899
|
+
return null;
|
|
6900
|
+
};
|
|
6901
|
+
return visit(failure, 0);
|
|
6902
|
+
}
|
|
6864
6903
|
|
|
6865
6904
|
// src/billing-content.tsx
|
|
6866
|
-
var
|
|
6867
|
-
var
|
|
6868
|
-
var
|
|
6905
|
+
var import_react17 = require("react");
|
|
6906
|
+
var import_ui11 = require("@streamoid/ui");
|
|
6907
|
+
var import_icons12 = require("@streamoid/icons");
|
|
6869
6908
|
|
|
6870
6909
|
// src/plan-comparison-data.ts
|
|
6871
6910
|
var PLAN_COMPARISON_COLUMNS = ["Free", "Pro", "Enterprise"];
|
|
@@ -7767,161 +7806,868 @@ function BuyCreditsModal({
|
|
|
7767
7806
|
);
|
|
7768
7807
|
}
|
|
7769
7808
|
|
|
7770
|
-
// src/
|
|
7771
|
-
var
|
|
7772
|
-
var
|
|
7773
|
-
|
|
7774
|
-
|
|
7775
|
-
|
|
7776
|
-
|
|
7777
|
-
|
|
7778
|
-
|
|
7779
|
-
|
|
7780
|
-
|
|
7781
|
-
|
|
7782
|
-
|
|
7783
|
-
|
|
7784
|
-
|
|
7809
|
+
// src/per-user-limits-view.tsx
|
|
7810
|
+
var import_react16 = require("react");
|
|
7811
|
+
var import_ui10 = require("@streamoid/ui");
|
|
7812
|
+
|
|
7813
|
+
// src/member-credit-limit-modal.tsx
|
|
7814
|
+
var import_react15 = require("react");
|
|
7815
|
+
var import_ui9 = require("@streamoid/ui");
|
|
7816
|
+
var import_icons11 = require("@streamoid/icons");
|
|
7817
|
+
|
|
7818
|
+
// src/credit-limits.ts
|
|
7819
|
+
var DAY_MS = 24 * 60 * 60 * 1e3;
|
|
7820
|
+
function creditCycleUnit(cycle) {
|
|
7821
|
+
if (!cycle) return "month";
|
|
7822
|
+
const days = (Date.parse(cycle.end) - Date.parse(cycle.start)) / DAY_MS;
|
|
7823
|
+
return Number.isFinite(days) && days > 200 ? "year" : "month";
|
|
7785
7824
|
}
|
|
7786
|
-
function
|
|
7787
|
-
if (
|
|
7788
|
-
|
|
7789
|
-
}
|
|
7790
|
-
return `$${(cents / 100).toFixed(2)}`;
|
|
7825
|
+
function formatCreditLimit(limit, unit) {
|
|
7826
|
+
if (limit === null) return "Unlimited";
|
|
7827
|
+
return `${limit.toLocaleString("en-US")} ${limit === 1 ? "credit" : "credits"} / ${unit}`;
|
|
7791
7828
|
}
|
|
7792
|
-
function
|
|
7793
|
-
return
|
|
7829
|
+
function roundCredits(value) {
|
|
7830
|
+
return Number(value.toFixed(2));
|
|
7794
7831
|
}
|
|
7795
|
-
function
|
|
7796
|
-
return
|
|
7832
|
+
function minimumCreditLimit(used) {
|
|
7833
|
+
return Math.ceil(roundCredits(used));
|
|
7797
7834
|
}
|
|
7798
|
-
function
|
|
7799
|
-
|
|
7800
|
-
|
|
7801
|
-
|
|
7802
|
-
|
|
7803
|
-
|
|
7804
|
-
|
|
7805
|
-
|
|
7806
|
-
|
|
7807
|
-
|
|
7835
|
+
function formatCredits(value) {
|
|
7836
|
+
return roundCredits(value).toLocaleString("en-US", { maximumFractionDigits: 2 });
|
|
7837
|
+
}
|
|
7838
|
+
function validateDefaultCreditLimitInput(raw) {
|
|
7839
|
+
return validateCreditLimitInput(raw, 0);
|
|
7840
|
+
}
|
|
7841
|
+
function validateCreditLimitInput(raw, used) {
|
|
7842
|
+
const trimmed = raw.trim();
|
|
7843
|
+
if (!trimmed) return { ok: false, reason: "Enter a credit limit" };
|
|
7844
|
+
if (!/^\d+$/.test(trimmed)) {
|
|
7845
|
+
return { ok: false, reason: "Enter a whole number of credits" };
|
|
7808
7846
|
}
|
|
7809
|
-
const
|
|
7810
|
-
|
|
7811
|
-
|
|
7812
|
-
|
|
7813
|
-
|
|
7814
|
-
|
|
7815
|
-
}
|
|
7847
|
+
const value = Number(trimmed);
|
|
7848
|
+
if (!Number.isSafeInteger(value)) {
|
|
7849
|
+
return { ok: false, reason: "Enter a smaller number" };
|
|
7850
|
+
}
|
|
7851
|
+
if (value < roundCredits(used)) {
|
|
7852
|
+
return { ok: false, reason: belowUsageReason(used) };
|
|
7853
|
+
}
|
|
7854
|
+
return { ok: true, value };
|
|
7816
7855
|
}
|
|
7817
|
-
function
|
|
7818
|
-
|
|
7819
|
-
const parsed = typeof value === "number" ? new Date(value < 1e10 ? value * 1e3 : value) : new Date(value);
|
|
7820
|
-
if (Number.isNaN(parsed.getTime())) return "";
|
|
7821
|
-
return parsed.toLocaleDateString("en-US", {
|
|
7822
|
-
month: "short",
|
|
7823
|
-
day: "numeric",
|
|
7824
|
-
year: "numeric"
|
|
7825
|
-
});
|
|
7856
|
+
function belowUsageReason(used) {
|
|
7857
|
+
return `Must be at least ${minimumCreditLimit(used).toLocaleString("en-US")} \u2014 ${formatCredits(used)} already used this cycle`;
|
|
7826
7858
|
}
|
|
7827
|
-
function
|
|
7828
|
-
|
|
7829
|
-
const [isLight, setIsLight] = (0, import_react15.useState)(read);
|
|
7830
|
-
(0, import_react15.useEffect)(() => {
|
|
7831
|
-
if (typeof document === "undefined") return;
|
|
7832
|
-
const target = document.documentElement;
|
|
7833
|
-
const observer = new MutationObserver(() => setIsLight(read()));
|
|
7834
|
-
observer.observe(target, {
|
|
7835
|
-
attributes: true,
|
|
7836
|
-
attributeFilter: ["data-theme"]
|
|
7837
|
-
});
|
|
7838
|
-
setIsLight(read());
|
|
7839
|
-
return () => observer.disconnect();
|
|
7840
|
-
}, []);
|
|
7841
|
-
return isLight;
|
|
7859
|
+
function describeDefaultLimit(response, unit) {
|
|
7860
|
+
return formatCreditLimit(response?.default?.limit ?? null, unit);
|
|
7842
7861
|
}
|
|
7843
|
-
function
|
|
7862
|
+
function describeMemberLimit(row, unit) {
|
|
7863
|
+
return formatCreditLimit(row.limit, unit);
|
|
7864
|
+
}
|
|
7865
|
+
function limitSourceLabel(row) {
|
|
7866
|
+
if (row.source === "override") return "Custom";
|
|
7867
|
+
if (row.source === "default") return "Default";
|
|
7868
|
+
return null;
|
|
7869
|
+
}
|
|
7870
|
+
function joinMembersWithLimits(members, response) {
|
|
7871
|
+
const byUser = /* @__PURE__ */ new Map();
|
|
7872
|
+
for (const entry of response?.users ?? []) byUser.set(entry.userId, entry);
|
|
7873
|
+
const def = response?.default ?? null;
|
|
7874
|
+
return members.map((member) => {
|
|
7875
|
+
const userId = member.user._id;
|
|
7876
|
+
const entry = byUser.get(userId);
|
|
7877
|
+
if (!entry) {
|
|
7878
|
+
return {
|
|
7879
|
+
member,
|
|
7880
|
+
userId,
|
|
7881
|
+
limit: def ? def.limit ?? null : null,
|
|
7882
|
+
source: def ? "default" : "none",
|
|
7883
|
+
hasLimit: false,
|
|
7884
|
+
used: 0,
|
|
7885
|
+
lastCycleUsed: 0
|
|
7886
|
+
};
|
|
7887
|
+
}
|
|
7888
|
+
const hasLimit = Boolean(entry.hasLimit);
|
|
7889
|
+
return {
|
|
7890
|
+
member,
|
|
7891
|
+
userId,
|
|
7892
|
+
limit: entry.limit ?? null,
|
|
7893
|
+
source: entry.source ?? (hasLimit ? "override" : def ? "default" : "none"),
|
|
7894
|
+
hasLimit,
|
|
7895
|
+
used: entry.used ?? 0,
|
|
7896
|
+
lastCycleUsed: entry.lastCycleUsed ?? 0
|
|
7897
|
+
};
|
|
7898
|
+
});
|
|
7899
|
+
}
|
|
7900
|
+
|
|
7901
|
+
// src/member-credit-limit-modal.tsx
|
|
7902
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
7903
|
+
var T12 = {
|
|
7904
|
+
primary: "var(--alias-text---icons-primary)",
|
|
7905
|
+
tertiary: "var(--alias-text---icons-tertiary)",
|
|
7906
|
+
muted: "var(--alias-text---icons-muted)",
|
|
7907
|
+
error: "var(--alias-text---icons-error, var(--alias-text-and-icons-error, #ff6b6b))",
|
|
7908
|
+
surface: "var(--primitives-neutral-825)",
|
|
7909
|
+
fillPlus: "var(--alias-fill-neutral-neutralplus)",
|
|
7910
|
+
borderSubtle: "var(--alias-border-subtle)",
|
|
7911
|
+
borderDivider: "var(--alias-border-divider)",
|
|
7912
|
+
font: "var(--font-family-font-family-body)",
|
|
7913
|
+
fsSm: "var(--font-size-font-size-sm)",
|
|
7914
|
+
fsLg: "var(--font-size-font-size-lg)",
|
|
7915
|
+
lhSm: "var(--line-height-line-height-sm)",
|
|
7916
|
+
lhLg: "var(--line-height-line-height-lg)",
|
|
7917
|
+
spXs: "var(--spacing-xs)",
|
|
7918
|
+
spXl: "var(--spacing-xl)",
|
|
7919
|
+
sp3xl: "var(--spacing-3xl)",
|
|
7920
|
+
sp6xl: "var(--spacing-6xl)",
|
|
7921
|
+
r3xl: "var(--radius-3xl)",
|
|
7922
|
+
r4xl: "var(--radius-4xl)"
|
|
7923
|
+
};
|
|
7924
|
+
function MemberCreditLimitModal({
|
|
7844
7925
|
open,
|
|
7845
|
-
|
|
7846
|
-
|
|
7847
|
-
|
|
7848
|
-
|
|
7849
|
-
|
|
7850
|
-
|
|
7926
|
+
title = "Set custom usage limit",
|
|
7927
|
+
description,
|
|
7928
|
+
subject,
|
|
7929
|
+
resetKey,
|
|
7930
|
+
used,
|
|
7931
|
+
initialLimit,
|
|
7932
|
+
isSet,
|
|
7933
|
+
unit,
|
|
7934
|
+
onSave,
|
|
7935
|
+
onRemove,
|
|
7936
|
+
removeLabel = "Remove",
|
|
7937
|
+
removeHint,
|
|
7938
|
+
saveSuccessMessage = "Usage limit updated",
|
|
7939
|
+
removeSuccessMessage = "Usage limit removed",
|
|
7851
7940
|
onClose,
|
|
7852
|
-
|
|
7941
|
+
onSaved,
|
|
7942
|
+
onStale
|
|
7853
7943
|
}) {
|
|
7854
|
-
const
|
|
7855
|
-
const
|
|
7856
|
-
const
|
|
7944
|
+
const { toast } = useSettingsAdapters();
|
|
7945
|
+
const initialUnlimited = initialLimit === null;
|
|
7946
|
+
const [unlimited, setUnlimited] = (0, import_react15.useState)(initialUnlimited);
|
|
7947
|
+
const [raw, setRaw] = (0, import_react15.useState)("");
|
|
7948
|
+
const [touched, setTouched] = (0, import_react15.useState)(false);
|
|
7949
|
+
const [saving, setSaving] = (0, import_react15.useState)(false);
|
|
7950
|
+
const [serverHint, setServerHint] = (0, import_react15.useState)(null);
|
|
7951
|
+
const [serverUsed, setServerUsed] = (0, import_react15.useState)(null);
|
|
7952
|
+
const close = () => {
|
|
7953
|
+
if (!saving) onClose();
|
|
7954
|
+
};
|
|
7955
|
+
useOverlayOpen(open, close);
|
|
7956
|
+
(0, import_react15.useEffect)(() => {
|
|
7957
|
+
if (!open) return;
|
|
7958
|
+
setUnlimited(initialUnlimited);
|
|
7959
|
+
setRaw(initialLimit !== null ? String(initialLimit) : "");
|
|
7960
|
+
setTouched(false);
|
|
7961
|
+
setSaving(false);
|
|
7962
|
+
setServerHint(null);
|
|
7963
|
+
setServerUsed(null);
|
|
7964
|
+
}, [open, resetKey, initialLimit, isSet, initialUnlimited]);
|
|
7857
7965
|
if (!open) return null;
|
|
7966
|
+
const usedNow = Math.max(used, serverUsed ?? 0);
|
|
7967
|
+
const validation = validateCreditLimitInput(raw, usedNow);
|
|
7968
|
+
const changed = !isSet || (unlimited ? !initialUnlimited : initialUnlimited || validation.ok && validation.value !== initialLimit);
|
|
7969
|
+
const canSave = !saving && changed && (unlimited || validation.ok);
|
|
7970
|
+
const hint = serverHint ?? (!unlimited && touched && !validation.ok ? validation.reason : null);
|
|
7971
|
+
const handleSave = async () => {
|
|
7972
|
+
if (!canSave) return;
|
|
7973
|
+
const next = unlimited ? null : validation.ok ? validation.value : null;
|
|
7974
|
+
setSaving(true);
|
|
7975
|
+
try {
|
|
7976
|
+
await onSave(next);
|
|
7977
|
+
toast.success(saveSuccessMessage);
|
|
7978
|
+
onSaved();
|
|
7979
|
+
onClose();
|
|
7980
|
+
} catch (err) {
|
|
7981
|
+
if (isLimitBelowUsage(err)) {
|
|
7982
|
+
const fresh = limitBelowUsageUsed(err) ?? usedNow;
|
|
7983
|
+
setServerUsed(fresh);
|
|
7984
|
+
setUnlimited(false);
|
|
7985
|
+
setServerHint(belowUsageReason(fresh));
|
|
7986
|
+
if (fresh !== used) onStale?.();
|
|
7987
|
+
} else {
|
|
7988
|
+
toast.error(errorMessage(err, { method: "PUT" }));
|
|
7989
|
+
}
|
|
7990
|
+
setSaving(false);
|
|
7991
|
+
}
|
|
7992
|
+
};
|
|
7993
|
+
const handleRemove = async () => {
|
|
7994
|
+
if (saving || !onRemove) return;
|
|
7995
|
+
setSaving(true);
|
|
7996
|
+
try {
|
|
7997
|
+
await onRemove();
|
|
7998
|
+
toast.success(removeSuccessMessage);
|
|
7999
|
+
onSaved();
|
|
8000
|
+
onClose();
|
|
8001
|
+
} catch (err) {
|
|
8002
|
+
toast.error(errorMessage(err, { method: "DELETE" }));
|
|
8003
|
+
setSaving(false);
|
|
8004
|
+
}
|
|
8005
|
+
};
|
|
8006
|
+
const bodyText = {
|
|
8007
|
+
fontFamily: T12.font,
|
|
8008
|
+
fontSize: T12.fsSm,
|
|
8009
|
+
lineHeight: T12.lhSm
|
|
8010
|
+
};
|
|
7858
8011
|
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
7859
8012
|
"div",
|
|
7860
8013
|
{
|
|
7861
8014
|
className: "fixed inset-0 z-50 flex items-center justify-center",
|
|
7862
8015
|
style: { backgroundColor: "rgba(0, 0, 0, 0.6)" },
|
|
7863
|
-
onClick: (
|
|
7864
|
-
if (
|
|
8016
|
+
onClick: (e) => {
|
|
8017
|
+
if (e.target === e.currentTarget) close();
|
|
7865
8018
|
},
|
|
7866
8019
|
children: /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
7867
8020
|
"div",
|
|
7868
8021
|
{
|
|
7869
|
-
className: "flex flex-col
|
|
8022
|
+
className: "flex flex-col items-start",
|
|
7870
8023
|
style: {
|
|
7871
|
-
backgroundColor:
|
|
7872
|
-
borderRadius:
|
|
7873
|
-
border:
|
|
7874
|
-
|
|
7875
|
-
|
|
7876
|
-
maxHeight: "
|
|
7877
|
-
overflowY: "auto"
|
|
8024
|
+
backgroundColor: T12.surface,
|
|
8025
|
+
borderRadius: T12.r4xl,
|
|
8026
|
+
border: `1px solid ${T12.borderSubtle}`,
|
|
8027
|
+
width: 480,
|
|
8028
|
+
maxWidth: "calc(100vw - 32px)",
|
|
8029
|
+
maxHeight: "85vh"
|
|
7878
8030
|
},
|
|
7879
8031
|
children: [
|
|
7880
|
-
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "
|
|
8032
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "shrink-0 w-full relative", children: [
|
|
7881
8033
|
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
7882
|
-
"
|
|
8034
|
+
"div",
|
|
7883
8035
|
{
|
|
7884
|
-
|
|
7885
|
-
|
|
7886
|
-
|
|
7887
|
-
fontSize: "var(--font-size-font-size-xxl)",
|
|
7888
|
-
fontWeight: 600,
|
|
7889
|
-
lineHeight: "var(--line-height-line-height-xxl)",
|
|
7890
|
-
color: "var(--alias-text---icons-primary)"
|
|
7891
|
-
},
|
|
7892
|
-
children: "Update Subscription"
|
|
8036
|
+
"aria-hidden": true,
|
|
8037
|
+
className: "absolute inset-0 pointer-events-none",
|
|
8038
|
+
style: { borderBottom: `1px solid ${T12.borderDivider}` }
|
|
7893
8039
|
}
|
|
7894
8040
|
),
|
|
7895
|
-
/* @__PURE__ */ (0, import_jsx_runtime20.
|
|
7896
|
-
"
|
|
8041
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
8042
|
+
"div",
|
|
7897
8043
|
{
|
|
7898
|
-
|
|
7899
|
-
|
|
7900
|
-
|
|
7901
|
-
|
|
8044
|
+
className: "flex items-center w-full",
|
|
8045
|
+
style: { gap: T12.sp3xl, padding: `${T12.sp3xl} ${T12.sp6xl}` },
|
|
8046
|
+
children: [
|
|
8047
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
8048
|
+
"p",
|
|
8049
|
+
{
|
|
8050
|
+
className: "flex-1 min-w-0 overflow-hidden text-ellipsis whitespace-nowrap",
|
|
8051
|
+
style: {
|
|
8052
|
+
color: T12.primary,
|
|
8053
|
+
fontFamily: T12.font,
|
|
8054
|
+
fontSize: T12.fsLg,
|
|
8055
|
+
fontWeight: 600,
|
|
8056
|
+
lineHeight: T12.lhLg
|
|
8057
|
+
},
|
|
8058
|
+
children: title
|
|
8059
|
+
}
|
|
8060
|
+
),
|
|
8061
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "shrink-0 cursor-pointer", onClick: close, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_icons11.SiconClose, { className: "w-6 h-6", color: T12.primary }) })
|
|
8062
|
+
]
|
|
7902
8063
|
}
|
|
7903
8064
|
)
|
|
7904
8065
|
] }),
|
|
7905
|
-
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
8066
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "flex-1 min-h-0 w-full overflow-y-auto", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
7906
8067
|
"div",
|
|
7907
8068
|
{
|
|
7908
|
-
className: "w-full",
|
|
7909
|
-
style: {
|
|
7910
|
-
height: "1px",
|
|
7911
|
-
backgroundColor: "var(--alias-border-divider)"
|
|
7912
|
-
}
|
|
7913
|
-
}
|
|
7914
|
-
),
|
|
7915
|
-
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
7916
|
-
"div",
|
|
7917
|
-
{
|
|
7918
|
-
className: "flex flex-col w-full",
|
|
7919
|
-
style: { gap: "var(--spacing-3xl)" },
|
|
8069
|
+
className: "flex flex-col items-start w-full",
|
|
8070
|
+
style: { padding: `${T12.sp3xl} ${T12.sp6xl}`, gap: T12.sp3xl },
|
|
7920
8071
|
children: [
|
|
8072
|
+
(subject || description) && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex flex-col w-full min-w-0", children: [
|
|
8073
|
+
subject?.name?.trim() && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
8074
|
+
"span",
|
|
8075
|
+
{
|
|
8076
|
+
className: "truncate",
|
|
8077
|
+
style: { ...bodyText, fontWeight: 500, color: T12.primary },
|
|
8078
|
+
children: subject.name
|
|
8079
|
+
}
|
|
8080
|
+
),
|
|
8081
|
+
subject && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
8082
|
+
"span",
|
|
8083
|
+
{
|
|
8084
|
+
className: "truncate",
|
|
8085
|
+
style: {
|
|
8086
|
+
...bodyText,
|
|
8087
|
+
color: subject.name?.trim() ? T12.muted : T12.primary
|
|
8088
|
+
},
|
|
8089
|
+
children: subject.email
|
|
8090
|
+
}
|
|
8091
|
+
),
|
|
8092
|
+
subject && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("span", { style: { ...bodyText, color: T12.tertiary, marginTop: T12.spXs }, children: [
|
|
8093
|
+
"Used this cycle: ",
|
|
8094
|
+
formatCredits(usedNow),
|
|
8095
|
+
" credits"
|
|
8096
|
+
] }),
|
|
8097
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { style: { ...bodyText, color: T12.tertiary }, children: description })
|
|
8098
|
+
] }),
|
|
8099
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex flex-col w-full", style: { gap: T12.spXs }, children: [
|
|
8100
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex items-center w-full", style: { gap: T12.sp3xl }, children: [
|
|
8101
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
8102
|
+
import_ui9.ScPairtext,
|
|
8103
|
+
{
|
|
8104
|
+
type: "radio",
|
|
8105
|
+
content: "",
|
|
8106
|
+
checked: !unlimited,
|
|
8107
|
+
onChange: () => setUnlimited(false)
|
|
8108
|
+
}
|
|
8109
|
+
),
|
|
8110
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
8111
|
+
"div",
|
|
8112
|
+
{
|
|
8113
|
+
className: "flex-1 min-w-0 flex items-center",
|
|
8114
|
+
style: {
|
|
8115
|
+
background: T12.fillPlus,
|
|
8116
|
+
height: 48,
|
|
8117
|
+
borderRadius: T12.r3xl,
|
|
8118
|
+
padding: `${T12.spXl} ${T12.sp3xl}`,
|
|
8119
|
+
gap: T12.spXl,
|
|
8120
|
+
border: hint ? `1px solid ${T12.error}` : "1px solid transparent",
|
|
8121
|
+
opacity: unlimited ? 0.6 : 1
|
|
8122
|
+
},
|
|
8123
|
+
children: [
|
|
8124
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
8125
|
+
"input",
|
|
8126
|
+
{
|
|
8127
|
+
inputMode: "numeric",
|
|
8128
|
+
"aria-label": "Credit limit",
|
|
8129
|
+
"aria-invalid": hint ? true : void 0,
|
|
8130
|
+
placeholder: "Enter credits",
|
|
8131
|
+
value: raw,
|
|
8132
|
+
disabled: saving,
|
|
8133
|
+
onFocus: () => setUnlimited(false),
|
|
8134
|
+
onChange: (e) => {
|
|
8135
|
+
setRaw(e.target.value.replace(/[^\d]/g, ""));
|
|
8136
|
+
setTouched(true);
|
|
8137
|
+
setServerHint(null);
|
|
8138
|
+
},
|
|
8139
|
+
className: "flex-1 min-w-0",
|
|
8140
|
+
style: {
|
|
8141
|
+
...bodyText,
|
|
8142
|
+
background: "transparent",
|
|
8143
|
+
border: "none",
|
|
8144
|
+
outline: "none",
|
|
8145
|
+
color: T12.primary,
|
|
8146
|
+
padding: 0
|
|
8147
|
+
}
|
|
8148
|
+
}
|
|
8149
|
+
),
|
|
8150
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("span", { className: "shrink-0", style: { ...bodyText, color: T12.muted }, children: [
|
|
8151
|
+
"credits / ",
|
|
8152
|
+
unit
|
|
8153
|
+
] })
|
|
8154
|
+
]
|
|
8155
|
+
}
|
|
8156
|
+
)
|
|
8157
|
+
] }),
|
|
8158
|
+
hint && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { role: "alert", style: { ...bodyText, color: T12.error }, children: hint })
|
|
8159
|
+
] }),
|
|
7921
8160
|
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
7922
|
-
|
|
8161
|
+
import_ui9.ScPairtext,
|
|
7923
8162
|
{
|
|
7924
|
-
|
|
8163
|
+
type: "radio",
|
|
8164
|
+
content: "Unlimited usage",
|
|
8165
|
+
checked: unlimited,
|
|
8166
|
+
onChange: () => {
|
|
8167
|
+
setUnlimited(true);
|
|
8168
|
+
setServerHint(null);
|
|
8169
|
+
}
|
|
8170
|
+
}
|
|
8171
|
+
),
|
|
8172
|
+
onRemove && removeHint && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { style: { ...bodyText, color: T12.muted }, children: removeHint })
|
|
8173
|
+
]
|
|
8174
|
+
}
|
|
8175
|
+
) }),
|
|
8176
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "shrink-0 w-full relative", children: [
|
|
8177
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
8178
|
+
"div",
|
|
8179
|
+
{
|
|
8180
|
+
"aria-hidden": true,
|
|
8181
|
+
className: "absolute inset-0 pointer-events-none",
|
|
8182
|
+
style: { borderTop: `1px solid ${T12.borderDivider}` }
|
|
8183
|
+
}
|
|
8184
|
+
),
|
|
8185
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
8186
|
+
"div",
|
|
8187
|
+
{
|
|
8188
|
+
className: "flex items-center w-full",
|
|
8189
|
+
style: {
|
|
8190
|
+
padding: `${T12.sp3xl} ${T12.sp6xl}`,
|
|
8191
|
+
justifyContent: onRemove ? "space-between" : "flex-end"
|
|
8192
|
+
},
|
|
8193
|
+
children: [
|
|
8194
|
+
onRemove && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
8195
|
+
import_ui9.ScButton,
|
|
8196
|
+
{
|
|
8197
|
+
text: removeLabel,
|
|
8198
|
+
variant: "error",
|
|
8199
|
+
size: "md",
|
|
8200
|
+
state: saving ? "disabled" : "default",
|
|
8201
|
+
onClick: saving ? void 0 : () => void handleRemove()
|
|
8202
|
+
}
|
|
8203
|
+
),
|
|
8204
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
8205
|
+
import_ui9.ScButton,
|
|
8206
|
+
{
|
|
8207
|
+
text: "Save",
|
|
8208
|
+
variant: "primary",
|
|
8209
|
+
size: "md",
|
|
8210
|
+
state: canSave ? "default" : "disabled",
|
|
8211
|
+
onClick: canSave ? () => void handleSave() : void 0
|
|
8212
|
+
}
|
|
8213
|
+
)
|
|
8214
|
+
]
|
|
8215
|
+
}
|
|
8216
|
+
)
|
|
8217
|
+
] })
|
|
8218
|
+
]
|
|
8219
|
+
}
|
|
8220
|
+
)
|
|
8221
|
+
}
|
|
8222
|
+
);
|
|
8223
|
+
}
|
|
8224
|
+
|
|
8225
|
+
// src/per-user-limits-view.tsx
|
|
8226
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
8227
|
+
var T13 = {
|
|
8228
|
+
primary: "var(--alias-text---icons-primary)",
|
|
8229
|
+
muted: "var(--alias-text---icons-muted)",
|
|
8230
|
+
fillPlus: "var(--alias-fill-neutral-neutralplus)",
|
|
8231
|
+
surfaceBase: "var(--alias-surface-base)",
|
|
8232
|
+
borderSubtle: "var(--alias-border-subtle)",
|
|
8233
|
+
font: "var(--font-family-font-family-body)",
|
|
8234
|
+
fsSm: "var(--font-size-font-size-sm)",
|
|
8235
|
+
fsXl: "var(--font-size-font-size-xl)",
|
|
8236
|
+
lhSm: "var(--line-height-line-height-sm)",
|
|
8237
|
+
lhXl: "var(--line-height-line-height-xl)",
|
|
8238
|
+
spMd: "var(--spacing-md)",
|
|
8239
|
+
sp3xl: "var(--spacing-3xl)",
|
|
8240
|
+
sp6xl: "var(--spacing-6xl)",
|
|
8241
|
+
r3xl: "var(--radius-3xl)"
|
|
8242
|
+
};
|
|
8243
|
+
var COLUMNS = "minmax(200px, 1fr) 140px 150px 190px 80px";
|
|
8244
|
+
var cellText = {
|
|
8245
|
+
fontFamily: T13.font,
|
|
8246
|
+
fontSize: T13.fsSm,
|
|
8247
|
+
lineHeight: T13.lhSm,
|
|
8248
|
+
color: T13.primary
|
|
8249
|
+
};
|
|
8250
|
+
function LimitRow({
|
|
8251
|
+
row,
|
|
8252
|
+
unit,
|
|
8253
|
+
onEdit
|
|
8254
|
+
}) {
|
|
8255
|
+
const name = row.member.user.name?.trim() ?? "";
|
|
8256
|
+
const email = row.member.user.email || "";
|
|
8257
|
+
const displayIdent = name || email.split("@")[0] || "user";
|
|
8258
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
8259
|
+
"div",
|
|
8260
|
+
{
|
|
8261
|
+
style: {
|
|
8262
|
+
borderBottom: `1px solid ${T13.borderSubtle}`,
|
|
8263
|
+
display: "grid",
|
|
8264
|
+
gridTemplateColumns: COLUMNS,
|
|
8265
|
+
alignItems: "center",
|
|
8266
|
+
padding: `8px ${T13.sp3xl}`,
|
|
8267
|
+
gap: 24
|
|
8268
|
+
},
|
|
8269
|
+
onMouseEnter: (e) => {
|
|
8270
|
+
e.currentTarget.style.background = T13.fillPlus;
|
|
8271
|
+
},
|
|
8272
|
+
onMouseLeave: (e) => {
|
|
8273
|
+
e.currentTarget.style.background = "transparent";
|
|
8274
|
+
},
|
|
8275
|
+
children: [
|
|
8276
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center min-w-0", style: { gap: T13.spMd }, children: [
|
|
8277
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ProfileAvatar, { name: displayIdent, size: 32 }),
|
|
8278
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex flex-col min-w-0", children: [
|
|
8279
|
+
name && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "truncate", style: { ...cellText, fontWeight: 500 }, children: name }),
|
|
8280
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
8281
|
+
"span",
|
|
8282
|
+
{
|
|
8283
|
+
className: "truncate",
|
|
8284
|
+
style: { ...cellText, color: name ? T13.muted : T13.primary },
|
|
8285
|
+
children: email || "\u2014"
|
|
8286
|
+
}
|
|
8287
|
+
)
|
|
8288
|
+
] })
|
|
8289
|
+
] }),
|
|
8290
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { style: cellText, children: formatCredits(row.used) }),
|
|
8291
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { style: cellText, children: formatCredits(row.lastCycleUsed) }),
|
|
8292
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex flex-col min-w-0", children: [
|
|
8293
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { style: cellText, children: describeMemberLimit(row, unit) }),
|
|
8294
|
+
limitSourceLabel(row) && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { style: { ...cellText, color: T13.muted }, children: limitSourceLabel(row) })
|
|
8295
|
+
] }),
|
|
8296
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "flex items-center", children: onEdit && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_ui10.ScButton, { text: "Edit", variant: "secondary", size: "sm", onClick: onEdit }) })
|
|
8297
|
+
]
|
|
8298
|
+
}
|
|
8299
|
+
);
|
|
8300
|
+
}
|
|
8301
|
+
function PerUserLimitsView() {
|
|
8302
|
+
const { api, workspace, toast } = useSettingsAdapters();
|
|
8303
|
+
const workspaceId = workspace.current?.id ?? null;
|
|
8304
|
+
const [members, setMembers] = (0, import_react16.useState)([]);
|
|
8305
|
+
const [limits, setLimits] = (0, import_react16.useState)(null);
|
|
8306
|
+
const [loading, setLoading] = (0, import_react16.useState)(true);
|
|
8307
|
+
const [failed, setFailed] = (0, import_react16.useState)(false);
|
|
8308
|
+
const [searchQuery, setSearchQuery] = (0, import_react16.useState)("");
|
|
8309
|
+
const [editing, setEditing] = (0, import_react16.useState)(null);
|
|
8310
|
+
const [editingDefault, setEditingDefault] = (0, import_react16.useState)(false);
|
|
8311
|
+
const latestLoad = (0, import_react16.useRef)(0);
|
|
8312
|
+
const load = (0, import_react16.useCallback)(async ({ refresh = false } = {}) => {
|
|
8313
|
+
const loadId = ++latestLoad.current;
|
|
8314
|
+
if (!api.fetchMemberCreditLimits) {
|
|
8315
|
+
setLoading(false);
|
|
8316
|
+
setFailed(true);
|
|
8317
|
+
return;
|
|
8318
|
+
}
|
|
8319
|
+
const [nextMembers, nextLimits] = await Promise.all([
|
|
8320
|
+
api.fetchMembers().catch(() => null),
|
|
8321
|
+
api.fetchMemberCreditLimits().catch(() => null)
|
|
8322
|
+
]);
|
|
8323
|
+
if (loadId !== latestLoad.current) return;
|
|
8324
|
+
if (refresh && (!nextMembers || !nextLimits)) {
|
|
8325
|
+
toast.error("Couldn't refresh usage limits. Reopen this page to see the latest.");
|
|
8326
|
+
return;
|
|
8327
|
+
}
|
|
8328
|
+
setFailed(!nextMembers || !nextLimits);
|
|
8329
|
+
setMembers(nextMembers ?? []);
|
|
8330
|
+
setLimits(nextLimits);
|
|
8331
|
+
setLoading(false);
|
|
8332
|
+
}, [api, toast]);
|
|
8333
|
+
(0, import_react16.useEffect)(() => {
|
|
8334
|
+
setLoading(true);
|
|
8335
|
+
setFailed(false);
|
|
8336
|
+
setMembers([]);
|
|
8337
|
+
setLimits(null);
|
|
8338
|
+
setEditing(null);
|
|
8339
|
+
setEditingDefault(false);
|
|
8340
|
+
setSearchQuery("");
|
|
8341
|
+
void load();
|
|
8342
|
+
}, [workspaceId]);
|
|
8343
|
+
(0, import_react16.useEffect)(
|
|
8344
|
+
() => () => {
|
|
8345
|
+
latestLoad.current += 1;
|
|
8346
|
+
},
|
|
8347
|
+
[]
|
|
8348
|
+
);
|
|
8349
|
+
const unit = creditCycleUnit(limits?.cycle);
|
|
8350
|
+
const rows = (0, import_react16.useMemo)(
|
|
8351
|
+
() => joinMembersWithLimits(members, limits),
|
|
8352
|
+
[members, limits]
|
|
8353
|
+
);
|
|
8354
|
+
const filtered = (0, import_react16.useMemo)(() => {
|
|
8355
|
+
const q = searchQuery.trim().toLowerCase();
|
|
8356
|
+
if (!q) return rows;
|
|
8357
|
+
return rows.filter(
|
|
8358
|
+
({ member }) => (member.user.name ?? "").toLowerCase().includes(q) || (member.user.email ?? "").toLowerCase().includes(q)
|
|
8359
|
+
);
|
|
8360
|
+
}, [rows, searchQuery]);
|
|
8361
|
+
if (loading) {
|
|
8362
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
8363
|
+
"div",
|
|
8364
|
+
{
|
|
8365
|
+
className: "flex items-center justify-center w-full",
|
|
8366
|
+
style: {
|
|
8367
|
+
backgroundColor: T13.surfaceBase,
|
|
8368
|
+
borderRadius: T13.r3xl,
|
|
8369
|
+
padding: T13.sp6xl
|
|
8370
|
+
},
|
|
8371
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
8372
|
+
"div",
|
|
8373
|
+
{
|
|
8374
|
+
className: "animate-spin",
|
|
8375
|
+
style: {
|
|
8376
|
+
width: 24,
|
|
8377
|
+
height: 24,
|
|
8378
|
+
borderRadius: "var(--radius-full)",
|
|
8379
|
+
border: "2px solid var(--alias-border-subtle)",
|
|
8380
|
+
borderTopColor: "var(--alias-text---icons-primary)"
|
|
8381
|
+
}
|
|
8382
|
+
}
|
|
8383
|
+
)
|
|
8384
|
+
}
|
|
8385
|
+
);
|
|
8386
|
+
}
|
|
8387
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex flex-col flex-1 min-h-0 w-full", style: { gap: 16 }, children: [
|
|
8388
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex flex-col shrink-0", style: { gap: 4 }, children: [
|
|
8389
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
8390
|
+
"span",
|
|
8391
|
+
{
|
|
8392
|
+
style: {
|
|
8393
|
+
fontFamily: T13.font,
|
|
8394
|
+
fontSize: T13.fsXl,
|
|
8395
|
+
fontWeight: 500,
|
|
8396
|
+
lineHeight: T13.lhXl,
|
|
8397
|
+
color: T13.primary
|
|
8398
|
+
},
|
|
8399
|
+
children: "Per-user usage limits"
|
|
8400
|
+
}
|
|
8401
|
+
),
|
|
8402
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { style: { ...cellText, color: T13.muted }, children: "Set a default for every member, and override it for individuals." })
|
|
8403
|
+
] }),
|
|
8404
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
8405
|
+
"div",
|
|
8406
|
+
{
|
|
8407
|
+
className: "flex items-center justify-between shrink-0 w-full",
|
|
8408
|
+
style: {
|
|
8409
|
+
gap: 12,
|
|
8410
|
+
padding: 16,
|
|
8411
|
+
backgroundColor: T13.surfaceBase,
|
|
8412
|
+
border: `1px solid ${T13.borderSubtle}`,
|
|
8413
|
+
borderRadius: T13.r3xl
|
|
8414
|
+
},
|
|
8415
|
+
children: [
|
|
8416
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex flex-col min-w-0", style: { gap: 4 }, children: [
|
|
8417
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { style: { ...cellText, fontWeight: 500 }, children: "Default limit per member" }),
|
|
8418
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { style: { ...cellText, color: T13.muted }, children: failed ? "\u2014" : describeDefaultLimit(limits, unit) })
|
|
8419
|
+
] }),
|
|
8420
|
+
api.setDefaultCreditLimit && !failed && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
8421
|
+
import_ui10.ScButton,
|
|
8422
|
+
{
|
|
8423
|
+
text: "Edit",
|
|
8424
|
+
variant: "secondary",
|
|
8425
|
+
size: "sm",
|
|
8426
|
+
onClick: () => setEditingDefault(true)
|
|
8427
|
+
}
|
|
8428
|
+
)
|
|
8429
|
+
]
|
|
8430
|
+
}
|
|
8431
|
+
),
|
|
8432
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
8433
|
+
MemberListToolbar,
|
|
8434
|
+
{
|
|
8435
|
+
activeTab: "active",
|
|
8436
|
+
onTabChange: () => {
|
|
8437
|
+
},
|
|
8438
|
+
activeLabel: "Members",
|
|
8439
|
+
activeCount: failed ? null : filtered.length,
|
|
8440
|
+
searchQuery,
|
|
8441
|
+
onSearchChange: setSearchQuery
|
|
8442
|
+
}
|
|
8443
|
+
),
|
|
8444
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
8445
|
+
MemberListFrame,
|
|
8446
|
+
{
|
|
8447
|
+
contentMinWidth: 860,
|
|
8448
|
+
header: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
8449
|
+
"div",
|
|
8450
|
+
{
|
|
8451
|
+
style: {
|
|
8452
|
+
display: "grid",
|
|
8453
|
+
gridTemplateColumns: COLUMNS,
|
|
8454
|
+
gap: 24,
|
|
8455
|
+
padding: "8px 16px",
|
|
8456
|
+
fontSize: 11,
|
|
8457
|
+
color: T13.muted,
|
|
8458
|
+
textTransform: "uppercase"
|
|
8459
|
+
},
|
|
8460
|
+
children: ["Name", "Used this cycle", "Last cycle's usage", "Limit", "Actions"].map(
|
|
8461
|
+
(label) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { children: label }, label)
|
|
8462
|
+
)
|
|
8463
|
+
}
|
|
8464
|
+
),
|
|
8465
|
+
isEmpty: failed || filtered.length === 0,
|
|
8466
|
+
emptyText: failed ? "Couldn't load usage limits. Try again later." : searchQuery.trim() ? "No members match your search" : "No members yet",
|
|
8467
|
+
children: filtered.map((row) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
8468
|
+
LimitRow,
|
|
8469
|
+
{
|
|
8470
|
+
row,
|
|
8471
|
+
unit,
|
|
8472
|
+
onEdit: api.setMemberCreditLimit ? () => setEditing(row) : void 0
|
|
8473
|
+
},
|
|
8474
|
+
row.userId
|
|
8475
|
+
))
|
|
8476
|
+
}
|
|
8477
|
+
),
|
|
8478
|
+
editing && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
8479
|
+
MemberCreditLimitModal,
|
|
8480
|
+
{
|
|
8481
|
+
open: true,
|
|
8482
|
+
resetKey: editing.userId,
|
|
8483
|
+
subject: { name: editing.member.user.name, email: editing.member.user.email },
|
|
8484
|
+
used: editing.used,
|
|
8485
|
+
initialLimit: editing.limit,
|
|
8486
|
+
isSet: editing.hasLimit,
|
|
8487
|
+
unit,
|
|
8488
|
+
onSave: (limit) => api.setMemberCreditLimit({ userId: editing.userId, limit }),
|
|
8489
|
+
onRemove: editing.hasLimit && api.removeMemberCreditLimit ? () => api.removeMemberCreditLimit(editing.userId) : void 0,
|
|
8490
|
+
removeLabel: limits?.default ? "Use default" : "Remove",
|
|
8491
|
+
removeHint: limits?.default ? `Falls back to the default: ${describeDefaultLimit(limits, unit)}` : "No default is set, so the member becomes unlimited.",
|
|
8492
|
+
onClose: () => setEditing(null),
|
|
8493
|
+
onSaved: () => void load({ refresh: true }),
|
|
8494
|
+
onStale: () => void load({ refresh: true })
|
|
8495
|
+
}
|
|
8496
|
+
),
|
|
8497
|
+
editingDefault && api.setDefaultCreditLimit && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
8498
|
+
MemberCreditLimitModal,
|
|
8499
|
+
{
|
|
8500
|
+
open: true,
|
|
8501
|
+
title: "Default usage limit",
|
|
8502
|
+
description: "Applies to every member without their own limit, including new members.",
|
|
8503
|
+
used: 0,
|
|
8504
|
+
initialLimit: limits?.default?.limit ?? null,
|
|
8505
|
+
isSet: Boolean(limits?.default),
|
|
8506
|
+
unit,
|
|
8507
|
+
onSave: (limit) => api.setDefaultCreditLimit(limit),
|
|
8508
|
+
saveSuccessMessage: "Default usage limit updated",
|
|
8509
|
+
onClose: () => setEditingDefault(false),
|
|
8510
|
+
onSaved: () => void load({ refresh: true })
|
|
8511
|
+
}
|
|
8512
|
+
)
|
|
8513
|
+
] });
|
|
8514
|
+
}
|
|
8515
|
+
|
|
8516
|
+
// src/billing-content.tsx
|
|
8517
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
8518
|
+
var DEFAULT_TOPUP_SERVICE = "catalogix";
|
|
8519
|
+
var PRIMARY_COLOR2 = "var(--alias-text---icons-primary)";
|
|
8520
|
+
var MUTED_COLOR = "var(--alias-text---icons-muted)";
|
|
8521
|
+
function formatDate2(iso) {
|
|
8522
|
+
try {
|
|
8523
|
+
return new Date(iso).toLocaleDateString("en-US", {
|
|
8524
|
+
month: "short",
|
|
8525
|
+
day: "numeric",
|
|
8526
|
+
year: "numeric"
|
|
8527
|
+
});
|
|
8528
|
+
} catch {
|
|
8529
|
+
return iso;
|
|
8530
|
+
}
|
|
8531
|
+
}
|
|
8532
|
+
function formatCurrency(cents, currency) {
|
|
8533
|
+
if (currency === "inr") {
|
|
8534
|
+
return `\u20B9${(cents / 100).toFixed(2)}`;
|
|
8535
|
+
}
|
|
8536
|
+
return `$${(cents / 100).toFixed(2)}`;
|
|
8537
|
+
}
|
|
8538
|
+
function getCurrencySymbolByCountry(country) {
|
|
8539
|
+
return country?.trim().toUpperCase() === "IN" ? "\u20B9" : "$";
|
|
8540
|
+
}
|
|
8541
|
+
function formatCredits2(n) {
|
|
8542
|
+
return n.toLocaleString("en-US");
|
|
8543
|
+
}
|
|
8544
|
+
function formatNextBillingDateLabel(iso) {
|
|
8545
|
+
if (iso) {
|
|
8546
|
+
const parsed = new Date(iso);
|
|
8547
|
+
if (!Number.isNaN(parsed.getTime())) {
|
|
8548
|
+
return parsed.toLocaleDateString("en-US", {
|
|
8549
|
+
month: "short",
|
|
8550
|
+
day: "numeric",
|
|
8551
|
+
year: "numeric"
|
|
8552
|
+
});
|
|
8553
|
+
}
|
|
8554
|
+
}
|
|
8555
|
+
const fallback = /* @__PURE__ */ new Date();
|
|
8556
|
+
fallback.setMonth(fallback.getMonth() + 1);
|
|
8557
|
+
return fallback.toLocaleDateString("en-US", {
|
|
8558
|
+
month: "short",
|
|
8559
|
+
day: "numeric",
|
|
8560
|
+
year: "numeric"
|
|
8561
|
+
});
|
|
8562
|
+
}
|
|
8563
|
+
function formatEffectiveDateLabel(value) {
|
|
8564
|
+
if (value == null) return "";
|
|
8565
|
+
const parsed = typeof value === "number" ? new Date(value < 1e10 ? value * 1e3 : value) : new Date(value);
|
|
8566
|
+
if (Number.isNaN(parsed.getTime())) return "";
|
|
8567
|
+
return parsed.toLocaleDateString("en-US", {
|
|
8568
|
+
month: "short",
|
|
8569
|
+
day: "numeric",
|
|
8570
|
+
year: "numeric"
|
|
8571
|
+
});
|
|
8572
|
+
}
|
|
8573
|
+
function useIsLightTheme() {
|
|
8574
|
+
const read = () => typeof document !== "undefined" && document.documentElement.getAttribute("data-theme") === "Light";
|
|
8575
|
+
const [isLight, setIsLight] = (0, import_react17.useState)(read);
|
|
8576
|
+
(0, import_react17.useEffect)(() => {
|
|
8577
|
+
if (typeof document === "undefined") return;
|
|
8578
|
+
const target = document.documentElement;
|
|
8579
|
+
const observer = new MutationObserver(() => setIsLight(read()));
|
|
8580
|
+
observer.observe(target, {
|
|
8581
|
+
attributes: true,
|
|
8582
|
+
attributeFilter: ["data-theme"]
|
|
8583
|
+
});
|
|
8584
|
+
setIsLight(read());
|
|
8585
|
+
return () => observer.disconnect();
|
|
8586
|
+
}, []);
|
|
8587
|
+
return isLight;
|
|
8588
|
+
}
|
|
8589
|
+
function UpdateSubscriptionModal({
|
|
8590
|
+
open,
|
|
8591
|
+
currentPlanName,
|
|
8592
|
+
currentPlanAmount,
|
|
8593
|
+
nextPlanName,
|
|
8594
|
+
nextPlanAmount,
|
|
8595
|
+
nextBillingDateLabel,
|
|
8596
|
+
loading,
|
|
8597
|
+
onClose,
|
|
8598
|
+
onProceed
|
|
8599
|
+
}) {
|
|
8600
|
+
const isLight = useIsLightTheme();
|
|
8601
|
+
const modalSurface = isLight ? "#ffffff" : "var(--alias-surface-base)";
|
|
8602
|
+
const cardBorder = isLight ? "1px solid var(--alias-border-subtle)" : "1px solid var(--alias-border-divider)";
|
|
8603
|
+
if (!open) return null;
|
|
8604
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
8605
|
+
"div",
|
|
8606
|
+
{
|
|
8607
|
+
className: "fixed inset-0 z-50 flex items-center justify-center",
|
|
8608
|
+
style: { backgroundColor: "rgba(0, 0, 0, 0.6)" },
|
|
8609
|
+
onClick: (event) => {
|
|
8610
|
+
if (event.target === event.currentTarget) onClose();
|
|
8611
|
+
},
|
|
8612
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
8613
|
+
"div",
|
|
8614
|
+
{
|
|
8615
|
+
className: "flex flex-col w-full max-w-xl",
|
|
8616
|
+
style: {
|
|
8617
|
+
backgroundColor: modalSurface,
|
|
8618
|
+
borderRadius: "var(--radius-3xl)",
|
|
8619
|
+
border: "1px solid var(--alias-border-subtle)",
|
|
8620
|
+
padding: "var(--spacing-6xl)",
|
|
8621
|
+
gap: "var(--spacing-6xl)",
|
|
8622
|
+
maxHeight: "90vh",
|
|
8623
|
+
overflowY: "auto"
|
|
8624
|
+
},
|
|
8625
|
+
children: [
|
|
8626
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex items-center w-full", children: [
|
|
8627
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
8628
|
+
"p",
|
|
8629
|
+
{
|
|
8630
|
+
className: "flex-1 min-w-0",
|
|
8631
|
+
style: {
|
|
8632
|
+
fontFamily: "var(--font-family-font-family-display)",
|
|
8633
|
+
fontSize: "var(--font-size-font-size-xxl)",
|
|
8634
|
+
fontWeight: 600,
|
|
8635
|
+
lineHeight: "var(--line-height-line-height-xxl)",
|
|
8636
|
+
color: "var(--alias-text---icons-primary)"
|
|
8637
|
+
},
|
|
8638
|
+
children: "Update Subscription"
|
|
8639
|
+
}
|
|
8640
|
+
),
|
|
8641
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
8642
|
+
"button",
|
|
8643
|
+
{
|
|
8644
|
+
type: "button",
|
|
8645
|
+
onClick: onClose,
|
|
8646
|
+
style: { background: "transparent", border: "none" },
|
|
8647
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_icons12.SiconClose, { className: "w-6 h-6", color: MUTED_COLOR })
|
|
8648
|
+
}
|
|
8649
|
+
)
|
|
8650
|
+
] }),
|
|
8651
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
8652
|
+
"div",
|
|
8653
|
+
{
|
|
8654
|
+
className: "w-full",
|
|
8655
|
+
style: {
|
|
8656
|
+
height: "1px",
|
|
8657
|
+
backgroundColor: "var(--alias-border-divider)"
|
|
8658
|
+
}
|
|
8659
|
+
}
|
|
8660
|
+
),
|
|
8661
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
8662
|
+
"div",
|
|
8663
|
+
{
|
|
8664
|
+
className: "flex flex-col w-full",
|
|
8665
|
+
style: { gap: "var(--spacing-3xl)" },
|
|
8666
|
+
children: [
|
|
8667
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
8668
|
+
"p",
|
|
8669
|
+
{
|
|
8670
|
+
style: {
|
|
7925
8671
|
fontFamily: "var(--font-family-font-family-body)",
|
|
7926
8672
|
fontSize: "var(--font-size-font-size-sm)",
|
|
7927
8673
|
fontWeight: 500,
|
|
@@ -7931,7 +8677,7 @@ function UpdateSubscriptionModal({
|
|
|
7931
8677
|
children: "Current billing plan"
|
|
7932
8678
|
}
|
|
7933
8679
|
),
|
|
7934
|
-
/* @__PURE__ */ (0,
|
|
8680
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
7935
8681
|
"div",
|
|
7936
8682
|
{
|
|
7937
8683
|
className: "flex items-center w-full",
|
|
@@ -7942,7 +8688,7 @@ function UpdateSubscriptionModal({
|
|
|
7942
8688
|
padding: "var(--spacing-3xl)"
|
|
7943
8689
|
},
|
|
7944
8690
|
children: [
|
|
7945
|
-
/* @__PURE__ */ (0,
|
|
8691
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
7946
8692
|
"p",
|
|
7947
8693
|
{
|
|
7948
8694
|
className: "flex-1 min-w-0",
|
|
@@ -7956,8 +8702,8 @@ function UpdateSubscriptionModal({
|
|
|
7956
8702
|
children: currentPlanName || "Free"
|
|
7957
8703
|
}
|
|
7958
8704
|
),
|
|
7959
|
-
/* @__PURE__ */ (0,
|
|
7960
|
-
/* @__PURE__ */ (0,
|
|
8705
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex flex-col items-end", children: [
|
|
8706
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
7961
8707
|
"p",
|
|
7962
8708
|
{
|
|
7963
8709
|
style: {
|
|
@@ -7970,7 +8716,7 @@ function UpdateSubscriptionModal({
|
|
|
7970
8716
|
children: currentPlanAmount
|
|
7971
8717
|
}
|
|
7972
8718
|
),
|
|
7973
|
-
/* @__PURE__ */ (0,
|
|
8719
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
7974
8720
|
"p",
|
|
7975
8721
|
{
|
|
7976
8722
|
style: {
|
|
@@ -7987,7 +8733,7 @@ function UpdateSubscriptionModal({
|
|
|
7987
8733
|
]
|
|
7988
8734
|
}
|
|
7989
8735
|
),
|
|
7990
|
-
/* @__PURE__ */ (0,
|
|
8736
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "w-full flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
7991
8737
|
"div",
|
|
7992
8738
|
{
|
|
7993
8739
|
className: "flex items-center justify-center",
|
|
@@ -7998,10 +8744,10 @@ function UpdateSubscriptionModal({
|
|
|
7998
8744
|
backgroundColor: "var(--alias-fill-neutral-neutral)",
|
|
7999
8745
|
border: cardBorder
|
|
8000
8746
|
},
|
|
8001
|
-
children: /* @__PURE__ */ (0,
|
|
8747
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_icons12.SiconDoubleArrow, { className: "w-4 h-4", color: MUTED_COLOR })
|
|
8002
8748
|
}
|
|
8003
8749
|
) }),
|
|
8004
|
-
/* @__PURE__ */ (0,
|
|
8750
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
8005
8751
|
"p",
|
|
8006
8752
|
{
|
|
8007
8753
|
style: {
|
|
@@ -8017,7 +8763,7 @@ function UpdateSubscriptionModal({
|
|
|
8017
8763
|
]
|
|
8018
8764
|
}
|
|
8019
8765
|
),
|
|
8020
|
-
/* @__PURE__ */ (0,
|
|
8766
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
8021
8767
|
"div",
|
|
8022
8768
|
{
|
|
8023
8769
|
className: "flex items-center w-full",
|
|
@@ -8028,7 +8774,7 @@ function UpdateSubscriptionModal({
|
|
|
8028
8774
|
padding: "var(--spacing-3xl)"
|
|
8029
8775
|
},
|
|
8030
8776
|
children: [
|
|
8031
|
-
/* @__PURE__ */ (0,
|
|
8777
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
8032
8778
|
"p",
|
|
8033
8779
|
{
|
|
8034
8780
|
className: "flex-1 min-w-0",
|
|
@@ -8042,8 +8788,8 @@ function UpdateSubscriptionModal({
|
|
|
8042
8788
|
children: nextPlanName || "Pro"
|
|
8043
8789
|
}
|
|
8044
8790
|
),
|
|
8045
|
-
/* @__PURE__ */ (0,
|
|
8046
|
-
/* @__PURE__ */ (0,
|
|
8791
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex flex-col items-end", children: [
|
|
8792
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
8047
8793
|
"p",
|
|
8048
8794
|
{
|
|
8049
8795
|
style: {
|
|
@@ -8056,7 +8802,7 @@ function UpdateSubscriptionModal({
|
|
|
8056
8802
|
children: nextPlanAmount
|
|
8057
8803
|
}
|
|
8058
8804
|
),
|
|
8059
|
-
/* @__PURE__ */ (0,
|
|
8805
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
8060
8806
|
"p",
|
|
8061
8807
|
{
|
|
8062
8808
|
style: {
|
|
@@ -8073,7 +8819,7 @@ function UpdateSubscriptionModal({
|
|
|
8073
8819
|
]
|
|
8074
8820
|
}
|
|
8075
8821
|
),
|
|
8076
|
-
/* @__PURE__ */ (0,
|
|
8822
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
8077
8823
|
"div",
|
|
8078
8824
|
{
|
|
8079
8825
|
className: "w-full",
|
|
@@ -8083,8 +8829,8 @@ function UpdateSubscriptionModal({
|
|
|
8083
8829
|
}
|
|
8084
8830
|
}
|
|
8085
8831
|
),
|
|
8086
|
-
/* @__PURE__ */ (0,
|
|
8087
|
-
/* @__PURE__ */ (0,
|
|
8832
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex items-center w-full", children: [
|
|
8833
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
8088
8834
|
"p",
|
|
8089
8835
|
{
|
|
8090
8836
|
className: "flex-1 min-w-0",
|
|
@@ -8098,7 +8844,7 @@ function UpdateSubscriptionModal({
|
|
|
8098
8844
|
children: "Amount Due Today"
|
|
8099
8845
|
}
|
|
8100
8846
|
),
|
|
8101
|
-
/* @__PURE__ */ (0,
|
|
8847
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
8102
8848
|
"p",
|
|
8103
8849
|
{
|
|
8104
8850
|
style: {
|
|
@@ -8115,7 +8861,7 @@ function UpdateSubscriptionModal({
|
|
|
8115
8861
|
]
|
|
8116
8862
|
}
|
|
8117
8863
|
),
|
|
8118
|
-
/* @__PURE__ */ (0,
|
|
8864
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
8119
8865
|
"button",
|
|
8120
8866
|
{
|
|
8121
8867
|
type: "button",
|
|
@@ -8130,7 +8876,7 @@ function UpdateSubscriptionModal({
|
|
|
8130
8876
|
},
|
|
8131
8877
|
disabled: loading,
|
|
8132
8878
|
onClick: onProceed,
|
|
8133
|
-
children: /* @__PURE__ */ (0,
|
|
8879
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
8134
8880
|
"span",
|
|
8135
8881
|
{
|
|
8136
8882
|
style: {
|
|
@@ -8170,7 +8916,7 @@ function PlansView({
|
|
|
8170
8916
|
const workspaceCurrencySymbol = getCurrencySymbolByCountry(
|
|
8171
8917
|
workspace?.country
|
|
8172
8918
|
);
|
|
8173
|
-
const allPlans = (0,
|
|
8919
|
+
const allPlans = (0, import_react17.useMemo)(() => {
|
|
8174
8920
|
if (products.length > 0) {
|
|
8175
8921
|
return products.flatMap(
|
|
8176
8922
|
(product) => product.prices.filter((price) => Boolean(price.metadata?.credits)).map((price) => ({
|
|
@@ -8188,7 +8934,7 @@ function PlansView({
|
|
|
8188
8934
|
}
|
|
8189
8935
|
return [];
|
|
8190
8936
|
}, [products, currentPlanId]);
|
|
8191
|
-
const sortedPlans = (0,
|
|
8937
|
+
const sortedPlans = (0, import_react17.useMemo)(
|
|
8192
8938
|
() => [...allPlans].sort((a, b) => a.amount - b.amount),
|
|
8193
8939
|
[allPlans]
|
|
8194
8940
|
);
|
|
@@ -8205,8 +8951,8 @@ function PlansView({
|
|
|
8205
8951
|
const currentPlan = sortedPlans.find((plan) => plan.isCurrent) ?? freePlan;
|
|
8206
8952
|
const middlePlans = sortedPlans.filter((plan) => plan.amount > 0);
|
|
8207
8953
|
const currentPlanAmount = currentPlan?.amount ?? 0;
|
|
8208
|
-
const [selectedMiddlePlanKey, setSelectedMiddlePlanKey] = (0,
|
|
8209
|
-
(0,
|
|
8954
|
+
const [selectedMiddlePlanKey, setSelectedMiddlePlanKey] = (0, import_react17.useState)("");
|
|
8955
|
+
(0, import_react17.useEffect)(() => {
|
|
8210
8956
|
if (middlePlans.length === 0) {
|
|
8211
8957
|
setSelectedMiddlePlanKey("");
|
|
8212
8958
|
return;
|
|
@@ -8220,9 +8966,9 @@ function PlansView({
|
|
|
8220
8966
|
const isMiddleActionLoading = Boolean(
|
|
8221
8967
|
selectedMiddlePlan && actionInFlight === selectedMiddlePlan.key
|
|
8222
8968
|
);
|
|
8223
|
-
const [isPlanSelectorOpen, setIsPlanSelectorOpen] = (0,
|
|
8224
|
-
const planDropdownRef = (0,
|
|
8225
|
-
(0,
|
|
8969
|
+
const [isPlanSelectorOpen, setIsPlanSelectorOpen] = (0, import_react17.useState)(false);
|
|
8970
|
+
const planDropdownRef = (0, import_react17.useRef)(null);
|
|
8971
|
+
(0, import_react17.useEffect)(() => {
|
|
8226
8972
|
if (!isPlanSelectorOpen) return;
|
|
8227
8973
|
const handleClickOutside = (event) => {
|
|
8228
8974
|
const target = event.target;
|
|
@@ -8240,8 +8986,8 @@ function PlansView({
|
|
|
8240
8986
|
const isCurrentWithDowngrade = Boolean(
|
|
8241
8987
|
currentPlan?.isCurrent && downgradeScheduled
|
|
8242
8988
|
);
|
|
8243
|
-
const [showUpgradeConfirmModal, setShowUpgradeConfirmModal] = (0,
|
|
8244
|
-
return /* @__PURE__ */ (0,
|
|
8989
|
+
const [showUpgradeConfirmModal, setShowUpgradeConfirmModal] = (0, import_react17.useState)(false);
|
|
8990
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
8245
8991
|
"div",
|
|
8246
8992
|
{
|
|
8247
8993
|
className: "flex flex-col items-start relative size-full overflow-y-auto",
|
|
@@ -8252,12 +8998,12 @@ function PlansView({
|
|
|
8252
8998
|
backgroundSize: "24px 24px"
|
|
8253
8999
|
},
|
|
8254
9000
|
children: [
|
|
8255
|
-
!hideHeader && /* @__PURE__ */ (0,
|
|
9001
|
+
!hideHeader && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
8256
9002
|
"div",
|
|
8257
9003
|
{
|
|
8258
9004
|
className: "flex items-center justify-end shrink-0 w-full",
|
|
8259
9005
|
style: { gap: "var(--spacing-lg)" },
|
|
8260
|
-
children: /* @__PURE__ */ (0,
|
|
9006
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
8261
9007
|
"div",
|
|
8262
9008
|
{
|
|
8263
9009
|
className: "flex items-center shrink-0 cursor-pointer",
|
|
@@ -8271,8 +9017,8 @@ function PlansView({
|
|
|
8271
9017
|
},
|
|
8272
9018
|
onClick: onBack,
|
|
8273
9019
|
children: [
|
|
8274
|
-
/* @__PURE__ */ (0,
|
|
8275
|
-
/* @__PURE__ */ (0,
|
|
9020
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_icons12.SiconLeft, { className: "w-4 h-4", color: MUTED_COLOR }),
|
|
9021
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
8276
9022
|
"span",
|
|
8277
9023
|
{
|
|
8278
9024
|
style: {
|
|
@@ -8290,14 +9036,14 @@ function PlansView({
|
|
|
8290
9036
|
)
|
|
8291
9037
|
}
|
|
8292
9038
|
),
|
|
8293
|
-
/* @__PURE__ */ (0,
|
|
9039
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
8294
9040
|
"div",
|
|
8295
9041
|
{
|
|
8296
9042
|
className: "grid w-full grid-cols-1 md:grid-cols-2 xl:grid-cols-3 items-stretch",
|
|
8297
9043
|
style: { gap: "var(--spacing-8xl)" },
|
|
8298
9044
|
children: [
|
|
8299
|
-
/* @__PURE__ */ (0,
|
|
8300
|
-
|
|
9045
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "h-full", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
9046
|
+
import_ui11.ScPlanCard,
|
|
8301
9047
|
{
|
|
8302
9048
|
planName: freePlan?.planName || "Free",
|
|
8303
9049
|
price: stripMonthly(freePlan?.price || `${workspaceCurrencySymbol}0`),
|
|
@@ -8326,8 +9072,8 @@ function PlansView({
|
|
|
8326
9072
|
className: "h-full"
|
|
8327
9073
|
}
|
|
8328
9074
|
) }),
|
|
8329
|
-
/* @__PURE__ */ (0,
|
|
8330
|
-
|
|
9075
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "h-full", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
9076
|
+
import_ui11.ScPlanCard,
|
|
8331
9077
|
{
|
|
8332
9078
|
planName: "Pro",
|
|
8333
9079
|
price: stripMonthly(selectedMiddlePlan?.price || "\u2014"),
|
|
@@ -8347,7 +9093,7 @@ function PlansView({
|
|
|
8347
9093
|
setShowUpgradeConfirmModal(true);
|
|
8348
9094
|
},
|
|
8349
9095
|
onIncreaseCredits: () => setIsPlanSelectorOpen((prev) => !prev),
|
|
8350
|
-
creditsDropdown: isPlanSelectorOpen ? /* @__PURE__ */ (0,
|
|
9096
|
+
creditsDropdown: isPlanSelectorOpen ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
8351
9097
|
"div",
|
|
8352
9098
|
{
|
|
8353
9099
|
ref: planDropdownRef,
|
|
@@ -8364,7 +9110,7 @@ function PlansView({
|
|
|
8364
9110
|
},
|
|
8365
9111
|
children: middlePlans.map((plan) => {
|
|
8366
9112
|
const selected = plan.key === selectedMiddlePlanKey;
|
|
8367
|
-
return /* @__PURE__ */ (0,
|
|
9113
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
8368
9114
|
"button",
|
|
8369
9115
|
{
|
|
8370
9116
|
type: "button",
|
|
@@ -8382,7 +9128,7 @@ function PlansView({
|
|
|
8382
9128
|
setIsPlanSelectorOpen(false);
|
|
8383
9129
|
},
|
|
8384
9130
|
children: [
|
|
8385
|
-
/* @__PURE__ */ (0,
|
|
9131
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
8386
9132
|
"span",
|
|
8387
9133
|
{
|
|
8388
9134
|
className: "flex-1 min-w-0 truncate",
|
|
@@ -8396,7 +9142,7 @@ function PlansView({
|
|
|
8396
9142
|
children: plan.credits
|
|
8397
9143
|
}
|
|
8398
9144
|
),
|
|
8399
|
-
/* @__PURE__ */ (0,
|
|
9145
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
8400
9146
|
"span",
|
|
8401
9147
|
{
|
|
8402
9148
|
style: {
|
|
@@ -8419,8 +9165,8 @@ function PlansView({
|
|
|
8419
9165
|
className: "h-full"
|
|
8420
9166
|
}
|
|
8421
9167
|
) }),
|
|
8422
|
-
/* @__PURE__ */ (0,
|
|
8423
|
-
|
|
9168
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "h-full", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
9169
|
+
import_ui11.ScPlanCard,
|
|
8424
9170
|
{
|
|
8425
9171
|
planName: "Enterprise",
|
|
8426
9172
|
type: "custom",
|
|
@@ -8436,8 +9182,8 @@ function PlansView({
|
|
|
8436
9182
|
]
|
|
8437
9183
|
}
|
|
8438
9184
|
),
|
|
8439
|
-
/* @__PURE__ */ (0,
|
|
8440
|
-
|
|
9185
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
9186
|
+
import_ui11.ScPlanComparison,
|
|
8441
9187
|
{
|
|
8442
9188
|
layout: "table",
|
|
8443
9189
|
columns: [...PLAN_COMPARISON_COLUMNS],
|
|
@@ -8446,7 +9192,7 @@ function PlansView({
|
|
|
8446
9192
|
highlightColumnIndex: 1
|
|
8447
9193
|
}
|
|
8448
9194
|
),
|
|
8449
|
-
/* @__PURE__ */ (0,
|
|
9195
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
8450
9196
|
UpdateSubscriptionModal,
|
|
8451
9197
|
{
|
|
8452
9198
|
open: showUpgradeConfirmModal,
|
|
@@ -8481,7 +9227,7 @@ function BillingTabBar({
|
|
|
8481
9227
|
activeTab,
|
|
8482
9228
|
onTabChange
|
|
8483
9229
|
}) {
|
|
8484
|
-
return /* @__PURE__ */ (0,
|
|
9230
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
8485
9231
|
"div",
|
|
8486
9232
|
{
|
|
8487
9233
|
className: "flex items-center shrink-0 relative",
|
|
@@ -8493,8 +9239,8 @@ function BillingTabBar({
|
|
|
8493
9239
|
border: "0.5px solid var(--alias-border-subtle)"
|
|
8494
9240
|
},
|
|
8495
9241
|
children: [
|
|
8496
|
-
/* @__PURE__ */ (0,
|
|
8497
|
-
|
|
9242
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
9243
|
+
import_ui11.ScTabComp,
|
|
8498
9244
|
{
|
|
8499
9245
|
text: "Invoice history",
|
|
8500
9246
|
type: "text-only",
|
|
@@ -8503,8 +9249,8 @@ function BillingTabBar({
|
|
|
8503
9249
|
style: { flex: 1 }
|
|
8504
9250
|
}
|
|
8505
9251
|
),
|
|
8506
|
-
/* @__PURE__ */ (0,
|
|
8507
|
-
|
|
9252
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
9253
|
+
import_ui11.ScTabComp,
|
|
8508
9254
|
{
|
|
8509
9255
|
text: "Usage logs",
|
|
8510
9256
|
type: "text-only",
|
|
@@ -8565,7 +9311,7 @@ function InvoiceHistoryTable({
|
|
|
8565
9311
|
}
|
|
8566
9312
|
};
|
|
8567
9313
|
if (loading) {
|
|
8568
|
-
return /* @__PURE__ */ (0,
|
|
9314
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
8569
9315
|
"div",
|
|
8570
9316
|
{
|
|
8571
9317
|
className: "flex items-center justify-center w-full",
|
|
@@ -8574,7 +9320,7 @@ function InvoiceHistoryTable({
|
|
|
8574
9320
|
borderRadius: "var(--radius-3xl)",
|
|
8575
9321
|
padding: "var(--spacing-6xl)"
|
|
8576
9322
|
},
|
|
8577
|
-
children: /* @__PURE__ */ (0,
|
|
9323
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
8578
9324
|
"div",
|
|
8579
9325
|
{
|
|
8580
9326
|
className: "animate-spin",
|
|
@@ -8590,7 +9336,7 @@ function InvoiceHistoryTable({
|
|
|
8590
9336
|
}
|
|
8591
9337
|
);
|
|
8592
9338
|
}
|
|
8593
|
-
return /* @__PURE__ */ (0,
|
|
9339
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
8594
9340
|
"div",
|
|
8595
9341
|
{
|
|
8596
9342
|
className: "flex-1 min-h-0 w-full relative",
|
|
@@ -8601,7 +9347,7 @@ function InvoiceHistoryTable({
|
|
|
8601
9347
|
overflowY: "auto"
|
|
8602
9348
|
},
|
|
8603
9349
|
children: [
|
|
8604
|
-
/* @__PURE__ */ (0,
|
|
9350
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
8605
9351
|
"div",
|
|
8606
9352
|
{
|
|
8607
9353
|
style: {
|
|
@@ -8610,15 +9356,15 @@ function InvoiceHistoryTable({
|
|
|
8610
9356
|
zIndex: 1,
|
|
8611
9357
|
backgroundColor: "var(--alias-surface-base)"
|
|
8612
9358
|
},
|
|
8613
|
-
children: /* @__PURE__ */ (0,
|
|
9359
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_ui11.ScBillingHistoryHeader, {})
|
|
8614
9360
|
}
|
|
8615
9361
|
),
|
|
8616
|
-
invoices.length === 0 && /* @__PURE__ */ (0,
|
|
9362
|
+
invoices.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
8617
9363
|
"div",
|
|
8618
9364
|
{
|
|
8619
9365
|
className: "flex items-center justify-center w-full",
|
|
8620
9366
|
style: { padding: "var(--spacing-6xl)" },
|
|
8621
|
-
children: /* @__PURE__ */ (0,
|
|
9367
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
8622
9368
|
"span",
|
|
8623
9369
|
{
|
|
8624
9370
|
style: {
|
|
@@ -8633,8 +9379,8 @@ function InvoiceHistoryTable({
|
|
|
8633
9379
|
)
|
|
8634
9380
|
}
|
|
8635
9381
|
),
|
|
8636
|
-
invoices.map((inv) => /* @__PURE__ */ (0,
|
|
8637
|
-
|
|
9382
|
+
invoices.map((inv) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
9383
|
+
import_ui11.ScBillingHistoryTableList,
|
|
8638
9384
|
{
|
|
8639
9385
|
invoiceNumber: inv.transactionId ? `# ${inv.transactionId.slice(0, 16).toUpperCase()}` : "# INV-UNKNOWN",
|
|
8640
9386
|
amount: inv.amountPaid != null ? `${currencySymbol}${inv.amountPaid.toFixed(2)}` : `${currencySymbol}${(inv.amount / 100).toFixed(2)}`,
|
|
@@ -8654,7 +9400,7 @@ function UsageLogsTable({
|
|
|
8654
9400
|
loading
|
|
8655
9401
|
}) {
|
|
8656
9402
|
if (loading) {
|
|
8657
|
-
return /* @__PURE__ */ (0,
|
|
9403
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
8658
9404
|
"div",
|
|
8659
9405
|
{
|
|
8660
9406
|
className: "flex items-center justify-center w-full",
|
|
@@ -8663,7 +9409,7 @@ function UsageLogsTable({
|
|
|
8663
9409
|
borderRadius: "var(--radius-3xl)",
|
|
8664
9410
|
padding: "var(--spacing-6xl)"
|
|
8665
9411
|
},
|
|
8666
|
-
children: /* @__PURE__ */ (0,
|
|
9412
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
8667
9413
|
"div",
|
|
8668
9414
|
{
|
|
8669
9415
|
className: "animate-spin",
|
|
@@ -8679,7 +9425,7 @@ function UsageLogsTable({
|
|
|
8679
9425
|
}
|
|
8680
9426
|
);
|
|
8681
9427
|
}
|
|
8682
|
-
return /* @__PURE__ */ (0,
|
|
9428
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
8683
9429
|
"div",
|
|
8684
9430
|
{
|
|
8685
9431
|
className: "flex-1 min-h-0 w-full relative",
|
|
@@ -8690,7 +9436,7 @@ function UsageLogsTable({
|
|
|
8690
9436
|
overflowY: "auto"
|
|
8691
9437
|
},
|
|
8692
9438
|
children: [
|
|
8693
|
-
/* @__PURE__ */ (0,
|
|
9439
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
8694
9440
|
"div",
|
|
8695
9441
|
{
|
|
8696
9442
|
style: {
|
|
@@ -8705,40 +9451,40 @@ function UsageLogsTable({
|
|
|
8705
9451
|
alignItems: "center"
|
|
8706
9452
|
},
|
|
8707
9453
|
children: [
|
|
8708
|
-
/* @__PURE__ */ (0,
|
|
8709
|
-
|
|
9454
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
9455
|
+
import_ui11.ScHeader,
|
|
8710
9456
|
{
|
|
8711
9457
|
text: "App",
|
|
8712
9458
|
state: "none",
|
|
8713
9459
|
style: { flex: 1, alignItems: "flex-start", gap: "0.25rem" }
|
|
8714
9460
|
}
|
|
8715
9461
|
),
|
|
8716
|
-
/* @__PURE__ */ (0,
|
|
8717
|
-
|
|
9462
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
9463
|
+
import_ui11.ScHeader,
|
|
8718
9464
|
{
|
|
8719
9465
|
text: "Activity",
|
|
8720
9466
|
state: "none",
|
|
8721
9467
|
style: { flex: 1, alignItems: "flex-start", gap: "0.25rem" }
|
|
8722
9468
|
}
|
|
8723
9469
|
),
|
|
8724
|
-
/* @__PURE__ */ (0,
|
|
8725
|
-
|
|
9470
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
9471
|
+
import_ui11.ScHeader,
|
|
8726
9472
|
{
|
|
8727
9473
|
text: "Used by",
|
|
8728
9474
|
state: "none",
|
|
8729
9475
|
style: { flexShrink: 0, width: "7.5rem" }
|
|
8730
9476
|
}
|
|
8731
9477
|
),
|
|
8732
|
-
/* @__PURE__ */ (0,
|
|
8733
|
-
|
|
9478
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
9479
|
+
import_ui11.ScHeader,
|
|
8734
9480
|
{
|
|
8735
9481
|
text: "Date",
|
|
8736
9482
|
state: "none",
|
|
8737
9483
|
style: { flexShrink: 0, width: "7.5rem" }
|
|
8738
9484
|
}
|
|
8739
9485
|
),
|
|
8740
|
-
/* @__PURE__ */ (0,
|
|
8741
|
-
|
|
9486
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
9487
|
+
import_ui11.ScHeader,
|
|
8742
9488
|
{
|
|
8743
9489
|
text: "Credits",
|
|
8744
9490
|
state: "none",
|
|
@@ -8752,12 +9498,12 @@ function UsageLogsTable({
|
|
|
8752
9498
|
]
|
|
8753
9499
|
}
|
|
8754
9500
|
),
|
|
8755
|
-
logs.length === 0 && /* @__PURE__ */ (0,
|
|
9501
|
+
logs.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
8756
9502
|
"div",
|
|
8757
9503
|
{
|
|
8758
9504
|
className: "flex items-center justify-center w-full",
|
|
8759
9505
|
style: { padding: "var(--spacing-6xl)" },
|
|
8760
|
-
children: /* @__PURE__ */ (0,
|
|
9506
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
8761
9507
|
"span",
|
|
8762
9508
|
{
|
|
8763
9509
|
style: {
|
|
@@ -8789,7 +9535,7 @@ function UsageLogsTable({
|
|
|
8789
9535
|
overflow: "hidden",
|
|
8790
9536
|
whiteSpace: "nowrap"
|
|
8791
9537
|
};
|
|
8792
|
-
return /* @__PURE__ */ (0,
|
|
9538
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
8793
9539
|
"div",
|
|
8794
9540
|
{
|
|
8795
9541
|
style: {
|
|
@@ -8801,11 +9547,11 @@ function UsageLogsTable({
|
|
|
8801
9547
|
alignItems: "center"
|
|
8802
9548
|
},
|
|
8803
9549
|
children: [
|
|
8804
|
-
/* @__PURE__ */ (0,
|
|
8805
|
-
/* @__PURE__ */ (0,
|
|
8806
|
-
/* @__PURE__ */ (0,
|
|
8807
|
-
/* @__PURE__ */ (0,
|
|
8808
|
-
/* @__PURE__ */ (0,
|
|
9550
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { style: { ...rowCellRegular, flex: 1 }, children: app }),
|
|
9551
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { style: { ...rowCellRegular, flex: 1 }, children: activity }),
|
|
9552
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { style: { ...rowCellRegular, width: "7.5rem" }, children: userName }),
|
|
9553
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { style: { ...rowCellRegular, width: "7.5rem" }, children: formatDate2(log.createdAt) }),
|
|
9554
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
8809
9555
|
"div",
|
|
8810
9556
|
{
|
|
8811
9557
|
style: {
|
|
@@ -8835,7 +9581,9 @@ function UsageLogsTable({
|
|
|
8835
9581
|
function BillingContent({
|
|
8836
9582
|
embedded = false,
|
|
8837
9583
|
showPlans: showPlansProp,
|
|
8838
|
-
onShowPlansChange
|
|
9584
|
+
onShowPlansChange,
|
|
9585
|
+
showPerUserLimits: showPerUserLimitsProp,
|
|
9586
|
+
onShowPerUserLimitsChange
|
|
8839
9587
|
} = {}) {
|
|
8840
9588
|
const { auth, workspace, api, toast, navigation } = useSettingsAdapters();
|
|
8841
9589
|
const user = auth.user;
|
|
@@ -8847,35 +9595,41 @@ function BillingContent({
|
|
|
8847
9595
|
if (typeof window === "undefined") return "";
|
|
8848
9596
|
return `${window.location.origin}${window.location.pathname}`;
|
|
8849
9597
|
};
|
|
8850
|
-
const [activeTab, setActiveTab] = (0,
|
|
8851
|
-
const [showPlansInternal, setShowPlansInternal] = (0,
|
|
9598
|
+
const [activeTab, setActiveTab] = (0, import_react17.useState)("invoice");
|
|
9599
|
+
const [showPlansInternal, setShowPlansInternal] = (0, import_react17.useState)(false);
|
|
8852
9600
|
const showPlans = showPlansProp ?? showPlansInternal;
|
|
8853
9601
|
const setShowPlans = (next) => {
|
|
8854
9602
|
if (onShowPlansChange) onShowPlansChange(next);
|
|
8855
9603
|
else setShowPlansInternal(next);
|
|
8856
9604
|
};
|
|
8857
|
-
const [
|
|
8858
|
-
const
|
|
8859
|
-
const
|
|
8860
|
-
|
|
8861
|
-
|
|
8862
|
-
|
|
8863
|
-
const [
|
|
8864
|
-
const [
|
|
8865
|
-
const [
|
|
8866
|
-
const [
|
|
9605
|
+
const [showPerUserLimitsInternal, setShowPerUserLimitsInternal] = (0, import_react17.useState)(false);
|
|
9606
|
+
const showPerUserLimits = (showPerUserLimitsProp ?? showPerUserLimitsInternal) && Boolean(api.fetchMemberCreditLimits);
|
|
9607
|
+
const setShowPerUserLimits = (next) => {
|
|
9608
|
+
if (onShowPerUserLimitsChange) onShowPerUserLimitsChange(next);
|
|
9609
|
+
else setShowPerUserLimitsInternal(next);
|
|
9610
|
+
};
|
|
9611
|
+
const [showExportModal, setShowExportModal] = (0, import_react17.useState)(false);
|
|
9612
|
+
const [showBuyCreditsModal, setShowBuyCreditsModal] = (0, import_react17.useState)(false);
|
|
9613
|
+
const [subscription, setSubscription] = (0, import_react17.useState)(null);
|
|
9614
|
+
const [availableCredits, setAvailableCredits] = (0, import_react17.useState)(null);
|
|
9615
|
+
const [products, setProducts] = (0, import_react17.useState)([]);
|
|
9616
|
+
const [invoices, setInvoices] = (0, import_react17.useState)([]);
|
|
9617
|
+
const [totalCredits, setTotalCredits] = (0, import_react17.useState)(null);
|
|
9618
|
+
const [usageLogs, setUsageLogs] = (0, import_react17.useState)([]);
|
|
9619
|
+
const [userMap, setUserMap] = (0, import_react17.useState)({});
|
|
9620
|
+
const [customPlanCredits, setCustomPlanCredits] = (0, import_react17.useState)(
|
|
8867
9621
|
null
|
|
8868
9622
|
);
|
|
8869
|
-
const [planActionInFlight, setPlanActionInFlight] = (0,
|
|
9623
|
+
const [planActionInFlight, setPlanActionInFlight] = (0, import_react17.useState)(
|
|
8870
9624
|
null
|
|
8871
9625
|
);
|
|
8872
|
-
const [buyCreditsInFlight, setBuyCreditsInFlight] = (0,
|
|
8873
|
-
const [loadingBilling, setLoadingBilling] = (0,
|
|
8874
|
-
const [billingOverviewLoaded, setBillingOverviewLoaded] = (0,
|
|
8875
|
-
const [loadingTable, setLoadingTable] = (0,
|
|
8876
|
-
const [showInitialLoader, setShowInitialLoader] = (0,
|
|
8877
|
-
const [initialFetchTriggered, setInitialFetchTriggered] = (0,
|
|
8878
|
-
const logBillingEvent = (0,
|
|
9626
|
+
const [buyCreditsInFlight, setBuyCreditsInFlight] = (0, import_react17.useState)(false);
|
|
9627
|
+
const [loadingBilling, setLoadingBilling] = (0, import_react17.useState)(false);
|
|
9628
|
+
const [billingOverviewLoaded, setBillingOverviewLoaded] = (0, import_react17.useState)(false);
|
|
9629
|
+
const [loadingTable, setLoadingTable] = (0, import_react17.useState)(false);
|
|
9630
|
+
const [showInitialLoader, setShowInitialLoader] = (0, import_react17.useState)(true);
|
|
9631
|
+
const [initialFetchTriggered, setInitialFetchTriggered] = (0, import_react17.useState)(false);
|
|
9632
|
+
const logBillingEvent = (0, import_react17.useCallback)(
|
|
8879
9633
|
async (eventName, description, metadata) => {
|
|
8880
9634
|
if (!api.sendBillingEvent) return;
|
|
8881
9635
|
try {
|
|
@@ -8885,7 +9639,7 @@ function BillingContent({
|
|
|
8885
9639
|
},
|
|
8886
9640
|
[api]
|
|
8887
9641
|
);
|
|
8888
|
-
const ensureWorkspaceOnBilling = (0,
|
|
9642
|
+
const ensureWorkspaceOnBilling = (0, import_react17.useCallback)(async () => {
|
|
8889
9643
|
if (!api.createWorkspaceOnBilling) return false;
|
|
8890
9644
|
try {
|
|
8891
9645
|
await api.createWorkspaceOnBilling({ serviceNames: [] });
|
|
@@ -8894,7 +9648,7 @@ function BillingContent({
|
|
|
8894
9648
|
return false;
|
|
8895
9649
|
}
|
|
8896
9650
|
}, [api]);
|
|
8897
|
-
const fetchBillingOverview = (0,
|
|
9651
|
+
const fetchBillingOverview = (0, import_react17.useCallback)(async () => {
|
|
8898
9652
|
setLoadingBilling(true);
|
|
8899
9653
|
setBillingOverviewLoaded(false);
|
|
8900
9654
|
try {
|
|
@@ -8928,7 +9682,7 @@ function BillingContent({
|
|
|
8928
9682
|
setBillingOverviewLoaded(true);
|
|
8929
9683
|
}
|
|
8930
9684
|
}, [api, workspace.current?.country]);
|
|
8931
|
-
const fetchUserMap = (0,
|
|
9685
|
+
const fetchUserMap = (0, import_react17.useCallback)(async () => {
|
|
8932
9686
|
try {
|
|
8933
9687
|
const members = await api.fetchMembers();
|
|
8934
9688
|
if (members && members.length) {
|
|
@@ -8941,7 +9695,7 @@ function BillingContent({
|
|
|
8941
9695
|
} catch {
|
|
8942
9696
|
}
|
|
8943
9697
|
}, [api]);
|
|
8944
|
-
const fetchTableData = (0,
|
|
9698
|
+
const fetchTableData = (0, import_react17.useCallback)(
|
|
8945
9699
|
async (tab) => {
|
|
8946
9700
|
setLoadingTable(true);
|
|
8947
9701
|
try {
|
|
@@ -8969,7 +9723,7 @@ function BillingContent({
|
|
|
8969
9723
|
},
|
|
8970
9724
|
[api]
|
|
8971
9725
|
);
|
|
8972
|
-
const handlePlanAction = (0,
|
|
9726
|
+
const handlePlanAction = (0, import_react17.useCallback)(
|
|
8973
9727
|
async ({ productId, priceId, planName: planName2 }) => {
|
|
8974
9728
|
if (!workspaceId || !user?.id || !user.email) {
|
|
8975
9729
|
toast.error("Missing account details for plan update");
|
|
@@ -9038,7 +9792,7 @@ function BillingContent({
|
|
|
9038
9792
|
toast
|
|
9039
9793
|
]
|
|
9040
9794
|
);
|
|
9041
|
-
const handleCancelDowngrade = (0,
|
|
9795
|
+
const handleCancelDowngrade = (0, import_react17.useCallback)(async () => {
|
|
9042
9796
|
if (!api.revertDowngrade) {
|
|
9043
9797
|
toast.error("Cancel downgrade is not available in this workspace");
|
|
9044
9798
|
return;
|
|
@@ -9064,7 +9818,7 @@ function BillingContent({
|
|
|
9064
9818
|
setPlanActionInFlight(null);
|
|
9065
9819
|
}
|
|
9066
9820
|
}, [api, fetchBillingOverview, logBillingEvent, toast]);
|
|
9067
|
-
(0,
|
|
9821
|
+
(0, import_react17.useEffect)(() => {
|
|
9068
9822
|
setShowInitialLoader(true);
|
|
9069
9823
|
setInitialFetchTriggered(false);
|
|
9070
9824
|
setBillingOverviewLoaded(false);
|
|
@@ -9074,22 +9828,22 @@ function BillingContent({
|
|
|
9074
9828
|
setTotalCredits(null);
|
|
9075
9829
|
setCustomPlanCredits(null);
|
|
9076
9830
|
}, [workspaceId]);
|
|
9077
|
-
(0,
|
|
9831
|
+
(0, import_react17.useEffect)(() => {
|
|
9078
9832
|
setInitialFetchTriggered(true);
|
|
9079
9833
|
fetchBillingOverview();
|
|
9080
9834
|
fetchUserMap();
|
|
9081
9835
|
}, [fetchBillingOverview, fetchUserMap]);
|
|
9082
9836
|
const usage = workspace.current?.usage ?? null;
|
|
9083
|
-
(0,
|
|
9837
|
+
(0, import_react17.useEffect)(() => {
|
|
9084
9838
|
void logBillingEvent("billing_page_viewed", "Billing page viewed", {
|
|
9085
9839
|
action: "view"
|
|
9086
9840
|
});
|
|
9087
9841
|
}, [logBillingEvent]);
|
|
9088
|
-
(0,
|
|
9842
|
+
(0, import_react17.useEffect)(() => {
|
|
9089
9843
|
setInitialFetchTriggered(true);
|
|
9090
9844
|
fetchTableData(activeTab);
|
|
9091
9845
|
}, [activeTab, fetchTableData]);
|
|
9092
|
-
(0,
|
|
9846
|
+
(0, import_react17.useEffect)(() => {
|
|
9093
9847
|
if (!showInitialLoader) return;
|
|
9094
9848
|
if (!initialFetchTriggered) return;
|
|
9095
9849
|
if (!billingOverviewLoaded) return;
|
|
@@ -9119,7 +9873,7 @@ function BillingContent({
|
|
|
9119
9873
|
preDowngradePlan?.credits ?? currentPlanPrice?.metadata?.credits
|
|
9120
9874
|
);
|
|
9121
9875
|
const currentPlanCredits = Number.isFinite(planCreditsFromPrice) ? planCreditsFromPrice : customPlanCredits;
|
|
9122
|
-
const planCreditsText = currentPlanCredits != null ? `${
|
|
9876
|
+
const planCreditsText = currentPlanCredits != null ? `${formatCredits2(currentPlanCredits)} credits` : "";
|
|
9123
9877
|
const scheduledDowngradeDateLabel = formatEffectiveDateLabel(
|
|
9124
9878
|
subscription?.scheduledDowngradeEffectiveDate
|
|
9125
9879
|
);
|
|
@@ -9128,7 +9882,7 @@ function BillingContent({
|
|
|
9128
9882
|
const usedCredits = availableCredits != null && totalCredits != null ? Math.max(0, totalCredits - availableCredits) : null;
|
|
9129
9883
|
const progressPct = usedCredits != null && totalCredits != null && totalCredits > 0 ? Math.min(100, Math.round(usedCredits / totalCredits * 100)) : 0;
|
|
9130
9884
|
const remainingPct = 100 - progressPct;
|
|
9131
|
-
const usageText = usedCredits != null ?
|
|
9885
|
+
const usageText = usedCredits != null ? formatCredits2(usedCredits) : availableCredits != null ? `${formatCredits2(availableCredits)} available` : customPlanCredits != null ? `${formatCredits2(customPlanCredits)} credits` : "\u2014";
|
|
9132
9886
|
const handleExport = async (startDate, endDate) => {
|
|
9133
9887
|
const end = new Date(endDate);
|
|
9134
9888
|
end.setHours(23, 59, 59, 999);
|
|
@@ -9256,7 +10010,7 @@ function BillingContent({
|
|
|
9256
10010
|
}
|
|
9257
10011
|
}
|
|
9258
10012
|
if (showInitialLoader) {
|
|
9259
|
-
const loader = /* @__PURE__ */ (0,
|
|
10013
|
+
const loader = /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
9260
10014
|
"div",
|
|
9261
10015
|
{
|
|
9262
10016
|
className: "flex items-center justify-center w-full",
|
|
@@ -9266,7 +10020,7 @@ function BillingContent({
|
|
|
9266
10020
|
border: "1px solid var(--alias-border-subtle)",
|
|
9267
10021
|
borderRadius: "var(--radius-3xl)"
|
|
9268
10022
|
},
|
|
9269
|
-
children: /* @__PURE__ */ (0,
|
|
10023
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
9270
10024
|
"div",
|
|
9271
10025
|
{
|
|
9272
10026
|
className: "animate-spin",
|
|
@@ -9282,7 +10036,7 @@ function BillingContent({
|
|
|
9282
10036
|
}
|
|
9283
10037
|
);
|
|
9284
10038
|
if (embedded) return loader;
|
|
9285
|
-
return /* @__PURE__ */ (0,
|
|
10039
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "flex-1 h-full min-h-0 min-w-0 relative", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
9286
10040
|
"div",
|
|
9287
10041
|
{
|
|
9288
10042
|
className: "flex flex-col items-start relative size-full overflow-y-auto",
|
|
@@ -9293,7 +10047,7 @@ function BillingContent({
|
|
|
9293
10047
|
backgroundSize: "24px 24px"
|
|
9294
10048
|
},
|
|
9295
10049
|
children: [
|
|
9296
|
-
/* @__PURE__ */ (0,
|
|
10050
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "flex items-center justify-between shrink-0 w-full", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
9297
10051
|
"p",
|
|
9298
10052
|
{
|
|
9299
10053
|
className: "flex-1 min-w-0 truncate",
|
|
@@ -9312,8 +10066,47 @@ function BillingContent({
|
|
|
9312
10066
|
}
|
|
9313
10067
|
) });
|
|
9314
10068
|
}
|
|
10069
|
+
if (showPerUserLimits) {
|
|
10070
|
+
const limitsView = /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex flex-col flex-1 h-full min-h-0 min-w-0 w-full", style: { gap: 16 }, children: [
|
|
10071
|
+
!onShowPerUserLimitsChange && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
10072
|
+
"div",
|
|
10073
|
+
{
|
|
10074
|
+
className: "flex items-center shrink-0 cursor-pointer",
|
|
10075
|
+
style: {
|
|
10076
|
+
gap: "var(--spacing-sm)",
|
|
10077
|
+
padding: "var(--spacing-xs) var(--spacing-lg)",
|
|
10078
|
+
borderRadius: "var(--radius-xl)",
|
|
10079
|
+
height: 32,
|
|
10080
|
+
width: "fit-content",
|
|
10081
|
+
border: "1px solid var(--alias-border-subtle)",
|
|
10082
|
+
backgroundColor: "var(--alias-surface-base)"
|
|
10083
|
+
},
|
|
10084
|
+
onClick: () => setShowPerUserLimits(false),
|
|
10085
|
+
children: [
|
|
10086
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_icons12.SiconLeft, { className: "w-4 h-4", color: "var(--alias-text---icons-muted)" }),
|
|
10087
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
10088
|
+
"span",
|
|
10089
|
+
{
|
|
10090
|
+
style: {
|
|
10091
|
+
fontFamily: "var(--font-family-font-family-body)",
|
|
10092
|
+
fontSize: "var(--font-size-font-size-sm)",
|
|
10093
|
+
fontWeight: 500,
|
|
10094
|
+
lineHeight: "var(--line-height-line-height-sm)",
|
|
10095
|
+
color: "var(--alias-text---icons-muted)"
|
|
10096
|
+
},
|
|
10097
|
+
children: "Back to billing"
|
|
10098
|
+
}
|
|
10099
|
+
)
|
|
10100
|
+
]
|
|
10101
|
+
}
|
|
10102
|
+
),
|
|
10103
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(PerUserLimitsView, {})
|
|
10104
|
+
] });
|
|
10105
|
+
if (embedded) return limitsView;
|
|
10106
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "flex-1 h-full min-h-0 min-w-0 relative", children: limitsView });
|
|
10107
|
+
}
|
|
9315
10108
|
if (showPlans) {
|
|
9316
|
-
const plansView = /* @__PURE__ */ (0,
|
|
10109
|
+
const plansView = /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
9317
10110
|
PlansView,
|
|
9318
10111
|
{
|
|
9319
10112
|
onBack: () => setShowPlans(false),
|
|
@@ -9330,17 +10123,17 @@ function BillingContent({
|
|
|
9330
10123
|
}
|
|
9331
10124
|
);
|
|
9332
10125
|
if (embedded) return plansView;
|
|
9333
|
-
return /* @__PURE__ */ (0,
|
|
10126
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "flex-1 h-full min-h-0 min-w-0 relative", children: plansView });
|
|
9334
10127
|
}
|
|
9335
|
-
const billingInnerContent = /* @__PURE__ */ (0,
|
|
9336
|
-
/* @__PURE__ */ (0,
|
|
10128
|
+
const billingInnerContent = /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_jsx_runtime22.Fragment, { children: [
|
|
10129
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
9337
10130
|
"div",
|
|
9338
10131
|
{
|
|
9339
10132
|
className: "flex items-start shrink-0 w-full",
|
|
9340
10133
|
style: { gap: 12 },
|
|
9341
10134
|
children: [
|
|
9342
|
-
/* @__PURE__ */ (0,
|
|
9343
|
-
|
|
10135
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
10136
|
+
import_ui11.ScPlanDetailsCard,
|
|
9344
10137
|
{
|
|
9345
10138
|
planName,
|
|
9346
10139
|
planCredits: planCreditsText,
|
|
@@ -9364,12 +10157,12 @@ function BillingContent({
|
|
|
9364
10157
|
}
|
|
9365
10158
|
}
|
|
9366
10159
|
),
|
|
9367
|
-
/* @__PURE__ */ (0,
|
|
9368
|
-
|
|
10160
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
10161
|
+
import_ui11.ScCreditsUsageCard,
|
|
9369
10162
|
{
|
|
9370
10163
|
usageLabel: "Credits used",
|
|
9371
10164
|
usageText,
|
|
9372
|
-
remainingText: availableCredits != null ? `${
|
|
10165
|
+
remainingText: availableCredits != null ? `${formatCredits2(availableCredits)} (${remainingPct}%) Remaining` : `${remainingPct}% Remaining`,
|
|
9373
10166
|
buyButtonText: "Buy credits",
|
|
9374
10167
|
buyButtonState: isFreePlan ? "disabled" : "default",
|
|
9375
10168
|
buyButtonHoverText: isFreePlan ? "Pro plan required" : void 0,
|
|
@@ -9389,7 +10182,7 @@ function BillingContent({
|
|
|
9389
10182
|
]
|
|
9390
10183
|
}
|
|
9391
10184
|
),
|
|
9392
|
-
usage ? /* @__PURE__ */ (0,
|
|
10185
|
+
usage ? /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
9393
10186
|
"div",
|
|
9394
10187
|
{
|
|
9395
10188
|
className: "grid shrink-0 w-full",
|
|
@@ -9398,9 +10191,9 @@ function BillingContent({
|
|
|
9398
10191
|
gridTemplateColumns: "repeat(auto-fit, minmax(18rem, 1fr))"
|
|
9399
10192
|
},
|
|
9400
10193
|
children: [
|
|
9401
|
-
/* @__PURE__ */ (0,
|
|
9402
|
-
/* @__PURE__ */ (0,
|
|
9403
|
-
|
|
10194
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_ui11.ScUsageMeterCard, { kind: "storage", plan: usage.plan, status: usage.storage }),
|
|
10195
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
10196
|
+
import_ui11.ScUsageMeterCard,
|
|
9404
10197
|
{
|
|
9405
10198
|
kind: "bandwidth",
|
|
9406
10199
|
plan: usage.plan,
|
|
@@ -9411,9 +10204,60 @@ function BillingContent({
|
|
|
9411
10204
|
]
|
|
9412
10205
|
}
|
|
9413
10206
|
) : null,
|
|
9414
|
-
/* @__PURE__ */ (0,
|
|
9415
|
-
|
|
9416
|
-
|
|
10207
|
+
api.fetchMemberCreditLimits ? /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
10208
|
+
"div",
|
|
10209
|
+
{
|
|
10210
|
+
className: "flex items-center justify-between shrink-0 w-full",
|
|
10211
|
+
style: {
|
|
10212
|
+
gap: 12,
|
|
10213
|
+
padding: 16,
|
|
10214
|
+
backgroundColor: "var(--alias-surface-base)",
|
|
10215
|
+
border: "1px solid var(--alias-border-subtle)",
|
|
10216
|
+
borderRadius: "var(--radius-3xl)"
|
|
10217
|
+
},
|
|
10218
|
+
children: [
|
|
10219
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex flex-col min-w-0", style: { gap: 4 }, children: [
|
|
10220
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
10221
|
+
"span",
|
|
10222
|
+
{
|
|
10223
|
+
style: {
|
|
10224
|
+
fontFamily: "var(--font-family-font-family-body)",
|
|
10225
|
+
fontSize: "var(--font-size-font-size-sm)",
|
|
10226
|
+
fontWeight: 500,
|
|
10227
|
+
lineHeight: "var(--line-height-line-height-sm)",
|
|
10228
|
+
color: "var(--alias-text---icons-primary)"
|
|
10229
|
+
},
|
|
10230
|
+
children: "Per-user usage limits"
|
|
10231
|
+
}
|
|
10232
|
+
),
|
|
10233
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
10234
|
+
"span",
|
|
10235
|
+
{
|
|
10236
|
+
style: {
|
|
10237
|
+
fontFamily: "var(--font-family-font-family-body)",
|
|
10238
|
+
fontSize: "var(--font-size-font-size-sm)",
|
|
10239
|
+
lineHeight: "var(--line-height-line-height-sm)",
|
|
10240
|
+
color: "var(--alias-text---icons-muted)"
|
|
10241
|
+
},
|
|
10242
|
+
children: "Set a default and per-member limits on credits per billing cycle"
|
|
10243
|
+
}
|
|
10244
|
+
)
|
|
10245
|
+
] }),
|
|
10246
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
10247
|
+
import_ui11.ScButton,
|
|
10248
|
+
{
|
|
10249
|
+
text: "Manage",
|
|
10250
|
+
variant: "secondary",
|
|
10251
|
+
size: "md",
|
|
10252
|
+
onClick: () => setShowPerUserLimits(true)
|
|
10253
|
+
}
|
|
10254
|
+
)
|
|
10255
|
+
]
|
|
10256
|
+
}
|
|
10257
|
+
) : null,
|
|
10258
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex items-center justify-between shrink-0 w-full", children: [
|
|
10259
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(BillingTabBar, { activeTab, onTabChange: setActiveTab }),
|
|
10260
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
9417
10261
|
"div",
|
|
9418
10262
|
{
|
|
9419
10263
|
className: "flex items-center shrink-0 cursor-pointer",
|
|
@@ -9425,8 +10269,8 @@ function BillingContent({
|
|
|
9425
10269
|
},
|
|
9426
10270
|
onClick: () => setShowExportModal(true),
|
|
9427
10271
|
children: [
|
|
9428
|
-
/* @__PURE__ */ (0,
|
|
9429
|
-
/* @__PURE__ */ (0,
|
|
10272
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_icons12.SiconDownload, { className: "w-5 h-5", color: PRIMARY_COLOR2 }),
|
|
10273
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
9430
10274
|
"span",
|
|
9431
10275
|
{
|
|
9432
10276
|
style: {
|
|
@@ -9443,14 +10287,14 @@ function BillingContent({
|
|
|
9443
10287
|
}
|
|
9444
10288
|
)
|
|
9445
10289
|
] }),
|
|
9446
|
-
activeTab === "invoice" ? /* @__PURE__ */ (0,
|
|
10290
|
+
activeTab === "invoice" ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
9447
10291
|
InvoiceHistoryTable,
|
|
9448
10292
|
{
|
|
9449
10293
|
invoices,
|
|
9450
10294
|
loading: loadingTable,
|
|
9451
10295
|
workspaceCountry: workspace.current?.country
|
|
9452
10296
|
}
|
|
9453
|
-
) : /* @__PURE__ */ (0,
|
|
10297
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
9454
10298
|
UsageLogsTable,
|
|
9455
10299
|
{
|
|
9456
10300
|
logs: usageLogs,
|
|
@@ -9458,7 +10302,7 @@ function BillingContent({
|
|
|
9458
10302
|
loading: loadingTable
|
|
9459
10303
|
}
|
|
9460
10304
|
),
|
|
9461
|
-
showExportModal && /* @__PURE__ */ (0,
|
|
10305
|
+
showExportModal && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
9462
10306
|
ExportDateModal,
|
|
9463
10307
|
{
|
|
9464
10308
|
title: activeTab === "invoice" ? "Export invoices" : "Export log",
|
|
@@ -9466,7 +10310,7 @@ function BillingContent({
|
|
|
9466
10310
|
onExport: handleExport
|
|
9467
10311
|
}
|
|
9468
10312
|
),
|
|
9469
|
-
showBuyCreditsModal && /* @__PURE__ */ (0,
|
|
10313
|
+
showBuyCreditsModal && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
9470
10314
|
BuyCreditsModal,
|
|
9471
10315
|
{
|
|
9472
10316
|
country: workspace.current?.country,
|
|
@@ -9481,7 +10325,7 @@ function BillingContent({
|
|
|
9481
10325
|
)
|
|
9482
10326
|
] });
|
|
9483
10327
|
if (embedded) {
|
|
9484
|
-
return /* @__PURE__ */ (0,
|
|
10328
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
9485
10329
|
"div",
|
|
9486
10330
|
{
|
|
9487
10331
|
className: "flex flex-col flex-1 min-w-0 min-h-0 w-full",
|
|
@@ -9490,7 +10334,7 @@ function BillingContent({
|
|
|
9490
10334
|
}
|
|
9491
10335
|
);
|
|
9492
10336
|
}
|
|
9493
|
-
return /* @__PURE__ */ (0,
|
|
10337
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "flex-1 h-full min-h-0 min-w-0 relative", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
9494
10338
|
"div",
|
|
9495
10339
|
{
|
|
9496
10340
|
className: "flex flex-col items-start relative size-full overflow-y-auto",
|
|
@@ -9501,7 +10345,7 @@ function BillingContent({
|
|
|
9501
10345
|
backgroundSize: "24px 24px"
|
|
9502
10346
|
},
|
|
9503
10347
|
children: [
|
|
9504
|
-
/* @__PURE__ */ (0,
|
|
10348
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "flex items-center justify-between shrink-0 w-full", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
9505
10349
|
"p",
|
|
9506
10350
|
{
|
|
9507
10351
|
className: "flex-1 min-w-0 truncate",
|
|
@@ -9522,10 +10366,10 @@ function BillingContent({
|
|
|
9522
10366
|
}
|
|
9523
10367
|
|
|
9524
10368
|
// src/tokens-content.tsx
|
|
9525
|
-
var
|
|
9526
|
-
var
|
|
9527
|
-
var
|
|
9528
|
-
var
|
|
10369
|
+
var import_react18 = require("react");
|
|
10370
|
+
var import_ui12 = require("@streamoid/ui");
|
|
10371
|
+
var import_icons13 = require("@streamoid/icons");
|
|
10372
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
9529
10373
|
var EXPIRY_OPTIONS = [
|
|
9530
10374
|
{ label: "30 days", value: "30d" },
|
|
9531
10375
|
{ label: "60 days", value: "60d" },
|
|
@@ -9545,7 +10389,7 @@ function isExpired(expiresAt) {
|
|
|
9545
10389
|
if (!expiresAt) return false;
|
|
9546
10390
|
return /* @__PURE__ */ new Date() > new Date(expiresAt);
|
|
9547
10391
|
}
|
|
9548
|
-
var
|
|
10392
|
+
var T14 = {
|
|
9549
10393
|
primary: "var(--alias-text---icons-primary)",
|
|
9550
10394
|
muted: "var(--alias-text---icons-muted)",
|
|
9551
10395
|
warning: "var(--alias-text---icons-warning)",
|
|
@@ -9567,9 +10411,9 @@ var T12 = {
|
|
|
9567
10411
|
};
|
|
9568
10412
|
function CreateTokenModal({ onClose, onCreated }) {
|
|
9569
10413
|
const { api, toast } = useSettingsAdapters();
|
|
9570
|
-
const [name, setName] = (0,
|
|
9571
|
-
const [expiry, setExpiry] = (0,
|
|
9572
|
-
const [loading, setLoading] = (0,
|
|
10414
|
+
const [name, setName] = (0, import_react18.useState)("");
|
|
10415
|
+
const [expiry, setExpiry] = (0, import_react18.useState)("never");
|
|
10416
|
+
const [loading, setLoading] = (0, import_react18.useState)(false);
|
|
9573
10417
|
async function handleCreate() {
|
|
9574
10418
|
if (!name.trim()) {
|
|
9575
10419
|
toast.error("Token name is required.");
|
|
@@ -9585,96 +10429,96 @@ function CreateTokenModal({ onClose, onCreated }) {
|
|
|
9585
10429
|
setLoading(false);
|
|
9586
10430
|
}
|
|
9587
10431
|
}
|
|
9588
|
-
return /* @__PURE__ */ (0,
|
|
10432
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
9589
10433
|
"div",
|
|
9590
10434
|
{
|
|
9591
10435
|
className: "fixed inset-0 flex items-center justify-center",
|
|
9592
10436
|
style: { backgroundColor: "rgba(0,0,0,0.6)", zIndex: 1e3 },
|
|
9593
10437
|
onClick: onClose,
|
|
9594
|
-
children: /* @__PURE__ */ (0,
|
|
10438
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
9595
10439
|
"div",
|
|
9596
10440
|
{
|
|
9597
10441
|
className: "flex flex-col items-start relative",
|
|
9598
10442
|
style: {
|
|
9599
|
-
backgroundColor:
|
|
9600
|
-
borderRadius:
|
|
10443
|
+
backgroundColor: T14.neutral825,
|
|
10444
|
+
borderRadius: T14.r4xl,
|
|
9601
10445
|
width: "min(40vw, 500px)",
|
|
9602
|
-
border: `1px solid ${
|
|
10446
|
+
border: `1px solid ${T14.borderSubtle}`
|
|
9603
10447
|
},
|
|
9604
10448
|
onClick: (e) => e.stopPropagation(),
|
|
9605
10449
|
children: [
|
|
9606
|
-
/* @__PURE__ */ (0,
|
|
10450
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
9607
10451
|
"div",
|
|
9608
10452
|
{
|
|
9609
10453
|
className: "relative shrink-0 w-full",
|
|
9610
|
-
style: { borderBottom: `1px solid ${
|
|
9611
|
-
children: /* @__PURE__ */ (0,
|
|
10454
|
+
style: { borderBottom: `1px solid ${T14.borderDivider}` },
|
|
10455
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
9612
10456
|
"div",
|
|
9613
10457
|
{
|
|
9614
10458
|
className: "flex items-center w-full",
|
|
9615
|
-
style: { padding: `${
|
|
10459
|
+
style: { padding: `${T14.spXl} ${T14.sp3xl}` },
|
|
9616
10460
|
children: [
|
|
9617
|
-
/* @__PURE__ */ (0,
|
|
10461
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
9618
10462
|
"p",
|
|
9619
10463
|
{
|
|
9620
10464
|
className: "flex-1 min-w-0 truncate",
|
|
9621
10465
|
style: {
|
|
9622
|
-
fontFamily:
|
|
9623
|
-
fontSize:
|
|
10466
|
+
fontFamily: T14.fontDisplay,
|
|
10467
|
+
fontSize: T14.fsLg,
|
|
9624
10468
|
fontWeight: 600,
|
|
9625
|
-
lineHeight:
|
|
9626
|
-
color:
|
|
10469
|
+
lineHeight: T14.lhLg,
|
|
10470
|
+
color: T14.primary,
|
|
9627
10471
|
margin: 0
|
|
9628
10472
|
},
|
|
9629
10473
|
children: "Create New Token"
|
|
9630
10474
|
}
|
|
9631
10475
|
),
|
|
9632
|
-
/* @__PURE__ */ (0,
|
|
10476
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "cursor-pointer", onClick: onClose, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_icons13.SiconClose, { className: "w-6 h-6", color: T14.primary }) })
|
|
9633
10477
|
]
|
|
9634
10478
|
}
|
|
9635
10479
|
)
|
|
9636
10480
|
}
|
|
9637
10481
|
),
|
|
9638
|
-
/* @__PURE__ */ (0,
|
|
10482
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
9639
10483
|
"div",
|
|
9640
10484
|
{
|
|
9641
10485
|
className: "flex flex-col items-start shrink-0 w-full",
|
|
9642
|
-
style: { padding:
|
|
10486
|
+
style: { padding: T14.sp3xl, gap: T14.sp3xl },
|
|
9643
10487
|
children: [
|
|
9644
|
-
/* @__PURE__ */ (0,
|
|
10488
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
9645
10489
|
"div",
|
|
9646
10490
|
{
|
|
9647
10491
|
className: "flex flex-col items-start shrink-0 w-full",
|
|
9648
10492
|
style: { gap: "var(--spacing-xs)" },
|
|
9649
10493
|
children: [
|
|
9650
|
-
/* @__PURE__ */ (0,
|
|
10494
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "flex items-center shrink-0 w-full", style: { height: 24 }, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
9651
10495
|
"span",
|
|
9652
10496
|
{
|
|
9653
10497
|
style: {
|
|
9654
|
-
fontFamily:
|
|
9655
|
-
fontSize:
|
|
10498
|
+
fontFamily: T14.font,
|
|
10499
|
+
fontSize: T14.fsSm,
|
|
9656
10500
|
fontWeight: 400,
|
|
9657
|
-
lineHeight:
|
|
9658
|
-
color:
|
|
10501
|
+
lineHeight: T14.lhSm,
|
|
10502
|
+
color: T14.muted
|
|
9659
10503
|
},
|
|
9660
10504
|
children: "Token name"
|
|
9661
10505
|
}
|
|
9662
10506
|
) }),
|
|
9663
|
-
/* @__PURE__ */ (0,
|
|
10507
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
9664
10508
|
"div",
|
|
9665
10509
|
{
|
|
9666
10510
|
className: "shrink-0 w-full",
|
|
9667
10511
|
style: {
|
|
9668
|
-
backgroundColor:
|
|
9669
|
-
borderRadius:
|
|
10512
|
+
backgroundColor: T14.neutral875,
|
|
10513
|
+
borderRadius: T14.rXl,
|
|
9670
10514
|
height: 48
|
|
9671
10515
|
},
|
|
9672
|
-
children: /* @__PURE__ */ (0,
|
|
10516
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
9673
10517
|
"div",
|
|
9674
10518
|
{
|
|
9675
10519
|
className: "flex items-center size-full",
|
|
9676
|
-
style: { padding: `var(--spacing-lg) ${
|
|
9677
|
-
children: /* @__PURE__ */ (0,
|
|
10520
|
+
style: { padding: `var(--spacing-lg) ${T14.spXl}` },
|
|
10521
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
9678
10522
|
"input",
|
|
9679
10523
|
{
|
|
9680
10524
|
type: "text",
|
|
@@ -9683,11 +10527,11 @@ function CreateTokenModal({ onClose, onCreated }) {
|
|
|
9683
10527
|
placeholder: "Name your token...",
|
|
9684
10528
|
className: "flex-1 min-w-0 bg-transparent border-none outline-none",
|
|
9685
10529
|
style: {
|
|
9686
|
-
fontFamily:
|
|
9687
|
-
fontSize:
|
|
10530
|
+
fontFamily: T14.font,
|
|
10531
|
+
fontSize: T14.fsSm,
|
|
9688
10532
|
fontWeight: 400,
|
|
9689
|
-
lineHeight:
|
|
9690
|
-
color: name ?
|
|
10533
|
+
lineHeight: T14.lhSm,
|
|
10534
|
+
color: name ? T14.primary : T14.neutral500
|
|
9691
10535
|
}
|
|
9692
10536
|
}
|
|
9693
10537
|
)
|
|
@@ -9698,27 +10542,27 @@ function CreateTokenModal({ onClose, onCreated }) {
|
|
|
9698
10542
|
]
|
|
9699
10543
|
}
|
|
9700
10544
|
),
|
|
9701
|
-
/* @__PURE__ */ (0,
|
|
10545
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
9702
10546
|
"div",
|
|
9703
10547
|
{
|
|
9704
10548
|
className: "flex flex-col items-start shrink-0 w-full",
|
|
9705
10549
|
style: { gap: "var(--spacing-xs)" },
|
|
9706
10550
|
children: [
|
|
9707
|
-
/* @__PURE__ */ (0,
|
|
10551
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "flex items-center shrink-0 w-full", style: { height: 24 }, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
9708
10552
|
"span",
|
|
9709
10553
|
{
|
|
9710
10554
|
style: {
|
|
9711
|
-
fontFamily:
|
|
9712
|
-
fontSize:
|
|
10555
|
+
fontFamily: T14.font,
|
|
10556
|
+
fontSize: T14.fsSm,
|
|
9713
10557
|
fontWeight: 400,
|
|
9714
|
-
lineHeight:
|
|
9715
|
-
color:
|
|
10558
|
+
lineHeight: T14.lhSm,
|
|
10559
|
+
color: T14.muted
|
|
9716
10560
|
},
|
|
9717
10561
|
children: "Expiry"
|
|
9718
10562
|
}
|
|
9719
10563
|
) }),
|
|
9720
|
-
/* @__PURE__ */ (0,
|
|
9721
|
-
|
|
10564
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { style: { display: "flex", gap: "var(--spacing-md)", flexWrap: "wrap" }, children: EXPIRY_OPTIONS.map((opt) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
10565
|
+
import_ui12.ScButton,
|
|
9722
10566
|
{
|
|
9723
10567
|
text: opt.label,
|
|
9724
10568
|
variant: expiry === opt.value ? "secondary" : "outline",
|
|
@@ -9730,8 +10574,8 @@ function CreateTokenModal({ onClose, onCreated }) {
|
|
|
9730
10574
|
]
|
|
9731
10575
|
}
|
|
9732
10576
|
),
|
|
9733
|
-
/* @__PURE__ */ (0,
|
|
9734
|
-
|
|
10577
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
10578
|
+
import_ui12.ScButton,
|
|
9735
10579
|
{
|
|
9736
10580
|
text: loading ? "Creating..." : "Create token",
|
|
9737
10581
|
variant: "secondary",
|
|
@@ -9752,7 +10596,7 @@ function CreateTokenModal({ onClose, onCreated }) {
|
|
|
9752
10596
|
}
|
|
9753
10597
|
function TokenCreatedModal({ token, onClose }) {
|
|
9754
10598
|
const { toast } = useSettingsAdapters();
|
|
9755
|
-
const [copied, setCopied] = (0,
|
|
10599
|
+
const [copied, setCopied] = (0, import_react18.useState)(false);
|
|
9756
10600
|
function handleCopy() {
|
|
9757
10601
|
navigator.clipboard.writeText(token.token).then(() => {
|
|
9758
10602
|
setCopied(true);
|
|
@@ -9762,101 +10606,101 @@ function TokenCreatedModal({ token, onClose }) {
|
|
|
9762
10606
|
toast.error("Failed to copy token. Please copy it manually.");
|
|
9763
10607
|
});
|
|
9764
10608
|
}
|
|
9765
|
-
return /* @__PURE__ */ (0,
|
|
10609
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
9766
10610
|
"div",
|
|
9767
10611
|
{
|
|
9768
10612
|
className: "fixed inset-0 flex items-center justify-center",
|
|
9769
10613
|
style: { backgroundColor: "rgba(0,0,0,0.6)", zIndex: 1e3 },
|
|
9770
|
-
children: /* @__PURE__ */ (0,
|
|
10614
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
9771
10615
|
"div",
|
|
9772
10616
|
{
|
|
9773
10617
|
className: "flex flex-col items-start relative",
|
|
9774
10618
|
style: {
|
|
9775
|
-
backgroundColor:
|
|
9776
|
-
borderRadius:
|
|
10619
|
+
backgroundColor: T14.neutral825,
|
|
10620
|
+
borderRadius: T14.r4xl,
|
|
9777
10621
|
width: "min(40vw, 500px)",
|
|
9778
|
-
border: `1px solid ${
|
|
10622
|
+
border: `1px solid ${T14.borderSubtle}`
|
|
9779
10623
|
},
|
|
9780
10624
|
children: [
|
|
9781
|
-
/* @__PURE__ */ (0,
|
|
10625
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
9782
10626
|
"div",
|
|
9783
10627
|
{
|
|
9784
10628
|
className: "relative shrink-0 w-full",
|
|
9785
|
-
style: { borderBottom: `1px solid ${
|
|
9786
|
-
children: /* @__PURE__ */ (0,
|
|
10629
|
+
style: { borderBottom: `1px solid ${T14.borderDivider}` },
|
|
10630
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
9787
10631
|
"div",
|
|
9788
10632
|
{
|
|
9789
10633
|
className: "flex items-center w-full",
|
|
9790
|
-
style: { padding: `${
|
|
10634
|
+
style: { padding: `${T14.spXl} ${T14.sp3xl}` },
|
|
9791
10635
|
children: [
|
|
9792
|
-
/* @__PURE__ */ (0,
|
|
10636
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
9793
10637
|
"p",
|
|
9794
10638
|
{
|
|
9795
10639
|
className: "flex-1 min-w-0 truncate",
|
|
9796
10640
|
style: {
|
|
9797
|
-
fontFamily:
|
|
9798
|
-
fontSize:
|
|
10641
|
+
fontFamily: T14.fontDisplay,
|
|
10642
|
+
fontSize: T14.fsLg,
|
|
9799
10643
|
fontWeight: 600,
|
|
9800
|
-
lineHeight:
|
|
9801
|
-
color:
|
|
10644
|
+
lineHeight: T14.lhLg,
|
|
10645
|
+
color: T14.primary,
|
|
9802
10646
|
margin: 0
|
|
9803
10647
|
},
|
|
9804
10648
|
children: "Token Created"
|
|
9805
10649
|
}
|
|
9806
10650
|
),
|
|
9807
|
-
/* @__PURE__ */ (0,
|
|
10651
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "cursor-pointer", onClick: onClose, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_icons13.SiconClose, { className: "w-6 h-6", color: T14.primary }) })
|
|
9808
10652
|
]
|
|
9809
10653
|
}
|
|
9810
10654
|
)
|
|
9811
10655
|
}
|
|
9812
10656
|
),
|
|
9813
|
-
/* @__PURE__ */ (0,
|
|
10657
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
9814
10658
|
"div",
|
|
9815
10659
|
{
|
|
9816
10660
|
className: "flex flex-col items-start shrink-0 w-full",
|
|
9817
|
-
style: { padding:
|
|
10661
|
+
style: { padding: T14.sp3xl, gap: T14.sp3xl },
|
|
9818
10662
|
children: [
|
|
9819
|
-
/* @__PURE__ */ (0,
|
|
10663
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
9820
10664
|
"p",
|
|
9821
10665
|
{
|
|
9822
10666
|
style: {
|
|
9823
|
-
fontFamily:
|
|
9824
|
-
fontSize:
|
|
10667
|
+
fontFamily: T14.font,
|
|
10668
|
+
fontSize: T14.fsSm,
|
|
9825
10669
|
fontWeight: 400,
|
|
9826
|
-
lineHeight:
|
|
9827
|
-
color:
|
|
10670
|
+
lineHeight: T14.lhSm,
|
|
10671
|
+
color: T14.warning,
|
|
9828
10672
|
margin: 0
|
|
9829
10673
|
},
|
|
9830
10674
|
children: "Copy this token now. You won't be able to see it again."
|
|
9831
10675
|
}
|
|
9832
10676
|
),
|
|
9833
|
-
/* @__PURE__ */ (0,
|
|
10677
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
9834
10678
|
"div",
|
|
9835
10679
|
{
|
|
9836
10680
|
className: "w-full",
|
|
9837
10681
|
style: {
|
|
9838
|
-
backgroundColor:
|
|
9839
|
-
borderRadius:
|
|
9840
|
-
padding: `var(--spacing-lg) ${
|
|
10682
|
+
backgroundColor: T14.neutral875,
|
|
10683
|
+
borderRadius: T14.rXl,
|
|
10684
|
+
padding: `var(--spacing-lg) ${T14.spXl}`
|
|
9841
10685
|
},
|
|
9842
|
-
children: /* @__PURE__ */ (0,
|
|
10686
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
9843
10687
|
"code",
|
|
9844
10688
|
{
|
|
9845
10689
|
style: {
|
|
9846
10690
|
fontFamily: "monospace",
|
|
9847
|
-
fontSize:
|
|
9848
|
-
color:
|
|
10691
|
+
fontSize: T14.fsSm,
|
|
10692
|
+
color: T14.primary,
|
|
9849
10693
|
wordBreak: "break-all",
|
|
9850
|
-
lineHeight:
|
|
10694
|
+
lineHeight: T14.lhSm
|
|
9851
10695
|
},
|
|
9852
10696
|
children: token.token
|
|
9853
10697
|
}
|
|
9854
10698
|
)
|
|
9855
10699
|
}
|
|
9856
10700
|
),
|
|
9857
|
-
/* @__PURE__ */ (0,
|
|
9858
|
-
/* @__PURE__ */ (0,
|
|
9859
|
-
|
|
10701
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { style: { display: "flex", gap: "var(--spacing-md)", width: "100%" }, children: [
|
|
10702
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
10703
|
+
import_ui12.ScButton,
|
|
9860
10704
|
{
|
|
9861
10705
|
text: copied ? "Copied!" : "Copy token",
|
|
9862
10706
|
variant: "secondary",
|
|
@@ -9865,8 +10709,8 @@ function TokenCreatedModal({ token, onClose }) {
|
|
|
9865
10709
|
className: "flex-1"
|
|
9866
10710
|
}
|
|
9867
10711
|
),
|
|
9868
|
-
/* @__PURE__ */ (0,
|
|
9869
|
-
|
|
10712
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
10713
|
+
import_ui12.ScButton,
|
|
9870
10714
|
{
|
|
9871
10715
|
text: "Done",
|
|
9872
10716
|
variant: "outline",
|
|
@@ -9893,22 +10737,22 @@ function TokensContent({
|
|
|
9893
10737
|
onCreateOpenChange
|
|
9894
10738
|
} = {}) {
|
|
9895
10739
|
const { api, toast } = useSettingsAdapters();
|
|
9896
|
-
const [tokens, setTokens] = (0,
|
|
9897
|
-
const [loading, setLoading] = (0,
|
|
9898
|
-
const [showRevoked, setShowRevoked] = (0,
|
|
9899
|
-
const [showCreateModal, setShowCreateModal] = (0,
|
|
9900
|
-
const [createdToken, setCreatedToken] = (0,
|
|
9901
|
-
const [deletingId, setDeletingId] = (0,
|
|
9902
|
-
(0,
|
|
10740
|
+
const [tokens, setTokens] = (0, import_react18.useState)([]);
|
|
10741
|
+
const [loading, setLoading] = (0, import_react18.useState)(true);
|
|
10742
|
+
const [showRevoked, setShowRevoked] = (0, import_react18.useState)(false);
|
|
10743
|
+
const [showCreateModal, setShowCreateModal] = (0, import_react18.useState)(false);
|
|
10744
|
+
const [createdToken, setCreatedToken] = (0, import_react18.useState)(null);
|
|
10745
|
+
const [deletingId, setDeletingId] = (0, import_react18.useState)(null);
|
|
10746
|
+
(0, import_react18.useEffect)(() => {
|
|
9903
10747
|
if (showRevokedOverride !== void 0) setShowRevoked(showRevokedOverride);
|
|
9904
10748
|
}, [showRevokedOverride]);
|
|
9905
|
-
(0,
|
|
10749
|
+
(0, import_react18.useEffect)(() => {
|
|
9906
10750
|
if (createOpenOverride) {
|
|
9907
10751
|
setShowCreateModal(true);
|
|
9908
10752
|
onCreateOpenChange?.(false);
|
|
9909
10753
|
}
|
|
9910
10754
|
}, [createOpenOverride, onCreateOpenChange]);
|
|
9911
|
-
const fetchTokens = (0,
|
|
10755
|
+
const fetchTokens = (0, import_react18.useCallback)(async () => {
|
|
9912
10756
|
setLoading(true);
|
|
9913
10757
|
try {
|
|
9914
10758
|
const data = await api.fetchTokens({ showRevoked });
|
|
@@ -9919,7 +10763,7 @@ function TokensContent({
|
|
|
9919
10763
|
setLoading(false);
|
|
9920
10764
|
}
|
|
9921
10765
|
}, [api, showRevoked]);
|
|
9922
|
-
(0,
|
|
10766
|
+
(0, import_react18.useEffect)(() => {
|
|
9923
10767
|
fetchTokens();
|
|
9924
10768
|
}, [fetchTokens]);
|
|
9925
10769
|
async function handleRevoke(tokenId) {
|
|
@@ -9957,8 +10801,8 @@ function TokensContent({
|
|
|
9957
10801
|
setCreatedToken(token);
|
|
9958
10802
|
fetchTokens();
|
|
9959
10803
|
}
|
|
9960
|
-
const tokensInnerContent = /* @__PURE__ */ (0,
|
|
9961
|
-
!embedded && /* @__PURE__ */ (0,
|
|
10804
|
+
const tokensInnerContent = /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
|
|
10805
|
+
!embedded && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
9962
10806
|
"div",
|
|
9963
10807
|
{
|
|
9964
10808
|
style: {
|
|
@@ -9970,8 +10814,8 @@ function TokensContent({
|
|
|
9970
10814
|
gap: "var(--spacing-md)"
|
|
9971
10815
|
},
|
|
9972
10816
|
children: [
|
|
9973
|
-
/* @__PURE__ */ (0,
|
|
9974
|
-
|
|
10817
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
10818
|
+
import_ui12.ScButton,
|
|
9975
10819
|
{
|
|
9976
10820
|
text: showRevoked ? "Hide Revoked" : "Show Revoked",
|
|
9977
10821
|
variant: "outline",
|
|
@@ -9979,21 +10823,21 @@ function TokensContent({
|
|
|
9979
10823
|
onClick: () => setShowRevoked((v) => !v)
|
|
9980
10824
|
}
|
|
9981
10825
|
),
|
|
9982
|
-
/* @__PURE__ */ (0,
|
|
9983
|
-
|
|
10826
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
10827
|
+
import_ui12.ScButton,
|
|
9984
10828
|
{
|
|
9985
10829
|
text: "New Token",
|
|
9986
10830
|
variant: "primary",
|
|
9987
10831
|
size: "md",
|
|
9988
10832
|
styleVariant: "icon-left",
|
|
9989
|
-
icon: /* @__PURE__ */ (0,
|
|
10833
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_icons13.SiconPlus, {}),
|
|
9990
10834
|
onClick: () => setShowCreateModal(true)
|
|
9991
10835
|
}
|
|
9992
10836
|
)
|
|
9993
10837
|
]
|
|
9994
10838
|
}
|
|
9995
10839
|
),
|
|
9996
|
-
loading ? /* @__PURE__ */ (0,
|
|
10840
|
+
loading ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
9997
10841
|
"div",
|
|
9998
10842
|
{
|
|
9999
10843
|
style: {
|
|
@@ -10007,7 +10851,7 @@ function TokensContent({
|
|
|
10007
10851
|
},
|
|
10008
10852
|
children: "Loading tokens..."
|
|
10009
10853
|
}
|
|
10010
|
-
) : tokens.length === 0 ? /* @__PURE__ */ (0,
|
|
10854
|
+
) : tokens.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
10011
10855
|
"div",
|
|
10012
10856
|
{
|
|
10013
10857
|
style: {
|
|
@@ -10019,8 +10863,8 @@ function TokensContent({
|
|
|
10019
10863
|
gap: "var(--spacing-xl)"
|
|
10020
10864
|
},
|
|
10021
10865
|
children: [
|
|
10022
|
-
/* @__PURE__ */ (0,
|
|
10023
|
-
/* @__PURE__ */ (0,
|
|
10866
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(SiconKey_default, { size: 48, color: "var(--alias-text---icons-muted)", strokeWidth: 1 }),
|
|
10867
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
10024
10868
|
"p",
|
|
10025
10869
|
{
|
|
10026
10870
|
style: {
|
|
@@ -10034,7 +10878,7 @@ function TokensContent({
|
|
|
10034
10878
|
)
|
|
10035
10879
|
]
|
|
10036
10880
|
}
|
|
10037
|
-
) : /* @__PURE__ */ (0,
|
|
10881
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
10038
10882
|
TokenTable,
|
|
10039
10883
|
{
|
|
10040
10884
|
tokens,
|
|
@@ -10043,14 +10887,14 @@ function TokensContent({
|
|
|
10043
10887
|
onDelete: handleDelete
|
|
10044
10888
|
}
|
|
10045
10889
|
),
|
|
10046
|
-
showCreateModal && /* @__PURE__ */ (0,
|
|
10890
|
+
showCreateModal && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
10047
10891
|
CreateTokenModal,
|
|
10048
10892
|
{
|
|
10049
10893
|
onClose: () => setShowCreateModal(false),
|
|
10050
10894
|
onCreated: handleTokenCreated
|
|
10051
10895
|
}
|
|
10052
10896
|
),
|
|
10053
|
-
createdToken && /* @__PURE__ */ (0,
|
|
10897
|
+
createdToken && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
10054
10898
|
TokenCreatedModal,
|
|
10055
10899
|
{
|
|
10056
10900
|
token: createdToken,
|
|
@@ -10059,7 +10903,7 @@ function TokensContent({
|
|
|
10059
10903
|
)
|
|
10060
10904
|
] });
|
|
10061
10905
|
if (embedded) {
|
|
10062
|
-
return /* @__PURE__ */ (0,
|
|
10906
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
10063
10907
|
"div",
|
|
10064
10908
|
{
|
|
10065
10909
|
className: "flex flex-col flex-1 min-w-0 min-h-0 w-full",
|
|
@@ -10068,7 +10912,7 @@ function TokensContent({
|
|
|
10068
10912
|
}
|
|
10069
10913
|
);
|
|
10070
10914
|
}
|
|
10071
|
-
return /* @__PURE__ */ (0,
|
|
10915
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "flex-1 min-h-0 min-w-0 relative", style: { height: "100%" }, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
10072
10916
|
"div",
|
|
10073
10917
|
{
|
|
10074
10918
|
className: "flex flex-col items-stretch size-full overflow-y-auto",
|
|
@@ -10079,7 +10923,7 @@ function TokensContent({
|
|
|
10079
10923
|
backgroundSize: "24px 24px"
|
|
10080
10924
|
},
|
|
10081
10925
|
children: [
|
|
10082
|
-
/* @__PURE__ */ (0,
|
|
10926
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
10083
10927
|
"div",
|
|
10084
10928
|
{
|
|
10085
10929
|
style: {
|
|
@@ -10090,7 +10934,7 @@ function TokensContent({
|
|
|
10090
10934
|
width: "100%"
|
|
10091
10935
|
},
|
|
10092
10936
|
children: [
|
|
10093
|
-
/* @__PURE__ */ (0,
|
|
10937
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
10094
10938
|
"p",
|
|
10095
10939
|
{
|
|
10096
10940
|
style: {
|
|
@@ -10104,9 +10948,9 @@ function TokensContent({
|
|
|
10104
10948
|
children: "API Tokens"
|
|
10105
10949
|
}
|
|
10106
10950
|
),
|
|
10107
|
-
/* @__PURE__ */ (0,
|
|
10108
|
-
/* @__PURE__ */ (0,
|
|
10109
|
-
|
|
10951
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { style: { display: "flex", gap: "var(--spacing-md)", alignItems: "center" }, children: [
|
|
10952
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
10953
|
+
import_ui12.ScButton,
|
|
10110
10954
|
{
|
|
10111
10955
|
text: showRevoked ? "Hide Revoked" : "Show Revoked",
|
|
10112
10956
|
variant: "outline",
|
|
@@ -10114,14 +10958,14 @@ function TokensContent({
|
|
|
10114
10958
|
onClick: () => setShowRevoked((v) => !v)
|
|
10115
10959
|
}
|
|
10116
10960
|
),
|
|
10117
|
-
/* @__PURE__ */ (0,
|
|
10118
|
-
|
|
10961
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
10962
|
+
import_ui12.ScButton,
|
|
10119
10963
|
{
|
|
10120
10964
|
text: "New Token",
|
|
10121
10965
|
variant: "primary",
|
|
10122
10966
|
size: "md",
|
|
10123
10967
|
styleVariant: "icon-left",
|
|
10124
|
-
icon: /* @__PURE__ */ (0,
|
|
10968
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_icons13.SiconPlus, {}),
|
|
10125
10969
|
onClick: () => setShowCreateModal(true)
|
|
10126
10970
|
}
|
|
10127
10971
|
)
|
|
@@ -10135,7 +10979,7 @@ function TokensContent({
|
|
|
10135
10979
|
) });
|
|
10136
10980
|
}
|
|
10137
10981
|
function TokenTable({ tokens, deletingId, onRevoke, onDelete }) {
|
|
10138
|
-
return /* @__PURE__ */ (0,
|
|
10982
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
10139
10983
|
"div",
|
|
10140
10984
|
{
|
|
10141
10985
|
style: {
|
|
@@ -10146,7 +10990,7 @@ function TokenTable({ tokens, deletingId, onRevoke, onDelete }) {
|
|
|
10146
10990
|
overflow: "hidden",
|
|
10147
10991
|
width: "100%"
|
|
10148
10992
|
},
|
|
10149
|
-
children: /* @__PURE__ */ (0,
|
|
10993
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
10150
10994
|
"div",
|
|
10151
10995
|
{
|
|
10152
10996
|
style: {
|
|
@@ -10159,7 +11003,7 @@ function TokenTable({ tokens, deletingId, onRevoke, onDelete }) {
|
|
|
10159
11003
|
minHeight: 0
|
|
10160
11004
|
},
|
|
10161
11005
|
children: [
|
|
10162
|
-
/* @__PURE__ */ (0,
|
|
11006
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
10163
11007
|
"div",
|
|
10164
11008
|
{
|
|
10165
11009
|
style: {
|
|
@@ -10170,7 +11014,7 @@ function TokenTable({ tokens, deletingId, onRevoke, onDelete }) {
|
|
|
10170
11014
|
borderBottom: "0.5px solid var(--alias-border-subtle)",
|
|
10171
11015
|
flexShrink: 0
|
|
10172
11016
|
},
|
|
10173
|
-
children: ["Name", "Token", "Expires", "Last Used", "Created", "Actions"].map((h) => /* @__PURE__ */ (0,
|
|
11017
|
+
children: ["Name", "Token", "Expires", "Last Used", "Created", "Actions"].map((h) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
10174
11018
|
"span",
|
|
10175
11019
|
{
|
|
10176
11020
|
style: {
|
|
@@ -10186,7 +11030,7 @@ function TokenTable({ tokens, deletingId, onRevoke, onDelete }) {
|
|
|
10186
11030
|
))
|
|
10187
11031
|
}
|
|
10188
11032
|
),
|
|
10189
|
-
/* @__PURE__ */ (0,
|
|
11033
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { style: { flex: 1, minHeight: 0, overflowY: "auto" }, children: tokens.map((token, idx) => /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
10190
11034
|
"div",
|
|
10191
11035
|
{
|
|
10192
11036
|
style: {
|
|
@@ -10197,8 +11041,8 @@ function TokenTable({ tokens, deletingId, onRevoke, onDelete }) {
|
|
|
10197
11041
|
borderBottom: idx < tokens.length - 1 ? "0.5px solid var(--alias-border-subtle)" : "none"
|
|
10198
11042
|
},
|
|
10199
11043
|
children: [
|
|
10200
|
-
/* @__PURE__ */ (0,
|
|
10201
|
-
/* @__PURE__ */ (0,
|
|
11044
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: "var(--spacing-md)", minWidth: 0 }, children: [
|
|
11045
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
10202
11046
|
"span",
|
|
10203
11047
|
{
|
|
10204
11048
|
style: {
|
|
@@ -10214,9 +11058,9 @@ function TokenTable({ tokens, deletingId, onRevoke, onDelete }) {
|
|
|
10214
11058
|
children: token.name
|
|
10215
11059
|
}
|
|
10216
11060
|
),
|
|
10217
|
-
token.status === "revoked" && /* @__PURE__ */ (0,
|
|
11061
|
+
token.status === "revoked" && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_ui12.ScBadges, { text: "Revoked", variant: "error" })
|
|
10218
11062
|
] }),
|
|
10219
|
-
/* @__PURE__ */ (0,
|
|
11063
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { style: { minWidth: 0 }, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
10220
11064
|
"code",
|
|
10221
11065
|
{
|
|
10222
11066
|
style: {
|
|
@@ -10239,7 +11083,7 @@ function TokenTable({ tokens, deletingId, onRevoke, onDelete }) {
|
|
|
10239
11083
|
]
|
|
10240
11084
|
}
|
|
10241
11085
|
) }),
|
|
10242
|
-
/* @__PURE__ */ (0,
|
|
11086
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
10243
11087
|
"span",
|
|
10244
11088
|
{
|
|
10245
11089
|
style: {
|
|
@@ -10251,7 +11095,7 @@ function TokenTable({ tokens, deletingId, onRevoke, onDelete }) {
|
|
|
10251
11095
|
children: formatDate3(token.expiresAt)
|
|
10252
11096
|
}
|
|
10253
11097
|
),
|
|
10254
|
-
/* @__PURE__ */ (0,
|
|
11098
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
10255
11099
|
"span",
|
|
10256
11100
|
{
|
|
10257
11101
|
style: {
|
|
@@ -10263,7 +11107,7 @@ function TokenTable({ tokens, deletingId, onRevoke, onDelete }) {
|
|
|
10263
11107
|
children: token.lastUsedAt ? formatDate3(token.lastUsedAt) : "Never"
|
|
10264
11108
|
}
|
|
10265
11109
|
),
|
|
10266
|
-
/* @__PURE__ */ (0,
|
|
11110
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
10267
11111
|
"span",
|
|
10268
11112
|
{
|
|
10269
11113
|
style: {
|
|
@@ -10275,9 +11119,9 @@ function TokenTable({ tokens, deletingId, onRevoke, onDelete }) {
|
|
|
10275
11119
|
children: formatDate3(token.createdAt)
|
|
10276
11120
|
}
|
|
10277
11121
|
),
|
|
10278
|
-
/* @__PURE__ */ (0,
|
|
10279
|
-
/* @__PURE__ */ (0,
|
|
10280
|
-
|
|
11122
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { style: { display: "flex", gap: "var(--spacing-sm)" }, children: [
|
|
11123
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
11124
|
+
import_ui12.ScButton,
|
|
10281
11125
|
{
|
|
10282
11126
|
text: deletingId === token._id ? "..." : "Revoke",
|
|
10283
11127
|
variant: "outline",
|
|
@@ -10286,8 +11130,8 @@ function TokenTable({ tokens, deletingId, onRevoke, onDelete }) {
|
|
|
10286
11130
|
onClick: () => onRevoke(token._id)
|
|
10287
11131
|
}
|
|
10288
11132
|
),
|
|
10289
|
-
/* @__PURE__ */ (0,
|
|
10290
|
-
|
|
11133
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
11134
|
+
import_ui12.ScButton,
|
|
10291
11135
|
{
|
|
10292
11136
|
text: deletingId === token._id ? "..." : "Delete",
|
|
10293
11137
|
variant: "error",
|
|
@@ -10309,7 +11153,7 @@ function TokenTable({ tokens, deletingId, onRevoke, onDelete }) {
|
|
|
10309
11153
|
}
|
|
10310
11154
|
|
|
10311
11155
|
// src/settings-content.tsx
|
|
10312
|
-
var
|
|
11156
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
10313
11157
|
function deriveInitials(name) {
|
|
10314
11158
|
return name.split(/\s+/).slice(0, 2).map((part) => part[0]?.toUpperCase() ?? "").join("") || "WS";
|
|
10315
11159
|
}
|
|
@@ -10345,8 +11189,8 @@ function SettingsNavItem({
|
|
|
10345
11189
|
onTabChange
|
|
10346
11190
|
}) {
|
|
10347
11191
|
const isActive = activeTab === tab;
|
|
10348
|
-
return /* @__PURE__ */ (0,
|
|
10349
|
-
|
|
11192
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(SettingsTooltip, { content: TAB_DESCRIPTIONS[tab], placement: "right", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
11193
|
+
import_ui13.ScSidebarMenu,
|
|
10350
11194
|
{
|
|
10351
11195
|
icon: icon(isActive ? PRIMARY_COLOR3 : MUTED_COLOR2),
|
|
10352
11196
|
text: label,
|
|
@@ -10374,7 +11218,7 @@ function SettingsNav({
|
|
|
10374
11218
|
hasOrganization,
|
|
10375
11219
|
isWorkspaceAdmin
|
|
10376
11220
|
}) {
|
|
10377
|
-
const item = (tab, icon) => /* @__PURE__ */ (0,
|
|
11221
|
+
const item = (tab, icon) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
10378
11222
|
SettingsNavItem,
|
|
10379
11223
|
{
|
|
10380
11224
|
tab,
|
|
@@ -10384,7 +11228,7 @@ function SettingsNav({
|
|
|
10384
11228
|
onTabChange
|
|
10385
11229
|
}
|
|
10386
11230
|
);
|
|
10387
|
-
return /* @__PURE__ */ (0,
|
|
11231
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
10388
11232
|
"div",
|
|
10389
11233
|
{
|
|
10390
11234
|
className: "flex flex-col items-start shrink-0 relative overflow-y-auto",
|
|
@@ -10407,33 +11251,33 @@ function SettingsNav({
|
|
|
10407
11251
|
gap: "var(--spacing-5xl)"
|
|
10408
11252
|
},
|
|
10409
11253
|
children: [
|
|
10410
|
-
/* @__PURE__ */ (0,
|
|
10411
|
-
/* @__PURE__ */ (0,
|
|
10412
|
-
item("profile", (color) => /* @__PURE__ */ (0,
|
|
10413
|
-
item("workspaceList", (color) => /* @__PURE__ */ (0,
|
|
11254
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex flex-col w-full", style: { gap: "var(--spacing-md)" }, children: [
|
|
11255
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { style: { padding: "4px 12px", fontSize: 11, fontWeight: 500, color: MUTED_COLOR2, textTransform: "uppercase", letterSpacing: "0.08em" }, children: "Account" }),
|
|
11256
|
+
item("profile", (color) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_icons14.SiconUser, { className: "w-5 h-5", color })),
|
|
11257
|
+
item("workspaceList", (color) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_icons14.SiconSwitch, { className: "w-5 h-5", color }))
|
|
10414
11258
|
] }),
|
|
10415
|
-
/* @__PURE__ */ (0,
|
|
10416
|
-
/* @__PURE__ */ (0,
|
|
10417
|
-
/* @__PURE__ */ (0,
|
|
10418
|
-
item("workspace", (color) => /* @__PURE__ */ (0,
|
|
10419
|
-
item("workspaceMembers", (color) => /* @__PURE__ */ (0,
|
|
10420
|
-
isWorkspaceAdmin && /* @__PURE__ */ (0,
|
|
10421
|
-
item("billing", (color) => /* @__PURE__ */ (0,
|
|
10422
|
-
item("apikey", (color) => /* @__PURE__ */ (0,
|
|
11259
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_ui13.ScHDivider, {}),
|
|
11260
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex flex-col w-full", style: { gap: "var(--spacing-md)" }, children: [
|
|
11261
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { title: workspaceName ?? void 0, style: { padding: "4px 12px", fontSize: 11, fontWeight: 500, color: MUTED_COLOR2, textTransform: "uppercase", letterSpacing: "0.08em" }, children: "Workspace" }),
|
|
11262
|
+
item("workspace", (color) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_icons14.SiconSettings, { className: "w-5 h-5", color })),
|
|
11263
|
+
item("workspaceMembers", (color) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_icons14.SiconTeam, { className: "w-5 h-5", color })),
|
|
11264
|
+
isWorkspaceAdmin && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
|
|
11265
|
+
item("billing", (color) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_icons14.SiconBilling, { className: "w-5 h-5", color })),
|
|
11266
|
+
item("apikey", (color) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(SiconKey_default, { className: "w-5 h-5", color }))
|
|
10423
11267
|
] }),
|
|
10424
|
-
!isWorkspaceAdmin && /* @__PURE__ */ (0,
|
|
11268
|
+
!isWorkspaceAdmin && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("p", { style: { margin: "4px 12px", fontSize: 12, lineHeight: "18px", color: MUTED_COLOR2 }, children: "Contact your workspace admin for credit top-ups and billing history." })
|
|
10425
11269
|
] }),
|
|
10426
|
-
/* @__PURE__ */ (0,
|
|
10427
|
-
/* @__PURE__ */ (0,
|
|
10428
|
-
/* @__PURE__ */ (0,
|
|
10429
|
-
item("organization", (color) => /* @__PURE__ */ (0,
|
|
10430
|
-
item("organizationWorkspaces", (color) => /* @__PURE__ */ (0,
|
|
10431
|
-
] }) : /* @__PURE__ */ (0,
|
|
11270
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_ui13.ScHDivider, {}),
|
|
11271
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "flex flex-col w-full", style: { gap: "var(--spacing-md)" }, children: hasOrganization ? /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
|
|
11272
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { style: { padding: "4px 12px", fontSize: 11, fontWeight: 500, color: MUTED_COLOR2, textTransform: "uppercase", letterSpacing: "0.08em" }, children: "Organization" }),
|
|
11273
|
+
item("organization", (color) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_icons14.SiconTeam, { className: "w-5 h-5", color })),
|
|
11274
|
+
item("organizationWorkspaces", (color) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_icons14.SiconWorkspace, { className: "w-5 h-5", color }))
|
|
11275
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
10432
11276
|
SettingsNavItem,
|
|
10433
11277
|
{
|
|
10434
11278
|
tab: "organization",
|
|
10435
11279
|
label: "Organization",
|
|
10436
|
-
icon: (color) => /* @__PURE__ */ (0,
|
|
11280
|
+
icon: (color) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_icons14.SiconGlobe, { className: "w-5 h-5", color }),
|
|
10437
11281
|
activeTab,
|
|
10438
11282
|
onTabChange
|
|
10439
11283
|
}
|
|
@@ -10445,7 +11289,7 @@ function SettingsNav({
|
|
|
10445
11289
|
var SPECIALIZATION_ICON_SIZE = 24;
|
|
10446
11290
|
function SpecializationIcon({ iconUrl }) {
|
|
10447
11291
|
if (iconUrl) {
|
|
10448
|
-
return /* @__PURE__ */ (0,
|
|
11292
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
10449
11293
|
"img",
|
|
10450
11294
|
{
|
|
10451
11295
|
src: iconUrl,
|
|
@@ -10458,8 +11302,8 @@ function SpecializationIcon({ iconUrl }) {
|
|
|
10458
11302
|
}
|
|
10459
11303
|
);
|
|
10460
11304
|
}
|
|
10461
|
-
return /* @__PURE__ */ (0,
|
|
10462
|
-
|
|
11305
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
11306
|
+
import_icons14.SiconBolt,
|
|
10463
11307
|
{
|
|
10464
11308
|
style: {
|
|
10465
11309
|
width: SPECIALIZATION_ICON_SIZE,
|
|
@@ -10490,10 +11334,10 @@ function SpecializationDropdown({
|
|
|
10490
11334
|
disabled
|
|
10491
11335
|
}) {
|
|
10492
11336
|
const { auth } = useSettingsAdapters();
|
|
10493
|
-
const [open, setOpen] = (0,
|
|
10494
|
-
const containerRef = (0,
|
|
10495
|
-
const [options, setOptions] = (0,
|
|
10496
|
-
(0,
|
|
11337
|
+
const [open, setOpen] = (0, import_react19.useState)(false);
|
|
11338
|
+
const containerRef = (0, import_react19.useRef)(null);
|
|
11339
|
+
const [options, setOptions] = (0, import_react19.useState)([]);
|
|
11340
|
+
(0, import_react19.useEffect)(() => {
|
|
10497
11341
|
if (!auth.getSpecializations) return;
|
|
10498
11342
|
let cancelled = false;
|
|
10499
11343
|
auth.getSpecializations().then((items) => {
|
|
@@ -10513,7 +11357,7 @@ function SpecializationDropdown({
|
|
|
10513
11357
|
cancelled = true;
|
|
10514
11358
|
};
|
|
10515
11359
|
}, [auth]);
|
|
10516
|
-
(0,
|
|
11360
|
+
(0, import_react19.useEffect)(() => {
|
|
10517
11361
|
if (!open) return;
|
|
10518
11362
|
function handleMouseDown(e) {
|
|
10519
11363
|
if (containerRef.current && !containerRef.current.contains(e.target)) {
|
|
@@ -10531,15 +11375,15 @@ function SpecializationDropdown({
|
|
|
10531
11375
|
};
|
|
10532
11376
|
}, [open]);
|
|
10533
11377
|
const selected = options.find((o) => o.id === value);
|
|
10534
|
-
return /* @__PURE__ */ (0,
|
|
11378
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
10535
11379
|
"div",
|
|
10536
11380
|
{
|
|
10537
11381
|
ref: containerRef,
|
|
10538
11382
|
className: "w-full",
|
|
10539
11383
|
style: { position: "relative" },
|
|
10540
11384
|
children: [
|
|
10541
|
-
/* @__PURE__ */ (0,
|
|
10542
|
-
/* @__PURE__ */ (0,
|
|
11385
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("style", { children: DROPDOWN_TRIGGER_STYLES }),
|
|
11386
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
10543
11387
|
"div",
|
|
10544
11388
|
{
|
|
10545
11389
|
className: "spec-dropdown-trigger",
|
|
@@ -10547,16 +11391,16 @@ function SpecializationDropdown({
|
|
|
10547
11391
|
onClick: () => !disabled && setOpen((v) => !v),
|
|
10548
11392
|
"aria-haspopup": "listbox",
|
|
10549
11393
|
"aria-expanded": open,
|
|
10550
|
-
children: /* @__PURE__ */ (0,
|
|
10551
|
-
|
|
11394
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
11395
|
+
import_ui14.ScTextField,
|
|
10552
11396
|
{
|
|
10553
11397
|
label: "Specialization",
|
|
10554
11398
|
labelGroup: "label",
|
|
10555
11399
|
value: selected?.label ?? "",
|
|
10556
11400
|
placeholderFilled: "Select specialization",
|
|
10557
11401
|
tfGroup: "icon-left-right",
|
|
10558
|
-
tfLeftIcon: /* @__PURE__ */ (0,
|
|
10559
|
-
tfRightIcon: /* @__PURE__ */ (0,
|
|
11402
|
+
tfLeftIcon: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(SpecializationIcon, { iconUrl: selected?.iconUrl }),
|
|
11403
|
+
tfRightIcon: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
10560
11404
|
"span",
|
|
10561
11405
|
{
|
|
10562
11406
|
style: {
|
|
@@ -10566,7 +11410,7 @@ function SpecializationDropdown({
|
|
|
10566
11410
|
transform: open ? "rotate(180deg)" : "none",
|
|
10567
11411
|
transition: "transform 120ms ease-out"
|
|
10568
11412
|
},
|
|
10569
|
-
children: /* @__PURE__ */ (0,
|
|
11413
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_icons14.SiconDown, {})
|
|
10570
11414
|
}
|
|
10571
11415
|
),
|
|
10572
11416
|
className: "sc-text-field-full-width",
|
|
@@ -10577,7 +11421,7 @@ function SpecializationDropdown({
|
|
|
10577
11421
|
)
|
|
10578
11422
|
}
|
|
10579
11423
|
),
|
|
10580
|
-
open && /* @__PURE__ */ (0,
|
|
11424
|
+
open && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
10581
11425
|
"div",
|
|
10582
11426
|
{
|
|
10583
11427
|
role: "listbox",
|
|
@@ -10599,11 +11443,11 @@ function SpecializationDropdown({
|
|
|
10599
11443
|
},
|
|
10600
11444
|
children: options.map((opt) => {
|
|
10601
11445
|
const isActive = opt.id === value;
|
|
10602
|
-
return /* @__PURE__ */ (0,
|
|
10603
|
-
|
|
11446
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
11447
|
+
import_ui13.ScMenuOptions,
|
|
10604
11448
|
{
|
|
10605
11449
|
text: opt.label,
|
|
10606
|
-
icon: /* @__PURE__ */ (0,
|
|
11450
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(SpecializationIcon, { iconUrl: opt.iconUrl }),
|
|
10607
11451
|
hover: isActive ? "true" : "false",
|
|
10608
11452
|
variant: "default",
|
|
10609
11453
|
role: "option",
|
|
@@ -10628,9 +11472,9 @@ function LanguageDropdown({
|
|
|
10628
11472
|
onChange,
|
|
10629
11473
|
disabled
|
|
10630
11474
|
}) {
|
|
10631
|
-
const [open, setOpen] = (0,
|
|
10632
|
-
const containerRef = (0,
|
|
10633
|
-
(0,
|
|
11475
|
+
const [open, setOpen] = (0, import_react19.useState)(false);
|
|
11476
|
+
const containerRef = (0, import_react19.useRef)(null);
|
|
11477
|
+
(0, import_react19.useEffect)(() => {
|
|
10634
11478
|
if (!open) return;
|
|
10635
11479
|
function handleMouseDown(e) {
|
|
10636
11480
|
if (containerRef.current && !containerRef.current.contains(e.target)) {
|
|
@@ -10647,15 +11491,15 @@ function LanguageDropdown({
|
|
|
10647
11491
|
document.removeEventListener("keydown", handleKeyDown);
|
|
10648
11492
|
};
|
|
10649
11493
|
}, [open]);
|
|
10650
|
-
return /* @__PURE__ */ (0,
|
|
11494
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
10651
11495
|
"div",
|
|
10652
11496
|
{
|
|
10653
11497
|
ref: containerRef,
|
|
10654
11498
|
className: "w-full",
|
|
10655
11499
|
style: { position: "relative" },
|
|
10656
11500
|
children: [
|
|
10657
|
-
/* @__PURE__ */ (0,
|
|
10658
|
-
/* @__PURE__ */ (0,
|
|
11501
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("style", { children: DROPDOWN_TRIGGER_STYLES }),
|
|
11502
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
10659
11503
|
"div",
|
|
10660
11504
|
{
|
|
10661
11505
|
className: "spec-dropdown-trigger",
|
|
@@ -10663,15 +11507,15 @@ function LanguageDropdown({
|
|
|
10663
11507
|
onClick: () => !disabled && setOpen((v) => !v),
|
|
10664
11508
|
"aria-haspopup": "listbox",
|
|
10665
11509
|
"aria-expanded": open,
|
|
10666
|
-
children: /* @__PURE__ */ (0,
|
|
10667
|
-
|
|
11510
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
11511
|
+
import_ui14.ScTextField,
|
|
10668
11512
|
{
|
|
10669
11513
|
label: "Language",
|
|
10670
11514
|
labelGroup: "label",
|
|
10671
11515
|
value: userLanguageLabel(value),
|
|
10672
11516
|
placeholderFilled: "Select language",
|
|
10673
11517
|
tfGroup: "icon-right",
|
|
10674
|
-
tfRightIcon: /* @__PURE__ */ (0,
|
|
11518
|
+
tfRightIcon: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
10675
11519
|
"span",
|
|
10676
11520
|
{
|
|
10677
11521
|
style: {
|
|
@@ -10681,7 +11525,7 @@ function LanguageDropdown({
|
|
|
10681
11525
|
transform: open ? "rotate(180deg)" : "none",
|
|
10682
11526
|
transition: "transform 120ms ease-out"
|
|
10683
11527
|
},
|
|
10684
|
-
children: /* @__PURE__ */ (0,
|
|
11528
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_icons14.SiconDown, {})
|
|
10685
11529
|
}
|
|
10686
11530
|
),
|
|
10687
11531
|
className: "sc-text-field-full-width",
|
|
@@ -10692,7 +11536,7 @@ function LanguageDropdown({
|
|
|
10692
11536
|
)
|
|
10693
11537
|
}
|
|
10694
11538
|
),
|
|
10695
|
-
open && /* @__PURE__ */ (0,
|
|
11539
|
+
open && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
10696
11540
|
"div",
|
|
10697
11541
|
{
|
|
10698
11542
|
role: "listbox",
|
|
@@ -10718,11 +11562,11 @@ function LanguageDropdown({
|
|
|
10718
11562
|
},
|
|
10719
11563
|
children: USER_LANGUAGES.map((lang) => {
|
|
10720
11564
|
const isActive = lang.code === value;
|
|
10721
|
-
return /* @__PURE__ */ (0,
|
|
10722
|
-
|
|
11565
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
11566
|
+
import_ui13.ScMenuOptions,
|
|
10723
11567
|
{
|
|
10724
11568
|
text: lang.label,
|
|
10725
|
-
icon: /* @__PURE__ */ (0,
|
|
11569
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_jsx_runtime24.Fragment, {}),
|
|
10726
11570
|
hover: isActive ? "true" : "false",
|
|
10727
11571
|
variant: "default",
|
|
10728
11572
|
role: "option",
|
|
@@ -10748,28 +11592,28 @@ function ProfileTab() {
|
|
|
10748
11592
|
const derivedName = user?.name ?? "";
|
|
10749
11593
|
const derivedSpec = user?.userSpecialization ?? "";
|
|
10750
11594
|
const derivedLanguage = user?.language?.trim() || DEFAULT_USER_LANGUAGE;
|
|
10751
|
-
const [fullName, setFullName] = (0,
|
|
10752
|
-
const [selectedSpec, setSelectedSpec] = (0,
|
|
10753
|
-
const [selectedLanguage, setSelectedLanguage] = (0,
|
|
10754
|
-
const [saving, setSaving] = (0,
|
|
10755
|
-
const [imageSaving, setImageSaving] = (0,
|
|
10756
|
-
const [imagePreview, setImagePreview] = (0,
|
|
11595
|
+
const [fullName, setFullName] = (0, import_react19.useState)(derivedName);
|
|
11596
|
+
const [selectedSpec, setSelectedSpec] = (0, import_react19.useState)(derivedSpec);
|
|
11597
|
+
const [selectedLanguage, setSelectedLanguage] = (0, import_react19.useState)(derivedLanguage);
|
|
11598
|
+
const [saving, setSaving] = (0, import_react19.useState)(false);
|
|
11599
|
+
const [imageSaving, setImageSaving] = (0, import_react19.useState)(false);
|
|
11600
|
+
const [imagePreview, setImagePreview] = (0, import_react19.useState)(
|
|
10757
11601
|
void 0
|
|
10758
11602
|
);
|
|
10759
|
-
const fileInputRef = (0,
|
|
11603
|
+
const fileInputRef = (0, import_react19.useRef)(null);
|
|
10760
11604
|
const profileDisplayName = fullName || user?.email || "User";
|
|
10761
11605
|
const profileImage = imagePreview ?? getUserProfileImage(user);
|
|
10762
11606
|
const profileInitial = profileDisplayName.charAt(0).toUpperCase();
|
|
10763
11607
|
const disableAllActions = saving || imageSaving;
|
|
10764
11608
|
const dirty = fullName.trim() !== derivedName || selectedSpec !== derivedSpec || selectedLanguage !== derivedLanguage;
|
|
10765
|
-
(0,
|
|
11609
|
+
(0, import_react19.useEffect)(() => {
|
|
10766
11610
|
setFullName(derivedName);
|
|
10767
11611
|
setImagePreview(void 0);
|
|
10768
11612
|
}, [derivedName]);
|
|
10769
|
-
(0,
|
|
11613
|
+
(0, import_react19.useEffect)(() => {
|
|
10770
11614
|
setSelectedSpec(derivedSpec);
|
|
10771
11615
|
}, [derivedSpec]);
|
|
10772
|
-
(0,
|
|
11616
|
+
(0, import_react19.useEffect)(() => {
|
|
10773
11617
|
setSelectedLanguage(derivedLanguage);
|
|
10774
11618
|
}, [derivedLanguage]);
|
|
10775
11619
|
const handleSave = async () => {
|
|
@@ -10851,13 +11695,13 @@ function ProfileTab() {
|
|
|
10851
11695
|
}
|
|
10852
11696
|
auth.clearAuth();
|
|
10853
11697
|
};
|
|
10854
|
-
return /* @__PURE__ */ (0,
|
|
11698
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
10855
11699
|
"div",
|
|
10856
11700
|
{
|
|
10857
11701
|
className: "flex flex-col items-start flex-1 min-w-0 min-h-0 overflow-y-auto",
|
|
10858
11702
|
style: { gap: "var(--spacing-3xl)" },
|
|
10859
11703
|
children: [
|
|
10860
|
-
/* @__PURE__ */ (0,
|
|
11704
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
10861
11705
|
"div",
|
|
10862
11706
|
{
|
|
10863
11707
|
className: "sc-profile-card flex flex-col items-start w-full",
|
|
@@ -10870,13 +11714,13 @@ function ProfileTab() {
|
|
|
10870
11714
|
gap: "var(--spacing-6xl)"
|
|
10871
11715
|
},
|
|
10872
11716
|
children: [
|
|
10873
|
-
/* @__PURE__ */ (0,
|
|
11717
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
10874
11718
|
"div",
|
|
10875
11719
|
{
|
|
10876
11720
|
className: "flex items-center shrink-0 w-full",
|
|
10877
11721
|
style: { gap: 24, flexWrap: "wrap" },
|
|
10878
11722
|
children: [
|
|
10879
|
-
profileImage ? /* @__PURE__ */ (0,
|
|
11723
|
+
profileImage ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
10880
11724
|
"img",
|
|
10881
11725
|
{
|
|
10882
11726
|
src: profileImage,
|
|
@@ -10889,7 +11733,7 @@ function ProfileTab() {
|
|
|
10889
11733
|
flexShrink: 0
|
|
10890
11734
|
}
|
|
10891
11735
|
}
|
|
10892
|
-
) : /* @__PURE__ */ (0,
|
|
11736
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
10893
11737
|
"div",
|
|
10894
11738
|
{
|
|
10895
11739
|
"aria-label": "Profile",
|
|
@@ -10902,7 +11746,7 @@ function ProfileTab() {
|
|
|
10902
11746
|
border: "1px solid var(--alias-border-subtle)",
|
|
10903
11747
|
flexShrink: 0
|
|
10904
11748
|
},
|
|
10905
|
-
children: /* @__PURE__ */ (0,
|
|
11749
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
10906
11750
|
"span",
|
|
10907
11751
|
{
|
|
10908
11752
|
style: {
|
|
@@ -10917,7 +11761,7 @@ function ProfileTab() {
|
|
|
10917
11761
|
)
|
|
10918
11762
|
}
|
|
10919
11763
|
),
|
|
10920
|
-
/* @__PURE__ */ (0,
|
|
11764
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
10921
11765
|
"input",
|
|
10922
11766
|
{
|
|
10923
11767
|
ref: fileInputRef,
|
|
@@ -10927,17 +11771,17 @@ function ProfileTab() {
|
|
|
10927
11771
|
onChange: handleImageChange
|
|
10928
11772
|
}
|
|
10929
11773
|
),
|
|
10930
|
-
/* @__PURE__ */ (0,
|
|
11774
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
10931
11775
|
"div",
|
|
10932
11776
|
{
|
|
10933
11777
|
className: "flex items-center",
|
|
10934
11778
|
style: { gap: 12, flexWrap: "wrap" },
|
|
10935
11779
|
children: [
|
|
10936
|
-
/* @__PURE__ */ (0,
|
|
10937
|
-
|
|
11780
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
11781
|
+
import_ui15.ScButton,
|
|
10938
11782
|
{
|
|
10939
11783
|
text: "Upload photo",
|
|
10940
|
-
icon: /* @__PURE__ */ (0,
|
|
11784
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_icons14.SiconUpload, { className: "w-5 h-5", color: PRIMARY_COLOR3 }),
|
|
10941
11785
|
styleVariant: "icon-left",
|
|
10942
11786
|
variant: "outline",
|
|
10943
11787
|
size: "md",
|
|
@@ -10945,12 +11789,12 @@ function ProfileTab() {
|
|
|
10945
11789
|
onClick: handleUploadClick
|
|
10946
11790
|
}
|
|
10947
11791
|
),
|
|
10948
|
-
/* @__PURE__ */ (0,
|
|
10949
|
-
|
|
11792
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
11793
|
+
import_ui15.ScButton,
|
|
10950
11794
|
{
|
|
10951
11795
|
text: "Remove photo",
|
|
10952
|
-
icon: /* @__PURE__ */ (0,
|
|
10953
|
-
|
|
11796
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
11797
|
+
import_icons14.SiconDelete,
|
|
10954
11798
|
{
|
|
10955
11799
|
className: "w-5 h-5",
|
|
10956
11800
|
color: PRIMARY_COLOR3
|
|
@@ -10969,16 +11813,16 @@ function ProfileTab() {
|
|
|
10969
11813
|
]
|
|
10970
11814
|
}
|
|
10971
11815
|
),
|
|
10972
|
-
/* @__PURE__ */ (0,
|
|
10973
|
-
/* @__PURE__ */ (0,
|
|
11816
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_ui13.ScHDivider, {}),
|
|
11817
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
10974
11818
|
"div",
|
|
10975
11819
|
{
|
|
10976
11820
|
className: "sc-profile-fields flex flex-col min-w-0 w-full",
|
|
10977
11821
|
style: { gap: 24 },
|
|
10978
11822
|
children: [
|
|
10979
|
-
/* @__PURE__ */ (0,
|
|
10980
|
-
/* @__PURE__ */ (0,
|
|
10981
|
-
|
|
11823
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { style: { display: "grid", width: "100%", gridTemplateColumns: "repeat(auto-fit, minmax(min(100%, 240px), 1fr))", gap: 24 }, children: [
|
|
11824
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "flex-1 min-w-0", style: { overflow: "hidden" }, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
11825
|
+
import_ui14.ScTextField,
|
|
10982
11826
|
{
|
|
10983
11827
|
label: "Full Name",
|
|
10984
11828
|
labelGroup: "label",
|
|
@@ -10991,7 +11835,7 @@ function ProfileTab() {
|
|
|
10991
11835
|
onChange: (e) => setFullName(e.target.value)
|
|
10992
11836
|
}
|
|
10993
11837
|
) }),
|
|
10994
|
-
/* @__PURE__ */ (0,
|
|
11838
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "flex-1 min-w-0", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
10995
11839
|
SpecializationDropdown,
|
|
10996
11840
|
{
|
|
10997
11841
|
value: selectedSpec,
|
|
@@ -11000,8 +11844,8 @@ function ProfileTab() {
|
|
|
11000
11844
|
}
|
|
11001
11845
|
) })
|
|
11002
11846
|
] }),
|
|
11003
|
-
/* @__PURE__ */ (0,
|
|
11004
|
-
/* @__PURE__ */ (0,
|
|
11847
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex items-start w-full", style: { gap: "var(--spacing-3xl)" }, children: [
|
|
11848
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "flex-1 min-w-0", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
11005
11849
|
LanguageDropdown,
|
|
11006
11850
|
{
|
|
11007
11851
|
value: selectedLanguage,
|
|
@@ -11009,10 +11853,10 @@ function ProfileTab() {
|
|
|
11009
11853
|
disabled: disableAllActions
|
|
11010
11854
|
}
|
|
11011
11855
|
) }),
|
|
11012
|
-
/* @__PURE__ */ (0,
|
|
11856
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "flex-1 min-w-0" })
|
|
11013
11857
|
] }),
|
|
11014
|
-
/* @__PURE__ */ (0,
|
|
11015
|
-
|
|
11858
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "w-full", style: { overflow: "hidden" }, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
11859
|
+
import_ui14.ScTextField,
|
|
11016
11860
|
{
|
|
11017
11861
|
label: "Email ID",
|
|
11018
11862
|
labelGroup: "label",
|
|
@@ -11020,8 +11864,8 @@ function ProfileTab() {
|
|
|
11020
11864
|
value: user?.email ?? "",
|
|
11021
11865
|
placeholderFilled: user?.email ?? "chris@kepler.com",
|
|
11022
11866
|
tfGroup: "icon-right",
|
|
11023
|
-
tfRightIcon: /* @__PURE__ */ (0,
|
|
11024
|
-
|
|
11867
|
+
tfRightIcon: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
11868
|
+
import_icons14.SiconLock,
|
|
11025
11869
|
{
|
|
11026
11870
|
className: "w-6 h-6",
|
|
11027
11871
|
color: "var(--alias-text---icons-primary)"
|
|
@@ -11032,13 +11876,13 @@ function ProfileTab() {
|
|
|
11032
11876
|
readOnly: true
|
|
11033
11877
|
}
|
|
11034
11878
|
) }),
|
|
11035
|
-
/* @__PURE__ */ (0,
|
|
11879
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
11036
11880
|
"div",
|
|
11037
11881
|
{
|
|
11038
11882
|
className: "flex items-center w-full",
|
|
11039
11883
|
style: { justifyContent: "flex-end", paddingTop: "var(--spacing-md)" },
|
|
11040
|
-
children: /* @__PURE__ */ (0,
|
|
11041
|
-
|
|
11884
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
11885
|
+
import_ui15.ScButton,
|
|
11042
11886
|
{
|
|
11043
11887
|
text: saving ? "Saving..." : "Save changes",
|
|
11044
11888
|
variant: "secondary",
|
|
@@ -11055,7 +11899,7 @@ function ProfileTab() {
|
|
|
11055
11899
|
]
|
|
11056
11900
|
}
|
|
11057
11901
|
),
|
|
11058
|
-
/* @__PURE__ */ (0,
|
|
11902
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
11059
11903
|
"div",
|
|
11060
11904
|
{
|
|
11061
11905
|
className: "flex items-center w-full",
|
|
@@ -11067,8 +11911,8 @@ function ProfileTab() {
|
|
|
11067
11911
|
gap: "var(--spacing-3xl)"
|
|
11068
11912
|
},
|
|
11069
11913
|
children: [
|
|
11070
|
-
/* @__PURE__ */ (0,
|
|
11071
|
-
/* @__PURE__ */ (0,
|
|
11914
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex flex-col min-w-0 flex-1", style: { gap: "var(--spacing-xs)" }, children: [
|
|
11915
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
11072
11916
|
"span",
|
|
11073
11917
|
{
|
|
11074
11918
|
style: {
|
|
@@ -11081,7 +11925,7 @@ function ProfileTab() {
|
|
|
11081
11925
|
children: "Session"
|
|
11082
11926
|
}
|
|
11083
11927
|
),
|
|
11084
|
-
/* @__PURE__ */ (0,
|
|
11928
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
11085
11929
|
"span",
|
|
11086
11930
|
{
|
|
11087
11931
|
className: "truncate",
|
|
@@ -11096,8 +11940,8 @@ function ProfileTab() {
|
|
|
11096
11940
|
}
|
|
11097
11941
|
)
|
|
11098
11942
|
] }),
|
|
11099
|
-
/* @__PURE__ */ (0,
|
|
11100
|
-
|
|
11943
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
11944
|
+
import_ui15.ScButton,
|
|
11101
11945
|
{
|
|
11102
11946
|
text: "Log out",
|
|
11103
11947
|
variant: "outline",
|
|
@@ -11160,11 +12004,11 @@ function WorkspaceListTab({
|
|
|
11160
12004
|
const currentOrganization = organizations.find(
|
|
11161
12005
|
(org) => org._id && org._id === currentWorkspace?.organizationId
|
|
11162
12006
|
);
|
|
11163
|
-
const [page, setPage] = (0,
|
|
11164
|
-
const [serverPage, setServerPage] = (0,
|
|
11165
|
-
const [serverFailed, setServerFailed] = (0,
|
|
12007
|
+
const [page, setPage] = (0, import_react19.useState)(0);
|
|
12008
|
+
const [serverPage, setServerPage] = (0, import_react19.useState)(null);
|
|
12009
|
+
const [serverFailed, setServerFailed] = (0, import_react19.useState)(false);
|
|
11166
12010
|
const serverMode = !!listPage && !serverFailed;
|
|
11167
|
-
(0,
|
|
12011
|
+
(0, import_react19.useEffect)(() => {
|
|
11168
12012
|
if (!listPage || serverFailed) return;
|
|
11169
12013
|
let cancelled = false;
|
|
11170
12014
|
listPage({ limit: pageSize, offset: page * pageSize }).then((result) => {
|
|
@@ -11205,21 +12049,21 @@ function WorkspaceListTab({
|
|
|
11205
12049
|
const pageRows = serverMode ? (serverPage?.items ?? []).map((ws) => ({ ws, group: serverGroupOf(ws) })) : rows.slice(pageStart, pageStart + pageSize);
|
|
11206
12050
|
const pageWorkspaces = pageRows.map((row) => row.ws);
|
|
11207
12051
|
const listLoading = loading || serverMode && !serverPage;
|
|
11208
|
-
const [plans, setPlans] = (0,
|
|
11209
|
-
const requestedPlans = (0,
|
|
12052
|
+
const [plans, setPlans] = (0, import_react19.useState)({});
|
|
12053
|
+
const requestedPlans = (0, import_react19.useRef)(/* @__PURE__ */ new Set());
|
|
11210
12054
|
const visibleIds = [
|
|
11211
12055
|
...currentWorkspace ? [currentWorkspace._id] : [],
|
|
11212
12056
|
...pageWorkspaces.map((ws) => ws._id)
|
|
11213
12057
|
];
|
|
11214
12058
|
const visibleKey = visibleIds.join(",");
|
|
11215
|
-
const mounted = (0,
|
|
11216
|
-
(0,
|
|
12059
|
+
const mounted = (0, import_react19.useRef)(true);
|
|
12060
|
+
(0, import_react19.useEffect)(() => {
|
|
11217
12061
|
mounted.current = true;
|
|
11218
12062
|
return () => {
|
|
11219
12063
|
mounted.current = false;
|
|
11220
12064
|
};
|
|
11221
12065
|
}, []);
|
|
11222
|
-
(0,
|
|
12066
|
+
(0, import_react19.useEffect)(() => {
|
|
11223
12067
|
if (!fetchPlans || listLoading) return;
|
|
11224
12068
|
const missing = visibleKey.split(",").filter((id) => id && !requestedPlans.current.has(id));
|
|
11225
12069
|
if (!missing.length) return;
|
|
@@ -11230,13 +12074,13 @@ function WorkspaceListTab({
|
|
|
11230
12074
|
});
|
|
11231
12075
|
}, [fetchPlans, listLoading, visibleKey]);
|
|
11232
12076
|
const planOf = (ws) => fetchPlans ? plans[ws._id] ?? "" : ws.plan ?? "";
|
|
11233
|
-
return /* @__PURE__ */ (0,
|
|
12077
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
11234
12078
|
"div",
|
|
11235
12079
|
{
|
|
11236
12080
|
className: "flex flex-col items-start flex-1 min-w-0",
|
|
11237
12081
|
style: { gap: "var(--spacing-3xl)", height: "100%" },
|
|
11238
12082
|
children: [
|
|
11239
|
-
/* @__PURE__ */ (0,
|
|
12083
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
11240
12084
|
"p",
|
|
11241
12085
|
{
|
|
11242
12086
|
className: "shrink-0 w-full",
|
|
@@ -11249,7 +12093,7 @@ function WorkspaceListTab({
|
|
|
11249
12093
|
children: "Switching changes which workspace the rest of Settings acts on."
|
|
11250
12094
|
}
|
|
11251
12095
|
),
|
|
11252
|
-
listLoading && /* @__PURE__ */ (0,
|
|
12096
|
+
listLoading && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
11253
12097
|
"p",
|
|
11254
12098
|
{
|
|
11255
12099
|
style: {
|
|
@@ -11260,13 +12104,13 @@ function WorkspaceListTab({
|
|
|
11260
12104
|
children: "Loading workspaces\u2026"
|
|
11261
12105
|
}
|
|
11262
12106
|
),
|
|
11263
|
-
!listLoading && currentWorkspace && /* @__PURE__ */ (0,
|
|
12107
|
+
!listLoading && currentWorkspace && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
11264
12108
|
"div",
|
|
11265
12109
|
{
|
|
11266
12110
|
className: "flex flex-col items-start shrink-0 w-full",
|
|
11267
12111
|
style: { gap: 16, padding: "var(--spacing-md) 0" },
|
|
11268
12112
|
children: [
|
|
11269
|
-
/* @__PURE__ */ (0,
|
|
12113
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
11270
12114
|
"p",
|
|
11271
12115
|
{
|
|
11272
12116
|
className: "w-full overflow-hidden text-ellipsis whitespace-nowrap",
|
|
@@ -11283,8 +12127,8 @@ function WorkspaceListTab({
|
|
|
11283
12127
|
]
|
|
11284
12128
|
}
|
|
11285
12129
|
),
|
|
11286
|
-
/* @__PURE__ */ (0,
|
|
11287
|
-
|
|
12130
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
12131
|
+
import_ui16.ScWorkspaceSwitchCard,
|
|
11288
12132
|
{
|
|
11289
12133
|
wsName: currentWorkspace.name,
|
|
11290
12134
|
initials: currentWorkspace.initials,
|
|
@@ -11300,7 +12144,7 @@ function WorkspaceListTab({
|
|
|
11300
12144
|
]
|
|
11301
12145
|
}
|
|
11302
12146
|
),
|
|
11303
|
-
!listLoading && currentWorkspace && listTotal > 0 && /* @__PURE__ */ (0,
|
|
12147
|
+
!listLoading && currentWorkspace && listTotal > 0 && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
11304
12148
|
"div",
|
|
11305
12149
|
{
|
|
11306
12150
|
className: "shrink-0 w-full",
|
|
@@ -11310,19 +12154,19 @@ function WorkspaceListTab({
|
|
|
11310
12154
|
}
|
|
11311
12155
|
}
|
|
11312
12156
|
),
|
|
11313
|
-
!listLoading && listTotal > 0 && /* @__PURE__ */ (0,
|
|
12157
|
+
!listLoading && listTotal > 0 && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
11314
12158
|
"div",
|
|
11315
12159
|
{
|
|
11316
12160
|
className: "flex flex-col items-start flex-1 min-h-0 w-full",
|
|
11317
12161
|
style: { gap: 16, overflowY: "auto" },
|
|
11318
12162
|
children: [
|
|
11319
|
-
/* @__PURE__ */ (0,
|
|
12163
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
11320
12164
|
"div",
|
|
11321
12165
|
{
|
|
11322
12166
|
className: "flex flex-col items-start w-full",
|
|
11323
12167
|
style: { gap: 16 },
|
|
11324
|
-
children: pageRows.map(({ ws, group }, index) => /* @__PURE__ */ (0,
|
|
11325
|
-
(index === 0 || pageRows[index - 1].group.key !== group.key) && /* @__PURE__ */ (0,
|
|
12168
|
+
children: pageRows.map(({ ws, group }, index) => /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_react19.Fragment, { children: [
|
|
12169
|
+
(index === 0 || pageRows[index - 1].group.key !== group.key) && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
11326
12170
|
"p",
|
|
11327
12171
|
{
|
|
11328
12172
|
className: "w-full overflow-hidden text-ellipsis whitespace-nowrap shrink-0",
|
|
@@ -11337,8 +12181,8 @@ function WorkspaceListTab({
|
|
|
11337
12181
|
children: group.label
|
|
11338
12182
|
}
|
|
11339
12183
|
),
|
|
11340
|
-
/* @__PURE__ */ (0,
|
|
11341
|
-
|
|
12184
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
12185
|
+
import_ui16.ScWorkspaceSwitchCard,
|
|
11342
12186
|
{
|
|
11343
12187
|
wsName: ws.name,
|
|
11344
12188
|
initials: ws.initials,
|
|
@@ -11355,13 +12199,13 @@ function WorkspaceListTab({
|
|
|
11355
12199
|
] }, ws._id))
|
|
11356
12200
|
}
|
|
11357
12201
|
),
|
|
11358
|
-
pageCount > 1 && /* @__PURE__ */ (0,
|
|
12202
|
+
pageCount > 1 && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
11359
12203
|
"div",
|
|
11360
12204
|
{
|
|
11361
12205
|
className: "flex items-center justify-between shrink-0 w-full",
|
|
11362
12206
|
style: { gap: "var(--spacing-md)" },
|
|
11363
12207
|
children: [
|
|
11364
|
-
/* @__PURE__ */ (0,
|
|
12208
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
11365
12209
|
"span",
|
|
11366
12210
|
{
|
|
11367
12211
|
style: {
|
|
@@ -11380,9 +12224,9 @@ function WorkspaceListTab({
|
|
|
11380
12224
|
]
|
|
11381
12225
|
}
|
|
11382
12226
|
),
|
|
11383
|
-
/* @__PURE__ */ (0,
|
|
11384
|
-
/* @__PURE__ */ (0,
|
|
11385
|
-
|
|
12227
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex items-center", style: { gap: "var(--spacing-md)" }, children: [
|
|
12228
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
12229
|
+
import_ui15.ScButton,
|
|
11386
12230
|
{
|
|
11387
12231
|
text: "Previous",
|
|
11388
12232
|
variant: "tertiary",
|
|
@@ -11391,8 +12235,8 @@ function WorkspaceListTab({
|
|
|
11391
12235
|
onClick: safePage === 0 ? void 0 : () => setPage(safePage - 1)
|
|
11392
12236
|
}
|
|
11393
12237
|
),
|
|
11394
|
-
/* @__PURE__ */ (0,
|
|
11395
|
-
|
|
12238
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
12239
|
+
import_ui15.ScButton,
|
|
11396
12240
|
{
|
|
11397
12241
|
text: "Next",
|
|
11398
12242
|
variant: "tertiary",
|
|
@@ -11419,12 +12263,12 @@ function ReferralTab() {
|
|
|
11419
12263
|
const referralCode = (user?.referralCode ?? user?.referral_code ?? user?.referalCode ?? user?.referal_code ?? "").trim();
|
|
11420
12264
|
const domain = typeof window !== "undefined" ? window.location.origin : "";
|
|
11421
12265
|
const referralLink = referralCode && domain ? `${domain}?referral_code=${encodeURIComponent(referralCode)}` : "";
|
|
11422
|
-
return /* @__PURE__ */ (0,
|
|
12266
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
11423
12267
|
"div",
|
|
11424
12268
|
{
|
|
11425
12269
|
className: "flex flex-col items-start flex-1 min-w-0",
|
|
11426
12270
|
style: { gap: "var(--spacing-3xl)" },
|
|
11427
|
-
children: /* @__PURE__ */ (0,
|
|
12271
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
11428
12272
|
"div",
|
|
11429
12273
|
{
|
|
11430
12274
|
className: "w-full relative",
|
|
@@ -11433,14 +12277,14 @@ function ReferralTab() {
|
|
|
11433
12277
|
borderRadius: "var(--radius-3xl)",
|
|
11434
12278
|
padding: "var(--spacing-6xl)"
|
|
11435
12279
|
},
|
|
11436
|
-
children: /* @__PURE__ */ (0,
|
|
12280
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
11437
12281
|
"div",
|
|
11438
12282
|
{
|
|
11439
12283
|
className: "flex items-start w-full",
|
|
11440
12284
|
style: { gap: "var(--spacing-3xl)" },
|
|
11441
12285
|
children: [
|
|
11442
|
-
/* @__PURE__ */ (0,
|
|
11443
|
-
|
|
12286
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
12287
|
+
import_ui14.ScTextField,
|
|
11444
12288
|
{
|
|
11445
12289
|
label: "Your Referral Link",
|
|
11446
12290
|
labelGroup: "label",
|
|
@@ -11448,8 +12292,8 @@ function ReferralTab() {
|
|
|
11448
12292
|
value: referralLink,
|
|
11449
12293
|
placeholderFilled: "https://your-domain.com?referral_code=ABC123",
|
|
11450
12294
|
tfGroup: "icon-right",
|
|
11451
|
-
tfRightIcon: /* @__PURE__ */ (0,
|
|
11452
|
-
|
|
12295
|
+
tfRightIcon: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
12296
|
+
import_icons14.SiconBolt,
|
|
11453
12297
|
{
|
|
11454
12298
|
className: "w-6 h-6",
|
|
11455
12299
|
color: "var(--alias-text---icons-primary)"
|
|
@@ -11459,8 +12303,8 @@ function ReferralTab() {
|
|
|
11459
12303
|
readOnly: true
|
|
11460
12304
|
}
|
|
11461
12305
|
),
|
|
11462
|
-
/* @__PURE__ */ (0,
|
|
11463
|
-
|
|
12306
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
12307
|
+
import_ui14.ScTextField,
|
|
11464
12308
|
{
|
|
11465
12309
|
label: "Invite through email",
|
|
11466
12310
|
labelGroup: "label",
|
|
@@ -11468,8 +12312,8 @@ function ReferralTab() {
|
|
|
11468
12312
|
value: user?.email ?? "",
|
|
11469
12313
|
placeholderFilled: "chris@kepler.com",
|
|
11470
12314
|
tfGroup: "icon-right",
|
|
11471
|
-
tfRightIcon: /* @__PURE__ */ (0,
|
|
11472
|
-
|
|
12315
|
+
tfRightIcon: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
12316
|
+
import_icons14.SiconSend,
|
|
11473
12317
|
{
|
|
11474
12318
|
className: "w-6 h-6",
|
|
11475
12319
|
color: "var(--alias-text---icons-primary)"
|
|
@@ -11493,7 +12337,7 @@ function SettingsContent({
|
|
|
11493
12337
|
onBack,
|
|
11494
12338
|
hiddenApps
|
|
11495
12339
|
}) {
|
|
11496
|
-
return /* @__PURE__ */ (0,
|
|
12340
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(SettingsAdaptersProvider, { adapters, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
11497
12341
|
SettingsContentInner,
|
|
11498
12342
|
{
|
|
11499
12343
|
activeTab,
|
|
@@ -11522,11 +12366,11 @@ function SettingsContentInner({
|
|
|
11522
12366
|
const workspaceId = workspace.current?.id ?? null;
|
|
11523
12367
|
const workspaceOwner = useWorkspaceOrganization({ workspaceId, request: workspace.organizationRequest ?? unavailableOrganizationRequest, enabled: !!workspace.organizationRequest });
|
|
11524
12368
|
const workspaceOwnerName = workspace.organizationRequest ? workspaceOwner.organizationName : void 0;
|
|
11525
|
-
const [workspaceList, setWorkspaceList] = (0,
|
|
12369
|
+
const [workspaceList, setWorkspaceList] = (0, import_react19.useState)([]);
|
|
11526
12370
|
const currentWorkspaceRole = workspace.current?.role ?? workspaceList.find((item) => item._id === workspaceId)?.role;
|
|
11527
12371
|
const isWorkspaceAdmin = currentWorkspaceRole?.trim().toLowerCase() === "admin";
|
|
11528
|
-
const [workspaceListLoading, setWorkspaceListLoading] = (0,
|
|
11529
|
-
const refreshWorkspaceList = (0,
|
|
12372
|
+
const [workspaceListLoading, setWorkspaceListLoading] = (0, import_react19.useState)(false);
|
|
12373
|
+
const refreshWorkspaceList = (0, import_react19.useCallback)(async () => {
|
|
11530
12374
|
setWorkspaceListLoading(true);
|
|
11531
12375
|
try {
|
|
11532
12376
|
const items = await workspace.list();
|
|
@@ -11547,11 +12391,11 @@ function SettingsContentInner({
|
|
|
11547
12391
|
setWorkspaceListLoading(false);
|
|
11548
12392
|
}
|
|
11549
12393
|
}, [workspace, workspaceId]);
|
|
11550
|
-
(0,
|
|
12394
|
+
(0, import_react19.useEffect)(() => {
|
|
11551
12395
|
void refreshWorkspaceList();
|
|
11552
12396
|
}, [refreshWorkspaceList]);
|
|
11553
12397
|
const hostListPage = workspace.listPage;
|
|
11554
|
-
const listWorkspacePage = (0,
|
|
12398
|
+
const listWorkspacePage = (0, import_react19.useMemo)(
|
|
11555
12399
|
() => hostListPage ? async (params) => {
|
|
11556
12400
|
const result = await hostListPage(params);
|
|
11557
12401
|
return {
|
|
@@ -11568,8 +12412,8 @@ function SettingsContentInner({
|
|
|
11568
12412
|
} : void 0,
|
|
11569
12413
|
[hostListPage, workspaceId]
|
|
11570
12414
|
);
|
|
11571
|
-
const [listOrganizations, setListOrganizations] = (0,
|
|
11572
|
-
(0,
|
|
12415
|
+
const [listOrganizations, setListOrganizations] = (0, import_react19.useState)([]);
|
|
12416
|
+
(0, import_react19.useEffect)(() => {
|
|
11573
12417
|
if (activeTab !== "workspaceList" || typeof organization?.list !== "function") {
|
|
11574
12418
|
return;
|
|
11575
12419
|
}
|
|
@@ -11590,7 +12434,7 @@ function SettingsContentInner({
|
|
|
11590
12434
|
cancelled = true;
|
|
11591
12435
|
};
|
|
11592
12436
|
}, [activeTab, organization]);
|
|
11593
|
-
const switchWorkspace = (0,
|
|
12437
|
+
const switchWorkspace = (0, import_react19.useCallback)(
|
|
11594
12438
|
async (id) => {
|
|
11595
12439
|
await workspace.switch(id);
|
|
11596
12440
|
},
|
|
@@ -11599,17 +12443,27 @@ function SettingsContentInner({
|
|
|
11599
12443
|
const setActiveTab = (tab) => {
|
|
11600
12444
|
navigation.navigateToTab(tab);
|
|
11601
12445
|
};
|
|
11602
|
-
const [creatingWorkspace, setCreatingWorkspace] = (0,
|
|
11603
|
-
const [updatingWorkspace, setUpdatingWorkspace] = (0,
|
|
11604
|
-
const [teamInviteOpen, setTeamInviteOpen] = (0,
|
|
11605
|
-
const [tokenShowRevoked, setTokenShowRevoked] = (0,
|
|
11606
|
-
const [tokenCreateOpen, setTokenCreateOpen] = (0,
|
|
11607
|
-
const [billingShowPlans, setBillingShowPlans] = (0,
|
|
12446
|
+
const [creatingWorkspace, setCreatingWorkspace] = (0, import_react19.useState)(false);
|
|
12447
|
+
const [updatingWorkspace, setUpdatingWorkspace] = (0, import_react19.useState)(false);
|
|
12448
|
+
const [teamInviteOpen, setTeamInviteOpen] = (0, import_react19.useState)(false);
|
|
12449
|
+
const [tokenShowRevoked, setTokenShowRevoked] = (0, import_react19.useState)(false);
|
|
12450
|
+
const [tokenCreateOpen, setTokenCreateOpen] = (0, import_react19.useState)(false);
|
|
12451
|
+
const [billingShowPlans, setBillingShowPlans] = (0, import_react19.useState)(false);
|
|
11608
12452
|
const isBillingPlans = activeTab === "billing" && isWorkspaceAdmin && billingShowPlans;
|
|
11609
|
-
(0,
|
|
11610
|
-
|
|
11611
|
-
|
|
11612
|
-
(0,
|
|
12453
|
+
const [billingShowPerUserLimits, setBillingShowPerUserLimits] = (0, import_react19.useState)(false);
|
|
12454
|
+
const isBillingPerUserLimits = activeTab === "billing" && isWorkspaceAdmin && billingShowPerUserLimits && !billingShowPlans;
|
|
12455
|
+
const isBillingSubView = isBillingPlans || isBillingPerUserLimits;
|
|
12456
|
+
(0, import_react19.useEffect)(() => {
|
|
12457
|
+
if (activeTab !== "billing" || !isWorkspaceAdmin) {
|
|
12458
|
+
setBillingShowPlans(false);
|
|
12459
|
+
setBillingShowPerUserLimits(false);
|
|
12460
|
+
}
|
|
12461
|
+
}, [activeTab, isWorkspaceAdmin]);
|
|
12462
|
+
(0, import_react19.useEffect)(() => {
|
|
12463
|
+
setBillingShowPlans(false);
|
|
12464
|
+
setBillingShowPerUserLimits(false);
|
|
12465
|
+
}, [workspaceId]);
|
|
12466
|
+
(0, import_react19.useEffect)(() => {
|
|
11613
12467
|
if (!onClose) return;
|
|
11614
12468
|
const handleKeyDown = (e) => {
|
|
11615
12469
|
if (e.key !== "Escape" || e.defaultPrevented) return;
|
|
@@ -11618,19 +12472,23 @@ function SettingsContentInner({
|
|
|
11618
12472
|
setBillingShowPlans(false);
|
|
11619
12473
|
return;
|
|
11620
12474
|
}
|
|
12475
|
+
if (billingShowPerUserLimits) {
|
|
12476
|
+
setBillingShowPerUserLimits(false);
|
|
12477
|
+
return;
|
|
12478
|
+
}
|
|
11621
12479
|
onClose();
|
|
11622
12480
|
};
|
|
11623
12481
|
document.addEventListener("keydown", handleKeyDown);
|
|
11624
12482
|
return () => document.removeEventListener("keydown", handleKeyDown);
|
|
11625
|
-
}, [onClose, billingShowPlans]);
|
|
11626
|
-
const [localWorkspaces, setLocalWorkspaces] = (0,
|
|
11627
|
-
const [wsModalOpen, setWsModalOpen] = (0,
|
|
11628
|
-
const [wsModalMode, setWsModalMode] = (0,
|
|
11629
|
-
const [editingWorkspace, setEditingWorkspace] = (0,
|
|
11630
|
-
const [confirmLeaveOpen, setConfirmLeaveOpen] = (0,
|
|
11631
|
-
const [leavingWorkspace, setLeavingWorkspace] = (0,
|
|
11632
|
-
const [confirmDeleteOpen, setConfirmDeleteOpen] = (0,
|
|
11633
|
-
const [deletingWorkspace, setDeletingWorkspace] = (0,
|
|
12483
|
+
}, [onClose, billingShowPlans, billingShowPerUserLimits]);
|
|
12484
|
+
const [localWorkspaces, setLocalWorkspaces] = (0, import_react19.useState)(null);
|
|
12485
|
+
const [wsModalOpen, setWsModalOpen] = (0, import_react19.useState)(false);
|
|
12486
|
+
const [wsModalMode, setWsModalMode] = (0, import_react19.useState)("create");
|
|
12487
|
+
const [editingWorkspace, setEditingWorkspace] = (0, import_react19.useState)(null);
|
|
12488
|
+
const [confirmLeaveOpen, setConfirmLeaveOpen] = (0, import_react19.useState)(false);
|
|
12489
|
+
const [leavingWorkspace, setLeavingWorkspace] = (0, import_react19.useState)(null);
|
|
12490
|
+
const [confirmDeleteOpen, setConfirmDeleteOpen] = (0, import_react19.useState)(false);
|
|
12491
|
+
const [deletingWorkspace, setDeletingWorkspace] = (0, import_react19.useState)(null);
|
|
11634
12492
|
const toWorkspaceData = (ws) => ({
|
|
11635
12493
|
id: ws._id,
|
|
11636
12494
|
name: ws.name ?? "",
|
|
@@ -11720,7 +12578,7 @@ function SettingsContentInner({
|
|
|
11720
12578
|
}
|
|
11721
12579
|
return true;
|
|
11722
12580
|
};
|
|
11723
|
-
(0,
|
|
12581
|
+
(0, import_react19.useEffect)(() => {
|
|
11724
12582
|
if (workspaceList.length > 0 && localWorkspaces === null) {
|
|
11725
12583
|
setLocalWorkspaces(workspaceList.map(toWorkspaceData));
|
|
11726
12584
|
}
|
|
@@ -11894,7 +12752,7 @@ function SettingsContentInner({
|
|
|
11894
12752
|
setConfirmLeaveOpen(true);
|
|
11895
12753
|
return false;
|
|
11896
12754
|
}
|
|
11897
|
-
return /* @__PURE__ */ (0,
|
|
12755
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
11898
12756
|
"div",
|
|
11899
12757
|
{
|
|
11900
12758
|
"data-streamoid-settings": "",
|
|
@@ -11904,8 +12762,8 @@ function SettingsContentInner({
|
|
|
11904
12762
|
backgroundSize: "24px 24px"
|
|
11905
12763
|
},
|
|
11906
12764
|
children: [
|
|
11907
|
-
/* @__PURE__ */ (0,
|
|
11908
|
-
/* @__PURE__ */ (0,
|
|
12765
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(SettingsAppearance, {}),
|
|
12766
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
11909
12767
|
"div",
|
|
11910
12768
|
{
|
|
11911
12769
|
className: "flex flex-col items-start relative h-full overflow-hidden",
|
|
@@ -11915,8 +12773,8 @@ function SettingsContentInner({
|
|
|
11915
12773
|
maxWidth: 1200,
|
|
11916
12774
|
width: "100%"
|
|
11917
12775
|
},
|
|
11918
|
-
children: /* @__PURE__ */ (0,
|
|
11919
|
-
onBack !== null && /* @__PURE__ */ (0,
|
|
12776
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex flex-col w-full flex-1 min-h-0", style: { gap: 20, paddingTop: 16 }, children: [
|
|
12777
|
+
onBack !== null && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "flex items-center shrink-0", style: { paddingLeft: 20 }, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
11920
12778
|
"button",
|
|
11921
12779
|
{
|
|
11922
12780
|
type: "button",
|
|
@@ -11938,12 +12796,12 @@ function SettingsContentInner({
|
|
|
11938
12796
|
},
|
|
11939
12797
|
onClick: () => onBack ? onBack() : window.history.back(),
|
|
11940
12798
|
children: [
|
|
11941
|
-
/* @__PURE__ */ (0,
|
|
12799
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_icons14.SiconLeft, { className: "w-4 h-4 shrink-0", color: "var(--alias-text---icons-muted)" }),
|
|
11942
12800
|
"Back"
|
|
11943
12801
|
]
|
|
11944
12802
|
}
|
|
11945
12803
|
) }),
|
|
11946
|
-
/* @__PURE__ */ (0,
|
|
12804
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
11947
12805
|
"div",
|
|
11948
12806
|
{
|
|
11949
12807
|
className: "flex items-center shrink-0 w-full",
|
|
@@ -11953,9 +12811,9 @@ function SettingsContentInner({
|
|
|
11953
12811
|
gap: 16
|
|
11954
12812
|
},
|
|
11955
12813
|
children: [
|
|
11956
|
-
/* @__PURE__ */ (0,
|
|
11957
|
-
/* @__PURE__ */ (0,
|
|
11958
|
-
/* @__PURE__ */ (0,
|
|
12814
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex items-center flex-1 min-w-0", style: { gap: 8, paddingLeft: 20 }, children: [
|
|
12815
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_icons14.SiconSettings, { className: "w-6 h-6 shrink-0", color: "var(--alias-text---icons-primary)" }),
|
|
12816
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
11959
12817
|
"span",
|
|
11960
12818
|
{
|
|
11961
12819
|
style: {
|
|
@@ -11968,9 +12826,9 @@ function SettingsContentInner({
|
|
|
11968
12826
|
children: "Settings"
|
|
11969
12827
|
}
|
|
11970
12828
|
),
|
|
11971
|
-
scopeCrumb && /* @__PURE__ */ (0,
|
|
11972
|
-
/* @__PURE__ */ (0,
|
|
11973
|
-
/* @__PURE__ */ (0,
|
|
12829
|
+
scopeCrumb && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
|
|
12830
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_icons14.SiconRight, { className: "w-6 h-6 shrink-0", color: "var(--alias-text---icons-primary)" }),
|
|
12831
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
11974
12832
|
"span",
|
|
11975
12833
|
{
|
|
11976
12834
|
className: "truncate",
|
|
@@ -11987,8 +12845,8 @@ function SettingsContentInner({
|
|
|
11987
12845
|
}
|
|
11988
12846
|
)
|
|
11989
12847
|
] }),
|
|
11990
|
-
/* @__PURE__ */ (0,
|
|
11991
|
-
/* @__PURE__ */ (0,
|
|
12848
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_icons14.SiconRight, { className: "w-6 h-6 shrink-0", color: "var(--alias-text---icons-primary)" }),
|
|
12849
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
11992
12850
|
"span",
|
|
11993
12851
|
{
|
|
11994
12852
|
style: {
|
|
@@ -12001,9 +12859,9 @@ function SettingsContentInner({
|
|
|
12001
12859
|
children: leafLabel
|
|
12002
12860
|
}
|
|
12003
12861
|
),
|
|
12004
|
-
isBillingPlans && /* @__PURE__ */ (0,
|
|
12005
|
-
/* @__PURE__ */ (0,
|
|
12006
|
-
/* @__PURE__ */ (0,
|
|
12862
|
+
isBillingPlans && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
|
|
12863
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_icons14.SiconRight, { className: "w-6 h-6 shrink-0", color: "var(--alias-text---icons-primary)" }),
|
|
12864
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
12007
12865
|
"span",
|
|
12008
12866
|
{
|
|
12009
12867
|
style: {
|
|
@@ -12016,9 +12874,25 @@ function SettingsContentInner({
|
|
|
12016
12874
|
children: "Plans"
|
|
12017
12875
|
}
|
|
12018
12876
|
)
|
|
12877
|
+
] }),
|
|
12878
|
+
isBillingPerUserLimits && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
|
|
12879
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_icons14.SiconRight, { className: "w-6 h-6 shrink-0", color: "var(--alias-text---icons-primary)" }),
|
|
12880
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
12881
|
+
"span",
|
|
12882
|
+
{
|
|
12883
|
+
style: {
|
|
12884
|
+
fontFamily: "var(--font-family-font-family-body)",
|
|
12885
|
+
fontSize: "var(--font-size-font-size-xl)",
|
|
12886
|
+
fontWeight: 500,
|
|
12887
|
+
lineHeight: "var(--line-height-line-height-xl)",
|
|
12888
|
+
color: "var(--alias-text---icons-primary)"
|
|
12889
|
+
},
|
|
12890
|
+
children: "Per-user limits"
|
|
12891
|
+
}
|
|
12892
|
+
)
|
|
12019
12893
|
] })
|
|
12020
12894
|
] }),
|
|
12021
|
-
|
|
12895
|
+
isBillingSubView && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
12022
12896
|
"div",
|
|
12023
12897
|
{
|
|
12024
12898
|
className: "flex items-center shrink-0 cursor-pointer",
|
|
@@ -12030,10 +12904,13 @@ function SettingsContentInner({
|
|
|
12030
12904
|
border: "1px solid var(--alias-border-subtle)",
|
|
12031
12905
|
backgroundColor: "var(--alias-surface-base)"
|
|
12032
12906
|
},
|
|
12033
|
-
onClick: () =>
|
|
12907
|
+
onClick: () => {
|
|
12908
|
+
setBillingShowPlans(false);
|
|
12909
|
+
setBillingShowPerUserLimits(false);
|
|
12910
|
+
},
|
|
12034
12911
|
children: [
|
|
12035
|
-
/* @__PURE__ */ (0,
|
|
12036
|
-
/* @__PURE__ */ (0,
|
|
12912
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_icons14.SiconLeft, { className: "w-4 h-4", color: "var(--alias-text---icons-muted)" }),
|
|
12913
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
12037
12914
|
"span",
|
|
12038
12915
|
{
|
|
12039
12916
|
style: {
|
|
@@ -12049,21 +12926,21 @@ function SettingsContentInner({
|
|
|
12049
12926
|
]
|
|
12050
12927
|
}
|
|
12051
12928
|
),
|
|
12052
|
-
activeTab === "workspaceList" && /* @__PURE__ */ (0,
|
|
12929
|
+
activeTab === "workspaceList" && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
12053
12930
|
SettingsTooltip,
|
|
12054
12931
|
{
|
|
12055
12932
|
content: "Start a new workspace with its own team, members and billing",
|
|
12056
12933
|
placement: "bottom",
|
|
12057
12934
|
inline: true,
|
|
12058
|
-
children: /* @__PURE__ */ (0,
|
|
12059
|
-
|
|
12935
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
12936
|
+
import_ui15.ScButton,
|
|
12060
12937
|
{
|
|
12061
12938
|
text: "Create Workspace",
|
|
12062
12939
|
variant: "secondary",
|
|
12063
12940
|
size: "md",
|
|
12064
12941
|
styleVariant: "icon-left",
|
|
12065
|
-
icon: /* @__PURE__ */ (0,
|
|
12066
|
-
|
|
12942
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
12943
|
+
import_icons14.SiconWorkspace,
|
|
12067
12944
|
{
|
|
12068
12945
|
className: "w-5 h-5",
|
|
12069
12946
|
color: "var(--alias-text---icons-inverse)"
|
|
@@ -12074,21 +12951,21 @@ function SettingsContentInner({
|
|
|
12074
12951
|
)
|
|
12075
12952
|
}
|
|
12076
12953
|
),
|
|
12077
|
-
activeTab === "workspaceMembers" && /* @__PURE__ */ (0,
|
|
12954
|
+
activeTab === "workspaceMembers" && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
12078
12955
|
SettingsTooltip,
|
|
12079
12956
|
{
|
|
12080
12957
|
content: "Send someone an invite to join this workspace",
|
|
12081
12958
|
placement: "bottom",
|
|
12082
12959
|
inline: true,
|
|
12083
|
-
children: /* @__PURE__ */ (0,
|
|
12084
|
-
|
|
12960
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
12961
|
+
import_ui15.ScButton,
|
|
12085
12962
|
{
|
|
12086
12963
|
text: "Invite user",
|
|
12087
12964
|
variant: "secondary",
|
|
12088
12965
|
size: "md",
|
|
12089
12966
|
styleVariant: "icon-left",
|
|
12090
|
-
icon: /* @__PURE__ */ (0,
|
|
12091
|
-
|
|
12967
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
12968
|
+
import_icons14.SiconUserAdd,
|
|
12092
12969
|
{
|
|
12093
12970
|
className: "w-5 h-5",
|
|
12094
12971
|
color: "var(--alias-text---icons-inverse)"
|
|
@@ -12099,15 +12976,15 @@ function SettingsContentInner({
|
|
|
12099
12976
|
)
|
|
12100
12977
|
}
|
|
12101
12978
|
),
|
|
12102
|
-
activeTab === "apikey" && isWorkspaceAdmin && /* @__PURE__ */ (0,
|
|
12103
|
-
/* @__PURE__ */ (0,
|
|
12979
|
+
activeTab === "apikey" && isWorkspaceAdmin && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex items-center shrink-0", style: { gap: "var(--spacing-md)" }, children: [
|
|
12980
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
12104
12981
|
SettingsTooltip,
|
|
12105
12982
|
{
|
|
12106
12983
|
content: "Include keys you have already revoked in the list below",
|
|
12107
12984
|
placement: "bottom",
|
|
12108
12985
|
inline: true,
|
|
12109
|
-
children: /* @__PURE__ */ (0,
|
|
12110
|
-
|
|
12986
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
12987
|
+
import_ui15.ScButton,
|
|
12111
12988
|
{
|
|
12112
12989
|
text: tokenShowRevoked ? "Hide Revoked" : "Show Revoked",
|
|
12113
12990
|
variant: "outline",
|
|
@@ -12117,21 +12994,21 @@ function SettingsContentInner({
|
|
|
12117
12994
|
)
|
|
12118
12995
|
}
|
|
12119
12996
|
),
|
|
12120
|
-
/* @__PURE__ */ (0,
|
|
12997
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
12121
12998
|
SettingsTooltip,
|
|
12122
12999
|
{
|
|
12123
13000
|
content: "Generate a key for calling the Streamoid APIs from your own code",
|
|
12124
13001
|
placement: "bottom",
|
|
12125
13002
|
inline: true,
|
|
12126
|
-
children: /* @__PURE__ */ (0,
|
|
12127
|
-
|
|
13003
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
13004
|
+
import_ui15.ScButton,
|
|
12128
13005
|
{
|
|
12129
13006
|
text: "New API Key",
|
|
12130
13007
|
variant: "secondary",
|
|
12131
13008
|
size: "md",
|
|
12132
13009
|
styleVariant: "icon-left",
|
|
12133
|
-
icon: /* @__PURE__ */ (0,
|
|
12134
|
-
|
|
13010
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
13011
|
+
import_icons14.SiconPlus,
|
|
12135
13012
|
{
|
|
12136
13013
|
className: "w-5 h-5",
|
|
12137
13014
|
color: "var(--alias-text---icons-inverse)"
|
|
@@ -12143,7 +13020,7 @@ function SettingsContentInner({
|
|
|
12143
13020
|
}
|
|
12144
13021
|
)
|
|
12145
13022
|
] }),
|
|
12146
|
-
onClose && /* @__PURE__ */ (0,
|
|
13023
|
+
onClose && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(SettingsTooltip, { content: "Close settings (Esc)", placement: "bottom", inline: true, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
12147
13024
|
"button",
|
|
12148
13025
|
{
|
|
12149
13026
|
type: "button",
|
|
@@ -12159,8 +13036,8 @@ function SettingsContentInner({
|
|
|
12159
13036
|
border: "1px solid var(--alias-border-subtle)",
|
|
12160
13037
|
backgroundColor: "var(--alias-surface-base)"
|
|
12161
13038
|
},
|
|
12162
|
-
children: /* @__PURE__ */ (0,
|
|
12163
|
-
|
|
13039
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
13040
|
+
import_icons14.SiconClose,
|
|
12164
13041
|
{
|
|
12165
13042
|
className: "w-5 h-5",
|
|
12166
13043
|
color: "var(--alias-text---icons-muted)"
|
|
@@ -12171,13 +13048,13 @@ function SettingsContentInner({
|
|
|
12171
13048
|
]
|
|
12172
13049
|
}
|
|
12173
13050
|
),
|
|
12174
|
-
/* @__PURE__ */ (0,
|
|
13051
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
12175
13052
|
"div",
|
|
12176
13053
|
{
|
|
12177
13054
|
className: "flex items-start flex-1 min-h-0 w-full overflow-hidden",
|
|
12178
13055
|
style: { gap: 20 },
|
|
12179
13056
|
children: [
|
|
12180
|
-
!
|
|
13057
|
+
!isBillingSubView && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
12181
13058
|
SettingsNav,
|
|
12182
13059
|
{
|
|
12183
13060
|
isWorkspaceAdmin,
|
|
@@ -12188,8 +13065,8 @@ function SettingsContentInner({
|
|
|
12188
13065
|
hasOrganization
|
|
12189
13066
|
}
|
|
12190
13067
|
),
|
|
12191
|
-
activeTab === "profile" && /* @__PURE__ */ (0,
|
|
12192
|
-
activeTab === "workspace" && /* @__PURE__ */ (0,
|
|
13068
|
+
activeTab === "profile" && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(ProfileTab, {}),
|
|
13069
|
+
activeTab === "workspace" && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "flex flex-col flex-1 min-w-0 min-h-0 h-full", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
12193
13070
|
WorkspaceGeneralTab,
|
|
12194
13071
|
{
|
|
12195
13072
|
workspace: currentWorkspaceData,
|
|
@@ -12211,7 +13088,7 @@ function SettingsContentInner({
|
|
|
12211
13088
|
}
|
|
12212
13089
|
}
|
|
12213
13090
|
) }),
|
|
12214
|
-
activeTab === "workspaceMembers" && /* @__PURE__ */ (0,
|
|
13091
|
+
activeTab === "workspaceMembers" && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "flex flex-col flex-1 min-w-0 min-h-0 h-full", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
12215
13092
|
TeamsContent,
|
|
12216
13093
|
{
|
|
12217
13094
|
embedded: true,
|
|
@@ -12223,7 +13100,7 @@ function SettingsContentInner({
|
|
|
12223
13100
|
hiddenApps
|
|
12224
13101
|
}
|
|
12225
13102
|
) }),
|
|
12226
|
-
activeTab === "workspaceList" && /* @__PURE__ */ (0,
|
|
13103
|
+
activeTab === "workspaceList" && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
12227
13104
|
WorkspaceListTab,
|
|
12228
13105
|
{
|
|
12229
13106
|
workspaces: displayWorkspaces,
|
|
@@ -12248,8 +13125,8 @@ function SettingsContentInner({
|
|
|
12248
13125
|
}
|
|
12249
13126
|
}
|
|
12250
13127
|
),
|
|
12251
|
-
activeTab === "referral" && /* @__PURE__ */ (0,
|
|
12252
|
-
(activeTab === "organization" || activeTab === "organizationWorkspaces" || activeTab === "organizationDomains") && /* @__PURE__ */ (0,
|
|
13128
|
+
activeTab === "referral" && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(ReferralTab, {}),
|
|
13129
|
+
(activeTab === "organization" || activeTab === "organizationWorkspaces" || activeTab === "organizationDomains") && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "flex flex-col flex-1 min-w-0 min-h-0 h-full", children: organization.managementUrl ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
12253
13130
|
ManagedOrganizationSummary,
|
|
12254
13131
|
{
|
|
12255
13132
|
name: workspaceOwner.organizationName,
|
|
@@ -12257,29 +13134,37 @@ function SettingsContentInner({
|
|
|
12257
13134
|
status: workspaceOwner.organizationStatus,
|
|
12258
13135
|
managementUrl: organization.managementUrl
|
|
12259
13136
|
}
|
|
12260
|
-
) : /* @__PURE__ */ (0,
|
|
13137
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
12261
13138
|
OrganizationContent,
|
|
12262
13139
|
{
|
|
12263
13140
|
embedded: true,
|
|
12264
13141
|
view: activeTab === "organizationWorkspaces" || activeTab === "organizationDomains" ? "workspaces" : "people"
|
|
12265
13142
|
}
|
|
12266
13143
|
) }),
|
|
12267
|
-
activeTab === "billing" && isWorkspaceAdmin && /* @__PURE__ */ (0,
|
|
13144
|
+
activeTab === "billing" && isWorkspaceAdmin && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "flex flex-col flex-1 min-w-0 min-h-0 h-full", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
12268
13145
|
BillingContent,
|
|
12269
13146
|
{
|
|
12270
13147
|
embedded: true,
|
|
12271
13148
|
showPlans: billingShowPlans,
|
|
12272
|
-
onShowPlansChange:
|
|
13149
|
+
onShowPlansChange: (open) => {
|
|
13150
|
+
setBillingShowPlans(open);
|
|
13151
|
+
if (open) setBillingShowPerUserLimits(false);
|
|
13152
|
+
},
|
|
13153
|
+
showPerUserLimits: billingShowPerUserLimits,
|
|
13154
|
+
onShowPerUserLimitsChange: (open) => {
|
|
13155
|
+
setBillingShowPerUserLimits(open);
|
|
13156
|
+
if (open) setBillingShowPlans(false);
|
|
13157
|
+
}
|
|
12273
13158
|
}
|
|
12274
13159
|
) }),
|
|
12275
|
-
(activeTab === "billing" || activeTab === "apikey") && !isWorkspaceAdmin && /* @__PURE__ */ (0,
|
|
12276
|
-
/* @__PURE__ */ (0,
|
|
12277
|
-
/* @__PURE__ */ (0,
|
|
12278
|
-
/* @__PURE__ */ (0,
|
|
12279
|
-
/* @__PURE__ */ (0,
|
|
13160
|
+
(activeTab === "billing" || activeTab === "apikey") && !isWorkspaceAdmin && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("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: [
|
|
13161
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_icons14.SiconLock, { size: 24, color: MUTED_COLOR2 }),
|
|
13162
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("h2", { style: { margin: 0, fontSize: 18, fontWeight: 600, color: PRIMARY_COLOR3 }, children: "Contact your workspace admin" }),
|
|
13163
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("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." }),
|
|
13164
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("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" })
|
|
12280
13165
|
] }),
|
|
12281
|
-
activeTab === "apikey" && isWorkspaceAdmin && /* @__PURE__ */ (0,
|
|
12282
|
-
/* @__PURE__ */ (0,
|
|
13166
|
+
activeTab === "apikey" && isWorkspaceAdmin && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex flex-col flex-1 min-w-0 min-h-0 h-full", children: [
|
|
13167
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
12283
13168
|
"a",
|
|
12284
13169
|
{
|
|
12285
13170
|
href: "https://docs.streamoid.com",
|
|
@@ -12289,19 +13174,19 @@ function SettingsContentInner({
|
|
|
12289
13174
|
className: "flex items-center shrink-0",
|
|
12290
13175
|
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" },
|
|
12291
13176
|
children: [
|
|
12292
|
-
/* @__PURE__ */ (0,
|
|
12293
|
-
/* @__PURE__ */ (0,
|
|
12294
|
-
/* @__PURE__ */ (0,
|
|
12295
|
-
/* @__PURE__ */ (0,
|
|
13177
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_icons14.SiconBookOpen, { size: 24 }),
|
|
13178
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("span", { style: { display: "flex", flexDirection: "column", gap: 4, flex: 1 }, children: [
|
|
13179
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { style: { fontSize: 14, fontWeight: 600 }, children: "Build with the Streamoid API" }),
|
|
13180
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { style: { fontSize: 13, lineHeight: "20px", color: MUTED_COLOR2 }, children: "Explore authentication, API references and integration guides." })
|
|
12296
13181
|
] }),
|
|
12297
|
-
/* @__PURE__ */ (0,
|
|
13182
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("span", { style: { display: "inline-flex", alignItems: "center", gap: 6, fontSize: 13, whiteSpace: "nowrap" }, children: [
|
|
12298
13183
|
"View docs ",
|
|
12299
|
-
/* @__PURE__ */ (0,
|
|
13184
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_icons14.SiconExternalLink, { size: 16 })
|
|
12300
13185
|
] })
|
|
12301
13186
|
]
|
|
12302
13187
|
}
|
|
12303
13188
|
),
|
|
12304
|
-
/* @__PURE__ */ (0,
|
|
13189
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
12305
13190
|
TokensContent,
|
|
12306
13191
|
{
|
|
12307
13192
|
embedded: true,
|
|
@@ -12318,7 +13203,7 @@ function SettingsContentInner({
|
|
|
12318
13203
|
] })
|
|
12319
13204
|
}
|
|
12320
13205
|
),
|
|
12321
|
-
/* @__PURE__ */ (0,
|
|
13206
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
12322
13207
|
WorkspaceModal,
|
|
12323
13208
|
{
|
|
12324
13209
|
open: wsModalOpen,
|
|
@@ -12337,7 +13222,7 @@ function SettingsContentInner({
|
|
|
12337
13222
|
}
|
|
12338
13223
|
}
|
|
12339
13224
|
),
|
|
12340
|
-
/* @__PURE__ */ (0,
|
|
13225
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
12341
13226
|
ConfirmLeaveModal,
|
|
12342
13227
|
{
|
|
12343
13228
|
open: confirmLeaveOpen,
|
|
@@ -12370,7 +13255,7 @@ function SettingsContentInner({
|
|
|
12370
13255
|
}
|
|
12371
13256
|
}
|
|
12372
13257
|
),
|
|
12373
|
-
/* @__PURE__ */ (0,
|
|
13258
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
12374
13259
|
ConfirmDeleteModal,
|
|
12375
13260
|
{
|
|
12376
13261
|
open: confirmDeleteOpen,
|
|
@@ -12400,10 +13285,10 @@ function SettingsContentInner({
|
|
|
12400
13285
|
}
|
|
12401
13286
|
|
|
12402
13287
|
// src/workspace-picker.tsx
|
|
12403
|
-
var
|
|
12404
|
-
var
|
|
12405
|
-
var
|
|
12406
|
-
var
|
|
13288
|
+
var import_react20 = require("react");
|
|
13289
|
+
var import_ui17 = require("@streamoid/ui");
|
|
13290
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
13291
|
+
var T15 = {
|
|
12407
13292
|
primary: "var(--alias-text---icons-primary)",
|
|
12408
13293
|
muted: "var(--alias-text---icons-muted)",
|
|
12409
13294
|
tertiary: "var(--alias-text---icons-tertiary)",
|
|
@@ -12433,10 +13318,10 @@ function WorkspacePicker({
|
|
|
12433
13318
|
onJoin,
|
|
12434
13319
|
onCreate
|
|
12435
13320
|
}) {
|
|
12436
|
-
const [selected, setSelected] = (0,
|
|
12437
|
-
const [creating, setCreating] = (0,
|
|
12438
|
-
const [name, setName] = (0,
|
|
12439
|
-
const [busy, setBusy] = (0,
|
|
13321
|
+
const [selected, setSelected] = (0, import_react20.useState)(/* @__PURE__ */ new Set());
|
|
13322
|
+
const [creating, setCreating] = (0, import_react20.useState)(false);
|
|
13323
|
+
const [name, setName] = (0, import_react20.useState)("");
|
|
13324
|
+
const [busy, setBusy] = (0, import_react20.useState)(false);
|
|
12440
13325
|
const hasWorkspaces = workspaces.length > 0;
|
|
12441
13326
|
const showCreate = creating || !loading && !hasWorkspaces;
|
|
12442
13327
|
const orgLabel = organizationName || "your organization";
|
|
@@ -12455,48 +13340,48 @@ function WorkspacePicker({
|
|
|
12455
13340
|
setBusy(false);
|
|
12456
13341
|
}
|
|
12457
13342
|
};
|
|
12458
|
-
return /* @__PURE__ */ (0,
|
|
13343
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
12459
13344
|
"div",
|
|
12460
13345
|
{
|
|
12461
13346
|
className: "flex flex-col w-full",
|
|
12462
|
-
style: { maxWidth: 520, gap:
|
|
13347
|
+
style: { maxWidth: 520, gap: T15.sp5xl, fontFamily: T15.font },
|
|
12463
13348
|
children: [
|
|
12464
|
-
/* @__PURE__ */ (0,
|
|
12465
|
-
/* @__PURE__ */ (0,
|
|
13349
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex flex-col", style: { gap: T15.spMd }, children: [
|
|
13350
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
12466
13351
|
"p",
|
|
12467
13352
|
{
|
|
12468
13353
|
style: {
|
|
12469
|
-
color:
|
|
12470
|
-
fontSize:
|
|
13354
|
+
color: T15.primary,
|
|
13355
|
+
fontSize: T15.fsXl,
|
|
12471
13356
|
fontWeight: 600,
|
|
12472
|
-
lineHeight:
|
|
13357
|
+
lineHeight: T15.lhXl,
|
|
12473
13358
|
margin: 0
|
|
12474
13359
|
},
|
|
12475
13360
|
children: "Choose your workspaces"
|
|
12476
13361
|
}
|
|
12477
13362
|
),
|
|
12478
|
-
/* @__PURE__ */ (0,
|
|
13363
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("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.` })
|
|
12479
13364
|
] }),
|
|
12480
|
-
(loading || hasWorkspaces) && /* @__PURE__ */ (0,
|
|
13365
|
+
(loading || hasWorkspaces) && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
12481
13366
|
"div",
|
|
12482
13367
|
{
|
|
12483
13368
|
className: "flex flex-col w-full overflow-y-auto",
|
|
12484
13369
|
style: {
|
|
12485
13370
|
maxHeight: 360,
|
|
12486
|
-
background:
|
|
12487
|
-
border: `1px solid ${
|
|
12488
|
-
borderRadius:
|
|
13371
|
+
background: T15.surface,
|
|
13372
|
+
border: `1px solid ${T15.borderSubtle}`,
|
|
13373
|
+
borderRadius: T15.r3xl
|
|
12489
13374
|
},
|
|
12490
|
-
children: loading ? /* @__PURE__ */ (0,
|
|
13375
|
+
children: loading ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
12491
13376
|
"div",
|
|
12492
13377
|
{
|
|
12493
13378
|
className: "flex items-center justify-center",
|
|
12494
|
-
style: { padding:
|
|
13379
|
+
style: { padding: T15.sp6xl, color: T15.muted, fontSize: T15.fsSm },
|
|
12495
13380
|
children: "Loading workspaces\u2026"
|
|
12496
13381
|
}
|
|
12497
13382
|
) : workspaces.map((workspace, index) => {
|
|
12498
13383
|
const checked = selected.has(workspace._id);
|
|
12499
|
-
return /* @__PURE__ */ (0,
|
|
13384
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
12500
13385
|
"div",
|
|
12501
13386
|
{
|
|
12502
13387
|
role: "checkbox",
|
|
@@ -12504,9 +13389,9 @@ function WorkspacePicker({
|
|
|
12504
13389
|
tabIndex: 0,
|
|
12505
13390
|
className: "flex items-center cursor-pointer",
|
|
12506
13391
|
style: {
|
|
12507
|
-
gap:
|
|
12508
|
-
padding: `${
|
|
12509
|
-
borderTop: index ? `1px solid ${
|
|
13392
|
+
gap: T15.spXl,
|
|
13393
|
+
padding: `${T15.spXl} ${T15.sp3xl}`,
|
|
13394
|
+
borderTop: index ? `1px solid ${T15.borderSubtle}` : "none"
|
|
12510
13395
|
},
|
|
12511
13396
|
onClick: () => toggle(workspace._id),
|
|
12512
13397
|
onKeyDown: (e) => {
|
|
@@ -12516,35 +13401,35 @@ function WorkspacePicker({
|
|
|
12516
13401
|
}
|
|
12517
13402
|
},
|
|
12518
13403
|
children: [
|
|
12519
|
-
/* @__PURE__ */ (0,
|
|
12520
|
-
/* @__PURE__ */ (0,
|
|
13404
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_ui17.ScCheckbox, { checked }),
|
|
13405
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
12521
13406
|
ProfileAvatar,
|
|
12522
13407
|
{
|
|
12523
13408
|
name: workspace.name,
|
|
12524
13409
|
profileImage: workspace.imageUrl,
|
|
12525
13410
|
size: 32,
|
|
12526
|
-
borderRadius:
|
|
13411
|
+
borderRadius: T15.rLg
|
|
12527
13412
|
}
|
|
12528
13413
|
),
|
|
12529
|
-
/* @__PURE__ */ (0,
|
|
12530
|
-
/* @__PURE__ */ (0,
|
|
13414
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex flex-col min-w-0", children: [
|
|
13415
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
12531
13416
|
"span",
|
|
12532
13417
|
{
|
|
12533
13418
|
className: "truncate",
|
|
12534
13419
|
style: {
|
|
12535
|
-
color:
|
|
12536
|
-
fontSize:
|
|
13420
|
+
color: T15.primary,
|
|
13421
|
+
fontSize: T15.fsSm,
|
|
12537
13422
|
fontWeight: 500,
|
|
12538
|
-
lineHeight:
|
|
13423
|
+
lineHeight: T15.lhSm
|
|
12539
13424
|
},
|
|
12540
13425
|
children: workspace.name
|
|
12541
13426
|
}
|
|
12542
13427
|
),
|
|
12543
|
-
workspace.ownerName && /* @__PURE__ */ (0,
|
|
13428
|
+
workspace.ownerName && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
12544
13429
|
"span",
|
|
12545
13430
|
{
|
|
12546
13431
|
className: "truncate",
|
|
12547
|
-
style: { color:
|
|
13432
|
+
style: { color: T15.muted, fontSize: T15.fsXs, lineHeight: T15.lhXs },
|
|
12548
13433
|
children: [
|
|
12549
13434
|
"Created by ",
|
|
12550
13435
|
workspace.ownerName
|
|
@@ -12559,16 +13444,16 @@ function WorkspacePicker({
|
|
|
12559
13444
|
})
|
|
12560
13445
|
}
|
|
12561
13446
|
),
|
|
12562
|
-
showCreate ? /* @__PURE__ */ (0,
|
|
12563
|
-
/* @__PURE__ */ (0,
|
|
13447
|
+
showCreate ? /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex flex-col w-full", style: { gap: T15.spMd }, children: [
|
|
13448
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
12564
13449
|
"label",
|
|
12565
13450
|
{
|
|
12566
13451
|
htmlFor: "workspace-picker-name",
|
|
12567
|
-
style: { color:
|
|
13452
|
+
style: { color: T15.tertiary, fontSize: T15.fsSm, lineHeight: T15.lhSm },
|
|
12568
13453
|
children: "New workspace name"
|
|
12569
13454
|
}
|
|
12570
13455
|
),
|
|
12571
|
-
/* @__PURE__ */ (0,
|
|
13456
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
12572
13457
|
"input",
|
|
12573
13458
|
{
|
|
12574
13459
|
id: "workspace-picker-name",
|
|
@@ -12583,20 +13468,20 @@ function WorkspacePicker({
|
|
|
12583
13468
|
placeholder: "e.g. Marketing",
|
|
12584
13469
|
style: {
|
|
12585
13470
|
height: 48,
|
|
12586
|
-
padding: `0 ${
|
|
12587
|
-
background:
|
|
13471
|
+
padding: `0 ${T15.sp3xl}`,
|
|
13472
|
+
background: T15.fillPlus,
|
|
12588
13473
|
border: "none",
|
|
12589
13474
|
outline: "none",
|
|
12590
|
-
borderRadius:
|
|
12591
|
-
color:
|
|
12592
|
-
fontFamily:
|
|
12593
|
-
fontSize:
|
|
13475
|
+
borderRadius: T15.r3xl,
|
|
13476
|
+
color: T15.primary,
|
|
13477
|
+
fontFamily: T15.font,
|
|
13478
|
+
fontSize: T15.fsSm
|
|
12594
13479
|
}
|
|
12595
13480
|
}
|
|
12596
13481
|
),
|
|
12597
|
-
/* @__PURE__ */ (0,
|
|
12598
|
-
hasWorkspaces && /* @__PURE__ */ (0,
|
|
12599
|
-
|
|
13482
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex items-center justify-end w-full", style: { gap: T15.spMd }, children: [
|
|
13483
|
+
hasWorkspaces && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
13484
|
+
import_ui17.ScButton,
|
|
12600
13485
|
{
|
|
12601
13486
|
text: "Back",
|
|
12602
13487
|
variant: "tertiary",
|
|
@@ -12604,8 +13489,8 @@ function WorkspacePicker({
|
|
|
12604
13489
|
onClick: () => setCreating(false)
|
|
12605
13490
|
}
|
|
12606
13491
|
),
|
|
12607
|
-
/* @__PURE__ */ (0,
|
|
12608
|
-
|
|
13492
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
13493
|
+
import_ui17.ScButton,
|
|
12609
13494
|
{
|
|
12610
13495
|
text: busy ? "Creating\u2026" : "Create workspace",
|
|
12611
13496
|
variant: "primary",
|
|
@@ -12615,9 +13500,9 @@ function WorkspacePicker({
|
|
|
12615
13500
|
}
|
|
12616
13501
|
)
|
|
12617
13502
|
] })
|
|
12618
|
-
] }) : /* @__PURE__ */ (0,
|
|
12619
|
-
/* @__PURE__ */ (0,
|
|
12620
|
-
|
|
13503
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex flex-wrap items-center justify-between w-full", style: { gap: T15.spMd }, children: [
|
|
13504
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
13505
|
+
import_ui17.ScButton,
|
|
12621
13506
|
{
|
|
12622
13507
|
text: "Create a workspace",
|
|
12623
13508
|
variant: "tertiary",
|
|
@@ -12626,8 +13511,8 @@ function WorkspacePicker({
|
|
|
12626
13511
|
onClick: loading || busy ? void 0 : () => setCreating(true)
|
|
12627
13512
|
}
|
|
12628
13513
|
),
|
|
12629
|
-
/* @__PURE__ */ (0,
|
|
12630
|
-
|
|
13514
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
13515
|
+
import_ui17.ScButton,
|
|
12631
13516
|
{
|
|
12632
13517
|
text: busy ? "Joining\u2026" : selected.size > 1 ? `Join ${selected.size} workspaces` : "Join workspace",
|
|
12633
13518
|
variant: "primary",
|