@carbon/ai-chat 0.1.6 → 0.1.7-alpha0

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 (144) hide show
  1. package/dist/cjs/{cds-aichat-internal.js → AppContainer.js} +615 -7203
  2. package/dist/cjs/Carousel.js +24 -16
  3. package/dist/cjs/Chat.js +813 -805
  4. package/dist/cjs/GenesysMessengerServiceDesk.js +60 -52
  5. package/dist/cjs/HumanAgentServiceImpl.js +103 -95
  6. package/dist/cjs/NiceDFOServiceDesk.js +56 -48
  7. package/dist/cjs/PDFViewerContainer.js +58 -149
  8. package/dist/cjs/ReactPlayer.js +2 -2
  9. package/dist/cjs/SFServiceDesk.js +66 -58
  10. package/dist/cjs/ServiceDeskImpl.js +2 -2
  11. package/dist/cjs/Table.js +457 -341
  12. package/dist/cjs/ZendeskServiceDesk.js +36 -28
  13. package/dist/cjs/_node-resolve_empty.js +2 -2
  14. package/dist/cjs/agentActions.js +5 -5
  15. package/dist/cjs/aiChatEntry.js +163 -144
  16. package/dist/cjs/anonymousUserIDStorage.js +8 -8
  17. package/dist/cjs/ar-dz.js +4 -4
  18. package/dist/cjs/ar-kw.js +4 -4
  19. package/dist/cjs/ar-ly.js +4 -4
  20. package/dist/cjs/ar-ma.js +4 -4
  21. package/dist/cjs/ar-sa.js +4 -4
  22. package/dist/cjs/ar-tn.js +4 -4
  23. package/dist/cjs/ar.js +4 -4
  24. package/dist/cjs/ar2.js +2 -2
  25. package/dist/cjs/cds-aichat-container.js +111 -23
  26. package/dist/cjs/cds-aichat-custom-element.js +42 -30
  27. package/dist/cjs/cs.js +4 -4
  28. package/dist/cjs/cs2.js +2 -2
  29. package/dist/cjs/de-at.js +4 -4
  30. package/dist/cjs/de-ch.js +4 -4
  31. package/dist/cjs/de.js +4 -4
  32. package/dist/cjs/de2.js +2 -2
  33. package/dist/cjs/en-au.js +4 -4
  34. package/dist/cjs/en-ca.js +4 -4
  35. package/dist/cjs/en-gb.js +4 -4
  36. package/dist/cjs/en-ie.js +4 -4
  37. package/dist/cjs/en-il.js +4 -4
  38. package/dist/cjs/en-nz.js +4 -4
  39. package/dist/cjs/es-do.js +4 -4
  40. package/dist/cjs/es-us.js +4 -4
  41. package/dist/cjs/es.js +4 -4
  42. package/dist/cjs/es2.js +2 -2
  43. package/dist/cjs/export.js +3 -3
  44. package/dist/cjs/export.legacy.js +3 -3
  45. package/dist/cjs/fontUtils.js +2 -2
  46. package/dist/cjs/fr-ca.js +4 -4
  47. package/dist/cjs/fr-ch.js +4 -4
  48. package/dist/cjs/fr.js +4 -4
  49. package/dist/cjs/fr2.js +2 -2
  50. package/dist/cjs/highlight_js.js +2 -2
  51. package/dist/cjs/it-ch.js +4 -4
  52. package/dist/cjs/it.js +4 -4
  53. package/dist/cjs/it2.js +2 -2
  54. package/dist/cjs/ja.js +4 -4
  55. package/dist/cjs/ja2.js +2 -2
  56. package/dist/cjs/ko.js +4 -4
  57. package/dist/cjs/ko2.js +2 -2
  58. package/dist/cjs/markdown.js +2362 -14
  59. package/dist/cjs/mockServiceDesk.js +42 -34
  60. package/dist/cjs/nl.js +4 -4
  61. package/dist/cjs/nl2.js +2 -2
  62. package/dist/cjs/pt-br.js +4 -4
  63. package/dist/cjs/pt-br2.js +2 -2
  64. package/dist/cjs/pt.js +4 -4
  65. package/dist/cjs/render.js +18 -10
  66. package/dist/cjs/zh-cn.js +4 -4
  67. package/dist/cjs/zh-tw.js +4 -4
  68. package/dist/cjs/zh-tw2.js +2 -2
  69. package/dist/cjs/zh.js +2 -2
  70. package/dist/es/{cds-aichat-internal.js → AppContainer.js} +1117 -7671
  71. package/dist/es/Carousel.js +16 -8
  72. package/dist/es/Chat.js +16 -8
  73. package/dist/es/GenesysMessengerServiceDesk.js +16 -8
  74. package/dist/es/HumanAgentServiceImpl.js +16 -8
  75. package/dist/es/NiceDFOServiceDesk.js +16 -8
  76. package/dist/es/PDFViewerContainer.js +16 -107
  77. package/dist/es/ReactPlayer.js +2 -2
  78. package/dist/es/SFServiceDesk.js +16 -8
  79. package/dist/es/ServiceDeskImpl.js +2 -2
  80. package/dist/es/Table.js +426 -310
  81. package/dist/es/ZendeskServiceDesk.js +16 -8
  82. package/dist/es/_node-resolve_empty.js +2 -2
  83. package/dist/es/agentActions.js +3 -3
  84. package/dist/es/aiChatEntry.js +136 -117
  85. package/dist/es/anonymousUserIDStorage.js +3 -3
  86. package/dist/es/ar-dz.js +3 -3
  87. package/dist/es/ar-kw.js +3 -3
  88. package/dist/es/ar-ly.js +3 -3
  89. package/dist/es/ar-ma.js +3 -3
  90. package/dist/es/ar-sa.js +3 -3
  91. package/dist/es/ar-tn.js +3 -3
  92. package/dist/es/ar.js +3 -3
  93. package/dist/es/ar2.js +2 -2
  94. package/dist/es/cds-aichat-container.js +103 -15
  95. package/dist/es/cds-aichat-custom-element.js +30 -18
  96. package/dist/es/cs.js +3 -3
  97. package/dist/es/cs2.js +2 -2
  98. package/dist/es/de-at.js +3 -3
  99. package/dist/es/de-ch.js +3 -3
  100. package/dist/es/de.js +3 -3
  101. package/dist/es/de2.js +2 -2
  102. package/dist/es/en-au.js +3 -3
  103. package/dist/es/en-ca.js +3 -3
  104. package/dist/es/en-gb.js +3 -3
  105. package/dist/es/en-ie.js +3 -3
  106. package/dist/es/en-il.js +3 -3
  107. package/dist/es/en-nz.js +3 -3
  108. package/dist/es/es-do.js +3 -3
  109. package/dist/es/es-us.js +3 -3
  110. package/dist/es/es.js +3 -3
  111. package/dist/es/es2.js +2 -2
  112. package/dist/es/export.js +3 -3
  113. package/dist/es/export.legacy.js +3 -3
  114. package/dist/es/fontUtils.js +2 -2
  115. package/dist/es/fr-ca.js +3 -3
  116. package/dist/es/fr-ch.js +3 -3
  117. package/dist/es/fr.js +3 -3
  118. package/dist/es/fr2.js +2 -2
  119. package/dist/es/highlight_js.js +2 -2
  120. package/dist/es/it-ch.js +3 -3
  121. package/dist/es/it.js +3 -3
  122. package/dist/es/it2.js +2 -2
  123. package/dist/es/ja.js +3 -3
  124. package/dist/es/ja2.js +2 -2
  125. package/dist/es/ko.js +3 -3
  126. package/dist/es/ko2.js +2 -2
  127. package/dist/es/markdown.js +2361 -15
  128. package/dist/es/mockServiceDesk.js +16 -8
  129. package/dist/es/nl.js +3 -3
  130. package/dist/es/nl2.js +2 -2
  131. package/dist/es/pt-br.js +3 -3
  132. package/dist/es/pt-br2.js +2 -2
  133. package/dist/es/pt.js +3 -3
  134. package/dist/es/render.js +17 -9
  135. package/dist/es/zh-cn.js +3 -3
  136. package/dist/es/zh-tw.js +3 -3
  137. package/dist/es/zh-tw2.js +2 -2
  138. package/dist/es/zh.js +2 -2
  139. package/dist/types/aiChatEntry.d.ts +69 -9
  140. package/package.json +27 -14
  141. package/dist/cjs/jstz.min.js +0 -43
  142. package/dist/cjs/markdown_attrs.js +0 -805
  143. package/dist/es/jstz.min.js +0 -41
  144. package/dist/es/markdown_attrs.js +0 -803
@@ -13,38 +13,46 @@ is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND
13
13
  or implied. See the License for the specific language governing permissions and limitations under
14
14
  the License.
15
15
 
16
- @carbon/ai-chat 0.1.6
16
+ @carbon/ai-chat 0.1.7-alpha0
17
17
 
18
- Built: Feb 3 2025 9:58 am -05:00
18
+ Built: Feb 12 2025 9:14 am -05:00
19
19
 
20
20
 
21
21
 
22
22
  */
23
23
  'use strict';
24
24
 
25
- var cdsAichatInternal = require('./cds-aichat-internal.js');
25
+ var AppContainer = require('./AppContainer.js');
26
26
  var ServiceDeskImpl = require('./ServiceDeskImpl.js');
27
- require('lit');
28
- require('lit/decorators.js');
29
27
  require('react');
30
- require('react-dom');
31
28
  require('./highlight_js.js');
32
29
  require('@carbon/react');
30
+ require('classnames');
33
31
  require('react-intl');
34
32
  require('react-redux');
33
+ require('tabbable');
34
+ require('@carbon/icons-react');
35
35
  require('./markdown.js');
36
- require('./markdown_attrs.js');
36
+ require('tslib');
37
+ require('lit');
38
+ require('lit/decorators.js');
37
39
  require('@carbon/web-components/es/components/button/index.js');
38
40
  require('@carbon/web-components/es/components/overflow-menu/index.js');
39
41
  require('lit/directives/unsafe-html.js');
42
+ require('prop-types');
40
43
  require('@carbon/web-components/es/components/slug/index.js');
41
44
  require('@carbon/web-components/es/components/popover/defs.js');
42
45
  require('@carbon/web-components/es/components/slug/defs.js');
46
+ require('@floating-ui/react');
47
+ require('react-dom');
43
48
  require('@carbon/web-components/es/components/slug/slug-action-button.js');
44
49
  require('@carbon/web-components/es/components/slug/slug.js');
50
+ require('@carbon/web-components/es/components/inline-loading/index.js');
51
+ require('@carbon/icon-helpers');
52
+ require('@carbon/icons');
53
+ require('lit/directives/unsafe-svg.js');
45
54
  require('@carbon/web-components/es/components/textarea/index.js');
46
55
  require('@carbon/web-components/es/components/icon-button/index.js');
47
- require('lit/directives/unsafe-svg.js');
48
56
  require('@carbon/web-components/es/components/tag/index.js');
49
57
  require('@carbon/web-components/es/components/chat-button/index.js');
50
58
  require('@carbon/web-components/es/components/button/button.js');
@@ -120,19 +128,19 @@ const TAG_WA_SESSION_PREFIX = 'x-watson-assistant-session_';
120
128
  // compatible with ZenDesk Support, which removes special characters more aggressively than ZenDesk Chat.
121
129
  const TAG_WA_SESSION_PREFIX_SUPPORT = 'x-watson-assistant-session-support_';
122
130
  // Error denoting Zendesk account is not online or has no online agents.
123
- const ERROR_ACCOUNT_NOT_ONLINE = `${cdsAichatInternal.WA_CONSOLE_PREFIX} Zendesk account is not online`;
131
+ const ERROR_ACCOUNT_NOT_ONLINE = `${AppContainer.WA_CONSOLE_PREFIX} Zendesk account is not online`;
124
132
  // Error denoting a connection attempt was made but with no initial message.
125
- const ERROR_NO_AGENT_MESSAGE = `${cdsAichatInternal.WA_CONSOLE_PREFIX} A message to the agent is required to initiate a connection to the service desk.`;
133
+ const ERROR_NO_AGENT_MESSAGE = `${AppContainer.WA_CONSOLE_PREFIX} A message to the agent is required to initiate a connection to the service desk.`;
126
134
  // Error denoting the Zendesk account connection is not initialized and is not ready to be called.
127
- const ERROR_NOT_INITIALIZED = `${cdsAichatInternal.WA_CONSOLE_PREFIX} Zendesk Web SDK is not initialized.`;
135
+ const ERROR_NOT_INITIALIZED = `${AppContainer.WA_CONSOLE_PREFIX} Zendesk Web SDK is not initialized.`;
128
136
  // Error denoting that we do not support a structured message without an initialed message string.
129
- const ERROR_STRUCTURED_MSG_NOT_SUPPORTED = `${cdsAichatInternal.WA_CONSOLE_PREFIX} Received a structured message without a string message from agent and this is not supported.`;
137
+ const ERROR_STRUCTURED_MSG_NOT_SUPPORTED = `${AppContainer.WA_CONSOLE_PREFIX} Received a structured message without a string message from agent and this is not supported.`;
130
138
  // Warning denoting we received a structured_msg event type that we don't currently support.
131
- const WARNING_EVENT_TYPE_NOT_SUPPORTED = (type) => `${cdsAichatInternal.WA_CONSOLE_PREFIX} Event type ${type} not currently supported.`;
139
+ const WARNING_EVENT_TYPE_NOT_SUPPORTED = (type) => `${AppContainer.WA_CONSOLE_PREFIX} Event type ${type} not currently supported.`;
132
140
  // Warning denoting we received an options array event type that we don't currently support.
133
- const WARNING_MESSAGE_OPTIONS_NOT_SENT = `${cdsAichatInternal.WA_CONSOLE_PREFIX} Received options attached to the message and the options will not be displayed to the user.`;
141
+ const WARNING_MESSAGE_OPTIONS_NOT_SENT = `${AppContainer.WA_CONSOLE_PREFIX} Received options attached to the message and the options will not be displayed to the user.`;
134
142
  // Warning denoting that we received a structured message with a string, and that we will strip out the structured msg.
135
- const WARNING_STRUCTURED_MSG_NOT_SUPPORTED = `${cdsAichatInternal.WA_CONSOLE_PREFIX} Received a structured message from agent and this is not supported. Only the string message will be sent.`;
143
+ const WARNING_STRUCTURED_MSG_NOT_SUPPORTED = `${AppContainer.WA_CONSOLE_PREFIX} Received a structured message from agent and this is not supported. Only the string message will be sent.`;
136
144
 
137
145
  /**
138
146
  *
@@ -223,7 +231,7 @@ class ZendeskServiceDesk extends ServiceDeskImpl.ServiceDeskImpl {
223
231
  this.sdk.on('error', (error) => {
224
232
  const { context } = error;
225
233
  if (context === 'init') {
226
- this.callback.setErrorStatus({ type: cdsAichatInternal.ErrorType.CONNECTING, logInfo: error.message });
234
+ this.callback.setErrorStatus({ type: AppContainer.ErrorType.CONNECTING, logInfo: error.message });
227
235
  }
228
236
  });
229
237
  // Documentation on connection_update events: https://api.zopim.com/web-sdk/#zchat-getaccountstatus.
@@ -231,7 +239,7 @@ class ZendeskServiceDesk extends ServiceDeskImpl.ServiceDeskImpl {
231
239
  switch (status) {
232
240
  case CONNECTION_STATUS.CONNECTED: {
233
241
  this.isConnected = true;
234
- this.callback.setErrorStatus({ type: cdsAichatInternal.ErrorType.DISCONNECTED, isDisconnected: false });
242
+ this.callback.setErrorStatus({ type: AppContainer.ErrorType.DISCONNECTED, isDisconnected: false });
235
243
  // Resolve the initial promise that may be waiting on the connection to happen. This may occur
236
244
  // multiple times during the chat but it's okay to do this more than once.
237
245
  resolve(undefined);
@@ -244,7 +252,7 @@ class ZendeskServiceDesk extends ServiceDeskImpl.ServiceDeskImpl {
244
252
  const wasConnected = this.isConnected;
245
253
  this.isConnected = false;
246
254
  if (wasConnected) {
247
- this.callback.setErrorStatus({ type: cdsAichatInternal.ErrorType.DISCONNECTED, isDisconnected: true });
255
+ this.callback.setErrorStatus({ type: AppContainer.ErrorType.DISCONNECTED, isDisconnected: true });
248
256
  }
249
257
  break;
250
258
  }
@@ -259,7 +267,7 @@ class ZendeskServiceDesk extends ServiceDeskImpl.ServiceDeskImpl {
259
267
  }
260
268
  async startChat(connectMessage, startChatOptions) {
261
269
  // The connect info is contained on the first "connect_to_agent" response we got from dialog.
262
- const connectInfo = connectMessage.output.generic.find(cdsAichatInternal.isConnectToAgent);
270
+ const connectInfo = connectMessage.output.generic.find(AppContainer.isConnectToAgent);
263
271
  this.authJWT = connectInfo.transfer_info?.additional_data?.jwt;
264
272
  await this.ensureZendeskModuleLoadedAndConnected();
265
273
  if (this.isChatStarted) {
@@ -328,7 +336,7 @@ class ZendeskServiceDesk extends ServiceDeskImpl.ServiceDeskImpl {
328
336
  await this.doWithRetry(0, addSessionTagExecutor);
329
337
  // Add any tags that are specified in the dialog pre-chat context variables.
330
338
  const preChat = connectMessage.context?.integrations?.zendesk?.pre_chat;
331
- if (typeof preChat === 'object' && !cdsAichatInternal.isEmptyObject(preChat)) {
339
+ if (typeof preChat === 'object' && !AppContainer.isEmptyObject(preChat)) {
332
340
  const preChatTags = Object.entries(preChat).map(([key, value]) => `${key}_${value}`);
333
341
  const addContextTagsExecutor = () => new Promise(resolve => {
334
342
  this.sdk.addTags(preChatTags, (error) => resolve(this.handleError(error)));
@@ -339,7 +347,7 @@ class ZendeskServiceDesk extends ServiceDeskImpl.ServiceDeskImpl {
339
347
  // exist, the connection should fail because an initial message is required to establish the websocket connection.
340
348
  if (connectInfo.transfer_info && Array.isArray(connectInfo.transfer_info.summary_message_to_agent)) {
341
349
  connectInfo.transfer_info.summary_message_to_agent.forEach(agentMessage => {
342
- if (agentMessage.response_type === cdsAichatInternal.MessageResponseTypes.TEXT) {
350
+ if (agentMessage.response_type === AppContainer.MessageResponseTypes.TEXT) {
343
351
  this.sdk.sendChatMsg(agentMessage.text, (error) => {
344
352
  if (error) {
345
353
  throw Error(error);
@@ -379,7 +387,7 @@ class ZendeskServiceDesk extends ServiceDeskImpl.ServiceDeskImpl {
379
387
  clear_dept_id_on_chat_ended: true,
380
388
  }, (error) => {
381
389
  if (error) {
382
- cdsAichatInternal.consoleError('[ZendeskServiceDesk]', error);
390
+ AppContainer.consoleError('[ZendeskServiceDesk]', error);
383
391
  resolve(false);
384
392
  }
385
393
  else {
@@ -399,7 +407,7 @@ class ZendeskServiceDesk extends ServiceDeskImpl.ServiceDeskImpl {
399
407
  const executor = () => new Promise(resolve => {
400
408
  this.sdk.sendChatMsg(text, (error) => {
401
409
  if (error) {
402
- cdsAichatInternal.consoleError('[ZendeskServiceDesk] Error sending message', error);
410
+ AppContainer.consoleError('[ZendeskServiceDesk] Error sending message', error);
403
411
  resolve(false);
404
412
  }
405
413
  else {
@@ -425,7 +433,7 @@ class ZendeskServiceDesk extends ServiceDeskImpl.ServiceDeskImpl {
425
433
  this.sdk.sendTyping(isTyping);
426
434
  }
427
435
  async areAnyAgentsOnline(connectMessage) {
428
- const connectInfo = connectMessage.output.generic.find(cdsAichatInternal.isConnectToAgent);
436
+ const connectInfo = connectMessage.output.generic.find(AppContainer.isConnectToAgent);
429
437
  this.authJWT = connectInfo?.transfer_info?.additional_data?.jwt;
430
438
  await this.ensureZendeskModuleLoadedAndConnected();
431
439
  return this.isAccountOnline();
@@ -500,7 +508,7 @@ class ZendeskServiceDesk extends ServiceDeskImpl.ServiceDeskImpl {
500
508
  await this.doWithRetry(0, executor);
501
509
  }
502
510
  const agentId = this.currentAgent ? this.currentAgent.id : null;
503
- const messageResponse = cdsAichatInternal.createMessageResponseForText(msg);
511
+ const messageResponse = AppContainer.createMessageResponseForText(msg);
504
512
  // As soon as the agent sends a message, make sure to clear the "isTyping" event for the agent.
505
513
  this.callback.agentTyping(false);
506
514
  this.callback.sendMessageToUser(messageResponse, agentId);
@@ -647,9 +655,9 @@ class ZendeskServiceDesk extends ServiceDeskImpl.ServiceDeskImpl {
647
655
  }
648
656
  }
649
657
  catch (error) {
650
- cdsAichatInternal.consoleError('Error in ZendeskServiceDesk.doWithRetry', error);
658
+ AppContainer.consoleError('Error in ZendeskServiceDesk.doWithRetry', error);
651
659
  }
652
- await cdsAichatInternal.sleep(RETRY_INTERVAL);
660
+ await AppContainer.sleep(RETRY_INTERVAL);
653
661
  return this.doWithRetry(numRetriesAttempted + 1, executor);
654
662
  }
655
663
  /**
@@ -660,7 +668,7 @@ class ZendeskServiceDesk extends ServiceDeskImpl.ServiceDeskImpl {
660
668
  */
661
669
  handleError(error) {
662
670
  if (error) {
663
- cdsAichatInternal.consoleError('[ZendeskServiceDesk]', error);
671
+ AppContainer.consoleError('[ZendeskServiceDesk]', error);
664
672
  return false;
665
673
  }
666
674
  return true;
@@ -13,9 +13,9 @@ is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND
13
13
  or implied. See the License for the specific language governing permissions and limitations under
14
14
  the License.
15
15
 
16
- @carbon/ai-chat 0.1.6
16
+ @carbon/ai-chat 0.1.7-alpha0
17
17
 
18
- Built: Feb 3 2025 9:58 am -05:00
18
+ Built: Feb 12 2025 9:14 am -05:00
19
19
 
20
20
 
21
21
 
@@ -13,16 +13,16 @@ is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND
13
13
  or implied. See the License for the specific language governing permissions and limitations under
14
14
  the License.
15
15
 
16
- @carbon/ai-chat 0.1.6
16
+ @carbon/ai-chat 0.1.7-alpha0
17
17
 
18
- Built: Feb 3 2025 9:58 am -05:00
18
+ Built: Feb 12 2025 9:14 am -05:00
19
19
 
20
20
 
21
21
 
22
22
  */
23
23
  'use strict';
24
24
 
25
- var cdsAichatInternal = require('./cds-aichat-internal.js');
25
+ var AppContainer = require('./AppContainer.js');
26
26
 
27
27
  /**
28
28
  *
@@ -48,11 +48,11 @@ var cdsAichatInternal = require('./cds-aichat-internal.js');
48
48
  * instance.
49
49
  * @param id If you have already generated an id, it's ok to pass it in. If not, one will be generated.
50
50
  */
51
- function inputItemToLocalItem(message, originalUserText, id = cdsAichatInternal.uuid(cdsAichatInternal.UUIDType.LOCAL_MESSAGE)) {
51
+ function inputItemToLocalItem(message, originalUserText, id = AppContainer.uuid(AppContainer.UUIDType.LOCAL_MESSAGE)) {
52
52
  const localMessage = {
53
53
  // The individual message in the format of an item from output.generic in the docs above.
54
54
  item: {
55
- response_type: cdsAichatInternal.MessageResponseTypes.TEXT,
55
+ response_type: AppContainer.MessageResponseTypes.TEXT,
56
56
  ...message.input,
57
57
  },
58
58
  // ui_state is for rendering concerns and is not persistent.