@streamoid/settings 0.15.0 → 0.15.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +40 -2
- package/dist/index.d.ts +40 -2
- package/dist/index.js +271 -257
- package/dist/index.mjs +271 -257
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -10611,6 +10611,34 @@ async function loadCurrentPlan(fetchCurrentPlan) {
|
|
|
10611
10611
|
return { subscription, entitlement, paid: hasPaidFeatures({ entitlement, subscription }) };
|
|
10612
10612
|
}
|
|
10613
10613
|
|
|
10614
|
+
// src/billing-layout.ts
|
|
10615
|
+
var BILLING_TABLE_MIN_HEIGHT = 300;
|
|
10616
|
+
var BILLING_TABLE_FRAME_STYLE = {
|
|
10617
|
+
flex: "1 0 auto",
|
|
10618
|
+
minHeight: BILLING_TABLE_MIN_HEIGHT,
|
|
10619
|
+
backgroundColor: "var(--alias-surface-base)",
|
|
10620
|
+
borderRadius: "var(--radius-3xl)",
|
|
10621
|
+
border: "1px solid var(--alias-border-subtle)",
|
|
10622
|
+
overflow: "clip"
|
|
10623
|
+
};
|
|
10624
|
+
var BILLING_TABLE_PAGER_STYLE = {
|
|
10625
|
+
position: "sticky",
|
|
10626
|
+
bottom: 0,
|
|
10627
|
+
zIndex: 2,
|
|
10628
|
+
backgroundColor: "var(--alias-surface-canvas)",
|
|
10629
|
+
paddingTop: "var(--spacing-xl)",
|
|
10630
|
+
paddingBottom: "var(--spacing-md)"
|
|
10631
|
+
};
|
|
10632
|
+
function productsForCountry(products, country) {
|
|
10633
|
+
const currency = country?.trim().toUpperCase() === "IN" ? "inr" : "usd";
|
|
10634
|
+
return products.map((product) => ({
|
|
10635
|
+
...product,
|
|
10636
|
+
prices: product.prices.filter(
|
|
10637
|
+
(price) => price.currency?.toLowerCase() === currency
|
|
10638
|
+
)
|
|
10639
|
+
})).filter((product) => product.prices.length > 0);
|
|
10640
|
+
}
|
|
10641
|
+
|
|
10614
10642
|
// src/usage-logs.ts
|
|
10615
10643
|
var USAGE_LOGS_PAGE_SIZE = 50;
|
|
10616
10644
|
var USAGE_LOGS_EXPORT_BATCH_SIZE = 100;
|
|
@@ -10686,6 +10714,9 @@ function usageLogsReducer(state, action) {
|
|
|
10686
10714
|
return INITIAL_USAGE_LOGS_STATE;
|
|
10687
10715
|
}
|
|
10688
10716
|
}
|
|
10717
|
+
function usageLogsReloadPage(state) {
|
|
10718
|
+
return Math.max(1, Math.floor(state.requestedPage) || 1);
|
|
10719
|
+
}
|
|
10689
10720
|
function usageLogsSpentByOthers(logs, workspaceId) {
|
|
10690
10721
|
return (logs.unpaged ?? logs.rows).some(
|
|
10691
10722
|
(log) => usedByWorkspaceKey(log, workspaceId) !== null
|
|
@@ -11624,63 +11655,51 @@ function InvoiceHistoryTable({
|
|
|
11624
11655
|
}
|
|
11625
11656
|
);
|
|
11626
11657
|
}
|
|
11627
|
-
return /* @__PURE__ */ jsxs26(
|
|
11628
|
-
|
|
11629
|
-
|
|
11630
|
-
|
|
11631
|
-
|
|
11632
|
-
|
|
11633
|
-
|
|
11634
|
-
|
|
11635
|
-
|
|
11636
|
-
|
|
11637
|
-
|
|
11638
|
-
|
|
11639
|
-
|
|
11658
|
+
return /* @__PURE__ */ jsxs26("div", { className: "w-full relative", style: BILLING_TABLE_FRAME_STYLE, children: [
|
|
11659
|
+
/* @__PURE__ */ jsx29(
|
|
11660
|
+
"div",
|
|
11661
|
+
{
|
|
11662
|
+
style: {
|
|
11663
|
+
position: "sticky",
|
|
11664
|
+
top: 0,
|
|
11665
|
+
zIndex: 1,
|
|
11666
|
+
backgroundColor: "var(--alias-surface-base)"
|
|
11667
|
+
},
|
|
11668
|
+
children: /* @__PURE__ */ jsx29(ScBillingHistoryHeader, {})
|
|
11669
|
+
}
|
|
11670
|
+
),
|
|
11671
|
+
invoices.length === 0 && /* @__PURE__ */ jsx29(
|
|
11672
|
+
"div",
|
|
11673
|
+
{
|
|
11674
|
+
className: "flex items-center justify-center w-full",
|
|
11675
|
+
style: { padding: "var(--spacing-6xl)" },
|
|
11676
|
+
children: /* @__PURE__ */ jsx29(
|
|
11677
|
+
"span",
|
|
11640
11678
|
{
|
|
11641
11679
|
style: {
|
|
11642
|
-
|
|
11643
|
-
|
|
11644
|
-
|
|
11645
|
-
|
|
11680
|
+
fontFamily: "var(--font-family-font-family-body)",
|
|
11681
|
+
fontSize: "var(--font-size-font-size-sm)",
|
|
11682
|
+
fontWeight: 400,
|
|
11683
|
+
lineHeight: "var(--line-height-line-height-sm)",
|
|
11684
|
+
color: "var(--alias-text---icons-muted)"
|
|
11646
11685
|
},
|
|
11647
|
-
children:
|
|
11648
|
-
}
|
|
11649
|
-
),
|
|
11650
|
-
invoices.length === 0 && /* @__PURE__ */ jsx29(
|
|
11651
|
-
"div",
|
|
11652
|
-
{
|
|
11653
|
-
className: "flex items-center justify-center w-full",
|
|
11654
|
-
style: { padding: "var(--spacing-6xl)" },
|
|
11655
|
-
children: /* @__PURE__ */ jsx29(
|
|
11656
|
-
"span",
|
|
11657
|
-
{
|
|
11658
|
-
style: {
|
|
11659
|
-
fontFamily: "var(--font-family-font-family-body)",
|
|
11660
|
-
fontSize: "var(--font-size-font-size-sm)",
|
|
11661
|
-
fontWeight: 400,
|
|
11662
|
-
lineHeight: "var(--line-height-line-height-sm)",
|
|
11663
|
-
color: "var(--alias-text---icons-muted)"
|
|
11664
|
-
},
|
|
11665
|
-
children: "No invoices found"
|
|
11666
|
-
}
|
|
11667
|
-
)
|
|
11686
|
+
children: "No invoices found"
|
|
11668
11687
|
}
|
|
11669
|
-
)
|
|
11670
|
-
|
|
11671
|
-
|
|
11672
|
-
|
|
11673
|
-
|
|
11674
|
-
|
|
11675
|
-
|
|
11676
|
-
|
|
11677
|
-
|
|
11678
|
-
|
|
11679
|
-
|
|
11680
|
-
|
|
11681
|
-
|
|
11682
|
-
|
|
11683
|
-
);
|
|
11688
|
+
)
|
|
11689
|
+
}
|
|
11690
|
+
),
|
|
11691
|
+
invoices.map((inv) => /* @__PURE__ */ jsx29(
|
|
11692
|
+
ScBillingHistoryTableList,
|
|
11693
|
+
{
|
|
11694
|
+
invoiceNumber: inv.transactionId ? `# ${inv.transactionId.slice(0, 16).toUpperCase()}` : "# INV-UNKNOWN",
|
|
11695
|
+
amount: inv.amountPaid != null ? `${currencySymbol}${inv.amountPaid.toFixed(2)}` : `${currencySymbol}${(inv.amount / 100).toFixed(2)}`,
|
|
11696
|
+
date: formatDate3(inv.createdAt),
|
|
11697
|
+
downloadLabel: "Download invoice",
|
|
11698
|
+
onClick: (e) => handleRowClick(e, inv)
|
|
11699
|
+
},
|
|
11700
|
+
inv._id
|
|
11701
|
+
))
|
|
11702
|
+
] });
|
|
11684
11703
|
}
|
|
11685
11704
|
function UsageLogsTable({
|
|
11686
11705
|
logs,
|
|
@@ -11762,180 +11781,168 @@ function UsageLogsTable({
|
|
|
11762
11781
|
}
|
|
11763
11782
|
);
|
|
11764
11783
|
}
|
|
11765
|
-
return /* @__PURE__ */ jsxs26(
|
|
11766
|
-
|
|
11767
|
-
|
|
11768
|
-
|
|
11769
|
-
|
|
11770
|
-
|
|
11771
|
-
|
|
11772
|
-
|
|
11773
|
-
|
|
11774
|
-
|
|
11775
|
-
|
|
11776
|
-
|
|
11777
|
-
"
|
|
11784
|
+
return /* @__PURE__ */ jsxs26("div", { className: "w-full relative", style: BILLING_TABLE_FRAME_STYLE, children: [
|
|
11785
|
+
/* @__PURE__ */ jsxs26(
|
|
11786
|
+
"div",
|
|
11787
|
+
{
|
|
11788
|
+
style: {
|
|
11789
|
+
position: "sticky",
|
|
11790
|
+
top: 0,
|
|
11791
|
+
zIndex: 1,
|
|
11792
|
+
background: "var(--alias-fill-neutral-neutral, #1a1a1a)",
|
|
11793
|
+
padding: "var(--spacing-xl, 0.75rem) var(--spacing-3xl, 1rem)",
|
|
11794
|
+
display: "flex",
|
|
11795
|
+
flexDirection: "row",
|
|
11796
|
+
gap: "var(--spacing-6xl, 1.5rem)",
|
|
11797
|
+
alignItems: "center"
|
|
11798
|
+
},
|
|
11799
|
+
children: [
|
|
11800
|
+
/* @__PURE__ */ jsx29(
|
|
11801
|
+
ScHeader,
|
|
11802
|
+
{
|
|
11803
|
+
text: "App",
|
|
11804
|
+
state: "none",
|
|
11805
|
+
style: { flex: 1, alignItems: "flex-start", gap: "0.25rem" }
|
|
11806
|
+
}
|
|
11807
|
+
),
|
|
11808
|
+
/* @__PURE__ */ jsx29(
|
|
11809
|
+
ScHeader,
|
|
11810
|
+
{
|
|
11811
|
+
text: "Activity",
|
|
11812
|
+
state: "none",
|
|
11813
|
+
style: { flex: 1, alignItems: "flex-start", gap: "0.25rem" }
|
|
11814
|
+
}
|
|
11815
|
+
),
|
|
11816
|
+
/* @__PURE__ */ jsx29(
|
|
11817
|
+
ScHeader,
|
|
11818
|
+
{
|
|
11819
|
+
text: "Used by",
|
|
11820
|
+
state: "none",
|
|
11821
|
+
style: { flexShrink: 0, width: "7.5rem" }
|
|
11822
|
+
}
|
|
11823
|
+
),
|
|
11824
|
+
showWorkspace && /* @__PURE__ */ jsx29(
|
|
11825
|
+
ScHeader,
|
|
11826
|
+
{
|
|
11827
|
+
text: "Workspace",
|
|
11828
|
+
state: "none",
|
|
11829
|
+
style: { flexShrink: 0, width: "9rem" }
|
|
11830
|
+
}
|
|
11831
|
+
),
|
|
11832
|
+
/* @__PURE__ */ jsx29(
|
|
11833
|
+
ScHeader,
|
|
11834
|
+
{
|
|
11835
|
+
text: "Date",
|
|
11836
|
+
state: "none",
|
|
11837
|
+
style: { flexShrink: 0, width: "7.5rem" }
|
|
11838
|
+
}
|
|
11839
|
+
),
|
|
11840
|
+
/* @__PURE__ */ jsx29(
|
|
11841
|
+
ScHeader,
|
|
11842
|
+
{
|
|
11843
|
+
text: "Credits",
|
|
11844
|
+
state: "none",
|
|
11845
|
+
style: {
|
|
11846
|
+
flexShrink: 0,
|
|
11847
|
+
width: "5rem",
|
|
11848
|
+
justifyContent: "flex-end"
|
|
11849
|
+
}
|
|
11850
|
+
}
|
|
11851
|
+
)
|
|
11852
|
+
]
|
|
11853
|
+
}
|
|
11854
|
+
),
|
|
11855
|
+
logs.length === 0 && /* @__PURE__ */ jsx29(
|
|
11856
|
+
"div",
|
|
11857
|
+
{
|
|
11858
|
+
className: "flex items-center justify-center w-full",
|
|
11859
|
+
style: { padding: "var(--spacing-6xl)" },
|
|
11860
|
+
children: /* @__PURE__ */ jsx29(
|
|
11861
|
+
"span",
|
|
11778
11862
|
{
|
|
11779
11863
|
style: {
|
|
11780
|
-
|
|
11781
|
-
|
|
11782
|
-
|
|
11783
|
-
|
|
11784
|
-
|
|
11785
|
-
display: "flex",
|
|
11786
|
-
flexDirection: "row",
|
|
11787
|
-
gap: "var(--spacing-6xl, 1.5rem)",
|
|
11788
|
-
alignItems: "center"
|
|
11864
|
+
fontFamily: "var(--font-family-font-family-body)",
|
|
11865
|
+
fontSize: "var(--font-size-font-size-sm)",
|
|
11866
|
+
fontWeight: 400,
|
|
11867
|
+
lineHeight: "var(--line-height-line-height-sm)",
|
|
11868
|
+
color: "var(--alias-text---icons-muted)"
|
|
11789
11869
|
},
|
|
11790
|
-
children:
|
|
11791
|
-
/* @__PURE__ */ jsx29(
|
|
11792
|
-
ScHeader,
|
|
11793
|
-
{
|
|
11794
|
-
text: "App",
|
|
11795
|
-
state: "none",
|
|
11796
|
-
style: { flex: 1, alignItems: "flex-start", gap: "0.25rem" }
|
|
11797
|
-
}
|
|
11798
|
-
),
|
|
11799
|
-
/* @__PURE__ */ jsx29(
|
|
11800
|
-
ScHeader,
|
|
11801
|
-
{
|
|
11802
|
-
text: "Activity",
|
|
11803
|
-
state: "none",
|
|
11804
|
-
style: { flex: 1, alignItems: "flex-start", gap: "0.25rem" }
|
|
11805
|
-
}
|
|
11806
|
-
),
|
|
11807
|
-
/* @__PURE__ */ jsx29(
|
|
11808
|
-
ScHeader,
|
|
11809
|
-
{
|
|
11810
|
-
text: "Used by",
|
|
11811
|
-
state: "none",
|
|
11812
|
-
style: { flexShrink: 0, width: "7.5rem" }
|
|
11813
|
-
}
|
|
11814
|
-
),
|
|
11815
|
-
showWorkspace && /* @__PURE__ */ jsx29(
|
|
11816
|
-
ScHeader,
|
|
11817
|
-
{
|
|
11818
|
-
text: "Workspace",
|
|
11819
|
-
state: "none",
|
|
11820
|
-
style: { flexShrink: 0, width: "9rem" }
|
|
11821
|
-
}
|
|
11822
|
-
),
|
|
11823
|
-
/* @__PURE__ */ jsx29(
|
|
11824
|
-
ScHeader,
|
|
11825
|
-
{
|
|
11826
|
-
text: "Date",
|
|
11827
|
-
state: "none",
|
|
11828
|
-
style: { flexShrink: 0, width: "7.5rem" }
|
|
11829
|
-
}
|
|
11830
|
-
),
|
|
11831
|
-
/* @__PURE__ */ jsx29(
|
|
11832
|
-
ScHeader,
|
|
11833
|
-
{
|
|
11834
|
-
text: "Credits",
|
|
11835
|
-
state: "none",
|
|
11836
|
-
style: {
|
|
11837
|
-
flexShrink: 0,
|
|
11838
|
-
width: "5rem",
|
|
11839
|
-
justifyContent: "flex-end"
|
|
11840
|
-
}
|
|
11841
|
-
}
|
|
11842
|
-
)
|
|
11843
|
-
]
|
|
11870
|
+
children: "No usage logs found"
|
|
11844
11871
|
}
|
|
11845
|
-
)
|
|
11846
|
-
|
|
11847
|
-
|
|
11848
|
-
|
|
11849
|
-
|
|
11850
|
-
|
|
11851
|
-
|
|
11852
|
-
|
|
11872
|
+
)
|
|
11873
|
+
}
|
|
11874
|
+
),
|
|
11875
|
+
logs.map((log) => {
|
|
11876
|
+
const userName = log.triggeredByUserId ? userMap[log.triggeredByUserId] || "Unknown" : "System";
|
|
11877
|
+
const app = log.service?.serviceGroupName || "\u2014";
|
|
11878
|
+
const usedBy = usedByWorkspaceKey(log, currentWorkspaceId);
|
|
11879
|
+
const workspaceLabel2 = usedBy ? `Used by ${usedByNames[usedBy.toLowerCase()] ?? "another workspace"}` : "This workspace";
|
|
11880
|
+
const activity = log.type === "return" ? "Returned Credits" : log.meta?.info || "Credit usage";
|
|
11881
|
+
const isPositive = log.type === "return" || log.type === "add";
|
|
11882
|
+
const signedAmount = `${isPositive ? "+" : "-"}${log.amount}`;
|
|
11883
|
+
const amountColor = isPositive ? "var(--alias-text---icons-success, #1aa055)" : "var(--alias-text---icons-error, #d11a1a)";
|
|
11884
|
+
const rowCellRegular = {
|
|
11885
|
+
color: "var(--alias-text---icons-primary, #f5f5f5)",
|
|
11886
|
+
fontFamily: "var(--font-family-font-family-body)",
|
|
11887
|
+
fontSize: "var(--font-size-font-size-sm, 0.875rem)",
|
|
11888
|
+
fontWeight: 400,
|
|
11889
|
+
lineHeight: "var(--line-height-line-height-sm, 1.25rem)",
|
|
11890
|
+
textOverflow: "ellipsis",
|
|
11891
|
+
overflow: "hidden",
|
|
11892
|
+
whiteSpace: "nowrap"
|
|
11893
|
+
};
|
|
11894
|
+
return /* @__PURE__ */ jsxs26(
|
|
11895
|
+
"div",
|
|
11896
|
+
{
|
|
11897
|
+
style: {
|
|
11898
|
+
borderBottom: "0.0625rem solid var(--alias-border-subtle, #242424)",
|
|
11899
|
+
padding: "8px 16px",
|
|
11900
|
+
display: "flex",
|
|
11901
|
+
flexDirection: "row",
|
|
11902
|
+
gap: "var(--spacing-6xl, 1.5rem)",
|
|
11903
|
+
alignItems: "center"
|
|
11904
|
+
},
|
|
11905
|
+
children: [
|
|
11906
|
+
/* @__PURE__ */ jsx29("div", { style: { ...rowCellRegular, flex: 1 }, children: app }),
|
|
11907
|
+
/* @__PURE__ */ jsx29("div", { style: { ...rowCellRegular, flex: 1 }, children: activity }),
|
|
11908
|
+
/* @__PURE__ */ jsx29("div", { style: { ...rowCellRegular, width: "7.5rem" }, children: userName }),
|
|
11909
|
+
showWorkspace && /* @__PURE__ */ jsx29(
|
|
11910
|
+
"div",
|
|
11853
11911
|
{
|
|
11854
11912
|
style: {
|
|
11913
|
+
...rowCellRegular,
|
|
11914
|
+
width: "9rem",
|
|
11915
|
+
color: usedBy ? "var(--alias-text---icons-primary, #f5f5f5)" : "var(--alias-text---icons-muted)"
|
|
11916
|
+
},
|
|
11917
|
+
title: workspaceLabel2,
|
|
11918
|
+
children: workspaceLabel2
|
|
11919
|
+
}
|
|
11920
|
+
),
|
|
11921
|
+
/* @__PURE__ */ jsx29("div", { style: { ...rowCellRegular, width: "7.5rem" }, children: formatDate3(log.createdAt) }),
|
|
11922
|
+
/* @__PURE__ */ jsx29(
|
|
11923
|
+
"div",
|
|
11924
|
+
{
|
|
11925
|
+
style: {
|
|
11926
|
+
width: "5rem",
|
|
11927
|
+
color: amountColor,
|
|
11855
11928
|
fontFamily: "var(--font-family-font-family-body)",
|
|
11856
|
-
fontSize: "var(--font-size-font-size-
|
|
11857
|
-
fontWeight:
|
|
11858
|
-
lineHeight: "var(--line-height-line-height-
|
|
11859
|
-
|
|
11929
|
+
fontSize: "var(--font-size-font-size-md, 1rem)",
|
|
11930
|
+
fontWeight: 600,
|
|
11931
|
+
lineHeight: "var(--line-height-line-height-md, 1.5rem)",
|
|
11932
|
+
textAlign: "right",
|
|
11933
|
+
textOverflow: "ellipsis",
|
|
11934
|
+
overflow: "hidden",
|
|
11935
|
+
whiteSpace: "nowrap"
|
|
11860
11936
|
},
|
|
11861
|
-
children:
|
|
11937
|
+
children: signedAmount
|
|
11862
11938
|
}
|
|
11863
11939
|
)
|
|
11864
|
-
|
|
11865
|
-
|
|
11866
|
-
|
|
11867
|
-
|
|
11868
|
-
|
|
11869
|
-
|
|
11870
|
-
const workspaceLabel2 = usedBy ? `Used by ${usedByNames[usedBy.toLowerCase()] ?? "another workspace"}` : "This workspace";
|
|
11871
|
-
const activity = log.type === "return" ? "Returned Credits" : log.meta?.info || "Credit usage";
|
|
11872
|
-
const isPositive = log.type === "return" || log.type === "add";
|
|
11873
|
-
const signedAmount = `${isPositive ? "+" : "-"}${log.amount}`;
|
|
11874
|
-
const amountColor = isPositive ? "var(--alias-text---icons-success, #1aa055)" : "var(--alias-text---icons-error, #d11a1a)";
|
|
11875
|
-
const rowCellRegular = {
|
|
11876
|
-
color: "var(--alias-text---icons-primary, #f5f5f5)",
|
|
11877
|
-
fontFamily: "var(--font-family-font-family-body)",
|
|
11878
|
-
fontSize: "var(--font-size-font-size-sm, 0.875rem)",
|
|
11879
|
-
fontWeight: 400,
|
|
11880
|
-
lineHeight: "var(--line-height-line-height-sm, 1.25rem)",
|
|
11881
|
-
textOverflow: "ellipsis",
|
|
11882
|
-
overflow: "hidden",
|
|
11883
|
-
whiteSpace: "nowrap"
|
|
11884
|
-
};
|
|
11885
|
-
return /* @__PURE__ */ jsxs26(
|
|
11886
|
-
"div",
|
|
11887
|
-
{
|
|
11888
|
-
style: {
|
|
11889
|
-
borderBottom: "0.0625rem solid var(--alias-border-subtle, #242424)",
|
|
11890
|
-
padding: "8px 16px",
|
|
11891
|
-
display: "flex",
|
|
11892
|
-
flexDirection: "row",
|
|
11893
|
-
gap: "var(--spacing-6xl, 1.5rem)",
|
|
11894
|
-
alignItems: "center"
|
|
11895
|
-
},
|
|
11896
|
-
children: [
|
|
11897
|
-
/* @__PURE__ */ jsx29("div", { style: { ...rowCellRegular, flex: 1 }, children: app }),
|
|
11898
|
-
/* @__PURE__ */ jsx29("div", { style: { ...rowCellRegular, flex: 1 }, children: activity }),
|
|
11899
|
-
/* @__PURE__ */ jsx29("div", { style: { ...rowCellRegular, width: "7.5rem" }, children: userName }),
|
|
11900
|
-
showWorkspace && /* @__PURE__ */ jsx29(
|
|
11901
|
-
"div",
|
|
11902
|
-
{
|
|
11903
|
-
style: {
|
|
11904
|
-
...rowCellRegular,
|
|
11905
|
-
width: "9rem",
|
|
11906
|
-
color: usedBy ? "var(--alias-text---icons-primary, #f5f5f5)" : "var(--alias-text---icons-muted)"
|
|
11907
|
-
},
|
|
11908
|
-
title: workspaceLabel2,
|
|
11909
|
-
children: workspaceLabel2
|
|
11910
|
-
}
|
|
11911
|
-
),
|
|
11912
|
-
/* @__PURE__ */ jsx29("div", { style: { ...rowCellRegular, width: "7.5rem" }, children: formatDate3(log.createdAt) }),
|
|
11913
|
-
/* @__PURE__ */ jsx29(
|
|
11914
|
-
"div",
|
|
11915
|
-
{
|
|
11916
|
-
style: {
|
|
11917
|
-
width: "5rem",
|
|
11918
|
-
color: amountColor,
|
|
11919
|
-
fontFamily: "var(--font-family-font-family-body)",
|
|
11920
|
-
fontSize: "var(--font-size-font-size-md, 1rem)",
|
|
11921
|
-
fontWeight: 600,
|
|
11922
|
-
lineHeight: "var(--line-height-line-height-md, 1.5rem)",
|
|
11923
|
-
textAlign: "right",
|
|
11924
|
-
textOverflow: "ellipsis",
|
|
11925
|
-
overflow: "hidden",
|
|
11926
|
-
whiteSpace: "nowrap"
|
|
11927
|
-
},
|
|
11928
|
-
children: signedAmount
|
|
11929
|
-
}
|
|
11930
|
-
)
|
|
11931
|
-
]
|
|
11932
|
-
},
|
|
11933
|
-
log._id
|
|
11934
|
-
);
|
|
11935
|
-
})
|
|
11936
|
-
]
|
|
11937
|
-
}
|
|
11938
|
-
);
|
|
11940
|
+
]
|
|
11941
|
+
},
|
|
11942
|
+
log._id
|
|
11943
|
+
);
|
|
11944
|
+
})
|
|
11945
|
+
] });
|
|
11939
11946
|
}
|
|
11940
11947
|
function UsageLogsPager({
|
|
11941
11948
|
page,
|
|
@@ -11951,7 +11958,7 @@ function UsageLogsPager({
|
|
|
11951
11958
|
"div",
|
|
11952
11959
|
{
|
|
11953
11960
|
className: "flex items-center justify-between shrink-0 w-full",
|
|
11954
|
-
style: { gap: "var(--spacing-md)" },
|
|
11961
|
+
style: { ...BILLING_TABLE_PAGER_STYLE, gap: "var(--spacing-md)" },
|
|
11955
11962
|
children: [
|
|
11956
11963
|
/* @__PURE__ */ jsxs26(
|
|
11957
11964
|
"span",
|
|
@@ -12092,7 +12099,12 @@ function BillingContent({
|
|
|
12092
12099
|
const [availableCredits, setAvailableCredits] = useState21(null);
|
|
12093
12100
|
const [sharedPool, setSharedPool] = useState21(null);
|
|
12094
12101
|
const [usedByNames, setUsedByNames] = useState21({});
|
|
12095
|
-
const [
|
|
12102
|
+
const [allProducts, setProducts] = useState21([]);
|
|
12103
|
+
const workspaceCountry = workspace.current?.country;
|
|
12104
|
+
const products = useMemo4(
|
|
12105
|
+
() => productsForCountry(allProducts, workspaceCountry),
|
|
12106
|
+
[allProducts, workspaceCountry]
|
|
12107
|
+
);
|
|
12096
12108
|
const [invoices, setInvoices] = useState21([]);
|
|
12097
12109
|
const [totalCredits, setTotalCredits] = useState21(null);
|
|
12098
12110
|
const [usageLogsState, dispatchUsageLogs] = useReducer(
|
|
@@ -12105,6 +12117,8 @@ function BillingContent({
|
|
|
12105
12117
|
error: usageLogsError
|
|
12106
12118
|
} = usageLogsState;
|
|
12107
12119
|
const usageLogsRequestRef = useRef10(0);
|
|
12120
|
+
const usageLogsStateRef = useRef10(usageLogsState);
|
|
12121
|
+
usageLogsStateRef.current = usageLogsState;
|
|
12108
12122
|
const workspaceIdRef = useRef10(workspaceId);
|
|
12109
12123
|
workspaceIdRef.current = workspaceId;
|
|
12110
12124
|
const loadUsedByNamesRef = useRef10(null);
|
|
@@ -12163,17 +12177,7 @@ function BillingContent({
|
|
|
12163
12177
|
if (creditsRes?.availableCredits != null)
|
|
12164
12178
|
setAvailableCredits(creditsRes.availableCredits);
|
|
12165
12179
|
setSharedPool(creditsRes?.sharedPool ?? null);
|
|
12166
|
-
if (productsRes?.data)
|
|
12167
|
-
const normalizedWorkspaceCountry = workspace.current?.country?.trim().toUpperCase();
|
|
12168
|
-
const targetCurrency = normalizedWorkspaceCountry === "IN" ? "inr" : "usd";
|
|
12169
|
-
const filteredProducts = productsRes.data.map((product) => ({
|
|
12170
|
-
...product,
|
|
12171
|
-
prices: product.prices.filter(
|
|
12172
|
-
(price) => price.currency?.toLowerCase() === targetCurrency
|
|
12173
|
-
)
|
|
12174
|
-
})).filter((product) => product.prices.length > 0);
|
|
12175
|
-
setProducts(filteredProducts);
|
|
12176
|
-
}
|
|
12180
|
+
if (productsRes?.data) setProducts(productsRes.data);
|
|
12177
12181
|
if (customRes?.data?.credits != null) {
|
|
12178
12182
|
setCustomPlanCredits(customRes.data.credits);
|
|
12179
12183
|
}
|
|
@@ -12182,7 +12186,7 @@ function BillingContent({
|
|
|
12182
12186
|
setLoadingBilling(false);
|
|
12183
12187
|
setBillingOverviewLoaded(true);
|
|
12184
12188
|
}
|
|
12185
|
-
}, [api
|
|
12189
|
+
}, [api]);
|
|
12186
12190
|
const fetchUserMap = useCallback8(async () => {
|
|
12187
12191
|
try {
|
|
12188
12192
|
const members = await api.fetchMembers();
|
|
@@ -12255,7 +12259,7 @@ function BillingContent({
|
|
|
12255
12259
|
const fetchTableData = useCallback8(
|
|
12256
12260
|
async (tab) => {
|
|
12257
12261
|
if (tab === "usage") {
|
|
12258
|
-
await loadUsageLogsPage(
|
|
12262
|
+
await loadUsageLogsPage(usageLogsReloadPage(usageLogsStateRef.current));
|
|
12259
12263
|
return;
|
|
12260
12264
|
}
|
|
12261
12265
|
setLoadingTable(true);
|
|
@@ -12385,6 +12389,7 @@ function BillingContent({
|
|
|
12385
12389
|
setCustomPlanCredits(null);
|
|
12386
12390
|
usageLogsRequestRef.current++;
|
|
12387
12391
|
dispatchUsageLogs({ type: "reset" });
|
|
12392
|
+
usageLogsStateRef.current = INITIAL_USAGE_LOGS_STATE;
|
|
12388
12393
|
loadUsedByNamesRef.current?.reset();
|
|
12389
12394
|
setUsedByNames({});
|
|
12390
12395
|
}, [workspaceId]);
|
|
@@ -13019,30 +13024,34 @@ function BillingContent({
|
|
|
13019
13024
|
loading: loadingTable,
|
|
13020
13025
|
workspaceCountry: workspace.current?.country
|
|
13021
13026
|
}
|
|
13022
|
-
) :
|
|
13023
|
-
|
|
13024
|
-
|
|
13025
|
-
|
|
13026
|
-
|
|
13027
|
-
|
|
13028
|
-
|
|
13029
|
-
|
|
13030
|
-
|
|
13031
|
-
|
|
13032
|
-
|
|
13033
|
-
|
|
13034
|
-
|
|
13035
|
-
|
|
13036
|
-
|
|
13037
|
-
|
|
13038
|
-
|
|
13039
|
-
|
|
13040
|
-
|
|
13041
|
-
|
|
13042
|
-
|
|
13043
|
-
|
|
13044
|
-
|
|
13045
|
-
|
|
13027
|
+
) : (
|
|
13028
|
+
// Table and pager only, so the sticky pager stops at the table's top
|
|
13029
|
+
// and never floats over the cards above it.
|
|
13030
|
+
/* @__PURE__ */ jsxs26("div", { className: "flex flex-col w-full", style: { flex: "1 0 auto" }, children: [
|
|
13031
|
+
/* @__PURE__ */ jsx29(
|
|
13032
|
+
UsageLogsTable,
|
|
13033
|
+
{
|
|
13034
|
+
logs: usageLogs.rows,
|
|
13035
|
+
userMap,
|
|
13036
|
+
loading: loadingUsageLogs,
|
|
13037
|
+
error: usageLogsError,
|
|
13038
|
+
onRetry: () => void loadUsageLogsPage(usageLogsState.requestedPage),
|
|
13039
|
+
currentWorkspaceId: workspaceId,
|
|
13040
|
+
usedByNames
|
|
13041
|
+
}
|
|
13042
|
+
),
|
|
13043
|
+
!usageLogsError && /* @__PURE__ */ jsx29(
|
|
13044
|
+
UsageLogsPager,
|
|
13045
|
+
{
|
|
13046
|
+
page: usageLogs.page,
|
|
13047
|
+
totalPages: usageLogs.totalPages,
|
|
13048
|
+
total: usageLogs.total,
|
|
13049
|
+
loading: loadingUsageLogs,
|
|
13050
|
+
onPageChange: goToUsageLogsPage
|
|
13051
|
+
}
|
|
13052
|
+
)
|
|
13053
|
+
] })
|
|
13054
|
+
),
|
|
13046
13055
|
showExportModal && /* @__PURE__ */ jsx29(
|
|
13047
13056
|
ExportDateModal,
|
|
13048
13057
|
{
|
|
@@ -13073,7 +13082,7 @@ function BillingContent({
|
|
|
13073
13082
|
"div",
|
|
13074
13083
|
{
|
|
13075
13084
|
className: "flex flex-col flex-1 min-w-0 min-h-0 w-full",
|
|
13076
|
-
style: { gap: 12 },
|
|
13085
|
+
style: { gap: 12, overflowY: "auto" },
|
|
13077
13086
|
children: billingInnerContent
|
|
13078
13087
|
}
|
|
13079
13088
|
);
|
|
@@ -17414,6 +17423,9 @@ export {
|
|
|
17414
17423
|
AppSettingsPage,
|
|
17415
17424
|
AppSettingsRow,
|
|
17416
17425
|
AppSettingsSection,
|
|
17426
|
+
BILLING_TABLE_FRAME_STYLE,
|
|
17427
|
+
BILLING_TABLE_MIN_HEIGHT,
|
|
17428
|
+
BILLING_TABLE_PAGER_STYLE,
|
|
17417
17429
|
BillingContent,
|
|
17418
17430
|
BuyCreditsModal,
|
|
17419
17431
|
ConfirmDeleteModal,
|
|
@@ -17512,6 +17524,7 @@ export {
|
|
|
17512
17524
|
poolErrorMessage,
|
|
17513
17525
|
poolRenewsAtCycleEnd,
|
|
17514
17526
|
poolWorkspaceName,
|
|
17527
|
+
productsForCountry,
|
|
17515
17528
|
readSettingsCaller,
|
|
17516
17529
|
rememberSettingsCaller,
|
|
17517
17530
|
resolveSettingsTabFromPath,
|
|
@@ -17528,6 +17541,7 @@ export {
|
|
|
17528
17541
|
usageLogsExportFileName,
|
|
17529
17542
|
usageLogsPage,
|
|
17530
17543
|
usageLogsReducer,
|
|
17544
|
+
usageLogsReloadPage,
|
|
17531
17545
|
usageLogsSpentByOthers,
|
|
17532
17546
|
useBillingEntitlement,
|
|
17533
17547
|
useSettingsAdapters,
|