@streamoid/settings 0.15.1 → 0.16.0

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,
@@ -119,11 +122,13 @@ __export(index_exports, {
119
122
  minimumCreditLimit: () => minimumCreditLimit,
120
123
  ownCreditsFirstText: () => ownCreditsFirstText,
121
124
  parseBillingEntitlement: () => parseBillingEntitlement,
125
+ parseInviteEmails: () => parseInviteEmails,
122
126
  pausedOwnCreditsText: () => pausedOwnCreditsText,
123
127
  poolEndsAtFrom: () => poolEndsAtFrom,
124
128
  poolErrorMessage: () => poolErrorMessage,
125
129
  poolRenewsAtCycleEnd: () => poolRenewsAtCycleEnd,
126
130
  poolWorkspaceName: () => poolWorkspaceName,
131
+ productsForCountry: () => productsForCountry,
127
132
  readSettingsCaller: () => readSettingsCaller,
128
133
  rememberSettingsCaller: () => rememberSettingsCaller,
129
134
  resolveSettingsTabFromPath: () => resolveSettingsTabFromPath,
@@ -3114,7 +3119,8 @@ var APP_ACCESS_MARKS = {
3114
3119
  "artifax": "data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2036%2036%22%3E%3Crect%20width%3D%2236%22%20height%3D%2236%22%20rx%3D%227%22%20fill%3D%22%23101010%22%2F%3E%3Cpath%20fill%3D%22%23fff%22%20fill-rule%3D%22evenodd%22%20d%3D%22M6%2029L15%207H21L30%2029H25.7L23.5%2023H12.5L10.3%2029ZM14%2019H22L18%209Z%22%2F%3E%3C%2Fsvg%3E%0A",
3115
3120
  "photogenix": "data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2036%2036%22%3E%3Crect%20width%3D%2236%22%20height%3D%2236%22%20rx%3D%227%22%20fill%3D%22%23101010%22%2F%3E%3Cpath%20fill%3D%22%23fff%22%20fill-rule%3D%22evenodd%22%20d%3D%22M10%2029V7H20C25%207%2028%2010%2028%2014.5S25%2022%2020%2022H14V29ZM14%2011V18H20C22.7%2018%2024%2017%2024%2014.5S22.7%2011%2020%2011Z%22%2F%3E%3C%2Fsvg%3E%0A",
3116
3121
  "catalogix": "data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2036%2036%22%3E%3Crect%20width%3D%2236%22%20height%3D%2236%22%20rx%3D%227%22%20fill%3D%22%23101010%22%2F%3E%3Cpath%20fill%3D%22%23fff%22%20fill-rule%3D%22evenodd%22%20d%3D%22M30%2012L26.5%2014C24.8%2011.5%2022.3%2010%2018.5%2010C12.7%2010%209%2013%209%2018S12.7%2026%2018.5%2026C22.3%2026%2024.8%2024.5%2026.5%2022L30%2024C27.7%2028%2023.7%2030%2018.5%2030C10.5%2030%205%2025.3%205%2018S10.5%206%2018.5%206C23.7%206%2027.7%208%2030%2012Z%22%2F%3E%3C%2Fsvg%3E%0A",
3117
- "returns": "data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2036%2036%22%3E%3Crect%20width%3D%2236%22%20height%3D%2236%22%20rx%3D%227%22%20fill%3D%22%23101010%22%2F%3E%3Cpath%20fill%3D%22%23fff%22%20transform%3D%22translate%288.034%207%29%20scale%280.782%29%22%20d%3D%22M4.536%2028.14H0V0H14.616C21%200%2024.948%203.024%2024.948%208.274C24.948%2012.936%2021.882%2015.792%2016.59%2016.086V16.38C18.774%2016.968%2019.782%2018.228%2020.79%2019.992L25.494%2028.14H20.286L15.792%2020.37C14.532%2018.144%2013.23%2017.22%209.702%2017.22H4.536V28.14ZM4.536%204.074V13.734H14.574C18.354%2013.734%2020.244%2012.432%2020.244%208.904C20.244%205.46%2018.354%204.074%2014.574%204.074H4.536Z%22%2F%3E%3C%2Fsvg%3E%0A"
3122
+ "returns": "data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2036%2036%22%3E%3Crect%20width%3D%2236%22%20height%3D%2236%22%20rx%3D%227%22%20fill%3D%22%23101010%22%2F%3E%3Cpath%20fill%3D%22%23fff%22%20transform%3D%22translate%288.034%207%29%20scale%280.782%29%22%20d%3D%22M4.536%2028.14H0V0H14.616C21%200%2024.948%203.024%2024.948%208.274C24.948%2012.936%2021.882%2015.792%2016.59%2016.086V16.38C18.774%2016.968%2019.782%2018.228%2020.79%2019.992L25.494%2028.14H20.286L15.792%2020.37C14.532%2018.144%2013.23%2017.22%209.702%2017.22H4.536V28.14ZM4.536%204.074V13.734H14.574C18.354%2013.734%2020.244%2012.432%2020.244%208.904C20.244%205.46%2018.354%204.074%2014.574%204.074H4.536Z%22%2F%3E%3C%2Fsvg%3E%0A",
3123
+ "tactix": "data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2036%2036%22%3E%3Crect%20width%3D%2236%22%20height%3D%2236%22%20rx%3D%227%22%20fill%3D%22%23101010%22%2F%3E%3Cpath%20fill%3D%22%23fff%22%20fill-rule%3D%22evenodd%22%20d%3D%22M5%207H31V11H20V29H16V11H5Z%22%2F%3E%3C%2Fsvg%3E%0A"
3118
3124
  };
3119
3125
 
3120
3126
  // src/teams-content.tsx
@@ -3145,6 +3151,7 @@ var svg_rodctpja6f_default = {
3145
3151
  // src/team-types.ts
3146
3152
  var APP_KEYS = [
3147
3153
  "artifax",
3154
+ "tactix",
3148
3155
  "photogenix",
3149
3156
  "returns",
3150
3157
  "catalogix"
@@ -3154,11 +3161,27 @@ var DEFAULT_PERMISSIONS = {
3154
3161
  photogenix: true,
3155
3162
  catalogix: true,
3156
3163
  returns: true,
3164
+ tactix: true,
3157
3165
  canUseCredits: true,
3158
3166
  canInviteUser: true,
3159
3167
  role: "admin",
3160
3168
  catalogixStores: []
3161
3169
  };
3170
+ function parseInviteEmails(input) {
3171
+ const emails = [];
3172
+ const invalid = [];
3173
+ for (const raw of input.split(/[\s,;]+/)) {
3174
+ const token = raw.trim();
3175
+ if (!token) continue;
3176
+ if (/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(token)) {
3177
+ const email = token.toLowerCase();
3178
+ if (!emails.includes(email)) emails.push(email);
3179
+ } else if (!invalid.includes(token)) {
3180
+ invalid.push(token);
3181
+ }
3182
+ }
3183
+ return { emails, invalid };
3184
+ }
3162
3185
 
3163
3186
  // src/invite-update-modal.tsx
3164
3187
  var import_jsx_runtime14 = require("react/jsx-runtime");
@@ -3279,7 +3302,8 @@ function InviteUpdateModal({
3279
3302
  initialOrganizationStanding = "guest",
3280
3303
  organizationDomain: _organizationDomain,
3281
3304
  allowAdminRole = true,
3282
- onInvite
3305
+ onInvite,
3306
+ onInviteMany
3283
3307
  }) {
3284
3308
  useOverlayOpen(open, onClose);
3285
3309
  const [emailValue, setEmailValue] = (0, import_react9.useState)("");
@@ -3298,6 +3322,8 @@ function InviteUpdateModal({
3298
3322
  !hiddenApps.includes("catalogix")
3299
3323
  );
3300
3324
  const [returnsOn, setReturnsOn] = (0, import_react9.useState)(!hiddenApps.includes("returns"));
3325
+ const [tactixOn, setTactixOn] = (0, import_react9.useState)(!hiddenApps.includes("tactix"));
3326
+ const [submitting, setSubmitting] = (0, import_react9.useState)(false);
3301
3327
  const [storeSearch, setStoreSearch] = (0, import_react9.useState)("");
3302
3328
  const [selectedStores, setSelectedStores] = (0, import_react9.useState)(/* @__PURE__ */ new Set());
3303
3329
  const filteredStores = stores.filter(
@@ -3316,6 +3342,7 @@ function InviteUpdateModal({
3316
3342
  );
3317
3343
  setCatalogixOn(!hidden.has("catalogix") && initialPermissions.catalogix);
3318
3344
  setReturnsOn(!hidden.has("returns") && initialPermissions.returns);
3345
+ setTactixOn(!hidden.has("tactix") && Boolean(initialPermissions.tactix));
3319
3346
  setSelectedStores(
3320
3347
  new Set(hidden.has("catalogix") ? [] : initialPermissions.catalogixStores)
3321
3348
  );
@@ -3331,6 +3358,8 @@ function InviteUpdateModal({
3331
3358
  setPhotogenixOn(!hidden.has("photogenix"));
3332
3359
  setCatalogixOn(!hidden.has("catalogix"));
3333
3360
  setReturnsOn(!hidden.has("returns"));
3361
+ setTactixOn(!hidden.has("tactix"));
3362
+ setSubmitting(false);
3334
3363
  setStoreSearch("");
3335
3364
  setSelectedStores(/* @__PURE__ */ new Set());
3336
3365
  }
@@ -3338,7 +3367,8 @@ function InviteUpdateModal({
3338
3367
  const adminLocked = mode === "invite" && !allowAdminRole;
3339
3368
  if (!open) return null;
3340
3369
  const isInvite = mode === "invite";
3341
- const hasEmail = /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(emailValue.trim());
3370
+ const parsedEmails = parseInviteEmails(emailValue);
3371
+ const hasEmail = parsedEmails.emails.length > 0 && parsedEmails.invalid.length === 0;
3342
3372
  function markChanged() {
3343
3373
  setHasChanges(true);
3344
3374
  }
@@ -3348,12 +3378,13 @@ function InviteUpdateModal({
3348
3378
  artifax: artifaxOn,
3349
3379
  photogenix: photogenixOn,
3350
3380
  returns: returnsOn,
3351
- catalogix: catalogixOn
3381
+ catalogix: catalogixOn,
3382
+ tactix: tactixOn
3352
3383
  };
3353
3384
  const notLastShown = (key) => shownApps[shownApps.length - 1] !== key;
3354
3385
  const appValue = (key) => role === "admin" || showsApp(key) ? appToggles[key] : false;
3355
3386
  const grantsNoApp = role === "member" && shownApps.length > 0 && !shownApps.some((key) => appToggles[key]);
3356
- const isSubmitDisabled = isInvite ? !hasEmail || grantsNoApp : !(allowSubmitWithoutChanges || hasChanges);
3387
+ const isSubmitDisabled = isInvite ? !hasEmail || grantsNoApp || submitting : !(allowSubmitWithoutChanges || hasChanges);
3357
3388
  function toggleStore(storeId) {
3358
3389
  setSelectedStores((prev) => {
3359
3390
  const next = new Set(prev);
@@ -3459,6 +3490,7 @@ function InviteUpdateModal({
3459
3490
  color: T6.primary
3460
3491
  },
3461
3492
  placeholder: "email@domain.in, email@domain.in, email@domain.in...",
3493
+ "aria-invalid": parsedEmails.invalid.length > 0,
3462
3494
  value: emailValue,
3463
3495
  onChange: (e) => setEmailValue(e.target.value)
3464
3496
  }
@@ -3480,6 +3512,20 @@ function InviteUpdateModal({
3480
3512
  }
3481
3513
  ) })
3482
3514
  }
3515
+ ),
3516
+ isInvite && parsedEmails.invalid.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
3517
+ "span",
3518
+ {
3519
+ role: "alert",
3520
+ style: {
3521
+ fontFamily: T6.font,
3522
+ fontSize: T6.fsXs,
3523
+ fontWeight: 400,
3524
+ lineHeight: T6.lhXs,
3525
+ color: "var(--alias-text---icons-error)"
3526
+ },
3527
+ children: parsedEmails.invalid.length === 1 ? `Not a valid email: ${parsedEmails.invalid[0]}` : `Not valid emails: ${parsedEmails.invalid.join(", ")}`
3528
+ }
3483
3529
  )
3484
3530
  ]
3485
3531
  }
@@ -3914,6 +3960,101 @@ function InviteUpdateModal({
3914
3960
  }
3915
3961
  ) })
3916
3962
  ] }) }),
3963
+ showsApp("tactix") && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_jsx_runtime14.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "shrink-0 w-full relative", children: [
3964
+ notLastShown("tactix") && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
3965
+ "div",
3966
+ {
3967
+ "aria-hidden": true,
3968
+ className: "absolute inset-0 pointer-events-none",
3969
+ style: {
3970
+ borderBottom: `1px solid ${T6.borderSubtle}`
3971
+ }
3972
+ }
3973
+ ),
3974
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "flex flex-row items-center size-full", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
3975
+ "div",
3976
+ {
3977
+ className: "flex items-center w-full",
3978
+ style: { padding: T6.sp3xl, gap: T6.spMd },
3979
+ children: [
3980
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
3981
+ "div",
3982
+ {
3983
+ className: "flex flex-1 min-w-0 items-center",
3984
+ style: { gap: T6.spXl },
3985
+ children: [
3986
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
3987
+ "div",
3988
+ {
3989
+ className: "shrink-0 flex items-center",
3990
+ style: {
3991
+ background: T6.fillHover,
3992
+ borderRadius: T6.rXl,
3993
+ padding: T6.spMd
3994
+ },
3995
+ children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
3996
+ import_icons5.SiconChartBar,
3997
+ {
3998
+ className: "w-6 h-6",
3999
+ color: T6.primary
4000
+ }
4001
+ )
4002
+ }
4003
+ ),
4004
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
4005
+ "div",
4006
+ {
4007
+ className: "flex flex-1 min-w-0 flex-col items-start overflow-hidden text-ellipsis whitespace-nowrap",
4008
+ style: { opacity: tactixOn ? 1 : 0.5 },
4009
+ children: [
4010
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
4011
+ "p",
4012
+ {
4013
+ className: "w-full overflow-hidden shrink-0",
4014
+ style: {
4015
+ fontFamily: T6.font,
4016
+ fontSize: T6.fsSm,
4017
+ fontWeight: 500,
4018
+ lineHeight: T6.lhSm,
4019
+ color: T6.primary
4020
+ },
4021
+ children: "Tactix"
4022
+ }
4023
+ ),
4024
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
4025
+ "p",
4026
+ {
4027
+ className: "w-full overflow-hidden shrink-0",
4028
+ style: {
4029
+ fontFamily: T6.font,
4030
+ fontSize: T6.fsXs,
4031
+ fontWeight: 400,
4032
+ lineHeight: T6.lhXs,
4033
+ color: T6.tertiary
4034
+ },
4035
+ children: "Buying and planning"
4036
+ }
4037
+ )
4038
+ ]
4039
+ }
4040
+ )
4041
+ ]
4042
+ }
4043
+ ),
4044
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
4045
+ ToggleSwitch,
4046
+ {
4047
+ active: tactixOn,
4048
+ onClick: () => {
4049
+ setTactixOn(!tactixOn);
4050
+ markChanged();
4051
+ }
4052
+ }
4053
+ )
4054
+ ]
4055
+ }
4056
+ ) })
4057
+ ] }) }),
3917
4058
  showsApp("photogenix") && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_jsx_runtime14.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "shrink-0 w-full relative", children: [
3918
4059
  notLastShown("photogenix") && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
3919
4060
  "div",
@@ -4428,18 +4569,27 @@ function InviteUpdateModal({
4428
4569
  photogenix: appValue("photogenix"),
4429
4570
  catalogix: appValue("catalogix"),
4430
4571
  returns: appValue("returns"),
4572
+ tactix: appValue("tactix"),
4431
4573
  // Stores ride on Catalogix, so they follow it: a
4432
4574
  // hidden Catalogix grants no app and therefore no
4433
4575
  // storefronts. Keeping them would leave a member
4434
4576
  // scoped to stores in a product they cannot open.
4435
4577
  catalogixStores: role === "admin" || showsApp("catalogix") ? Array.from(selectedStores) : []
4436
4578
  };
4437
- if (isInvite && onInvite) {
4438
- onInvite(
4439
- perms,
4440
- emailValue.trim(),
4441
- showOrganizationStanding ? orgStanding : void 0
4442
- );
4579
+ const standing = showOrganizationStanding ? orgStanding : void 0;
4580
+ if (isInvite && onInviteMany) {
4581
+ setSubmitting(true);
4582
+ Promise.resolve(
4583
+ onInviteMany(perms, parsedEmails.emails, standing)
4584
+ ).then((result) => {
4585
+ if (result && result.failed.length > 0) {
4586
+ setEmailValue(result.failed.join(", "));
4587
+ }
4588
+ }).finally(() => setSubmitting(false));
4589
+ } else if (isInvite && onInvite) {
4590
+ for (const email of parsedEmails.emails) {
4591
+ onInvite(perms, email, standing);
4592
+ }
4443
4593
  } else if (onSave) {
4444
4594
  onSave(perms);
4445
4595
  }
@@ -4674,6 +4824,7 @@ function appNameTokens(app) {
4674
4824
  return ["artifax", "artifact", "artifacts", "artifex", "chat"];
4675
4825
  if (app === "photogenix") return ["photogenix"];
4676
4826
  if (app === "returns") return ["returns", "return"];
4827
+ if (app === "tactix") return ["tactix"];
4677
4828
  return ["catalogix"];
4678
4829
  }
4679
4830
  function normalizeServiceName(value) {
@@ -4702,6 +4853,7 @@ function permissionServiceIds(services, permissions) {
4702
4853
  if (serviceMatchesApp(s, "catalogix") && permissions.catalogix)
4703
4854
  return true;
4704
4855
  if (serviceMatchesApp(s, "returns") && permissions.returns) return true;
4856
+ if (serviceMatchesApp(s, "tactix") && permissions.tactix) return true;
4705
4857
  return false;
4706
4858
  }).map((s) => s._id);
4707
4859
  }
@@ -4814,7 +4966,8 @@ function readInviteAppFlag(invRecord, app) {
4814
4966
  ],
4815
4967
  photogenix: ["photogenix", "photogenixAccess"],
4816
4968
  catalogix: ["catalogix", "catalogixAccess"],
4817
- returns: ["returns", "return", "returnsAccess"]
4969
+ returns: ["returns", "return", "returnsAccess"],
4970
+ tactix: ["tactix", "tactixAccess"]
4818
4971
  };
4819
4972
  const containers = [invRecord];
4820
4973
  for (const nestedKey of ["permissions", "permission", "access", "apps"]) {
@@ -4889,6 +5042,7 @@ function memberToTeamMember(m, services) {
4889
5042
  const hasPhotogenix = isAdmin || userHasApp("photogenix");
4890
5043
  const hasCatalogix = isAdmin || userHasApp("catalogix");
4891
5044
  const hasReturns = isAdmin || userHasApp("returns");
5045
+ const hasTactix = isAdmin || userHasApp("tactix");
4892
5046
  return {
4893
5047
  id: m._id,
4894
5048
  kind: "member",
@@ -4915,6 +5069,7 @@ function memberToTeamMember(m, services) {
4915
5069
  photogenix: hasPhotogenix,
4916
5070
  catalogix: hasCatalogix,
4917
5071
  returns: hasReturns,
5072
+ tactix: hasTactix,
4918
5073
  canUseCredits: m.creditAccess,
4919
5074
  canInviteUser: m.inviteAccess,
4920
5075
  role: m.role,
@@ -4933,14 +5088,17 @@ function inviteToTeamMember(inv, services) {
4933
5088
  );
4934
5089
  const derivedCatalogix = serviceNames.some((n) => matchesApp(n, "catalogix"));
4935
5090
  const derivedReturns = serviceNames.some((n) => matchesApp(n, "returns"));
5091
+ const derivedTactix = serviceNames.some((n) => matchesApp(n, "tactix"));
4936
5092
  const explicitArtifax = readInviteAppFlag(invRecord, "artifax");
4937
5093
  const explicitPhotogenix = readInviteAppFlag(invRecord, "photogenix");
4938
5094
  const explicitCatalogix = readInviteAppFlag(invRecord, "catalogix");
4939
5095
  const explicitReturns = readInviteAppFlag(invRecord, "returns");
5096
+ const explicitTactix = readInviteAppFlag(invRecord, "tactix");
4940
5097
  const artifaxFlag = Boolean(explicitArtifax) || derivedArtifax;
4941
5098
  const photogenixFlag = Boolean(explicitPhotogenix) || derivedPhotogenix;
4942
5099
  const catalogixFlag = Boolean(explicitCatalogix) || derivedCatalogix;
4943
5100
  const returnsFlag = Boolean(explicitReturns) || derivedReturns;
5101
+ const tactixFlag = Boolean(explicitTactix) || derivedTactix;
4944
5102
  const catalogixStores = uniqueNonEmpty([
4945
5103
  ...extractIdsFromMixedArray(invRecord.stores),
4946
5104
  ...extractIdsFromMixedArray(invRecord.storeIds)
@@ -4957,6 +5115,7 @@ function inviteToTeamMember(inv, services) {
4957
5115
  photogenix: photogenixFlag,
4958
5116
  catalogix: catalogixFlag,
4959
5117
  returns: returnsFlag,
5118
+ tactix: tactixFlag,
4960
5119
  canUseCredits: inv.creditAccess ?? false,
4961
5120
  canInviteUser: inv.inviteAccess ?? false,
4962
5121
  role: inv.role ?? "member",
@@ -4965,7 +5124,7 @@ function inviteToTeamMember(inv, services) {
4965
5124
  };
4966
5125
  }
4967
5126
  function AccessIcons({ permissions }) {
4968
- const apps = ["artifax", "photogenix", "catalogix", "returns"];
5127
+ const apps = ["artifax", "tactix", "photogenix", "catalogix", "returns"];
4969
5128
  return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "flex items-center shrink-0", style: { gap: 6 }, children: apps.filter((app) => permissions[app]).map((app) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
4970
5129
  "img",
4971
5130
  {
@@ -5488,34 +5647,50 @@ function TeamsContent({
5488
5647
  toast.error(msg);
5489
5648
  }
5490
5649
  };
5491
- const handleInvite = async (permissions, email, organizationStanding) => {
5650
+ const handleInviteMany = async (permissions, emails, organizationStanding) => {
5492
5651
  if (!viewerCanInvite || permissions.role === "admin" && highestRole !== "admin") {
5493
5652
  toast.error("You do not have permission to invite users");
5494
5653
  closeModal();
5495
- return;
5654
+ return { failed: [] };
5496
5655
  }
5497
5656
  const serviceIds = permissions.role === "admin" ? [] : permissionServiceIds(allServices, permissions);
5498
- try {
5499
- await api.inviteMember({
5500
- email,
5501
- creditAccess: permissions.canUseCredits,
5502
- inviteAccess: permissions.canInviteUser,
5503
- role: permissions.role,
5504
- serviceIds,
5505
- storeIds: permissions.catalogixStores || [],
5506
- // Omitted when the control was never shown, which leaves the backend
5507
- // deriving the standing from the invitee's email domain as before.
5508
- ...organizationStanding ? {
5509
- organizationRole: organizationStanding === "colleague" ? "member" : "guest"
5510
- } : {}
5511
- });
5512
- toast.success(`Invitation sent to ${email}`);
5513
- await fetchData();
5514
- closeModal();
5515
- } catch (err) {
5516
- const msg = errorMessage(err, { method: "POST" });
5517
- toast.error(msg);
5657
+ const sent = [];
5658
+ const failed = [];
5659
+ for (const email of emails) {
5660
+ try {
5661
+ await api.inviteMember({
5662
+ email,
5663
+ creditAccess: permissions.canUseCredits,
5664
+ inviteAccess: permissions.canInviteUser,
5665
+ role: permissions.role,
5666
+ serviceIds,
5667
+ storeIds: permissions.catalogixStores || [],
5668
+ // Omitted when the control was never shown, which leaves the backend
5669
+ // deriving the standing from the invitee's email domain as before.
5670
+ ...organizationStanding ? {
5671
+ organizationRole: organizationStanding === "colleague" ? "member" : "guest"
5672
+ } : {}
5673
+ });
5674
+ sent.push(email);
5675
+ } catch (err) {
5676
+ failed.push({ email, message: errorMessage(err, { method: "POST" }) });
5677
+ }
5518
5678
  }
5679
+ if (sent.length === 1) toast.success(`Invitation sent to ${sent[0]}`);
5680
+ else if (sent.length > 1)
5681
+ toast.success(`Invitations sent to ${sent.length} people`);
5682
+ if (failed.length === 1) {
5683
+ toast.error(
5684
+ emails.length === 1 ? failed[0].message : `${failed[0].email}: ${failed[0].message}`
5685
+ );
5686
+ } else if (failed.length > 1) {
5687
+ toast.error(
5688
+ `${failed.length} invitations were not sent. ${failed[0].email}: ${failed[0].message}`
5689
+ );
5690
+ }
5691
+ if (sent.length > 0) await fetchData();
5692
+ if (failed.length === 0) closeModal();
5693
+ return { failed: failed.map((f) => f.email) };
5519
5694
  };
5520
5695
  const filteredActive = activeMembers.filter((m) => {
5521
5696
  const q = searchQuery.toLowerCase();
@@ -5633,7 +5808,7 @@ function TeamsContent({
5633
5808
  showOrganizationStanding: mayGrantOrgMembership,
5634
5809
  organizationName: organizationName ?? orgCurrent?.name,
5635
5810
  organizationDomain: workspaceOrgId && orgCurrent?.id === workspaceOrgId ? orgCurrent?.domain : void 0,
5636
- onInvite: handleInvite
5811
+ onInviteMany: handleInviteMany
5637
5812
  }
5638
5813
  )
5639
5814
  ] });
@@ -10699,6 +10874,34 @@ async function loadCurrentPlan(fetchCurrentPlan) {
10699
10874
  return { subscription, entitlement, paid: hasPaidFeatures({ entitlement, subscription }) };
10700
10875
  }
10701
10876
 
10877
+ // src/billing-layout.ts
10878
+ var BILLING_TABLE_MIN_HEIGHT = 300;
10879
+ var BILLING_TABLE_FRAME_STYLE = {
10880
+ flex: "1 0 auto",
10881
+ minHeight: BILLING_TABLE_MIN_HEIGHT,
10882
+ backgroundColor: "var(--alias-surface-base)",
10883
+ borderRadius: "var(--radius-3xl)",
10884
+ border: "1px solid var(--alias-border-subtle)",
10885
+ overflow: "clip"
10886
+ };
10887
+ var BILLING_TABLE_PAGER_STYLE = {
10888
+ position: "sticky",
10889
+ bottom: 0,
10890
+ zIndex: 2,
10891
+ backgroundColor: "var(--alias-surface-canvas)",
10892
+ paddingTop: "var(--spacing-xl)",
10893
+ paddingBottom: "var(--spacing-md)"
10894
+ };
10895
+ function productsForCountry(products, country) {
10896
+ const currency = country?.trim().toUpperCase() === "IN" ? "inr" : "usd";
10897
+ return products.map((product) => ({
10898
+ ...product,
10899
+ prices: product.prices.filter(
10900
+ (price) => price.currency?.toLowerCase() === currency
10901
+ )
10902
+ })).filter((product) => product.prices.length > 0);
10903
+ }
10904
+
10702
10905
  // src/usage-logs.ts
10703
10906
  var USAGE_LOGS_PAGE_SIZE = 50;
10704
10907
  var USAGE_LOGS_EXPORT_BATCH_SIZE = 100;
@@ -11642,7 +11845,6 @@ function BillingTabBar({
11642
11845
  }
11643
11846
  );
11644
11847
  }
11645
- var BILLING_TABLE_MIN_HEIGHT = 300;
11646
11848
  function InvoiceHistoryTable({
11647
11849
  invoices,
11648
11850
  loading,
@@ -11716,64 +11918,51 @@ function InvoiceHistoryTable({
11716
11918
  }
11717
11919
  );
11718
11920
  }
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",
11921
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "w-full relative", style: BILLING_TABLE_FRAME_STYLE, children: [
11922
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
11923
+ "div",
11924
+ {
11925
+ style: {
11926
+ position: "sticky",
11927
+ top: 0,
11928
+ zIndex: 1,
11929
+ backgroundColor: "var(--alias-surface-base)"
11930
+ },
11931
+ children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_ui17.ScBillingHistoryHeader, {})
11932
+ }
11933
+ ),
11934
+ invoices.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
11935
+ "div",
11936
+ {
11937
+ className: "flex items-center justify-center w-full",
11938
+ style: { padding: "var(--spacing-6xl)" },
11939
+ children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
11940
+ "span",
11733
11941
  {
11734
11942
  style: {
11735
- position: "sticky",
11736
- top: 0,
11737
- zIndex: 1,
11738
- backgroundColor: "var(--alias-surface-base)"
11943
+ fontFamily: "var(--font-family-font-family-body)",
11944
+ fontSize: "var(--font-size-font-size-sm)",
11945
+ fontWeight: 400,
11946
+ lineHeight: "var(--line-height-line-height-sm)",
11947
+ color: "var(--alias-text---icons-muted)"
11739
11948
  },
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
- )
11949
+ children: "No invoices found"
11761
11950
  }
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
- );
11951
+ )
11952
+ }
11953
+ ),
11954
+ invoices.map((inv) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
11955
+ import_ui17.ScBillingHistoryTableList,
11956
+ {
11957
+ invoiceNumber: inv.transactionId ? `# ${inv.transactionId.slice(0, 16).toUpperCase()}` : "# INV-UNKNOWN",
11958
+ amount: inv.amountPaid != null ? `${currencySymbol}${inv.amountPaid.toFixed(2)}` : `${currencySymbol}${(inv.amount / 100).toFixed(2)}`,
11959
+ date: formatDate3(inv.createdAt),
11960
+ downloadLabel: "Download invoice",
11961
+ onClick: (e) => handleRowClick(e, inv)
11962
+ },
11963
+ inv._id
11964
+ ))
11965
+ ] });
11777
11966
  }
11778
11967
  function UsageLogsTable({
11779
11968
  logs,
@@ -11855,181 +12044,168 @@ function UsageLogsTable({
11855
12044
  }
11856
12045
  );
11857
12046
  }
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",
12047
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "w-full relative", style: BILLING_TABLE_FRAME_STYLE, children: [
12048
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
12049
+ "div",
12050
+ {
12051
+ style: {
12052
+ position: "sticky",
12053
+ top: 0,
12054
+ zIndex: 1,
12055
+ background: "var(--alias-fill-neutral-neutral, #1a1a1a)",
12056
+ padding: "var(--spacing-xl, 0.75rem) var(--spacing-3xl, 1rem)",
12057
+ display: "flex",
12058
+ flexDirection: "row",
12059
+ gap: "var(--spacing-6xl, 1.5rem)",
12060
+ alignItems: "center"
12061
+ },
12062
+ children: [
12063
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
12064
+ import_ui17.ScHeader,
12065
+ {
12066
+ text: "App",
12067
+ state: "none",
12068
+ style: { flex: 1, alignItems: "flex-start", gap: "0.25rem" }
12069
+ }
12070
+ ),
12071
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
12072
+ import_ui17.ScHeader,
12073
+ {
12074
+ text: "Activity",
12075
+ state: "none",
12076
+ style: { flex: 1, alignItems: "flex-start", gap: "0.25rem" }
12077
+ }
12078
+ ),
12079
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
12080
+ import_ui17.ScHeader,
12081
+ {
12082
+ text: "Used by",
12083
+ state: "none",
12084
+ style: { flexShrink: 0, width: "7.5rem" }
12085
+ }
12086
+ ),
12087
+ showWorkspace && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
12088
+ import_ui17.ScHeader,
12089
+ {
12090
+ text: "Workspace",
12091
+ state: "none",
12092
+ style: { flexShrink: 0, width: "9rem" }
12093
+ }
12094
+ ),
12095
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
12096
+ import_ui17.ScHeader,
12097
+ {
12098
+ text: "Date",
12099
+ state: "none",
12100
+ style: { flexShrink: 0, width: "7.5rem" }
12101
+ }
12102
+ ),
12103
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
12104
+ import_ui17.ScHeader,
12105
+ {
12106
+ text: "Credits",
12107
+ state: "none",
12108
+ style: {
12109
+ flexShrink: 0,
12110
+ width: "5rem",
12111
+ justifyContent: "flex-end"
12112
+ }
12113
+ }
12114
+ )
12115
+ ]
12116
+ }
12117
+ ),
12118
+ logs.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
12119
+ "div",
12120
+ {
12121
+ className: "flex items-center justify-center w-full",
12122
+ style: { padding: "var(--spacing-6xl)" },
12123
+ children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
12124
+ "span",
11872
12125
  {
11873
12126
  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"
12127
+ fontFamily: "var(--font-family-font-family-body)",
12128
+ fontSize: "var(--font-size-font-size-sm)",
12129
+ fontWeight: 400,
12130
+ lineHeight: "var(--line-height-line-height-sm)",
12131
+ color: "var(--alias-text---icons-muted)"
11883
12132
  },
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
- ]
12133
+ children: "No usage logs found"
11938
12134
  }
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",
12135
+ )
12136
+ }
12137
+ ),
12138
+ logs.map((log) => {
12139
+ const userName = log.triggeredByUserId ? userMap[log.triggeredByUserId] || "Unknown" : "System";
12140
+ const app = log.service?.serviceGroupName || "\u2014";
12141
+ const usedBy = usedByWorkspaceKey(log, currentWorkspaceId);
12142
+ const workspaceLabel2 = usedBy ? `Used by ${usedByNames[usedBy.toLowerCase()] ?? "another workspace"}` : "This workspace";
12143
+ const activity = log.type === "return" ? "Returned Credits" : log.meta?.info || "Credit usage";
12144
+ const isPositive = log.type === "return" || log.type === "add";
12145
+ const signedAmount = `${isPositive ? "+" : "-"}${log.amount}`;
12146
+ const amountColor = isPositive ? "var(--alias-text---icons-success, #1aa055)" : "var(--alias-text---icons-error, #d11a1a)";
12147
+ const rowCellRegular = {
12148
+ color: "var(--alias-text---icons-primary, #f5f5f5)",
12149
+ fontFamily: "var(--font-family-font-family-body)",
12150
+ fontSize: "var(--font-size-font-size-sm, 0.875rem)",
12151
+ fontWeight: 400,
12152
+ lineHeight: "var(--line-height-line-height-sm, 1.25rem)",
12153
+ textOverflow: "ellipsis",
12154
+ overflow: "hidden",
12155
+ whiteSpace: "nowrap"
12156
+ };
12157
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
12158
+ "div",
12159
+ {
12160
+ style: {
12161
+ borderBottom: "0.0625rem solid var(--alias-border-subtle, #242424)",
12162
+ padding: "8px 16px",
12163
+ display: "flex",
12164
+ flexDirection: "row",
12165
+ gap: "var(--spacing-6xl, 1.5rem)",
12166
+ alignItems: "center"
12167
+ },
12168
+ children: [
12169
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { style: { ...rowCellRegular, flex: 1 }, children: app }),
12170
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { style: { ...rowCellRegular, flex: 1 }, children: activity }),
12171
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { style: { ...rowCellRegular, width: "7.5rem" }, children: userName }),
12172
+ showWorkspace && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
12173
+ "div",
11947
12174
  {
11948
12175
  style: {
12176
+ ...rowCellRegular,
12177
+ width: "9rem",
12178
+ color: usedBy ? "var(--alias-text---icons-primary, #f5f5f5)" : "var(--alias-text---icons-muted)"
12179
+ },
12180
+ title: workspaceLabel2,
12181
+ children: workspaceLabel2
12182
+ }
12183
+ ),
12184
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { style: { ...rowCellRegular, width: "7.5rem" }, children: formatDate3(log.createdAt) }),
12185
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
12186
+ "div",
12187
+ {
12188
+ style: {
12189
+ width: "5rem",
12190
+ color: amountColor,
11949
12191
  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)"
12192
+ fontSize: "var(--font-size-font-size-md, 1rem)",
12193
+ fontWeight: 600,
12194
+ lineHeight: "var(--line-height-line-height-md, 1.5rem)",
12195
+ textAlign: "right",
12196
+ textOverflow: "ellipsis",
12197
+ overflow: "hidden",
12198
+ whiteSpace: "nowrap"
11954
12199
  },
11955
- children: "No usage logs found"
12200
+ children: signedAmount
11956
12201
  }
11957
12202
  )
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
- );
12203
+ ]
12204
+ },
12205
+ log._id
12206
+ );
12207
+ })
12208
+ ] });
12033
12209
  }
12034
12210
  function UsageLogsPager({
12035
12211
  page,
@@ -12045,7 +12221,7 @@ function UsageLogsPager({
12045
12221
  "div",
12046
12222
  {
12047
12223
  className: "flex items-center justify-between shrink-0 w-full",
12048
- style: { gap: "var(--spacing-md)" },
12224
+ style: { ...BILLING_TABLE_PAGER_STYLE, gap: "var(--spacing-md)" },
12049
12225
  children: [
12050
12226
  /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
12051
12227
  "span",
@@ -12186,7 +12362,12 @@ function BillingContent({
12186
12362
  const [availableCredits, setAvailableCredits] = (0, import_react23.useState)(null);
12187
12363
  const [sharedPool, setSharedPool] = (0, import_react23.useState)(null);
12188
12364
  const [usedByNames, setUsedByNames] = (0, import_react23.useState)({});
12189
- const [products, setProducts] = (0, import_react23.useState)([]);
12365
+ const [allProducts, setProducts] = (0, import_react23.useState)([]);
12366
+ const workspaceCountry = workspace.current?.country;
12367
+ const products = (0, import_react23.useMemo)(
12368
+ () => productsForCountry(allProducts, workspaceCountry),
12369
+ [allProducts, workspaceCountry]
12370
+ );
12190
12371
  const [invoices, setInvoices] = (0, import_react23.useState)([]);
12191
12372
  const [totalCredits, setTotalCredits] = (0, import_react23.useState)(null);
12192
12373
  const [usageLogsState, dispatchUsageLogs] = (0, import_react23.useReducer)(
@@ -12259,17 +12440,7 @@ function BillingContent({
12259
12440
  if (creditsRes?.availableCredits != null)
12260
12441
  setAvailableCredits(creditsRes.availableCredits);
12261
12442
  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
- }
12443
+ if (productsRes?.data) setProducts(productsRes.data);
12273
12444
  if (customRes?.data?.credits != null) {
12274
12445
  setCustomPlanCredits(customRes.data.credits);
12275
12446
  }
@@ -12278,7 +12449,7 @@ function BillingContent({
12278
12449
  setLoadingBilling(false);
12279
12450
  setBillingOverviewLoaded(true);
12280
12451
  }
12281
- }, [api, workspace.current?.country]);
12452
+ }, [api]);
12282
12453
  const fetchUserMap = (0, import_react23.useCallback)(async () => {
12283
12454
  try {
12284
12455
  const members = await api.fetchMembers();
@@ -13116,30 +13287,34 @@ function BillingContent({
13116
13287
  loading: loadingTable,
13117
13288
  workspaceCountry: workspace.current?.country
13118
13289
  }
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
- ] }),
13290
+ ) : (
13291
+ // Table and pager only, so the sticky pager stops at the table's top
13292
+ // and never floats over the cards above it.
13293
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "flex flex-col w-full", style: { flex: "1 0 auto" }, children: [
13294
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
13295
+ UsageLogsTable,
13296
+ {
13297
+ logs: usageLogs.rows,
13298
+ userMap,
13299
+ loading: loadingUsageLogs,
13300
+ error: usageLogsError,
13301
+ onRetry: () => void loadUsageLogsPage(usageLogsState.requestedPage),
13302
+ currentWorkspaceId: workspaceId,
13303
+ usedByNames
13304
+ }
13305
+ ),
13306
+ !usageLogsError && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
13307
+ UsageLogsPager,
13308
+ {
13309
+ page: usageLogs.page,
13310
+ totalPages: usageLogs.totalPages,
13311
+ total: usageLogs.total,
13312
+ loading: loadingUsageLogs,
13313
+ onPageChange: goToUsageLogsPage
13314
+ }
13315
+ )
13316
+ ] })
13317
+ ),
13143
13318
  showExportModal && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
13144
13319
  ExportDateModal,
13145
13320
  {