@streamoid/settings 0.15.1 → 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.js CHANGED
@@ -26,6 +26,9 @@ __export(index_exports, {
26
26
  AppSettingsPage: () => AppSettingsPage,
27
27
  AppSettingsRow: () => AppSettingsRow,
28
28
  AppSettingsSection: () => AppSettingsSection,
29
+ BILLING_TABLE_FRAME_STYLE: () => BILLING_TABLE_FRAME_STYLE,
30
+ BILLING_TABLE_MIN_HEIGHT: () => BILLING_TABLE_MIN_HEIGHT,
31
+ BILLING_TABLE_PAGER_STYLE: () => BILLING_TABLE_PAGER_STYLE,
29
32
  BillingContent: () => BillingContent,
30
33
  BuyCreditsModal: () => BuyCreditsModal,
31
34
  ConfirmDeleteModal: () => ConfirmDeleteModal,
@@ -124,6 +127,7 @@ __export(index_exports, {
124
127
  poolErrorMessage: () => poolErrorMessage,
125
128
  poolRenewsAtCycleEnd: () => poolRenewsAtCycleEnd,
126
129
  poolWorkspaceName: () => poolWorkspaceName,
130
+ productsForCountry: () => productsForCountry,
127
131
  readSettingsCaller: () => readSettingsCaller,
128
132
  rememberSettingsCaller: () => rememberSettingsCaller,
129
133
  resolveSettingsTabFromPath: () => resolveSettingsTabFromPath,
@@ -10699,6 +10703,34 @@ async function loadCurrentPlan(fetchCurrentPlan) {
10699
10703
  return { subscription, entitlement, paid: hasPaidFeatures({ entitlement, subscription }) };
10700
10704
  }
10701
10705
 
10706
+ // src/billing-layout.ts
10707
+ var BILLING_TABLE_MIN_HEIGHT = 300;
10708
+ var BILLING_TABLE_FRAME_STYLE = {
10709
+ flex: "1 0 auto",
10710
+ minHeight: BILLING_TABLE_MIN_HEIGHT,
10711
+ backgroundColor: "var(--alias-surface-base)",
10712
+ borderRadius: "var(--radius-3xl)",
10713
+ border: "1px solid var(--alias-border-subtle)",
10714
+ overflow: "clip"
10715
+ };
10716
+ var BILLING_TABLE_PAGER_STYLE = {
10717
+ position: "sticky",
10718
+ bottom: 0,
10719
+ zIndex: 2,
10720
+ backgroundColor: "var(--alias-surface-canvas)",
10721
+ paddingTop: "var(--spacing-xl)",
10722
+ paddingBottom: "var(--spacing-md)"
10723
+ };
10724
+ function productsForCountry(products, country) {
10725
+ const currency = country?.trim().toUpperCase() === "IN" ? "inr" : "usd";
10726
+ return products.map((product) => ({
10727
+ ...product,
10728
+ prices: product.prices.filter(
10729
+ (price) => price.currency?.toLowerCase() === currency
10730
+ )
10731
+ })).filter((product) => product.prices.length > 0);
10732
+ }
10733
+
10702
10734
  // src/usage-logs.ts
10703
10735
  var USAGE_LOGS_PAGE_SIZE = 50;
10704
10736
  var USAGE_LOGS_EXPORT_BATCH_SIZE = 100;
@@ -11642,7 +11674,6 @@ function BillingTabBar({
11642
11674
  }
11643
11675
  );
11644
11676
  }
11645
- var BILLING_TABLE_MIN_HEIGHT = 300;
11646
11677
  function InvoiceHistoryTable({
11647
11678
  invoices,
11648
11679
  loading,
@@ -11716,64 +11747,51 @@ function InvoiceHistoryTable({
11716
11747
  }
11717
11748
  );
11718
11749
  }
11719
- return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
11720
- "div",
11721
- {
11722
- className: "flex-1 min-h-0 w-full relative",
11723
- style: {
11724
- minHeight: BILLING_TABLE_MIN_HEIGHT,
11725
- backgroundColor: "var(--alias-surface-base)",
11726
- borderRadius: "var(--radius-3xl)",
11727
- border: "1px solid var(--alias-border-subtle)",
11728
- overflowY: "auto"
11729
- },
11730
- children: [
11731
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
11732
- "div",
11750
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "w-full relative", style: BILLING_TABLE_FRAME_STYLE, children: [
11751
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
11752
+ "div",
11753
+ {
11754
+ style: {
11755
+ position: "sticky",
11756
+ top: 0,
11757
+ zIndex: 1,
11758
+ backgroundColor: "var(--alias-surface-base)"
11759
+ },
11760
+ children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_ui17.ScBillingHistoryHeader, {})
11761
+ }
11762
+ ),
11763
+ invoices.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
11764
+ "div",
11765
+ {
11766
+ className: "flex items-center justify-center w-full",
11767
+ style: { padding: "var(--spacing-6xl)" },
11768
+ children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
11769
+ "span",
11733
11770
  {
11734
11771
  style: {
11735
- position: "sticky",
11736
- top: 0,
11737
- zIndex: 1,
11738
- backgroundColor: "var(--alias-surface-base)"
11772
+ fontFamily: "var(--font-family-font-family-body)",
11773
+ fontSize: "var(--font-size-font-size-sm)",
11774
+ fontWeight: 400,
11775
+ lineHeight: "var(--line-height-line-height-sm)",
11776
+ color: "var(--alias-text---icons-muted)"
11739
11777
  },
11740
- children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_ui17.ScBillingHistoryHeader, {})
11741
- }
11742
- ),
11743
- invoices.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
11744
- "div",
11745
- {
11746
- className: "flex items-center justify-center w-full",
11747
- style: { padding: "var(--spacing-6xl)" },
11748
- children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
11749
- "span",
11750
- {
11751
- style: {
11752
- fontFamily: "var(--font-family-font-family-body)",
11753
- fontSize: "var(--font-size-font-size-sm)",
11754
- fontWeight: 400,
11755
- lineHeight: "var(--line-height-line-height-sm)",
11756
- color: "var(--alias-text---icons-muted)"
11757
- },
11758
- children: "No invoices found"
11759
- }
11760
- )
11778
+ children: "No invoices found"
11761
11779
  }
11762
- ),
11763
- invoices.map((inv) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
11764
- import_ui17.ScBillingHistoryTableList,
11765
- {
11766
- invoiceNumber: inv.transactionId ? `# ${inv.transactionId.slice(0, 16).toUpperCase()}` : "# INV-UNKNOWN",
11767
- amount: inv.amountPaid != null ? `${currencySymbol}${inv.amountPaid.toFixed(2)}` : `${currencySymbol}${(inv.amount / 100).toFixed(2)}`,
11768
- date: formatDate3(inv.createdAt),
11769
- downloadLabel: "Download invoice",
11770
- onClick: (e) => handleRowClick(e, inv)
11771
- },
11772
- inv._id
11773
- ))
11774
- ]
11775
- }
11776
- );
11780
+ )
11781
+ }
11782
+ ),
11783
+ invoices.map((inv) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
11784
+ import_ui17.ScBillingHistoryTableList,
11785
+ {
11786
+ invoiceNumber: inv.transactionId ? `# ${inv.transactionId.slice(0, 16).toUpperCase()}` : "# INV-UNKNOWN",
11787
+ amount: inv.amountPaid != null ? `${currencySymbol}${inv.amountPaid.toFixed(2)}` : `${currencySymbol}${(inv.amount / 100).toFixed(2)}`,
11788
+ date: formatDate3(inv.createdAt),
11789
+ downloadLabel: "Download invoice",
11790
+ onClick: (e) => handleRowClick(e, inv)
11791
+ },
11792
+ inv._id
11793
+ ))
11794
+ ] });
11777
11795
  }
11778
11796
  function UsageLogsTable({
11779
11797
  logs,
@@ -11855,181 +11873,168 @@ function UsageLogsTable({
11855
11873
  }
11856
11874
  );
11857
11875
  }
11858
- return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
11859
- "div",
11860
- {
11861
- className: "flex-1 min-h-0 w-full relative",
11862
- style: {
11863
- minHeight: BILLING_TABLE_MIN_HEIGHT,
11864
- backgroundColor: "var(--alias-surface-base)",
11865
- borderRadius: "var(--radius-3xl)",
11866
- border: "1px solid var(--alias-border-subtle)",
11867
- overflowY: "auto"
11868
- },
11869
- children: [
11870
- /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
11871
- "div",
11876
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "w-full relative", style: BILLING_TABLE_FRAME_STYLE, children: [
11877
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
11878
+ "div",
11879
+ {
11880
+ style: {
11881
+ position: "sticky",
11882
+ top: 0,
11883
+ zIndex: 1,
11884
+ background: "var(--alias-fill-neutral-neutral, #1a1a1a)",
11885
+ padding: "var(--spacing-xl, 0.75rem) var(--spacing-3xl, 1rem)",
11886
+ display: "flex",
11887
+ flexDirection: "row",
11888
+ gap: "var(--spacing-6xl, 1.5rem)",
11889
+ alignItems: "center"
11890
+ },
11891
+ children: [
11892
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
11893
+ import_ui17.ScHeader,
11894
+ {
11895
+ text: "App",
11896
+ state: "none",
11897
+ style: { flex: 1, alignItems: "flex-start", gap: "0.25rem" }
11898
+ }
11899
+ ),
11900
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
11901
+ import_ui17.ScHeader,
11902
+ {
11903
+ text: "Activity",
11904
+ state: "none",
11905
+ style: { flex: 1, alignItems: "flex-start", gap: "0.25rem" }
11906
+ }
11907
+ ),
11908
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
11909
+ import_ui17.ScHeader,
11910
+ {
11911
+ text: "Used by",
11912
+ state: "none",
11913
+ style: { flexShrink: 0, width: "7.5rem" }
11914
+ }
11915
+ ),
11916
+ showWorkspace && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
11917
+ import_ui17.ScHeader,
11918
+ {
11919
+ text: "Workspace",
11920
+ state: "none",
11921
+ style: { flexShrink: 0, width: "9rem" }
11922
+ }
11923
+ ),
11924
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
11925
+ import_ui17.ScHeader,
11926
+ {
11927
+ text: "Date",
11928
+ state: "none",
11929
+ style: { flexShrink: 0, width: "7.5rem" }
11930
+ }
11931
+ ),
11932
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
11933
+ import_ui17.ScHeader,
11934
+ {
11935
+ text: "Credits",
11936
+ state: "none",
11937
+ style: {
11938
+ flexShrink: 0,
11939
+ width: "5rem",
11940
+ justifyContent: "flex-end"
11941
+ }
11942
+ }
11943
+ )
11944
+ ]
11945
+ }
11946
+ ),
11947
+ logs.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
11948
+ "div",
11949
+ {
11950
+ className: "flex items-center justify-center w-full",
11951
+ style: { padding: "var(--spacing-6xl)" },
11952
+ children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
11953
+ "span",
11872
11954
  {
11873
11955
  style: {
11874
- position: "sticky",
11875
- top: 0,
11876
- zIndex: 1,
11877
- background: "var(--alias-fill-neutral-neutral, #1a1a1a)",
11878
- padding: "var(--spacing-xl, 0.75rem) var(--spacing-3xl, 1rem)",
11879
- display: "flex",
11880
- flexDirection: "row",
11881
- gap: "var(--spacing-6xl, 1.5rem)",
11882
- alignItems: "center"
11956
+ fontFamily: "var(--font-family-font-family-body)",
11957
+ fontSize: "var(--font-size-font-size-sm)",
11958
+ fontWeight: 400,
11959
+ lineHeight: "var(--line-height-line-height-sm)",
11960
+ color: "var(--alias-text---icons-muted)"
11883
11961
  },
11884
- children: [
11885
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
11886
- import_ui17.ScHeader,
11887
- {
11888
- text: "App",
11889
- state: "none",
11890
- style: { flex: 1, alignItems: "flex-start", gap: "0.25rem" }
11891
- }
11892
- ),
11893
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
11894
- import_ui17.ScHeader,
11895
- {
11896
- text: "Activity",
11897
- state: "none",
11898
- style: { flex: 1, alignItems: "flex-start", gap: "0.25rem" }
11899
- }
11900
- ),
11901
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
11902
- import_ui17.ScHeader,
11903
- {
11904
- text: "Used by",
11905
- state: "none",
11906
- style: { flexShrink: 0, width: "7.5rem" }
11907
- }
11908
- ),
11909
- showWorkspace && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
11910
- import_ui17.ScHeader,
11911
- {
11912
- text: "Workspace",
11913
- state: "none",
11914
- style: { flexShrink: 0, width: "9rem" }
11915
- }
11916
- ),
11917
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
11918
- import_ui17.ScHeader,
11919
- {
11920
- text: "Date",
11921
- state: "none",
11922
- style: { flexShrink: 0, width: "7.5rem" }
11923
- }
11924
- ),
11925
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
11926
- import_ui17.ScHeader,
11927
- {
11928
- text: "Credits",
11929
- state: "none",
11930
- style: {
11931
- flexShrink: 0,
11932
- width: "5rem",
11933
- justifyContent: "flex-end"
11934
- }
11935
- }
11936
- )
11937
- ]
11962
+ children: "No usage logs found"
11938
11963
  }
11939
- ),
11940
- logs.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
11941
- "div",
11942
- {
11943
- className: "flex items-center justify-center w-full",
11944
- style: { padding: "var(--spacing-6xl)" },
11945
- children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
11946
- "span",
11964
+ )
11965
+ }
11966
+ ),
11967
+ logs.map((log) => {
11968
+ const userName = log.triggeredByUserId ? userMap[log.triggeredByUserId] || "Unknown" : "System";
11969
+ const app = log.service?.serviceGroupName || "\u2014";
11970
+ const usedBy = usedByWorkspaceKey(log, currentWorkspaceId);
11971
+ const workspaceLabel2 = usedBy ? `Used by ${usedByNames[usedBy.toLowerCase()] ?? "another workspace"}` : "This workspace";
11972
+ const activity = log.type === "return" ? "Returned Credits" : log.meta?.info || "Credit usage";
11973
+ const isPositive = log.type === "return" || log.type === "add";
11974
+ const signedAmount = `${isPositive ? "+" : "-"}${log.amount}`;
11975
+ const amountColor = isPositive ? "var(--alias-text---icons-success, #1aa055)" : "var(--alias-text---icons-error, #d11a1a)";
11976
+ const rowCellRegular = {
11977
+ color: "var(--alias-text---icons-primary, #f5f5f5)",
11978
+ fontFamily: "var(--font-family-font-family-body)",
11979
+ fontSize: "var(--font-size-font-size-sm, 0.875rem)",
11980
+ fontWeight: 400,
11981
+ lineHeight: "var(--line-height-line-height-sm, 1.25rem)",
11982
+ textOverflow: "ellipsis",
11983
+ overflow: "hidden",
11984
+ whiteSpace: "nowrap"
11985
+ };
11986
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
11987
+ "div",
11988
+ {
11989
+ style: {
11990
+ borderBottom: "0.0625rem solid var(--alias-border-subtle, #242424)",
11991
+ padding: "8px 16px",
11992
+ display: "flex",
11993
+ flexDirection: "row",
11994
+ gap: "var(--spacing-6xl, 1.5rem)",
11995
+ alignItems: "center"
11996
+ },
11997
+ children: [
11998
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { style: { ...rowCellRegular, flex: 1 }, children: app }),
11999
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { style: { ...rowCellRegular, flex: 1 }, children: activity }),
12000
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { style: { ...rowCellRegular, width: "7.5rem" }, children: userName }),
12001
+ showWorkspace && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
12002
+ "div",
11947
12003
  {
11948
12004
  style: {
12005
+ ...rowCellRegular,
12006
+ width: "9rem",
12007
+ color: usedBy ? "var(--alias-text---icons-primary, #f5f5f5)" : "var(--alias-text---icons-muted)"
12008
+ },
12009
+ title: workspaceLabel2,
12010
+ children: workspaceLabel2
12011
+ }
12012
+ ),
12013
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { style: { ...rowCellRegular, width: "7.5rem" }, children: formatDate3(log.createdAt) }),
12014
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
12015
+ "div",
12016
+ {
12017
+ style: {
12018
+ width: "5rem",
12019
+ color: amountColor,
11949
12020
  fontFamily: "var(--font-family-font-family-body)",
11950
- fontSize: "var(--font-size-font-size-sm)",
11951
- fontWeight: 400,
11952
- lineHeight: "var(--line-height-line-height-sm)",
11953
- color: "var(--alias-text---icons-muted)"
12021
+ fontSize: "var(--font-size-font-size-md, 1rem)",
12022
+ fontWeight: 600,
12023
+ lineHeight: "var(--line-height-line-height-md, 1.5rem)",
12024
+ textAlign: "right",
12025
+ textOverflow: "ellipsis",
12026
+ overflow: "hidden",
12027
+ whiteSpace: "nowrap"
11954
12028
  },
11955
- children: "No usage logs found"
12029
+ children: signedAmount
11956
12030
  }
11957
12031
  )
11958
- }
11959
- ),
11960
- logs.map((log) => {
11961
- const userName = log.triggeredByUserId ? userMap[log.triggeredByUserId] || "Unknown" : "System";
11962
- const app = log.service?.serviceGroupName || "\u2014";
11963
- const usedBy = usedByWorkspaceKey(log, currentWorkspaceId);
11964
- const workspaceLabel2 = usedBy ? `Used by ${usedByNames[usedBy.toLowerCase()] ?? "another workspace"}` : "This workspace";
11965
- const activity = log.type === "return" ? "Returned Credits" : log.meta?.info || "Credit usage";
11966
- const isPositive = log.type === "return" || log.type === "add";
11967
- const signedAmount = `${isPositive ? "+" : "-"}${log.amount}`;
11968
- const amountColor = isPositive ? "var(--alias-text---icons-success, #1aa055)" : "var(--alias-text---icons-error, #d11a1a)";
11969
- const rowCellRegular = {
11970
- color: "var(--alias-text---icons-primary, #f5f5f5)",
11971
- fontFamily: "var(--font-family-font-family-body)",
11972
- fontSize: "var(--font-size-font-size-sm, 0.875rem)",
11973
- fontWeight: 400,
11974
- lineHeight: "var(--line-height-line-height-sm, 1.25rem)",
11975
- textOverflow: "ellipsis",
11976
- overflow: "hidden",
11977
- whiteSpace: "nowrap"
11978
- };
11979
- return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
11980
- "div",
11981
- {
11982
- style: {
11983
- borderBottom: "0.0625rem solid var(--alias-border-subtle, #242424)",
11984
- padding: "8px 16px",
11985
- display: "flex",
11986
- flexDirection: "row",
11987
- gap: "var(--spacing-6xl, 1.5rem)",
11988
- alignItems: "center"
11989
- },
11990
- children: [
11991
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { style: { ...rowCellRegular, flex: 1 }, children: app }),
11992
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { style: { ...rowCellRegular, flex: 1 }, children: activity }),
11993
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { style: { ...rowCellRegular, width: "7.5rem" }, children: userName }),
11994
- showWorkspace && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
11995
- "div",
11996
- {
11997
- style: {
11998
- ...rowCellRegular,
11999
- width: "9rem",
12000
- color: usedBy ? "var(--alias-text---icons-primary, #f5f5f5)" : "var(--alias-text---icons-muted)"
12001
- },
12002
- title: workspaceLabel2,
12003
- children: workspaceLabel2
12004
- }
12005
- ),
12006
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { style: { ...rowCellRegular, width: "7.5rem" }, children: formatDate3(log.createdAt) }),
12007
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
12008
- "div",
12009
- {
12010
- style: {
12011
- width: "5rem",
12012
- color: amountColor,
12013
- fontFamily: "var(--font-family-font-family-body)",
12014
- fontSize: "var(--font-size-font-size-md, 1rem)",
12015
- fontWeight: 600,
12016
- lineHeight: "var(--line-height-line-height-md, 1.5rem)",
12017
- textAlign: "right",
12018
- textOverflow: "ellipsis",
12019
- overflow: "hidden",
12020
- whiteSpace: "nowrap"
12021
- },
12022
- children: signedAmount
12023
- }
12024
- )
12025
- ]
12026
- },
12027
- log._id
12028
- );
12029
- })
12030
- ]
12031
- }
12032
- );
12032
+ ]
12033
+ },
12034
+ log._id
12035
+ );
12036
+ })
12037
+ ] });
12033
12038
  }
12034
12039
  function UsageLogsPager({
12035
12040
  page,
@@ -12045,7 +12050,7 @@ function UsageLogsPager({
12045
12050
  "div",
12046
12051
  {
12047
12052
  className: "flex items-center justify-between shrink-0 w-full",
12048
- style: { gap: "var(--spacing-md)" },
12053
+ style: { ...BILLING_TABLE_PAGER_STYLE, gap: "var(--spacing-md)" },
12049
12054
  children: [
12050
12055
  /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
12051
12056
  "span",
@@ -12186,7 +12191,12 @@ function BillingContent({
12186
12191
  const [availableCredits, setAvailableCredits] = (0, import_react23.useState)(null);
12187
12192
  const [sharedPool, setSharedPool] = (0, import_react23.useState)(null);
12188
12193
  const [usedByNames, setUsedByNames] = (0, import_react23.useState)({});
12189
- const [products, setProducts] = (0, import_react23.useState)([]);
12194
+ const [allProducts, setProducts] = (0, import_react23.useState)([]);
12195
+ const workspaceCountry = workspace.current?.country;
12196
+ const products = (0, import_react23.useMemo)(
12197
+ () => productsForCountry(allProducts, workspaceCountry),
12198
+ [allProducts, workspaceCountry]
12199
+ );
12190
12200
  const [invoices, setInvoices] = (0, import_react23.useState)([]);
12191
12201
  const [totalCredits, setTotalCredits] = (0, import_react23.useState)(null);
12192
12202
  const [usageLogsState, dispatchUsageLogs] = (0, import_react23.useReducer)(
@@ -12259,17 +12269,7 @@ function BillingContent({
12259
12269
  if (creditsRes?.availableCredits != null)
12260
12270
  setAvailableCredits(creditsRes.availableCredits);
12261
12271
  setSharedPool(creditsRes?.sharedPool ?? null);
12262
- if (productsRes?.data) {
12263
- const normalizedWorkspaceCountry = workspace.current?.country?.trim().toUpperCase();
12264
- const targetCurrency = normalizedWorkspaceCountry === "IN" ? "inr" : "usd";
12265
- const filteredProducts = productsRes.data.map((product) => ({
12266
- ...product,
12267
- prices: product.prices.filter(
12268
- (price) => price.currency?.toLowerCase() === targetCurrency
12269
- )
12270
- })).filter((product) => product.prices.length > 0);
12271
- setProducts(filteredProducts);
12272
- }
12272
+ if (productsRes?.data) setProducts(productsRes.data);
12273
12273
  if (customRes?.data?.credits != null) {
12274
12274
  setCustomPlanCredits(customRes.data.credits);
12275
12275
  }
@@ -12278,7 +12278,7 @@ function BillingContent({
12278
12278
  setLoadingBilling(false);
12279
12279
  setBillingOverviewLoaded(true);
12280
12280
  }
12281
- }, [api, workspace.current?.country]);
12281
+ }, [api]);
12282
12282
  const fetchUserMap = (0, import_react23.useCallback)(async () => {
12283
12283
  try {
12284
12284
  const members = await api.fetchMembers();
@@ -13116,30 +13116,34 @@ function BillingContent({
13116
13116
  loading: loadingTable,
13117
13117
  workspaceCountry: workspace.current?.country
13118
13118
  }
13119
- ) : /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_jsx_runtime29.Fragment, { children: [
13120
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
13121
- UsageLogsTable,
13122
- {
13123
- logs: usageLogs.rows,
13124
- userMap,
13125
- loading: loadingUsageLogs,
13126
- error: usageLogsError,
13127
- onRetry: () => void loadUsageLogsPage(usageLogsState.requestedPage),
13128
- currentWorkspaceId: workspaceId,
13129
- usedByNames
13130
- }
13131
- ),
13132
- !usageLogsError && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
13133
- UsageLogsPager,
13134
- {
13135
- page: usageLogs.page,
13136
- totalPages: usageLogs.totalPages,
13137
- total: usageLogs.total,
13138
- loading: loadingUsageLogs,
13139
- onPageChange: goToUsageLogsPage
13140
- }
13141
- )
13142
- ] }),
13119
+ ) : (
13120
+ // Table and pager only, so the sticky pager stops at the table's top
13121
+ // and never floats over the cards above it.
13122
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "flex flex-col w-full", style: { flex: "1 0 auto" }, children: [
13123
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
13124
+ UsageLogsTable,
13125
+ {
13126
+ logs: usageLogs.rows,
13127
+ userMap,
13128
+ loading: loadingUsageLogs,
13129
+ error: usageLogsError,
13130
+ onRetry: () => void loadUsageLogsPage(usageLogsState.requestedPage),
13131
+ currentWorkspaceId: workspaceId,
13132
+ usedByNames
13133
+ }
13134
+ ),
13135
+ !usageLogsError && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
13136
+ UsageLogsPager,
13137
+ {
13138
+ page: usageLogs.page,
13139
+ totalPages: usageLogs.totalPages,
13140
+ total: usageLogs.total,
13141
+ loading: loadingUsageLogs,
13142
+ onPageChange: goToUsageLogsPage
13143
+ }
13144
+ )
13145
+ ] })
13146
+ ),
13143
13147
  showExportModal && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
13144
13148
  ExportDateModal,
13145
13149
  {