@burdenoff/microfe-billing 2026.1116.1 → 2026.1119.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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
@@ -1 +1 @@
1
- {"version":3,"file":"QuotaTemplateEditPage.js","names":["QuotaTemplateEditPage","useI18n","tr","translated","t","key","fallback","useParams","navigateTo","useBillingNavigate","permissions","useBillingPermissions","isQuotaLoading","quotaError","useQuotaTemplate","quotaId","useQuotaTemplateMutations","name","setName","useState","displayName","setDisplayName","description","setDescription","limitType","setLimitType","limitValue","setLimitValue","unit","setUnit","reusable","setReusable","resetPeriod","setResetPeriod","QuotaResetPeriod","isActive","setIsActive","error","setError","success","setSuccess","useEffect","quota","limits","ctx","i","isServerError","ServerError","refetch","PageHeader","PagePurpose","input","updateQuota","err","isUpdating","AccessDenied"],"sources":["../../../../../src/billing/modules/quota/pages/QuotaTemplateEditPage.tsx"],"sourcesContent":["/**\n * Quota Module - Quota Template Edit Page\n * Form to edit an existing quota template\n */\n\nimport { useState, useEffect, type FC, type FormEvent } from 'react';\nimport { useParams } from 'react-router';\nimport { useBillingNavigate } from '../../../hooks/useBillingNavigate';\nimport { useQuotaTemplate, useQuotaTemplateMutations } from '../hooks';\nimport { useBillingPermissions } from '../../../hooks/useBillingPermissions';\nimport { AccessDenied, PageHeader, ServerError } from '../../../shared/components';\nimport { PagePurpose } from '@burdenoff/fe-libs/ui';\nimport { isServerError } from '../../../shared/utils';\nimport { QuotaResetPeriod, type UpdateQuotaInput } from '../../../shared/types';\nimport { useI18n } from '@burdenoff/fe-libs/shared/providers/shell/I18nProvider';\n\nexport const QuotaTemplateEditPage: FC = () => {\n const { t } = useI18n();\n const tr = (key: string, fallback: string): string => {\n const translated = t(key);\n return translated === key ? fallback : translated;\n };\n const { quotaId } = useParams<{ quotaId: string }>();\n const navigateTo = useBillingNavigate();\n const permissions = useBillingPermissions();\n const {\n quota,\n isLoading: isQuotaLoading,\n error: quotaError,\n refetch,\n } = useQuotaTemplate(quotaId);\n const { updateQuota, isUpdating } = useQuotaTemplateMutations();\n\n // Form state\n const [name, setName] = useState('');\n const [displayName, setDisplayName] = useState('');\n const [description, setDescription] = useState('');\n const [limitType, setLimitType] = useState('numeric');\n const [limitValue, setLimitValue] = useState('');\n const [unit, setUnit] = useState('');\n const [reusable, setReusable] = useState(false);\n const [resetPeriod, setResetPeriod] = useState<QuotaResetPeriod>(QuotaResetPeriod.NEVER);\n const [isActive, setIsActive] = useState(true);\n const [error, setError] = useState<string | null>(null);\n const [success, setSuccess] = useState(false);\n\n // Populate form when quota data loads\n useEffect(() => {\n if (quota) {\n setName(quota.name ?? '');\n setReusable(quota.reusable ?? false);\n setResetPeriod(quota.resetPeriod ?? QuotaResetPeriod.NEVER);\n setIsActive(quota.isActive ?? true);\n\n const limits = quota.limits as { type?: string; value?: number; unit?: string } | null;\n setLimitType(limits?.type ?? 'numeric');\n setLimitValue(String(limits?.value ?? ''));\n setUnit(limits?.unit ?? '');\n\n const ctx = quota.context as { displayName?: string; description?: string } | null;\n setDisplayName(ctx?.displayName ?? '');\n setDescription(ctx?.description ?? '');\n }\n }, [quota]);\n\n // Permission check\n if (!permissions.canManageQuotas) {\n return <AccessDenied message=\"You don't have permission to edit quotas.\" />;\n }\n\n // Loading state\n if (isQuotaLoading) {\n return (\n <div className=\"space-y-6 p-6\">\n <div className=\"h-8 w-48 bg-bg-sunken animate-pulse rounded\" />\n <div className=\"max-w-2xl space-y-4\">\n {[1, 2, 3, 4].map((i) => (\n <div key={i} className=\"h-16 bg-bg-sunken animate-pulse rounded\" />\n ))}\n </div>\n </div>\n );\n }\n\n // Error state\n if (quotaError && isServerError(quotaError)) {\n return (\n <div className=\"p-6\">\n <ServerError\n title=\"Server Unavailable\"\n message=\"Unable to load quota. The server might be down or experiencing issues.\"\n onRetry={() => refetch()}\n showRetry\n />\n </div>\n );\n }\n\n if (!quota) {\n return (\n <div className=\"flex items-center justify-center h-full min-h-[400px]\">\n <div className=\"text-center space-y-4\">\n <h2 className=\"text-lg font-semibold text-text-primary\">Quota not found</h2>\n <button\n type=\"button\"\n onClick={() => navigateTo('/quotas')}\n className=\"px-4 py-2 text-sm font-medium bg-action-primary-bg text-action-primary-text rounded-button hover:bg-action-primary-bgHover\"\n >\n Back to Quotas\n </button>\n </div>\n </div>\n );\n }\n\n const handleSubmit = async (e: FormEvent) => {\n e.preventDefault();\n setError(null);\n setSuccess(false);\n\n // Validation\n if (!name.trim()) {\n setError('Quota name is required');\n return;\n }\n if (!limitValue || isNaN(Number(limitValue)) || Number(limitValue) < 0) {\n setError('Valid limit value is required');\n return;\n }\n if (!unit.trim()) {\n setError('Unit is required (e.g., bots, GB, seats)');\n return;\n }\n\n const input: UpdateQuotaInput = {\n id: quotaId!,\n name: name.trim(),\n limits: {\n type: limitType,\n value: Number(limitValue),\n unit: unit.trim(),\n },\n reusable,\n isActive,\n resetPeriod,\n context: {\n displayName: displayName.trim() || name.trim(),\n description: description.trim(),\n },\n };\n\n try {\n await updateQuota(input);\n setSuccess(true);\n // Navigate back after short delay\n setTimeout(() => navigateTo(`/quotas/${quotaId}`), 1500);\n } catch (err) {\n setError(err instanceof Error ? err.message : 'Failed to update quota');\n }\n };\n\n return (\n <div className=\"space-y-6 p-6\">\n <PageHeader\n title={`Edit Quota: ${(quota.context as { displayName?: string } | null)?.displayName ?? quota.name}`}\n description=\"Update the quota template configuration\"\n />\n\n <PagePurpose>\n Adjust this quota template&apos;s configuration. Changes apply wherever the template is\n referenced, so review which plans and add-ons use it before changing its type or unit.\n </PagePurpose>\n\n <form onSubmit={handleSubmit} className=\"max-w-2xl space-y-6\">\n {/* Error/Success Messages */}\n {error && (\n <div className=\"p-4 bg-status-error-bg-subtle border border-border-subtle rounded-lg\">\n <p className=\"text-sm text-status-error-text\">{error}</p>\n </div>\n )}\n {success && (\n <div className=\"p-4 bg-status-success-bg-subtle border border-border-subtle rounded-lg\">\n <p className=\"text-sm text-status-success-text\">\n Quota updated successfully! Redirecting…\n </p>\n </div>\n )}\n\n {/* Basic Info */}\n <div className=\"border border-border-seam rounded-card bg-bg-surface overflow-hidden shadow-[var(--shadow-elevation-1)]\">\n <div className=\"p-4 border-b border-border-subtle bg-bg-sunken/30\">\n <h2 className=\"font-semibold text-text-primary\">Basic Information</h2>\n </div>\n <div className=\"p-4 space-y-4\">\n {/* Machine Key (name) */}\n <div>\n <label htmlFor=\"name\" className=\"block text-sm font-medium text-text-primary mb-1\">\n Quota Key *\n </label>\n <input\n id=\"name\"\n type=\"text\"\n value={name}\n onChange={(e) => setName(e.target.value)}\n className=\"w-full px-3 py-2 border border-border-subtle rounded-input bg-bg-surface text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)] font-mono text-sm\"\n placeholder=\"e.g., sessions-started, tunnels-created\"\n required\n />\n <p className=\"text-xs text-text-muted mt-1\">\n Internal machine key, must match the <code>quotaName</code> used in{' '}\n <code>@usage</code> directives. Never shown to users.\n </p>\n </div>\n\n {/* Display Name */}\n <div>\n <label\n htmlFor=\"displayName\"\n className=\"block text-sm font-medium text-text-primary mb-1\"\n >\n Display Name *\n </label>\n <input\n id=\"displayName\"\n type=\"text\"\n value={displayName}\n onChange={(e) => setDisplayName(e.target.value)}\n className=\"w-full px-3 py-2 border border-border-subtle rounded-input bg-bg-surface text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]\"\n placeholder=\"e.g., Tunnels, Session Starts, Webhooks\"\n required\n />\n <p className=\"text-xs text-text-muted mt-1\">\n Human-readable name shown to users in billing and usage UI.\n </p>\n </div>\n\n {/* Description */}\n <div>\n <label\n htmlFor=\"description\"\n className=\"block text-sm font-medium text-text-primary mb-1\"\n >\n Description\n </label>\n <textarea\n id=\"description\"\n value={description}\n onChange={(e) => setDescription(e.target.value)}\n rows={2}\n className=\"w-full px-3 py-2 border border-border-subtle rounded-input bg-bg-surface text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)] resize-none\"\n placeholder=\"e.g., Active tunnels created through VibeControls (slot freed on delete)\"\n />\n <p className=\"text-xs text-text-muted mt-1\">\n Short explanation shown in billing and usage detail views.\n </p>\n </div>\n\n {/* Quota Type (read-only) */}\n <div>\n <label className=\"block text-sm font-medium text-text-primary mb-1\">Quota Type</label>\n <div className=\"px-3 py-2 border border-border-subtle rounded-md bg-bg-sunken/50 text-text-muted\">\n {quota.quotaType === 'POOLED' ? 'Pooled' : 'Product Specific'}\n <span className=\"text-xs ml-2\">(cannot be changed)</span>\n </div>\n </div>\n\n {/* Reusable */}\n <div className=\"flex items-center gap-3\">\n <input\n id=\"reusable\"\n type=\"checkbox\"\n checked={reusable}\n onChange={(e) => setReusable(e.target.checked)}\n className=\"size-4 rounded border-border-subtle text-text-link focus:ring-[var(--color-focus-ring)]\"\n />\n <div>\n <label htmlFor=\"reusable\" className=\"text-sm font-medium text-text-primary\">\n Reusable Quota\n </label>\n <p className=\"text-xs text-text-muted\">\n Enable for quotas like seats or bots that can be freed up\n </p>\n </div>\n </div>\n\n {/* Reset Period */}\n <div>\n <label\n htmlFor=\"resetPeriod\"\n className=\"block text-sm font-medium text-text-primary mb-1\"\n >\n Reset Period\n </label>\n <select\n id=\"resetPeriod\"\n value={resetPeriod}\n onChange={(e) => setResetPeriod(e.target.value as QuotaResetPeriod)}\n className=\"w-full px-3 py-2 border border-border-subtle rounded-input bg-bg-surface text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)] scheme-normal dark:scheme-dark [&_option]:bg-bg-surface [&_option]:text-text-primary\"\n >\n <option value={QuotaResetPeriod.NEVER}>Never (one-time limit)</option>\n <option value={QuotaResetPeriod.DAILY}>Daily (resets every day)</option>\n <option value={QuotaResetPeriod.MONTHLY}>Monthly (resets every month)</option>\n </select>\n <p className=\"text-xs text-text-muted mt-1\">\n How often the quota usage counter is reset to zero\n </p>\n </div>\n\n {/* Status */}\n <div className=\"flex items-center gap-3\">\n <input\n id=\"isActive\"\n type=\"checkbox\"\n checked={isActive}\n onChange={(e) => setIsActive(e.target.checked)}\n className=\"size-4 rounded border-border-subtle text-text-link focus:ring-[var(--color-focus-ring)]\"\n />\n <label htmlFor=\"isActive\" className=\"text-sm font-medium text-text-primary\">\n Quota is active\n </label>\n </div>\n </div>\n </div>\n\n {/* Limits Configuration */}\n <div className=\"border border-border-seam rounded-card bg-bg-surface overflow-hidden shadow-[var(--shadow-elevation-1)]\">\n <div className=\"p-4 border-b border-border-subtle bg-bg-sunken/30\">\n <h2 className=\"font-semibold text-text-primary\">Limits Configuration</h2>\n </div>\n <div className=\"p-4 space-y-4\">\n {/* Limit Type */}\n <div>\n <label\n htmlFor=\"limitType\"\n className=\"block text-sm font-medium text-text-primary mb-1\"\n >\n Limit Type *\n </label>\n <select\n id=\"limitType\"\n value={limitType}\n onChange={(e) => setLimitType(e.target.value)}\n className=\"w-full px-3 py-2 border border-border-subtle rounded-input bg-bg-surface text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)] scheme-normal dark:scheme-dark [&_option]:bg-bg-surface [&_option]:text-text-primary\"\n >\n <option value=\"numeric\">Numeric (count)</option>\n <option value=\"storage\">Storage (bytes)</option>\n <option value=\"duration\">Duration (seconds)</option>\n <option value=\"percentage\">Percentage</option>\n </select>\n </div>\n\n {/* Limit Value */}\n <div>\n <label\n htmlFor=\"limitValue\"\n className=\"block text-sm font-medium text-text-primary mb-1\"\n >\n Limit Value *\n </label>\n <input\n id=\"limitValue\"\n type=\"number\"\n min=\"0\"\n value={limitValue}\n onChange={(e) => setLimitValue(e.target.value)}\n className=\"w-full px-3 py-2 border border-border-subtle rounded-input bg-bg-surface text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]\"\n placeholder=\"1000\"\n required\n />\n <p className=\"text-xs text-text-muted mt-1\">The maximum limit value for this quota</p>\n </div>\n\n {/* Unit */}\n <div>\n <label htmlFor=\"unit\" className=\"block text-sm font-medium text-text-primary mb-1\">\n Unit *\n </label>\n <input\n id=\"unit\"\n type=\"text\"\n value={unit}\n onChange={(e) => setUnit(e.target.value)}\n className=\"w-full px-3 py-2 border border-border-subtle rounded-input bg-bg-surface text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]\"\n placeholder=\"e.g., bots, GB, MB, seats, workflow runs\"\n required\n />\n <p className=\"text-xs text-text-muted mt-1\">\n The unit of measurement displayed with usage values (e.g., &quot;2/6 bots&quot;)\n </p>\n </div>\n </div>\n </div>\n\n {/* Actions */}\n <div className=\"flex items-center gap-3 pt-4\">\n <button\n type=\"submit\"\n disabled={isUpdating}\n className=\"px-6 py-2 text-sm font-medium bg-action-primary-bg text-action-primary-text rounded-button hover:bg-action-primary-bgHover transition-colors disabled:opacity-50\"\n >\n {isUpdating\n ? tr('billing.quota.saving', 'Saving...')\n : tr('billing.quota.saveChanges', 'Save Changes')}\n </button>\n <button\n type=\"button\"\n onClick={() => navigateTo(`/quotas/${quotaId}`)}\n className=\"px-6 py-2 text-sm font-medium border border-border-subtle text-text-primary rounded-button hover:bg-bg-sunken transition-colors\"\n >\n Cancel\n </button>\n </div>\n </form>\n </div>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;AAgBA,IAAaA,UAAkC;CAC7C,IAAM,EAAE,SAAMC,EAAQ,GAChBC,KAAM,GAAa,MAA6B;EACpD,IAAMC,IAAaC,EAAEC,CAAG;EACxB,OAA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,OAAOC;UACP,WAAW,MAAMC,EAAc,EAAE,OAAO,KAAK;UAC7C,WAAU;UACV,aAAY;UACZ,UAAA;SACD,CAAA;SACD,kBAAC,KAAD;UAAG,WAAU;UAA+B,UAAA;SAAyC,CAAA;QAClF,EAAA,CAAA;QAGL,kBAAC,OAAD,EAAA,UAAA;SACE,kBAAC,SAAD;UAAO,SAAQ;UAAO,WAAU;UAAmD,UAAA;SAE5E,CAAA;SACP,kBAAC,SAAD;UACE,IAAG;UACH,MAAK;UACL,OAAOC;UACP,WAAW,MAAMC,EAAQ,EAAE,OAAO,KAAK;UACvC,WAAU;UACV,aAAY;UACZ,UAAA;SACD,CAAA;SACD,kBAAC,KAAD;UAAG,WAAU;UAA+B,UAAA;SAEzC,CAAA;QACA,EAAA,CAAA;OACF;MACF,CAAA,CAAA;;KAGL,kBAAC,OAAD;MAAK,WAAU;MAAf,UAAA,CACE,kBAAC,UAAD;OACE,MAAK;OACL,UAAUyB;OACV,WAAU;OAET,UAAAA,IACGpD,EAAG,wBAAwB,WAAW,IACtCA,EAAG,6BAA6B,cAAc;MAC5C,CAAA,GACR,kBAAC,UAAD;OACE,MAAK;OACL,eAAeM,EAAW,WAAWO,GAAS;OAC9C,WAAU;OACX,UAAA;MAEO,CAAA,CACL;;IACD;;EACH;C,KAzTH,kBAAC,OAAD;EAAK,WAAU;EACb,UAAA,kBAAC,OAAD;GAAK,WAAU;GAAf,UAAA,CACE,kBAAC,MAAD;IAAI,WAAU;IAA0C,UAAA;GAAmB,CAAA,GAC3E,kBAAC,UAAD;IACE,MAAK;IACL,eAAeP,EAAW,SAAS;IACnC,WAAU;IACX,UAAA;GAEO,CAAA,CACL;;CACF,CAAA,IA5CA,kBAAC+C,GAAD,EAAc,SAAQ,4CAA6C,CAAA;AA4V9E"}
1
+ {"version":3,"file":"QuotaTemplateEditPage.js","names":["QuotaTemplateEditPage","useI18n","tr","translated","t","key","fallback","useParams","navigateTo","useBillingNavigate","permissions","useBillingPermissions","isQuotaLoading","quotaError","useQuotaTemplate","quotaId","useQuotaTemplateMutations","name","setName","useState","displayName","setDisplayName","description","setDescription","limitType","setLimitType","limitValue","setLimitValue","unit","setUnit","reusable","setReusable","resetPeriod","setResetPeriod","QuotaResetPeriod","isActive","setIsActive","error","setError","success","setSuccess","useEffect","quota","limits","ctx","i","isServerError","ServerError","refetch","PageHeader","PagePurpose","input","updateQuota","err","ThemedSelect","isUpdating","AccessDenied"],"sources":["../../../../../src/billing/modules/quota/pages/QuotaTemplateEditPage.tsx"],"sourcesContent":["/**\n * Quota Module - Quota Template Edit Page\n * Form to edit an existing quota template\n */\n\nimport { useState, useEffect, type FC, type FormEvent } from 'react';\nimport { useParams } from 'react-router';\nimport { useBillingNavigate } from '../../../hooks/useBillingNavigate';\nimport { useQuotaTemplate, useQuotaTemplateMutations } from '../hooks';\nimport { useBillingPermissions } from '../../../hooks/useBillingPermissions';\nimport { AccessDenied, PageHeader, ServerError } from '../../../shared/components';\nimport { PagePurpose, ThemedSelect } from '@burdenoff/fe-libs/ui';\nimport { isServerError } from '../../../shared/utils';\nimport { QuotaResetPeriod, type UpdateQuotaInput } from '../../../shared/types';\nimport { useI18n } from '@burdenoff/fe-libs/shared/providers/shell/I18nProvider';\n\nexport const QuotaTemplateEditPage: FC = () => {\n const { t } = useI18n();\n const tr = (key: string, fallback: string): string => {\n const translated = t(key);\n return translated === key ? fallback : translated;\n };\n const { quotaId } = useParams<{ quotaId: string }>();\n const navigateTo = useBillingNavigate();\n const permissions = useBillingPermissions();\n const {\n quota,\n isLoading: isQuotaLoading,\n error: quotaError,\n refetch,\n } = useQuotaTemplate(quotaId);\n const { updateQuota, isUpdating } = useQuotaTemplateMutations();\n\n // Form state\n const [name, setName] = useState('');\n const [displayName, setDisplayName] = useState('');\n const [description, setDescription] = useState('');\n const [limitType, setLimitType] = useState('numeric');\n const [limitValue, setLimitValue] = useState('');\n const [unit, setUnit] = useState('');\n const [reusable, setReusable] = useState(false);\n const [resetPeriod, setResetPeriod] = useState<QuotaResetPeriod>(QuotaResetPeriod.NEVER);\n const [isActive, setIsActive] = useState(true);\n const [error, setError] = useState<string | null>(null);\n const [success, setSuccess] = useState(false);\n\n // Populate form when quota data loads\n useEffect(() => {\n if (quota) {\n setName(quota.name ?? '');\n setReusable(quota.reusable ?? false);\n setResetPeriod(quota.resetPeriod ?? QuotaResetPeriod.NEVER);\n setIsActive(quota.isActive ?? true);\n\n const limits = quota.limits as { type?: string; value?: number; unit?: string } | null;\n setLimitType(limits?.type ?? 'numeric');\n setLimitValue(String(limits?.value ?? ''));\n setUnit(limits?.unit ?? '');\n\n const ctx = quota.context as { displayName?: string; description?: string } | null;\n setDisplayName(ctx?.displayName ?? '');\n setDescription(ctx?.description ?? '');\n }\n }, [quota]);\n\n // Permission check\n if (!permissions.canManageQuotas) {\n return <AccessDenied message=\"You don't have permission to edit quotas.\" />;\n }\n\n // Loading state\n if (isQuotaLoading) {\n return (\n <div className=\"space-y-6 p-6\">\n <div className=\"h-8 w-48 bg-bg-sunken animate-pulse rounded\" />\n <div className=\"max-w-2xl space-y-4\">\n {[1, 2, 3, 4].map((i) => (\n <div key={i} className=\"h-16 bg-bg-sunken animate-pulse rounded\" />\n ))}\n </div>\n </div>\n );\n }\n\n // Error state\n if (quotaError && isServerError(quotaError)) {\n return (\n <div className=\"p-6\">\n <ServerError\n title=\"Server Unavailable\"\n message=\"Unable to load quota. The server might be down or experiencing issues.\"\n onRetry={() => refetch()}\n showRetry\n />\n </div>\n );\n }\n\n if (!quota) {\n return (\n <div className=\"flex items-center justify-center h-full min-h-[400px]\">\n <div className=\"text-center space-y-4\">\n <h2 className=\"text-lg font-semibold text-text-primary\">Quota not found</h2>\n <button\n type=\"button\"\n onClick={() => navigateTo('/quotas')}\n className=\"px-4 py-2 text-sm font-medium bg-action-primary-bg text-action-primary-text rounded-button hover:bg-action-primary-bgHover\"\n >\n Back to Quotas\n </button>\n </div>\n </div>\n );\n }\n\n const handleSubmit = async (e: FormEvent) => {\n e.preventDefault();\n setError(null);\n setSuccess(false);\n\n // Validation\n if (!name.trim()) {\n setError('Quota name is required');\n return;\n }\n if (!limitValue || isNaN(Number(limitValue)) || Number(limitValue) < 0) {\n setError('Valid limit value is required');\n return;\n }\n if (!unit.trim()) {\n setError('Unit is required (e.g., bots, GB, seats)');\n return;\n }\n\n const input: UpdateQuotaInput = {\n id: quotaId!,\n name: name.trim(),\n limits: {\n type: limitType,\n value: Number(limitValue),\n unit: unit.trim(),\n },\n reusable,\n isActive,\n resetPeriod,\n context: {\n displayName: displayName.trim() || name.trim(),\n description: description.trim(),\n },\n };\n\n try {\n await updateQuota(input);\n setSuccess(true);\n // Navigate back after short delay\n setTimeout(() => navigateTo(`/quotas/${quotaId}`), 1500);\n } catch (err) {\n setError(err instanceof Error ? err.message : 'Failed to update quota');\n }\n };\n\n return (\n <div className=\"space-y-6 p-6\">\n <PageHeader\n title={`Edit Quota: ${(quota.context as { displayName?: string } | null)?.displayName ?? quota.name}`}\n description=\"Update the quota template configuration\"\n />\n\n <PagePurpose>\n Adjust this quota template&apos;s configuration. Changes apply wherever the template is\n referenced, so review which plans and add-ons use it before changing its type or unit.\n </PagePurpose>\n\n <form onSubmit={handleSubmit} className=\"max-w-2xl space-y-6\">\n {/* Error/Success Messages */}\n {error && (\n <div className=\"p-4 bg-status-error-bg-subtle border border-border-subtle rounded-lg\">\n <p className=\"text-sm text-status-error-text\">{error}</p>\n </div>\n )}\n {success && (\n <div className=\"p-4 bg-status-success-bg-subtle border border-border-subtle rounded-lg\">\n <p className=\"text-sm text-status-success-text\">\n Quota updated successfully! Redirecting…\n </p>\n </div>\n )}\n\n {/* Basic Info */}\n <div className=\"border border-border-seam rounded-card bg-bg-surface overflow-hidden shadow-[var(--shadow-elevation-1)]\">\n <div className=\"p-4 border-b border-border-subtle bg-bg-sunken/30\">\n <h2 className=\"font-semibold text-text-primary\">Basic Information</h2>\n </div>\n <div className=\"p-4 space-y-4\">\n {/* Machine Key (name) */}\n <div>\n <label htmlFor=\"name\" className=\"block text-sm font-medium text-text-primary mb-1\">\n Quota Key *\n </label>\n <input\n id=\"name\"\n type=\"text\"\n value={name}\n onChange={(e) => setName(e.target.value)}\n className=\"w-full px-3 py-2 border border-border-subtle rounded-input bg-bg-surface text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)] font-mono text-sm\"\n placeholder=\"e.g., sessions-started, tunnels-created\"\n required\n />\n <p className=\"text-xs text-text-muted mt-1\">\n Internal machine key, must match the <code>quotaName</code> used in{' '}\n <code>@usage</code> directives. Never shown to users.\n </p>\n </div>\n\n {/* Display Name */}\n <div>\n <label\n htmlFor=\"displayName\"\n className=\"block text-sm font-medium text-text-primary mb-1\"\n >\n Display Name *\n </label>\n <input\n id=\"displayName\"\n type=\"text\"\n value={displayName}\n onChange={(e) => setDisplayName(e.target.value)}\n className=\"w-full px-3 py-2 border border-border-subtle rounded-input bg-bg-surface text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]\"\n placeholder=\"e.g., Tunnels, Session Starts, Webhooks\"\n required\n />\n <p className=\"text-xs text-text-muted mt-1\">\n Human-readable name shown to users in billing and usage UI.\n </p>\n </div>\n\n {/* Description */}\n <div>\n <label\n htmlFor=\"description\"\n className=\"block text-sm font-medium text-text-primary mb-1\"\n >\n Description\n </label>\n <textarea\n id=\"description\"\n value={description}\n onChange={(e) => setDescription(e.target.value)}\n rows={2}\n className=\"w-full px-3 py-2 border border-border-subtle rounded-input bg-bg-surface text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)] resize-none\"\n placeholder=\"e.g., Active tunnels created through VibeControls (slot freed on delete)\"\n />\n <p className=\"text-xs text-text-muted mt-1\">\n Short explanation shown in billing and usage detail views.\n </p>\n </div>\n\n {/* Quota Type (read-only) */}\n <div>\n <label className=\"block text-sm font-medium text-text-primary mb-1\">Quota Type</label>\n <div className=\"px-3 py-2 border border-border-subtle rounded-md bg-bg-sunken/50 text-text-muted\">\n {quota.quotaType === 'POOLED' ? 'Pooled' : 'Product Specific'}\n <span className=\"text-xs ml-2\">(cannot be changed)</span>\n </div>\n </div>\n\n {/* Reusable */}\n <div className=\"flex items-center gap-3\">\n <input\n id=\"reusable\"\n type=\"checkbox\"\n checked={reusable}\n onChange={(e) => setReusable(e.target.checked)}\n className=\"size-4 rounded border-border-subtle text-text-link focus:ring-[var(--color-focus-ring)]\"\n />\n <div>\n <label htmlFor=\"reusable\" className=\"text-sm font-medium text-text-primary\">\n Reusable Quota\n </label>\n <p className=\"text-xs text-text-muted\">\n Enable for quotas like seats or bots that can be freed up\n </p>\n </div>\n </div>\n\n {/* Reset Period */}\n <div>\n <label\n htmlFor=\"resetPeriod\"\n className=\"block text-sm font-medium text-text-primary mb-1\"\n >\n Reset Period\n </label>\n <ThemedSelect\n id=\"resetPeriod\"\n value={resetPeriod}\n onChange={(e) => setResetPeriod(e.target.value as QuotaResetPeriod)}\n className=\"w-full px-3 py-2 border border-border-subtle rounded-input bg-bg-surface text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)] scheme-normal dark:scheme-dark [&_option]:bg-bg-surface [&_option]:text-text-primary\"\n >\n <option value={QuotaResetPeriod.NEVER}>Never (one-time limit)</option>\n <option value={QuotaResetPeriod.DAILY}>Daily (resets every day)</option>\n <option value={QuotaResetPeriod.MONTHLY}>Monthly (resets every month)</option>\n </ThemedSelect>\n <p className=\"text-xs text-text-muted mt-1\">\n How often the quota usage counter is reset to zero\n </p>\n </div>\n\n {/* Status */}\n <div className=\"flex items-center gap-3\">\n <input\n id=\"isActive\"\n type=\"checkbox\"\n checked={isActive}\n onChange={(e) => setIsActive(e.target.checked)}\n className=\"size-4 rounded border-border-subtle text-text-link focus:ring-[var(--color-focus-ring)]\"\n />\n <label htmlFor=\"isActive\" className=\"text-sm font-medium text-text-primary\">\n Quota is active\n </label>\n </div>\n </div>\n </div>\n\n {/* Limits Configuration */}\n <div className=\"border border-border-seam rounded-card bg-bg-surface overflow-hidden shadow-[var(--shadow-elevation-1)]\">\n <div className=\"p-4 border-b border-border-subtle bg-bg-sunken/30\">\n <h2 className=\"font-semibold text-text-primary\">Limits Configuration</h2>\n </div>\n <div className=\"p-4 space-y-4\">\n {/* Limit Type */}\n <div>\n <label\n htmlFor=\"limitType\"\n className=\"block text-sm font-medium text-text-primary mb-1\"\n >\n Limit Type *\n </label>\n <ThemedSelect\n id=\"limitType\"\n value={limitType}\n onChange={(e) => setLimitType(e.target.value)}\n className=\"w-full px-3 py-2 border border-border-subtle rounded-input bg-bg-surface text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)] scheme-normal dark:scheme-dark [&_option]:bg-bg-surface [&_option]:text-text-primary\"\n >\n <option value=\"numeric\">Numeric (count)</option>\n <option value=\"storage\">Storage (bytes)</option>\n <option value=\"duration\">Duration (seconds)</option>\n <option value=\"percentage\">Percentage</option>\n </ThemedSelect>\n </div>\n\n {/* Limit Value */}\n <div>\n <label\n htmlFor=\"limitValue\"\n className=\"block text-sm font-medium text-text-primary mb-1\"\n >\n Limit Value *\n </label>\n <input\n id=\"limitValue\"\n type=\"number\"\n min=\"0\"\n value={limitValue}\n onChange={(e) => setLimitValue(e.target.value)}\n className=\"w-full px-3 py-2 border border-border-subtle rounded-input bg-bg-surface text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]\"\n placeholder=\"1000\"\n required\n />\n <p className=\"text-xs text-text-muted mt-1\">The maximum limit value for this quota</p>\n </div>\n\n {/* Unit */}\n <div>\n <label htmlFor=\"unit\" className=\"block text-sm font-medium text-text-primary mb-1\">\n Unit *\n </label>\n <input\n id=\"unit\"\n type=\"text\"\n value={unit}\n onChange={(e) => setUnit(e.target.value)}\n className=\"w-full px-3 py-2 border border-border-subtle rounded-input bg-bg-surface text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]\"\n placeholder=\"e.g., bots, GB, MB, seats, workflow runs\"\n required\n />\n <p className=\"text-xs text-text-muted mt-1\">\n The unit of measurement displayed with usage values (e.g., &quot;2/6 bots&quot;)\n </p>\n </div>\n </div>\n </div>\n\n {/* Actions */}\n <div className=\"flex items-center gap-3 pt-4\">\n <button\n type=\"submit\"\n disabled={isUpdating}\n className=\"px-6 py-2 text-sm font-medium bg-action-primary-bg text-action-primary-text rounded-button hover:bg-action-primary-bgHover transition-colors disabled:opacity-50\"\n >\n {isUpdating\n ? tr('billing.quota.saving', 'Saving...')\n : tr('billing.quota.saveChanges', 'Save Changes')}\n </button>\n <button\n type=\"button\"\n onClick={() => navigateTo(`/quotas/${quotaId}`)}\n className=\"px-6 py-2 text-sm font-medium border border-border-subtle text-text-primary rounded-button hover:bg-bg-sunken transition-colors\"\n >\n Cancel\n </button>\n </div>\n </form>\n </div>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;AAgBA,IAAaA,UAAkC;CAC7C,IAAM,EAAE,SAAMC,EAAQ,GAChBC,KAAM,GAAa,MAA6B;EACpD,IAAMC,IAAaC,EAAEC,CAAG;EACxB,OAAOF,MAAeE,IAAMC,IAAWH;CACzC,GACM,EAAE,eAAYI,EAA+B,GAC7CC,IAAaC,EAAmB,GAChCC,IAAcC,EAAsB,GACpC,EACJ,UACA,WAAWC,GACX,OAAOC,GACP,eACEC,EAAiBC,CAAO,GACtB,EAAE,gBAAa,kBAAeC,EAA0B,GAGxD,CAACC,GAAMC,KAAWC,EAAS,EAAE,GAC7B,CAACC,GAAaC,KAAkBF,EAAS,EAAE,GAC3C,CAACG,GAAaC,KAAkBJ,EAAS,EAAE,GAC3C,CAACK,GAAWC,KAAgBN,EAAS,SAAS,GAC9C,CAACO,GAAYC,KAAiBR,EAAS,EAAE,GACzC,CAACS,GAAMC,KAAWV,EAAS,EAAE,GAC7B,CAACW,GAAUC,KAAeZ,EAAS,EAAK,GACxC,CAACa,GAAaC,KAAkBd,EAA2Be,EAAiB,KAAK,GACjF,CAACC,GAAUC,KAAejB,EAAS,EAAI,GACvC,CAACkB,GAAOC,KAAYnB,EAA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ACV,WAAU;OAET,UAAAA,IACGrD,EAAG,wBAAwB,WAAW,IACtCA,EAAG,6BAA6B,cAAc;MAC5C,CAAA,GACR,kBAAC,UAAD;OACE,MAAK;OACL,eAAeM,EAAW,WAAWO,GAAS;OAC9C,WAAU;OACX,UAAA;MAEO,CAAA,CACL;;IACD;;EACH;C,KAzTH,kBAAC,OAAD;EAAK,WAAU;EACb,UAAA,kBAAC,OAAD;GAAK,WAAU;GAAf,UAAA,CACE,kBAAC,MAAD;IAAI,WAAU;IAA0C,UAAA;GAAmB,CAAA,GAC3E,kBAAC,UAAD;IACE,MAAK;IACL,eAAeP,EAAW,SAAS;IACnC,WAAU;IACX,UAAA;GAEO,CAAA,CACL;;CACF,CAAA,IA5CA,kBAACgD,GAAD,EAAc,SAAQ,4CAA6C,CAAA;AA4V9E"}
@@ -1,67 +1,67 @@
1
1
  import { EMPTY_SETTINGS_FORM as e, formFromAccount as t, hasFormChanges as n, toUpdateInput as ee } from "../utils/accountForm.js";
2
2
  import { useIsFluidgridsVariant as te } from "../../../hooks/useBillingVariant.js";
3
- import { AccessDenied as r } from "../../../shared/components/AccessDenied.js";
4
- import { PageHeader as ne } from "../../../shared/components/PageHeader.js";
5
- import { useBillingEventEmitter as re } from "../../../hooks/useBillingEventEmitter.js";
6
- import { useBillingPermissions as ie } from "../../../hooks/useBillingPermissions.js";
3
+ import { AccessDenied as ne } from "../../../shared/components/AccessDenied.js";
4
+ import { PageHeader as re } from "../../../shared/components/PageHeader.js";
5
+ import { useBillingEventEmitter as ie } from "../../../hooks/useBillingEventEmitter.js";
6
+ import { useBillingPermissions as r } from "../../../hooks/useBillingPermissions.js";
7
7
  import { useBilling as ae } from "../../../providers/BillingProvider.js";
8
8
  import "../../../shared/components/index.js";
9
9
  import { directBillingGraphqlRequest as oe } from "../../../shared/utils/directBillingGraphql.js";
10
10
  import { TeamPermissionsPage as se } from "./TeamPermissionsPage.js";
11
11
  import "../../../shared/utils/index.js";
12
- import { ArchiveBillingAccountSettingsDocument as ce, useGetBillingAccountSettingsQuery as le, useGetBillingAccountsSettingsQuery as ue, useGetDefaultBillingAccountSettingsQuery as de, useSetDefaultBillingAccountSettingsMutation as fe, useUpdateBillingAccountSettingsMutation as pe } from "../../../../generated/global-operations.js";
13
- import { useTr as me } from "../../../shared/hooks/useTr.js";
14
- import { useCallback as i, useEffect as he, useMemo as a, useState as o } from "react";
15
- import { AccessGate as s, AlertDialog as c, AlertDialogAction as ge, AlertDialogCancel as _e, AlertDialogContent as ve, AlertDialogDescription as ye, AlertDialogFooter as be, AlertDialogHeader as xe, AlertDialogTitle as Se, OptionalFields as Ce, PagePurpose as we } from "@burdenoff/fe-libs/ui";
12
+ import { ArchiveBillingAccountSettingsDocument as ce, useGetBillingAccountSettingsQuery as le, useGetBillingAccountsSettingsQuery as ue, useGetDefaultBillingAccountSettingsQuery as i, useSetDefaultBillingAccountSettingsMutation as a, useUpdateBillingAccountSettingsMutation as de } from "../../../../generated/global-operations.js";
13
+ import { useTr as fe } from "../../../shared/hooks/useTr.js";
14
+ import { useCallback as o, useEffect as pe, useMemo as s, useState as c } from "react";
15
+ import { AccessGate as me, AlertDialog as he, AlertDialogAction as ge, AlertDialogCancel as _e, AlertDialogContent as ve, AlertDialogDescription as ye, AlertDialogFooter as be, AlertDialogHeader as xe, AlertDialogTitle as Se, OptionalFields as Ce, PagePurpose as we, ThemedSelect as Te } from "@burdenoff/fe-libs/ui";
16
16
  import { Fragment as l, jsx as u, jsxs as d } from "react/jsx-runtime";
17
17
  // src/billing/modules/settings/pages/SettingsPage.tsx
18
- var Te = () => {
18
+ var Ee = () => {
19
19
  if (typeof window < "u") return new URLSearchParams(window.location.search).get("billingAccountId") || void 0;
20
20
  }, f = () => {
21
- let f = me(), p = ie(), m = te(), { apiGatewayUrl: h, authToken: g, orgId: _ } = ae(), { emit: v } = re(), [y, b] = o(Te), [x, S] = o(!1), [C, w] = o(!1), [T, E] = o(!1), [D, O] = o(!1), [k, A] = o(null), [Ee, j] = o(!1), [De, M] = o(!1), [Oe, N] = o(!1), [P, F] = o(e), { data: I, loading: ke, refetch: L } = ue({}), R = a(() => I?.getBillingAccountsByOrg || [], [I?.getBillingAccountsByOrg]), { data: Ae, loading: je, refetch: z } = de({}), B = Ae?.getDefaultBillingAccount || null, { data: Me, loading: V, refetch: H } = le({
21
+ let f = fe(), p = r(), m = te(), { apiGatewayUrl: h, authToken: g, orgId: _ } = ae(), { emit: v } = ie(), [y, b] = c(Ee), [x, S] = c(!1), [C, w] = c(!1), [T, E] = c(!1), [D, O] = c(!1), [k, A] = c(null), [De, j] = c(!1), [Oe, M] = c(!1), [N, P] = c(!1), [F, I] = c(e), { data: L, loading: ke, refetch: R } = ue({}), z = s(() => L?.getBillingAccountsByOrg || [], [L?.getBillingAccountsByOrg]), { data: Ae, loading: je, refetch: B } = i({}), V = Ae?.getDefaultBillingAccount || null, { data: Me, loading: H, refetch: U } = le({
22
22
  variables: { id: y },
23
23
  skip: !y
24
- }), U = Me?.getBillingAccount || null, [W] = pe(), [G] = fe(), K = a(() => {
24
+ }), W = Me?.getBillingAccount || null, [G] = de(), [K] = a(), q = s(() => {
25
25
  if (y) {
26
- if (U) return U;
27
- let e = R.find((e) => e.id === y);
26
+ if (W) return W;
27
+ let e = z.find((e) => e.id === y);
28
28
  if (e) return e;
29
- if (V) return null;
29
+ if (H) return null;
30
30
  }
31
- return B;
31
+ return V;
32
32
  }, [
33
33
  y,
34
- U,
35
- R,
36
- V,
37
- B
38
- ]), Ne = ke || je || y && V;
39
- he(() => {
40
- K && F(t(K));
41
- }, [K]);
34
+ W,
35
+ z,
36
+ H,
37
+ V
38
+ ]), Ne = ke || je || y && H;
39
+ pe(() => {
40
+ q && I(t(q));
41
+ }, [q]);
42
42
  let Pe = (e) => {
43
43
  b(e.id), S(!1), j(!1), A(null);
44
- }, q = (e, t) => {
45
- F((n) => ({
44
+ }, J = (e, t) => {
45
+ I((n) => ({
46
46
  ...n,
47
47
  [e]: t
48
48
  })), j(!1), A(null);
49
- }, J = a(() => R.find((e) => e.isDefault) || null, [R]), Y = a(() => n(P, K), [P, K]), X = P.isDefault && !K?.isDefault, Z = X && J && J.id !== K?.id, Q = i(async () => {
50
- if (K?.id) {
51
- w(!0), A(null), j(!1), M(!1), N(!1);
49
+ }, Y = s(() => z.find((e) => e.isDefault) || null, [z]), Fe = s(() => n(F, q), [F, q]), X = F.isDefault && !q?.isDefault, Z = X && Y && Y.id !== q?.id, Q = o(async () => {
50
+ if (q?.id) {
51
+ w(!0), A(null), j(!1), M(!1), P(!1);
52
52
  try {
53
- await W({ variables: { input: ee(K.id, P) } }), v("billing.billing_account.updated", {
53
+ await G({ variables: { input: ee(q.id, F) } }), v("billing.billing_account.updated", {
54
54
  route: "/billing/settings",
55
- entityId: K.id,
55
+ entityId: q.id,
56
56
  source: "settings"
57
- }), X && (await G({
58
- variables: { id: K.id },
57
+ }), X && (await K({
58
+ variables: { id: q.id },
59
59
  refetchQueries: ["GetBillingAccountsByTenant", "GetDefaultBillingAccount"]
60
60
  }), v("billing.billing_account.updated", {
61
61
  route: "/billing/settings",
62
- entityId: K.id,
62
+ entityId: q.id,
63
63
  source: "settings.default"
64
- })), y ? await H() : await z(), j(!0), setTimeout(() => j(!1), 3e3);
64
+ })), y ? await U() : await B(), j(!0), setTimeout(() => j(!1), 3e3);
65
65
  } catch (e) {
66
66
  A(e instanceof Error ? e.message : "Failed to save changes");
67
67
  } finally {
@@ -69,26 +69,26 @@ var Te = () => {
69
69
  }
70
70
  }
71
71
  }, [
72
- K?.id,
73
- P,
72
+ q?.id,
73
+ F,
74
74
  X,
75
- W,
76
75
  G,
76
+ K,
77
77
  y,
78
- H,
79
- z,
78
+ U,
79
+ B,
80
80
  v
81
- ]), Fe = i(() => {
82
- K?.id && (Z ? (N(!0), M(!0)) : Q());
81
+ ]), Ie = o(() => {
82
+ q?.id && (Z ? (P(!0), M(!0)) : Q());
83
83
  }, [
84
- K?.id,
84
+ q?.id,
85
85
  Z,
86
86
  Q
87
- ]), $ = a(() => K ? R.find((e) => e.id !== K.id && e.isActive) : void 0, [K, R]), Ie = K ? K.isDefault ? $ ? f("billing.settings.archiveDefaultConfirm", "Archive {{accountName}}? {{replacementName}} will become the default account.", {
88
- accountName: K.name,
87
+ ]), $ = s(() => q ? z.find((e) => e.id !== q.id && e.isActive) : void 0, [q, z]), Le = q ? q.isDefault ? $ ? f("billing.settings.archiveDefaultConfirm", "Archive {{accountName}}? {{replacementName}} will become the default account.", {
88
+ accountName: q.name,
89
89
  replacementName: $.name
90
- }) : f("billing.settings.archiveDefaultNoReplacementConfirm", "Archive {{accountName}}? No replacement default account is available.", { accountName: K.name }) : f("billing.settings.archiveConfirm", "Archive {{accountName}}?", { accountName: K.name }) : "", Le = i(async () => {
91
- if (K?.id && K.isActive) {
90
+ }) : f("billing.settings.archiveDefaultNoReplacementConfirm", "Archive {{accountName}}? No replacement default account is available.", { accountName: q.name }) : f("billing.settings.archiveConfirm", "Archive {{accountName}}?", { accountName: q.name }) : "", Re = o(async () => {
91
+ if (q?.id && q.isActive) {
92
92
  E(!0), A(null), j(!1);
93
93
  try {
94
94
  await oe({
@@ -97,15 +97,15 @@ var Te = () => {
97
97
  orgId: _,
98
98
  query: ce,
99
99
  variables: {
100
- id: K.id,
100
+ id: q.id,
101
101
  reason: "Archived from billing settings",
102
- replacementDefaultBillingAccountId: K.isDefault ? $?.id ?? null : null
102
+ replacementDefaultBillingAccountId: q.isDefault ? $?.id ?? null : null
103
103
  }
104
104
  }), v("billing.billing_account.archived", {
105
105
  route: "/billing/settings",
106
- entityId: K.id,
106
+ entityId: q.id,
107
107
  source: "settings"
108
- }), await Promise.all([L(), z()]), b($?.id), j(!0), setTimeout(() => j(!1), 3e3);
108
+ }), await Promise.all([R(), B()]), b($?.id), j(!0), setTimeout(() => j(!1), 3e3);
109
109
  } catch (e) {
110
110
  A(e instanceof Error ? e.message : "Failed to archive billing account");
111
111
  } finally {
@@ -115,14 +115,14 @@ var Te = () => {
115
115
  }, [
116
116
  h,
117
117
  g,
118
- K,
118
+ q,
119
119
  $,
120
120
  _,
121
- L,
122
- z,
121
+ R,
122
+ B,
123
123
  v
124
124
  ]);
125
- return p.canManageBillingAccount ? Ne && !K ? /* @__PURE__ */ d("div", {
125
+ return p.canManageBillingAccount ? Ne && !q ? /* @__PURE__ */ d("div", {
126
126
  className: "space-y-6 p-6",
127
127
  children: [/* @__PURE__ */ u("div", { className: "h-8 w-48 bg-bg-sunken animate-pulse rounded" }), /* @__PURE__ */ u("div", {
128
128
  className: "border border-border-subtle rounded-lg p-6 space-y-4",
@@ -135,12 +135,12 @@ var Te = () => {
135
135
  }) : /* @__PURE__ */ d("div", {
136
136
  className: "space-y-6 p-6",
137
137
  children: [
138
- /* @__PURE__ */ u(ne, {
138
+ /* @__PURE__ */ u(re, {
139
139
  title: f("billing.settings.billingSettings", "Billing Settings"),
140
140
  description: f("billing.settings.description", "Manage your billing account configuration")
141
141
  }),
142
142
  /* @__PURE__ */ u(we, { children: f("billing.settings.purpose", "Configure how a billing account behaves — its name and contact details, default currency, tax information and whether it's your default account. Changes here affect how invoices are generated and which account new purchases bill to.") }),
143
- R.length > 1 && /* @__PURE__ */ d("div", {
143
+ z.length > 1 && /* @__PURE__ */ d("div", {
144
144
  className: "relative",
145
145
  children: [/* @__PURE__ */ d("button", {
146
146
  type: "button",
@@ -166,10 +166,10 @@ var Te = () => {
166
166
  className: "text-left",
167
167
  children: [/* @__PURE__ */ u("p", {
168
168
  className: "text-sm font-medium text-text-primary",
169
- children: K?.name || f("billing.settings.selectAccount", "Select Account")
169
+ children: q?.name || f("billing.settings.selectAccount", "Select Account")
170
170
  }), /* @__PURE__ */ u("p", {
171
171
  className: "text-xs text-text-secondary",
172
- children: K?.email
172
+ children: q?.email
173
173
  })]
174
174
  })]
175
175
  }), /* @__PURE__ */ u("svg", {
@@ -189,7 +189,7 @@ var Te = () => {
189
189
  onClick: () => S(!1)
190
190
  }), /* @__PURE__ */ u("div", {
191
191
  className: "absolute top-full left-0 right-0 sm:right-auto mt-1 w-full sm:w-80 bg-popover border border-border-subtle rounded-lg shadow-lg z-20 py-1 max-h-60 overflow-y-auto",
192
- children: R.map((e) => /* @__PURE__ */ d("button", {
192
+ children: z.map((e) => /* @__PURE__ */ d("button", {
193
193
  type: "button",
194
194
  onClick: () => Pe(e),
195
195
  className: "w-full flex items-center justify-between gap-3 px-4 py-3 hover:bg-bg-sunken transition-colors",
@@ -219,7 +219,7 @@ var Te = () => {
219
219
  children: e.email
220
220
  })]
221
221
  })]
222
- }), K?.id === e.id && /* @__PURE__ */ u("svg", {
222
+ }), q?.id === e.id && /* @__PURE__ */ u("svg", {
223
223
  className: "size-4 text-primary flex-shrink-0",
224
224
  fill: "none",
225
225
  viewBox: "0 0 24 24",
@@ -246,7 +246,7 @@ var Te = () => {
246
246
  }), /* @__PURE__ */ u("p", {
247
247
  className: "text-sm text-text-secondary mt-1",
248
248
  children: f("billing.settings.accountInfoDescription", "Update your billing contact details and tax information")
249
- })] }), K?.isDefault && /* @__PURE__ */ d("span", {
249
+ })] }), q?.isDefault && /* @__PURE__ */ d("span", {
250
250
  className: "inline-flex items-center gap-1.5 px-2.5 py-1 text-xs font-medium bg-action-primary-bg/10 text-primary rounded-full",
251
251
  children: [/* @__PURE__ */ u("svg", {
252
252
  className: "size-3",
@@ -263,15 +263,15 @@ var Te = () => {
263
263
  }), /* @__PURE__ */ d("div", {
264
264
  className: "p-6 space-y-6",
265
265
  children: [
266
- K && /* @__PURE__ */ d("div", {
266
+ q && /* @__PURE__ */ d("div", {
267
267
  className: "grid grid-cols-2 sm:grid-cols-4 gap-4 text-sm pb-4 border-b border-border-subtle",
268
268
  children: [
269
269
  /* @__PURE__ */ d("div", { children: [/* @__PURE__ */ u("p", {
270
270
  className: "text-text-secondary",
271
271
  children: f("billing.settings.status", "Status")
272
272
  }), /* @__PURE__ */ u("p", {
273
- className: `font-medium ${K.isActive ? "text-status-success-text" : "text-status-error-text"}`,
274
- children: K.isActive ? f("billing.settings.active", "Active") : f("billing.settings.inactive", "Inactive")
273
+ className: `font-medium ${q.isActive ? "text-status-success-text" : "text-status-error-text"}`,
274
+ children: q.isActive ? f("billing.settings.active", "Active") : f("billing.settings.inactive", "Inactive")
275
275
  })] }),
276
276
  /* @__PURE__ */ d("div", { children: [/* @__PURE__ */ u("p", {
277
277
  className: "text-text-secondary",
@@ -279,7 +279,7 @@ var Te = () => {
279
279
  }), /* @__PURE__ */ d("p", {
280
280
  className: "font-medium text-text-primary",
281
281
  children: [
282
- (K.creditAmount || 0).toLocaleString(),
282
+ (q.creditAmount || 0).toLocaleString(),
283
283
  " ",
284
284
  f("billing.common.credits", "Credits")
285
285
  ]
@@ -289,15 +289,15 @@ var Te = () => {
289
289
  children: f("billing.settings.accountId", "Account ID")
290
290
  }), /* @__PURE__ */ u("p", {
291
291
  className: "font-mono text-xs text-text-primary truncate",
292
- title: K.id,
293
- children: K.id
292
+ title: q.id,
293
+ children: q.id
294
294
  })] }),
295
295
  /* @__PURE__ */ d("div", { children: [/* @__PURE__ */ u("p", {
296
296
  className: "text-text-secondary",
297
297
  children: f("billing.settings.created", "Created")
298
298
  }), /* @__PURE__ */ u("p", {
299
299
  className: "font-medium text-text-primary",
300
- children: K.createdAt ? new Date(K.createdAt).toLocaleDateString() : f("billing.settings.notAvailable", "N/A")
300
+ children: q.createdAt ? new Date(q.createdAt).toLocaleDateString() : f("billing.settings.notAvailable", "N/A")
301
301
  })] })
302
302
  ]
303
303
  }),
@@ -320,8 +320,8 @@ var Te = () => {
320
320
  }), /* @__PURE__ */ u("input", {
321
321
  id: "billing-account-name",
322
322
  type: "text",
323
- value: P.name,
324
- onChange: (e) => q("name", e.target.value),
323
+ value: F.name,
324
+ onChange: (e) => J("name", e.target.value),
325
325
  className: "w-full px-3 py-2 text-sm border border-border-subtle rounded-md bg-bg-surface text-text-primary focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent"
326
326
  })] }), /* @__PURE__ */ d("div", { children: [/* @__PURE__ */ d("label", {
327
327
  htmlFor: "billing-account-email",
@@ -337,8 +337,8 @@ var Te = () => {
337
337
  }), /* @__PURE__ */ u("input", {
338
338
  id: "billing-account-email",
339
339
  type: "email",
340
- value: P.email,
341
- onChange: (e) => q("email", e.target.value),
340
+ value: F.email,
341
+ onChange: (e) => J("email", e.target.value),
342
342
  className: "w-full px-3 py-2 text-sm border border-border-subtle rounded-md bg-bg-surface text-text-primary focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent"
343
343
  })] })]
344
344
  })] }),
@@ -361,8 +361,8 @@ var Te = () => {
361
361
  /* @__PURE__ */ u("input", {
362
362
  id: "billing-account-billing-email",
363
363
  type: "email",
364
- value: P.billingEmail,
365
- onChange: (e) => q("billingEmail", e.target.value),
364
+ value: F.billingEmail,
365
+ onChange: (e) => J("billingEmail", e.target.value),
366
366
  placeholder: f("billing.settings.billingEmailPlaceholder", "Optional - defaults to account email"),
367
367
  className: "w-full px-3 py-2 text-sm border border-border-subtle rounded-md bg-bg-surface text-text-primary placeholder:text-text-secondary focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent"
368
368
  }),
@@ -375,10 +375,10 @@ var Te = () => {
375
375
  htmlFor: "billing-account-currency",
376
376
  className: "block text-sm font-medium text-text-primary mb-1",
377
377
  children: f("billing.settings.currency", "Currency")
378
- }), /* @__PURE__ */ d("select", {
378
+ }), /* @__PURE__ */ d(Te, {
379
379
  id: "billing-account-currency",
380
- value: P.currency,
381
- onChange: (e) => q("currency", e.target.value),
380
+ value: F.currency,
381
+ onChange: (e) => J("currency", e.target.value),
382
382
  className: "w-full px-3 py-2 text-sm border border-border-subtle rounded-md bg-bg-surface text-text-primary focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent scheme-normal dark:scheme-dark [&_option]:bg-bg-surface [&_option]:text-text-primary",
383
383
  children: [
384
384
  /* @__PURE__ */ u("option", {
@@ -410,8 +410,8 @@ var Te = () => {
410
410
  /* @__PURE__ */ u("input", {
411
411
  id: "billing-account-tax-id",
412
412
  type: "text",
413
- value: P.taxId,
414
- onChange: (e) => q("taxId", e.target.value),
413
+ value: F.taxId,
414
+ onChange: (e) => J("taxId", e.target.value),
415
415
  placeholder: f("billing.settings.taxIdPlaceholder", "Enter your tax identification number"),
416
416
  className: "w-full px-3 py-2 text-sm border border-border-subtle rounded-md bg-bg-surface text-text-primary placeholder:text-text-secondary focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent"
417
417
  }),
@@ -424,7 +424,7 @@ var Te = () => {
424
424
  ]
425
425
  })
426
426
  }),
427
- K?.isActive && R.length > 1 && /* @__PURE__ */ u("div", {
427
+ q?.isActive && z.length > 1 && /* @__PURE__ */ u("div", {
428
428
  className: "pt-4 border-t border-border-subtle",
429
429
  children: /* @__PURE__ */ d("div", {
430
430
  className: "flex items-start gap-3",
@@ -433,12 +433,12 @@ var Te = () => {
433
433
  children: /* @__PURE__ */ u("input", {
434
434
  type: "checkbox",
435
435
  id: "isDefault",
436
- checked: P.isDefault,
437
- onChange: (e) => F((t) => ({
436
+ checked: F.isDefault,
437
+ onChange: (e) => I((t) => ({
438
438
  ...t,
439
439
  isDefault: e.target.checked
440
440
  })),
441
- disabled: K?.isDefault,
441
+ disabled: q?.isDefault,
442
442
  className: "size-4 rounded border-border-subtle text-primary focus:ring-primary focus:ring-offset-0 disabled:opacity-50 disabled:cursor-not-allowed"
443
443
  })
444
444
  }), /* @__PURE__ */ d("div", {
@@ -449,7 +449,7 @@ var Te = () => {
449
449
  children: f("billing.settings.setDefault", "Set as default billing account")
450
450
  }), /* @__PURE__ */ u("p", {
451
451
  className: "text-xs text-text-secondary mt-0.5",
452
- children: K?.isDefault ? f("billing.settings.currentDefaultDescription", "This is currently your default billing account") : f("billing.settings.makePrimaryDescription", "Make this your primary billing account for new subscriptions")
452
+ children: q?.isDefault ? f("billing.settings.currentDefaultDescription", "This is currently your default billing account") : f("billing.settings.makePrimaryDescription", "Make this your primary billing account for new subscriptions")
453
453
  })]
454
454
  })]
455
455
  })
@@ -458,7 +458,7 @@ var Te = () => {
458
458
  className: "pt-4 border-t border-border-subtle flex items-center justify-between",
459
459
  children: [/* @__PURE__ */ d("div", {
460
460
  className: "flex items-center gap-2",
461
- children: [Ee && /* @__PURE__ */ d("div", {
461
+ children: [De && /* @__PURE__ */ d("div", {
462
462
  className: "flex items-center gap-2 text-sm text-status-success-text",
463
463
  children: [/* @__PURE__ */ u("svg", {
464
464
  className: "size-4",
@@ -489,7 +489,7 @@ var Te = () => {
489
489
  })]
490
490
  }), /* @__PURE__ */ d("div", {
491
491
  className: "flex items-center gap-3",
492
- children: [p.canArchiveBillingAccount && K?.isActive ? /* @__PURE__ */ u("button", {
492
+ children: [p.canArchiveBillingAccount && q?.isActive ? /* @__PURE__ */ u("button", {
493
493
  type: "button",
494
494
  onClick: () => O(!0),
495
495
  disabled: C || T,
@@ -497,8 +497,8 @@ var Te = () => {
497
497
  children: T ? f("billing.settings.archiving", "Archiving...") : f("billing.settings.archiveAccount", "Archive Account")
498
498
  }) : null, /* @__PURE__ */ d("button", {
499
499
  type: "button",
500
- onClick: Fe,
501
- disabled: !Y || C || T || !P.name || !P.email,
500
+ onClick: Ie,
501
+ disabled: !Fe || C || T || !F.name || !F.email,
502
502
  className: "px-4 py-2 text-sm font-medium bg-action-primary-bg text-action-primary-text rounded-md hover:bg-action-primary-bg/90 disabled:opacity-50 disabled:cursor-not-allowed transition-colors flex items-center gap-2",
503
503
  children: [C && /* @__PURE__ */ d("svg", {
504
504
  className: "size-4 animate-spin",
@@ -523,12 +523,12 @@ var Te = () => {
523
523
  ]
524
524
  })]
525
525
  }),
526
- De && Oe && /* @__PURE__ */ d(l, { children: [/* @__PURE__ */ u("div", {
526
+ Oe && N && /* @__PURE__ */ d(l, { children: [/* @__PURE__ */ u("div", {
527
527
  className: "fixed inset-0 bg-overlay-scrim z-40",
528
528
  onClick: () => {
529
- C || (M(!1), N(!1), F((e) => ({
529
+ C || (M(!1), P(!1), I((e) => ({
530
530
  ...e,
531
- isDefault: K?.isDefault || !1
531
+ isDefault: q?.isDefault || !1
532
532
  })));
533
533
  }
534
534
  }), /* @__PURE__ */ u("div", {
@@ -542,9 +542,9 @@ var Te = () => {
542
542
  }),
543
543
  /* @__PURE__ */ u("p", {
544
544
  className: "text-sm text-text-secondary mb-4",
545
- children: f("billing.settings.confirmDefaultDescription", "You are about to set {{accountName}} as your default billing account and save your changes.", { accountName: K?.name ?? "" })
545
+ children: f("billing.settings.confirmDefaultDescription", "You are about to set {{accountName}} as your default billing account and save your changes.", { accountName: q?.name ?? "" })
546
546
  }),
547
- J && J.id !== K?.id && /* @__PURE__ */ u("div", {
547
+ Y && Y.id !== q?.id && /* @__PURE__ */ u("div", {
548
548
  className: "mb-4 p-3 bg-status-warning-bg-subtle border border-border-subtle rounded-md",
549
549
  children: /* @__PURE__ */ d("div", {
550
550
  className: "flex items-start gap-2",
@@ -566,7 +566,7 @@ var Te = () => {
566
566
  children: f("billing.settings.currentDefaultWillChange", "Current default will change")
567
567
  }), /* @__PURE__ */ u("p", {
568
568
  className: "text-status-warning-text mt-0.5",
569
- children: f("billing.settings.currentDefaultWillChangeDescription", "{{accountName}} will no longer be the default account.", { accountName: J.name })
569
+ children: f("billing.settings.currentDefaultWillChangeDescription", "{{accountName}} will no longer be the default account.", { accountName: Y.name })
570
570
  })]
571
571
  })]
572
572
  })
@@ -576,9 +576,9 @@ var Te = () => {
576
576
  children: [/* @__PURE__ */ u("button", {
577
577
  type: "button",
578
578
  onClick: () => {
579
- M(!1), N(!1), F((e) => ({
579
+ M(!1), P(!1), I((e) => ({
580
580
  ...e,
581
- isDefault: K?.isDefault || !1
581
+ isDefault: q?.isDefault || !1
582
582
  }));
583
583
  },
584
584
  disabled: C,
@@ -623,21 +623,21 @@ var Te = () => {
623
623
  children: f("billing.settings.teamPermissionsHint", "Control who can manage this billing account and what they can do.")
624
624
  })] }), /* @__PURE__ */ u(se, { embedded: !0 })]
625
625
  }) : null,
626
- /* @__PURE__ */ u(c, {
626
+ /* @__PURE__ */ u(he, {
627
627
  open: D,
628
628
  onOpenChange: O,
629
- children: /* @__PURE__ */ d(ve, { children: [/* @__PURE__ */ d(xe, { children: [/* @__PURE__ */ u(Se, { children: f("billing.settings.archiveDialogTitle", "Archive billing account?") }), /* @__PURE__ */ u(ye, { children: Ie })] }), /* @__PURE__ */ d(be, { children: [/* @__PURE__ */ u(_e, { children: f("billing.common.cancel", "Cancel") }), /* @__PURE__ */ u(ge, {
629
+ children: /* @__PURE__ */ d(ve, { children: [/* @__PURE__ */ d(xe, { children: [/* @__PURE__ */ u(Se, { children: f("billing.settings.archiveDialogTitle", "Archive billing account?") }), /* @__PURE__ */ u(ye, { children: Le })] }), /* @__PURE__ */ d(be, { children: [/* @__PURE__ */ u(_e, { children: f("billing.common.cancel", "Cancel") }), /* @__PURE__ */ u(ge, {
630
630
  onClick: () => {
631
- O(!1), Le();
631
+ O(!1), Re();
632
632
  },
633
633
  children: f("billing.settings.archiveAccount", "Archive Account")
634
634
  })] })] })
635
635
  })
636
636
  ]
637
- }) : m ? /* @__PURE__ */ u(s, {
637
+ }) : m ? /* @__PURE__ */ u(me, {
638
638
  message: f("billing.settings.needAccess", "You need access to billing settings"),
639
639
  granterHint: f("billing.settings.needAccessHint", "Ask a billing admin of this organization to give you access.")
640
- }) : /* @__PURE__ */ u(r, { message: f("billing.settings.noManagePermission", "You don't have permission to manage billing settings.") });
640
+ }) : /* @__PURE__ */ u(ne, { message: f("billing.settings.noManagePermission", "You don't have permission to manage billing settings.") });
641
641
  };
642
642
  export { f as SettingsPage };
643
643