@streamoid/settings 0.7.9 → 0.7.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +183 -2
- package/dist/index.d.ts +183 -2
- package/dist/index.js +1603 -711
- package/dist/index.mjs +1587 -694
- package/package.json +1 -1
package/dist/index.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,28 @@ __export(index_exports, {
|
|
|
57
59
|
WorkspaceModal: () => WorkspaceModal,
|
|
58
60
|
WorkspacePicker: () => WorkspacePicker,
|
|
59
61
|
WorkspaceTab: () => WorkspaceTab,
|
|
62
|
+
belowUsageReason: () => belowUsageReason,
|
|
63
|
+
cleanCreditLimitInput: () => cleanCreditLimitInput,
|
|
60
64
|
countLabel: () => countLabel,
|
|
65
|
+
creditCycleUnit: () => creditCycleUnit,
|
|
66
|
+
describeDefaultLimit: () => describeDefaultLimit,
|
|
67
|
+
describeMemberLimit: () => describeMemberLimit,
|
|
68
|
+
formatCreditLimit: () => formatCreditLimit,
|
|
69
|
+
formatCredits: () => formatCredits,
|
|
61
70
|
groupWorkspaceList: () => groupWorkspaceList,
|
|
71
|
+
isLimitBelowUsage: () => isLimitBelowUsage,
|
|
72
|
+
joinMembersWithLimits: () => joinMembersWithLimits,
|
|
73
|
+
limitBelowUsageUsed: () => limitBelowUsageUsed,
|
|
74
|
+
limitSourceLabel: () => limitSourceLabel,
|
|
62
75
|
loadWorkspaceOrganization: () => loadWorkspaceOrganization,
|
|
76
|
+
minimumCreditLimit: () => minimumCreditLimit,
|
|
63
77
|
resolveSettingsTabFromPath: () => resolveSettingsTabFromPath,
|
|
78
|
+
roundCredits: () => roundCredits,
|
|
64
79
|
useSettingsAdapters: () => useSettingsAdapters,
|
|
65
80
|
useWorkspaceOrganization: () => useWorkspaceOrganization,
|
|
66
|
-
userLanguageLabel: () => userLanguageLabel
|
|
81
|
+
userLanguageLabel: () => userLanguageLabel,
|
|
82
|
+
validateCreditLimitInput: () => validateCreditLimitInput,
|
|
83
|
+
validateDefaultCreditLimitInput: () => validateDefaultCreditLimitInput
|
|
67
84
|
});
|
|
68
85
|
module.exports = __toCommonJS(index_exports);
|
|
69
86
|
|
|
@@ -386,12 +403,12 @@ function useWorkspaceOrganization({
|
|
|
386
403
|
}
|
|
387
404
|
|
|
388
405
|
// src/settings-content.tsx
|
|
389
|
-
var
|
|
390
|
-
var import_ui11 = require("@streamoid/ui");
|
|
391
|
-
var import_ui12 = require("@streamoid/ui");
|
|
406
|
+
var import_react19 = require("react");
|
|
392
407
|
var import_ui13 = require("@streamoid/ui");
|
|
393
408
|
var import_ui14 = require("@streamoid/ui");
|
|
394
|
-
var
|
|
409
|
+
var import_ui15 = require("@streamoid/ui");
|
|
410
|
+
var import_ui16 = require("@streamoid/ui");
|
|
411
|
+
var import_icons14 = require("@streamoid/icons");
|
|
395
412
|
|
|
396
413
|
// src/icons/SiconKey.tsx
|
|
397
414
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
@@ -6861,11 +6878,34 @@ function isBillingWorkspaceMissing(failure) {
|
|
|
6861
6878
|
};
|
|
6862
6879
|
return visit(failure, 0);
|
|
6863
6880
|
}
|
|
6881
|
+
var LIMIT_BELOW_USAGE = "LIMIT_BELOW_USAGE";
|
|
6882
|
+
function isLimitBelowUsage(failure) {
|
|
6883
|
+
return findLimitBelowUsage(failure) !== null;
|
|
6884
|
+
}
|
|
6885
|
+
function limitBelowUsageUsed(failure) {
|
|
6886
|
+
const used = findLimitBelowUsage(failure)?.used;
|
|
6887
|
+
return typeof used === "number" && Number.isFinite(used) ? used : null;
|
|
6888
|
+
}
|
|
6889
|
+
function findLimitBelowUsage(failure) {
|
|
6890
|
+
const seen = /* @__PURE__ */ new Set();
|
|
6891
|
+
const visit = (value, depth) => {
|
|
6892
|
+
if (depth > 4 || value == null || typeof value !== "object" || seen.has(value)) return null;
|
|
6893
|
+
seen.add(value);
|
|
6894
|
+
const error = value;
|
|
6895
|
+
if (error.code === LIMIT_BELOW_USAGE) return error;
|
|
6896
|
+
for (const child of [error.error, error.data, error.body, error.cause, error.publicError]) {
|
|
6897
|
+
const found = visit(child, depth + 1);
|
|
6898
|
+
if (found) return found;
|
|
6899
|
+
}
|
|
6900
|
+
return null;
|
|
6901
|
+
};
|
|
6902
|
+
return visit(failure, 0);
|
|
6903
|
+
}
|
|
6864
6904
|
|
|
6865
6905
|
// src/billing-content.tsx
|
|
6866
|
-
var
|
|
6867
|
-
var
|
|
6868
|
-
var
|
|
6906
|
+
var import_react17 = require("react");
|
|
6907
|
+
var import_ui11 = require("@streamoid/ui");
|
|
6908
|
+
var import_icons12 = require("@streamoid/icons");
|
|
6869
6909
|
|
|
6870
6910
|
// src/plan-comparison-data.ts
|
|
6871
6911
|
var PLAN_COMPARISON_COLUMNS = ["Free", "Pro", "Enterprise"];
|
|
@@ -7767,158 +7807,871 @@ function BuyCreditsModal({
|
|
|
7767
7807
|
);
|
|
7768
7808
|
}
|
|
7769
7809
|
|
|
7770
|
-
// src/
|
|
7771
|
-
var
|
|
7772
|
-
var
|
|
7773
|
-
|
|
7774
|
-
|
|
7775
|
-
|
|
7776
|
-
|
|
7777
|
-
|
|
7778
|
-
|
|
7779
|
-
|
|
7780
|
-
|
|
7781
|
-
|
|
7782
|
-
|
|
7783
|
-
|
|
7784
|
-
|
|
7810
|
+
// src/per-user-limits-view.tsx
|
|
7811
|
+
var import_react16 = require("react");
|
|
7812
|
+
var import_ui10 = require("@streamoid/ui");
|
|
7813
|
+
|
|
7814
|
+
// src/member-credit-limit-modal.tsx
|
|
7815
|
+
var import_react15 = require("react");
|
|
7816
|
+
var import_ui9 = require("@streamoid/ui");
|
|
7817
|
+
var import_icons11 = require("@streamoid/icons");
|
|
7818
|
+
|
|
7819
|
+
// src/credit-limits.ts
|
|
7820
|
+
var DAY_MS = 24 * 60 * 60 * 1e3;
|
|
7821
|
+
function creditCycleUnit(cycle) {
|
|
7822
|
+
if (!cycle) return "month";
|
|
7823
|
+
const days = (Date.parse(cycle.end) - Date.parse(cycle.start)) / DAY_MS;
|
|
7824
|
+
return Number.isFinite(days) && days > 200 ? "year" : "month";
|
|
7785
7825
|
}
|
|
7786
|
-
function
|
|
7787
|
-
if (
|
|
7788
|
-
|
|
7789
|
-
}
|
|
7790
|
-
return `$${(cents / 100).toFixed(2)}`;
|
|
7826
|
+
function formatCreditLimit(limit, unit) {
|
|
7827
|
+
if (limit === null) return "Unlimited";
|
|
7828
|
+
return `${limit.toLocaleString("en-US")} ${limit === 1 ? "credit" : "credits"} / ${unit}`;
|
|
7791
7829
|
}
|
|
7792
|
-
function
|
|
7793
|
-
return
|
|
7830
|
+
function roundCredits(value) {
|
|
7831
|
+
return Number(value.toFixed(2));
|
|
7794
7832
|
}
|
|
7795
|
-
function
|
|
7796
|
-
return
|
|
7833
|
+
function minimumCreditLimit(used) {
|
|
7834
|
+
return Math.ceil(roundCredits(used));
|
|
7797
7835
|
}
|
|
7798
|
-
function
|
|
7799
|
-
|
|
7800
|
-
|
|
7801
|
-
|
|
7802
|
-
|
|
7803
|
-
|
|
7804
|
-
|
|
7805
|
-
|
|
7806
|
-
|
|
7807
|
-
|
|
7836
|
+
function formatCredits(value) {
|
|
7837
|
+
return roundCredits(value).toLocaleString("en-US", { maximumFractionDigits: 2 });
|
|
7838
|
+
}
|
|
7839
|
+
function validateDefaultCreditLimitInput(raw) {
|
|
7840
|
+
return validateCreditLimitInput(raw, 0);
|
|
7841
|
+
}
|
|
7842
|
+
function cleanCreditLimitInput(value) {
|
|
7843
|
+
return value.replace(/[^\d.]/g, "");
|
|
7844
|
+
}
|
|
7845
|
+
function validateCreditLimitInput(raw, used) {
|
|
7846
|
+
const trimmed = raw.trim();
|
|
7847
|
+
if (!trimmed) return { ok: false, reason: "Enter a credit limit" };
|
|
7848
|
+
if (!/^\d+$/.test(trimmed)) {
|
|
7849
|
+
return { ok: false, reason: "Enter a whole number of credits" };
|
|
7808
7850
|
}
|
|
7809
|
-
const
|
|
7810
|
-
|
|
7811
|
-
|
|
7812
|
-
|
|
7813
|
-
|
|
7814
|
-
|
|
7815
|
-
}
|
|
7851
|
+
const value = Number(trimmed);
|
|
7852
|
+
if (!Number.isSafeInteger(value)) {
|
|
7853
|
+
return { ok: false, reason: "Enter a smaller number" };
|
|
7854
|
+
}
|
|
7855
|
+
if (value < roundCredits(used)) {
|
|
7856
|
+
return { ok: false, reason: belowUsageReason(used) };
|
|
7857
|
+
}
|
|
7858
|
+
return { ok: true, value };
|
|
7816
7859
|
}
|
|
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
|
-
});
|
|
7860
|
+
function belowUsageReason(used) {
|
|
7861
|
+
return `Must be at least ${minimumCreditLimit(used).toLocaleString("en-US")} \u2014 ${formatCredits(used)} already used this cycle`;
|
|
7826
7862
|
}
|
|
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;
|
|
7863
|
+
function describeDefaultLimit(response, unit) {
|
|
7864
|
+
return formatCreditLimit(response?.default?.limit ?? null, unit);
|
|
7842
7865
|
}
|
|
7843
|
-
function
|
|
7866
|
+
function describeMemberLimit(row, unit) {
|
|
7867
|
+
return formatCreditLimit(row.limit, unit);
|
|
7868
|
+
}
|
|
7869
|
+
function limitSourceLabel(row) {
|
|
7870
|
+
if (row.source === "override") return "Custom";
|
|
7871
|
+
if (row.source === "default") return "Default";
|
|
7872
|
+
return null;
|
|
7873
|
+
}
|
|
7874
|
+
function joinMembersWithLimits(members, response) {
|
|
7875
|
+
const byUser = /* @__PURE__ */ new Map();
|
|
7876
|
+
for (const entry of response?.users ?? []) byUser.set(entry.userId, entry);
|
|
7877
|
+
const def = response?.default ?? null;
|
|
7878
|
+
return members.map((member) => {
|
|
7879
|
+
const userId = member.user._id;
|
|
7880
|
+
const entry = byUser.get(userId);
|
|
7881
|
+
if (!entry) {
|
|
7882
|
+
return {
|
|
7883
|
+
member,
|
|
7884
|
+
userId,
|
|
7885
|
+
limit: def ? def.limit ?? null : null,
|
|
7886
|
+
source: def ? "default" : "none",
|
|
7887
|
+
hasLimit: false,
|
|
7888
|
+
used: 0,
|
|
7889
|
+
lastCycleUsed: 0
|
|
7890
|
+
};
|
|
7891
|
+
}
|
|
7892
|
+
const hasLimit = Boolean(entry.hasLimit);
|
|
7893
|
+
return {
|
|
7894
|
+
member,
|
|
7895
|
+
userId,
|
|
7896
|
+
limit: entry.limit ?? null,
|
|
7897
|
+
source: entry.source ?? (hasLimit ? "override" : def ? "default" : "none"),
|
|
7898
|
+
hasLimit,
|
|
7899
|
+
used: entry.used ?? 0,
|
|
7900
|
+
lastCycleUsed: entry.lastCycleUsed ?? 0
|
|
7901
|
+
};
|
|
7902
|
+
});
|
|
7903
|
+
}
|
|
7904
|
+
|
|
7905
|
+
// src/member-credit-limit-modal.tsx
|
|
7906
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
7907
|
+
var T12 = {
|
|
7908
|
+
primary: "var(--alias-text---icons-primary)",
|
|
7909
|
+
tertiary: "var(--alias-text---icons-tertiary)",
|
|
7910
|
+
muted: "var(--alias-text---icons-muted)",
|
|
7911
|
+
error: "var(--alias-text---icons-error, var(--alias-text-and-icons-error, #ff6b6b))",
|
|
7912
|
+
surface: "var(--primitives-neutral-825)",
|
|
7913
|
+
fillPlus: "var(--alias-fill-neutral-neutralplus)",
|
|
7914
|
+
borderSubtle: "var(--alias-border-subtle)",
|
|
7915
|
+
borderDivider: "var(--alias-border-divider)",
|
|
7916
|
+
font: "var(--font-family-font-family-body)",
|
|
7917
|
+
fsSm: "var(--font-size-font-size-sm)",
|
|
7918
|
+
fsLg: "var(--font-size-font-size-lg)",
|
|
7919
|
+
lhSm: "var(--line-height-line-height-sm)",
|
|
7920
|
+
lhLg: "var(--line-height-line-height-lg)",
|
|
7921
|
+
spXs: "var(--spacing-xs)",
|
|
7922
|
+
spXl: "var(--spacing-xl)",
|
|
7923
|
+
sp3xl: "var(--spacing-3xl)",
|
|
7924
|
+
sp6xl: "var(--spacing-6xl)",
|
|
7925
|
+
r3xl: "var(--radius-3xl)",
|
|
7926
|
+
r4xl: "var(--radius-4xl)"
|
|
7927
|
+
};
|
|
7928
|
+
function MemberCreditLimitModal({
|
|
7844
7929
|
open,
|
|
7845
|
-
|
|
7846
|
-
|
|
7847
|
-
|
|
7848
|
-
|
|
7849
|
-
|
|
7850
|
-
|
|
7930
|
+
title = "Set custom usage limit",
|
|
7931
|
+
description,
|
|
7932
|
+
subject,
|
|
7933
|
+
resetKey,
|
|
7934
|
+
used,
|
|
7935
|
+
initialLimit,
|
|
7936
|
+
isSet,
|
|
7937
|
+
unit,
|
|
7938
|
+
onSave,
|
|
7939
|
+
onRemove,
|
|
7940
|
+
removeLabel = "Remove",
|
|
7941
|
+
removeHint,
|
|
7942
|
+
saveSuccessMessage = "Usage limit updated",
|
|
7943
|
+
removeSuccessMessage = "Usage limit removed",
|
|
7851
7944
|
onClose,
|
|
7852
|
-
|
|
7945
|
+
onSaved,
|
|
7946
|
+
onStale
|
|
7853
7947
|
}) {
|
|
7854
|
-
const
|
|
7855
|
-
const
|
|
7856
|
-
const
|
|
7948
|
+
const { toast } = useSettingsAdapters();
|
|
7949
|
+
const initialUnlimited = initialLimit === null;
|
|
7950
|
+
const [unlimited, setUnlimited] = (0, import_react15.useState)(initialUnlimited);
|
|
7951
|
+
const [raw, setRaw] = (0, import_react15.useState)("");
|
|
7952
|
+
const [touched, setTouched] = (0, import_react15.useState)(false);
|
|
7953
|
+
const [saving, setSaving] = (0, import_react15.useState)(false);
|
|
7954
|
+
const [serverHint, setServerHint] = (0, import_react15.useState)(null);
|
|
7955
|
+
const [serverUsed, setServerUsed] = (0, import_react15.useState)(null);
|
|
7956
|
+
const close = () => {
|
|
7957
|
+
if (!saving) onClose();
|
|
7958
|
+
};
|
|
7959
|
+
useOverlayOpen(open, close);
|
|
7960
|
+
(0, import_react15.useEffect)(() => {
|
|
7961
|
+
if (!open) return;
|
|
7962
|
+
setUnlimited(initialUnlimited);
|
|
7963
|
+
setRaw(initialLimit !== null ? String(initialLimit) : "");
|
|
7964
|
+
setTouched(false);
|
|
7965
|
+
setSaving(false);
|
|
7966
|
+
setServerHint(null);
|
|
7967
|
+
setServerUsed(null);
|
|
7968
|
+
}, [open, resetKey, initialLimit, isSet, initialUnlimited]);
|
|
7857
7969
|
if (!open) return null;
|
|
7970
|
+
const usedNow = Math.max(used, serverUsed ?? 0);
|
|
7971
|
+
const validation = validateCreditLimitInput(raw, usedNow);
|
|
7972
|
+
const changed = !isSet || (unlimited ? !initialUnlimited : initialUnlimited || validation.ok && validation.value !== initialLimit);
|
|
7973
|
+
const canSave = !saving && changed && (unlimited || validation.ok);
|
|
7974
|
+
const hint = serverHint ?? (!unlimited && touched && !validation.ok ? validation.reason : null);
|
|
7975
|
+
const handleSave = async () => {
|
|
7976
|
+
if (!canSave) return;
|
|
7977
|
+
const next = unlimited ? null : validation.ok ? validation.value : null;
|
|
7978
|
+
setSaving(true);
|
|
7979
|
+
try {
|
|
7980
|
+
await onSave(next);
|
|
7981
|
+
toast.success(saveSuccessMessage);
|
|
7982
|
+
onSaved();
|
|
7983
|
+
onClose();
|
|
7984
|
+
} catch (err) {
|
|
7985
|
+
if (isLimitBelowUsage(err)) {
|
|
7986
|
+
const fresh = limitBelowUsageUsed(err) ?? usedNow;
|
|
7987
|
+
setServerUsed(fresh);
|
|
7988
|
+
setUnlimited(false);
|
|
7989
|
+
setServerHint(belowUsageReason(fresh));
|
|
7990
|
+
if (fresh !== used) onStale?.();
|
|
7991
|
+
} else {
|
|
7992
|
+
toast.error(errorMessage(err, { method: "PUT" }));
|
|
7993
|
+
}
|
|
7994
|
+
setSaving(false);
|
|
7995
|
+
}
|
|
7996
|
+
};
|
|
7997
|
+
const handleRemove = async () => {
|
|
7998
|
+
if (saving || !onRemove) return;
|
|
7999
|
+
setSaving(true);
|
|
8000
|
+
try {
|
|
8001
|
+
await onRemove();
|
|
8002
|
+
toast.success(removeSuccessMessage);
|
|
8003
|
+
onSaved();
|
|
8004
|
+
onClose();
|
|
8005
|
+
} catch (err) {
|
|
8006
|
+
toast.error(errorMessage(err, { method: "DELETE" }));
|
|
8007
|
+
setSaving(false);
|
|
8008
|
+
}
|
|
8009
|
+
};
|
|
8010
|
+
const bodyText = {
|
|
8011
|
+
fontFamily: T12.font,
|
|
8012
|
+
fontSize: T12.fsSm,
|
|
8013
|
+
lineHeight: T12.lhSm
|
|
8014
|
+
};
|
|
7858
8015
|
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
7859
8016
|
"div",
|
|
7860
8017
|
{
|
|
7861
8018
|
className: "fixed inset-0 z-50 flex items-center justify-center",
|
|
7862
8019
|
style: { backgroundColor: "rgba(0, 0, 0, 0.6)" },
|
|
7863
|
-
onClick: (
|
|
7864
|
-
if (
|
|
8020
|
+
onClick: (e) => {
|
|
8021
|
+
if (e.target === e.currentTarget) close();
|
|
7865
8022
|
},
|
|
7866
8023
|
children: /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
7867
8024
|
"div",
|
|
7868
8025
|
{
|
|
7869
|
-
className: "flex flex-col
|
|
8026
|
+
className: "flex flex-col items-start",
|
|
7870
8027
|
style: {
|
|
7871
|
-
backgroundColor:
|
|
7872
|
-
borderRadius:
|
|
7873
|
-
border:
|
|
7874
|
-
|
|
7875
|
-
|
|
7876
|
-
maxHeight: "
|
|
7877
|
-
overflowY: "auto"
|
|
8028
|
+
backgroundColor: T12.surface,
|
|
8029
|
+
borderRadius: T12.r4xl,
|
|
8030
|
+
border: `1px solid ${T12.borderSubtle}`,
|
|
8031
|
+
width: 480,
|
|
8032
|
+
maxWidth: "calc(100vw - 32px)",
|
|
8033
|
+
maxHeight: "85vh"
|
|
7878
8034
|
},
|
|
7879
8035
|
children: [
|
|
7880
|
-
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "
|
|
8036
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "shrink-0 w-full relative", children: [
|
|
7881
8037
|
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
7882
|
-
"
|
|
8038
|
+
"div",
|
|
7883
8039
|
{
|
|
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"
|
|
8040
|
+
"aria-hidden": true,
|
|
8041
|
+
className: "absolute inset-0 pointer-events-none",
|
|
8042
|
+
style: { borderBottom: `1px solid ${T12.borderDivider}` }
|
|
7893
8043
|
}
|
|
7894
8044
|
),
|
|
7895
|
-
/* @__PURE__ */ (0, import_jsx_runtime20.
|
|
7896
|
-
"
|
|
8045
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
8046
|
+
"div",
|
|
7897
8047
|
{
|
|
7898
|
-
|
|
7899
|
-
|
|
7900
|
-
|
|
7901
|
-
|
|
8048
|
+
className: "flex items-center w-full",
|
|
8049
|
+
style: { gap: T12.sp3xl, padding: `${T12.sp3xl} ${T12.sp6xl}` },
|
|
8050
|
+
children: [
|
|
8051
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
8052
|
+
"p",
|
|
8053
|
+
{
|
|
8054
|
+
className: "flex-1 min-w-0 overflow-hidden text-ellipsis whitespace-nowrap",
|
|
8055
|
+
style: {
|
|
8056
|
+
color: T12.primary,
|
|
8057
|
+
fontFamily: T12.font,
|
|
8058
|
+
fontSize: T12.fsLg,
|
|
8059
|
+
fontWeight: 600,
|
|
8060
|
+
lineHeight: T12.lhLg
|
|
8061
|
+
},
|
|
8062
|
+
children: title
|
|
8063
|
+
}
|
|
8064
|
+
),
|
|
8065
|
+
/* @__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 }) })
|
|
8066
|
+
]
|
|
7902
8067
|
}
|
|
7903
8068
|
)
|
|
7904
8069
|
] }),
|
|
7905
|
-
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
7906
|
-
"div",
|
|
7907
|
-
{
|
|
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)(
|
|
8070
|
+
/* @__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)(
|
|
7916
8071
|
"div",
|
|
7917
8072
|
{
|
|
7918
|
-
className: "flex flex-col w-full",
|
|
7919
|
-
style: { gap:
|
|
8073
|
+
className: "flex flex-col items-start w-full",
|
|
8074
|
+
style: { padding: `${T12.sp3xl} ${T12.sp6xl}`, gap: T12.sp3xl },
|
|
7920
8075
|
children: [
|
|
8076
|
+
(subject || description) && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex flex-col w-full min-w-0", children: [
|
|
8077
|
+
subject?.name?.trim() && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
8078
|
+
"span",
|
|
8079
|
+
{
|
|
8080
|
+
className: "truncate",
|
|
8081
|
+
style: { ...bodyText, fontWeight: 500, color: T12.primary },
|
|
8082
|
+
children: subject.name
|
|
8083
|
+
}
|
|
8084
|
+
),
|
|
8085
|
+
subject && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
8086
|
+
"span",
|
|
8087
|
+
{
|
|
8088
|
+
className: "truncate",
|
|
8089
|
+
style: {
|
|
8090
|
+
...bodyText,
|
|
8091
|
+
color: subject.name?.trim() ? T12.muted : T12.primary
|
|
8092
|
+
},
|
|
8093
|
+
children: subject.email
|
|
8094
|
+
}
|
|
8095
|
+
),
|
|
8096
|
+
subject && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("span", { style: { ...bodyText, color: T12.tertiary, marginTop: T12.spXs }, children: [
|
|
8097
|
+
"Used this cycle: ",
|
|
8098
|
+
formatCredits(usedNow),
|
|
8099
|
+
" credits"
|
|
8100
|
+
] }),
|
|
8101
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { style: { ...bodyText, color: T12.tertiary }, children: description })
|
|
8102
|
+
] }),
|
|
8103
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex flex-col w-full", style: { gap: T12.spXs }, children: [
|
|
8104
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex items-center w-full", style: { gap: T12.sp3xl }, children: [
|
|
8105
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
8106
|
+
import_ui9.ScPairtext,
|
|
8107
|
+
{
|
|
8108
|
+
type: "radio",
|
|
8109
|
+
content: "",
|
|
8110
|
+
checked: !unlimited,
|
|
8111
|
+
onChange: () => {
|
|
8112
|
+
if (!saving) setUnlimited(false);
|
|
8113
|
+
}
|
|
8114
|
+
}
|
|
8115
|
+
),
|
|
8116
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
8117
|
+
"div",
|
|
8118
|
+
{
|
|
8119
|
+
className: "flex-1 min-w-0 flex items-center",
|
|
8120
|
+
style: {
|
|
8121
|
+
background: T12.fillPlus,
|
|
8122
|
+
height: 48,
|
|
8123
|
+
borderRadius: T12.r3xl,
|
|
8124
|
+
padding: `${T12.spXl} ${T12.sp3xl}`,
|
|
8125
|
+
gap: T12.spXl,
|
|
8126
|
+
border: hint ? `1px solid ${T12.error}` : "1px solid transparent",
|
|
8127
|
+
opacity: unlimited ? 0.6 : 1
|
|
8128
|
+
},
|
|
8129
|
+
children: [
|
|
8130
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
8131
|
+
"input",
|
|
8132
|
+
{
|
|
8133
|
+
inputMode: "numeric",
|
|
8134
|
+
"aria-label": "Credit limit",
|
|
8135
|
+
"aria-invalid": hint ? true : void 0,
|
|
8136
|
+
placeholder: "Enter credits",
|
|
8137
|
+
value: raw,
|
|
8138
|
+
disabled: saving,
|
|
8139
|
+
onFocus: () => setUnlimited(false),
|
|
8140
|
+
onChange: (e) => {
|
|
8141
|
+
setRaw(cleanCreditLimitInput(e.target.value));
|
|
8142
|
+
setTouched(true);
|
|
8143
|
+
setServerHint(null);
|
|
8144
|
+
},
|
|
8145
|
+
className: "flex-1 min-w-0",
|
|
8146
|
+
style: {
|
|
8147
|
+
...bodyText,
|
|
8148
|
+
background: "transparent",
|
|
8149
|
+
border: "none",
|
|
8150
|
+
outline: "none",
|
|
8151
|
+
color: T12.primary,
|
|
8152
|
+
padding: 0
|
|
8153
|
+
}
|
|
8154
|
+
}
|
|
8155
|
+
),
|
|
8156
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("span", { className: "shrink-0", style: { ...bodyText, color: T12.muted }, children: [
|
|
8157
|
+
"credits / ",
|
|
8158
|
+
unit
|
|
8159
|
+
] })
|
|
8160
|
+
]
|
|
8161
|
+
}
|
|
8162
|
+
)
|
|
8163
|
+
] }),
|
|
8164
|
+
hint && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { role: "alert", style: { ...bodyText, color: T12.error }, children: hint })
|
|
8165
|
+
] }),
|
|
7921
8166
|
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
8167
|
+
import_ui9.ScPairtext,
|
|
8168
|
+
{
|
|
8169
|
+
type: "radio",
|
|
8170
|
+
content: "Unlimited usage",
|
|
8171
|
+
checked: unlimited,
|
|
8172
|
+
onChange: () => {
|
|
8173
|
+
if (saving) return;
|
|
8174
|
+
setUnlimited(true);
|
|
8175
|
+
setServerHint(null);
|
|
8176
|
+
}
|
|
8177
|
+
}
|
|
8178
|
+
),
|
|
8179
|
+
onRemove && removeHint && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { style: { ...bodyText, color: T12.muted }, children: removeHint })
|
|
8180
|
+
]
|
|
8181
|
+
}
|
|
8182
|
+
) }),
|
|
8183
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "shrink-0 w-full relative", children: [
|
|
8184
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
8185
|
+
"div",
|
|
8186
|
+
{
|
|
8187
|
+
"aria-hidden": true,
|
|
8188
|
+
className: "absolute inset-0 pointer-events-none",
|
|
8189
|
+
style: { borderTop: `1px solid ${T12.borderDivider}` }
|
|
8190
|
+
}
|
|
8191
|
+
),
|
|
8192
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
8193
|
+
"div",
|
|
8194
|
+
{
|
|
8195
|
+
className: "flex items-center w-full",
|
|
8196
|
+
style: {
|
|
8197
|
+
padding: `${T12.sp3xl} ${T12.sp6xl}`,
|
|
8198
|
+
justifyContent: onRemove ? "space-between" : "flex-end"
|
|
8199
|
+
},
|
|
8200
|
+
children: [
|
|
8201
|
+
onRemove && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
8202
|
+
import_ui9.ScButton,
|
|
8203
|
+
{
|
|
8204
|
+
text: removeLabel,
|
|
8205
|
+
variant: "error",
|
|
8206
|
+
size: "md",
|
|
8207
|
+
state: saving ? "disabled" : "default",
|
|
8208
|
+
onClick: saving ? void 0 : () => void handleRemove()
|
|
8209
|
+
}
|
|
8210
|
+
),
|
|
8211
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
8212
|
+
import_ui9.ScButton,
|
|
8213
|
+
{
|
|
8214
|
+
text: "Save",
|
|
8215
|
+
variant: "primary",
|
|
8216
|
+
size: "md",
|
|
8217
|
+
state: canSave ? "default" : "disabled",
|
|
8218
|
+
onClick: canSave ? () => void handleSave() : void 0
|
|
8219
|
+
}
|
|
8220
|
+
)
|
|
8221
|
+
]
|
|
8222
|
+
}
|
|
8223
|
+
)
|
|
8224
|
+
] })
|
|
8225
|
+
]
|
|
8226
|
+
}
|
|
8227
|
+
)
|
|
8228
|
+
}
|
|
8229
|
+
);
|
|
8230
|
+
}
|
|
8231
|
+
|
|
8232
|
+
// src/per-user-limits-view.tsx
|
|
8233
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
8234
|
+
var T13 = {
|
|
8235
|
+
primary: "var(--alias-text---icons-primary)",
|
|
8236
|
+
muted: "var(--alias-text---icons-muted)",
|
|
8237
|
+
fillPlus: "var(--alias-fill-neutral-neutralplus)",
|
|
8238
|
+
surfaceBase: "var(--alias-surface-base)",
|
|
8239
|
+
borderSubtle: "var(--alias-border-subtle)",
|
|
8240
|
+
font: "var(--font-family-font-family-body)",
|
|
8241
|
+
fsSm: "var(--font-size-font-size-sm)",
|
|
8242
|
+
fsXl: "var(--font-size-font-size-xl)",
|
|
8243
|
+
lhSm: "var(--line-height-line-height-sm)",
|
|
8244
|
+
lhXl: "var(--line-height-line-height-xl)",
|
|
8245
|
+
spMd: "var(--spacing-md)",
|
|
8246
|
+
sp3xl: "var(--spacing-3xl)",
|
|
8247
|
+
sp6xl: "var(--spacing-6xl)",
|
|
8248
|
+
r3xl: "var(--radius-3xl)"
|
|
8249
|
+
};
|
|
8250
|
+
var COLUMNS = "minmax(200px, 1fr) 140px 150px 190px 80px";
|
|
8251
|
+
var cellText = {
|
|
8252
|
+
fontFamily: T13.font,
|
|
8253
|
+
fontSize: T13.fsSm,
|
|
8254
|
+
lineHeight: T13.lhSm,
|
|
8255
|
+
color: T13.primary
|
|
8256
|
+
};
|
|
8257
|
+
function LimitRow({
|
|
8258
|
+
row,
|
|
8259
|
+
unit,
|
|
8260
|
+
onEdit
|
|
8261
|
+
}) {
|
|
8262
|
+
const name = row.member.user.name?.trim() ?? "";
|
|
8263
|
+
const email = row.member.user.email || "";
|
|
8264
|
+
const displayIdent = name || email.split("@")[0] || "user";
|
|
8265
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
8266
|
+
"div",
|
|
8267
|
+
{
|
|
8268
|
+
style: {
|
|
8269
|
+
borderBottom: `1px solid ${T13.borderSubtle}`,
|
|
8270
|
+
display: "grid",
|
|
8271
|
+
gridTemplateColumns: COLUMNS,
|
|
8272
|
+
alignItems: "center",
|
|
8273
|
+
padding: `8px ${T13.sp3xl}`,
|
|
8274
|
+
gap: 24
|
|
8275
|
+
},
|
|
8276
|
+
onMouseEnter: (e) => {
|
|
8277
|
+
e.currentTarget.style.background = T13.fillPlus;
|
|
8278
|
+
},
|
|
8279
|
+
onMouseLeave: (e) => {
|
|
8280
|
+
e.currentTarget.style.background = "transparent";
|
|
8281
|
+
},
|
|
8282
|
+
children: [
|
|
8283
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center min-w-0", style: { gap: T13.spMd }, children: [
|
|
8284
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ProfileAvatar, { name: displayIdent, size: 32 }),
|
|
8285
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex flex-col min-w-0", children: [
|
|
8286
|
+
name && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "truncate", style: { ...cellText, fontWeight: 500 }, children: name }),
|
|
8287
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
8288
|
+
"span",
|
|
8289
|
+
{
|
|
8290
|
+
className: "truncate",
|
|
8291
|
+
style: { ...cellText, color: name ? T13.muted : T13.primary },
|
|
8292
|
+
children: email || "\u2014"
|
|
8293
|
+
}
|
|
8294
|
+
)
|
|
8295
|
+
] })
|
|
8296
|
+
] }),
|
|
8297
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { style: cellText, children: formatCredits(row.used) }),
|
|
8298
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { style: cellText, children: formatCredits(row.lastCycleUsed) }),
|
|
8299
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex flex-col min-w-0", children: [
|
|
8300
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { style: cellText, children: describeMemberLimit(row, unit) }),
|
|
8301
|
+
limitSourceLabel(row) && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { style: { ...cellText, color: T13.muted }, children: limitSourceLabel(row) })
|
|
8302
|
+
] }),
|
|
8303
|
+
/* @__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 }) })
|
|
8304
|
+
]
|
|
8305
|
+
}
|
|
8306
|
+
);
|
|
8307
|
+
}
|
|
8308
|
+
function PerUserLimitsView() {
|
|
8309
|
+
const { api, workspace, toast } = useSettingsAdapters();
|
|
8310
|
+
const workspaceId = workspace.current?.id ?? null;
|
|
8311
|
+
const [members, setMembers] = (0, import_react16.useState)([]);
|
|
8312
|
+
const [limits, setLimits] = (0, import_react16.useState)(null);
|
|
8313
|
+
const [loading, setLoading] = (0, import_react16.useState)(true);
|
|
8314
|
+
const [failed, setFailed] = (0, import_react16.useState)(false);
|
|
8315
|
+
const [searchQuery, setSearchQuery] = (0, import_react16.useState)("");
|
|
8316
|
+
const [editing, setEditing] = (0, import_react16.useState)(null);
|
|
8317
|
+
const [editingDefault, setEditingDefault] = (0, import_react16.useState)(false);
|
|
8318
|
+
const latestLoad = (0, import_react16.useRef)(0);
|
|
8319
|
+
const load = (0, import_react16.useCallback)(async ({ refresh = false } = {}) => {
|
|
8320
|
+
const loadId = ++latestLoad.current;
|
|
8321
|
+
if (!api.fetchMemberCreditLimits) {
|
|
8322
|
+
setLoading(false);
|
|
8323
|
+
setFailed(true);
|
|
8324
|
+
return;
|
|
8325
|
+
}
|
|
8326
|
+
const [nextMembers, nextLimits] = await Promise.all([
|
|
8327
|
+
api.fetchMembers().catch(() => null),
|
|
8328
|
+
api.fetchMemberCreditLimits().catch(() => null)
|
|
8329
|
+
]);
|
|
8330
|
+
if (loadId !== latestLoad.current) return;
|
|
8331
|
+
if (refresh && (!nextMembers || !nextLimits)) {
|
|
8332
|
+
toast.error("Couldn't refresh usage limits. Reopen this page to see the latest.");
|
|
8333
|
+
return;
|
|
8334
|
+
}
|
|
8335
|
+
setFailed(!nextMembers || !nextLimits);
|
|
8336
|
+
setMembers(nextMembers ?? []);
|
|
8337
|
+
setLimits(nextLimits);
|
|
8338
|
+
setLoading(false);
|
|
8339
|
+
}, [api, toast]);
|
|
8340
|
+
(0, import_react16.useEffect)(() => {
|
|
8341
|
+
setLoading(true);
|
|
8342
|
+
setFailed(false);
|
|
8343
|
+
setMembers([]);
|
|
8344
|
+
setLimits(null);
|
|
8345
|
+
setEditing(null);
|
|
8346
|
+
setEditingDefault(false);
|
|
8347
|
+
setSearchQuery("");
|
|
8348
|
+
void load();
|
|
8349
|
+
}, [workspaceId]);
|
|
8350
|
+
(0, import_react16.useEffect)(
|
|
8351
|
+
() => () => {
|
|
8352
|
+
latestLoad.current += 1;
|
|
8353
|
+
},
|
|
8354
|
+
[]
|
|
8355
|
+
);
|
|
8356
|
+
const unit = creditCycleUnit(limits?.cycle);
|
|
8357
|
+
const rows = (0, import_react16.useMemo)(
|
|
8358
|
+
() => joinMembersWithLimits(members, limits),
|
|
8359
|
+
[members, limits]
|
|
8360
|
+
);
|
|
8361
|
+
const filtered = (0, import_react16.useMemo)(() => {
|
|
8362
|
+
const q = searchQuery.trim().toLowerCase();
|
|
8363
|
+
if (!q) return rows;
|
|
8364
|
+
return rows.filter(
|
|
8365
|
+
({ member }) => (member.user.name ?? "").toLowerCase().includes(q) || (member.user.email ?? "").toLowerCase().includes(q)
|
|
8366
|
+
);
|
|
8367
|
+
}, [rows, searchQuery]);
|
|
8368
|
+
if (loading) {
|
|
8369
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
8370
|
+
"div",
|
|
8371
|
+
{
|
|
8372
|
+
className: "flex items-center justify-center w-full",
|
|
8373
|
+
style: {
|
|
8374
|
+
backgroundColor: T13.surfaceBase,
|
|
8375
|
+
borderRadius: T13.r3xl,
|
|
8376
|
+
padding: T13.sp6xl
|
|
8377
|
+
},
|
|
8378
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
8379
|
+
"div",
|
|
8380
|
+
{
|
|
8381
|
+
className: "animate-spin",
|
|
8382
|
+
style: {
|
|
8383
|
+
width: 24,
|
|
8384
|
+
height: 24,
|
|
8385
|
+
borderRadius: "var(--radius-full)",
|
|
8386
|
+
border: "2px solid var(--alias-border-subtle)",
|
|
8387
|
+
borderTopColor: "var(--alias-text---icons-primary)"
|
|
8388
|
+
}
|
|
8389
|
+
}
|
|
8390
|
+
)
|
|
8391
|
+
}
|
|
8392
|
+
);
|
|
8393
|
+
}
|
|
8394
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex flex-col flex-1 min-h-0 w-full", style: { gap: 16 }, children: [
|
|
8395
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex flex-col shrink-0", style: { gap: 4 }, children: [
|
|
8396
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
8397
|
+
"span",
|
|
8398
|
+
{
|
|
8399
|
+
style: {
|
|
8400
|
+
fontFamily: T13.font,
|
|
8401
|
+
fontSize: T13.fsXl,
|
|
8402
|
+
fontWeight: 500,
|
|
8403
|
+
lineHeight: T13.lhXl,
|
|
8404
|
+
color: T13.primary
|
|
8405
|
+
},
|
|
8406
|
+
children: "Per-user usage limits"
|
|
8407
|
+
}
|
|
8408
|
+
),
|
|
8409
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { style: { ...cellText, color: T13.muted }, children: "Set a default for every member, and override it for individuals." })
|
|
8410
|
+
] }),
|
|
8411
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
8412
|
+
"div",
|
|
8413
|
+
{
|
|
8414
|
+
className: "flex items-center justify-between shrink-0 w-full",
|
|
8415
|
+
style: {
|
|
8416
|
+
gap: 12,
|
|
8417
|
+
padding: 16,
|
|
8418
|
+
backgroundColor: T13.surfaceBase,
|
|
8419
|
+
border: `1px solid ${T13.borderSubtle}`,
|
|
8420
|
+
borderRadius: T13.r3xl
|
|
8421
|
+
},
|
|
8422
|
+
children: [
|
|
8423
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex flex-col min-w-0", style: { gap: 4 }, children: [
|
|
8424
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { style: { ...cellText, fontWeight: 500 }, children: "Default limit per member" }),
|
|
8425
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { style: { ...cellText, color: T13.muted }, children: failed ? "\u2014" : describeDefaultLimit(limits, unit) })
|
|
8426
|
+
] }),
|
|
8427
|
+
api.setDefaultCreditLimit && !failed && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
8428
|
+
import_ui10.ScButton,
|
|
8429
|
+
{
|
|
8430
|
+
text: "Edit",
|
|
8431
|
+
variant: "secondary",
|
|
8432
|
+
size: "sm",
|
|
8433
|
+
onClick: () => setEditingDefault(true)
|
|
8434
|
+
}
|
|
8435
|
+
)
|
|
8436
|
+
]
|
|
8437
|
+
}
|
|
8438
|
+
),
|
|
8439
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
8440
|
+
MemberListToolbar,
|
|
8441
|
+
{
|
|
8442
|
+
activeTab: "active",
|
|
8443
|
+
onTabChange: () => {
|
|
8444
|
+
},
|
|
8445
|
+
activeLabel: "Members",
|
|
8446
|
+
activeCount: failed ? null : filtered.length,
|
|
8447
|
+
searchQuery,
|
|
8448
|
+
onSearchChange: setSearchQuery
|
|
8449
|
+
}
|
|
8450
|
+
),
|
|
8451
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
8452
|
+
MemberListFrame,
|
|
8453
|
+
{
|
|
8454
|
+
contentMinWidth: 860,
|
|
8455
|
+
header: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
8456
|
+
"div",
|
|
8457
|
+
{
|
|
8458
|
+
style: {
|
|
8459
|
+
display: "grid",
|
|
8460
|
+
gridTemplateColumns: COLUMNS,
|
|
8461
|
+
gap: 24,
|
|
8462
|
+
padding: "8px 16px",
|
|
8463
|
+
fontSize: 11,
|
|
8464
|
+
color: T13.muted,
|
|
8465
|
+
textTransform: "uppercase"
|
|
8466
|
+
},
|
|
8467
|
+
children: ["Name", "Used this cycle", "Last cycle's usage", "Limit", "Actions"].map(
|
|
8468
|
+
(label) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { children: label }, label)
|
|
8469
|
+
)
|
|
8470
|
+
}
|
|
8471
|
+
),
|
|
8472
|
+
isEmpty: failed || filtered.length === 0,
|
|
8473
|
+
emptyText: failed ? "Couldn't load usage limits. Try again later." : searchQuery.trim() ? "No members match your search" : "No members yet",
|
|
8474
|
+
children: filtered.map((row) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
8475
|
+
LimitRow,
|
|
8476
|
+
{
|
|
8477
|
+
row,
|
|
8478
|
+
unit,
|
|
8479
|
+
onEdit: api.setMemberCreditLimit ? () => setEditing(row) : void 0
|
|
8480
|
+
},
|
|
8481
|
+
row.userId
|
|
8482
|
+
))
|
|
8483
|
+
}
|
|
8484
|
+
),
|
|
8485
|
+
editing && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
8486
|
+
MemberCreditLimitModal,
|
|
8487
|
+
{
|
|
8488
|
+
open: true,
|
|
8489
|
+
resetKey: editing.userId,
|
|
8490
|
+
subject: { name: editing.member.user.name, email: editing.member.user.email },
|
|
8491
|
+
used: editing.used,
|
|
8492
|
+
initialLimit: editing.limit,
|
|
8493
|
+
isSet: editing.hasLimit,
|
|
8494
|
+
unit,
|
|
8495
|
+
onSave: (limit) => api.setMemberCreditLimit({ userId: editing.userId, limit }),
|
|
8496
|
+
onRemove: editing.hasLimit && api.removeMemberCreditLimit ? () => api.removeMemberCreditLimit(editing.userId) : void 0,
|
|
8497
|
+
removeLabel: limits?.default ? "Use default" : "Remove",
|
|
8498
|
+
removeHint: limits?.default ? `Falls back to the default: ${describeDefaultLimit(limits, unit)}` : "No default is set, so the member becomes unlimited.",
|
|
8499
|
+
onClose: () => setEditing(null),
|
|
8500
|
+
onSaved: () => void load({ refresh: true }),
|
|
8501
|
+
onStale: () => void load({ refresh: true })
|
|
8502
|
+
}
|
|
8503
|
+
),
|
|
8504
|
+
editingDefault && api.setDefaultCreditLimit && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
8505
|
+
MemberCreditLimitModal,
|
|
8506
|
+
{
|
|
8507
|
+
open: true,
|
|
8508
|
+
title: "Default usage limit",
|
|
8509
|
+
description: "Applies to every member without their own limit, including new members.",
|
|
8510
|
+
used: 0,
|
|
8511
|
+
initialLimit: limits?.default?.limit ?? null,
|
|
8512
|
+
isSet: Boolean(limits?.default),
|
|
8513
|
+
unit,
|
|
8514
|
+
onSave: (limit) => api.setDefaultCreditLimit(limit),
|
|
8515
|
+
saveSuccessMessage: "Default usage limit updated",
|
|
8516
|
+
onClose: () => setEditingDefault(false),
|
|
8517
|
+
onSaved: () => void load({ refresh: true })
|
|
8518
|
+
}
|
|
8519
|
+
)
|
|
8520
|
+
] });
|
|
8521
|
+
}
|
|
8522
|
+
|
|
8523
|
+
// src/billing-content.tsx
|
|
8524
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
8525
|
+
var DEFAULT_TOPUP_SERVICE = "catalogix";
|
|
8526
|
+
var PRIMARY_COLOR2 = "var(--alias-text---icons-primary)";
|
|
8527
|
+
var MUTED_COLOR = "var(--alias-text---icons-muted)";
|
|
8528
|
+
function formatDate2(iso) {
|
|
8529
|
+
try {
|
|
8530
|
+
return new Date(iso).toLocaleDateString("en-US", {
|
|
8531
|
+
month: "short",
|
|
8532
|
+
day: "numeric",
|
|
8533
|
+
year: "numeric"
|
|
8534
|
+
});
|
|
8535
|
+
} catch {
|
|
8536
|
+
return iso;
|
|
8537
|
+
}
|
|
8538
|
+
}
|
|
8539
|
+
function formatCurrency(cents, currency) {
|
|
8540
|
+
if (currency === "inr") {
|
|
8541
|
+
return `\u20B9${(cents / 100).toFixed(2)}`;
|
|
8542
|
+
}
|
|
8543
|
+
return `$${(cents / 100).toFixed(2)}`;
|
|
8544
|
+
}
|
|
8545
|
+
function getCurrencySymbolByCountry(country) {
|
|
8546
|
+
return country?.trim().toUpperCase() === "IN" ? "\u20B9" : "$";
|
|
8547
|
+
}
|
|
8548
|
+
function formatCredits2(n) {
|
|
8549
|
+
return n.toLocaleString("en-US");
|
|
8550
|
+
}
|
|
8551
|
+
function formatNextBillingDateLabel(iso) {
|
|
8552
|
+
if (iso) {
|
|
8553
|
+
const parsed = new Date(iso);
|
|
8554
|
+
if (!Number.isNaN(parsed.getTime())) {
|
|
8555
|
+
return parsed.toLocaleDateString("en-US", {
|
|
8556
|
+
month: "short",
|
|
8557
|
+
day: "numeric",
|
|
8558
|
+
year: "numeric"
|
|
8559
|
+
});
|
|
8560
|
+
}
|
|
8561
|
+
}
|
|
8562
|
+
const fallback = /* @__PURE__ */ new Date();
|
|
8563
|
+
fallback.setMonth(fallback.getMonth() + 1);
|
|
8564
|
+
return fallback.toLocaleDateString("en-US", {
|
|
8565
|
+
month: "short",
|
|
8566
|
+
day: "numeric",
|
|
8567
|
+
year: "numeric"
|
|
8568
|
+
});
|
|
8569
|
+
}
|
|
8570
|
+
function formatEffectiveDateLabel(value) {
|
|
8571
|
+
if (value == null) return "";
|
|
8572
|
+
const parsed = typeof value === "number" ? new Date(value < 1e10 ? value * 1e3 : value) : new Date(value);
|
|
8573
|
+
if (Number.isNaN(parsed.getTime())) return "";
|
|
8574
|
+
return parsed.toLocaleDateString("en-US", {
|
|
8575
|
+
month: "short",
|
|
8576
|
+
day: "numeric",
|
|
8577
|
+
year: "numeric"
|
|
8578
|
+
});
|
|
8579
|
+
}
|
|
8580
|
+
function useIsLightTheme() {
|
|
8581
|
+
const read = () => typeof document !== "undefined" && document.documentElement.getAttribute("data-theme") === "Light";
|
|
8582
|
+
const [isLight, setIsLight] = (0, import_react17.useState)(read);
|
|
8583
|
+
(0, import_react17.useEffect)(() => {
|
|
8584
|
+
if (typeof document === "undefined") return;
|
|
8585
|
+
const target = document.documentElement;
|
|
8586
|
+
const observer = new MutationObserver(() => setIsLight(read()));
|
|
8587
|
+
observer.observe(target, {
|
|
8588
|
+
attributes: true,
|
|
8589
|
+
attributeFilter: ["data-theme"]
|
|
8590
|
+
});
|
|
8591
|
+
setIsLight(read());
|
|
8592
|
+
return () => observer.disconnect();
|
|
8593
|
+
}, []);
|
|
8594
|
+
return isLight;
|
|
8595
|
+
}
|
|
8596
|
+
function UpdateSubscriptionModal({
|
|
8597
|
+
open,
|
|
8598
|
+
currentPlanName,
|
|
8599
|
+
currentPlanAmount,
|
|
8600
|
+
nextPlanName,
|
|
8601
|
+
nextPlanAmount,
|
|
8602
|
+
nextBillingDateLabel,
|
|
8603
|
+
loading,
|
|
8604
|
+
onClose,
|
|
8605
|
+
onProceed
|
|
8606
|
+
}) {
|
|
8607
|
+
const isLight = useIsLightTheme();
|
|
8608
|
+
const modalSurface = isLight ? "#ffffff" : "var(--alias-surface-base)";
|
|
8609
|
+
const cardBorder = isLight ? "1px solid var(--alias-border-subtle)" : "1px solid var(--alias-border-divider)";
|
|
8610
|
+
if (!open) return null;
|
|
8611
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
8612
|
+
"div",
|
|
8613
|
+
{
|
|
8614
|
+
className: "fixed inset-0 z-50 flex items-center justify-center",
|
|
8615
|
+
style: { backgroundColor: "rgba(0, 0, 0, 0.6)" },
|
|
8616
|
+
onClick: (event) => {
|
|
8617
|
+
if (event.target === event.currentTarget) onClose();
|
|
8618
|
+
},
|
|
8619
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
8620
|
+
"div",
|
|
8621
|
+
{
|
|
8622
|
+
className: "flex flex-col w-full max-w-xl",
|
|
8623
|
+
style: {
|
|
8624
|
+
backgroundColor: modalSurface,
|
|
8625
|
+
borderRadius: "var(--radius-3xl)",
|
|
8626
|
+
border: "1px solid var(--alias-border-subtle)",
|
|
8627
|
+
padding: "var(--spacing-6xl)",
|
|
8628
|
+
gap: "var(--spacing-6xl)",
|
|
8629
|
+
maxHeight: "90vh",
|
|
8630
|
+
overflowY: "auto"
|
|
8631
|
+
},
|
|
8632
|
+
children: [
|
|
8633
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex items-center w-full", children: [
|
|
8634
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
8635
|
+
"p",
|
|
8636
|
+
{
|
|
8637
|
+
className: "flex-1 min-w-0",
|
|
8638
|
+
style: {
|
|
8639
|
+
fontFamily: "var(--font-family-font-family-display)",
|
|
8640
|
+
fontSize: "var(--font-size-font-size-xxl)",
|
|
8641
|
+
fontWeight: 600,
|
|
8642
|
+
lineHeight: "var(--line-height-line-height-xxl)",
|
|
8643
|
+
color: "var(--alias-text---icons-primary)"
|
|
8644
|
+
},
|
|
8645
|
+
children: "Update Subscription"
|
|
8646
|
+
}
|
|
8647
|
+
),
|
|
8648
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
8649
|
+
"button",
|
|
8650
|
+
{
|
|
8651
|
+
type: "button",
|
|
8652
|
+
onClick: onClose,
|
|
8653
|
+
style: { background: "transparent", border: "none" },
|
|
8654
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_icons12.SiconClose, { className: "w-6 h-6", color: MUTED_COLOR })
|
|
8655
|
+
}
|
|
8656
|
+
)
|
|
8657
|
+
] }),
|
|
8658
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
8659
|
+
"div",
|
|
8660
|
+
{
|
|
8661
|
+
className: "w-full",
|
|
8662
|
+
style: {
|
|
8663
|
+
height: "1px",
|
|
8664
|
+
backgroundColor: "var(--alias-border-divider)"
|
|
8665
|
+
}
|
|
8666
|
+
}
|
|
8667
|
+
),
|
|
8668
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
8669
|
+
"div",
|
|
8670
|
+
{
|
|
8671
|
+
className: "flex flex-col w-full",
|
|
8672
|
+
style: { gap: "var(--spacing-3xl)" },
|
|
8673
|
+
children: [
|
|
8674
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
7922
8675
|
"p",
|
|
7923
8676
|
{
|
|
7924
8677
|
style: {
|
|
@@ -7931,7 +8684,7 @@ function UpdateSubscriptionModal({
|
|
|
7931
8684
|
children: "Current billing plan"
|
|
7932
8685
|
}
|
|
7933
8686
|
),
|
|
7934
|
-
/* @__PURE__ */ (0,
|
|
8687
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
7935
8688
|
"div",
|
|
7936
8689
|
{
|
|
7937
8690
|
className: "flex items-center w-full",
|
|
@@ -7942,7 +8695,7 @@ function UpdateSubscriptionModal({
|
|
|
7942
8695
|
padding: "var(--spacing-3xl)"
|
|
7943
8696
|
},
|
|
7944
8697
|
children: [
|
|
7945
|
-
/* @__PURE__ */ (0,
|
|
8698
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
7946
8699
|
"p",
|
|
7947
8700
|
{
|
|
7948
8701
|
className: "flex-1 min-w-0",
|
|
@@ -7956,8 +8709,8 @@ function UpdateSubscriptionModal({
|
|
|
7956
8709
|
children: currentPlanName || "Free"
|
|
7957
8710
|
}
|
|
7958
8711
|
),
|
|
7959
|
-
/* @__PURE__ */ (0,
|
|
7960
|
-
/* @__PURE__ */ (0,
|
|
8712
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex flex-col items-end", children: [
|
|
8713
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
7961
8714
|
"p",
|
|
7962
8715
|
{
|
|
7963
8716
|
style: {
|
|
@@ -7970,7 +8723,7 @@ function UpdateSubscriptionModal({
|
|
|
7970
8723
|
children: currentPlanAmount
|
|
7971
8724
|
}
|
|
7972
8725
|
),
|
|
7973
|
-
/* @__PURE__ */ (0,
|
|
8726
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
7974
8727
|
"p",
|
|
7975
8728
|
{
|
|
7976
8729
|
style: {
|
|
@@ -7987,7 +8740,7 @@ function UpdateSubscriptionModal({
|
|
|
7987
8740
|
]
|
|
7988
8741
|
}
|
|
7989
8742
|
),
|
|
7990
|
-
/* @__PURE__ */ (0,
|
|
8743
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "w-full flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
7991
8744
|
"div",
|
|
7992
8745
|
{
|
|
7993
8746
|
className: "flex items-center justify-center",
|
|
@@ -7998,10 +8751,10 @@ function UpdateSubscriptionModal({
|
|
|
7998
8751
|
backgroundColor: "var(--alias-fill-neutral-neutral)",
|
|
7999
8752
|
border: cardBorder
|
|
8000
8753
|
},
|
|
8001
|
-
children: /* @__PURE__ */ (0,
|
|
8754
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_icons12.SiconDoubleArrow, { className: "w-4 h-4", color: MUTED_COLOR })
|
|
8002
8755
|
}
|
|
8003
8756
|
) }),
|
|
8004
|
-
/* @__PURE__ */ (0,
|
|
8757
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
8005
8758
|
"p",
|
|
8006
8759
|
{
|
|
8007
8760
|
style: {
|
|
@@ -8017,7 +8770,7 @@ function UpdateSubscriptionModal({
|
|
|
8017
8770
|
]
|
|
8018
8771
|
}
|
|
8019
8772
|
),
|
|
8020
|
-
/* @__PURE__ */ (0,
|
|
8773
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
8021
8774
|
"div",
|
|
8022
8775
|
{
|
|
8023
8776
|
className: "flex items-center w-full",
|
|
@@ -8028,7 +8781,7 @@ function UpdateSubscriptionModal({
|
|
|
8028
8781
|
padding: "var(--spacing-3xl)"
|
|
8029
8782
|
},
|
|
8030
8783
|
children: [
|
|
8031
|
-
/* @__PURE__ */ (0,
|
|
8784
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
8032
8785
|
"p",
|
|
8033
8786
|
{
|
|
8034
8787
|
className: "flex-1 min-w-0",
|
|
@@ -8042,8 +8795,8 @@ function UpdateSubscriptionModal({
|
|
|
8042
8795
|
children: nextPlanName || "Pro"
|
|
8043
8796
|
}
|
|
8044
8797
|
),
|
|
8045
|
-
/* @__PURE__ */ (0,
|
|
8046
|
-
/* @__PURE__ */ (0,
|
|
8798
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex flex-col items-end", children: [
|
|
8799
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
8047
8800
|
"p",
|
|
8048
8801
|
{
|
|
8049
8802
|
style: {
|
|
@@ -8056,7 +8809,7 @@ function UpdateSubscriptionModal({
|
|
|
8056
8809
|
children: nextPlanAmount
|
|
8057
8810
|
}
|
|
8058
8811
|
),
|
|
8059
|
-
/* @__PURE__ */ (0,
|
|
8812
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
8060
8813
|
"p",
|
|
8061
8814
|
{
|
|
8062
8815
|
style: {
|
|
@@ -8073,7 +8826,7 @@ function UpdateSubscriptionModal({
|
|
|
8073
8826
|
]
|
|
8074
8827
|
}
|
|
8075
8828
|
),
|
|
8076
|
-
/* @__PURE__ */ (0,
|
|
8829
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
8077
8830
|
"div",
|
|
8078
8831
|
{
|
|
8079
8832
|
className: "w-full",
|
|
@@ -8083,8 +8836,8 @@ function UpdateSubscriptionModal({
|
|
|
8083
8836
|
}
|
|
8084
8837
|
}
|
|
8085
8838
|
),
|
|
8086
|
-
/* @__PURE__ */ (0,
|
|
8087
|
-
/* @__PURE__ */ (0,
|
|
8839
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex items-center w-full", children: [
|
|
8840
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
8088
8841
|
"p",
|
|
8089
8842
|
{
|
|
8090
8843
|
className: "flex-1 min-w-0",
|
|
@@ -8098,7 +8851,7 @@ function UpdateSubscriptionModal({
|
|
|
8098
8851
|
children: "Amount Due Today"
|
|
8099
8852
|
}
|
|
8100
8853
|
),
|
|
8101
|
-
/* @__PURE__ */ (0,
|
|
8854
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
8102
8855
|
"p",
|
|
8103
8856
|
{
|
|
8104
8857
|
style: {
|
|
@@ -8115,7 +8868,7 @@ function UpdateSubscriptionModal({
|
|
|
8115
8868
|
]
|
|
8116
8869
|
}
|
|
8117
8870
|
),
|
|
8118
|
-
/* @__PURE__ */ (0,
|
|
8871
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
8119
8872
|
"button",
|
|
8120
8873
|
{
|
|
8121
8874
|
type: "button",
|
|
@@ -8130,7 +8883,7 @@ function UpdateSubscriptionModal({
|
|
|
8130
8883
|
},
|
|
8131
8884
|
disabled: loading,
|
|
8132
8885
|
onClick: onProceed,
|
|
8133
|
-
children: /* @__PURE__ */ (0,
|
|
8886
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
8134
8887
|
"span",
|
|
8135
8888
|
{
|
|
8136
8889
|
style: {
|
|
@@ -8170,7 +8923,7 @@ function PlansView({
|
|
|
8170
8923
|
const workspaceCurrencySymbol = getCurrencySymbolByCountry(
|
|
8171
8924
|
workspace?.country
|
|
8172
8925
|
);
|
|
8173
|
-
const allPlans = (0,
|
|
8926
|
+
const allPlans = (0, import_react17.useMemo)(() => {
|
|
8174
8927
|
if (products.length > 0) {
|
|
8175
8928
|
return products.flatMap(
|
|
8176
8929
|
(product) => product.prices.filter((price) => Boolean(price.metadata?.credits)).map((price) => ({
|
|
@@ -8188,7 +8941,7 @@ function PlansView({
|
|
|
8188
8941
|
}
|
|
8189
8942
|
return [];
|
|
8190
8943
|
}, [products, currentPlanId]);
|
|
8191
|
-
const sortedPlans = (0,
|
|
8944
|
+
const sortedPlans = (0, import_react17.useMemo)(
|
|
8192
8945
|
() => [...allPlans].sort((a, b) => a.amount - b.amount),
|
|
8193
8946
|
[allPlans]
|
|
8194
8947
|
);
|
|
@@ -8205,8 +8958,8 @@ function PlansView({
|
|
|
8205
8958
|
const currentPlan = sortedPlans.find((plan) => plan.isCurrent) ?? freePlan;
|
|
8206
8959
|
const middlePlans = sortedPlans.filter((plan) => plan.amount > 0);
|
|
8207
8960
|
const currentPlanAmount = currentPlan?.amount ?? 0;
|
|
8208
|
-
const [selectedMiddlePlanKey, setSelectedMiddlePlanKey] = (0,
|
|
8209
|
-
(0,
|
|
8961
|
+
const [selectedMiddlePlanKey, setSelectedMiddlePlanKey] = (0, import_react17.useState)("");
|
|
8962
|
+
(0, import_react17.useEffect)(() => {
|
|
8210
8963
|
if (middlePlans.length === 0) {
|
|
8211
8964
|
setSelectedMiddlePlanKey("");
|
|
8212
8965
|
return;
|
|
@@ -8220,9 +8973,9 @@ function PlansView({
|
|
|
8220
8973
|
const isMiddleActionLoading = Boolean(
|
|
8221
8974
|
selectedMiddlePlan && actionInFlight === selectedMiddlePlan.key
|
|
8222
8975
|
);
|
|
8223
|
-
const [isPlanSelectorOpen, setIsPlanSelectorOpen] = (0,
|
|
8224
|
-
const planDropdownRef = (0,
|
|
8225
|
-
(0,
|
|
8976
|
+
const [isPlanSelectorOpen, setIsPlanSelectorOpen] = (0, import_react17.useState)(false);
|
|
8977
|
+
const planDropdownRef = (0, import_react17.useRef)(null);
|
|
8978
|
+
(0, import_react17.useEffect)(() => {
|
|
8226
8979
|
if (!isPlanSelectorOpen) return;
|
|
8227
8980
|
const handleClickOutside = (event) => {
|
|
8228
8981
|
const target = event.target;
|
|
@@ -8240,8 +8993,8 @@ function PlansView({
|
|
|
8240
8993
|
const isCurrentWithDowngrade = Boolean(
|
|
8241
8994
|
currentPlan?.isCurrent && downgradeScheduled
|
|
8242
8995
|
);
|
|
8243
|
-
const [showUpgradeConfirmModal, setShowUpgradeConfirmModal] = (0,
|
|
8244
|
-
return /* @__PURE__ */ (0,
|
|
8996
|
+
const [showUpgradeConfirmModal, setShowUpgradeConfirmModal] = (0, import_react17.useState)(false);
|
|
8997
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
8245
8998
|
"div",
|
|
8246
8999
|
{
|
|
8247
9000
|
className: "flex flex-col items-start relative size-full overflow-y-auto",
|
|
@@ -8252,12 +9005,12 @@ function PlansView({
|
|
|
8252
9005
|
backgroundSize: "24px 24px"
|
|
8253
9006
|
},
|
|
8254
9007
|
children: [
|
|
8255
|
-
!hideHeader && /* @__PURE__ */ (0,
|
|
9008
|
+
!hideHeader && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
8256
9009
|
"div",
|
|
8257
9010
|
{
|
|
8258
9011
|
className: "flex items-center justify-end shrink-0 w-full",
|
|
8259
9012
|
style: { gap: "var(--spacing-lg)" },
|
|
8260
|
-
children: /* @__PURE__ */ (0,
|
|
9013
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
8261
9014
|
"div",
|
|
8262
9015
|
{
|
|
8263
9016
|
className: "flex items-center shrink-0 cursor-pointer",
|
|
@@ -8271,8 +9024,8 @@ function PlansView({
|
|
|
8271
9024
|
},
|
|
8272
9025
|
onClick: onBack,
|
|
8273
9026
|
children: [
|
|
8274
|
-
/* @__PURE__ */ (0,
|
|
8275
|
-
/* @__PURE__ */ (0,
|
|
9027
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_icons12.SiconLeft, { className: "w-4 h-4", color: MUTED_COLOR }),
|
|
9028
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
8276
9029
|
"span",
|
|
8277
9030
|
{
|
|
8278
9031
|
style: {
|
|
@@ -8290,14 +9043,14 @@ function PlansView({
|
|
|
8290
9043
|
)
|
|
8291
9044
|
}
|
|
8292
9045
|
),
|
|
8293
|
-
/* @__PURE__ */ (0,
|
|
9046
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
8294
9047
|
"div",
|
|
8295
9048
|
{
|
|
8296
9049
|
className: "grid w-full grid-cols-1 md:grid-cols-2 xl:grid-cols-3 items-stretch",
|
|
8297
9050
|
style: { gap: "var(--spacing-8xl)" },
|
|
8298
9051
|
children: [
|
|
8299
|
-
/* @__PURE__ */ (0,
|
|
8300
|
-
|
|
9052
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "h-full", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
9053
|
+
import_ui11.ScPlanCard,
|
|
8301
9054
|
{
|
|
8302
9055
|
planName: freePlan?.planName || "Free",
|
|
8303
9056
|
price: stripMonthly(freePlan?.price || `${workspaceCurrencySymbol}0`),
|
|
@@ -8326,8 +9079,8 @@ function PlansView({
|
|
|
8326
9079
|
className: "h-full"
|
|
8327
9080
|
}
|
|
8328
9081
|
) }),
|
|
8329
|
-
/* @__PURE__ */ (0,
|
|
8330
|
-
|
|
9082
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "h-full", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
9083
|
+
import_ui11.ScPlanCard,
|
|
8331
9084
|
{
|
|
8332
9085
|
planName: "Pro",
|
|
8333
9086
|
price: stripMonthly(selectedMiddlePlan?.price || "\u2014"),
|
|
@@ -8347,7 +9100,7 @@ function PlansView({
|
|
|
8347
9100
|
setShowUpgradeConfirmModal(true);
|
|
8348
9101
|
},
|
|
8349
9102
|
onIncreaseCredits: () => setIsPlanSelectorOpen((prev) => !prev),
|
|
8350
|
-
creditsDropdown: isPlanSelectorOpen ? /* @__PURE__ */ (0,
|
|
9103
|
+
creditsDropdown: isPlanSelectorOpen ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
8351
9104
|
"div",
|
|
8352
9105
|
{
|
|
8353
9106
|
ref: planDropdownRef,
|
|
@@ -8364,7 +9117,7 @@ function PlansView({
|
|
|
8364
9117
|
},
|
|
8365
9118
|
children: middlePlans.map((plan) => {
|
|
8366
9119
|
const selected = plan.key === selectedMiddlePlanKey;
|
|
8367
|
-
return /* @__PURE__ */ (0,
|
|
9120
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
8368
9121
|
"button",
|
|
8369
9122
|
{
|
|
8370
9123
|
type: "button",
|
|
@@ -8382,7 +9135,7 @@ function PlansView({
|
|
|
8382
9135
|
setIsPlanSelectorOpen(false);
|
|
8383
9136
|
},
|
|
8384
9137
|
children: [
|
|
8385
|
-
/* @__PURE__ */ (0,
|
|
9138
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
8386
9139
|
"span",
|
|
8387
9140
|
{
|
|
8388
9141
|
className: "flex-1 min-w-0 truncate",
|
|
@@ -8396,7 +9149,7 @@ function PlansView({
|
|
|
8396
9149
|
children: plan.credits
|
|
8397
9150
|
}
|
|
8398
9151
|
),
|
|
8399
|
-
/* @__PURE__ */ (0,
|
|
9152
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
8400
9153
|
"span",
|
|
8401
9154
|
{
|
|
8402
9155
|
style: {
|
|
@@ -8419,8 +9172,8 @@ function PlansView({
|
|
|
8419
9172
|
className: "h-full"
|
|
8420
9173
|
}
|
|
8421
9174
|
) }),
|
|
8422
|
-
/* @__PURE__ */ (0,
|
|
8423
|
-
|
|
9175
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "h-full", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
9176
|
+
import_ui11.ScPlanCard,
|
|
8424
9177
|
{
|
|
8425
9178
|
planName: "Enterprise",
|
|
8426
9179
|
type: "custom",
|
|
@@ -8436,8 +9189,8 @@ function PlansView({
|
|
|
8436
9189
|
]
|
|
8437
9190
|
}
|
|
8438
9191
|
),
|
|
8439
|
-
/* @__PURE__ */ (0,
|
|
8440
|
-
|
|
9192
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
9193
|
+
import_ui11.ScPlanComparison,
|
|
8441
9194
|
{
|
|
8442
9195
|
layout: "table",
|
|
8443
9196
|
columns: [...PLAN_COMPARISON_COLUMNS],
|
|
@@ -8446,7 +9199,7 @@ function PlansView({
|
|
|
8446
9199
|
highlightColumnIndex: 1
|
|
8447
9200
|
}
|
|
8448
9201
|
),
|
|
8449
|
-
/* @__PURE__ */ (0,
|
|
9202
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
8450
9203
|
UpdateSubscriptionModal,
|
|
8451
9204
|
{
|
|
8452
9205
|
open: showUpgradeConfirmModal,
|
|
@@ -8481,7 +9234,7 @@ function BillingTabBar({
|
|
|
8481
9234
|
activeTab,
|
|
8482
9235
|
onTabChange
|
|
8483
9236
|
}) {
|
|
8484
|
-
return /* @__PURE__ */ (0,
|
|
9237
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
8485
9238
|
"div",
|
|
8486
9239
|
{
|
|
8487
9240
|
className: "flex items-center shrink-0 relative",
|
|
@@ -8493,8 +9246,8 @@ function BillingTabBar({
|
|
|
8493
9246
|
border: "0.5px solid var(--alias-border-subtle)"
|
|
8494
9247
|
},
|
|
8495
9248
|
children: [
|
|
8496
|
-
/* @__PURE__ */ (0,
|
|
8497
|
-
|
|
9249
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
9250
|
+
import_ui11.ScTabComp,
|
|
8498
9251
|
{
|
|
8499
9252
|
text: "Invoice history",
|
|
8500
9253
|
type: "text-only",
|
|
@@ -8503,8 +9256,8 @@ function BillingTabBar({
|
|
|
8503
9256
|
style: { flex: 1 }
|
|
8504
9257
|
}
|
|
8505
9258
|
),
|
|
8506
|
-
/* @__PURE__ */ (0,
|
|
8507
|
-
|
|
9259
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
9260
|
+
import_ui11.ScTabComp,
|
|
8508
9261
|
{
|
|
8509
9262
|
text: "Usage logs",
|
|
8510
9263
|
type: "text-only",
|
|
@@ -8565,7 +9318,7 @@ function InvoiceHistoryTable({
|
|
|
8565
9318
|
}
|
|
8566
9319
|
};
|
|
8567
9320
|
if (loading) {
|
|
8568
|
-
return /* @__PURE__ */ (0,
|
|
9321
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
8569
9322
|
"div",
|
|
8570
9323
|
{
|
|
8571
9324
|
className: "flex items-center justify-center w-full",
|
|
@@ -8574,7 +9327,7 @@ function InvoiceHistoryTable({
|
|
|
8574
9327
|
borderRadius: "var(--radius-3xl)",
|
|
8575
9328
|
padding: "var(--spacing-6xl)"
|
|
8576
9329
|
},
|
|
8577
|
-
children: /* @__PURE__ */ (0,
|
|
9330
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
8578
9331
|
"div",
|
|
8579
9332
|
{
|
|
8580
9333
|
className: "animate-spin",
|
|
@@ -8590,7 +9343,7 @@ function InvoiceHistoryTable({
|
|
|
8590
9343
|
}
|
|
8591
9344
|
);
|
|
8592
9345
|
}
|
|
8593
|
-
return /* @__PURE__ */ (0,
|
|
9346
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
8594
9347
|
"div",
|
|
8595
9348
|
{
|
|
8596
9349
|
className: "flex-1 min-h-0 w-full relative",
|
|
@@ -8601,7 +9354,7 @@ function InvoiceHistoryTable({
|
|
|
8601
9354
|
overflowY: "auto"
|
|
8602
9355
|
},
|
|
8603
9356
|
children: [
|
|
8604
|
-
/* @__PURE__ */ (0,
|
|
9357
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
8605
9358
|
"div",
|
|
8606
9359
|
{
|
|
8607
9360
|
style: {
|
|
@@ -8610,15 +9363,15 @@ function InvoiceHistoryTable({
|
|
|
8610
9363
|
zIndex: 1,
|
|
8611
9364
|
backgroundColor: "var(--alias-surface-base)"
|
|
8612
9365
|
},
|
|
8613
|
-
children: /* @__PURE__ */ (0,
|
|
9366
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_ui11.ScBillingHistoryHeader, {})
|
|
8614
9367
|
}
|
|
8615
9368
|
),
|
|
8616
|
-
invoices.length === 0 && /* @__PURE__ */ (0,
|
|
9369
|
+
invoices.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
8617
9370
|
"div",
|
|
8618
9371
|
{
|
|
8619
9372
|
className: "flex items-center justify-center w-full",
|
|
8620
9373
|
style: { padding: "var(--spacing-6xl)" },
|
|
8621
|
-
children: /* @__PURE__ */ (0,
|
|
9374
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
8622
9375
|
"span",
|
|
8623
9376
|
{
|
|
8624
9377
|
style: {
|
|
@@ -8633,8 +9386,8 @@ function InvoiceHistoryTable({
|
|
|
8633
9386
|
)
|
|
8634
9387
|
}
|
|
8635
9388
|
),
|
|
8636
|
-
invoices.map((inv) => /* @__PURE__ */ (0,
|
|
8637
|
-
|
|
9389
|
+
invoices.map((inv) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
9390
|
+
import_ui11.ScBillingHistoryTableList,
|
|
8638
9391
|
{
|
|
8639
9392
|
invoiceNumber: inv.transactionId ? `# ${inv.transactionId.slice(0, 16).toUpperCase()}` : "# INV-UNKNOWN",
|
|
8640
9393
|
amount: inv.amountPaid != null ? `${currencySymbol}${inv.amountPaid.toFixed(2)}` : `${currencySymbol}${(inv.amount / 100).toFixed(2)}`,
|
|
@@ -8654,7 +9407,7 @@ function UsageLogsTable({
|
|
|
8654
9407
|
loading
|
|
8655
9408
|
}) {
|
|
8656
9409
|
if (loading) {
|
|
8657
|
-
return /* @__PURE__ */ (0,
|
|
9410
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
8658
9411
|
"div",
|
|
8659
9412
|
{
|
|
8660
9413
|
className: "flex items-center justify-center w-full",
|
|
@@ -8663,7 +9416,7 @@ function UsageLogsTable({
|
|
|
8663
9416
|
borderRadius: "var(--radius-3xl)",
|
|
8664
9417
|
padding: "var(--spacing-6xl)"
|
|
8665
9418
|
},
|
|
8666
|
-
children: /* @__PURE__ */ (0,
|
|
9419
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
8667
9420
|
"div",
|
|
8668
9421
|
{
|
|
8669
9422
|
className: "animate-spin",
|
|
@@ -8679,7 +9432,7 @@ function UsageLogsTable({
|
|
|
8679
9432
|
}
|
|
8680
9433
|
);
|
|
8681
9434
|
}
|
|
8682
|
-
return /* @__PURE__ */ (0,
|
|
9435
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
8683
9436
|
"div",
|
|
8684
9437
|
{
|
|
8685
9438
|
className: "flex-1 min-h-0 w-full relative",
|
|
@@ -8690,7 +9443,7 @@ function UsageLogsTable({
|
|
|
8690
9443
|
overflowY: "auto"
|
|
8691
9444
|
},
|
|
8692
9445
|
children: [
|
|
8693
|
-
/* @__PURE__ */ (0,
|
|
9446
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
8694
9447
|
"div",
|
|
8695
9448
|
{
|
|
8696
9449
|
style: {
|
|
@@ -8705,40 +9458,40 @@ function UsageLogsTable({
|
|
|
8705
9458
|
alignItems: "center"
|
|
8706
9459
|
},
|
|
8707
9460
|
children: [
|
|
8708
|
-
/* @__PURE__ */ (0,
|
|
8709
|
-
|
|
9461
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
9462
|
+
import_ui11.ScHeader,
|
|
8710
9463
|
{
|
|
8711
9464
|
text: "App",
|
|
8712
9465
|
state: "none",
|
|
8713
9466
|
style: { flex: 1, alignItems: "flex-start", gap: "0.25rem" }
|
|
8714
9467
|
}
|
|
8715
9468
|
),
|
|
8716
|
-
/* @__PURE__ */ (0,
|
|
8717
|
-
|
|
9469
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
9470
|
+
import_ui11.ScHeader,
|
|
8718
9471
|
{
|
|
8719
9472
|
text: "Activity",
|
|
8720
9473
|
state: "none",
|
|
8721
9474
|
style: { flex: 1, alignItems: "flex-start", gap: "0.25rem" }
|
|
8722
9475
|
}
|
|
8723
9476
|
),
|
|
8724
|
-
/* @__PURE__ */ (0,
|
|
8725
|
-
|
|
9477
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
9478
|
+
import_ui11.ScHeader,
|
|
8726
9479
|
{
|
|
8727
9480
|
text: "Used by",
|
|
8728
9481
|
state: "none",
|
|
8729
9482
|
style: { flexShrink: 0, width: "7.5rem" }
|
|
8730
9483
|
}
|
|
8731
9484
|
),
|
|
8732
|
-
/* @__PURE__ */ (0,
|
|
8733
|
-
|
|
9485
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
9486
|
+
import_ui11.ScHeader,
|
|
8734
9487
|
{
|
|
8735
9488
|
text: "Date",
|
|
8736
9489
|
state: "none",
|
|
8737
9490
|
style: { flexShrink: 0, width: "7.5rem" }
|
|
8738
9491
|
}
|
|
8739
9492
|
),
|
|
8740
|
-
/* @__PURE__ */ (0,
|
|
8741
|
-
|
|
9493
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
9494
|
+
import_ui11.ScHeader,
|
|
8742
9495
|
{
|
|
8743
9496
|
text: "Credits",
|
|
8744
9497
|
state: "none",
|
|
@@ -8752,12 +9505,12 @@ function UsageLogsTable({
|
|
|
8752
9505
|
]
|
|
8753
9506
|
}
|
|
8754
9507
|
),
|
|
8755
|
-
logs.length === 0 && /* @__PURE__ */ (0,
|
|
9508
|
+
logs.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
8756
9509
|
"div",
|
|
8757
9510
|
{
|
|
8758
9511
|
className: "flex items-center justify-center w-full",
|
|
8759
9512
|
style: { padding: "var(--spacing-6xl)" },
|
|
8760
|
-
children: /* @__PURE__ */ (0,
|
|
9513
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
8761
9514
|
"span",
|
|
8762
9515
|
{
|
|
8763
9516
|
style: {
|
|
@@ -8789,7 +9542,7 @@ function UsageLogsTable({
|
|
|
8789
9542
|
overflow: "hidden",
|
|
8790
9543
|
whiteSpace: "nowrap"
|
|
8791
9544
|
};
|
|
8792
|
-
return /* @__PURE__ */ (0,
|
|
9545
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
8793
9546
|
"div",
|
|
8794
9547
|
{
|
|
8795
9548
|
style: {
|
|
@@ -8801,11 +9554,11 @@ function UsageLogsTable({
|
|
|
8801
9554
|
alignItems: "center"
|
|
8802
9555
|
},
|
|
8803
9556
|
children: [
|
|
8804
|
-
/* @__PURE__ */ (0,
|
|
8805
|
-
/* @__PURE__ */ (0,
|
|
8806
|
-
/* @__PURE__ */ (0,
|
|
8807
|
-
/* @__PURE__ */ (0,
|
|
8808
|
-
/* @__PURE__ */ (0,
|
|
9557
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { style: { ...rowCellRegular, flex: 1 }, children: app }),
|
|
9558
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { style: { ...rowCellRegular, flex: 1 }, children: activity }),
|
|
9559
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { style: { ...rowCellRegular, width: "7.5rem" }, children: userName }),
|
|
9560
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { style: { ...rowCellRegular, width: "7.5rem" }, children: formatDate2(log.createdAt) }),
|
|
9561
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
8809
9562
|
"div",
|
|
8810
9563
|
{
|
|
8811
9564
|
style: {
|
|
@@ -8835,7 +9588,9 @@ function UsageLogsTable({
|
|
|
8835
9588
|
function BillingContent({
|
|
8836
9589
|
embedded = false,
|
|
8837
9590
|
showPlans: showPlansProp,
|
|
8838
|
-
onShowPlansChange
|
|
9591
|
+
onShowPlansChange,
|
|
9592
|
+
showPerUserLimits: showPerUserLimitsProp,
|
|
9593
|
+
onShowPerUserLimitsChange
|
|
8839
9594
|
} = {}) {
|
|
8840
9595
|
const { auth, workspace, api, toast, navigation } = useSettingsAdapters();
|
|
8841
9596
|
const user = auth.user;
|
|
@@ -8847,35 +9602,41 @@ function BillingContent({
|
|
|
8847
9602
|
if (typeof window === "undefined") return "";
|
|
8848
9603
|
return `${window.location.origin}${window.location.pathname}`;
|
|
8849
9604
|
};
|
|
8850
|
-
const [activeTab, setActiveTab] = (0,
|
|
8851
|
-
const [showPlansInternal, setShowPlansInternal] = (0,
|
|
9605
|
+
const [activeTab, setActiveTab] = (0, import_react17.useState)("invoice");
|
|
9606
|
+
const [showPlansInternal, setShowPlansInternal] = (0, import_react17.useState)(false);
|
|
8852
9607
|
const showPlans = showPlansProp ?? showPlansInternal;
|
|
8853
9608
|
const setShowPlans = (next) => {
|
|
8854
9609
|
if (onShowPlansChange) onShowPlansChange(next);
|
|
8855
9610
|
else setShowPlansInternal(next);
|
|
8856
9611
|
};
|
|
8857
|
-
const [
|
|
8858
|
-
const
|
|
8859
|
-
const
|
|
8860
|
-
|
|
8861
|
-
|
|
8862
|
-
|
|
8863
|
-
const [
|
|
8864
|
-
const [
|
|
8865
|
-
const [
|
|
8866
|
-
const [
|
|
9612
|
+
const [showPerUserLimitsInternal, setShowPerUserLimitsInternal] = (0, import_react17.useState)(false);
|
|
9613
|
+
const showPerUserLimits = (showPerUserLimitsProp ?? showPerUserLimitsInternal) && Boolean(api.fetchMemberCreditLimits);
|
|
9614
|
+
const setShowPerUserLimits = (next) => {
|
|
9615
|
+
if (onShowPerUserLimitsChange) onShowPerUserLimitsChange(next);
|
|
9616
|
+
else setShowPerUserLimitsInternal(next);
|
|
9617
|
+
};
|
|
9618
|
+
const [showExportModal, setShowExportModal] = (0, import_react17.useState)(false);
|
|
9619
|
+
const [showBuyCreditsModal, setShowBuyCreditsModal] = (0, import_react17.useState)(false);
|
|
9620
|
+
const [subscription, setSubscription] = (0, import_react17.useState)(null);
|
|
9621
|
+
const [availableCredits, setAvailableCredits] = (0, import_react17.useState)(null);
|
|
9622
|
+
const [products, setProducts] = (0, import_react17.useState)([]);
|
|
9623
|
+
const [invoices, setInvoices] = (0, import_react17.useState)([]);
|
|
9624
|
+
const [totalCredits, setTotalCredits] = (0, import_react17.useState)(null);
|
|
9625
|
+
const [usageLogs, setUsageLogs] = (0, import_react17.useState)([]);
|
|
9626
|
+
const [userMap, setUserMap] = (0, import_react17.useState)({});
|
|
9627
|
+
const [customPlanCredits, setCustomPlanCredits] = (0, import_react17.useState)(
|
|
8867
9628
|
null
|
|
8868
9629
|
);
|
|
8869
|
-
const [planActionInFlight, setPlanActionInFlight] = (0,
|
|
9630
|
+
const [planActionInFlight, setPlanActionInFlight] = (0, import_react17.useState)(
|
|
8870
9631
|
null
|
|
8871
9632
|
);
|
|
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,
|
|
9633
|
+
const [buyCreditsInFlight, setBuyCreditsInFlight] = (0, import_react17.useState)(false);
|
|
9634
|
+
const [loadingBilling, setLoadingBilling] = (0, import_react17.useState)(false);
|
|
9635
|
+
const [billingOverviewLoaded, setBillingOverviewLoaded] = (0, import_react17.useState)(false);
|
|
9636
|
+
const [loadingTable, setLoadingTable] = (0, import_react17.useState)(false);
|
|
9637
|
+
const [showInitialLoader, setShowInitialLoader] = (0, import_react17.useState)(true);
|
|
9638
|
+
const [initialFetchTriggered, setInitialFetchTriggered] = (0, import_react17.useState)(false);
|
|
9639
|
+
const logBillingEvent = (0, import_react17.useCallback)(
|
|
8879
9640
|
async (eventName, description, metadata) => {
|
|
8880
9641
|
if (!api.sendBillingEvent) return;
|
|
8881
9642
|
try {
|
|
@@ -8885,7 +9646,7 @@ function BillingContent({
|
|
|
8885
9646
|
},
|
|
8886
9647
|
[api]
|
|
8887
9648
|
);
|
|
8888
|
-
const ensureWorkspaceOnBilling = (0,
|
|
9649
|
+
const ensureWorkspaceOnBilling = (0, import_react17.useCallback)(async () => {
|
|
8889
9650
|
if (!api.createWorkspaceOnBilling) return false;
|
|
8890
9651
|
try {
|
|
8891
9652
|
await api.createWorkspaceOnBilling({ serviceNames: [] });
|
|
@@ -8894,7 +9655,7 @@ function BillingContent({
|
|
|
8894
9655
|
return false;
|
|
8895
9656
|
}
|
|
8896
9657
|
}, [api]);
|
|
8897
|
-
const fetchBillingOverview = (0,
|
|
9658
|
+
const fetchBillingOverview = (0, import_react17.useCallback)(async () => {
|
|
8898
9659
|
setLoadingBilling(true);
|
|
8899
9660
|
setBillingOverviewLoaded(false);
|
|
8900
9661
|
try {
|
|
@@ -8928,7 +9689,7 @@ function BillingContent({
|
|
|
8928
9689
|
setBillingOverviewLoaded(true);
|
|
8929
9690
|
}
|
|
8930
9691
|
}, [api, workspace.current?.country]);
|
|
8931
|
-
const fetchUserMap = (0,
|
|
9692
|
+
const fetchUserMap = (0, import_react17.useCallback)(async () => {
|
|
8932
9693
|
try {
|
|
8933
9694
|
const members = await api.fetchMembers();
|
|
8934
9695
|
if (members && members.length) {
|
|
@@ -8941,7 +9702,7 @@ function BillingContent({
|
|
|
8941
9702
|
} catch {
|
|
8942
9703
|
}
|
|
8943
9704
|
}, [api]);
|
|
8944
|
-
const fetchTableData = (0,
|
|
9705
|
+
const fetchTableData = (0, import_react17.useCallback)(
|
|
8945
9706
|
async (tab) => {
|
|
8946
9707
|
setLoadingTable(true);
|
|
8947
9708
|
try {
|
|
@@ -8969,7 +9730,7 @@ function BillingContent({
|
|
|
8969
9730
|
},
|
|
8970
9731
|
[api]
|
|
8971
9732
|
);
|
|
8972
|
-
const handlePlanAction = (0,
|
|
9733
|
+
const handlePlanAction = (0, import_react17.useCallback)(
|
|
8973
9734
|
async ({ productId, priceId, planName: planName2 }) => {
|
|
8974
9735
|
if (!workspaceId || !user?.id || !user.email) {
|
|
8975
9736
|
toast.error("Missing account details for plan update");
|
|
@@ -9038,7 +9799,7 @@ function BillingContent({
|
|
|
9038
9799
|
toast
|
|
9039
9800
|
]
|
|
9040
9801
|
);
|
|
9041
|
-
const handleCancelDowngrade = (0,
|
|
9802
|
+
const handleCancelDowngrade = (0, import_react17.useCallback)(async () => {
|
|
9042
9803
|
if (!api.revertDowngrade) {
|
|
9043
9804
|
toast.error("Cancel downgrade is not available in this workspace");
|
|
9044
9805
|
return;
|
|
@@ -9064,7 +9825,7 @@ function BillingContent({
|
|
|
9064
9825
|
setPlanActionInFlight(null);
|
|
9065
9826
|
}
|
|
9066
9827
|
}, [api, fetchBillingOverview, logBillingEvent, toast]);
|
|
9067
|
-
(0,
|
|
9828
|
+
(0, import_react17.useEffect)(() => {
|
|
9068
9829
|
setShowInitialLoader(true);
|
|
9069
9830
|
setInitialFetchTriggered(false);
|
|
9070
9831
|
setBillingOverviewLoaded(false);
|
|
@@ -9074,22 +9835,22 @@ function BillingContent({
|
|
|
9074
9835
|
setTotalCredits(null);
|
|
9075
9836
|
setCustomPlanCredits(null);
|
|
9076
9837
|
}, [workspaceId]);
|
|
9077
|
-
(0,
|
|
9838
|
+
(0, import_react17.useEffect)(() => {
|
|
9078
9839
|
setInitialFetchTriggered(true);
|
|
9079
9840
|
fetchBillingOverview();
|
|
9080
9841
|
fetchUserMap();
|
|
9081
9842
|
}, [fetchBillingOverview, fetchUserMap]);
|
|
9082
9843
|
const usage = workspace.current?.usage ?? null;
|
|
9083
|
-
(0,
|
|
9844
|
+
(0, import_react17.useEffect)(() => {
|
|
9084
9845
|
void logBillingEvent("billing_page_viewed", "Billing page viewed", {
|
|
9085
9846
|
action: "view"
|
|
9086
9847
|
});
|
|
9087
9848
|
}, [logBillingEvent]);
|
|
9088
|
-
(0,
|
|
9849
|
+
(0, import_react17.useEffect)(() => {
|
|
9089
9850
|
setInitialFetchTriggered(true);
|
|
9090
9851
|
fetchTableData(activeTab);
|
|
9091
9852
|
}, [activeTab, fetchTableData]);
|
|
9092
|
-
(0,
|
|
9853
|
+
(0, import_react17.useEffect)(() => {
|
|
9093
9854
|
if (!showInitialLoader) return;
|
|
9094
9855
|
if (!initialFetchTriggered) return;
|
|
9095
9856
|
if (!billingOverviewLoaded) return;
|
|
@@ -9119,7 +9880,7 @@ function BillingContent({
|
|
|
9119
9880
|
preDowngradePlan?.credits ?? currentPlanPrice?.metadata?.credits
|
|
9120
9881
|
);
|
|
9121
9882
|
const currentPlanCredits = Number.isFinite(planCreditsFromPrice) ? planCreditsFromPrice : customPlanCredits;
|
|
9122
|
-
const planCreditsText = currentPlanCredits != null ? `${
|
|
9883
|
+
const planCreditsText = currentPlanCredits != null ? `${formatCredits2(currentPlanCredits)} credits` : "";
|
|
9123
9884
|
const scheduledDowngradeDateLabel = formatEffectiveDateLabel(
|
|
9124
9885
|
subscription?.scheduledDowngradeEffectiveDate
|
|
9125
9886
|
);
|
|
@@ -9128,7 +9889,7 @@ function BillingContent({
|
|
|
9128
9889
|
const usedCredits = availableCredits != null && totalCredits != null ? Math.max(0, totalCredits - availableCredits) : null;
|
|
9129
9890
|
const progressPct = usedCredits != null && totalCredits != null && totalCredits > 0 ? Math.min(100, Math.round(usedCredits / totalCredits * 100)) : 0;
|
|
9130
9891
|
const remainingPct = 100 - progressPct;
|
|
9131
|
-
const usageText = usedCredits != null ?
|
|
9892
|
+
const usageText = usedCredits != null ? formatCredits2(usedCredits) : availableCredits != null ? `${formatCredits2(availableCredits)} available` : customPlanCredits != null ? `${formatCredits2(customPlanCredits)} credits` : "\u2014";
|
|
9132
9893
|
const handleExport = async (startDate, endDate) => {
|
|
9133
9894
|
const end = new Date(endDate);
|
|
9134
9895
|
end.setHours(23, 59, 59, 999);
|
|
@@ -9256,7 +10017,7 @@ function BillingContent({
|
|
|
9256
10017
|
}
|
|
9257
10018
|
}
|
|
9258
10019
|
if (showInitialLoader) {
|
|
9259
|
-
const loader = /* @__PURE__ */ (0,
|
|
10020
|
+
const loader = /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
9260
10021
|
"div",
|
|
9261
10022
|
{
|
|
9262
10023
|
className: "flex items-center justify-center w-full",
|
|
@@ -9266,7 +10027,7 @@ function BillingContent({
|
|
|
9266
10027
|
border: "1px solid var(--alias-border-subtle)",
|
|
9267
10028
|
borderRadius: "var(--radius-3xl)"
|
|
9268
10029
|
},
|
|
9269
|
-
children: /* @__PURE__ */ (0,
|
|
10030
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
9270
10031
|
"div",
|
|
9271
10032
|
{
|
|
9272
10033
|
className: "animate-spin",
|
|
@@ -9282,7 +10043,7 @@ function BillingContent({
|
|
|
9282
10043
|
}
|
|
9283
10044
|
);
|
|
9284
10045
|
if (embedded) return loader;
|
|
9285
|
-
return /* @__PURE__ */ (0,
|
|
10046
|
+
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
10047
|
"div",
|
|
9287
10048
|
{
|
|
9288
10049
|
className: "flex flex-col items-start relative size-full overflow-y-auto",
|
|
@@ -9293,7 +10054,7 @@ function BillingContent({
|
|
|
9293
10054
|
backgroundSize: "24px 24px"
|
|
9294
10055
|
},
|
|
9295
10056
|
children: [
|
|
9296
|
-
/* @__PURE__ */ (0,
|
|
10057
|
+
/* @__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
10058
|
"p",
|
|
9298
10059
|
{
|
|
9299
10060
|
className: "flex-1 min-w-0 truncate",
|
|
@@ -9312,8 +10073,47 @@ function BillingContent({
|
|
|
9312
10073
|
}
|
|
9313
10074
|
) });
|
|
9314
10075
|
}
|
|
10076
|
+
if (showPerUserLimits) {
|
|
10077
|
+
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: [
|
|
10078
|
+
!onShowPerUserLimitsChange && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
10079
|
+
"div",
|
|
10080
|
+
{
|
|
10081
|
+
className: "flex items-center shrink-0 cursor-pointer",
|
|
10082
|
+
style: {
|
|
10083
|
+
gap: "var(--spacing-sm)",
|
|
10084
|
+
padding: "var(--spacing-xs) var(--spacing-lg)",
|
|
10085
|
+
borderRadius: "var(--radius-xl)",
|
|
10086
|
+
height: 32,
|
|
10087
|
+
width: "fit-content",
|
|
10088
|
+
border: "1px solid var(--alias-border-subtle)",
|
|
10089
|
+
backgroundColor: "var(--alias-surface-base)"
|
|
10090
|
+
},
|
|
10091
|
+
onClick: () => setShowPerUserLimits(false),
|
|
10092
|
+
children: [
|
|
10093
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_icons12.SiconLeft, { className: "w-4 h-4", color: "var(--alias-text---icons-muted)" }),
|
|
10094
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
10095
|
+
"span",
|
|
10096
|
+
{
|
|
10097
|
+
style: {
|
|
10098
|
+
fontFamily: "var(--font-family-font-family-body)",
|
|
10099
|
+
fontSize: "var(--font-size-font-size-sm)",
|
|
10100
|
+
fontWeight: 500,
|
|
10101
|
+
lineHeight: "var(--line-height-line-height-sm)",
|
|
10102
|
+
color: "var(--alias-text---icons-muted)"
|
|
10103
|
+
},
|
|
10104
|
+
children: "Back to billing"
|
|
10105
|
+
}
|
|
10106
|
+
)
|
|
10107
|
+
]
|
|
10108
|
+
}
|
|
10109
|
+
),
|
|
10110
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(PerUserLimitsView, {})
|
|
10111
|
+
] });
|
|
10112
|
+
if (embedded) return limitsView;
|
|
10113
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "flex-1 h-full min-h-0 min-w-0 relative", children: limitsView });
|
|
10114
|
+
}
|
|
9315
10115
|
if (showPlans) {
|
|
9316
|
-
const plansView = /* @__PURE__ */ (0,
|
|
10116
|
+
const plansView = /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
9317
10117
|
PlansView,
|
|
9318
10118
|
{
|
|
9319
10119
|
onBack: () => setShowPlans(false),
|
|
@@ -9330,17 +10130,17 @@ function BillingContent({
|
|
|
9330
10130
|
}
|
|
9331
10131
|
);
|
|
9332
10132
|
if (embedded) return plansView;
|
|
9333
|
-
return /* @__PURE__ */ (0,
|
|
10133
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "flex-1 h-full min-h-0 min-w-0 relative", children: plansView });
|
|
9334
10134
|
}
|
|
9335
|
-
const billingInnerContent = /* @__PURE__ */ (0,
|
|
9336
|
-
/* @__PURE__ */ (0,
|
|
10135
|
+
const billingInnerContent = /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_jsx_runtime22.Fragment, { children: [
|
|
10136
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
9337
10137
|
"div",
|
|
9338
10138
|
{
|
|
9339
10139
|
className: "flex items-start shrink-0 w-full",
|
|
9340
10140
|
style: { gap: 12 },
|
|
9341
10141
|
children: [
|
|
9342
|
-
/* @__PURE__ */ (0,
|
|
9343
|
-
|
|
10142
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
10143
|
+
import_ui11.ScPlanDetailsCard,
|
|
9344
10144
|
{
|
|
9345
10145
|
planName,
|
|
9346
10146
|
planCredits: planCreditsText,
|
|
@@ -9364,12 +10164,12 @@ function BillingContent({
|
|
|
9364
10164
|
}
|
|
9365
10165
|
}
|
|
9366
10166
|
),
|
|
9367
|
-
/* @__PURE__ */ (0,
|
|
9368
|
-
|
|
10167
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
10168
|
+
import_ui11.ScCreditsUsageCard,
|
|
9369
10169
|
{
|
|
9370
10170
|
usageLabel: "Credits used",
|
|
9371
10171
|
usageText,
|
|
9372
|
-
remainingText: availableCredits != null ? `${
|
|
10172
|
+
remainingText: availableCredits != null ? `${formatCredits2(availableCredits)} (${remainingPct}%) Remaining` : `${remainingPct}% Remaining`,
|
|
9373
10173
|
buyButtonText: "Buy credits",
|
|
9374
10174
|
buyButtonState: isFreePlan ? "disabled" : "default",
|
|
9375
10175
|
buyButtonHoverText: isFreePlan ? "Pro plan required" : void 0,
|
|
@@ -9389,7 +10189,7 @@ function BillingContent({
|
|
|
9389
10189
|
]
|
|
9390
10190
|
}
|
|
9391
10191
|
),
|
|
9392
|
-
usage ? /* @__PURE__ */ (0,
|
|
10192
|
+
usage ? /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
9393
10193
|
"div",
|
|
9394
10194
|
{
|
|
9395
10195
|
className: "grid shrink-0 w-full",
|
|
@@ -9398,9 +10198,9 @@ function BillingContent({
|
|
|
9398
10198
|
gridTemplateColumns: "repeat(auto-fit, minmax(18rem, 1fr))"
|
|
9399
10199
|
},
|
|
9400
10200
|
children: [
|
|
9401
|
-
/* @__PURE__ */ (0,
|
|
9402
|
-
/* @__PURE__ */ (0,
|
|
9403
|
-
|
|
10201
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_ui11.ScUsageMeterCard, { kind: "storage", plan: usage.plan, status: usage.storage }),
|
|
10202
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
10203
|
+
import_ui11.ScUsageMeterCard,
|
|
9404
10204
|
{
|
|
9405
10205
|
kind: "bandwidth",
|
|
9406
10206
|
plan: usage.plan,
|
|
@@ -9411,9 +10211,60 @@ function BillingContent({
|
|
|
9411
10211
|
]
|
|
9412
10212
|
}
|
|
9413
10213
|
) : null,
|
|
9414
|
-
/* @__PURE__ */ (0,
|
|
9415
|
-
|
|
9416
|
-
|
|
10214
|
+
api.fetchMemberCreditLimits ? /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
10215
|
+
"div",
|
|
10216
|
+
{
|
|
10217
|
+
className: "flex items-center justify-between shrink-0 w-full",
|
|
10218
|
+
style: {
|
|
10219
|
+
gap: 12,
|
|
10220
|
+
padding: 16,
|
|
10221
|
+
backgroundColor: "var(--alias-surface-base)",
|
|
10222
|
+
border: "1px solid var(--alias-border-subtle)",
|
|
10223
|
+
borderRadius: "var(--radius-3xl)"
|
|
10224
|
+
},
|
|
10225
|
+
children: [
|
|
10226
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex flex-col min-w-0", style: { gap: 4 }, children: [
|
|
10227
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
10228
|
+
"span",
|
|
10229
|
+
{
|
|
10230
|
+
style: {
|
|
10231
|
+
fontFamily: "var(--font-family-font-family-body)",
|
|
10232
|
+
fontSize: "var(--font-size-font-size-sm)",
|
|
10233
|
+
fontWeight: 500,
|
|
10234
|
+
lineHeight: "var(--line-height-line-height-sm)",
|
|
10235
|
+
color: "var(--alias-text---icons-primary)"
|
|
10236
|
+
},
|
|
10237
|
+
children: "Per-user usage limits"
|
|
10238
|
+
}
|
|
10239
|
+
),
|
|
10240
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
10241
|
+
"span",
|
|
10242
|
+
{
|
|
10243
|
+
style: {
|
|
10244
|
+
fontFamily: "var(--font-family-font-family-body)",
|
|
10245
|
+
fontSize: "var(--font-size-font-size-sm)",
|
|
10246
|
+
lineHeight: "var(--line-height-line-height-sm)",
|
|
10247
|
+
color: "var(--alias-text---icons-muted)"
|
|
10248
|
+
},
|
|
10249
|
+
children: "Set a default and per-member limits on credits per billing cycle"
|
|
10250
|
+
}
|
|
10251
|
+
)
|
|
10252
|
+
] }),
|
|
10253
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
10254
|
+
import_ui11.ScButton,
|
|
10255
|
+
{
|
|
10256
|
+
text: "Manage",
|
|
10257
|
+
variant: "secondary",
|
|
10258
|
+
size: "md",
|
|
10259
|
+
onClick: () => setShowPerUserLimits(true)
|
|
10260
|
+
}
|
|
10261
|
+
)
|
|
10262
|
+
]
|
|
10263
|
+
}
|
|
10264
|
+
) : null,
|
|
10265
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex items-center justify-between shrink-0 w-full", children: [
|
|
10266
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(BillingTabBar, { activeTab, onTabChange: setActiveTab }),
|
|
10267
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
9417
10268
|
"div",
|
|
9418
10269
|
{
|
|
9419
10270
|
className: "flex items-center shrink-0 cursor-pointer",
|
|
@@ -9425,8 +10276,8 @@ function BillingContent({
|
|
|
9425
10276
|
},
|
|
9426
10277
|
onClick: () => setShowExportModal(true),
|
|
9427
10278
|
children: [
|
|
9428
|
-
/* @__PURE__ */ (0,
|
|
9429
|
-
/* @__PURE__ */ (0,
|
|
10279
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_icons12.SiconDownload, { className: "w-5 h-5", color: PRIMARY_COLOR2 }),
|
|
10280
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
9430
10281
|
"span",
|
|
9431
10282
|
{
|
|
9432
10283
|
style: {
|
|
@@ -9443,14 +10294,14 @@ function BillingContent({
|
|
|
9443
10294
|
}
|
|
9444
10295
|
)
|
|
9445
10296
|
] }),
|
|
9446
|
-
activeTab === "invoice" ? /* @__PURE__ */ (0,
|
|
10297
|
+
activeTab === "invoice" ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
9447
10298
|
InvoiceHistoryTable,
|
|
9448
10299
|
{
|
|
9449
10300
|
invoices,
|
|
9450
10301
|
loading: loadingTable,
|
|
9451
10302
|
workspaceCountry: workspace.current?.country
|
|
9452
10303
|
}
|
|
9453
|
-
) : /* @__PURE__ */ (0,
|
|
10304
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
9454
10305
|
UsageLogsTable,
|
|
9455
10306
|
{
|
|
9456
10307
|
logs: usageLogs,
|
|
@@ -9458,7 +10309,7 @@ function BillingContent({
|
|
|
9458
10309
|
loading: loadingTable
|
|
9459
10310
|
}
|
|
9460
10311
|
),
|
|
9461
|
-
showExportModal && /* @__PURE__ */ (0,
|
|
10312
|
+
showExportModal && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
9462
10313
|
ExportDateModal,
|
|
9463
10314
|
{
|
|
9464
10315
|
title: activeTab === "invoice" ? "Export invoices" : "Export log",
|
|
@@ -9466,7 +10317,7 @@ function BillingContent({
|
|
|
9466
10317
|
onExport: handleExport
|
|
9467
10318
|
}
|
|
9468
10319
|
),
|
|
9469
|
-
showBuyCreditsModal && /* @__PURE__ */ (0,
|
|
10320
|
+
showBuyCreditsModal && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
9470
10321
|
BuyCreditsModal,
|
|
9471
10322
|
{
|
|
9472
10323
|
country: workspace.current?.country,
|
|
@@ -9481,7 +10332,7 @@ function BillingContent({
|
|
|
9481
10332
|
)
|
|
9482
10333
|
] });
|
|
9483
10334
|
if (embedded) {
|
|
9484
|
-
return /* @__PURE__ */ (0,
|
|
10335
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
9485
10336
|
"div",
|
|
9486
10337
|
{
|
|
9487
10338
|
className: "flex flex-col flex-1 min-w-0 min-h-0 w-full",
|
|
@@ -9490,7 +10341,7 @@ function BillingContent({
|
|
|
9490
10341
|
}
|
|
9491
10342
|
);
|
|
9492
10343
|
}
|
|
9493
|
-
return /* @__PURE__ */ (0,
|
|
10344
|
+
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
10345
|
"div",
|
|
9495
10346
|
{
|
|
9496
10347
|
className: "flex flex-col items-start relative size-full overflow-y-auto",
|
|
@@ -9501,7 +10352,7 @@ function BillingContent({
|
|
|
9501
10352
|
backgroundSize: "24px 24px"
|
|
9502
10353
|
},
|
|
9503
10354
|
children: [
|
|
9504
|
-
/* @__PURE__ */ (0,
|
|
10355
|
+
/* @__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
10356
|
"p",
|
|
9506
10357
|
{
|
|
9507
10358
|
className: "flex-1 min-w-0 truncate",
|
|
@@ -9522,10 +10373,10 @@ function BillingContent({
|
|
|
9522
10373
|
}
|
|
9523
10374
|
|
|
9524
10375
|
// src/tokens-content.tsx
|
|
9525
|
-
var
|
|
9526
|
-
var
|
|
9527
|
-
var
|
|
9528
|
-
var
|
|
10376
|
+
var import_react18 = require("react");
|
|
10377
|
+
var import_ui12 = require("@streamoid/ui");
|
|
10378
|
+
var import_icons13 = require("@streamoid/icons");
|
|
10379
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
9529
10380
|
var EXPIRY_OPTIONS = [
|
|
9530
10381
|
{ label: "30 days", value: "30d" },
|
|
9531
10382
|
{ label: "60 days", value: "60d" },
|
|
@@ -9545,7 +10396,7 @@ function isExpired(expiresAt) {
|
|
|
9545
10396
|
if (!expiresAt) return false;
|
|
9546
10397
|
return /* @__PURE__ */ new Date() > new Date(expiresAt);
|
|
9547
10398
|
}
|
|
9548
|
-
var
|
|
10399
|
+
var T14 = {
|
|
9549
10400
|
primary: "var(--alias-text---icons-primary)",
|
|
9550
10401
|
muted: "var(--alias-text---icons-muted)",
|
|
9551
10402
|
warning: "var(--alias-text---icons-warning)",
|
|
@@ -9567,9 +10418,9 @@ var T12 = {
|
|
|
9567
10418
|
};
|
|
9568
10419
|
function CreateTokenModal({ onClose, onCreated }) {
|
|
9569
10420
|
const { api, toast } = useSettingsAdapters();
|
|
9570
|
-
const [name, setName] = (0,
|
|
9571
|
-
const [expiry, setExpiry] = (0,
|
|
9572
|
-
const [loading, setLoading] = (0,
|
|
10421
|
+
const [name, setName] = (0, import_react18.useState)("");
|
|
10422
|
+
const [expiry, setExpiry] = (0, import_react18.useState)("never");
|
|
10423
|
+
const [loading, setLoading] = (0, import_react18.useState)(false);
|
|
9573
10424
|
async function handleCreate() {
|
|
9574
10425
|
if (!name.trim()) {
|
|
9575
10426
|
toast.error("Token name is required.");
|
|
@@ -9585,96 +10436,96 @@ function CreateTokenModal({ onClose, onCreated }) {
|
|
|
9585
10436
|
setLoading(false);
|
|
9586
10437
|
}
|
|
9587
10438
|
}
|
|
9588
|
-
return /* @__PURE__ */ (0,
|
|
10439
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
9589
10440
|
"div",
|
|
9590
10441
|
{
|
|
9591
10442
|
className: "fixed inset-0 flex items-center justify-center",
|
|
9592
10443
|
style: { backgroundColor: "rgba(0,0,0,0.6)", zIndex: 1e3 },
|
|
9593
10444
|
onClick: onClose,
|
|
9594
|
-
children: /* @__PURE__ */ (0,
|
|
10445
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
9595
10446
|
"div",
|
|
9596
10447
|
{
|
|
9597
10448
|
className: "flex flex-col items-start relative",
|
|
9598
10449
|
style: {
|
|
9599
|
-
backgroundColor:
|
|
9600
|
-
borderRadius:
|
|
10450
|
+
backgroundColor: T14.neutral825,
|
|
10451
|
+
borderRadius: T14.r4xl,
|
|
9601
10452
|
width: "min(40vw, 500px)",
|
|
9602
|
-
border: `1px solid ${
|
|
10453
|
+
border: `1px solid ${T14.borderSubtle}`
|
|
9603
10454
|
},
|
|
9604
10455
|
onClick: (e) => e.stopPropagation(),
|
|
9605
10456
|
children: [
|
|
9606
|
-
/* @__PURE__ */ (0,
|
|
10457
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
9607
10458
|
"div",
|
|
9608
10459
|
{
|
|
9609
10460
|
className: "relative shrink-0 w-full",
|
|
9610
|
-
style: { borderBottom: `1px solid ${
|
|
9611
|
-
children: /* @__PURE__ */ (0,
|
|
10461
|
+
style: { borderBottom: `1px solid ${T14.borderDivider}` },
|
|
10462
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
9612
10463
|
"div",
|
|
9613
10464
|
{
|
|
9614
10465
|
className: "flex items-center w-full",
|
|
9615
|
-
style: { padding: `${
|
|
10466
|
+
style: { padding: `${T14.spXl} ${T14.sp3xl}` },
|
|
9616
10467
|
children: [
|
|
9617
|
-
/* @__PURE__ */ (0,
|
|
10468
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
9618
10469
|
"p",
|
|
9619
10470
|
{
|
|
9620
10471
|
className: "flex-1 min-w-0 truncate",
|
|
9621
10472
|
style: {
|
|
9622
|
-
fontFamily:
|
|
9623
|
-
fontSize:
|
|
10473
|
+
fontFamily: T14.fontDisplay,
|
|
10474
|
+
fontSize: T14.fsLg,
|
|
9624
10475
|
fontWeight: 600,
|
|
9625
|
-
lineHeight:
|
|
9626
|
-
color:
|
|
10476
|
+
lineHeight: T14.lhLg,
|
|
10477
|
+
color: T14.primary,
|
|
9627
10478
|
margin: 0
|
|
9628
10479
|
},
|
|
9629
10480
|
children: "Create New Token"
|
|
9630
10481
|
}
|
|
9631
10482
|
),
|
|
9632
|
-
/* @__PURE__ */ (0,
|
|
10483
|
+
/* @__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
10484
|
]
|
|
9634
10485
|
}
|
|
9635
10486
|
)
|
|
9636
10487
|
}
|
|
9637
10488
|
),
|
|
9638
|
-
/* @__PURE__ */ (0,
|
|
10489
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
9639
10490
|
"div",
|
|
9640
10491
|
{
|
|
9641
10492
|
className: "flex flex-col items-start shrink-0 w-full",
|
|
9642
|
-
style: { padding:
|
|
10493
|
+
style: { padding: T14.sp3xl, gap: T14.sp3xl },
|
|
9643
10494
|
children: [
|
|
9644
|
-
/* @__PURE__ */ (0,
|
|
10495
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
9645
10496
|
"div",
|
|
9646
10497
|
{
|
|
9647
10498
|
className: "flex flex-col items-start shrink-0 w-full",
|
|
9648
10499
|
style: { gap: "var(--spacing-xs)" },
|
|
9649
10500
|
children: [
|
|
9650
|
-
/* @__PURE__ */ (0,
|
|
10501
|
+
/* @__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
10502
|
"span",
|
|
9652
10503
|
{
|
|
9653
10504
|
style: {
|
|
9654
|
-
fontFamily:
|
|
9655
|
-
fontSize:
|
|
10505
|
+
fontFamily: T14.font,
|
|
10506
|
+
fontSize: T14.fsSm,
|
|
9656
10507
|
fontWeight: 400,
|
|
9657
|
-
lineHeight:
|
|
9658
|
-
color:
|
|
10508
|
+
lineHeight: T14.lhSm,
|
|
10509
|
+
color: T14.muted
|
|
9659
10510
|
},
|
|
9660
10511
|
children: "Token name"
|
|
9661
10512
|
}
|
|
9662
10513
|
) }),
|
|
9663
|
-
/* @__PURE__ */ (0,
|
|
10514
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
9664
10515
|
"div",
|
|
9665
10516
|
{
|
|
9666
10517
|
className: "shrink-0 w-full",
|
|
9667
10518
|
style: {
|
|
9668
|
-
backgroundColor:
|
|
9669
|
-
borderRadius:
|
|
10519
|
+
backgroundColor: T14.neutral875,
|
|
10520
|
+
borderRadius: T14.rXl,
|
|
9670
10521
|
height: 48
|
|
9671
10522
|
},
|
|
9672
|
-
children: /* @__PURE__ */ (0,
|
|
10523
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
9673
10524
|
"div",
|
|
9674
10525
|
{
|
|
9675
10526
|
className: "flex items-center size-full",
|
|
9676
|
-
style: { padding: `var(--spacing-lg) ${
|
|
9677
|
-
children: /* @__PURE__ */ (0,
|
|
10527
|
+
style: { padding: `var(--spacing-lg) ${T14.spXl}` },
|
|
10528
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
9678
10529
|
"input",
|
|
9679
10530
|
{
|
|
9680
10531
|
type: "text",
|
|
@@ -9683,11 +10534,11 @@ function CreateTokenModal({ onClose, onCreated }) {
|
|
|
9683
10534
|
placeholder: "Name your token...",
|
|
9684
10535
|
className: "flex-1 min-w-0 bg-transparent border-none outline-none",
|
|
9685
10536
|
style: {
|
|
9686
|
-
fontFamily:
|
|
9687
|
-
fontSize:
|
|
10537
|
+
fontFamily: T14.font,
|
|
10538
|
+
fontSize: T14.fsSm,
|
|
9688
10539
|
fontWeight: 400,
|
|
9689
|
-
lineHeight:
|
|
9690
|
-
color: name ?
|
|
10540
|
+
lineHeight: T14.lhSm,
|
|
10541
|
+
color: name ? T14.primary : T14.neutral500
|
|
9691
10542
|
}
|
|
9692
10543
|
}
|
|
9693
10544
|
)
|
|
@@ -9698,27 +10549,27 @@ function CreateTokenModal({ onClose, onCreated }) {
|
|
|
9698
10549
|
]
|
|
9699
10550
|
}
|
|
9700
10551
|
),
|
|
9701
|
-
/* @__PURE__ */ (0,
|
|
10552
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
9702
10553
|
"div",
|
|
9703
10554
|
{
|
|
9704
10555
|
className: "flex flex-col items-start shrink-0 w-full",
|
|
9705
10556
|
style: { gap: "var(--spacing-xs)" },
|
|
9706
10557
|
children: [
|
|
9707
|
-
/* @__PURE__ */ (0,
|
|
10558
|
+
/* @__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
10559
|
"span",
|
|
9709
10560
|
{
|
|
9710
10561
|
style: {
|
|
9711
|
-
fontFamily:
|
|
9712
|
-
fontSize:
|
|
10562
|
+
fontFamily: T14.font,
|
|
10563
|
+
fontSize: T14.fsSm,
|
|
9713
10564
|
fontWeight: 400,
|
|
9714
|
-
lineHeight:
|
|
9715
|
-
color:
|
|
10565
|
+
lineHeight: T14.lhSm,
|
|
10566
|
+
color: T14.muted
|
|
9716
10567
|
},
|
|
9717
10568
|
children: "Expiry"
|
|
9718
10569
|
}
|
|
9719
10570
|
) }),
|
|
9720
|
-
/* @__PURE__ */ (0,
|
|
9721
|
-
|
|
10571
|
+
/* @__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)(
|
|
10572
|
+
import_ui12.ScButton,
|
|
9722
10573
|
{
|
|
9723
10574
|
text: opt.label,
|
|
9724
10575
|
variant: expiry === opt.value ? "secondary" : "outline",
|
|
@@ -9730,8 +10581,8 @@ function CreateTokenModal({ onClose, onCreated }) {
|
|
|
9730
10581
|
]
|
|
9731
10582
|
}
|
|
9732
10583
|
),
|
|
9733
|
-
/* @__PURE__ */ (0,
|
|
9734
|
-
|
|
10584
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
10585
|
+
import_ui12.ScButton,
|
|
9735
10586
|
{
|
|
9736
10587
|
text: loading ? "Creating..." : "Create token",
|
|
9737
10588
|
variant: "secondary",
|
|
@@ -9752,7 +10603,7 @@ function CreateTokenModal({ onClose, onCreated }) {
|
|
|
9752
10603
|
}
|
|
9753
10604
|
function TokenCreatedModal({ token, onClose }) {
|
|
9754
10605
|
const { toast } = useSettingsAdapters();
|
|
9755
|
-
const [copied, setCopied] = (0,
|
|
10606
|
+
const [copied, setCopied] = (0, import_react18.useState)(false);
|
|
9756
10607
|
function handleCopy() {
|
|
9757
10608
|
navigator.clipboard.writeText(token.token).then(() => {
|
|
9758
10609
|
setCopied(true);
|
|
@@ -9762,101 +10613,101 @@ function TokenCreatedModal({ token, onClose }) {
|
|
|
9762
10613
|
toast.error("Failed to copy token. Please copy it manually.");
|
|
9763
10614
|
});
|
|
9764
10615
|
}
|
|
9765
|
-
return /* @__PURE__ */ (0,
|
|
10616
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
9766
10617
|
"div",
|
|
9767
10618
|
{
|
|
9768
10619
|
className: "fixed inset-0 flex items-center justify-center",
|
|
9769
10620
|
style: { backgroundColor: "rgba(0,0,0,0.6)", zIndex: 1e3 },
|
|
9770
|
-
children: /* @__PURE__ */ (0,
|
|
10621
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
9771
10622
|
"div",
|
|
9772
10623
|
{
|
|
9773
10624
|
className: "flex flex-col items-start relative",
|
|
9774
10625
|
style: {
|
|
9775
|
-
backgroundColor:
|
|
9776
|
-
borderRadius:
|
|
10626
|
+
backgroundColor: T14.neutral825,
|
|
10627
|
+
borderRadius: T14.r4xl,
|
|
9777
10628
|
width: "min(40vw, 500px)",
|
|
9778
|
-
border: `1px solid ${
|
|
10629
|
+
border: `1px solid ${T14.borderSubtle}`
|
|
9779
10630
|
},
|
|
9780
10631
|
children: [
|
|
9781
|
-
/* @__PURE__ */ (0,
|
|
10632
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
9782
10633
|
"div",
|
|
9783
10634
|
{
|
|
9784
10635
|
className: "relative shrink-0 w-full",
|
|
9785
|
-
style: { borderBottom: `1px solid ${
|
|
9786
|
-
children: /* @__PURE__ */ (0,
|
|
10636
|
+
style: { borderBottom: `1px solid ${T14.borderDivider}` },
|
|
10637
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
9787
10638
|
"div",
|
|
9788
10639
|
{
|
|
9789
10640
|
className: "flex items-center w-full",
|
|
9790
|
-
style: { padding: `${
|
|
10641
|
+
style: { padding: `${T14.spXl} ${T14.sp3xl}` },
|
|
9791
10642
|
children: [
|
|
9792
|
-
/* @__PURE__ */ (0,
|
|
10643
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
9793
10644
|
"p",
|
|
9794
10645
|
{
|
|
9795
10646
|
className: "flex-1 min-w-0 truncate",
|
|
9796
10647
|
style: {
|
|
9797
|
-
fontFamily:
|
|
9798
|
-
fontSize:
|
|
10648
|
+
fontFamily: T14.fontDisplay,
|
|
10649
|
+
fontSize: T14.fsLg,
|
|
9799
10650
|
fontWeight: 600,
|
|
9800
|
-
lineHeight:
|
|
9801
|
-
color:
|
|
10651
|
+
lineHeight: T14.lhLg,
|
|
10652
|
+
color: T14.primary,
|
|
9802
10653
|
margin: 0
|
|
9803
10654
|
},
|
|
9804
10655
|
children: "Token Created"
|
|
9805
10656
|
}
|
|
9806
10657
|
),
|
|
9807
|
-
/* @__PURE__ */ (0,
|
|
10658
|
+
/* @__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
10659
|
]
|
|
9809
10660
|
}
|
|
9810
10661
|
)
|
|
9811
10662
|
}
|
|
9812
10663
|
),
|
|
9813
|
-
/* @__PURE__ */ (0,
|
|
10664
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
9814
10665
|
"div",
|
|
9815
10666
|
{
|
|
9816
10667
|
className: "flex flex-col items-start shrink-0 w-full",
|
|
9817
|
-
style: { padding:
|
|
10668
|
+
style: { padding: T14.sp3xl, gap: T14.sp3xl },
|
|
9818
10669
|
children: [
|
|
9819
|
-
/* @__PURE__ */ (0,
|
|
10670
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
9820
10671
|
"p",
|
|
9821
10672
|
{
|
|
9822
10673
|
style: {
|
|
9823
|
-
fontFamily:
|
|
9824
|
-
fontSize:
|
|
10674
|
+
fontFamily: T14.font,
|
|
10675
|
+
fontSize: T14.fsSm,
|
|
9825
10676
|
fontWeight: 400,
|
|
9826
|
-
lineHeight:
|
|
9827
|
-
color:
|
|
10677
|
+
lineHeight: T14.lhSm,
|
|
10678
|
+
color: T14.warning,
|
|
9828
10679
|
margin: 0
|
|
9829
10680
|
},
|
|
9830
10681
|
children: "Copy this token now. You won't be able to see it again."
|
|
9831
10682
|
}
|
|
9832
10683
|
),
|
|
9833
|
-
/* @__PURE__ */ (0,
|
|
10684
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
9834
10685
|
"div",
|
|
9835
10686
|
{
|
|
9836
10687
|
className: "w-full",
|
|
9837
10688
|
style: {
|
|
9838
|
-
backgroundColor:
|
|
9839
|
-
borderRadius:
|
|
9840
|
-
padding: `var(--spacing-lg) ${
|
|
10689
|
+
backgroundColor: T14.neutral875,
|
|
10690
|
+
borderRadius: T14.rXl,
|
|
10691
|
+
padding: `var(--spacing-lg) ${T14.spXl}`
|
|
9841
10692
|
},
|
|
9842
|
-
children: /* @__PURE__ */ (0,
|
|
10693
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
9843
10694
|
"code",
|
|
9844
10695
|
{
|
|
9845
10696
|
style: {
|
|
9846
10697
|
fontFamily: "monospace",
|
|
9847
|
-
fontSize:
|
|
9848
|
-
color:
|
|
10698
|
+
fontSize: T14.fsSm,
|
|
10699
|
+
color: T14.primary,
|
|
9849
10700
|
wordBreak: "break-all",
|
|
9850
|
-
lineHeight:
|
|
10701
|
+
lineHeight: T14.lhSm
|
|
9851
10702
|
},
|
|
9852
10703
|
children: token.token
|
|
9853
10704
|
}
|
|
9854
10705
|
)
|
|
9855
10706
|
}
|
|
9856
10707
|
),
|
|
9857
|
-
/* @__PURE__ */ (0,
|
|
9858
|
-
/* @__PURE__ */ (0,
|
|
9859
|
-
|
|
10708
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { style: { display: "flex", gap: "var(--spacing-md)", width: "100%" }, children: [
|
|
10709
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
10710
|
+
import_ui12.ScButton,
|
|
9860
10711
|
{
|
|
9861
10712
|
text: copied ? "Copied!" : "Copy token",
|
|
9862
10713
|
variant: "secondary",
|
|
@@ -9865,8 +10716,8 @@ function TokenCreatedModal({ token, onClose }) {
|
|
|
9865
10716
|
className: "flex-1"
|
|
9866
10717
|
}
|
|
9867
10718
|
),
|
|
9868
|
-
/* @__PURE__ */ (0,
|
|
9869
|
-
|
|
10719
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
10720
|
+
import_ui12.ScButton,
|
|
9870
10721
|
{
|
|
9871
10722
|
text: "Done",
|
|
9872
10723
|
variant: "outline",
|
|
@@ -9893,22 +10744,22 @@ function TokensContent({
|
|
|
9893
10744
|
onCreateOpenChange
|
|
9894
10745
|
} = {}) {
|
|
9895
10746
|
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,
|
|
10747
|
+
const [tokens, setTokens] = (0, import_react18.useState)([]);
|
|
10748
|
+
const [loading, setLoading] = (0, import_react18.useState)(true);
|
|
10749
|
+
const [showRevoked, setShowRevoked] = (0, import_react18.useState)(false);
|
|
10750
|
+
const [showCreateModal, setShowCreateModal] = (0, import_react18.useState)(false);
|
|
10751
|
+
const [createdToken, setCreatedToken] = (0, import_react18.useState)(null);
|
|
10752
|
+
const [deletingId, setDeletingId] = (0, import_react18.useState)(null);
|
|
10753
|
+
(0, import_react18.useEffect)(() => {
|
|
9903
10754
|
if (showRevokedOverride !== void 0) setShowRevoked(showRevokedOverride);
|
|
9904
10755
|
}, [showRevokedOverride]);
|
|
9905
|
-
(0,
|
|
10756
|
+
(0, import_react18.useEffect)(() => {
|
|
9906
10757
|
if (createOpenOverride) {
|
|
9907
10758
|
setShowCreateModal(true);
|
|
9908
10759
|
onCreateOpenChange?.(false);
|
|
9909
10760
|
}
|
|
9910
10761
|
}, [createOpenOverride, onCreateOpenChange]);
|
|
9911
|
-
const fetchTokens = (0,
|
|
10762
|
+
const fetchTokens = (0, import_react18.useCallback)(async () => {
|
|
9912
10763
|
setLoading(true);
|
|
9913
10764
|
try {
|
|
9914
10765
|
const data = await api.fetchTokens({ showRevoked });
|
|
@@ -9919,7 +10770,7 @@ function TokensContent({
|
|
|
9919
10770
|
setLoading(false);
|
|
9920
10771
|
}
|
|
9921
10772
|
}, [api, showRevoked]);
|
|
9922
|
-
(0,
|
|
10773
|
+
(0, import_react18.useEffect)(() => {
|
|
9923
10774
|
fetchTokens();
|
|
9924
10775
|
}, [fetchTokens]);
|
|
9925
10776
|
async function handleRevoke(tokenId) {
|
|
@@ -9957,8 +10808,8 @@ function TokensContent({
|
|
|
9957
10808
|
setCreatedToken(token);
|
|
9958
10809
|
fetchTokens();
|
|
9959
10810
|
}
|
|
9960
|
-
const tokensInnerContent = /* @__PURE__ */ (0,
|
|
9961
|
-
!embedded && /* @__PURE__ */ (0,
|
|
10811
|
+
const tokensInnerContent = /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
|
|
10812
|
+
!embedded && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
9962
10813
|
"div",
|
|
9963
10814
|
{
|
|
9964
10815
|
style: {
|
|
@@ -9970,8 +10821,8 @@ function TokensContent({
|
|
|
9970
10821
|
gap: "var(--spacing-md)"
|
|
9971
10822
|
},
|
|
9972
10823
|
children: [
|
|
9973
|
-
/* @__PURE__ */ (0,
|
|
9974
|
-
|
|
10824
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
10825
|
+
import_ui12.ScButton,
|
|
9975
10826
|
{
|
|
9976
10827
|
text: showRevoked ? "Hide Revoked" : "Show Revoked",
|
|
9977
10828
|
variant: "outline",
|
|
@@ -9979,21 +10830,21 @@ function TokensContent({
|
|
|
9979
10830
|
onClick: () => setShowRevoked((v) => !v)
|
|
9980
10831
|
}
|
|
9981
10832
|
),
|
|
9982
|
-
/* @__PURE__ */ (0,
|
|
9983
|
-
|
|
10833
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
10834
|
+
import_ui12.ScButton,
|
|
9984
10835
|
{
|
|
9985
10836
|
text: "New Token",
|
|
9986
10837
|
variant: "primary",
|
|
9987
10838
|
size: "md",
|
|
9988
10839
|
styleVariant: "icon-left",
|
|
9989
|
-
icon: /* @__PURE__ */ (0,
|
|
10840
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_icons13.SiconPlus, {}),
|
|
9990
10841
|
onClick: () => setShowCreateModal(true)
|
|
9991
10842
|
}
|
|
9992
10843
|
)
|
|
9993
10844
|
]
|
|
9994
10845
|
}
|
|
9995
10846
|
),
|
|
9996
|
-
loading ? /* @__PURE__ */ (0,
|
|
10847
|
+
loading ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
9997
10848
|
"div",
|
|
9998
10849
|
{
|
|
9999
10850
|
style: {
|
|
@@ -10007,7 +10858,7 @@ function TokensContent({
|
|
|
10007
10858
|
},
|
|
10008
10859
|
children: "Loading tokens..."
|
|
10009
10860
|
}
|
|
10010
|
-
) : tokens.length === 0 ? /* @__PURE__ */ (0,
|
|
10861
|
+
) : tokens.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
10011
10862
|
"div",
|
|
10012
10863
|
{
|
|
10013
10864
|
style: {
|
|
@@ -10019,8 +10870,8 @@ function TokensContent({
|
|
|
10019
10870
|
gap: "var(--spacing-xl)"
|
|
10020
10871
|
},
|
|
10021
10872
|
children: [
|
|
10022
|
-
/* @__PURE__ */ (0,
|
|
10023
|
-
/* @__PURE__ */ (0,
|
|
10873
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(SiconKey_default, { size: 48, color: "var(--alias-text---icons-muted)", strokeWidth: 1 }),
|
|
10874
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
10024
10875
|
"p",
|
|
10025
10876
|
{
|
|
10026
10877
|
style: {
|
|
@@ -10034,7 +10885,7 @@ function TokensContent({
|
|
|
10034
10885
|
)
|
|
10035
10886
|
]
|
|
10036
10887
|
}
|
|
10037
|
-
) : /* @__PURE__ */ (0,
|
|
10888
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
10038
10889
|
TokenTable,
|
|
10039
10890
|
{
|
|
10040
10891
|
tokens,
|
|
@@ -10043,14 +10894,14 @@ function TokensContent({
|
|
|
10043
10894
|
onDelete: handleDelete
|
|
10044
10895
|
}
|
|
10045
10896
|
),
|
|
10046
|
-
showCreateModal && /* @__PURE__ */ (0,
|
|
10897
|
+
showCreateModal && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
10047
10898
|
CreateTokenModal,
|
|
10048
10899
|
{
|
|
10049
10900
|
onClose: () => setShowCreateModal(false),
|
|
10050
10901
|
onCreated: handleTokenCreated
|
|
10051
10902
|
}
|
|
10052
10903
|
),
|
|
10053
|
-
createdToken && /* @__PURE__ */ (0,
|
|
10904
|
+
createdToken && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
10054
10905
|
TokenCreatedModal,
|
|
10055
10906
|
{
|
|
10056
10907
|
token: createdToken,
|
|
@@ -10059,7 +10910,7 @@ function TokensContent({
|
|
|
10059
10910
|
)
|
|
10060
10911
|
] });
|
|
10061
10912
|
if (embedded) {
|
|
10062
|
-
return /* @__PURE__ */ (0,
|
|
10913
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
10063
10914
|
"div",
|
|
10064
10915
|
{
|
|
10065
10916
|
className: "flex flex-col flex-1 min-w-0 min-h-0 w-full",
|
|
@@ -10068,7 +10919,7 @@ function TokensContent({
|
|
|
10068
10919
|
}
|
|
10069
10920
|
);
|
|
10070
10921
|
}
|
|
10071
|
-
return /* @__PURE__ */ (0,
|
|
10922
|
+
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
10923
|
"div",
|
|
10073
10924
|
{
|
|
10074
10925
|
className: "flex flex-col items-stretch size-full overflow-y-auto",
|
|
@@ -10079,7 +10930,7 @@ function TokensContent({
|
|
|
10079
10930
|
backgroundSize: "24px 24px"
|
|
10080
10931
|
},
|
|
10081
10932
|
children: [
|
|
10082
|
-
/* @__PURE__ */ (0,
|
|
10933
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
10083
10934
|
"div",
|
|
10084
10935
|
{
|
|
10085
10936
|
style: {
|
|
@@ -10090,7 +10941,7 @@ function TokensContent({
|
|
|
10090
10941
|
width: "100%"
|
|
10091
10942
|
},
|
|
10092
10943
|
children: [
|
|
10093
|
-
/* @__PURE__ */ (0,
|
|
10944
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
10094
10945
|
"p",
|
|
10095
10946
|
{
|
|
10096
10947
|
style: {
|
|
@@ -10104,9 +10955,9 @@ function TokensContent({
|
|
|
10104
10955
|
children: "API Tokens"
|
|
10105
10956
|
}
|
|
10106
10957
|
),
|
|
10107
|
-
/* @__PURE__ */ (0,
|
|
10108
|
-
/* @__PURE__ */ (0,
|
|
10109
|
-
|
|
10958
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { style: { display: "flex", gap: "var(--spacing-md)", alignItems: "center" }, children: [
|
|
10959
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
10960
|
+
import_ui12.ScButton,
|
|
10110
10961
|
{
|
|
10111
10962
|
text: showRevoked ? "Hide Revoked" : "Show Revoked",
|
|
10112
10963
|
variant: "outline",
|
|
@@ -10114,14 +10965,14 @@ function TokensContent({
|
|
|
10114
10965
|
onClick: () => setShowRevoked((v) => !v)
|
|
10115
10966
|
}
|
|
10116
10967
|
),
|
|
10117
|
-
/* @__PURE__ */ (0,
|
|
10118
|
-
|
|
10968
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
10969
|
+
import_ui12.ScButton,
|
|
10119
10970
|
{
|
|
10120
10971
|
text: "New Token",
|
|
10121
10972
|
variant: "primary",
|
|
10122
10973
|
size: "md",
|
|
10123
10974
|
styleVariant: "icon-left",
|
|
10124
|
-
icon: /* @__PURE__ */ (0,
|
|
10975
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_icons13.SiconPlus, {}),
|
|
10125
10976
|
onClick: () => setShowCreateModal(true)
|
|
10126
10977
|
}
|
|
10127
10978
|
)
|
|
@@ -10135,7 +10986,7 @@ function TokensContent({
|
|
|
10135
10986
|
) });
|
|
10136
10987
|
}
|
|
10137
10988
|
function TokenTable({ tokens, deletingId, onRevoke, onDelete }) {
|
|
10138
|
-
return /* @__PURE__ */ (0,
|
|
10989
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
10139
10990
|
"div",
|
|
10140
10991
|
{
|
|
10141
10992
|
style: {
|
|
@@ -10146,7 +10997,7 @@ function TokenTable({ tokens, deletingId, onRevoke, onDelete }) {
|
|
|
10146
10997
|
overflow: "hidden",
|
|
10147
10998
|
width: "100%"
|
|
10148
10999
|
},
|
|
10149
|
-
children: /* @__PURE__ */ (0,
|
|
11000
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
10150
11001
|
"div",
|
|
10151
11002
|
{
|
|
10152
11003
|
style: {
|
|
@@ -10159,7 +11010,7 @@ function TokenTable({ tokens, deletingId, onRevoke, onDelete }) {
|
|
|
10159
11010
|
minHeight: 0
|
|
10160
11011
|
},
|
|
10161
11012
|
children: [
|
|
10162
|
-
/* @__PURE__ */ (0,
|
|
11013
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
10163
11014
|
"div",
|
|
10164
11015
|
{
|
|
10165
11016
|
style: {
|
|
@@ -10170,7 +11021,7 @@ function TokenTable({ tokens, deletingId, onRevoke, onDelete }) {
|
|
|
10170
11021
|
borderBottom: "0.5px solid var(--alias-border-subtle)",
|
|
10171
11022
|
flexShrink: 0
|
|
10172
11023
|
},
|
|
10173
|
-
children: ["Name", "Token", "Expires", "Last Used", "Created", "Actions"].map((h) => /* @__PURE__ */ (0,
|
|
11024
|
+
children: ["Name", "Token", "Expires", "Last Used", "Created", "Actions"].map((h) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
10174
11025
|
"span",
|
|
10175
11026
|
{
|
|
10176
11027
|
style: {
|
|
@@ -10186,7 +11037,7 @@ function TokenTable({ tokens, deletingId, onRevoke, onDelete }) {
|
|
|
10186
11037
|
))
|
|
10187
11038
|
}
|
|
10188
11039
|
),
|
|
10189
|
-
/* @__PURE__ */ (0,
|
|
11040
|
+
/* @__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
11041
|
"div",
|
|
10191
11042
|
{
|
|
10192
11043
|
style: {
|
|
@@ -10197,8 +11048,8 @@ function TokenTable({ tokens, deletingId, onRevoke, onDelete }) {
|
|
|
10197
11048
|
borderBottom: idx < tokens.length - 1 ? "0.5px solid var(--alias-border-subtle)" : "none"
|
|
10198
11049
|
},
|
|
10199
11050
|
children: [
|
|
10200
|
-
/* @__PURE__ */ (0,
|
|
10201
|
-
/* @__PURE__ */ (0,
|
|
11051
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: "var(--spacing-md)", minWidth: 0 }, children: [
|
|
11052
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
10202
11053
|
"span",
|
|
10203
11054
|
{
|
|
10204
11055
|
style: {
|
|
@@ -10214,9 +11065,9 @@ function TokenTable({ tokens, deletingId, onRevoke, onDelete }) {
|
|
|
10214
11065
|
children: token.name
|
|
10215
11066
|
}
|
|
10216
11067
|
),
|
|
10217
|
-
token.status === "revoked" && /* @__PURE__ */ (0,
|
|
11068
|
+
token.status === "revoked" && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_ui12.ScBadges, { text: "Revoked", variant: "error" })
|
|
10218
11069
|
] }),
|
|
10219
|
-
/* @__PURE__ */ (0,
|
|
11070
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { style: { minWidth: 0 }, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
10220
11071
|
"code",
|
|
10221
11072
|
{
|
|
10222
11073
|
style: {
|
|
@@ -10239,7 +11090,7 @@ function TokenTable({ tokens, deletingId, onRevoke, onDelete }) {
|
|
|
10239
11090
|
]
|
|
10240
11091
|
}
|
|
10241
11092
|
) }),
|
|
10242
|
-
/* @__PURE__ */ (0,
|
|
11093
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
10243
11094
|
"span",
|
|
10244
11095
|
{
|
|
10245
11096
|
style: {
|
|
@@ -10251,7 +11102,7 @@ function TokenTable({ tokens, deletingId, onRevoke, onDelete }) {
|
|
|
10251
11102
|
children: formatDate3(token.expiresAt)
|
|
10252
11103
|
}
|
|
10253
11104
|
),
|
|
10254
|
-
/* @__PURE__ */ (0,
|
|
11105
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
10255
11106
|
"span",
|
|
10256
11107
|
{
|
|
10257
11108
|
style: {
|
|
@@ -10263,7 +11114,7 @@ function TokenTable({ tokens, deletingId, onRevoke, onDelete }) {
|
|
|
10263
11114
|
children: token.lastUsedAt ? formatDate3(token.lastUsedAt) : "Never"
|
|
10264
11115
|
}
|
|
10265
11116
|
),
|
|
10266
|
-
/* @__PURE__ */ (0,
|
|
11117
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
10267
11118
|
"span",
|
|
10268
11119
|
{
|
|
10269
11120
|
style: {
|
|
@@ -10275,9 +11126,9 @@ function TokenTable({ tokens, deletingId, onRevoke, onDelete }) {
|
|
|
10275
11126
|
children: formatDate3(token.createdAt)
|
|
10276
11127
|
}
|
|
10277
11128
|
),
|
|
10278
|
-
/* @__PURE__ */ (0,
|
|
10279
|
-
/* @__PURE__ */ (0,
|
|
10280
|
-
|
|
11129
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { style: { display: "flex", gap: "var(--spacing-sm)" }, children: [
|
|
11130
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
11131
|
+
import_ui12.ScButton,
|
|
10281
11132
|
{
|
|
10282
11133
|
text: deletingId === token._id ? "..." : "Revoke",
|
|
10283
11134
|
variant: "outline",
|
|
@@ -10286,8 +11137,8 @@ function TokenTable({ tokens, deletingId, onRevoke, onDelete }) {
|
|
|
10286
11137
|
onClick: () => onRevoke(token._id)
|
|
10287
11138
|
}
|
|
10288
11139
|
),
|
|
10289
|
-
/* @__PURE__ */ (0,
|
|
10290
|
-
|
|
11140
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
11141
|
+
import_ui12.ScButton,
|
|
10291
11142
|
{
|
|
10292
11143
|
text: deletingId === token._id ? "..." : "Delete",
|
|
10293
11144
|
variant: "error",
|
|
@@ -10309,7 +11160,7 @@ function TokenTable({ tokens, deletingId, onRevoke, onDelete }) {
|
|
|
10309
11160
|
}
|
|
10310
11161
|
|
|
10311
11162
|
// src/settings-content.tsx
|
|
10312
|
-
var
|
|
11163
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
10313
11164
|
function deriveInitials(name) {
|
|
10314
11165
|
return name.split(/\s+/).slice(0, 2).map((part) => part[0]?.toUpperCase() ?? "").join("") || "WS";
|
|
10315
11166
|
}
|
|
@@ -10345,8 +11196,8 @@ function SettingsNavItem({
|
|
|
10345
11196
|
onTabChange
|
|
10346
11197
|
}) {
|
|
10347
11198
|
const isActive = activeTab === tab;
|
|
10348
|
-
return /* @__PURE__ */ (0,
|
|
10349
|
-
|
|
11199
|
+
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)(
|
|
11200
|
+
import_ui13.ScSidebarMenu,
|
|
10350
11201
|
{
|
|
10351
11202
|
icon: icon(isActive ? PRIMARY_COLOR3 : MUTED_COLOR2),
|
|
10352
11203
|
text: label,
|
|
@@ -10374,7 +11225,7 @@ function SettingsNav({
|
|
|
10374
11225
|
hasOrganization,
|
|
10375
11226
|
isWorkspaceAdmin
|
|
10376
11227
|
}) {
|
|
10377
|
-
const item = (tab, icon) => /* @__PURE__ */ (0,
|
|
11228
|
+
const item = (tab, icon) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
10378
11229
|
SettingsNavItem,
|
|
10379
11230
|
{
|
|
10380
11231
|
tab,
|
|
@@ -10384,7 +11235,7 @@ function SettingsNav({
|
|
|
10384
11235
|
onTabChange
|
|
10385
11236
|
}
|
|
10386
11237
|
);
|
|
10387
|
-
return /* @__PURE__ */ (0,
|
|
11238
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
10388
11239
|
"div",
|
|
10389
11240
|
{
|
|
10390
11241
|
className: "flex flex-col items-start shrink-0 relative overflow-y-auto",
|
|
@@ -10407,33 +11258,33 @@ function SettingsNav({
|
|
|
10407
11258
|
gap: "var(--spacing-5xl)"
|
|
10408
11259
|
},
|
|
10409
11260
|
children: [
|
|
10410
|
-
/* @__PURE__ */ (0,
|
|
10411
|
-
/* @__PURE__ */ (0,
|
|
10412
|
-
item("profile", (color) => /* @__PURE__ */ (0,
|
|
10413
|
-
item("workspaceList", (color) => /* @__PURE__ */ (0,
|
|
11261
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex flex-col w-full", style: { gap: "var(--spacing-md)" }, children: [
|
|
11262
|
+
/* @__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" }),
|
|
11263
|
+
item("profile", (color) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_icons14.SiconUser, { className: "w-5 h-5", color })),
|
|
11264
|
+
item("workspaceList", (color) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_icons14.SiconSwitch, { className: "w-5 h-5", color }))
|
|
10414
11265
|
] }),
|
|
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,
|
|
11266
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_ui13.ScHDivider, {}),
|
|
11267
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex flex-col w-full", style: { gap: "var(--spacing-md)" }, children: [
|
|
11268
|
+
/* @__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" }),
|
|
11269
|
+
item("workspace", (color) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_icons14.SiconSettings, { className: "w-5 h-5", color })),
|
|
11270
|
+
item("workspaceMembers", (color) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_icons14.SiconTeam, { className: "w-5 h-5", color })),
|
|
11271
|
+
isWorkspaceAdmin && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
|
|
11272
|
+
item("billing", (color) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_icons14.SiconBilling, { className: "w-5 h-5", color })),
|
|
11273
|
+
item("apikey", (color) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(SiconKey_default, { className: "w-5 h-5", color }))
|
|
10423
11274
|
] }),
|
|
10424
|
-
!isWorkspaceAdmin && /* @__PURE__ */ (0,
|
|
11275
|
+
!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
11276
|
] }),
|
|
10426
|
-
/* @__PURE__ */ (0,
|
|
10427
|
-
/* @__PURE__ */ (0,
|
|
10428
|
-
/* @__PURE__ */ (0,
|
|
10429
|
-
item("organization", (color) => /* @__PURE__ */ (0,
|
|
10430
|
-
item("organizationWorkspaces", (color) => /* @__PURE__ */ (0,
|
|
10431
|
-
] }) : /* @__PURE__ */ (0,
|
|
11277
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_ui13.ScHDivider, {}),
|
|
11278
|
+
/* @__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: [
|
|
11279
|
+
/* @__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" }),
|
|
11280
|
+
item("organization", (color) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_icons14.SiconTeam, { className: "w-5 h-5", color })),
|
|
11281
|
+
item("organizationWorkspaces", (color) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_icons14.SiconWorkspace, { className: "w-5 h-5", color }))
|
|
11282
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
10432
11283
|
SettingsNavItem,
|
|
10433
11284
|
{
|
|
10434
11285
|
tab: "organization",
|
|
10435
11286
|
label: "Organization",
|
|
10436
|
-
icon: (color) => /* @__PURE__ */ (0,
|
|
11287
|
+
icon: (color) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_icons14.SiconGlobe, { className: "w-5 h-5", color }),
|
|
10437
11288
|
activeTab,
|
|
10438
11289
|
onTabChange
|
|
10439
11290
|
}
|
|
@@ -10445,7 +11296,7 @@ function SettingsNav({
|
|
|
10445
11296
|
var SPECIALIZATION_ICON_SIZE = 24;
|
|
10446
11297
|
function SpecializationIcon({ iconUrl }) {
|
|
10447
11298
|
if (iconUrl) {
|
|
10448
|
-
return /* @__PURE__ */ (0,
|
|
11299
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
10449
11300
|
"img",
|
|
10450
11301
|
{
|
|
10451
11302
|
src: iconUrl,
|
|
@@ -10458,8 +11309,8 @@ function SpecializationIcon({ iconUrl }) {
|
|
|
10458
11309
|
}
|
|
10459
11310
|
);
|
|
10460
11311
|
}
|
|
10461
|
-
return /* @__PURE__ */ (0,
|
|
10462
|
-
|
|
11312
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
11313
|
+
import_icons14.SiconBolt,
|
|
10463
11314
|
{
|
|
10464
11315
|
style: {
|
|
10465
11316
|
width: SPECIALIZATION_ICON_SIZE,
|
|
@@ -10490,10 +11341,10 @@ function SpecializationDropdown({
|
|
|
10490
11341
|
disabled
|
|
10491
11342
|
}) {
|
|
10492
11343
|
const { auth } = useSettingsAdapters();
|
|
10493
|
-
const [open, setOpen] = (0,
|
|
10494
|
-
const containerRef = (0,
|
|
10495
|
-
const [options, setOptions] = (0,
|
|
10496
|
-
(0,
|
|
11344
|
+
const [open, setOpen] = (0, import_react19.useState)(false);
|
|
11345
|
+
const containerRef = (0, import_react19.useRef)(null);
|
|
11346
|
+
const [options, setOptions] = (0, import_react19.useState)([]);
|
|
11347
|
+
(0, import_react19.useEffect)(() => {
|
|
10497
11348
|
if (!auth.getSpecializations) return;
|
|
10498
11349
|
let cancelled = false;
|
|
10499
11350
|
auth.getSpecializations().then((items) => {
|
|
@@ -10513,7 +11364,7 @@ function SpecializationDropdown({
|
|
|
10513
11364
|
cancelled = true;
|
|
10514
11365
|
};
|
|
10515
11366
|
}, [auth]);
|
|
10516
|
-
(0,
|
|
11367
|
+
(0, import_react19.useEffect)(() => {
|
|
10517
11368
|
if (!open) return;
|
|
10518
11369
|
function handleMouseDown(e) {
|
|
10519
11370
|
if (containerRef.current && !containerRef.current.contains(e.target)) {
|
|
@@ -10531,15 +11382,15 @@ function SpecializationDropdown({
|
|
|
10531
11382
|
};
|
|
10532
11383
|
}, [open]);
|
|
10533
11384
|
const selected = options.find((o) => o.id === value);
|
|
10534
|
-
return /* @__PURE__ */ (0,
|
|
11385
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
10535
11386
|
"div",
|
|
10536
11387
|
{
|
|
10537
11388
|
ref: containerRef,
|
|
10538
11389
|
className: "w-full",
|
|
10539
11390
|
style: { position: "relative" },
|
|
10540
11391
|
children: [
|
|
10541
|
-
/* @__PURE__ */ (0,
|
|
10542
|
-
/* @__PURE__ */ (0,
|
|
11392
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("style", { children: DROPDOWN_TRIGGER_STYLES }),
|
|
11393
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
10543
11394
|
"div",
|
|
10544
11395
|
{
|
|
10545
11396
|
className: "spec-dropdown-trigger",
|
|
@@ -10547,16 +11398,16 @@ function SpecializationDropdown({
|
|
|
10547
11398
|
onClick: () => !disabled && setOpen((v) => !v),
|
|
10548
11399
|
"aria-haspopup": "listbox",
|
|
10549
11400
|
"aria-expanded": open,
|
|
10550
|
-
children: /* @__PURE__ */ (0,
|
|
10551
|
-
|
|
11401
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
11402
|
+
import_ui14.ScTextField,
|
|
10552
11403
|
{
|
|
10553
11404
|
label: "Specialization",
|
|
10554
11405
|
labelGroup: "label",
|
|
10555
11406
|
value: selected?.label ?? "",
|
|
10556
11407
|
placeholderFilled: "Select specialization",
|
|
10557
11408
|
tfGroup: "icon-left-right",
|
|
10558
|
-
tfLeftIcon: /* @__PURE__ */ (0,
|
|
10559
|
-
tfRightIcon: /* @__PURE__ */ (0,
|
|
11409
|
+
tfLeftIcon: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(SpecializationIcon, { iconUrl: selected?.iconUrl }),
|
|
11410
|
+
tfRightIcon: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
10560
11411
|
"span",
|
|
10561
11412
|
{
|
|
10562
11413
|
style: {
|
|
@@ -10566,7 +11417,7 @@ function SpecializationDropdown({
|
|
|
10566
11417
|
transform: open ? "rotate(180deg)" : "none",
|
|
10567
11418
|
transition: "transform 120ms ease-out"
|
|
10568
11419
|
},
|
|
10569
|
-
children: /* @__PURE__ */ (0,
|
|
11420
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_icons14.SiconDown, {})
|
|
10570
11421
|
}
|
|
10571
11422
|
),
|
|
10572
11423
|
className: "sc-text-field-full-width",
|
|
@@ -10577,7 +11428,7 @@ function SpecializationDropdown({
|
|
|
10577
11428
|
)
|
|
10578
11429
|
}
|
|
10579
11430
|
),
|
|
10580
|
-
open && /* @__PURE__ */ (0,
|
|
11431
|
+
open && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
10581
11432
|
"div",
|
|
10582
11433
|
{
|
|
10583
11434
|
role: "listbox",
|
|
@@ -10599,11 +11450,11 @@ function SpecializationDropdown({
|
|
|
10599
11450
|
},
|
|
10600
11451
|
children: options.map((opt) => {
|
|
10601
11452
|
const isActive = opt.id === value;
|
|
10602
|
-
return /* @__PURE__ */ (0,
|
|
10603
|
-
|
|
11453
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
11454
|
+
import_ui13.ScMenuOptions,
|
|
10604
11455
|
{
|
|
10605
11456
|
text: opt.label,
|
|
10606
|
-
icon: /* @__PURE__ */ (0,
|
|
11457
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(SpecializationIcon, { iconUrl: opt.iconUrl }),
|
|
10607
11458
|
hover: isActive ? "true" : "false",
|
|
10608
11459
|
variant: "default",
|
|
10609
11460
|
role: "option",
|
|
@@ -10628,9 +11479,9 @@ function LanguageDropdown({
|
|
|
10628
11479
|
onChange,
|
|
10629
11480
|
disabled
|
|
10630
11481
|
}) {
|
|
10631
|
-
const [open, setOpen] = (0,
|
|
10632
|
-
const containerRef = (0,
|
|
10633
|
-
(0,
|
|
11482
|
+
const [open, setOpen] = (0, import_react19.useState)(false);
|
|
11483
|
+
const containerRef = (0, import_react19.useRef)(null);
|
|
11484
|
+
(0, import_react19.useEffect)(() => {
|
|
10634
11485
|
if (!open) return;
|
|
10635
11486
|
function handleMouseDown(e) {
|
|
10636
11487
|
if (containerRef.current && !containerRef.current.contains(e.target)) {
|
|
@@ -10647,15 +11498,15 @@ function LanguageDropdown({
|
|
|
10647
11498
|
document.removeEventListener("keydown", handleKeyDown);
|
|
10648
11499
|
};
|
|
10649
11500
|
}, [open]);
|
|
10650
|
-
return /* @__PURE__ */ (0,
|
|
11501
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
10651
11502
|
"div",
|
|
10652
11503
|
{
|
|
10653
11504
|
ref: containerRef,
|
|
10654
11505
|
className: "w-full",
|
|
10655
11506
|
style: { position: "relative" },
|
|
10656
11507
|
children: [
|
|
10657
|
-
/* @__PURE__ */ (0,
|
|
10658
|
-
/* @__PURE__ */ (0,
|
|
11508
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("style", { children: DROPDOWN_TRIGGER_STYLES }),
|
|
11509
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
10659
11510
|
"div",
|
|
10660
11511
|
{
|
|
10661
11512
|
className: "spec-dropdown-trigger",
|
|
@@ -10663,15 +11514,15 @@ function LanguageDropdown({
|
|
|
10663
11514
|
onClick: () => !disabled && setOpen((v) => !v),
|
|
10664
11515
|
"aria-haspopup": "listbox",
|
|
10665
11516
|
"aria-expanded": open,
|
|
10666
|
-
children: /* @__PURE__ */ (0,
|
|
10667
|
-
|
|
11517
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
11518
|
+
import_ui14.ScTextField,
|
|
10668
11519
|
{
|
|
10669
11520
|
label: "Language",
|
|
10670
11521
|
labelGroup: "label",
|
|
10671
11522
|
value: userLanguageLabel(value),
|
|
10672
11523
|
placeholderFilled: "Select language",
|
|
10673
11524
|
tfGroup: "icon-right",
|
|
10674
|
-
tfRightIcon: /* @__PURE__ */ (0,
|
|
11525
|
+
tfRightIcon: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
10675
11526
|
"span",
|
|
10676
11527
|
{
|
|
10677
11528
|
style: {
|
|
@@ -10681,7 +11532,7 @@ function LanguageDropdown({
|
|
|
10681
11532
|
transform: open ? "rotate(180deg)" : "none",
|
|
10682
11533
|
transition: "transform 120ms ease-out"
|
|
10683
11534
|
},
|
|
10684
|
-
children: /* @__PURE__ */ (0,
|
|
11535
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_icons14.SiconDown, {})
|
|
10685
11536
|
}
|
|
10686
11537
|
),
|
|
10687
11538
|
className: "sc-text-field-full-width",
|
|
@@ -10692,7 +11543,7 @@ function LanguageDropdown({
|
|
|
10692
11543
|
)
|
|
10693
11544
|
}
|
|
10694
11545
|
),
|
|
10695
|
-
open && /* @__PURE__ */ (0,
|
|
11546
|
+
open && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
10696
11547
|
"div",
|
|
10697
11548
|
{
|
|
10698
11549
|
role: "listbox",
|
|
@@ -10718,11 +11569,11 @@ function LanguageDropdown({
|
|
|
10718
11569
|
},
|
|
10719
11570
|
children: USER_LANGUAGES.map((lang) => {
|
|
10720
11571
|
const isActive = lang.code === value;
|
|
10721
|
-
return /* @__PURE__ */ (0,
|
|
10722
|
-
|
|
11572
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
11573
|
+
import_ui13.ScMenuOptions,
|
|
10723
11574
|
{
|
|
10724
11575
|
text: lang.label,
|
|
10725
|
-
icon: /* @__PURE__ */ (0,
|
|
11576
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_jsx_runtime24.Fragment, {}),
|
|
10726
11577
|
hover: isActive ? "true" : "false",
|
|
10727
11578
|
variant: "default",
|
|
10728
11579
|
role: "option",
|
|
@@ -10748,28 +11599,28 @@ function ProfileTab() {
|
|
|
10748
11599
|
const derivedName = user?.name ?? "";
|
|
10749
11600
|
const derivedSpec = user?.userSpecialization ?? "";
|
|
10750
11601
|
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,
|
|
11602
|
+
const [fullName, setFullName] = (0, import_react19.useState)(derivedName);
|
|
11603
|
+
const [selectedSpec, setSelectedSpec] = (0, import_react19.useState)(derivedSpec);
|
|
11604
|
+
const [selectedLanguage, setSelectedLanguage] = (0, import_react19.useState)(derivedLanguage);
|
|
11605
|
+
const [saving, setSaving] = (0, import_react19.useState)(false);
|
|
11606
|
+
const [imageSaving, setImageSaving] = (0, import_react19.useState)(false);
|
|
11607
|
+
const [imagePreview, setImagePreview] = (0, import_react19.useState)(
|
|
10757
11608
|
void 0
|
|
10758
11609
|
);
|
|
10759
|
-
const fileInputRef = (0,
|
|
11610
|
+
const fileInputRef = (0, import_react19.useRef)(null);
|
|
10760
11611
|
const profileDisplayName = fullName || user?.email || "User";
|
|
10761
11612
|
const profileImage = imagePreview ?? getUserProfileImage(user);
|
|
10762
11613
|
const profileInitial = profileDisplayName.charAt(0).toUpperCase();
|
|
10763
11614
|
const disableAllActions = saving || imageSaving;
|
|
10764
11615
|
const dirty = fullName.trim() !== derivedName || selectedSpec !== derivedSpec || selectedLanguage !== derivedLanguage;
|
|
10765
|
-
(0,
|
|
11616
|
+
(0, import_react19.useEffect)(() => {
|
|
10766
11617
|
setFullName(derivedName);
|
|
10767
11618
|
setImagePreview(void 0);
|
|
10768
11619
|
}, [derivedName]);
|
|
10769
|
-
(0,
|
|
11620
|
+
(0, import_react19.useEffect)(() => {
|
|
10770
11621
|
setSelectedSpec(derivedSpec);
|
|
10771
11622
|
}, [derivedSpec]);
|
|
10772
|
-
(0,
|
|
11623
|
+
(0, import_react19.useEffect)(() => {
|
|
10773
11624
|
setSelectedLanguage(derivedLanguage);
|
|
10774
11625
|
}, [derivedLanguage]);
|
|
10775
11626
|
const handleSave = async () => {
|
|
@@ -10851,13 +11702,13 @@ function ProfileTab() {
|
|
|
10851
11702
|
}
|
|
10852
11703
|
auth.clearAuth();
|
|
10853
11704
|
};
|
|
10854
|
-
return /* @__PURE__ */ (0,
|
|
11705
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
10855
11706
|
"div",
|
|
10856
11707
|
{
|
|
10857
11708
|
className: "flex flex-col items-start flex-1 min-w-0 min-h-0 overflow-y-auto",
|
|
10858
11709
|
style: { gap: "var(--spacing-3xl)" },
|
|
10859
11710
|
children: [
|
|
10860
|
-
/* @__PURE__ */ (0,
|
|
11711
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
10861
11712
|
"div",
|
|
10862
11713
|
{
|
|
10863
11714
|
className: "sc-profile-card flex flex-col items-start w-full",
|
|
@@ -10870,13 +11721,13 @@ function ProfileTab() {
|
|
|
10870
11721
|
gap: "var(--spacing-6xl)"
|
|
10871
11722
|
},
|
|
10872
11723
|
children: [
|
|
10873
|
-
/* @__PURE__ */ (0,
|
|
11724
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
10874
11725
|
"div",
|
|
10875
11726
|
{
|
|
10876
11727
|
className: "flex items-center shrink-0 w-full",
|
|
10877
11728
|
style: { gap: 24, flexWrap: "wrap" },
|
|
10878
11729
|
children: [
|
|
10879
|
-
profileImage ? /* @__PURE__ */ (0,
|
|
11730
|
+
profileImage ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
10880
11731
|
"img",
|
|
10881
11732
|
{
|
|
10882
11733
|
src: profileImage,
|
|
@@ -10889,7 +11740,7 @@ function ProfileTab() {
|
|
|
10889
11740
|
flexShrink: 0
|
|
10890
11741
|
}
|
|
10891
11742
|
}
|
|
10892
|
-
) : /* @__PURE__ */ (0,
|
|
11743
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
10893
11744
|
"div",
|
|
10894
11745
|
{
|
|
10895
11746
|
"aria-label": "Profile",
|
|
@@ -10902,7 +11753,7 @@ function ProfileTab() {
|
|
|
10902
11753
|
border: "1px solid var(--alias-border-subtle)",
|
|
10903
11754
|
flexShrink: 0
|
|
10904
11755
|
},
|
|
10905
|
-
children: /* @__PURE__ */ (0,
|
|
11756
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
10906
11757
|
"span",
|
|
10907
11758
|
{
|
|
10908
11759
|
style: {
|
|
@@ -10917,7 +11768,7 @@ function ProfileTab() {
|
|
|
10917
11768
|
)
|
|
10918
11769
|
}
|
|
10919
11770
|
),
|
|
10920
|
-
/* @__PURE__ */ (0,
|
|
11771
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
10921
11772
|
"input",
|
|
10922
11773
|
{
|
|
10923
11774
|
ref: fileInputRef,
|
|
@@ -10927,17 +11778,17 @@ function ProfileTab() {
|
|
|
10927
11778
|
onChange: handleImageChange
|
|
10928
11779
|
}
|
|
10929
11780
|
),
|
|
10930
|
-
/* @__PURE__ */ (0,
|
|
11781
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
10931
11782
|
"div",
|
|
10932
11783
|
{
|
|
10933
11784
|
className: "flex items-center",
|
|
10934
11785
|
style: { gap: 12, flexWrap: "wrap" },
|
|
10935
11786
|
children: [
|
|
10936
|
-
/* @__PURE__ */ (0,
|
|
10937
|
-
|
|
11787
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
11788
|
+
import_ui15.ScButton,
|
|
10938
11789
|
{
|
|
10939
11790
|
text: "Upload photo",
|
|
10940
|
-
icon: /* @__PURE__ */ (0,
|
|
11791
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_icons14.SiconUpload, { className: "w-5 h-5", color: PRIMARY_COLOR3 }),
|
|
10941
11792
|
styleVariant: "icon-left",
|
|
10942
11793
|
variant: "outline",
|
|
10943
11794
|
size: "md",
|
|
@@ -10945,12 +11796,12 @@ function ProfileTab() {
|
|
|
10945
11796
|
onClick: handleUploadClick
|
|
10946
11797
|
}
|
|
10947
11798
|
),
|
|
10948
|
-
/* @__PURE__ */ (0,
|
|
10949
|
-
|
|
11799
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
11800
|
+
import_ui15.ScButton,
|
|
10950
11801
|
{
|
|
10951
11802
|
text: "Remove photo",
|
|
10952
|
-
icon: /* @__PURE__ */ (0,
|
|
10953
|
-
|
|
11803
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
11804
|
+
import_icons14.SiconDelete,
|
|
10954
11805
|
{
|
|
10955
11806
|
className: "w-5 h-5",
|
|
10956
11807
|
color: PRIMARY_COLOR3
|
|
@@ -10969,16 +11820,16 @@ function ProfileTab() {
|
|
|
10969
11820
|
]
|
|
10970
11821
|
}
|
|
10971
11822
|
),
|
|
10972
|
-
/* @__PURE__ */ (0,
|
|
10973
|
-
/* @__PURE__ */ (0,
|
|
11823
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_ui13.ScHDivider, {}),
|
|
11824
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
10974
11825
|
"div",
|
|
10975
11826
|
{
|
|
10976
11827
|
className: "sc-profile-fields flex flex-col min-w-0 w-full",
|
|
10977
11828
|
style: { gap: 24 },
|
|
10978
11829
|
children: [
|
|
10979
|
-
/* @__PURE__ */ (0,
|
|
10980
|
-
/* @__PURE__ */ (0,
|
|
10981
|
-
|
|
11830
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { style: { display: "grid", width: "100%", gridTemplateColumns: "repeat(auto-fit, minmax(min(100%, 240px), 1fr))", gap: 24 }, children: [
|
|
11831
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "flex-1 min-w-0", style: { overflow: "hidden" }, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
11832
|
+
import_ui14.ScTextField,
|
|
10982
11833
|
{
|
|
10983
11834
|
label: "Full Name",
|
|
10984
11835
|
labelGroup: "label",
|
|
@@ -10991,7 +11842,7 @@ function ProfileTab() {
|
|
|
10991
11842
|
onChange: (e) => setFullName(e.target.value)
|
|
10992
11843
|
}
|
|
10993
11844
|
) }),
|
|
10994
|
-
/* @__PURE__ */ (0,
|
|
11845
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "flex-1 min-w-0", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
10995
11846
|
SpecializationDropdown,
|
|
10996
11847
|
{
|
|
10997
11848
|
value: selectedSpec,
|
|
@@ -11000,8 +11851,8 @@ function ProfileTab() {
|
|
|
11000
11851
|
}
|
|
11001
11852
|
) })
|
|
11002
11853
|
] }),
|
|
11003
|
-
/* @__PURE__ */ (0,
|
|
11004
|
-
/* @__PURE__ */ (0,
|
|
11854
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex items-start w-full", style: { gap: "var(--spacing-3xl)" }, children: [
|
|
11855
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "flex-1 min-w-0", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
11005
11856
|
LanguageDropdown,
|
|
11006
11857
|
{
|
|
11007
11858
|
value: selectedLanguage,
|
|
@@ -11009,10 +11860,10 @@ function ProfileTab() {
|
|
|
11009
11860
|
disabled: disableAllActions
|
|
11010
11861
|
}
|
|
11011
11862
|
) }),
|
|
11012
|
-
/* @__PURE__ */ (0,
|
|
11863
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "flex-1 min-w-0" })
|
|
11013
11864
|
] }),
|
|
11014
|
-
/* @__PURE__ */ (0,
|
|
11015
|
-
|
|
11865
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "w-full", style: { overflow: "hidden" }, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
11866
|
+
import_ui14.ScTextField,
|
|
11016
11867
|
{
|
|
11017
11868
|
label: "Email ID",
|
|
11018
11869
|
labelGroup: "label",
|
|
@@ -11020,8 +11871,8 @@ function ProfileTab() {
|
|
|
11020
11871
|
value: user?.email ?? "",
|
|
11021
11872
|
placeholderFilled: user?.email ?? "chris@kepler.com",
|
|
11022
11873
|
tfGroup: "icon-right",
|
|
11023
|
-
tfRightIcon: /* @__PURE__ */ (0,
|
|
11024
|
-
|
|
11874
|
+
tfRightIcon: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
11875
|
+
import_icons14.SiconLock,
|
|
11025
11876
|
{
|
|
11026
11877
|
className: "w-6 h-6",
|
|
11027
11878
|
color: "var(--alias-text---icons-primary)"
|
|
@@ -11032,13 +11883,13 @@ function ProfileTab() {
|
|
|
11032
11883
|
readOnly: true
|
|
11033
11884
|
}
|
|
11034
11885
|
) }),
|
|
11035
|
-
/* @__PURE__ */ (0,
|
|
11886
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
11036
11887
|
"div",
|
|
11037
11888
|
{
|
|
11038
11889
|
className: "flex items-center w-full",
|
|
11039
11890
|
style: { justifyContent: "flex-end", paddingTop: "var(--spacing-md)" },
|
|
11040
|
-
children: /* @__PURE__ */ (0,
|
|
11041
|
-
|
|
11891
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
11892
|
+
import_ui15.ScButton,
|
|
11042
11893
|
{
|
|
11043
11894
|
text: saving ? "Saving..." : "Save changes",
|
|
11044
11895
|
variant: "secondary",
|
|
@@ -11055,7 +11906,7 @@ function ProfileTab() {
|
|
|
11055
11906
|
]
|
|
11056
11907
|
}
|
|
11057
11908
|
),
|
|
11058
|
-
/* @__PURE__ */ (0,
|
|
11909
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
11059
11910
|
"div",
|
|
11060
11911
|
{
|
|
11061
11912
|
className: "flex items-center w-full",
|
|
@@ -11067,8 +11918,8 @@ function ProfileTab() {
|
|
|
11067
11918
|
gap: "var(--spacing-3xl)"
|
|
11068
11919
|
},
|
|
11069
11920
|
children: [
|
|
11070
|
-
/* @__PURE__ */ (0,
|
|
11071
|
-
/* @__PURE__ */ (0,
|
|
11921
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex flex-col min-w-0 flex-1", style: { gap: "var(--spacing-xs)" }, children: [
|
|
11922
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
11072
11923
|
"span",
|
|
11073
11924
|
{
|
|
11074
11925
|
style: {
|
|
@@ -11081,7 +11932,7 @@ function ProfileTab() {
|
|
|
11081
11932
|
children: "Session"
|
|
11082
11933
|
}
|
|
11083
11934
|
),
|
|
11084
|
-
/* @__PURE__ */ (0,
|
|
11935
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
11085
11936
|
"span",
|
|
11086
11937
|
{
|
|
11087
11938
|
className: "truncate",
|
|
@@ -11096,8 +11947,8 @@ function ProfileTab() {
|
|
|
11096
11947
|
}
|
|
11097
11948
|
)
|
|
11098
11949
|
] }),
|
|
11099
|
-
/* @__PURE__ */ (0,
|
|
11100
|
-
|
|
11950
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
11951
|
+
import_ui15.ScButton,
|
|
11101
11952
|
{
|
|
11102
11953
|
text: "Log out",
|
|
11103
11954
|
variant: "outline",
|
|
@@ -11160,11 +12011,11 @@ function WorkspaceListTab({
|
|
|
11160
12011
|
const currentOrganization = organizations.find(
|
|
11161
12012
|
(org) => org._id && org._id === currentWorkspace?.organizationId
|
|
11162
12013
|
);
|
|
11163
|
-
const [page, setPage] = (0,
|
|
11164
|
-
const [serverPage, setServerPage] = (0,
|
|
11165
|
-
const [serverFailed, setServerFailed] = (0,
|
|
12014
|
+
const [page, setPage] = (0, import_react19.useState)(0);
|
|
12015
|
+
const [serverPage, setServerPage] = (0, import_react19.useState)(null);
|
|
12016
|
+
const [serverFailed, setServerFailed] = (0, import_react19.useState)(false);
|
|
11166
12017
|
const serverMode = !!listPage && !serverFailed;
|
|
11167
|
-
(0,
|
|
12018
|
+
(0, import_react19.useEffect)(() => {
|
|
11168
12019
|
if (!listPage || serverFailed) return;
|
|
11169
12020
|
let cancelled = false;
|
|
11170
12021
|
listPage({ limit: pageSize, offset: page * pageSize }).then((result) => {
|
|
@@ -11205,21 +12056,21 @@ function WorkspaceListTab({
|
|
|
11205
12056
|
const pageRows = serverMode ? (serverPage?.items ?? []).map((ws) => ({ ws, group: serverGroupOf(ws) })) : rows.slice(pageStart, pageStart + pageSize);
|
|
11206
12057
|
const pageWorkspaces = pageRows.map((row) => row.ws);
|
|
11207
12058
|
const listLoading = loading || serverMode && !serverPage;
|
|
11208
|
-
const [plans, setPlans] = (0,
|
|
11209
|
-
const requestedPlans = (0,
|
|
12059
|
+
const [plans, setPlans] = (0, import_react19.useState)({});
|
|
12060
|
+
const requestedPlans = (0, import_react19.useRef)(/* @__PURE__ */ new Set());
|
|
11210
12061
|
const visibleIds = [
|
|
11211
12062
|
...currentWorkspace ? [currentWorkspace._id] : [],
|
|
11212
12063
|
...pageWorkspaces.map((ws) => ws._id)
|
|
11213
12064
|
];
|
|
11214
12065
|
const visibleKey = visibleIds.join(",");
|
|
11215
|
-
const mounted = (0,
|
|
11216
|
-
(0,
|
|
12066
|
+
const mounted = (0, import_react19.useRef)(true);
|
|
12067
|
+
(0, import_react19.useEffect)(() => {
|
|
11217
12068
|
mounted.current = true;
|
|
11218
12069
|
return () => {
|
|
11219
12070
|
mounted.current = false;
|
|
11220
12071
|
};
|
|
11221
12072
|
}, []);
|
|
11222
|
-
(0,
|
|
12073
|
+
(0, import_react19.useEffect)(() => {
|
|
11223
12074
|
if (!fetchPlans || listLoading) return;
|
|
11224
12075
|
const missing = visibleKey.split(",").filter((id) => id && !requestedPlans.current.has(id));
|
|
11225
12076
|
if (!missing.length) return;
|
|
@@ -11230,13 +12081,13 @@ function WorkspaceListTab({
|
|
|
11230
12081
|
});
|
|
11231
12082
|
}, [fetchPlans, listLoading, visibleKey]);
|
|
11232
12083
|
const planOf = (ws) => fetchPlans ? plans[ws._id] ?? "" : ws.plan ?? "";
|
|
11233
|
-
return /* @__PURE__ */ (0,
|
|
12084
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
11234
12085
|
"div",
|
|
11235
12086
|
{
|
|
11236
12087
|
className: "flex flex-col items-start flex-1 min-w-0",
|
|
11237
12088
|
style: { gap: "var(--spacing-3xl)", height: "100%" },
|
|
11238
12089
|
children: [
|
|
11239
|
-
/* @__PURE__ */ (0,
|
|
12090
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
11240
12091
|
"p",
|
|
11241
12092
|
{
|
|
11242
12093
|
className: "shrink-0 w-full",
|
|
@@ -11249,7 +12100,7 @@ function WorkspaceListTab({
|
|
|
11249
12100
|
children: "Switching changes which workspace the rest of Settings acts on."
|
|
11250
12101
|
}
|
|
11251
12102
|
),
|
|
11252
|
-
listLoading && /* @__PURE__ */ (0,
|
|
12103
|
+
listLoading && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
11253
12104
|
"p",
|
|
11254
12105
|
{
|
|
11255
12106
|
style: {
|
|
@@ -11260,13 +12111,13 @@ function WorkspaceListTab({
|
|
|
11260
12111
|
children: "Loading workspaces\u2026"
|
|
11261
12112
|
}
|
|
11262
12113
|
),
|
|
11263
|
-
!listLoading && currentWorkspace && /* @__PURE__ */ (0,
|
|
12114
|
+
!listLoading && currentWorkspace && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
11264
12115
|
"div",
|
|
11265
12116
|
{
|
|
11266
12117
|
className: "flex flex-col items-start shrink-0 w-full",
|
|
11267
12118
|
style: { gap: 16, padding: "var(--spacing-md) 0" },
|
|
11268
12119
|
children: [
|
|
11269
|
-
/* @__PURE__ */ (0,
|
|
12120
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
11270
12121
|
"p",
|
|
11271
12122
|
{
|
|
11272
12123
|
className: "w-full overflow-hidden text-ellipsis whitespace-nowrap",
|
|
@@ -11283,8 +12134,8 @@ function WorkspaceListTab({
|
|
|
11283
12134
|
]
|
|
11284
12135
|
}
|
|
11285
12136
|
),
|
|
11286
|
-
/* @__PURE__ */ (0,
|
|
11287
|
-
|
|
12137
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
12138
|
+
import_ui16.ScWorkspaceSwitchCard,
|
|
11288
12139
|
{
|
|
11289
12140
|
wsName: currentWorkspace.name,
|
|
11290
12141
|
initials: currentWorkspace.initials,
|
|
@@ -11300,7 +12151,7 @@ function WorkspaceListTab({
|
|
|
11300
12151
|
]
|
|
11301
12152
|
}
|
|
11302
12153
|
),
|
|
11303
|
-
!listLoading && currentWorkspace && listTotal > 0 && /* @__PURE__ */ (0,
|
|
12154
|
+
!listLoading && currentWorkspace && listTotal > 0 && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
11304
12155
|
"div",
|
|
11305
12156
|
{
|
|
11306
12157
|
className: "shrink-0 w-full",
|
|
@@ -11310,19 +12161,19 @@ function WorkspaceListTab({
|
|
|
11310
12161
|
}
|
|
11311
12162
|
}
|
|
11312
12163
|
),
|
|
11313
|
-
!listLoading && listTotal > 0 && /* @__PURE__ */ (0,
|
|
12164
|
+
!listLoading && listTotal > 0 && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
11314
12165
|
"div",
|
|
11315
12166
|
{
|
|
11316
12167
|
className: "flex flex-col items-start flex-1 min-h-0 w-full",
|
|
11317
12168
|
style: { gap: 16, overflowY: "auto" },
|
|
11318
12169
|
children: [
|
|
11319
|
-
/* @__PURE__ */ (0,
|
|
12170
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
11320
12171
|
"div",
|
|
11321
12172
|
{
|
|
11322
12173
|
className: "flex flex-col items-start w-full",
|
|
11323
12174
|
style: { gap: 16 },
|
|
11324
|
-
children: pageRows.map(({ ws, group }, index) => /* @__PURE__ */ (0,
|
|
11325
|
-
(index === 0 || pageRows[index - 1].group.key !== group.key) && /* @__PURE__ */ (0,
|
|
12175
|
+
children: pageRows.map(({ ws, group }, index) => /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_react19.Fragment, { children: [
|
|
12176
|
+
(index === 0 || pageRows[index - 1].group.key !== group.key) && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
11326
12177
|
"p",
|
|
11327
12178
|
{
|
|
11328
12179
|
className: "w-full overflow-hidden text-ellipsis whitespace-nowrap shrink-0",
|
|
@@ -11337,8 +12188,8 @@ function WorkspaceListTab({
|
|
|
11337
12188
|
children: group.label
|
|
11338
12189
|
}
|
|
11339
12190
|
),
|
|
11340
|
-
/* @__PURE__ */ (0,
|
|
11341
|
-
|
|
12191
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
12192
|
+
import_ui16.ScWorkspaceSwitchCard,
|
|
11342
12193
|
{
|
|
11343
12194
|
wsName: ws.name,
|
|
11344
12195
|
initials: ws.initials,
|
|
@@ -11355,13 +12206,13 @@ function WorkspaceListTab({
|
|
|
11355
12206
|
] }, ws._id))
|
|
11356
12207
|
}
|
|
11357
12208
|
),
|
|
11358
|
-
pageCount > 1 && /* @__PURE__ */ (0,
|
|
12209
|
+
pageCount > 1 && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
11359
12210
|
"div",
|
|
11360
12211
|
{
|
|
11361
12212
|
className: "flex items-center justify-between shrink-0 w-full",
|
|
11362
12213
|
style: { gap: "var(--spacing-md)" },
|
|
11363
12214
|
children: [
|
|
11364
|
-
/* @__PURE__ */ (0,
|
|
12215
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
11365
12216
|
"span",
|
|
11366
12217
|
{
|
|
11367
12218
|
style: {
|
|
@@ -11380,9 +12231,9 @@ function WorkspaceListTab({
|
|
|
11380
12231
|
]
|
|
11381
12232
|
}
|
|
11382
12233
|
),
|
|
11383
|
-
/* @__PURE__ */ (0,
|
|
11384
|
-
/* @__PURE__ */ (0,
|
|
11385
|
-
|
|
12234
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex items-center", style: { gap: "var(--spacing-md)" }, children: [
|
|
12235
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
12236
|
+
import_ui15.ScButton,
|
|
11386
12237
|
{
|
|
11387
12238
|
text: "Previous",
|
|
11388
12239
|
variant: "tertiary",
|
|
@@ -11391,8 +12242,8 @@ function WorkspaceListTab({
|
|
|
11391
12242
|
onClick: safePage === 0 ? void 0 : () => setPage(safePage - 1)
|
|
11392
12243
|
}
|
|
11393
12244
|
),
|
|
11394
|
-
/* @__PURE__ */ (0,
|
|
11395
|
-
|
|
12245
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
12246
|
+
import_ui15.ScButton,
|
|
11396
12247
|
{
|
|
11397
12248
|
text: "Next",
|
|
11398
12249
|
variant: "tertiary",
|
|
@@ -11419,12 +12270,12 @@ function ReferralTab() {
|
|
|
11419
12270
|
const referralCode = (user?.referralCode ?? user?.referral_code ?? user?.referalCode ?? user?.referal_code ?? "").trim();
|
|
11420
12271
|
const domain = typeof window !== "undefined" ? window.location.origin : "";
|
|
11421
12272
|
const referralLink = referralCode && domain ? `${domain}?referral_code=${encodeURIComponent(referralCode)}` : "";
|
|
11422
|
-
return /* @__PURE__ */ (0,
|
|
12273
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
11423
12274
|
"div",
|
|
11424
12275
|
{
|
|
11425
12276
|
className: "flex flex-col items-start flex-1 min-w-0",
|
|
11426
12277
|
style: { gap: "var(--spacing-3xl)" },
|
|
11427
|
-
children: /* @__PURE__ */ (0,
|
|
12278
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
11428
12279
|
"div",
|
|
11429
12280
|
{
|
|
11430
12281
|
className: "w-full relative",
|
|
@@ -11433,14 +12284,14 @@ function ReferralTab() {
|
|
|
11433
12284
|
borderRadius: "var(--radius-3xl)",
|
|
11434
12285
|
padding: "var(--spacing-6xl)"
|
|
11435
12286
|
},
|
|
11436
|
-
children: /* @__PURE__ */ (0,
|
|
12287
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
11437
12288
|
"div",
|
|
11438
12289
|
{
|
|
11439
12290
|
className: "flex items-start w-full",
|
|
11440
12291
|
style: { gap: "var(--spacing-3xl)" },
|
|
11441
12292
|
children: [
|
|
11442
|
-
/* @__PURE__ */ (0,
|
|
11443
|
-
|
|
12293
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
12294
|
+
import_ui14.ScTextField,
|
|
11444
12295
|
{
|
|
11445
12296
|
label: "Your Referral Link",
|
|
11446
12297
|
labelGroup: "label",
|
|
@@ -11448,8 +12299,8 @@ function ReferralTab() {
|
|
|
11448
12299
|
value: referralLink,
|
|
11449
12300
|
placeholderFilled: "https://your-domain.com?referral_code=ABC123",
|
|
11450
12301
|
tfGroup: "icon-right",
|
|
11451
|
-
tfRightIcon: /* @__PURE__ */ (0,
|
|
11452
|
-
|
|
12302
|
+
tfRightIcon: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
12303
|
+
import_icons14.SiconBolt,
|
|
11453
12304
|
{
|
|
11454
12305
|
className: "w-6 h-6",
|
|
11455
12306
|
color: "var(--alias-text---icons-primary)"
|
|
@@ -11459,8 +12310,8 @@ function ReferralTab() {
|
|
|
11459
12310
|
readOnly: true
|
|
11460
12311
|
}
|
|
11461
12312
|
),
|
|
11462
|
-
/* @__PURE__ */ (0,
|
|
11463
|
-
|
|
12313
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
12314
|
+
import_ui14.ScTextField,
|
|
11464
12315
|
{
|
|
11465
12316
|
label: "Invite through email",
|
|
11466
12317
|
labelGroup: "label",
|
|
@@ -11468,8 +12319,8 @@ function ReferralTab() {
|
|
|
11468
12319
|
value: user?.email ?? "",
|
|
11469
12320
|
placeholderFilled: "chris@kepler.com",
|
|
11470
12321
|
tfGroup: "icon-right",
|
|
11471
|
-
tfRightIcon: /* @__PURE__ */ (0,
|
|
11472
|
-
|
|
12322
|
+
tfRightIcon: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
12323
|
+
import_icons14.SiconSend,
|
|
11473
12324
|
{
|
|
11474
12325
|
className: "w-6 h-6",
|
|
11475
12326
|
color: "var(--alias-text---icons-primary)"
|
|
@@ -11493,7 +12344,7 @@ function SettingsContent({
|
|
|
11493
12344
|
onBack,
|
|
11494
12345
|
hiddenApps
|
|
11495
12346
|
}) {
|
|
11496
|
-
return /* @__PURE__ */ (0,
|
|
12347
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(SettingsAdaptersProvider, { adapters, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
11497
12348
|
SettingsContentInner,
|
|
11498
12349
|
{
|
|
11499
12350
|
activeTab,
|
|
@@ -11522,11 +12373,11 @@ function SettingsContentInner({
|
|
|
11522
12373
|
const workspaceId = workspace.current?.id ?? null;
|
|
11523
12374
|
const workspaceOwner = useWorkspaceOrganization({ workspaceId, request: workspace.organizationRequest ?? unavailableOrganizationRequest, enabled: !!workspace.organizationRequest });
|
|
11524
12375
|
const workspaceOwnerName = workspace.organizationRequest ? workspaceOwner.organizationName : void 0;
|
|
11525
|
-
const [workspaceList, setWorkspaceList] = (0,
|
|
12376
|
+
const [workspaceList, setWorkspaceList] = (0, import_react19.useState)([]);
|
|
11526
12377
|
const currentWorkspaceRole = workspace.current?.role ?? workspaceList.find((item) => item._id === workspaceId)?.role;
|
|
11527
12378
|
const isWorkspaceAdmin = currentWorkspaceRole?.trim().toLowerCase() === "admin";
|
|
11528
|
-
const [workspaceListLoading, setWorkspaceListLoading] = (0,
|
|
11529
|
-
const refreshWorkspaceList = (0,
|
|
12379
|
+
const [workspaceListLoading, setWorkspaceListLoading] = (0, import_react19.useState)(false);
|
|
12380
|
+
const refreshWorkspaceList = (0, import_react19.useCallback)(async () => {
|
|
11530
12381
|
setWorkspaceListLoading(true);
|
|
11531
12382
|
try {
|
|
11532
12383
|
const items = await workspace.list();
|
|
@@ -11547,11 +12398,11 @@ function SettingsContentInner({
|
|
|
11547
12398
|
setWorkspaceListLoading(false);
|
|
11548
12399
|
}
|
|
11549
12400
|
}, [workspace, workspaceId]);
|
|
11550
|
-
(0,
|
|
12401
|
+
(0, import_react19.useEffect)(() => {
|
|
11551
12402
|
void refreshWorkspaceList();
|
|
11552
12403
|
}, [refreshWorkspaceList]);
|
|
11553
12404
|
const hostListPage = workspace.listPage;
|
|
11554
|
-
const listWorkspacePage = (0,
|
|
12405
|
+
const listWorkspacePage = (0, import_react19.useMemo)(
|
|
11555
12406
|
() => hostListPage ? async (params) => {
|
|
11556
12407
|
const result = await hostListPage(params);
|
|
11557
12408
|
return {
|
|
@@ -11568,8 +12419,8 @@ function SettingsContentInner({
|
|
|
11568
12419
|
} : void 0,
|
|
11569
12420
|
[hostListPage, workspaceId]
|
|
11570
12421
|
);
|
|
11571
|
-
const [listOrganizations, setListOrganizations] = (0,
|
|
11572
|
-
(0,
|
|
12422
|
+
const [listOrganizations, setListOrganizations] = (0, import_react19.useState)([]);
|
|
12423
|
+
(0, import_react19.useEffect)(() => {
|
|
11573
12424
|
if (activeTab !== "workspaceList" || typeof organization?.list !== "function") {
|
|
11574
12425
|
return;
|
|
11575
12426
|
}
|
|
@@ -11590,7 +12441,7 @@ function SettingsContentInner({
|
|
|
11590
12441
|
cancelled = true;
|
|
11591
12442
|
};
|
|
11592
12443
|
}, [activeTab, organization]);
|
|
11593
|
-
const switchWorkspace = (0,
|
|
12444
|
+
const switchWorkspace = (0, import_react19.useCallback)(
|
|
11594
12445
|
async (id) => {
|
|
11595
12446
|
await workspace.switch(id);
|
|
11596
12447
|
},
|
|
@@ -11599,17 +12450,27 @@ function SettingsContentInner({
|
|
|
11599
12450
|
const setActiveTab = (tab) => {
|
|
11600
12451
|
navigation.navigateToTab(tab);
|
|
11601
12452
|
};
|
|
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,
|
|
12453
|
+
const [creatingWorkspace, setCreatingWorkspace] = (0, import_react19.useState)(false);
|
|
12454
|
+
const [updatingWorkspace, setUpdatingWorkspace] = (0, import_react19.useState)(false);
|
|
12455
|
+
const [teamInviteOpen, setTeamInviteOpen] = (0, import_react19.useState)(false);
|
|
12456
|
+
const [tokenShowRevoked, setTokenShowRevoked] = (0, import_react19.useState)(false);
|
|
12457
|
+
const [tokenCreateOpen, setTokenCreateOpen] = (0, import_react19.useState)(false);
|
|
12458
|
+
const [billingShowPlans, setBillingShowPlans] = (0, import_react19.useState)(false);
|
|
11608
12459
|
const isBillingPlans = activeTab === "billing" && isWorkspaceAdmin && billingShowPlans;
|
|
11609
|
-
(0,
|
|
11610
|
-
|
|
11611
|
-
|
|
11612
|
-
(0,
|
|
12460
|
+
const [billingShowPerUserLimits, setBillingShowPerUserLimits] = (0, import_react19.useState)(false);
|
|
12461
|
+
const isBillingPerUserLimits = activeTab === "billing" && isWorkspaceAdmin && billingShowPerUserLimits && !billingShowPlans;
|
|
12462
|
+
const isBillingSubView = isBillingPlans || isBillingPerUserLimits;
|
|
12463
|
+
(0, import_react19.useEffect)(() => {
|
|
12464
|
+
if (activeTab !== "billing" || !isWorkspaceAdmin) {
|
|
12465
|
+
setBillingShowPlans(false);
|
|
12466
|
+
setBillingShowPerUserLimits(false);
|
|
12467
|
+
}
|
|
12468
|
+
}, [activeTab, isWorkspaceAdmin]);
|
|
12469
|
+
(0, import_react19.useEffect)(() => {
|
|
12470
|
+
setBillingShowPlans(false);
|
|
12471
|
+
setBillingShowPerUserLimits(false);
|
|
12472
|
+
}, [workspaceId]);
|
|
12473
|
+
(0, import_react19.useEffect)(() => {
|
|
11613
12474
|
if (!onClose) return;
|
|
11614
12475
|
const handleKeyDown = (e) => {
|
|
11615
12476
|
if (e.key !== "Escape" || e.defaultPrevented) return;
|
|
@@ -11618,19 +12479,23 @@ function SettingsContentInner({
|
|
|
11618
12479
|
setBillingShowPlans(false);
|
|
11619
12480
|
return;
|
|
11620
12481
|
}
|
|
12482
|
+
if (billingShowPerUserLimits) {
|
|
12483
|
+
setBillingShowPerUserLimits(false);
|
|
12484
|
+
return;
|
|
12485
|
+
}
|
|
11621
12486
|
onClose();
|
|
11622
12487
|
};
|
|
11623
12488
|
document.addEventListener("keydown", handleKeyDown);
|
|
11624
12489
|
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,
|
|
12490
|
+
}, [onClose, billingShowPlans, billingShowPerUserLimits]);
|
|
12491
|
+
const [localWorkspaces, setLocalWorkspaces] = (0, import_react19.useState)(null);
|
|
12492
|
+
const [wsModalOpen, setWsModalOpen] = (0, import_react19.useState)(false);
|
|
12493
|
+
const [wsModalMode, setWsModalMode] = (0, import_react19.useState)("create");
|
|
12494
|
+
const [editingWorkspace, setEditingWorkspace] = (0, import_react19.useState)(null);
|
|
12495
|
+
const [confirmLeaveOpen, setConfirmLeaveOpen] = (0, import_react19.useState)(false);
|
|
12496
|
+
const [leavingWorkspace, setLeavingWorkspace] = (0, import_react19.useState)(null);
|
|
12497
|
+
const [confirmDeleteOpen, setConfirmDeleteOpen] = (0, import_react19.useState)(false);
|
|
12498
|
+
const [deletingWorkspace, setDeletingWorkspace] = (0, import_react19.useState)(null);
|
|
11634
12499
|
const toWorkspaceData = (ws) => ({
|
|
11635
12500
|
id: ws._id,
|
|
11636
12501
|
name: ws.name ?? "",
|
|
@@ -11720,7 +12585,7 @@ function SettingsContentInner({
|
|
|
11720
12585
|
}
|
|
11721
12586
|
return true;
|
|
11722
12587
|
};
|
|
11723
|
-
(0,
|
|
12588
|
+
(0, import_react19.useEffect)(() => {
|
|
11724
12589
|
if (workspaceList.length > 0 && localWorkspaces === null) {
|
|
11725
12590
|
setLocalWorkspaces(workspaceList.map(toWorkspaceData));
|
|
11726
12591
|
}
|
|
@@ -11894,7 +12759,7 @@ function SettingsContentInner({
|
|
|
11894
12759
|
setConfirmLeaveOpen(true);
|
|
11895
12760
|
return false;
|
|
11896
12761
|
}
|
|
11897
|
-
return /* @__PURE__ */ (0,
|
|
12762
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
11898
12763
|
"div",
|
|
11899
12764
|
{
|
|
11900
12765
|
"data-streamoid-settings": "",
|
|
@@ -11904,8 +12769,8 @@ function SettingsContentInner({
|
|
|
11904
12769
|
backgroundSize: "24px 24px"
|
|
11905
12770
|
},
|
|
11906
12771
|
children: [
|
|
11907
|
-
/* @__PURE__ */ (0,
|
|
11908
|
-
/* @__PURE__ */ (0,
|
|
12772
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(SettingsAppearance, {}),
|
|
12773
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
11909
12774
|
"div",
|
|
11910
12775
|
{
|
|
11911
12776
|
className: "flex flex-col items-start relative h-full overflow-hidden",
|
|
@@ -11915,8 +12780,8 @@ function SettingsContentInner({
|
|
|
11915
12780
|
maxWidth: 1200,
|
|
11916
12781
|
width: "100%"
|
|
11917
12782
|
},
|
|
11918
|
-
children: /* @__PURE__ */ (0,
|
|
11919
|
-
onBack !== null && /* @__PURE__ */ (0,
|
|
12783
|
+
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: [
|
|
12784
|
+
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
12785
|
"button",
|
|
11921
12786
|
{
|
|
11922
12787
|
type: "button",
|
|
@@ -11938,12 +12803,12 @@ function SettingsContentInner({
|
|
|
11938
12803
|
},
|
|
11939
12804
|
onClick: () => onBack ? onBack() : window.history.back(),
|
|
11940
12805
|
children: [
|
|
11941
|
-
/* @__PURE__ */ (0,
|
|
12806
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_icons14.SiconLeft, { className: "w-4 h-4 shrink-0", color: "var(--alias-text---icons-muted)" }),
|
|
11942
12807
|
"Back"
|
|
11943
12808
|
]
|
|
11944
12809
|
}
|
|
11945
12810
|
) }),
|
|
11946
|
-
/* @__PURE__ */ (0,
|
|
12811
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
11947
12812
|
"div",
|
|
11948
12813
|
{
|
|
11949
12814
|
className: "flex items-center shrink-0 w-full",
|
|
@@ -11953,9 +12818,9 @@ function SettingsContentInner({
|
|
|
11953
12818
|
gap: 16
|
|
11954
12819
|
},
|
|
11955
12820
|
children: [
|
|
11956
|
-
/* @__PURE__ */ (0,
|
|
11957
|
-
/* @__PURE__ */ (0,
|
|
11958
|
-
/* @__PURE__ */ (0,
|
|
12821
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex items-center flex-1 min-w-0", style: { gap: 8, paddingLeft: 20 }, children: [
|
|
12822
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_icons14.SiconSettings, { className: "w-6 h-6 shrink-0", color: "var(--alias-text---icons-primary)" }),
|
|
12823
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
11959
12824
|
"span",
|
|
11960
12825
|
{
|
|
11961
12826
|
style: {
|
|
@@ -11968,9 +12833,9 @@ function SettingsContentInner({
|
|
|
11968
12833
|
children: "Settings"
|
|
11969
12834
|
}
|
|
11970
12835
|
),
|
|
11971
|
-
scopeCrumb && /* @__PURE__ */ (0,
|
|
11972
|
-
/* @__PURE__ */ (0,
|
|
11973
|
-
/* @__PURE__ */ (0,
|
|
12836
|
+
scopeCrumb && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
|
|
12837
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_icons14.SiconRight, { className: "w-6 h-6 shrink-0", color: "var(--alias-text---icons-primary)" }),
|
|
12838
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
11974
12839
|
"span",
|
|
11975
12840
|
{
|
|
11976
12841
|
className: "truncate",
|
|
@@ -11987,8 +12852,8 @@ function SettingsContentInner({
|
|
|
11987
12852
|
}
|
|
11988
12853
|
)
|
|
11989
12854
|
] }),
|
|
11990
|
-
/* @__PURE__ */ (0,
|
|
11991
|
-
/* @__PURE__ */ (0,
|
|
12855
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_icons14.SiconRight, { className: "w-6 h-6 shrink-0", color: "var(--alias-text---icons-primary)" }),
|
|
12856
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
11992
12857
|
"span",
|
|
11993
12858
|
{
|
|
11994
12859
|
style: {
|
|
@@ -12001,9 +12866,9 @@ function SettingsContentInner({
|
|
|
12001
12866
|
children: leafLabel
|
|
12002
12867
|
}
|
|
12003
12868
|
),
|
|
12004
|
-
isBillingPlans && /* @__PURE__ */ (0,
|
|
12005
|
-
/* @__PURE__ */ (0,
|
|
12006
|
-
/* @__PURE__ */ (0,
|
|
12869
|
+
isBillingPlans && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
|
|
12870
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_icons14.SiconRight, { className: "w-6 h-6 shrink-0", color: "var(--alias-text---icons-primary)" }),
|
|
12871
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
12007
12872
|
"span",
|
|
12008
12873
|
{
|
|
12009
12874
|
style: {
|
|
@@ -12016,9 +12881,25 @@ function SettingsContentInner({
|
|
|
12016
12881
|
children: "Plans"
|
|
12017
12882
|
}
|
|
12018
12883
|
)
|
|
12884
|
+
] }),
|
|
12885
|
+
isBillingPerUserLimits && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
|
|
12886
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_icons14.SiconRight, { className: "w-6 h-6 shrink-0", color: "var(--alias-text---icons-primary)" }),
|
|
12887
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
12888
|
+
"span",
|
|
12889
|
+
{
|
|
12890
|
+
style: {
|
|
12891
|
+
fontFamily: "var(--font-family-font-family-body)",
|
|
12892
|
+
fontSize: "var(--font-size-font-size-xl)",
|
|
12893
|
+
fontWeight: 500,
|
|
12894
|
+
lineHeight: "var(--line-height-line-height-xl)",
|
|
12895
|
+
color: "var(--alias-text---icons-primary)"
|
|
12896
|
+
},
|
|
12897
|
+
children: "Per-user limits"
|
|
12898
|
+
}
|
|
12899
|
+
)
|
|
12019
12900
|
] })
|
|
12020
12901
|
] }),
|
|
12021
|
-
|
|
12902
|
+
isBillingSubView && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
12022
12903
|
"div",
|
|
12023
12904
|
{
|
|
12024
12905
|
className: "flex items-center shrink-0 cursor-pointer",
|
|
@@ -12030,10 +12911,13 @@ function SettingsContentInner({
|
|
|
12030
12911
|
border: "1px solid var(--alias-border-subtle)",
|
|
12031
12912
|
backgroundColor: "var(--alias-surface-base)"
|
|
12032
12913
|
},
|
|
12033
|
-
onClick: () =>
|
|
12914
|
+
onClick: () => {
|
|
12915
|
+
setBillingShowPlans(false);
|
|
12916
|
+
setBillingShowPerUserLimits(false);
|
|
12917
|
+
},
|
|
12034
12918
|
children: [
|
|
12035
|
-
/* @__PURE__ */ (0,
|
|
12036
|
-
/* @__PURE__ */ (0,
|
|
12919
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_icons14.SiconLeft, { className: "w-4 h-4", color: "var(--alias-text---icons-muted)" }),
|
|
12920
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
12037
12921
|
"span",
|
|
12038
12922
|
{
|
|
12039
12923
|
style: {
|
|
@@ -12049,21 +12933,21 @@ function SettingsContentInner({
|
|
|
12049
12933
|
]
|
|
12050
12934
|
}
|
|
12051
12935
|
),
|
|
12052
|
-
activeTab === "workspaceList" && /* @__PURE__ */ (0,
|
|
12936
|
+
activeTab === "workspaceList" && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
12053
12937
|
SettingsTooltip,
|
|
12054
12938
|
{
|
|
12055
12939
|
content: "Start a new workspace with its own team, members and billing",
|
|
12056
12940
|
placement: "bottom",
|
|
12057
12941
|
inline: true,
|
|
12058
|
-
children: /* @__PURE__ */ (0,
|
|
12059
|
-
|
|
12942
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
12943
|
+
import_ui15.ScButton,
|
|
12060
12944
|
{
|
|
12061
12945
|
text: "Create Workspace",
|
|
12062
12946
|
variant: "secondary",
|
|
12063
12947
|
size: "md",
|
|
12064
12948
|
styleVariant: "icon-left",
|
|
12065
|
-
icon: /* @__PURE__ */ (0,
|
|
12066
|
-
|
|
12949
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
12950
|
+
import_icons14.SiconWorkspace,
|
|
12067
12951
|
{
|
|
12068
12952
|
className: "w-5 h-5",
|
|
12069
12953
|
color: "var(--alias-text---icons-inverse)"
|
|
@@ -12074,21 +12958,21 @@ function SettingsContentInner({
|
|
|
12074
12958
|
)
|
|
12075
12959
|
}
|
|
12076
12960
|
),
|
|
12077
|
-
activeTab === "workspaceMembers" && /* @__PURE__ */ (0,
|
|
12961
|
+
activeTab === "workspaceMembers" && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
12078
12962
|
SettingsTooltip,
|
|
12079
12963
|
{
|
|
12080
12964
|
content: "Send someone an invite to join this workspace",
|
|
12081
12965
|
placement: "bottom",
|
|
12082
12966
|
inline: true,
|
|
12083
|
-
children: /* @__PURE__ */ (0,
|
|
12084
|
-
|
|
12967
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
12968
|
+
import_ui15.ScButton,
|
|
12085
12969
|
{
|
|
12086
12970
|
text: "Invite user",
|
|
12087
12971
|
variant: "secondary",
|
|
12088
12972
|
size: "md",
|
|
12089
12973
|
styleVariant: "icon-left",
|
|
12090
|
-
icon: /* @__PURE__ */ (0,
|
|
12091
|
-
|
|
12974
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
12975
|
+
import_icons14.SiconUserAdd,
|
|
12092
12976
|
{
|
|
12093
12977
|
className: "w-5 h-5",
|
|
12094
12978
|
color: "var(--alias-text---icons-inverse)"
|
|
@@ -12099,15 +12983,15 @@ function SettingsContentInner({
|
|
|
12099
12983
|
)
|
|
12100
12984
|
}
|
|
12101
12985
|
),
|
|
12102
|
-
activeTab === "apikey" && isWorkspaceAdmin && /* @__PURE__ */ (0,
|
|
12103
|
-
/* @__PURE__ */ (0,
|
|
12986
|
+
activeTab === "apikey" && isWorkspaceAdmin && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex items-center shrink-0", style: { gap: "var(--spacing-md)" }, children: [
|
|
12987
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
12104
12988
|
SettingsTooltip,
|
|
12105
12989
|
{
|
|
12106
12990
|
content: "Include keys you have already revoked in the list below",
|
|
12107
12991
|
placement: "bottom",
|
|
12108
12992
|
inline: true,
|
|
12109
|
-
children: /* @__PURE__ */ (0,
|
|
12110
|
-
|
|
12993
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
12994
|
+
import_ui15.ScButton,
|
|
12111
12995
|
{
|
|
12112
12996
|
text: tokenShowRevoked ? "Hide Revoked" : "Show Revoked",
|
|
12113
12997
|
variant: "outline",
|
|
@@ -12117,21 +13001,21 @@ function SettingsContentInner({
|
|
|
12117
13001
|
)
|
|
12118
13002
|
}
|
|
12119
13003
|
),
|
|
12120
|
-
/* @__PURE__ */ (0,
|
|
13004
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
12121
13005
|
SettingsTooltip,
|
|
12122
13006
|
{
|
|
12123
13007
|
content: "Generate a key for calling the Streamoid APIs from your own code",
|
|
12124
13008
|
placement: "bottom",
|
|
12125
13009
|
inline: true,
|
|
12126
|
-
children: /* @__PURE__ */ (0,
|
|
12127
|
-
|
|
13010
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
13011
|
+
import_ui15.ScButton,
|
|
12128
13012
|
{
|
|
12129
13013
|
text: "New API Key",
|
|
12130
13014
|
variant: "secondary",
|
|
12131
13015
|
size: "md",
|
|
12132
13016
|
styleVariant: "icon-left",
|
|
12133
|
-
icon: /* @__PURE__ */ (0,
|
|
12134
|
-
|
|
13017
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
13018
|
+
import_icons14.SiconPlus,
|
|
12135
13019
|
{
|
|
12136
13020
|
className: "w-5 h-5",
|
|
12137
13021
|
color: "var(--alias-text---icons-inverse)"
|
|
@@ -12143,7 +13027,7 @@ function SettingsContentInner({
|
|
|
12143
13027
|
}
|
|
12144
13028
|
)
|
|
12145
13029
|
] }),
|
|
12146
|
-
onClose && /* @__PURE__ */ (0,
|
|
13030
|
+
onClose && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(SettingsTooltip, { content: "Close settings (Esc)", placement: "bottom", inline: true, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
12147
13031
|
"button",
|
|
12148
13032
|
{
|
|
12149
13033
|
type: "button",
|
|
@@ -12159,8 +13043,8 @@ function SettingsContentInner({
|
|
|
12159
13043
|
border: "1px solid var(--alias-border-subtle)",
|
|
12160
13044
|
backgroundColor: "var(--alias-surface-base)"
|
|
12161
13045
|
},
|
|
12162
|
-
children: /* @__PURE__ */ (0,
|
|
12163
|
-
|
|
13046
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
13047
|
+
import_icons14.SiconClose,
|
|
12164
13048
|
{
|
|
12165
13049
|
className: "w-5 h-5",
|
|
12166
13050
|
color: "var(--alias-text---icons-muted)"
|
|
@@ -12171,13 +13055,13 @@ function SettingsContentInner({
|
|
|
12171
13055
|
]
|
|
12172
13056
|
}
|
|
12173
13057
|
),
|
|
12174
|
-
/* @__PURE__ */ (0,
|
|
13058
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
12175
13059
|
"div",
|
|
12176
13060
|
{
|
|
12177
13061
|
className: "flex items-start flex-1 min-h-0 w-full overflow-hidden",
|
|
12178
13062
|
style: { gap: 20 },
|
|
12179
13063
|
children: [
|
|
12180
|
-
!
|
|
13064
|
+
!isBillingSubView && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
12181
13065
|
SettingsNav,
|
|
12182
13066
|
{
|
|
12183
13067
|
isWorkspaceAdmin,
|
|
@@ -12188,8 +13072,8 @@ function SettingsContentInner({
|
|
|
12188
13072
|
hasOrganization
|
|
12189
13073
|
}
|
|
12190
13074
|
),
|
|
12191
|
-
activeTab === "profile" && /* @__PURE__ */ (0,
|
|
12192
|
-
activeTab === "workspace" && /* @__PURE__ */ (0,
|
|
13075
|
+
activeTab === "profile" && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(ProfileTab, {}),
|
|
13076
|
+
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
13077
|
WorkspaceGeneralTab,
|
|
12194
13078
|
{
|
|
12195
13079
|
workspace: currentWorkspaceData,
|
|
@@ -12211,7 +13095,7 @@ function SettingsContentInner({
|
|
|
12211
13095
|
}
|
|
12212
13096
|
}
|
|
12213
13097
|
) }),
|
|
12214
|
-
activeTab === "workspaceMembers" && /* @__PURE__ */ (0,
|
|
13098
|
+
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
13099
|
TeamsContent,
|
|
12216
13100
|
{
|
|
12217
13101
|
embedded: true,
|
|
@@ -12223,7 +13107,7 @@ function SettingsContentInner({
|
|
|
12223
13107
|
hiddenApps
|
|
12224
13108
|
}
|
|
12225
13109
|
) }),
|
|
12226
|
-
activeTab === "workspaceList" && /* @__PURE__ */ (0,
|
|
13110
|
+
activeTab === "workspaceList" && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
12227
13111
|
WorkspaceListTab,
|
|
12228
13112
|
{
|
|
12229
13113
|
workspaces: displayWorkspaces,
|
|
@@ -12248,8 +13132,8 @@ function SettingsContentInner({
|
|
|
12248
13132
|
}
|
|
12249
13133
|
}
|
|
12250
13134
|
),
|
|
12251
|
-
activeTab === "referral" && /* @__PURE__ */ (0,
|
|
12252
|
-
(activeTab === "organization" || activeTab === "organizationWorkspaces" || activeTab === "organizationDomains") && /* @__PURE__ */ (0,
|
|
13135
|
+
activeTab === "referral" && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(ReferralTab, {}),
|
|
13136
|
+
(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
13137
|
ManagedOrganizationSummary,
|
|
12254
13138
|
{
|
|
12255
13139
|
name: workspaceOwner.organizationName,
|
|
@@ -12257,29 +13141,37 @@ function SettingsContentInner({
|
|
|
12257
13141
|
status: workspaceOwner.organizationStatus,
|
|
12258
13142
|
managementUrl: organization.managementUrl
|
|
12259
13143
|
}
|
|
12260
|
-
) : /* @__PURE__ */ (0,
|
|
13144
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
12261
13145
|
OrganizationContent,
|
|
12262
13146
|
{
|
|
12263
13147
|
embedded: true,
|
|
12264
13148
|
view: activeTab === "organizationWorkspaces" || activeTab === "organizationDomains" ? "workspaces" : "people"
|
|
12265
13149
|
}
|
|
12266
13150
|
) }),
|
|
12267
|
-
activeTab === "billing" && isWorkspaceAdmin && /* @__PURE__ */ (0,
|
|
13151
|
+
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
13152
|
BillingContent,
|
|
12269
13153
|
{
|
|
12270
13154
|
embedded: true,
|
|
12271
13155
|
showPlans: billingShowPlans,
|
|
12272
|
-
onShowPlansChange:
|
|
13156
|
+
onShowPlansChange: (open) => {
|
|
13157
|
+
setBillingShowPlans(open);
|
|
13158
|
+
if (open) setBillingShowPerUserLimits(false);
|
|
13159
|
+
},
|
|
13160
|
+
showPerUserLimits: billingShowPerUserLimits,
|
|
13161
|
+
onShowPerUserLimitsChange: (open) => {
|
|
13162
|
+
setBillingShowPerUserLimits(open);
|
|
13163
|
+
if (open) setBillingShowPlans(false);
|
|
13164
|
+
}
|
|
12273
13165
|
}
|
|
12274
13166
|
) }),
|
|
12275
|
-
(activeTab === "billing" || activeTab === "apikey") && !isWorkspaceAdmin && /* @__PURE__ */ (0,
|
|
12276
|
-
/* @__PURE__ */ (0,
|
|
12277
|
-
/* @__PURE__ */ (0,
|
|
12278
|
-
/* @__PURE__ */ (0,
|
|
12279
|
-
/* @__PURE__ */ (0,
|
|
13167
|
+
(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: [
|
|
13168
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_icons14.SiconLock, { size: 24, color: MUTED_COLOR2 }),
|
|
13169
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("h2", { style: { margin: 0, fontSize: 18, fontWeight: 600, color: PRIMARY_COLOR3 }, children: "Contact your workspace admin" }),
|
|
13170
|
+
/* @__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." }),
|
|
13171
|
+
/* @__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
13172
|
] }),
|
|
12281
|
-
activeTab === "apikey" && isWorkspaceAdmin && /* @__PURE__ */ (0,
|
|
12282
|
-
/* @__PURE__ */ (0,
|
|
13173
|
+
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: [
|
|
13174
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
12283
13175
|
"a",
|
|
12284
13176
|
{
|
|
12285
13177
|
href: "https://docs.streamoid.com",
|
|
@@ -12289,19 +13181,19 @@ function SettingsContentInner({
|
|
|
12289
13181
|
className: "flex items-center shrink-0",
|
|
12290
13182
|
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
13183
|
children: [
|
|
12292
|
-
/* @__PURE__ */ (0,
|
|
12293
|
-
/* @__PURE__ */ (0,
|
|
12294
|
-
/* @__PURE__ */ (0,
|
|
12295
|
-
/* @__PURE__ */ (0,
|
|
13184
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_icons14.SiconBookOpen, { size: 24 }),
|
|
13185
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("span", { style: { display: "flex", flexDirection: "column", gap: 4, flex: 1 }, children: [
|
|
13186
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { style: { fontSize: 14, fontWeight: 600 }, children: "Build with the Streamoid API" }),
|
|
13187
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { style: { fontSize: 13, lineHeight: "20px", color: MUTED_COLOR2 }, children: "Explore authentication, API references and integration guides." })
|
|
12296
13188
|
] }),
|
|
12297
|
-
/* @__PURE__ */ (0,
|
|
13189
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("span", { style: { display: "inline-flex", alignItems: "center", gap: 6, fontSize: 13, whiteSpace: "nowrap" }, children: [
|
|
12298
13190
|
"View docs ",
|
|
12299
|
-
/* @__PURE__ */ (0,
|
|
13191
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_icons14.SiconExternalLink, { size: 16 })
|
|
12300
13192
|
] })
|
|
12301
13193
|
]
|
|
12302
13194
|
}
|
|
12303
13195
|
),
|
|
12304
|
-
/* @__PURE__ */ (0,
|
|
13196
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
12305
13197
|
TokensContent,
|
|
12306
13198
|
{
|
|
12307
13199
|
embedded: true,
|
|
@@ -12318,7 +13210,7 @@ function SettingsContentInner({
|
|
|
12318
13210
|
] })
|
|
12319
13211
|
}
|
|
12320
13212
|
),
|
|
12321
|
-
/* @__PURE__ */ (0,
|
|
13213
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
12322
13214
|
WorkspaceModal,
|
|
12323
13215
|
{
|
|
12324
13216
|
open: wsModalOpen,
|
|
@@ -12337,7 +13229,7 @@ function SettingsContentInner({
|
|
|
12337
13229
|
}
|
|
12338
13230
|
}
|
|
12339
13231
|
),
|
|
12340
|
-
/* @__PURE__ */ (0,
|
|
13232
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
12341
13233
|
ConfirmLeaveModal,
|
|
12342
13234
|
{
|
|
12343
13235
|
open: confirmLeaveOpen,
|
|
@@ -12370,7 +13262,7 @@ function SettingsContentInner({
|
|
|
12370
13262
|
}
|
|
12371
13263
|
}
|
|
12372
13264
|
),
|
|
12373
|
-
/* @__PURE__ */ (0,
|
|
13265
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
12374
13266
|
ConfirmDeleteModal,
|
|
12375
13267
|
{
|
|
12376
13268
|
open: confirmDeleteOpen,
|
|
@@ -12400,10 +13292,10 @@ function SettingsContentInner({
|
|
|
12400
13292
|
}
|
|
12401
13293
|
|
|
12402
13294
|
// src/workspace-picker.tsx
|
|
12403
|
-
var
|
|
12404
|
-
var
|
|
12405
|
-
var
|
|
12406
|
-
var
|
|
13295
|
+
var import_react20 = require("react");
|
|
13296
|
+
var import_ui17 = require("@streamoid/ui");
|
|
13297
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
13298
|
+
var T15 = {
|
|
12407
13299
|
primary: "var(--alias-text---icons-primary)",
|
|
12408
13300
|
muted: "var(--alias-text---icons-muted)",
|
|
12409
13301
|
tertiary: "var(--alias-text---icons-tertiary)",
|
|
@@ -12433,10 +13325,10 @@ function WorkspacePicker({
|
|
|
12433
13325
|
onJoin,
|
|
12434
13326
|
onCreate
|
|
12435
13327
|
}) {
|
|
12436
|
-
const [selected, setSelected] = (0,
|
|
12437
|
-
const [creating, setCreating] = (0,
|
|
12438
|
-
const [name, setName] = (0,
|
|
12439
|
-
const [busy, setBusy] = (0,
|
|
13328
|
+
const [selected, setSelected] = (0, import_react20.useState)(/* @__PURE__ */ new Set());
|
|
13329
|
+
const [creating, setCreating] = (0, import_react20.useState)(false);
|
|
13330
|
+
const [name, setName] = (0, import_react20.useState)("");
|
|
13331
|
+
const [busy, setBusy] = (0, import_react20.useState)(false);
|
|
12440
13332
|
const hasWorkspaces = workspaces.length > 0;
|
|
12441
13333
|
const showCreate = creating || !loading && !hasWorkspaces;
|
|
12442
13334
|
const orgLabel = organizationName || "your organization";
|
|
@@ -12455,48 +13347,48 @@ function WorkspacePicker({
|
|
|
12455
13347
|
setBusy(false);
|
|
12456
13348
|
}
|
|
12457
13349
|
};
|
|
12458
|
-
return /* @__PURE__ */ (0,
|
|
13350
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
12459
13351
|
"div",
|
|
12460
13352
|
{
|
|
12461
13353
|
className: "flex flex-col w-full",
|
|
12462
|
-
style: { maxWidth: 520, gap:
|
|
13354
|
+
style: { maxWidth: 520, gap: T15.sp5xl, fontFamily: T15.font },
|
|
12463
13355
|
children: [
|
|
12464
|
-
/* @__PURE__ */ (0,
|
|
12465
|
-
/* @__PURE__ */ (0,
|
|
13356
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex flex-col", style: { gap: T15.spMd }, children: [
|
|
13357
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
12466
13358
|
"p",
|
|
12467
13359
|
{
|
|
12468
13360
|
style: {
|
|
12469
|
-
color:
|
|
12470
|
-
fontSize:
|
|
13361
|
+
color: T15.primary,
|
|
13362
|
+
fontSize: T15.fsXl,
|
|
12471
13363
|
fontWeight: 600,
|
|
12472
|
-
lineHeight:
|
|
13364
|
+
lineHeight: T15.lhXl,
|
|
12473
13365
|
margin: 0
|
|
12474
13366
|
},
|
|
12475
13367
|
children: "Choose your workspaces"
|
|
12476
13368
|
}
|
|
12477
13369
|
),
|
|
12478
|
-
/* @__PURE__ */ (0,
|
|
13370
|
+
/* @__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
13371
|
] }),
|
|
12480
|
-
(loading || hasWorkspaces) && /* @__PURE__ */ (0,
|
|
13372
|
+
(loading || hasWorkspaces) && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
12481
13373
|
"div",
|
|
12482
13374
|
{
|
|
12483
13375
|
className: "flex flex-col w-full overflow-y-auto",
|
|
12484
13376
|
style: {
|
|
12485
13377
|
maxHeight: 360,
|
|
12486
|
-
background:
|
|
12487
|
-
border: `1px solid ${
|
|
12488
|
-
borderRadius:
|
|
13378
|
+
background: T15.surface,
|
|
13379
|
+
border: `1px solid ${T15.borderSubtle}`,
|
|
13380
|
+
borderRadius: T15.r3xl
|
|
12489
13381
|
},
|
|
12490
|
-
children: loading ? /* @__PURE__ */ (0,
|
|
13382
|
+
children: loading ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
12491
13383
|
"div",
|
|
12492
13384
|
{
|
|
12493
13385
|
className: "flex items-center justify-center",
|
|
12494
|
-
style: { padding:
|
|
13386
|
+
style: { padding: T15.sp6xl, color: T15.muted, fontSize: T15.fsSm },
|
|
12495
13387
|
children: "Loading workspaces\u2026"
|
|
12496
13388
|
}
|
|
12497
13389
|
) : workspaces.map((workspace, index) => {
|
|
12498
13390
|
const checked = selected.has(workspace._id);
|
|
12499
|
-
return /* @__PURE__ */ (0,
|
|
13391
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
12500
13392
|
"div",
|
|
12501
13393
|
{
|
|
12502
13394
|
role: "checkbox",
|
|
@@ -12504,9 +13396,9 @@ function WorkspacePicker({
|
|
|
12504
13396
|
tabIndex: 0,
|
|
12505
13397
|
className: "flex items-center cursor-pointer",
|
|
12506
13398
|
style: {
|
|
12507
|
-
gap:
|
|
12508
|
-
padding: `${
|
|
12509
|
-
borderTop: index ? `1px solid ${
|
|
13399
|
+
gap: T15.spXl,
|
|
13400
|
+
padding: `${T15.spXl} ${T15.sp3xl}`,
|
|
13401
|
+
borderTop: index ? `1px solid ${T15.borderSubtle}` : "none"
|
|
12510
13402
|
},
|
|
12511
13403
|
onClick: () => toggle(workspace._id),
|
|
12512
13404
|
onKeyDown: (e) => {
|
|
@@ -12516,35 +13408,35 @@ function WorkspacePicker({
|
|
|
12516
13408
|
}
|
|
12517
13409
|
},
|
|
12518
13410
|
children: [
|
|
12519
|
-
/* @__PURE__ */ (0,
|
|
12520
|
-
/* @__PURE__ */ (0,
|
|
13411
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_ui17.ScCheckbox, { checked }),
|
|
13412
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
12521
13413
|
ProfileAvatar,
|
|
12522
13414
|
{
|
|
12523
13415
|
name: workspace.name,
|
|
12524
13416
|
profileImage: workspace.imageUrl,
|
|
12525
13417
|
size: 32,
|
|
12526
|
-
borderRadius:
|
|
13418
|
+
borderRadius: T15.rLg
|
|
12527
13419
|
}
|
|
12528
13420
|
),
|
|
12529
|
-
/* @__PURE__ */ (0,
|
|
12530
|
-
/* @__PURE__ */ (0,
|
|
13421
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex flex-col min-w-0", children: [
|
|
13422
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
12531
13423
|
"span",
|
|
12532
13424
|
{
|
|
12533
13425
|
className: "truncate",
|
|
12534
13426
|
style: {
|
|
12535
|
-
color:
|
|
12536
|
-
fontSize:
|
|
13427
|
+
color: T15.primary,
|
|
13428
|
+
fontSize: T15.fsSm,
|
|
12537
13429
|
fontWeight: 500,
|
|
12538
|
-
lineHeight:
|
|
13430
|
+
lineHeight: T15.lhSm
|
|
12539
13431
|
},
|
|
12540
13432
|
children: workspace.name
|
|
12541
13433
|
}
|
|
12542
13434
|
),
|
|
12543
|
-
workspace.ownerName && /* @__PURE__ */ (0,
|
|
13435
|
+
workspace.ownerName && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
12544
13436
|
"span",
|
|
12545
13437
|
{
|
|
12546
13438
|
className: "truncate",
|
|
12547
|
-
style: { color:
|
|
13439
|
+
style: { color: T15.muted, fontSize: T15.fsXs, lineHeight: T15.lhXs },
|
|
12548
13440
|
children: [
|
|
12549
13441
|
"Created by ",
|
|
12550
13442
|
workspace.ownerName
|
|
@@ -12559,16 +13451,16 @@ function WorkspacePicker({
|
|
|
12559
13451
|
})
|
|
12560
13452
|
}
|
|
12561
13453
|
),
|
|
12562
|
-
showCreate ? /* @__PURE__ */ (0,
|
|
12563
|
-
/* @__PURE__ */ (0,
|
|
13454
|
+
showCreate ? /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex flex-col w-full", style: { gap: T15.spMd }, children: [
|
|
13455
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
12564
13456
|
"label",
|
|
12565
13457
|
{
|
|
12566
13458
|
htmlFor: "workspace-picker-name",
|
|
12567
|
-
style: { color:
|
|
13459
|
+
style: { color: T15.tertiary, fontSize: T15.fsSm, lineHeight: T15.lhSm },
|
|
12568
13460
|
children: "New workspace name"
|
|
12569
13461
|
}
|
|
12570
13462
|
),
|
|
12571
|
-
/* @__PURE__ */ (0,
|
|
13463
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
12572
13464
|
"input",
|
|
12573
13465
|
{
|
|
12574
13466
|
id: "workspace-picker-name",
|
|
@@ -12583,20 +13475,20 @@ function WorkspacePicker({
|
|
|
12583
13475
|
placeholder: "e.g. Marketing",
|
|
12584
13476
|
style: {
|
|
12585
13477
|
height: 48,
|
|
12586
|
-
padding: `0 ${
|
|
12587
|
-
background:
|
|
13478
|
+
padding: `0 ${T15.sp3xl}`,
|
|
13479
|
+
background: T15.fillPlus,
|
|
12588
13480
|
border: "none",
|
|
12589
13481
|
outline: "none",
|
|
12590
|
-
borderRadius:
|
|
12591
|
-
color:
|
|
12592
|
-
fontFamily:
|
|
12593
|
-
fontSize:
|
|
13482
|
+
borderRadius: T15.r3xl,
|
|
13483
|
+
color: T15.primary,
|
|
13484
|
+
fontFamily: T15.font,
|
|
13485
|
+
fontSize: T15.fsSm
|
|
12594
13486
|
}
|
|
12595
13487
|
}
|
|
12596
13488
|
),
|
|
12597
|
-
/* @__PURE__ */ (0,
|
|
12598
|
-
hasWorkspaces && /* @__PURE__ */ (0,
|
|
12599
|
-
|
|
13489
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex items-center justify-end w-full", style: { gap: T15.spMd }, children: [
|
|
13490
|
+
hasWorkspaces && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
13491
|
+
import_ui17.ScButton,
|
|
12600
13492
|
{
|
|
12601
13493
|
text: "Back",
|
|
12602
13494
|
variant: "tertiary",
|
|
@@ -12604,8 +13496,8 @@ function WorkspacePicker({
|
|
|
12604
13496
|
onClick: () => setCreating(false)
|
|
12605
13497
|
}
|
|
12606
13498
|
),
|
|
12607
|
-
/* @__PURE__ */ (0,
|
|
12608
|
-
|
|
13499
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
13500
|
+
import_ui17.ScButton,
|
|
12609
13501
|
{
|
|
12610
13502
|
text: busy ? "Creating\u2026" : "Create workspace",
|
|
12611
13503
|
variant: "primary",
|
|
@@ -12615,9 +13507,9 @@ function WorkspacePicker({
|
|
|
12615
13507
|
}
|
|
12616
13508
|
)
|
|
12617
13509
|
] })
|
|
12618
|
-
] }) : /* @__PURE__ */ (0,
|
|
12619
|
-
/* @__PURE__ */ (0,
|
|
12620
|
-
|
|
13510
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex flex-wrap items-center justify-between w-full", style: { gap: T15.spMd }, children: [
|
|
13511
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
13512
|
+
import_ui17.ScButton,
|
|
12621
13513
|
{
|
|
12622
13514
|
text: "Create a workspace",
|
|
12623
13515
|
variant: "tertiary",
|
|
@@ -12626,8 +13518,8 @@ function WorkspacePicker({
|
|
|
12626
13518
|
onClick: loading || busy ? void 0 : () => setCreating(true)
|
|
12627
13519
|
}
|
|
12628
13520
|
),
|
|
12629
|
-
/* @__PURE__ */ (0,
|
|
12630
|
-
|
|
13521
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
13522
|
+
import_ui17.ScButton,
|
|
12631
13523
|
{
|
|
12632
13524
|
text: busy ? "Joining\u2026" : selected.size > 1 ? `Join ${selected.size} workspaces` : "Join workspace",
|
|
12633
13525
|
variant: "primary",
|