@burdenoff/microfe-billing 2026.1116.1 → 2026.1119.1

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.
Files changed (62) hide show
  1. package/dist/billing/modules/addons/pages/AddonCreatePage.js +143 -143
  2. package/dist/billing/modules/addons/pages/AddonCreatePage.js.map +1 -1
  3. package/dist/billing/modules/addons/pages/AddonEditPage.js +170 -170
  4. package/dist/billing/modules/addons/pages/AddonEditPage.js.map +1 -1
  5. package/dist/billing/modules/analytics/pages/AnalyticsPage.js +148 -148
  6. package/dist/billing/modules/analytics/pages/AnalyticsPage.js.map +1 -1
  7. package/dist/billing/modules/billing/pages/BillingWebhookLogsPage.js +115 -115
  8. package/dist/billing/modules/billing/pages/BillingWebhookLogsPage.js.map +1 -1
  9. package/dist/billing/modules/billing/pages/InvoicesListPage.js +136 -136
  10. package/dist/billing/modules/billing/pages/InvoicesListPage.js.map +1 -1
  11. package/dist/billing/modules/billing/pages/OrderCallbackLogsPage.js +129 -129
  12. package/dist/billing/modules/billing/pages/OrderCallbackLogsPage.js.map +1 -1
  13. package/dist/billing/modules/billing/pages/RefundsPage.js +325 -325
  14. package/dist/billing/modules/billing/pages/RefundsPage.js.map +1 -1
  15. package/dist/billing/modules/billing/pages/UserRefundsPage.js +149 -149
  16. package/dist/billing/modules/billing/pages/UserRefundsPage.js.map +1 -1
  17. package/dist/billing/modules/checkout/components/CompleteBillingAccountModal.js +99 -98
  18. package/dist/billing/modules/checkout/components/CompleteBillingAccountModal.js.map +1 -1
  19. package/dist/billing/modules/checkout/components/StoreShippingSection.js +125 -124
  20. package/dist/billing/modules/checkout/components/StoreShippingSection.js.map +1 -1
  21. package/dist/billing/modules/checkout/components/WorkspaceQuotaAssignmentModal.js +61 -60
  22. package/dist/billing/modules/checkout/components/WorkspaceQuotaAssignmentModal.js.map +1 -1
  23. package/dist/billing/modules/coupons/pages/CouponsListPage.js +177 -177
  24. package/dist/billing/modules/coupons/pages/CouponsListPage.js.map +1 -1
  25. package/dist/billing/modules/coupons/pages/CreateCouponPage.js +231 -231
  26. package/dist/billing/modules/coupons/pages/CreateCouponPage.js.map +1 -1
  27. package/dist/billing/modules/coupons/pages/EditCouponPage.js +139 -139
  28. package/dist/billing/modules/coupons/pages/EditCouponPage.js.map +1 -1
  29. package/dist/billing/modules/credits/pages/AdminCreditsPage.js +54 -54
  30. package/dist/billing/modules/credits/pages/AdminCreditsPage.js.map +1 -1
  31. package/dist/billing/modules/credits/pages/CreditWithdrawalPage.js +65 -65
  32. package/dist/billing/modules/credits/pages/CreditWithdrawalPage.js.map +1 -1
  33. package/dist/billing/modules/credits/pages/CreditsPage.js +95 -95
  34. package/dist/billing/modules/credits/pages/CreditsPage.js.map +1 -1
  35. package/dist/billing/modules/dashboard/components/CreateBillingAccountModal.js +232 -231
  36. package/dist/billing/modules/dashboard/components/CreateBillingAccountModal.js.map +1 -1
  37. package/dist/billing/modules/discounts/pages/DiscountsListPage.js +328 -328
  38. package/dist/billing/modules/discounts/pages/DiscountsListPage.js.map +1 -1
  39. package/dist/billing/modules/earnings/pages/DeveloperRevenueOrgDetailPage.js +57 -57
  40. package/dist/billing/modules/earnings/pages/DeveloperRevenueOrgDetailPage.js.map +1 -1
  41. package/dist/billing/modules/earnings/pages/EarningsPage.js +53 -53
  42. package/dist/billing/modules/earnings/pages/EarningsPage.js.map +1 -1
  43. package/dist/billing/modules/earnings/pages/PayoutsPage.js +100 -100
  44. package/dist/billing/modules/earnings/pages/PayoutsPage.js.map +1 -1
  45. package/dist/billing/modules/plans/pages/PlanCreatePage.js +150 -150
  46. package/dist/billing/modules/plans/pages/PlanCreatePage.js.map +1 -1
  47. package/dist/billing/modules/plans/pages/PlanEditPage.js +125 -125
  48. package/dist/billing/modules/plans/pages/PlanEditPage.js.map +1 -1
  49. package/dist/billing/modules/quota/pages/QuotaTemplateCreatePage.js +113 -113
  50. package/dist/billing/modules/quota/pages/QuotaTemplateCreatePage.js.map +1 -1
  51. package/dist/billing/modules/quota/pages/QuotaTemplateEditPage.js +132 -132
  52. package/dist/billing/modules/quota/pages/QuotaTemplateEditPage.js.map +1 -1
  53. package/dist/billing/modules/settings/pages/SettingsPage.js +101 -101
  54. package/dist/billing/modules/settings/pages/SettingsPage.js.map +1 -1
  55. package/dist/billing/modules/settings/pages/TeamPermissionsPage.js +125 -125
  56. package/dist/billing/modules/settings/pages/TeamPermissionsPage.js.map +1 -1
  57. package/dist/billing/modules/usage/components/WorkspaceAiSpendPanel.js +51 -50
  58. package/dist/billing/modules/usage/components/WorkspaceAiSpendPanel.js.map +1 -1
  59. package/dist/billing/modules/usage/pages/UsagePage.js +107 -107
  60. package/dist/billing/modules/usage/pages/UsagePage.js.map +1 -1
  61. package/dist/billing/shared/components/GeoPricingOverridesEditor.js +1 -0
  62. package/package.json +2 -2
@@ -6,226 +6,226 @@ import "../../../shared/components/index.js";
6
6
  import { useBillingPermissions as i } from "../../../hooks/useBillingPermissions.js";
7
7
  import { directBillingGraphqlRequest as a } from "../../../shared/utils/directBillingGraphql.js";
8
8
  import { useBillingAccountSelection as o } from "../../../hooks/useBillingAccountSelection.js";
9
- import { useBillingAccounts as s } from "../../dashboard/hooks/useDashboard.js";
9
+ import { useBillingAccounts as ee } from "../../dashboard/hooks/useDashboard.js";
10
10
  import "../../../shared/utils/index.js";
11
- import { useActorProfiles as c } from "../../../shared/hooks/useActorProfiles.js";
11
+ import { useActorProfiles as s } from "../../../shared/hooks/useActorProfiles.js";
12
12
  import "../../../shared/hooks/index.js";
13
- import { useCallback as l, useEffect as u, useMemo as d, useState as f } from "react";
14
- import { AlertDialog as p, AlertDialogAction as m, AlertDialogCancel as h, AlertDialogContent as g, AlertDialogDescription as ee, AlertDialogFooter as te, AlertDialogHeader as ne, AlertDialogTitle as _, IllustratedEmptyState as re, PagePurpose as v } from "@burdenoff/fe-libs/ui";
15
- import { Fragment as y, jsx as b, jsxs as x } from "react/jsx-runtime";
13
+ import { useCallback as c, useEffect as l, useMemo as u, useState as d } from "react";
14
+ import { AlertDialog as f, AlertDialogAction as p, AlertDialogCancel as m, AlertDialogContent as h, AlertDialogDescription as g, AlertDialogFooter as _, AlertDialogHeader as v, AlertDialogTitle as y, IllustratedEmptyState as b, PagePurpose as x, ThemedSelect as S } from "@burdenoff/fe-libs/ui";
15
+ import { Fragment as C, jsx as w, jsxs as T } from "react/jsx-runtime";
16
16
  // src/billing/modules/settings/pages/TeamPermissionsPage.tsx
17
- var S = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i, C = "\n query BillingScopeRoles($scopeId: String!) {\n roles(scopeId: $scopeId) {\n id\n name\n description\n priority\n isSystem\n }\n }\n", w = "\n query BillingScopeActors($scopeId: String!) {\n actors(scopeId: $scopeId) {\n actorId\n actorType\n roleAssignments {\n id\n actorId\n actorType\n roleId\n scopeId\n isActive\n expiresAt\n role { id name priority }\n }\n }\n }\n", T = "\n mutation AssignBillingRole($input: AssignRoleInput!) {\n assignRoleToActor(input: $input) {\n id\n actorId\n roleId\n scopeId\n }\n }\n", E = "\n mutation RemoveBillingRole($assignmentId: String!) {\n removeRoleFromActor(assignmentId: $assignmentId)\n }\n", D = ({ embedded: D = !1 }) => {
18
- let { apiGatewayUrl: O, authToken: k, orgId: A } = e(), { billingAccounts: j } = s(), { selectedAccountId: M } = o({
19
- orgId: A,
20
- billingAccounts: j,
17
+ var te = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i, ne = "\n query BillingScopeRoles($scopeId: String!) {\n roles(scopeId: $scopeId) {\n id\n name\n description\n priority\n isSystem\n }\n }\n", re = "\n query BillingScopeActors($scopeId: String!) {\n actors(scopeId: $scopeId) {\n actorId\n actorType\n roleAssignments {\n id\n actorId\n actorType\n roleId\n scopeId\n isActive\n expiresAt\n role { id name priority }\n }\n }\n }\n", ie = "\n mutation AssignBillingRole($input: AssignRoleInput!) {\n assignRoleToActor(input: $input) {\n id\n actorId\n roleId\n scopeId\n }\n }\n", ae = "\n mutation RemoveBillingRole($assignmentId: String!) {\n removeRoleFromActor(assignmentId: $assignmentId)\n }\n", E = ({ embedded: E = !1 }) => {
18
+ let { apiGatewayUrl: D, authToken: O, orgId: k } = e(), { billingAccounts: A } = ee(), { selectedAccountId: j } = o({
19
+ orgId: k,
20
+ billingAccounts: A,
21
21
  syncFromUrl: !0,
22
22
  urlParamName: "billingAccountId"
23
- }), N = M ?? void 0, P = i({ billingAccountIdOverride: N }), [F, I] = f([]), [L, R] = f([]), [z, B] = f(!1), [V, H] = f(null), [U, W] = f(""), [G, K] = f(""), [q, J] = f(!1), [Y, X] = f(null), Z = l(async (e, t) => a({
24
- apiGatewayUrl: O,
25
- authToken: k,
26
- orgId: A,
23
+ }), M = j ?? void 0, N = i({ billingAccountIdOverride: M }), [P, F] = d([]), [I, L] = d([]), [R, z] = d(!1), [B, V] = d(null), [H, U] = d(""), [W, G] = d(""), [K, q] = d(!1), [J, Y] = d(null), X = c(async (e, t) => a({
24
+ apiGatewayUrl: D,
25
+ authToken: O,
26
+ orgId: k,
27
27
  query: e,
28
28
  variables: t
29
29
  }), [
30
+ D,
30
31
  O,
31
- k,
32
- A
33
- ]), Q = l(async () => {
34
- if (N) {
35
- B(!0), H(null);
32
+ k
33
+ ]), Z = c(async () => {
34
+ if (M) {
35
+ z(!0), V(null);
36
36
  try {
37
- let [e, t] = await Promise.all([Z(C, { scopeId: N }), Z(w, { scopeId: N })]);
38
- I(e.roles ?? []), R(t.actors ?? []);
37
+ let [e, t] = await Promise.all([X(ne, { scopeId: M }), X(re, { scopeId: M })]);
38
+ F(e.roles ?? []), L(t.actors ?? []);
39
39
  let n = (e.roles ?? []).find((e) => /viewer/i.test(e.name));
40
- K(n?.id ?? e.roles?.[0]?.id ?? "");
40
+ G(n?.id ?? e.roles?.[0]?.id ?? "");
41
41
  } catch (e) {
42
- H(e instanceof Error ? e.message : "Failed to load team data");
42
+ V(e instanceof Error ? e.message : "Failed to load team data");
43
43
  } finally {
44
- B(!1);
44
+ z(!1);
45
45
  }
46
46
  }
47
- }, [N, Z]);
48
- u(() => {
49
- Q();
50
- }, [Q]);
51
- let $ = d(() => [...L].sort((e, t) => {
47
+ }, [M, X]);
48
+ l(() => {
49
+ Z();
50
+ }, [Z]);
51
+ let Q = u(() => [...I].sort((e, t) => {
52
52
  let n = Math.max(...e.roleAssignments.map((e) => e.role?.priority ?? 0), 0);
53
53
  return Math.max(...t.roleAssignments.map((e) => e.role?.priority ?? 0), 0) - n;
54
- }), [L]), ie = d(() => $.map((e) => ({
54
+ }), [I]), oe = u(() => Q.map((e) => ({
55
55
  actorId: e.actorId,
56
56
  actorType: e.actorType
57
- })), [$]), ae = c(ie), oe = d(() => {
58
- if (N) return j.find((e) => e.id === N)?.name ?? void 0;
59
- }, [N, j]), se = async (e) => {
60
- if (e.preventDefault(), !N || !U.trim() || !G) return;
61
- let t = U.trim();
62
- if (!S.test(t)) H("User ID must be a UUID (e.g. 1a2b3c4d-...). Get it from the user profile page.");
57
+ })), [Q]), se = s(oe), ce = u(() => {
58
+ if (M) return A.find((e) => e.id === M)?.name ?? void 0;
59
+ }, [M, A]), le = async (e) => {
60
+ if (e.preventDefault(), !M || !H.trim() || !W) return;
61
+ let t = H.trim();
62
+ if (!te.test(t)) V("User ID must be a UUID (e.g. 1a2b3c4d-...). Get it from the user profile page.");
63
63
  else {
64
- J(!0), H(null);
64
+ q(!0), V(null);
65
65
  try {
66
- await Z(T, { input: {
66
+ await X(ie, { input: {
67
67
  actorId: t,
68
68
  actorType: "USER",
69
- roleId: G,
70
- scopeId: N
71
- } }), W(""), await Q();
69
+ roleId: W,
70
+ scopeId: M
71
+ } }), U(""), await Z();
72
72
  } catch (e) {
73
- H(e instanceof Error ? e.message : "Failed to assign role");
73
+ V(e instanceof Error ? e.message : "Failed to assign role");
74
74
  } finally {
75
- J(!1);
75
+ q(!1);
76
76
  }
77
77
  }
78
- }, ce = async (e) => {
79
- H(null);
78
+ }, $ = async (e) => {
79
+ V(null);
80
80
  try {
81
- await Z(E, { assignmentId: e }), await Q();
81
+ await X(ae, { assignmentId: e }), await Z();
82
82
  } catch (e) {
83
- H(e instanceof Error ? e.message : "Failed to remove role");
83
+ V(e instanceof Error ? e.message : "Failed to remove role");
84
84
  }
85
85
  };
86
- return P.isLoading ? /* @__PURE__ */ b("div", {
86
+ return N.isLoading ? /* @__PURE__ */ w("div", {
87
87
  className: "flex min-h-[400px] items-center justify-center",
88
- children: /* @__PURE__ */ b("div", { className: "size-8 animate-spin rounded-full border-4 border-primary border-t-transparent" })
89
- }) : P.isBillingAdmin ? N ? /* @__PURE__ */ x("div", {
90
- className: D ? "space-y-6" : "space-y-6 p-6",
88
+ children: /* @__PURE__ */ w("div", { className: "size-8 animate-spin rounded-full border-4 border-primary border-t-transparent" })
89
+ }) : N.isBillingAdmin ? M ? /* @__PURE__ */ T("div", {
90
+ className: E ? "space-y-6" : "space-y-6 p-6",
91
91
  children: [
92
- D ? null : /* @__PURE__ */ x(y, { children: [/* @__PURE__ */ b(n, {
92
+ E ? null : /* @__PURE__ */ T(C, { children: [/* @__PURE__ */ w(n, {
93
93
  title: "Team & Permissions",
94
94
  description: "Control who can manage this billing account and what they can do."
95
- }), /* @__PURE__ */ b(v, { children: "Decide who on your team can see and manage this billing account. Assign the Billing Admin role (full access) or Billing Viewer (read-only) to specific people, and revoke access when someone no longer needs it." })] }),
96
- /* @__PURE__ */ x("div", {
95
+ }), /* @__PURE__ */ w(x, { children: "Decide who on your team can see and manage this billing account. Assign the Billing Admin role (full access) or Billing Viewer (read-only) to specific people, and revoke access when someone no longer needs it." })] }),
96
+ /* @__PURE__ */ T("div", {
97
97
  className: "rounded-lg border border-border-subtle bg-bg-surface p-4 text-sm",
98
98
  children: [
99
- /* @__PURE__ */ b("span", {
99
+ /* @__PURE__ */ w("span", {
100
100
  className: "font-medium text-text-primary",
101
101
  children: "Billing account:"
102
102
  }),
103
103
  " ",
104
- /* @__PURE__ */ b("span", {
104
+ /* @__PURE__ */ w("span", {
105
105
  className: "text-text-primary",
106
- children: oe ?? "Unnamed account"
106
+ children: ce ?? "Unnamed account"
107
107
  }),
108
- N ? /* @__PURE__ */ x("details", {
108
+ M ? /* @__PURE__ */ T("details", {
109
109
  className: "mt-2 text-xs text-text-secondary",
110
- children: [/* @__PURE__ */ b("summary", {
110
+ children: [/* @__PURE__ */ w("summary", {
111
111
  className: "cursor-pointer",
112
112
  children: "Account ID"
113
- }), /* @__PURE__ */ b("span", {
113
+ }), /* @__PURE__ */ w("span", {
114
114
  className: "mt-1 inline-block font-mono",
115
- children: N
115
+ children: M
116
116
  })]
117
117
  }) : null
118
118
  ]
119
119
  }),
120
- V && /* @__PURE__ */ b("div", {
120
+ B && /* @__PURE__ */ w("div", {
121
121
  className: "rounded-lg border border-status-error-border/30 bg-status-error-bg/5 p-4 text-sm text-status-error-text",
122
- children: V
122
+ children: B
123
123
  }),
124
- /* @__PURE__ */ x("form", {
125
- onSubmit: (e) => void se(e),
124
+ /* @__PURE__ */ T("form", {
125
+ onSubmit: (e) => void le(e),
126
126
  className: "rounded-lg border border-border-subtle bg-bg-surface p-4 space-y-3",
127
127
  children: [
128
- /* @__PURE__ */ b("h3", {
128
+ /* @__PURE__ */ w("h3", {
129
129
  className: "text-sm font-semibold text-text-primary",
130
130
  children: "Add member"
131
131
  }),
132
- /* @__PURE__ */ x("div", {
132
+ /* @__PURE__ */ T("div", {
133
133
  className: "grid grid-cols-1 gap-3 md:grid-cols-3",
134
- children: [/* @__PURE__ */ x("div", {
134
+ children: [/* @__PURE__ */ T("div", {
135
135
  className: "md:col-span-2",
136
136
  children: [
137
- /* @__PURE__ */ b("label", {
137
+ /* @__PURE__ */ w("label", {
138
138
  htmlFor: "newActorId",
139
139
  className: "block text-xs font-medium text-text-secondary",
140
140
  children: "User ID"
141
141
  }),
142
- /* @__PURE__ */ b("input", {
142
+ /* @__PURE__ */ w("input", {
143
143
  id: "newActorId",
144
144
  type: "text",
145
- value: U,
146
- onChange: (e) => W(e.target.value),
145
+ value: H,
146
+ onChange: (e) => U(e.target.value),
147
147
  placeholder: "Paste the user ID from their profile page",
148
148
  className: "mt-1 w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm",
149
149
  required: !0
150
150
  }),
151
- /* @__PURE__ */ b("p", {
151
+ /* @__PURE__ */ w("p", {
152
152
  className: "mt-1 text-[11px] text-text-secondary",
153
153
  children: "Find this on the user's profile page."
154
154
  })
155
155
  ]
156
- }), /* @__PURE__ */ x("div", { children: [/* @__PURE__ */ b("label", {
156
+ }), /* @__PURE__ */ T("div", { children: [/* @__PURE__ */ w("label", {
157
157
  htmlFor: "newRoleId",
158
158
  className: "block text-xs font-medium text-text-secondary",
159
159
  children: "Role"
160
- }), /* @__PURE__ */ b("select", {
160
+ }), /* @__PURE__ */ w(S, {
161
161
  id: "newRoleId",
162
- value: G,
163
- onChange: (e) => K(e.target.value),
162
+ value: W,
163
+ onChange: (e) => G(e.target.value),
164
164
  className: "mt-1 w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm scheme-normal dark:scheme-dark [&_option]:bg-bg-surface [&_option]:text-text-primary",
165
165
  required: !0,
166
- children: F.map((e) => /* @__PURE__ */ b("option", {
166
+ children: P.map((e) => /* @__PURE__ */ w("option", {
167
167
  value: e.id,
168
168
  children: e.name
169
169
  }, e.id))
170
170
  })] })]
171
171
  }),
172
- /* @__PURE__ */ b("button", {
172
+ /* @__PURE__ */ w("button", {
173
173
  type: "submit",
174
- disabled: q || !U.trim() || !G,
174
+ disabled: K || !H.trim() || !W,
175
175
  className: "rounded-md bg-action-primary-bg px-4 py-2 text-sm font-medium text-action-primary-text disabled:opacity-50",
176
- children: q ? "Adding…" : "Add member"
176
+ children: K ? "Adding…" : "Add member"
177
177
  })
178
178
  ]
179
179
  }),
180
- /* @__PURE__ */ x("div", {
180
+ /* @__PURE__ */ T("div", {
181
181
  className: "rounded-lg border border-border-subtle bg-bg-surface",
182
- children: [/* @__PURE__ */ x("div", {
182
+ children: [/* @__PURE__ */ T("div", {
183
183
  className: "border-b border-border-subtle px-4 py-3",
184
- children: [/* @__PURE__ */ b("h3", {
184
+ children: [/* @__PURE__ */ w("h3", {
185
185
  className: "text-sm font-semibold text-text-primary",
186
186
  children: "Members"
187
- }), /* @__PURE__ */ b("p", {
187
+ }), /* @__PURE__ */ w("p", {
188
188
  className: "text-xs text-text-secondary",
189
189
  children: "Each member's role applies only to this billing account."
190
190
  })]
191
- }), z ? /* @__PURE__ */ b("div", {
191
+ }), R ? /* @__PURE__ */ w("div", {
192
192
  className: "p-6 text-sm text-text-secondary",
193
193
  children: "Loading…"
194
- }) : $.length === 0 ? /* @__PURE__ */ b("div", {
194
+ }) : Q.length === 0 ? /* @__PURE__ */ w("div", {
195
195
  className: "p-6 text-sm text-text-secondary",
196
196
  children: "No members assigned yet."
197
- }) : /* @__PURE__ */ b("div", {
197
+ }) : /* @__PURE__ */ w("div", {
198
198
  className: "overflow-x-auto",
199
199
  "data-testid": "billing-team-members-scroll",
200
- children: /* @__PURE__ */ x("table", {
200
+ children: /* @__PURE__ */ T("table", {
201
201
  className: "w-full text-sm",
202
- children: [/* @__PURE__ */ b("thead", { children: /* @__PURE__ */ x("tr", {
202
+ children: [/* @__PURE__ */ w("thead", { children: /* @__PURE__ */ T("tr", {
203
203
  className: "border-b border-border-subtle text-left text-xs text-text-secondary",
204
204
  children: [
205
- /* @__PURE__ */ b("th", {
205
+ /* @__PURE__ */ w("th", {
206
206
  className: "px-4 py-2",
207
207
  children: "Member"
208
208
  }),
209
- /* @__PURE__ */ b("th", {
209
+ /* @__PURE__ */ w("th", {
210
210
  className: "px-4 py-2",
211
211
  children: "Type"
212
212
  }),
213
- /* @__PURE__ */ b("th", {
213
+ /* @__PURE__ */ w("th", {
214
214
  className: "px-4 py-2",
215
215
  children: "Roles"
216
216
  }),
217
- /* @__PURE__ */ b("th", {
217
+ /* @__PURE__ */ w("th", {
218
218
  className: "px-4 py-2 text-right",
219
219
  children: "Actions"
220
220
  })
221
221
  ]
222
- }) }), /* @__PURE__ */ b("tbody", { children: $.map((e) => /* @__PURE__ */ x("tr", {
222
+ }) }), /* @__PURE__ */ w("tbody", { children: Q.map((e) => /* @__PURE__ */ T("tr", {
223
223
  className: "border-b border-border-subtle last:border-0",
224
224
  children: [
225
- /* @__PURE__ */ b("td", {
225
+ /* @__PURE__ */ w("td", {
226
226
  className: "px-4 py-3",
227
- children: /* @__PURE__ */ b(r, {
228
- profile: ae[e.actorId] ?? {
227
+ children: /* @__PURE__ */ w(r, {
228
+ profile: se[e.actorId] ?? {
229
229
  actorId: e.actorId,
230
230
  actorType: e.actorType,
231
231
  displayName: e.actorType.toLowerCase() === "user" ? `User ${e.actorId.slice(0, 8)}…` : e.actorType,
@@ -235,19 +235,19 @@ var S = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i, C = "
235
235
  variant: "cell"
236
236
  })
237
237
  }),
238
- /* @__PURE__ */ b("td", {
238
+ /* @__PURE__ */ w("td", {
239
239
  className: "px-4 py-3 text-xs capitalize text-text-secondary",
240
240
  children: e.actorType.toLowerCase()
241
241
  }),
242
- /* @__PURE__ */ b("td", {
242
+ /* @__PURE__ */ w("td", {
243
243
  className: "px-4 py-3",
244
- children: /* @__PURE__ */ b("div", {
244
+ children: /* @__PURE__ */ w("div", {
245
245
  className: "flex flex-wrap gap-1",
246
- children: e.roleAssignments.filter((e) => e.isActive).map((e) => /* @__PURE__ */ x("span", {
246
+ children: e.roleAssignments.filter((e) => e.isActive).map((e) => /* @__PURE__ */ T("span", {
247
247
  className: "inline-flex items-center gap-1 rounded-full border border-border-subtle bg-bg-sunken px-2 py-0.5 text-xs",
248
- children: [e.role?.name ?? e.roleId, /* @__PURE__ */ b("button", {
248
+ children: [e.role?.name ?? e.roleId, /* @__PURE__ */ w("button", {
249
249
  type: "button",
250
- onClick: () => X(e.id),
250
+ onClick: () => Y(e.id),
251
251
  className: "text-text-secondary hover:text-status-error-text",
252
252
  "aria-label": `Remove ${e.role?.name ?? "role"}`,
253
253
  children: "×"
@@ -255,9 +255,9 @@ var S = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i, C = "
255
255
  }, e.id))
256
256
  })
257
257
  }),
258
- /* @__PURE__ */ b("td", {
258
+ /* @__PURE__ */ w("td", {
259
259
  className: "px-4 py-3 text-right",
260
- children: /* @__PURE__ */ x("span", {
260
+ children: /* @__PURE__ */ T("span", {
261
261
  className: "text-xs text-text-secondary",
262
262
  children: [e.effectivePermissionCount ?? "—", " permissions"]
263
263
  })
@@ -267,31 +267,31 @@ var S = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i, C = "
267
267
  })
268
268
  })]
269
269
  }),
270
- /* @__PURE__ */ x("div", {
270
+ /* @__PURE__ */ T("div", {
271
271
  className: "rounded-lg border border-border-subtle bg-bg-surface p-4",
272
272
  children: [
273
- /* @__PURE__ */ b("h3", {
273
+ /* @__PURE__ */ w("h3", {
274
274
  className: "text-sm font-semibold text-text-primary",
275
275
  children: "Available roles"
276
276
  }),
277
- /* @__PURE__ */ b("p", {
277
+ /* @__PURE__ */ w("p", {
278
278
  className: "mt-1 text-xs text-text-secondary",
279
279
  children: "Roles are cloned from the system templates when a billing account is created."
280
280
  }),
281
- /* @__PURE__ */ b("ul", {
281
+ /* @__PURE__ */ w("ul", {
282
282
  className: "mt-3 space-y-2",
283
- children: F.map((e) => /* @__PURE__ */ x("li", {
283
+ children: P.map((e) => /* @__PURE__ */ T("li", {
284
284
  className: "flex items-start gap-3 rounded-md border border-border-subtle bg-bg-surface p-3",
285
- children: [/* @__PURE__ */ x("div", {
285
+ children: [/* @__PURE__ */ T("div", {
286
286
  className: "flex-1",
287
- children: [/* @__PURE__ */ b("div", {
287
+ children: [/* @__PURE__ */ w("div", {
288
288
  className: "text-sm font-medium text-text-primary",
289
289
  children: e.name
290
- }), e.description && /* @__PURE__ */ b("p", {
290
+ }), e.description && /* @__PURE__ */ w("p", {
291
291
  className: "mt-1 text-xs text-text-secondary",
292
292
  children: e.description
293
293
  })]
294
- }), /* @__PURE__ */ x("span", {
294
+ }), /* @__PURE__ */ T("span", {
295
295
  className: "text-xs text-text-secondary",
296
296
  children: ["priority ", e.priority]
297
297
  })]
@@ -299,32 +299,32 @@ var S = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i, C = "
299
299
  })
300
300
  ]
301
301
  }),
302
- /* @__PURE__ */ b(p, {
303
- open: Y !== null,
302
+ /* @__PURE__ */ w(f, {
303
+ open: J !== null,
304
304
  onOpenChange: (e) => {
305
- e || X(null);
305
+ e || Y(null);
306
306
  },
307
- children: /* @__PURE__ */ x(g, { children: [/* @__PURE__ */ x(ne, { children: [/* @__PURE__ */ b(_, { children: "Remove role assignment?" }), /* @__PURE__ */ b(ee, { children: "Remove this role assignment? The member will lose the access this role grants for this billing account." })] }), /* @__PURE__ */ x(te, { children: [/* @__PURE__ */ b(h, { children: "Cancel" }), /* @__PURE__ */ b(m, {
307
+ children: /* @__PURE__ */ T(h, { children: [/* @__PURE__ */ T(v, { children: [/* @__PURE__ */ w(y, { children: "Remove role assignment?" }), /* @__PURE__ */ w(g, { children: "Remove this role assignment? The member will lose the access this role grants for this billing account." })] }), /* @__PURE__ */ T(_, { children: [/* @__PURE__ */ w(m, { children: "Cancel" }), /* @__PURE__ */ w(p, {
308
308
  onClick: () => {
309
- let e = Y;
310
- X(null), e && ce(e);
309
+ let e = J;
310
+ Y(null), e && $(e);
311
311
  },
312
312
  children: "Remove"
313
313
  })] })] })
314
314
  })
315
315
  ]
316
- }) : D ? null : /* @__PURE__ */ x("div", {
316
+ }) : E ? null : /* @__PURE__ */ T("div", {
317
317
  className: "space-y-6 p-6",
318
- children: [/* @__PURE__ */ b(n, {
318
+ children: [/* @__PURE__ */ w(n, {
319
319
  title: "Team & Permissions",
320
320
  description: "Select a billing account to manage who can access it."
321
- }), /* @__PURE__ */ b(re, {
321
+ }), /* @__PURE__ */ w(b, {
322
322
  illustration: "empty-people",
323
323
  title: "No billing account selected",
324
324
  description: "Pick one from the billing account selector to manage its members and roles."
325
325
  })]
326
- }) : D ? null : /* @__PURE__ */ b(t, { message: "You don't have permission to manage team and permissions for this billing account." });
326
+ }) : E ? null : /* @__PURE__ */ w(t, { message: "You don't have permission to manage team and permissions for this billing account." });
327
327
  };
328
- export { D as TeamPermissionsPage };
328
+ export { E as TeamPermissionsPage };
329
329
 
330
330
  //# sourceMappingURL=TeamPermissionsPage.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"TeamPermissionsPage.js","names":["_Fragment","Fragment$1","UUID_RE","ROLES_QUERY","ACTORS_QUERY","ASSIGN_ROLE_MUTATION","REMOVE_ROLE_MUTATION","TeamPermissionsPage","useBilling","useBillingAccounts","useBillingAccountSelection","billingAccountId","selectedAccountId","permissions","useBillingPermissions","roles","setRoles","useState","actors","setActors","isLoading","setIsLoading","error","setError","newActorId","setNewActorId","newRoleId","setNewRoleId","isAdding","setIsAdding","removeAssignmentId","setRemoveAssignmentId","gqlPost","useCallback","directBillingGraphqlRequest","apiGatewayUrl","authToken","orgId","loadData","rolesResp","actorsResp","viewer","r","err","sortedActors","useMemo","priA","a","ra","b","profileInputs","profileMap","useActorProfiles","billingAccountName","billingAccounts","acct","handleAddMember","trimmedActorId","handleRemoveAssignment","embedded","PageHeader","PagePurpose","ActorIdentity","actor","AlertDialog","open","AlertDialogContent","AlertDialogHeader","AlertDialogTitle","AlertDialogDescription","AlertDialogFooter","AlertDialogCancel","AlertDialogAction","id","IllustratedEmptyState","AccessDenied"],"sources":["../../../../../src/billing/modules/settings/pages/TeamPermissionsPage.tsx"],"sourcesContent":["/**\n * Settings Module - Team & Permissions Page\n *\n * Lets a Billing Admin manage billing-scope role assignments for a specific\n * billing account. Calls global-rbac-svc directly via the same gateway URL\n * used by the rest of the billing module.\n *\n * Scope: `scopeType: \"billing\"`, `scopeId: <billingAccountId>`\n * Roles cloned per billing account at creation time:\n * - Billing Admin (full access to this billing account)\n * - Billing Viewer (read-only access to this billing account)\n */\nimport { useCallback, useEffect, useMemo, useState, type FC } from 'react';\nimport {\n AlertDialog,\n AlertDialogAction,\n AlertDialogCancel,\n AlertDialogContent,\n AlertDialogDescription,\n AlertDialogFooter,\n AlertDialogHeader,\n AlertDialogTitle,\n PagePurpose,\n IllustratedEmptyState,\n} from '@burdenoff/fe-libs/ui';\nimport { useBilling } from '../../../providers/BillingProvider';\nimport { AccessDenied, ActorIdentity, PageHeader } from '../../../shared/components';\nimport { useBillingPermissions } from '../../../hooks/useBillingPermissions';\nimport { useBillingAccountSelection } from '../../../hooks/useBillingAccountSelection';\nimport { useBillingAccounts } from '../../dashboard/hooks/useDashboard';\nimport { directBillingGraphqlRequest } from '../../../shared/utils';\nimport { useActorProfiles } from '../../../shared/hooks';\n\n// Basic UUID-v1-through-v5 shape — accept any 8-4-4-4-12 hex pattern.\n// We intentionally don't strictly validate the version nibble; the rbac\n// service is the authoritative ID validator.\nconst UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;\n\ninterface Role {\n id: string;\n name: string;\n description?: string | null;\n priority: number;\n isSystem: boolean;\n}\n\ninterface ActorRoleAssignment {\n id: string;\n actorId: string;\n actorType: string;\n roleId: string;\n scopeId: string;\n isActive: boolean;\n expiresAt?: string | null;\n role?: Role;\n}\n\ninterface ActorRbacSummary {\n actorId: string;\n actorType: string;\n roleAssignments: ActorRoleAssignment[];\n effectivePermissionCount?: number;\n}\n\nconst ROLES_QUERY = `\n query BillingScopeRoles($scopeId: String!) {\n roles(scopeId: $scopeId) {\n id\n name\n description\n priority\n isSystem\n }\n }\n`;\n\nconst ACTORS_QUERY = `\n query BillingScopeActors($scopeId: String!) {\n actors(scopeId: $scopeId) {\n actorId\n actorType\n roleAssignments {\n id\n actorId\n actorType\n roleId\n scopeId\n isActive\n expiresAt\n role { id name priority }\n }\n }\n }\n`;\n\nconst ASSIGN_ROLE_MUTATION = `\n mutation AssignBillingRole($input: AssignRoleInput!) {\n assignRoleToActor(input: $input) {\n id\n actorId\n roleId\n scopeId\n }\n }\n`;\n\nconst REMOVE_ROLE_MUTATION = `\n mutation RemoveBillingRole($assignmentId: String!) {\n removeRoleFromActor(assignmentId: $assignmentId)\n }\n`;\n\ninterface TeamPermissionsPageProps {\n /** Rendered inside the Settings page: no page header or outer padding, and silent when not allowed. */\n embedded?: boolean;\n}\n\nexport const TeamPermissionsPage: FC<TeamPermissionsPageProps> = ({ embedded = false }) => {\n const { apiGatewayUrl, authToken, orgId } = useBilling();\n\n // Resolution priority: URL `?billingAccountId=` → persisted localStorage →\n // default/first available account. Pass `billingAccounts` so first-time\n // users with empty localStorage still land on the default account\n // (without it the hook's auto-select effect can't fire and the page\n // dead-ends on \"No billing account selected\").\n const { billingAccounts } = useBillingAccounts();\n const { selectedAccountId } = useBillingAccountSelection({\n orgId,\n billingAccounts,\n syncFromUrl: true,\n urlParamName: 'billingAccountId',\n });\n const billingAccountId = selectedAccountId ?? undefined;\n\n // Share the resolved account with `useBillingPermissions` so its\n // billing-scope permissions fetch observes the same ID. Without this,\n // a first-time user (no URL param, empty localStorage) would see the\n // page resolve to the default account here while the permissions hook\n // still sat at null — billing-scope-only admins would see AccessDenied\n // until a navigation/reload propagated the localStorage write.\n const permissions = useBillingPermissions({ billingAccountIdOverride: billingAccountId });\n\n const [roles, setRoles] = useState<Role[]>([]);\n const [actors, setActors] = useState<ActorRbacSummary[]>([]);\n const [isLoading, setIsLoading] = useState(false);\n const [error, setError] = useState<string | null>(null);\n\n // Add-member form\n const [newActorId, setNewActorId] = useState('');\n const [newRoleId, setNewRoleId] = useState('');\n const [isAdding, setIsAdding] = useState(false);\n const [removeAssignmentId, setRemoveAssignmentId] = useState<string | null>(null);\n\n const gqlPost = useCallback(\n async <T,>(query: string, variables: Record<string, unknown>): Promise<T> => {\n return directBillingGraphqlRequest<T>({\n apiGatewayUrl,\n authToken,\n orgId,\n query,\n variables,\n });\n },\n [apiGatewayUrl, authToken, orgId]\n );\n\n const loadData = useCallback(async () => {\n if (!billingAccountId) return;\n setIsLoading(true);\n setError(null);\n try {\n const [rolesResp, actorsResp] = await Promise.all([\n gqlPost<{ roles: Role[] }>(ROLES_QUERY, { scopeId: billingAccountId }),\n gqlPost<{ actors: ActorRbacSummary[] }>(ACTORS_QUERY, {\n scopeId: billingAccountId,\n }),\n ]);\n setRoles(rolesResp.roles ?? []);\n setActors(actorsResp.actors ?? []);\n // Default the role-picker to \"Billing Viewer\" if available, else first role\n const viewer = (rolesResp.roles ?? []).find((r) => /viewer/i.test(r.name));\n setNewRoleId(viewer?.id ?? rolesResp.roles?.[0]?.id ?? '');\n } catch (err) {\n setError(err instanceof Error ? err.message : 'Failed to load team data');\n } finally {\n setIsLoading(false);\n }\n }, [billingAccountId, gqlPost]);\n\n useEffect(() => {\n void loadData();\n }, [loadData]);\n\n const sortedActors = useMemo(\n () =>\n [...actors].sort((a, b) => {\n const priA = Math.max(...a.roleAssignments.map((ra) => ra.role?.priority ?? 0), 0);\n const priB = Math.max(...b.roleAssignments.map((ra) => ra.role?.priority ?? 0), 0);\n return priB - priA;\n }),\n [actors]\n );\n\n const profileInputs = useMemo(\n () =>\n sortedActors.map((a) => ({\n actorId: a.actorId,\n actorType: a.actorType,\n })),\n [sortedActors]\n );\n const profileMap = useActorProfiles(profileInputs);\n\n const billingAccountName = useMemo(() => {\n if (!billingAccountId) return undefined;\n return billingAccounts.find((acct) => acct.id === billingAccountId)?.name ?? undefined;\n }, [billingAccountId, billingAccounts]);\n\n const handleAddMember = async (e: React.FormEvent) => {\n e.preventDefault();\n if (!billingAccountId || !newActorId.trim() || !newRoleId) return;\n const trimmedActorId = newActorId.trim();\n if (!UUID_RE.test(trimmedActorId)) {\n setError('User ID must be a UUID (e.g. 1a2b3c4d-...). Get it from the user profile page.');\n return;\n }\n setIsAdding(true);\n setError(null);\n try {\n await gqlPost(ASSIGN_ROLE_MUTATION, {\n input: {\n actorId: trimmedActorId,\n actorType: 'USER',\n roleId: newRoleId,\n scopeId: billingAccountId,\n },\n });\n setNewActorId('');\n await loadData();\n } catch (err) {\n setError(err instanceof Error ? err.message : 'Failed to assign role');\n } finally {\n setIsAdding(false);\n }\n };\n\n const handleRemoveAssignment = async (assignmentId: string) => {\n setError(null);\n try {\n await gqlPost(REMOVE_ROLE_MUTATION, { assignmentId });\n await loadData();\n } catch (err) {\n setError(err instanceof Error ? err.message : 'Failed to remove role');\n }\n };\n\n if (permissions.isLoading) {\n return (\n <div className=\"flex min-h-[400px] items-center justify-center\">\n <div className=\"size-8 animate-spin rounded-full border-4 border-primary border-t-transparent\" />\n </div>\n );\n }\n\n if (!permissions.isBillingAdmin) {\n if (embedded) return null;\n return (\n <AccessDenied message=\"You don't have permission to manage team and permissions for this billing account.\" />\n );\n }\n\n if (!billingAccountId) {\n if (embedded) return null;\n return (\n <div className=\"space-y-6 p-6\">\n <PageHeader\n title=\"Team & Permissions\"\n description=\"Select a billing account to manage who can access it.\"\n />\n <IllustratedEmptyState\n illustration=\"empty-people\"\n title=\"No billing account selected\"\n description=\"Pick one from the billing account selector to manage its members and roles.\"\n />\n </div>\n );\n }\n\n return (\n <div className={embedded ? 'space-y-6' : 'space-y-6 p-6'}>\n {embedded ? null : (\n <>\n <PageHeader\n title=\"Team & Permissions\"\n description=\"Control who can manage this billing account and what they can do.\"\n />\n\n <PagePurpose>\n Decide who on your team can see and manage this billing account. Assign the Billing\n Admin role (full access) or Billing Viewer (read-only) to specific people, and revoke\n access when someone no longer needs it.\n </PagePurpose>\n </>\n )}\n\n <div className=\"rounded-lg border border-border-subtle bg-bg-surface p-4 text-sm\">\n <span className=\"font-medium text-text-primary\">Billing account:</span>{' '}\n <span className=\"text-text-primary\">{billingAccountName ?? 'Unnamed account'}</span>\n {billingAccountId ? (\n <details className=\"mt-2 text-xs text-text-secondary\">\n <summary className=\"cursor-pointer\">Account ID</summary>\n <span className=\"mt-1 inline-block font-mono\">{billingAccountId}</span>\n </details>\n ) : null}\n </div>\n\n {error && (\n <div className=\"rounded-lg border border-status-error-border/30 bg-status-error-bg/5 p-4 text-sm text-status-error-text\">\n {error}\n </div>\n )}\n\n {/* Add member form */}\n <form\n onSubmit={(e) => void handleAddMember(e)}\n className=\"rounded-lg border border-border-subtle bg-bg-surface p-4 space-y-3\"\n >\n <h3 className=\"text-sm font-semibold text-text-primary\">Add member</h3>\n <div className=\"grid grid-cols-1 gap-3 md:grid-cols-3\">\n <div className=\"md:col-span-2\">\n <label htmlFor=\"newActorId\" className=\"block text-xs font-medium text-text-secondary\">\n User ID\n </label>\n <input\n id=\"newActorId\"\n type=\"text\"\n value={newActorId}\n onChange={(e) => setNewActorId(e.target.value)}\n placeholder=\"Paste the user ID from their profile page\"\n className=\"mt-1 w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm\"\n required\n />\n <p className=\"mt-1 text-[11px] text-text-secondary\">\n Find this on the user&apos;s profile page.\n </p>\n </div>\n <div>\n <label htmlFor=\"newRoleId\" className=\"block text-xs font-medium text-text-secondary\">\n Role\n </label>\n <select\n id=\"newRoleId\"\n value={newRoleId}\n onChange={(e) => setNewRoleId(e.target.value)}\n className=\"mt-1 w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm scheme-normal dark:scheme-dark [&_option]:bg-bg-surface [&_option]:text-text-primary\"\n required\n >\n {roles.map((r) => (\n <option key={r.id} value={r.id}>\n {r.name}\n </option>\n ))}\n </select>\n </div>\n </div>\n <button\n type=\"submit\"\n disabled={isAdding || !newActorId.trim() || !newRoleId}\n className=\"rounded-md bg-action-primary-bg px-4 py-2 text-sm font-medium text-action-primary-text disabled:opacity-50\"\n >\n {isAdding ? 'Adding…' : 'Add member'}\n </button>\n </form>\n\n {/* Members table */}\n <div className=\"rounded-lg border border-border-subtle bg-bg-surface\">\n <div className=\"border-b border-border-subtle px-4 py-3\">\n <h3 className=\"text-sm font-semibold text-text-primary\">Members</h3>\n <p className=\"text-xs text-text-secondary\">\n Each member&apos;s role applies only to this billing account.\n </p>\n </div>\n {isLoading ? (\n <div className=\"p-6 text-sm text-text-secondary\">Loading…</div>\n ) : sortedActors.length === 0 ? (\n <div className=\"p-6 text-sm text-text-secondary\">No members assigned yet.</div>\n ) : (\n // overflow-x-auto (BOFF-15045): the four columns need ~480 px, so on a\n // phone the table scrolls inside its card instead of pushing the page\n // sideways. Wherever the table fits (every desktop width) nothing scrolls.\n <div className=\"overflow-x-auto\" data-testid=\"billing-team-members-scroll\">\n <table className=\"w-full text-sm\">\n <thead>\n <tr className=\"border-b border-border-subtle text-left text-xs text-text-secondary\">\n <th className=\"px-4 py-2\">Member</th>\n <th className=\"px-4 py-2\">Type</th>\n <th className=\"px-4 py-2\">Roles</th>\n <th className=\"px-4 py-2 text-right\">Actions</th>\n </tr>\n </thead>\n <tbody>\n {sortedActors.map((actor) => (\n <tr key={actor.actorId} className=\"border-b border-border-subtle last:border-0\">\n <td className=\"px-4 py-3\">\n <ActorIdentity\n profile={\n profileMap[actor.actorId] ?? {\n actorId: actor.actorId,\n actorType: actor.actorType,\n displayName:\n actor.actorType.toLowerCase() === 'user'\n ? `User ${actor.actorId.slice(0, 8)}…`\n : actor.actorType,\n secondaryLabel: actor.actorId.slice(0, 12),\n resolved: false,\n }\n }\n variant=\"cell\"\n />\n </td>\n <td className=\"px-4 py-3 text-xs capitalize text-text-secondary\">\n {actor.actorType.toLowerCase()}\n </td>\n <td className=\"px-4 py-3\">\n <div className=\"flex flex-wrap gap-1\">\n {actor.roleAssignments\n .filter((ra) => ra.isActive)\n .map((ra) => (\n <span\n key={ra.id}\n className=\"inline-flex items-center gap-1 rounded-full border border-border-subtle bg-bg-sunken px-2 py-0.5 text-xs\"\n >\n {ra.role?.name ?? ra.roleId}\n <button\n type=\"button\"\n onClick={() => setRemoveAssignmentId(ra.id)}\n className=\"text-text-secondary hover:text-status-error-text\"\n aria-label={`Remove ${ra.role?.name ?? 'role'}`}\n >\n ×\n </button>\n </span>\n ))}\n </div>\n </td>\n <td className=\"px-4 py-3 text-right\">\n <span className=\"text-xs text-text-secondary\">\n {actor.effectivePermissionCount ?? '—'} permissions\n </span>\n </td>\n </tr>\n ))}\n </tbody>\n </table>\n </div>\n )}\n </div>\n\n {/* Roles reference */}\n <div className=\"rounded-lg border border-border-subtle bg-bg-surface p-4\">\n <h3 className=\"text-sm font-semibold text-text-primary\">Available roles</h3>\n <p className=\"mt-1 text-xs text-text-secondary\">\n Roles are cloned from the system templates when a billing account is created.\n </p>\n <ul className=\"mt-3 space-y-2\">\n {roles.map((r) => (\n <li\n key={r.id}\n className=\"flex items-start gap-3 rounded-md border border-border-subtle bg-bg-surface p-3\"\n >\n <div className=\"flex-1\">\n <div className=\"text-sm font-medium text-text-primary\">{r.name}</div>\n {r.description && (\n <p className=\"mt-1 text-xs text-text-secondary\">{r.description}</p>\n )}\n </div>\n <span className=\"text-xs text-text-secondary\">priority {r.priority}</span>\n </li>\n ))}\n </ul>\n </div>\n\n <AlertDialog\n open={removeAssignmentId !== null}\n onOpenChange={(open) => {\n if (!open) setRemoveAssignmentId(null);\n }}\n >\n <AlertDialogContent>\n <AlertDialogHeader>\n <AlertDialogTitle>Remove role assignment?</AlertDialogTitle>\n <AlertDialogDescription>\n Remove this role assignment? The member will lose the access this role grants for this\n billing account.\n </AlertDialogDescription>\n </AlertDialogHeader>\n <AlertDialogFooter>\n <AlertDialogCancel>Cancel</AlertDialogCancel>\n <AlertDialogAction\n onClick={() => {\n const id = removeAssignmentId;\n setRemoveAssignmentId(null);\n if (id) void handleRemoveAssignment(id);\n }}\n >\n Remove\n </AlertDialogAction>\n </AlertDialogFooter>\n </AlertDialogContent>\n </AlertDialog>\n </div>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;AAoCA,IAAME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,EAAA,CAAA,GACnB,kBAACC,IAAD,EAAA,UAAA,CACE,kBAACC,GAAD,EAAA,UAAmB,SAAyB,CAAA,GAC5C,kBAACC,GAAD;KACE,eAAe;MACb,IAAMC,IAAK3C;MAEX,AADAC,EAAsB,IAAI,GACtB0C,KAAIf,GAA4Be,CAAE;KACxC;KACD,UAAA;IAEkB,CAAA,CACF,EAAA,CAAA,CACD,EAAA,CAAA;GACT,CAAA;EACV;C,KA9ODd,IAAiB,OAEnB,kBAAC,OAAD;EAAK,WAAU;EAAf,UAAA,CACE,kBAACC,GAAD;GACE,OAAM;GACN,aAAY;EACb,CAAA,GACD,kBAACc,IAAD;GACE,cAAa;GACb,OAAM;GACN,aAAY;EACb,CAAA,CACE;C,KAnBHf,IAAiB,OAEnB,kBAACgB,GAAD,EAAc,SAAQ,qFAAsF,CAAA;AAqPlH"}
1
+ {"version":3,"file":"TeamPermissionsPage.js","names":["_Fragment","Fragment$1","UUID_RE","ROLES_QUERY","ACTORS_QUERY","ASSIGN_ROLE_MUTATION","REMOVE_ROLE_MUTATION","TeamPermissionsPage","useBilling","useBillingAccounts","useBillingAccountSelection","billingAccountId","selectedAccountId","permissions","useBillingPermissions","roles","setRoles","useState","actors","setActors","isLoading","setIsLoading","error","setError","newActorId","setNewActorId","newRoleId","setNewRoleId","isAdding","setIsAdding","removeAssignmentId","setRemoveAssignmentId","gqlPost","useCallback","directBillingGraphqlRequest","apiGatewayUrl","authToken","orgId","loadData","rolesResp","actorsResp","viewer","r","err","sortedActors","useMemo","priA","a","ra","b","profileInputs","profileMap","useActorProfiles","billingAccountName","billingAccounts","acct","handleAddMember","trimmedActorId","handleRemoveAssignment","embedded","PageHeader","PagePurpose","ThemedSelect","ActorIdentity","actor","AlertDialog","open","AlertDialogContent","AlertDialogHeader","AlertDialogTitle","AlertDialogDescription","AlertDialogFooter","AlertDialogCancel","AlertDialogAction","id","IllustratedEmptyState","AccessDenied"],"sources":["../../../../../src/billing/modules/settings/pages/TeamPermissionsPage.tsx"],"sourcesContent":["/**\n * Settings Module - Team & Permissions Page\n *\n * Lets a Billing Admin manage billing-scope role assignments for a specific\n * billing account. Calls global-rbac-svc directly via the same gateway URL\n * used by the rest of the billing module.\n *\n * Scope: `scopeType: \"billing\"`, `scopeId: <billingAccountId>`\n * Roles cloned per billing account at creation time:\n * - Billing Admin (full access to this billing account)\n * - Billing Viewer (read-only access to this billing account)\n */\nimport { useCallback, useEffect, useMemo, useState, type FC } from 'react';\nimport {\n AlertDialog,\n AlertDialogAction,\n AlertDialogCancel,\n AlertDialogContent,\n AlertDialogDescription,\n AlertDialogFooter,\n AlertDialogHeader,\n AlertDialogTitle,\n PagePurpose,\n IllustratedEmptyState,\n ThemedSelect,\n} from '@burdenoff/fe-libs/ui';\nimport { useBilling } from '../../../providers/BillingProvider';\nimport { AccessDenied, ActorIdentity, PageHeader } from '../../../shared/components';\nimport { useBillingPermissions } from '../../../hooks/useBillingPermissions';\nimport { useBillingAccountSelection } from '../../../hooks/useBillingAccountSelection';\nimport { useBillingAccounts } from '../../dashboard/hooks/useDashboard';\nimport { directBillingGraphqlRequest } from '../../../shared/utils';\nimport { useActorProfiles } from '../../../shared/hooks';\n\n// Basic UUID-v1-through-v5 shape — accept any 8-4-4-4-12 hex pattern.\n// We intentionally don't strictly validate the version nibble; the rbac\n// service is the authoritative ID validator.\nconst UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;\n\ninterface Role {\n id: string;\n name: string;\n description?: string | null;\n priority: number;\n isSystem: boolean;\n}\n\ninterface ActorRoleAssignment {\n id: string;\n actorId: string;\n actorType: string;\n roleId: string;\n scopeId: string;\n isActive: boolean;\n expiresAt?: string | null;\n role?: Role;\n}\n\ninterface ActorRbacSummary {\n actorId: string;\n actorType: string;\n roleAssignments: ActorRoleAssignment[];\n effectivePermissionCount?: number;\n}\n\nconst ROLES_QUERY = `\n query BillingScopeRoles($scopeId: String!) {\n roles(scopeId: $scopeId) {\n id\n name\n description\n priority\n isSystem\n }\n }\n`;\n\nconst ACTORS_QUERY = `\n query BillingScopeActors($scopeId: String!) {\n actors(scopeId: $scopeId) {\n actorId\n actorType\n roleAssignments {\n id\n actorId\n actorType\n roleId\n scopeId\n isActive\n expiresAt\n role { id name priority }\n }\n }\n }\n`;\n\nconst ASSIGN_ROLE_MUTATION = `\n mutation AssignBillingRole($input: AssignRoleInput!) {\n assignRoleToActor(input: $input) {\n id\n actorId\n roleId\n scopeId\n }\n }\n`;\n\nconst REMOVE_ROLE_MUTATION = `\n mutation RemoveBillingRole($assignmentId: String!) {\n removeRoleFromActor(assignmentId: $assignmentId)\n }\n`;\n\ninterface TeamPermissionsPageProps {\n /** Rendered inside the Settings page: no page header or outer padding, and silent when not allowed. */\n embedded?: boolean;\n}\n\nexport const TeamPermissionsPage: FC<TeamPermissionsPageProps> = ({ embedded = false }) => {\n const { apiGatewayUrl, authToken, orgId } = useBilling();\n\n // Resolution priority: URL `?billingAccountId=` → persisted localStorage →\n // default/first available account. Pass `billingAccounts` so first-time\n // users with empty localStorage still land on the default account\n // (without it the hook's auto-select effect can't fire and the page\n // dead-ends on \"No billing account selected\").\n const { billingAccounts } = useBillingAccounts();\n const { selectedAccountId } = useBillingAccountSelection({\n orgId,\n billingAccounts,\n syncFromUrl: true,\n urlParamName: 'billingAccountId',\n });\n const billingAccountId = selectedAccountId ?? undefined;\n\n // Share the resolved account with `useBillingPermissions` so its\n // billing-scope permissions fetch observes the same ID. Without this,\n // a first-time user (no URL param, empty localStorage) would see the\n // page resolve to the default account here while the permissions hook\n // still sat at null — billing-scope-only admins would see AccessDenied\n // until a navigation/reload propagated the localStorage write.\n const permissions = useBillingPermissions({ billingAccountIdOverride: billingAccountId });\n\n const [roles, setRoles] = useState<Role[]>([]);\n const [actors, setActors] = useState<ActorRbacSummary[]>([]);\n const [isLoading, setIsLoading] = useState(false);\n const [error, setError] = useState<string | null>(null);\n\n // Add-member form\n const [newActorId, setNewActorId] = useState('');\n const [newRoleId, setNewRoleId] = useState('');\n const [isAdding, setIsAdding] = useState(false);\n const [removeAssignmentId, setRemoveAssignmentId] = useState<string | null>(null);\n\n const gqlPost = useCallback(\n async <T,>(query: string, variables: Record<string, unknown>): Promise<T> => {\n return directBillingGraphqlRequest<T>({\n apiGatewayUrl,\n authToken,\n orgId,\n query,\n variables,\n });\n },\n [apiGatewayUrl, authToken, orgId]\n );\n\n const loadData = useCallback(async () => {\n if (!billingAccountId) return;\n setIsLoading(true);\n setError(null);\n try {\n const [rolesResp, actorsResp] = await Promise.all([\n gqlPost<{ roles: Role[] }>(ROLES_QUERY, { scopeId: billingAccountId }),\n gqlPost<{ actors: ActorRbacSummary[] }>(ACTORS_QUERY, {\n scopeId: billingAccountId,\n }),\n ]);\n setRoles(rolesResp.roles ?? []);\n setActors(actorsResp.actors ?? []);\n // Default the role-picker to \"Billing Viewer\" if available, else first role\n const viewer = (rolesResp.roles ?? []).find((r) => /viewer/i.test(r.name));\n setNewRoleId(viewer?.id ?? rolesResp.roles?.[0]?.id ?? '');\n } catch (err) {\n setError(err instanceof Error ? err.message : 'Failed to load team data');\n } finally {\n setIsLoading(false);\n }\n }, [billingAccountId, gqlPost]);\n\n useEffect(() => {\n void loadData();\n }, [loadData]);\n\n const sortedActors = useMemo(\n () =>\n [...actors].sort((a, b) => {\n const priA = Math.max(...a.roleAssignments.map((ra) => ra.role?.priority ?? 0), 0);\n const priB = Math.max(...b.roleAssignments.map((ra) => ra.role?.priority ?? 0), 0);\n return priB - priA;\n }),\n [actors]\n );\n\n const profileInputs = useMemo(\n () =>\n sortedActors.map((a) => ({\n actorId: a.actorId,\n actorType: a.actorType,\n })),\n [sortedActors]\n );\n const profileMap = useActorProfiles(profileInputs);\n\n const billingAccountName = useMemo(() => {\n if (!billingAccountId) return undefined;\n return billingAccounts.find((acct) => acct.id === billingAccountId)?.name ?? undefined;\n }, [billingAccountId, billingAccounts]);\n\n const handleAddMember = async (e: React.FormEvent) => {\n e.preventDefault();\n if (!billingAccountId || !newActorId.trim() || !newRoleId) return;\n const trimmedActorId = newActorId.trim();\n if (!UUID_RE.test(trimmedActorId)) {\n setError('User ID must be a UUID (e.g. 1a2b3c4d-...). Get it from the user profile page.');\n return;\n }\n setIsAdding(true);\n setError(null);\n try {\n await gqlPost(ASSIGN_ROLE_MUTATION, {\n input: {\n actorId: trimmedActorId,\n actorType: 'USER',\n roleId: newRoleId,\n scopeId: billingAccountId,\n },\n });\n setNewActorId('');\n await loadData();\n } catch (err) {\n setError(err instanceof Error ? err.message : 'Failed to assign role');\n } finally {\n setIsAdding(false);\n }\n };\n\n const handleRemoveAssignment = async (assignmentId: string) => {\n setError(null);\n try {\n await gqlPost(REMOVE_ROLE_MUTATION, { assignmentId });\n await loadData();\n } catch (err) {\n setError(err instanceof Error ? err.message : 'Failed to remove role');\n }\n };\n\n if (permissions.isLoading) {\n return (\n <div className=\"flex min-h-[400px] items-center justify-center\">\n <div className=\"size-8 animate-spin rounded-full border-4 border-primary border-t-transparent\" />\n </div>\n );\n }\n\n if (!permissions.isBillingAdmin) {\n if (embedded) return null;\n return (\n <AccessDenied message=\"You don't have permission to manage team and permissions for this billing account.\" />\n );\n }\n\n if (!billingAccountId) {\n if (embedded) return null;\n return (\n <div className=\"space-y-6 p-6\">\n <PageHeader\n title=\"Team & Permissions\"\n description=\"Select a billing account to manage who can access it.\"\n />\n <IllustratedEmptyState\n illustration=\"empty-people\"\n title=\"No billing account selected\"\n description=\"Pick one from the billing account selector to manage its members and roles.\"\n />\n </div>\n );\n }\n\n return (\n <div className={embedded ? 'space-y-6' : 'space-y-6 p-6'}>\n {embedded ? null : (\n <>\n <PageHeader\n title=\"Team & Permissions\"\n description=\"Control who can manage this billing account and what they can do.\"\n />\n\n <PagePurpose>\n Decide who on your team can see and manage this billing account. Assign the Billing\n Admin role (full access) or Billing Viewer (read-only) to specific people, and revoke\n access when someone no longer needs it.\n </PagePurpose>\n </>\n )}\n\n <div className=\"rounded-lg border border-border-subtle bg-bg-surface p-4 text-sm\">\n <span className=\"font-medium text-text-primary\">Billing account:</span>{' '}\n <span className=\"text-text-primary\">{billingAccountName ?? 'Unnamed account'}</span>\n {billingAccountId ? (\n <details className=\"mt-2 text-xs text-text-secondary\">\n <summary className=\"cursor-pointer\">Account ID</summary>\n <span className=\"mt-1 inline-block font-mono\">{billingAccountId}</span>\n </details>\n ) : null}\n </div>\n\n {error && (\n <div className=\"rounded-lg border border-status-error-border/30 bg-status-error-bg/5 p-4 text-sm text-status-error-text\">\n {error}\n </div>\n )}\n\n {/* Add member form */}\n <form\n onSubmit={(e) => void handleAddMember(e)}\n className=\"rounded-lg border border-border-subtle bg-bg-surface p-4 space-y-3\"\n >\n <h3 className=\"text-sm font-semibold text-text-primary\">Add member</h3>\n <div className=\"grid grid-cols-1 gap-3 md:grid-cols-3\">\n <div className=\"md:col-span-2\">\n <label htmlFor=\"newActorId\" className=\"block text-xs font-medium text-text-secondary\">\n User ID\n </label>\n <input\n id=\"newActorId\"\n type=\"text\"\n value={newActorId}\n onChange={(e) => setNewActorId(e.target.value)}\n placeholder=\"Paste the user ID from their profile page\"\n className=\"mt-1 w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm\"\n required\n />\n <p className=\"mt-1 text-[11px] text-text-secondary\">\n Find this on the user&apos;s profile page.\n </p>\n </div>\n <div>\n <label htmlFor=\"newRoleId\" className=\"block text-xs font-medium text-text-secondary\">\n Role\n </label>\n <ThemedSelect\n id=\"newRoleId\"\n value={newRoleId}\n onChange={(e) => setNewRoleId(e.target.value)}\n className=\"mt-1 w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm scheme-normal dark:scheme-dark [&_option]:bg-bg-surface [&_option]:text-text-primary\"\n required\n >\n {roles.map((r) => (\n <option key={r.id} value={r.id}>\n {r.name}\n </option>\n ))}\n </ThemedSelect>\n </div>\n </div>\n <button\n type=\"submit\"\n disabled={isAdding || !newActorId.trim() || !newRoleId}\n className=\"rounded-md bg-action-primary-bg px-4 py-2 text-sm font-medium text-action-primary-text disabled:opacity-50\"\n >\n {isAdding ? 'Adding…' : 'Add member'}\n </button>\n </form>\n\n {/* Members table */}\n <div className=\"rounded-lg border border-border-subtle bg-bg-surface\">\n <div className=\"border-b border-border-subtle px-4 py-3\">\n <h3 className=\"text-sm font-semibold text-text-primary\">Members</h3>\n <p className=\"text-xs text-text-secondary\">\n Each member&apos;s role applies only to this billing account.\n </p>\n </div>\n {isLoading ? (\n <div className=\"p-6 text-sm text-text-secondary\">Loading…</div>\n ) : sortedActors.length === 0 ? (\n <div className=\"p-6 text-sm text-text-secondary\">No members assigned yet.</div>\n ) : (\n // overflow-x-auto (BOFF-15045): the four columns need ~480 px, so on a\n // phone the table scrolls inside its card instead of pushing the page\n // sideways. Wherever the table fits (every desktop width) nothing scrolls.\n <div className=\"overflow-x-auto\" data-testid=\"billing-team-members-scroll\">\n <table className=\"w-full text-sm\">\n <thead>\n <tr className=\"border-b border-border-subtle text-left text-xs text-text-secondary\">\n <th className=\"px-4 py-2\">Member</th>\n <th className=\"px-4 py-2\">Type</th>\n <th className=\"px-4 py-2\">Roles</th>\n <th className=\"px-4 py-2 text-right\">Actions</th>\n </tr>\n </thead>\n <tbody>\n {sortedActors.map((actor) => (\n <tr key={actor.actorId} className=\"border-b border-border-subtle last:border-0\">\n <td className=\"px-4 py-3\">\n <ActorIdentity\n profile={\n profileMap[actor.actorId] ?? {\n actorId: actor.actorId,\n actorType: actor.actorType,\n displayName:\n actor.actorType.toLowerCase() === 'user'\n ? `User ${actor.actorId.slice(0, 8)}…`\n : actor.actorType,\n secondaryLabel: actor.actorId.slice(0, 12),\n resolved: false,\n }\n }\n variant=\"cell\"\n />\n </td>\n <td className=\"px-4 py-3 text-xs capitalize text-text-secondary\">\n {actor.actorType.toLowerCase()}\n </td>\n <td className=\"px-4 py-3\">\n <div className=\"flex flex-wrap gap-1\">\n {actor.roleAssignments\n .filter((ra) => ra.isActive)\n .map((ra) => (\n <span\n key={ra.id}\n className=\"inline-flex items-center gap-1 rounded-full border border-border-subtle bg-bg-sunken px-2 py-0.5 text-xs\"\n >\n {ra.role?.name ?? ra.roleId}\n <button\n type=\"button\"\n onClick={() => setRemoveAssignmentId(ra.id)}\n className=\"text-text-secondary hover:text-status-error-text\"\n aria-label={`Remove ${ra.role?.name ?? 'role'}`}\n >\n ×\n </button>\n </span>\n ))}\n </div>\n </td>\n <td className=\"px-4 py-3 text-right\">\n <span className=\"text-xs text-text-secondary\">\n {actor.effectivePermissionCount ?? '—'} permissions\n </span>\n </td>\n </tr>\n ))}\n </tbody>\n </table>\n </div>\n )}\n </div>\n\n {/* Roles reference */}\n <div className=\"rounded-lg border border-border-subtle bg-bg-surface p-4\">\n <h3 className=\"text-sm font-semibold text-text-primary\">Available roles</h3>\n <p className=\"mt-1 text-xs text-text-secondary\">\n Roles are cloned from the system templates when a billing account is created.\n </p>\n <ul className=\"mt-3 space-y-2\">\n {roles.map((r) => (\n <li\n key={r.id}\n className=\"flex items-start gap-3 rounded-md border border-border-subtle bg-bg-surface p-3\"\n >\n <div className=\"flex-1\">\n <div className=\"text-sm font-medium text-text-primary\">{r.name}</div>\n {r.description && (\n <p className=\"mt-1 text-xs text-text-secondary\">{r.description}</p>\n )}\n </div>\n <span className=\"text-xs text-text-secondary\">priority {r.priority}</span>\n </li>\n ))}\n </ul>\n </div>\n\n <AlertDialog\n open={removeAssignmentId !== null}\n onOpenChange={(open) => {\n if (!open) setRemoveAssignmentId(null);\n }}\n >\n <AlertDialogContent>\n <AlertDialogHeader>\n <AlertDialogTitle>Remove role assignment?</AlertDialogTitle>\n <AlertDialogDescription>\n Remove this role assignment? The member will lose the access this role grants for this\n billing account.\n </AlertDialogDescription>\n </AlertDialogHeader>\n <AlertDialogFooter>\n <AlertDialogCancel>Cancel</AlertDialogCancel>\n <AlertDialogAction\n onClick={() => {\n const id = removeAssignmentId;\n setRemoveAssignmentId(null);\n if (id) void handleRemoveAssignment(id);\n }}\n >\n Remove\n </Alert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