@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.
- package/dist/billing/modules/addons/pages/AddonCreatePage.js +143 -143
- package/dist/billing/modules/addons/pages/AddonCreatePage.js.map +1 -1
- package/dist/billing/modules/addons/pages/AddonEditPage.js +170 -170
- package/dist/billing/modules/addons/pages/AddonEditPage.js.map +1 -1
- package/dist/billing/modules/analytics/pages/AnalyticsPage.js +148 -148
- package/dist/billing/modules/analytics/pages/AnalyticsPage.js.map +1 -1
- package/dist/billing/modules/billing/pages/BillingWebhookLogsPage.js +115 -115
- package/dist/billing/modules/billing/pages/BillingWebhookLogsPage.js.map +1 -1
- package/dist/billing/modules/billing/pages/InvoicesListPage.js +136 -136
- package/dist/billing/modules/billing/pages/InvoicesListPage.js.map +1 -1
- package/dist/billing/modules/billing/pages/OrderCallbackLogsPage.js +129 -129
- package/dist/billing/modules/billing/pages/OrderCallbackLogsPage.js.map +1 -1
- package/dist/billing/modules/billing/pages/RefundsPage.js +325 -325
- package/dist/billing/modules/billing/pages/RefundsPage.js.map +1 -1
- package/dist/billing/modules/billing/pages/UserRefundsPage.js +149 -149
- package/dist/billing/modules/billing/pages/UserRefundsPage.js.map +1 -1
- package/dist/billing/modules/checkout/components/CompleteBillingAccountModal.js +99 -98
- package/dist/billing/modules/checkout/components/CompleteBillingAccountModal.js.map +1 -1
- package/dist/billing/modules/checkout/components/StoreShippingSection.js +125 -124
- package/dist/billing/modules/checkout/components/StoreShippingSection.js.map +1 -1
- package/dist/billing/modules/checkout/components/WorkspaceQuotaAssignmentModal.js +61 -60
- package/dist/billing/modules/checkout/components/WorkspaceQuotaAssignmentModal.js.map +1 -1
- package/dist/billing/modules/coupons/pages/CouponsListPage.js +177 -177
- package/dist/billing/modules/coupons/pages/CouponsListPage.js.map +1 -1
- package/dist/billing/modules/coupons/pages/CreateCouponPage.js +231 -231
- package/dist/billing/modules/coupons/pages/CreateCouponPage.js.map +1 -1
- package/dist/billing/modules/coupons/pages/EditCouponPage.js +139 -139
- package/dist/billing/modules/coupons/pages/EditCouponPage.js.map +1 -1
- package/dist/billing/modules/credits/pages/AdminCreditsPage.js +54 -54
- package/dist/billing/modules/credits/pages/AdminCreditsPage.js.map +1 -1
- package/dist/billing/modules/credits/pages/CreditWithdrawalPage.js +65 -65
- package/dist/billing/modules/credits/pages/CreditWithdrawalPage.js.map +1 -1
- package/dist/billing/modules/credits/pages/CreditsPage.js +95 -95
- package/dist/billing/modules/credits/pages/CreditsPage.js.map +1 -1
- package/dist/billing/modules/dashboard/components/CreateBillingAccountModal.js +232 -231
- package/dist/billing/modules/dashboard/components/CreateBillingAccountModal.js.map +1 -1
- package/dist/billing/modules/discounts/pages/DiscountsListPage.js +328 -328
- package/dist/billing/modules/discounts/pages/DiscountsListPage.js.map +1 -1
- package/dist/billing/modules/earnings/pages/DeveloperRevenueOrgDetailPage.js +57 -57
- package/dist/billing/modules/earnings/pages/DeveloperRevenueOrgDetailPage.js.map +1 -1
- package/dist/billing/modules/earnings/pages/EarningsPage.js +53 -53
- package/dist/billing/modules/earnings/pages/EarningsPage.js.map +1 -1
- package/dist/billing/modules/earnings/pages/PayoutsPage.js +100 -100
- package/dist/billing/modules/earnings/pages/PayoutsPage.js.map +1 -1
- package/dist/billing/modules/plans/pages/PlanCreatePage.js +150 -150
- package/dist/billing/modules/plans/pages/PlanCreatePage.js.map +1 -1
- package/dist/billing/modules/plans/pages/PlanEditPage.js +125 -125
- package/dist/billing/modules/plans/pages/PlanEditPage.js.map +1 -1
- package/dist/billing/modules/quota/pages/QuotaTemplateCreatePage.js +113 -113
- package/dist/billing/modules/quota/pages/QuotaTemplateCreatePage.js.map +1 -1
- package/dist/billing/modules/quota/pages/QuotaTemplateEditPage.js +132 -132
- package/dist/billing/modules/quota/pages/QuotaTemplateEditPage.js.map +1 -1
- package/dist/billing/modules/settings/pages/SettingsPage.js +101 -101
- package/dist/billing/modules/settings/pages/SettingsPage.js.map +1 -1
- package/dist/billing/modules/settings/pages/TeamPermissionsPage.js +125 -125
- package/dist/billing/modules/settings/pages/TeamPermissionsPage.js.map +1 -1
- package/dist/billing/modules/usage/components/WorkspaceAiSpendPanel.js +51 -50
- package/dist/billing/modules/usage/components/WorkspaceAiSpendPanel.js.map +1 -1
- package/dist/billing/modules/usage/pages/UsagePage.js +107 -107
- package/dist/billing/modules/usage/pages/UsagePage.js.map +1 -1
- package/dist/billing/shared/components/GeoPricingOverridesEditor.js +1 -0
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"QuotaTemplateCreatePage.js","names":["QuotaTemplateCreatePage","useI18n","tr","translated","t","key","fallback","navigateTo","useBillingNavigate","permissions","useBillingPermissions","useQuotaTemplateMutations","name","setName","useState","displayName","setDisplayName","description","setDescription","limitType","setLimitType","limitValue","setLimitValue","unit","setUnit","quotaType","setQuotaType","QuotaType","reusable","setReusable","resetPeriod","setResetPeriod","QuotaResetPeriod","error","setError","success","setSuccess","PageHeader","PagePurpose","input","createQuota","err","isCreating","AccessDenied"],"sources":["../../../../../src/billing/modules/quota/pages/QuotaTemplateCreatePage.tsx"],"sourcesContent":["/**\n * Quota Module - Quota Template Create Page\n * Form to create a new quota template\n */\n\nimport { useState, type FC, type FormEvent } from 'react';\nimport { useBillingNavigate } from '../../../hooks/useBillingNavigate';\nimport { useQuotaTemplateMutations } from '../hooks';\nimport { useBillingPermissions } from '../../../hooks/useBillingPermissions';\nimport { AccessDenied, PageHeader } from '../../../shared/components';\nimport { PagePurpose } from '@burdenoff/fe-libs/ui';\nimport { QuotaType, QuotaResetPeriod, type CreateQuotaInput } from '../../../shared/types';\nimport { useI18n } from '@burdenoff/fe-libs/shared/providers/shell/I18nProvider';\n\nexport const QuotaTemplateCreatePage: 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 navigateTo = useBillingNavigate();\n const permissions = useBillingPermissions();\n const { createQuota, isCreating } = 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 [quotaType, setQuotaType] = useState<QuotaType>(QuotaType.PRODUCT_SPECIFIC);\n const [reusable, setReusable] = useState(false);\n const [resetPeriod, setResetPeriod] = useState<QuotaResetPeriod>(QuotaResetPeriod.NEVER);\n const [error, setError] = useState<string | null>(null);\n const [success, setSuccess] = useState(false);\n\n // Permission check\n if (!permissions.canManageQuotas) {\n return <AccessDenied message=\"You don't have permission to create quotas.\" />;\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: CreateQuotaInput = {\n name: name.trim(),\n limits: {\n type: limitType,\n value: Number(limitValue),\n unit: unit.trim(),\n },\n quotaType,\n reusable,\n resetPeriod,\n context: {\n displayName: displayName.trim() || name.trim(),\n description: description.trim(),\n },\n };\n\n try {\n await createQuota(input);\n setSuccess(true);\n // Navigate back after short delay\n setTimeout(() => navigateTo('/quotas'), 1500);\n } catch (err) {\n setError(err instanceof Error ? err.message : 'Failed to create quota');\n }\n };\n\n return (\n <div className=\"space-y-6 p-6\">\n <PageHeader title=\"Create New Quota\" description=\"Set up a new quota template\" />\n\n <PagePurpose>\n Define a reusable limit — its name, type (pooled or product-specific), unit and default\n value — that you can then attach to any number of plans and add-ons. Build the template once\n here instead of redefining the same limit on every plan.\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 created 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 */}\n <div>\n <label\n htmlFor=\"quotaType\"\n className=\"block text-sm font-medium text-text-primary mb-1\"\n >\n Quota Type *\n </label>\n <select\n id=\"quotaType\"\n value={quotaType}\n onChange={(e) => setQuotaType(e.target.value as QuotaType)}\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={QuotaType.PRODUCT_SPECIFIC}>Product Specific</option>\n <option value={QuotaType.POOLED}>Pooled</option>\n </select>\n <p className=\"text-xs text-text-muted mt-1\">\n {quotaType === QuotaType.POOLED\n ? 'Shared across all products'\n : 'Specific to individual products'}\n </p>\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 </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., "2/6 bots")\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={isCreating}\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 {isCreating\n ? tr('billing.quota.creating', 'Creating...')\n : tr('billing.quota.createQuota', 'Create Quota')}\n </button>\n <button\n type=\"button\"\n onClick={() => navigateTo('/quotas')}\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":";;;;;;;;;;;;;AAcA,IAAaA,UAAoC;CAC/C,IAAM,EAAE,SAAMC,EAAQ,GAChBC,KAAM,GAAa,MAA6B;EACpD,IAAMC,IAAaC,EAAEC,CAAG;EACxB,OAAOF,MAAeE,IAAMC,IAAWH;CACzC,GACMI,IAAaC,EAAmB,GAChCC,IAAcC,EAAsB,GACpC,EAAE,gBAAa,kBAAeC,EAA0B,GAGxD,CAACC,GAAMC,KAAWC,EAAS,EAAE,GAC7B,CAACC,GAAaC,KAAkBF,EA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E,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,UAAUkB;OACV,WAAU;OAET,UAAAA,IACGxC,EAAG,0BAA0B,aAAa,IAC1CA,EAAG,6BAA6B,cAAc;MAC5C,CAAA,GACR,kBAAC,UAAD;OACE,MAAK;OACL,eAAeK,EAAW,SAAS;OACnC,WAAU;OACX,UAAA;MAEO,CAAA,CACL;;IACD;;EACH;C,KA3SE,kBAACoC,GAAD,EAAc,SAAQ,8CAA+C,CAAA;AA6ShF"}
|
|
1
|
+
{"version":3,"file":"QuotaTemplateCreatePage.js","names":["QuotaTemplateCreatePage","useI18n","tr","translated","t","key","fallback","navigateTo","useBillingNavigate","permissions","useBillingPermissions","useQuotaTemplateMutations","name","setName","useState","displayName","setDisplayName","description","setDescription","limitType","setLimitType","limitValue","setLimitValue","unit","setUnit","quotaType","setQuotaType","QuotaType","reusable","setReusable","resetPeriod","setResetPeriod","QuotaResetPeriod","error","setError","success","setSuccess","PageHeader","PagePurpose","input","createQuota","err","ThemedSelect","isCreating","AccessDenied"],"sources":["../../../../../src/billing/modules/quota/pages/QuotaTemplateCreatePage.tsx"],"sourcesContent":["/**\n * Quota Module - Quota Template Create Page\n * Form to create a new quota template\n */\n\nimport { useState, type FC, type FormEvent } from 'react';\nimport { useBillingNavigate } from '../../../hooks/useBillingNavigate';\nimport { useQuotaTemplateMutations } from '../hooks';\nimport { useBillingPermissions } from '../../../hooks/useBillingPermissions';\nimport { AccessDenied, PageHeader } from '../../../shared/components';\nimport { PagePurpose, ThemedSelect } from '@burdenoff/fe-libs/ui';\nimport { QuotaType, QuotaResetPeriod, type CreateQuotaInput } from '../../../shared/types';\nimport { useI18n } from '@burdenoff/fe-libs/shared/providers/shell/I18nProvider';\n\nexport const QuotaTemplateCreatePage: 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 navigateTo = useBillingNavigate();\n const permissions = useBillingPermissions();\n const { createQuota, isCreating } = 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 [quotaType, setQuotaType] = useState<QuotaType>(QuotaType.PRODUCT_SPECIFIC);\n const [reusable, setReusable] = useState(false);\n const [resetPeriod, setResetPeriod] = useState<QuotaResetPeriod>(QuotaResetPeriod.NEVER);\n const [error, setError] = useState<string | null>(null);\n const [success, setSuccess] = useState(false);\n\n // Permission check\n if (!permissions.canManageQuotas) {\n return <AccessDenied message=\"You don't have permission to create quotas.\" />;\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: CreateQuotaInput = {\n name: name.trim(),\n limits: {\n type: limitType,\n value: Number(limitValue),\n unit: unit.trim(),\n },\n quotaType,\n reusable,\n resetPeriod,\n context: {\n displayName: displayName.trim() || name.trim(),\n description: description.trim(),\n },\n };\n\n try {\n await createQuota(input);\n setSuccess(true);\n // Navigate back after short delay\n setTimeout(() => navigateTo('/quotas'), 1500);\n } catch (err) {\n setError(err instanceof Error ? err.message : 'Failed to create quota');\n }\n };\n\n return (\n <div className=\"space-y-6 p-6\">\n <PageHeader title=\"Create New Quota\" description=\"Set up a new quota template\" />\n\n <PagePurpose>\n Define a reusable limit — its name, type (pooled or product-specific), unit and default\n value — that you can then attach to any number of plans and add-ons. Build the template once\n here instead of redefining the same limit on every plan.\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 created 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 */}\n <div>\n <label\n htmlFor=\"quotaType\"\n className=\"block text-sm font-medium text-text-primary mb-1\"\n >\n Quota Type *\n </label>\n <ThemedSelect\n id=\"quotaType\"\n value={quotaType}\n onChange={(e) => setQuotaType(e.target.value as QuotaType)}\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={QuotaType.PRODUCT_SPECIFIC}>Product Specific</option>\n <option value={QuotaType.POOLED}>Pooled</option>\n </ThemedSelect>\n <p className=\"text-xs text-text-muted mt-1\">\n {quotaType === QuotaType.POOLED\n ? 'Shared across all products'\n : 'Specific to individual products'}\n </p>\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 </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., "2/6 bots")\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={isCreating}\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 {isCreating\n ? tr('billing.quota.creating', 'Creating...')\n : tr('billing.quota.createQuota', 'Create Quota')}\n </button>\n <button\n type=\"button\"\n onClick={() => navigateTo('/quotas')}\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":";;;;;;;;;;;;;AAcA,IAAaA,UAAoC;CAC/C,IAAM,EAAE,SAAMC,EAAQ,GAChBC,KAAM,GAAa,MAA6B;EACpD,IAAMC,IAAaC,EAAEC,CAAG;EACxB,OAAOF,MAAeE,IAAMC,IAAWH;CACzC,GACMI,IAAaC,EAAmB,GAChCC,IAAcC,EAAsB,GACpC,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,GAAWC,KAAgBZ,EAAoBa,EAAU,gBAAgB,GAC1E,CAACC,GAAUC,KAAef,EAAS,EAAK,GACxC,CAACgB,GAAaC,KAAkBjB,EAA2BkB,EAAiB,KAAK,GACjF,CAACC,GAAOC,KAAYpB,EAAwB,IAAI,GAChD,CAACqB,GAASC,KAActB,EAAS,EAAK;CAoD5C,OAjDKL,EAAY,kBAkDf,kBAAC,OAAD;EAAK,WAAU;EAAf,UAAA;GACE,kBAAC4B,GAAD;IAAY,OAAM;IAAmB,aAAY;GAA+B,CAAA;GAEhF,kBAACC,GAAD,EAAA,UAAa,gPAIA,CAAA;GAEb,kBAAC,QAAD;IAAM,UAAU,OAvDQ,MAAiB;KAM3C,IALA,EAAE,eAAe,GACjBJ,EAAS,IAAI,GACbE,EAAW,EAAK,GAGZ,CAACxB,EAAK,KAAK,GAAG;MAChB,EAAS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;OACX,UAAA;MAEO,CAAA,CACL;;IACD;;EACH;C,KA3SE,kBAACqC,GAAD,EAAc,SAAQ,8CAA+C,CAAA;AA6ShF"}
|
|
@@ -10,247 +10,247 @@ import "../../../shared/utils/index.js";
|
|
|
10
10
|
import { useQuotaTemplate as o, useQuotaTemplateMutations as s } from "../hooks/useQuotaTemplates.js";
|
|
11
11
|
import { QuotaResetPeriod as c } from "../../../shared/types/graphql.js";
|
|
12
12
|
import { useEffect as l, useState as u } from "react";
|
|
13
|
-
import { PagePurpose as d } from "@burdenoff/fe-libs/ui";
|
|
14
|
-
import { useParams as
|
|
15
|
-
import { jsx as
|
|
16
|
-
import { useI18n as
|
|
13
|
+
import { PagePurpose as d, ThemedSelect as f } from "@burdenoff/fe-libs/ui";
|
|
14
|
+
import { useParams as p } from "react-router";
|
|
15
|
+
import { jsx as m, jsxs as h } from "react/jsx-runtime";
|
|
16
|
+
import { useI18n as g } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
|
|
17
17
|
// src/billing/modules/quota/pages/QuotaTemplateEditPage.tsx
|
|
18
|
-
var
|
|
19
|
-
let { t:
|
|
20
|
-
let n =
|
|
18
|
+
var _ = () => {
|
|
19
|
+
let { t: _ } = g(), v = (e, t) => {
|
|
20
|
+
let n = _(e);
|
|
21
21
|
return n === e ? t : n;
|
|
22
|
-
}, { quotaId:
|
|
22
|
+
}, { quotaId: y } = p(), b = r(), x = i(), { quota: S, isLoading: C, error: w, refetch: T } = o(y), { updateQuota: E, isUpdating: D } = s(), [O, k] = u(""), [A, j] = u(""), [M, N] = u(""), [P, F] = u("numeric"), [I, L] = u(""), [R, z] = u(""), [B, V] = u(!1), [H, U] = u(c.NEVER), [W, G] = u(!0), [K, q] = u(null), [J, Y] = u(!1);
|
|
23
23
|
return l(() => {
|
|
24
|
-
if (
|
|
25
|
-
|
|
26
|
-
let e =
|
|
27
|
-
|
|
28
|
-
let t =
|
|
29
|
-
|
|
24
|
+
if (S) {
|
|
25
|
+
k(S.name ?? ""), V(S.reusable ?? !1), U(S.resetPeriod ?? c.NEVER), G(S.isActive ?? !0);
|
|
26
|
+
let e = S.limits;
|
|
27
|
+
F(e?.type ?? "numeric"), L(String(e?.value ?? "")), z(e?.unit ?? "");
|
|
28
|
+
let t = S.context;
|
|
29
|
+
j(t?.displayName ?? ""), N(t?.description ?? "");
|
|
30
30
|
}
|
|
31
|
-
}, [
|
|
31
|
+
}, [S]), x.canManageQuotas ? C ? /* @__PURE__ */ h("div", {
|
|
32
32
|
className: "space-y-6 p-6",
|
|
33
|
-
children: [/* @__PURE__ */
|
|
33
|
+
children: [/* @__PURE__ */ m("div", { className: "h-8 w-48 bg-bg-sunken animate-pulse rounded" }), /* @__PURE__ */ m("div", {
|
|
34
34
|
className: "max-w-2xl space-y-4",
|
|
35
35
|
children: [
|
|
36
36
|
1,
|
|
37
37
|
2,
|
|
38
38
|
3,
|
|
39
39
|
4
|
|
40
|
-
].map((e) => /* @__PURE__ */
|
|
40
|
+
].map((e) => /* @__PURE__ */ m("div", { className: "h-16 bg-bg-sunken animate-pulse rounded" }, e))
|
|
41
41
|
})]
|
|
42
|
-
}) :
|
|
42
|
+
}) : w && a(w) ? /* @__PURE__ */ m("div", {
|
|
43
43
|
className: "p-6",
|
|
44
|
-
children: /* @__PURE__ */
|
|
44
|
+
children: /* @__PURE__ */ m(n, {
|
|
45
45
|
title: "Server Unavailable",
|
|
46
46
|
message: "Unable to load quota. The server might be down or experiencing issues.",
|
|
47
|
-
onRetry: () =>
|
|
47
|
+
onRetry: () => T(),
|
|
48
48
|
showRetry: !0
|
|
49
49
|
})
|
|
50
|
-
}) :
|
|
50
|
+
}) : S ? /* @__PURE__ */ h("div", {
|
|
51
51
|
className: "space-y-6 p-6",
|
|
52
52
|
children: [
|
|
53
|
-
/* @__PURE__ */
|
|
54
|
-
title: `Edit Quota: ${
|
|
53
|
+
/* @__PURE__ */ m(t, {
|
|
54
|
+
title: `Edit Quota: ${S.context?.displayName ?? S.name}`,
|
|
55
55
|
description: "Update the quota template configuration"
|
|
56
56
|
}),
|
|
57
|
-
/* @__PURE__ */
|
|
58
|
-
/* @__PURE__ */
|
|
57
|
+
/* @__PURE__ */ m(d, { children: "Adjust this quota template's configuration. Changes apply wherever the template is referenced, so review which plans and add-ons use it before changing its type or unit." }),
|
|
58
|
+
/* @__PURE__ */ h("form", {
|
|
59
59
|
onSubmit: async (e) => {
|
|
60
|
-
if (e.preventDefault(),
|
|
61
|
-
|
|
60
|
+
if (e.preventDefault(), q(null), Y(!1), !O.trim()) {
|
|
61
|
+
q("Quota name is required");
|
|
62
62
|
return;
|
|
63
63
|
}
|
|
64
|
-
if (!
|
|
65
|
-
|
|
64
|
+
if (!I || isNaN(Number(I)) || Number(I) < 0) {
|
|
65
|
+
q("Valid limit value is required");
|
|
66
66
|
return;
|
|
67
67
|
}
|
|
68
|
-
if (!
|
|
69
|
-
|
|
68
|
+
if (!R.trim()) {
|
|
69
|
+
q("Unit is required (e.g., bots, GB, seats)");
|
|
70
70
|
return;
|
|
71
71
|
}
|
|
72
72
|
let t = {
|
|
73
|
-
id:
|
|
74
|
-
name:
|
|
73
|
+
id: y,
|
|
74
|
+
name: O.trim(),
|
|
75
75
|
limits: {
|
|
76
|
-
type:
|
|
77
|
-
value: Number(
|
|
78
|
-
unit:
|
|
76
|
+
type: P,
|
|
77
|
+
value: Number(I),
|
|
78
|
+
unit: R.trim()
|
|
79
79
|
},
|
|
80
|
-
reusable:
|
|
81
|
-
isActive:
|
|
82
|
-
resetPeriod:
|
|
80
|
+
reusable: B,
|
|
81
|
+
isActive: W,
|
|
82
|
+
resetPeriod: H,
|
|
83
83
|
context: {
|
|
84
|
-
displayName:
|
|
85
|
-
description:
|
|
84
|
+
displayName: A.trim() || O.trim(),
|
|
85
|
+
description: M.trim()
|
|
86
86
|
}
|
|
87
87
|
};
|
|
88
88
|
try {
|
|
89
|
-
await
|
|
89
|
+
await E(t), Y(!0), setTimeout(() => b(`/quotas/${y}`), 1500);
|
|
90
90
|
} catch (e) {
|
|
91
|
-
|
|
91
|
+
q(e instanceof Error ? e.message : "Failed to update quota");
|
|
92
92
|
}
|
|
93
93
|
},
|
|
94
94
|
className: "max-w-2xl space-y-6",
|
|
95
95
|
children: [
|
|
96
|
-
|
|
96
|
+
K && /* @__PURE__ */ m("div", {
|
|
97
97
|
className: "p-4 bg-status-error-bg-subtle border border-border-subtle rounded-lg",
|
|
98
|
-
children: /* @__PURE__ */
|
|
98
|
+
children: /* @__PURE__ */ m("p", {
|
|
99
99
|
className: "text-sm text-status-error-text",
|
|
100
|
-
children:
|
|
100
|
+
children: K
|
|
101
101
|
})
|
|
102
102
|
}),
|
|
103
|
-
|
|
103
|
+
J && /* @__PURE__ */ m("div", {
|
|
104
104
|
className: "p-4 bg-status-success-bg-subtle border border-border-subtle rounded-lg",
|
|
105
|
-
children: /* @__PURE__ */
|
|
105
|
+
children: /* @__PURE__ */ m("p", {
|
|
106
106
|
className: "text-sm text-status-success-text",
|
|
107
107
|
children: "Quota updated successfully! Redirecting…"
|
|
108
108
|
})
|
|
109
109
|
}),
|
|
110
|
-
/* @__PURE__ */
|
|
110
|
+
/* @__PURE__ */ h("div", {
|
|
111
111
|
className: "border border-border-seam rounded-card bg-bg-surface overflow-hidden shadow-[var(--shadow-elevation-1)]",
|
|
112
|
-
children: [/* @__PURE__ */
|
|
112
|
+
children: [/* @__PURE__ */ m("div", {
|
|
113
113
|
className: "p-4 border-b border-border-subtle bg-bg-sunken/30",
|
|
114
|
-
children: /* @__PURE__ */
|
|
114
|
+
children: /* @__PURE__ */ m("h2", {
|
|
115
115
|
className: "font-semibold text-text-primary",
|
|
116
116
|
children: "Basic Information"
|
|
117
117
|
})
|
|
118
|
-
}), /* @__PURE__ */
|
|
118
|
+
}), /* @__PURE__ */ h("div", {
|
|
119
119
|
className: "p-4 space-y-4",
|
|
120
120
|
children: [
|
|
121
|
-
/* @__PURE__ */
|
|
122
|
-
/* @__PURE__ */
|
|
121
|
+
/* @__PURE__ */ h("div", { children: [
|
|
122
|
+
/* @__PURE__ */ m("label", {
|
|
123
123
|
htmlFor: "name",
|
|
124
124
|
className: "block text-sm font-medium text-text-primary mb-1",
|
|
125
125
|
children: "Quota Key *"
|
|
126
126
|
}),
|
|
127
|
-
/* @__PURE__ */
|
|
127
|
+
/* @__PURE__ */ m("input", {
|
|
128
128
|
id: "name",
|
|
129
129
|
type: "text",
|
|
130
|
-
value:
|
|
131
|
-
onChange: (e) =>
|
|
130
|
+
value: O,
|
|
131
|
+
onChange: (e) => k(e.target.value),
|
|
132
132
|
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",
|
|
133
133
|
placeholder: "e.g., sessions-started, tunnels-created",
|
|
134
134
|
required: !0
|
|
135
135
|
}),
|
|
136
|
-
/* @__PURE__ */
|
|
136
|
+
/* @__PURE__ */ h("p", {
|
|
137
137
|
className: "text-xs text-text-muted mt-1",
|
|
138
138
|
children: [
|
|
139
139
|
"Internal machine key, must match the ",
|
|
140
|
-
/* @__PURE__ */
|
|
140
|
+
/* @__PURE__ */ m("code", { children: "quotaName" }),
|
|
141
141
|
" used in",
|
|
142
142
|
" ",
|
|
143
|
-
/* @__PURE__ */
|
|
143
|
+
/* @__PURE__ */ m("code", { children: "@usage" }),
|
|
144
144
|
" directives. Never shown to users."
|
|
145
145
|
]
|
|
146
146
|
})
|
|
147
147
|
] }),
|
|
148
|
-
/* @__PURE__ */
|
|
149
|
-
/* @__PURE__ */
|
|
148
|
+
/* @__PURE__ */ h("div", { children: [
|
|
149
|
+
/* @__PURE__ */ m("label", {
|
|
150
150
|
htmlFor: "displayName",
|
|
151
151
|
className: "block text-sm font-medium text-text-primary mb-1",
|
|
152
152
|
children: "Display Name *"
|
|
153
153
|
}),
|
|
154
|
-
/* @__PURE__ */
|
|
154
|
+
/* @__PURE__ */ m("input", {
|
|
155
155
|
id: "displayName",
|
|
156
156
|
type: "text",
|
|
157
|
-
value:
|
|
158
|
-
onChange: (e) =>
|
|
157
|
+
value: A,
|
|
158
|
+
onChange: (e) => j(e.target.value),
|
|
159
159
|
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)]",
|
|
160
160
|
placeholder: "e.g., Tunnels, Session Starts, Webhooks",
|
|
161
161
|
required: !0
|
|
162
162
|
}),
|
|
163
|
-
/* @__PURE__ */
|
|
163
|
+
/* @__PURE__ */ m("p", {
|
|
164
164
|
className: "text-xs text-text-muted mt-1",
|
|
165
165
|
children: "Human-readable name shown to users in billing and usage UI."
|
|
166
166
|
})
|
|
167
167
|
] }),
|
|
168
|
-
/* @__PURE__ */
|
|
169
|
-
/* @__PURE__ */
|
|
168
|
+
/* @__PURE__ */ h("div", { children: [
|
|
169
|
+
/* @__PURE__ */ m("label", {
|
|
170
170
|
htmlFor: "description",
|
|
171
171
|
className: "block text-sm font-medium text-text-primary mb-1",
|
|
172
172
|
children: "Description"
|
|
173
173
|
}),
|
|
174
|
-
/* @__PURE__ */
|
|
174
|
+
/* @__PURE__ */ m("textarea", {
|
|
175
175
|
id: "description",
|
|
176
|
-
value:
|
|
177
|
-
onChange: (e) =>
|
|
176
|
+
value: M,
|
|
177
|
+
onChange: (e) => N(e.target.value),
|
|
178
178
|
rows: 2,
|
|
179
179
|
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",
|
|
180
180
|
placeholder: "e.g., Active tunnels created through VibeControls (slot freed on delete)"
|
|
181
181
|
}),
|
|
182
|
-
/* @__PURE__ */
|
|
182
|
+
/* @__PURE__ */ m("p", {
|
|
183
183
|
className: "text-xs text-text-muted mt-1",
|
|
184
184
|
children: "Short explanation shown in billing and usage detail views."
|
|
185
185
|
})
|
|
186
186
|
] }),
|
|
187
|
-
/* @__PURE__ */
|
|
187
|
+
/* @__PURE__ */ h("div", { children: [/* @__PURE__ */ m("label", {
|
|
188
188
|
className: "block text-sm font-medium text-text-primary mb-1",
|
|
189
189
|
children: "Quota Type"
|
|
190
|
-
}), /* @__PURE__ */
|
|
190
|
+
}), /* @__PURE__ */ h("div", {
|
|
191
191
|
className: "px-3 py-2 border border-border-subtle rounded-md bg-bg-sunken/50 text-text-muted",
|
|
192
|
-
children: [
|
|
192
|
+
children: [S.quotaType === "POOLED" ? "Pooled" : "Product Specific", /* @__PURE__ */ m("span", {
|
|
193
193
|
className: "text-xs ml-2",
|
|
194
194
|
children: "(cannot be changed)"
|
|
195
195
|
})]
|
|
196
196
|
})] }),
|
|
197
|
-
/* @__PURE__ */
|
|
197
|
+
/* @__PURE__ */ h("div", {
|
|
198
198
|
className: "flex items-center gap-3",
|
|
199
|
-
children: [/* @__PURE__ */
|
|
199
|
+
children: [/* @__PURE__ */ m("input", {
|
|
200
200
|
id: "reusable",
|
|
201
201
|
type: "checkbox",
|
|
202
|
-
checked:
|
|
203
|
-
onChange: (e) =>
|
|
202
|
+
checked: B,
|
|
203
|
+
onChange: (e) => V(e.target.checked),
|
|
204
204
|
className: "size-4 rounded border-border-subtle text-text-link focus:ring-[var(--color-focus-ring)]"
|
|
205
|
-
}), /* @__PURE__ */
|
|
205
|
+
}), /* @__PURE__ */ h("div", { children: [/* @__PURE__ */ m("label", {
|
|
206
206
|
htmlFor: "reusable",
|
|
207
207
|
className: "text-sm font-medium text-text-primary",
|
|
208
208
|
children: "Reusable Quota"
|
|
209
|
-
}), /* @__PURE__ */
|
|
209
|
+
}), /* @__PURE__ */ m("p", {
|
|
210
210
|
className: "text-xs text-text-muted",
|
|
211
211
|
children: "Enable for quotas like seats or bots that can be freed up"
|
|
212
212
|
})] })]
|
|
213
213
|
}),
|
|
214
|
-
/* @__PURE__ */
|
|
215
|
-
/* @__PURE__ */
|
|
214
|
+
/* @__PURE__ */ h("div", { children: [
|
|
215
|
+
/* @__PURE__ */ m("label", {
|
|
216
216
|
htmlFor: "resetPeriod",
|
|
217
217
|
className: "block text-sm font-medium text-text-primary mb-1",
|
|
218
218
|
children: "Reset Period"
|
|
219
219
|
}),
|
|
220
|
-
/* @__PURE__ */
|
|
220
|
+
/* @__PURE__ */ h(f, {
|
|
221
221
|
id: "resetPeriod",
|
|
222
|
-
value:
|
|
223
|
-
onChange: (e) =>
|
|
222
|
+
value: H,
|
|
223
|
+
onChange: (e) => U(e.target.value),
|
|
224
224
|
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",
|
|
225
225
|
children: [
|
|
226
|
-
/* @__PURE__ */
|
|
226
|
+
/* @__PURE__ */ m("option", {
|
|
227
227
|
value: c.NEVER,
|
|
228
228
|
children: "Never (one-time limit)"
|
|
229
229
|
}),
|
|
230
|
-
/* @__PURE__ */
|
|
230
|
+
/* @__PURE__ */ m("option", {
|
|
231
231
|
value: c.DAILY,
|
|
232
232
|
children: "Daily (resets every day)"
|
|
233
233
|
}),
|
|
234
|
-
/* @__PURE__ */
|
|
234
|
+
/* @__PURE__ */ m("option", {
|
|
235
235
|
value: c.MONTHLY,
|
|
236
236
|
children: "Monthly (resets every month)"
|
|
237
237
|
})
|
|
238
238
|
]
|
|
239
239
|
}),
|
|
240
|
-
/* @__PURE__ */
|
|
240
|
+
/* @__PURE__ */ m("p", {
|
|
241
241
|
className: "text-xs text-text-muted mt-1",
|
|
242
242
|
children: "How often the quota usage counter is reset to zero"
|
|
243
243
|
})
|
|
244
244
|
] }),
|
|
245
|
-
/* @__PURE__ */
|
|
245
|
+
/* @__PURE__ */ h("div", {
|
|
246
246
|
className: "flex items-center gap-3",
|
|
247
|
-
children: [/* @__PURE__ */
|
|
247
|
+
children: [/* @__PURE__ */ m("input", {
|
|
248
248
|
id: "isActive",
|
|
249
249
|
type: "checkbox",
|
|
250
|
-
checked:
|
|
251
|
-
onChange: (e) =>
|
|
250
|
+
checked: W,
|
|
251
|
+
onChange: (e) => G(e.target.checked),
|
|
252
252
|
className: "size-4 rounded border-border-subtle text-text-link focus:ring-[var(--color-focus-ring)]"
|
|
253
|
-
}), /* @__PURE__ */
|
|
253
|
+
}), /* @__PURE__ */ m("label", {
|
|
254
254
|
htmlFor: "isActive",
|
|
255
255
|
className: "text-sm font-medium text-text-primary",
|
|
256
256
|
children: "Quota is active"
|
|
@@ -259,82 +259,82 @@ var g = () => {
|
|
|
259
259
|
]
|
|
260
260
|
})]
|
|
261
261
|
}),
|
|
262
|
-
/* @__PURE__ */
|
|
262
|
+
/* @__PURE__ */ h("div", {
|
|
263
263
|
className: "border border-border-seam rounded-card bg-bg-surface overflow-hidden shadow-[var(--shadow-elevation-1)]",
|
|
264
|
-
children: [/* @__PURE__ */
|
|
264
|
+
children: [/* @__PURE__ */ m("div", {
|
|
265
265
|
className: "p-4 border-b border-border-subtle bg-bg-sunken/30",
|
|
266
|
-
children: /* @__PURE__ */
|
|
266
|
+
children: /* @__PURE__ */ m("h2", {
|
|
267
267
|
className: "font-semibold text-text-primary",
|
|
268
268
|
children: "Limits Configuration"
|
|
269
269
|
})
|
|
270
|
-
}), /* @__PURE__ */
|
|
270
|
+
}), /* @__PURE__ */ h("div", {
|
|
271
271
|
className: "p-4 space-y-4",
|
|
272
272
|
children: [
|
|
273
|
-
/* @__PURE__ */
|
|
273
|
+
/* @__PURE__ */ h("div", { children: [/* @__PURE__ */ m("label", {
|
|
274
274
|
htmlFor: "limitType",
|
|
275
275
|
className: "block text-sm font-medium text-text-primary mb-1",
|
|
276
276
|
children: "Limit Type *"
|
|
277
|
-
}), /* @__PURE__ */
|
|
277
|
+
}), /* @__PURE__ */ h(f, {
|
|
278
278
|
id: "limitType",
|
|
279
|
-
value:
|
|
280
|
-
onChange: (e) =>
|
|
279
|
+
value: P,
|
|
280
|
+
onChange: (e) => F(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)] scheme-normal dark:scheme-dark [&_option]:bg-bg-surface [&_option]:text-text-primary",
|
|
282
282
|
children: [
|
|
283
|
-
/* @__PURE__ */
|
|
283
|
+
/* @__PURE__ */ m("option", {
|
|
284
284
|
value: "numeric",
|
|
285
285
|
children: "Numeric (count)"
|
|
286
286
|
}),
|
|
287
|
-
/* @__PURE__ */
|
|
287
|
+
/* @__PURE__ */ m("option", {
|
|
288
288
|
value: "storage",
|
|
289
289
|
children: "Storage (bytes)"
|
|
290
290
|
}),
|
|
291
|
-
/* @__PURE__ */
|
|
291
|
+
/* @__PURE__ */ m("option", {
|
|
292
292
|
value: "duration",
|
|
293
293
|
children: "Duration (seconds)"
|
|
294
294
|
}),
|
|
295
|
-
/* @__PURE__ */
|
|
295
|
+
/* @__PURE__ */ m("option", {
|
|
296
296
|
value: "percentage",
|
|
297
297
|
children: "Percentage"
|
|
298
298
|
})
|
|
299
299
|
]
|
|
300
300
|
})] }),
|
|
301
|
-
/* @__PURE__ */
|
|
302
|
-
/* @__PURE__ */
|
|
301
|
+
/* @__PURE__ */ h("div", { children: [
|
|
302
|
+
/* @__PURE__ */ m("label", {
|
|
303
303
|
htmlFor: "limitValue",
|
|
304
304
|
className: "block text-sm font-medium text-text-primary mb-1",
|
|
305
305
|
children: "Limit Value *"
|
|
306
306
|
}),
|
|
307
|
-
/* @__PURE__ */
|
|
307
|
+
/* @__PURE__ */ m("input", {
|
|
308
308
|
id: "limitValue",
|
|
309
309
|
type: "number",
|
|
310
310
|
min: "0",
|
|
311
|
-
value:
|
|
312
|
-
onChange: (e) =>
|
|
311
|
+
value: I,
|
|
312
|
+
onChange: (e) => L(e.target.value),
|
|
313
313
|
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)]",
|
|
314
314
|
placeholder: "1000",
|
|
315
315
|
required: !0
|
|
316
316
|
}),
|
|
317
|
-
/* @__PURE__ */
|
|
317
|
+
/* @__PURE__ */ m("p", {
|
|
318
318
|
className: "text-xs text-text-muted mt-1",
|
|
319
319
|
children: "The maximum limit value for this quota"
|
|
320
320
|
})
|
|
321
321
|
] }),
|
|
322
|
-
/* @__PURE__ */
|
|
323
|
-
/* @__PURE__ */
|
|
322
|
+
/* @__PURE__ */ h("div", { children: [
|
|
323
|
+
/* @__PURE__ */ m("label", {
|
|
324
324
|
htmlFor: "unit",
|
|
325
325
|
className: "block text-sm font-medium text-text-primary mb-1",
|
|
326
326
|
children: "Unit *"
|
|
327
327
|
}),
|
|
328
|
-
/* @__PURE__ */
|
|
328
|
+
/* @__PURE__ */ m("input", {
|
|
329
329
|
id: "unit",
|
|
330
330
|
type: "text",
|
|
331
|
-
value:
|
|
332
|
-
onChange: (e) =>
|
|
331
|
+
value: R,
|
|
332
|
+
onChange: (e) => z(e.target.value),
|
|
333
333
|
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)]",
|
|
334
334
|
placeholder: "e.g., bots, GB, MB, seats, workflow runs",
|
|
335
335
|
required: !0
|
|
336
336
|
}),
|
|
337
|
-
/* @__PURE__ */
|
|
337
|
+
/* @__PURE__ */ m("p", {
|
|
338
338
|
className: "text-xs text-text-muted mt-1",
|
|
339
339
|
children: "The unit of measurement displayed with usage values (e.g., \"2/6 bots\")"
|
|
340
340
|
})
|
|
@@ -342,16 +342,16 @@ var g = () => {
|
|
|
342
342
|
]
|
|
343
343
|
})]
|
|
344
344
|
}),
|
|
345
|
-
/* @__PURE__ */
|
|
345
|
+
/* @__PURE__ */ h("div", {
|
|
346
346
|
className: "flex items-center gap-3 pt-4",
|
|
347
|
-
children: [/* @__PURE__ */
|
|
347
|
+
children: [/* @__PURE__ */ m("button", {
|
|
348
348
|
type: "submit",
|
|
349
|
-
disabled:
|
|
349
|
+
disabled: D,
|
|
350
350
|
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",
|
|
351
|
-
children:
|
|
352
|
-
}), /* @__PURE__ */
|
|
351
|
+
children: D ? v("billing.quota.saving", "Saving...") : v("billing.quota.saveChanges", "Save Changes")
|
|
352
|
+
}), /* @__PURE__ */ m("button", {
|
|
353
353
|
type: "button",
|
|
354
|
-
onClick: () =>
|
|
354
|
+
onClick: () => b(`/quotas/${y}`),
|
|
355
355
|
className: "px-6 py-2 text-sm font-medium border border-border-subtle text-text-primary rounded-button hover:bg-bg-sunken transition-colors",
|
|
356
356
|
children: "Cancel"
|
|
357
357
|
})]
|
|
@@ -359,22 +359,22 @@ var g = () => {
|
|
|
359
359
|
]
|
|
360
360
|
})
|
|
361
361
|
]
|
|
362
|
-
}) : /* @__PURE__ */
|
|
362
|
+
}) : /* @__PURE__ */ m("div", {
|
|
363
363
|
className: "flex items-center justify-center h-full min-h-[400px]",
|
|
364
|
-
children: /* @__PURE__ */
|
|
364
|
+
children: /* @__PURE__ */ h("div", {
|
|
365
365
|
className: "text-center space-y-4",
|
|
366
|
-
children: [/* @__PURE__ */
|
|
366
|
+
children: [/* @__PURE__ */ m("h2", {
|
|
367
367
|
className: "text-lg font-semibold text-text-primary",
|
|
368
368
|
children: "Quota not found"
|
|
369
|
-
}), /* @__PURE__ */
|
|
369
|
+
}), /* @__PURE__ */ m("button", {
|
|
370
370
|
type: "button",
|
|
371
|
-
onClick: () =>
|
|
371
|
+
onClick: () => b("/quotas"),
|
|
372
372
|
className: "px-4 py-2 text-sm font-medium bg-action-primary-bg text-action-primary-text rounded-button hover:bg-action-primary-bgHover",
|
|
373
373
|
children: "Back to Quotas"
|
|
374
374
|
})]
|
|
375
375
|
})
|
|
376
|
-
}) : /* @__PURE__ */
|
|
376
|
+
}) : /* @__PURE__ */ m(e, { message: "You don't have permission to edit quotas." });
|
|
377
377
|
};
|
|
378
|
-
export {
|
|
378
|
+
export { _ as QuotaTemplateEditPage };
|
|
379
379
|
|
|
380
380
|
//# sourceMappingURL=QuotaTemplateEditPage.js.map
|