@burdenoff/microfe-billing 2026.1119.1 → 2026.1120.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 (58) hide show
  1. package/dist/billing/modules/addons/pages/AddonsBrowsePage.js +2 -1
  2. package/dist/billing/modules/addons/pages/AddonsBrowsePage.js.map +1 -1
  3. package/dist/billing/modules/addons/pages/AddonsListPage.js +2 -1
  4. package/dist/billing/modules/addons/pages/AddonsListPage.js.map +1 -1
  5. package/dist/billing/modules/affiliate/pages/AffiliateDashboardPage.js +5 -2
  6. package/dist/billing/modules/affiliate/pages/AffiliateDashboardPage.js.map +1 -1
  7. package/dist/billing/modules/analytics/pages/AnalyticsPage.js +2 -1
  8. package/dist/billing/modules/analytics/pages/AnalyticsPage.js.map +1 -1
  9. package/dist/billing/modules/billing/pages/BillingWebhookLogsPage.js +2 -1
  10. package/dist/billing/modules/billing/pages/BillingWebhookLogsPage.js.map +1 -1
  11. package/dist/billing/modules/billing/pages/InvoicesListPage.js +3 -1
  12. package/dist/billing/modules/billing/pages/InvoicesListPage.js.map +1 -1
  13. package/dist/billing/modules/billing/pages/OrderCallbackLogsPage.js +2 -1
  14. package/dist/billing/modules/billing/pages/OrderCallbackLogsPage.js.map +1 -1
  15. package/dist/billing/modules/billing/pages/PaymentMethodsPage.js +2 -1
  16. package/dist/billing/modules/billing/pages/PaymentMethodsPage.js.map +1 -1
  17. package/dist/billing/modules/billing/pages/RefundIssueLogsPage.js +2 -1
  18. package/dist/billing/modules/billing/pages/RefundIssueLogsPage.js.map +1 -1
  19. package/dist/billing/modules/billing/pages/RefundsPage.js +3 -1
  20. package/dist/billing/modules/billing/pages/RefundsPage.js.map +1 -1
  21. package/dist/billing/modules/billing/pages/TransactionsPage.js +166 -164
  22. package/dist/billing/modules/billing/pages/TransactionsPage.js.map +1 -1
  23. package/dist/billing/modules/billing/pages/UserRefundsPage.js +3 -1
  24. package/dist/billing/modules/billing/pages/UserRefundsPage.js.map +1 -1
  25. package/dist/billing/modules/coupons/pages/CouponsListPage.js +4 -1
  26. package/dist/billing/modules/coupons/pages/CouponsListPage.js.map +1 -1
  27. package/dist/billing/modules/credits/pages/AdminCreditsPage.js +3 -1
  28. package/dist/billing/modules/credits/pages/AdminCreditsPage.js.map +1 -1
  29. package/dist/billing/modules/credits/pages/CreditTransactionsPage.js +3 -1
  30. package/dist/billing/modules/credits/pages/CreditTransactionsPage.js.map +1 -1
  31. package/dist/billing/modules/credits/pages/CreditWithdrawalPage.js +6 -2
  32. package/dist/billing/modules/credits/pages/CreditWithdrawalPage.js.map +1 -1
  33. package/dist/billing/modules/credits/pages/CreditsPage.js +3 -1
  34. package/dist/billing/modules/credits/pages/CreditsPage.js.map +1 -1
  35. package/dist/billing/modules/discounts/pages/DiscountsListPage.js +3 -1
  36. package/dist/billing/modules/discounts/pages/DiscountsListPage.js.map +1 -1
  37. package/dist/billing/modules/earnings/pages/EarningsPage.js +14 -5
  38. package/dist/billing/modules/earnings/pages/EarningsPage.js.map +1 -1
  39. package/dist/billing/modules/earnings/pages/PayoutAdminPage.js +3 -1
  40. package/dist/billing/modules/earnings/pages/PayoutAdminPage.js.map +1 -1
  41. package/dist/billing/modules/earnings/pages/PayoutsPage.js +6 -2
  42. package/dist/billing/modules/earnings/pages/PayoutsPage.js.map +1 -1
  43. package/dist/billing/modules/plans/pages/PlansBrowsePage.js +3 -1
  44. package/dist/billing/modules/plans/pages/PlansBrowsePage.js.map +1 -1
  45. package/dist/billing/modules/plans/pages/PlansListPage.js +3 -1
  46. package/dist/billing/modules/plans/pages/PlansListPage.js.map +1 -1
  47. package/dist/billing/modules/promotions/pages/PromotionsListPage.js +2 -1
  48. package/dist/billing/modules/promotions/pages/PromotionsListPage.js.map +1 -1
  49. package/dist/billing/modules/quota/pages/QuotaTemplatesListPage.js +2 -1
  50. package/dist/billing/modules/quota/pages/QuotaTemplatesListPage.js.map +1 -1
  51. package/dist/billing/modules/subscriptions/pages/SubscriptionsListPage.js +3 -1
  52. package/dist/billing/modules/subscriptions/pages/SubscriptionsListPage.js.map +1 -1
  53. package/dist/billing/modules/usage/pages/UsagePage.js +4 -2
  54. package/dist/billing/modules/usage/pages/UsagePage.js.map +1 -1
  55. package/dist/billing/shared/components/EmptyState.d.ts +7 -0
  56. package/dist/billing/shared/components/EmptyState.js +5 -2
  57. package/dist/billing/shared/components/EmptyState.js.map +1 -1
  58. package/package.json +2 -2
@@ -1 +1 @@
1
- {"version":3,"file":"DiscountsListPage.js","names":["isExpired","discount","formatDiscountValue","formatCurrency","INITIAL_CREATE_FORM","DiscountsListPage","useI18n","tr","translated","t","key","fallback","permissions","useBillingPermissions","useGetDiscountsQuery","createDiscount","isCreating","useCreateDiscountMutation","updateDiscount","isUpdating","useUpdateDiscountMutation","deleteDiscount","isDeleting","useDeleteDiscountMutation","searchQuery","setSearchQuery","useState","modal","setModal","createForm","setCreateForm","editForm","setEditForm","mutationError","setMutationError","selectedDiscountIds","setSelectedDiscountIds","showBulkDeleteConfirm","setShowBulkDeleteConfirm","discounts","data","filteredDiscounts","selectedDiscounts","useMemo","allVisibleSelected","partiallySelected","AccessDenied","totalDiscounts","activeDiscounts","d","expiredDiscounts","openCreateModal","openEditModal","openDeleteModal","closeModal","handleCreate","valueNum","refetch","err","handleUpdate","handleDelete","nativeImpact","nativeNotify","handleBulkDelete","toggleDiscountSelection","next","prev","checked","discountId","toggleAllDiscounts","loading","i","error","PagePurpose","input","event","IllustratedEmptyState","DiscountRow","ModalOverlay","ThemedSelect","expired","selected","onToggleSelect","formatDate","onEdit","onDelete","onClose"],"sources":["../../../../../src/billing/modules/discounts/pages/DiscountsListPage.tsx"],"sourcesContent":["/**\n * Discounts Module - Discounts List Page\n * Admin page for creating, viewing, and managing discount codes\n */\n\nimport { useMemo, useState, type FC, type FormEvent } from 'react';\nimport {\n useGetDiscountsQuery,\n useCreateDiscountMutation,\n useUpdateDiscountMutation,\n useDeleteDiscountMutation,\n} from '../../../../generated/global-operations';\nimport { useBillingPermissions } from '../../../hooks/useBillingPermissions';\nimport { AccessDenied } from '../../../shared/components';\nimport { formatCurrency, formatDate } from '../../../shared/utils/format';\nimport { useI18n } from '@burdenoff/fe-libs/shared/providers/shell/I18nProvider';\nimport { PagePurpose, IllustratedEmptyState, ThemedSelect } from '@burdenoff/fe-libs/ui';\nimport { nativeImpact, nativeNotify } from '../../../../utils/nativeBridge';\n\n// ============================================================================\n// Types\n// ============================================================================\n\ntype DiscountType = 'PERCENTAGE' | 'FIXED';\n\ninterface BillingDiscount {\n id: string;\n code: string;\n type: DiscountType;\n value: number;\n currency: string | null;\n maxUses: number | null;\n usedCount: number;\n validFrom: string | null;\n validUntil: string | null;\n metadata: Record<string, unknown> | null;\n context: Record<string, unknown> | null;\n createdAt: string;\n updatedAt: string;\n}\n\ninterface CreateDiscountForm {\n code: string;\n type: DiscountType;\n value: string;\n currency: string;\n maxUses: string;\n validFrom: string;\n validUntil: string;\n}\n\ninterface EditDiscountForm {\n maxUses: string;\n validUntil: string;\n}\n\ntype ModalState =\n | { kind: 'closed' }\n | { kind: 'create' }\n | { kind: 'edit'; discount: BillingDiscount }\n | { kind: 'delete'; discount: BillingDiscount };\n\n// ============================================================================\n// Helpers\n// ============================================================================\n\nfunction isExpired(discount: BillingDiscount): boolean {\n if (!discount.validUntil) return false;\n return new Date(discount.validUntil) < new Date();\n}\n\nfunction formatDiscountValue(discount: BillingDiscount): string {\n if (discount.type === 'PERCENTAGE') {\n return `${discount.value}%`;\n }\n return formatCurrency(discount.value, discount.currency ?? 'USD');\n}\n\nconst INITIAL_CREATE_FORM: CreateDiscountForm = {\n code: '',\n type: 'PERCENTAGE',\n value: '',\n currency: 'USD',\n maxUses: '',\n validFrom: '',\n validUntil: '',\n};\n\n// ============================================================================\n// Main Component\n// ============================================================================\n\nexport const DiscountsListPage: 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 permissions = useBillingPermissions();\n\n const { data, loading, error, refetch } = useGetDiscountsQuery();\n\n const [createDiscount, { loading: isCreating }] = useCreateDiscountMutation();\n const [updateDiscount, { loading: isUpdating }] = useUpdateDiscountMutation();\n const [deleteDiscount, { loading: isDeleting }] = useDeleteDiscountMutation();\n\n const [searchQuery, setSearchQuery] = useState('');\n const [modal, setModal] = useState<ModalState>({ kind: 'closed' });\n const [createForm, setCreateForm] = useState<CreateDiscountForm>(INITIAL_CREATE_FORM);\n const [editForm, setEditForm] = useState<EditDiscountForm>({ maxUses: '', validUntil: '' });\n const [mutationError, setMutationError] = useState<string | null>(null);\n const [selectedDiscountIds, setSelectedDiscountIds] = useState<Set<string>>(new Set());\n const [showBulkDeleteConfirm, setShowBulkDeleteConfirm] = useState(false);\n\n const discounts: BillingDiscount[] = (data?.getDiscounts ?? []) as BillingDiscount[];\n\n // Filtered discounts\n const filteredDiscounts = discounts.filter((discount: BillingDiscount) => {\n if (!searchQuery) return true;\n return discount.code.toLowerCase().includes(searchQuery.toLowerCase());\n });\n\n const selectedDiscounts = useMemo(\n () => filteredDiscounts.filter((discount) => selectedDiscountIds.has(discount.id)),\n [filteredDiscounts, selectedDiscountIds]\n );\n\n const allVisibleSelected =\n filteredDiscounts.length > 0 &&\n filteredDiscounts.every((discount) => selectedDiscountIds.has(discount.id));\n const partiallySelected =\n filteredDiscounts.some((discount) => selectedDiscountIds.has(discount.id)) &&\n !allVisibleSelected;\n\n // Permission check\n if (!permissions.canManageDiscounts) {\n return <AccessDenied message=\"You don't have permission to manage discount codes.\" />;\n }\n\n // Summary stats\n const totalDiscounts = discounts.length;\n const activeDiscounts = discounts.filter((d: BillingDiscount) => !isExpired(d)).length;\n const expiredDiscounts = discounts.filter((d: BillingDiscount) => isExpired(d)).length;\n\n // ── Modal handlers ──────────────────────────────────────────────────\n\n const openCreateModal = () => {\n setCreateForm(INITIAL_CREATE_FORM);\n setMutationError(null);\n setModal({ kind: 'create' });\n };\n\n const openEditModal = (discount: BillingDiscount) => {\n setEditForm({\n maxUses: discount.maxUses != null ? String(discount.maxUses) : '',\n validUntil: discount.validUntil\n ? new Date(discount.validUntil).toISOString().slice(0, 16)\n : '',\n });\n setMutationError(null);\n setModal({ kind: 'edit', discount });\n };\n\n const openDeleteModal = (discount: BillingDiscount) => {\n setMutationError(null);\n setModal({ kind: 'delete', discount });\n };\n\n const closeModal = () => {\n setModal({ kind: 'closed' });\n setMutationError(null);\n };\n\n // ── Mutation handlers ───────────────────────────────────────────────\n\n const handleCreate = async (e: FormEvent) => {\n e.preventDefault();\n setMutationError(null);\n\n if (!createForm.code.trim()) {\n setMutationError('Discount code is required.');\n return;\n }\n\n const valueNum = Number(createForm.value);\n if (Number.isNaN(valueNum) || valueNum <= 0) {\n setMutationError('Value must be a positive number.');\n return;\n }\n\n if (createForm.type === 'PERCENTAGE' && valueNum > 100) {\n setMutationError('Percentage value cannot exceed 100.');\n return;\n }\n\n try {\n await createDiscount({\n variables: {\n code: createForm.code.trim().toUpperCase(),\n type: createForm.type,\n value: valueNum,\n currency: createForm.type === 'FIXED' ? createForm.currency : null,\n maxUses: createForm.maxUses ? Number(createForm.maxUses) : null,\n validFrom: createForm.validFrom ? new Date(createForm.validFrom).toISOString() : null,\n validUntil: createForm.validUntil ? new Date(createForm.validUntil).toISOString() : null,\n },\n });\n await refetch();\n closeModal();\n } catch (err) {\n setMutationError(err instanceof Error ? err.message : 'Failed to create discount.');\n }\n };\n\n const handleUpdate = async (e: FormEvent) => {\n e.preventDefault();\n if (modal.kind !== 'edit') return;\n setMutationError(null);\n\n try {\n await updateDiscount({\n variables: {\n id: modal.discount.id,\n maxUses: editForm.maxUses ? Number(editForm.maxUses) : null,\n validUntil: editForm.validUntil ? new Date(editForm.validUntil).toISOString() : null,\n },\n });\n await refetch();\n closeModal();\n } catch (err) {\n setMutationError(err instanceof Error ? err.message : 'Failed to update discount.');\n }\n };\n\n const handleDelete = async () => {\n if (modal.kind !== 'delete') return;\n setMutationError(null);\n void nativeImpact('medium');\n\n try {\n await deleteDiscount({ variables: { id: modal.discount.id } });\n void nativeNotify('success');\n await refetch();\n closeModal();\n } catch (err) {\n void nativeNotify('error');\n setMutationError(err instanceof Error ? err.message : 'Failed to delete discount.');\n }\n };\n\n const handleBulkDelete = async () => {\n if (selectedDiscounts.length === 0) return;\n\n setMutationError(null);\n setShowBulkDeleteConfirm(false);\n await Promise.allSettled(\n selectedDiscounts.map((discount) => deleteDiscount({ variables: { id: discount.id } }))\n );\n await refetch();\n setSelectedDiscountIds(new Set());\n };\n\n const toggleDiscountSelection = (discountId: string, checked: boolean) => {\n setSelectedDiscountIds((prev) => {\n const next = new Set(prev);\n if (checked) {\n next.add(discountId);\n } else {\n next.delete(discountId);\n }\n return next;\n });\n setShowBulkDeleteConfirm(false);\n };\n\n const toggleAllDiscounts = (checked: boolean) => {\n setSelectedDiscountIds((prev) => {\n const next = new Set(prev);\n filteredDiscounts.forEach((discount) => {\n if (checked) {\n next.add(discount.id);\n } else {\n next.delete(discount.id);\n }\n });\n return next;\n });\n setShowBulkDeleteConfirm(false);\n };\n\n // ── Loading state ───────────────────────────────────────────────────\n\n if (loading && discounts.length === 0) {\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=\"grid grid-cols-1 sm:grid-cols-3 gap-4\">\n {[1, 2, 3].map((i) => (\n <div key={i} className=\"border border-border-subtle rounded-lg p-4 space-y-2\">\n <div className=\"h-4 w-24 bg-bg-sunken animate-pulse rounded\" />\n <div className=\"h-6 w-16 bg-bg-sunken animate-pulse rounded\" />\n </div>\n ))}\n </div>\n <div className=\"space-y-3\">\n {[1, 2, 3, 4, 5].map((i) => (\n <div key={i} className=\"border border-border-subtle rounded-lg p-4\">\n <div className=\"flex items-center gap-4\">\n <div className=\"size-10 bg-bg-sunken animate-pulse rounded\" />\n <div className=\"flex-1 space-y-2\">\n <div className=\"h-4 w-32 bg-bg-sunken animate-pulse rounded\" />\n <div className=\"h-3 w-48 bg-bg-sunken animate-pulse rounded\" />\n </div>\n </div>\n </div>\n ))}\n </div>\n </div>\n );\n }\n\n // ── Error state ─────────────────────────────────────────────────────\n\n if (error) {\n return (\n <div className=\"flex items-center justify-center h-full min-h-[400px]\">\n <div className=\"text-center space-y-4\">\n <div className=\"size-12 mx-auto rounded-full bg-status-error-bg-subtle flex items-center justify-center\">\n <svg\n className=\"size-6 text-status-error-text\"\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=\"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z\"\n />\n </svg>\n </div>\n <h2 className=\"text-lg font-semibold text-text-primary\">Failed to load discounts</h2>\n <p className=\"text-sm text-text-muted\">{error.message}</p>\n <button\n type=\"button\"\n onClick={() => refetch()}\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 transition-colors\"\n >\n Try Again\n </button>\n </div>\n </div>\n );\n }\n\n // ── Main render ─────────────────────────────────────────────────────\n\n return (\n <div className=\"space-y-6 p-6\">\n {/* Header */}\n <div className=\"flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between\">\n <div>\n <h1 className=\"text-2xl md:text-3xl font-semibold tracking-tight text-text-primary\">\n Discount Codes\n </h1>\n <p className=\"text-sm text-text-secondary mt-1\">\n Create, view, and manage discount codes for billing\n </p>\n <PagePurpose className=\"mt-3\">\n Discount codes reduce the price of a purchase at checkout. Create codes here, set how\n much they take off and any limits, and manage which ones are active — separate from\n time-bounded promotions and customer-facing coupons.\n </PagePurpose>\n </div>\n <button\n type=\"button\"\n onClick={openCreateModal}\n className=\"inline-flex items-center gap-2 px-4 py-2 text-sm font-medium bg-action-primary-bg text-action-primary-text rounded-button hover:bg-action-primary-bgHover transition-colors duration-200 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)]\"\n >\n <svg className=\"size-4\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\">\n <path strokeLinecap=\"round\" strokeLinejoin=\"round\" strokeWidth={2} d=\"M12 4v16m8-8H4\" />\n </svg>\n Create Discount\n </button>\n </div>\n\n {/* Summary Cards */}\n <div className=\"grid grid-cols-1 sm:grid-cols-3 gap-4\">\n <div className=\"rounded-card border border-border-seam bg-bg-surface p-5 shadow-[var(--shadow-elevation-1)]\">\n <p className=\"text-sm text-text-secondary\">Total Discounts</p>\n <p className=\"text-2xl font-semibold text-text-primary tabular-nums mt-1\">\n {totalDiscounts}\n </p>\n </div>\n <div className=\"rounded-card border border-border-seam bg-bg-surface p-5 shadow-[var(--shadow-elevation-1)]\">\n <p className=\"text-sm text-text-secondary\">Active</p>\n <p className=\"text-2xl font-semibold text-status-success-text tabular-nums mt-1\">\n {activeDiscounts}\n </p>\n </div>\n <div className=\"rounded-card border border-border-seam bg-bg-surface p-5 shadow-[var(--shadow-elevation-1)]\">\n <p className=\"text-sm text-text-secondary\">Expired</p>\n <p className=\"text-2xl font-semibold text-status-warning-text tabular-nums mt-1\">\n {expiredDiscounts}\n </p>\n </div>\n </div>\n\n {/* Search */}\n <div className=\"flex flex-col sm:flex-row flex-wrap items-stretch sm:items-center gap-3 sm:gap-4 pb-4 border-b border-border-subtle\">\n <div className=\"relative flex-1 min-w-0 w-full sm:max-w-md\">\n <svg\n className=\"absolute left-3 top-1/2 -translate-y-1/2 size-4 text-text-muted\"\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=\"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z\"\n />\n </svg>\n <input\n type=\"text\"\n placeholder=\"Search by discount code...\"\n value={searchQuery}\n onChange={(e) => setSearchQuery(e.target.value)}\n className=\"w-full pl-[3.25rem] pr-4 py-2 text-sm border border-border-subtle rounded-input bg-bg-surface text-text-primary placeholder:text-text-muted focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)] focus:border-transparent\"\n />\n </div>\n </div>\n\n {filteredDiscounts.length > 0 && (\n <div className=\"flex flex-col gap-3 rounded-lg border border-border-subtle bg-bg-surface p-4 sm:flex-row sm:items-center sm:justify-between\">\n <label className=\"flex items-center gap-2 text-sm text-text-primary\">\n <input\n type=\"checkbox\"\n checked={allVisibleSelected}\n ref={(input) => {\n if (input) {\n input.indeterminate = partiallySelected && !allVisibleSelected;\n }\n }}\n onChange={(event) => toggleAllDiscounts(event.target.checked)}\n aria-label=\"Select all discounts\"\n className=\"size-4 rounded border-border-subtle text-text-link\"\n />\n <span>Select all visible</span>\n </label>\n\n <div className=\"flex items-center gap-2\">\n <span className=\"text-sm text-text-muted\">{selectedDiscountIds.size} selected</span>\n {selectedDiscountIds.size > 0 && (\n <button\n type=\"button\"\n onClick={() => {\n setSelectedDiscountIds(new Set());\n setShowBulkDeleteConfirm(false);\n }}\n className=\"text-sm text-text-muted hover:text-text-primary\"\n >\n Clear selection\n </button>\n )}\n <button\n type=\"button\"\n onClick={() => setShowBulkDeleteConfirm(true)}\n disabled={selectedDiscounts.length === 0 || isDeleting}\n className=\"inline-flex items-center gap-2 px-3 py-2 text-sm font-medium border border-status-error-border text-status-error-text rounded-md hover:bg-status-error-bg-subtle transition-colors disabled:opacity-50\"\n >\n Delete Selected{selectedDiscounts.length > 0 ? ` (${selectedDiscounts.length})` : ''}\n </button>\n </div>\n </div>\n )}\n\n {showBulkDeleteConfirm && selectedDiscounts.length > 0 && (\n <div className=\"rounded-lg border border-status-error-border bg-status-error-bg-subtle p-4\">\n <div className=\"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between\">\n <div>\n <p className=\"text-sm font-medium text-text-primary\">\n Delete {selectedDiscounts.length} selected discount\n {selectedDiscounts.length === 1 ? '' : 's'}?\n </p>\n <p className=\"text-sm text-text-muted\">This action cannot be undone.</p>\n </div>\n <div className=\"flex items-center gap-2\">\n <button\n type=\"button\"\n onClick={() => setShowBulkDeleteConfirm(false)}\n className=\"px-3 py-2 text-sm font-medium text-text-muted hover:text-text-primary\"\n >\n Cancel\n </button>\n <button\n type=\"button\"\n onClick={handleBulkDelete}\n disabled={isDeleting}\n className=\"inline-flex items-center gap-2 rounded-button bg-action-danger-bg px-3 py-2 text-sm font-medium text-action-danger-text hover:bg-action-danger-bgHover disabled:opacity-50\"\n >\n Confirm Delete\n </button>\n </div>\n </div>\n </div>\n )}\n\n {/* Discounts Table */}\n {filteredDiscounts.length === 0 ? (\n <IllustratedEmptyState\n illustration={searchQuery ? 'empty-search' : 'empty-data'}\n title=\"No discount codes found\"\n description={\n searchQuery\n ? 'No discount codes match your search.'\n : 'Create your first discount code to get started.'\n }\n action={\n !searchQuery ? (\n <button\n type=\"button\"\n onClick={openCreateModal}\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 transition-colors\"\n >\n Create your first discount\n </button>\n ) : undefined\n }\n />\n ) : (\n <div className=\"border border-border-seam rounded-card overflow-hidden shadow-[var(--shadow-elevation-1)]\">\n <div className=\"overflow-x-auto\">\n <table className=\"w-full\">\n <thead className=\"sticky top-0 z-10 bg-bg-sunken border-b border-border-subtle\">\n <tr>\n <th className=\"text-left px-4 py-3 text-xs font-medium uppercase tracking-wide text-text-muted w-12\">\n <input\n type=\"checkbox\"\n checked={allVisibleSelected}\n ref={(input) => {\n if (input) {\n input.indeterminate = partiallySelected && !allVisibleSelected;\n }\n }}\n onChange={(event) => toggleAllDiscounts(event.target.checked)}\n aria-label=\"Select all discounts\"\n className=\"size-4 rounded border-border-subtle text-action-primary-bg focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)]\"\n />\n </th>\n <th className=\"text-left px-4 py-3 text-xs font-medium uppercase tracking-wide text-text-muted\">\n Code\n </th>\n <th className=\"text-left px-4 py-3 text-xs font-medium uppercase tracking-wide text-text-muted\">\n Type\n </th>\n <th className=\"text-left px-4 py-3 text-xs font-medium uppercase tracking-wide text-text-muted\">\n Value\n </th>\n <th className=\"text-left px-4 py-3 text-xs font-medium uppercase tracking-wide text-text-muted hidden md:table-cell\">\n Uses\n </th>\n <th className=\"text-left px-4 py-3 text-xs font-medium uppercase tracking-wide text-text-muted hidden lg:table-cell\">\n Valid From\n </th>\n <th className=\"text-left px-4 py-3 text-xs font-medium uppercase tracking-wide text-text-muted hidden sm:table-cell\">\n Valid Until\n </th>\n <th className=\"text-left px-4 py-3 text-xs font-medium uppercase tracking-wide text-text-muted\">\n Status\n </th>\n <th className=\"text-right px-4 py-3 text-xs font-medium uppercase tracking-wide text-text-muted\">\n Actions\n </th>\n </tr>\n </thead>\n <tbody className=\"divide-y divide-border-subtle\">\n {filteredDiscounts.map((discount: BillingDiscount) => (\n <DiscountRow\n key={discount.id}\n discount={discount}\n selected={selectedDiscountIds.has(discount.id)}\n onToggleSelect={toggleDiscountSelection}\n onEdit={openEditModal}\n onDelete={openDeleteModal}\n />\n ))}\n </tbody>\n </table>\n </div>\n </div>\n )}\n\n {/* Create Modal */}\n {modal.kind === 'create' && (\n <ModalOverlay onClose={closeModal}>\n <form onSubmit={handleCreate} className=\"space-y-4\">\n <div className=\"flex items-center justify-between mb-2\">\n <h2 className=\"text-lg font-semibold text-text-primary\">\n {tr('billing.discounts.createDiscountCode', 'Create Discount Code')}\n </h2>\n <button\n type=\"button\"\n onClick={closeModal}\n className=\"p-1.5 rounded hover:bg-bg-sunken transition-colors\"\n >\n <svg\n className=\"size-5 text-text-muted\"\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=\"M6 18L18 6M6 6l12 12\"\n />\n </svg>\n </button>\n </div>\n\n {mutationError && (\n <div className=\"p-3 text-sm text-status-error-text bg-status-error-bg-subtle border border-status-error-border rounded-md\">\n {mutationError}\n </div>\n )}\n\n {/* Code */}\n <div>\n <label\n htmlFor=\"create-code\"\n className=\"block text-sm font-medium text-text-primary mb-1\"\n >\n {tr('billing.discounts.code', 'Code')}{' '}\n <span className=\"text-status-error-text\">*</span>\n </label>\n <input\n id=\"create-code\"\n type=\"text\"\n required\n value={createForm.code}\n onChange={(e) => setCreateForm((prev) => ({ ...prev, code: e.target.value }))}\n placeholder={tr('billing.discounts.codePlaceholder', 'e.g. SUMMER25')}\n className=\"w-full px-3 py-2 text-sm border border-border-subtle rounded-input bg-bg-surface text-text-primary placeholder:text-text-muted focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)] focus:border-transparent uppercase\"\n />\n </div>\n\n {/* Type + Value row */}\n <div className=\"grid grid-cols-2 gap-4\">\n <div>\n <label\n htmlFor=\"create-type\"\n className=\"block text-sm font-medium text-text-primary mb-1\"\n >\n {tr('billing.discounts.type', 'Type')}{' '}\n <span className=\"text-status-error-text\">*</span>\n </label>\n <ThemedSelect\n id=\"create-type\"\n value={createForm.type}\n onChange={(e) =>\n setCreateForm((prev) => ({\n ...prev,\n type: e.target.value as DiscountType,\n }))\n }\n className=\"w-full px-3 py-2 text-sm border border-border-subtle rounded-input bg-bg-surface text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)] focus:border-transparent scheme-normal dark:scheme-dark [&_option]:bg-bg-surface [&_option]:text-text-primary\"\n >\n <option value=\"PERCENTAGE\">\n {tr('billing.discounts.typePercentage', 'Percentage')}\n </option>\n <option value=\"FIXED\">\n {tr('billing.discounts.typeFixedAmount', 'Fixed Amount')}\n </option>\n </ThemedSelect>\n </div>\n <div>\n <label\n htmlFor=\"create-value\"\n className=\"block text-sm font-medium text-text-primary mb-1\"\n >\n {tr('billing.discounts.value', 'Value')}{' '}\n <span className=\"text-status-error-text\">*</span>\n </label>\n <div className=\"relative\">\n <input\n id=\"create-value\"\n type=\"number\"\n required\n min=\"0.01\"\n max={createForm.type === 'PERCENTAGE' ? '100' : undefined}\n step=\"0.01\"\n value={createForm.value}\n onChange={(e) => setCreateForm((prev) => ({ ...prev, value: e.target.value }))}\n placeholder={createForm.type === 'PERCENTAGE' ? '10' : '25.00'}\n className=\"w-full px-3 py-2 pr-8 text-sm border border-border-subtle rounded-input bg-bg-surface text-text-primary placeholder:text-text-muted focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)] focus:border-transparent\"\n />\n <span className=\"absolute right-3 top-1/2 -translate-y-1/2 text-sm text-text-muted\">\n {createForm.type === 'PERCENTAGE' ? '%' : createForm.currency}\n </span>\n </div>\n </div>\n </div>\n\n {/* Currency (only for FIXED) */}\n {createForm.type === 'FIXED' && (\n <div>\n <label\n htmlFor=\"create-currency\"\n className=\"block text-sm font-medium text-text-primary mb-1\"\n >\n {tr('billing.discounts.currency', 'Currency')}\n </label>\n <ThemedSelect\n id=\"create-currency\"\n value={createForm.currency}\n onChange={(e) => setCreateForm((prev) => ({ ...prev, currency: e.target.value }))}\n className=\"w-full px-3 py-2 text-sm border border-border-subtle rounded-input bg-bg-surface text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)] focus:border-transparent 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=\"CAD\">CAD</option>\n <option value=\"AUD\">AUD</option>\n </ThemedSelect>\n </div>\n )}\n\n {/* Max Uses */}\n <div>\n <label\n htmlFor=\"create-max-uses\"\n className=\"block text-sm font-medium text-text-primary mb-1\"\n >\n {tr('billing.discounts.maxUses', 'Max Uses')}\n </label>\n <input\n id=\"create-max-uses\"\n type=\"number\"\n min=\"1\"\n step=\"1\"\n value={createForm.maxUses}\n onChange={(e) => setCreateForm((prev) => ({ ...prev, maxUses: e.target.value }))}\n placeholder={tr('billing.discounts.unlimited', 'Unlimited')}\n className=\"w-full px-3 py-2 text-sm border border-border-subtle rounded-input bg-bg-surface text-text-primary placeholder:text-text-muted focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)] focus:border-transparent\"\n />\n <p className=\"text-xs text-text-muted mt-1\">\n {tr('billing.discounts.unlimitedHelp', 'Leave empty for unlimited uses.')}\n </p>\n </div>\n\n {/* Valid From / Valid Until row */}\n <div className=\"grid grid-cols-2 gap-4\">\n <div>\n <label\n htmlFor=\"create-valid-from\"\n className=\"block text-sm font-medium text-text-primary mb-1\"\n >\n {tr('billing.discounts.validFrom', 'Valid From')}\n </label>\n <input\n id=\"create-valid-from\"\n type=\"datetime-local\"\n value={createForm.validFrom}\n onChange={(e) =>\n setCreateForm((prev) => ({ ...prev, validFrom: e.target.value }))\n }\n className=\"w-full px-3 py-2 text-sm border border-border-subtle rounded-input bg-bg-surface text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)] focus:border-transparent\"\n />\n </div>\n <div>\n <label\n htmlFor=\"create-valid-until\"\n className=\"block text-sm font-medium text-text-primary mb-1\"\n >\n {tr('billing.discounts.validUntil', 'Valid Until')}\n </label>\n <input\n id=\"create-valid-until\"\n type=\"datetime-local\"\n value={createForm.validUntil}\n onChange={(e) =>\n setCreateForm((prev) => ({ ...prev, validUntil: e.target.value }))\n }\n className=\"w-full px-3 py-2 text-sm border border-border-subtle rounded-input bg-bg-surface text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)] focus:border-transparent\"\n />\n </div>\n </div>\n\n {/* Actions */}\n <div className=\"flex items-center justify-end gap-3 pt-2 border-t border-border-subtle\">\n <button\n type=\"button\"\n onClick={closeModal}\n className=\"px-4 py-2 text-sm font-medium border border-border-subtle text-text-primary rounded-button hover:bg-bg-sunken transition-colors\"\n >\n {tr('billing.discounts.cancel', 'Cancel')}\n </button>\n <button\n type=\"submit\"\n disabled={isCreating}\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 transition-colors disabled:opacity-50 disabled:cursor-not-allowed\"\n >\n {isCreating\n ? tr('billing.discounts.creating', 'Creating...')\n : tr('billing.discounts.createDiscount', 'Create Discount')}\n </button>\n </div>\n </form>\n </ModalOverlay>\n )}\n\n {/* Edit Modal */}\n {modal.kind === 'edit' && (\n <ModalOverlay onClose={closeModal}>\n <form onSubmit={handleUpdate} className=\"space-y-4\">\n <div className=\"flex items-center justify-between mb-2\">\n <h2 className=\"text-lg font-semibold text-text-primary\">Edit Discount</h2>\n <button\n type=\"button\"\n onClick={closeModal}\n className=\"p-1.5 rounded hover:bg-bg-sunken transition-colors\"\n >\n <svg\n className=\"size-5 text-text-muted\"\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=\"M6 18L18 6M6 6l12 12\"\n />\n </svg>\n </button>\n </div>\n\n {mutationError && (\n <div className=\"p-3 text-sm text-status-error-text bg-status-error-bg-subtle border border-status-error-border rounded-md\">\n {mutationError}\n </div>\n )}\n\n {/* Read-only info */}\n <div className=\"p-3 bg-bg-sunken/50 border border-border-subtle rounded-md space-y-1\">\n <div className=\"flex items-center justify-between text-sm\">\n <span className=\"text-text-muted\">Code</span>\n <span className=\"font-mono font-medium text-text-primary\">\n {modal.discount.code}\n </span>\n </div>\n <div className=\"flex items-center justify-between text-sm\">\n <span className=\"text-text-muted\">Type</span>\n <span className=\"text-text-primary\">\n {modal.discount.type === 'PERCENTAGE' ? 'Percentage' : 'Fixed Amount'}\n </span>\n </div>\n <div className=\"flex items-center justify-between text-sm\">\n <span className=\"text-text-muted\">Value</span>\n <span className=\"text-text-primary\">{formatDiscountValue(modal.discount)}</span>\n </div>\n <div className=\"flex items-center justify-between text-sm\">\n <span className=\"text-text-muted\">Used</span>\n <span className=\"text-text-primary\">{modal.discount.usedCount} times</span>\n </div>\n </div>\n\n {/* Editable: Max Uses */}\n <div>\n <label\n htmlFor=\"edit-max-uses\"\n className=\"block text-sm font-medium text-text-primary mb-1\"\n >\n Max Uses\n </label>\n <input\n id=\"edit-max-uses\"\n type=\"number\"\n min=\"1\"\n step=\"1\"\n value={editForm.maxUses}\n onChange={(e) => setEditForm((prev) => ({ ...prev, maxUses: e.target.value }))}\n placeholder=\"Unlimited\"\n className=\"w-full px-3 py-2 text-sm border border-border-subtle rounded-input bg-bg-surface text-text-primary placeholder:text-text-muted focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)] focus:border-transparent\"\n />\n <p className=\"text-xs text-text-muted mt-1\">Leave empty for unlimited uses.</p>\n </div>\n\n {/* Editable: Valid Until */}\n <div>\n <label\n htmlFor=\"edit-valid-until\"\n className=\"block text-sm font-medium text-text-primary mb-1\"\n >\n Valid Until\n </label>\n <input\n id=\"edit-valid-until\"\n type=\"datetime-local\"\n value={editForm.validUntil}\n onChange={(e) => setEditForm((prev) => ({ ...prev, validUntil: e.target.value }))}\n className=\"w-full px-3 py-2 text-sm border border-border-subtle rounded-input bg-bg-surface text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)] focus:border-transparent\"\n />\n </div>\n\n {/* Actions */}\n <div className=\"flex items-center justify-end gap-3 pt-2 border-t border-border-subtle\">\n <button\n type=\"button\"\n onClick={closeModal}\n className=\"px-4 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 <button\n type=\"submit\"\n disabled={isUpdating}\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 transition-colors disabled:opacity-50 disabled:cursor-not-allowed\"\n >\n {isUpdating ? 'Saving...' : 'Save Changes'}\n </button>\n </div>\n </form>\n </ModalOverlay>\n )}\n\n {/* Delete Confirmation Modal */}\n {modal.kind === 'delete' && (\n <ModalOverlay onClose={closeModal}>\n <div className=\"space-y-4\">\n <div className=\"flex items-center justify-between mb-2\">\n <h2 className=\"text-lg font-semibold text-text-primary\">Delete Discount</h2>\n <button\n type=\"button\"\n onClick={closeModal}\n className=\"p-1.5 rounded hover:bg-bg-sunken transition-colors\"\n >\n <svg\n className=\"size-5 text-text-muted\"\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=\"M6 18L18 6M6 6l12 12\"\n />\n </svg>\n </button>\n </div>\n\n {mutationError && (\n <div className=\"p-3 text-sm text-status-error-text bg-status-error-bg-subtle border border-status-error-border rounded-md\">\n {mutationError}\n </div>\n )}\n\n <div className=\"flex items-start gap-3\">\n <div className=\"size-10 rounded-full bg-status-error-bg-subtle flex items-center justify-center shrink-0\">\n <svg\n className=\"size-5 text-status-error-text\"\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=\"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z\"\n />\n </svg>\n </div>\n <div>\n <p className=\"text-sm text-text-primary\">\n Are you sure you want to delete the discount code{' '}\n <span className=\"font-mono font-semibold\">{modal.discount.code}</span>?\n </p>\n <p className=\"text-sm text-text-muted mt-1\">\n This action cannot be undone. The discount has been used{' '}\n <span className=\"font-medium\">{modal.discount.usedCount}</span> time\n {modal.discount.usedCount !== 1 ? 's' : ''}.\n </p>\n </div>\n </div>\n\n <div className=\"flex items-center justify-end gap-3 pt-2 border-t border-border-subtle\">\n <button\n type=\"button\"\n onClick={closeModal}\n className=\"px-4 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 <button\n type=\"button\"\n onClick={handleDelete}\n disabled={isDeleting}\n className=\"px-4 py-2 text-sm font-medium bg-action-danger-bg text-action-danger-text rounded-button hover:bg-action-danger-bgHover transition-colors disabled:opacity-50 disabled:cursor-not-allowed\"\n >\n {isDeleting ? 'Deleting...' : 'Delete Discount'}\n </button>\n </div>\n </div>\n </ModalOverlay>\n )}\n </div>\n );\n};\n\n// ============================================================================\n// Discount Row Component\n// ============================================================================\n\ninterface DiscountRowProps {\n discount: BillingDiscount;\n selected: boolean;\n onToggleSelect: (discountId: string, checked: boolean) => void;\n onEdit: (discount: BillingDiscount) => void;\n onDelete: (discount: BillingDiscount) => void;\n}\n\nconst DiscountRow: FC<DiscountRowProps> = ({\n discount,\n selected,\n onToggleSelect,\n onEdit,\n onDelete,\n}) => {\n const expired = isExpired(discount);\n\n return (\n <tr className={`hover:bg-bg-sunken/30 transition-colors ${selected ? 'bg-bg-sunken/20' : ''}`}>\n <td className=\"p-4\">\n <input\n type=\"checkbox\"\n checked={selected}\n onChange={(event) => onToggleSelect(discount.id, event.target.checked)}\n aria-label={`Select discount ${discount.code}`}\n className=\"size-4 rounded border-border-subtle text-text-link\"\n />\n </td>\n {/* Code */}\n <td className=\"p-4\">\n <span className=\"font-mono font-medium text-text-primary\">{discount.code}</span>\n </td>\n\n {/* Type */}\n <td className=\"p-4\">\n <span className=\"text-sm text-text-muted\">\n {discount.type === 'PERCENTAGE' ? 'Percentage' : 'Fixed'}\n </span>\n </td>\n\n {/* Value */}\n <td className=\"p-4\">\n <span className=\"text-sm font-medium text-text-primary\">\n {formatDiscountValue(discount)}\n </span>\n </td>\n\n {/* Uses */}\n <td className=\"p-4 hidden md:table-cell\">\n <span className=\"text-sm text-text-muted\">\n {discount.usedCount}\n {discount.maxUses != null ? ` / ${discount.maxUses}` : ' / \\u221E'}\n </span>\n </td>\n\n {/* Valid From */}\n <td className=\"p-4 text-sm text-text-muted hidden lg:table-cell\">\n {discount.validFrom ? formatDate(discount.validFrom, 'short') : '\\u2014'}\n </td>\n\n {/* Valid Until */}\n <td className=\"p-4 text-sm text-text-muted hidden sm:table-cell\">\n {discount.validUntil ? formatDate(discount.validUntil, 'short') : '\\u2014'}\n </td>\n\n {/* Status */}\n <td className=\"p-4\">\n {expired ? (\n <span className=\"inline-flex px-2 py-1 text-xs font-medium rounded bg-status-warning-bg-subtle text-status-warning-text\">\n Expired\n </span>\n ) : (\n <span className=\"inline-flex px-2 py-1 text-xs font-medium rounded bg-status-success-bg-subtle text-status-success-text\">\n Active\n </span>\n )}\n </td>\n\n {/* Actions */}\n <td className=\"p-4 text-right\">\n <div className=\"flex items-center justify-end gap-2\">\n <button\n type=\"button\"\n onClick={() => onEdit(discount)}\n className=\"px-3 py-1.5 text-sm font-medium text-text-primary hover:bg-bg-sunken rounded-button transition-colors\"\n title=\"Edit discount\"\n >\n {/* Pencil icon */}\n <svg className=\"size-4\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\">\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeWidth={2}\n d=\"M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z\"\n />\n </svg>\n </button>\n <button\n type=\"button\"\n onClick={() => onDelete(discount)}\n className=\"px-3 py-1.5 text-sm font-medium text-status-error-text hover:bg-status-error-bg-subtle rounded-md transition-colors\"\n title=\"Delete discount\"\n >\n {/* Trash icon */}\n <svg className=\"size-4\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\">\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 </td>\n </tr>\n );\n};\n\n// ============================================================================\n// Modal Overlay Component\n// ============================================================================\n\ninterface ModalOverlayProps {\n onClose: () => void;\n children: React.ReactNode;\n}\n\nconst ModalOverlay: FC<ModalOverlayProps> = ({ onClose, children }) => {\n return (\n <div className=\"fixed inset-0 z-50 flex items-center justify-center\">\n {/* Backdrop */}\n <div className=\"absolute inset-0 bg-bg-overlay\" onClick={onClose} />\n\n {/* Dialog */}\n <div className=\"relative w-full max-w-lg max-h-[85vh] overflow-y-auto bg-bg-elevated border border-border-seam rounded-card shadow-[var(--shadow-elevation-4)] p-6 mx-4\">\n {children}\n </div>\n </div>\n );\n};\n"],"mappings":";;;;;;;;;;;AAkEA,SAASA,EAAU,GAAoC;CAErD,OADKC,EAAS,aACP,IAAI,KAAKA,EAAS,UAAU,oBAAI,IAAI,KAAK,IADf;AAEnC;AAEA,SAASC,EAAoB,GAAmC;CAI9D,OAHID,EAAS,SAAS,eACb,GAAGA,EAAS,MAAM,KAEpBE,EAAeF,EAAS,OAAOA,EAAS,YAAY,KAAK;AAClE;AAEA,IAAMG,IAA0C;CAC9C,MAAM;CACN,MAAM;CACN,OAAO;CACP,UAAU;CACV,SAAS;CACT,WAAW;CACX,YAAY;AACd,GAMaC,UAA8B;CACzC,IAAM,EAAE,SAAMC,EAAQ,GAChBC,KAAM,GAAa,MAA6B;EACpD,IAAMC,IAAaC,EAAEC,CAAG;EACxB,OAAOF,MAAeE,IAAMC,IAAWH;CACzC,GACMI,IAAcC,EAAsB,GAEpC,EAAE,SAAM,YAAS,UAAO,eAAYC,EAAqB,GAEzD,CAACC,IAAgB,EAAE,SAASC,OAAgBC,EAA0B,GACtE,CAACC,GAAgB,EAAE,SAASC,OAAgBC,EAA0B,GACtE,CAACC,GAAgB,EAAE,SAASC,OAAgBC,EAA0B,GAEtE,CAACC,GAAaC,MAAkBC,EAAS,EAAE,GAC3C,CAACC,GAAOC,KAAYF,EAAqB,EAAE,MAAM,SAAS,CAAC,GAC3D,CAACG,GAAYC,KAAiBJ,EAA6BtB,CAAmB,GAC9E,CAAC2B,GAAUC,KAAeN,EAA2B;E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kBAAC,MAAD;IAAI,WAAU;IACZ,UAAA,kBAAC,OAAD;KAAK,WAAU;KAAf,UAAA,CACE,kBAAC,UAAD;MACE,MAAK;MACL,eAAeI,EAAOnF,CAAQ;MAC9B,WAAU;MACV,OAAM;MAGN,UAAA,kBAAC,OAAD;OAAK,WAAU;OAAS,MAAK;OAAO,SAAQ;OAAY,QAAO;OAC7D,UAAA,kBAAC,QAAD;QACE,eAAc;QACd,gBAAe;QACf,aAAa;QACb,GAAE;OACH,CAAA;MACE,CAAA;KACC,CAAA,GACR,kBAAC,UAAD;MACE,MAAK;MACL,eAAeoF,EAASpF,CAAQ;MAChC,WAAU;MACV,OAAM;MAGN,UAAA,kBAAC,OAAD;OAAK,WAAU;OAAS,MAAK;OAAO,SAAQ;OAAY,QAAO;OAC7D,UAAA,kBAAC,QAAD;QACE,eAAc;QACd,gBAAe;QACf,aAAa;QACb,GAAE;OACH,CAAA;MACE,CAAA;KACC,CAAA,CACL;;GACH,CAAA;EACF;;AAER,GAWM6E,KAAuC,EAAE,YAAS,kBAEpD,kBAAC,OAAD;CAAK,WAAU;CAAf,UAAA,CAEE,kBAAC,OAAD;EAAK,WAAU;EAAiC,SAASQ;CAAU,CAAA,GAGnE,kBAAC,OAAD;EAAK,WAAU;EACZ;CACE,CAAA,CACF"}
1
+ {"version":3,"file":"DiscountsListPage.js","names":["isExpired","discount","formatDiscountValue","formatCurrency","INITIAL_CREATE_FORM","DiscountsListPage","useI18n","tr","translated","t","key","fallback","permissions","useBillingPermissions","useGetDiscountsQuery","createDiscount","isCreating","useCreateDiscountMutation","updateDiscount","isUpdating","useUpdateDiscountMutation","deleteDiscount","isDeleting","useDeleteDiscountMutation","searchQuery","setSearchQuery","useState","modal","setModal","createForm","setCreateForm","editForm","setEditForm","mutationError","setMutationError","selectedDiscountIds","setSelectedDiscountIds","showBulkDeleteConfirm","setShowBulkDeleteConfirm","discounts","data","filteredDiscounts","selectedDiscounts","useMemo","allVisibleSelected","partiallySelected","AccessDenied","totalDiscounts","activeDiscounts","d","expiredDiscounts","openCreateModal","openEditModal","openDeleteModal","closeModal","handleCreate","valueNum","refetch","err","handleUpdate","handleDelete","nativeImpact","nativeNotify","handleBulkDelete","toggleDiscountSelection","next","prev","checked","discountId","toggleAllDiscounts","loading","i","error","PagePurpose","input","event","IllustratedEmptyState","DiscountRow","ModalOverlay","ThemedSelect","expired","selected","onToggleSelect","formatDate","onEdit","onDelete","onClose"],"sources":["../../../../../src/billing/modules/discounts/pages/DiscountsListPage.tsx"],"sourcesContent":["/**\n * Discounts Module - Discounts List Page\n * Admin page for creating, viewing, and managing discount codes\n */\n\nimport { useMemo, useState, type FC, type FormEvent } from 'react';\nimport {\n useGetDiscountsQuery,\n useCreateDiscountMutation,\n useUpdateDiscountMutation,\n useDeleteDiscountMutation,\n} from '../../../../generated/global-operations';\nimport { useBillingPermissions } from '../../../hooks/useBillingPermissions';\nimport { AccessDenied } from '../../../shared/components';\nimport { formatCurrency, formatDate } from '../../../shared/utils/format';\nimport { useI18n } from '@burdenoff/fe-libs/shared/providers/shell/I18nProvider';\nimport { PagePurpose, IllustratedEmptyState, ThemedSelect } from '@burdenoff/fe-libs/ui';\nimport { nativeImpact, nativeNotify } from '../../../../utils/nativeBridge';\n\n// ============================================================================\n// Types\n// ============================================================================\n\ntype DiscountType = 'PERCENTAGE' | 'FIXED';\n\ninterface BillingDiscount {\n id: string;\n code: string;\n type: DiscountType;\n value: number;\n currency: string | null;\n maxUses: number | null;\n usedCount: number;\n validFrom: string | null;\n validUntil: string | null;\n metadata: Record<string, unknown> | null;\n context: Record<string, unknown> | null;\n createdAt: string;\n updatedAt: string;\n}\n\ninterface CreateDiscountForm {\n code: string;\n type: DiscountType;\n value: string;\n currency: string;\n maxUses: string;\n validFrom: string;\n validUntil: string;\n}\n\ninterface EditDiscountForm {\n maxUses: string;\n validUntil: string;\n}\n\ntype ModalState =\n | { kind: 'closed' }\n | { kind: 'create' }\n | { kind: 'edit'; discount: BillingDiscount }\n | { kind: 'delete'; discount: BillingDiscount };\n\n// ============================================================================\n// Helpers\n// ============================================================================\n\nfunction isExpired(discount: BillingDiscount): boolean {\n if (!discount.validUntil) return false;\n return new Date(discount.validUntil) < new Date();\n}\n\nfunction formatDiscountValue(discount: BillingDiscount): string {\n if (discount.type === 'PERCENTAGE') {\n return `${discount.value}%`;\n }\n return formatCurrency(discount.value, discount.currency ?? 'USD');\n}\n\nconst INITIAL_CREATE_FORM: CreateDiscountForm = {\n code: '',\n type: 'PERCENTAGE',\n value: '',\n currency: 'USD',\n maxUses: '',\n validFrom: '',\n validUntil: '',\n};\n\n// ============================================================================\n// Main Component\n// ============================================================================\n\nexport const DiscountsListPage: 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 permissions = useBillingPermissions();\n\n const { data, loading, error, refetch } = useGetDiscountsQuery();\n\n const [createDiscount, { loading: isCreating }] = useCreateDiscountMutation();\n const [updateDiscount, { loading: isUpdating }] = useUpdateDiscountMutation();\n const [deleteDiscount, { loading: isDeleting }] = useDeleteDiscountMutation();\n\n const [searchQuery, setSearchQuery] = useState('');\n const [modal, setModal] = useState<ModalState>({ kind: 'closed' });\n const [createForm, setCreateForm] = useState<CreateDiscountForm>(INITIAL_CREATE_FORM);\n const [editForm, setEditForm] = useState<EditDiscountForm>({ maxUses: '', validUntil: '' });\n const [mutationError, setMutationError] = useState<string | null>(null);\n const [selectedDiscountIds, setSelectedDiscountIds] = useState<Set<string>>(new Set());\n const [showBulkDeleteConfirm, setShowBulkDeleteConfirm] = useState(false);\n\n const discounts: BillingDiscount[] = (data?.getDiscounts ?? []) as BillingDiscount[];\n\n // Filtered discounts\n const filteredDiscounts = discounts.filter((discount: BillingDiscount) => {\n if (!searchQuery) return true;\n return discount.code.toLowerCase().includes(searchQuery.toLowerCase());\n });\n\n const selectedDiscounts = useMemo(\n () => filteredDiscounts.filter((discount) => selectedDiscountIds.has(discount.id)),\n [filteredDiscounts, selectedDiscountIds]\n );\n\n const allVisibleSelected =\n filteredDiscounts.length > 0 &&\n filteredDiscounts.every((discount) => selectedDiscountIds.has(discount.id));\n const partiallySelected =\n filteredDiscounts.some((discount) => selectedDiscountIds.has(discount.id)) &&\n !allVisibleSelected;\n\n // Permission check\n if (!permissions.canManageDiscounts) {\n return <AccessDenied message=\"You don't have permission to manage discount codes.\" />;\n }\n\n // Summary stats\n const totalDiscounts = discounts.length;\n const activeDiscounts = discounts.filter((d: BillingDiscount) => !isExpired(d)).length;\n const expiredDiscounts = discounts.filter((d: BillingDiscount) => isExpired(d)).length;\n\n // ── Modal handlers ──────────────────────────────────────────────────\n\n const openCreateModal = () => {\n setCreateForm(INITIAL_CREATE_FORM);\n setMutationError(null);\n setModal({ kind: 'create' });\n };\n\n const openEditModal = (discount: BillingDiscount) => {\n setEditForm({\n maxUses: discount.maxUses != null ? String(discount.maxUses) : '',\n validUntil: discount.validUntil\n ? new Date(discount.validUntil).toISOString().slice(0, 16)\n : '',\n });\n setMutationError(null);\n setModal({ kind: 'edit', discount });\n };\n\n const openDeleteModal = (discount: BillingDiscount) => {\n setMutationError(null);\n setModal({ kind: 'delete', discount });\n };\n\n const closeModal = () => {\n setModal({ kind: 'closed' });\n setMutationError(null);\n };\n\n // ── Mutation handlers ───────────────────────────────────────────────\n\n const handleCreate = async (e: FormEvent) => {\n e.preventDefault();\n setMutationError(null);\n\n if (!createForm.code.trim()) {\n setMutationError('Discount code is required.');\n return;\n }\n\n const valueNum = Number(createForm.value);\n if (Number.isNaN(valueNum) || valueNum <= 0) {\n setMutationError('Value must be a positive number.');\n return;\n }\n\n if (createForm.type === 'PERCENTAGE' && valueNum > 100) {\n setMutationError('Percentage value cannot exceed 100.');\n return;\n }\n\n try {\n await createDiscount({\n variables: {\n code: createForm.code.trim().toUpperCase(),\n type: createForm.type,\n value: valueNum,\n currency: createForm.type === 'FIXED' ? createForm.currency : null,\n maxUses: createForm.maxUses ? Number(createForm.maxUses) : null,\n validFrom: createForm.validFrom ? new Date(createForm.validFrom).toISOString() : null,\n validUntil: createForm.validUntil ? new Date(createForm.validUntil).toISOString() : null,\n },\n });\n await refetch();\n closeModal();\n } catch (err) {\n setMutationError(err instanceof Error ? err.message : 'Failed to create discount.');\n }\n };\n\n const handleUpdate = async (e: FormEvent) => {\n e.preventDefault();\n if (modal.kind !== 'edit') return;\n setMutationError(null);\n\n try {\n await updateDiscount({\n variables: {\n id: modal.discount.id,\n maxUses: editForm.maxUses ? Number(editForm.maxUses) : null,\n validUntil: editForm.validUntil ? new Date(editForm.validUntil).toISOString() : null,\n },\n });\n await refetch();\n closeModal();\n } catch (err) {\n setMutationError(err instanceof Error ? err.message : 'Failed to update discount.');\n }\n };\n\n const handleDelete = async () => {\n if (modal.kind !== 'delete') return;\n setMutationError(null);\n void nativeImpact('medium');\n\n try {\n await deleteDiscount({ variables: { id: modal.discount.id } });\n void nativeNotify('success');\n await refetch();\n closeModal();\n } catch (err) {\n void nativeNotify('error');\n setMutationError(err instanceof Error ? err.message : 'Failed to delete discount.');\n }\n };\n\n const handleBulkDelete = async () => {\n if (selectedDiscounts.length === 0) return;\n\n setMutationError(null);\n setShowBulkDeleteConfirm(false);\n await Promise.allSettled(\n selectedDiscounts.map((discount) => deleteDiscount({ variables: { id: discount.id } }))\n );\n await refetch();\n setSelectedDiscountIds(new Set());\n };\n\n const toggleDiscountSelection = (discountId: string, checked: boolean) => {\n setSelectedDiscountIds((prev) => {\n const next = new Set(prev);\n if (checked) {\n next.add(discountId);\n } else {\n next.delete(discountId);\n }\n return next;\n });\n setShowBulkDeleteConfirm(false);\n };\n\n const toggleAllDiscounts = (checked: boolean) => {\n setSelectedDiscountIds((prev) => {\n const next = new Set(prev);\n filteredDiscounts.forEach((discount) => {\n if (checked) {\n next.add(discount.id);\n } else {\n next.delete(discount.id);\n }\n });\n return next;\n });\n setShowBulkDeleteConfirm(false);\n };\n\n // ── Loading state ───────────────────────────────────────────────────\n\n if (loading && discounts.length === 0) {\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=\"grid grid-cols-1 sm:grid-cols-3 gap-4\">\n {[1, 2, 3].map((i) => (\n <div key={i} className=\"border border-border-subtle rounded-lg p-4 space-y-2\">\n <div className=\"h-4 w-24 bg-bg-sunken animate-pulse rounded\" />\n <div className=\"h-6 w-16 bg-bg-sunken animate-pulse rounded\" />\n </div>\n ))}\n </div>\n <div className=\"space-y-3\">\n {[1, 2, 3, 4, 5].map((i) => (\n <div key={i} className=\"border border-border-subtle rounded-lg p-4\">\n <div className=\"flex items-center gap-4\">\n <div className=\"size-10 bg-bg-sunken animate-pulse rounded\" />\n <div className=\"flex-1 space-y-2\">\n <div className=\"h-4 w-32 bg-bg-sunken animate-pulse rounded\" />\n <div className=\"h-3 w-48 bg-bg-sunken animate-pulse rounded\" />\n </div>\n </div>\n </div>\n ))}\n </div>\n </div>\n );\n }\n\n // ── Error state ─────────────────────────────────────────────────────\n\n if (error) {\n return (\n <div className=\"flex items-center justify-center h-full min-h-[400px]\">\n <div className=\"text-center space-y-4\">\n <div className=\"size-12 mx-auto rounded-full bg-status-error-bg-subtle flex items-center justify-center\">\n <svg\n className=\"size-6 text-status-error-text\"\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=\"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z\"\n />\n </svg>\n </div>\n <h2 className=\"text-lg font-semibold text-text-primary\">Failed to load discounts</h2>\n <p className=\"text-sm text-text-muted\">{error.message}</p>\n <button\n type=\"button\"\n onClick={() => refetch()}\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 transition-colors\"\n >\n Try Again\n </button>\n </div>\n </div>\n );\n }\n\n // ── Main render ─────────────────────────────────────────────────────\n\n return (\n <div className=\"space-y-6 p-6\">\n {/* Header */}\n <div className=\"flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between\">\n <div>\n <h1 className=\"text-2xl md:text-3xl font-semibold tracking-tight text-text-primary\">\n Discount Codes\n </h1>\n <p className=\"text-sm text-text-secondary mt-1\">\n Create, view, and manage discount codes for billing\n </p>\n <PagePurpose className=\"mt-3\">\n Discount codes reduce the price of a purchase at checkout. Create codes here, set how\n much they take off and any limits, and manage which ones are active — separate from\n time-bounded promotions and customer-facing coupons.\n </PagePurpose>\n </div>\n <button\n type=\"button\"\n onClick={openCreateModal}\n className=\"inline-flex items-center gap-2 px-4 py-2 text-sm font-medium bg-action-primary-bg text-action-primary-text rounded-button hover:bg-action-primary-bgHover transition-colors duration-200 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)]\"\n >\n <svg className=\"size-4\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\">\n <path strokeLinecap=\"round\" strokeLinejoin=\"round\" strokeWidth={2} d=\"M12 4v16m8-8H4\" />\n </svg>\n Create Discount\n </button>\n </div>\n\n {/* Summary Cards */}\n <div className=\"grid grid-cols-1 sm:grid-cols-3 gap-4\">\n <div className=\"rounded-card border border-border-seam bg-bg-surface p-5 shadow-[var(--shadow-elevation-1)]\">\n <p className=\"text-sm text-text-secondary\">Total Discounts</p>\n <p className=\"text-2xl font-semibold text-text-primary tabular-nums mt-1\">\n {totalDiscounts}\n </p>\n </div>\n <div className=\"rounded-card border border-border-seam bg-bg-surface p-5 shadow-[var(--shadow-elevation-1)]\">\n <p className=\"text-sm text-text-secondary\">Active</p>\n <p className=\"text-2xl font-semibold text-status-success-text tabular-nums mt-1\">\n {activeDiscounts}\n </p>\n </div>\n <div className=\"rounded-card border border-border-seam bg-bg-surface p-5 shadow-[var(--shadow-elevation-1)]\">\n <p className=\"text-sm text-text-secondary\">Expired</p>\n <p className=\"text-2xl font-semibold text-status-warning-text tabular-nums mt-1\">\n {expiredDiscounts}\n </p>\n </div>\n </div>\n\n {/* Search */}\n <div className=\"flex flex-col sm:flex-row flex-wrap items-stretch sm:items-center gap-3 sm:gap-4 pb-4 border-b border-border-subtle\">\n <div className=\"relative flex-1 min-w-0 w-full sm:max-w-md\">\n <svg\n className=\"absolute left-3 top-1/2 -translate-y-1/2 size-4 text-text-muted\"\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=\"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z\"\n />\n </svg>\n <input\n type=\"text\"\n placeholder=\"Search by discount code...\"\n value={searchQuery}\n onChange={(e) => setSearchQuery(e.target.value)}\n className=\"w-full pl-[3.25rem] pr-4 py-2 text-sm border border-border-subtle rounded-input bg-bg-surface text-text-primary placeholder:text-text-muted focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)] focus:border-transparent\"\n />\n </div>\n </div>\n\n {filteredDiscounts.length > 0 && (\n <div className=\"flex flex-col gap-3 rounded-lg border border-border-subtle bg-bg-surface p-4 sm:flex-row sm:items-center sm:justify-between\">\n <label className=\"flex items-center gap-2 text-sm text-text-primary\">\n <input\n type=\"checkbox\"\n checked={allVisibleSelected}\n ref={(input) => {\n if (input) {\n input.indeterminate = partiallySelected && !allVisibleSelected;\n }\n }}\n onChange={(event) => toggleAllDiscounts(event.target.checked)}\n aria-label=\"Select all discounts\"\n className=\"size-4 rounded border-border-subtle text-text-link\"\n />\n <span>Select all visible</span>\n </label>\n\n <div className=\"flex items-center gap-2\">\n <span className=\"text-sm text-text-muted\">{selectedDiscountIds.size} selected</span>\n {selectedDiscountIds.size > 0 && (\n <button\n type=\"button\"\n onClick={() => {\n setSelectedDiscountIds(new Set());\n setShowBulkDeleteConfirm(false);\n }}\n className=\"text-sm text-text-muted hover:text-text-primary\"\n >\n Clear selection\n </button>\n )}\n <button\n type=\"button\"\n onClick={() => setShowBulkDeleteConfirm(true)}\n disabled={selectedDiscounts.length === 0 || isDeleting}\n className=\"inline-flex items-center gap-2 px-3 py-2 text-sm font-medium border border-status-error-border text-status-error-text rounded-md hover:bg-status-error-bg-subtle transition-colors disabled:opacity-50\"\n >\n Delete Selected{selectedDiscounts.length > 0 ? ` (${selectedDiscounts.length})` : ''}\n </button>\n </div>\n </div>\n )}\n\n {showBulkDeleteConfirm && selectedDiscounts.length > 0 && (\n <div className=\"rounded-lg border border-status-error-border bg-status-error-bg-subtle p-4\">\n <div className=\"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between\">\n <div>\n <p className=\"text-sm font-medium text-text-primary\">\n Delete {selectedDiscounts.length} selected discount\n {selectedDiscounts.length === 1 ? '' : 's'}?\n </p>\n <p className=\"text-sm text-text-muted\">This action cannot be undone.</p>\n </div>\n <div className=\"flex items-center gap-2\">\n <button\n type=\"button\"\n onClick={() => setShowBulkDeleteConfirm(false)}\n className=\"px-3 py-2 text-sm font-medium text-text-muted hover:text-text-primary\"\n >\n Cancel\n </button>\n <button\n type=\"button\"\n onClick={handleBulkDelete}\n disabled={isDeleting}\n className=\"inline-flex items-center gap-2 rounded-button bg-action-danger-bg px-3 py-2 text-sm font-medium text-action-danger-text hover:bg-action-danger-bgHover disabled:opacity-50\"\n >\n Confirm Delete\n </button>\n </div>\n </div>\n </div>\n )}\n\n {/* Discounts Table */}\n {filteredDiscounts.length === 0 ? (\n <IllustratedEmptyState\n illustration={searchQuery ? 'empty-search' : 'empty-data'}\n title=\"No discount codes found\"\n description={\n searchQuery\n ? 'No discount codes match your search.'\n : 'Create your first discount code to get started.'\n }\n action={\n !searchQuery ? (\n <button\n type=\"button\"\n onClick={openCreateModal}\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 transition-colors\"\n >\n Create your first discount\n </button>\n ) : undefined\n }\n kind={searchQuery ? 'no-results' : 'first-use'}\n glassIllustration=\"money\"\n />\n ) : (\n <div className=\"border border-border-seam rounded-card overflow-hidden shadow-[var(--shadow-elevation-1)]\">\n <div className=\"overflow-x-auto\">\n <table className=\"w-full\">\n <thead className=\"sticky top-0 z-10 bg-bg-sunken border-b border-border-subtle\">\n <tr>\n <th className=\"text-left px-4 py-3 text-xs font-medium uppercase tracking-wide text-text-muted w-12\">\n <input\n type=\"checkbox\"\n checked={allVisibleSelected}\n ref={(input) => {\n if (input) {\n input.indeterminate = partiallySelected && !allVisibleSelected;\n }\n }}\n onChange={(event) => toggleAllDiscounts(event.target.checked)}\n aria-label=\"Select all discounts\"\n className=\"size-4 rounded border-border-subtle text-action-primary-bg focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)]\"\n />\n </th>\n <th className=\"text-left px-4 py-3 text-xs font-medium uppercase tracking-wide text-text-muted\">\n Code\n </th>\n <th className=\"text-left px-4 py-3 text-xs font-medium uppercase tracking-wide text-text-muted\">\n Type\n </th>\n <th className=\"text-left px-4 py-3 text-xs font-medium uppercase tracking-wide text-text-muted\">\n Value\n </th>\n <th className=\"text-left px-4 py-3 text-xs font-medium uppercase tracking-wide text-text-muted hidden md:table-cell\">\n Uses\n </th>\n <th className=\"text-left px-4 py-3 text-xs font-medium uppercase tracking-wide text-text-muted hidden lg:table-cell\">\n Valid From\n </th>\n <th className=\"text-left px-4 py-3 text-xs font-medium uppercase tracking-wide text-text-muted hidden sm:table-cell\">\n Valid Until\n </th>\n <th className=\"text-left px-4 py-3 text-xs font-medium uppercase tracking-wide text-text-muted\">\n Status\n </th>\n <th className=\"text-right px-4 py-3 text-xs font-medium uppercase tracking-wide text-text-muted\">\n Actions\n </th>\n </tr>\n </thead>\n <tbody className=\"divide-y divide-border-subtle\">\n {filteredDiscounts.map((discount: BillingDiscount) => (\n <DiscountRow\n key={discount.id}\n discount={discount}\n selected={selectedDiscountIds.has(discount.id)}\n onToggleSelect={toggleDiscountSelection}\n onEdit={openEditModal}\n onDelete={openDeleteModal}\n />\n ))}\n </tbody>\n </table>\n </div>\n </div>\n )}\n\n {/* Create Modal */}\n {modal.kind === 'create' && (\n <ModalOverlay onClose={closeModal}>\n <form onSubmit={handleCreate} className=\"space-y-4\">\n <div className=\"flex items-center justify-between mb-2\">\n <h2 className=\"text-lg font-semibold text-text-primary\">\n {tr('billing.discounts.createDiscountCode', 'Create Discount Code')}\n </h2>\n <button\n type=\"button\"\n onClick={closeModal}\n className=\"p-1.5 rounded hover:bg-bg-sunken transition-colors\"\n >\n <svg\n className=\"size-5 text-text-muted\"\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=\"M6 18L18 6M6 6l12 12\"\n />\n </svg>\n </button>\n </div>\n\n {mutationError && (\n <div className=\"p-3 text-sm text-status-error-text bg-status-error-bg-subtle border border-status-error-border rounded-md\">\n {mutationError}\n </div>\n )}\n\n {/* Code */}\n <div>\n <label\n htmlFor=\"create-code\"\n className=\"block text-sm font-medium text-text-primary mb-1\"\n >\n {tr('billing.discounts.code', 'Code')}{' '}\n <span className=\"text-status-error-text\">*</span>\n </label>\n <input\n id=\"create-code\"\n type=\"text\"\n required\n value={createForm.code}\n onChange={(e) => setCreateForm((prev) => ({ ...prev, code: e.target.value }))}\n placeholder={tr('billing.discounts.codePlaceholder', 'e.g. SUMMER25')}\n className=\"w-full px-3 py-2 text-sm border border-border-subtle rounded-input bg-bg-surface text-text-primary placeholder:text-text-muted focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)] focus:border-transparent uppercase\"\n />\n </div>\n\n {/* Type + Value row */}\n <div className=\"grid grid-cols-2 gap-4\">\n <div>\n <label\n htmlFor=\"create-type\"\n className=\"block text-sm font-medium text-text-primary mb-1\"\n >\n {tr('billing.discounts.type', 'Type')}{' '}\n <span className=\"text-status-error-text\">*</span>\n </label>\n <ThemedSelect\n id=\"create-type\"\n value={createForm.type}\n onChange={(e) =>\n setCreateForm((prev) => ({\n ...prev,\n type: e.target.value as DiscountType,\n }))\n }\n className=\"w-full px-3 py-2 text-sm border border-border-subtle rounded-input bg-bg-surface text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)] focus:border-transparent scheme-normal dark:scheme-dark [&_option]:bg-bg-surface [&_option]:text-text-primary\"\n >\n <option value=\"PERCENTAGE\">\n {tr('billing.discounts.typePercentage', 'Percentage')}\n </option>\n <option value=\"FIXED\">\n {tr('billing.discounts.typeFixedAmount', 'Fixed Amount')}\n </option>\n </ThemedSelect>\n </div>\n <div>\n <label\n htmlFor=\"create-value\"\n className=\"block text-sm font-medium text-text-primary mb-1\"\n >\n {tr('billing.discounts.value', 'Value')}{' '}\n <span className=\"text-status-error-text\">*</span>\n </label>\n <div className=\"relative\">\n <input\n id=\"create-value\"\n type=\"number\"\n required\n min=\"0.01\"\n max={createForm.type === 'PERCENTAGE' ? '100' : undefined}\n step=\"0.01\"\n value={createForm.value}\n onChange={(e) => setCreateForm((prev) => ({ ...prev, value: e.target.value }))}\n placeholder={createForm.type === 'PERCENTAGE' ? '10' : '25.00'}\n className=\"w-full px-3 py-2 pr-8 text-sm border border-border-subtle rounded-input bg-bg-surface text-text-primary placeholder:text-text-muted focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)] focus:border-transparent\"\n />\n <span className=\"absolute right-3 top-1/2 -translate-y-1/2 text-sm text-text-muted\">\n {createForm.type === 'PERCENTAGE' ? '%' : createForm.currency}\n </span>\n </div>\n </div>\n </div>\n\n {/* Currency (only for FIXED) */}\n {createForm.type === 'FIXED' && (\n <div>\n <label\n htmlFor=\"create-currency\"\n className=\"block text-sm font-medium text-text-primary mb-1\"\n >\n {tr('billing.discounts.currency', 'Currency')}\n </label>\n <ThemedSelect\n id=\"create-currency\"\n value={createForm.currency}\n onChange={(e) => setCreateForm((prev) => ({ ...prev, currency: e.target.value }))}\n className=\"w-full px-3 py-2 text-sm border border-border-subtle rounded-input bg-bg-surface text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)] focus:border-transparent 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=\"CAD\">CAD</option>\n <option value=\"AUD\">AUD</option>\n </ThemedSelect>\n </div>\n )}\n\n {/* Max Uses */}\n <div>\n <label\n htmlFor=\"create-max-uses\"\n className=\"block text-sm font-medium text-text-primary mb-1\"\n >\n {tr('billing.discounts.maxUses', 'Max Uses')}\n </label>\n <input\n id=\"create-max-uses\"\n type=\"number\"\n min=\"1\"\n step=\"1\"\n value={createForm.maxUses}\n onChange={(e) => setCreateForm((prev) => ({ ...prev, maxUses: e.target.value }))}\n placeholder={tr('billing.discounts.unlimited', 'Unlimited')}\n className=\"w-full px-3 py-2 text-sm border border-border-subtle rounded-input bg-bg-surface text-text-primary placeholder:text-text-muted focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)] focus:border-transparent\"\n />\n <p className=\"text-xs text-text-muted mt-1\">\n {tr('billing.discounts.unlimitedHelp', 'Leave empty for unlimited uses.')}\n </p>\n </div>\n\n {/* Valid From / Valid Until row */}\n <div className=\"grid grid-cols-2 gap-4\">\n <div>\n <label\n htmlFor=\"create-valid-from\"\n className=\"block text-sm font-medium text-text-primary mb-1\"\n >\n {tr('billing.discounts.validFrom', 'Valid From')}\n </label>\n <input\n id=\"create-valid-from\"\n type=\"datetime-local\"\n value={createForm.validFrom}\n onChange={(e) =>\n setCreateForm((prev) => ({ ...prev, validFrom: e.target.value }))\n }\n className=\"w-full px-3 py-2 text-sm border border-border-subtle rounded-input bg-bg-surface text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)] focus:border-transparent\"\n />\n </div>\n <div>\n <label\n htmlFor=\"create-valid-until\"\n className=\"block text-sm font-medium text-text-primary mb-1\"\n >\n {tr('billing.discounts.validUntil', 'Valid Until')}\n </label>\n <input\n id=\"create-valid-until\"\n type=\"datetime-local\"\n value={createForm.validUntil}\n onChange={(e) =>\n setCreateForm((prev) => ({ ...prev, validUntil: e.target.value }))\n }\n className=\"w-full px-3 py-2 text-sm border border-border-subtle rounded-input bg-bg-surface text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)] focus:border-transparent\"\n />\n </div>\n </div>\n\n {/* Actions */}\n <div className=\"flex items-center justify-end gap-3 pt-2 border-t border-border-subtle\">\n <button\n type=\"button\"\n onClick={closeModal}\n className=\"px-4 py-2 text-sm font-medium border border-border-subtle text-text-primary rounded-button hover:bg-bg-sunken transition-colors\"\n >\n {tr('billing.discounts.cancel', 'Cancel')}\n </button>\n <button\n type=\"submit\"\n disabled={isCreating}\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 transition-colors disabled:opacity-50 disabled:cursor-not-allowed\"\n >\n {isCreating\n ? tr('billing.discounts.creating', 'Creating...')\n : tr('billing.discounts.createDiscount', 'Create Discount')}\n </button>\n </div>\n </form>\n </ModalOverlay>\n )}\n\n {/* Edit Modal */}\n {modal.kind === 'edit' && (\n <ModalOverlay onClose={closeModal}>\n <form onSubmit={handleUpdate} className=\"space-y-4\">\n <div className=\"flex items-center justify-between mb-2\">\n <h2 className=\"text-lg font-semibold text-text-primary\">Edit Discount</h2>\n <button\n type=\"button\"\n onClick={closeModal}\n className=\"p-1.5 rounded hover:bg-bg-sunken transition-colors\"\n >\n <svg\n className=\"size-5 text-text-muted\"\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=\"M6 18L18 6M6 6l12 12\"\n />\n </svg>\n </button>\n </div>\n\n {mutationError && (\n <div className=\"p-3 text-sm text-status-error-text bg-status-error-bg-subtle border border-status-error-border rounded-md\">\n {mutationError}\n </div>\n )}\n\n {/* Read-only info */}\n <div className=\"p-3 bg-bg-sunken/50 border border-border-subtle rounded-md space-y-1\">\n <div className=\"flex items-center justify-between text-sm\">\n <span className=\"text-text-muted\">Code</span>\n <span className=\"font-mono font-medium text-text-primary\">\n {modal.discount.code}\n </span>\n </div>\n <div className=\"flex items-center justify-between text-sm\">\n <span className=\"text-text-muted\">Type</span>\n <span className=\"text-text-primary\">\n {modal.discount.type === 'PERCENTAGE' ? 'Percentage' : 'Fixed Amount'}\n </span>\n </div>\n <div className=\"flex items-center justify-between text-sm\">\n <span className=\"text-text-muted\">Value</span>\n <span className=\"text-text-primary\">{formatDiscountValue(modal.discount)}</span>\n </div>\n <div className=\"flex items-center justify-between text-sm\">\n <span className=\"text-text-muted\">Used</span>\n <span className=\"text-text-primary\">{modal.discount.usedCount} times</span>\n </div>\n </div>\n\n {/* Editable: Max Uses */}\n <div>\n <label\n htmlFor=\"edit-max-uses\"\n className=\"block text-sm font-medium text-text-primary mb-1\"\n >\n Max Uses\n </label>\n <input\n id=\"edit-max-uses\"\n type=\"number\"\n min=\"1\"\n step=\"1\"\n value={editForm.maxUses}\n onChange={(e) => setEditForm((prev) => ({ ...prev, maxUses: e.target.value }))}\n placeholder=\"Unlimited\"\n className=\"w-full px-3 py-2 text-sm border border-border-subtle rounded-input bg-bg-surface text-text-primary placeholder:text-text-muted focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)] focus:border-transparent\"\n />\n <p className=\"text-xs text-text-muted mt-1\">Leave empty for unlimited uses.</p>\n </div>\n\n {/* Editable: Valid Until */}\n <div>\n <label\n htmlFor=\"edit-valid-until\"\n className=\"block text-sm font-medium text-text-primary mb-1\"\n >\n Valid Until\n </label>\n <input\n id=\"edit-valid-until\"\n type=\"datetime-local\"\n value={editForm.validUntil}\n onChange={(e) => setEditForm((prev) => ({ ...prev, validUntil: e.target.value }))}\n className=\"w-full px-3 py-2 text-sm border border-border-subtle rounded-input bg-bg-surface text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)] focus:border-transparent\"\n />\n </div>\n\n {/* Actions */}\n <div className=\"flex items-center justify-end gap-3 pt-2 border-t border-border-subtle\">\n <button\n type=\"button\"\n onClick={closeModal}\n className=\"px-4 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 <button\n type=\"submit\"\n disabled={isUpdating}\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 transition-colors disabled:opacity-50 disabled:cursor-not-allowed\"\n >\n {isUpdating ? 'Saving...' : 'Save Changes'}\n </button>\n </div>\n </form>\n </ModalOverlay>\n )}\n\n {/* Delete Confirmation Modal */}\n {modal.kind === 'delete' && (\n <ModalOverlay onClose={closeModal}>\n <div className=\"space-y-4\">\n <div className=\"flex items-center justify-between mb-2\">\n <h2 className=\"text-lg font-semibold text-text-primary\">Delete Discount</h2>\n <button\n type=\"button\"\n onClick={closeModal}\n className=\"p-1.5 rounded hover:bg-bg-sunken transition-colors\"\n >\n <svg\n className=\"size-5 text-text-muted\"\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=\"M6 18L18 6M6 6l12 12\"\n />\n </svg>\n </button>\n </div>\n\n {mutationError && (\n <div className=\"p-3 text-sm text-status-error-text bg-status-error-bg-subtle border border-status-error-border rounded-md\">\n {mutationError}\n </div>\n )}\n\n <div className=\"flex items-start gap-3\">\n <div className=\"size-10 rounded-full bg-status-error-bg-subtle flex items-center justify-center shrink-0\">\n <svg\n className=\"size-5 text-status-error-text\"\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=\"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z\"\n />\n </svg>\n </div>\n <div>\n <p className=\"text-sm text-text-primary\">\n Are you sure you want to delete the discount code{' '}\n <span className=\"font-mono font-semibold\">{modal.discount.code}</span>?\n </p>\n <p className=\"text-sm text-text-muted mt-1\">\n This action cannot be undone. The discount has been used{' '}\n <span className=\"font-medium\">{modal.discount.usedCount}</span> time\n {modal.discount.usedCount !== 1 ? 's' : ''}.\n </p>\n </div>\n </div>\n\n <div className=\"flex items-center justify-end gap-3 pt-2 border-t border-border-subtle\">\n <button\n type=\"button\"\n onClick={closeModal}\n className=\"px-4 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 <button\n type=\"button\"\n onClick={handleDelete}\n disabled={isDeleting}\n className=\"px-4 py-2 text-sm font-medium bg-action-danger-bg text-action-danger-text rounded-button hover:bg-action-danger-bgHover transition-colors disabled:opacity-50 disabled:cursor-not-allowed\"\n >\n {isDeleting ? 'Deleting...' : 'Delete Discount'}\n </button>\n </div>\n </div>\n </ModalOverlay>\n )}\n </div>\n );\n};\n\n// ============================================================================\n// Discount Row Component\n// ============================================================================\n\ninterface DiscountRowProps {\n discount: BillingDiscount;\n selected: boolean;\n onToggleSelect: (discountId: string, checked: boolean) => void;\n onEdit: (discount: BillingDiscount) => void;\n onDelete: (discount: BillingDiscount) => void;\n}\n\nconst DiscountRow: FC<DiscountRowProps> = ({\n discount,\n selected,\n onToggleSelect,\n onEdit,\n onDelete,\n}) => {\n const expired = isExpired(discount);\n\n return (\n <tr className={`hover:bg-bg-sunken/30 transition-colors ${selected ? 'bg-bg-sunken/20' : ''}`}>\n <td className=\"p-4\">\n <input\n type=\"checkbox\"\n checked={selected}\n onChange={(event) => onToggleSelect(discount.id, event.target.checked)}\n aria-label={`Select discount ${discount.code}`}\n className=\"size-4 rounded border-border-subtle text-text-link\"\n />\n </td>\n {/* Code */}\n <td className=\"p-4\">\n <span className=\"font-mono font-medium text-text-primary\">{discount.code}</span>\n </td>\n\n {/* Type */}\n <td className=\"p-4\">\n <span className=\"text-sm text-text-muted\">\n {discount.type === 'PERCENTAGE' ? 'Percentage' : 'Fixed'}\n </span>\n </td>\n\n {/* Value */}\n <td className=\"p-4\">\n <span className=\"text-sm font-medium text-text-primary\">\n {formatDiscountValue(discount)}\n </span>\n </td>\n\n {/* Uses */}\n <td className=\"p-4 hidden md:table-cell\">\n <span className=\"text-sm text-text-muted\">\n {discount.usedCount}\n {discount.maxUses != null ? ` / ${discount.maxUses}` : ' / \\u221E'}\n </span>\n </td>\n\n {/* Valid From */}\n <td className=\"p-4 text-sm text-text-muted hidden lg:table-cell\">\n {discount.validFrom ? formatDate(discount.validFrom, 'short') : '\\u2014'}\n </td>\n\n {/* Valid Until */}\n <td className=\"p-4 text-sm text-text-muted hidden sm:table-cell\">\n {discount.validUntil ? formatDate(discount.validUntil, 'short') : '\\u2014'}\n </td>\n\n {/* Status */}\n <td className=\"p-4\">\n {expired ? (\n <span className=\"inline-flex px-2 py-1 text-xs font-medium rounded bg-status-warning-bg-subtle text-status-warning-text\">\n Expired\n </span>\n ) : (\n <span className=\"inline-flex px-2 py-1 text-xs font-medium rounded bg-status-success-bg-subtle text-status-success-text\">\n Active\n </span>\n )}\n </td>\n\n {/* Actions */}\n <td className=\"p-4 text-right\">\n <div className=\"flex items-center justify-end gap-2\">\n <button\n type=\"button\"\n onClick={() => onEdit(discount)}\n className=\"px-3 py-1.5 text-sm font-medium text-text-primary hover:bg-bg-sunken rounded-button transition-colors\"\n title=\"Edit discount\"\n >\n {/* Pencil icon */}\n <svg className=\"size-4\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\">\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeWidth={2}\n d=\"M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z\"\n />\n </svg>\n </button>\n <button\n type=\"button\"\n onClick={() => onDelete(discount)}\n className=\"px-3 py-1.5 text-sm font-medium text-status-error-text hover:bg-status-error-bg-subtle rounded-md transition-colors\"\n title=\"Delete discount\"\n >\n {/* Trash icon */}\n <svg className=\"size-4\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\">\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 </td>\n </tr>\n );\n};\n\n// ============================================================================\n// Modal Overlay Component\n// ============================================================================\n\ninterface ModalOverlayProps {\n onClose: () => void;\n children: React.ReactNode;\n}\n\nconst ModalOverlay: FC<ModalOverlayProps> = ({ onClose, children }) => {\n return (\n <div className=\"fixed inset-0 z-50 flex items-center justify-center\">\n {/* Backdrop */}\n <div className=\"absolute inset-0 bg-bg-overlay\" onClick={onClose} />\n\n {/* Dialog */}\n <div className=\"relative w-full max-w-lg max-h-[85vh] overflow-y-auto bg-bg-elevated border border-border-seam rounded-card shadow-[var(--shadow-elevation-4)] p-6 mx-4\">\n {children}\n </div>\n </div>\n );\n};\n"],"mappings":";;;;;;;;;;;AAkEA,SAASA,EAAU,GAAoC;CAErD,OADKC,EAAS,aACP,IAAI,KAAKA,EAAS,UAAU,oBAAI,IAAI,KAAK,IADf;AAEnC;AAEA,SAASC,EAAoB,GAAmC;CAI9D,OAHID,EAAS,SAAS,eACb,GAAGA,EAAS,MAAM,KAEpBE,EAAeF,EAAS,OAAOA,EAAS,YAAY,KAAK;AAClE;AAEA,IAAMG,IAA0C;CAC9C,MAAM;CACN,MAAM;CACN,OAAO;CACP,UAAU;CACV,SAAS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AWM6E,KAAuC,EAAE,YAAS,kBAEpD,kBAAC,OAAD;CAAK,WAAU;CAAf,UAAA,CAEE,kBAAC,OAAD;EAAK,WAAU;EAAiC,SAASQ;CAAU,CAAA,GAGnE,kBAAC,OAAD;EAAK,WAAU;EACZ;CACE,CAAA,CACF"}
@@ -162,7 +162,8 @@ var fe = [
162
162
  if (!M && !L && !I) return /* @__PURE__ */ C(f, {
163
163
  illustration: "empty-generic",
164
164
  title: "No billing account found",
165
- description: "Create a billing account first to view earnings."
165
+ description: "Create a billing account first to view earnings.",
166
+ glassIllustration: "money"
166
167
  });
167
168
  if (q && c(q)) {
168
169
  let e = /* @__PURE__ */ C(te, {
@@ -275,7 +276,9 @@ var fe = [
275
276
  }), H.sales.length === 0 ? /* @__PURE__ */ C(f, {
276
277
  illustration: "empty-data",
277
278
  title: "No sales yet",
278
- description: "Sales will appear here when customers start purchasing your apps."
279
+ description: "Sales will appear here when customers start purchasing your apps.",
280
+ glassIllustration: "money",
281
+ size: "panel"
279
282
  }) : /* @__PURE__ */ C(m, {
280
283
  data: H.sales,
281
284
  rowKey: (e) => e.id,
@@ -290,7 +293,9 @@ var fe = [
290
293
  }), H.payouts.length === 0 ? /* @__PURE__ */ C(f, {
291
294
  illustration: "empty-data",
292
295
  title: "No payouts yet",
293
- description: "Scheduled and completed payouts will appear here."
296
+ description: "Scheduled and completed payouts will appear here.",
297
+ glassIllustration: "money",
298
+ size: "panel"
294
299
  }) : /* @__PURE__ */ C(m, {
295
300
  data: H.payouts,
296
301
  rowKey: (e) => e.id,
@@ -301,7 +306,8 @@ var fe = [
301
306
  }) : /* @__PURE__ */ C(f, {
302
307
  illustration: "empty-data",
303
308
  title: "No developer portal revenue yet",
304
- description: "Marketplace revenue will appear here once your developer organization records sales."
309
+ description: "Marketplace revenue will appear here once your developer organization records sales.",
310
+ glassIllustration: "money"
305
311
  }) : R ? /* @__PURE__ */ w("div", {
306
312
  className: "space-y-4",
307
313
  children: [/* @__PURE__ */ C(ue, {
@@ -380,7 +386,10 @@ var fe = [
380
386
  }), Z.length === 0 && !G ? /* @__PURE__ */ C(f, {
381
387
  illustration: "empty-data",
382
388
  title: "No earnings yet",
383
- description: "Eligible affiliate rewards and other earnings will appear here."
389
+ description: "Eligible affiliate rewards and other earnings will appear here.",
390
+ kind: W === "ALL" ? "first-use" : "filtered",
391
+ glassIllustration: "money",
392
+ size: "panel"
384
393
  }) : /* @__PURE__ */ C(m, {
385
394
  data: Z,
386
395
  rowKey: (e) => e.id,
@@ -1 +1 @@
1
- {"version":3,"file":"EarningsPage.js","names":["_Fragment","Fragment$1","salesColumns","sale","formatCurrency","formatDateTime","payoutColumns","payout","ledgerColumns","entry","EarningsPage","searchParams","useSearchParams","permissions","useBillingPermissions","isFluidgrids","useIsFluidgridsVariant","tr","useTr","useBilling","developerOrgId","developerOrgName","returnTo","billingAccountData","billingAccountLoading","useGetDefaultBillingAccountSettingsQuery","billingAccountId","summary","setSummary","useState","entries","setEntries","developerPortalRevenue","setDeveloperPortalRevenue","sourceFilter","setSourceFilter","loading","setLoading","error","setError","requestContext","useMemo","apiGatewayUrl","authToken","orgId","loadData","useCallback","loadedRevenue","fetchDeveloperPortalRevenueDashboard","loadedSummary","loadedEntries","fetchEarningsSummary","fetchEarningsEntries","loadError","useEffect","AccessDenied","IllustratedEmptyState","isServerError","serverError","ServerError","plainPayoutError","ShowTechnicalDetails","rawErrorText","cards","HandCoins","Coins","Wallet","RefreshCw","filteredEntries","categoryCards","item","developerPortalCards","isDeveloperPortalMode","PageHeader","navigate","ArrowLeft","PagePurpose","StatCard","card","ResponsiveTable","EmphasisPanel","PayoutErrorNotice","ThemedSelect","event"],"sources":["../../../../../src/billing/modules/earnings/pages/EarningsPage.tsx"],"sourcesContent":["import { useCallback, useEffect, useMemo, useState, type FC } from 'react';\nimport { useSearchParams } from 'react-router';\nimport { ArrowLeft, Coins, HandCoins, RefreshCw, Wallet } from 'lucide-react';\nimport {\n ResponsiveTable,\n type ResponsiveTableColumn,\n PagePurpose,\n EmphasisPanel,\n IllustratedEmptyState,\n ShowTechnicalDetails,\n ThemedSelect,\n} from '@burdenoff/fe-libs/ui';\n\nimport { useIsFluidgridsVariant } from '../../../hooks/useBillingVariant';\nimport { useTr } from '../../../shared/hooks/useTr';\nimport { PayoutErrorNotice } from '../components/PayoutErrorNotice';\nimport { plainPayoutError, rawErrorText } from '../utils/plainPayoutError';\nimport { useBillingPermissions } from '../../../hooks/useBillingPermissions';\nimport { useBilling } from '../../../providers/BillingProvider';\nimport { AccessDenied, PageHeader, ServerError, StatCard } from '../../../shared/components';\nimport { formatCurrency, formatDateTime, isServerError } from '../../../shared/utils';\nimport { useGetDefaultBillingAccountSettingsQuery } from '../../../../generated/global-operations';\nimport {\n fetchEarningsEntries,\n fetchEarningsSummary,\n fetchDeveloperPortalRevenueDashboard,\n type DeveloperPortalRevenueDashboard,\n type DeveloperPortalRevenueSale,\n type DeveloperPortalRevenuePayout,\n type EarningsEntry,\n type EarningsSummary,\n} from '../api';\n\ntype EarningsSourceFilter = 'ALL' | 'AFFILIATE' | 'STORE' | 'OTHER';\n\nconst salesColumns: ResponsiveTableColumn<DeveloperPortalRevenueSale>[] = [\n {\n key: 'application',\n header: 'Application',\n priority: 'primary',\n cell: (sale) => sale.application?.name || sale.application?.slug || 'Unknown app',\n },\n { key: 'pricing', header: 'Pricing', cell: (sale) => sale.pricingModel },\n {\n key: 'gross',\n header: 'Gross',\n cell: (sale) => (\n <span className=\"tabular-nums\">\n {formatCurrency(sale.grossAmount, sale.currency || 'USD')}\n </span>\n ),\n },\n {\n key: 'net',\n header: 'Net',\n cell: (sale) => (\n <span className=\"tabular-nums\">{formatCurrency(sale.netAmount, sale.currency || 'USD')}</span>\n ),\n },\n { key: 'status', header: 'Status', cell: (sale) => sale.status },\n {\n key: 'purchased',\n header: 'Purchased',\n cell: (sale) => formatDateTime(sale.purchasedAt),\n },\n];\n\nconst payoutColumns: ResponsiveTableColumn<DeveloperPortalRevenuePayout>[] = [\n {\n key: 'period',\n header: 'Period',\n priority: 'primary',\n cell: (payout) => payout.periodLabel || '-',\n },\n {\n key: 'amount',\n header: 'Amount',\n cell: (payout) => (\n <span className=\"tabular-nums\">\n {formatCurrency(payout.netAmount, payout.currency || 'USD')}\n </span>\n ),\n },\n { key: 'status', header: 'Status', cell: (payout) => payout.status },\n {\n key: 'scheduled',\n header: 'Scheduled',\n cell: (payout) => (payout.scheduledAt ? formatDateTime(payout.scheduledAt) : '-'),\n },\n {\n key: 'completed',\n header: 'Completed',\n cell: (payout) => (payout.completedAt ? formatDateTime(payout.completedAt) : '-'),\n },\n];\n\nconst ledgerColumns: ResponsiveTableColumn<EarningsEntry>[] = [\n {\n key: 'category',\n header: 'Category',\n priority: 'primary',\n cell: (entry) => entry.sourceCategory,\n },\n {\n key: 'description',\n header: 'Description',\n cell: (entry) => entry.description || entry.sourceSubcategory || '-',\n },\n { key: 'unit', header: 'Unit', cell: (entry) => entry.unitType },\n {\n key: 'amount',\n header: 'Amount',\n cell: (entry) => (\n <span className=\"tabular-nums\">\n {entry.unitType === 'CREDITS'\n ? `${entry.amount.toLocaleString()} credits`\n : formatCurrency(entry.amount, entry.currency || 'USD')}\n </span>\n ),\n },\n { key: 'status', header: 'Status', cell: (entry) => entry.status },\n {\n key: 'created',\n header: 'Created',\n cell: (entry) => formatDateTime(entry.createdAt),\n },\n];\n\nexport const EarningsPage: FC = () => {\n const [searchParams] = useSearchParams();\n const permissions = useBillingPermissions();\n const isFluidgrids = useIsFluidgridsVariant();\n const tr = useTr();\n const { apiGatewayUrl, authToken, orgId, navigate } = useBilling();\n const developerOrgId = searchParams.get('developerOrgId');\n const developerOrgName = searchParams.get('developerOrgName');\n // Set by devportal's OrganizationDetailPage when it links here — lets this\n // page offer a way back without needing to know whether the org is\n // PHYSICAL or DIGITAL (that split isn't in scope on this side).\n const returnTo = searchParams.get('returnTo');\n const { data: billingAccountData, loading: billingAccountLoading } =\n useGetDefaultBillingAccountSettingsQuery({});\n\n const billingAccountId = billingAccountData?.getDefaultBillingAccount?.id;\n const [summary, setSummary] = useState<EarningsSummary | null>(null);\n const [entries, setEntries] = useState<EarningsEntry[]>([]);\n const [developerPortalRevenue, setDeveloperPortalRevenue] =\n useState<DeveloperPortalRevenueDashboard | null>(null);\n const [sourceFilter, setSourceFilter] = useState<EarningsSourceFilter>('ALL');\n const [loading, setLoading] = useState(true);\n const [error, setError] = useState<Error | null>(null);\n\n const requestContext = useMemo(\n () => ({\n apiGatewayUrl,\n authToken,\n orgId,\n }),\n [apiGatewayUrl, authToken, orgId]\n );\n\n const loadData = useCallback(async () => {\n setLoading(true);\n setError(null);\n try {\n if (developerOrgId) {\n const loadedRevenue = await fetchDeveloperPortalRevenueDashboard(\n developerOrgId,\n requestContext\n );\n setDeveloperPortalRevenue(loadedRevenue);\n setSummary(null);\n setEntries([]);\n return;\n }\n\n if (!billingAccountId) {\n setSummary(null);\n setEntries([]);\n setDeveloperPortalRevenue(null);\n return;\n }\n\n const [loadedSummary, loadedEntries] = await Promise.all([\n fetchEarningsSummary(billingAccountId, requestContext),\n fetchEarningsEntries(billingAccountId, requestContext),\n ]);\n setSummary(loadedSummary);\n setEntries(loadedEntries);\n setDeveloperPortalRevenue(null);\n } catch (loadError) {\n setError(loadError instanceof Error ? loadError : new Error('Failed to load earnings'));\n } finally {\n setLoading(false);\n }\n }, [billingAccountId, developerOrgId, requestContext]);\n\n useEffect(() => {\n void loadData();\n }, [loadData]);\n\n if (!permissions.canViewBillingAccount) {\n return <AccessDenied message=\"You don't have permission to view earnings.\" />;\n }\n\n if (!developerOrgId && !billingAccountId && !billingAccountLoading) {\n return (\n <IllustratedEmptyState\n illustration=\"empty-generic\"\n title=\"No billing account found\"\n description=\"Create a billing account first to view earnings.\"\n />\n );\n }\n\n if (error && isServerError(error)) {\n const serverError = (\n <ServerError\n title=\"Earnings unavailable\"\n message={isFluidgrids ? plainPayoutError(error, tr) : error.message}\n onRetry={() => void loadData()}\n showRetry\n />\n );\n return isFluidgrids ? (\n <>\n {serverError}\n <div className=\"px-6\">\n <ShowTechnicalDetails copyable>{rawErrorText(error)}</ShowTechnicalDetails>\n </div>\n </>\n ) : (\n serverError\n );\n }\n\n const cards = summary\n ? [\n {\n title: 'Available',\n value: formatCurrency(summary.availableAmount, 'USD'),\n icon: <HandCoins className=\"size-5\" />,\n },\n {\n title: 'Reserved',\n value: formatCurrency(summary.reservedAmount, 'USD'),\n icon: <Coins className=\"size-5\" />,\n },\n {\n title: 'Paid out',\n value: formatCurrency(summary.paidAmount, 'USD'),\n icon: <Wallet className=\"size-5\" />,\n },\n {\n title: 'Lifetime',\n value: formatCurrency(summary.totalLifetimeAmount, 'USD'),\n icon: <RefreshCw className=\"size-5\" />,\n },\n ]\n : [];\n\n const filteredEntries =\n sourceFilter === 'ALL'\n ? entries\n : entries.filter((entry) => entry.sourceCategory === sourceFilter);\n\n const categoryCards =\n summary?.categoryBreakdown?.map((item) => ({\n title: `${item.category} earnings`,\n value: formatCurrency(item.amount, 'USD'),\n helperText: `${item.count} entries`,\n })) ?? [];\n\n const developerPortalCards = developerPortalRevenue?.summary\n ? [\n {\n title: 'Gross revenue',\n value: formatCurrency(\n developerPortalRevenue.summary.totalGrossRevenue,\n developerPortalRevenue.summary.currency\n ),\n icon: <HandCoins className=\"size-5\" />,\n },\n {\n title: 'Net revenue',\n value: formatCurrency(\n developerPortalRevenue.summary.totalNetRevenue,\n developerPortalRevenue.summary.currency\n ),\n icon: <Wallet className=\"size-5\" />,\n },\n {\n title: 'Pending balance',\n value: formatCurrency(\n developerPortalRevenue.summary.pendingBalance,\n developerPortalRevenue.summary.currency\n ),\n icon: <Coins className=\"size-5\" />,\n },\n {\n title: 'Platform fees',\n value: formatCurrency(\n developerPortalRevenue.summary.totalPlatformFees,\n developerPortalRevenue.summary.currency\n ),\n icon: <RefreshCw className=\"size-5\" />,\n },\n ]\n : [];\n\n const isDeveloperPortalMode = !!developerOrgId;\n\n return (\n <div className=\"space-y-6 p-6\">\n <PageHeader\n title={isDeveloperPortalMode ? 'Marketplace earnings' : 'Earnings'}\n description={\n isDeveloperPortalMode\n ? `Developer portal revenue, sales, and payouts${developerOrgName ? ` for ${developerOrgName}` : ''}.`\n : 'Track affiliate, store, and other earning sources in one ledger.'\n }\n actions={\n returnTo ? (\n <button\n type=\"button\"\n onClick={() => navigate?.(returnTo)}\n className=\"inline-flex items-center gap-2 rounded-md border border-border-subtle px-4 py-2 text-sm font-medium text-text-primary\"\n >\n <ArrowLeft className=\"size-4\" />\n Back\n </button>\n ) : undefined\n }\n />\n\n <PagePurpose>\n See everything you have earned — from affiliate rewards, store sales and marketplace revenue\n — in one ledger, along with how much has been paid out and what is still pending. Filter by\n source to reconcile a specific stream.\n </PagePurpose>\n\n {loading ? (\n <div className=\"grid gap-4 md:grid-cols-2 xl:grid-cols-4\">\n {[1, 2, 3, 4].map((item) => (\n <div\n key={item}\n className=\"h-28 animate-pulse rounded-lg border border-border-subtle bg-bg-surface\"\n />\n ))}\n </div>\n ) : isDeveloperPortalMode ? (\n developerPortalRevenue?.summary ? (\n <div className=\"space-y-6\">\n <div className=\"grid gap-4 md:grid-cols-2 xl:grid-cols-4\">\n {developerPortalCards.map((card) => (\n <StatCard key={card.title} label={card.title} value={card.value} icon={card.icon} />\n ))}\n </div>\n\n <section className=\"rounded-lg border border-border-subtle bg-bg-surface p-4\">\n <div className=\"mb-4 flex items-center justify-between\">\n <h2 className=\"text-lg font-semibold text-text-primary\">Recent sales</h2>\n <button\n type=\"button\"\n onClick={() => void loadData()}\n className=\"inline-flex items-center gap-2 rounded-md border border-border-subtle px-3 py-2 text-sm font-medium text-text-primary\"\n >\n <RefreshCw className=\"size-4\" />\n Refresh\n </button>\n </div>\n\n {developerPortalRevenue.sales.length === 0 ? (\n <IllustratedEmptyState\n illustration=\"empty-data\"\n title=\"No sales yet\"\n description=\"Sales will appear here when customers start purchasing your apps.\"\n />\n ) : (\n <ResponsiveTable\n data={developerPortalRevenue.sales}\n rowKey={(sale) => sale.id}\n columns={salesColumns}\n />\n )}\n </section>\n\n <section className=\"rounded-lg border border-border-subtle bg-bg-surface p-4\">\n <h2 className=\"mb-4 text-lg font-semibold text-text-primary\">Payouts</h2>\n\n {developerPortalRevenue.payouts.length === 0 ? (\n <IllustratedEmptyState\n illustration=\"empty-data\"\n title=\"No payouts yet\"\n description=\"Scheduled and completed payouts will appear here.\"\n />\n ) : (\n <ResponsiveTable\n data={developerPortalRevenue.payouts}\n rowKey={(payout) => payout.id}\n columns={payoutColumns}\n />\n )}\n </section>\n </div>\n ) : (\n <IllustratedEmptyState\n illustration=\"empty-data\"\n title=\"No developer portal revenue yet\"\n description=\"Marketplace revenue will appear here once your developer organization records sales.\"\n />\n )\n ) : summary ? (\n <div className=\"space-y-4\">\n <EmphasisPanel className=\"p-4 sm:p-5\">\n <div className=\"grid gap-4 md:grid-cols-2 xl:grid-cols-4\">\n {cards.map((card) => (\n <StatCard key={card.title} label={card.title} value={card.value} icon={card.icon} />\n ))}\n </div>\n </EmphasisPanel>\n {categoryCards.length > 0 ? (\n <div className=\"grid gap-4 md:grid-cols-2 xl:grid-cols-3\">\n {categoryCards.map((card) => (\n <div\n key={card.title}\n className=\"rounded-lg border border-border-subtle bg-bg-surface p-4\"\n >\n <p className=\"text-sm text-text-secondary\">{card.title}</p>\n <p className=\"mt-2 text-xl font-semibold text-text-primary\">{card.value}</p>\n <p className=\"mt-1 text-xs text-text-secondary\">{card.helperText}</p>\n </div>\n ))}\n </div>\n ) : null}\n </div>\n ) : null}\n\n {error && !isServerError(error) ? (\n isFluidgrids ? (\n <PayoutErrorNotice error={error} />\n ) : (\n <div className=\"rounded-lg border border-border-subtle bg-bg-surface p-4 text-sm text-status-error-text\">\n {error.message}\n </div>\n )\n ) : null}\n\n <section className=\"rounded-lg border border-border-subtle bg-bg-surface p-4\">\n <div className=\"mb-4 flex items-center justify-between\">\n <h2 className=\"text-lg font-semibold text-text-primary\">Ledger</h2>\n <div className=\"flex items-center gap-3\">\n <ThemedSelect\n value={sourceFilter}\n onChange={(event) => setSourceFilter(event.target.value as EarningsSourceFilter)}\n className=\"rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary scheme-normal dark:scheme-dark [&_option]:bg-bg-surface [&_option]:text-text-primary\"\n >\n <option value=\"ALL\">All sources</option>\n <option value=\"AFFILIATE\">Affiliate</option>\n <option value=\"STORE\">Store</option>\n <option value=\"OTHER\">Other</option>\n </ThemedSelect>\n <button\n type=\"button\"\n onClick={() => void loadData()}\n className=\"inline-flex items-center gap-2 rounded-md border border-border-subtle px-3 py-2 text-sm font-medium text-text-primary\"\n >\n <RefreshCw className=\"size-4\" />\n Refresh\n </button>\n </div>\n </div>\n\n {filteredEntries.length === 0 && !loading ? (\n <IllustratedEmptyState\n illustration=\"empty-data\"\n title=\"No earnings yet\"\n description=\"Eligible affiliate rewards and other earnings will appear here.\"\n />\n ) : (\n <ResponsiveTable\n data={filteredEntries}\n rowKey={(entry) => entry.id}\n columns={ledgerColumns}\n />\n )}\n </section>\n </div>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAmCA,IAAME,KAAoE;CACxE;EACE,KAAK;EACL,QAAQ;EACR,UAAU;EACV,OAAO,MAASC,EAAK,aAAa,QAAQA,EAAK,aAAa,QAAQ;CACtE;CACA;EAAE,KAAK;EAAW,QAAQ;EAAW,OAAO,MAASA,EAAK;CAAa;CACvE;EACE,KAAK;EACL,QAAQ;EACR,OAAO,MACL,kBAAC,QAAD;GAAM,WAAU;GACb,UAAAC,EAAeD,EAAK,aAAaA,EAAK,YAAY,KAAK;EACpD,CAAA;CAEV;CACA;EACE,KAAK;EACL,QAAQ;EACR,OAAO,MACL,kBAAC,QAAD;GAAM,WAAU;GAAgB,UAAAC,EAAeD,EAAK,WAAWA,EAAK,YAAY,KAAK;EAAQ,CAAA;CAEjG;CACA;EAAE,KAAK;EAAU,QAAQ;EAAU,OAAO,MAASA,EAAK;CAAO;CAC/D;EACE,KAAK;EACL,QAAQ;EACR,OAAO,M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C3C,kBAAC,UAAD;SAAQ,OAAM;SAAQ,UAAA;QAAa,CAAA;QACnC,kBAAC,UAAD;SAAQ,OAAM;SAAQ,UAAA;QAAa,CAAA;OACvB;MACd,CAAA,GAAA,kBAAC,UAAD;OACE,MAAK;OACL,eAAe,KAAKtC,EAAS;OAC7B,WAAU;OAHZ,UAAA,CAKE,kBAACsB,GAAD,EAAW,WAAU,SAAU,CAAA,GAAC,SAE1B;MACL,CAAA,CAAA;KACF,CAAA,CAAA;IAEJ,CAAA,GAAAC,EAAgB,WAAW,KAAK,CAAChC,IAChC,kBAACoB,GAAD;KACE,cAAa;KACb,OAAM;KACN,aAAY;IACb,CAAA,IAED,kBAACuB,GAAD;KACE,MAAMX;KACN,SAAS,MAAU3D,EAAM;KACzB,SAASD;IACV,CAAA,CAEI;;EACN;;AAET"}
1
+ {"version":3,"file":"EarningsPage.js","names":["_Fragment","Fragment$1","salesColumns","sale","formatCurrency","formatDateTime","payoutColumns","payout","ledgerColumns","entry","EarningsPage","searchParams","useSearchParams","permissions","useBillingPermissions","isFluidgrids","useIsFluidgridsVariant","tr","useTr","useBilling","developerOrgId","developerOrgName","returnTo","billingAccountData","billingAccountLoading","useGetDefaultBillingAccountSettingsQuery","billingAccountId","summary","setSummary","useState","entries","setEntries","developerPortalRevenue","setDeveloperPortalRevenue","sourceFilter","setSourceFilter","loading","setLoading","error","setError","requestContext","useMemo","apiGatewayUrl","authToken","orgId","loadData","useCallback","loadedRevenue","fetchDeveloperPortalRevenueDashboard","loadedSummary","loadedEntries","fetchEarningsSummary","fetchEarningsEntries","loadError","useEffect","AccessDenied","IllustratedEmptyState","isServerError","serverError","ServerError","plainPayoutError","ShowTechnicalDetails","rawErrorText","cards","HandCoins","Coins","Wallet","RefreshCw","filteredEntries","categoryCards","item","developerPortalCards","isDeveloperPortalMode","PageHeader","navigate","ArrowLeft","PagePurpose","StatCard","card","ResponsiveTable","EmphasisPanel","PayoutErrorNotice","ThemedSelect","event"],"sources":["../../../../../src/billing/modules/earnings/pages/EarningsPage.tsx"],"sourcesContent":["import { useCallback, useEffect, useMemo, useState, type FC } from 'react';\nimport { useSearchParams } from 'react-router';\nimport { ArrowLeft, Coins, HandCoins, RefreshCw, Wallet } from 'lucide-react';\nimport {\n ResponsiveTable,\n type ResponsiveTableColumn,\n PagePurpose,\n EmphasisPanel,\n IllustratedEmptyState,\n ShowTechnicalDetails,\n ThemedSelect,\n} from '@burdenoff/fe-libs/ui';\n\nimport { useIsFluidgridsVariant } from '../../../hooks/useBillingVariant';\nimport { useTr } from '../../../shared/hooks/useTr';\nimport { PayoutErrorNotice } from '../components/PayoutErrorNotice';\nimport { plainPayoutError, rawErrorText } from '../utils/plainPayoutError';\nimport { useBillingPermissions } from '../../../hooks/useBillingPermissions';\nimport { useBilling } from '../../../providers/BillingProvider';\nimport { AccessDenied, PageHeader, ServerError, StatCard } from '../../../shared/components';\nimport { formatCurrency, formatDateTime, isServerError } from '../../../shared/utils';\nimport { useGetDefaultBillingAccountSettingsQuery } from '../../../../generated/global-operations';\nimport {\n fetchEarningsEntries,\n fetchEarningsSummary,\n fetchDeveloperPortalRevenueDashboard,\n type DeveloperPortalRevenueDashboard,\n type DeveloperPortalRevenueSale,\n type DeveloperPortalRevenuePayout,\n type EarningsEntry,\n type EarningsSummary,\n} from '../api';\n\ntype EarningsSourceFilter = 'ALL' | 'AFFILIATE' | 'STORE' | 'OTHER';\n\nconst salesColumns: ResponsiveTableColumn<DeveloperPortalRevenueSale>[] = [\n {\n key: 'application',\n header: 'Application',\n priority: 'primary',\n cell: (sale) => sale.application?.name || sale.application?.slug || 'Unknown app',\n },\n { key: 'pricing', header: 'Pricing', cell: (sale) => sale.pricingModel },\n {\n key: 'gross',\n header: 'Gross',\n cell: (sale) => (\n <span className=\"tabular-nums\">\n {formatCurrency(sale.grossAmount, sale.currency || 'USD')}\n </span>\n ),\n },\n {\n key: 'net',\n header: 'Net',\n cell: (sale) => (\n <span className=\"tabular-nums\">{formatCurrency(sale.netAmount, sale.currency || 'USD')}</span>\n ),\n },\n { key: 'status', header: 'Status', cell: (sale) => sale.status },\n {\n key: 'purchased',\n header: 'Purchased',\n cell: (sale) => formatDateTime(sale.purchasedAt),\n },\n];\n\nconst payoutColumns: ResponsiveTableColumn<DeveloperPortalRevenuePayout>[] = [\n {\n key: 'period',\n header: 'Period',\n priority: 'primary',\n cell: (payout) => payout.periodLabel || '-',\n },\n {\n key: 'amount',\n header: 'Amount',\n cell: (payout) => (\n <span className=\"tabular-nums\">\n {formatCurrency(payout.netAmount, payout.currency || 'USD')}\n </span>\n ),\n },\n { key: 'status', header: 'Status', cell: (payout) => payout.status },\n {\n key: 'scheduled',\n header: 'Scheduled',\n cell: (payout) => (payout.scheduledAt ? formatDateTime(payout.scheduledAt) : '-'),\n },\n {\n key: 'completed',\n header: 'Completed',\n cell: (payout) => (payout.completedAt ? formatDateTime(payout.completedAt) : '-'),\n },\n];\n\nconst ledgerColumns: ResponsiveTableColumn<EarningsEntry>[] = [\n {\n key: 'category',\n header: 'Category',\n priority: 'primary',\n cell: (entry) => entry.sourceCategory,\n },\n {\n key: 'description',\n header: 'Description',\n cell: (entry) => entry.description || entry.sourceSubcategory || '-',\n },\n { key: 'unit', header: 'Unit', cell: (entry) => entry.unitType },\n {\n key: 'amount',\n header: 'Amount',\n cell: (entry) => (\n <span className=\"tabular-nums\">\n {entry.unitType === 'CREDITS'\n ? `${entry.amount.toLocaleString()} credits`\n : formatCurrency(entry.amount, entry.currency || 'USD')}\n </span>\n ),\n },\n { key: 'status', header: 'Status', cell: (entry) => entry.status },\n {\n key: 'created',\n header: 'Created',\n cell: (entry) => formatDateTime(entry.createdAt),\n },\n];\n\nexport const EarningsPage: FC = () => {\n const [searchParams] = useSearchParams();\n const permissions = useBillingPermissions();\n const isFluidgrids = useIsFluidgridsVariant();\n const tr = useTr();\n const { apiGatewayUrl, authToken, orgId, navigate } = useBilling();\n const developerOrgId = searchParams.get('developerOrgId');\n const developerOrgName = searchParams.get('developerOrgName');\n // Set by devportal's OrganizationDetailPage when it links here — lets this\n // page offer a way back without needing to know whether the org is\n // PHYSICAL or DIGITAL (that split isn't in scope on this side).\n const returnTo = searchParams.get('returnTo');\n const { data: billingAccountData, loading: billingAccountLoading } =\n useGetDefaultBillingAccountSettingsQuery({});\n\n const billingAccountId = billingAccountData?.getDefaultBillingAccount?.id;\n const [summary, setSummary] = useState<EarningsSummary | null>(null);\n const [entries, setEntries] = useState<EarningsEntry[]>([]);\n const [developerPortalRevenue, setDeveloperPortalRevenue] =\n useState<DeveloperPortalRevenueDashboard | null>(null);\n const [sourceFilter, setSourceFilter] = useState<EarningsSourceFilter>('ALL');\n const [loading, setLoading] = useState(true);\n const [error, setError] = useState<Error | null>(null);\n\n const requestContext = useMemo(\n () => ({\n apiGatewayUrl,\n authToken,\n orgId,\n }),\n [apiGatewayUrl, authToken, orgId]\n );\n\n const loadData = useCallback(async () => {\n setLoading(true);\n setError(null);\n try {\n if (developerOrgId) {\n const loadedRevenue = await fetchDeveloperPortalRevenueDashboard(\n developerOrgId,\n requestContext\n );\n setDeveloperPortalRevenue(loadedRevenue);\n setSummary(null);\n setEntries([]);\n return;\n }\n\n if (!billingAccountId) {\n setSummary(null);\n setEntries([]);\n setDeveloperPortalRevenue(null);\n return;\n }\n\n const [loadedSummary, loadedEntries] = await Promise.all([\n fetchEarningsSummary(billingAccountId, requestContext),\n fetchEarningsEntries(billingAccountId, requestContext),\n ]);\n setSummary(loadedSummary);\n setEntries(loadedEntries);\n setDeveloperPortalRevenue(null);\n } catch (loadError) {\n setError(loadError instanceof Error ? loadError : new Error('Failed to load earnings'));\n } finally {\n setLoading(false);\n }\n }, [billingAccountId, developerOrgId, requestContext]);\n\n useEffect(() => {\n void loadData();\n }, [loadData]);\n\n if (!permissions.canViewBillingAccount) {\n return <AccessDenied message=\"You don't have permission to view earnings.\" />;\n }\n\n if (!developerOrgId && !billingAccountId && !billingAccountLoading) {\n return (\n <IllustratedEmptyState\n illustration=\"empty-generic\"\n title=\"No billing account found\"\n description=\"Create a billing account first to view earnings.\"\n glassIllustration=\"money\"\n />\n );\n }\n\n if (error && isServerError(error)) {\n const serverError = (\n <ServerError\n title=\"Earnings unavailable\"\n message={isFluidgrids ? plainPayoutError(error, tr) : error.message}\n onRetry={() => void loadData()}\n showRetry\n />\n );\n return isFluidgrids ? (\n <>\n {serverError}\n <div className=\"px-6\">\n <ShowTechnicalDetails copyable>{rawErrorText(error)}</ShowTechnicalDetails>\n </div>\n </>\n ) : (\n serverError\n );\n }\n\n const cards = summary\n ? [\n {\n title: 'Available',\n value: formatCurrency(summary.availableAmount, 'USD'),\n icon: <HandCoins className=\"size-5\" />,\n },\n {\n title: 'Reserved',\n value: formatCurrency(summary.reservedAmount, 'USD'),\n icon: <Coins className=\"size-5\" />,\n },\n {\n title: 'Paid out',\n value: formatCurrency(summary.paidAmount, 'USD'),\n icon: <Wallet className=\"size-5\" />,\n },\n {\n title: 'Lifetime',\n value: formatCurrency(summary.totalLifetimeAmount, 'USD'),\n icon: <RefreshCw className=\"size-5\" />,\n },\n ]\n : [];\n\n const filteredEntries =\n sourceFilter === 'ALL'\n ? entries\n : entries.filter((entry) => entry.sourceCategory === sourceFilter);\n\n const categoryCards =\n summary?.categoryBreakdown?.map((item) => ({\n title: `${item.category} earnings`,\n value: formatCurrency(item.amount, 'USD'),\n helperText: `${item.count} entries`,\n })) ?? [];\n\n const developerPortalCards = developerPortalRevenue?.summary\n ? [\n {\n title: 'Gross revenue',\n value: formatCurrency(\n developerPortalRevenue.summary.totalGrossRevenue,\n developerPortalRevenue.summary.currency\n ),\n icon: <HandCoins className=\"size-5\" />,\n },\n {\n title: 'Net revenue',\n value: formatCurrency(\n developerPortalRevenue.summary.totalNetRevenue,\n developerPortalRevenue.summary.currency\n ),\n icon: <Wallet className=\"size-5\" />,\n },\n {\n title: 'Pending balance',\n value: formatCurrency(\n developerPortalRevenue.summary.pendingBalance,\n developerPortalRevenue.summary.currency\n ),\n icon: <Coins className=\"size-5\" />,\n },\n {\n title: 'Platform fees',\n value: formatCurrency(\n developerPortalRevenue.summary.totalPlatformFees,\n developerPortalRevenue.summary.currency\n ),\n icon: <RefreshCw className=\"size-5\" />,\n },\n ]\n : [];\n\n const isDeveloperPortalMode = !!developerOrgId;\n\n return (\n <div className=\"space-y-6 p-6\">\n <PageHeader\n title={isDeveloperPortalMode ? 'Marketplace earnings' : 'Earnings'}\n description={\n isDeveloperPortalMode\n ? `Developer portal revenue, sales, and payouts${developerOrgName ? ` for ${developerOrgName}` : ''}.`\n : 'Track affiliate, store, and other earning sources in one ledger.'\n }\n actions={\n returnTo ? (\n <button\n type=\"button\"\n onClick={() => navigate?.(returnTo)}\n className=\"inline-flex items-center gap-2 rounded-md border border-border-subtle px-4 py-2 text-sm font-medium text-text-primary\"\n >\n <ArrowLeft className=\"size-4\" />\n Back\n </button>\n ) : undefined\n }\n />\n\n <PagePurpose>\n See everything you have earned — from affiliate rewards, store sales and marketplace revenue\n — in one ledger, along with how much has been paid out and what is still pending. Filter by\n source to reconcile a specific stream.\n </PagePurpose>\n\n {loading ? (\n <div className=\"grid gap-4 md:grid-cols-2 xl:grid-cols-4\">\n {[1, 2, 3, 4].map((item) => (\n <div\n key={item}\n className=\"h-28 animate-pulse rounded-lg border border-border-subtle bg-bg-surface\"\n />\n ))}\n </div>\n ) : isDeveloperPortalMode ? (\n developerPortalRevenue?.summary ? (\n <div className=\"space-y-6\">\n <div className=\"grid gap-4 md:grid-cols-2 xl:grid-cols-4\">\n {developerPortalCards.map((card) => (\n <StatCard key={card.title} label={card.title} value={card.value} icon={card.icon} />\n ))}\n </div>\n\n <section className=\"rounded-lg border border-border-subtle bg-bg-surface p-4\">\n <div className=\"mb-4 flex items-center justify-between\">\n <h2 className=\"text-lg font-semibold text-text-primary\">Recent sales</h2>\n <button\n type=\"button\"\n onClick={() => void loadData()}\n className=\"inline-flex items-center gap-2 rounded-md border border-border-subtle px-3 py-2 text-sm font-medium text-text-primary\"\n >\n <RefreshCw className=\"size-4\" />\n Refresh\n </button>\n </div>\n\n {developerPortalRevenue.sales.length === 0 ? (\n <IllustratedEmptyState\n illustration=\"empty-data\"\n title=\"No sales yet\"\n description=\"Sales will appear here when customers start purchasing your apps.\"\n glassIllustration=\"money\"\n size=\"panel\"\n />\n ) : (\n <ResponsiveTable\n data={developerPortalRevenue.sales}\n rowKey={(sale) => sale.id}\n columns={salesColumns}\n />\n )}\n </section>\n\n <section className=\"rounded-lg border border-border-subtle bg-bg-surface p-4\">\n <h2 className=\"mb-4 text-lg font-semibold text-text-primary\">Payouts</h2>\n\n {developerPortalRevenue.payouts.length === 0 ? (\n <IllustratedEmptyState\n illustration=\"empty-data\"\n title=\"No payouts yet\"\n description=\"Scheduled and completed payouts will appear here.\"\n glassIllustration=\"money\"\n size=\"panel\"\n />\n ) : (\n <ResponsiveTable\n data={developerPortalRevenue.payouts}\n rowKey={(payout) => payout.id}\n columns={payoutColumns}\n />\n )}\n </section>\n </div>\n ) : (\n <IllustratedEmptyState\n illustration=\"empty-data\"\n title=\"No developer portal revenue yet\"\n description=\"Marketplace revenue will appear here once your developer organization records sales.\"\n glassIllustration=\"money\"\n />\n )\n ) : summary ? (\n <div className=\"space-y-4\">\n <EmphasisPanel className=\"p-4 sm:p-5\">\n <div className=\"grid gap-4 md:grid-cols-2 xl:grid-cols-4\">\n {cards.map((card) => (\n <StatCard key={card.title} label={card.title} value={card.value} icon={card.icon} />\n ))}\n </div>\n </EmphasisPanel>\n {categoryCards.length > 0 ? (\n <div className=\"grid gap-4 md:grid-cols-2 xl:grid-cols-3\">\n {categoryCards.map((card) => (\n <div\n key={card.title}\n className=\"rounded-lg border border-border-subtle bg-bg-surface p-4\"\n >\n <p className=\"text-sm text-text-secondary\">{card.title}</p>\n <p className=\"mt-2 text-xl font-semibold text-text-primary\">{card.value}</p>\n <p className=\"mt-1 text-xs text-text-secondary\">{card.helperText}</p>\n </div>\n ))}\n </div>\n ) : null}\n </div>\n ) : null}\n\n {error && !isServerError(error) ? (\n isFluidgrids ? (\n <PayoutErrorNotice error={error} />\n ) : (\n <div className=\"rounded-lg border border-border-subtle bg-bg-surface p-4 text-sm text-status-error-text\">\n {error.message}\n </div>\n )\n ) : null}\n\n <section className=\"rounded-lg border border-border-subtle bg-bg-surface p-4\">\n <div className=\"mb-4 flex items-center justify-between\">\n <h2 className=\"text-lg font-semibold text-text-primary\">Ledger</h2>\n <div className=\"flex items-center gap-3\">\n <ThemedSelect\n value={sourceFilter}\n onChange={(event) => setSourceFilter(event.target.value as EarningsSourceFilter)}\n className=\"rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary scheme-normal dark:scheme-dark [&_option]:bg-bg-surface [&_option]:text-text-primary\"\n >\n <option value=\"ALL\">All sources</option>\n <option value=\"AFFILIATE\">Affiliate</option>\n <option value=\"STORE\">Store</option>\n <option value=\"OTHER\">Other</option>\n </ThemedSelect>\n <button\n type=\"button\"\n onClick={() => void loadData()}\n className=\"inline-flex items-center gap-2 rounded-md border border-border-subtle px-3 py-2 text-sm font-medium text-text-primary\"\n >\n <RefreshCw className=\"size-4\" />\n Refresh\n </button>\n </div>\n </div>\n\n {filteredEntries.length === 0 && !loading ? (\n <IllustratedEmptyState\n illustration=\"empty-data\"\n title=\"No earnings yet\"\n description=\"Eligible affiliate rewards and other earnings will appear here.\"\n kind={sourceFilter !== 'ALL' ? 'filtered' : 'first-use'}\n glassIllustration=\"money\"\n size=\"panel\"\n />\n ) : (\n <ResponsiveTable\n data={filteredEntries}\n rowKey={(entry) => entry.id}\n columns={ledgerColumns}\n />\n )}\n </section>\n </div>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAmCA,IAAME,KAAoE;CACxE;EACE,KAAK;EACL,QAAQ;EACR,UAAU;EACV,OAAO,MAASC,EAAK,aAAa,QAAQA,EAAK,aAAa,QAAQ;CACtE;CACA;EAAE,KAAK;EAAW,QAAQ;EAAW,OAAO,MAASA,EAAK;CAAa;CACvE;EACE,KAAK;EACL,QAAQ;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C,EAAM;GACJ,CAAA,IAEL;GAEJ,kBAAC,WAAD;IAAS,WAAU;IAAnB,UAAA,CACE,kBAAC,OAAD;KAAK,WAAU;KAAf,UAAA,CACE,kBAAC,MAAD;MAAI,WAAU;MAA0C,UAAA;KAAU,CAAA,GAClE,kBAAC,OAAD;MAAK,WAAU;MAAf,UAAA,CACE,kBAAC4C,GAAD;OACE,OAAOhD;OACP,WAAW,MAAUC,GAAgBgD,EAAM,OAAO,KAA6B;OAC/E,WAAU;OAHZ,UAAA;QAKE,kBAAC,UAAD;SAAQ,OAAM;SAAM,UAAA;QAAmB,CAAA;QACvC,kBAAC,UAAD;SAAQ,OAAM;SAAY,UAAA;QAAiB,CAAA;QAC3C,kBAAC,UAAD;SAAQ,OAAM;SAAQ,UAAA;QAAa,CAAA;QACnC,kBAAC,UAAD;SAAQ,OAAM;SAAQ,UAAA;QAAa,CAAA;OACvB;MACd,CAAA,GAAA,kBAAC,UAAD;OACE,MAAK;OACL,eAAe,KAAKtC,EAAS;OAC7B,WAAU;OAHZ,UAAA,CAKE,kBAACsB,GAAD,EAAW,WAAU,SAAU,CAAA,GAAC,SAE1B;MACL,CAAA,CAAA;KACF,CAAA,CAAA;IAEJ,CAAA,GAAAC,EAAgB,WAAW,KAAK,CAAChC,IAChC,kBAACoB,GAAD;KACE,cAAa;KACb,OAAM;KACN,aAAY;KACZ,MAAMtB,MAAiB,QAAqB,cAAb;KAC/B,mBAAkB;KAClB,MAAK;IACN,CAAA,IAED,kBAAC6C,GAAD;KACE,MAAMX;KACN,SAAS,MAAU3D,EAAM;KACzB,SAASD;IACV,CAAA,CAEI;;EACN;;AAET"}
@@ -598,7 +598,9 @@ var H = () => {
598
598
  }) : Q.length === 0 ? /* @__PURE__ */ N(ne, {
599
599
  illustration: "empty-data",
600
600
  title: H === "pending" ? "No pending requests" : H === "approved" ? "No approved requests awaiting payment" : "No history yet",
601
- description: H === "pending" ? "New requests will appear here." : H === "approved" ? z === "CREDIT_CONVERSION" ? "Revenue share requests skip this tab — approving one completes it immediately, there's no separate payment step." : "Approve pending requests first, then send payment and mark as paid." : "Completed and rejected requests will appear here."
601
+ description: H === "pending" ? "New requests will appear here." : H === "approved" ? z === "CREDIT_CONVERSION" ? "Revenue share requests skip this tab — approving one completes it immediately, there's no separate payment step." : "Approve pending requests first, then send payment and mark as paid." : "Completed and rejected requests will appear here.",
602
+ kind: H === "pending" || H === "approved" ? "all-done" : "first-use",
603
+ glassIllustration: "money"
602
604
  }) : /* @__PURE__ */ P("div", {
603
605
  className: "space-y-4",
604
606
  children: [Q.map((e) => /* @__PURE__ */ N(V, {