@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
@@ -1 +1 @@
1
- {"version":3,"file":"PlanEditPage.js","names":["_Fragment","Fragment$1","PlanEditPage","useI18n","tr","translated","t","key","fallback","useParams","navigateTo","useBillingNavigate","permissions","useBillingPermissions","isPlanLoading","planError","usePlan","planId","isQuotasLoading","useQuotas","usePlanMutations","name","setName","useState","price","setPrice","currency","setCurrency","duration","setDuration","PlanDuration","isActive","setIsActive","isPurchasable","setIsPurchasable","quotaAllocations","setQuotaAllocations","currencyPriceOverrides","setCurrencyPriceOverrides","initialCurrencyPriceOverrides","setInitialCurrencyPriceOverrides","error","setError","success","setSuccess","useEffect","plan","existing","overrides","v","amount","allocations","quotaMap","feature","quotaId","value","getPlanFeatureQuantity","quantity","AccessDenied","i","isServerError","ServerError","refetch","handleAddQuota","handleRemoveQuota","index","handleQuotaChange","updated","field","PageHeader","PagePurpose","a","input","getChangedCurrencyPriceOverrides","updatePlan","err","selectedQuota","quotas","q","allocation","limitType","quota","CurrencyPriceOverridesEditor","isUpdating"],"sources":["../../../../../src/billing/modules/plans/pages/PlanEditPage.tsx"],"sourcesContent":["/**\n * Plans Module - Plan Edit Page\n * Form to edit an existing plan\n */\n\nimport { useState, useEffect, type FC, type FormEvent } from 'react';\nimport { useParams } from 'react-router';\nimport { useBillingNavigate } from '../../../hooks/useBillingNavigate';\nimport { usePlan, usePlanMutations, useQuotas } from '../hooks';\nimport { useBillingPermissions } from '../../../hooks/useBillingPermissions';\nimport {\n AccessDenied,\n CurrencyPriceOverridesEditor,\n PageHeader,\n ServerError,\n} from '../../../shared/components';\nimport { PagePurpose } from '@burdenoff/fe-libs/ui';\nimport { getPlanFeatureQuantity, isServerError } from '../../../shared/utils';\nimport {\n PlanDuration,\n type CurrencyPriceOverrideInput,\n type UpdatePlanInput,\n} from '../../../shared/types';\nimport { useI18n } from '@burdenoff/fe-libs/shared/providers/shell/I18nProvider';\nimport { getChangedCurrencyPriceOverrides } from '../utils/currencyPriceOverrides';\n\ninterface QuotaAllocation {\n quotaId: string;\n quantity: number;\n}\n\nexport const PlanEditPage: 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 { planId } = useParams<{ planId: string }>();\n const navigateTo = useBillingNavigate();\n const permissions = useBillingPermissions();\n const { plan, isLoading: isPlanLoading, error: planError, refetch } = usePlan(planId);\n const { quotas, isLoading: isQuotasLoading } = useQuotas({ onlyActive: true });\n const { updatePlan, isUpdating } = usePlanMutations();\n\n // Form state\n const [name, setName] = useState('');\n const [price, setPrice] = useState('');\n const [currency, setCurrency] = useState('USD');\n const [duration, setDuration] = useState<PlanDuration>(PlanDuration.MONTHLY);\n const [isActive, setIsActive] = useState(true);\n const [isPurchasable, setIsPurchasable] = useState(true);\n const [quotaAllocations, setQuotaAllocations] = useState<QuotaAllocation[]>([]);\n const [currencyPriceOverrides, setCurrencyPriceOverrides] = useState<\n CurrencyPriceOverrideInput[]\n >([]);\n const [initialCurrencyPriceOverrides, setInitialCurrencyPriceOverrides] = useState<\n CurrencyPriceOverrideInput[]\n >([]);\n const [error, setError] = useState<string | null>(null);\n const [success, setSuccess] = useState(false);\n\n // Populate form when plan data loads\n useEffect(() => {\n if (plan) {\n setName(plan.name ?? '');\n setPrice(String(plan.price ?? ''));\n setCurrency(plan.currency ?? 'USD');\n setDuration(plan.duration ?? PlanDuration.MONTHLY);\n setIsActive(plan.isActive ?? true);\n setIsPurchasable(plan.isPurchasable ?? true);\n // Pre-populate currency price overrides so existing prices are preserved on save\n if (plan.currencyPrices && typeof plan.currencyPrices === 'object') {\n const existing = plan.currencyPrices as Record<string, number>;\n const overrides = Object.entries(existing)\n .filter(([, v]) => typeof v === 'number')\n .map(([currency, amount]) => ({ currency, amount }));\n setCurrencyPriceOverrides(overrides);\n setInitialCurrencyPriceOverrides(overrides);\n }\n // Extract quota allocations from features\n if (plan.features && plan.features.length > 0) {\n const allocations: QuotaAllocation[] = [];\n const quotaMap = new Map<string, number>();\n\n for (const feature of plan.features) {\n if (feature.quota?.id) {\n const quotaId = feature.quota.id;\n // SubscriptionFeature now stores per-plan override in context.quantity.\n // Fall back to quota.limits.value for legacy autoseeded plans.\n const value = getPlanFeatureQuantity(feature) || 1;\n quotaMap.set(quotaId, value);\n }\n }\n\n for (const [quotaId, quantity] of quotaMap) {\n allocations.push({ quotaId, quantity });\n }\n\n setQuotaAllocations(allocations);\n }\n }\n }, [plan]);\n\n // Permission check\n if (!permissions.canManagePlans) {\n return (\n <AccessDenied\n message={tr('billing.plans.noEditPermission', \"You don't have permission to edit plans.\")}\n />\n );\n }\n\n // Loading state\n if (isPlanLoading || isQuotasLoading) {\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, 5].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 (planError && isServerError(planError)) {\n return (\n <div className=\"p-6\">\n <ServerError\n title={tr('billing.plans.serverUnavailable', 'Server Unavailable')}\n message={tr(\n 'billing.plans.serverUnavailableLoadPlan',\n 'Unable to load plan. The server might be down or experiencing issues.'\n )}\n onRetry={() => refetch()}\n showRetry\n />\n </div>\n );\n }\n\n if (!plan) {\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\">\n {tr('billing.plans.planNotFound', 'Plan not found')}\n </h2>\n <button\n type=\"button\"\n onClick={() => navigateTo('/plans')}\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 Plans\n </button>\n </div>\n </div>\n );\n }\n\n const handleAddQuota = () => {\n // Add new quota at the top with empty quotaId (placeholder)\n setQuotaAllocations([{ quotaId: '', quantity: 1 }, ...quotaAllocations]);\n };\n\n const handleRemoveQuota = (index: number) => {\n setQuotaAllocations(quotaAllocations.filter((_, i) => i !== index));\n };\n\n const handleQuotaChange = (\n index: number,\n field: 'quotaId' | 'quantity',\n value: string | number\n ) => {\n const updated = [...quotaAllocations];\n if (field === 'quotaId') {\n updated[index].quotaId = value as string;\n } else {\n updated[index].quantity = Number(value);\n }\n setQuotaAllocations(updated);\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('Plan name is required');\n return;\n }\n if (quotaAllocations.length === 0) {\n setError('At least one quota is required');\n return;\n }\n // Check for unselected quotas\n const unselectedQuotas = quotaAllocations.filter((a) => a.quotaId === '');\n if (unselectedQuotas.length > 0) {\n setError('Please select a quota for all allocations');\n return;\n }\n\n const input: UpdatePlanInput = {\n id: planId!,\n name: name.trim(),\n // price, currency and duration are immutable on existing plans (the payment\n // provider plans are locked to them), and the Plan.price/currency the form is\n // pre-filled with are resolved in the caller's billing currency, not the stored\n // one. Never send them back from the edit form.\n isActive,\n isPurchasable,\n quotas: quotaAllocations.map((a) => ({\n quotaId: a.quotaId,\n quantity: a.quantity,\n })),\n ...(getChangedCurrencyPriceOverrides(initialCurrencyPriceOverrides, currencyPriceOverrides)\n .length > 0\n ? {\n currencyPriceOverrides: getChangedCurrencyPriceOverrides(\n initialCurrencyPriceOverrides,\n currencyPriceOverrides\n ),\n }\n : {}),\n };\n\n try {\n await updatePlan(input);\n setSuccess(true);\n // Navigate back after short delay\n setTimeout(() => navigateTo(`/plans/${planId}`), 1500);\n } catch (err) {\n setError(err instanceof Error ? err.message : 'Failed to update plan');\n }\n };\n\n return (\n <div className=\"space-y-6 p-6\">\n <PageHeader\n title={`Edit Plan: ${plan.name}`}\n description={tr(\n 'billing.plans.editPlanDesc',\n 'Update the plan details and quota allocations'\n )}\n />\n\n <PagePurpose>\n {tr(\n 'billing.plans.editPurpose',\n \"Update this plan's price, currency/seat pricing and the quotas it grants. Changes apply to new subscriptions; existing subscribers keep the terms they signed up with until they renew or change plans.\"\n )}\n </PagePurpose>\n\n <form onSubmit={handleSubmit} className=\"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 {tr('billing.plans.updateSuccess', 'Plan updated successfully! Redirecting...')}\n </p>\n </div>\n )}\n\n {/* Two-column layout on desktop */}\n <div className=\"grid grid-cols-1 lg:grid-cols-2 gap-6\">\n {/* Basic Info */}\n <div className=\"border border-border-seam rounded-card bg-bg-surface overflow-hidden shadow-[var(--shadow-elevation-1)] h-fit\">\n <div className=\"p-4 border-b border-border-subtle bg-bg-sunken/30\">\n <h2 className=\"font-semibold text-text-primary\">\n {tr('billing.plans.basicInfo', 'Basic Information')}\n </h2>\n </div>\n <div className=\"p-4 space-y-4\">\n {/* Name */}\n <div>\n <label htmlFor=\"name\" className=\"block text-sm font-medium text-text-primary mb-1\">\n {tr('billing.plans.planNameLabel', 'Plan Name')} *\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)]\"\n placeholder={tr('billing.plans.planNamePlaceholder', 'e.g., Pro Plan')}\n required\n />\n </div>\n\n {/* Price & Currency */}\n <div className=\"grid grid-cols-2 gap-4\">\n <div>\n <label\n htmlFor=\"price\"\n className=\"block text-sm font-medium text-text-primary mb-1\"\n >\n {tr('billing.plans.priceLabel', 'Price')} *\n </label>\n <input\n id=\"price\"\n type=\"number\"\n step=\"0.01\"\n min=\"0\"\n value={price}\n onChange={(e) => setPrice(e.target.value)}\n disabled\n title=\"Price cannot be changed on an existing plan. Create a new plan instead.\"\n className=\"w-full disabled:opacity-60 disabled:cursor-not-allowed 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=\"49.99\"\n />\n </div>\n <div>\n <label\n htmlFor=\"currency\"\n className=\"block text-sm font-medium text-text-primary mb-1\"\n >\n {tr('billing.plans.currencyLabel', 'Currency')} *\n </label>\n <select\n id=\"currency\"\n value={currency}\n onChange={(e) => setCurrency(e.target.value)}\n disabled\n title=\"Currency cannot be changed on an existing plan. Create a new plan instead.\"\n className=\"w-full disabled:opacity-60 disabled:cursor-not-allowed 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=\"USD\">USD ($)</option>\n <option value=\"EUR\">EUR</option>\n <option value=\"GBP\">GBP</option>\n <option value=\"INR\">INR</option>\n <option value=\"AUD\">AUD</option>\n <option value=\"CAD\">CAD</option>\n <option value=\"JPY\">JPY</option>\n <option value=\"SGD\">SGD</option>\n </select>\n </div>\n </div>\n\n {/* Duration */}\n <div>\n <label\n htmlFor=\"duration\"\n className=\"block text-sm font-medium text-text-primary mb-1\"\n >\n {tr('billing.plans.billingPeriodLabel', 'Billing Period')} *\n </label>\n <select\n id=\"duration\"\n value={duration}\n onChange={(e) => setDuration(e.target.value as PlanDuration)}\n disabled\n title=\"Billing period cannot be changed on an existing plan. Create a new plan instead.\"\n className=\"w-full disabled:opacity-60 disabled:cursor-not-allowed 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={PlanDuration.MONTHLY}>Monthly</option>\n <option value={PlanDuration.YEARLY}>Yearly</option>\n </select>\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 {tr('billing.plans.planIsActive', 'Plan is active')}\n </label>\n </div>\n\n {/* Purchasable toggle */}\n <div className=\"flex items-start justify-between gap-4 pt-1\">\n <div>\n <p className=\"text-sm font-medium text-text-primary\">\n {tr('billing.plans.isPurchasableLabel', 'Publicly purchasable')}\n </p>\n <p className=\"text-xs text-text-muted mt-0.5\">\n {isPurchasable\n ? tr(\n 'billing.plans.isPurchasableOn',\n 'Visible on pricing page — users can subscribe directly.'\n )\n : tr(\n 'billing.plans.isPurchasableOff',\n 'Internal / custom plan — hidden from pricing page, assign via API only.'\n )}\n </p>\n </div>\n <button\n type=\"button\"\n role=\"switch\"\n aria-checked={isPurchasable}\n onClick={() => setIsPurchasable((v) => !v)}\n className={`relative inline-flex h-6 w-11 shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)] focus:ring-offset-2 ${\n isPurchasable ? 'bg-action-primary-bg' : 'bg-text-muted/30'\n }`}\n >\n <span\n className={`inline-block h-5 w-5 transform rounded-full bg-bg-surface shadow transition-transform ${\n isPurchasable ? 'translate-x-5' : 'translate-x-0'\n }`}\n />\n </button>\n </div>\n </div>\n </div>\n\n {/* Quota Allocations */}\n <div className=\"border border-border-seam rounded-card bg-bg-surface overflow-hidden shadow-[var(--shadow-elevation-1)] h-fit\">\n <div className=\"p-4 border-b border-border-subtle bg-bg-sunken/30 flex items-center justify-between\">\n <h2 className=\"font-semibold text-text-primary\">\n {tr('billing.plans.quotaAllocations', 'Quota Allocations')}\n </h2>\n <button\n type=\"button\"\n onClick={handleAddQuota}\n className=\"px-3 py-1 text-sm font-medium text-text-link hover:bg-[var(--color-accent-soft)] rounded-md transition-colors\"\n >\n + Add Quota\n </button>\n </div>\n <div className=\"p-4 space-y-3\">\n {quotaAllocations.length === 0 ? (\n <p className=\"text-sm text-text-muted\">\n {tr(\n 'billing.plans.noQuotasAllocated',\n 'No quotas allocated. Click \"Add Quota\" to add one.'\n )}\n </p>\n ) : (\n quotaAllocations.map((allocation, index) => {\n const selectedQuota = quotas.find((q) => q.id === allocation.quotaId);\n const limits = selectedQuota?.limits as { type?: string; value?: number } | null;\n const limitType = limits?.type ?? 'unknown';\n\n return (\n <div\n key={index}\n className=\"p-3 border border-border-subtle rounded-lg bg-bg-sunken/20 space-y-3\"\n >\n <div className=\"flex items-center gap-3\">\n <select\n value={allocation.quotaId}\n onChange={(e) => handleQuotaChange(index, 'quotaId', e.target.value)}\n className={`flex-1 px-3 py-2 border border-border-subtle rounded-input bg-bg-surface scheme-normal dark:scheme-dark [&_option]:bg-bg-surface [&_option]:text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)] ${\n allocation.quotaId === '' ? 'text-text-muted' : 'text-text-primary'\n }`}\n >\n <option value=\"\" disabled>\n {tr('billing.plans.selectQuota', 'Select a quota...')}\n </option>\n {quotas.map((quota) => (\n <option key={quota.id} value={quota.id}>\n {quota.name}\n </option>\n ))}\n </select>\n <button\n type=\"button\"\n onClick={() => handleRemoveQuota(index)}\n className=\"p-2 text-status-error-text hover:bg-status-error-bg-subtle rounded-md transition-colors\"\n title=\"Remove quota\"\n >\n <svg\n className=\"size-5\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n stroke=\"currentColor\"\n >\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeWidth={2}\n d=\"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16\"\n />\n </svg>\n </button>\n </div>\n\n {/* Quota Info - only show when quota is selected */}\n {selectedQuota && (\n <>\n <div className=\"flex items-center justify-between text-sm\">\n <span className=\"capitalize text-text-muted\">Type: {limitType}</span>\n </div>\n\n {/* Limit value — allocation.quantity is the absolute limit */}\n <div className=\"flex items-center gap-2\">\n <label className=\"text-sm text-text-muted\">\n {tr('billing.plans.limit', 'Limit')}:\n </label>\n <input\n type=\"number\"\n min=\"1\"\n value={allocation.quantity}\n onChange={(e) => handleQuotaChange(index, 'quantity', e.target.value)}\n className=\"w-36 px-3 py-1.5 border border-border-subtle rounded-input bg-bg-surface text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)] text-center\"\n />\n </div>\n </>\n )}\n </div>\n );\n })\n )}\n </div>\n </div>\n </div>\n\n <CurrencyPriceOverridesEditor\n overrides={currencyPriceOverrides}\n onChange={setCurrencyPriceOverrides}\n />\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.plans.saving', 'Saving...')\n : tr('billing.plans.saveChanges', 'Save Changes')}\n </button>\n <button\n type=\"button\"\n onClick={() => navigateTo(`/plans/${planId}`)}\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":";;;;;;;;;;;;;;;;;;;;;AA+BA,IAAaE,UAAyB;CACpC,IAAM,EAAE,SAAMC,EAAQ,GAChBC,KAAM,GAAa,MAA6B;EACpD,IAAMC,IAAaC,EAAEC,CAAG;EACxB,OAAOF,MAAeE,IAAMC,IAAWH;CACzC,GACM,EAAE,cAAWI,EAA8B,GAC3CC,IAAaC,GAAmB,GAChCC,IAAcC,EAAsB,GACpC,EAAE,SAAM,WAAWC,GAAe,OAAOC,GAAW,eAAYC,EAAQC,CAAM,GAC9E,EAAE,WAAQ,WAAWC,MAAoBC,EAAU,EAAE,YAAY,GAAK,CAAC,GACvE,EAAE,eAAY,kBAAeC,EAAiB,GAG9C,CAACC,GAAMC,KAAWC,EAAS,EAAE,GAC7B,CAACC,IAAOC,KAAYF,EAAS,EAAE,GAC/B,CAACG,GAAUC,KAAeJ,EAAS,KAAK,GACxC,CAACK,GAAUC,KAAeN,EAAuBO,EAAa,OAAO,GACrE,CAACC,GAAUC,KAAeT,EAAS,EAAI,GACvC,CAACU,GAAeC,KAAoBX,EAAS,EAAI,GACjD,CAACY,GAAkBC,KAAuBb,EAA4B,CAAC,CAAC,GACxE,CAACc,GAAwBC,KAA6Bf,EAE1D,CAAC,CAAC,GACE,CAACgB,GAA+BC,KAAoCjB,EAExE,CAAC,CAAC,GACE,CAACkB,GAAOC,KAAYnB,EAAwB,IAAI,GAChD,CAACoB,GAASC,KAAcrB,EAAS,EAAK;CA6C5C,IA1CAsB,QAAgB;EACd,IAAIC,GAAM;GAQR,IAPAxB,EAAQwB,EAAK,QAAQ,EAAE,GACvBrB,EAAS,OAAOqB,EAAK,SAAS,EAAE,CAAC,GACjCnB,EAAYmB,EAAK,YA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M;YAEN,UAAA,kBAAC,OAAD;aACE,WAAU;aACV,MAAK;aACL,SAAQ;aACR,QAAO;aAEP,UAAA,kBAAC,QAAD;cACE,eAAc;cACd,gBAAe;cACf,aAAa;cACb,GAAE;aACH,CAAA;YACE,CAAA;WACC,CAAA,CACL;UAGJ,CAAA,GAAAW,KACC,kBAAA5E,GAAA,EAAA,UAAA,CACE,kBAAC,OAAD;WAAK,WAAU;WACb,UAAA,kBAAC,QAAD;YAAM,WAAU;YAAhB,UAAA,CAA6C,UAAOgF,CAAgB;;UACjE,CAAA,GAGL,kBAAC,OAAD;WAAK,WAAU;WAAf,UAAA,CACE,kBAAC,SAAD;YAAO,WAAU;YAAjB,UAAA,CACG5E,EAAG,uBAAuB,OAAO,GAAE,GAC/B;WACP,CAAA,GAAA,kBAAC,SAAD;YACE,MAAK;YACL,KAAI;YACJ,OAAO2E,EAAW;YAClB,WAAW,MAAMb,EAAkBD,GAAO,YAAY,EAAE,OAAO,KAAK;YACpE,WAAU;WACX,CAAA,CACE;UACL,CAAA,CAAA,EAAA,CAAA,CAED;SAhEE,GAAAA,CAgEF;QAET,CAAC;OAEA,CAAA,CACF;MACF,CAAA,CAAA;;KAEL,kBAACiB,GAAD;MACE,WAAW7C;MACX,UAAUC;KACX,CAAA;KAGD,kBAAC,OAAD;MAAK,WAAU;MAAf,UAAA,CACE,kBAAC,UAAD;OACE,MAAK;OACL,UAAU6C;OACV,WAAU;OAET,UAAAA,IACG/E,EAAG,wBAAwB,WAAW,IACtCA,EAAG,6BAA6B,cAAc;MAC5C,CAAA,GACR,kBAAC,UAAD;OACE,MAAK;OACL,eAAeM,EAAW,UAAUO,GAAQ;OAC5C,WAAU;OACX,UAAA;MAEO,CAAA,CACL;;IACD;;EACH;;AAET"}
1
+ {"version":3,"file":"PlanEditPage.js","names":["_Fragment","Fragment$1","PlanEditPage","useI18n","tr","translated","t","key","fallback","useParams","navigateTo","useBillingNavigate","permissions","useBillingPermissions","isPlanLoading","planError","usePlan","planId","isQuotasLoading","useQuotas","usePlanMutations","name","setName","useState","price","setPrice","currency","setCurrency","duration","setDuration","PlanDuration","isActive","setIsActive","isPurchasable","setIsPurchasable","quotaAllocations","setQuotaAllocations","currencyPriceOverrides","setCurrencyPriceOverrides","initialCurrencyPriceOverrides","setInitialCurrencyPriceOverrides","error","setError","success","setSuccess","useEffect","plan","existing","overrides","v","amount","allocations","quotaMap","feature","quotaId","value","getPlanFeatureQuantity","quantity","AccessDenied","i","isServerError","ServerError","refetch","handleAddQuota","handleRemoveQuota","index","handleQuotaChange","updated","field","PageHeader","PagePurpose","a","input","getChangedCurrencyPriceOverrides","updatePlan","err","ThemedSelect","selectedQuota","quotas","q","allocation","limitType","quota","CurrencyPriceOverridesEditor","isUpdating"],"sources":["../../../../../src/billing/modules/plans/pages/PlanEditPage.tsx"],"sourcesContent":["/**\n * Plans Module - Plan Edit Page\n * Form to edit an existing plan\n */\n\nimport { useState, useEffect, type FC, type FormEvent } from 'react';\nimport { useParams } from 'react-router';\nimport { useBillingNavigate } from '../../../hooks/useBillingNavigate';\nimport { usePlan, usePlanMutations, useQuotas } from '../hooks';\nimport { useBillingPermissions } from '../../../hooks/useBillingPermissions';\nimport {\n AccessDenied,\n CurrencyPriceOverridesEditor,\n PageHeader,\n ServerError,\n} from '../../../shared/components';\nimport { PagePurpose, ThemedSelect } from '@burdenoff/fe-libs/ui';\nimport { getPlanFeatureQuantity, isServerError } from '../../../shared/utils';\nimport {\n PlanDuration,\n type CurrencyPriceOverrideInput,\n type UpdatePlanInput,\n} from '../../../shared/types';\nimport { useI18n } from '@burdenoff/fe-libs/shared/providers/shell/I18nProvider';\nimport { getChangedCurrencyPriceOverrides } from '../utils/currencyPriceOverrides';\n\ninterface QuotaAllocation {\n quotaId: string;\n quantity: number;\n}\n\nexport const PlanEditPage: 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 { planId } = useParams<{ planId: string }>();\n const navigateTo = useBillingNavigate();\n const permissions = useBillingPermissions();\n const { plan, isLoading: isPlanLoading, error: planError, refetch } = usePlan(planId);\n const { quotas, isLoading: isQuotasLoading } = useQuotas({ onlyActive: true });\n const { updatePlan, isUpdating } = usePlanMutations();\n\n // Form state\n const [name, setName] = useState('');\n const [price, setPrice] = useState('');\n const [currency, setCurrency] = useState('USD');\n const [duration, setDuration] = useState<PlanDuration>(PlanDuration.MONTHLY);\n const [isActive, setIsActive] = useState(true);\n const [isPurchasable, setIsPurchasable] = useState(true);\n const [quotaAllocations, setQuotaAllocations] = useState<QuotaAllocation[]>([]);\n const [currencyPriceOverrides, setCurrencyPriceOverrides] = useState<\n CurrencyPriceOverrideInput[]\n >([]);\n const [initialCurrencyPriceOverrides, setInitialCurrencyPriceOverrides] = useState<\n CurrencyPriceOverrideInput[]\n >([]);\n const [error, setError] = useState<string | null>(null);\n const [success, setSuccess] = useState(false);\n\n // Populate form when plan data loads\n useEffect(() => {\n if (plan) {\n setName(plan.name ?? '');\n setPrice(String(plan.price ?? ''));\n setCurrency(plan.currency ?? 'USD');\n setDuration(plan.duration ?? PlanDuration.MONTHLY);\n setIsActive(plan.isActive ?? true);\n setIsPurchasable(plan.isPurchasable ?? true);\n // Pre-populate currency price overrides so existing prices are preserved on save\n if (plan.currencyPrices && typeof plan.currencyPrices === 'object') {\n const existing = plan.currencyPrices as Record<string, number>;\n const overrides = Object.entries(existing)\n .filter(([, v]) => typeof v === 'number')\n .map(([currency, amount]) => ({ currency, amount }));\n setCurrencyPriceOverrides(overrides);\n setInitialCurrencyPriceOverrides(overrides);\n }\n // Extract quota allocations from features\n if (plan.features && plan.features.length > 0) {\n const allocations: QuotaAllocation[] = [];\n const quotaMap = new Map<string, number>();\n\n for (const feature of plan.features) {\n if (feature.quota?.id) {\n const quotaId = feature.quota.id;\n // SubscriptionFeature now stores per-plan override in context.quantity.\n // Fall back to quota.limits.value for legacy autoseeded plans.\n const value = getPlanFeatureQuantity(feature) || 1;\n quotaMap.set(quotaId, value);\n }\n }\n\n for (const [quotaId, quantity] of quotaMap) {\n allocations.push({ quotaId, quantity });\n }\n\n setQuotaAllocations(allocations);\n }\n }\n }, [plan]);\n\n // Permission check\n if (!permissions.canManagePlans) {\n return (\n <AccessDenied\n message={tr('billing.plans.noEditPermission', \"You don't have permission to edit plans.\")}\n />\n );\n }\n\n // Loading state\n if (isPlanLoading || isQuotasLoading) {\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, 5].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 (planError && isServerError(planError)) {\n return (\n <div className=\"p-6\">\n <ServerError\n title={tr('billing.plans.serverUnavailable', 'Server Unavailable')}\n message={tr(\n 'billing.plans.serverUnavailableLoadPlan',\n 'Unable to load plan. The server might be down or experiencing issues.'\n )}\n onRetry={() => refetch()}\n showRetry\n />\n </div>\n );\n }\n\n if (!plan) {\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\">\n {tr('billing.plans.planNotFound', 'Plan not found')}\n </h2>\n <button\n type=\"button\"\n onClick={() => navigateTo('/plans')}\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 Plans\n </button>\n </div>\n </div>\n );\n }\n\n const handleAddQuota = () => {\n // Add new quota at the top with empty quotaId (placeholder)\n setQuotaAllocations([{ quotaId: '', quantity: 1 }, ...quotaAllocations]);\n };\n\n const handleRemoveQuota = (index: number) => {\n setQuotaAllocations(quotaAllocations.filter((_, i) => i !== index));\n };\n\n const handleQuotaChange = (\n index: number,\n field: 'quotaId' | 'quantity',\n value: string | number\n ) => {\n const updated = [...quotaAllocations];\n if (field === 'quotaId') {\n updated[index].quotaId = value as string;\n } else {\n updated[index].quantity = Number(value);\n }\n setQuotaAllocations(updated);\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('Plan name is required');\n return;\n }\n if (quotaAllocations.length === 0) {\n setError('At least one quota is required');\n return;\n }\n // Check for unselected quotas\n const unselectedQuotas = quotaAllocations.filter((a) => a.quotaId === '');\n if (unselectedQuotas.length > 0) {\n setError('Please select a quota for all allocations');\n return;\n }\n\n const input: UpdatePlanInput = {\n id: planId!,\n name: name.trim(),\n // price, currency and duration are immutable on existing plans (the payment\n // provider plans are locked to them), and the Plan.price/currency the form is\n // pre-filled with are resolved in the caller's billing currency, not the stored\n // one. Never send them back from the edit form.\n isActive,\n isPurchasable,\n quotas: quotaAllocations.map((a) => ({\n quotaId: a.quotaId,\n quantity: a.quantity,\n })),\n ...(getChangedCurrencyPriceOverrides(initialCurrencyPriceOverrides, currencyPriceOverrides)\n .length > 0\n ? {\n currencyPriceOverrides: getChangedCurrencyPriceOverrides(\n initialCurrencyPriceOverrides,\n currencyPriceOverrides\n ),\n }\n : {}),\n };\n\n try {\n await updatePlan(input);\n setSuccess(true);\n // Navigate back after short delay\n setTimeout(() => navigateTo(`/plans/${planId}`), 1500);\n } catch (err) {\n setError(err instanceof Error ? err.message : 'Failed to update plan');\n }\n };\n\n return (\n <div className=\"space-y-6 p-6\">\n <PageHeader\n title={`Edit Plan: ${plan.name}`}\n description={tr(\n 'billing.plans.editPlanDesc',\n 'Update the plan details and quota allocations'\n )}\n />\n\n <PagePurpose>\n {tr(\n 'billing.plans.editPurpose',\n \"Update this plan's price, currency/seat pricing and the quotas it grants. Changes apply to new subscriptions; existing subscribers keep the terms they signed up with until they renew or change plans.\"\n )}\n </PagePurpose>\n\n <form onSubmit={handleSubmit} className=\"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 {tr('billing.plans.updateSuccess', 'Plan updated successfully! Redirecting...')}\n </p>\n </div>\n )}\n\n {/* Two-column layout on desktop */}\n <div className=\"grid grid-cols-1 lg:grid-cols-2 gap-6\">\n {/* Basic Info */}\n <div className=\"border border-border-seam rounded-card bg-bg-surface overflow-hidden shadow-[var(--shadow-elevation-1)] h-fit\">\n <div className=\"p-4 border-b border-border-subtle bg-bg-sunken/30\">\n <h2 className=\"font-semibold text-text-primary\">\n {tr('billing.plans.basicInfo', 'Basic Information')}\n </h2>\n </div>\n <div className=\"p-4 space-y-4\">\n {/* Name */}\n <div>\n <label htmlFor=\"name\" className=\"block text-sm font-medium text-text-primary mb-1\">\n {tr('billing.plans.planNameLabel', 'Plan Name')} *\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)]\"\n placeholder={tr('billing.plans.planNamePlaceholder', 'e.g., Pro Plan')}\n required\n />\n </div>\n\n {/* Price & Currency */}\n <div className=\"grid grid-cols-2 gap-4\">\n <div>\n <label\n htmlFor=\"price\"\n className=\"block text-sm font-medium text-text-primary mb-1\"\n >\n {tr('billing.plans.priceLabel', 'Price')} *\n </label>\n <input\n id=\"price\"\n type=\"number\"\n step=\"0.01\"\n min=\"0\"\n value={price}\n onChange={(e) => setPrice(e.target.value)}\n disabled\n title=\"Price cannot be changed on an existing plan. Create a new plan instead.\"\n className=\"w-full disabled:opacity-60 disabled:cursor-not-allowed 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=\"49.99\"\n />\n </div>\n <div>\n <label\n htmlFor=\"currency\"\n className=\"block text-sm font-medium text-text-primary mb-1\"\n >\n {tr('billing.plans.currencyLabel', 'Currency')} *\n </label>\n <ThemedSelect\n id=\"currency\"\n value={currency}\n onChange={(e) => setCurrency(e.target.value)}\n disabled\n title=\"Currency cannot be changed on an existing plan. Create a new plan instead.\"\n className=\"w-full disabled:opacity-60 disabled:cursor-not-allowed 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=\"USD\">USD ($)</option>\n <option value=\"EUR\">EUR</option>\n <option value=\"GBP\">GBP</option>\n <option value=\"INR\">INR</option>\n <option value=\"AUD\">AUD</option>\n <option value=\"CAD\">CAD</option>\n <option value=\"JPY\">JPY</option>\n <option value=\"SGD\">SGD</option>\n </ThemedSelect>\n </div>\n </div>\n\n {/* Duration */}\n <div>\n <label\n htmlFor=\"duration\"\n className=\"block text-sm font-medium text-text-primary mb-1\"\n >\n {tr('billing.plans.billingPeriodLabel', 'Billing Period')} *\n </label>\n <ThemedSelect\n id=\"duration\"\n value={duration}\n onChange={(e) => setDuration(e.target.value as PlanDuration)}\n disabled\n title=\"Billing period cannot be changed on an existing plan. Create a new plan instead.\"\n className=\"w-full disabled:opacity-60 disabled:cursor-not-allowed 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={PlanDuration.MONTHLY}>Monthly</option>\n <option value={PlanDuration.YEARLY}>Yearly</option>\n </ThemedSelect>\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 {tr('billing.plans.planIsActive', 'Plan is active')}\n </label>\n </div>\n\n {/* Purchasable toggle */}\n <div className=\"flex items-start justify-between gap-4 pt-1\">\n <div>\n <p className=\"text-sm font-medium text-text-primary\">\n {tr('billing.plans.isPurchasableLabel', 'Publicly purchasable')}\n </p>\n <p className=\"text-xs text-text-muted mt-0.5\">\n {isPurchasable\n ? tr(\n 'billing.plans.isPurchasableOn',\n 'Visible on pricing page — users can subscribe directly.'\n )\n : tr(\n 'billing.plans.isPurchasableOff',\n 'Internal / custom plan — hidden from pricing page, assign via API only.'\n )}\n </p>\n </div>\n <button\n type=\"button\"\n role=\"switch\"\n aria-checked={isPurchasable}\n onClick={() => setIsPurchasable((v) => !v)}\n className={`relative inline-flex h-6 w-11 shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)] focus:ring-offset-2 ${\n isPurchasable ? 'bg-action-primary-bg' : 'bg-text-muted/30'\n }`}\n >\n <span\n className={`inline-block h-5 w-5 transform rounded-full bg-bg-surface shadow transition-transform ${\n isPurchasable ? 'translate-x-5' : 'translate-x-0'\n }`}\n />\n </button>\n </div>\n </div>\n </div>\n\n {/* Quota Allocations */}\n <div className=\"border border-border-seam rounded-card bg-bg-surface overflow-hidden shadow-[var(--shadow-elevation-1)] h-fit\">\n <div className=\"p-4 border-b border-border-subtle bg-bg-sunken/30 flex items-center justify-between\">\n <h2 className=\"font-semibold text-text-primary\">\n {tr('billing.plans.quotaAllocations', 'Quota Allocations')}\n </h2>\n <button\n type=\"button\"\n onClick={handleAddQuota}\n className=\"px-3 py-1 text-sm font-medium text-text-link hover:bg-[var(--color-accent-soft)] rounded-md transition-colors\"\n >\n + Add Quota\n </button>\n </div>\n <div className=\"p-4 space-y-3\">\n {quotaAllocations.length === 0 ? (\n <p className=\"text-sm text-text-muted\">\n {tr(\n 'billing.plans.noQuotasAllocated',\n 'No quotas allocated. Click \"Add Quota\" to add one.'\n )}\n </p>\n ) : (\n quotaAllocations.map((allocation, index) => {\n const selectedQuota = quotas.find((q) => q.id === allocation.quotaId);\n const limits = selectedQuota?.limits as { type?: string; value?: number } | null;\n const limitType = limits?.type ?? 'unknown';\n\n return (\n <div\n key={index}\n className=\"p-3 border border-border-subtle rounded-lg bg-bg-sunken/20 space-y-3\"\n >\n <div className=\"flex items-center gap-3\">\n <ThemedSelect\n value={allocation.quotaId}\n onChange={(e) => handleQuotaChange(index, 'quotaId', e.target.value)}\n className={`flex-1 px-3 py-2 border border-border-subtle rounded-input bg-bg-surface scheme-normal dark:scheme-dark [&_option]:bg-bg-surface [&_option]:text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)] ${\n allocation.quotaId === '' ? 'text-text-muted' : 'text-text-primary'\n }`}\n >\n <option value=\"\" disabled>\n {tr('billing.plans.selectQuota', 'Select a quota...')}\n </option>\n {quotas.map((quota) => (\n <option key={quota.id} value={quota.id}>\n {quota.name}\n </option>\n ))}\n </ThemedSelect>\n <button\n type=\"button\"\n onClick={() => handleRemoveQuota(index)}\n className=\"p-2 text-status-error-text hover:bg-status-error-bg-subtle rounded-md transition-colors\"\n title=\"Remove quota\"\n >\n <svg\n className=\"size-5\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n stroke=\"currentColor\"\n >\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeWidth={2}\n d=\"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16\"\n />\n </svg>\n </button>\n </div>\n\n {/* Quota Info - only show when quota is selected */}\n {selectedQuota && (\n <>\n <div className=\"flex items-center justify-between text-sm\">\n <span className=\"capitalize text-text-muted\">Type: {limitType}</span>\n </div>\n\n {/* Limit value — allocation.quantity is the absolute limit */}\n <div className=\"flex items-center gap-2\">\n <label className=\"text-sm text-text-muted\">\n {tr('billing.plans.limit', 'Limit')}:\n </label>\n <input\n type=\"number\"\n min=\"1\"\n value={allocation.quantity}\n onChange={(e) => handleQuotaChange(index, 'quantity', e.target.value)}\n className=\"w-36 px-3 py-1.5 border border-border-subtle rounded-input bg-bg-surface text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)] text-center\"\n />\n </div>\n </>\n )}\n </div>\n );\n })\n )}\n </div>\n </div>\n </div>\n\n <CurrencyPriceOverridesEditor\n overrides={currencyPriceOverrides}\n onChange={setCurrencyPriceOverrides}\n />\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.plans.saving', 'Saving...')\n : tr('billing.plans.saveChanges', 'Save Changes')}\n </button>\n <button\n type=\"button\"\n onClick={() => navigateTo(`/plans/${planId}`)}\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":";;;;;;;;;;;;;;;;;;;;;AA+BA,IAAaE,UAAyB;CACpC,IAAM,EAAE,SAAMC,EAAQ,GAChBC,KAAM,GAAa,MAA6B;EACpD,IAAMC,IAAaC,EAAEC,CAAG;EACxB,OAAOF,MAAeE,IAAMC,IAAWH;CACzC,GACM,EAAE,cAAWI,GAA8B,GAC3CC,IAAaC,EAAmB,GAChCC,KAAcC,EAAsB,GACpC,EAAE,SAAM,WAAWC,GAAe,OAAOC,GAAW,eAAYC,EAAQC,CAAM,GAC9E,EAAE,WAAQ,WAAWC,MAAoBC,EAAU,EAAE,YAAY,GAAK,CAAC,GACvE,EAAE,eAAY,kBAAeC,EAAiB,GAG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YACpE,WAAU;WACX,CAAA,CACE;UACL,CAAA,CAAA,EAAA,CAAA,CAED;SAhEE,GAAAA,CAgEF;QAET,CAAC;OAEA,CAAA,CACF;MACF,CAAA,CAAA;;KAEL,kBAACkB,GAAD;MACE,WAAW9C;MACX,UAAUC;KACX,CAAA;KAGD,kBAAC,OAAD;MAAK,WAAU;MAAf,UAAA,CACE,kBAAC,UAAD;OACE,MAAK;OACL,UAAU8C;OACV,WAAU;OAET,UAAAA,IACGhF,EAAG,wBAAwB,WAAW,IACtCA,EAAG,6BAA6B,cAAc;MAC5C,CAAA,GACR,kBAAC,UAAD;OACE,MAAK;OACL,eAAeM,EAAW,UAAUO,GAAQ;OAC5C,WAAU;OACX,UAAA;MAEO,CAAA,CACL;;IACD;;EACH;;AAET"}
@@ -7,219 +7,219 @@ import "../../../shared/components/index.js";
7
7
  import { useQuotaTemplateMutations as i } from "../hooks/useQuotaTemplates.js";
8
8
  import { QuotaResetPeriod as a, QuotaType as o } from "../../../shared/types/graphql.js";
9
9
  import { useState as s } from "react";
10
- import { PagePurpose as c } from "@burdenoff/fe-libs/ui";
11
- import { jsx as l, jsxs as u } from "react/jsx-runtime";
12
- import { useI18n as d } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
10
+ import { PagePurpose as c, ThemedSelect as l } from "@burdenoff/fe-libs/ui";
11
+ import { jsx as u, jsxs as d } from "react/jsx-runtime";
12
+ import { useI18n as f } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
13
13
  // src/billing/modules/quota/pages/QuotaTemplateCreatePage.tsx
14
- var f = () => {
15
- let { t: f } = d(), p = (e, t) => {
16
- let n = f(e);
14
+ var p = () => {
15
+ let { t: p } = f(), m = (e, t) => {
16
+ let n = p(e);
17
17
  return n === e ? t : n;
18
- }, m = n(), h = r(), { createQuota: g, isCreating: _ } = i(), [v, y] = s(""), [b, x] = s(""), [S, C] = s(""), [w, T] = s("numeric"), [E, D] = s(""), [O, k] = s(""), [A, j] = s(o.PRODUCT_SPECIFIC), [M, N] = s(!1), [P, F] = s(a.NEVER), [I, L] = s(null), [R, z] = s(!1);
19
- return h.canManageQuotas ? /* @__PURE__ */ u("div", {
18
+ }, h = n(), g = r(), { createQuota: _, isCreating: v } = i(), [y, b] = s(""), [x, S] = s(""), [C, w] = s(""), [T, E] = s("numeric"), [D, O] = s(""), [k, A] = s(""), [j, M] = s(o.PRODUCT_SPECIFIC), [N, P] = s(!1), [F, I] = s(a.NEVER), [L, R] = s(null), [z, B] = s(!1);
19
+ return g.canManageQuotas ? /* @__PURE__ */ d("div", {
20
20
  className: "space-y-6 p-6",
21
21
  children: [
22
- /* @__PURE__ */ l(t, {
22
+ /* @__PURE__ */ u(t, {
23
23
  title: "Create New Quota",
24
24
  description: "Set up a new quota template"
25
25
  }),
26
- /* @__PURE__ */ l(c, { children: "Define a reusable limit — its name, type (pooled or product-specific), unit and default value — that you can then attach to any number of plans and add-ons. Build the template once here instead of redefining the same limit on every plan." }),
27
- /* @__PURE__ */ u("form", {
26
+ /* @__PURE__ */ u(c, { children: "Define a reusable limit — its name, type (pooled or product-specific), unit and default value — that you can then attach to any number of plans and add-ons. Build the template once here instead of redefining the same limit on every plan." }),
27
+ /* @__PURE__ */ d("form", {
28
28
  onSubmit: async (e) => {
29
- if (e.preventDefault(), L(null), z(!1), !v.trim()) {
30
- L("Quota name is required");
29
+ if (e.preventDefault(), R(null), B(!1), !y.trim()) {
30
+ R("Quota name is required");
31
31
  return;
32
32
  }
33
- if (!E || isNaN(Number(E)) || Number(E) < 0) {
34
- L("Valid limit value is required");
33
+ if (!D || isNaN(Number(D)) || Number(D) < 0) {
34
+ R("Valid limit value is required");
35
35
  return;
36
36
  }
37
- if (!O.trim()) {
38
- L("Unit is required (e.g., bots, GB, seats)");
37
+ if (!k.trim()) {
38
+ R("Unit is required (e.g., bots, GB, seats)");
39
39
  return;
40
40
  }
41
41
  let t = {
42
- name: v.trim(),
42
+ name: y.trim(),
43
43
  limits: {
44
- type: w,
45
- value: Number(E),
46
- unit: O.trim()
44
+ type: T,
45
+ value: Number(D),
46
+ unit: k.trim()
47
47
  },
48
- quotaType: A,
49
- reusable: M,
50
- resetPeriod: P,
48
+ quotaType: j,
49
+ reusable: N,
50
+ resetPeriod: F,
51
51
  context: {
52
- displayName: b.trim() || v.trim(),
53
- description: S.trim()
52
+ displayName: x.trim() || y.trim(),
53
+ description: C.trim()
54
54
  }
55
55
  };
56
56
  try {
57
- await g(t), z(!0), setTimeout(() => m("/quotas"), 1500);
57
+ await _(t), B(!0), setTimeout(() => h("/quotas"), 1500);
58
58
  } catch (e) {
59
- L(e instanceof Error ? e.message : "Failed to create quota");
59
+ R(e instanceof Error ? e.message : "Failed to create quota");
60
60
  }
61
61
  },
62
62
  className: "max-w-2xl space-y-6",
63
63
  children: [
64
- I && /* @__PURE__ */ l("div", {
64
+ L && /* @__PURE__ */ u("div", {
65
65
  className: "p-4 bg-status-error-bg-subtle border border-border-subtle rounded-lg",
66
- children: /* @__PURE__ */ l("p", {
66
+ children: /* @__PURE__ */ u("p", {
67
67
  className: "text-sm text-status-error-text",
68
- children: I
68
+ children: L
69
69
  })
70
70
  }),
71
- R && /* @__PURE__ */ l("div", {
71
+ z && /* @__PURE__ */ u("div", {
72
72
  className: "p-4 bg-status-success-bg-subtle border border-border-subtle rounded-lg",
73
- children: /* @__PURE__ */ l("p", {
73
+ children: /* @__PURE__ */ u("p", {
74
74
  className: "text-sm text-status-success-text",
75
75
  children: "Quota created successfully! Redirecting…"
76
76
  })
77
77
  }),
78
- /* @__PURE__ */ u("div", {
78
+ /* @__PURE__ */ d("div", {
79
79
  className: "border border-border-seam rounded-card bg-bg-surface overflow-hidden shadow-[var(--shadow-elevation-1)]",
80
- children: [/* @__PURE__ */ l("div", {
80
+ children: [/* @__PURE__ */ u("div", {
81
81
  className: "p-4 border-b border-border-subtle bg-bg-sunken/30",
82
- children: /* @__PURE__ */ l("h2", {
82
+ children: /* @__PURE__ */ u("h2", {
83
83
  className: "font-semibold text-text-primary",
84
84
  children: "Basic Information"
85
85
  })
86
- }), /* @__PURE__ */ u("div", {
86
+ }), /* @__PURE__ */ d("div", {
87
87
  className: "p-4 space-y-4",
88
88
  children: [
89
- /* @__PURE__ */ u("div", { children: [
90
- /* @__PURE__ */ l("label", {
89
+ /* @__PURE__ */ d("div", { children: [
90
+ /* @__PURE__ */ u("label", {
91
91
  htmlFor: "name",
92
92
  className: "block text-sm font-medium text-text-primary mb-1",
93
93
  children: "Quota Key *"
94
94
  }),
95
- /* @__PURE__ */ l("input", {
95
+ /* @__PURE__ */ u("input", {
96
96
  id: "name",
97
97
  type: "text",
98
- value: v,
99
- onChange: (e) => y(e.target.value),
98
+ value: y,
99
+ onChange: (e) => b(e.target.value),
100
100
  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",
101
101
  placeholder: "e.g., sessions-started, tunnels-created",
102
102
  required: !0
103
103
  }),
104
- /* @__PURE__ */ u("p", {
104
+ /* @__PURE__ */ d("p", {
105
105
  className: "text-xs text-text-muted mt-1",
106
106
  children: [
107
107
  "Internal machine key, must match the ",
108
- /* @__PURE__ */ l("code", { children: "quotaName" }),
108
+ /* @__PURE__ */ u("code", { children: "quotaName" }),
109
109
  " used in",
110
110
  " ",
111
- /* @__PURE__ */ l("code", { children: "@usage" }),
111
+ /* @__PURE__ */ u("code", { children: "@usage" }),
112
112
  " directives. Never shown to users."
113
113
  ]
114
114
  })
115
115
  ] }),
116
- /* @__PURE__ */ u("div", { children: [
117
- /* @__PURE__ */ l("label", {
116
+ /* @__PURE__ */ d("div", { children: [
117
+ /* @__PURE__ */ u("label", {
118
118
  htmlFor: "displayName",
119
119
  className: "block text-sm font-medium text-text-primary mb-1",
120
120
  children: "Display Name *"
121
121
  }),
122
- /* @__PURE__ */ l("input", {
122
+ /* @__PURE__ */ u("input", {
123
123
  id: "displayName",
124
124
  type: "text",
125
- value: b,
126
- onChange: (e) => x(e.target.value),
125
+ value: x,
126
+ onChange: (e) => S(e.target.value),
127
127
  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)]",
128
128
  placeholder: "e.g., Tunnels, Session Starts, Webhooks",
129
129
  required: !0
130
130
  }),
131
- /* @__PURE__ */ l("p", {
131
+ /* @__PURE__ */ u("p", {
132
132
  className: "text-xs text-text-muted mt-1",
133
133
  children: "Human-readable name shown to users in billing and usage UI."
134
134
  })
135
135
  ] }),
136
- /* @__PURE__ */ u("div", { children: [
137
- /* @__PURE__ */ l("label", {
136
+ /* @__PURE__ */ d("div", { children: [
137
+ /* @__PURE__ */ u("label", {
138
138
  htmlFor: "description",
139
139
  className: "block text-sm font-medium text-text-primary mb-1",
140
140
  children: "Description"
141
141
  }),
142
- /* @__PURE__ */ l("textarea", {
142
+ /* @__PURE__ */ u("textarea", {
143
143
  id: "description",
144
- value: S,
145
- onChange: (e) => C(e.target.value),
144
+ value: C,
145
+ onChange: (e) => w(e.target.value),
146
146
  rows: 2,
147
147
  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",
148
148
  placeholder: "e.g., Active tunnels created through VibeControls (slot freed on delete)"
149
149
  }),
150
- /* @__PURE__ */ l("p", {
150
+ /* @__PURE__ */ u("p", {
151
151
  className: "text-xs text-text-muted mt-1",
152
152
  children: "Short explanation shown in billing and usage detail views."
153
153
  })
154
154
  ] }),
155
- /* @__PURE__ */ u("div", { children: [
156
- /* @__PURE__ */ l("label", {
155
+ /* @__PURE__ */ d("div", { children: [
156
+ /* @__PURE__ */ u("label", {
157
157
  htmlFor: "quotaType",
158
158
  className: "block text-sm font-medium text-text-primary mb-1",
159
159
  children: "Quota Type *"
160
160
  }),
161
- /* @__PURE__ */ u("select", {
161
+ /* @__PURE__ */ d(l, {
162
162
  id: "quotaType",
163
- value: A,
164
- onChange: (e) => j(e.target.value),
163
+ value: j,
164
+ onChange: (e) => M(e.target.value),
165
165
  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",
166
- children: [/* @__PURE__ */ l("option", {
166
+ children: [/* @__PURE__ */ u("option", {
167
167
  value: o.PRODUCT_SPECIFIC,
168
168
  children: "Product Specific"
169
- }), /* @__PURE__ */ l("option", {
169
+ }), /* @__PURE__ */ u("option", {
170
170
  value: o.POOLED,
171
171
  children: "Pooled"
172
172
  })]
173
173
  }),
174
- /* @__PURE__ */ l("p", {
174
+ /* @__PURE__ */ u("p", {
175
175
  className: "text-xs text-text-muted mt-1",
176
- children: A === o.POOLED ? "Shared across all products" : "Specific to individual products"
176
+ children: j === o.POOLED ? "Shared across all products" : "Specific to individual products"
177
177
  })
178
178
  ] }),
179
- /* @__PURE__ */ u("div", {
179
+ /* @__PURE__ */ d("div", {
180
180
  className: "flex items-center gap-3",
181
- children: [/* @__PURE__ */ l("input", {
181
+ children: [/* @__PURE__ */ u("input", {
182
182
  id: "reusable",
183
183
  type: "checkbox",
184
- checked: M,
185
- onChange: (e) => N(e.target.checked),
184
+ checked: N,
185
+ onChange: (e) => P(e.target.checked),
186
186
  className: "size-4 rounded border-border-subtle text-text-link focus:ring-[var(--color-focus-ring)]"
187
- }), /* @__PURE__ */ u("div", { children: [/* @__PURE__ */ l("label", {
187
+ }), /* @__PURE__ */ d("div", { children: [/* @__PURE__ */ u("label", {
188
188
  htmlFor: "reusable",
189
189
  className: "text-sm font-medium text-text-primary",
190
190
  children: "Reusable Quota"
191
- }), /* @__PURE__ */ l("p", {
191
+ }), /* @__PURE__ */ u("p", {
192
192
  className: "text-xs text-text-muted",
193
193
  children: "Enable for quotas like seats or bots that can be freed up"
194
194
  })] })]
195
195
  }),
196
- /* @__PURE__ */ u("div", { children: [
197
- /* @__PURE__ */ l("label", {
196
+ /* @__PURE__ */ d("div", { children: [
197
+ /* @__PURE__ */ u("label", {
198
198
  htmlFor: "resetPeriod",
199
199
  className: "block text-sm font-medium text-text-primary mb-1",
200
200
  children: "Reset Period"
201
201
  }),
202
- /* @__PURE__ */ u("select", {
202
+ /* @__PURE__ */ d(l, {
203
203
  id: "resetPeriod",
204
- value: P,
205
- onChange: (e) => F(e.target.value),
204
+ value: F,
205
+ onChange: (e) => I(e.target.value),
206
206
  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",
207
207
  children: [
208
- /* @__PURE__ */ l("option", {
208
+ /* @__PURE__ */ u("option", {
209
209
  value: a.NEVER,
210
210
  children: "Never (one-time limit)"
211
211
  }),
212
- /* @__PURE__ */ l("option", {
212
+ /* @__PURE__ */ u("option", {
213
213
  value: a.DAILY,
214
214
  children: "Daily (resets every day)"
215
215
  }),
216
- /* @__PURE__ */ l("option", {
216
+ /* @__PURE__ */ u("option", {
217
217
  value: a.MONTHLY,
218
218
  children: "Monthly (resets every month)"
219
219
  })
220
220
  ]
221
221
  }),
222
- /* @__PURE__ */ l("p", {
222
+ /* @__PURE__ */ u("p", {
223
223
  className: "text-xs text-text-muted mt-1",
224
224
  children: "How often the quota usage counter is reset to zero"
225
225
  })
@@ -227,82 +227,82 @@ var f = () => {
227
227
  ]
228
228
  })]
229
229
  }),
230
- /* @__PURE__ */ u("div", {
230
+ /* @__PURE__ */ d("div", {
231
231
  className: "border border-border-seam rounded-card bg-bg-surface overflow-hidden shadow-[var(--shadow-elevation-1)]",
232
- children: [/* @__PURE__ */ l("div", {
232
+ children: [/* @__PURE__ */ u("div", {
233
233
  className: "p-4 border-b border-border-subtle bg-bg-sunken/30",
234
- children: /* @__PURE__ */ l("h2", {
234
+ children: /* @__PURE__ */ u("h2", {
235
235
  className: "font-semibold text-text-primary",
236
236
  children: "Limits Configuration"
237
237
  })
238
- }), /* @__PURE__ */ u("div", {
238
+ }), /* @__PURE__ */ d("div", {
239
239
  className: "p-4 space-y-4",
240
240
  children: [
241
- /* @__PURE__ */ u("div", { children: [/* @__PURE__ */ l("label", {
241
+ /* @__PURE__ */ d("div", { children: [/* @__PURE__ */ u("label", {
242
242
  htmlFor: "limitType",
243
243
  className: "block text-sm font-medium text-text-primary mb-1",
244
244
  children: "Limit Type *"
245
- }), /* @__PURE__ */ u("select", {
245
+ }), /* @__PURE__ */ d(l, {
246
246
  id: "limitType",
247
- value: w,
248
- onChange: (e) => T(e.target.value),
247
+ value: T,
248
+ onChange: (e) => E(e.target.value),
249
249
  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",
250
250
  children: [
251
- /* @__PURE__ */ l("option", {
251
+ /* @__PURE__ */ u("option", {
252
252
  value: "numeric",
253
253
  children: "Numeric (count)"
254
254
  }),
255
- /* @__PURE__ */ l("option", {
255
+ /* @__PURE__ */ u("option", {
256
256
  value: "storage",
257
257
  children: "Storage (bytes)"
258
258
  }),
259
- /* @__PURE__ */ l("option", {
259
+ /* @__PURE__ */ u("option", {
260
260
  value: "duration",
261
261
  children: "Duration (seconds)"
262
262
  }),
263
- /* @__PURE__ */ l("option", {
263
+ /* @__PURE__ */ u("option", {
264
264
  value: "percentage",
265
265
  children: "Percentage"
266
266
  })
267
267
  ]
268
268
  })] }),
269
- /* @__PURE__ */ u("div", { children: [
270
- /* @__PURE__ */ l("label", {
269
+ /* @__PURE__ */ d("div", { children: [
270
+ /* @__PURE__ */ u("label", {
271
271
  htmlFor: "limitValue",
272
272
  className: "block text-sm font-medium text-text-primary mb-1",
273
273
  children: "Limit Value *"
274
274
  }),
275
- /* @__PURE__ */ l("input", {
275
+ /* @__PURE__ */ u("input", {
276
276
  id: "limitValue",
277
277
  type: "number",
278
278
  min: "0",
279
- value: E,
280
- onChange: (e) => D(e.target.value),
279
+ value: D,
280
+ onChange: (e) => O(e.target.value),
281
281
  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)]",
282
282
  placeholder: "1000",
283
283
  required: !0
284
284
  }),
285
- /* @__PURE__ */ l("p", {
285
+ /* @__PURE__ */ u("p", {
286
286
  className: "text-xs text-text-muted mt-1",
287
287
  children: "The maximum limit value for this quota"
288
288
  })
289
289
  ] }),
290
- /* @__PURE__ */ u("div", { children: [
291
- /* @__PURE__ */ l("label", {
290
+ /* @__PURE__ */ d("div", { children: [
291
+ /* @__PURE__ */ u("label", {
292
292
  htmlFor: "unit",
293
293
  className: "block text-sm font-medium text-text-primary mb-1",
294
294
  children: "Unit *"
295
295
  }),
296
- /* @__PURE__ */ l("input", {
296
+ /* @__PURE__ */ u("input", {
297
297
  id: "unit",
298
298
  type: "text",
299
- value: O,
300
- onChange: (e) => k(e.target.value),
299
+ value: k,
300
+ onChange: (e) => A(e.target.value),
301
301
  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)]",
302
302
  placeholder: "e.g., bots, GB, MB, seats, workflow runs",
303
303
  required: !0
304
304
  }),
305
- /* @__PURE__ */ l("p", {
305
+ /* @__PURE__ */ u("p", {
306
306
  className: "text-xs text-text-muted mt-1",
307
307
  children: "The unit of measurement displayed with usage values (e.g., \"2/6 bots\")"
308
308
  })
@@ -310,16 +310,16 @@ var f = () => {
310
310
  ]
311
311
  })]
312
312
  }),
313
- /* @__PURE__ */ u("div", {
313
+ /* @__PURE__ */ d("div", {
314
314
  className: "flex items-center gap-3 pt-4",
315
- children: [/* @__PURE__ */ l("button", {
315
+ children: [/* @__PURE__ */ u("button", {
316
316
  type: "submit",
317
- disabled: _,
317
+ disabled: v,
318
318
  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",
319
- children: _ ? p("billing.quota.creating", "Creating...") : p("billing.quota.createQuota", "Create Quota")
320
- }), /* @__PURE__ */ l("button", {
319
+ children: v ? m("billing.quota.creating", "Creating...") : m("billing.quota.createQuota", "Create Quota")
320
+ }), /* @__PURE__ */ u("button", {
321
321
  type: "button",
322
- onClick: () => m("/quotas"),
322
+ onClick: () => h("/quotas"),
323
323
  className: "px-6 py-2 text-sm font-medium border border-border-subtle text-text-primary rounded-button hover:bg-bg-sunken transition-colors",
324
324
  children: "Cancel"
325
325
  })]
@@ -327,8 +327,8 @@ var f = () => {
327
327
  ]
328
328
  })
329
329
  ]
330
- }) : /* @__PURE__ */ l(e, { message: "You don't have permission to create quotas." });
330
+ }) : /* @__PURE__ */ u(e, { message: "You don't have permission to create quotas." });
331
331
  };
332
- export { f as QuotaTemplateCreatePage };
332
+ export { p as QuotaTemplateCreatePage };
333
333
 
334
334
  //# sourceMappingURL=QuotaTemplateCreatePage.js.map