@burdenoff/microfe-support 2026.518.2 → 2026.520.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/generated/global-operations.js +2 -0
- package/dist/generated/global-operations.js.map +1 -1
- package/dist/generated/global-types.js.map +1 -1
- package/dist/support/components/tickets/TicketHeader.js +63 -111
- package/dist/support/components/tickets/TicketHeader.js.map +1 -1
- package/dist/support/hooks/useTicketOperations.js +3 -3
- package/dist/support/hooks/useTicketOperations.js.map +1 -1
- package/dist/support/pages/ContactInquiriesPage.js +117 -112
- package/dist/support/pages/ContactInquiriesPage.js.map +1 -1
- package/dist/support/pages/ContactInquiryDetailPage.js +229 -176
- package/dist/support/pages/ContactInquiryDetailPage.js.map +1 -1
- package/dist/support/pages/TicketDetailAdminPage.js +25 -34
- package/dist/support/pages/TicketDetailAdminPage.js.map +1 -1
- package/dist/support/utils/index.js +17 -14
- package/dist/support/utils/index.js.map +1 -1
- package/dist/support/utils/supportFiles.js +4 -2
- package/dist/support/utils/supportFiles.js.map +1 -1
- package/package.json +2 -2
|
@@ -1,24 +1,25 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
1
|
+
import { humanizeCategory as e } from "../utils/index.js";
|
|
2
|
+
import { useGetContactInquiriesQuery as t } from "../../generated/global-operations.js";
|
|
3
|
+
import { useEffect as n, useState as r } from "react";
|
|
4
|
+
import { AlertCircle as i, ChevronDown as a, Filter as o, Loader2 as s, Mail as c, Search as l } from "lucide-react";
|
|
5
|
+
import { useLocation as u, useNavigate as d } from "react-router-dom";
|
|
6
|
+
import { graphqlFetch as f } from "@burdenoff/fe-libs/shared/graphql/fetch";
|
|
7
|
+
import { Fragment as p, jsx as m, jsxs as h } from "react/jsx-runtime";
|
|
7
8
|
//#region src/support/pages/ContactInquiriesPage.tsx
|
|
8
|
-
var
|
|
9
|
+
var g = {
|
|
9
10
|
NEW: "bg-status-info-bg-subtle text-status-info-text",
|
|
10
11
|
REVIEWED: "bg-status-warning-bg-subtle text-status-warning-text",
|
|
11
12
|
CONVERTED: "bg-status-success-bg-subtle text-status-success-text",
|
|
12
13
|
SPAM: "bg-status-error-bg-subtle text-status-error-text",
|
|
13
14
|
ARCHIVED: "bg-bg-sunken text-text-secondary"
|
|
14
|
-
},
|
|
15
|
+
}, _ = {
|
|
15
16
|
NEW: "New",
|
|
16
17
|
REVIEWED: "Reviewed",
|
|
17
18
|
CONVERTED: "Converted",
|
|
18
19
|
SPAM: "Spam",
|
|
19
20
|
ARCHIVED: "Archived"
|
|
20
21
|
};
|
|
21
|
-
function
|
|
22
|
+
function v(e) {
|
|
22
23
|
return new Date(e).toLocaleDateString("en-US", {
|
|
23
24
|
month: "short",
|
|
24
25
|
day: "numeric",
|
|
@@ -27,279 +28,283 @@ function _(e) {
|
|
|
27
28
|
minute: "2-digit"
|
|
28
29
|
});
|
|
29
30
|
}
|
|
30
|
-
function
|
|
31
|
-
let
|
|
32
|
-
|
|
33
|
-
let { data:
|
|
31
|
+
function y() {
|
|
32
|
+
let y = d(), b = u().search, [x, S] = r(""), [C, w] = r(""), [T, E] = r(""), [D, O] = r(!1), [k, A] = r({}), j = {};
|
|
33
|
+
x && (j.search = x), C && (j.status = C), T && (j.productId = T);
|
|
34
|
+
let { data: M, loading: N, error: P, fetchMore: F } = t({
|
|
34
35
|
variables: {
|
|
35
|
-
filter:
|
|
36
|
+
filter: j,
|
|
36
37
|
limit: 50,
|
|
37
38
|
offset: 0
|
|
38
39
|
},
|
|
39
40
|
fetchPolicy: "cache-and-network"
|
|
40
|
-
}),
|
|
41
|
-
return
|
|
42
|
-
let e =
|
|
41
|
+
}), I = M?.contactInquiries?.items ?? [], L = M?.contactInquiries?.total ?? 0, R = M?.contactInquiries?.hasMore ?? !1, z = Array.from(new Set(I.map((e) => e.productId).filter(Boolean)));
|
|
42
|
+
return n(() => {
|
|
43
|
+
let e = z.filter((e) => !k[e]);
|
|
43
44
|
e.length !== 0 && e.forEach((e) => {
|
|
44
|
-
|
|
45
|
+
f({
|
|
45
46
|
gateway: "global",
|
|
46
47
|
query: "query($id: ID!) { platformProduct(id: $id) { name } }",
|
|
47
48
|
variables: { id: e }
|
|
48
49
|
}).then((t) => {
|
|
49
50
|
let n = t.data?.platformProduct?.name;
|
|
50
|
-
n &&
|
|
51
|
+
n && A((t) => ({
|
|
51
52
|
...t,
|
|
52
53
|
[e]: n
|
|
53
54
|
}));
|
|
54
55
|
}).catch(() => {});
|
|
55
56
|
});
|
|
56
|
-
}, [
|
|
57
|
+
}, [z.join(",")]), N && I.length === 0 ? /* @__PURE__ */ h("div", {
|
|
57
58
|
className: "p-6",
|
|
58
|
-
children: [/* @__PURE__ */
|
|
59
|
+
children: [/* @__PURE__ */ h("div", {
|
|
59
60
|
className: "flex items-center gap-3 mb-6",
|
|
60
|
-
children: [/* @__PURE__ */
|
|
61
|
+
children: [/* @__PURE__ */ m(c, {
|
|
61
62
|
size: 24,
|
|
62
63
|
className: "text-text-primary"
|
|
63
|
-
}), /* @__PURE__ */
|
|
64
|
+
}), /* @__PURE__ */ m("h1", {
|
|
64
65
|
className: "text-2xl font-bold text-text-primary",
|
|
65
66
|
children: "Contact Inquiries"
|
|
66
67
|
})]
|
|
67
|
-
}), /* @__PURE__ */
|
|
68
|
+
}), /* @__PURE__ */ h("div", {
|
|
68
69
|
className: "flex flex-col items-center justify-center py-16",
|
|
69
|
-
children: [/* @__PURE__ */
|
|
70
|
+
children: [/* @__PURE__ */ m(s, {
|
|
70
71
|
size: 32,
|
|
71
72
|
className: "animate-spin text-text-secondary mb-4"
|
|
72
|
-
}), /* @__PURE__ */
|
|
73
|
+
}), /* @__PURE__ */ m("p", {
|
|
73
74
|
className: "text-sm text-text-secondary",
|
|
74
75
|
children: "Loading inquiries..."
|
|
75
76
|
})]
|
|
76
77
|
})]
|
|
77
|
-
}) :
|
|
78
|
+
}) : P ? /* @__PURE__ */ h("div", {
|
|
78
79
|
className: "p-6",
|
|
79
|
-
children: [/* @__PURE__ */
|
|
80
|
+
children: [/* @__PURE__ */ h("div", {
|
|
80
81
|
className: "flex items-center gap-3 mb-6",
|
|
81
|
-
children: [/* @__PURE__ */
|
|
82
|
+
children: [/* @__PURE__ */ m(c, {
|
|
82
83
|
size: 24,
|
|
83
84
|
className: "text-text-primary"
|
|
84
|
-
}), /* @__PURE__ */
|
|
85
|
+
}), /* @__PURE__ */ m("h1", {
|
|
85
86
|
className: "text-2xl font-bold text-text-primary",
|
|
86
87
|
children: "Contact Inquiries"
|
|
87
88
|
})]
|
|
88
|
-
}), /* @__PURE__ */
|
|
89
|
+
}), /* @__PURE__ */ h("div", {
|
|
89
90
|
className: "flex flex-col items-center justify-center py-16 text-center",
|
|
90
91
|
children: [
|
|
91
|
-
/* @__PURE__ */
|
|
92
|
+
/* @__PURE__ */ m("div", {
|
|
92
93
|
className: "p-4 rounded-2xl bg-status-error-bg-subtle text-status-error-text mb-4",
|
|
93
|
-
children: /* @__PURE__ */
|
|
94
|
+
children: /* @__PURE__ */ m(i, { size: 48 })
|
|
94
95
|
}),
|
|
95
|
-
/* @__PURE__ */
|
|
96
|
+
/* @__PURE__ */ m("h3", {
|
|
96
97
|
className: "text-lg font-semibold text-text-primary mb-2",
|
|
97
98
|
children: "Failed to load inquiries"
|
|
98
99
|
}),
|
|
99
|
-
/* @__PURE__ */
|
|
100
|
+
/* @__PURE__ */ m("p", {
|
|
100
101
|
className: "text-sm text-text-secondary",
|
|
101
|
-
children:
|
|
102
|
+
children: P.message
|
|
102
103
|
})
|
|
103
104
|
]
|
|
104
105
|
})]
|
|
105
|
-
}) : /* @__PURE__ */
|
|
106
|
+
}) : /* @__PURE__ */ h("div", {
|
|
106
107
|
className: "p-6",
|
|
107
108
|
children: [
|
|
108
|
-
/* @__PURE__ */
|
|
109
|
+
/* @__PURE__ */ m("div", {
|
|
109
110
|
className: "flex items-center justify-between mb-6",
|
|
110
|
-
children: /* @__PURE__ */
|
|
111
|
+
children: /* @__PURE__ */ h("div", {
|
|
111
112
|
className: "flex items-center gap-3",
|
|
112
113
|
children: [
|
|
113
|
-
/* @__PURE__ */
|
|
114
|
+
/* @__PURE__ */ m(c, {
|
|
114
115
|
size: 24,
|
|
115
116
|
className: "text-text-primary"
|
|
116
117
|
}),
|
|
117
|
-
/* @__PURE__ */
|
|
118
|
+
/* @__PURE__ */ h("div", { children: [/* @__PURE__ */ m("h1", {
|
|
118
119
|
className: "text-2xl font-bold text-text-primary",
|
|
119
120
|
children: "Contact Inquiries"
|
|
120
|
-
}), /* @__PURE__ */
|
|
121
|
+
}), /* @__PURE__ */ m("p", {
|
|
121
122
|
className: "text-sm text-text-secondary",
|
|
122
123
|
children: "Website contact form submissions"
|
|
123
124
|
})] }),
|
|
124
|
-
/* @__PURE__ */
|
|
125
|
+
/* @__PURE__ */ m("span", {
|
|
125
126
|
className: "ml-2 inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-muted text-text-secondary",
|
|
126
|
-
children:
|
|
127
|
+
children: L
|
|
127
128
|
})
|
|
128
129
|
]
|
|
129
130
|
})
|
|
130
131
|
}),
|
|
131
|
-
/* @__PURE__ */
|
|
132
|
+
/* @__PURE__ */ h("div", {
|
|
132
133
|
className: "flex flex-col sm:flex-row gap-3 mb-6",
|
|
133
|
-
children: [/* @__PURE__ */
|
|
134
|
+
children: [/* @__PURE__ */ h("div", {
|
|
134
135
|
className: "relative flex-1",
|
|
135
|
-
children: [/* @__PURE__ */
|
|
136
|
+
children: [/* @__PURE__ */ m(l, {
|
|
136
137
|
size: 16,
|
|
137
138
|
className: "absolute left-3 top-1/2 -translate-y-1/2 text-text-secondary"
|
|
138
|
-
}), /* @__PURE__ */
|
|
139
|
+
}), /* @__PURE__ */ m("input", {
|
|
139
140
|
type: "text",
|
|
140
141
|
placeholder: "Search by name, email, or subject...",
|
|
141
|
-
value:
|
|
142
|
-
onChange: (e) =>
|
|
142
|
+
value: x,
|
|
143
|
+
onChange: (e) => S(e.target.value),
|
|
143
144
|
className: "w-full pl-9 pr-4 py-2 bg-surface border border-default rounded-lg text-sm text-text-primary placeholder:text-text-secondary focus:outline-none focus:ring-2 focus:ring-accent/50"
|
|
144
145
|
})]
|
|
145
|
-
}), /* @__PURE__ */
|
|
146
|
-
onClick: () =>
|
|
146
|
+
}), /* @__PURE__ */ h("button", {
|
|
147
|
+
onClick: () => O(!D),
|
|
147
148
|
className: "inline-flex items-center gap-2 px-4 py-2 bg-surface border border-default rounded-lg text-sm text-text-secondary hover:text-text-primary hover:bg-muted transition-colors",
|
|
148
149
|
children: [
|
|
149
|
-
/* @__PURE__ */
|
|
150
|
+
/* @__PURE__ */ m(o, { size: 16 }),
|
|
150
151
|
"Filters",
|
|
151
|
-
/* @__PURE__ */
|
|
152
|
+
/* @__PURE__ */ m(a, {
|
|
152
153
|
size: 14,
|
|
153
|
-
className:
|
|
154
|
+
className: D ? "rotate-180 transition-transform" : "transition-transform"
|
|
154
155
|
})
|
|
155
156
|
]
|
|
156
157
|
})]
|
|
157
158
|
}),
|
|
158
|
-
|
|
159
|
+
D && /* @__PURE__ */ m("div", {
|
|
159
160
|
className: "mb-6 p-4 bg-surface border border-default rounded-lg",
|
|
160
|
-
children: /* @__PURE__ */
|
|
161
|
+
children: /* @__PURE__ */ h("div", {
|
|
161
162
|
className: "flex flex-wrap gap-4",
|
|
162
|
-
children: [/* @__PURE__ */
|
|
163
|
+
children: [/* @__PURE__ */ h("div", { children: [/* @__PURE__ */ m("label", {
|
|
163
164
|
className: "block text-xs font-medium text-text-secondary mb-1",
|
|
164
165
|
children: "Status"
|
|
165
|
-
}), /* @__PURE__ */
|
|
166
|
-
value:
|
|
167
|
-
onChange: (e) =>
|
|
166
|
+
}), /* @__PURE__ */ h("select", {
|
|
167
|
+
value: C,
|
|
168
|
+
onChange: (e) => w(e.target.value),
|
|
168
169
|
className: "px-3 py-2 bg-surface border border-default rounded-lg text-sm text-text-primary focus:outline-none focus:ring-2 focus:ring-accent/50",
|
|
169
170
|
children: [
|
|
170
|
-
/* @__PURE__ */
|
|
171
|
+
/* @__PURE__ */ m("option", {
|
|
171
172
|
value: "",
|
|
172
173
|
children: "All statuses"
|
|
173
174
|
}),
|
|
174
|
-
/* @__PURE__ */
|
|
175
|
+
/* @__PURE__ */ m("option", {
|
|
175
176
|
value: "NEW",
|
|
176
177
|
children: "New"
|
|
177
178
|
}),
|
|
178
|
-
/* @__PURE__ */
|
|
179
|
+
/* @__PURE__ */ m("option", {
|
|
179
180
|
value: "REVIEWED",
|
|
180
181
|
children: "Reviewed"
|
|
181
182
|
}),
|
|
182
|
-
/* @__PURE__ */
|
|
183
|
+
/* @__PURE__ */ m("option", {
|
|
183
184
|
value: "CONVERTED",
|
|
184
185
|
children: "Converted"
|
|
185
186
|
}),
|
|
186
|
-
/* @__PURE__ */
|
|
187
|
+
/* @__PURE__ */ m("option", {
|
|
187
188
|
value: "SPAM",
|
|
188
189
|
children: "Spam"
|
|
189
190
|
}),
|
|
190
|
-
/* @__PURE__ */
|
|
191
|
+
/* @__PURE__ */ m("option", {
|
|
191
192
|
value: "ARCHIVED",
|
|
192
193
|
children: "Archived"
|
|
193
194
|
})
|
|
194
195
|
]
|
|
195
|
-
})] }), /* @__PURE__ */
|
|
196
|
+
})] }), /* @__PURE__ */ h("div", { children: [/* @__PURE__ */ m("label", {
|
|
196
197
|
className: "block text-xs font-medium text-text-secondary mb-1",
|
|
197
198
|
children: "Product"
|
|
198
|
-
}), /* @__PURE__ */
|
|
199
|
-
value:
|
|
200
|
-
onChange: (e) =>
|
|
199
|
+
}), /* @__PURE__ */ h("select", {
|
|
200
|
+
value: T,
|
|
201
|
+
onChange: (e) => E(e.target.value),
|
|
201
202
|
className: "px-3 py-2 bg-surface border border-default rounded-lg text-sm text-text-primary focus:outline-none focus:ring-2 focus:ring-accent/50",
|
|
202
|
-
children: [/* @__PURE__ */
|
|
203
|
+
children: [/* @__PURE__ */ m("option", {
|
|
203
204
|
value: "",
|
|
204
205
|
children: "All products"
|
|
205
|
-
}),
|
|
206
|
+
}), z.map((e) => /* @__PURE__ */ m("option", {
|
|
206
207
|
value: e,
|
|
207
|
-
children:
|
|
208
|
+
children: k[e] || e
|
|
208
209
|
}, e))]
|
|
209
210
|
})] })]
|
|
210
211
|
})
|
|
211
212
|
}),
|
|
212
|
-
|
|
213
|
+
I.length === 0 ? /* @__PURE__ */ h("div", {
|
|
213
214
|
className: "flex flex-col items-center justify-center py-16 text-center",
|
|
214
215
|
children: [
|
|
215
|
-
/* @__PURE__ */
|
|
216
|
+
/* @__PURE__ */ m("div", {
|
|
216
217
|
className: "p-4 rounded-2xl bg-muted mb-4",
|
|
217
|
-
children: /* @__PURE__ */
|
|
218
|
+
children: /* @__PURE__ */ m(c, {
|
|
218
219
|
size: 48,
|
|
219
220
|
className: "text-text-secondary opacity-50"
|
|
220
221
|
})
|
|
221
222
|
}),
|
|
222
|
-
/* @__PURE__ */
|
|
223
|
+
/* @__PURE__ */ m("h3", {
|
|
223
224
|
className: "text-lg font-semibold text-text-primary mb-2",
|
|
224
225
|
children: "No inquiries yet"
|
|
225
226
|
}),
|
|
226
|
-
/* @__PURE__ */
|
|
227
|
+
/* @__PURE__ */ m("p", {
|
|
227
228
|
className: "text-sm text-text-secondary",
|
|
228
229
|
children: "Contact form submissions from your product websites will appear here."
|
|
229
230
|
})
|
|
230
231
|
]
|
|
231
|
-
}) : /* @__PURE__ */
|
|
232
|
+
}) : /* @__PURE__ */ h(p, { children: [/* @__PURE__ */ m("div", {
|
|
232
233
|
className: "space-y-3",
|
|
233
|
-
children:
|
|
234
|
-
onClick: () =>
|
|
234
|
+
children: I.map((t) => /* @__PURE__ */ m("button", {
|
|
235
|
+
onClick: () => y(`/support/inquiries/${t.id}${b}`),
|
|
235
236
|
className: "w-full text-left p-4 bg-surface border border-default rounded-lg hover:bg-muted/50 hover:border-accent/30 transition-all duration-200 group",
|
|
236
|
-
children: /* @__PURE__ */
|
|
237
|
+
children: /* @__PURE__ */ h("div", {
|
|
237
238
|
className: "flex items-start justify-between gap-4",
|
|
238
|
-
children: [/* @__PURE__ */
|
|
239
|
+
children: [/* @__PURE__ */ h("div", {
|
|
239
240
|
className: "flex-1 min-w-0",
|
|
240
241
|
children: [
|
|
241
|
-
/* @__PURE__ */
|
|
242
|
+
/* @__PURE__ */ h("div", {
|
|
242
243
|
className: "flex items-center gap-2 mb-1",
|
|
243
244
|
children: [
|
|
244
|
-
/* @__PURE__ */
|
|
245
|
+
/* @__PURE__ */ m("h3", {
|
|
245
246
|
className: "text-sm font-semibold text-text-primary truncate group-hover:text-accent transition-colors",
|
|
246
|
-
children:
|
|
247
|
+
children: t.subject
|
|
247
248
|
}),
|
|
248
|
-
/* @__PURE__ */
|
|
249
|
-
className: `inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium ${
|
|
250
|
-
children:
|
|
249
|
+
/* @__PURE__ */ m("span", {
|
|
250
|
+
className: `inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium ${g[t.status] || g.NEW}`,
|
|
251
|
+
children: _[t.status] || t.status
|
|
251
252
|
}),
|
|
252
|
-
|
|
253
|
+
t.productId && k[t.productId] && /* @__PURE__ */ m("span", {
|
|
253
254
|
className: "inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium bg-accent-purple-subtle text-accent-purple",
|
|
254
|
-
title: `Product: ${
|
|
255
|
-
children:
|
|
255
|
+
title: `Product: ${k[t.productId]}`,
|
|
256
|
+
children: k[t.productId]
|
|
257
|
+
}),
|
|
258
|
+
t.category && /* @__PURE__ */ m("span", {
|
|
259
|
+
className: "inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium bg-accent-blue-subtle text-accent-blue",
|
|
260
|
+
children: e(t.category)
|
|
256
261
|
})
|
|
257
262
|
]
|
|
258
263
|
}),
|
|
259
|
-
/* @__PURE__ */
|
|
264
|
+
/* @__PURE__ */ h("p", {
|
|
260
265
|
className: "text-sm text-text-secondary mb-1",
|
|
261
266
|
children: [
|
|
262
|
-
/* @__PURE__ */
|
|
267
|
+
/* @__PURE__ */ m("span", {
|
|
263
268
|
className: "font-medium",
|
|
264
|
-
children:
|
|
269
|
+
children: t.name
|
|
265
270
|
}),
|
|
266
|
-
/* @__PURE__ */
|
|
271
|
+
/* @__PURE__ */ m("span", {
|
|
267
272
|
className: "mx-1.5 text-text-secondary/50",
|
|
268
273
|
children: "·"
|
|
269
274
|
}),
|
|
270
|
-
/* @__PURE__ */
|
|
271
|
-
|
|
275
|
+
/* @__PURE__ */ m("span", { children: t.email }),
|
|
276
|
+
t.company && /* @__PURE__ */ h(p, { children: [/* @__PURE__ */ m("span", {
|
|
272
277
|
className: "mx-1.5 text-text-secondary/50",
|
|
273
278
|
children: "·"
|
|
274
|
-
}), /* @__PURE__ */
|
|
279
|
+
}), /* @__PURE__ */ m("span", { children: t.company })] })
|
|
275
280
|
]
|
|
276
281
|
}),
|
|
277
|
-
/* @__PURE__ */
|
|
282
|
+
/* @__PURE__ */ m("p", {
|
|
278
283
|
className: "text-xs text-text-secondary truncate",
|
|
279
|
-
children:
|
|
284
|
+
children: t.message
|
|
280
285
|
})
|
|
281
286
|
]
|
|
282
|
-
}), /* @__PURE__ */
|
|
287
|
+
}), /* @__PURE__ */ m("div", {
|
|
283
288
|
className: "text-xs text-text-secondary whitespace-nowrap",
|
|
284
|
-
children:
|
|
289
|
+
children: v(t.createdAt)
|
|
285
290
|
})]
|
|
286
291
|
})
|
|
287
|
-
},
|
|
288
|
-
}),
|
|
292
|
+
}, t.id))
|
|
293
|
+
}), R && /* @__PURE__ */ m("div", {
|
|
289
294
|
className: "flex justify-center mt-6",
|
|
290
|
-
children: /* @__PURE__ */
|
|
295
|
+
children: /* @__PURE__ */ h("button", {
|
|
291
296
|
onClick: () => {
|
|
292
|
-
|
|
293
|
-
variables: { offset:
|
|
297
|
+
R && F({
|
|
298
|
+
variables: { offset: I.length },
|
|
294
299
|
updateQuery: (e, { fetchMoreResult: t }) => t ? { contactInquiries: {
|
|
295
300
|
...t.contactInquiries,
|
|
296
301
|
items: [...e.contactInquiries?.items ?? [], ...t.contactInquiries?.items ?? []]
|
|
297
302
|
} } : e
|
|
298
303
|
});
|
|
299
304
|
},
|
|
300
|
-
disabled:
|
|
305
|
+
disabled: N,
|
|
301
306
|
className: "inline-flex items-center gap-2 px-6 py-2 bg-surface border border-default rounded-lg text-sm text-text-secondary hover:text-text-primary hover:bg-muted transition-colors disabled:opacity-50",
|
|
302
|
-
children: [
|
|
307
|
+
children: [N ? /* @__PURE__ */ m(s, {
|
|
303
308
|
size: 14,
|
|
304
309
|
className: "animate-spin"
|
|
305
310
|
}) : null, "Load more"]
|
|
@@ -309,6 +314,6 @@ function v() {
|
|
|
309
314
|
});
|
|
310
315
|
}
|
|
311
316
|
//#endregion
|
|
312
|
-
export {
|
|
317
|
+
export { y as ContactInquiriesPage };
|
|
313
318
|
|
|
314
319
|
//# sourceMappingURL=ContactInquiriesPage.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContactInquiriesPage.js","names":[],"sources":["../../../src/support/pages/ContactInquiriesPage.tsx"],"sourcesContent":["import { useState, useEffect } from 'react';\nimport { useNavigate, useLocation } from 'react-router-dom';\nimport { Mail, Search, Filter, Loader2, AlertCircle, ChevronDown } from 'lucide-react';\nimport { graphqlFetch } from '@burdenoff/fe-libs/shared/graphql/fetch';\nimport {\n useGetContactInquiriesQuery,\n type GetContactInquiriesQuery,\n} from '../../generated/global-operations';\nimport type { ContactInquiryStatus, ContactInquiryFilterInput } from '../../generated/global-types';\n\ntype ContactInquiry = GetContactInquiriesQuery['contactInquiries']['items'][number];\n\nconst statusColors: Record<string, string> = {\n NEW: 'bg-status-info-bg-subtle text-status-info-text',\n REVIEWED: 'bg-status-warning-bg-subtle text-status-warning-text',\n CONVERTED: 'bg-status-success-bg-subtle text-status-success-text',\n SPAM: 'bg-status-error-bg-subtle text-status-error-text',\n ARCHIVED: 'bg-bg-sunken text-text-secondary',\n};\n\nconst statusLabels: Record<string, string> = {\n NEW: 'New',\n REVIEWED: 'Reviewed',\n CONVERTED: 'Converted',\n SPAM: 'Spam',\n ARCHIVED: 'Archived',\n};\n\nfunction formatDate(dateString: string): string {\n return new Date(dateString).toLocaleDateString('en-US', {\n month: 'short',\n day: 'numeric',\n year: 'numeric',\n hour: '2-digit',\n minute: '2-digit',\n });\n}\n\nexport function ContactInquiriesPage() {\n const navigate = useNavigate();\n const location = useLocation();\n const queryParams = location.search;\n const [search, setSearch] = useState('');\n const [statusFilter, setStatusFilter] = useState<ContactInquiryStatus | ''>('');\n const [productFilter, setProductFilter] = useState('');\n const [showFilters, setShowFilters] = useState(false);\n const [productNames, setProductNames] = useState<Record<string, string>>({});\n\n const filter: ContactInquiryFilterInput = {};\n if (search) filter.search = search;\n if (statusFilter) filter.status = statusFilter;\n if (productFilter) filter.productId = productFilter;\n\n const { data, loading, error, fetchMore } = useGetContactInquiriesQuery({\n variables: { filter, limit: 50, offset: 0 },\n fetchPolicy: 'cache-and-network',\n });\n\n const inquiries = data?.contactInquiries?.items ?? [];\n const total = data?.contactInquiries?.total ?? 0;\n const hasMore = data?.contactInquiries?.hasMore ?? false;\n\n // Fetch product names for the filter dropdown\n const productIds = Array.from(\n new Set(inquiries.map((i: ContactInquiry) => i.productId).filter(Boolean))\n ) as string[];\n useEffect(() => {\n const unknownIds = productIds.filter((pid) => !productNames[pid]);\n if (unknownIds.length === 0) return;\n unknownIds.forEach((pid) => {\n graphqlFetch<{ platformProduct?: { name?: string } }>({\n gateway: 'global',\n query: 'query($id: ID!) { platformProduct(id: $id) { name } }',\n variables: { id: pid },\n })\n .then((result) => {\n const name = result.data?.platformProduct?.name;\n if (name) setProductNames((prev) => ({ ...prev, [pid]: name }));\n })\n .catch(() => {});\n });\n }, [productIds.join(',')]); // eslint-disable-line react-hooks/exhaustive-deps\n\n const loadMore = () => {\n if (!hasMore) return;\n fetchMore({\n variables: { offset: inquiries.length },\n updateQuery: (prev, { fetchMoreResult }) => {\n if (!fetchMoreResult) return prev;\n return {\n contactInquiries: {\n ...fetchMoreResult.contactInquiries,\n items: [\n ...(prev.contactInquiries?.items ?? []),\n ...(fetchMoreResult.contactInquiries?.items ?? []),\n ],\n },\n };\n },\n });\n };\n\n // Loading state\n if (loading && inquiries.length === 0) {\n return (\n <div className=\"p-6\">\n <div className=\"flex items-center gap-3 mb-6\">\n <Mail size={24} className=\"text-text-primary\" />\n <h1 className=\"text-2xl font-bold text-text-primary\">Contact Inquiries</h1>\n </div>\n <div className=\"flex flex-col items-center justify-center py-16\">\n <Loader2 size={32} className=\"animate-spin text-text-secondary mb-4\" />\n <p className=\"text-sm text-text-secondary\">Loading inquiries...</p>\n </div>\n </div>\n );\n }\n\n // Error state\n if (error) {\n return (\n <div className=\"p-6\">\n <div className=\"flex items-center gap-3 mb-6\">\n <Mail size={24} className=\"text-text-primary\" />\n <h1 className=\"text-2xl font-bold text-text-primary\">Contact Inquiries</h1>\n </div>\n <div className=\"flex flex-col items-center justify-center py-16 text-center\">\n <div className=\"p-4 rounded-2xl bg-status-error-bg-subtle text-status-error-text mb-4\">\n <AlertCircle size={48} />\n </div>\n <h3 className=\"text-lg font-semibold text-text-primary mb-2\">Failed to load inquiries</h3>\n <p className=\"text-sm text-text-secondary\">{error.message}</p>\n </div>\n </div>\n );\n }\n\n return (\n <div className=\"p-6\">\n {/* Header */}\n <div className=\"flex items-center justify-between mb-6\">\n <div className=\"flex items-center gap-3\">\n <Mail size={24} className=\"text-text-primary\" />\n <div>\n <h1 className=\"text-2xl font-bold text-text-primary\">Contact Inquiries</h1>\n <p className=\"text-sm text-text-secondary\">Website contact form submissions</p>\n </div>\n <span className=\"ml-2 inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-muted text-text-secondary\">\n {total}\n </span>\n </div>\n </div>\n\n {/* Toolbar */}\n <div className=\"flex flex-col sm:flex-row gap-3 mb-6\">\n {/* Search */}\n <div className=\"relative flex-1\">\n <Search\n size={16}\n className=\"absolute left-3 top-1/2 -translate-y-1/2 text-text-secondary\"\n />\n <input\n type=\"text\"\n placeholder=\"Search by name, email, or subject...\"\n value={search}\n onChange={(e) => setSearch(e.target.value)}\n className=\"w-full pl-9 pr-4 py-2 bg-surface border border-default rounded-lg text-sm text-text-primary placeholder:text-text-secondary focus:outline-none focus:ring-2 focus:ring-accent/50\"\n />\n </div>\n\n {/* Filter toggle */}\n <button\n onClick={() => setShowFilters(!showFilters)}\n className=\"inline-flex items-center gap-2 px-4 py-2 bg-surface border border-default rounded-lg text-sm text-text-secondary hover:text-text-primary hover:bg-muted transition-colors\"\n >\n <Filter size={16} />\n Filters\n <ChevronDown\n size={14}\n className={showFilters ? 'rotate-180 transition-transform' : 'transition-transform'}\n />\n </button>\n </div>\n\n {/* Filters panel */}\n {showFilters && (\n <div className=\"mb-6 p-4 bg-surface border border-default rounded-lg\">\n <div className=\"flex flex-wrap gap-4\">\n <div>\n <label className=\"block text-xs font-medium text-text-secondary mb-1\">Status</label>\n <select\n value={statusFilter}\n onChange={(e) => setStatusFilter(e.target.value as ContactInquiryStatus | '')}\n className=\"px-3 py-2 bg-surface border border-default rounded-lg text-sm text-text-primary focus:outline-none focus:ring-2 focus:ring-accent/50\"\n >\n <option value=\"\">All statuses</option>\n <option value=\"NEW\">New</option>\n <option value=\"REVIEWED\">Reviewed</option>\n <option value=\"CONVERTED\">Converted</option>\n <option value=\"SPAM\">Spam</option>\n <option value=\"ARCHIVED\">Archived</option>\n </select>\n </div>\n <div>\n <label className=\"block text-xs font-medium text-text-secondary mb-1\">Product</label>\n <select\n value={productFilter}\n onChange={(e) => setProductFilter(e.target.value)}\n className=\"px-3 py-2 bg-surface border border-default rounded-lg text-sm text-text-primary focus:outline-none focus:ring-2 focus:ring-accent/50\"\n >\n <option value=\"\">All products</option>\n {productIds.map((pid) => (\n <option key={pid} value={pid}>\n {productNames[pid] || pid}\n </option>\n ))}\n </select>\n </div>\n </div>\n </div>\n )}\n\n {/* Empty state */}\n {inquiries.length === 0 ? (\n <div className=\"flex flex-col items-center justify-center py-16 text-center\">\n <div className=\"p-4 rounded-2xl bg-muted mb-4\">\n <Mail size={48} className=\"text-text-secondary opacity-50\" />\n </div>\n <h3 className=\"text-lg font-semibold text-text-primary mb-2\">No inquiries yet</h3>\n <p className=\"text-sm text-text-secondary\">\n Contact form submissions from your product websites will appear here.\n </p>\n </div>\n ) : (\n <>\n {/* Inquiry list */}\n <div className=\"space-y-3\">\n {inquiries.map((inquiry: ContactInquiry) => (\n <button\n key={inquiry.id}\n onClick={() => navigate(`/support/inquiries/${inquiry.id}${queryParams}`)}\n className=\"w-full text-left p-4 bg-surface border border-default rounded-lg hover:bg-muted/50 hover:border-accent/30 transition-all duration-200 group\"\n >\n <div className=\"flex items-start justify-between gap-4\">\n <div className=\"flex-1 min-w-0\">\n <div className=\"flex items-center gap-2 mb-1\">\n <h3 className=\"text-sm font-semibold text-text-primary truncate group-hover:text-accent transition-colors\">\n {inquiry.subject}\n </h3>\n <span\n className={`inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium ${statusColors[inquiry.status] || statusColors.NEW}`}\n >\n {statusLabels[inquiry.status] || inquiry.status}\n </span>\n {inquiry.productId && productNames[inquiry.productId] && (\n <span\n className=\"inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium bg-accent-purple-subtle text-accent-purple\"\n title={`Product: ${productNames[inquiry.productId]}`}\n >\n {productNames[inquiry.productId]}\n </span>\n )}\n </div>\n <p className=\"text-sm text-text-secondary mb-1\">\n <span className=\"font-medium\">{inquiry.name}</span>\n <span className=\"mx-1.5 text-text-secondary/50\">·</span>\n <span>{inquiry.email}</span>\n {inquiry.company && (\n <>\n <span className=\"mx-1.5 text-text-secondary/50\">·</span>\n <span>{inquiry.company}</span>\n </>\n )}\n </p>\n <p className=\"text-xs text-text-secondary truncate\">{inquiry.message}</p>\n </div>\n <div className=\"text-xs text-text-secondary whitespace-nowrap\">\n {formatDate(inquiry.createdAt)}\n </div>\n </div>\n </button>\n ))}\n </div>\n\n {/* Load more */}\n {hasMore && (\n <div className=\"flex justify-center mt-6\">\n <button\n onClick={loadMore}\n disabled={loading}\n className=\"inline-flex items-center gap-2 px-6 py-2 bg-surface border border-default rounded-lg text-sm text-text-secondary hover:text-text-primary hover:bg-muted transition-colors disabled:opacity-50\"\n >\n {loading ? <Loader2 size={14} className=\"animate-spin\" /> : null}\n Load more\n </button>\n </div>\n )}\n </>\n )}\n </div>\n );\n}\n"],"mappings":";;;;;;;AAYA,IAAM,IAAuC;CAC3C,KAAK;CACL,UAAU;CACV,WAAW;CACX,MAAM;CACN,UAAU;CACX,EAEK,IAAuC;CAC3C,KAAK;CACL,UAAU;CACV,WAAW;CACX,MAAM;CACN,UAAU;CACX;AAED,SAAS,EAAW,GAA4B;AAC9C,QAAO,IAAI,KAAK,EAAW,CAAC,mBAAmB,SAAS;EACtD,OAAO;EACP,KAAK;EACL,MAAM;EACN,MAAM;EACN,QAAQ;EACT,CAAC;;AAGJ,SAAgB,IAAuB;CACrC,IAAM,IAAW,GAAa,EAExB,IADW,GAAa,CACD,QACvB,CAAC,GAAQ,KAAa,EAAS,GAAG,EAClC,CAAC,GAAc,KAAmB,EAAoC,GAAG,EACzE,CAAC,GAAe,KAAoB,EAAS,GAAG,EAChD,CAAC,GAAa,KAAkB,EAAS,GAAM,EAC/C,CAAC,GAAc,KAAmB,EAAiC,EAAE,CAAC,EAEtE,IAAoC,EAAE;AAG5C,CAFI,MAAQ,EAAO,SAAS,IACxB,MAAc,EAAO,SAAS,IAC9B,MAAe,EAAO,YAAY;CAEtC,IAAM,EAAE,SAAM,YAAS,UAAO,iBAAc,EAA4B;EACtE,WAAW;GAAE;GAAQ,OAAO;GAAI,QAAQ;GAAG;EAC3C,aAAa;EACd,CAAC,EAEI,IAAY,GAAM,kBAAkB,SAAS,EAAE,EAC/C,IAAQ,GAAM,kBAAkB,SAAS,GACzC,IAAU,GAAM,kBAAkB,WAAW,IAG7C,IAAa,MAAM,KACvB,IAAI,IAAI,EAAU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/pages/ContactInquiriesPage.tsx"],"sourcesContent":["import { useState, useEffect } from 'react';\nimport { useNavigate, useLocation } from 'react-router-dom';\nimport { Mail, Search, Filter, Loader2, AlertCircle, ChevronDown } from 'lucide-react';\nimport { graphqlFetch } from '@burdenoff/fe-libs/shared/graphql/fetch';\nimport {\n useGetContactInquiriesQuery,\n type GetContactInquiriesQuery,\n} from '../../generated/global-operations';\nimport type { ContactInquiryStatus, ContactInquiryFilterInput } from '../../generated/global-types';\nimport { humanizeCategory } from '../utils';\n\ntype ContactInquiry = GetContactInquiriesQuery['contactInquiries']['items'][number];\n\nconst statusColors: Record<string, string> = {\n NEW: 'bg-status-info-bg-subtle text-status-info-text',\n REVIEWED: 'bg-status-warning-bg-subtle text-status-warning-text',\n CONVERTED: 'bg-status-success-bg-subtle text-status-success-text',\n SPAM: 'bg-status-error-bg-subtle text-status-error-text',\n ARCHIVED: 'bg-bg-sunken text-text-secondary',\n};\n\nconst statusLabels: Record<string, string> = {\n NEW: 'New',\n REVIEWED: 'Reviewed',\n CONVERTED: 'Converted',\n SPAM: 'Spam',\n ARCHIVED: 'Archived',\n};\n\nfunction formatDate(dateString: string): string {\n return new Date(dateString).toLocaleDateString('en-US', {\n month: 'short',\n day: 'numeric',\n year: 'numeric',\n hour: '2-digit',\n minute: '2-digit',\n });\n}\n\nexport function ContactInquiriesPage() {\n const navigate = useNavigate();\n const location = useLocation();\n const queryParams = location.search;\n const [search, setSearch] = useState('');\n const [statusFilter, setStatusFilter] = useState<ContactInquiryStatus | ''>('');\n const [productFilter, setProductFilter] = useState('');\n const [showFilters, setShowFilters] = useState(false);\n const [productNames, setProductNames] = useState<Record<string, string>>({});\n\n const filter: ContactInquiryFilterInput = {};\n if (search) filter.search = search;\n if (statusFilter) filter.status = statusFilter;\n if (productFilter) filter.productId = productFilter;\n\n const { data, loading, error, fetchMore } = useGetContactInquiriesQuery({\n variables: { filter, limit: 50, offset: 0 },\n fetchPolicy: 'cache-and-network',\n });\n\n const inquiries = data?.contactInquiries?.items ?? [];\n const total = data?.contactInquiries?.total ?? 0;\n const hasMore = data?.contactInquiries?.hasMore ?? false;\n\n // Fetch product names for the filter dropdown\n const productIds = Array.from(\n new Set(inquiries.map((i: ContactInquiry) => i.productId).filter(Boolean))\n ) as string[];\n useEffect(() => {\n const unknownIds = productIds.filter((pid) => !productNames[pid]);\n if (unknownIds.length === 0) return;\n unknownIds.forEach((pid) => {\n graphqlFetch<{ platformProduct?: { name?: string } }>({\n gateway: 'global',\n query: 'query($id: ID!) { platformProduct(id: $id) { name } }',\n variables: { id: pid },\n })\n .then((result) => {\n const name = result.data?.platformProduct?.name;\n if (name) setProductNames((prev) => ({ ...prev, [pid]: name }));\n })\n .catch(() => {});\n });\n }, [productIds.join(',')]); // eslint-disable-line react-hooks/exhaustive-deps\n\n const loadMore = () => {\n if (!hasMore) return;\n fetchMore({\n variables: { offset: inquiries.length },\n updateQuery: (prev, { fetchMoreResult }) => {\n if (!fetchMoreResult) return prev;\n return {\n contactInquiries: {\n ...fetchMoreResult.contactInquiries,\n items: [\n ...(prev.contactInquiries?.items ?? []),\n ...(fetchMoreResult.contactInquiries?.items ?? []),\n ],\n },\n };\n },\n });\n };\n\n // Loading state\n if (loading && inquiries.length === 0) {\n return (\n <div className=\"p-6\">\n <div className=\"flex items-center gap-3 mb-6\">\n <Mail size={24} className=\"text-text-primary\" />\n <h1 className=\"text-2xl font-bold text-text-primary\">Contact Inquiries</h1>\n </div>\n <div className=\"flex flex-col items-center justify-center py-16\">\n <Loader2 size={32} className=\"animate-spin text-text-secondary mb-4\" />\n <p className=\"text-sm text-text-secondary\">Loading inquiries...</p>\n </div>\n </div>\n );\n }\n\n // Error state\n if (error) {\n return (\n <div className=\"p-6\">\n <div className=\"flex items-center gap-3 mb-6\">\n <Mail size={24} className=\"text-text-primary\" />\n <h1 className=\"text-2xl font-bold text-text-primary\">Contact Inquiries</h1>\n </div>\n <div className=\"flex flex-col items-center justify-center py-16 text-center\">\n <div className=\"p-4 rounded-2xl bg-status-error-bg-subtle text-status-error-text mb-4\">\n <AlertCircle size={48} />\n </div>\n <h3 className=\"text-lg font-semibold text-text-primary mb-2\">Failed to load inquiries</h3>\n <p className=\"text-sm text-text-secondary\">{error.message}</p>\n </div>\n </div>\n );\n }\n\n return (\n <div className=\"p-6\">\n {/* Header */}\n <div className=\"flex items-center justify-between mb-6\">\n <div className=\"flex items-center gap-3\">\n <Mail size={24} className=\"text-text-primary\" />\n <div>\n <h1 className=\"text-2xl font-bold text-text-primary\">Contact Inquiries</h1>\n <p className=\"text-sm text-text-secondary\">Website contact form submissions</p>\n </div>\n <span className=\"ml-2 inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-muted text-text-secondary\">\n {total}\n </span>\n </div>\n </div>\n\n {/* Toolbar */}\n <div className=\"flex flex-col sm:flex-row gap-3 mb-6\">\n {/* Search */}\n <div className=\"relative flex-1\">\n <Search\n size={16}\n className=\"absolute left-3 top-1/2 -translate-y-1/2 text-text-secondary\"\n />\n <input\n type=\"text\"\n placeholder=\"Search by name, email, or subject...\"\n value={search}\n onChange={(e) => setSearch(e.target.value)}\n className=\"w-full pl-9 pr-4 py-2 bg-surface border border-default rounded-lg text-sm text-text-primary placeholder:text-text-secondary focus:outline-none focus:ring-2 focus:ring-accent/50\"\n />\n </div>\n\n {/* Filter toggle */}\n <button\n onClick={() => setShowFilters(!showFilters)}\n className=\"inline-flex items-center gap-2 px-4 py-2 bg-surface border border-default rounded-lg text-sm text-text-secondary hover:text-text-primary hover:bg-muted transition-colors\"\n >\n <Filter size={16} />\n Filters\n <ChevronDown\n size={14}\n className={showFilters ? 'rotate-180 transition-transform' : 'transition-transform'}\n />\n </button>\n </div>\n\n {/* Filters panel */}\n {showFilters && (\n <div className=\"mb-6 p-4 bg-surface border border-default rounded-lg\">\n <div className=\"flex flex-wrap gap-4\">\n <div>\n <label className=\"block text-xs font-medium text-text-secondary mb-1\">Status</label>\n <select\n value={statusFilter}\n onChange={(e) => setStatusFilter(e.target.value as ContactInquiryStatus | '')}\n className=\"px-3 py-2 bg-surface border border-default rounded-lg text-sm text-text-primary focus:outline-none focus:ring-2 focus:ring-accent/50\"\n >\n <option value=\"\">All statuses</option>\n <option value=\"NEW\">New</option>\n <option value=\"REVIEWED\">Reviewed</option>\n <option value=\"CONVERTED\">Converted</option>\n <option value=\"SPAM\">Spam</option>\n <option value=\"ARCHIVED\">Archived</option>\n </select>\n </div>\n <div>\n <label className=\"block text-xs font-medium text-text-secondary mb-1\">Product</label>\n <select\n value={productFilter}\n onChange={(e) => setProductFilter(e.target.value)}\n className=\"px-3 py-2 bg-surface border border-default rounded-lg text-sm text-text-primary focus:outline-none focus:ring-2 focus:ring-accent/50\"\n >\n <option value=\"\">All products</option>\n {productIds.map((pid) => (\n <option key={pid} value={pid}>\n {productNames[pid] || pid}\n </option>\n ))}\n </select>\n </div>\n </div>\n </div>\n )}\n\n {/* Empty state */}\n {inquiries.length === 0 ? (\n <div className=\"flex flex-col items-center justify-center py-16 text-center\">\n <div className=\"p-4 rounded-2xl bg-muted mb-4\">\n <Mail size={48} className=\"text-text-secondary opacity-50\" />\n </div>\n <h3 className=\"text-lg font-semibold text-text-primary mb-2\">No inquiries yet</h3>\n <p className=\"text-sm text-text-secondary\">\n Contact form submissions from your product websites will appear here.\n </p>\n </div>\n ) : (\n <>\n {/* Inquiry list */}\n <div className=\"space-y-3\">\n {inquiries.map((inquiry: ContactInquiry) => (\n <button\n key={inquiry.id}\n onClick={() => navigate(`/support/inquiries/${inquiry.id}${queryParams}`)}\n className=\"w-full text-left p-4 bg-surface border border-default rounded-lg hover:bg-muted/50 hover:border-accent/30 transition-all duration-200 group\"\n >\n <div className=\"flex items-start justify-between gap-4\">\n <div className=\"flex-1 min-w-0\">\n <div className=\"flex items-center gap-2 mb-1\">\n <h3 className=\"text-sm font-semibold text-text-primary truncate group-hover:text-accent transition-colors\">\n {inquiry.subject}\n </h3>\n <span\n className={`inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium ${statusColors[inquiry.status] || statusColors.NEW}`}\n >\n {statusLabels[inquiry.status] || inquiry.status}\n </span>\n {inquiry.productId && productNames[inquiry.productId] && (\n <span\n className=\"inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium bg-accent-purple-subtle text-accent-purple\"\n title={`Product: ${productNames[inquiry.productId]}`}\n >\n {productNames[inquiry.productId]}\n </span>\n )}\n {inquiry.category && (\n <span className=\"inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium bg-accent-blue-subtle text-accent-blue\">\n {humanizeCategory(inquiry.category)}\n </span>\n )}\n </div>\n <p className=\"text-sm text-text-secondary mb-1\">\n <span className=\"font-medium\">{inquiry.name}</span>\n <span className=\"mx-1.5 text-text-secondary/50\">·</span>\n <span>{inquiry.email}</span>\n {inquiry.company && (\n <>\n <span className=\"mx-1.5 text-text-secondary/50\">·</span>\n <span>{inquiry.company}</span>\n </>\n )}\n </p>\n <p className=\"text-xs text-text-secondary truncate\">{inquiry.message}</p>\n </div>\n <div className=\"text-xs text-text-secondary whitespace-nowrap\">\n {formatDate(inquiry.createdAt)}\n </div>\n </div>\n </button>\n ))}\n </div>\n\n {/* Load more */}\n {hasMore && (\n <div className=\"flex justify-center mt-6\">\n <button\n onClick={loadMore}\n disabled={loading}\n className=\"inline-flex items-center gap-2 px-6 py-2 bg-surface border border-default rounded-lg text-sm text-text-secondary hover:text-text-primary hover:bg-muted transition-colors disabled:opacity-50\"\n >\n {loading ? <Loader2 size={14} className=\"animate-spin\" /> : null}\n Load more\n </button>\n </div>\n )}\n </>\n )}\n </div>\n );\n}\n"],"mappings":";;;;;;;;AAaA,IAAM,IAAuC;CAC3C,KAAK;CACL,UAAU;CACV,WAAW;CACX,MAAM;CACN,UAAU;CACX,EAEK,IAAuC;CAC3C,KAAK;CACL,UAAU;CACV,WAAW;CACX,MAAM;CACN,UAAU;CACX;AAED,SAAS,EAAW,GAA4B;AAC9C,QAAO,IAAI,KAAK,EAAW,CAAC,mBAAmB,SAAS;EACt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