@burdenoff/microfe-support 2026.1029.3 → 2026.1031.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (259) hide show
  1. package/dist/generated/global-operations.js +1 -2
  2. package/dist/generated/global-operations.js.map +1 -1
  3. package/dist/generated/global-types.js +1 -2
  4. package/dist/generated/global-types.js.map +1 -1
  5. package/dist/node_modules/@tiptap/core/dist/index.js +701 -712
  6. package/dist/node_modules/@tiptap/core/dist/index.js.map +1 -1
  7. package/dist/node_modules/@tiptap/core/dist/jsx-runtime/jsx-runtime.js +1 -2
  8. package/dist/node_modules/@tiptap/core/dist/jsx-runtime/jsx-runtime.js.map +1 -1
  9. package/dist/node_modules/@tiptap/core/dist/rolldown-runtime-D7D4PA-g.js +1 -2
  10. package/dist/node_modules/@tiptap/core/dist/rolldown-runtime-D7D4PA-g.js.map +1 -1
  11. package/dist/node_modules/@tiptap/extension-blockquote/dist/index.js +15 -16
  12. package/dist/node_modules/@tiptap/extension-blockquote/dist/index.js.map +1 -1
  13. package/dist/node_modules/@tiptap/extension-bold/dist/index.js +1 -2
  14. package/dist/node_modules/@tiptap/extension-bold/dist/index.js.map +1 -1
  15. package/dist/node_modules/@tiptap/extension-code/dist/index.js +1 -2
  16. package/dist/node_modules/@tiptap/extension-code/dist/index.js.map +1 -1
  17. package/dist/node_modules/@tiptap/extension-code-block/dist/index.js +25 -26
  18. package/dist/node_modules/@tiptap/extension-code-block/dist/index.js.map +1 -1
  19. package/dist/node_modules/@tiptap/extension-document/dist/index.js +1 -2
  20. package/dist/node_modules/@tiptap/extension-document/dist/index.js.map +1 -1
  21. package/dist/node_modules/@tiptap/extension-hard-break/dist/index.js +1 -2
  22. package/dist/node_modules/@tiptap/extension-hard-break/dist/index.js.map +1 -1
  23. package/dist/node_modules/@tiptap/extension-heading/dist/index.js +1 -2
  24. package/dist/node_modules/@tiptap/extension-heading/dist/index.js.map +1 -1
  25. package/dist/node_modules/@tiptap/extension-horizontal-rule/dist/index.js +16 -17
  26. package/dist/node_modules/@tiptap/extension-horizontal-rule/dist/index.js.map +1 -1
  27. package/dist/node_modules/@tiptap/extension-italic/dist/index.js +1 -2
  28. package/dist/node_modules/@tiptap/extension-italic/dist/index.js.map +1 -1
  29. package/dist/node_modules/@tiptap/extension-link/dist/index.js +71 -80
  30. package/dist/node_modules/@tiptap/extension-link/dist/index.js.map +1 -1
  31. package/dist/node_modules/@tiptap/extension-list/dist/index.js +77 -90
  32. package/dist/node_modules/@tiptap/extension-list/dist/index.js.map +1 -1
  33. package/dist/node_modules/@tiptap/extension-paragraph/dist/index.js +1 -2
  34. package/dist/node_modules/@tiptap/extension-paragraph/dist/index.js.map +1 -1
  35. package/dist/node_modules/@tiptap/extension-placeholder/dist/index.js +1 -2
  36. package/dist/node_modules/@tiptap/extension-placeholder/dist/index.js.map +1 -1
  37. package/dist/node_modules/@tiptap/extension-strike/dist/index.js +1 -2
  38. package/dist/node_modules/@tiptap/extension-strike/dist/index.js.map +1 -1
  39. package/dist/node_modules/@tiptap/extension-text/dist/index.js +1 -2
  40. package/dist/node_modules/@tiptap/extension-text/dist/index.js.map +1 -1
  41. package/dist/node_modules/@tiptap/extension-underline/dist/index.js +1 -2
  42. package/dist/node_modules/@tiptap/extension-underline/dist/index.js.map +1 -1
  43. package/dist/node_modules/@tiptap/extensions/dist/index.js +112 -113
  44. package/dist/node_modules/@tiptap/extensions/dist/index.js.map +1 -1
  45. package/dist/node_modules/@tiptap/react/dist/index.js +5 -10
  46. package/dist/node_modules/@tiptap/react/dist/index.js.map +1 -1
  47. package/dist/node_modules/@tiptap/starter-kit/dist/index.js +1 -2
  48. package/dist/node_modules/@tiptap/starter-kit/dist/index.js.map +1 -1
  49. package/dist/node_modules/clsx/dist/clsx.js +1 -2
  50. package/dist/node_modules/clsx/dist/clsx.js.map +1 -1
  51. package/dist/node_modules/dompurify/dist/purify.es.js +357 -347
  52. package/dist/node_modules/dompurify/dist/purify.es.js.map +1 -1
  53. package/dist/node_modules/fast-equals/dist/es/index.js +1 -2
  54. package/dist/node_modules/fast-equals/dist/es/index.js.map +1 -1
  55. package/dist/node_modules/linkifyjs/dist/linkify.js +1 -2
  56. package/dist/node_modules/linkifyjs/dist/linkify.js.map +1 -1
  57. package/dist/node_modules/marked/lib/marked.esm.js +10 -70
  58. package/dist/node_modules/marked/lib/marked.esm.js.map +1 -1
  59. package/dist/node_modules/orderedmap/dist/index.js +1 -2
  60. package/dist/node_modules/orderedmap/dist/index.js.map +1 -1
  61. package/dist/node_modules/prosemirror-commands/dist/index.js +107 -108
  62. package/dist/node_modules/prosemirror-commands/dist/index.js.map +1 -1
  63. package/dist/node_modules/prosemirror-dropcursor/dist/index.js +12 -13
  64. package/dist/node_modules/prosemirror-dropcursor/dist/index.js.map +1 -1
  65. package/dist/node_modules/prosemirror-gapcursor/dist/index.js +42 -47
  66. package/dist/node_modules/prosemirror-gapcursor/dist/index.js.map +1 -1
  67. package/dist/node_modules/prosemirror-history/dist/index.js +47 -49
  68. package/dist/node_modules/prosemirror-history/dist/index.js.map +1 -1
  69. package/dist/node_modules/prosemirror-keymap/dist/index.js +15 -16
  70. package/dist/node_modules/prosemirror-keymap/dist/index.js.map +1 -1
  71. package/dist/node_modules/prosemirror-model/dist/index.js +37 -41
  72. package/dist/node_modules/prosemirror-model/dist/index.js.map +1 -1
  73. package/dist/node_modules/prosemirror-schema-list/dist/index.js +36 -37
  74. package/dist/node_modules/prosemirror-schema-list/dist/index.js.map +1 -1
  75. package/dist/node_modules/prosemirror-state/dist/index.js +1 -2
  76. package/dist/node_modules/prosemirror-state/dist/index.js.map +1 -1
  77. package/dist/node_modules/prosemirror-transform/dist/index.js +1 -2
  78. package/dist/node_modules/prosemirror-transform/dist/index.js.map +1 -1
  79. package/dist/node_modules/prosemirror-view/dist/index.js +302 -304
  80. package/dist/node_modules/prosemirror-view/dist/index.js.map +1 -1
  81. package/dist/node_modules/rope-sequence/dist/index.js +1 -2
  82. package/dist/node_modules/rope-sequence/dist/index.js.map +1 -1
  83. package/dist/node_modules/tailwind-merge/dist/bundle-mjs.js +4 -21
  84. package/dist/node_modules/tailwind-merge/dist/bundle-mjs.js.map +1 -1
  85. package/dist/node_modules/w3c-keyname/index.js +0 -1
  86. package/dist/node_modules/w3c-keyname/index.js.map +1 -1
  87. package/dist/support/SupportAdminRoot.js +14 -15
  88. package/dist/support/SupportAdminRoot.js.map +1 -1
  89. package/dist/support/SupportAdminRoutes.js +5 -6
  90. package/dist/support/SupportAdminRoutes.js.map +1 -1
  91. package/dist/support/SupportUserRoot.js +10 -11
  92. package/dist/support/SupportUserRoot.js.map +1 -1
  93. package/dist/support/SupportUserRoutes.js +1 -2
  94. package/dist/support/SupportUserRoutes.js.map +1 -1
  95. package/dist/support/components/NotificationToast.js +1 -2
  96. package/dist/support/components/NotificationToast.js.map +1 -1
  97. package/dist/support/components/PageLayout.js +15 -16
  98. package/dist/support/components/PageLayout.js.map +1 -1
  99. package/dist/support/components/RouteHelpers.js +1 -2
  100. package/dist/support/components/RouteHelpers.js.map +1 -1
  101. package/dist/support/components/analytics/CategoryBreakdown.js +9 -10
  102. package/dist/support/components/analytics/CategoryBreakdown.js.map +1 -1
  103. package/dist/support/components/analytics/MetricCard.js +1 -2
  104. package/dist/support/components/analytics/MetricCard.js.map +1 -1
  105. package/dist/support/components/analytics/PriorityBreakdown.js +9 -10
  106. package/dist/support/components/analytics/PriorityBreakdown.js.map +1 -1
  107. package/dist/support/components/analytics/SLAReport.js +5 -6
  108. package/dist/support/components/analytics/SLAReport.js.map +1 -1
  109. package/dist/support/components/analytics/SatisfactionDistribution.js +5 -6
  110. package/dist/support/components/analytics/SatisfactionDistribution.js.map +1 -1
  111. package/dist/support/components/analytics/TopAgents.js +5 -6
  112. package/dist/support/components/analytics/TopAgents.js.map +1 -1
  113. package/dist/support/components/analytics/TrendChart.js +5 -6
  114. package/dist/support/components/analytics/TrendChart.js.map +1 -1
  115. package/dist/support/components/careers/BulkCandidateActionGuidance.js +1 -2
  116. package/dist/support/components/careers/BulkCandidateActionGuidance.js.map +1 -1
  117. package/dist/support/components/careers/BulkCandidateDialogs.js +321 -322
  118. package/dist/support/components/careers/BulkCandidateDialogs.js.map +1 -1
  119. package/dist/support/components/careers/BulkOperationFeedback.js +1 -2
  120. package/dist/support/components/careers/BulkOperationFeedback.js.map +1 -1
  121. package/dist/support/components/careers/BulkSelectionSummary.js +1 -2
  122. package/dist/support/components/careers/BulkSelectionSummary.js.map +1 -1
  123. package/dist/support/components/careers/JobApplicationFilterContextGuard.js +1 -2
  124. package/dist/support/components/careers/JobApplicationFilterContextGuard.js.map +1 -1
  125. package/dist/support/components/careers/RichTextEditor.js +17 -18
  126. package/dist/support/components/careers/RichTextEditor.js.map +1 -1
  127. package/dist/support/components/kb/ArticleForm.js +10 -11
  128. package/dist/support/components/kb/ArticleForm.js.map +1 -1
  129. package/dist/support/components/settings/CannedResponsesSettings.js +2 -3
  130. package/dist/support/components/settings/CannedResponsesSettings.js.map +1 -1
  131. package/dist/support/components/settings/SLAPoliciesSettings.js +1 -2
  132. package/dist/support/components/settings/SLAPoliciesSettings.js.map +1 -1
  133. package/dist/support/components/settings/TicketCategoriesSettings.js +3 -8
  134. package/dist/support/components/settings/TicketCategoriesSettings.js.map +1 -1
  135. package/dist/support/components/tickets/AttachmentList.js +4 -5
  136. package/dist/support/components/tickets/AttachmentList.js.map +1 -1
  137. package/dist/support/components/tickets/MarkdownContent.js +1 -2
  138. package/dist/support/components/tickets/MarkdownContent.js.map +1 -1
  139. package/dist/support/components/tickets/MessageComposer.js +1 -2
  140. package/dist/support/components/tickets/MessageComposer.js.map +1 -1
  141. package/dist/support/components/tickets/MessageThread.js +13 -14
  142. package/dist/support/components/tickets/MessageThread.js.map +1 -1
  143. package/dist/support/components/tickets/TicketDetailHeader.js +13 -14
  144. package/dist/support/components/tickets/TicketDetailHeader.js.map +1 -1
  145. package/dist/support/components/tickets/TicketHeader.js +1 -2
  146. package/dist/support/components/tickets/TicketHeader.js.map +1 -1
  147. package/dist/support/components/tickets/TicketSidebar.js +6 -7
  148. package/dist/support/components/tickets/TicketSidebar.js.map +1 -1
  149. package/dist/support/components/tickets/TriagePanel.js +25 -26
  150. package/dist/support/components/tickets/TriagePanel.js.map +1 -1
  151. package/dist/support/components/ui.js +1 -2
  152. package/dist/support/constants/pipeline.js +1 -2
  153. package/dist/support/constants/pipeline.js.map +1 -1
  154. package/dist/support/constants.js +1 -2
  155. package/dist/support/constants.js.map +1 -1
  156. package/dist/support/events/rybbit.js +1 -2
  157. package/dist/support/events/rybbit.js.map +1 -1
  158. package/dist/support/hooks/index.js +6 -6
  159. package/dist/support/hooks/useAnalyticsOperations.js +1 -2
  160. package/dist/support/hooks/useAnalyticsOperations.js.map +1 -1
  161. package/dist/support/hooks/useAttachmentsFailedToast.js +1 -2
  162. package/dist/support/hooks/useAttachmentsFailedToast.js.map +1 -1
  163. package/dist/support/hooks/useChatOperations.js +14 -15
  164. package/dist/support/hooks/useChatOperations.js.map +1 -1
  165. package/dist/support/hooks/useDebouncedUrlText.js +1 -2
  166. package/dist/support/hooks/useDebouncedUrlText.js.map +1 -1
  167. package/dist/support/hooks/useKnowledgeBaseOperations.js +62 -63
  168. package/dist/support/hooks/useKnowledgeBaseOperations.js.map +1 -1
  169. package/dist/support/hooks/useNotification.js +1 -2
  170. package/dist/support/hooks/useNotification.js.map +1 -1
  171. package/dist/support/hooks/useRegisterFooter.js +1 -2
  172. package/dist/support/hooks/useRegisterFooter.js.map +1 -1
  173. package/dist/support/hooks/useSettingsOperations.js +1 -2
  174. package/dist/support/hooks/useSettingsOperations.js.map +1 -1
  175. package/dist/support/hooks/useSupportAttachments.js +1 -2
  176. package/dist/support/hooks/useSupportAttachments.js.map +1 -1
  177. package/dist/support/hooks/useTicketListOperations.js +9 -10
  178. package/dist/support/hooks/useTicketListOperations.js.map +1 -1
  179. package/dist/support/hooks/useTicketOperations.js +57 -58
  180. package/dist/support/hooks/useTicketOperations.js.map +1 -1
  181. package/dist/support/hooks/useTr.js +1 -2
  182. package/dist/support/hooks/useTr.js.map +1 -1
  183. package/dist/support/index.js +4 -4
  184. package/dist/support/pages/AnalyticsPage.js +34 -35
  185. package/dist/support/pages/AnalyticsPage.js.map +1 -1
  186. package/dist/support/pages/ArticleDetailAdminPage.js +33 -38
  187. package/dist/support/pages/ArticleDetailAdminPage.js.map +1 -1
  188. package/dist/support/pages/ArticleDetailUserPage.js +22 -23
  189. package/dist/support/pages/ArticleDetailUserPage.js.map +1 -1
  190. package/dist/support/pages/ContactInquiriesPage.js +5 -6
  191. package/dist/support/pages/ContactInquiriesPage.js.map +1 -1
  192. package/dist/support/pages/ContactInquiryDetailPage.js +13 -14
  193. package/dist/support/pages/ContactInquiryDetailPage.js.map +1 -1
  194. package/dist/support/pages/CreateArticlePage.js +15 -16
  195. package/dist/support/pages/CreateArticlePage.js.map +1 -1
  196. package/dist/support/pages/CreateTicketPage.js +37 -44
  197. package/dist/support/pages/CreateTicketPage.js.map +1 -1
  198. package/dist/support/pages/EditArticlePage.js +20 -21
  199. package/dist/support/pages/EditArticlePage.js.map +1 -1
  200. package/dist/support/pages/InterviewersPage.js +121 -122
  201. package/dist/support/pages/InterviewersPage.js.map +1 -1
  202. package/dist/support/pages/JobApplicationDetailPage.js +322 -332
  203. package/dist/support/pages/JobApplicationDetailPage.js.map +1 -1
  204. package/dist/support/pages/JobApplicationsPage.js +556 -561
  205. package/dist/support/pages/JobApplicationsPage.js.map +1 -1
  206. package/dist/support/pages/JobPostingDetailPage.js +489 -490
  207. package/dist/support/pages/JobPostingDetailPage.js.map +1 -1
  208. package/dist/support/pages/JobPostingsPage.js +279 -280
  209. package/dist/support/pages/JobPostingsPage.js.map +1 -1
  210. package/dist/support/pages/KnowledgeBaseAdminPage.js +26 -27
  211. package/dist/support/pages/KnowledgeBaseAdminPage.js.map +1 -1
  212. package/dist/support/pages/KnowledgeBaseUserPage.js +23 -24
  213. package/dist/support/pages/KnowledgeBaseUserPage.js.map +1 -1
  214. package/dist/support/pages/SettingsPage.js +43 -44
  215. package/dist/support/pages/SettingsPage.js.map +1 -1
  216. package/dist/support/pages/TicketDetailAdminPage.js +54 -55
  217. package/dist/support/pages/TicketDetailAdminPage.js.map +1 -1
  218. package/dist/support/pages/TicketDetailUserPage.js +61 -62
  219. package/dist/support/pages/TicketDetailUserPage.js.map +1 -1
  220. package/dist/support/pages/TicketListPage.js +77 -78
  221. package/dist/support/pages/TicketListPage.js.map +1 -1
  222. package/dist/support/providers/SupportProvider.js +1 -2
  223. package/dist/support/providers/SupportProvider.js.map +1 -1
  224. package/dist/support/store/supportStore.js +1 -2
  225. package/dist/support/store/supportStore.js.map +1 -1
  226. package/dist/support/translations/en.js +1 -2
  227. package/dist/support/translations/en.js.map +1 -1
  228. package/dist/support/utils/attachments.js +1 -2
  229. package/dist/support/utils/attachments.js.map +1 -1
  230. package/dist/support/utils/breadcrumbRegistry.js +3 -4
  231. package/dist/support/utils/breadcrumbRegistry.js.map +1 -1
  232. package/dist/support/utils/bulkCandidateOperations.js +0 -1
  233. package/dist/support/utils/bulkCandidateOperations.js.map +1 -1
  234. package/dist/support/utils/bulkCandidateTargetQuery.js +1 -2
  235. package/dist/support/utils/bulkCandidateTargetQuery.js.map +1 -1
  236. package/dist/support/utils/categoryColors.js +1 -2
  237. package/dist/support/utils/categoryColors.js.map +1 -1
  238. package/dist/support/utils/cn.js +1 -2
  239. package/dist/support/utils/cn.js.map +1 -1
  240. package/dist/support/utils/context.js +3 -4
  241. package/dist/support/utils/context.js.map +1 -1
  242. package/dist/support/utils/errors.js +1 -2
  243. package/dist/support/utils/errors.js.map +1 -1
  244. package/dist/support/utils/i18n.js +1 -2
  245. package/dist/support/utils/i18n.js.map +1 -1
  246. package/dist/support/utils/index.js +1 -2
  247. package/dist/support/utils/index.js.map +1 -1
  248. package/dist/support/utils/jobApplicationFilterParams.js +1 -2
  249. package/dist/support/utils/jobApplicationFilterParams.js.map +1 -1
  250. package/dist/support/utils/markdown.js +1 -2
  251. package/dist/support/utils/markdown.js.map +1 -1
  252. package/dist/support/utils/supportFiles.js +2 -11
  253. package/dist/support/utils/supportFiles.js.map +1 -1
  254. package/dist/support/utils/ticketFilters.js +1 -2
  255. package/dist/support/utils/ticketFilters.js.map +1 -1
  256. package/dist/support/utils/uiTokens.js +1 -2
  257. package/dist/support/utils/uiTokens.js.map +1 -1
  258. package/dist/utils/nativeBridge.js +1 -2
  259. package/package.json +21 -14
@@ -1,4 +1,4 @@
1
- //#region src/support/events/rybbit.ts
1
+ // src/support/events/rybbit.ts
2
2
  var e = [
3
3
  "support.ticket.created",
4
4
  "support.ticket.closed",
@@ -29,7 +29,6 @@ function a(e, t, n) {
29
29
  rating: n ? "helpful" : "not_helpful"
30
30
  }, { component: "support-kb" });
31
31
  }
32
- //#endregion
33
32
  export { e as SUPPORT_RYBBIT_EVENT_ALLOWLIST, a as emitSupportKbArticleRated, r as emitSupportTicketClosed, n as emitSupportTicketCreated, i as emitSupportTicketReopened };
34
33
 
35
34
  //# sourceMappingURL=rybbit.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"rybbit.js","names":[],"sources":["../../../src/support/events/rybbit.ts"],"sourcesContent":["import type { BurdenoffEventName, EventBus } from '@burdenoff/fe-libs/shared/events';\n\ntype SupportAnalyticsTicket = {\n id: string;\n status?: string | null;\n priority?: string | null;\n categoryId?: string | null;\n};\n\nexport const SUPPORT_RYBBIT_EVENT_ALLOWLIST = [\n 'support.ticket.created',\n 'support.ticket.closed',\n 'support.ticket.reopened',\n 'support.kb.article_rated',\n] as const satisfies readonly BurdenoffEventName[];\n\nfunction ticketPayload(ticket: SupportAnalyticsTicket, workspaceId?: string | null) {\n return {\n ticketId: ticket.id,\n status: ticket.status ?? undefined,\n priority: ticket.priority ?? undefined,\n categoryId: ticket.categoryId ?? undefined,\n workspaceId: workspaceId ?? undefined,\n };\n}\n\nexport function emitSupportTicketCreated(\n eventBus: EventBus,\n ticket: SupportAnalyticsTicket,\n workspaceId?: string | null\n): void {\n eventBus.emit('support.ticket.created', ticketPayload(ticket, workspaceId), {\n component: 'support-ticket',\n });\n}\n\nexport function emitSupportTicketClosed(\n eventBus: EventBus,\n ticket: SupportAnalyticsTicket,\n workspaceId?: string | null\n): void {\n eventBus.emit('support.ticket.closed', ticketPayload(ticket, workspaceId), {\n component: 'support-ticket',\n });\n}\n\nexport function emitSupportTicketReopened(\n eventBus: EventBus,\n ticket: SupportAnalyticsTicket,\n workspaceId?: string | null\n): void {\n eventBus.emit('support.ticket.reopened', ticketPayload(ticket, workspaceId), {\n component: 'support-ticket',\n });\n}\n\nexport function emitSupportKbArticleRated(\n eventBus: EventBus,\n articleId: string,\n helpful: boolean\n): void {\n eventBus.emit(\n 'support.kb.article_rated',\n {\n articleId,\n rating: helpful ? 'helpful' : 'not_helpful',\n },\n { component: 'support-kb' }\n );\n}\n"],"mappings":";AASA,IAAa,IAAiC;CAC5C;CACA;CACA;CACA;AACF;AAEA,SAAS,EAAc,GAAgC,GAA6B;CAClF,OAAO;EACL,UAAU,EAAO;EACjB,QAAQ,EAAO,UAAU,KAAA;EACzB,UAAU,EAAO,YAAY,KAAA;EAC7B,YAAY,EAAO,cAAc,KAAA;EACjC,aAAa,KAAe,KAAA;CAC9B;AACF;AAEA,SAAgB,EACd,GACA,GACA,GACM;CACN,EAAS,KAAK,0BAA0B,EAAc,GAAQ,CAAW,GAAG,EAC1E,WAAW,iBACb,CAAC;AACH;AAEA,SAAgB,EACd,GACA,GACA,GACM;CACN,EAAS,KAAK,yBAAyB,EAAc,GAAQ,CAAW,GAAG,EACzE,WAAW,iBACb,CAAC;AACH;AAEA,SAAgB,EACd,GACA,GACA,GACM;CACN,EAAS,KAAK,2BAA2B,EAAc,GAAQ,CAAW,GAAG,EAC3E,WAAW,iBACb,CAAC;AACH;AAEA,SAAgB,EACd,GACA,GACA,GACM;CACN,EAAS,KACP,4BACA;EACE;EACA,QAAQ,IAAU,YAAY;CAChC,GACA,EAAE,WAAW,aAAa,CAC5B;AACF"}
1
+ {"version":3,"file":"rybbit.js","names":["SUPPORT_RYBBIT_EVENT_ALLOWLIST","ticketPayload","ticket","workspaceId","emitSupportTicketCreated","emitSupportTicketClosed","emitSupportTicketReopened","emitSupportKbArticleRated","helpful"],"sources":["../../../src/support/events/rybbit.ts"],"sourcesContent":["import type { BurdenoffEventName, EventBus } from '@burdenoff/fe-libs/shared/events';\n\ntype SupportAnalyticsTicket = {\n id: string;\n status?: string | null;\n priority?: string | null;\n categoryId?: string | null;\n};\n\nexport const SUPPORT_RYBBIT_EVENT_ALLOWLIST = [\n 'support.ticket.created',\n 'support.ticket.closed',\n 'support.ticket.reopened',\n 'support.kb.article_rated',\n] as const satisfies readonly BurdenoffEventName[];\n\nfunction ticketPayload(ticket: SupportAnalyticsTicket, workspaceId?: string | null) {\n return {\n ticketId: ticket.id,\n status: ticket.status ?? undefined,\n priority: ticket.priority ?? undefined,\n categoryId: ticket.categoryId ?? undefined,\n workspaceId: workspaceId ?? undefined,\n };\n}\n\nexport function emitSupportTicketCreated(\n eventBus: EventBus,\n ticket: SupportAnalyticsTicket,\n workspaceId?: string | null\n): void {\n eventBus.emit('support.ticket.created', ticketPayload(ticket, workspaceId), {\n component: 'support-ticket',\n });\n}\n\nexport function emitSupportTicketClosed(\n eventBus: EventBus,\n ticket: SupportAnalyticsTicket,\n workspaceId?: string | null\n): void {\n eventBus.emit('support.ticket.closed', ticketPayload(ticket, workspaceId), {\n component: 'support-ticket',\n });\n}\n\nexport function emitSupportTicketReopened(\n eventBus: EventBus,\n ticket: SupportAnalyticsTicket,\n workspaceId?: string | null\n): void {\n eventBus.emit('support.ticket.reopened', ticketPayload(ticket, workspaceId), {\n component: 'support-ticket',\n });\n}\n\nexport function emitSupportKbArticleRated(\n eventBus: EventBus,\n articleId: string,\n helpful: boolean\n): void {\n eventBus.emit(\n 'support.kb.article_rated',\n {\n articleId,\n rating: helpful ? 'helpful' : 'not_helpful',\n },\n { component: 'support-kb' }\n );\n}\n"],"mappings":";AASA,IAAaA,IAAiC;CAC5C;CACA;CACA;CACA;AACF;AAEA,SAASC,EAAc,GAAgC,GAA6B;CAClF,OAAO;EACL,UAAUC,EAAO;EACjB,QAAQA,EAAO,UAAU,KAAA;EACzB,UAAUA,EAAO,YAAY,KAAA;EAC7B,YAAYA,EAAO,cAAc,KAAA;EACjC,aAAaC,KAAe,KAAA;CAC9B;AACF;AAEA,SAAgBC,EACd,GACA,GACA,GACM;CACN,EAAS,KAAK,0BAA0BH,EAAcC,GAAQC,CAAW,GAAG,EAC1E,WAAW,iBACb,CAAC;AACH;AAEA,SAAgBE,EACd,GACA,GACA,GACM;CACN,EAAS,KAAK,yBAAyBJ,EAAcC,GAAQC,CAAW,GAAG,EACzE,WAAW,iBACb,CAAC;AACH;AAEA,SAAgBG,EACd,GACA,GACA,GACM;CACN,EAAS,KAAK,2BAA2BL,EAAcC,GAAQC,CAAW,GAAG,EAC3E,WAAW,iBACb,CAAC;AACH;AAEA,SAAgBI,EACd,GACA,GACA,GACM;CACN,EAAS,KACP,4BACA;EACE;EACA,QAAQC,IAAU,YAAY;CAChC,GACA,EAAE,WAAW,aAAa,CAC5B;AACF"}
@@ -1,7 +1,7 @@
1
+ import { useTicketOperations as e } from "./useTicketOperations.js";
2
+ import { useChatOperations as t } from "./useChatOperations.js";
3
+ import { useKnowledgeBaseOperations as n } from "./useKnowledgeBaseOperations.js";
4
+ import { useAnalyticsOperations as r } from "./useAnalyticsOperations.js";
5
+ import { useSupportStore as i } from "../store/supportStore.js";
1
6
  import "./useTr.js";
2
- import { useSupportStore as e } from "../store/supportStore.js";
3
- import { useTicketOperations as t } from "./useTicketOperations.js";
4
- import { useChatOperations as n } from "./useChatOperations.js";
5
- import { useKnowledgeBaseOperations as r } from "./useKnowledgeBaseOperations.js";
6
- import { useAnalyticsOperations as i } from "./useAnalyticsOperations.js";
7
- export { i as useAnalyticsOperations, n as useChatOperations, r as useKnowledgeBaseOperations, e as useSupportStore, t as useTicketOperations };
7
+ export { r as useAnalyticsOperations, t as useChatOperations, n as useKnowledgeBaseOperations, i as useSupportStore, e as useTicketOperations };
@@ -1,7 +1,7 @@
1
1
  import { useGetAgentLeaderboardQuery as e, useGetSatisfactionMetricsQuery as t, useGetSlaReportQuery as n, useGetSupportAnalyticsQuery as r } from "../../generated/global-operations.js";
2
2
  import { TimePeriod as i, TrendGroupBy as a } from "../../generated/global-types.js";
3
3
  import { useState as o } from "react";
4
- //#region src/support/hooks/useAnalyticsOperations.ts
4
+ // src/support/hooks/useAnalyticsOperations.ts
5
5
  function s() {
6
6
  let [s, c] = o(i.Last_30Days), [l, u] = o(a.Day), { data: d, loading: f, error: p, refetch: m } = r({ variables: { filter: {
7
7
  period: s,
@@ -55,7 +55,6 @@ function s() {
55
55
  }
56
56
  };
57
57
  }
58
- //#endregion
59
58
  export { i as TimePeriod, s as useAnalyticsOperations };
60
59
 
61
60
  //# sourceMappingURL=useAnalyticsOperations.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useAnalyticsOperations.js","names":[],"sources":["../../../src/support/hooks/useAnalyticsOperations.ts"],"sourcesContent":["import { useState } from 'react';\nimport {\n useGetSupportAnalyticsQuery,\n useGetSlaReportQuery,\n useGetSatisfactionMetricsQuery,\n useGetAgentLeaderboardQuery,\n} from '../../generated/global-operations';\nimport { TimePeriod, TrendGroupBy } from '../../generated/global-types';\nimport type {\n AnalyticsFilterInput,\n SlaReportFilterInput,\n SatisfactionMetricsFilterInput,\n} from '../../generated/global-types';\n\n// Re-export for external usage\nexport { TimePeriod };\n\nexport function useAnalyticsOperations() {\n const [period, setPeriod] = useState<TimePeriod>(TimePeriod.Last_30Days);\n const [trendGroupBy, setTrendGroupBy] = useState<TrendGroupBy>(TrendGroupBy.Day);\n\n // Build filter from current state\n const buildFilter = (): AnalyticsFilterInput => ({\n period,\n groupBy: trendGroupBy,\n });\n\n // Query: Get support analytics (stats, breakdowns, trends)\n const {\n data: analyticsData,\n loading: analyticsLoading,\n error: analyticsError,\n refetch: refetchAnalytics,\n } = useGetSupportAnalyticsQuery({\n variables: {\n filter: buildFilter(),\n },\n });\n\n // Query: Get SLA report\n const {\n data: slaReportData,\n loading: slaReportLoading,\n error: slaReportError,\n refetch: refetchSLAReport,\n } = useGetSlaReportQuery({\n variables: {\n filter: { period } as SlaReportFilterInput,\n },\n });\n\n // Query: Get satisfaction metrics\n const {\n data: satisfactionData,\n loading: satisfactionLoading,\n error: satisfactionError,\n refetch: refetchSatisfaction,\n } = useGetSatisfactionMetricsQuery({\n variables: {\n filter: { period } as SatisfactionMetricsFilterInput,\n },\n });\n\n // Query: Get agent leaderboard\n const {\n data: leaderboardData,\n loading: leaderboardLoading,\n error: leaderboardError,\n refetch: refetchLeaderboard,\n } = useGetAgentLeaderboardQuery({\n variables: {\n period,\n limit: 10,\n },\n });\n\n // Helper: Update period\n const updatePeriod = (newPeriod: TimePeriod) => {\n setPeriod(newPeriod);\n };\n\n // Helper: Update trend grouping\n const updateTrendGroupBy = (groupBy: TrendGroupBy) => {\n setTrendGroupBy(groupBy);\n };\n\n // Helper: Export analytics report\n const exportReport = async (format: 'PDF' | 'CSV') => {\n try {\n // NOTE: Report export pending — requires backend report generation endpoint or client-side format conversion\n console.log(`Exporting analytics report as ${format}`);\n } catch (error) {\n console.error('Failed to export report:', error);\n }\n };\n\n // Combine all analytics data into a unified structure for backward compatibility\n const analytics = analyticsData?.supportAnalytics\n ? {\n stats: analyticsData.supportAnalytics.stats,\n categoryBreakdown: analyticsData.supportAnalytics.categoryBreakdown,\n priorityBreakdown: analyticsData.supportAnalytics.priorityBreakdown,\n sourceBreakdown: analyticsData.supportAnalytics.sourceBreakdown,\n ticketTrends: analyticsData.supportAnalytics.ticketTrends,\n }\n : null;\n\n return {\n // Data\n analytics,\n slaReport: slaReportData?.slaReport || null,\n satisfaction: satisfactionData?.satisfactionMetrics || null,\n agentLeaderboard: leaderboardData?.agentLeaderboard || null,\n trends: analyticsData?.supportAnalytics.ticketTrends || [],\n period,\n trendGroupBy,\n\n // Loading states\n analyticsLoading,\n slaReportLoading,\n satisfactionLoading,\n leaderboardLoading,\n trendsLoading: analyticsLoading,\n isLoading: analyticsLoading || slaReportLoading || satisfactionLoading || leaderboardLoading,\n\n // Errors\n analyticsError,\n slaReportError,\n satisfactionError,\n leaderboardError,\n trendsError: analyticsError,\n\n // Operations\n updatePeriod,\n updateTrendGroupBy,\n refetchAnalytics,\n refetchSLAReport,\n refetchSatisfaction,\n refetchLeaderboard,\n refetchTrends: refetchAnalytics,\n exportReport,\n };\n}\n"],"mappings":";;;;AAiBA,SAAgB,IAAyB;CACvC,IAAM,CAAC,GAAQ,KAAa,EAAqB,EAAW,WAAW,GACjE,CAAC,GAAc,KAAmB,EAAuB,EAAa,GAAG,GASzE,EACJ,MAAM,GACN,SAAS,GACT,OAAO,GACP,SAAS,MACP,EAA4B,EAC9B,WAAW,EACT,QAb6C;EAC/C;EACA,SAAS;CACX,EAWE,EACF,CAAC,GAGK,EACJ,MAAM,GACN,SAAS,GACT,OAAO,GACP,SAAS,MACP,EAAqB,EACvB,WAAW,EACT,QAAQ,EAAE,UAAO,EACnB,EACF,CAAC,GAGK,EACJ,MAAM,GACN,SAAS,GACT,OAAO,GACP,SAAS,MACP,EAA+B,EACjC,WAAW,EACT,QAAQ,EAAE,UAAO,EACnB,EACF,CAAC,GAGK,EACJ,MAAM,GACN,SAAS,GACT,OAAO,GACP,SAAS,MACP,EAA4B,EAC9B,WAAW;EACT;EACA,OAAO;CACT,EACF,CAAC;CAiCD,OAAO;EAEL,WAZgB,GAAe,mBAC7B;GACE,OAAO,EAAc,iBAAiB;GACtC,mBAAmB,EAAc,iBAAiB;GAClD,mBAAmB,EAAc,iBAAiB;GAClD,iBAAiB,EAAc,iBAAiB;GAChD,cAAc,EAAc,iBAAiB;EAC/C,IACA;EAKF,WAAW,GAAe,aAAa;EACvC,cAAc,GAAkB,uBAAuB;EACvD,kBAAkB,GAAiB,oBAAoB;EACvD,QAAQ,GAAe,iBAAiB,gBAAgB,CAAC;EACzD;EACA;EAGA;EACA;EACA;EACA;EACA,eAAe;EACf,WAAW,KAAoB,KAAoB,KAAuB;EAG1E;EACA;EACA;EACA;EACA,aAAa;EAGb,eAxDoB,MAA0B;GAC9C,EAAU,CAAS;EACrB;EAuDE,qBApD0B,MAA0B;GACpD,EAAgB,CAAO;EACzB;EAmDE;EACA;EACA;EACA;EACA,eAAe;EACf,qBArD0B,MAA0B;GACpD,IAAI;IAEF,QAAQ,IAAI,iCAAiC,GAAQ;GACvD,SAAS,GAAO;IACd,QAAQ,MAAM,4BAA4B,CAAK;GACjD;EACF;CA+CA;AACF"}
1
+ {"version":3,"file":"useAnalyticsOperations.js","names":["useAnalyticsOperations","period","setPeriod","useState","TimePeriod","trendGroupBy","setTrendGroupBy","TrendGroupBy","analyticsData","analyticsLoading","analyticsError","refetchAnalytics","useGetSupportAnalyticsQuery","slaReportData","slaReportLoading","slaReportError","refetchSLAReport","useGetSlaReportQuery","satisfactionData","satisfactionLoading","satisfactionError","refetchSatisfaction","useGetSatisfactionMetricsQuery","leaderboardData","leaderboardLoading","leaderboardError","refetchLeaderboard","useGetAgentLeaderboardQuery","newPeriod","groupBy","format","error"],"sources":["../../../src/support/hooks/useAnalyticsOperations.ts"],"sourcesContent":["import { useState } from 'react';\nimport {\n useGetSupportAnalyticsQuery,\n useGetSlaReportQuery,\n useGetSatisfactionMetricsQuery,\n useGetAgentLeaderboardQuery,\n} from '../../generated/global-operations';\nimport { TimePeriod, TrendGroupBy } from '../../generated/global-types';\nimport type {\n AnalyticsFilterInput,\n SlaReportFilterInput,\n SatisfactionMetricsFilterInput,\n} from '../../generated/global-types';\n\n// Re-export for external usage\nexport { TimePeriod };\n\nexport function useAnalyticsOperations() {\n const [period, setPeriod] = useState<TimePeriod>(TimePeriod.Last_30Days);\n const [trendGroupBy, setTrendGroupBy] = useState<TrendGroupBy>(TrendGroupBy.Day);\n\n // Build filter from current state\n const buildFilter = (): AnalyticsFilterInput => ({\n period,\n groupBy: trendGroupBy,\n });\n\n // Query: Get support analytics (stats, breakdowns, trends)\n const {\n data: analyticsData,\n loading: analyticsLoading,\n error: analyticsError,\n refetch: refetchAnalytics,\n } = useGetSupportAnalyticsQuery({\n variables: {\n filter: buildFilter(),\n },\n });\n\n // Query: Get SLA report\n const {\n data: slaReportData,\n loading: slaReportLoading,\n error: slaReportError,\n refetch: refetchSLAReport,\n } = useGetSlaReportQuery({\n variables: {\n filter: { period } as SlaReportFilterInput,\n },\n });\n\n // Query: Get satisfaction metrics\n const {\n data: satisfactionData,\n loading: satisfactionLoading,\n error: satisfactionError,\n refetch: refetchSatisfaction,\n } = useGetSatisfactionMetricsQuery({\n variables: {\n filter: { period } as SatisfactionMetricsFilterInput,\n },\n });\n\n // Query: Get agent leaderboard\n const {\n data: leaderboardData,\n loading: leaderboardLoading,\n error: leaderboardError,\n refetch: refetchLeaderboard,\n } = useGetAgentLeaderboardQuery({\n variables: {\n period,\n limit: 10,\n },\n });\n\n // Helper: Update period\n const updatePeriod = (newPeriod: TimePeriod) => {\n setPeriod(newPeriod);\n };\n\n // Helper: Update trend grouping\n const updateTrendGroupBy = (groupBy: TrendGroupBy) => {\n setTrendGroupBy(groupBy);\n };\n\n // Helper: Export analytics report\n const exportReport = async (format: 'PDF' | 'CSV') => {\n try {\n // NOTE: Report export pending — requires backend report generation endpoint or client-side format conversion\n console.log(`Exporting analytics report as ${format}`);\n } catch (error) {\n console.error('Failed to export report:', error);\n }\n };\n\n // Combine all analytics data into a unified structure for backward compatibility\n const analytics = analyticsData?.supportAnalytics\n ? {\n stats: analyticsData.supportAnalytics.stats,\n categoryBreakdown: analyticsData.supportAnalytics.categoryBreakdown,\n priorityBreakdown: analyticsData.supportAnalytics.priorityBreakdown,\n sourceBreakdown: analyticsData.supportAnalytics.sourceBreakdown,\n ticketTrends: analyticsData.supportAnalytics.ticketTrends,\n }\n : null;\n\n return {\n // Data\n analytics,\n slaReport: slaReportData?.slaReport || null,\n satisfaction: satisfactionData?.satisfactionMetrics || null,\n agentLeaderboard: leaderboardData?.agentLeaderboard || null,\n trends: analyticsData?.supportAnalytics.ticketTrends || [],\n period,\n trendGroupBy,\n\n // Loading states\n analyticsLoading,\n slaReportLoading,\n satisfactionLoading,\n leaderboardLoading,\n trendsLoading: analyticsLoading,\n isLoading: analyticsLoading || slaReportLoading || satisfactionLoading || leaderboardLoading,\n\n // Errors\n analyticsError,\n slaReportError,\n satisfactionError,\n leaderboardError,\n trendsError: analyticsError,\n\n // Operations\n updatePeriod,\n updateTrendGroupBy,\n refetchAnalytics,\n refetchSLAReport,\n refetchSatisfaction,\n refetchLeaderboard,\n refetchTrends: refetchAnalytics,\n exportReport,\n };\n}\n"],"mappings":";;;;AAiBA,SAAgBA,IAAyB;CACvC,IAAM,CAACC,GAAQC,KAAaC,EAAqBC,EAAW,WAAW,GACjE,CAACC,GAAcC,KAAmBH,EAAuBI,EAAa,GAAG,GASzE,EACJ,MAAMC,GACN,SAASC,GACT,OAAOC,GACP,SAASC,MACPC,EAA4B,EAC9B,WAAW,EACT,QAb6C;EAC/C;EACA,SAASP;CACX,EAWE,EACF,CAAC,GAGK,EACJ,MAAMQ,GACN,SAASC,GACT,OAAOC,GACP,SAASC,MACPC,EAAqB,EACvB,WAAW,EACT,QAAQ,EAAE,UAAO,EACnB,EACF,CAAC,GAGK,EACJ,MAAMC,GACN,SAASC,GACT,OAAOC,GACP,SAASC,MACPC,EAA+B,EACjC,WAAW,EACT,QAAQ,EAAE,UAAO,EACnB,EACF,CAAC,GAGK,EACJ,MAAMC,GACN,SAASC,GACT,OAAOC,GACP,SAASC,MACPC,EAA4B,EAC9B,WAAW;EACT;EACA,OAAO;CACT,EACF,CAAC;CAiCD,OAAO;EAEL,WAZgBnB,GAAe,mBAC7B;GACE,OAAOA,EAAc,iBAAiB;GACtC,mBAAmBA,EAAc,iBAAiB;GAClD,mBAAmBA,EAAc,iBAAiB;GAClD,iBAAiBA,EAAc,iBAAiB;GAChD,cAAcA,EAAc,iBAAiB;EAC/C,IACA;EAKF,WAAWK,GAAe,aAAa;EACvC,cAAcK,GAAkB,uBAAuB;EACvD,kBAAkBK,GAAiB,oBAAoB;EACvD,QAAQf,GAAe,iBAAiB,gBAAgB,CAAC;EACzD;EACA;EAGA;EACA;EACA;EACA;EACA,eAAeC;EACf,WAAWA,KAAoBK,KAAoBK,KAAuBK;EAG1E;EACA;EACA;EACA;EACA,aAAad;EAGb,eAxDoB,MAA0B;GAC9C,EAAUkB,CAAS;EACrB;EAuDE,qBApD0B,MAA0B;GACpD,EAAgBC,CAAO;EACzB;EAmDE;EACA;EACA;EACA;EACA,eAAelB;EACf,qBArD0B,MAA0B;GACpD,IAAI;IAEF,QAAQ,IAAI,iCAAiCmB,GAAQ;GACvD,SAASC,GAAO;IACd,QAAQ,MAAM,4BAA4BA,CAAK;GACjD;EACF;CA+CA;AACF"}
@@ -1,7 +1,7 @@
1
1
  import { ATTACHMENTS_FAILED_PARAM as e } from "../constants.js";
2
2
  import { useEffect as t } from "react";
3
3
  import { useSearchParams as n } from "react-router";
4
- //#region src/support/hooks/useAttachmentsFailedToast.ts
4
+ // src/support/hooks/useAttachmentsFailedToast.ts
5
5
  var r = "Ticket created, but attachments failed. Please retry from this page.", i = 6e3;
6
6
  function a(a) {
7
7
  let [o, s] = n();
@@ -16,7 +16,6 @@ function a(a) {
16
16
  s
17
17
  ]);
18
18
  }
19
- //#endregion
20
19
  export { a as useAttachmentsFailedToast };
21
20
 
22
21
  //# sourceMappingURL=useAttachmentsFailedToast.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useAttachmentsFailedToast.js","names":[],"sources":["../../../src/support/hooks/useAttachmentsFailedToast.ts"],"sourcesContent":["import { useEffect } from 'react';\nimport { useSearchParams } from 'react-router';\n\nimport { ATTACHMENTS_FAILED_PARAM } from '../constants';\nimport type { UseNotificationApi } from './useNotification';\n\n/**\n * Surface the \"ticket created, but attachments failed\" toast on the ticket\n * detail page after `CreateTicketPage` redirects.\n *\n * Consumes a code-only query param (`?attachmentsFailed=1`) so no server-side\n * error text ever lands in the URL / browser history / referer / proxy logs.\n * The client-safe message is composed entirely from the constant below, which\n * lives in this repo and is safe to surface.\n *\n * The param is removed from the URL via `replace: true` so a user hitting back\n * doesn't re-fire the toast on every navigation.\n */\nconst DEFAULT_MESSAGE = 'Ticket created, but attachments failed. Please retry from this page.';\nconst DEFAULT_DURATION_MS = 6000;\n\nexport function useAttachmentsFailedToast(notify: UseNotificationApi['notify']): void {\n const [searchParams, setSearchParams] = useSearchParams();\n\n useEffect(() => {\n if (!searchParams.has(ATTACHMENTS_FAILED_PARAM)) {\n return;\n }\n\n notify('error', DEFAULT_MESSAGE, DEFAULT_DURATION_MS);\n\n const nextParams = new URLSearchParams(searchParams);\n nextParams.delete(ATTACHMENTS_FAILED_PARAM);\n setSearchParams(nextParams, { replace: true });\n }, [notify, searchParams, setSearchParams]);\n}\n"],"mappings":";;;;AAkBA,IAAM,IAAkB,wEAClB,IAAsB;AAE5B,SAAgB,EAA0B,GAA4C;CACpF,IAAM,CAAC,GAAc,KAAmB,EAAgB;CAExD,QAAgB;EACd,IAAI,CAAC,EAAa,IAAA,mBAA4B,GAC5C;EAGF,EAAO,SAAS,GAAiB,CAAmB;EAEpD,IAAM,IAAa,IAAI,gBAAgB,CAAY;EAEnD,AADA,EAAW,OAAO,CAAwB,GAC1C,EAAgB,GAAY,EAAE,SAAS,GAAK,CAAC;CAC/C,GAAG;EAAC;EAAQ;EAAc;CAAe,CAAC;AAC5C"}
1
+ {"version":3,"file":"useAttachmentsFailedToast.js","names":["DEFAULT_MESSAGE","DEFAULT_DURATION_MS","useAttachmentsFailedToast","searchParams","setSearchParams","useSearchParams","nextParams","ATTACHMENTS_FAILED_PARAM","notify"],"sources":["../../../src/support/hooks/useAttachmentsFailedToast.ts"],"sourcesContent":["import { useEffect } from 'react';\nimport { useSearchParams } from 'react-router';\n\nimport { ATTACHMENTS_FAILED_PARAM } from '../constants';\nimport type { UseNotificationApi } from './useNotification';\n\n/**\n * Surface the \"ticket created, but attachments failed\" toast on the ticket\n * detail page after `CreateTicketPage` redirects.\n *\n * Consumes a code-only query param (`?attachmentsFailed=1`) so no server-side\n * error text ever lands in the URL / browser history / referer / proxy logs.\n * The client-safe message is composed entirely from the constant below, which\n * lives in this repo and is safe to surface.\n *\n * The param is removed from the URL via `replace: true` so a user hitting back\n * doesn't re-fire the toast on every navigation.\n */\nconst DEFAULT_MESSAGE = 'Ticket created, but attachments failed. Please retry from this page.';\nconst DEFAULT_DURATION_MS = 6000;\n\nexport function useAttachmentsFailedToast(notify: UseNotificationApi['notify']): void {\n const [searchParams, setSearchParams] = useSearchParams();\n\n useEffect(() => {\n if (!searchParams.has(ATTACHMENTS_FAILED_PARAM)) {\n return;\n }\n\n notify('error', DEFAULT_MESSAGE, DEFAULT_DURATION_MS);\n\n const nextParams = new URLSearchParams(searchParams);\n nextParams.delete(ATTACHMENTS_FAILED_PARAM);\n setSearchParams(nextParams, { replace: true });\n }, [notify, searchParams, setSearchParams]);\n}\n"],"mappings":";;;;AAkBA,IAAMA,IAAkB,wEAClBC,IAAsB;AAE5B,SAAgBC,EAA0B,GAA4C;CACpF,IAAM,CAACC,GAAcC,KAAmBC,EAAgB;CAExD,QAAgB;EACd,IAAI,CAACF,EAAa,IAAA,mBAA4B,GAC5C;EAGF,EAAO,SAASH,GAAiBC,CAAmB;EAEpD,IAAMK,IAAa,IAAI,gBAAgBH,CAAY;EAEnD,AADAG,EAAW,OAAOC,CAAwB,GAC1CH,EAAgBE,GAAY,EAAE,SAAS,GAAK,CAAC;CAC/C,GAAG;EAACE;EAAQL;EAAcC;CAAe,CAAC;AAC5C"}
@@ -1,11 +1,11 @@
1
- import { useSupport as e } from "../providers/SupportProvider.js";
2
- import { useSupportStore as t } from "../store/supportStore.js";
3
- import { useCreateSupportMessageMutation as n, useCreateSupportTicketMutation as r, useGetTicketDetailQuery as i, useSubscribeTicketMessageAddedSubscription as a, useUpdateSupportTicketStatusMutation as o } from "../../generated/global-operations.js";
4
- import { MessageType as s, SupportTicketPriority as c, SupportTicketStatus as l, TicketSource as u } from "../../generated/global-types.js";
1
+ import { useCreateSupportMessageMutation as e, useCreateSupportTicketMutation as t, useGetTicketDetailQuery as n, useSubscribeTicketMessageAddedSubscription as r, useUpdateSupportTicketStatusMutation as i } from "../../generated/global-operations.js";
2
+ import { MessageType as a, SupportTicketPriority as o, SupportTicketStatus as s, TicketSource as c } from "../../generated/global-types.js";
3
+ import { useSupport as l } from "../providers/SupportProvider.js";
4
+ import { useSupportStore as u } from "../store/supportStore.js";
5
5
  import { useEffect as d, useMemo as f } from "react";
6
- //#region src/support/hooks/useChatOperations.ts
6
+ // src/support/hooks/useChatOperations.ts
7
7
  function p(e) {
8
- return e === s.AgentReply || e === s.InternalNote ? "AGENT" : e === s.SystemMessage ? "SYSTEM" : "CUSTOMER";
8
+ return e === a.AgentReply || e === a.InternalNote ? "AGENT" : e === a.SystemMessage ? "SYSTEM" : "CUSTOMER";
9
9
  }
10
10
  function m(e) {
11
11
  return {
@@ -30,7 +30,7 @@ function h(e) {
30
30
  } : void 0;
31
31
  return {
32
32
  id: e.id,
33
- status: e.status === l.Closed || e.status === l.Resolved ? "ENDED" : n ? "ACTIVE" : "WAITING",
33
+ status: e.status === s.Closed || e.status === s.Resolved ? "ENDED" : n ? "ACTIVE" : "WAITING",
34
34
  startedAt: e.createdAt,
35
35
  endedAt: e.closedAt ?? e.resolvedAt ?? void 0,
36
36
  queuePosition: n ? void 0 : 0,
@@ -40,15 +40,15 @@ function h(e) {
40
40
  };
41
41
  }
42
42
  function g(m) {
43
- let { workspaceId: g, organizationId: _, productId: v, currentUser: y, onChatStarted: b } = e(), { chatSession: x, startChatSession: S, endChatSession: C, minimizeChat: w, maximizeChat: T, setAgentTyping: E, setQueuePosition: D } = t(), { data: O, loading: k, refetch: A } = i({
43
+ let { workspaceId: g, organizationId: _, productId: v, currentUser: y, onChatStarted: b } = l(), { chatSession: x, startChatSession: S, endChatSession: C, minimizeChat: w, maximizeChat: T, setAgentTyping: E, setQueuePosition: D } = u(), { data: O, loading: k, refetch: A } = n({
44
44
  variables: { id: m ?? "" },
45
45
  skip: !m
46
- }), [j, { loading: M }] = r(), [N, { loading: P }] = n(), [F, { loading: I }] = o(), { data: L } = a({
46
+ }), [j, { loading: M }] = t(), [N, { loading: P }] = e(), [F, { loading: I }] = i(), { data: L } = r({
47
47
  variables: { ticketId: m ?? "" },
48
48
  skip: !m
49
49
  });
50
50
  d(() => {
51
- !L?.ticketMessageAdded || !m || A();
51
+ L?.ticketMessageAdded && m && A();
52
52
  }, [
53
53
  L,
54
54
  A,
@@ -69,8 +69,8 @@ function g(m) {
69
69
  let t = e.subject?.trim() || "Support conversation", n = e.name || e.email || y?.displayName || y?.email, r = n ? `Support conversation requested by ${n}` : "Support conversation requested from the support widget", i = (await j({ variables: { input: {
70
70
  subject: t,
71
71
  description: r,
72
- priority: c.Normal,
73
- source: u.Website,
72
+ priority: o.Normal,
73
+ source: c.Website,
74
74
  tags: ["ticket-conversation"],
75
75
  workspaceId: g,
76
76
  context: {
@@ -102,7 +102,7 @@ function g(m) {
102
102
  let n = (await N({ variables: { input: {
103
103
  ticketId: m,
104
104
  message: e,
105
- type: s.CustomerReply,
105
+ type: a.CustomerReply,
106
106
  context: {
107
107
  workspaceId: g,
108
108
  organizationId: _,
@@ -126,7 +126,7 @@ function g(m) {
126
126
  terminateChatSession: async (e) => {
127
127
  m && await F({ variables: {
128
128
  id: m,
129
- status: l.Closed
129
+ status: s.Closed
130
130
  } }), C();
131
131
  },
132
132
  refetchSessions: async () => {
@@ -140,7 +140,6 @@ function g(m) {
140
140
  setAgentTyping: E
141
141
  };
142
142
  }
143
- //#endregion
144
143
  export { g as useChatOperations };
145
144
 
146
145
  //# sourceMappingURL=useChatOperations.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useChatOperations.js","names":[],"sources":["../../../src/support/hooks/useChatOperations.ts"],"sourcesContent":["import { useEffect, useMemo } from 'react';\n\nimport {\n useCreateSupportMessageMutation,\n useCreateSupportTicketMutation,\n useGetTicketDetailQuery,\n useSubscribeTicketMessageAddedSubscription,\n useUpdateSupportTicketStatusMutation,\n type GetTicketDetailQuery,\n} from '../../generated/global-operations';\nimport {\n MessageType,\n SupportTicketPriority,\n SupportTicketStatus,\n TicketSource,\n} from '../../generated/global-types';\nimport { useSupport } from '../providers/SupportProvider';\nimport { useSupportStore } from '../store/supportStore';\nimport type { ChatMessage, ChatSession } from '../types';\n\ntype TicketDetail = NonNullable<GetTicketDetailQuery['supportTicket']>;\ntype TicketMessage = TicketDetail['messages'][number];\n\nfunction mapMessageType(type: MessageType): ChatMessage['senderType'] {\n if (type === MessageType.AgentReply || type === MessageType.InternalNote) return 'AGENT';\n if (type === MessageType.SystemMessage) return 'SYSTEM';\n return 'CUSTOMER';\n}\n\nfunction mapMessage(message: TicketMessage): ChatMessage {\n return {\n id: message.id,\n content: message.message,\n senderType: mapMessageType(message.type),\n createdAt: message.createdAt,\n attachments: message.attachments.map((attachmentId) => ({\n id: attachmentId,\n filename: attachmentId,\n url: attachmentId,\n size: 0,\n })),\n };\n}\n\nfunction mapTicketToChatSession(ticket: TicketDetail | null | undefined): ChatSession | null {\n if (!ticket) return null;\n const messages = ticket.messages.map(mapMessage);\n const assignedAgent = ticket.assignedTo\n ? {\n id: ticket.assignedTo,\n displayName: ticket.assignedTo,\n email: '',\n }\n : undefined;\n\n return {\n id: ticket.id,\n status:\n ticket.status === SupportTicketStatus.Closed || ticket.status === SupportTicketStatus.Resolved\n ? 'ENDED'\n : assignedAgent\n ? 'ACTIVE'\n : 'WAITING',\n startedAt: ticket.createdAt,\n endedAt: ticket.closedAt ?? ticket.resolvedAt ?? undefined,\n queuePosition: assignedAgent ? undefined : 0,\n assignedAgent,\n messages,\n lastMessage: messages.at(-1),\n };\n}\n\nexport function useChatOperations(sessionId?: string) {\n const { workspaceId, organizationId, productId, currentUser, onChatStarted } = useSupport();\n const {\n chatSession,\n startChatSession: startChatSessionStore,\n endChatSession: endChatSessionStore,\n minimizeChat,\n maximizeChat,\n setAgentTyping,\n setQueuePosition,\n } = useSupportStore();\n\n const {\n data: sessionData,\n loading: sessionLoading,\n refetch: refetchTicket,\n } = useGetTicketDetailQuery({\n variables: { id: sessionId ?? '' },\n skip: !sessionId,\n });\n\n const [createTicket, { loading: startingChat }] = useCreateSupportTicketMutation();\n const [createMessage, { loading: sendingMessage }] = useCreateSupportMessageMutation();\n const [updateTicketStatus, { loading: endingChat }] = useUpdateSupportTicketStatusMutation();\n\n const { data: messageSubscriptionData } = useSubscribeTicketMessageAddedSubscription({\n variables: { ticketId: sessionId ?? '' },\n skip: !sessionId,\n });\n\n useEffect(() => {\n if (!messageSubscriptionData?.ticketMessageAdded || !sessionId) return;\n void refetchTicket();\n }, [messageSubscriptionData, refetchTicket, sessionId]);\n\n const currentSession = useMemo(\n () => mapTicketToChatSession(sessionData?.supportTicket),\n [sessionData?.supportTicket]\n );\n\n const messages = currentSession?.messages ?? [];\n\n const initiateChatSession = async (input: {\n name?: string;\n email?: string;\n subject?: string;\n }): Promise<ChatSession | undefined> => {\n const subject = input.subject?.trim() || 'Support conversation';\n const requester = input.name || input.email || currentUser?.displayName || currentUser?.email;\n const description = requester\n ? `Support conversation requested by ${requester}`\n : 'Support conversation requested from the support widget';\n const result = await createTicket({\n variables: {\n input: {\n subject,\n description,\n priority: SupportTicketPriority.Normal,\n source: TicketSource.Website,\n tags: ['ticket-conversation'],\n workspaceId,\n context: {\n workspaceId,\n organizationId,\n productId,\n userId: currentUser?.id,\n custom: {\n channel: 'ticket-conversation',\n requesterName: input.name,\n requesterEmail: input.email,\n },\n },\n },\n },\n });\n const ticket = result.data?.createSupportTicket;\n if (!ticket) return undefined;\n\n startChatSessionStore();\n setQueuePosition(0);\n const session: ChatSession = {\n id: ticket.id,\n status: 'WAITING',\n startedAt: ticket.createdAt,\n queuePosition: 0,\n messages: [],\n };\n onChatStarted?.({ id: ticket.id });\n return session;\n };\n\n const sendMessage = async (\n content: string,\n attachments?: File[]\n ): Promise<ChatMessage | undefined> => {\n if (!sessionId) {\n throw new Error('Cannot send a chat message without an active ticket-backed chat session.');\n }\n if (attachments?.length) {\n throw new Error('Chat attachment uploads must be completed before sending the message.');\n }\n\n const result = await createMessage({\n variables: {\n input: {\n ticketId: sessionId,\n message: content,\n type: MessageType.CustomerReply,\n context: {\n workspaceId,\n organizationId,\n productId,\n userId: currentUser?.id,\n },\n },\n },\n });\n const message = result.data?.createSupportMessage;\n if (!message) return undefined;\n await refetchTicket();\n return {\n id: message.id,\n content: message.message,\n senderType: mapMessageType(message.type),\n createdAt: message.createdAt,\n attachments: message.attachments.map((attachmentId: string) => ({\n id: attachmentId,\n filename: attachmentId,\n url: attachmentId,\n size: 0,\n })),\n };\n };\n\n const terminateChatSession = async (_feedback?: {\n rating?: number;\n comment?: string;\n }): Promise<void> => {\n if (sessionId) {\n await updateTicketStatus({\n variables: {\n id: sessionId,\n status: SupportTicketStatus.Closed,\n },\n });\n }\n endChatSessionStore();\n };\n\n const refetchSessions = async () => {\n if (sessionId) await refetchTicket();\n };\n\n const refetchSession = async () => {\n if (sessionId) await refetchTicket();\n };\n\n return {\n chatSessions: currentSession ? [currentSession] : [],\n currentSession,\n messages,\n\n sessionsLoading: sessionLoading,\n sessionLoading,\n startingChat,\n sendingMessage,\n endingChat,\n\n // Chat session state\n chatSession,\n\n initiateChatSession,\n sendMessage,\n terminateChatSession,\n refetchSessions,\n refetchSession,\n minimizeChat,\n maximizeChat,\n setAgentTyping,\n };\n}\n"],"mappings":";;;;;;AAuBA,SAAS,EAAe,GAA8C;CAGpE,OAFI,MAAS,EAAY,cAAc,MAAS,EAAY,eAAqB,UAC7E,MAAS,EAAY,gBAAsB,WACxC;AACT;AAEA,SAAS,EAAW,GAAqC;CACvD,OAAO;EACL,IAAI,EAAQ;EACZ,SAAS,EAAQ;EACjB,YAAY,EAAe,EAAQ,IAAI;EACvC,WAAW,EAAQ;EACnB,aAAa,EAAQ,YAAY,KAAK,OAAkB;GACtD,IAAI;GACJ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AU;KACV,KAAK;KACL,MAAM;IACR,EAAE;GACJ;EACF;EAyCE,6BAvCkC,MAGf;GASnB,AARI,KACF,MAAM,EAAmB,EACvB,WAAW;IACT,IAAI;IACJ,QAAQ,EAAoB;GAC9B,EACF,CAAC,GAEH,EAAoB;EACtB;EA2BE,6BAzBkC;GAClC,AAAI,KAAW,MAAM,EAAc;EACrC;EAwBE,4BAtBiC;GACjC,AAAI,KAAW,MAAM,EAAc;EACrC;EAqBE;EACA;EACA;CACF;AACF"}
1
+ {"version":3,"file":"useChatOperations.js","names":["mapMessageType","type","MessageType","mapMessage","message","attachmentId","mapTicketToChatSession","ticket","messages","assignedAgent","SupportTicketStatus","useChatOperations","useSupport","startChatSessionStore","endChatSessionStore","useSupportStore","sessionData","sessionLoading","refetchTicket","useGetTicketDetailQuery","sessionId","createTicket","startingChat","useCreateSupportTicketMutation","createMessage","sendingMessage","useCreateSupportMessageMutation","updateTicketStatus","endingChat","useUpdateSupportTicketStatusMutation","messageSubscriptionData","useSubscribeTicketMessageAddedSubscription","currentSession","useMemo","subject","input","requester","currentUser","description","SupportTicketPriority","TicketSource","setQueuePosition","session","onChatStarted","attachments","content"],"sources":["../../../src/support/hooks/useChatOperations.ts"],"sourcesContent":["import { useEffect, useMemo } from 'react';\n\nimport {\n useCreateSupportMessageMutation,\n useCreateSupportTicketMutation,\n useGetTicketDetailQuery,\n useSubscribeTicketMessageAddedSubscription,\n useUpdateSupportTicketStatusMutation,\n type GetTicketDetailQuery,\n} from '../../generated/global-operations';\nimport {\n MessageType,\n SupportTicketPriority,\n SupportTicketStatus,\n TicketSource,\n} from '../../generated/global-types';\nimport { useSupport } from '../providers/SupportProvider';\nimport { useSupportStore } from '../store/supportStore';\nimport type { ChatMessage, ChatSession } from '../types';\n\ntype TicketDetail = NonNullable<GetTicketDetailQuery['supportTicket']>;\ntype TicketMessage = TicketDetail['messages'][number];\n\nfunction mapMessageType(type: MessageType): ChatMessage['senderType'] {\n if (type === MessageType.AgentReply || type === MessageType.InternalNote) return 'AGENT';\n if (type === MessageType.SystemMessage) return 'SYSTEM';\n return 'CUSTOMER';\n}\n\nfunction mapMessage(message: TicketMessage): ChatMessage {\n return {\n id: message.id,\n content: message.message,\n senderType: mapMessageType(message.type),\n createdAt: message.createdAt,\n attachments: message.attachments.map((attachmentId) => ({\n id: attachmentId,\n filename: attachmentId,\n url: attachmentId,\n size: 0,\n })),\n };\n}\n\nfunction mapTicketToChatSession(ticket: TicketDetail | null | undefined): ChatSession | null {\n if (!ticket) return null;\n const messages = ticket.messages.map(mapMessage);\n const assignedAgent = ticket.assignedTo\n ? {\n id: ticket.assignedTo,\n displayName: ticket.assignedTo,\n email: '',\n }\n : undefined;\n\n return {\n id: ticket.id,\n status:\n ticket.status === SupportTicketStatus.Closed || ticket.status === SupportTicketStatus.Resolved\n ? 'ENDED'\n : assignedAgent\n ? 'ACTIVE'\n : 'WAITING',\n startedAt: ticket.createdAt,\n endedAt: ticket.closedAt ?? ticket.resolvedAt ?? undefined,\n queuePosition: assignedAgent ? undefined : 0,\n assignedAgent,\n messages,\n lastMessage: messages.at(-1),\n };\n}\n\nexport function useChatOperations(sessionId?: string) {\n const { workspaceId, organizationId, productId, currentUser, onChatStarted } = useSupport();\n const {\n chatSession,\n startChatSession: startChatSessionStore,\n endChatSession: endChatSessionStore,\n minimizeChat,\n maximizeChat,\n setAgentTyping,\n setQueuePosition,\n } = useSupportStore();\n\n const {\n data: sessionData,\n loading: sessionLoading,\n refetch: refetchTicket,\n } = useGetTicketDetailQuery({\n variables: { id: sessionId ?? '' },\n skip: !sessionId,\n });\n\n const [createTicket, { loading: startingChat }] = useCreateSupportTicketMutation();\n const [createMessage, { loading: sendingMessage }] = useCreateSupportMessageMutation();\n const [updateTicketStatus, { loading: endingChat }] = useUpdateSupportTicketStatusMutation();\n\n const { data: messageSubscriptionData } = useSubscribeTicketMessageAddedSubscription({\n variables: { ticketId: sessionId ?? '' },\n skip: !sessionId,\n });\n\n useEffect(() => {\n if (!messageSubscriptionData?.ticketMessageAdded || !sessionId) return;\n void refetchTicket();\n }, [messageSubscriptionData, refetchTicket, sessionId]);\n\n const currentSession = useMemo(\n () => mapTicketToChatSession(sessionData?.supportTicket),\n [sessionData?.supportTicket]\n );\n\n const messages = currentSession?.messages ?? [];\n\n const initiateChatSession = async (input: {\n name?: string;\n email?: string;\n subject?: string;\n }): Promise<ChatSession | undefined> => {\n const subject = input.subject?.trim() || 'Support conversation';\n const requester = input.name || input.email || currentUser?.displayName || currentUser?.email;\n const description = requester\n ? `Support conversation requested by ${requester}`\n : 'Support conversation requested from the support widget';\n const result = await createTicket({\n variables: {\n input: {\n subject,\n description,\n priority: SupportTicketPriority.Normal,\n source: TicketSource.Website,\n tags: ['ticket-conversation'],\n workspaceId,\n context: {\n workspaceId,\n organizationId,\n productId,\n userId: currentUser?.id,\n custom: {\n channel: 'ticket-conversation',\n requesterName: input.name,\n requesterEmail: input.email,\n },\n },\n },\n },\n });\n const ticket = result.data?.createSupportTicket;\n if (!ticket) return undefined;\n\n startChatSessionStore();\n setQueuePosition(0);\n const session: ChatSession = {\n id: ticket.id,\n status: 'WAITING',\n startedAt: ticket.createdAt,\n queuePosition: 0,\n messages: [],\n };\n onChatStarted?.({ id: ticket.id });\n return session;\n };\n\n const sendMessage = async (\n content: string,\n attachments?: File[]\n ): Promise<ChatMessage | undefined> => {\n if (!sessionId) {\n throw new Error('Cannot send a chat message without an active ticket-backed chat session.');\n }\n if (attachments?.length) {\n throw new Error('Chat attachment uploads must be completed before sending the message.');\n }\n\n const result = await createMessage({\n variables: {\n input: {\n ticketId: sessionId,\n message: content,\n type: MessageType.CustomerReply,\n context: {\n workspaceId,\n organizationId,\n productId,\n userId: currentUser?.id,\n },\n },\n },\n });\n const message = result.data?.createSupportMessage;\n if (!message) return undefined;\n await refetchTicket();\n return {\n id: message.id,\n content: message.message,\n senderType: mapMessageType(message.type),\n createdAt: message.createdAt,\n attachments: message.attachments.map((attachmentId: string) => ({\n id: attachmentId,\n filename: attachmentId,\n url: attachmentId,\n size: 0,\n })),\n };\n };\n\n const terminateChatSession = async (_feedback?: {\n rating?: number;\n comment?: string;\n }): Promise<void> => {\n if (sessionId) {\n await updateTicketStatus({\n variables: {\n id: sessionId,\n status: SupportTicketStatus.Closed,\n },\n });\n }\n endChatSessionStore();\n };\n\n const refetchSessions = async () => {\n if (sessionId) await refetchTicket();\n };\n\n const refetchSession = async () => {\n if (sessionId) await refetchTicket();\n };\n\n return {\n chatSessions: currentSession ? [currentSession] : [],\n currentSession,\n messages,\n\n sessionsLoading: sessionLoading,\n sessionLoading,\n startingChat,\n sendingMessage,\n endingChat,\n\n // Chat session state\n chatSession,\n\n initiateChatSession,\n sendMessage,\n terminateChatSession,\n refetchSessions,\n refetchSession,\n minimizeChat,\n maximizeChat,\n setAgentTyping,\n };\n}\n"],"mappings":";;;;;;AAuBA,SAASA,EAAe,GAA8C;CAGpE,OAFIC,MAASC,EAAY,cAAcD,MAASC,EAAY,eAAqB,UAC7ED,MAASC,EAAY,gBAAsB,WACxC;AACT;AAEA,SAASC,EAAW,GAAqC;CACvD,OAAO;EACL,IAAIC,EAAQ;EACZ,SAASA,EAAQ;EACjB,YAAYJ,EAAeI,EAAQ,IAAI;EACvC,WAAWA,EAAQ;EACnB,aAAaA,EAAQ,YAAY,KAAK,OAAkB;GACtD,IAAIC;GACJ,UAAUA;GACV,KAAKA;GACL,MAAM;EACR,EAAE;CACJ;AACF;AAEA,SAASC,EAAuB,GAA6D;CAC3F,IAAI,CAACC,GAAQ,OAAO;CACpB,IAAMC,IAAWD,EAAO,SAAS,IAAIJ,CAAU,GACzCM,IAAgBF,EAAO,aACzB;EACE,IAAIA,EAAO;EACX,aAAaA,EAAO;EACpB,OAAO;CACT,IACA,KAAA;CAEJ,OAAO;EACL,IAAIA,EAAO;EACX,QACEA,EAAO,WAAWG,EAAoB,UAAUH,EAAO,WAAWG,EAAoB,WAClF,UACAD,IACE,WACA;EACR,WAAWF,EAAO;EAClB,SAASA,EAAO,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AW,MAAMF,EAAc;EACrC;EAqBE;EACA;EACA;CACF;AACF"}
@@ -1,5 +1,5 @@
1
1
  import { useCallback as e, useEffect as t, useRef as n, useState as r } from "react";
2
- //#region src/support/hooks/useDebouncedUrlText.ts
2
+ // src/support/hooks/useDebouncedUrlText.ts
3
3
  function i(i, a, o = 300) {
4
4
  let [s, c] = r(i), l = n(i), u = n(a);
5
5
  return t(() => {
@@ -22,7 +22,6 @@ function i(i, a, o = 300) {
22
22
  }, [])
23
23
  ];
24
24
  }
25
- //#endregion
26
25
  export { i as useDebouncedUrlText };
27
26
 
28
27
  //# sourceMappingURL=useDebouncedUrlText.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useDebouncedUrlText.js","names":[],"sources":["../../../src/support/hooks/useDebouncedUrlText.ts"],"sourcesContent":["import { useCallback, useEffect, useRef, useState } from 'react';\n\n/**\n * Two-way binding between a text input and a value that lives in the URL.\n *\n * Typing updates a local draft immediately (so the field stays responsive) and\n * is written to the URL once the user pauses. An external change to the URL —\n * browser back/forward, \"Clear all\", a context switch — replaces the draft.\n *\n * The `claimed` ref is what keeps those two directions from fighting: before a\n * debounced write goes out we record the value we are about to put in the URL,\n * so when it comes back as `urlValue` the sync-down effect recognises it as our\n * own echo and leaves the draft alone. Without it, a write landing while the\n * user is still typing would rewind the field to the value that just went out.\n *\n * The callback is held in a ref so that a caller re-creating it on every render\n * cannot keep restarting the timer (which would stop the write ever landing).\n *\n * `commit` may return the value it actually wrote, which matters when the\n * caller normalizes: a draft of only spaces serializes to nothing, so the URL\n * does not change, so there is no new `urlValue` for the sync-down effect to\n * echo back — that effect only runs when `urlValue` itself changes. Without a\n * returned value the draft would stay un-normalized forever while the parsed\n * value sits at the normalized one, leaving the two permanently unequal. On\n * this page that difference is `searchPending`, which disables selection and\n * every bulk action, so a stray space would lock those controls until the\n * reviewer edited the field again.\n *\n * @param urlValue - current value as parsed from the URL\n * @param commit - writes the debounced value back to the URL; may return the\n * canonical value it wrote, when that differs from what it was given\n * @param delayMs - idle time before writing\n * @returns `[draft, setDraft, resetDraft]` for the input element\n */\nexport function useDebouncedUrlText(\n urlValue: string,\n commit: (value: string) => string | void,\n delayMs = 300\n): [string, (value: string) => void, (nextValue?: string) => void] {\n const [draft, setDraft] = useState(urlValue);\n const claimedRef = useRef(urlValue);\n const commitRef = useRef(commit);\n\n // Written in an effect rather than during render: React may replay or discard\n // a render, and a ref mutated there can leak from UI that never commits. The\n // timer below only reads this ref after a delay, long after the effect ran.\n useEffect(() => {\n commitRef.current = commit;\n });\n\n useEffect(() => {\n if (urlValue === claimedRef.current) return;\n claimedRef.current = urlValue;\n setDraft(urlValue);\n }, [urlValue]);\n\n useEffect(() => {\n if (draft === claimedRef.current) return;\n const timer = setTimeout(() => {\n claimedRef.current = draft;\n const committed = commitRef.current(draft);\n // Adopt the canonical value when the caller normalized what we sent. If\n // it matches `urlValue` already, the sync-down effect will never fire for\n // it, so this is the only chance to reconcile the draft.\n if (typeof committed === 'string' && committed !== draft) {\n claimedRef.current = committed;\n setDraft(committed);\n }\n }, delayMs);\n return () => clearTimeout(timer);\n }, [draft, delayMs]);\n\n /**\n * Drops a keystroke that is still inside its debounce window and adopts\n * `nextValue` — the value the URL is about to hold — instead.\n *\n * \"Clear all\" needs this: clearing an already-empty search box leaves\n * `urlValue` as the same empty string, so the sync-down effect above never\n * fires, and a pending write would land in the URL moments after the user\n * asked for a clean slate. Changing the draft cancels the timer, because the\n * write effect tears down on its way to deciding there is nothing to write.\n */\n const resetDraft = useCallback((nextValue = '') => {\n claimedRef.current = nextValue;\n setDraft(nextValue);\n }, []);\n\n return [draft, setDraft, resetDraft];\n}\n"],"mappings":";;AAkCA,SAAgB,EACd,GACA,GACA,IAAU,KACuD;CACjE,IAAM,CAAC,GAAO,KAAY,EAAS,CAAQ,GACrC,IAAa,EAAO,CAAQ,GAC5B,IAAY,EAAO,CAAM;CA8C/B,OAzCA,QAAgB;EACd,EAAU,UAAU;CACtB,CAAC,GAED,QAAgB;EACV,MAAa,EAAW,YAC5B,EAAW,UAAU,GACrB,EAAS,CAAQ;CACnB,GAAG,CAAC,CAAQ,CAAC,GAEb,QAAgB;EACd,IAAI,MAAU,EAAW,SAAS;EAClC,IAAM,IAAQ,iBAAiB;GAC7B,EAAW,UAAU;GACrB,IAAM,IAAY,EAAU,QAAQ,CAAK;GAIzC,AAAI,OAAO,KAAc,YAAY,MAAc,MACjD,EAAW,UAAU,GACrB,EAAS,CAAS;EAEtB,GAAG,CAAO;EACV,aAAa,aAAa,CAAK;CACjC,GAAG,CAAC,GAAO,CAAO,CAAC,GAiBZ;EAAC;EAAO;EALI,GAAa,IAAY,OAAO;GAEjD,AADA,EAAW,UAAU,GACrB,EAAS,CAAS;EACpB,GAAG,CAAC,CAEqB;CAAU;AACrC"}
1
+ {"version":3,"file":"useDebouncedUrlText.js","names":["useDebouncedUrlText","draft","setDraft","useState","urlValue","claimedRef","useRef","commitRef","commit","useEffect","timer","committed","delayMs","useCallback","nextValue"],"sources":["../../../src/support/hooks/useDebouncedUrlText.ts"],"sourcesContent":["import { useCallback, useEffect, useRef, useState } from 'react';\n\n/**\n * Two-way binding between a text input and a value that lives in the URL.\n *\n * Typing updates a local draft immediately (so the field stays responsive) and\n * is written to the URL once the user pauses. An external change to the URL —\n * browser back/forward, \"Clear all\", a context switch — replaces the draft.\n *\n * The `claimed` ref is what keeps those two directions from fighting: before a\n * debounced write goes out we record the value we are about to put in the URL,\n * so when it comes back as `urlValue` the sync-down effect recognises it as our\n * own echo and leaves the draft alone. Without it, a write landing while the\n * user is still typing would rewind the field to the value that just went out.\n *\n * The callback is held in a ref so that a caller re-creating it on every render\n * cannot keep restarting the timer (which would stop the write ever landing).\n *\n * `commit` may return the value it actually wrote, which matters when the\n * caller normalizes: a draft of only spaces serializes to nothing, so the URL\n * does not change, so there is no new `urlValue` for the sync-down effect to\n * echo back — that effect only runs when `urlValue` itself changes. Without a\n * returned value the draft would stay un-normalized forever while the parsed\n * value sits at the normalized one, leaving the two permanently unequal. On\n * this page that difference is `searchPending`, which disables selection and\n * every bulk action, so a stray space would lock those controls until the\n * reviewer edited the field again.\n *\n * @param urlValue - current value as parsed from the URL\n * @param commit - writes the debounced value back to the URL; may return the\n * canonical value it wrote, when that differs from what it was given\n * @param delayMs - idle time before writing\n * @returns `[draft, setDraft, resetDraft]` for the input element\n */\nexport function useDebouncedUrlText(\n urlValue: string,\n commit: (value: string) => string | void,\n delayMs = 300\n): [string, (value: string) => void, (nextValue?: string) => void] {\n const [draft, setDraft] = useState(urlValue);\n const claimedRef = useRef(urlValue);\n const commitRef = useRef(commit);\n\n // Written in an effect rather than during render: React may replay or discard\n // a render, and a ref mutated there can leak from UI that never commits. The\n // timer below only reads this ref after a delay, long after the effect ran.\n useEffect(() => {\n commitRef.current = commit;\n });\n\n useEffect(() => {\n if (urlValue === claimedRef.current) return;\n claimedRef.current = urlValue;\n setDraft(urlValue);\n }, [urlValue]);\n\n useEffect(() => {\n if (draft === claimedRef.current) return;\n const timer = setTimeout(() => {\n claimedRef.current = draft;\n const committed = commitRef.current(draft);\n // Adopt the canonical value when the caller normalized what we sent. If\n // it matches `urlValue` already, the sync-down effect will never fire for\n // it, so this is the only chance to reconcile the draft.\n if (typeof committed === 'string' && committed !== draft) {\n claimedRef.current = committed;\n setDraft(committed);\n }\n }, delayMs);\n return () => clearTimeout(timer);\n }, [draft, delayMs]);\n\n /**\n * Drops a keystroke that is still inside its debounce window and adopts\n * `nextValue` — the value the URL is about to hold — instead.\n *\n * \"Clear all\" needs this: clearing an already-empty search box leaves\n * `urlValue` as the same empty string, so the sync-down effect above never\n * fires, and a pending write would land in the URL moments after the user\n * asked for a clean slate. Changing the draft cancels the timer, because the\n * write effect tears down on its way to deciding there is nothing to write.\n */\n const resetDraft = useCallback((nextValue = '') => {\n claimedRef.current = nextValue;\n setDraft(nextValue);\n }, []);\n\n return [draft, setDraft, resetDraft];\n}\n"],"mappings":";;AAkCA,SAAgBA,EACd,GACA,GACA,IAAU,KACuD;CACjE,IAAM,CAACC,GAAOC,KAAYC,EAASC,CAAQ,GACrCC,IAAaC,EAAOF,CAAQ,GAC5BG,IAAYD,EAAOE,CAAM;CA8C/B,OAzCAC,QAAgB;EACd,EAAU,UAAUD;CACtB,CAAC,GAEDC,QAAgB;EACd,AAAIL,MAAaC,EAAW,YAC5B,EAAW,UAAUD,GACrBF,EAASE,CAAQ;CACnB,GAAG,CAACA,CAAQ,CAAC,GAEbK,QAAgB;EACd,IAAIR,MAAUI,EAAW,SAAS;EAClC,IAAMK,IAAQ,iBAAiB;GAC7B,EAAW,UAAUT;GACrB,IAAMU,IAAYJ,EAAU,QAAQN,CAAK;GAIzC,AAAI,OAAOU,KAAc,YAAYA,MAAcV,MACjD,EAAW,UAAUU,GACrBT,EAASS,CAAS;EAEtB,GAAGC,CAAO;EACV,aAAa,aAAaF,CAAK;CACjC,GAAG,CAACT,GAAOW,CAAO,CAAC,GAiBZ;EAACX;EAAOC;EALIW,GAAa,IAAY,OAAO;GAEjD,AADA,EAAW,UAAUC,GACrBZ,EAASY,CAAS;EACpB,GAAG,CAAC,CAEqB;CAAU;AACrC"}
@@ -1,128 +1,128 @@
1
- import { useSupportStore as e } from "../store/supportStore.js";
2
- import { useArchiveKnowledgeBaseArticleMutation as t, useCreateKnowledgeBaseArticleMutation as n, useDeleteKnowledgeBaseArticleMutation as r, useGetArticleQuery as i, useGetArticlesQuery as a, useGetPopularArticlesQuery as o, useGetTicketCategoriesQuery as s, usePublishKnowledgeBaseArticleMutation as c, useRateArticleMutation as l, useRecordArticleViewMutation as u, useSearchKnowledgeBaseQuery as ee, useUnpublishKnowledgeBaseArticleMutation as d, useUpdateKnowledgeBaseArticleMutation as f } from "../../generated/global-operations.js";
3
- import { emitSupportKbArticleRated as p } from "../events/rybbit.js";
4
- import { useCallback as m, useEffect as h } from "react";
5
- import { useEventBus as g } from "@burdenoff/fe-libs/shared/events";
6
- //#region src/support/hooks/useKnowledgeBaseOperations.ts
7
- function _(_) {
8
- let { kbSearch: v, selectedArticle: y, updateKbSearch: b, setKbResults: x, setSelectedArticle: S } = e(), C = g(), { data: w, loading: T, error: E, fetchMore: D, refetch: O } = a({ variables: {
1
+ import { emitSupportKbArticleRated as e } from "../events/rybbit.js";
2
+ import { useSupportStore as t } from "../store/supportStore.js";
3
+ import { useArchiveKnowledgeBaseArticleMutation as n, useCreateKnowledgeBaseArticleMutation as r, useDeleteKnowledgeBaseArticleMutation as i, useGetArticleQuery as a, useGetArticlesQuery as o, useGetPopularArticlesQuery as s, useGetTicketCategoriesQuery as c, usePublishKnowledgeBaseArticleMutation as l, useRateArticleMutation as u, useRecordArticleViewMutation as d, useSearchKnowledgeBaseQuery as f, useUnpublishKnowledgeBaseArticleMutation as p, useUpdateKnowledgeBaseArticleMutation as m } from "../../generated/global-operations.js";
4
+ import { useCallback as h, useEffect as g } from "react";
5
+ import { useEventBus as _ } from "@burdenoff/fe-libs/shared/events";
6
+ // src/support/hooks/useKnowledgeBaseOperations.ts
7
+ function v(v) {
8
+ let { kbSearch: y, selectedArticle: b, updateKbSearch: x, setKbResults: S, setSelectedArticle: C } = t(), w = _(), { data: T, loading: E, error: D, fetchMore: O, refetch: k } = o({ variables: {
9
9
  limit: 20,
10
10
  offset: 0,
11
11
  filter: {
12
- categoryId: v.filters.categoryId || void 0,
13
- tags: v.filters.tags.length > 0 ? v.filters.tags : void 0
12
+ categoryId: y.filters.categoryId || void 0,
13
+ tags: y.filters.tags.length > 0 ? y.filters.tags : void 0
14
14
  }
15
- } }), k = _ ? w?.knowledgeBaseArticles?.nodes?.find((e) => e.slug === _)?.id : void 0, { data: A, loading: j } = o({ variables: { limit: 10 } }), { data: M, loading: N } = s({ variables: { limit: 50 } }), { data: P, loading: F, error: I } = ee({
15
+ } }), A = v ? T?.knowledgeBaseArticles?.nodes?.find((e) => e.slug === v)?.id : void 0, { data: j, loading: M } = s({ variables: { limit: 10 } }), { data: N, loading: P } = c({ variables: { limit: 50 } }), { data: F, loading: ee, error: I } = f({
16
16
  variables: {
17
- query: v.query || "",
17
+ query: y.query || "",
18
18
  limit: 20,
19
- categoryId: v.filters.categoryId || void 0
19
+ categoryId: y.filters.categoryId || void 0
20
20
  },
21
- skip: !v.query
21
+ skip: !y.query
22
22
  });
23
- h(() => {
24
- if (P?.searchKnowledgeBase) {
25
- let e = P.searchKnowledgeBase;
26
- x(e);
23
+ g(() => {
24
+ if (F?.searchKnowledgeBase) {
25
+ let e = F.searchKnowledgeBase;
26
+ S(e);
27
27
  }
28
- }, [P, x]);
29
- let { data: L, loading: R, error: z, refetch: B } = i({
30
- variables: { id: y?.id || k || "" },
31
- skip: !y?.id && !k
32
- }), [V, { loading: H }] = l({
28
+ }, [F, S]);
29
+ let { data: L, loading: R, error: z, refetch: B } = a({
30
+ variables: { id: b?.id || A || "" },
31
+ skip: !b?.id && !A
32
+ }), [V, { loading: H }] = u({
33
33
  onCompleted: () => {
34
34
  B();
35
35
  },
36
36
  onError: (e) => {
37
37
  console.error("Failed to rate article:", e);
38
38
  }
39
- }), [U] = u({ onError: (e) => {
39
+ }), [U] = d({ onError: (e) => {
40
40
  console.error("Failed to record view:", e);
41
- } }), [W, { loading: G }] = n({
41
+ } }), [W, { loading: G }] = r({
42
42
  onCompleted: () => {
43
- O();
43
+ k();
44
44
  },
45
45
  onError: (e) => {
46
46
  console.error("Failed to create article:", e);
47
47
  }
48
- }), [K, { loading: q }] = f({
48
+ }), [K, { loading: q }] = m({
49
49
  onCompleted: () => {
50
- O(), B();
50
+ k(), B();
51
51
  },
52
52
  onError: (e) => {
53
53
  console.error("Failed to update article:", e);
54
54
  }
55
- }), [J, { loading: Y }] = r({
55
+ }), [J, { loading: Y }] = i({
56
56
  onCompleted: () => {
57
- O();
57
+ k();
58
58
  },
59
59
  onError: (e) => {
60
60
  console.error("Failed to delete article:", e);
61
61
  }
62
- }), [X, { loading: Z }] = c({
62
+ }), [X, { loading: Z }] = l({
63
63
  onCompleted: () => {
64
- O(), B();
64
+ k(), B();
65
65
  },
66
66
  onError: (e) => {
67
67
  console.error("Failed to publish article:", e);
68
68
  }
69
- }), [Q, { loading: $ }] = d({
69
+ }), [Q, { loading: $ }] = p({
70
70
  onCompleted: () => {
71
- O(), B();
71
+ k(), B();
72
72
  },
73
73
  onError: (e) => {
74
74
  console.error("Failed to unpublish article:", e);
75
75
  }
76
- }), [te, { loading: ne }] = t({
76
+ }), [te, { loading: ne }] = n({
77
77
  onCompleted: () => {
78
- O(), B();
78
+ k(), B();
79
79
  },
80
80
  onError: (e) => {
81
81
  console.error("Failed to archive article:", e);
82
82
  }
83
83
  }), re = (e, t) => {
84
- b(e.trim(), t);
84
+ x(e.trim(), t);
85
85
  }, ie = (e) => {
86
- b(v.query, e);
86
+ x(y.query, e);
87
87
  }, ae = () => {
88
- let e = w?.knowledgeBaseArticles?.nodes?.length || 0;
89
- w?.knowledgeBaseArticles?.hasMore && D({
88
+ let e = T?.knowledgeBaseArticles?.nodes?.length || 0;
89
+ T?.knowledgeBaseArticles?.hasMore && O({
90
90
  variables: { offset: e },
91
91
  updateQuery: (e, { fetchMoreResult: t }) => t ? { knowledgeBaseArticles: {
92
92
  ...t.knowledgeBaseArticles,
93
93
  nodes: [...e.knowledgeBaseArticles?.nodes || [], ...t.knowledgeBaseArticles?.nodes || []]
94
94
  } } : e
95
95
  });
96
- }, oe = async (e, t) => {
96
+ }, oe = async (t, n) => {
97
97
  try {
98
98
  await V({ variables: {
99
- id: e,
100
- helpful: t
101
- } }), p(C, e, t);
99
+ id: t,
100
+ helpful: n
101
+ } }), e(w, t, n);
102
102
  } catch (e) {
103
103
  throw console.error("Failed to vote on article:", e), e;
104
104
  }
105
- }, se = m(async (e) => {
105
+ }, se = h(async (e) => {
106
106
  try {
107
- await U({ variables: { id: e } }), C.emit("support.kb.article_viewed", { articleId: e });
107
+ await U({ variables: { id: e } }), w.emit("support.kb.article_viewed", { articleId: e });
108
108
  } catch (e) {
109
109
  console.error("Failed to record view:", e);
110
110
  }
111
- }, [C, U]);
111
+ }, [w, U]);
112
112
  return {
113
- articles: w?.knowledgeBaseArticles?.nodes || [],
114
- popularArticles: A?.popularArticles || [],
115
- categories: M?.ticketCategories?.nodes || [],
116
- searchResults: v.results,
113
+ articles: T?.knowledgeBaseArticles?.nodes || [],
114
+ popularArticles: j?.popularArticles || [],
115
+ categories: N?.ticketCategories?.nodes || [],
116
+ searchResults: y.results,
117
117
  articleDetail: L?.knowledgeBaseArticle || null,
118
- totalArticles: w?.knowledgeBaseArticles?.totalCount || 0,
119
- totalResults: P?.searchKnowledgeBase?.length || 0,
120
- hasMoreArticles: w?.knowledgeBaseArticles?.hasMore || !1,
118
+ totalArticles: T?.knowledgeBaseArticles?.totalCount || 0,
119
+ totalResults: F?.searchKnowledgeBase?.length || 0,
120
+ hasMoreArticles: T?.knowledgeBaseArticles?.hasMore || !1,
121
121
  hasMoreResults: !1,
122
- articlesLoading: T,
123
- popularLoading: j,
124
- categoriesLoading: N,
125
- searchLoading: F,
122
+ articlesLoading: E,
123
+ popularLoading: M,
124
+ categoriesLoading: P,
125
+ searchLoading: ee,
126
126
  articleLoading: R,
127
127
  ratingArticle: H,
128
128
  creatingArticle: G,
@@ -131,7 +131,7 @@ function _(_) {
131
131
  publishingArticle: Z,
132
132
  unpublishingArticle: $,
133
133
  archivingArticle: ne,
134
- articlesError: E,
134
+ articlesError: D,
135
135
  searchError: I,
136
136
  articleError: z,
137
137
  searchArticles: re,
@@ -139,9 +139,9 @@ function _(_) {
139
139
  loadMoreArticles: ae,
140
140
  voteArticle: oe,
141
141
  recordView: se,
142
- refetchArticles: O,
142
+ refetchArticles: k,
143
143
  refetchArticle: B,
144
- setSelectedArticle: S,
144
+ setSelectedArticle: C,
145
145
  createArticle: async (e) => {
146
146
  try {
147
147
  return (await W({ variables: { input: e } })).data?.createKnowledgeBaseArticle;
@@ -189,7 +189,6 @@ function _(_) {
189
189
  }
190
190
  };
191
191
  }
192
- //#endregion
193
- export { _ as useKnowledgeBaseOperations };
192
+ export { v as useKnowledgeBaseOperations };
194
193
 
195
194
  //# sourceMappingURL=useKnowledgeBaseOperations.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useKnowledgeBaseOperations.js","names":[],"sources":["../../../src/support/hooks/useKnowledgeBaseOperations.ts"],"sourcesContent":["import { useCallback, useEffect } from 'react';\nimport { useEventBus } from '@burdenoff/fe-libs/shared/events';\nimport { emitSupportKbArticleRated } from '../events/rybbit';\nimport { useSupportStore } from '../store/supportStore';\nimport {\n useGetArticlesQuery,\n useGetArticleQuery,\n useGetPopularArticlesQuery,\n useGetTicketCategoriesQuery,\n useSearchKnowledgeBaseQuery,\n useRateArticleMutation,\n useRecordArticleViewMutation,\n useCreateKnowledgeBaseArticleMutation,\n useUpdateKnowledgeBaseArticleMutation,\n useDeleteKnowledgeBaseArticleMutation,\n usePublishKnowledgeBaseArticleMutation,\n useUnpublishKnowledgeBaseArticleMutation,\n useArchiveKnowledgeBaseArticleMutation,\n} from '../../generated/global-operations';\nimport type {\n KnowledgeBaseArticle,\n KnowledgeBaseArticleFilterInput,\n CreateKnowledgeBaseArticleInput,\n UpdateKnowledgeBaseArticleInput,\n} from '../../generated/global-types';\nimport type { KnowledgeBaseArticleState } from '../store/supportStore';\n\n// Input types for article operations (re-export for consumers)\nexport type { CreateKnowledgeBaseArticleInput, UpdateKnowledgeBaseArticleInput };\n\nexport function useKnowledgeBaseOperations(articleSlug?: string) {\n const { kbSearch, selectedArticle, updateKbSearch, setKbResults, setSelectedArticle } =\n useSupportStore();\n const eventBus = useEventBus();\n\n // Query: Get articles list (show all statuses - admins can see drafts)\n const {\n data: articlesData,\n loading: articlesLoading,\n error: articlesError,\n fetchMore: fetchMoreArticles,\n refetch: refetchArticles,\n } = useGetArticlesQuery({\n variables: {\n limit: 20,\n offset: 0,\n filter: {\n // Don't filter by status - show all articles including drafts\n categoryId: kbSearch.filters.categoryId || undefined,\n tags: kbSearch.filters.tags.length > 0 ? kbSearch.filters.tags : undefined,\n } as KnowledgeBaseArticleFilterInput,\n },\n });\n\n const articleIdFromSlug = articleSlug\n ? articlesData?.knowledgeBaseArticles?.nodes?.find(\n (article: { slug: string; id: string }) => article.slug === articleSlug\n )?.id\n : undefined;\n\n // Query: Get popular articles\n const { data: popularData, loading: popularLoading } = useGetPopularArticlesQuery({\n variables: { limit: 10 },\n });\n\n // Query: Get categories\n const { data: categoriesData, loading: categoriesLoading } = useGetTicketCategoriesQuery({\n variables: { limit: 50 },\n });\n\n // Query: Search articles\n const {\n data: searchData,\n loading: searchLoading,\n error: searchError,\n } = useSearchKnowledgeBaseQuery({\n variables: {\n query: kbSearch.query || '',\n limit: 20,\n categoryId: kbSearch.filters.categoryId || undefined,\n },\n skip: !kbSearch.query,\n });\n\n // Update kbResults when search data changes\n useEffect(() => {\n if (searchData?.searchKnowledgeBase) {\n const articles = searchData.searchKnowledgeBase;\n setKbResults(articles as KnowledgeBaseArticleState[]);\n }\n }, [searchData, setKbResults]);\n\n // Query: Get article detail\n const {\n data: articleData,\n loading: articleLoading,\n error: articleError,\n refetch: refetchArticle,\n } = useGetArticleQuery({\n variables: { id: selectedArticle?.id || articleIdFromSlug || '' },\n skip: !selectedArticle?.id && !articleIdFromSlug,\n });\n\n // Mutation: Rate article\n const [rateArticleMutation, { loading: ratingArticle }] = useRateArticleMutation({\n onCompleted: () => {\n refetchArticle();\n },\n onError: (error) => {\n console.error('Failed to rate article:', error);\n },\n });\n\n // Mutation: Record article view\n const [recordViewMutation] = useRecordArticleViewMutation({\n onError: (error) => {\n console.error('Failed to record view:', error);\n },\n });\n\n // Mutation: Create article\n const [createArticleMutation, { loading: creatingArticle }] =\n useCreateKnowledgeBaseArticleMutation({\n onCompleted: () => {\n refetchArticles();\n },\n onError: (error) => {\n console.error('Failed to create article:', error);\n },\n });\n\n // Mutation: Update article\n const [updateArticleMutation, { loading: updatingArticle }] =\n useUpdateKnowledgeBaseArticleMutation({\n onCompleted: () => {\n refetchArticles();\n refetchArticle();\n },\n onError: (error) => {\n console.error('Failed to update article:', error);\n },\n });\n\n // Mutation: Delete article\n const [deleteArticleMutation, { loading: deletingArticle }] =\n useDeleteKnowledgeBaseArticleMutation({\n onCompleted: () => {\n refetchArticles();\n },\n onError: (error) => {\n console.error('Failed to delete article:', error);\n },\n });\n\n // Mutation: Publish article\n const [publishArticleMutation, { loading: publishingArticle }] =\n usePublishKnowledgeBaseArticleMutation({\n onCompleted: () => {\n refetchArticles();\n refetchArticle();\n },\n onError: (error) => {\n console.error('Failed to publish article:', error);\n },\n });\n\n // Mutation: Unpublish article\n const [unpublishArticleMutation, { loading: unpublishingArticle }] =\n useUnpublishKnowledgeBaseArticleMutation({\n onCompleted: () => {\n refetchArticles();\n refetchArticle();\n },\n onError: (error) => {\n console.error('Failed to unpublish article:', error);\n },\n });\n\n // Mutation: Archive article\n const [archiveArticleMutation, { loading: archivingArticle }] =\n useArchiveKnowledgeBaseArticleMutation({\n onCompleted: () => {\n refetchArticles();\n refetchArticle();\n },\n onError: (error) => {\n console.error('Failed to archive article:', error);\n },\n });\n\n // Helper: Search articles\n const searchArticles = (query: string, filters?: { categoryId?: string; tags?: string[] }) => {\n updateKbSearch(query.trim(), filters);\n };\n\n const filterArticles = (filters?: { categoryId?: string; tags?: string[] }) => {\n updateKbSearch(kbSearch.query, filters);\n };\n\n // Helper: Load more articles (offset-based pagination)\n const loadMoreArticles = () => {\n const currentCount = articlesData?.knowledgeBaseArticles?.nodes?.length || 0;\n if (articlesData?.knowledgeBaseArticles?.hasMore) {\n fetchMoreArticles({\n variables: {\n offset: currentCount,\n },\n updateQuery: (prev, { fetchMoreResult }) => {\n if (!fetchMoreResult) return prev;\n return {\n knowledgeBaseArticles: {\n ...fetchMoreResult.knowledgeBaseArticles,\n nodes: [\n ...(prev.knowledgeBaseArticles?.nodes || []),\n ...(fetchMoreResult.knowledgeBaseArticles?.nodes || []),\n ],\n },\n };\n },\n });\n }\n };\n\n // Helper: Vote on article helpfulness\n const voteArticle = async (articleId: string, helpful: boolean) => {\n try {\n await rateArticleMutation({\n variables: { id: articleId, helpful },\n });\n emitSupportKbArticleRated(eventBus, articleId, helpful);\n } catch (error) {\n console.error('Failed to vote on article:', error);\n throw error;\n }\n };\n\n // Helper: Record article view (memoized to prevent multiple calls)\n const recordView = useCallback(\n async (articleId: string) => {\n try {\n await recordViewMutation({\n variables: { id: articleId },\n });\n eventBus.emit('support.kb.article_viewed', {\n articleId,\n });\n } catch (error) {\n console.error('Failed to record view:', error);\n }\n },\n [eventBus, recordViewMutation]\n );\n\n // Helper: Create article\n const createArticle = async (input: CreateKnowledgeBaseArticleInput) => {\n try {\n const result = await createArticleMutation({\n variables: { input },\n });\n return result.data?.createKnowledgeBaseArticle;\n } catch (error) {\n console.error('Failed to create article:', error);\n throw error;\n }\n };\n\n // Helper: Update article\n const updateArticle = async (id: string, input: UpdateKnowledgeBaseArticleInput) => {\n try {\n const result = await updateArticleMutation({\n variables: { id, input },\n });\n return result.data?.updateKnowledgeBaseArticle;\n } catch (error) {\n console.error('Failed to update article:', error);\n throw error;\n }\n };\n\n // Helper: Delete article\n const deleteArticle = async (id: string) => {\n try {\n const result = await deleteArticleMutation({\n variables: { id },\n });\n return result.data?.deleteKnowledgeBaseArticle;\n } catch (error) {\n console.error('Failed to delete article:', error);\n throw error;\n }\n };\n\n // Helper: Publish article\n const publishArticle = async (id: string) => {\n try {\n const result = await publishArticleMutation({\n variables: { id },\n });\n return result.data?.publishKnowledgeBaseArticle;\n } catch (error) {\n console.error('Failed to publish article:', error);\n throw error;\n }\n };\n\n // Helper: Unpublish article\n const unpublishArticle = async (id: string) => {\n try {\n const result = await unpublishArticleMutation({\n variables: { id },\n });\n return result.data?.unpublishKnowledgeBaseArticle;\n } catch (error) {\n console.error('Failed to unpublish article:', error);\n throw error;\n }\n };\n\n // Helper: Archive article\n const archiveArticle = async (id: string) => {\n try {\n const result = await archiveArticleMutation({\n variables: { id },\n });\n return result.data?.archiveKnowledgeBaseArticle;\n } catch (error) {\n console.error('Failed to archive article:', error);\n throw error;\n }\n };\n\n return {\n // Data\n articles: (articlesData?.knowledgeBaseArticles?.nodes || []) as KnowledgeBaseArticle[],\n popularArticles: (popularData?.popularArticles || []) as KnowledgeBaseArticle[],\n categories: categoriesData?.ticketCategories?.nodes || [],\n searchResults: kbSearch.results,\n articleDetail: articleData?.knowledgeBaseArticle || null,\n totalArticles: articlesData?.knowledgeBaseArticles?.totalCount || 0,\n totalResults: searchData?.searchKnowledgeBase?.length || 0,\n hasMoreArticles: articlesData?.knowledgeBaseArticles?.hasMore || false,\n hasMoreResults: false, // searchKnowledgeBase returns array, no pagination\n\n // Loading states\n articlesLoading,\n popularLoading,\n categoriesLoading,\n searchLoading,\n articleLoading,\n ratingArticle,\n creatingArticle,\n updatingArticle,\n deletingArticle,\n publishingArticle,\n unpublishingArticle,\n archivingArticle,\n\n // Errors\n articlesError,\n searchError,\n articleError,\n\n // Read Operations\n searchArticles,\n filterArticles,\n loadMoreArticles,\n voteArticle,\n recordView,\n refetchArticles,\n refetchArticle,\n setSelectedArticle,\n\n // CRUD Operations\n createArticle,\n updateArticle,\n deleteArticle,\n publishArticle,\n unpublishArticle,\n archiveArticle,\n };\n}\n"],"mappings":";;;;;;AA8BA,SAAgB,EAA2B,GAAsB;CAC/D,IAAM,EAAE,aAAU,oBAAiB,mBAAgB,iBAAc,0BAC/D,EAAgB,GACZ,IAAW,EAAY,GAGvB,EACJ,MAAM,GACN,SAAS,GACT,OAAO,GACP,WAAW,GACX,SAAS,MACP,EAAoB,EACtB,WAAW;EACT,OAAO;EACP,QAAQ;EACR,QAAQ;GAEN,YAAY,EAAS,QAAQ,cAAc,KAAA;GAC3C,MAAM,EAAS,QAAQ,KAAK,SAAS,IAAI,EAAS,QAAQ,OAAO,KAAA;EACnE;CACF,EACF,CAAC,GAEK,IAAoB,IACtB,GAAc,uBAAuB,OAAO,MACzC,MAA0C,EAAQ,SAAS,CAC9D,CAAC,EAAE,KACH,KAAA,GAGE,EAAE,MAAM,GAAa,SAAS,MAAmB,EAA2B,EAChF,WAAW,EAAE,OAAO,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C,IAAI;IAIF,QAAO,MAHc,EAAuB,EAC1C,WAAW,EAAE,MAAG,EAClB,CAAC,EAAA,CACa,MAAM;GACtB,SAAS,GAAO;IAEd,MADA,QAAQ,MAAM,8BAA8B,CAAK,GAC3C;GACR;EACF;EA0EE,yBAvE8B,MAAe;GAC7C,IAAI;IAIF,QAAO,MAHc,EAAyB,EAC5C,WAAW,EAAE,MAAG,EAClB,CAAC,EAAA,CACa,MAAM;GACtB,SAAS,GAAO;IAEd,MADA,QAAQ,MAAM,gCAAgC,CAAK,GAC7C;GACR;EACF;EA8DE,uBA3D4B,MAAe;GAC3C,IAAI;IAIF,QAAO,MAHc,GAAuB,EAC1C,WAAW,EAAE,MAAG,EAClB,CAAC,EAAA,CACa,MAAM;GACtB,SAAS,GAAO;IAEd,MADA,QAAQ,MAAM,8BAA8B,CAAK,GAC3C;GACR;EACF;CAkDA;AACF"}
1
+ {"version":3,"file":"useKnowledgeBaseOperations.js","names":["useKnowledgeBaseOperations","useSupportStore","eventBus","useEventBus","articlesData","articlesLoading","articlesError","fetchMoreArticles","refetchArticles","useGetArticlesQuery","kbSearch","articleIdFromSlug","articleSlug","article","popularData","popularLoading","useGetPopularArticlesQuery","categoriesData","categoriesLoading","useGetTicketCategoriesQuery","searchData","searchLoading","searchError","useSearchKnowledgeBaseQuery","articles","setKbResults","articleData","articleLoading","articleError","refetchArticle","useGetArticleQuery","selectedArticle","rateArticleMutation","ratingArticle","useRateArticleMutation","error","recordViewMutation","useRecordArticleViewMutation","createArticleMutation","creatingArticle","useCreateKnowledgeBaseArticleMutation","updateArticleMutation","updatingArticle","useUpdateKnowledgeBaseArticleMutation","deleteArticleMutation","deletingArticle","useDeleteKnowledgeBaseArticleMutation","publishArticleMutation","publishingArticle","usePublishKnowledgeBaseArticleMutation","unpublishArticleMutation","unpublishingArticle","useUnpublishKnowledgeBaseArticleMutation","archiveArticleMutation","archivingArticle","useArchiveKnowledgeBaseArticleMutation","searchArticles","query","filters","filterArticles","loadMoreArticles","currentCount","fetchMoreResult","prev","voteArticle","articleId","emitSupportKbArticleRated","helpful","recordView","useCallback"],"sources":["../../../src/support/hooks/useKnowledgeBaseOperations.ts"],"sourcesContent":["import { useCallback, useEffect } from 'react';\nimport { useEventBus } from '@burdenoff/fe-libs/shared/events';\nimport { emitSupportKbArticleRated } from '../events/rybbit';\nimport { useSupportStore } from '../store/supportStore';\nimport {\n useGetArticlesQuery,\n useGetArticleQuery,\n useGetPopularArticlesQuery,\n useGetTicketCategoriesQuery,\n useSearchKnowledgeBaseQuery,\n useRateArticleMutation,\n useRecordArticleViewMutation,\n useCreateKnowledgeBaseArticleMutation,\n useUpdateKnowledgeBaseArticleMutation,\n useDeleteKnowledgeBaseArticleMutation,\n usePublishKnowledgeBaseArticleMutation,\n useUnpublishKnowledgeBaseArticleMutation,\n useArchiveKnowledgeBaseArticleMutation,\n} from '../../generated/global-operations';\nimport type {\n KnowledgeBaseArticle,\n KnowledgeBaseArticleFilterInput,\n CreateKnowledgeBaseArticleInput,\n UpdateKnowledgeBaseArticleInput,\n} from '../../generated/global-types';\nimport type { KnowledgeBaseArticleState } from '../store/supportStore';\n\n// Input types for article operations (re-export for consumers)\nexport type { CreateKnowledgeBaseArticleInput, UpdateKnowledgeBaseArticleInput };\n\nexport function useKnowledgeBaseOperations(articleSlug?: string) {\n const { kbSearch, selectedArticle, updateKbSearch, setKbResults, setSelectedArticle } =\n useSupportStore();\n const eventBus = useEventBus();\n\n // Query: Get articles list (show all statuses - admins can see drafts)\n const {\n data: articlesData,\n loading: articlesLoading,\n error: articlesError,\n fetchMore: fetchMoreArticles,\n refetch: refetchArticles,\n } = useGetArticlesQuery({\n variables: {\n limit: 20,\n offset: 0,\n filter: {\n // Don't filter by status - show all articles including drafts\n categoryId: kbSearch.filters.categoryId || undefined,\n tags: kbSearch.filters.tags.length > 0 ? kbSearch.filters.tags : undefined,\n } as KnowledgeBaseArticleFilterInput,\n },\n });\n\n const articleIdFromSlug = articleSlug\n ? articlesData?.knowledgeBaseArticles?.nodes?.find(\n (article: { slug: string; id: string }) => article.slug === articleSlug\n )?.id\n : undefined;\n\n // Query: Get popular articles\n const { data: popularData, loading: popularLoading } = useGetPopularArticlesQuery({\n variables: { limit: 10 },\n });\n\n // Query: Get categories\n const { data: categoriesData, loading: categoriesLoading } = useGetTicketCategoriesQuery({\n variables: { limit: 50 },\n });\n\n // Query: Search articles\n const {\n data: searchData,\n loading: searchLoading,\n error: searchError,\n } = useSearchKnowledgeBaseQuery({\n variables: {\n query: kbSearch.query || '',\n limit: 20,\n categoryId: kbSearch.filters.categoryId || undefined,\n },\n skip: !kbSearch.query,\n });\n\n // Update kbResults when search data changes\n useEffect(() => {\n if (searchData?.searchKnowledgeBase) {\n const articles = searchData.searchKnowledgeBase;\n setKbResults(articles as KnowledgeBaseArticleState[]);\n }\n }, [searchData, setKbResults]);\n\n // Query: Get article detail\n const {\n data: articleData,\n loading: articleLoading,\n error: articleError,\n refetch: refetchArticle,\n } = useGetArticleQuery({\n variables: { id: selectedArticle?.id || articleIdFromSlug || '' },\n skip: !selectedArticle?.id && !articleIdFromSlug,\n });\n\n // Mutation: Rate article\n const [rateArticleMutation, { loading: ratingArticle }] = useRateArticleMutation({\n onCompleted: () => {\n refetchArticle();\n },\n onError: (error) => {\n console.error('Failed to rate article:', error);\n },\n });\n\n // Mutation: Record article view\n const [recordViewMutation] = useRecordArticleViewMutation({\n onError: (error) => {\n console.error('Failed to record view:', error);\n },\n });\n\n // Mutation: Create article\n const [createArticleMutation, { loading: creatingArticle }] =\n useCreateKnowledgeBaseArticleMutation({\n onCompleted: () => {\n refetchArticles();\n },\n onError: (error) => {\n console.error('Failed to create article:', error);\n },\n });\n\n // Mutation: Update article\n const [updateArticleMutation, { loading: updatingArticle }] =\n useUpdateKnowledgeBaseArticleMutation({\n onCompleted: () => {\n refetchArticles();\n refetchArticle();\n },\n onError: (error) => {\n console.error('Failed to update article:', error);\n },\n });\n\n // Mutation: Delete article\n const [deleteArticleMutation, { loading: deletingArticle }] =\n useDeleteKnowledgeBaseArticleMutation({\n onCompleted: () => {\n refetchArticles();\n },\n onError: (error) => {\n console.error('Failed to delete article:', error);\n },\n });\n\n // Mutation: Publish article\n const [publishArticleMutation, { loading: publishingArticle }] =\n usePublishKnowledgeBaseArticleMutation({\n onCompleted: () => {\n refetchArticles();\n refetchArticle();\n },\n onError: (error) => {\n console.error('Failed to publish article:', error);\n },\n });\n\n // Mutation: Unpublish article\n const [unpublishArticleMutation, { loading: unpublishingArticle }] =\n useUnpublishKnowledgeBaseArticleMutation({\n onCompleted: () => {\n refetchArticles();\n refetchArticle();\n },\n onError: (error) => {\n console.error('Failed to unpublish article:', error);\n },\n });\n\n // Mutation: Archive article\n const [archiveArticleMutation, { loading: archivingArticle }] =\n useArchiveKnowledgeBaseArticleMutation({\n onCompleted: () => {\n refetchArticles();\n refetchArticle();\n },\n onError: (error) => {\n console.error('Failed to archive article:', error);\n },\n });\n\n // Helper: Search articles\n const searchArticles = (query: string, filters?: { categoryId?: string; tags?: string[] }) => {\n updateKbSearch(query.trim(), filters);\n };\n\n const filterArticles = (filters?: { categoryId?: string; tags?: string[] }) => {\n updateKbSearch(kbSearch.query, filters);\n };\n\n // Helper: Load more articles (offset-based pagination)\n const loadMoreArticles = () => {\n const currentCount = articlesData?.knowledgeBaseArticles?.nodes?.length || 0;\n if (articlesData?.knowledgeBaseArticles?.hasMore) {\n fetchMoreArticles({\n variables: {\n offset: currentCount,\n },\n updateQuery: (prev, { fetchMoreResult }) => {\n if (!fetchMoreResult) return prev;\n return {\n knowledgeBaseArticles: {\n ...fetchMoreResult.knowledgeBaseArticles,\n nodes: [\n ...(prev.knowledgeBaseArticles?.nodes || []),\n ...(fetchMoreResult.knowledgeBaseArticles?.nodes || []),\n ],\n },\n };\n },\n });\n }\n };\n\n // Helper: Vote on article helpfulness\n const voteArticle = async (articleId: string, helpful: boolean) => {\n try {\n await rateArticleMutation({\n variables: { id: articleId, helpful },\n });\n emitSupportKbArticleRated(eventBus, articleId, helpful);\n } catch (error) {\n console.error('Failed to vote on article:', error);\n throw error;\n }\n };\n\n // Helper: Record article view (memoized to prevent multiple calls)\n const recordView = useCallback(\n async (articleId: string) => {\n try {\n await recordViewMutation({\n variables: { id: articleId },\n });\n eventBus.emit('support.kb.article_viewed', {\n articleId,\n });\n } catch (error) {\n console.error('Failed to record view:', error);\n }\n },\n [eventBus, recordViewMutation]\n );\n\n // Helper: Create article\n const createArticle = async (input: CreateKnowledgeBaseArticleInput) => {\n try {\n const result = await createArticleMutation({\n variables: { input },\n });\n return result.data?.createKnowledgeBaseArticle;\n } catch (error) {\n console.error('Failed to create article:', error);\n throw error;\n }\n };\n\n // Helper: Update article\n const updateArticle = async (id: string, input: UpdateKnowledgeBaseArticleInput) => {\n try {\n const result = await updateArticleMutation({\n variables: { id, input },\n });\n return result.data?.updateKnowledgeBaseArticle;\n } catch (error) {\n console.error('Failed to update article:', error);\n throw error;\n }\n };\n\n // Helper: Delete article\n const deleteArticle = async (id: string) => {\n try {\n const result = await deleteArticleMutation({\n variables: { id },\n });\n return result.data?.deleteKnowledgeBaseArticle;\n } catch (error) {\n console.error('Failed to delete article:', error);\n throw error;\n }\n };\n\n // Helper: Publish article\n const publishArticle = async (id: string) => {\n try {\n const result = await publishArticleMutation({\n variables: { id },\n });\n return result.data?.publishKnowledgeBaseArticle;\n } catch (error) {\n console.error('Failed to publish article:', error);\n throw error;\n }\n };\n\n // Helper: Unpublish article\n const unpublishArticle = async (id: string) => {\n try {\n const result = await unpublishArticleMutation({\n variables: { id },\n });\n return result.data?.unpublishKnowledgeBaseArticle;\n } catch (error) {\n console.error('Failed to unpublish article:', error);\n throw error;\n }\n };\n\n // Helper: Archive article\n const archiveArticle = async (id: string) => {\n try {\n const result = await archiveArticleMutation({\n variables: { id },\n });\n return result.data?.archiveKnowledgeBaseArticle;\n } catch (error) {\n console.error('Failed to archive article:', error);\n throw error;\n }\n };\n\n return {\n // Data\n articles: (articlesData?.knowledgeBaseArticles?.nodes || []) as KnowledgeBaseArticle[],\n popularArticles: (popularData?.popularArticles || []) as KnowledgeBaseArticle[],\n categories: categoriesData?.ticketCategories?.nodes || [],\n searchResults: kbSearch.results,\n articleDetail: articleData?.knowledgeBaseArticle || null,\n totalArticles: articlesData?.knowledgeBaseArticles?.totalCount || 0,\n totalResults: searchData?.searchKnowledgeBase?.length || 0,\n hasMoreArticles: articlesData?.knowledgeBaseArticles?.hasMore || false,\n hasMoreResults: false, // searchKnowledgeBase returns array, no pagination\n\n // Loading states\n articlesLoading,\n popularLoading,\n categoriesLoading,\n searchLoading,\n articleLoading,\n ratingArticle,\n creatingArticle,\n updatingArticle,\n deletingArticle,\n publishingArticle,\n unpublishingArticle,\n archivingArticle,\n\n // Errors\n articlesError,\n searchError,\n articleError,\n\n // Read Operations\n searchArticles,\n filterArticles,\n loadMoreArticles,\n voteArticle,\n recordView,\n refetchArticles,\n refetchArticle,\n setSelectedArticle,\n\n // CRUD Operations\n createArticle,\n updateArticle,\n deleteArticle,\n publishArticle,\n unpublishArticle,\n archiveArticle,\n };\n}\n"],"mappings":";;;;;;AA8BA,SAAgBA,EAA2B,GAAsB;CAC/D,IAAM,EAAE,aAAU,oBAAiB,mBAAgB,iBAAc,0BAC/DC,EAAgB,GACZC,IAAWC,EAAY,GAGvB,EACJ,MAAMC,GACN,SAASC,GACT,OAAOC,GACP,WAAWC,GACX,SAASC,MACPC,EAAoB,EACtB,WAAW;EACT,OAAO;EACP,QAAQ;EACR,QAAQ;GAEN,YAAYC,EAAS,QAAQ,cAAc,KAAA;GAC3C,MAAMA,EAAS,QAAQ,KAAK,SAAS,IAAIA,EAAS,QAAQ,OAAO,KAAA;EACnE;CACF,EACF,CAAC,GAEKC,IAAoBC,IACtBR,GAAc,uBAAuB,OAAO,MACzC,MAA0CS,EAAQ,SAASD,CAC9D,CAAC,EAAE,KACH,KAAA,GAGE,EAAE,MAAME,GAAa,SAASC,MAAmBC,EAA2B,EAChF,WAAW,EAAE,OAAO,GAAG,EACzB,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