@botonic/react 0.41.0 → 0.42.0-alpha.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 (122) hide show
  1. package/lib/cjs/components/system-debug-trace/debug-message.js +22 -0
  2. package/lib/cjs/components/system-debug-trace/debug-message.js.map +1 -1
  3. package/lib/cjs/components/system-debug-trace/events/bot-action.d.ts +7 -0
  4. package/lib/cjs/components/system-debug-trace/events/bot-action.js +18 -0
  5. package/lib/cjs/components/system-debug-trace/events/bot-action.js.map +1 -0
  6. package/lib/cjs/components/system-debug-trace/events/conditional-channel.d.ts +7 -0
  7. package/lib/cjs/components/system-debug-trace/events/conditional-channel.js +18 -0
  8. package/lib/cjs/components/system-debug-trace/events/conditional-channel.js.map +1 -0
  9. package/lib/cjs/components/system-debug-trace/events/conditional-country.d.ts +7 -0
  10. package/lib/cjs/components/system-debug-trace/events/conditional-country.js +18 -0
  11. package/lib/cjs/components/system-debug-trace/events/conditional-country.js.map +1 -0
  12. package/lib/cjs/components/system-debug-trace/events/conditional-custom.d.ts +8 -0
  13. package/lib/cjs/components/system-debug-trace/events/conditional-custom.js +18 -0
  14. package/lib/cjs/components/system-debug-trace/events/conditional-custom.js.map +1 -0
  15. package/lib/cjs/components/system-debug-trace/events/conditional-queue-status.d.ts +10 -0
  16. package/lib/cjs/components/system-debug-trace/events/conditional-queue-status.js +20 -0
  17. package/lib/cjs/components/system-debug-trace/events/conditional-queue-status.js.map +1 -0
  18. package/lib/cjs/components/system-debug-trace/events/constants.d.ts +4 -0
  19. package/lib/cjs/components/system-debug-trace/events/constants.js +4 -0
  20. package/lib/cjs/components/system-debug-trace/events/constants.js.map +1 -1
  21. package/lib/cjs/components/system-debug-trace/events/handoff-success.d.ts +2 -0
  22. package/lib/cjs/components/system-debug-trace/events/handoff-success.js +23 -4
  23. package/lib/cjs/components/system-debug-trace/events/handoff-success.js.map +1 -1
  24. package/lib/cjs/components/system-debug-trace/events/index.d.ts +7 -0
  25. package/lib/cjs/components/system-debug-trace/events/index.js +7 -0
  26. package/lib/cjs/components/system-debug-trace/events/index.js.map +1 -1
  27. package/lib/cjs/components/system-debug-trace/events/redirect-flow.d.ts +10 -0
  28. package/lib/cjs/components/system-debug-trace/events/redirect-flow.js +18 -0
  29. package/lib/cjs/components/system-debug-trace/events/redirect-flow.js.map +1 -0
  30. package/lib/cjs/components/system-debug-trace/events/webview-action-triggered.d.ts +8 -0
  31. package/lib/cjs/components/system-debug-trace/events/webview-action-triggered.js +18 -0
  32. package/lib/cjs/components/system-debug-trace/events/webview-action-triggered.js.map +1 -0
  33. package/lib/cjs/components/system-debug-trace/icons/arrow-progress.d.ts +2 -0
  34. package/lib/cjs/components/system-debug-trace/icons/arrow-progress.js +10 -0
  35. package/lib/cjs/components/system-debug-trace/icons/arrow-progress.js.map +1 -0
  36. package/lib/cjs/components/system-debug-trace/icons/code.d.ts +2 -0
  37. package/lib/cjs/components/system-debug-trace/icons/code.js +10 -0
  38. package/lib/cjs/components/system-debug-trace/icons/code.js.map +1 -0
  39. package/lib/cjs/components/system-debug-trace/icons/split.d.ts +2 -0
  40. package/lib/cjs/components/system-debug-trace/icons/split.js +10 -0
  41. package/lib/cjs/components/system-debug-trace/icons/split.js.map +1 -0
  42. package/lib/cjs/components/system-debug-trace/icons/window-restore.d.ts +2 -0
  43. package/lib/cjs/components/system-debug-trace/icons/window-restore.js +10 -0
  44. package/lib/cjs/components/system-debug-trace/icons/window-restore.js.map +1 -0
  45. package/lib/cjs/components/system-debug-trace/styles.js +7 -4
  46. package/lib/cjs/components/system-debug-trace/styles.js.map +1 -1
  47. package/lib/cjs/components/system-debug-trace/types.d.ts +2 -2
  48. package/lib/cjs/index-types.d.ts +8 -0
  49. package/lib/cjs/index-types.js.map +1 -1
  50. package/lib/cjs/webchat/context/index.js +14 -0
  51. package/lib/cjs/webchat/context/index.js.map +1 -1
  52. package/lib/esm/components/system-debug-trace/debug-message.js +24 -2
  53. package/lib/esm/components/system-debug-trace/debug-message.js.map +1 -1
  54. package/lib/esm/components/system-debug-trace/events/bot-action.d.ts +7 -0
  55. package/lib/esm/components/system-debug-trace/events/bot-action.js +14 -0
  56. package/lib/esm/components/system-debug-trace/events/bot-action.js.map +1 -0
  57. package/lib/esm/components/system-debug-trace/events/conditional-channel.d.ts +7 -0
  58. package/lib/esm/components/system-debug-trace/events/conditional-channel.js +14 -0
  59. package/lib/esm/components/system-debug-trace/events/conditional-channel.js.map +1 -0
  60. package/lib/esm/components/system-debug-trace/events/conditional-country.d.ts +7 -0
  61. package/lib/esm/components/system-debug-trace/events/conditional-country.js +14 -0
  62. package/lib/esm/components/system-debug-trace/events/conditional-country.js.map +1 -0
  63. package/lib/esm/components/system-debug-trace/events/conditional-custom.d.ts +8 -0
  64. package/lib/esm/components/system-debug-trace/events/conditional-custom.js +14 -0
  65. package/lib/esm/components/system-debug-trace/events/conditional-custom.js.map +1 -0
  66. package/lib/esm/components/system-debug-trace/events/conditional-queue-status.d.ts +10 -0
  67. package/lib/esm/components/system-debug-trace/events/conditional-queue-status.js +16 -0
  68. package/lib/esm/components/system-debug-trace/events/conditional-queue-status.js.map +1 -0
  69. package/lib/esm/components/system-debug-trace/events/constants.d.ts +4 -0
  70. package/lib/esm/components/system-debug-trace/events/constants.js +4 -0
  71. package/lib/esm/components/system-debug-trace/events/constants.js.map +1 -1
  72. package/lib/esm/components/system-debug-trace/events/handoff-success.d.ts +2 -0
  73. package/lib/esm/components/system-debug-trace/events/handoff-success.js +23 -4
  74. package/lib/esm/components/system-debug-trace/events/handoff-success.js.map +1 -1
  75. package/lib/esm/components/system-debug-trace/events/index.d.ts +7 -0
  76. package/lib/esm/components/system-debug-trace/events/index.js +7 -0
  77. package/lib/esm/components/system-debug-trace/events/index.js.map +1 -1
  78. package/lib/esm/components/system-debug-trace/events/redirect-flow.d.ts +10 -0
  79. package/lib/esm/components/system-debug-trace/events/redirect-flow.js +14 -0
  80. package/lib/esm/components/system-debug-trace/events/redirect-flow.js.map +1 -0
  81. package/lib/esm/components/system-debug-trace/events/webview-action-triggered.d.ts +8 -0
  82. package/lib/esm/components/system-debug-trace/events/webview-action-triggered.js +14 -0
  83. package/lib/esm/components/system-debug-trace/events/webview-action-triggered.js.map +1 -0
  84. package/lib/esm/components/system-debug-trace/icons/arrow-progress.d.ts +2 -0
  85. package/lib/esm/components/system-debug-trace/icons/arrow-progress.js +6 -0
  86. package/lib/esm/components/system-debug-trace/icons/arrow-progress.js.map +1 -0
  87. package/lib/esm/components/system-debug-trace/icons/code.d.ts +2 -0
  88. package/lib/esm/components/system-debug-trace/icons/code.js +6 -0
  89. package/lib/esm/components/system-debug-trace/icons/code.js.map +1 -0
  90. package/lib/esm/components/system-debug-trace/icons/split.d.ts +2 -0
  91. package/lib/esm/components/system-debug-trace/icons/split.js +6 -0
  92. package/lib/esm/components/system-debug-trace/icons/split.js.map +1 -0
  93. package/lib/esm/components/system-debug-trace/icons/window-restore.d.ts +2 -0
  94. package/lib/esm/components/system-debug-trace/icons/window-restore.js +6 -0
  95. package/lib/esm/components/system-debug-trace/icons/window-restore.js.map +1 -0
  96. package/lib/esm/components/system-debug-trace/styles.js +7 -4
  97. package/lib/esm/components/system-debug-trace/styles.js.map +1 -1
  98. package/lib/esm/components/system-debug-trace/types.d.ts +2 -2
  99. package/lib/esm/index-types.d.ts +8 -0
  100. package/lib/esm/index-types.js.map +1 -1
  101. package/lib/esm/webchat/context/index.js +14 -0
  102. package/lib/esm/webchat/context/index.js.map +1 -1
  103. package/package.json +2 -2
  104. package/src/components/system-debug-trace/debug-message.tsx +30 -2
  105. package/src/components/system-debug-trace/events/bot-action.tsx +28 -0
  106. package/src/components/system-debug-trace/events/conditional-channel.tsx +28 -0
  107. package/src/components/system-debug-trace/events/conditional-country.tsx +28 -0
  108. package/src/components/system-debug-trace/events/conditional-custom.tsx +29 -0
  109. package/src/components/system-debug-trace/events/conditional-queue-status.tsx +37 -0
  110. package/src/components/system-debug-trace/events/constants.ts +4 -0
  111. package/src/components/system-debug-trace/events/handoff-success.tsx +45 -8
  112. package/src/components/system-debug-trace/events/index.ts +7 -0
  113. package/src/components/system-debug-trace/events/redirect-flow.tsx +31 -0
  114. package/src/components/system-debug-trace/events/webview-action-triggered.tsx +29 -0
  115. package/src/components/system-debug-trace/icons/arrow-progress.tsx +15 -0
  116. package/src/components/system-debug-trace/icons/code.tsx +15 -0
  117. package/src/components/system-debug-trace/icons/split.tsx +15 -0
  118. package/src/components/system-debug-trace/icons/window-restore.tsx +15 -0
  119. package/src/components/system-debug-trace/styles.ts +7 -4
  120. package/src/components/system-debug-trace/types.ts +14 -0
  121. package/src/index-types.ts +9 -0
  122. package/src/webchat/context/index.tsx +17 -0
@@ -52,9 +52,17 @@ interface AddBotResponseArgs {
52
52
  interface AddSystemResponseArgs {
53
53
  response: any;
54
54
  }
55
+ export interface MinimalHubtypeMessage {
56
+ id: string;
57
+ type: string;
58
+ action: string;
59
+ text: string;
60
+ }
55
61
  export interface PreviewUtils {
56
62
  getChunkIdsGroupedBySource: (chunkIds: string[]) => Promise<ChunkIdsGroupedBySourceData[]>;
57
63
  onClickOpenChunks: (chunkIdsGroupedBySource: ChunkIdsGroupedBySourceData[]) => void;
64
+ getMessageById: (messageId: string) => Promise<MinimalHubtypeMessage>;
65
+ trackPreviewEventOpened: (eventProperties: Record<string, unknown>) => void;
58
66
  }
59
67
  export interface WebchatArgs {
60
68
  theme?: Partial<WebchatTheme>;
@@ -1 +1 @@
1
- {"version":3,"file":"index-types.js","sourceRoot":"","sources":["../../src/index-types.ts"],"names":[],"mappings":"AAqJA,MAAM,CAAN,IAAY,OAKX;AALD,WAAY,OAAO;IACjB,sBAAW,CAAA;IACX,wBAAa,CAAA;IACb,0BAAe,CAAA;IACf,4BAAiB,CAAA;AACnB,CAAC,EALW,OAAO,KAAP,OAAO,QAKlB;AAED,MAAM,CAAN,IAAY,MAGX;AAHD,WAAY,MAAM;IAChB,0BAAgB,CAAA;IAChB,4BAAkB,CAAA;AACpB,CAAC,EAHW,MAAM,KAAN,MAAM,QAGjB"}
1
+ {"version":3,"file":"index-types.js","sourceRoot":"","sources":["../../src/index-types.ts"],"names":[],"mappings":"AA8JA,MAAM,CAAN,IAAY,OAKX;AALD,WAAY,OAAO;IACjB,sBAAW,CAAA;IACX,wBAAa,CAAA;IACb,0BAAe,CAAA;IACf,4BAAiB,CAAA;AACnB,CAAC,EALW,OAAO,KAAP,OAAO,QAKlB;AAED,MAAM,CAAN,IAAY,MAGX;AAHD,WAAY,MAAM;IAChB,0BAAgB,CAAA;IAChB,4BAAkB,CAAA;AACpB,CAAC,EAHW,MAAM,KAAN,MAAM,QAGjB"}
@@ -69,6 +69,20 @@ export const WebchatContext = createContext({
69
69
  return;
70
70
  },
71
71
  webchatState: {},
72
+ previewUtils: {
73
+ trackPreviewEventOpened: () => {
74
+ return;
75
+ },
76
+ getChunkIdsGroupedBySource: () => __awaiter(void 0, void 0, void 0, function* () {
77
+ return [];
78
+ }),
79
+ onClickOpenChunks: () => {
80
+ return;
81
+ },
82
+ getMessageById: () => __awaiter(void 0, void 0, void 0, function* () {
83
+ return {};
84
+ }),
85
+ },
72
86
  trackEvent: () => __awaiter(void 0, void 0, void 0, function* () {
73
87
  return;
74
88
  }),
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/webchat/context/index.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAA;AAKrC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAE1C,MAAM,CAAC,MAAM,cAAc,GAAG,aAAa,CAAsB;IAC/D,UAAU,EAAE,GAAG,EAAE;QACf,OAAM;IACR,CAAC;IACD,gBAAgB,EAAE,GAAG,EAAE;QACrB,OAAM;IACR,CAAC;IACD,YAAY,EAAE,GAAS,EAAE;QACvB,OAAM;IACR,CAAC,CAAA;IACD,WAAW,EAAE,GAAG,EAAE;QAChB,OAAM;IACR,CAAC;IACD,WAAW,EAAE,GAAG,EAAE;QAChB,OAAM;IACR,CAAC;IACD,mBAAmB,EAAE,GAAG,EAAE;QACxB,OAAM;IACR,CAAC;IACD,iBAAiB,EAAE,GAAG,EAAE;QACtB,OAAM;IACR,CAAC;IACD,qBAAqB,EAAE,GAAG,EAAE;QAC1B,OAAM;IACR,CAAC;IACD,cAAc,EAAE,GAAS,EAAE;QACzB,OAAM;IACR,CAAC,CAAA;IACD,SAAS,EAAE,GAAS,EAAE;QACpB,OAAM;IACR,CAAC,CAAA;IACD,WAAW,EAAE,GAAS,EAAE;QACtB,OAAM;IACR,CAAC,CAAA;IACD,QAAQ,EAAE,GAAS,EAAE;QACnB,OAAM;IACR,CAAC,CAAA;IACD,oBAAoB,EAAE,GAAG,EAAE;QACzB,OAAM;IACR,CAAC;IACD,aAAa,EAAE,GAAG,EAAE;QAClB,OAAM;IACR,CAAC;IACD,iBAAiB,EAAE,GAAG,EAAE;QACtB,OAAM;IACR,CAAC;IACD,oBAAoB,EAAE,GAAG,EAAE;QACzB,OAAM;IACR,CAAC;IACD,wBAAwB,EAAE,GAAG,EAAE;QAC7B,OAAM;IACR,CAAC;IACD,iBAAiB,EAAE,GAAG,EAAE;QACtB,OAAM;IACR,CAAC;IACD,aAAa,EAAE,GAAG,EAAE;QAClB,OAAM;IACR,CAAC;IACD,aAAa,EAAE,GAAG,EAAE;QAClB,OAAM;IACR,CAAC;IACD,UAAU,EAAE,GAAG,EAAE;QACf,OAAM;IACR,CAAC;IACD,wBAAwB,EAAE,GAAG,EAAE;QAC7B,OAAM;IACR,CAAC;IACD,YAAY,EAAE,EAAkB;IAChC,UAAU,EAAE,GAAS,EAAE;QACrB,OAAM;IACR,CAAC,CAAA;IACD,mBAAmB,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;IACtC,WAAW,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;IAC9B,aAAa,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;IAChC,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;IAC5B,yBAAyB,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;IAC5C,UAAU,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;CAC9B,CAAC,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/webchat/context/index.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAA;AAOrC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAE1C,MAAM,CAAC,MAAM,cAAc,GAAG,aAAa,CAAsB;IAC/D,UAAU,EAAE,GAAG,EAAE;QACf,OAAM;IACR,CAAC;IACD,gBAAgB,EAAE,GAAG,EAAE;QACrB,OAAM;IACR,CAAC;IACD,YAAY,EAAE,GAAS,EAAE;QACvB,OAAM;IACR,CAAC,CAAA;IACD,WAAW,EAAE,GAAG,EAAE;QAChB,OAAM;IACR,CAAC;IACD,WAAW,EAAE,GAAG,EAAE;QAChB,OAAM;IACR,CAAC;IACD,mBAAmB,EAAE,GAAG,EAAE;QACxB,OAAM;IACR,CAAC;IACD,iBAAiB,EAAE,GAAG,EAAE;QACtB,OAAM;IACR,CAAC;IACD,qBAAqB,EAAE,GAAG,EAAE;QAC1B,OAAM;IACR,CAAC;IACD,cAAc,EAAE,GAAS,EAAE;QACzB,OAAM;IACR,CAAC,CAAA;IACD,SAAS,EAAE,GAAS,EAAE;QACpB,OAAM;IACR,CAAC,CAAA;IACD,WAAW,EAAE,GAAS,EAAE;QACtB,OAAM;IACR,CAAC,CAAA;IACD,QAAQ,EAAE,GAAS,EAAE;QACnB,OAAM;IACR,CAAC,CAAA;IACD,oBAAoB,EAAE,GAAG,EAAE;QACzB,OAAM;IACR,CAAC;IACD,aAAa,EAAE,GAAG,EAAE;QAClB,OAAM;IACR,CAAC;IACD,iBAAiB,EAAE,GAAG,EAAE;QACtB,OAAM;IACR,CAAC;IACD,oBAAoB,EAAE,GAAG,EAAE;QACzB,OAAM;IACR,CAAC;IACD,wBAAwB,EAAE,GAAG,EAAE;QAC7B,OAAM;IACR,CAAC;IACD,iBAAiB,EAAE,GAAG,EAAE;QACtB,OAAM;IACR,CAAC;IACD,aAAa,EAAE,GAAG,EAAE;QAClB,OAAM;IACR,CAAC;IACD,aAAa,EAAE,GAAG,EAAE;QAClB,OAAM;IACR,CAAC;IACD,UAAU,EAAE,GAAG,EAAE;QACf,OAAM;IACR,CAAC;IACD,wBAAwB,EAAE,GAAG,EAAE;QAC7B,OAAM;IACR,CAAC;IACD,YAAY,EAAE,EAAkB;IAChC,YAAY,EAAE;QACZ,uBAAuB,EAAE,GAAG,EAAE;YAC5B,OAAM;QACR,CAAC;QACD,0BAA0B,EAAE,GAAS,EAAE;YACrC,OAAO,EAAmC,CAAA;QAC5C,CAAC,CAAA;QACD,iBAAiB,EAAE,GAAG,EAAE;YACtB,OAAM;QACR,CAAC;QACD,cAAc,EAAE,GAAS,EAAE;YACzB,OAAO,EAA2B,CAAA;QACpC,CAAC,CAAA;KACF;IAED,UAAU,EAAE,GAAS,EAAE;QACrB,OAAM;IACR,CAAC,CAAA;IACD,mBAAmB,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;IACtC,WAAW,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;IAC9B,aAAa,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;IAChC,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;IAC5B,yBAAyB,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;IAC5C,UAAU,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;CAC9B,CAAC,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@botonic/react",
3
- "version": "0.41.0",
3
+ "version": "0.42.0-alpha.0",
4
4
  "license": "MIT",
5
5
  "description": "Build Chatbots using React",
6
6
  "main": "./lib/cjs",
@@ -21,7 +21,7 @@
21
21
  "lint_core": "../../node_modules/.bin/eslint_d --cache --quiet '.*.js' '*.js' 'src/**/*.js*' --fix"
22
22
  },
23
23
  "dependencies": {
24
- "@botonic/core": "^0.41.0",
24
+ "@botonic/core": "0.42.0-alpha.0",
25
25
  "axios": "^1.12.2",
26
26
  "emoji-picker-react": "^4.12.0",
27
27
  "lodash.merge": "^4.6.2",
@@ -1,13 +1,21 @@
1
1
  import { EventAction } from '@botonic/core'
2
- import React, { useRef, useState } from 'react'
2
+ import React, { useContext, useEffect, useRef, useState } from 'react'
3
3
 
4
+ import { WebchatContext } from '../../webchat/context'
4
5
  import {
5
6
  getAiAgentEventConfig,
7
+ getBotActionEventConfig,
8
+ getConditionalChannelEventConfig,
9
+ getConditionalCountryEventConfig,
10
+ getConditionalCustomEventConfig,
11
+ getConditionalQueueStatusEventConfig,
6
12
  getFallbackEventConfig,
7
13
  getHandoffSuccessEventConfig,
8
14
  getKeywordEventConfig,
9
15
  getKnowledgeBaseEventConfig,
16
+ getRedirectFlowEventConfig,
10
17
  getSmartIntentEventConfig,
18
+ getWebviewActionTriggeredEventConfig,
11
19
  } from './events'
12
20
  import { useLastLabelPosition } from './hooks/use-last-label-position'
13
21
  import { CaretDownSvg, CaretUpSvg } from './icons'
@@ -38,6 +46,20 @@ const getEventConfig = (
38
46
  return getKnowledgeBaseEventConfig(debugEvent)
39
47
  case EventAction.Fallback:
40
48
  return getFallbackEventConfig(debugEvent)
49
+ case EventAction.BotAction:
50
+ return getBotActionEventConfig(debugEvent)
51
+ case EventAction.ConditionalChannel:
52
+ return getConditionalChannelEventConfig(debugEvent)
53
+ case EventAction.ConditionalCountry:
54
+ return getConditionalCountryEventConfig(debugEvent)
55
+ case EventAction.ConditionalCustom:
56
+ return getConditionalCustomEventConfig(debugEvent)
57
+ case EventAction.ConditionalQueueStatus:
58
+ return getConditionalQueueStatusEventConfig(debugEvent)
59
+ case EventAction.RedirectFlow:
60
+ return getRedirectFlowEventConfig(debugEvent)
61
+ case EventAction.WebviewActionTriggered:
62
+ return getWebviewActionTriggeredEventConfig(debugEvent)
41
63
  default:
42
64
  return undefined
43
65
  }
@@ -51,7 +73,7 @@ interface DebugMessageProps {
51
73
  export const DebugMessage = ({ debugEvent, messageId }: DebugMessageProps) => {
52
74
  const [isExpanded, setIsExpanded] = useState(false)
53
75
  const wrapperRef = useRef<HTMLDivElement>(null)
54
-
76
+ const { previewUtils } = useContext(WebchatContext)
55
77
  const eventConfig = getEventConfig(debugEvent)
56
78
 
57
79
  useLastLabelPosition({
@@ -61,6 +83,12 @@ export const DebugMessage = ({ debugEvent, messageId }: DebugMessageProps) => {
61
83
  isCollapsible: eventConfig?.collapsible ?? false,
62
84
  })
63
85
 
86
+ useEffect(() => {
87
+ if (isExpanded) {
88
+ previewUtils?.trackPreviewEventOpened?.({ action: debugEvent.action })
89
+ }
90
+ }, [previewUtils, isExpanded, debugEvent])
91
+
64
92
  if (!eventConfig) {
65
93
  return null
66
94
  }
@@ -0,0 +1,28 @@
1
+ import { EventAction } from '@botonic/core'
2
+ import React from 'react'
3
+
4
+ import { CodeSvg } from '../icons/code'
5
+ import { DebugEventConfig } from '../types'
6
+
7
+ export interface BotActionDebugEvent {
8
+ action: EventAction.BotAction
9
+ payload: string
10
+ }
11
+
12
+ export const getBotActionEventConfig = (
13
+ data: BotActionDebugEvent
14
+ ): DebugEventConfig => {
15
+ const title = (
16
+ <>
17
+ Bot action triggered <span>- {data.payload}</span>
18
+ </>
19
+ )
20
+
21
+ return {
22
+ action: EventAction.BotAction,
23
+ title,
24
+ component: null,
25
+ icon: <CodeSvg />,
26
+ collapsible: false,
27
+ }
28
+ }
@@ -0,0 +1,28 @@
1
+ import { EventAction } from '@botonic/core'
2
+ import React from 'react'
3
+
4
+ import { SplitSvg } from '../icons/split'
5
+ import { DebugEventConfig } from '../types'
6
+
7
+ export interface ConditionalChannelDebugEvent {
8
+ action: EventAction.ConditionalChannel
9
+ channel: string
10
+ }
11
+
12
+ export const getConditionalChannelEventConfig = (
13
+ data: ConditionalChannelDebugEvent
14
+ ): DebugEventConfig => {
15
+ const title = (
16
+ <>
17
+ Channel checked <span>- {data.channel}</span>
18
+ </>
19
+ )
20
+
21
+ return {
22
+ action: EventAction.ConditionalChannel,
23
+ title,
24
+ component: null,
25
+ icon: <SplitSvg />,
26
+ collapsible: false,
27
+ }
28
+ }
@@ -0,0 +1,28 @@
1
+ import { EventAction } from '@botonic/core'
2
+ import React from 'react'
3
+
4
+ import { SplitSvg } from '../icons/split'
5
+ import { DebugEventConfig } from '../types'
6
+
7
+ export interface ConditionalCountryDebugEvent {
8
+ action: EventAction.ConditionalCountry
9
+ country: string
10
+ }
11
+
12
+ export const getConditionalCountryEventConfig = (
13
+ data: ConditionalCountryDebugEvent
14
+ ): DebugEventConfig => {
15
+ const title = (
16
+ <>
17
+ Country checked <span>- {data.country}</span>
18
+ </>
19
+ )
20
+
21
+ return {
22
+ action: EventAction.ConditionalCountry,
23
+ title,
24
+ component: null,
25
+ icon: <SplitSvg />,
26
+ collapsible: false,
27
+ }
28
+ }
@@ -0,0 +1,29 @@
1
+ import { EventAction } from '@botonic/core'
2
+ import React from 'react'
3
+
4
+ import { SplitSvg } from '../icons/split'
5
+ import { DebugEventConfig } from '../types'
6
+
7
+ export interface ConditionalCustomDebugEvent {
8
+ action: EventAction.ConditionalCustom
9
+ conditional_variable: string
10
+ variable_format: string
11
+ }
12
+
13
+ export const getConditionalCustomEventConfig = (
14
+ data: ConditionalCustomDebugEvent
15
+ ): DebugEventConfig => {
16
+ const title = (
17
+ <>
18
+ Custom condition checked <span>- {data.conditional_variable}</span>
19
+ </>
20
+ )
21
+
22
+ return {
23
+ action: EventAction.ConditionalCustom,
24
+ title,
25
+ component: null,
26
+ icon: <SplitSvg />,
27
+ collapsible: false,
28
+ }
29
+ }
@@ -0,0 +1,37 @@
1
+ import { EventAction } from '@botonic/core'
2
+ import React from 'react'
3
+
4
+ import { SplitSvg } from '../icons/split'
5
+ import { DebugEventConfig } from '../types'
6
+
7
+ export interface ConditionalQueueStatusDebugEvent {
8
+ action: EventAction.ConditionalQueueStatus
9
+ queue_id: string
10
+ queue_name: string
11
+ is_queue_open: boolean
12
+ is_available_agent: boolean
13
+ }
14
+
15
+ export const getConditionalQueueStatusEventConfig = (
16
+ data: ConditionalQueueStatusDebugEvent
17
+ ): DebugEventConfig => {
18
+ const queueStatus = data.is_queue_open ? 'Open' : 'Closed'
19
+ const agentStatus = data.is_available_agent ? 'Available' : 'Unavailable'
20
+
21
+ const title = (
22
+ <>
23
+ Queue status checked{' '}
24
+ <span>
25
+ - {queueStatus} (Agent {agentStatus})
26
+ </span>
27
+ </>
28
+ )
29
+
30
+ return {
31
+ action: EventAction.ConditionalQueueStatus,
32
+ title,
33
+ component: null,
34
+ icon: <SplitSvg />,
35
+ collapsible: false,
36
+ }
37
+ }
@@ -7,9 +7,13 @@ export const LABELS = {
7
7
  KNOWLEDGE_GATHERED: 'Knowledge gathered',
8
8
  EXECUTED_TOOLS: 'Executed tools',
9
9
  NO_TOOLS_EXECUTED: 'No tools executed',
10
+ AUTO_ASSIGN_ON: 'ON',
11
+ AUTO_ASSIGN_OFF: 'OFF',
10
12
  EXIT: 'Exit',
11
13
  ERROR: 'Error',
12
14
  QUEUE: 'Queue',
15
+ AUTO_ASSIGN: 'Auto-assign',
16
+ NOTE: 'Note',
13
17
  KNOWLEDGE_BASE_FAIL_REASON: 'Knowledge Base Fail Reason',
14
18
  SEE_CHUNKS_BUTTON: 'See chunks',
15
19
  } as const
@@ -1,6 +1,7 @@
1
1
  import { EventAction } from '@botonic/core'
2
- import React from 'react'
2
+ import React, { useContext, useEffect, useState } from 'react'
3
3
 
4
+ import { WebchatContext } from '../../../webchat/context'
4
5
  import { HeadSetSvg } from '../icons'
5
6
  import {
6
7
  StyledDebugDetail,
@@ -14,14 +15,51 @@ export interface HandoffSuccessDebugEvent {
14
15
  action: EventAction.HandoffSuccess
15
16
  handoff_queue_name: string
16
17
  handoff_is_queue_open: boolean
18
+ handoff_has_auto_assign: boolean
19
+ handoff_note_id: string
17
20
  }
18
21
 
19
22
  export const HandoffSuccess = (props: HandoffSuccessDebugEvent) => {
23
+ const { previewUtils } = useContext(WebchatContext)
24
+ const [noteMessage, setNoteMessage] = useState<string>()
25
+
26
+ useEffect(() => {
27
+ const fetchNoteMessage = async () => {
28
+ if (!previewUtils || !props.handoff_note_id) {
29
+ return
30
+ }
31
+ const noteMessage = await previewUtils.getMessageById(
32
+ props.handoff_note_id
33
+ )
34
+ if (!noteMessage) {
35
+ return
36
+ }
37
+ setNoteMessage(noteMessage.text)
38
+ }
39
+ fetchNoteMessage()
40
+ }, [previewUtils, props.handoff_note_id])
41
+
20
42
  return (
21
- <StyledDebugDetail>
22
- <StyledDebugLabel>{LABELS.QUEUE}</StyledDebugLabel>
23
- <StyledDebugValue>{props.handoff_queue_name}</StyledDebugValue>
24
- </StyledDebugDetail>
43
+ <>
44
+ <StyledDebugDetail>
45
+ <StyledDebugLabel>{LABELS.QUEUE}</StyledDebugLabel>
46
+ <StyledDebugValue>{props.handoff_queue_name}</StyledDebugValue>
47
+ </StyledDebugDetail>
48
+ <StyledDebugDetail>
49
+ <StyledDebugLabel>{LABELS.AUTO_ASSIGN}</StyledDebugLabel>
50
+ <StyledDebugValue>
51
+ {props.handoff_has_auto_assign
52
+ ? LABELS.AUTO_ASSIGN_ON
53
+ : LABELS.AUTO_ASSIGN_OFF}
54
+ </StyledDebugValue>
55
+ </StyledDebugDetail>
56
+ {Boolean(noteMessage) && (
57
+ <StyledDebugDetail>
58
+ <StyledDebugLabel>{LABELS.NOTE}</StyledDebugLabel>
59
+ <StyledDebugValue>{noteMessage}</StyledDebugValue>
60
+ </StyledDebugDetail>
61
+ )}
62
+ </>
25
63
  )
26
64
  }
27
65
 
@@ -36,8 +74,7 @@ export const getHandoffSuccessEventConfig = (
36
74
  </>
37
75
  ),
38
76
  icon: <HeadSetSvg />,
39
- // TODO: Disable component and collapsible for now because we are only showing the queue name
40
- component: null,
41
- collapsible: false,
77
+ component: HandoffSuccess,
78
+ collapsible: true,
42
79
  }
43
80
  }
@@ -1,7 +1,14 @@
1
1
  export * from './ai-agent'
2
+ export * from './bot-action'
3
+ export * from './conditional-channel'
4
+ export * from './conditional-country'
5
+ export * from './conditional-custom'
6
+ export * from './conditional-queue-status'
2
7
  export * from './fallback'
3
8
  export * from './handoff-success'
4
9
  export * from './keyword'
5
10
  export * from './knowledge-base'
6
11
  export * from './knowledge-bases-types'
12
+ export * from './redirect-flow'
7
13
  export * from './smart-intent'
14
+ export * from './webview-action-triggered'
@@ -0,0 +1,31 @@
1
+ import { EventAction } from '@botonic/core'
2
+ import React from 'react'
3
+
4
+ import { ArrowProgressSvg } from '../icons/arrow-progress'
5
+ import { DebugEventConfig } from '../types'
6
+
7
+ export interface RedirectFlowDebugEvent {
8
+ action: EventAction.RedirectFlow
9
+ flow_id: string
10
+ flow_name: string
11
+ flow_target_id: string
12
+ flow_target_name: string
13
+ }
14
+
15
+ export const getRedirectFlowEventConfig = (
16
+ data: RedirectFlowDebugEvent
17
+ ): DebugEventConfig => {
18
+ const title = (
19
+ <>
20
+ Redirected to flow <span>- {data.flow_target_name}</span>
21
+ </>
22
+ )
23
+
24
+ return {
25
+ action: EventAction.RedirectFlow,
26
+ title,
27
+ component: null,
28
+ icon: <ArrowProgressSvg />,
29
+ collapsible: false,
30
+ }
31
+ }
@@ -0,0 +1,29 @@
1
+ import { EventAction } from '@botonic/core'
2
+ import React from 'react'
3
+
4
+ import { WindowRestoreSvg } from '../icons/window-restore'
5
+ import { DebugEventConfig } from '../types'
6
+
7
+ export interface WebviewActionTriggeredDebugEvent {
8
+ action: EventAction.WebviewActionTriggered
9
+ webview_target_id: string
10
+ webview_name: string
11
+ }
12
+
13
+ export const getWebviewActionTriggeredEventConfig = (
14
+ data: WebviewActionTriggeredDebugEvent
15
+ ): DebugEventConfig => {
16
+ const title = (
17
+ <>
18
+ Webview action triggered <span>- {data.webview_name}</span>
19
+ </>
20
+ )
21
+
22
+ return {
23
+ action: EventAction.WebviewActionTriggered,
24
+ title,
25
+ component: null,
26
+ icon: <WindowRestoreSvg />,
27
+ collapsible: false,
28
+ }
29
+ }
@@ -0,0 +1,15 @@
1
+ import React from 'react'
2
+
3
+ import { COLORS } from '../../../constants'
4
+ import { IconProps } from '../types'
5
+
6
+ export const ArrowProgressSvg = ({ color = COLORS.N500 }: IconProps) => {
7
+ return (
8
+ <svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 640 640' fill={color}>
9
+ <path
10
+ d='M294.8 97.8C303.8 94.1 314.1 96.1 321 103L361 143C370.4 152.4 370.4 167.6 361 176.9L321 216.9C314.1 223.8 303.8 225.8 294.8 222.1C285.8 218.4 280 209.7 280 200L280 192L176 192C149.5 192 128 213.5 128 240C128 266.5 149.5 288 176 288L464 288C525.9 288 576 338.1 576 400C576 446.4 547.8 486.1 507.7 503.2C498.4 527.1 475.2 544 448 544C412.7 544 384 515.3 384 480C384 444.7 412.7 416 448 416C466.6 416 483.4 423.9 495 436.6C505.4 427.8 512 414.7 512 400C512 373.5 490.5 352 464 352L176 352C114.1 352 64 301.9 64 240C64 178.1 114.1 128 176 128L280 128L280 120C280 110.3 285.8 101.5 294.8 97.8zM480 96C515.3 96 544 124.7 544 160C544 195.3 515.3 224 480 224C444.7 224 416 195.3 416 160C416 124.7 444.7 96 480 96zM215.4 512C204.3 531.1 183.7 544 160 544C124.7 544 96 515.3 96 480C96 444.7 124.7 416 160 416C183.7 416 204.4 428.9 215.4 448L248 448L248 440C248 430.3 253.8 421.5 262.8 417.8C271.8 414.1 282.1 416.1 289 423L329 463C338.4 472.4 338.4 487.6 329 496.9L289 536.9C282.1 543.8 271.8 545.8 262.8 542.1C253.8 538.4 248 529.7 248 520L248 512L215.4 512z'
11
+ fill='currentColor'
12
+ />
13
+ </svg>
14
+ )
15
+ }
@@ -0,0 +1,15 @@
1
+ import React from 'react'
2
+
3
+ import { COLORS } from '../../../constants'
4
+ import { IconProps } from '../types'
5
+
6
+ export const CodeSvg = ({ color = COLORS.N500 }: IconProps) => {
7
+ return (
8
+ <svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 640 640' fill={color}>
9
+ <path
10
+ d='M392.8 65.2C375.8 60.3 358.1 70.2 353.2 87.2L225.2 535.2C220.3 552.2 230.2 569.9 247.2 574.8C264.2 579.7 281.9 569.8 286.8 552.8L414.8 104.8C419.7 87.8 409.8 70.1 392.8 65.2zM457.4 201.3C444.9 213.8 444.9 234.1 457.4 246.6L530.8 320L457.4 393.4C444.9 405.9 444.9 426.2 457.4 438.7C469.9 451.2 490.2 451.2 502.7 438.7L598.7 342.7C611.2 330.2 611.2 309.9 598.7 297.4L502.7 201.4C490.2 188.9 469.9 188.9 457.4 201.4zM182.7 201.3C170.2 188.8 149.9 188.8 137.4 201.3L41.4 297.3C28.9 309.8 28.9 330.1 41.4 342.6L137.4 438.6C149.9 451.1 170.2 451.1 182.7 438.6C195.2 426.1 195.2 405.8 182.7 393.3L109.3 320L182.6 246.6C195.1 234.1 195.1 213.8 182.6 201.3z'
11
+ fill='currentColor'
12
+ />
13
+ </svg>
14
+ )
15
+ }
@@ -0,0 +1,15 @@
1
+ import React from 'react'
2
+
3
+ import { COLORS } from '../../../constants'
4
+ import { IconProps } from '../types'
5
+
6
+ export const SplitSvg = ({ color = COLORS.N500 }: IconProps) => {
7
+ return (
8
+ <svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 640 640' fill={color}>
9
+ <path
10
+ d='M467.8 66.4C479.8 61.4 493.5 64.2 502.7 73.3L566.7 137.3C572.7 143.3 576.1 151.4 576.1 159.9C576.1 168.4 572.7 176.5 566.7 182.5L502.7 246.5C493.5 255.7 479.8 258.4 467.8 253.4C455.8 248.4 448 236.9 448 224L448 192L410.5 192C402 192 393.9 195.4 387.9 201.4L269.3 320L387.9 438.6C393.9 444.6 402 448 410.5 448L448 448L448 416C448 403.1 455.8 391.4 467.8 386.4C479.8 381.4 493.5 384.2 502.7 393.3L566.7 457.3C572.7 463.3 576.1 471.4 576.1 479.9C576.1 488.4 572.7 496.5 566.7 502.5L502.7 566.5C493.5 575.7 479.8 578.4 467.8 573.4C455.8 568.4 448 556.9 448 544L448 512L410.5 512C385 512 360.6 501.9 342.6 483.9L210.7 352L96 352C78.3 352 64 337.7 64 320C64 302.3 78.3 288 96 288L210.7 288L342.6 156.1C360.6 138.1 385 128 410.5 128L448 128L448 96C448 83.1 455.8 71.4 467.8 66.4z'
11
+ fill='currentColor'
12
+ />
13
+ </svg>
14
+ )
15
+ }
@@ -0,0 +1,15 @@
1
+ import React from 'react'
2
+
3
+ import { COLORS } from '../../../constants'
4
+ import { IconProps } from '../types'
5
+
6
+ export const WindowRestoreSvg = ({ color = COLORS.N500 }: IconProps) => {
7
+ return (
8
+ <svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 640 640' fill={color}>
9
+ <path
10
+ d='M544 160L192 160C192 124.7 220.7 96 256 96L544 96C579.3 96 608 124.7 608 160L608 352C608 387.3 579.3 416 544 416L496 416L496 352L544 352L544 160zM32 288C32 252.7 60.7 224 96 224L384 224C419.3 224 448 252.7 448 288L448 480C448 515.3 419.3 544 384 544L96 544C60.7 544 32 515.3 32 480L32 288zM96 328C96 341.3 106.7 352 120 352L360 352C373.3 352 384 341.3 384 328C384 314.7 373.3 304 360 304L120 304C106.7 304 96 314.7 96 328z'
11
+ fill='currentColor'
12
+ />
13
+ </svg>
14
+ )
15
+ }
@@ -120,13 +120,14 @@ export const StyledDebugLabel = styled.strong`
120
120
  `
121
121
 
122
122
  export const StyledDebugValue = styled.div`
123
- display: flex;
124
- align-items: center;
125
- gap: 8px;
126
123
  font-weight: 600;
127
124
  font-size: 12px;
128
125
  color: ${COLORS.N700};
129
126
  line-height: 1.5;
127
+ width: 100%;
128
+ overflow-wrap: break-word;
129
+ word-break: break-word;
130
+ white-space: pre-wrap;
130
131
 
131
132
  > svg {
132
133
  width: 14px;
@@ -134,7 +135,9 @@ export const StyledDebugValue = styled.div`
134
135
  min-width: 14px;
135
136
  min-height: 14px;
136
137
  flex-shrink: 0;
137
- display: block;
138
+ display: inline-block;
139
+ vertical-align: middle;
140
+ margin-right: 8px;
138
141
  }
139
142
  `
140
143
 
@@ -2,11 +2,18 @@ import React from 'react'
2
2
 
3
3
  import {
4
4
  AiAgentDebugEvent,
5
+ BotActionDebugEvent,
6
+ ConditionalChannelDebugEvent,
7
+ ConditionalCountryDebugEvent,
8
+ ConditionalCustomDebugEvent,
9
+ ConditionalQueueStatusDebugEvent,
5
10
  FallbackDebugEvent,
6
11
  HandoffSuccessDebugEvent,
7
12
  KeywordDebugEvent,
8
13
  KnowledgeBaseDebugEvent,
14
+ RedirectFlowDebugEvent,
9
15
  SmartIntentDebugEvent,
16
+ WebviewActionTriggeredDebugEvent,
10
17
  } from './events'
11
18
 
12
19
  export interface IconProps {
@@ -21,6 +28,13 @@ export type DebugEvent =
21
28
  | FallbackDebugEvent
22
29
  | SmartIntentDebugEvent
23
30
  | HandoffSuccessDebugEvent
31
+ | BotActionDebugEvent
32
+ | ConditionalChannelDebugEvent
33
+ | ConditionalCountryDebugEvent
34
+ | ConditionalCustomDebugEvent
35
+ | ConditionalQueueStatusDebugEvent
36
+ | RedirectFlowDebugEvent
37
+ | WebviewActionTriggeredDebugEvent
24
38
 
25
39
  export interface DebugEventConfig {
26
40
  action: string
@@ -81,6 +81,13 @@ interface AddSystemResponseArgs {
81
81
  response: any
82
82
  }
83
83
 
84
+ export interface MinimalHubtypeMessage {
85
+ id: string
86
+ type: string
87
+ action: string
88
+ text: string
89
+ }
90
+
84
91
  export interface PreviewUtils {
85
92
  getChunkIdsGroupedBySource: (
86
93
  chunkIds: string[]
@@ -88,6 +95,8 @@ export interface PreviewUtils {
88
95
  onClickOpenChunks: (
89
96
  chunkIdsGroupedBySource: ChunkIdsGroupedBySourceData[]
90
97
  ) => void
98
+ getMessageById: (messageId: string) => Promise<MinimalHubtypeMessage>
99
+ trackPreviewEventOpened: (eventProperties: Record<string, unknown>) => void
91
100
  }
92
101
 
93
102
  export interface WebchatArgs {
@@ -1,5 +1,7 @@
1
1
  import { createContext } from 'react'
2
2
 
3
+ import { ChunkIdsGroupedBySourceData } from '../../components/system-debug-trace/events/knowledge-bases-types'
4
+ import { MinimalHubtypeMessage } from '../../index-types'
3
5
  import { WebchatContextProps, WebchatState } from './types'
4
6
 
5
7
  export { ClientSession, WebchatState } from './types'
@@ -73,6 +75,21 @@ export const WebchatContext = createContext<WebchatContextProps>({
73
75
  return
74
76
  },
75
77
  webchatState: {} as WebchatState,
78
+ previewUtils: {
79
+ trackPreviewEventOpened: () => {
80
+ return
81
+ },
82
+ getChunkIdsGroupedBySource: async () => {
83
+ return [] as ChunkIdsGroupedBySourceData[]
84
+ },
85
+ onClickOpenChunks: () => {
86
+ return
87
+ },
88
+ getMessageById: async () => {
89
+ return {} as MinimalHubtypeMessage
90
+ },
91
+ },
92
+
76
93
  trackEvent: async () => {
77
94
  return
78
95
  },