@burdenoff/microfe-support 2026.510.52

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (137) hide show
  1. package/README.md +290 -0
  2. package/dist/generated/global-operations.js +1118 -0
  3. package/dist/generated/global-operations.js.map +1 -0
  4. package/dist/generated/global-types.js +20 -0
  5. package/dist/generated/global-types.js.map +1 -0
  6. package/dist/index.js +11 -0
  7. package/dist/microfe-support.css +2 -0
  8. package/dist/node_modules/clsx/dist/clsx.js +18 -0
  9. package/dist/node_modules/clsx/dist/clsx.js.map +1 -0
  10. package/dist/node_modules/dompurify/dist/purify.es.js +555 -0
  11. package/dist/node_modules/dompurify/dist/purify.es.js.map +1 -0
  12. package/dist/node_modules/marked/lib/marked.esm.js +1430 -0
  13. package/dist/node_modules/marked/lib/marked.esm.js.map +1 -0
  14. package/dist/node_modules/tailwind-merge/dist/bundle-mjs.js +1674 -0
  15. package/dist/node_modules/tailwind-merge/dist/bundle-mjs.js.map +1 -0
  16. package/dist/support/SupportAdminRoot.js +69 -0
  17. package/dist/support/SupportAdminRoot.js.map +1 -0
  18. package/dist/support/SupportAdminRoutes.js +73 -0
  19. package/dist/support/SupportAdminRoutes.js.map +1 -0
  20. package/dist/support/SupportUserRoot.js +42 -0
  21. package/dist/support/SupportUserRoot.js.map +1 -0
  22. package/dist/support/SupportUserRoutes.js +49 -0
  23. package/dist/support/SupportUserRoutes.js.map +1 -0
  24. package/dist/support/components/NotificationToast.js +34 -0
  25. package/dist/support/components/NotificationToast.js.map +1 -0
  26. package/dist/support/components/PageLayout.js +87 -0
  27. package/dist/support/components/PageLayout.js.map +1 -0
  28. package/dist/support/components/RouteHelpers.js +22 -0
  29. package/dist/support/components/RouteHelpers.js.map +1 -0
  30. package/dist/support/components/analytics/CategoryBreakdown.js +63 -0
  31. package/dist/support/components/analytics/CategoryBreakdown.js.map +1 -0
  32. package/dist/support/components/analytics/MetricCard.js +31 -0
  33. package/dist/support/components/analytics/MetricCard.js.map +1 -0
  34. package/dist/support/components/analytics/PriorityBreakdown.js +59 -0
  35. package/dist/support/components/analytics/PriorityBreakdown.js.map +1 -0
  36. package/dist/support/components/analytics/SLAReport.js +110 -0
  37. package/dist/support/components/analytics/SLAReport.js.map +1 -0
  38. package/dist/support/components/analytics/SatisfactionDistribution.js +150 -0
  39. package/dist/support/components/analytics/SatisfactionDistribution.js.map +1 -0
  40. package/dist/support/components/analytics/TopAgents.js +70 -0
  41. package/dist/support/components/analytics/TopAgents.js.map +1 -0
  42. package/dist/support/components/analytics/TrendChart.js +48 -0
  43. package/dist/support/components/analytics/TrendChart.js.map +1 -0
  44. package/dist/support/components/kb/ArticleForm.js +244 -0
  45. package/dist/support/components/kb/ArticleForm.js.map +1 -0
  46. package/dist/support/components/kb/index.js +1 -0
  47. package/dist/support/components/settings/CannedResponsesSettings.js +84 -0
  48. package/dist/support/components/settings/CannedResponsesSettings.js.map +1 -0
  49. package/dist/support/components/settings/SLAPoliciesSettings.js +249 -0
  50. package/dist/support/components/settings/SLAPoliciesSettings.js.map +1 -0
  51. package/dist/support/components/settings/TicketCategoriesSettings.js +360 -0
  52. package/dist/support/components/settings/TicketCategoriesSettings.js.map +1 -0
  53. package/dist/support/components/tickets/AttachmentList.js +54 -0
  54. package/dist/support/components/tickets/AttachmentList.js.map +1 -0
  55. package/dist/support/components/tickets/MarkdownContent.js +11 -0
  56. package/dist/support/components/tickets/MarkdownContent.js.map +1 -0
  57. package/dist/support/components/tickets/MessageComposer.js +137 -0
  58. package/dist/support/components/tickets/MessageComposer.js.map +1 -0
  59. package/dist/support/components/tickets/MessageThread.js +88 -0
  60. package/dist/support/components/tickets/MessageThread.js.map +1 -0
  61. package/dist/support/components/tickets/TicketDetailHeader.js +123 -0
  62. package/dist/support/components/tickets/TicketDetailHeader.js.map +1 -0
  63. package/dist/support/components/tickets/TicketHeader.js +191 -0
  64. package/dist/support/components/tickets/TicketHeader.js.map +1 -0
  65. package/dist/support/components/tickets/TicketSidebar.js +271 -0
  66. package/dist/support/components/tickets/TicketSidebar.js.map +1 -0
  67. package/dist/support/components/ui.js +2 -0
  68. package/dist/support/constants.js +6 -0
  69. package/dist/support/constants.js.map +1 -0
  70. package/dist/support/hooks/index.js +5 -0
  71. package/dist/support/hooks/useAnalyticsOperations.js +61 -0
  72. package/dist/support/hooks/useAnalyticsOperations.js.map +1 -0
  73. package/dist/support/hooks/useAttachmentsFailedToast.js +22 -0
  74. package/dist/support/hooks/useAttachmentsFailedToast.js.map +1 -0
  75. package/dist/support/hooks/useChatOperations.js +146 -0
  76. package/dist/support/hooks/useChatOperations.js.map +1 -0
  77. package/dist/support/hooks/useKnowledgeBaseOperations.js +194 -0
  78. package/dist/support/hooks/useKnowledgeBaseOperations.js.map +1 -0
  79. package/dist/support/hooks/useNotification.js +26 -0
  80. package/dist/support/hooks/useNotification.js.map +1 -0
  81. package/dist/support/hooks/useRegisterFooter.js +17 -0
  82. package/dist/support/hooks/useRegisterFooter.js.map +1 -0
  83. package/dist/support/hooks/useSettingsOperations.js +145 -0
  84. package/dist/support/hooks/useSettingsOperations.js.map +1 -0
  85. package/dist/support/hooks/useSupportAttachments.js +37 -0
  86. package/dist/support/hooks/useSupportAttachments.js.map +1 -0
  87. package/dist/support/hooks/useTicketOperations.js +222 -0
  88. package/dist/support/hooks/useTicketOperations.js.map +1 -0
  89. package/dist/support/index.js +10 -0
  90. package/dist/support/pages/AnalyticsPage.js +206 -0
  91. package/dist/support/pages/AnalyticsPage.js.map +1 -0
  92. package/dist/support/pages/ArticleDetailAdminPage.js +350 -0
  93. package/dist/support/pages/ArticleDetailAdminPage.js.map +1 -0
  94. package/dist/support/pages/ArticleDetailUserPage.js +150 -0
  95. package/dist/support/pages/ArticleDetailUserPage.js.map +1 -0
  96. package/dist/support/pages/ContactInquiriesPage.js +314 -0
  97. package/dist/support/pages/ContactInquiriesPage.js.map +1 -0
  98. package/dist/support/pages/ContactInquiryDetailPage.js +481 -0
  99. package/dist/support/pages/ContactInquiryDetailPage.js.map +1 -0
  100. package/dist/support/pages/CreateArticlePage.js +120 -0
  101. package/dist/support/pages/CreateArticlePage.js.map +1 -0
  102. package/dist/support/pages/CreateTicketPage.js +281 -0
  103. package/dist/support/pages/CreateTicketPage.js.map +1 -0
  104. package/dist/support/pages/EditArticlePage.js +151 -0
  105. package/dist/support/pages/EditArticlePage.js.map +1 -0
  106. package/dist/support/pages/KnowledgeBaseAdminPage.js +208 -0
  107. package/dist/support/pages/KnowledgeBaseAdminPage.js.map +1 -0
  108. package/dist/support/pages/KnowledgeBaseUserPage.js +188 -0
  109. package/dist/support/pages/KnowledgeBaseUserPage.js.map +1 -0
  110. package/dist/support/pages/SettingsPage.js +215 -0
  111. package/dist/support/pages/SettingsPage.js.map +1 -0
  112. package/dist/support/pages/TicketDetailAdminPage.js +157 -0
  113. package/dist/support/pages/TicketDetailAdminPage.js.map +1 -0
  114. package/dist/support/pages/TicketDetailUserPage.js +292 -0
  115. package/dist/support/pages/TicketDetailUserPage.js.map +1 -0
  116. package/dist/support/pages/TicketListPage.js +337 -0
  117. package/dist/support/pages/TicketListPage.js.map +1 -0
  118. package/dist/support/providers/SupportProvider.js +40 -0
  119. package/dist/support/providers/SupportProvider.js.map +1 -0
  120. package/dist/support/store/supportStore.js +102 -0
  121. package/dist/support/store/supportStore.js.map +1 -0
  122. package/dist/support/utils/cn.js +10 -0
  123. package/dist/support/utils/cn.js.map +1 -0
  124. package/dist/support/utils/context.js +32 -0
  125. package/dist/support/utils/context.js.map +1 -0
  126. package/dist/support/utils/errors.js +13 -0
  127. package/dist/support/utils/errors.js.map +1 -0
  128. package/dist/support/utils/i18n.js +9 -0
  129. package/dist/support/utils/i18n.js.map +1 -0
  130. package/dist/support/utils/index.js +105 -0
  131. package/dist/support/utils/index.js.map +1 -0
  132. package/dist/support/utils/markdown.js +47 -0
  133. package/dist/support/utils/markdown.js.map +1 -0
  134. package/dist/support/utils/supportFiles.js +116 -0
  135. package/dist/support/utils/supportFiles.js.map +1 -0
  136. package/dist/utils/nativeBridge.js +2 -0
  137. package/package.json +145 -0
@@ -0,0 +1,314 @@
1
+ import { useGetContactInquiriesQuery as e } from "../../generated/global-operations.js";
2
+ import { useEffect as t, useState as n } from "react";
3
+ import { AlertCircle as r, ChevronDown as i, Filter as a, Loader2 as o, Mail as s, Search as c } from "lucide-react";
4
+ import { useLocation as l, useNavigate as u } from "react-router-dom";
5
+ import { graphqlFetch as d } from "@burdenoff/fe-libs/shared/graphql/fetch";
6
+ import { Fragment as f, jsx as p, jsxs as m } from "react/jsx-runtime";
7
+ //#region src/support/pages/ContactInquiriesPage.tsx
8
+ var h = {
9
+ NEW: "bg-status-info-bg-subtle text-status-info-text",
10
+ REVIEWED: "bg-status-warning-bg-subtle text-status-warning-text",
11
+ CONVERTED: "bg-status-success-bg-subtle text-status-success-text",
12
+ SPAM: "bg-status-error-bg-subtle text-status-error-text",
13
+ ARCHIVED: "bg-bg-sunken text-text-secondary"
14
+ }, g = {
15
+ NEW: "New",
16
+ REVIEWED: "Reviewed",
17
+ CONVERTED: "Converted",
18
+ SPAM: "Spam",
19
+ ARCHIVED: "Archived"
20
+ };
21
+ function _(e) {
22
+ return new Date(e).toLocaleDateString("en-US", {
23
+ month: "short",
24
+ day: "numeric",
25
+ year: "numeric",
26
+ hour: "2-digit",
27
+ minute: "2-digit"
28
+ });
29
+ }
30
+ function v() {
31
+ let v = u(), y = l().search, [b, x] = n(""), [S, C] = n(""), [w, T] = n(""), [E, D] = n(!1), [O, k] = n({}), A = {};
32
+ b && (A.search = b), S && (A.status = S), w && (A.productId = w);
33
+ let { data: j, loading: M, error: N, fetchMore: P } = e({
34
+ variables: {
35
+ filter: A,
36
+ limit: 50,
37
+ offset: 0
38
+ },
39
+ fetchPolicy: "cache-and-network"
40
+ }), F = j?.contactInquiries?.items ?? [], I = j?.contactInquiries?.total ?? 0, L = j?.contactInquiries?.hasMore ?? !1, R = Array.from(new Set(F.map((e) => e.productId).filter(Boolean)));
41
+ return t(() => {
42
+ let e = R.filter((e) => !O[e]);
43
+ e.length !== 0 && e.forEach((e) => {
44
+ d({
45
+ gateway: "global",
46
+ query: "query($id: ID!) { platformProduct(id: $id) { name } }",
47
+ variables: { id: e }
48
+ }).then((t) => {
49
+ let n = t.data?.platformProduct?.name;
50
+ n && k((t) => ({
51
+ ...t,
52
+ [e]: n
53
+ }));
54
+ }).catch(() => {});
55
+ });
56
+ }, [R.join(",")]), M && F.length === 0 ? /* @__PURE__ */ m("div", {
57
+ className: "p-6",
58
+ children: [/* @__PURE__ */ m("div", {
59
+ className: "flex items-center gap-3 mb-6",
60
+ children: [/* @__PURE__ */ p(s, {
61
+ size: 24,
62
+ className: "text-text-primary"
63
+ }), /* @__PURE__ */ p("h1", {
64
+ className: "text-2xl font-bold text-text-primary",
65
+ children: "Contact Inquiries"
66
+ })]
67
+ }), /* @__PURE__ */ m("div", {
68
+ className: "flex flex-col items-center justify-center py-16",
69
+ children: [/* @__PURE__ */ p(o, {
70
+ size: 32,
71
+ className: "animate-spin text-text-secondary mb-4"
72
+ }), /* @__PURE__ */ p("p", {
73
+ className: "text-sm text-text-secondary",
74
+ children: "Loading inquiries..."
75
+ })]
76
+ })]
77
+ }) : N ? /* @__PURE__ */ m("div", {
78
+ className: "p-6",
79
+ children: [/* @__PURE__ */ m("div", {
80
+ className: "flex items-center gap-3 mb-6",
81
+ children: [/* @__PURE__ */ p(s, {
82
+ size: 24,
83
+ className: "text-text-primary"
84
+ }), /* @__PURE__ */ p("h1", {
85
+ className: "text-2xl font-bold text-text-primary",
86
+ children: "Contact Inquiries"
87
+ })]
88
+ }), /* @__PURE__ */ m("div", {
89
+ className: "flex flex-col items-center justify-center py-16 text-center",
90
+ children: [
91
+ /* @__PURE__ */ p("div", {
92
+ className: "p-4 rounded-2xl bg-status-error-bg-subtle text-status-error-text mb-4",
93
+ children: /* @__PURE__ */ p(r, { size: 48 })
94
+ }),
95
+ /* @__PURE__ */ p("h3", {
96
+ className: "text-lg font-semibold text-text-primary mb-2",
97
+ children: "Failed to load inquiries"
98
+ }),
99
+ /* @__PURE__ */ p("p", {
100
+ className: "text-sm text-text-secondary",
101
+ children: N.message
102
+ })
103
+ ]
104
+ })]
105
+ }) : /* @__PURE__ */ m("div", {
106
+ className: "p-6",
107
+ children: [
108
+ /* @__PURE__ */ p("div", {
109
+ className: "flex items-center justify-between mb-6",
110
+ children: /* @__PURE__ */ m("div", {
111
+ className: "flex items-center gap-3",
112
+ children: [
113
+ /* @__PURE__ */ p(s, {
114
+ size: 24,
115
+ className: "text-text-primary"
116
+ }),
117
+ /* @__PURE__ */ m("div", { children: [/* @__PURE__ */ p("h1", {
118
+ className: "text-2xl font-bold text-text-primary",
119
+ children: "Contact Inquiries"
120
+ }), /* @__PURE__ */ p("p", {
121
+ className: "text-sm text-text-secondary",
122
+ children: "Website contact form submissions"
123
+ })] }),
124
+ /* @__PURE__ */ p("span", {
125
+ 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: I
127
+ })
128
+ ]
129
+ })
130
+ }),
131
+ /* @__PURE__ */ m("div", {
132
+ className: "flex flex-col sm:flex-row gap-3 mb-6",
133
+ children: [/* @__PURE__ */ m("div", {
134
+ className: "relative flex-1",
135
+ children: [/* @__PURE__ */ p(c, {
136
+ size: 16,
137
+ className: "absolute left-3 top-1/2 -translate-y-1/2 text-text-secondary"
138
+ }), /* @__PURE__ */ p("input", {
139
+ type: "text",
140
+ placeholder: "Search by name, email, or subject...",
141
+ value: b,
142
+ onChange: (e) => x(e.target.value),
143
+ 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
+ }), /* @__PURE__ */ m("button", {
146
+ onClick: () => D(!E),
147
+ 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
+ children: [
149
+ /* @__PURE__ */ p(a, { size: 16 }),
150
+ "Filters",
151
+ /* @__PURE__ */ p(i, {
152
+ size: 14,
153
+ className: E ? "rotate-180 transition-transform" : "transition-transform"
154
+ })
155
+ ]
156
+ })]
157
+ }),
158
+ E && /* @__PURE__ */ p("div", {
159
+ className: "mb-6 p-4 bg-surface border border-default rounded-lg",
160
+ children: /* @__PURE__ */ m("div", {
161
+ className: "flex flex-wrap gap-4",
162
+ children: [/* @__PURE__ */ m("div", { children: [/* @__PURE__ */ p("label", {
163
+ className: "block text-xs font-medium text-text-secondary mb-1",
164
+ children: "Status"
165
+ }), /* @__PURE__ */ m("select", {
166
+ value: S,
167
+ onChange: (e) => C(e.target.value),
168
+ 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
+ children: [
170
+ /* @__PURE__ */ p("option", {
171
+ value: "",
172
+ children: "All statuses"
173
+ }),
174
+ /* @__PURE__ */ p("option", {
175
+ value: "NEW",
176
+ children: "New"
177
+ }),
178
+ /* @__PURE__ */ p("option", {
179
+ value: "REVIEWED",
180
+ children: "Reviewed"
181
+ }),
182
+ /* @__PURE__ */ p("option", {
183
+ value: "CONVERTED",
184
+ children: "Converted"
185
+ }),
186
+ /* @__PURE__ */ p("option", {
187
+ value: "SPAM",
188
+ children: "Spam"
189
+ }),
190
+ /* @__PURE__ */ p("option", {
191
+ value: "ARCHIVED",
192
+ children: "Archived"
193
+ })
194
+ ]
195
+ })] }), /* @__PURE__ */ m("div", { children: [/* @__PURE__ */ p("label", {
196
+ className: "block text-xs font-medium text-text-secondary mb-1",
197
+ children: "Product"
198
+ }), /* @__PURE__ */ m("select", {
199
+ value: w,
200
+ onChange: (e) => T(e.target.value),
201
+ 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__ */ p("option", {
203
+ value: "",
204
+ children: "All products"
205
+ }), R.map((e) => /* @__PURE__ */ p("option", {
206
+ value: e,
207
+ children: O[e] || e
208
+ }, e))]
209
+ })] })]
210
+ })
211
+ }),
212
+ F.length === 0 ? /* @__PURE__ */ m("div", {
213
+ className: "flex flex-col items-center justify-center py-16 text-center",
214
+ children: [
215
+ /* @__PURE__ */ p("div", {
216
+ className: "p-4 rounded-2xl bg-muted mb-4",
217
+ children: /* @__PURE__ */ p(s, {
218
+ size: 48,
219
+ className: "text-text-secondary opacity-50"
220
+ })
221
+ }),
222
+ /* @__PURE__ */ p("h3", {
223
+ className: "text-lg font-semibold text-text-primary mb-2",
224
+ children: "No inquiries yet"
225
+ }),
226
+ /* @__PURE__ */ p("p", {
227
+ className: "text-sm text-text-secondary",
228
+ children: "Contact form submissions from your product websites will appear here."
229
+ })
230
+ ]
231
+ }) : /* @__PURE__ */ m(f, { children: [/* @__PURE__ */ p("div", {
232
+ className: "space-y-3",
233
+ children: F.map((e) => /* @__PURE__ */ p("button", {
234
+ onClick: () => v(`/support/inquiries/${e.id}${y}`),
235
+ 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__ */ m("div", {
237
+ className: "flex items-start justify-between gap-4",
238
+ children: [/* @__PURE__ */ m("div", {
239
+ className: "flex-1 min-w-0",
240
+ children: [
241
+ /* @__PURE__ */ m("div", {
242
+ className: "flex items-center gap-2 mb-1",
243
+ children: [
244
+ /* @__PURE__ */ p("h3", {
245
+ className: "text-sm font-semibold text-text-primary truncate group-hover:text-accent transition-colors",
246
+ children: e.subject
247
+ }),
248
+ /* @__PURE__ */ p("span", {
249
+ className: `inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium ${h[e.status] || h.NEW}`,
250
+ children: g[e.status] || e.status
251
+ }),
252
+ e.productId && O[e.productId] && /* @__PURE__ */ p("span", {
253
+ 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: ${O[e.productId]}`,
255
+ children: O[e.productId]
256
+ })
257
+ ]
258
+ }),
259
+ /* @__PURE__ */ m("p", {
260
+ className: "text-sm text-text-secondary mb-1",
261
+ children: [
262
+ /* @__PURE__ */ p("span", {
263
+ className: "font-medium",
264
+ children: e.name
265
+ }),
266
+ /* @__PURE__ */ p("span", {
267
+ className: "mx-1.5 text-text-secondary/50",
268
+ children: "·"
269
+ }),
270
+ /* @__PURE__ */ p("span", { children: e.email }),
271
+ e.company && /* @__PURE__ */ m(f, { children: [/* @__PURE__ */ p("span", {
272
+ className: "mx-1.5 text-text-secondary/50",
273
+ children: "·"
274
+ }), /* @__PURE__ */ p("span", { children: e.company })] })
275
+ ]
276
+ }),
277
+ /* @__PURE__ */ p("p", {
278
+ className: "text-xs text-text-secondary truncate",
279
+ children: e.message
280
+ })
281
+ ]
282
+ }), /* @__PURE__ */ p("div", {
283
+ className: "text-xs text-text-secondary whitespace-nowrap",
284
+ children: _(e.createdAt)
285
+ })]
286
+ })
287
+ }, e.id))
288
+ }), L && /* @__PURE__ */ p("div", {
289
+ className: "flex justify-center mt-6",
290
+ children: /* @__PURE__ */ m("button", {
291
+ onClick: () => {
292
+ L && P({
293
+ variables: { offset: F.length },
294
+ updateQuery: (e, { fetchMoreResult: t }) => t ? { contactInquiries: {
295
+ ...t.contactInquiries,
296
+ items: [...e.contactInquiries?.items ?? [], ...t.contactInquiries?.items ?? []]
297
+ } } : e
298
+ });
299
+ },
300
+ disabled: M,
301
+ 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: [M ? /* @__PURE__ */ p(o, {
303
+ size: 14,
304
+ className: "animate-spin"
305
+ }) : null, "Load more"]
306
+ })
307
+ })] })
308
+ ]
309
+ });
310
+ }
311
+ //#endregion
312
+ export { v as ContactInquiriesPage };
313
+
314
+ //# sourceMappingURL=ContactInquiriesPage.js.map
@@ -0,0 +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\">&middot;</span>\n <span>{inquiry.email}</span>\n {inquiry.company && (\n <>\n <span className=\"mx-1.5 text-text-secondary/50\">&middot;</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,I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