@burdenoff/microfe-support 2026.625.2 → 2026.715.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.d.ts +2517 -0
- package/dist/generated/global-types.d.ts +22913 -0
- package/dist/generated/wspace-operations.d.ts +1 -0
- package/dist/generated/wspace-types.d.ts +57850 -0
- package/dist/index.d.ts +5 -0
- package/dist/support/SupportAdminRoot.d.ts +20 -0
- package/dist/support/SupportAdminRoutes.d.ts +13 -0
- package/dist/support/SupportUserRoot.d.ts +17 -0
- package/dist/support/SupportUserRoutes.d.ts +11 -0
- package/dist/support/components/NotificationToast.d.ts +17 -0
- package/dist/support/components/PageLayout.d.ts +71 -0
- package/dist/support/components/RouteHelpers.d.ts +9 -0
- package/dist/support/components/analytics/CategoryBreakdown.d.ts +9 -0
- package/dist/support/components/analytics/MetricCard.d.ts +10 -0
- package/dist/support/components/analytics/PriorityBreakdown.d.ts +9 -0
- package/dist/support/components/analytics/SLAReport.d.ts +23 -0
- package/dist/support/components/analytics/SatisfactionDistribution.d.ts +23 -0
- package/dist/support/components/analytics/TopAgents.d.ts +19 -0
- package/dist/support/components/analytics/TrendChart.d.ts +15 -0
- package/dist/support/components/kb/ArticleForm.d.ts +25 -0
- package/dist/support/components/settings/CannedResponsesSettings.d.ts +21 -0
- package/dist/support/components/settings/SLAPoliciesSettings.d.ts +18 -0
- package/dist/support/components/settings/TicketCategoriesSettings.d.ts +20 -0
- package/dist/support/components/tickets/AttachmentList.d.ts +7 -0
- package/dist/support/components/tickets/MarkdownContent.d.ts +7 -0
- package/dist/support/components/tickets/MessageComposer.d.ts +22 -0
- package/dist/support/components/tickets/MessageThread.d.ts +12 -0
- package/dist/support/components/tickets/TicketDetailHeader.d.ts +16 -0
- package/dist/support/components/tickets/TicketHeader.d.ts +9 -0
- package/dist/support/components/tickets/TicketSidebar.d.ts +7 -0
- package/dist/support/components/ui.d.ts +5 -0
- package/dist/support/components/ui.js +2 -2
- package/dist/support/constants.d.ts +20 -0
- package/dist/support/events/rybbit.d.ts +13 -0
- package/dist/support/hooks/index.d.ts +5 -0
- package/dist/support/hooks/useAnalyticsOperations.d.ts +51 -0
- package/dist/support/hooks/useAttachmentsFailedToast.d.ts +2 -0
- package/dist/support/hooks/useChatOperations.d.ts +27 -0
- package/dist/support/hooks/useKnowledgeBaseOperations.d.ts +55 -0
- package/dist/support/hooks/useNotification.d.ts +20 -0
- package/dist/support/hooks/useRegisterFooter.d.ts +6 -0
- package/dist/support/hooks/useSettingsOperations.d.ts +47 -0
- package/dist/support/hooks/useSupportAttachments.d.ts +10 -0
- package/dist/support/hooks/useTicketListOperations.d.ts +31 -0
- package/dist/support/hooks/useTicketOperations.d.ts +39 -0
- package/dist/support/index.d.ts +44 -0
- package/dist/support/pages/AnalyticsPage.d.ts +1 -0
- package/dist/support/pages/AnalyticsPage.js +144 -113
- package/dist/support/pages/AnalyticsPage.js.map +1 -1
- package/dist/support/pages/ArticleDetailAdminPage.d.ts +7 -0
- package/dist/support/pages/ArticleDetailAdminPage.js +150 -113
- package/dist/support/pages/ArticleDetailAdminPage.js.map +1 -1
- package/dist/support/pages/ArticleDetailUserPage.d.ts +7 -0
- package/dist/support/pages/ArticleDetailUserPage.js +90 -83
- package/dist/support/pages/ArticleDetailUserPage.js.map +1 -1
- package/dist/support/pages/ContactInquiriesPage.d.ts +1 -0
- package/dist/support/pages/ContactInquiriesPage.js +48 -44
- package/dist/support/pages/ContactInquiriesPage.js.map +1 -1
- package/dist/support/pages/ContactInquiryDetailPage.d.ts +1 -0
- package/dist/support/pages/ContactInquiryDetailPage.js +225 -205
- package/dist/support/pages/ContactInquiryDetailPage.js.map +1 -1
- package/dist/support/pages/CreateArticlePage.d.ts +1 -0
- package/dist/support/pages/CreateArticlePage.js +50 -46
- package/dist/support/pages/CreateArticlePage.js.map +1 -1
- package/dist/support/pages/CreateTicketPage.d.ts +1 -0
- package/dist/support/pages/CreateTicketPage.js +122 -116
- package/dist/support/pages/CreateTicketPage.js.map +1 -1
- package/dist/support/pages/EditArticlePage.d.ts +1 -0
- package/dist/support/pages/EditArticlePage.js +76 -80
- package/dist/support/pages/EditArticlePage.js.map +1 -1
- package/dist/support/pages/JobApplicationDetailPage.d.ts +1 -0
- package/dist/support/pages/JobApplicationDetailPage.js +292 -269
- package/dist/support/pages/JobApplicationDetailPage.js.map +1 -1
- package/dist/support/pages/JobApplicationsPage.d.ts +1 -0
- package/dist/support/pages/JobApplicationsPage.js +50 -46
- package/dist/support/pages/JobApplicationsPage.js.map +1 -1
- package/dist/support/pages/KnowledgeBaseAdminPage.d.ts +7 -0
- package/dist/support/pages/KnowledgeBaseAdminPage.js +84 -81
- package/dist/support/pages/KnowledgeBaseAdminPage.js.map +1 -1
- package/dist/support/pages/KnowledgeBaseUserPage.d.ts +8 -0
- package/dist/support/pages/KnowledgeBaseUserPage.js +76 -75
- package/dist/support/pages/KnowledgeBaseUserPage.js.map +1 -1
- package/dist/support/pages/SettingsPage.d.ts +1 -0
- package/dist/support/pages/SettingsPage.js +215 -182
- package/dist/support/pages/SettingsPage.js.map +1 -1
- package/dist/support/pages/TicketDetailAdminPage.d.ts +8 -0
- package/dist/support/pages/TicketDetailAdminPage.js +158 -128
- package/dist/support/pages/TicketDetailAdminPage.js.map +1 -1
- package/dist/support/pages/TicketDetailUserPage.d.ts +8 -0
- package/dist/support/pages/TicketDetailUserPage.js +174 -141
- package/dist/support/pages/TicketDetailUserPage.js.map +1 -1
- package/dist/support/pages/TicketListPage.d.ts +11 -0
- package/dist/support/pages/TicketListPage.js +171 -170
- package/dist/support/pages/TicketListPage.js.map +1 -1
- package/dist/support/providers/SupportProvider.d.ts +16 -0
- package/dist/support/store/supportStore.d.ts +66 -0
- package/dist/support/types/index.d.ts +160 -0
- package/dist/support/utils/attachments.d.ts +27 -0
- package/dist/support/utils/categoryColors.d.ts +10 -0
- package/dist/support/utils/cn.d.ts +6 -0
- package/dist/support/utils/context.d.ts +2 -0
- package/dist/support/utils/errors.d.ts +2 -0
- package/dist/support/utils/i18n.d.ts +4 -0
- package/dist/support/utils/index.d.ts +57 -0
- package/dist/support/utils/markdown.d.ts +2 -0
- package/dist/support/utils/supportFiles.d.ts +15 -0
- package/dist/support/utils/ticketFilters.d.ts +6 -0
- package/dist/support/utils/uiTokens.d.ts +7 -0
- package/dist/utils/nativeBridge.d.ts +2 -0
- package/package.json +4 -4
|
@@ -5,22 +5,22 @@ import { AlertCircle as a, ChevronDown as o, Filter as s, Loader2 as c, Mail as
|
|
|
5
5
|
import { useLocation as d, useNavigate as f } from "react-router-dom";
|
|
6
6
|
import { graphqlFetch as p } from "@burdenoff/fe-libs/shared/graphql/fetch";
|
|
7
7
|
import { Fragment as m, jsx as h, jsxs as g } from "react/jsx-runtime";
|
|
8
|
-
import { IllustratedEmptyState as _ } from "@burdenoff/fe-libs/ui";
|
|
8
|
+
import { IllustratedEmptyState as _, PagePurpose as v } from "@burdenoff/fe-libs/ui";
|
|
9
9
|
//#region src/support/pages/ContactInquiriesPage.tsx
|
|
10
|
-
var
|
|
10
|
+
var y = {
|
|
11
11
|
NEW: "bg-status-info-bg-subtle text-status-info-text",
|
|
12
12
|
REVIEWED: "bg-status-warning-bg-subtle text-status-warning-text",
|
|
13
13
|
CONVERTED: "bg-status-success-bg-subtle text-status-success-text",
|
|
14
14
|
SPAM: "bg-status-error-bg-subtle text-status-error-text",
|
|
15
15
|
ARCHIVED: "bg-bg-sunken text-text-secondary"
|
|
16
|
-
},
|
|
16
|
+
}, b = {
|
|
17
17
|
NEW: "New",
|
|
18
18
|
REVIEWED: "Reviewed",
|
|
19
19
|
CONVERTED: "Converted",
|
|
20
20
|
SPAM: "Spam",
|
|
21
21
|
ARCHIVED: "Archived"
|
|
22
22
|
};
|
|
23
|
-
function
|
|
23
|
+
function x(e) {
|
|
24
24
|
return new Date(e).toLocaleDateString("en-US", {
|
|
25
25
|
month: "short",
|
|
26
26
|
day: "numeric",
|
|
@@ -29,21 +29,21 @@ function b(e) {
|
|
|
29
29
|
minute: "2-digit"
|
|
30
30
|
});
|
|
31
31
|
}
|
|
32
|
-
function
|
|
33
|
-
let
|
|
34
|
-
|
|
35
|
-
let
|
|
36
|
-
|
|
37
|
-
let { data:
|
|
32
|
+
function S() {
|
|
33
|
+
let S = f(), C = d().search, [w, T] = i(""), [E, D] = i(""), [O, k] = i(""), [A, j] = i(!1), [M, N] = i({}), P = r(M);
|
|
34
|
+
P.current = M;
|
|
35
|
+
let F = {};
|
|
36
|
+
w && (F.search = w), E && (F.status = E), O && (F.productId = O);
|
|
37
|
+
let { data: I, loading: L, error: R, fetchMore: z } = t({
|
|
38
38
|
variables: {
|
|
39
|
-
filter:
|
|
39
|
+
filter: F,
|
|
40
40
|
limit: 50,
|
|
41
41
|
offset: 0
|
|
42
42
|
},
|
|
43
43
|
fetchPolicy: "cache-and-network"
|
|
44
|
-
}),
|
|
44
|
+
}), B = I?.contactInquiries?.items ?? [], V = I?.contactInquiries?.total ?? 0, H = I?.contactInquiries?.hasMore ?? !1, U = Array.from(new Set(B.flatMap((e) => e.productId ? [e.productId] : []))).sort(), W = U.join(",");
|
|
45
45
|
return n(() => {
|
|
46
|
-
let e =
|
|
46
|
+
let e = W ? W.split(",").filter((e) => !P.current[e]) : [];
|
|
47
47
|
e.length !== 0 && e.forEach((e) => {
|
|
48
48
|
p({
|
|
49
49
|
gateway: "global",
|
|
@@ -51,13 +51,13 @@ function x() {
|
|
|
51
51
|
variables: { id: e }
|
|
52
52
|
}).then((t) => {
|
|
53
53
|
let n = t.data?.platformProduct?.name;
|
|
54
|
-
n &&
|
|
54
|
+
n && N((t) => ({
|
|
55
55
|
...t,
|
|
56
56
|
[e]: n
|
|
57
57
|
}));
|
|
58
58
|
}).catch(() => {});
|
|
59
59
|
});
|
|
60
|
-
}, [
|
|
60
|
+
}, [W]), L && B.length === 0 ? /* @__PURE__ */ g("div", {
|
|
61
61
|
className: "p-3 sm:p-6",
|
|
62
62
|
children: [/* @__PURE__ */ g("div", {
|
|
63
63
|
className: "flex items-center gap-3 mb-6",
|
|
@@ -78,7 +78,7 @@ function x() {
|
|
|
78
78
|
children: "Loading inquiries…"
|
|
79
79
|
})]
|
|
80
80
|
})]
|
|
81
|
-
}) :
|
|
81
|
+
}) : R ? /* @__PURE__ */ g("div", {
|
|
82
82
|
className: "p-3 sm:p-6",
|
|
83
83
|
children: [/* @__PURE__ */ g("div", {
|
|
84
84
|
className: "flex items-center gap-3 mb-6",
|
|
@@ -102,7 +102,7 @@ function x() {
|
|
|
102
102
|
}),
|
|
103
103
|
/* @__PURE__ */ h("p", {
|
|
104
104
|
className: "text-sm text-text-secondary",
|
|
105
|
-
children:
|
|
105
|
+
children: R.message
|
|
106
106
|
})
|
|
107
107
|
]
|
|
108
108
|
})]
|
|
@@ -127,11 +127,15 @@ function x() {
|
|
|
127
127
|
})] }),
|
|
128
128
|
/* @__PURE__ */ h("span", {
|
|
129
129
|
className: "ml-2 inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-bg-sunken text-text-secondary",
|
|
130
|
-
children:
|
|
130
|
+
children: V
|
|
131
131
|
})
|
|
132
132
|
]
|
|
133
133
|
})
|
|
134
134
|
}),
|
|
135
|
+
/* @__PURE__ */ h(v, {
|
|
136
|
+
className: "mb-6",
|
|
137
|
+
children: "Every message sent through your product websites' contact forms lands here. Triage sales and support leads, mark spam, and convert genuine inquiries into tickets so nothing from a prospective customer slips through the cracks. Open an inquiry to read it in full and take action."
|
|
138
|
+
}),
|
|
135
139
|
/* @__PURE__ */ g("div", {
|
|
136
140
|
className: "flex flex-col sm:flex-row gap-3 mb-6",
|
|
137
141
|
children: [/* @__PURE__ */ g("div", {
|
|
@@ -143,25 +147,25 @@ function x() {
|
|
|
143
147
|
type: "text",
|
|
144
148
|
"aria-label": "Search inquiries",
|
|
145
149
|
placeholder: "Search by name, email, or subject...",
|
|
146
|
-
value:
|
|
147
|
-
onChange: (e) =>
|
|
150
|
+
value: w,
|
|
151
|
+
onChange: (e) => T(e.target.value),
|
|
148
152
|
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"
|
|
149
153
|
})]
|
|
150
154
|
}), /* @__PURE__ */ g("button", {
|
|
151
155
|
type: "button",
|
|
152
|
-
onClick: () =>
|
|
156
|
+
onClick: () => j(!A),
|
|
153
157
|
className: "min-h-11 inline-flex items-center justify-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-bg-sunken transition-colors",
|
|
154
158
|
children: [
|
|
155
159
|
/* @__PURE__ */ h(s, { size: 16 }),
|
|
156
160
|
"Filters",
|
|
157
161
|
/* @__PURE__ */ h(o, {
|
|
158
162
|
size: 14,
|
|
159
|
-
className:
|
|
163
|
+
className: A ? "rotate-180 transition-transform" : "transition-transform"
|
|
160
164
|
})
|
|
161
165
|
]
|
|
162
166
|
})]
|
|
163
167
|
}),
|
|
164
|
-
|
|
168
|
+
A && /* @__PURE__ */ h("div", {
|
|
165
169
|
className: "mb-6 p-4 bg-bg-surface border border-border-seam rounded-lg",
|
|
166
170
|
children: /* @__PURE__ */ g("div", {
|
|
167
171
|
className: "grid grid-cols-1 gap-4 sm:grid-cols-2",
|
|
@@ -171,8 +175,8 @@ function x() {
|
|
|
171
175
|
children: "Status"
|
|
172
176
|
}), /* @__PURE__ */ g("select", {
|
|
173
177
|
id: "contactinquiriespage-status-0",
|
|
174
|
-
value:
|
|
175
|
-
onChange: (e) =>
|
|
178
|
+
value: E,
|
|
179
|
+
onChange: (e) => D(e.target.value),
|
|
176
180
|
className: "min-h-11 w-full 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",
|
|
177
181
|
children: [
|
|
178
182
|
/* @__PURE__ */ h("option", {
|
|
@@ -206,28 +210,28 @@ function x() {
|
|
|
206
210
|
children: "Product"
|
|
207
211
|
}), /* @__PURE__ */ g("select", {
|
|
208
212
|
id: "contactinquiriespage-product-2",
|
|
209
|
-
value:
|
|
210
|
-
onChange: (e) =>
|
|
213
|
+
value: O,
|
|
214
|
+
onChange: (e) => k(e.target.value),
|
|
211
215
|
className: "min-h-11 w-full 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",
|
|
212
216
|
children: [/* @__PURE__ */ h("option", {
|
|
213
217
|
value: "",
|
|
214
218
|
children: "All products"
|
|
215
|
-
}),
|
|
219
|
+
}), U.map((e) => /* @__PURE__ */ h("option", {
|
|
216
220
|
value: e,
|
|
217
|
-
children:
|
|
221
|
+
children: M[e] || e
|
|
218
222
|
}, e))]
|
|
219
223
|
})] })]
|
|
220
224
|
})
|
|
221
225
|
}),
|
|
222
|
-
|
|
226
|
+
B.length === 0 ? /* @__PURE__ */ h(_, {
|
|
223
227
|
illustration: "empty-notifications",
|
|
224
228
|
title: "No inquiries yet",
|
|
225
229
|
description: "Contact form submissions from your product websites will appear here."
|
|
226
230
|
}) : /* @__PURE__ */ g(m, { children: [/* @__PURE__ */ h("div", {
|
|
227
231
|
className: "space-y-3",
|
|
228
|
-
children:
|
|
232
|
+
children: B.map((t) => /* @__PURE__ */ h("button", {
|
|
229
233
|
type: "button",
|
|
230
|
-
onClick: () =>
|
|
234
|
+
onClick: () => S(`/support/inquiries/${t.id}${C}`),
|
|
231
235
|
className: "w-full text-left p-4 bg-bg-surface border border-border-seam rounded-lg shadow-[var(--shadow-pop)] hover:border-border-strong hover:shadow-[var(--shadow-pop-hover)] transition-[box-shadow,border-color] duration-200 group",
|
|
232
236
|
children: /* @__PURE__ */ g("div", {
|
|
233
237
|
className: "flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between",
|
|
@@ -242,13 +246,13 @@ function x() {
|
|
|
242
246
|
children: t.subject
|
|
243
247
|
}),
|
|
244
248
|
/* @__PURE__ */ h("span", {
|
|
245
|
-
className: `inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium ${
|
|
246
|
-
children:
|
|
249
|
+
className: `inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium ${y[t.status] || y.NEW} ${t.status === "NEW" ? "motion-safe:animate-vc-glow-pulse" : ""}`,
|
|
250
|
+
children: b[t.status] || t.status
|
|
247
251
|
}),
|
|
248
|
-
t.productId &&
|
|
252
|
+
t.productId && M[t.productId] && /* @__PURE__ */ h("span", {
|
|
249
253
|
className: "inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium bg-accent-purple-subtle text-accent-purple",
|
|
250
|
-
title: `Product: ${
|
|
251
|
-
children:
|
|
254
|
+
title: `Product: ${M[t.productId]}`,
|
|
255
|
+
children: M[t.productId]
|
|
252
256
|
}),
|
|
253
257
|
t.category && /* @__PURE__ */ h("span", {
|
|
254
258
|
className: "inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium bg-accent-blue-subtle text-accent-blue",
|
|
@@ -281,26 +285,26 @@ function x() {
|
|
|
281
285
|
]
|
|
282
286
|
}), /* @__PURE__ */ h("div", {
|
|
283
287
|
className: "text-xs text-text-secondary sm:whitespace-nowrap",
|
|
284
|
-
children:
|
|
288
|
+
children: x(t.createdAt)
|
|
285
289
|
})]
|
|
286
290
|
})
|
|
287
291
|
}, t.id))
|
|
288
|
-
}),
|
|
292
|
+
}), H && /* @__PURE__ */ h("div", {
|
|
289
293
|
className: "flex justify-center mt-6",
|
|
290
294
|
children: /* @__PURE__ */ g("button", {
|
|
291
295
|
type: "button",
|
|
292
296
|
onClick: () => {
|
|
293
|
-
|
|
294
|
-
variables: { offset:
|
|
297
|
+
H && z({
|
|
298
|
+
variables: { offset: B.length },
|
|
295
299
|
updateQuery: (e, { fetchMoreResult: t }) => t ? { contactInquiries: {
|
|
296
300
|
...t.contactInquiries,
|
|
297
301
|
items: [...e.contactInquiries?.items ?? [], ...t.contactInquiries?.items ?? []]
|
|
298
302
|
} } : e
|
|
299
303
|
});
|
|
300
304
|
},
|
|
301
|
-
disabled:
|
|
305
|
+
disabled: L,
|
|
302
306
|
className: "min-h-11 inline-flex items-center justify-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-bg-sunken transition-colors disabled:opacity-50",
|
|
303
|
-
children: [
|
|
307
|
+
children: [L ? /* @__PURE__ */ h(c, {
|
|
304
308
|
size: 14,
|
|
305
309
|
className: "animate-spin"
|
|
306
310
|
}) : null, "Load more"]
|
|
@@ -310,6 +314,6 @@ function x() {
|
|
|
310
314
|
});
|
|
311
315
|
}
|
|
312
316
|
//#endregion
|
|
313
|
-
export {
|
|
317
|
+
export { S as ContactInquiriesPage };
|
|
314
318
|
|
|
315
319
|
//# sourceMappingURL=ContactInquiriesPage.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContactInquiriesPage.js","names":[],"sources":["../../../src/support/pages/ContactInquiriesPage.tsx"],"sourcesContent":["import { useState, useEffect, useRef } from 'react';\nimport { useNavigate, useLocation } from 'react-router-dom';\nimport { Mail, Search, Filter, Loader2, AlertCircle, ChevronDown } from 'lucide-react';\nimport { IllustratedEmptyState } from '@burdenoff/fe-libs/ui';\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 // Mirror the latest map into a ref so the resolver effect can read it\n // without re-running every time we cache a freshly-resolved name.\n const productNamesRef = useRef(productNames);\n productNamesRef.current = productNames;\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. We key the effect off a\n // stable string so a new array reference per render doesn't retrigger.\n const productIds = Array.from(\n new Set(inquiries.flatMap((i: ContactInquiry): string[] => (i.productId ? [i.productId] : [])))\n ).sort() as string[];\n const productIdsKey = productIds.join(',');\n useEffect(() => {\n const unknownIds = productIdsKey\n ? productIdsKey.split(',').filter((pid) => !productNamesRef.current[pid])\n : [];\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 }, [productIdsKey]);\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-3 sm: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-3 sm: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-3 sm:p-6\">\n {/* Header */}\n <div className=\"flex flex-col gap-3 mb-6 sm:flex-row sm:items-center sm:justify-between\">\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-bg-sunken 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 aria-label=\"Search inquiries\"\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 type=\"button\"\n onClick={() => setShowFilters(!showFilters)}\n className=\"min-h-11 inline-flex items-center justify-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-bg-sunken 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-bg-surface border border-border-seam rounded-lg\">\n <div className=\"grid grid-cols-1 gap-4 sm:grid-cols-2\">\n <div>\n <label\n className=\"block text-xs font-medium text-text-secondary mb-1\"\n htmlFor=\"contactinquiriespage-status-0\"\n >\n Status\n </label>\n <select\n id=\"contactinquiriespage-status-0\"\n value={statusFilter}\n onChange={(e) => setStatusFilter(e.target.value as ContactInquiryStatus | '')}\n className=\"min-h-11 w-full 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\n className=\"block text-xs font-medium text-text-secondary mb-1\"\n htmlFor=\"contactinquiriespage-product-2\"\n >\n Product\n </label>\n <select\n id=\"contactinquiriespage-product-2\"\n value={productFilter}\n onChange={(e) => setProductFilter(e.target.value)}\n className=\"min-h-11 w-full 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 <IllustratedEmptyState\n illustration=\"empty-notifications\"\n title=\"No inquiries yet\"\n description=\"Contact form submissions from your product websites will appear here.\"\n />\n ) : (\n <>\n {/* Inquiry list */}\n <div className=\"space-y-3\">\n {inquiries.map((inquiry: ContactInquiry) => (\n <button\n type=\"button\"\n key={inquiry.id}\n onClick={() => navigate(`/support/inquiries/${inquiry.id}${queryParams}`)}\n className=\"w-full text-left p-4 bg-bg-surface border border-border-seam rounded-lg shadow-[var(--shadow-pop)] hover:border-border-strong hover:shadow-[var(--shadow-pop-hover)] transition-[box-shadow,border-color] duration-200 group\"\n >\n <div className=\"flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between\">\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} ${inquiry.status === 'NEW' ? 'motion-safe:animate-vc-glow-pulse' : ''}`}\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 sm: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 type=\"button\"\n onClick={loadMore}\n disabled={loading}\n className=\"min-h-11 inline-flex items-center justify-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-bg-sunken 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":";;;;;;;;;AAcA,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,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U;mBAAwC,EAAQ;SAAY,CAAA;QACrE;UACN,kBAAC,OAAD;OAAK,WAAU;iBACZ,EAAW,EAAQ,UAAU;OAC1B,CAAA,CACF;;KACC,EA9CF,EAAQ,GA8CN,CACT;IACE,CAAA,EAGL,KACC,kBAAC,OAAD;IAAK,WAAU;cACb,kBAAC,UAAD;KACE,MAAK;KACL,eA9NS;AAChB,WACL,EAAU;OACR,WAAW,EAAE,QAAQ,EAAU,QAAQ;OACvC,cAAc,GAAM,EAAE,yBACf,IACE,EACL,kBAAkB;QAChB,GAAG,EAAgB;QACnB,OAAO,CACL,GAAI,EAAK,kBAAkB,SAAS,EAAE,EACtC,GAAI,EAAgB,kBAAkB,SAAS,EAAE,CAClD;QACF,EACF,GAT4B;OAWhC,CAAC;;KA+MU,UAAU;KACV,WAAU;eAJZ,CAMG,IAAU,kBAAC,GAAD;MAAS,MAAM;MAAI,WAAU;MAAiB,CAAA,GAAG,MAAK,YAE1D;;IACL,CAAA,CAEP,EAAA,CAAA;GAED"}
|
|
1
|
+
{"version":3,"file":"ContactInquiriesPage.js","names":[],"sources":["../../../src/support/pages/ContactInquiriesPage.tsx"],"sourcesContent":["import { useState, useEffect, useRef } from 'react';\nimport { useNavigate, useLocation } from 'react-router-dom';\nimport { Mail, Search, Filter, Loader2, AlertCircle, ChevronDown } from 'lucide-react';\nimport { IllustratedEmptyState, PagePurpose } from '@burdenoff/fe-libs/ui';\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 // Mirror the latest map into a ref so the resolver effect can read it\n // without re-running every time we cache a freshly-resolved name.\n const productNamesRef = useRef(productNames);\n productNamesRef.current = productNames;\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. We key the effect off a\n // stable string so a new array reference per render doesn't retrigger.\n const productIds = Array.from(\n new Set(inquiries.flatMap((i: ContactInquiry): string[] => (i.productId ? [i.productId] : [])))\n ).sort() as string[];\n const productIdsKey = productIds.join(',');\n useEffect(() => {\n const unknownIds = productIdsKey\n ? productIdsKey.split(',').filter((pid) => !productNamesRef.current[pid])\n : [];\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 }, [productIdsKey]);\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-3 sm: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-3 sm: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-3 sm:p-6\">\n {/* Header */}\n <div className=\"flex flex-col gap-3 mb-6 sm:flex-row sm:items-center sm:justify-between\">\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-bg-sunken text-text-secondary\">\n {total}\n </span>\n </div>\n </div>\n\n <PagePurpose className=\"mb-6\">\n Every message sent through your product websites' contact forms lands here. Triage\n sales and support leads, mark spam, and convert genuine inquiries into tickets so nothing\n from a prospective customer slips through the cracks. Open an inquiry to read it in full and\n take action.\n </PagePurpose>\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 aria-label=\"Search inquiries\"\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 type=\"button\"\n onClick={() => setShowFilters(!showFilters)}\n className=\"min-h-11 inline-flex items-center justify-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-bg-sunken 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-bg-surface border border-border-seam rounded-lg\">\n <div className=\"grid grid-cols-1 gap-4 sm:grid-cols-2\">\n <div>\n <label\n className=\"block text-xs font-medium text-text-secondary mb-1\"\n htmlFor=\"contactinquiriespage-status-0\"\n >\n Status\n </label>\n <select\n id=\"contactinquiriespage-status-0\"\n value={statusFilter}\n onChange={(e) => setStatusFilter(e.target.value as ContactInquiryStatus | '')}\n className=\"min-h-11 w-full 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\n className=\"block text-xs font-medium text-text-secondary mb-1\"\n htmlFor=\"contactinquiriespage-product-2\"\n >\n Product\n </label>\n <select\n id=\"contactinquiriespage-product-2\"\n value={productFilter}\n onChange={(e) => setProductFilter(e.target.value)}\n className=\"min-h-11 w-full 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 <IllustratedEmptyState\n illustration=\"empty-notifications\"\n title=\"No inquiries yet\"\n description=\"Contact form submissions from your product websites will appear here.\"\n />\n ) : (\n <>\n {/* Inquiry list */}\n <div className=\"space-y-3\">\n {inquiries.map((inquiry: ContactInquiry) => (\n <button\n type=\"button\"\n key={inquiry.id}\n onClick={() => navigate(`/support/inquiries/${inquiry.id}${queryParams}`)}\n className=\"w-full text-left p-4 bg-bg-surface border border-border-seam rounded-lg shadow-[var(--shadow-pop)] hover:border-border-strong hover:shadow-[var(--shadow-pop-hover)] transition-[box-shadow,border-color] duration-200 group\"\n >\n <div className=\"flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between\">\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} ${inquiry.status === 'NEW' ? 'motion-safe:animate-vc-glow-pulse' : ''}`}\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 sm: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 type=\"button\"\n onClick={loadMore}\n disabled={loading}\n className=\"min-h-11 inline-flex items-center justify-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-bg-sunken 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":";;;;;;;;;AAcA,IAAM,IAAuC;CAC3C,KAAK;CACL,UAAU;CACV,WAAW;CACX,MAAM;CACN,UAAU;CACX,EAEK,IAAuC;CAC3C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