@burdenoff/microfe-billing 2026.1116.1 → 2026.1119.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/billing/modules/addons/pages/AddonCreatePage.js +143 -143
- package/dist/billing/modules/addons/pages/AddonCreatePage.js.map +1 -1
- package/dist/billing/modules/addons/pages/AddonEditPage.js +170 -170
- package/dist/billing/modules/addons/pages/AddonEditPage.js.map +1 -1
- package/dist/billing/modules/analytics/pages/AnalyticsPage.js +148 -148
- package/dist/billing/modules/analytics/pages/AnalyticsPage.js.map +1 -1
- package/dist/billing/modules/billing/pages/BillingWebhookLogsPage.js +115 -115
- package/dist/billing/modules/billing/pages/BillingWebhookLogsPage.js.map +1 -1
- package/dist/billing/modules/billing/pages/InvoicesListPage.js +136 -136
- package/dist/billing/modules/billing/pages/InvoicesListPage.js.map +1 -1
- package/dist/billing/modules/billing/pages/OrderCallbackLogsPage.js +129 -129
- package/dist/billing/modules/billing/pages/OrderCallbackLogsPage.js.map +1 -1
- package/dist/billing/modules/billing/pages/RefundsPage.js +325 -325
- package/dist/billing/modules/billing/pages/RefundsPage.js.map +1 -1
- package/dist/billing/modules/billing/pages/UserRefundsPage.js +149 -149
- package/dist/billing/modules/billing/pages/UserRefundsPage.js.map +1 -1
- package/dist/billing/modules/checkout/components/CompleteBillingAccountModal.js +99 -98
- package/dist/billing/modules/checkout/components/CompleteBillingAccountModal.js.map +1 -1
- package/dist/billing/modules/checkout/components/StoreShippingSection.js +125 -124
- package/dist/billing/modules/checkout/components/StoreShippingSection.js.map +1 -1
- package/dist/billing/modules/checkout/components/WorkspaceQuotaAssignmentModal.js +61 -60
- package/dist/billing/modules/checkout/components/WorkspaceQuotaAssignmentModal.js.map +1 -1
- package/dist/billing/modules/coupons/pages/CouponsListPage.js +177 -177
- package/dist/billing/modules/coupons/pages/CouponsListPage.js.map +1 -1
- package/dist/billing/modules/coupons/pages/CreateCouponPage.js +231 -231
- package/dist/billing/modules/coupons/pages/CreateCouponPage.js.map +1 -1
- package/dist/billing/modules/coupons/pages/EditCouponPage.js +139 -139
- package/dist/billing/modules/coupons/pages/EditCouponPage.js.map +1 -1
- package/dist/billing/modules/credits/pages/AdminCreditsPage.js +54 -54
- package/dist/billing/modules/credits/pages/AdminCreditsPage.js.map +1 -1
- package/dist/billing/modules/credits/pages/CreditWithdrawalPage.js +65 -65
- package/dist/billing/modules/credits/pages/CreditWithdrawalPage.js.map +1 -1
- package/dist/billing/modules/credits/pages/CreditsPage.js +95 -95
- package/dist/billing/modules/credits/pages/CreditsPage.js.map +1 -1
- package/dist/billing/modules/dashboard/components/CreateBillingAccountModal.js +232 -231
- package/dist/billing/modules/dashboard/components/CreateBillingAccountModal.js.map +1 -1
- package/dist/billing/modules/discounts/pages/DiscountsListPage.js +328 -328
- package/dist/billing/modules/discounts/pages/DiscountsListPage.js.map +1 -1
- package/dist/billing/modules/earnings/pages/DeveloperRevenueOrgDetailPage.js +57 -57
- package/dist/billing/modules/earnings/pages/DeveloperRevenueOrgDetailPage.js.map +1 -1
- package/dist/billing/modules/earnings/pages/EarningsPage.js +53 -53
- package/dist/billing/modules/earnings/pages/EarningsPage.js.map +1 -1
- package/dist/billing/modules/earnings/pages/PayoutsPage.js +100 -100
- package/dist/billing/modules/earnings/pages/PayoutsPage.js.map +1 -1
- package/dist/billing/modules/plans/pages/PlanCreatePage.js +150 -150
- package/dist/billing/modules/plans/pages/PlanCreatePage.js.map +1 -1
- package/dist/billing/modules/plans/pages/PlanEditPage.js +125 -125
- package/dist/billing/modules/plans/pages/PlanEditPage.js.map +1 -1
- package/dist/billing/modules/quota/pages/QuotaTemplateCreatePage.js +113 -113
- package/dist/billing/modules/quota/pages/QuotaTemplateCreatePage.js.map +1 -1
- package/dist/billing/modules/quota/pages/QuotaTemplateEditPage.js +132 -132
- package/dist/billing/modules/quota/pages/QuotaTemplateEditPage.js.map +1 -1
- package/dist/billing/modules/settings/pages/SettingsPage.js +101 -101
- package/dist/billing/modules/settings/pages/SettingsPage.js.map +1 -1
- package/dist/billing/modules/settings/pages/TeamPermissionsPage.js +125 -125
- package/dist/billing/modules/settings/pages/TeamPermissionsPage.js.map +1 -1
- package/dist/billing/modules/usage/components/WorkspaceAiSpendPanel.js +51 -50
- package/dist/billing/modules/usage/components/WorkspaceAiSpendPanel.js.map +1 -1
- package/dist/billing/modules/usage/pages/UsagePage.js +107 -107
- package/dist/billing/modules/usage/pages/UsagePage.js.map +1 -1
- package/dist/billing/shared/components/GeoPricingOverridesEditor.js +1 -0
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UserRefundsPage.js","names":["UUID_RE","STATUS_CONFIG","RefundRecordStatus","Clock","Loader2","className","CheckCircle","XCircle","StatusBadge","cfg","status","Icon","UserRefundsPage","useI18n","tr","v","t","key","fallback","navigateTo","useBillingNavigate","permissions","useBillingPermissions","isFluidgrids","useIsFluidgridsVariant","canRequestRefund","canShowRefundRequest","showForm","setShowForm","useState","txnIdInput","setTxnIdInput","lookedUpTxn","setLookedUpTxn","txnNotFound","setTxnNotFound","reason","setReason","amount","setAmount","formError","setFormError","formSuccess","setFormSuccess","accountsData","accountsLoading","useGetBillingAccountsCheckoutQuery","accounts","useMemo","selectedAccountId","setSelectedAccountId","selectedAccount","a","fetchTxn","txnLookupData","txnLookupLoading","txnLookupError","useGetTransactionLazyQuery","lastLookupKey","useRef","txn","triggerLookup","txnId","accountId","handleTxnIdChange","value","handleAccountChange","refundsData","refundsLoading","refetchRefunds","useGetRefundRecordsQuery","refunds","createRefund","isSubmitting","useCreateRefundRecordMutation","getGatewayInfo","handleSubmit","gatewayInfo","parsedAmount","formatCurrency","resetFormFields","err","resetForm","PageHeader","PlusCircle","PagePurpose","BillingHistoryTabs","CreditCard","X","Search","formatDateTime","IllustratedEmptyState","r"],"sources":["../../../../../src/billing/modules/billing/pages/UserRefundsPage.tsx"],"sourcesContent":["/**\n * Billing Module - User Refunds Page\n * Shows the user's refund request history and allows submitting new requests.\n */\n\nimport { useState, useEffect, useMemo, useRef, type FC, type FormEvent } from 'react';\nimport {\n PlusCircle,\n X,\n Clock,\n CheckCircle,\n XCircle,\n Loader2,\n Search,\n CreditCard,\n} from 'lucide-react';\nimport { useBillingNavigate } from '../../../hooks/useBillingNavigate';\nimport { useBillingPermissions } from '../../../hooks/useBillingPermissions';\nimport { useIsFluidgridsVariant } from '../../../hooks/useBillingVariant';\nimport { formatCurrency, formatDateTime } from '../../../shared/utils';\nimport { BillingHistoryTabs, PageHeader } from '../../../shared/components';\nimport { canShowRefundRequest } from '../../../shared/utils/accessRules';\nimport { useI18n } from '@burdenoff/fe-libs/shared/providers/shell/I18nProvider';\nimport { PagePurpose, IllustratedEmptyState } from '@burdenoff/fe-libs/ui';\nimport {\n useGetBillingAccountsCheckoutQuery,\n useGetTransactionLazyQuery,\n useGetRefundRecordsQuery,\n useCreateRefundRecordMutation,\n type GetRefundRecordsQuery,\n type GetTransactionQuery,\n} from '../../../../generated/global-operations';\nimport { RefundRecordStatus } from '../../../../generated/global-types';\n\ntype RefundItem = NonNullable<GetRefundRecordsQuery['getRefundRecords']['records']>[number];\ntype TxnLookup = NonNullable<GetTransactionQuery['getTransaction']>;\n\nconst UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;\n\n// ============================================================================\n// Status helpers\n// ============================================================================\n\nconst STATUS_CONFIG: Record<\n RefundRecordStatus,\n { label: string; className: string; icon: FC<{ className?: string }> }\n> = {\n [RefundRecordStatus.Pending]: {\n label: 'In Review',\n className: 'bg-status-warning-bg/20 text-status-warning-text border-status-warning-border',\n icon: ({ className }) => <Clock className={className} />,\n },\n [RefundRecordStatus.Processing]: {\n label: 'Processing',\n className: 'bg-action-primary-bg/15 text-action-primary-bg border-action-primary-bg/30',\n icon: ({ className }) => <Loader2 className={`${className} animate-spin`} />,\n },\n [RefundRecordStatus.Completed]: {\n label: 'Refunded',\n className: 'bg-status-success-bg/20 text-status-success-text border-status-success-border',\n icon: ({ className }) => <CheckCircle className={className} />,\n },\n [RefundRecordStatus.Failed]: {\n label: 'Failed',\n className: 'bg-status-error-bg/20 text-status-error-text border-status-error-border',\n icon: ({ className }) => <XCircle className={className} />,\n },\n [RefundRecordStatus.Skipped]: {\n label: 'Closed',\n className: 'bg-bg-sunken text-text-secondary border-border-subtle',\n icon: ({ className }) => <XCircle className={className} />,\n },\n};\n\nfunction StatusBadge({ status }: { status: string }) {\n const cfg = STATUS_CONFIG[status as RefundRecordStatus] ?? {\n label: status,\n className: 'bg-bg-sunken text-text-secondary border-border-subtle',\n icon: ({ className }: { className?: string }) => <Clock className={className} />,\n };\n const Icon = cfg.icon;\n return (\n <span\n className={`inline-flex items-center gap-1 px-2 py-0.5 rounded-full border text-xs font-medium ${cfg.className}`}\n >\n <Icon className=\"size-3\" />\n {cfg.label}\n </span>\n );\n}\n\n// ============================================================================\n// Main page\n// ============================================================================\n\nexport const UserRefundsPage: FC = () => {\n const { t } = useI18n();\n const tr = (key: string, fallback: string) => {\n const v = t(key);\n return v === key ? fallback : v;\n };\n const navigateTo = useBillingNavigate();\n const permissions = useBillingPermissions();\n // FluidGrids: createRefundRecord is `manage`-gated on the gateway, so the\n // request button only shows to people whose request can succeed (BOFF-11860).\n const isFluidgrids = useIsFluidgridsVariant();\n const canRequestRefund = canShowRefundRequest(isFluidgrids, permissions.canProcessRefund);\n\n // Form state\n const [showForm, setShowForm] = useState(false);\n const [txnIdInput, setTxnIdInput] = useState('');\n const [lookedUpTxn, setLookedUpTxn] = useState<TxnLookup | null>(null);\n const [txnNotFound, setTxnNotFound] = useState(false);\n const [reason, setReason] = useState('');\n const [amount, setAmount] = useState('');\n const [formError, setFormError] = useState<string | null>(null);\n const [formSuccess, setFormSuccess] = useState(false);\n\n // All billing accounts\n const { data: accountsData, loading: accountsLoading } = useGetBillingAccountsCheckoutQuery({\n fetchPolicy: 'cache-and-network',\n });\n type BillingAccount = NonNullable<typeof accountsData>['getBillingAccountsByOrg'][number];\n const accounts = useMemo<BillingAccount[]>(\n () => accountsData?.getBillingAccountsByOrg ?? [],\n [accountsData]\n );\n\n // Default to the first account; user can switch\n const [selectedAccountId, setSelectedAccountId] = useState<string | undefined>(undefined);\n useEffect(() => {\n if (!selectedAccountId && accounts.length > 0) {\n setSelectedAccountId(accounts[0].id);\n }\n }, [accounts, selectedAccountId]);\n\n const selectedAccount = accounts.find((a) => a.id === selectedAccountId);\n\n // Transaction lookup by ID (lazy — fires when user enters a valid UUID)\n const [fetchTxn, { data: txnLookupData, loading: txnLookupLoading, error: txnLookupError }] =\n useGetTransactionLazyQuery({ fetchPolicy: 'network-only' });\n\n // Track the \"active\" lookup key so we only apply results for the latest request\n const lastLookupKey = useRef('');\n\n useEffect(() => {\n if (txnLookupLoading) return;\n const txn = txnLookupData?.getTransaction;\n if (txn) {\n setLookedUpTxn(txn);\n setTxnNotFound(false);\n setAmount(String(txn.amount));\n } else if (txnLookupData !== undefined || txnLookupError) {\n setLookedUpTxn(null);\n setTxnNotFound(true);\n setAmount('');\n }\n }, [txnLookupData, txnLookupLoading, txnLookupError]);\n\n const triggerLookup = (txnId: string, accountId: string) => {\n const key = `${txnId}::${accountId}`;\n lastLookupKey.current = key;\n setLookedUpTxn(null);\n setTxnNotFound(false);\n setAmount('');\n fetchTxn({ variables: { id: txnId, billingAccountId: accountId } });\n };\n\n const handleTxnIdChange = (value: string) => {\n setTxnIdInput(value);\n setLookedUpTxn(null);\n setTxnNotFound(false);\n setAmount('');\n if (UUID_RE.test(value.trim()) && selectedAccountId) {\n triggerLookup(value.trim(), selectedAccountId);\n }\n };\n\n // When account changes, re-fetch the transaction if one is entered\n const handleAccountChange = (accountId: string) => {\n setSelectedAccountId(accountId);\n setLookedUpTxn(null);\n setTxnNotFound(false);\n setAmount('');\n if (UUID_RE.test(txnIdInput.trim())) {\n triggerLookup(txnIdInput.trim(), accountId);\n }\n };\n\n // Refund history for selected account\n const {\n data: refundsData,\n loading: refundsLoading,\n refetch: refetchRefunds,\n } = useGetRefundRecordsQuery({\n variables: { billingAccountId: selectedAccountId, pageSize: 20, page: 1 },\n skip: !selectedAccountId,\n fetchPolicy: 'cache-and-network',\n });\n const refunds = refundsData?.getRefundRecords.records ?? [];\n\n const [createRefund, { loading: isSubmitting }] = useCreateRefundRecordMutation({\n refetchQueries: ['GetRefundRecords'],\n });\n\n const getGatewayInfo = (txn: TxnLookup | null) => {\n if (!txn) return null;\n if (txn.stripePaymentId) return { provider: 'STRIPE', gatewayPaymentId: txn.stripePaymentId };\n if (txn.razorpayPaymentId)\n return { provider: 'RAZORPAY', gatewayPaymentId: txn.razorpayPaymentId };\n return null;\n };\n\n const handleSubmit = async (e: FormEvent) => {\n e.preventDefault();\n setFormError(null);\n\n if (!lookedUpTxn || !reason.trim() || !amount) {\n setFormError('Enter a valid transaction ID, an amount, and a reason.');\n return;\n }\n const gatewayInfo = getGatewayInfo(lookedUpTxn);\n if (!gatewayInfo) {\n setFormError('No payment gateway info found for this transaction. Please contact support.');\n return;\n }\n const parsedAmount = parseFloat(amount);\n if (isNaN(parsedAmount) || parsedAmount <= 0) {\n setFormError('Please enter a valid amount greater than 0.');\n return;\n }\n if (parsedAmount > lookedUpTxn.amount) {\n setFormError(\n `Cannot exceed the original payment amount (${formatCurrency(lookedUpTxn.amount, lookedUpTxn.currency)}).`\n );\n return;\n }\n\n try {\n await createRefund({\n variables: {\n billingAccountId: selectedAccountId,\n provider: gatewayInfo.provider,\n gatewayPaymentId: gatewayInfo.gatewayPaymentId,\n amount: parsedAmount,\n currency: lookedUpTxn.currency ?? selectedAccount?.currency ?? 'USD',\n transactionId: lookedUpTxn.id,\n reason: reason.trim(),\n notes: `Requested by user via billing portal`,\n },\n });\n setFormSuccess(true);\n setShowForm(false);\n resetFormFields();\n await refetchRefunds();\n } catch (err) {\n setFormError(err instanceof Error ? err.message : 'Failed to submit refund request.');\n }\n };\n\n const resetFormFields = () => {\n setTxnIdInput('');\n setLookedUpTxn(null);\n setTxnNotFound(false);\n setReason('');\n setAmount('');\n setFormError(null);\n };\n\n const resetForm = () => {\n setShowForm(false);\n setFormSuccess(false);\n resetFormFields();\n };\n\n return (\n <div\n className={isFluidgrids ? 'space-y-6 px-4 py-6 sm:px-6 lg:px-8' : 'space-y-6 p-6 max-w-3xl'}\n >\n <PageHeader\n title={tr('billing.refunds.title', 'Refunds')}\n description={tr(\n 'billing.refunds.description',\n 'View your refund requests and submit new ones'\n )}\n actions={\n !showForm && canRequestRefund ? (\n <button\n type=\"button\"\n onClick={() => {\n setShowForm(true);\n setFormSuccess(false);\n }}\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\"\n >\n <PlusCircle className=\"size-4\" />\n {tr('billing.refunds.requestRefund', 'Request Refund')}\n </button>\n ) : undefined\n }\n />\n\n <PagePurpose>\n {tr(\n 'billing.refunds.userPurpose',\n 'Request money back for a payment and follow where each request stands. Paste the transaction ID of the charge you want refunded, tell us how much and why, and track every request here from \"In Review\" through to \"Refunded\".'\n )}\n </PagePurpose>\n\n {isFluidgrids && <BillingHistoryTabs active=\"refunds\" billingAccountId={selectedAccountId} />}\n\n {/* Billing account switcher */}\n {!accountsLoading && accounts.length > 1 && (\n <div\n className={\n isFluidgrids ? 'flex flex-wrap items-center gap-x-3 gap-y-2' : 'flex items-center gap-3'\n }\n >\n <CreditCard className=\"size-4 text-text-secondary shrink-0\" />\n <label htmlFor=\"accountSwitch\" className=\"text-sm text-text-secondary shrink-0\">\n {tr('billing.refunds.account', 'Billing account')}\n </label>\n <select\n id=\"accountSwitch\"\n value={selectedAccountId ?? ''}\n onChange={(e) => handleAccountChange(e.target.value)}\n className={`${isFluidgrids ? 'min-w-0 basis-full truncate sm:basis-auto sm:max-w-lg ' : ''}flex-1 px-3 py-1.5 border border-border-subtle rounded-button bg-bg-surface text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)] text-sm scheme-normal dark:scheme-dark [&_option]:bg-bg-surface [&_option]:text-text-primary`}\n >\n {accounts.map((a) => (\n <option key={a.id} value={a.id}>\n {a.name} ({a.currency}) — {a.email}\n </option>\n ))}\n </select>\n </div>\n )}\n\n {/* Success banner */}\n {formSuccess && (\n <div className=\"flex items-center justify-between p-4 rounded-lg border border-status-success-border bg-status-success-bg/10\">\n <div className=\"flex items-center gap-2\">\n <CheckCircle className=\"size-4 text-status-success-text\" />\n <p className=\"text-sm text-status-success-text font-medium\">\n {tr(\n 'billing.refunds.submitted',\n 'Refund request submitted. Our team will review it shortly.'\n )}\n </p>\n </div>\n <button\n type=\"button\"\n onClick={() => setFormSuccess(false)}\n className=\"text-status-success-text hover:opacity-70\"\n >\n <X className=\"size-4\" />\n </button>\n </div>\n )}\n\n {/* Request Refund Form */}\n {showForm && (\n <div className=\"border border-border-seam rounded-card bg-bg-surface shadow-elevation-1 overflow-hidden\">\n <div className=\"flex items-center justify-between p-4 border-b border-border-subtle bg-bg-sunken\">\n <h2 className=\"font-semibold text-text-primary\">\n {tr('billing.refunds.newRequest', 'New Refund Request')}\n </h2>\n <button\n type=\"button\"\n onClick={resetForm}\n className=\"p-1 rounded hover:bg-bg-sunken transition-colors\"\n >\n <X className=\"size-4 text-text-secondary\" />\n </button>\n </div>\n\n <form onSubmit={handleSubmit} className=\"p-4 space-y-4\">\n {formError && (\n <div className=\"p-3 rounded-lg border border-status-error-border bg-status-error-bg/10\">\n <p className=\"text-sm text-status-error-text\">{formError}</p>\n </div>\n )}\n\n {/* Transaction ID lookup */}\n <div>\n <label htmlFor=\"txnId\" className=\"block text-sm font-medium text-text-primary mb-1\">\n {tr('billing.refunds.transactionId', 'Transaction ID')} *\n </label>\n <div className=\"relative\">\n <input\n id=\"txnId\"\n type=\"text\"\n value={txnIdInput}\n onChange={(e) => handleTxnIdChange(e.target.value)}\n placeholder=\"Paste your transaction ID...\"\n className=\"w-full pl-3 pr-9 py-2 border border-border-subtle rounded-button bg-bg-surface text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)] text-sm font-mono\"\n />\n <div className=\"absolute right-2.5 top-1/2 -translate-y-1/2 text-text-secondary\">\n {txnLookupLoading ? (\n <Loader2 className=\"size-4 animate-spin\" />\n ) : (\n <Search className=\"size-4\" />\n )}\n </div>\n </div>\n\n {/* Transaction lookup result */}\n {lookedUpTxn && (\n <div className=\"mt-2 p-3 rounded-button border border-status-success-border bg-status-success-bg/10 text-sm space-y-0.5\">\n <div className=\"flex items-center gap-2\">\n <CheckCircle className=\"size-3.5 text-status-success-text shrink-0\" />\n <span className=\"font-medium text-text-primary\">\n {formatCurrency(lookedUpTxn.amount, lookedUpTxn.currency)}\n </span>\n <span className=\"text-text-secondary\">·</span>\n <span className=\"text-text-secondary\">\n {formatDateTime(lookedUpTxn.createdAt)}\n </span>\n {lookedUpTxn.stripePaymentId && (\n <span className=\"text-xs text-text-secondary\">Stripe</span>\n )}\n {lookedUpTxn.razorpayPaymentId && (\n <span className=\"text-xs text-text-secondary\">Razorpay</span>\n )}\n </div>\n {lookedUpTxn.description && (\n <p className=\"text-xs text-text-secondary pl-5\">{lookedUpTxn.description}</p>\n )}\n </div>\n )}\n {txnNotFound && txnIdInput.length > 0 && !txnLookupLoading && (\n <p className=\"mt-1 text-xs text-status-error-text\">\n {tr(\n 'billing.refunds.txnNotFound',\n 'Transaction not found in this billing account.'\n )}\n </p>\n )}\n {!UUID_RE.test(txnIdInput.trim()) && txnIdInput.length > 4 && (\n <p className=\"mt-1 text-xs text-text-secondary\">\n {tr(\n 'billing.refunds.txnIdHint',\n 'Transaction IDs look like: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'\n )}\n </p>\n )}\n </div>\n\n {/* Amount — only shown once transaction is found */}\n {lookedUpTxn && (\n <div>\n <label\n htmlFor=\"refundAmount\"\n className=\"block text-sm font-medium text-text-primary mb-1\"\n >\n {tr('billing.refunds.amount', 'Refund Amount')} *\n </label>\n <div className=\"flex items-center gap-2\">\n <input\n id=\"refundAmount\"\n type=\"number\"\n step=\"0.01\"\n min=\"0.01\"\n max={lookedUpTxn.amount}\n value={amount}\n onChange={(e) => setAmount(e.target.value)}\n required\n className=\"w-40 px-3 py-2 border border-border-subtle rounded-button bg-bg-surface text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)] text-sm\"\n placeholder=\"0.00\"\n />\n <span className=\"text-sm text-text-secondary\">\n {lookedUpTxn.currency ?? selectedAccount?.currency ?? 'USD'}\n </span>\n <span className=\"text-xs text-text-secondary\">\n max {formatCurrency(lookedUpTxn.amount, lookedUpTxn.currency)}\n </span>\n </div>\n </div>\n )}\n\n {/* Reason */}\n <div>\n <label htmlFor=\"reason\" className=\"block text-sm font-medium text-text-primary mb-1\">\n {tr('billing.refunds.reason', 'Reason for refund')} *\n </label>\n <textarea\n id=\"reason\"\n value={reason}\n onChange={(e) => setReason(e.target.value)}\n required\n rows={3}\n className=\"w-full px-3 py-2 border border-border-subtle rounded-button bg-bg-surface text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)] text-sm resize-none\"\n placeholder={tr(\n 'billing.refunds.reasonPlaceholder',\n 'Describe why you are requesting a refund...'\n )}\n />\n </div>\n\n <div className=\"flex items-center gap-3 pt-1\">\n <button\n type=\"submit\"\n disabled={isSubmitting || !lookedUpTxn || !reason.trim() || !amount}\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 {isSubmitting\n ? tr('billing.refunds.submitting', 'Submitting...')\n : tr('billing.refunds.submitRequest', 'Submit Request')}\n </button>\n <button\n type=\"button\"\n onClick={resetForm}\n className=\"px-4 py-2 text-sm border border-border-subtle text-text-primary rounded-button hover:bg-bg-sunken transition-colors\"\n >\n {tr('billing.common.cancel', 'Cancel')}\n </button>\n </div>\n </form>\n </div>\n )}\n\n {/* Refund history */}\n <div className=\"border border-border-seam rounded-card bg-bg-surface shadow-elevation-1 overflow-hidden\">\n <div className=\"p-4 border-b border-border-subtle bg-bg-sunken\">\n <h2 className=\"font-semibold text-text-primary\">\n {tr('billing.refunds.history', 'Refund History')}\n </h2>\n </div>\n\n {accountsLoading || refundsLoading ? (\n <div className=\"p-8 flex items-center justify-center\">\n <Loader2 className=\"size-5 animate-spin text-text-secondary\" />\n </div>\n ) : refunds.length === 0 ? (\n <div className={isFluidgrids ? 'flex justify-center px-4 py-10 text-center' : undefined}>\n <IllustratedEmptyState\n illustration=\"empty-data\"\n title={tr('billing.refunds.noRefunds', 'No refund requests yet')}\n description={tr(\n 'billing.refunds.noRefundsHint',\n 'If you have an issue with a payment, click \"Request Refund\" to get started.'\n )}\n />\n </div>\n ) : (\n <ul className=\"divide-y divide-border-subtle\">\n {refunds.map((r: RefundItem) => (\n <li\n key={r.id}\n className={`flex gap-4 p-4 hover:bg-bg-sunken transition-colors ${\n isFluidgrids\n ? 'flex-col gap-2 sm:flex-row sm:items-start sm:gap-4'\n : 'items-start'\n }`}\n >\n <div className=\"flex-1 min-w-0\">\n <div className=\"flex items-center gap-2 flex-wrap\">\n <span className=\"text-sm font-medium text-text-primary\">\n {formatCurrency(r.amount, r.currency)}\n </span>\n <StatusBadge status={r.status} />\n {r.purchaseDetail && (\n <span className=\"text-xs text-text-secondary truncate\">\n {r.purchaseDetail}\n </span>\n )}\n </div>\n {r.reason && (\n <p className=\"text-xs text-text-secondary mt-1 line-clamp-2\">{r.reason}</p>\n )}\n {r.errorMessage && r.status === RefundRecordStatus.Failed && (\n <p className=\"text-xs text-status-error-text mt-1\">{r.errorMessage}</p>\n )}\n </div>\n <div className={isFluidgrids ? 'shrink-0 sm:text-right' : 'text-right shrink-0'}>\n <p className=\"text-xs text-text-secondary\">{formatDateTime(r.createdAt)}</p>\n {r.processedAt && (\n <p className=\"text-xs text-text-secondary mt-0.5\">\n Processed {formatDateTime(r.processedAt)}\n </p>\n )}\n </div>\n </li>\n ))}\n </ul>\n )}\n </div>\n\n <p className=\"text-xs text-text-secondary\">\n {tr(\n 'billing.refunds.footer',\n 'Refund requests are reviewed by our team within 3–5 business days. For urgent issues, contact support.'\n )}{' '}\n <button\n type=\"button\"\n onClick={() => navigateTo('/transactions/' + selectedAccountId)}\n className=\"underline hover:no-underline\"\n >\n {tr('billing.refunds.viewTransactions', 'View all transactions')}\n </button>\n </p>\n </div>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;AAqCA,IAAMA,IAAU,mEAMVC,IAGF;EACDC,EAAmB,UAAU;EAC5B,OAAO;EACP,WAAW;EACX,OAAO,EAAE,mBAAgB,kBAACC,GAAD,EAAkB,aAAY,CAAA;CACzD;EACCD,EAAmB,aAAa;EAC/B,OAAO;EACP,WAAW;EACX,OAAO,EAAE,mBAAgB,kBAACE,GAAD,EAAS,WAAW,GAAGC,EAAU,eAAiB,CAAA;CAC7E;EACCH,EAAmB,YAAY;EAC9B,OAAO;EACP,WAAW;EACX,OAAO,EAAE,mBAAgB,kBAACI,GAAD,EAAwB,aAAY,CAAA;CAC/D;EACCJ,EAAmB,SAAS;EAC3B,OAAO;EACP,WAAW;EACX,OAAO,EAAE,mBAAgB,kBAACK,GAAD,EAAoB,aAAY,CAAA;CAC3D;EACCL,EAAmB,UAAU;EAC5B,OAAO;EACP,WAAW;EACX,OAAO,EAAE,mBAAgB,kBAACK,GAAD,EAAoB,aAAY,CAAA;CAC3D;AACF;AAEA,SAASC,EAAY,EAAE,aAA8B;CACnD,IAAMC,IAAMR,EAAcS,MAAiC;EACzD,OAAOA;EACP,WAAW;EACX,OAAO,EAAE,mBAAwC,kBAACP,GAAD,EAAkB,aAAY,CAAA;CACjF,GACMQ,IAAOF,EAAI;CACjB,OACE,kBAAC,QAAD;EACE,WAAW,sFAAsFA,EAAI;EADvG,UAAA,CAGE,kBAACE,GAAD,EAAM,WAAU,SAAU,CAAA,GACzBF,EAAI,KACD;;AAEV;AAMA,IAAaG,UAA4B;CACv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W,uDACThD,IACI,uDACA;MALR,UAAA,CAQE,kBAAC,OAAD;OAAK,WAAU;OAAf,UAAA;QACE,kBAAC,OAAD;SAAK,WAAU;SAAf,UAAA;UACE,kBAAC,QAAD;WAAM,WAAU;WACb,UAAAwD,EAAea,EAAE,QAAQA,EAAE,QAAQ;UAChC,CAAA;UACN,kBAACpF,GAAD,EAAa,QAAQoF,EAAE,OAAS,CAAA;UAC/BA,EAAE,kBACD,kBAAC,QAAD;WAAM,WAAU;WACb,UAAAA,EAAE;UACC,CAAA;SAEL;;QACJA,EAAE,UACD,kBAAC,KAAD;SAAG,WAAU;SAAiD,UAAAA,EAAE;QAAU,CAAA;QAE3EA,EAAE,gBAAgBA,EAAE,WAAW1F,EAAmB,UACjD,kBAAC,KAAD;SAAG,WAAU;SAAuC,UAAA0F,EAAE;QAAgB,CAAA;OAErE;MACL,CAAA,GAAA,kBAAC,OAAD;OAAK,WAAWrE,IAAe,2BAA2B;OAA1D,UAAA,CACE,kBAAC,KAAD;QAAG,WAAU;QAA+B,UAAAmE,EAAeE,EAAE,SAAS;OAAK,CAAA,GAC1EA,EAAE,eACD,kBAAC,KAAD;QAAG,WAAU;QAAb,UAAA,CAAkD,cACrCF,EAAeE,EAAE,WAAW,CACtC;OAEF,CAAA,CAAA;MACH,CAAA,CAAA;KAlCG,GAAAA,EAAE,EAkCL,CACL;IACC,CAAA,CAEH;;GAEL,kBAAC,KAAD;IAAG,WAAU;IAAb,UAAA;KACG9E,EACC,0BACA,wGACF;KAAG;KACH,kBAAC,UAAD;MACE,MAAK;MACL,eAAeK,EAAW,mBAAmB8B,CAAiB;MAC9D,WAAU;MAET,UAAAnC,EAAG,oCAAoC,uBAAuB;KACzD,CAAA;IACP;;EACA;;AAET"}
|
|
1
|
+
{"version":3,"file":"UserRefundsPage.js","names":["UUID_RE","STATUS_CONFIG","RefundRecordStatus","Clock","Loader2","className","CheckCircle","XCircle","StatusBadge","cfg","status","Icon","UserRefundsPage","useI18n","tr","v","t","key","fallback","navigateTo","useBillingNavigate","permissions","useBillingPermissions","isFluidgrids","useIsFluidgridsVariant","canRequestRefund","canShowRefundRequest","showForm","setShowForm","useState","txnIdInput","setTxnIdInput","lookedUpTxn","setLookedUpTxn","txnNotFound","setTxnNotFound","reason","setReason","amount","setAmount","formError","setFormError","formSuccess","setFormSuccess","accountsData","accountsLoading","useGetBillingAccountsCheckoutQuery","accounts","useMemo","selectedAccountId","setSelectedAccountId","selectedAccount","a","fetchTxn","txnLookupData","txnLookupLoading","txnLookupError","useGetTransactionLazyQuery","lastLookupKey","useRef","txn","triggerLookup","txnId","accountId","handleTxnIdChange","value","handleAccountChange","refundsData","refundsLoading","refetchRefunds","useGetRefundRecordsQuery","refunds","createRefund","isSubmitting","useCreateRefundRecordMutation","getGatewayInfo","handleSubmit","gatewayInfo","parsedAmount","formatCurrency","resetFormFields","err","resetForm","PageHeader","PlusCircle","PagePurpose","BillingHistoryTabs","CreditCard","ThemedSelect","X","Search","formatDateTime","IllustratedEmptyState","r"],"sources":["../../../../../src/billing/modules/billing/pages/UserRefundsPage.tsx"],"sourcesContent":["/**\n * Billing Module - User Refunds Page\n * Shows the user's refund request history and allows submitting new requests.\n */\n\nimport { useState, useEffect, useMemo, useRef, type FC, type FormEvent } from 'react';\nimport {\n PlusCircle,\n X,\n Clock,\n CheckCircle,\n XCircle,\n Loader2,\n Search,\n CreditCard,\n} from 'lucide-react';\nimport { useBillingNavigate } from '../../../hooks/useBillingNavigate';\nimport { useBillingPermissions } from '../../../hooks/useBillingPermissions';\nimport { useIsFluidgridsVariant } from '../../../hooks/useBillingVariant';\nimport { formatCurrency, formatDateTime } from '../../../shared/utils';\nimport { BillingHistoryTabs, PageHeader } from '../../../shared/components';\nimport { canShowRefundRequest } from '../../../shared/utils/accessRules';\nimport { useI18n } from '@burdenoff/fe-libs/shared/providers/shell/I18nProvider';\nimport { PagePurpose, IllustratedEmptyState, ThemedSelect } from '@burdenoff/fe-libs/ui';\nimport {\n useGetBillingAccountsCheckoutQuery,\n useGetTransactionLazyQuery,\n useGetRefundRecordsQuery,\n useCreateRefundRecordMutation,\n type GetRefundRecordsQuery,\n type GetTransactionQuery,\n} from '../../../../generated/global-operations';\nimport { RefundRecordStatus } from '../../../../generated/global-types';\n\ntype RefundItem = NonNullable<GetRefundRecordsQuery['getRefundRecords']['records']>[number];\ntype TxnLookup = NonNullable<GetTransactionQuery['getTransaction']>;\n\nconst UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;\n\n// ============================================================================\n// Status helpers\n// ============================================================================\n\nconst STATUS_CONFIG: Record<\n RefundRecordStatus,\n { label: string; className: string; icon: FC<{ className?: string }> }\n> = {\n [RefundRecordStatus.Pending]: {\n label: 'In Review',\n className: 'bg-status-warning-bg/20 text-status-warning-text border-status-warning-border',\n icon: ({ className }) => <Clock className={className} />,\n },\n [RefundRecordStatus.Processing]: {\n label: 'Processing',\n className: 'bg-action-primary-bg/15 text-action-primary-bg border-action-primary-bg/30',\n icon: ({ className }) => <Loader2 className={`${className} animate-spin`} />,\n },\n [RefundRecordStatus.Completed]: {\n label: 'Refunded',\n className: 'bg-status-success-bg/20 text-status-success-text border-status-success-border',\n icon: ({ className }) => <CheckCircle className={className} />,\n },\n [RefundRecordStatus.Failed]: {\n label: 'Failed',\n className: 'bg-status-error-bg/20 text-status-error-text border-status-error-border',\n icon: ({ className }) => <XCircle className={className} />,\n },\n [RefundRecordStatus.Skipped]: {\n label: 'Closed',\n className: 'bg-bg-sunken text-text-secondary border-border-subtle',\n icon: ({ className }) => <XCircle className={className} />,\n },\n};\n\nfunction StatusBadge({ status }: { status: string }) {\n const cfg = STATUS_CONFIG[status as RefundRecordStatus] ?? {\n label: status,\n className: 'bg-bg-sunken text-text-secondary border-border-subtle',\n icon: ({ className }: { className?: string }) => <Clock className={className} />,\n };\n const Icon = cfg.icon;\n return (\n <span\n className={`inline-flex items-center gap-1 px-2 py-0.5 rounded-full border text-xs font-medium ${cfg.className}`}\n >\n <Icon className=\"size-3\" />\n {cfg.label}\n </span>\n );\n}\n\n// ============================================================================\n// Main page\n// ============================================================================\n\nexport const UserRefundsPage: FC = () => {\n const { t } = useI18n();\n const tr = (key: string, fallback: string) => {\n const v = t(key);\n return v === key ? fallback : v;\n };\n const navigateTo = useBillingNavigate();\n const permissions = useBillingPermissions();\n // FluidGrids: createRefundRecord is `manage`-gated on the gateway, so the\n // request button only shows to people whose request can succeed (BOFF-11860).\n const isFluidgrids = useIsFluidgridsVariant();\n const canRequestRefund = canShowRefundRequest(isFluidgrids, permissions.canProcessRefund);\n\n // Form state\n const [showForm, setShowForm] = useState(false);\n const [txnIdInput, setTxnIdInput] = useState('');\n const [lookedUpTxn, setLookedUpTxn] = useState<TxnLookup | null>(null);\n const [txnNotFound, setTxnNotFound] = useState(false);\n const [reason, setReason] = useState('');\n const [amount, setAmount] = useState('');\n const [formError, setFormError] = useState<string | null>(null);\n const [formSuccess, setFormSuccess] = useState(false);\n\n // All billing accounts\n const { data: accountsData, loading: accountsLoading } = useGetBillingAccountsCheckoutQuery({\n fetchPolicy: 'cache-and-network',\n });\n type BillingAccount = NonNullable<typeof accountsData>['getBillingAccountsByOrg'][number];\n const accounts = useMemo<BillingAccount[]>(\n () => accountsData?.getBillingAccountsByOrg ?? [],\n [accountsData]\n );\n\n // Default to the first account; user can switch\n const [selectedAccountId, setSelectedAccountId] = useState<string | undefined>(undefined);\n useEffect(() => {\n if (!selectedAccountId && accounts.length > 0) {\n setSelectedAccountId(accounts[0].id);\n }\n }, [accounts, selectedAccountId]);\n\n const selectedAccount = accounts.find((a) => a.id === selectedAccountId);\n\n // Transaction lookup by ID (lazy — fires when user enters a valid UUID)\n const [fetchTxn, { data: txnLookupData, loading: txnLookupLoading, error: txnLookupError }] =\n useGetTransactionLazyQuery({ fetchPolicy: 'network-only' });\n\n // Track the \"active\" lookup key so we only apply results for the latest request\n const lastLookupKey = useRef('');\n\n useEffect(() => {\n if (txnLookupLoading) return;\n const txn = txnLookupData?.getTransaction;\n if (txn) {\n setLookedUpTxn(txn);\n setTxnNotFound(false);\n setAmount(String(txn.amount));\n } else if (txnLookupData !== undefined || txnLookupError) {\n setLookedUpTxn(null);\n setTxnNotFound(true);\n setAmount('');\n }\n }, [txnLookupData, txnLookupLoading, txnLookupError]);\n\n const triggerLookup = (txnId: string, accountId: string) => {\n const key = `${txnId}::${accountId}`;\n lastLookupKey.current = key;\n setLookedUpTxn(null);\n setTxnNotFound(false);\n setAmount('');\n fetchTxn({ variables: { id: txnId, billingAccountId: accountId } });\n };\n\n const handleTxnIdChange = (value: string) => {\n setTxnIdInput(value);\n setLookedUpTxn(null);\n setTxnNotFound(false);\n setAmount('');\n if (UUID_RE.test(value.trim()) && selectedAccountId) {\n triggerLookup(value.trim(), selectedAccountId);\n }\n };\n\n // When account changes, re-fetch the transaction if one is entered\n const handleAccountChange = (accountId: string) => {\n setSelectedAccountId(accountId);\n setLookedUpTxn(null);\n setTxnNotFound(false);\n setAmount('');\n if (UUID_RE.test(txnIdInput.trim())) {\n triggerLookup(txnIdInput.trim(), accountId);\n }\n };\n\n // Refund history for selected account\n const {\n data: refundsData,\n loading: refundsLoading,\n refetch: refetchRefunds,\n } = useGetRefundRecordsQuery({\n variables: { billingAccountId: selectedAccountId, pageSize: 20, page: 1 },\n skip: !selectedAccountId,\n fetchPolicy: 'cache-and-network',\n });\n const refunds = refundsData?.getRefundRecords.records ?? [];\n\n const [createRefund, { loading: isSubmitting }] = useCreateRefundRecordMutation({\n refetchQueries: ['GetRefundRecords'],\n });\n\n const getGatewayInfo = (txn: TxnLookup | null) => {\n if (!txn) return null;\n if (txn.stripePaymentId) return { provider: 'STRIPE', gatewayPaymentId: txn.stripePaymentId };\n if (txn.razorpayPaymentId)\n return { provider: 'RAZORPAY', gatewayPaymentId: txn.razorpayPaymentId };\n return null;\n };\n\n const handleSubmit = async (e: FormEvent) => {\n e.preventDefault();\n setFormError(null);\n\n if (!lookedUpTxn || !reason.trim() || !amount) {\n setFormError('Enter a valid transaction ID, an amount, and a reason.');\n return;\n }\n const gatewayInfo = getGatewayInfo(lookedUpTxn);\n if (!gatewayInfo) {\n setFormError('No payment gateway info found for this transaction. Please contact support.');\n return;\n }\n const parsedAmount = parseFloat(amount);\n if (isNaN(parsedAmount) || parsedAmount <= 0) {\n setFormError('Please enter a valid amount greater than 0.');\n return;\n }\n if (parsedAmount > lookedUpTxn.amount) {\n setFormError(\n `Cannot exceed the original payment amount (${formatCurrency(lookedUpTxn.amount, lookedUpTxn.currency)}).`\n );\n return;\n }\n\n try {\n await createRefund({\n variables: {\n billingAccountId: selectedAccountId,\n provider: gatewayInfo.provider,\n gatewayPaymentId: gatewayInfo.gatewayPaymentId,\n amount: parsedAmount,\n currency: lookedUpTxn.currency ?? selectedAccount?.currency ?? 'USD',\n transactionId: lookedUpTxn.id,\n reason: reason.trim(),\n notes: `Requested by user via billing portal`,\n },\n });\n setFormSuccess(true);\n setShowForm(false);\n resetFormFields();\n await refetchRefunds();\n } catch (err) {\n setFormError(err instanceof Error ? err.message : 'Failed to submit refund request.');\n }\n };\n\n const resetFormFields = () => {\n setTxnIdInput('');\n setLookedUpTxn(null);\n setTxnNotFound(false);\n setReason('');\n setAmount('');\n setFormError(null);\n };\n\n const resetForm = () => {\n setShowForm(false);\n setFormSuccess(false);\n resetFormFields();\n };\n\n return (\n <div\n className={isFluidgrids ? 'space-y-6 px-4 py-6 sm:px-6 lg:px-8' : 'space-y-6 p-6 max-w-3xl'}\n >\n <PageHeader\n title={tr('billing.refunds.title', 'Refunds')}\n description={tr(\n 'billing.refunds.description',\n 'View your refund requests and submit new ones'\n )}\n actions={\n !showForm && canRequestRefund ? (\n <button\n type=\"button\"\n onClick={() => {\n setShowForm(true);\n setFormSuccess(false);\n }}\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\"\n >\n <PlusCircle className=\"size-4\" />\n {tr('billing.refunds.requestRefund', 'Request Refund')}\n </button>\n ) : undefined\n }\n />\n\n <PagePurpose>\n {tr(\n 'billing.refunds.userPurpose',\n 'Request money back for a payment and follow where each request stands. Paste the transaction ID of the charge you want refunded, tell us how much and why, and track every request here from \"In Review\" through to \"Refunded\".'\n )}\n </PagePurpose>\n\n {isFluidgrids && <BillingHistoryTabs active=\"refunds\" billingAccountId={selectedAccountId} />}\n\n {/* Billing account switcher */}\n {!accountsLoading && accounts.length > 1 && (\n <div\n className={\n isFluidgrids ? 'flex flex-wrap items-center gap-x-3 gap-y-2' : 'flex items-center gap-3'\n }\n >\n <CreditCard className=\"size-4 text-text-secondary shrink-0\" />\n <label htmlFor=\"accountSwitch\" className=\"text-sm text-text-secondary shrink-0\">\n {tr('billing.refunds.account', 'Billing account')}\n </label>\n <ThemedSelect\n id=\"accountSwitch\"\n value={selectedAccountId ?? ''}\n onChange={(e) => handleAccountChange(e.target.value)}\n className={`${isFluidgrids ? 'min-w-0 basis-full truncate sm:basis-auto sm:max-w-lg ' : ''}flex-1 px-3 py-1.5 border border-border-subtle rounded-button bg-bg-surface text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)] text-sm scheme-normal dark:scheme-dark [&_option]:bg-bg-surface [&_option]:text-text-primary`}\n >\n {accounts.map((a) => (\n <option key={a.id} value={a.id}>\n {a.name} ({a.currency}) — {a.email}\n </option>\n ))}\n </ThemedSelect>\n </div>\n )}\n\n {/* Success banner */}\n {formSuccess && (\n <div className=\"flex items-center justify-between p-4 rounded-lg border border-status-success-border bg-status-success-bg/10\">\n <div className=\"flex items-center gap-2\">\n <CheckCircle className=\"size-4 text-status-success-text\" />\n <p className=\"text-sm text-status-success-text font-medium\">\n {tr(\n 'billing.refunds.submitted',\n 'Refund request submitted. Our team will review it shortly.'\n )}\n </p>\n </div>\n <button\n type=\"button\"\n onClick={() => setFormSuccess(false)}\n className=\"text-status-success-text hover:opacity-70\"\n >\n <X className=\"size-4\" />\n </button>\n </div>\n )}\n\n {/* Request Refund Form */}\n {showForm && (\n <div className=\"border border-border-seam rounded-card bg-bg-surface shadow-elevation-1 overflow-hidden\">\n <div className=\"flex items-center justify-between p-4 border-b border-border-subtle bg-bg-sunken\">\n <h2 className=\"font-semibold text-text-primary\">\n {tr('billing.refunds.newRequest', 'New Refund Request')}\n </h2>\n <button\n type=\"button\"\n onClick={resetForm}\n className=\"p-1 rounded hover:bg-bg-sunken transition-colors\"\n >\n <X className=\"size-4 text-text-secondary\" />\n </button>\n </div>\n\n <form onSubmit={handleSubmit} className=\"p-4 space-y-4\">\n {formError && (\n <div className=\"p-3 rounded-lg border border-status-error-border bg-status-error-bg/10\">\n <p className=\"text-sm text-status-error-text\">{formError}</p>\n </div>\n )}\n\n {/* Transaction ID lookup */}\n <div>\n <label htmlFor=\"txnId\" className=\"block text-sm font-medium text-text-primary mb-1\">\n {tr('billing.refunds.transactionId', 'Transaction ID')} *\n </label>\n <div className=\"relative\">\n <input\n id=\"txnId\"\n type=\"text\"\n value={txnIdInput}\n onChange={(e) => handleTxnIdChange(e.target.value)}\n placeholder=\"Paste your transaction ID...\"\n className=\"w-full pl-3 pr-9 py-2 border border-border-subtle rounded-button bg-bg-surface text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)] text-sm font-mono\"\n />\n <div className=\"absolute right-2.5 top-1/2 -translate-y-1/2 text-text-secondary\">\n {txnLookupLoading ? (\n <Loader2 className=\"size-4 animate-spin\" />\n ) : (\n <Search className=\"size-4\" />\n )}\n </div>\n </div>\n\n {/* Transaction lookup result */}\n {lookedUpTxn && (\n <div className=\"mt-2 p-3 rounded-button border border-status-success-border bg-status-success-bg/10 text-sm space-y-0.5\">\n <div className=\"flex items-center gap-2\">\n <CheckCircle className=\"size-3.5 text-status-success-text shrink-0\" />\n <span className=\"font-medium text-text-primary\">\n {formatCurrency(lookedUpTxn.amount, lookedUpTxn.currency)}\n </span>\n <span className=\"text-text-secondary\">·</span>\n <span className=\"text-text-secondary\">\n {formatDateTime(lookedUpTxn.createdAt)}\n </span>\n {lookedUpTxn.stripePaymentId && (\n <span className=\"text-xs text-text-secondary\">Stripe</span>\n )}\n {lookedUpTxn.razorpayPaymentId && (\n <span className=\"text-xs text-text-secondary\">Razorpay</span>\n )}\n </div>\n {lookedUpTxn.description && (\n <p className=\"text-xs text-text-secondary pl-5\">{lookedUpTxn.description}</p>\n )}\n </div>\n )}\n {txnNotFound && txnIdInput.length > 0 && !txnLookupLoading && (\n <p className=\"mt-1 text-xs text-status-error-text\">\n {tr(\n 'billing.refunds.txnNotFound',\n 'Transaction not found in this billing account.'\n )}\n </p>\n )}\n {!UUID_RE.test(txnIdInput.trim()) && txnIdInput.length > 4 && (\n <p className=\"mt-1 text-xs text-text-secondary\">\n {tr(\n 'billing.refunds.txnIdHint',\n 'Transaction IDs look like: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'\n )}\n </p>\n )}\n </div>\n\n {/* Amount — only shown once transaction is found */}\n {lookedUpTxn && (\n <div>\n <label\n htmlFor=\"refundAmount\"\n className=\"block text-sm font-medium text-text-primary mb-1\"\n >\n {tr('billing.refunds.amount', 'Refund Amount')} *\n </label>\n <div className=\"flex items-center gap-2\">\n <input\n id=\"refundAmount\"\n type=\"number\"\n step=\"0.01\"\n min=\"0.01\"\n max={lookedUpTxn.amount}\n value={amount}\n onChange={(e) => setAmount(e.target.value)}\n required\n className=\"w-40 px-3 py-2 border border-border-subtle rounded-button bg-bg-surface text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)] text-sm\"\n placeholder=\"0.00\"\n />\n <span className=\"text-sm text-text-secondary\">\n {lookedUpTxn.currency ?? selectedAccount?.currency ?? 'USD'}\n </span>\n <span className=\"text-xs text-text-secondary\">\n max {formatCurrency(lookedUpTxn.amount, lookedUpTxn.currency)}\n </span>\n </div>\n </div>\n )}\n\n {/* Reason */}\n <div>\n <label htmlFor=\"reason\" className=\"block text-sm font-medium text-text-primary mb-1\">\n {tr('billing.refunds.reason', 'Reason for refund')} *\n </label>\n <textarea\n id=\"reason\"\n value={reason}\n onChange={(e) => setReason(e.target.value)}\n required\n rows={3}\n className=\"w-full px-3 py-2 border border-border-subtle rounded-button bg-bg-surface text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)] text-sm resize-none\"\n placeholder={tr(\n 'billing.refunds.reasonPlaceholder',\n 'Describe why you are requesting a refund...'\n )}\n />\n </div>\n\n <div className=\"flex items-center gap-3 pt-1\">\n <button\n type=\"submit\"\n disabled={isSubmitting || !lookedUpTxn || !reason.trim() || !amount}\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 {isSubmitting\n ? tr('billing.refunds.submitting', 'Submitting...')\n : tr('billing.refunds.submitRequest', 'Submit Request')}\n </button>\n <button\n type=\"button\"\n onClick={resetForm}\n className=\"px-4 py-2 text-sm border border-border-subtle text-text-primary rounded-button hover:bg-bg-sunken transition-colors\"\n >\n {tr('billing.common.cancel', 'Cancel')}\n </button>\n </div>\n </form>\n </div>\n )}\n\n {/* Refund history */}\n <div className=\"border border-border-seam rounded-card bg-bg-surface shadow-elevation-1 overflow-hidden\">\n <div className=\"p-4 border-b border-border-subtle bg-bg-sunken\">\n <h2 className=\"font-semibold text-text-primary\">\n {tr('billing.refunds.history', 'Refund History')}\n </h2>\n </div>\n\n {accountsLoading || refundsLoading ? (\n <div className=\"p-8 flex items-center justify-center\">\n <Loader2 className=\"size-5 animate-spin text-text-secondary\" />\n </div>\n ) : refunds.length === 0 ? (\n <div className={isFluidgrids ? 'flex justify-center px-4 py-10 text-center' : undefined}>\n <IllustratedEmptyState\n illustration=\"empty-data\"\n title={tr('billing.refunds.noRefunds', 'No refund requests yet')}\n description={tr(\n 'billing.refunds.noRefundsHint',\n 'If you have an issue with a payment, click \"Request Refund\" to get started.'\n )}\n />\n </div>\n ) : (\n <ul className=\"divide-y divide-border-subtle\">\n {refunds.map((r: RefundItem) => (\n <li\n key={r.id}\n className={`flex gap-4 p-4 hover:bg-bg-sunken transition-colors ${\n isFluidgrids\n ? 'flex-col gap-2 sm:flex-row sm:items-start sm:gap-4'\n : 'items-start'\n }`}\n >\n <div className=\"flex-1 min-w-0\">\n <div className=\"flex items-center gap-2 flex-wrap\">\n <span className=\"text-sm font-medium text-text-primary\">\n {formatCurrency(r.amount, r.currency)}\n </span>\n <StatusBadge status={r.status} />\n {r.purchaseDetail && (\n <span className=\"text-xs text-text-secondary truncate\">\n {r.purchaseDetail}\n </span>\n )}\n </div>\n {r.reason && (\n <p className=\"text-xs text-text-secondary mt-1 line-clamp-2\">{r.reason}</p>\n )}\n {r.errorMessage && r.status === RefundRecordStatus.Failed && (\n <p className=\"text-xs text-status-error-text mt-1\">{r.errorMessage}</p>\n )}\n </div>\n <div className={isFluidgrids ? 'shrink-0 sm:text-right' : 'text-right shrink-0'}>\n <p className=\"text-xs text-text-secondary\">{formatDateTime(r.createdAt)}</p>\n {r.processedAt && (\n <p className=\"text-xs text-text-secondary mt-0.5\">\n Processed {formatDateTime(r.processedAt)}\n </p>\n )}\n </div>\n </li>\n ))}\n </ul>\n )}\n </div>\n\n <p className=\"text-xs text-text-secondary\">\n {tr(\n 'billing.refunds.footer',\n 'Refund requests are reviewed by our team within 3–5 business days. For urgent issues, contact support.'\n )}{' '}\n <button\n type=\"button\"\n onClick={() => navigateTo('/transactions/' + selectedAccountId)}\n className=\"underline hover:no-underline\"\n >\n {tr('billing.refunds.viewTransactions', 'View all transactions')}\n </button>\n </p>\n </div>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;AAqCA,IAAMA,IAAU,mEAMVC,IAGF;EACDC,EAAmB,UAAU;EAC5B,OAAO;EACP,WAAW;EACX,OAAO,EAAE,mBAAgB,kBAACC,GAAD,EAAkB,aAAY,CAAA;CACzD;EACCD,EAAmB,aAAa;EAC/B,OAAO;EACP,WAAW;E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AU;SAAuC,UAAA2F,EAAE;QAAgB,CAAA;OAErE;MACL,CAAA,GAAA,kBAAC,OAAD;OAAK,WAAWtE,IAAe,2BAA2B;OAA1D,UAAA,CACE,kBAAC,KAAD;QAAG,WAAU;QAA+B,UAAAoE,EAAeE,EAAE,SAAS;OAAK,CAAA,GAC1EA,EAAE,eACD,kBAAC,KAAD;QAAG,WAAU;QAAb,UAAA,CAAkD,cACrCF,EAAeE,EAAE,WAAW,CACtC;OAEF,CAAA,CAAA;MACH,CAAA,CAAA;KAlCG,GAAAA,EAAE,EAkCL,CACL;IACC,CAAA,CAEH;;GAEL,kBAAC,KAAD;IAAG,WAAU;IAAb,UAAA;KACG/E,EACC,0BACA,wGACF;KAAG;KACH,kBAAC,UAAD;MACE,MAAK;MACL,eAAeK,EAAW,mBAAmB8B,CAAiB;MAC9D,WAAU;MAET,UAAAnC,EAAG,oCAAoC,uBAAuB;KACzD,CAAA;IACP;;EACA;;AAET"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { useSetBillingAddressMutation as e, useUpdateBillingAccountMutation as t } from "../../../../generated/global-operations.js";
|
|
2
2
|
import { useState as n } from "react";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { ThemedSelect as r } from "@burdenoff/fe-libs/ui";
|
|
4
|
+
import { Loader2 as i, MapPin as a, Phone as o, X as s } from "lucide-react";
|
|
5
|
+
import { jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
5
6
|
// src/billing/modules/checkout/components/CompleteBillingAccountModal.tsx
|
|
6
|
-
var
|
|
7
|
+
var u = [
|
|
7
8
|
{
|
|
8
9
|
value: "IN",
|
|
9
10
|
label: "India"
|
|
@@ -41,12 +42,12 @@ var l = [
|
|
|
41
42
|
label: "UAE"
|
|
42
43
|
}
|
|
43
44
|
];
|
|
44
|
-
function
|
|
45
|
+
function d(e) {
|
|
45
46
|
let t = !!e.contactNumber?.trim(), n = e.billingAddresses?.[0], r = !!(n?.line1?.trim() && n?.city?.trim() && n?.postalCode?.trim() && n?.country?.trim());
|
|
46
47
|
return t && r;
|
|
47
48
|
}
|
|
48
|
-
var
|
|
49
|
-
let [
|
|
49
|
+
var f = ({ billingAccountId: d, hasPhone: f, hasAddress: p, onCompleted: m, onCancel: h }) => {
|
|
50
|
+
let [g, _] = n({
|
|
50
51
|
contactNumber: "",
|
|
51
52
|
line1: "",
|
|
52
53
|
line2: "",
|
|
@@ -54,153 +55,153 @@ var d = ({ billingAccountId: u, hasPhone: d, hasAddress: f, onCompleted: p, onCa
|
|
|
54
55
|
state: "",
|
|
55
56
|
postalCode: "",
|
|
56
57
|
country: "IN"
|
|
57
|
-
}), [
|
|
58
|
+
}), [v, y] = n({}), [b, x] = n(!1), [S, C] = n(null), [w] = e(), [T] = t(), E = (e, t) => _((n) => ({
|
|
58
59
|
...n,
|
|
59
60
|
[e]: t
|
|
60
|
-
})),
|
|
61
|
+
})), D = () => {
|
|
61
62
|
let e = {};
|
|
62
|
-
return !
|
|
63
|
+
return !f && !g.contactNumber.trim() && (e.contactNumber = "Phone number is required for payment processing"), p || (g.line1.trim() || (e.line1 = "Street address is required"), g.city.trim() || (e.city = "City is required"), g.postalCode.trim() || (e.postalCode = "Postal code is required"), g.country.trim() || (e.country = "Country is required")), y(e), Object.keys(e).length === 0;
|
|
63
64
|
};
|
|
64
|
-
return /* @__PURE__ */
|
|
65
|
+
return /* @__PURE__ */ c("div", {
|
|
65
66
|
className: "fixed inset-0 z-50 flex items-center justify-center bg-bg-overlay p-4",
|
|
66
|
-
children: /* @__PURE__ */
|
|
67
|
+
children: /* @__PURE__ */ l("div", {
|
|
67
68
|
className: "bg-bg-surface border border-border-seam rounded-card shadow-[var(--shadow-elevation-4)] w-full max-w-lg max-h-[90vh] overflow-y-auto",
|
|
68
69
|
children: [
|
|
69
|
-
/* @__PURE__ */
|
|
70
|
+
/* @__PURE__ */ l("div", {
|
|
70
71
|
className: "flex items-start justify-between p-6 border-b border-border-subtle",
|
|
71
|
-
children: [/* @__PURE__ */
|
|
72
|
+
children: [/* @__PURE__ */ l("div", { children: [/* @__PURE__ */ c("h2", {
|
|
72
73
|
className: "text-lg font-semibold text-text-primary",
|
|
73
74
|
children: "Complete billing details"
|
|
74
|
-
}), /* @__PURE__ */
|
|
75
|
+
}), /* @__PURE__ */ c("p", {
|
|
75
76
|
className: "text-sm text-text-secondary mt-1",
|
|
76
77
|
children: "We need a few more details before processing your payment."
|
|
77
|
-
})] }), /* @__PURE__ */
|
|
78
|
+
})] }), /* @__PURE__ */ c("button", {
|
|
78
79
|
type: "button",
|
|
79
|
-
onClick:
|
|
80
|
+
onClick: h,
|
|
80
81
|
className: "p-2 text-text-secondary hover:text-text-primary rounded-button hover:bg-bg-sunken transition-colors",
|
|
81
|
-
children: /* @__PURE__ */ s
|
|
82
|
+
children: /* @__PURE__ */ c(s, { className: "size-4" })
|
|
82
83
|
})]
|
|
83
84
|
}),
|
|
84
|
-
/* @__PURE__ */
|
|
85
|
+
/* @__PURE__ */ l("div", {
|
|
85
86
|
className: "p-6 space-y-6",
|
|
86
87
|
children: [
|
|
87
|
-
|
|
88
|
+
S && /* @__PURE__ */ c("div", {
|
|
88
89
|
className: "p-3 rounded-lg bg-status-error-bg-subtle border border-status-error-border text-sm text-status-error-text",
|
|
89
|
-
children:
|
|
90
|
+
children: S
|
|
90
91
|
}),
|
|
91
|
-
!
|
|
92
|
+
!f && /* @__PURE__ */ l("section", {
|
|
92
93
|
className: "space-y-3",
|
|
93
|
-
children: [/* @__PURE__ */
|
|
94
|
+
children: [/* @__PURE__ */ l("div", {
|
|
94
95
|
className: "flex items-center gap-2 text-sm font-medium text-text-primary",
|
|
95
|
-
children: [/* @__PURE__ */
|
|
96
|
-
}), /* @__PURE__ */
|
|
96
|
+
children: [/* @__PURE__ */ c(o, { className: "size-4 text-text-secondary" }), "Contact number"]
|
|
97
|
+
}), /* @__PURE__ */ l("div", { children: [/* @__PURE__ */ c("input", {
|
|
97
98
|
type: "tel",
|
|
98
|
-
value:
|
|
99
|
-
onChange: (e) =>
|
|
99
|
+
value: g.contactNumber,
|
|
100
|
+
onChange: (e) => E("contactNumber", e.target.value),
|
|
100
101
|
placeholder: "+91 98765 43210",
|
|
101
|
-
className: `w-full px-3 py-2 text-sm border rounded-input bg-bg-surface text-text-primary placeholder:text-text-placeholder focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)] ${
|
|
102
|
-
}),
|
|
102
|
+
className: `w-full px-3 py-2 text-sm border rounded-input bg-bg-surface text-text-primary placeholder:text-text-placeholder focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)] ${v.contactNumber ? "border-status-error-border" : "border-border-subtle"}`
|
|
103
|
+
}), v.contactNumber && /* @__PURE__ */ c("p", {
|
|
103
104
|
className: "mt-1 text-xs text-status-error-text",
|
|
104
|
-
children:
|
|
105
|
+
children: v.contactNumber
|
|
105
106
|
})] })]
|
|
106
107
|
}),
|
|
107
|
-
!
|
|
108
|
+
!p && /* @__PURE__ */ l("section", {
|
|
108
109
|
className: "space-y-3",
|
|
109
|
-
children: [/* @__PURE__ */
|
|
110
|
+
children: [/* @__PURE__ */ l("div", {
|
|
110
111
|
className: "flex items-center gap-2 text-sm font-medium text-text-primary",
|
|
111
|
-
children: [/* @__PURE__ */
|
|
112
|
-
}), /* @__PURE__ */
|
|
112
|
+
children: [/* @__PURE__ */ c(a, { className: "size-4 text-text-secondary" }), "Billing address"]
|
|
113
|
+
}), /* @__PURE__ */ l("div", {
|
|
113
114
|
className: "space-y-3",
|
|
114
115
|
children: [
|
|
115
|
-
/* @__PURE__ */
|
|
116
|
+
/* @__PURE__ */ l("div", { children: [/* @__PURE__ */ c("label", {
|
|
116
117
|
className: "block text-xs text-text-secondary mb-1",
|
|
117
118
|
children: "Country"
|
|
118
|
-
}), /* @__PURE__ */
|
|
119
|
-
value:
|
|
120
|
-
onChange: (e) =>
|
|
121
|
-
className: `w-full px-3 py-2 text-sm border rounded-input bg-bg-surface scheme-normal dark:scheme-dark [&_option]:bg-bg-surface [&_option]:text-text-primary text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)] ${
|
|
122
|
-
children:
|
|
119
|
+
}), /* @__PURE__ */ c(r, {
|
|
120
|
+
value: g.country,
|
|
121
|
+
onChange: (e) => E("country", e.target.value),
|
|
122
|
+
className: `w-full px-3 py-2 text-sm border rounded-input bg-bg-surface scheme-normal dark:scheme-dark [&_option]:bg-bg-surface [&_option]:text-text-primary text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)] ${v.country ? "border-status-error-border" : "border-border-subtle"}`,
|
|
123
|
+
children: u.map((e) => /* @__PURE__ */ c("option", {
|
|
123
124
|
value: e.value,
|
|
124
125
|
children: e.label
|
|
125
126
|
}, e.value))
|
|
126
127
|
})] }),
|
|
127
|
-
/* @__PURE__ */
|
|
128
|
-
/* @__PURE__ */
|
|
128
|
+
/* @__PURE__ */ l("div", { children: [
|
|
129
|
+
/* @__PURE__ */ c("label", {
|
|
129
130
|
className: "block text-xs text-text-secondary mb-1",
|
|
130
131
|
children: "Street address"
|
|
131
132
|
}),
|
|
132
|
-
/* @__PURE__ */
|
|
133
|
+
/* @__PURE__ */ c("input", {
|
|
133
134
|
type: "text",
|
|
134
|
-
value:
|
|
135
|
-
onChange: (e) =>
|
|
135
|
+
value: g.line1,
|
|
136
|
+
onChange: (e) => E("line1", e.target.value),
|
|
136
137
|
placeholder: "123 Main St",
|
|
137
|
-
className: `w-full px-3 py-2 text-sm border rounded-input bg-bg-surface text-text-primary placeholder:text-text-placeholder focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)] ${
|
|
138
|
+
className: `w-full px-3 py-2 text-sm border rounded-input bg-bg-surface text-text-primary placeholder:text-text-placeholder focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)] ${v.line1 ? "border-status-error-border" : "border-border-subtle"}`
|
|
138
139
|
}),
|
|
139
|
-
|
|
140
|
+
v.line1 && /* @__PURE__ */ c("p", {
|
|
140
141
|
className: "mt-1 text-xs text-status-error-text",
|
|
141
|
-
children:
|
|
142
|
+
children: v.line1
|
|
142
143
|
})
|
|
143
144
|
] }),
|
|
144
|
-
/* @__PURE__ */
|
|
145
|
+
/* @__PURE__ */ l("div", { children: [/* @__PURE__ */ l("label", {
|
|
145
146
|
className: "block text-xs text-text-secondary mb-1",
|
|
146
|
-
children: ["Apartment, suite, etc. ", /* @__PURE__ */
|
|
147
|
+
children: ["Apartment, suite, etc. ", /* @__PURE__ */ c("span", {
|
|
147
148
|
className: "text-text-muted",
|
|
148
149
|
children: "(optional)"
|
|
149
150
|
})]
|
|
150
|
-
}), /* @__PURE__ */
|
|
151
|
+
}), /* @__PURE__ */ c("input", {
|
|
151
152
|
type: "text",
|
|
152
|
-
value:
|
|
153
|
-
onChange: (e) =>
|
|
153
|
+
value: g.line2,
|
|
154
|
+
onChange: (e) => E("line2", e.target.value),
|
|
154
155
|
placeholder: "Apt 4B",
|
|
155
156
|
className: "w-full px-3 py-2 text-sm border border-border-subtle rounded-input bg-bg-surface text-text-primary placeholder:text-text-placeholder focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]"
|
|
156
157
|
})] }),
|
|
157
|
-
/* @__PURE__ */
|
|
158
|
+
/* @__PURE__ */ l("div", {
|
|
158
159
|
className: "grid grid-cols-2 gap-3",
|
|
159
|
-
children: [/* @__PURE__ */
|
|
160
|
-
/* @__PURE__ */
|
|
160
|
+
children: [/* @__PURE__ */ l("div", { children: [
|
|
161
|
+
/* @__PURE__ */ c("label", {
|
|
161
162
|
className: "block text-xs text-text-secondary mb-1",
|
|
162
163
|
children: "City"
|
|
163
164
|
}),
|
|
164
|
-
/* @__PURE__ */
|
|
165
|
+
/* @__PURE__ */ c("input", {
|
|
165
166
|
type: "text",
|
|
166
|
-
value:
|
|
167
|
-
onChange: (e) =>
|
|
167
|
+
value: g.city,
|
|
168
|
+
onChange: (e) => E("city", e.target.value),
|
|
168
169
|
placeholder: "Mumbai",
|
|
169
|
-
className: `w-full px-3 py-2 text-sm border rounded-input bg-bg-surface text-text-primary placeholder:text-text-placeholder focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)] ${
|
|
170
|
+
className: `w-full px-3 py-2 text-sm border rounded-input bg-bg-surface text-text-primary placeholder:text-text-placeholder focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)] ${v.city ? "border-status-error-border" : "border-border-subtle"}`
|
|
170
171
|
}),
|
|
171
|
-
|
|
172
|
+
v.city && /* @__PURE__ */ c("p", {
|
|
172
173
|
className: "mt-1 text-xs text-status-error-text",
|
|
173
|
-
children:
|
|
174
|
+
children: v.city
|
|
174
175
|
})
|
|
175
|
-
] }), /* @__PURE__ */
|
|
176
|
+
] }), /* @__PURE__ */ l("div", { children: [/* @__PURE__ */ l("label", {
|
|
176
177
|
className: "block text-xs text-text-secondary mb-1",
|
|
177
|
-
children: ["State ", /* @__PURE__ */
|
|
178
|
+
children: ["State ", /* @__PURE__ */ c("span", {
|
|
178
179
|
className: "text-text-muted",
|
|
179
180
|
children: "(optional)"
|
|
180
181
|
})]
|
|
181
|
-
}), /* @__PURE__ */
|
|
182
|
+
}), /* @__PURE__ */ c("input", {
|
|
182
183
|
type: "text",
|
|
183
|
-
value:
|
|
184
|
-
onChange: (e) =>
|
|
184
|
+
value: g.state,
|
|
185
|
+
onChange: (e) => E("state", e.target.value),
|
|
185
186
|
placeholder: "Maharashtra",
|
|
186
187
|
className: "w-full px-3 py-2 text-sm border border-border-subtle rounded-input bg-bg-surface text-text-primary placeholder:text-text-placeholder focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]"
|
|
187
188
|
})] })]
|
|
188
189
|
}),
|
|
189
|
-
/* @__PURE__ */
|
|
190
|
-
/* @__PURE__ */
|
|
190
|
+
/* @__PURE__ */ l("div", { children: [
|
|
191
|
+
/* @__PURE__ */ c("label", {
|
|
191
192
|
className: "block text-xs text-text-secondary mb-1",
|
|
192
193
|
children: "Postal code"
|
|
193
194
|
}),
|
|
194
|
-
/* @__PURE__ */
|
|
195
|
+
/* @__PURE__ */ c("input", {
|
|
195
196
|
type: "text",
|
|
196
|
-
value:
|
|
197
|
-
onChange: (e) =>
|
|
197
|
+
value: g.postalCode,
|
|
198
|
+
onChange: (e) => E("postalCode", e.target.value),
|
|
198
199
|
placeholder: "400001",
|
|
199
|
-
className: `w-full px-3 py-2 text-sm border rounded-input bg-bg-surface text-text-primary placeholder:text-text-placeholder focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)] ${
|
|
200
|
+
className: `w-full px-3 py-2 text-sm border rounded-input bg-bg-surface text-text-primary placeholder:text-text-placeholder focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)] ${v.postalCode ? "border-status-error-border" : "border-border-subtle"}`
|
|
200
201
|
}),
|
|
201
|
-
|
|
202
|
+
v.postalCode && /* @__PURE__ */ c("p", {
|
|
202
203
|
className: "mt-1 text-xs text-status-error-text",
|
|
203
|
-
children:
|
|
204
|
+
children: v.postalCode
|
|
204
205
|
})
|
|
205
206
|
] })
|
|
206
207
|
]
|
|
@@ -208,49 +209,49 @@ var d = ({ billingAccountId: u, hasPhone: d, hasAddress: f, onCompleted: p, onCa
|
|
|
208
209
|
})
|
|
209
210
|
]
|
|
210
211
|
}),
|
|
211
|
-
/* @__PURE__ */
|
|
212
|
+
/* @__PURE__ */ l("div", {
|
|
212
213
|
className: "flex items-center justify-end gap-3 p-6 border-t border-border-subtle",
|
|
213
|
-
children: [/* @__PURE__ */
|
|
214
|
+
children: [/* @__PURE__ */ c("button", {
|
|
214
215
|
type: "button",
|
|
215
|
-
onClick:
|
|
216
|
-
disabled:
|
|
216
|
+
onClick: h,
|
|
217
|
+
disabled: b,
|
|
217
218
|
className: "px-4 py-2 text-sm font-medium text-text-secondary hover:text-text-primary hover:bg-bg-sunken rounded-lg transition-colors",
|
|
218
219
|
children: "Cancel"
|
|
219
|
-
}), /* @__PURE__ */
|
|
220
|
+
}), /* @__PURE__ */ l("button", {
|
|
220
221
|
type: "button",
|
|
221
222
|
onClick: async () => {
|
|
222
|
-
if (
|
|
223
|
-
|
|
223
|
+
if (D()) {
|
|
224
|
+
x(!0), C(null);
|
|
224
225
|
try {
|
|
225
226
|
let e = [];
|
|
226
|
-
!
|
|
227
|
-
id:
|
|
228
|
-
contactNumber:
|
|
229
|
-
} } })),
|
|
230
|
-
billingAccountId:
|
|
231
|
-
line1:
|
|
232
|
-
...
|
|
233
|
-
city:
|
|
234
|
-
...
|
|
235
|
-
postalCode:
|
|
236
|
-
country:
|
|
237
|
-
} } })), await Promise.all(e),
|
|
227
|
+
!f && g.contactNumber.trim() && e.push(T({ variables: { input: {
|
|
228
|
+
id: d,
|
|
229
|
+
contactNumber: g.contactNumber.trim()
|
|
230
|
+
} } })), p || e.push(w({ variables: { input: {
|
|
231
|
+
billingAccountId: d,
|
|
232
|
+
line1: g.line1.trim(),
|
|
233
|
+
...g.line2.trim() ? { line2: g.line2.trim() } : {},
|
|
234
|
+
city: g.city.trim(),
|
|
235
|
+
...g.state.trim() ? { state: g.state.trim() } : {},
|
|
236
|
+
postalCode: g.postalCode.trim(),
|
|
237
|
+
country: g.country
|
|
238
|
+
} } })), await Promise.all(e), m();
|
|
238
239
|
} catch {
|
|
239
|
-
|
|
240
|
+
C("Failed to save billing details. Please try again.");
|
|
240
241
|
} finally {
|
|
241
|
-
|
|
242
|
+
x(!1);
|
|
242
243
|
}
|
|
243
244
|
}
|
|
244
245
|
},
|
|
245
|
-
disabled:
|
|
246
|
+
disabled: b,
|
|
246
247
|
className: "inline-flex items-center gap-2 px-4 py-2 text-sm font-medium text-action-primary-text bg-action-primary-bg hover:bg-action-primary-bgHover rounded-lg transition-colors disabled:opacity-50",
|
|
247
|
-
children: [
|
|
248
|
+
children: [b && /* @__PURE__ */ c(i, { className: "size-4 animate-spin" }), "Save and continue"]
|
|
248
249
|
})]
|
|
249
250
|
})
|
|
250
251
|
]
|
|
251
252
|
})
|
|
252
253
|
});
|
|
253
254
|
};
|
|
254
|
-
export {
|
|
255
|
+
export { f as CompleteBillingAccountModal, d as isBillingAccountComplete };
|
|
255
256
|
|
|
256
257
|
//# sourceMappingURL=CompleteBillingAccountModal.js.map
|