@bigbinary/neeto-assist-frontend 1.2.1 → 1.3.0

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 (43) hide show
  1. package/README.md +430 -21
  2. package/app/javascript/src/translations/en.json +39 -2
  3. package/dist/.ready +1 -1
  4. package/dist/NeetoAssistButton.js +13 -6
  5. package/dist/NeetoAssistButton.js.map +1 -1
  6. package/dist/NeetoAssistPane.js +1469 -166
  7. package/dist/NeetoAssistPane.js.map +1 -1
  8. package/dist/cjs/NeetoAssistButton.js +16 -9
  9. package/dist/cjs/NeetoAssistButton.js.map +1 -1
  10. package/dist/cjs/NeetoAssistPane.js +1491 -188
  11. package/dist/cjs/NeetoAssistPane.js.map +1 -1
  12. package/dist/cjs/index.js +11 -5
  13. package/dist/cjs/index.js.map +1 -1
  14. package/dist/cjs/useNeetoAssistAssistant.js +43 -0
  15. package/dist/cjs/useNeetoAssistAssistant.js.map +1 -0
  16. package/dist/cjs/useNeetoAssistStatus.js +3 -1
  17. package/dist/cjs/useNeetoAssistStatus.js.map +1 -1
  18. package/dist/index.js +10 -5
  19. package/dist/index.js.map +1 -1
  20. package/dist/neeto_assist-COp7BR77.js +249 -0
  21. package/dist/neeto_assist-COp7BR77.js.map +1 -0
  22. package/dist/neeto_assist-D1wzZ3ou.js +219 -0
  23. package/dist/neeto_assist-D1wzZ3ou.js.map +1 -0
  24. package/dist/useNeetoAssistAssistant.js +41 -0
  25. package/dist/useNeetoAssistAssistant.js.map +1 -0
  26. package/dist/useNeetoAssistStatus.js +3 -1
  27. package/dist/useNeetoAssistStatus.js.map +1 -1
  28. package/dist/useNeetoAssistStore-Bj6niQdc.js +103 -0
  29. package/dist/useNeetoAssistStore-Bj6niQdc.js.map +1 -0
  30. package/dist/useNeetoAssistStore-Dgt8aV52.js +101 -0
  31. package/dist/useNeetoAssistStore-Dgt8aV52.js.map +1 -0
  32. package/dist/{useNeetoAssistStore-InICsbe8.js → useRunsApi-BgsICthX.js} +228 -113
  33. package/dist/useRunsApi-BgsICthX.js.map +1 -0
  34. package/dist/{useNeetoAssistStore-VaZp3268.js → useRunsApi-Rh6xXOwm.js} +232 -112
  35. package/dist/useRunsApi-Rh6xXOwm.js.map +1 -0
  36. package/package.json +4 -4
  37. package/types.d.ts +81 -8
  38. package/dist/neeto_assist-CpUBA-3Z.js +0 -135
  39. package/dist/neeto_assist-CpUBA-3Z.js.map +0 -1
  40. package/dist/neeto_assist-CznTN_YY.js +0 -157
  41. package/dist/neeto_assist-CznTN_YY.js.map +0 -1
  42. package/dist/useNeetoAssistStore-InICsbe8.js.map +0 -1
  43. package/dist/useNeetoAssistStore-VaZp3268.js.map +0 -1
@@ -31,9 +31,33 @@
31
31
  "failed": "NeetoAssist could not answer this one",
32
32
  "skipped": "NeetoAssist skipped this one",
33
33
  "customerWrote": "Customer wrote",
34
- "sources": "From your help articles",
34
+ "sources": "Sources",
35
+ "stopped": "Stopped before NeetoAssist answered.",
36
+ "copyAnswer": "Copy answer",
37
+ "answerCopied": "Copied",
35
38
  "needsFollowUp": "This reply tells the customer the team will act on their request, so someone needs to follow up."
36
39
  },
40
+ "languages": {
41
+ "customerWritesIn": "The customer writes in {{language, anyCase}}.",
42
+ "customerWritesInAnotherLanguage": "The customer writes in another language.",
43
+ "replyIsIn": "This reply is in {{language, anyCase}}.",
44
+ "replyIsInAnotherLanguage": "This reply is in another language.",
45
+ "showIn": "Show in {{language, anyCase}}",
46
+ "showInTheirLanguage": "Show in their language",
47
+ "showInEnglish": "Show in English",
48
+ "showOriginal": "Show original",
49
+ "useIn": "Use in {{language, anyCase}}",
50
+ "useInTheirLanguage": "Use in their language",
51
+ "useInEnglish": "Use in English",
52
+ "translatedFrom": "Translated from {{language, anyCase}}.",
53
+ "translated": "Translated.",
54
+ "originalIn": "Original in {{language, anyCase}}.",
55
+ "original": "Original."
56
+ },
57
+ "sources": {
58
+ "helpArticle": "Help article",
59
+ "apiDoc": "API docs"
60
+ },
37
61
  "steps": {
38
62
  "lookedAt_one": "Looked at {{count}} thing",
39
63
  "lookedAt_other": "Looked at {{count}} things",
@@ -86,7 +110,9 @@
86
110
  },
87
111
  "ask": {
88
112
  "placeholder": "Ask anything, or say what you need done",
89
- "submit": "Send to NeetoAssist"
113
+ "submit": "Send to NeetoAssist",
114
+ "stop": "Stop answering",
115
+ "stopping": "Stopping..."
90
116
  },
91
117
  "commands": {
92
118
  "hint": "Type / for commands",
@@ -98,6 +124,17 @@
98
124
  "notFound": "NeetoAssist is not available for this conversation.",
99
125
  "invalid": "NeetoAssist could not take that. Check it and try again.",
100
126
  "generic": "Something went wrong with NeetoAssist. Try again."
127
+ },
128
+ "assistant": {
129
+ "newChat": "New chat",
130
+ "betaNote": "NeetoAssist looks things up for you with your own access. It cannot change anything.",
131
+ "intro": "Ask me about your work here, or how something works. I look things up with your own access, and I cannot change anything.",
132
+ "suggestions": "Questions to start with",
133
+ "placeholder": "Ask about your work here, or how something works",
134
+ "note": "NeetoAssist only looks things up. It changes nothing.",
135
+ "errors": {
136
+ "notFound": "NeetoAssist is not available here."
137
+ }
101
138
  }
102
139
  }
103
140
  }
package/dist/.ready CHANGED
@@ -1 +1 @@
1
- Built at 2026-11-12T16:29:39.285Z
1
+ Built at 2026-11-16T04:39:11.025Z
@@ -2,14 +2,19 @@ import _defineProperty from '@babel/runtime/helpers/defineProperty';
2
2
  import { useRef, useEffect } from 'react';
3
3
  import { Button } from '@bigbinary/neeto-atoms';
4
4
  import { useTranslation } from 'react-i18next';
5
- import { u as useNeetoAssistStore, a as useFetchRuns, l as latestDraftId, S as Sparkle } from './useNeetoAssistStore-InICsbe8.js';
5
+ import { P as PANE_MODES } from './neeto_assist-D1wzZ3ou.js';
6
+ import { u as useFetchRuns, l as latestDraftId, S as Sparkle } from './useRunsApi-BgsICthX.js';
7
+ import { u as useNeetoAssistStore } from './useNeetoAssistStore-Dgt8aV52.js';
6
8
  import { jsxs, jsx } from 'react/jsx-runtime';
7
9
  import '@babel/runtime/helpers/objectWithoutProperties';
8
- import '@tanstack/react-query';
9
- import '@bigbinary/neeto-commons-frontend/v2/react-utils';
10
- import './neeto_assist-CpUBA-3Z.js';
11
10
  import 'axios';
11
+ import '@babel/runtime/helpers/asyncToGenerator';
12
12
  import '@babel/runtime/helpers/toConsumableArray';
13
+ import '@babel/runtime/helpers/typeof';
14
+ import '@babel/runtime/regenerator';
15
+ import '@tanstack/react-query';
16
+ import '@bigbinary/neeto-cist';
17
+ import '@bigbinary/neeto-commons-frontend/v2/react-utils';
13
18
  import '@babel/runtime/helpers/toArray';
14
19
  import 'ramda';
15
20
  import '@bigbinary/neeto-commons-frontend/v2/utils';
@@ -26,7 +31,9 @@ var NeetoAssistIcon = function NeetoAssistIcon(props) {
26
31
  // Goes on the ticket: it opens the pane, and tells the pane which ticket it is
27
32
  // about for as long as the button is on screen, along with the host's words
28
33
  // for what the rep is looking at. A dot says a suggested reply is waiting,
29
- // since the pane is closed until the rep asks for it.
34
+ // since the pane is closed until the rep asks for it. While the pane shows the
35
+ // person's assistant instead, the button is not pressed, and a click brings
36
+ // the ticket back.
30
37
  var NeetoAssistButton = function NeetoAssistButton(_ref) {
31
38
  var conversationId = _ref.conversationId,
32
39
  contextLabel = _ref.contextLabel,
@@ -35,7 +42,7 @@ var NeetoAssistButton = function NeetoAssistButton(_ref) {
35
42
  var _useTranslation = useTranslation(),
36
43
  t = _useTranslation.t;
37
44
  var isOpen = useNeetoAssistStore(function (state) {
38
- return state.isOpen;
45
+ return state.isOpen && state.mode !== PANE_MODES.ASSISTANT;
39
46
  });
40
47
  var toggle = useNeetoAssistStore(function (state) {
41
48
  return state.toggle;
@@ -1 +1 @@
1
- {"version":3,"file":"NeetoAssistButton.js","sources":["../app/javascript/src/components/NeetoAssistButton/index.jsx"],"sourcesContent":["import { useEffect, useRef } from \"react\";\n\nimport { Button } from \"neetoatoms\";\nimport { useTranslation } from \"react-i18next\";\n\nimport Sparkle from \"components/commons/Sparkle\";\nimport { useFetchRuns } from \"hooks/reactQuery/useRunsApi\";\nimport useNeetoAssistStore from \"stores/useNeetoAssistStore\";\nimport { latestDraftId } from \"utils/runs\";\n\nconst NeetoAssistIcon = props => (\n <Sparkle {...props} className=\"text-purple-600\" />\n);\n\n// Goes on the ticket: it opens the pane, and tells the pane which ticket it is\n// about for as long as the button is on screen, along with the host's words\n// for what the rep is looking at. A dot says a suggested reply is waiting,\n// since the pane is closed until the rep asks for it.\nconst NeetoAssistButton = ({\n conversationId,\n contextLabel,\n onActionApplied,\n onUseReply,\n}) => {\n const { t } = useTranslation();\n const isOpen = useNeetoAssistStore(state => state.isOpen);\n const toggle = useNeetoAssistStore(state => state.toggle);\n const setConversation = useNeetoAssistStore(state => state.setConversation);\n const clearConversation = useNeetoAssistStore(\n state => state.clearConversation\n );\n\n const seenDraftId = useNeetoAssistStore(\n state => state.seenDrafts[conversationId]\n );\n\n const { data: { runs = [] } = {} } = useFetchRuns(conversationId);\n const draftId = latestDraftId(runs);\n const hasUnseenDraft = !isOpen && !!draftId && draftId !== seenDraftId;\n\n // The host's handlers change on every render. Only whether there is one for\n // \"Use reply\" matters to the pane, and one for an applied action changes\n // nothing it shows, so the pane gets stand-ins that call the latest.\n const useReplyRef = useRef(onUseReply);\n const actionAppliedRef = useRef(onActionApplied);\n const canUseReply = !!onUseReply;\n useEffect(() => {\n useReplyRef.current = onUseReply;\n actionAppliedRef.current = onActionApplied;\n });\n\n useEffect(() => {\n // The answer to a click on Apply can arrive after the button has moved on\n // to another ticket. It then goes to the handler the host last gave for\n // this ticket, not to the one for the ticket now on screen.\n let handlerOnLeaving;\n let hasLeft = false;\n\n setConversation({\n id: conversationId,\n contextLabel,\n onUseReply: canUseReply\n ? (text, html) => useReplyRef.current?.(text, html)\n : undefined,\n onActionApplied: action =>\n (hasLeft ? handlerOnLeaving : actionAppliedRef.current)?.(action),\n });\n\n return () => {\n handlerOnLeaving = actionAppliedRef.current;\n hasLeft = true;\n clearConversation(conversationId);\n };\n }, [\n canUseReply,\n clearConversation,\n contextLabel,\n conversationId,\n setConversation,\n ]);\n\n return (\n <span className=\"relative inline-flex\">\n <Button\n aria-pressed={isOpen}\n data-testid=\"neeto-assist-button\"\n icon={NeetoAssistIcon}\n iconPosition=\"left\"\n label={t(\"neetoAssist.askButton\")}\n size=\"sm\"\n variant={isOpen ? \"secondary\" : \"outline\"}\n tooltipProps={\n hasUnseenDraft ? { content: t(\"neetoAssist.draftReady\") } : undefined\n }\n onClick={toggle}\n />\n {hasUnseenDraft && (\n <span\n aria-label={t(\"neetoAssist.draftReady\")}\n className=\"ring-background absolute -end-0.5 -top-0.5 size-2.5 rounded-full bg-purple-600 ring-2\"\n data-testid=\"neeto-assist-draft-dot\"\n role=\"status\"\n />\n )}\n </span>\n );\n};\n\nexport default NeetoAssistButton;\n"],"names":["NeetoAssistIcon","props","_jsx","Sparkle","_objectSpread","className","NeetoAssistButton","_ref","conversationId","contextLabel","onActionApplied","onUseReply","_useTranslation","useTranslation","t","isOpen","useNeetoAssistStore","state","toggle","setConversation","clearConversation","seenDraftId","seenDrafts","_useFetchRuns","useFetchRuns","_useFetchRuns$data","data","_useFetchRuns$data2","_useFetchRuns$data2$r","runs","draftId","latestDraftId","hasUnseenDraft","useReplyRef","useRef","actionAppliedRef","canUseReply","useEffect","current","handlerOnLeaving","hasLeft","id","text","html","_useReplyRef$current","call","undefined","action","_ref2","_jsxs","children","Button","icon","iconPosition","label","size","variant","tooltipProps","content","onClick","role"],"mappings":";;;;;;;;;;;;;;;;;;;AAUA,IAAMA,eAAe,GAAG,SAAlBA,eAAeA,CAAGC,KAAK,EAAA;EAAA,oBAC3BC,GAAA,CAACC,OAAO,EAAAC,aAAA,CAAAA,aAAA,KAAKH,KAAK,CAAA,EAAA,EAAA,EAAA;AAAEI,IAAAA,SAAS,EAAC;AAAiB,GAAA,CAAE,CAAC;AAAA,CACnD;;AAED;AACA;AACA;AACA;AACA,IAAMC,iBAAiB,GAAG,SAApBA,iBAAiBA,CAAAC,IAAA,EAKjB;A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AGJ,gBAAgB,CAACG,OAAO;AAC3CE,MAAAA,OAAO,GAAG,IAAI;MACdpB,iBAAiB,CAACZ,cAAc,CAAC;IACnC,CAAC;AACH,EAAA,CAAC,EAAE,CACD4B,WAAW,EACXhB,iBAAiB,EACjBX,YAAY,EACZD,cAAc,EACdW,eAAe,CAChB,CAAC;AAEF,EAAA,oBACE8B,IAAA,CAAA,MAAA,EAAA;AAAM5C,IAAAA,SAAS,EAAC,sBAAsB;IAAA6C,QAAA,EAAA,cACpChD,GAAA,CAACiD,MAAM,EAAA;AACL,MAAA,cAAA,EAAcpC,MAAO;AACrB,MAAA,aAAA,EAAY,qBAAqB;AACjCqC,MAAAA,IAAI,EAAEpD,eAAgB;AACtBqD,MAAAA,YAAY,EAAC,MAAM;AACnBC,MAAAA,KAAK,EAAExC,CAAC,CAAC,uBAAuB,CAAE;AAClCyC,MAAAA,IAAI,EAAC,IAAI;AACTC,MAAAA,OAAO,EAAEzC,MAAM,GAAG,WAAW,GAAG,SAAU;MAC1C0C,YAAY,EACVzB,cAAc,GAAG;QAAE0B,OAAO,EAAE5C,CAAC,CAAC,wBAAwB;AAAE,OAAC,GAAGgC,SAC7D;AACDa,MAAAA,OAAO,EAAEzC;AAAO,KACjB,CAAC,EACDc,cAAc,iBACb9B,GAAA,CAAA,MAAA,EAAA;MACE,YAAA,EAAYY,CAAC,CAAC,wBAAwB,CAAE;AACxCT,MAAAA,SAAS,EAAC,uFAAuF;AACjG,MAAA,aAAA,EAAY,wBAAwB;AACpCuD,MAAAA,IAAI,EAAC;AAAQ,KACd,CACF;AAAA,GACG,CAAC;AAEX;;;;"}
1
+ {"version":3,"file":"NeetoAssistButton.js","sources":["../app/javascript/src/components/NeetoAssistButton/index.jsx"],"sourcesContent":["import { useEffect, useRef } from \"react\";\n\nimport { Button } from \"neetoatoms\";\nimport { useTranslation } from \"react-i18next\";\n\nimport { PANE_MODES } from \"common/constants\";\nimport Sparkle from \"components/commons/Sparkle\";\nimport { useFetchRuns } from \"hooks/reactQuery/useRunsApi\";\nimport useNeetoAssistStore from \"stores/useNeetoAssistStore\";\nimport { latestDraftId } from \"utils/runs\";\n\nconst NeetoAssistIcon = props => (\n <Sparkle {...props} className=\"text-purple-600\" />\n);\n\n// Goes on the ticket: it opens the pane, and tells the pane which ticket it is\n// about for as long as the button is on screen, along with the host's words\n// for what the rep is looking at. A dot says a suggested reply is waiting,\n// since the pane is closed until the rep asks for it. While the pane shows the\n// person's assistant instead, the button is not pressed, and a click brings\n// the ticket back.\nconst NeetoAssistButton = ({\n conversationId,\n contextLabel,\n onActionApplied,\n onUseReply,\n}) => {\n const { t } = useTranslation();\n const isOpen = useNeetoAssistStore(\n state => state.isOpen && state.mode !== PANE_MODES.ASSISTANT\n );\n const toggle = useNeetoAssistStore(state => state.toggle);\n const setConversation = useNeetoAssistStore(state => state.setConversation);\n const clearConversation = useNeetoAssistStore(\n state => state.clearConversation\n );\n\n const seenDraftId = useNeetoAssistStore(\n state => state.seenDrafts[conversationId]\n );\n\n const { data: { runs = [] } = {} } = useFetchRuns(conversationId);\n const draftId = latestDraftId(runs);\n const hasUnseenDraft = !isOpen && !!draftId && draftId !== seenDraftId;\n\n // The host's handlers change on every render. Only whether there is one for\n // \"Use reply\" matters to the pane, and one for an applied action changes\n // nothing it shows, so the pane gets stand-ins that call the latest.\n const useReplyRef = useRef(onUseReply);\n const actionAppliedRef = useRef(onActionApplied);\n const canUseReply = !!onUseReply;\n useEffect(() => {\n useReplyRef.current = onUseReply;\n actionAppliedRef.current = onActionApplied;\n });\n\n useEffect(() => {\n // The answer to a click on Apply can arrive after the button has moved on\n // to another ticket. It then goes to the handler the host last gave for\n // this ticket, not to the one for the ticket now on screen.\n let handlerOnLeaving;\n let hasLeft = false;\n\n setConversation({\n id: conversationId,\n contextLabel,\n onUseReply: canUseReply\n ? (text, html) => useReplyRef.current?.(text, html)\n : undefined,\n onActionApplied: action =>\n (hasLeft ? handlerOnLeaving : actionAppliedRef.current)?.(action),\n });\n\n return () => {\n handlerOnLeaving = actionAppliedRef.current;\n hasLeft = true;\n clearConversation(conversationId);\n };\n }, [\n canUseReply,\n clearConversation,\n contextLabel,\n conversationId,\n setConversation,\n ]);\n\n return (\n <span className=\"relative inline-flex\">\n <Button\n aria-pressed={isOpen}\n data-testid=\"neeto-assist-button\"\n icon={NeetoAssistIcon}\n iconPosition=\"left\"\n label={t(\"neetoAssist.askButton\")}\n size=\"sm\"\n variant={isOpen ? \"secondary\" : \"outline\"}\n tooltipProps={\n hasUnseenDraft ? { content: t(\"neetoAssist.draftReady\") } : undefined\n }\n onClick={toggle}\n />\n {hasUnseenDraft && (\n <span\n aria-label={t(\"neetoAssist.draftReady\")}\n className=\"ring-background absolute -end-0.5 -top-0.5 size-2.5 rounded-full bg-purple-600 ring-2\"\n data-testid=\"neeto-assist-draft-dot\"\n role=\"status\"\n />\n )}\n </span>\n );\n};\n\nexport default NeetoAssistButton;\n"],"names":["NeetoAssistIcon","props","_jsx","Sparkle","_objectSpread","className","NeetoAssistButton","_ref","conversationId","contextLabel","onActionApplied","onUseReply","_useTranslation","useTranslation","t","isOpen","useNeetoAssistStore","state","mode","PANE_MODES","ASSISTANT","toggle","setConversation","clearConversation","seenDraftId","seenDrafts","_useFetchRuns","useFetchRuns","_useFetchRuns$data","data","_useFetchRuns$data2","_useFetchRuns$data2$r","runs","draftId","latestDraftId","hasUnseenDraft","useReplyRef","useRef","actionAppliedRef","canUseReply","useEffect","current","handlerOnLeaving","hasLeft","id","text","html","_useReplyRef$current","call","undefined","action","_ref2","_jsxs","children","Button","icon","iconPosition","label","size","variant","tooltipProps","content","onClick","role"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAWA,IAAMA,eAAe,GAAG,SAAlBA,eAAeA,CAAGC,KAAK,EAAA;EAAA,oBAC3BC,GAAA,CAACC,OAAO,EAAAC,aAAA,CAAAA,aAAA,KAAKH,KAAK,CAAA,EAAA,EAAA,EAAA;AAAEI,IAAAA,SAAS,EAAC;AAAiB,GAAA,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