@burdenoff/microfe-billing 2026.1115.2 → 2026.1119.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/billing/modules/addons/pages/AddonCreatePage.js +143 -143
- package/dist/billing/modules/addons/pages/AddonCreatePage.js.map +1 -1
- package/dist/billing/modules/addons/pages/AddonEditPage.js +170 -170
- package/dist/billing/modules/addons/pages/AddonEditPage.js.map +1 -1
- package/dist/billing/modules/analytics/pages/AnalyticsPage.js +148 -148
- package/dist/billing/modules/analytics/pages/AnalyticsPage.js.map +1 -1
- package/dist/billing/modules/billing/pages/BillingWebhookLogsPage.js +115 -115
- package/dist/billing/modules/billing/pages/BillingWebhookLogsPage.js.map +1 -1
- package/dist/billing/modules/billing/pages/InvoicesListPage.js +136 -136
- package/dist/billing/modules/billing/pages/InvoicesListPage.js.map +1 -1
- package/dist/billing/modules/billing/pages/OrderCallbackLogsPage.js +129 -129
- package/dist/billing/modules/billing/pages/OrderCallbackLogsPage.js.map +1 -1
- package/dist/billing/modules/billing/pages/RefundsPage.js +325 -325
- package/dist/billing/modules/billing/pages/RefundsPage.js.map +1 -1
- package/dist/billing/modules/billing/pages/UserRefundsPage.js +149 -149
- package/dist/billing/modules/billing/pages/UserRefundsPage.js.map +1 -1
- package/dist/billing/modules/checkout/components/CompleteBillingAccountModal.js +99 -98
- package/dist/billing/modules/checkout/components/CompleteBillingAccountModal.js.map +1 -1
- package/dist/billing/modules/checkout/components/StoreShippingSection.js +125 -124
- package/dist/billing/modules/checkout/components/StoreShippingSection.js.map +1 -1
- package/dist/billing/modules/checkout/components/WorkspaceQuotaAssignmentModal.js +61 -60
- package/dist/billing/modules/checkout/components/WorkspaceQuotaAssignmentModal.js.map +1 -1
- package/dist/billing/modules/checkout/pages/CheckoutPage.js +1 -1
- package/dist/billing/modules/checkout/pages/CheckoutPage.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 +175 -171
- 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
|
@@ -10,129 +10,129 @@ import "../../../shared/utils/index.js";
|
|
|
10
10
|
import { useBillingWebhookLogs as o, useRefundMutations as s } from "../hooks/useRefunds.js";
|
|
11
11
|
import { statusTokens as c } from "../../../shared/utils/tokens.js";
|
|
12
12
|
import { useState as l } from "react";
|
|
13
|
-
import { IllustratedEmptyState as u, ResponsiveTable as d } from "@burdenoff/fe-libs/ui";
|
|
14
|
-
import { AlertTriangle as
|
|
15
|
-
import { jsx as
|
|
13
|
+
import { IllustratedEmptyState as u, ResponsiveTable as d, ThemedSelect as f } from "@burdenoff/fe-libs/ui";
|
|
14
|
+
import { AlertTriangle as p, CheckCircle as m, ChevronLeft as h, ChevronRight as g, DollarSign as _, Eye as v, Loader2 as y, RefreshCw as b, X as x } from "lucide-react";
|
|
15
|
+
import { jsx as S, jsxs as C } from "react/jsx-runtime";
|
|
16
16
|
// src/billing/modules/billing/pages/BillingWebhookLogsPage.tsx
|
|
17
|
-
var
|
|
17
|
+
var w = 25, T = ["stripe", "razorpay"], E = /* @__PURE__ */ new Set([
|
|
18
18
|
"payment_intent.succeeded",
|
|
19
19
|
"charge.succeeded",
|
|
20
20
|
"payment.captured",
|
|
21
21
|
"order.paid"
|
|
22
|
-
]),
|
|
22
|
+
]), D = (e) => e.processed ? {
|
|
23
23
|
label: "Processed",
|
|
24
24
|
className: `${c.success.bg} ${c.success.text}`,
|
|
25
|
-
icon:
|
|
25
|
+
icon: m
|
|
26
26
|
} : {
|
|
27
27
|
label: e.error ? "Failed" : "Pending",
|
|
28
28
|
className: `${c.error.bg} ${c.error.text}`,
|
|
29
|
-
icon:
|
|
30
|
-
},
|
|
29
|
+
icon: p
|
|
30
|
+
}, O = ({ log: e, onClose: t, onCreateRefund: n, isCreatingRefund: r, canCreateRefund: a }) => e ? /* @__PURE__ */ S("div", {
|
|
31
31
|
className: "fixed inset-0 z-50 flex items-center justify-center bg-bg-overlay p-4",
|
|
32
|
-
children: /* @__PURE__ */
|
|
32
|
+
children: /* @__PURE__ */ C("div", {
|
|
33
33
|
className: "w-full max-w-2xl max-h-[85vh] overflow-y-auto rounded-lg bg-bg-surface border border-border-subtle shadow-[var(--shadow-elevation-2)]",
|
|
34
|
-
children: [/* @__PURE__ */
|
|
34
|
+
children: [/* @__PURE__ */ C("div", {
|
|
35
35
|
className: "flex items-center justify-between p-4 border-b border-border-subtle",
|
|
36
|
-
children: [/* @__PURE__ */
|
|
36
|
+
children: [/* @__PURE__ */ S("h3", {
|
|
37
37
|
className: "text-base font-semibold text-text-primary",
|
|
38
38
|
children: "Webhook log details"
|
|
39
|
-
}), /* @__PURE__ */
|
|
39
|
+
}), /* @__PURE__ */ S("button", {
|
|
40
40
|
type: "button",
|
|
41
41
|
onClick: t,
|
|
42
42
|
className: "p-1 rounded text-text-muted hover:text-text-primary hover:bg-bg-sunken/50",
|
|
43
|
-
children: /* @__PURE__ */ x
|
|
43
|
+
children: /* @__PURE__ */ S(x, { className: "size-4" })
|
|
44
44
|
})]
|
|
45
|
-
}), /* @__PURE__ */
|
|
45
|
+
}), /* @__PURE__ */ C("div", {
|
|
46
46
|
className: "p-4 space-y-4",
|
|
47
47
|
children: [
|
|
48
|
-
/* @__PURE__ */
|
|
48
|
+
/* @__PURE__ */ C("div", {
|
|
49
49
|
className: "grid grid-cols-2 gap-4 text-sm",
|
|
50
50
|
children: [
|
|
51
|
-
/* @__PURE__ */
|
|
51
|
+
/* @__PURE__ */ C("div", { children: [/* @__PURE__ */ S("p", {
|
|
52
52
|
className: "text-text-muted",
|
|
53
53
|
children: "Provider"
|
|
54
|
-
}), /* @__PURE__ */
|
|
54
|
+
}), /* @__PURE__ */ S("p", {
|
|
55
55
|
className: "text-text-primary capitalize",
|
|
56
56
|
children: e.provider
|
|
57
57
|
})] }),
|
|
58
|
-
/* @__PURE__ */
|
|
58
|
+
/* @__PURE__ */ C("div", { children: [/* @__PURE__ */ S("p", {
|
|
59
59
|
className: "text-text-muted",
|
|
60
60
|
children: "Event"
|
|
61
|
-
}), /* @__PURE__ */
|
|
61
|
+
}), /* @__PURE__ */ S("p", {
|
|
62
62
|
className: "text-text-primary font-mono text-xs",
|
|
63
63
|
children: e.event
|
|
64
64
|
})] }),
|
|
65
|
-
/* @__PURE__ */
|
|
65
|
+
/* @__PURE__ */ C("div", { children: [/* @__PURE__ */ S("p", {
|
|
66
66
|
className: "text-text-muted",
|
|
67
67
|
children: "Received"
|
|
68
|
-
}), /* @__PURE__ */
|
|
68
|
+
}), /* @__PURE__ */ S("p", {
|
|
69
69
|
className: "text-text-primary",
|
|
70
70
|
children: i(e.createdAt)
|
|
71
71
|
})] }),
|
|
72
|
-
/* @__PURE__ */
|
|
72
|
+
/* @__PURE__ */ C("div", { children: [/* @__PURE__ */ S("p", {
|
|
73
73
|
className: "text-text-muted",
|
|
74
74
|
children: "Processed"
|
|
75
|
-
}), /* @__PURE__ */
|
|
75
|
+
}), /* @__PURE__ */ S("p", {
|
|
76
76
|
className: "text-text-primary",
|
|
77
77
|
children: e.processed ? "Yes" : "No"
|
|
78
78
|
})] })
|
|
79
79
|
]
|
|
80
80
|
}),
|
|
81
|
-
e.error && /* @__PURE__ */
|
|
81
|
+
e.error && /* @__PURE__ */ C("div", { children: [/* @__PURE__ */ S("p", {
|
|
82
82
|
className: "text-sm text-text-muted mb-1",
|
|
83
83
|
children: "Error"
|
|
84
|
-
}), /* @__PURE__ */
|
|
84
|
+
}), /* @__PURE__ */ S("pre", {
|
|
85
85
|
className: "text-xs whitespace-pre-wrap p-3 rounded-md bg-status-error-bg-subtle text-status-error-text border border-status-error-border",
|
|
86
86
|
children: e.error
|
|
87
87
|
})] }),
|
|
88
|
-
/* @__PURE__ */
|
|
88
|
+
/* @__PURE__ */ C("div", { children: [/* @__PURE__ */ S("p", {
|
|
89
89
|
className: "text-sm text-text-muted mb-1",
|
|
90
90
|
children: "Payload"
|
|
91
|
-
}), /* @__PURE__ */
|
|
91
|
+
}), /* @__PURE__ */ S("pre", {
|
|
92
92
|
className: "text-xs whitespace-pre-wrap p-3 rounded-md bg-bg-sunken/60 text-text-secondary max-h-64 overflow-y-auto",
|
|
93
93
|
children: JSON.stringify(e.payload, null, 2)
|
|
94
94
|
})] }),
|
|
95
|
-
!e.processed && a && /* @__PURE__ */
|
|
95
|
+
!e.processed && a && /* @__PURE__ */ C("button", {
|
|
96
96
|
type: "button",
|
|
97
97
|
onClick: () => n(e.id),
|
|
98
98
|
disabled: r,
|
|
99
99
|
className: "inline-flex items-center gap-2 px-3 py-2 text-sm font-medium rounded-md bg-action-primary-bg text-action-primary-text hover:bg-action-primary-bgHover disabled:opacity-50",
|
|
100
|
-
children: [r ? /* @__PURE__ */
|
|
100
|
+
children: [r ? /* @__PURE__ */ S(y, { className: "size-4 animate-spin" }) : /* @__PURE__ */ S(_, { className: "size-4" }), "Create refund from this webhook"]
|
|
101
101
|
})
|
|
102
102
|
]
|
|
103
103
|
})]
|
|
104
104
|
})
|
|
105
|
-
}) : null,
|
|
106
|
-
let c = n(), [
|
|
107
|
-
if (!c.isBillingAdmin) return /* @__PURE__ */
|
|
108
|
-
if (
|
|
105
|
+
}) : null, k = () => {
|
|
106
|
+
let c = n(), [p, m] = l(0), [_, y] = l({}), [x, k] = l(null), { logs: A, totalCount: j, isLoading: M, error: N, refetch: P } = o(_, p, w), { createRefundRecordFromWebhook: F, isCreatingFromWebhook: I } = s();
|
|
107
|
+
if (!c.isBillingAdmin) return /* @__PURE__ */ S(e, { message: "You don't have permission to view billing webhook logs." });
|
|
108
|
+
if (N && a(N)) return /* @__PURE__ */ S("div", {
|
|
109
109
|
className: "p-6",
|
|
110
|
-
children: /* @__PURE__ */
|
|
110
|
+
children: /* @__PURE__ */ S(r, {
|
|
111
111
|
title: "Server Unavailable",
|
|
112
112
|
message: "Unable to load webhook logs. The server might be down or experiencing issues.",
|
|
113
|
-
onRetry: () =>
|
|
113
|
+
onRetry: () => P(),
|
|
114
114
|
showRetry: !0
|
|
115
115
|
})
|
|
116
116
|
});
|
|
117
|
-
let
|
|
118
|
-
|
|
117
|
+
let L = (e, t) => {
|
|
118
|
+
y((n) => ({
|
|
119
119
|
...n,
|
|
120
120
|
[e]: t
|
|
121
|
-
})),
|
|
122
|
-
},
|
|
123
|
-
await
|
|
124
|
-
},
|
|
121
|
+
})), m(0);
|
|
122
|
+
}, R = async (e) => {
|
|
123
|
+
await F(e), k(null);
|
|
124
|
+
}, z = [
|
|
125
125
|
{
|
|
126
126
|
key: "date",
|
|
127
127
|
header: "Received",
|
|
128
128
|
priority: "primary",
|
|
129
129
|
cellClassName: "whitespace-nowrap",
|
|
130
|
-
cell: (e) => /* @__PURE__ */
|
|
130
|
+
cell: (e) => /* @__PURE__ */ C("div", {
|
|
131
131
|
className: "flex flex-col",
|
|
132
|
-
children: [/* @__PURE__ */
|
|
132
|
+
children: [/* @__PURE__ */ S("span", {
|
|
133
133
|
className: "text-sm text-text-primary",
|
|
134
134
|
children: i(e.createdAt).split(" ")[0]
|
|
135
|
-
}), /* @__PURE__ */
|
|
135
|
+
}), /* @__PURE__ */ S("span", {
|
|
136
136
|
className: "text-xs text-text-muted",
|
|
137
137
|
children: i(e.createdAt).split(" ")[1]
|
|
138
138
|
})]
|
|
@@ -143,10 +143,10 @@ var C = 25, w = ["stripe", "razorpay"], T = /* @__PURE__ */ new Set([
|
|
|
143
143
|
header: "Status",
|
|
144
144
|
cellClassName: "whitespace-nowrap",
|
|
145
145
|
cell: (e) => {
|
|
146
|
-
let t =
|
|
147
|
-
return /* @__PURE__ */
|
|
146
|
+
let t = D(e), n = t.icon;
|
|
147
|
+
return /* @__PURE__ */ C("span", {
|
|
148
148
|
className: `inline-flex items-center gap-1 px-2 py-0.5 text-xs font-medium rounded ${t.className}`,
|
|
149
|
-
children: [/* @__PURE__ */
|
|
149
|
+
children: [/* @__PURE__ */ S(n, { className: "size-3" }), t.label]
|
|
150
150
|
});
|
|
151
151
|
}
|
|
152
152
|
},
|
|
@@ -155,7 +155,7 @@ var C = 25, w = ["stripe", "razorpay"], T = /* @__PURE__ */ new Set([
|
|
|
155
155
|
header: "Provider",
|
|
156
156
|
priority: "hidden-on-mobile",
|
|
157
157
|
cellClassName: "whitespace-nowrap",
|
|
158
|
-
cell: (e) => /* @__PURE__ */
|
|
158
|
+
cell: (e) => /* @__PURE__ */ S("span", {
|
|
159
159
|
className: "text-sm text-text-primary capitalize",
|
|
160
160
|
children: e.provider
|
|
161
161
|
})
|
|
@@ -164,7 +164,7 @@ var C = 25, w = ["stripe", "razorpay"], T = /* @__PURE__ */ new Set([
|
|
|
164
164
|
key: "event",
|
|
165
165
|
header: "Event",
|
|
166
166
|
cellClassName: "whitespace-nowrap max-w-[220px] truncate",
|
|
167
|
-
cell: (e) => /* @__PURE__ */
|
|
167
|
+
cell: (e) => /* @__PURE__ */ S("span", {
|
|
168
168
|
className: "text-sm font-mono text-text-muted",
|
|
169
169
|
children: e.event
|
|
170
170
|
})
|
|
@@ -174,82 +174,82 @@ var C = 25, w = ["stripe", "razorpay"], T = /* @__PURE__ */ new Set([
|
|
|
174
174
|
header: "Error",
|
|
175
175
|
priority: "hidden-on-mobile",
|
|
176
176
|
cellClassName: "max-w-[280px] truncate",
|
|
177
|
-
cell: (e) => /* @__PURE__ */
|
|
177
|
+
cell: (e) => /* @__PURE__ */ S("span", {
|
|
178
178
|
className: "text-sm text-status-error-text",
|
|
179
179
|
children: e.error || "-"
|
|
180
180
|
})
|
|
181
181
|
}
|
|
182
|
-
],
|
|
183
|
-
return /* @__PURE__ */
|
|
182
|
+
], B = Math.max(1, Math.ceil(j / w));
|
|
183
|
+
return /* @__PURE__ */ C("div", {
|
|
184
184
|
className: "space-y-6 p-6",
|
|
185
185
|
children: [
|
|
186
|
-
/* @__PURE__ */
|
|
186
|
+
/* @__PURE__ */ S(t, {
|
|
187
187
|
title: "Billing Webhook Logs",
|
|
188
188
|
description: "Every Stripe/Razorpay webhook delivery — investigate processing failures directly.",
|
|
189
|
-
actions: /* @__PURE__ */
|
|
189
|
+
actions: /* @__PURE__ */ C("button", {
|
|
190
190
|
type: "button",
|
|
191
|
-
onClick: () =>
|
|
191
|
+
onClick: () => P(),
|
|
192
192
|
className: "inline-flex items-center gap-2 px-3 py-2 text-sm font-medium rounded-md border border-border-subtle bg-bg-surface hover:bg-bg-sunken/50",
|
|
193
|
-
children: [/* @__PURE__ */
|
|
193
|
+
children: [/* @__PURE__ */ S(b, { className: "size-4" }), "Refresh"]
|
|
194
194
|
})
|
|
195
195
|
}),
|
|
196
|
-
/* @__PURE__ */
|
|
196
|
+
/* @__PURE__ */ C("div", {
|
|
197
197
|
className: "p-4 border border-border-subtle rounded-lg bg-bg-sunken/30 grid grid-cols-1 sm:grid-cols-3 gap-4",
|
|
198
198
|
children: [
|
|
199
|
-
/* @__PURE__ */
|
|
199
|
+
/* @__PURE__ */ C("div", { children: [/* @__PURE__ */ S("label", {
|
|
200
200
|
className: "block text-sm font-medium mb-1",
|
|
201
201
|
children: "Processed"
|
|
202
|
-
}), /* @__PURE__ */
|
|
203
|
-
value:
|
|
204
|
-
onChange: (e) =>
|
|
202
|
+
}), /* @__PURE__ */ C(f, {
|
|
203
|
+
value: _.processed === void 0 ? "" : String(_.processed),
|
|
204
|
+
onChange: (e) => L("processed", e.target.value === "" ? void 0 : e.target.value === "true"),
|
|
205
205
|
className: "w-full px-3 py-2 border border-border-subtle rounded-md bg-bg-surface scheme-normal dark:scheme-dark [&_option]:bg-bg-surface [&_option]:text-text-primary",
|
|
206
206
|
children: [
|
|
207
|
-
/* @__PURE__ */
|
|
207
|
+
/* @__PURE__ */ S("option", {
|
|
208
208
|
value: "",
|
|
209
209
|
children: "All"
|
|
210
210
|
}),
|
|
211
|
-
/* @__PURE__ */
|
|
211
|
+
/* @__PURE__ */ S("option", {
|
|
212
212
|
value: "false",
|
|
213
213
|
children: "Unprocessed / Failed"
|
|
214
214
|
}),
|
|
215
|
-
/* @__PURE__ */
|
|
215
|
+
/* @__PURE__ */ S("option", {
|
|
216
216
|
value: "true",
|
|
217
217
|
children: "Processed"
|
|
218
218
|
})
|
|
219
219
|
]
|
|
220
220
|
})] }),
|
|
221
|
-
/* @__PURE__ */
|
|
221
|
+
/* @__PURE__ */ C("div", { children: [/* @__PURE__ */ S("label", {
|
|
222
222
|
className: "block text-sm font-medium mb-1",
|
|
223
223
|
children: "Provider"
|
|
224
|
-
}), /* @__PURE__ */
|
|
225
|
-
value:
|
|
226
|
-
onChange: (e) =>
|
|
224
|
+
}), /* @__PURE__ */ C(f, {
|
|
225
|
+
value: _.provider || "",
|
|
226
|
+
onChange: (e) => L("provider", e.target.value || void 0),
|
|
227
227
|
className: "w-full px-3 py-2 border border-border-subtle rounded-md bg-bg-surface scheme-normal dark:scheme-dark [&_option]:bg-bg-surface [&_option]:text-text-primary",
|
|
228
|
-
children: [/* @__PURE__ */
|
|
228
|
+
children: [/* @__PURE__ */ S("option", {
|
|
229
229
|
value: "",
|
|
230
230
|
children: "All Providers"
|
|
231
|
-
}),
|
|
231
|
+
}), T.map((e) => /* @__PURE__ */ S("option", {
|
|
232
232
|
value: e,
|
|
233
233
|
children: e.charAt(0).toUpperCase() + e.slice(1)
|
|
234
234
|
}, e))]
|
|
235
235
|
})] }),
|
|
236
|
-
/* @__PURE__ */
|
|
236
|
+
/* @__PURE__ */ C("div", { children: [/* @__PURE__ */ S("label", {
|
|
237
237
|
className: "block text-sm font-medium mb-1",
|
|
238
238
|
children: "Has Error"
|
|
239
|
-
}), /* @__PURE__ */
|
|
240
|
-
value:
|
|
241
|
-
onChange: (e) =>
|
|
239
|
+
}), /* @__PURE__ */ C(f, {
|
|
240
|
+
value: _.hasError === void 0 ? "" : String(_.hasError),
|
|
241
|
+
onChange: (e) => L("hasError", e.target.value === "" ? void 0 : e.target.value === "true"),
|
|
242
242
|
className: "w-full px-3 py-2 border border-border-subtle rounded-md bg-bg-surface scheme-normal dark:scheme-dark [&_option]:bg-bg-surface [&_option]:text-text-primary",
|
|
243
243
|
children: [
|
|
244
|
-
/* @__PURE__ */
|
|
244
|
+
/* @__PURE__ */ S("option", {
|
|
245
245
|
value: "",
|
|
246
246
|
children: "All"
|
|
247
247
|
}),
|
|
248
|
-
/* @__PURE__ */
|
|
248
|
+
/* @__PURE__ */ S("option", {
|
|
249
249
|
value: "true",
|
|
250
250
|
children: "Has error"
|
|
251
251
|
}),
|
|
252
|
-
/* @__PURE__ */
|
|
252
|
+
/* @__PURE__ */ S("option", {
|
|
253
253
|
value: "false",
|
|
254
254
|
children: "No error"
|
|
255
255
|
})
|
|
@@ -257,7 +257,7 @@ var C = 25, w = ["stripe", "razorpay"], T = /* @__PURE__ */ new Set([
|
|
|
257
257
|
})] })
|
|
258
258
|
]
|
|
259
259
|
}),
|
|
260
|
-
|
|
260
|
+
M && A.length === 0 ? /* @__PURE__ */ S("div", {
|
|
261
261
|
className: "space-y-2",
|
|
262
262
|
children: [
|
|
263
263
|
1,
|
|
@@ -265,99 +265,99 @@ var C = 25, w = ["stripe", "razorpay"], T = /* @__PURE__ */ new Set([
|
|
|
265
265
|
3,
|
|
266
266
|
4,
|
|
267
267
|
5
|
|
268
|
-
].map((e) => /* @__PURE__ */
|
|
269
|
-
}) :
|
|
268
|
+
].map((e) => /* @__PURE__ */ S("div", { className: "h-16 bg-bg-sunken animate-pulse rounded" }, e))
|
|
269
|
+
}) : A.length === 0 ? /* @__PURE__ */ S(u, {
|
|
270
270
|
illustration: "empty-data",
|
|
271
271
|
title: "No webhook logs found",
|
|
272
272
|
description: "Nothing matches these filters — try widening them, or check back after the next payment."
|
|
273
|
-
}) : /* @__PURE__ */
|
|
273
|
+
}) : /* @__PURE__ */ S("div", {
|
|
274
274
|
className: "border border-border-subtle rounded-lg overflow-hidden",
|
|
275
|
-
children: /* @__PURE__ */
|
|
276
|
-
columns:
|
|
277
|
-
data:
|
|
275
|
+
children: /* @__PURE__ */ S(d, {
|
|
276
|
+
columns: z,
|
|
277
|
+
data: A,
|
|
278
278
|
rowKey: (e) => e.id,
|
|
279
|
-
rowActions: (e) => /* @__PURE__ */
|
|
279
|
+
rowActions: (e) => /* @__PURE__ */ C("button", {
|
|
280
280
|
type: "button",
|
|
281
|
-
onClick: () =>
|
|
281
|
+
onClick: () => k(e),
|
|
282
282
|
className: "inline-flex items-center gap-1.5 px-2 py-1 text-sm font-medium rounded-button text-text-secondary hover:text-text-primary hover:bg-bg-sunken/60 transition-colors",
|
|
283
|
-
children: [/* @__PURE__ */
|
|
283
|
+
children: [/* @__PURE__ */ S(v, { className: "size-4" }), /* @__PURE__ */ S("span", {
|
|
284
284
|
className: "hidden sm:inline",
|
|
285
285
|
children: "View"
|
|
286
286
|
})]
|
|
287
287
|
})
|
|
288
288
|
})
|
|
289
289
|
}),
|
|
290
|
-
|
|
290
|
+
j > 0 && /* @__PURE__ */ C("div", {
|
|
291
291
|
className: "flex flex-col sm:flex-row items-center justify-between gap-4 border-t border-border-subtle pt-4",
|
|
292
|
-
children: [/* @__PURE__ */
|
|
292
|
+
children: [/* @__PURE__ */ C("p", {
|
|
293
293
|
className: "text-sm text-text-muted text-center sm:text-left",
|
|
294
294
|
children: [
|
|
295
295
|
"Showing ",
|
|
296
|
-
|
|
296
|
+
p * w + 1,
|
|
297
297
|
" to ",
|
|
298
|
-
Math.min((
|
|
298
|
+
Math.min((p + 1) * w, j),
|
|
299
299
|
" of",
|
|
300
300
|
" ",
|
|
301
|
-
|
|
301
|
+
j,
|
|
302
302
|
" logs"
|
|
303
303
|
]
|
|
304
|
-
}), /* @__PURE__ */
|
|
304
|
+
}), /* @__PURE__ */ C("div", {
|
|
305
305
|
className: "flex items-center gap-2",
|
|
306
306
|
children: [
|
|
307
|
-
/* @__PURE__ */
|
|
307
|
+
/* @__PURE__ */ C("button", {
|
|
308
308
|
type: "button",
|
|
309
|
-
onClick: () =>
|
|
310
|
-
disabled:
|
|
309
|
+
onClick: () => m((e) => Math.max(0, e - 1)),
|
|
310
|
+
disabled: p === 0,
|
|
311
311
|
className: "inline-flex items-center gap-1 px-3 py-1.5 text-sm font-medium rounded-button border border-border-subtle bg-bg-surface hover:bg-bg-sunken/50 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",
|
|
312
|
-
children: [/* @__PURE__ */
|
|
312
|
+
children: [/* @__PURE__ */ S(h, { className: "size-4" }), /* @__PURE__ */ S("span", {
|
|
313
313
|
className: "hidden sm:inline",
|
|
314
314
|
children: "Previous"
|
|
315
315
|
})]
|
|
316
316
|
}),
|
|
317
|
-
/* @__PURE__ */
|
|
317
|
+
/* @__PURE__ */ C("span", {
|
|
318
318
|
className: "text-sm text-text-muted px-2",
|
|
319
319
|
children: [
|
|
320
|
-
/* @__PURE__ */
|
|
320
|
+
/* @__PURE__ */ S("span", {
|
|
321
321
|
className: "hidden sm:inline",
|
|
322
322
|
children: "Page "
|
|
323
323
|
}),
|
|
324
|
-
|
|
324
|
+
p + 1,
|
|
325
325
|
" ",
|
|
326
|
-
/* @__PURE__ */
|
|
326
|
+
/* @__PURE__ */ S("span", {
|
|
327
327
|
className: "hidden sm:inline",
|
|
328
328
|
children: "of"
|
|
329
329
|
}),
|
|
330
|
-
/* @__PURE__ */
|
|
330
|
+
/* @__PURE__ */ S("span", {
|
|
331
331
|
className: "sm:hidden",
|
|
332
332
|
children: "/"
|
|
333
333
|
}),
|
|
334
334
|
" ",
|
|
335
|
-
|
|
335
|
+
B
|
|
336
336
|
]
|
|
337
337
|
}),
|
|
338
|
-
/* @__PURE__ */
|
|
338
|
+
/* @__PURE__ */ C("button", {
|
|
339
339
|
type: "button",
|
|
340
|
-
onClick: () =>
|
|
341
|
-
disabled:
|
|
340
|
+
onClick: () => m((e) => e + 1 < B ? e + 1 : e),
|
|
341
|
+
disabled: p + 1 >= B,
|
|
342
342
|
className: "inline-flex items-center gap-1 px-3 py-1.5 text-sm font-medium rounded-button border border-border-subtle bg-bg-surface hover:bg-bg-sunken/50 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",
|
|
343
|
-
children: [/* @__PURE__ */
|
|
343
|
+
children: [/* @__PURE__ */ S("span", {
|
|
344
344
|
className: "hidden sm:inline",
|
|
345
345
|
children: "Next"
|
|
346
|
-
}), /* @__PURE__ */
|
|
346
|
+
}), /* @__PURE__ */ S(g, { className: "size-4" })]
|
|
347
347
|
})
|
|
348
348
|
]
|
|
349
349
|
})]
|
|
350
350
|
}),
|
|
351
|
-
/* @__PURE__ */
|
|
352
|
-
log:
|
|
353
|
-
onClose: () =>
|
|
354
|
-
onCreateRefund:
|
|
355
|
-
isCreatingRefund:
|
|
356
|
-
canCreateRefund:
|
|
351
|
+
/* @__PURE__ */ S(O, {
|
|
352
|
+
log: x,
|
|
353
|
+
onClose: () => k(null),
|
|
354
|
+
onCreateRefund: R,
|
|
355
|
+
isCreatingRefund: I,
|
|
356
|
+
canCreateRefund: x ? E.has(x.event) && !!x.error : !1
|
|
357
357
|
})
|
|
358
358
|
]
|
|
359
359
|
});
|
|
360
360
|
};
|
|
361
|
-
export {
|
|
361
|
+
export { k as BillingWebhookLogsPage };
|
|
362
362
|
|
|
363
363
|
//# sourceMappingURL=BillingWebhookLogsPage.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BillingWebhookLogsPage.js","names":["PAGE_SIZE","PROVIDER_OPTIONS","REFUND_ELIGIBLE_EVENTS","getBadge","log","statusTokens","CheckCircle","AlertTriangle","WebhookLogDetailModal","onClose","X","formatDateTime","canCreateRefund","onCreateRefund","isCreatingRefund","Loader2","DollarSign","BillingWebhookLogsPage","permissions","useBillingPermissions","page","setPage","useState","filters","setFilters","selectedLog","setSelectedLog","useBillingWebhookLogs","useRefundMutations","AccessDenied","error","isServerError","ServerError","refetch","handleFilterChange","prev","key","value","handleCreateRefund","createRefundRecordFromWebhook","webhookLogId","columns","badge","BadgeIcon","totalPages","totalCount","PageHeader","RefreshCw","p","isLoading","logs","i","IllustratedEmptyState","ResponsiveTable","Eye","ChevronLeft","ChevronRight","isCreatingFromWebhook"],"sources":["../../../../../src/billing/modules/billing/pages/BillingWebhookLogsPage.tsx"],"sourcesContent":["/**\n * Billing Module - Billing Webhook Logs Page\n * Admin visibility into every Stripe/Razorpay webhook processing attempt —\n * not just the payment-succeeded subset eligible for automatic refund\n * creation (see RefundsPage's \"Import Failed Webhooks\" action). Lets whoever\n * owns billing ops see and investigate ANY webhook processing failure\n * without needing direct DB access.\n */\n\nimport { useState, type FC } from 'react';\nimport {\n RefreshCw,\n ChevronLeft,\n ChevronRight,\n CheckCircle,\n AlertTriangle,\n X,\n DollarSign,\n Loader2,\n Eye,\n} from 'lucide-react';\nimport { useBillingPermissions } from '../../../hooks/useBillingPermissions';\nimport {\n useBillingWebhookLogs,\n useRefundMutations,\n type BillingWebhookLogFilters,\n type WebhookLog,\n} from '../hooks';\nimport { AccessDenied, PageHeader, ServerError } from '../../../shared/components';\nimport { formatDateTime, isServerError } from '../../../shared/utils';\nimport { statusTokens } from '../../../shared/utils/tokens';\nimport {\n ResponsiveTable,\n type ResponsiveTableColumn,\n IllustratedEmptyState,\n} from '@burdenoff/fe-libs/ui';\n\nconst PAGE_SIZE = 25;\nconst PROVIDER_OPTIONS = ['stripe', 'razorpay'];\nconst REFUND_ELIGIBLE_EVENTS = new Set([\n 'payment_intent.succeeded',\n 'charge.succeeded',\n 'payment.captured',\n 'order.paid',\n]);\n\nconst getBadge = (\n log: WebhookLog\n): { label: string; className: string; icon: FC<{ className?: string }> } => {\n if (!log.processed) {\n return {\n label: log.error ? 'Failed' : 'Pending',\n className: `${statusTokens.error.bg} ${statusTokens.error.text}`,\n icon: AlertTriangle,\n };\n }\n return {\n label: 'Processed',\n className: `${statusTokens.success.bg} ${statusTokens.success.text}`,\n icon: CheckCircle,\n };\n};\n\nconst WebhookLogDetailModal: FC<{\n log: WebhookLog | null;\n onClose: () => void;\n onCreateRefund: (id: string) => void;\n isCreatingRefund: boolean;\n canCreateRefund: boolean;\n}> = ({ log, onClose, onCreateRefund, isCreatingRefund, canCreateRefund }) => {\n if (!log) return null;\n\n return (\n <div className=\"fixed inset-0 z-50 flex items-center justify-center bg-bg-overlay p-4\">\n <div className=\"w-full max-w-2xl max-h-[85vh] overflow-y-auto rounded-lg bg-bg-surface border border-border-subtle shadow-[var(--shadow-elevation-2)]\">\n <div className=\"flex items-center justify-between p-4 border-b border-border-subtle\">\n <h3 className=\"text-base font-semibold text-text-primary\">Webhook log details</h3>\n <button\n type=\"button\"\n onClick={onClose}\n className=\"p-1 rounded text-text-muted hover:text-text-primary hover:bg-bg-sunken/50\"\n >\n <X className=\"size-4\" />\n </button>\n </div>\n <div className=\"p-4 space-y-4\">\n <div className=\"grid grid-cols-2 gap-4 text-sm\">\n <div>\n <p className=\"text-text-muted\">Provider</p>\n <p className=\"text-text-primary capitalize\">{log.provider}</p>\n </div>\n <div>\n <p className=\"text-text-muted\">Event</p>\n <p className=\"text-text-primary font-mono text-xs\">{log.event}</p>\n </div>\n <div>\n <p className=\"text-text-muted\">Received</p>\n <p className=\"text-text-primary\">{formatDateTime(log.createdAt)}</p>\n </div>\n <div>\n <p className=\"text-text-muted\">Processed</p>\n <p className=\"text-text-primary\">{log.processed ? 'Yes' : 'No'}</p>\n </div>\n </div>\n {log.error && (\n <div>\n <p className=\"text-sm text-text-muted mb-1\">Error</p>\n <pre className=\"text-xs whitespace-pre-wrap p-3 rounded-md bg-status-error-bg-subtle text-status-error-text border border-status-error-border\">\n {log.error}\n </pre>\n </div>\n )}\n <div>\n <p className=\"text-sm text-text-muted mb-1\">Payload</p>\n <pre className=\"text-xs whitespace-pre-wrap p-3 rounded-md bg-bg-sunken/60 text-text-secondary max-h-64 overflow-y-auto\">\n {JSON.stringify(log.payload, null, 2)}\n </pre>\n </div>\n {!log.processed && canCreateRefund && (\n <button\n type=\"button\"\n onClick={() => onCreateRefund(log.id)}\n disabled={isCreatingRefund}\n className=\"inline-flex items-center gap-2 px-3 py-2 text-sm font-medium rounded-md bg-action-primary-bg text-action-primary-text hover:bg-action-primary-bgHover disabled:opacity-50\"\n >\n {isCreatingRefund ? (\n <Loader2 className=\"size-4 animate-spin\" />\n ) : (\n <DollarSign className=\"size-4\" />\n )}\n Create refund from this webhook\n </button>\n )}\n </div>\n </div>\n </div>\n );\n};\n\nexport const BillingWebhookLogsPage: FC = () => {\n const permissions = useBillingPermissions();\n const [page, setPage] = useState(0);\n const [filters, setFilters] = useState<BillingWebhookLogFilters>({});\n const [selectedLog, setSelectedLog] = useState<WebhookLog | null>(null);\n\n const { logs, totalCount, isLoading, error, refetch } = useBillingWebhookLogs(\n filters,\n page,\n PAGE_SIZE\n );\n const { createRefundRecordFromWebhook, isCreatingFromWebhook } = useRefundMutations();\n\n if (!permissions.isBillingAdmin) {\n return <AccessDenied message=\"You don't have permission to view billing webhook logs.\" />;\n }\n\n if (error && isServerError(error)) {\n return (\n <div className=\"p-6\">\n <ServerError\n title=\"Server Unavailable\"\n message=\"Unable to load webhook logs. The server might be down or experiencing issues.\"\n onRetry={() => refetch()}\n showRetry\n />\n </div>\n );\n }\n\n const handleFilterChange = <K extends keyof BillingWebhookLogFilters>(\n key: K,\n value: BillingWebhookLogFilters[K]\n ) => {\n setFilters((prev) => ({ ...prev, [key]: value }));\n setPage(0);\n };\n\n const handleCreateRefund = async (webhookLogId: string) => {\n await createRefundRecordFromWebhook(webhookLogId);\n setSelectedLog(null);\n };\n\n const columns: ResponsiveTableColumn<WebhookLog>[] = [\n {\n key: 'date',\n header: 'Received',\n priority: 'primary',\n cellClassName: 'whitespace-nowrap',\n cell: (log) => (\n <div className=\"flex flex-col\">\n <span className=\"text-sm text-text-primary\">\n {formatDateTime(log.createdAt).split(' ')[0]}\n </span>\n <span className=\"text-xs text-text-muted\">\n {formatDateTime(log.createdAt).split(' ')[1]}\n </span>\n </div>\n ),\n },\n {\n key: 'status',\n header: 'Status',\n cellClassName: 'whitespace-nowrap',\n cell: (log) => {\n const badge = getBadge(log);\n const BadgeIcon = badge.icon;\n return (\n <span\n className={`inline-flex items-center gap-1 px-2 py-0.5 text-xs font-medium rounded ${badge.className}`}\n >\n <BadgeIcon className=\"size-3\" />\n {badge.label}\n </span>\n );\n },\n },\n {\n key: 'provider',\n header: 'Provider',\n priority: 'hidden-on-mobile',\n cellClassName: 'whitespace-nowrap',\n cell: (log) => <span className=\"text-sm text-text-primary capitalize\">{log.provider}</span>,\n },\n {\n key: 'event',\n header: 'Event',\n cellClassName: 'whitespace-nowrap max-w-[220px] truncate',\n cell: (log) => <span className=\"text-sm font-mono text-text-muted\">{log.event}</span>,\n },\n {\n key: 'error',\n header: 'Error',\n priority: 'hidden-on-mobile',\n cellClassName: 'max-w-[280px] truncate',\n cell: (log) => <span className=\"text-sm text-status-error-text\">{log.error || '-'}</span>,\n },\n ];\n\n const totalPages = Math.max(1, Math.ceil(totalCount / PAGE_SIZE));\n\n return (\n <div className=\"space-y-6 p-6\">\n <PageHeader\n title=\"Billing Webhook Logs\"\n description=\"Every Stripe/Razorpay webhook delivery — investigate processing failures directly.\"\n actions={\n <button\n type=\"button\"\n onClick={() => refetch()}\n className=\"inline-flex items-center gap-2 px-3 py-2 text-sm font-medium rounded-md border border-border-subtle bg-bg-surface hover:bg-bg-sunken/50\"\n >\n <RefreshCw className=\"size-4\" />\n Refresh\n </button>\n }\n />\n\n {/* Filters */}\n <div className=\"p-4 border border-border-subtle rounded-lg bg-bg-sunken/30 grid grid-cols-1 sm:grid-cols-3 gap-4\">\n <div>\n <label className=\"block text-sm font-medium mb-1\">Processed</label>\n <select\n value={filters.processed === undefined ? '' : String(filters.processed)}\n onChange={(e) =>\n handleFilterChange(\n 'processed',\n e.target.value === '' ? undefined : e.target.value === 'true'\n )\n }\n className=\"w-full px-3 py-2 border border-border-subtle rounded-md bg-bg-surface scheme-normal dark:scheme-dark [&_option]:bg-bg-surface [&_option]:text-text-primary\"\n >\n <option value=\"\">All</option>\n <option value=\"false\">Unprocessed / Failed</option>\n <option value=\"true\">Processed</option>\n </select>\n </div>\n <div>\n <label className=\"block text-sm font-medium mb-1\">Provider</label>\n <select\n value={filters.provider || ''}\n onChange={(e) => handleFilterChange('provider', e.target.value || undefined)}\n className=\"w-full px-3 py-2 border border-border-subtle rounded-md bg-bg-surface scheme-normal dark:scheme-dark [&_option]:bg-bg-surface [&_option]:text-text-primary\"\n >\n <option value=\"\">All Providers</option>\n {PROVIDER_OPTIONS.map((p) => (\n <option key={p} value={p}>\n {p.charAt(0).toUpperCase() + p.slice(1)}\n </option>\n ))}\n </select>\n </div>\n <div>\n <label className=\"block text-sm font-medium mb-1\">Has Error</label>\n <select\n value={filters.hasError === undefined ? '' : String(filters.hasError)}\n onChange={(e) =>\n handleFilterChange(\n 'hasError',\n e.target.value === '' ? undefined : e.target.value === 'true'\n )\n }\n className=\"w-full px-3 py-2 border border-border-subtle rounded-md bg-bg-surface scheme-normal dark:scheme-dark [&_option]:bg-bg-surface [&_option]:text-text-primary\"\n >\n <option value=\"\">All</option>\n <option value=\"true\">Has error</option>\n <option value=\"false\">No error</option>\n </select>\n </div>\n </div>\n\n {/* Table */}\n {isLoading && logs.length === 0 ? (\n <div className=\"space-y-2\">\n {[1, 2, 3, 4, 5].map((i) => (\n <div key={i} className=\"h-16 bg-bg-sunken animate-pulse rounded\" />\n ))}\n </div>\n ) : logs.length === 0 ? (\n <IllustratedEmptyState\n illustration=\"empty-data\"\n title=\"No webhook logs found\"\n description=\"Nothing matches these filters — try widening them, or check back after the next payment.\"\n />\n ) : (\n <div className=\"border border-border-subtle rounded-lg overflow-hidden\">\n <ResponsiveTable<WebhookLog>\n columns={columns}\n data={logs}\n rowKey={(log) => log.id}\n rowActions={(log) => (\n <button\n type=\"button\"\n onClick={() => setSelectedLog(log)}\n className=\"inline-flex items-center gap-1.5 px-2 py-1 text-sm font-medium rounded-button text-text-secondary hover:text-text-primary hover:bg-bg-sunken/60 transition-colors\"\n >\n <Eye className=\"size-4\" />\n <span className=\"hidden sm:inline\">View</span>\n </button>\n )}\n />\n </div>\n )}\n\n {/* Pagination */}\n {totalCount > 0 && (\n <div className=\"flex flex-col sm:flex-row items-center justify-between gap-4 border-t border-border-subtle pt-4\">\n <p className=\"text-sm text-text-muted text-center sm:text-left\">\n Showing {page * PAGE_SIZE + 1} to {Math.min((page + 1) * PAGE_SIZE, totalCount)} of{' '}\n {totalCount} logs\n </p>\n <div className=\"flex items-center gap-2\">\n <button\n type=\"button\"\n onClick={() => setPage((p) => Math.max(0, p - 1))}\n disabled={page === 0}\n className=\"inline-flex items-center gap-1 px-3 py-1.5 text-sm font-medium rounded-button border border-border-subtle bg-bg-surface hover:bg-bg-sunken/50 disabled:opacity-50 disabled:cursor-not-allowed transition-colors\"\n >\n <ChevronLeft className=\"size-4\" />\n <span className=\"hidden sm:inline\">Previous</span>\n </button>\n <span className=\"text-sm text-text-muted px-2\">\n <span className=\"hidden sm:inline\">Page </span>\n {page + 1} <span className=\"hidden sm:inline\">of</span>\n <span className=\"sm:hidden\">/</span> {totalPages}\n </span>\n <button\n type=\"button\"\n onClick={() => setPage((p) => (p + 1 < totalPages ? p + 1 : p))}\n disabled={page + 1 >= totalPages}\n className=\"inline-flex items-center gap-1 px-3 py-1.5 text-sm font-medium rounded-button border border-border-subtle bg-bg-surface hover:bg-bg-sunken/50 disabled:opacity-50 disabled:cursor-not-allowed transition-colors\"\n >\n <span className=\"hidden sm:inline\">Next</span>\n <ChevronRight className=\"size-4\" />\n </button>\n </div>\n </div>\n )}\n\n <WebhookLogDetailModal\n log={selectedLog}\n onClose={() => setSelectedLog(null)}\n onCreateRefund={handleCreateRefund}\n isCreatingRefund={isCreatingFromWebhook}\n canCreateRefund={\n selectedLog\n ? REFUND_ELIGIBLE_EVENTS.has(selectedLog.event) && Boolean(selectedLog.error)\n : false\n }\n />\n </div>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;AAqCA,IAAMA,IAAY,IACZC,IAAmB,CAAC,UAAU,UAAU,GACxCC,oBAAyB,IAAI,IAAI;CACrC;CACA;CACA;CACA;AACF,CAAC,GAEKC,KACJ,MAEKC,EAAI,YAOF;CACL,OAAO;CACP,WAAW,GAAGC,EAAa,QAAQ,GAAG,GAAGA,EAAa,QAAQ;CAC9D,MAAMC;AACR,IAVS;CACL,OAAOF,EAAI,QAAQ,WAAW;CAC9B,WAAW,GAAGC,EAAa,MAAM,GAAG,GAAGA,EAAa,MAAM;CAC1D,MAAME;AACR,GASEC,KAMA,EAAE,QAAK,YAAS,mBAAgB,qBAAkB,yBACjDJ,IAGH,kBAAC,OAAD;CAAK,WAAU;CACb,UAAA,kBAAC,OAAD;EAAK,WAAU;EAAf,UAAA,CACE,kBAAC,OAAD;GAAK,WAAU;GAAf,UAAA,CACE,kBAAC,MAAD;IAAI,WAAU;IAA4C,UAAA;GAAuB,CAAA,GACjF,kBAAC,UAAD;IACE,MAAK;IACL,SAASK;IACT,WAAU;IAEV,UAAA,kBAACC,GAAD,EAAG,WAAU,SAAU,CAAA;GACjB,CAAA,CACL;EACL,CAAA,GAAA,kBAAC,OAAD;GAAK,WAAU;GAAf,UAAA;IACE,kBAAC,OAAD;KAAK,WAAU;KAAf,UAAA;MACE,kBAAC,OAAD,EAAA,UAAA,CACE,kBAAC,KAAD;OAAG,WAAU;OAAkB,UAAA;MAAW,CAAA,GAC1C,kBAAC,KAAD;OAAG,WAAU;OAAgC,UAAAN,EAAI;MAAY,CAAA,CAC1D,EAAA,CAAA;MACL,kBAAC,OAAD,EAAA,UAAA,CACE,kBAAC,KAAD;OAAG,WAAU;OAAkB,UAAA;MAAQ,CAAA,G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CAME,kBAAC,QAAD;QAAM,WAAU;QAAmB,UAAA;OAAU,CAAA,GAC7C,kBAACY,GAAD,EAAc,WAAU,SAAU,CAAA,CAC5B;;KACL;IACF,CAAA,CAAA;;GAGP,kBAAChD,GAAD;IACE,KAAKiB;IACL,eAAeC,EAAe,IAAI;IAClC,gBAAgBY;IAChB,kBAAkBmB;IAClB,iBACEhC,IACIvB,EAAuB,IAAIuB,EAAY,KAAK,KAAK,EAAQA,EAAY,QACrE;GAEP,CAAA;EACE;;AAET"}
|
|
1
|
+
{"version":3,"file":"BillingWebhookLogsPage.js","names":["PAGE_SIZE","PROVIDER_OPTIONS","REFUND_ELIGIBLE_EVENTS","getBadge","log","statusTokens","CheckCircle","AlertTriangle","WebhookLogDetailModal","onClose","X","formatDateTime","canCreateRefund","onCreateRefund","isCreatingRefund","Loader2","DollarSign","BillingWebhookLogsPage","permissions","useBillingPermissions","page","setPage","useState","filters","setFilters","selectedLog","setSelectedLog","useBillingWebhookLogs","useRefundMutations","AccessDenied","error","isServerError","ServerError","refetch","handleFilterChange","prev","key","value","handleCreateRefund","createRefundRecordFromWebhook","webhookLogId","columns","badge","BadgeIcon","totalPages","totalCount","PageHeader","RefreshCw","ThemedSelect","p","isLoading","logs","i","IllustratedEmptyState","ResponsiveTable","Eye","ChevronLeft","ChevronRight","isCreatingFromWebhook"],"sources":["../../../../../src/billing/modules/billing/pages/BillingWebhookLogsPage.tsx"],"sourcesContent":["/**\n * Billing Module - Billing Webhook Logs Page\n * Admin visibility into every Stripe/Razorpay webhook processing attempt —\n * not just the payment-succeeded subset eligible for automatic refund\n * creation (see RefundsPage's \"Import Failed Webhooks\" action). Lets whoever\n * owns billing ops see and investigate ANY webhook processing failure\n * without needing direct DB access.\n */\n\nimport { useState, type FC } from 'react';\nimport {\n RefreshCw,\n ChevronLeft,\n ChevronRight,\n CheckCircle,\n AlertTriangle,\n X,\n DollarSign,\n Loader2,\n Eye,\n} from 'lucide-react';\nimport { useBillingPermissions } from '../../../hooks/useBillingPermissions';\nimport {\n useBillingWebhookLogs,\n useRefundMutations,\n type BillingWebhookLogFilters,\n type WebhookLog,\n} from '../hooks';\nimport { AccessDenied, PageHeader, ServerError } from '../../../shared/components';\nimport { formatDateTime, isServerError } from '../../../shared/utils';\nimport { statusTokens } from '../../../shared/utils/tokens';\nimport {\n ResponsiveTable,\n type ResponsiveTableColumn,\n IllustratedEmptyState,\n ThemedSelect,\n} from '@burdenoff/fe-libs/ui';\n\nconst PAGE_SIZE = 25;\nconst PROVIDER_OPTIONS = ['stripe', 'razorpay'];\nconst REFUND_ELIGIBLE_EVENTS = new Set([\n 'payment_intent.succeeded',\n 'charge.succeeded',\n 'payment.captured',\n 'order.paid',\n]);\n\nconst getBadge = (\n log: WebhookLog\n): { label: string; className: string; icon: FC<{ className?: string }> } => {\n if (!log.processed) {\n return {\n label: log.error ? 'Failed' : 'Pending',\n className: `${statusTokens.error.bg} ${statusTokens.error.text}`,\n icon: AlertTriangle,\n };\n }\n return {\n label: 'Processed',\n className: `${statusTokens.success.bg} ${statusTokens.success.text}`,\n icon: CheckCircle,\n };\n};\n\nconst WebhookLogDetailModal: FC<{\n log: WebhookLog | null;\n onClose: () => void;\n onCreateRefund: (id: string) => void;\n isCreatingRefund: boolean;\n canCreateRefund: boolean;\n}> = ({ log, onClose, onCreateRefund, isCreatingRefund, canCreateRefund }) => {\n if (!log) return null;\n\n return (\n <div className=\"fixed inset-0 z-50 flex items-center justify-center bg-bg-overlay p-4\">\n <div className=\"w-full max-w-2xl max-h-[85vh] overflow-y-auto rounded-lg bg-bg-surface border border-border-subtle shadow-[var(--shadow-elevation-2)]\">\n <div className=\"flex items-center justify-between p-4 border-b border-border-subtle\">\n <h3 className=\"text-base font-semibold text-text-primary\">Webhook log details</h3>\n <button\n type=\"button\"\n onClick={onClose}\n className=\"p-1 rounded text-text-muted hover:text-text-primary hover:bg-bg-sunken/50\"\n >\n <X className=\"size-4\" />\n </button>\n </div>\n <div className=\"p-4 space-y-4\">\n <div className=\"grid grid-cols-2 gap-4 text-sm\">\n <div>\n <p className=\"text-text-muted\">Provider</p>\n <p className=\"text-text-primary capitalize\">{log.provider}</p>\n </div>\n <div>\n <p className=\"text-text-muted\">Event</p>\n <p className=\"text-text-primary font-mono text-xs\">{log.event}</p>\n </div>\n <div>\n <p className=\"text-text-muted\">Received</p>\n <p className=\"text-text-primary\">{formatDateTime(log.createdAt)}</p>\n </div>\n <div>\n <p className=\"text-text-muted\">Processed</p>\n <p className=\"text-text-primary\">{log.processed ? 'Yes' : 'No'}</p>\n </div>\n </div>\n {log.error && (\n <div>\n <p className=\"text-sm text-text-muted mb-1\">Error</p>\n <pre className=\"text-xs whitespace-pre-wrap p-3 rounded-md bg-status-error-bg-subtle text-status-error-text border border-status-error-border\">\n {log.error}\n </pre>\n </div>\n )}\n <div>\n <p className=\"text-sm text-text-muted mb-1\">Payload</p>\n <pre className=\"text-xs whitespace-pre-wrap p-3 rounded-md bg-bg-sunken/60 text-text-secondary max-h-64 overflow-y-auto\">\n {JSON.stringify(log.payload, null, 2)}\n </pre>\n </div>\n {!log.processed && canCreateRefund && (\n <button\n type=\"button\"\n onClick={() => onCreateRefund(log.id)}\n disabled={isCreatingRefund}\n className=\"inline-flex items-center gap-2 px-3 py-2 text-sm font-medium rounded-md bg-action-primary-bg text-action-primary-text hover:bg-action-primary-bgHover disabled:opacity-50\"\n >\n {isCreatingRefund ? (\n <Loader2 className=\"size-4 animate-spin\" />\n ) : (\n <DollarSign className=\"size-4\" />\n )}\n Create refund from this webhook\n </button>\n )}\n </div>\n </div>\n </div>\n );\n};\n\nexport const BillingWebhookLogsPage: FC = () => {\n const permissions = useBillingPermissions();\n const [page, setPage] = useState(0);\n const [filters, setFilters] = useState<BillingWebhookLogFilters>({});\n const [selectedLog, setSelectedLog] = useState<WebhookLog | null>(null);\n\n const { logs, totalCount, isLoading, error, refetch } = useBillingWebhookLogs(\n filters,\n page,\n PAGE_SIZE\n );\n const { createRefundRecordFromWebhook, isCreatingFromWebhook } = useRefundMutations();\n\n if (!permissions.isBillingAdmin) {\n return <AccessDenied message=\"You don't have permission to view billing webhook logs.\" />;\n }\n\n if (error && isServerError(error)) {\n return (\n <div className=\"p-6\">\n <ServerError\n title=\"Server Unavailable\"\n message=\"Unable to load webhook logs. The server might be down or experiencing issues.\"\n onRetry={() => refetch()}\n showRetry\n />\n </div>\n );\n }\n\n const handleFilterChange = <K extends keyof BillingWebhookLogFilters>(\n key: K,\n value: BillingWebhookLogFilters[K]\n ) => {\n setFilters((prev) => ({ ...prev, [key]: value }));\n setPage(0);\n };\n\n const handleCreateRefund = async (webhookLogId: string) => {\n await createRefundRecordFromWebhook(webhookLogId);\n setSelectedLog(null);\n };\n\n const columns: ResponsiveTableColumn<WebhookLog>[] = [\n {\n key: 'date',\n header: 'Received',\n priority: 'primary',\n cellClassName: 'whitespace-nowrap',\n cell: (log) => (\n <div className=\"flex flex-col\">\n <span className=\"text-sm text-text-primary\">\n {formatDateTime(log.createdAt).split(' ')[0]}\n </span>\n <span className=\"text-xs text-text-muted\">\n {formatDateTime(log.createdAt).split(' ')[1]}\n </span>\n </div>\n ),\n },\n {\n key: 'status',\n header: 'Status',\n cellClassName: 'whitespace-nowrap',\n cell: (log) => {\n const badge = getBadge(log);\n const BadgeIcon = badge.icon;\n return (\n <span\n className={`inline-flex items-center gap-1 px-2 py-0.5 text-xs font-medium rounded ${badge.className}`}\n >\n <BadgeIcon className=\"size-3\" />\n {badge.label}\n </span>\n );\n },\n },\n {\n key: 'provider',\n header: 'Provider',\n priority: 'hidden-on-mobile',\n cellClassName: 'whitespace-nowrap',\n cell: (log) => <span className=\"text-sm text-text-primary capitalize\">{log.provider}</span>,\n },\n {\n key: 'event',\n header: 'Event',\n cellClassName: 'whitespace-nowrap max-w-[220px] truncate',\n cell: (log) => <span className=\"text-sm font-mono text-text-muted\">{log.event}</span>,\n },\n {\n key: 'error',\n header: 'Error',\n priority: 'hidden-on-mobile',\n cellClassName: 'max-w-[280px] truncate',\n cell: (log) => <span className=\"text-sm text-status-error-text\">{log.error || '-'}</span>,\n },\n ];\n\n const totalPages = Math.max(1, Math.ceil(totalCount / PAGE_SIZE));\n\n return (\n <div className=\"space-y-6 p-6\">\n <PageHeader\n title=\"Billing Webhook Logs\"\n description=\"Every Stripe/Razorpay webhook delivery — investigate processing failures directly.\"\n actions={\n <button\n type=\"button\"\n onClick={() => refetch()}\n className=\"inline-flex items-center gap-2 px-3 py-2 text-sm font-medium rounded-md border border-border-subtle bg-bg-surface hover:bg-bg-sunken/50\"\n >\n <RefreshCw className=\"size-4\" />\n Refresh\n </button>\n }\n />\n\n {/* Filters */}\n <div className=\"p-4 border border-border-subtle rounded-lg bg-bg-sunken/30 grid grid-cols-1 sm:grid-cols-3 gap-4\">\n <div>\n <label className=\"block text-sm font-medium mb-1\">Processed</label>\n <ThemedSelect\n value={filters.processed === undefined ? '' : String(filters.processed)}\n onChange={(e) =>\n handleFilterChange(\n 'processed',\n e.target.value === '' ? undefined : e.target.value === 'true'\n )\n }\n className=\"w-full px-3 py-2 border border-border-subtle rounded-md bg-bg-surface scheme-normal dark:scheme-dark [&_option]:bg-bg-surface [&_option]:text-text-primary\"\n >\n <option value=\"\">All</option>\n <option value=\"false\">Unprocessed / Failed</option>\n <option value=\"true\">Processed</option>\n </ThemedSelect>\n </div>\n <div>\n <label className=\"block text-sm font-medium mb-1\">Provider</label>\n <ThemedSelect\n value={filters.provider || ''}\n onChange={(e) => handleFilterChange('provider', e.target.value || undefined)}\n className=\"w-full px-3 py-2 border border-border-subtle rounded-md bg-bg-surface scheme-normal dark:scheme-dark [&_option]:bg-bg-surface [&_option]:text-text-primary\"\n >\n <option value=\"\">All Providers</option>\n {PROVIDER_OPTIONS.map((p) => (\n <option key={p} value={p}>\n {p.charAt(0).toUpperCase() + p.slice(1)}\n </option>\n ))}\n </ThemedSelect>\n </div>\n <div>\n <label className=\"block text-sm font-medium mb-1\">Has Error</label>\n <ThemedSelect\n value={filters.hasError === undefined ? '' : String(filters.hasError)}\n onChange={(e) =>\n handleFilterChange(\n 'hasError',\n e.target.value === '' ? undefined : e.target.value === 'true'\n )\n }\n className=\"w-full px-3 py-2 border border-border-subtle rounded-md bg-bg-surface scheme-normal dark:scheme-dark [&_option]:bg-bg-surface [&_option]:text-text-primary\"\n >\n <option value=\"\">All</option>\n <option value=\"true\">Has error</option>\n <option value=\"false\">No error</option>\n </ThemedSelect>\n </div>\n </div>\n\n {/* Table */}\n {isLoading && logs.length === 0 ? (\n <div className=\"space-y-2\">\n {[1, 2, 3, 4, 5].map((i) => (\n <div key={i} className=\"h-16 bg-bg-sunken animate-pulse rounded\" />\n ))}\n </div>\n ) : logs.length === 0 ? (\n <IllustratedEmptyState\n illustration=\"empty-data\"\n title=\"No webhook logs found\"\n description=\"Nothing matches these filters — try widening them, or check back after the next payment.\"\n />\n ) : (\n <div className=\"border border-border-subtle rounded-lg overflow-hidden\">\n <ResponsiveTable<WebhookLog>\n columns={columns}\n data={logs}\n rowKey={(log) => log.id}\n rowActions={(log) => (\n <button\n type=\"button\"\n onClick={() => setSelectedLog(log)}\n className=\"inline-flex items-center gap-1.5 px-2 py-1 text-sm font-medium rounded-button text-text-secondary hover:text-text-primary hover:bg-bg-sunken/60 transition-colors\"\n >\n <Eye className=\"size-4\" />\n <span className=\"hidden sm:inline\">View</span>\n </button>\n )}\n />\n </div>\n )}\n\n {/* Pagination */}\n {totalCount > 0 && (\n <div className=\"flex flex-col sm:flex-row items-center justify-between gap-4 border-t border-border-subtle pt-4\">\n <p className=\"text-sm text-text-muted text-center sm:text-left\">\n Showing {page * PAGE_SIZE + 1} to {Math.min((page + 1) * PAGE_SIZE, totalCount)} of{' '}\n {totalCount} logs\n </p>\n <div className=\"flex items-center gap-2\">\n <button\n type=\"button\"\n onClick={() => setPage((p) => Math.max(0, p - 1))}\n disabled={page === 0}\n className=\"inline-flex items-center gap-1 px-3 py-1.5 text-sm font-medium rounded-button border border-border-subtle bg-bg-surface hover:bg-bg-sunken/50 disabled:opacity-50 disabled:cursor-not-allowed transition-colors\"\n >\n <ChevronLeft className=\"size-4\" />\n <span className=\"hidden sm:inline\">Previous</span>\n </button>\n <span className=\"text-sm text-text-muted px-2\">\n <span className=\"hidden sm:inline\">Page </span>\n {page + 1} <span className=\"hidden sm:inline\">of</span>\n <span className=\"sm:hidden\">/</span> {totalPages}\n </span>\n <button\n type=\"button\"\n onClick={() => setPage((p) => (p + 1 < totalPages ? p + 1 : p))}\n disabled={page + 1 >= totalPages}\n className=\"inline-flex items-center gap-1 px-3 py-1.5 text-sm font-medium rounded-button border border-border-subtle bg-bg-surface hover:bg-bg-sunken/50 disabled:opacity-50 disabled:cursor-not-allowed transition-colors\"\n >\n <span className=\"hidden sm:inline\">Next</span>\n <ChevronRight className=\"size-4\" />\n </button>\n </div>\n </div>\n )}\n\n <WebhookLogDetailModal\n log={selectedLog}\n onClose={() => setSelectedLog(null)}\n onCreateRefund={handleCreateRefund}\n isCreatingRefund={isCreatingFromWebhook}\n canCreateRefund={\n selectedLog\n ? REFUND_ELIGIBLE_EVENTS.has(selectedLog.event) && Boolean(selectedLog.error)\n : false\n }\n />\n </div>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;AAsCA,IAAMA,IAAY,IACZC,IAAmB,CAAC,UAAU,UAAU,GACxCC,oBAAyB,IAAI,IAAI;CACrC;CACA;CACA;CACA;AACF,CAAC,GAEKC,KACJ,MAEKC,EAAI,YAOF;CACL,OAAO;CACP,WAAW,GAAGC,EAAa,QAAQ,GAAG,GAAGA,EAAa,QAAQ;CAC9D,MAAMC;AACR,IAVS;CACL,OAAOF,EAAI,QAAQ,WAAW;CAC9B,WAAW,GAAGC,EAAa,MAAM,GAAG,GAAGA,EAAa,MAAM;CAC1D,MAAME;AACR,GASEC,KAMA,EAAE,QAAK,YAAS,mBAAgB,qBAAkB,yBACjDJ,IAGH,kBAAC,OAAD;CAAK,WAAU;CACb,UAAA,kBAAC,OAAD;EAAK,WAAU;EAAf,UAAA,CACE,kBAAC,OA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