@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');
@@ -123,7 +131,7 @@ class SFServiceDesk extends ServiceDeskImpl.ServiceDeskImpl {
123
131
  const { subscription } = serviceDeskConfig;
124
132
  if (!subscription?.data) {
125
133
  this.callback.setErrorStatus({
126
- type: cdsAichatInternal.ErrorType.CONNECTING,
134
+ type: AppContainer.ErrorType.CONNECTING,
127
135
  logInfo: 'The integration needs to be subscribed first to the service desk',
128
136
  });
129
137
  return;
@@ -133,14 +141,14 @@ class SFServiceDesk extends ServiceDeskImpl.ServiceDeskImpl {
133
141
  !subscription.data[DOMAIN] ||
134
142
  !subscription.data[ORGANIZATION_ID]) {
135
143
  this.callback.setErrorStatus({
136
- type: cdsAichatInternal.ErrorType.CONNECTING,
144
+ type: AppContainer.ErrorType.CONNECTING,
137
145
  logInfo: 'Mandatory service desk subscription values missing',
138
146
  });
139
147
  return;
140
148
  }
141
149
  if (!regionHostname) {
142
150
  this.callback.setErrorStatus({
143
- type: cdsAichatInternal.ErrorType.CONNECTING,
151
+ type: AppContainer.ErrorType.CONNECTING,
144
152
  logInfo: 'Unable to determine URL to call Salesforce',
145
153
  });
146
154
  return;
@@ -278,7 +286,7 @@ class SFServiceDesk extends ServiceDeskImpl.ServiceDeskImpl {
278
286
  * Helper function that initializes all the variables needed to start a chat
279
287
  */
280
288
  async startChat(connectMessage, startChatOptions) {
281
- cdsAichatInternal.debugLog(`${PREFIX} Called startChat`, connectMessage, startChatOptions);
289
+ AppContainer.debugLog(`${PREFIX} Called startChat`, connectMessage, startChatOptions);
282
290
  // The following values are initialized/reset every time user starts a new chat.
283
291
  this.connectMessage = connectMessage;
284
292
  this.startChatOptions = startChatOptions;
@@ -287,7 +295,7 @@ class SFServiceDesk extends ServiceDeskImpl.ServiceDeskImpl {
287
295
  this.callback.updateCapabilities({ allowFileUploads: false });
288
296
  // Rebuild the routing info queues so we can start over and check the whole list again in case the agent
289
297
  // availability has changed.
290
- const connectItem = connectMessage.output.generic.find(cdsAichatInternal.isConnectToAgent);
298
+ const connectItem = connectMessage.output.generic.find(AppContainer.isConnectToAgent);
291
299
  this.buildRoutingInfos(connectItem);
292
300
  await this.startChatInternal();
293
301
  }
@@ -298,12 +306,12 @@ class SFServiceDesk extends ServiceDeskImpl.ServiceDeskImpl {
298
306
  const { subscription } = this.config;
299
307
  const additionalRoutingInfo = connectItem?.transfer_info?.target?.salesforce
300
308
  ?.additional_routing_info;
301
- cdsAichatInternal.debugLog(`${PREFIX} Building routing infos`, connectItem, subscription);
309
+ AppContainer.debugLog(`${PREFIX} Building routing infos`, connectItem, subscription);
302
310
  let allRoutingInfo;
303
311
  if (additionalRoutingInfo) {
304
312
  // The connect item has specified all the routing info we need. This will override the default web chat
305
313
  // configuration settings.
306
- allRoutingInfo = cdsAichatInternal.cloneDeep(additionalRoutingInfo);
314
+ allRoutingInfo = AppContainer.cloneDeep(additionalRoutingInfo);
307
315
  allRoutingInfo.forEach(routingInfo => {
308
316
  // Fill in some default values if the routing info is not complete.
309
317
  routingInfo.org_id = routingInfo.org_id || subscription.data.organizationId;
@@ -312,7 +320,7 @@ class SFServiceDesk extends ServiceDeskImpl.ServiceDeskImpl {
312
320
  // Backwards compatibility for the deprecated property.
313
321
  if (routingInfo.button_ids) {
314
322
  routingInfo.button_overrides = routingInfo.button_ids;
315
- cdsAichatInternal.consoleWarn(`${PREFIX} The additionalRoutingInfo.button_ids property is deprecated. Use button_overrides instead.`);
323
+ AppContainer.consoleWarn(`${PREFIX} The additionalRoutingInfo.button_ids property is deprecated. Use button_overrides instead.`);
316
324
  }
317
325
  // The button ID can either be provided in the routing info, it can be overridden by the connect to agent item
318
326
  // (a field available in the tooling UI), or it can come from the web chat live agent settings.
@@ -334,8 +342,8 @@ class SFServiceDesk extends ServiceDeskImpl.ServiceDeskImpl {
334
342
  ];
335
343
  }
336
344
  this.routingInfoQueue = allRoutingInfo;
337
- if (cdsAichatInternal.isEnableDebugLog()) {
338
- cdsAichatInternal.debugLog(`${PREFIX} Built routing infos`, cdsAichatInternal.cloneDeep(allRoutingInfo));
345
+ if (AppContainer.isEnableDebugLog()) {
346
+ AppContainer.debugLog(`${PREFIX} Built routing infos`, AppContainer.cloneDeep(allRoutingInfo));
339
347
  }
340
348
  }
341
349
  /**
@@ -344,7 +352,7 @@ class SFServiceDesk extends ServiceDeskImpl.ServiceDeskImpl {
344
352
  * Salesforce to browser direction.
345
353
  */
346
354
  async startChatInternal() {
347
- cdsAichatInternal.debugLog(`${PREFIX} Starting chat`, this.startChatOptions);
355
+ AppContainer.debugLog(`${PREFIX} Starting chat`, this.startChatOptions);
348
356
  // Check the routing queue to determine which currently has any agents available. This also has the effect of
349
357
  // rechecking the info at the top of the queue to determine if agents that were previously available have since
350
358
  // become unavailable.
@@ -353,7 +361,7 @@ class SFServiceDesk extends ServiceDeskImpl.ServiceDeskImpl {
353
361
  const routingInfo = this.routingInfoQueue[0];
354
362
  if (!routingInfo) {
355
363
  this.callback.setErrorStatus({
356
- type: cdsAichatInternal.ErrorType.CONNECTING,
364
+ type: AppContainer.ErrorType.CONNECTING,
357
365
  messageToUser: this.getIntlText('errors_noAgentsAvailable'),
358
366
  });
359
367
  return;
@@ -362,7 +370,7 @@ class SFServiceDesk extends ServiceDeskImpl.ServiceDeskImpl {
362
370
  this.updatePersistedState({ toAgentSequence: 0 });
363
371
  // The reconnecting state starts as false.
364
372
  this.isReconnecting = false;
365
- this.connectItem = this.connectMessage.output.generic.find(cdsAichatInternal.isConnectToAgent);
373
+ this.connectItem = this.connectMessage.output.generic.find(AppContainer.isConnectToAgent);
366
374
  // Extracts the browser information from context.integrations.chat.browser_info object.
367
375
  const browserInfo = this.connectMessage.context?.integrations?.chat?.browser_info;
368
376
  // Pre-chat data can be set inside the dialog. This data is later sent to salesforce. It can also be provided in
@@ -370,13 +378,13 @@ class SFServiceDesk extends ServiceDeskImpl.ServiceDeskImpl {
370
378
  const preChatEvent = this.startChatOptions.preStartChatPayload?.preChat;
371
379
  const preChatContext = this.connectMessage.context?.integrations?.salesforce?.pre_chat;
372
380
  // The Record<string, string> piece is for undocumented legacy code.
373
- const preChat = cdsAichatInternal.mergeNoArrays({}, preChatContext, preChatEvent);
381
+ const preChat = AppContainer.mergeNoArrays({}, preChatContext, preChatEvent);
374
382
  if (!this.connectItem?.transfer_info?.additional_data?.jwt) {
375
383
  // This isn't actually used anymore but if the back-end removes it, existing web chats will break because of
376
384
  // this check. If we remove this check from new web chats, it'll make it easier to forget about the old ones
377
385
  // so we'll just leave this here for now.
378
386
  this.callback.setErrorStatus({
379
- type: cdsAichatInternal.ErrorType.CONNECTING,
387
+ type: AppContainer.ErrorType.CONNECTING,
380
388
  logInfo: 'Unable to connect due to missing security tokens',
381
389
  });
382
390
  return;
@@ -394,12 +402,12 @@ class SFServiceDesk extends ServiceDeskImpl.ServiceDeskImpl {
394
402
  sessionIdResponse = await this.sendToSalesforce('GET', sessionUrl, null, headers);
395
403
  }
396
404
  catch (error) {
397
- this.callback.setErrorStatus({ type: cdsAichatInternal.ErrorType.CONNECTING, logInfo: error });
405
+ this.callback.setErrorStatus({ type: AppContainer.ErrorType.CONNECTING, logInfo: error });
398
406
  return;
399
407
  }
400
408
  if (!sessionIdResponse || !sessionIdResponse.ok) {
401
409
  this.callback.setErrorStatus({
402
- type: cdsAichatInternal.ErrorType.CONNECTING,
410
+ type: AppContainer.ErrorType.CONNECTING,
403
411
  logInfo: `Unable to start a live agent session: ${sessionIdResponse.status}`,
404
412
  });
405
413
  return;
@@ -407,10 +415,10 @@ class SFServiceDesk extends ServiceDeskImpl.ServiceDeskImpl {
407
415
  try {
408
416
  const sessionData = await sessionIdResponse.json();
409
417
  this.updatePersistedState({ sessionData });
410
- cdsAichatInternal.debugLog(`${PREFIX} Starting with chat session data`, sessionData);
418
+ AppContainer.debugLog(`${PREFIX} Starting with chat session data`, sessionData);
411
419
  }
412
420
  catch (error) {
413
- this.callback.setErrorStatus({ type: cdsAichatInternal.ErrorType.CONNECTING, logInfo: error });
421
+ this.callback.setErrorStatus({ type: AppContainer.ErrorType.CONNECTING, logInfo: error });
414
422
  return;
415
423
  }
416
424
  // Programmatically mimic an end user requesting an agent.
@@ -444,11 +452,11 @@ class SFServiceDesk extends ServiceDeskImpl.ServiceDeskImpl {
444
452
  chasitorResponse = await this.sendToSalesforce('POST', buttonPressUrl, body, null);
445
453
  }
446
454
  catch (error) {
447
- this.callback.setErrorStatus({ type: cdsAichatInternal.ErrorType.CONNECTING, logInfo: error });
455
+ this.callback.setErrorStatus({ type: AppContainer.ErrorType.CONNECTING, logInfo: error });
448
456
  }
449
457
  if (!chasitorResponse || !chasitorResponse.ok) {
450
458
  this.callback.setErrorStatus({
451
- type: cdsAichatInternal.ErrorType.CONNECTING,
459
+ type: AppContainer.ErrorType.CONNECTING,
452
460
  logInfo: `Unable to contact an agent: ${chasitorResponse.status}`,
453
461
  });
454
462
  return;
@@ -467,13 +475,13 @@ class SFServiceDesk extends ServiceDeskImpl.ServiceDeskImpl {
467
475
  this.callback.agentJoined(newAgent);
468
476
  this.hasAgentJoined = true;
469
477
  // Send the initial summary messages to the agent.
470
- const messages = cdsAichatInternal.getSummaryMessages(this.connectItem, 'Begin conversation');
471
- await cdsAichatInternal.asyncForEach(messages, async (text) => {
478
+ const messages = AppContainer.getSummaryMessages(this.connectItem, 'Begin conversation');
479
+ await AppContainer.asyncForEach(messages, async (text) => {
472
480
  // If calls to ChatMessage API are made too quickly, Salesforce tends to not process some calls on their end
473
481
  // (even though they return a 200 for those calls). Introducing a small delay ensures that calls to ChatMessage
474
482
  // API are processed correctly.
475
- await cdsAichatInternal.sleep(DELAY_BETWEEN_SF_API_CALLS);
476
- await this.sendMessageToAgent(cdsAichatInternal.createMessageRequestForText(text), '', {});
483
+ await AppContainer.sleep(DELAY_BETWEEN_SF_API_CALLS);
484
+ await this.sendMessageToAgent(AppContainer.createMessageRequestForText(text), '', {});
477
485
  });
478
486
  }
479
487
  async endChat() {
@@ -493,11 +501,11 @@ class SFServiceDesk extends ServiceDeskImpl.ServiceDeskImpl {
493
501
  try {
494
502
  const response = await this.sendToSalesforce('POST', endChatUrl, body, null);
495
503
  if (!response || !response.ok) {
496
- cdsAichatInternal.consoleError('Failed to end chat', response);
504
+ AppContainer.consoleError('Failed to end chat', response);
497
505
  }
498
506
  }
499
507
  catch (error) {
500
- cdsAichatInternal.consoleError('Unable to close chat with Salesforce agent.', error);
508
+ AppContainer.consoleError('Unable to close chat with Salesforce agent.', error);
501
509
  }
502
510
  }
503
511
  }
@@ -538,7 +546,7 @@ class SFServiceDesk extends ServiceDeskImpl.ServiceDeskImpl {
538
546
  method: 'POST',
539
547
  body: formData,
540
548
  });
541
- cdsAichatInternal.debugLog(`${PREFIX} Got response in doFileUpload`, await cdsAichatInternal.safeFetchText(response));
549
+ AppContainer.debugLog(`${PREFIX} Got response in doFileUpload`, await AppContainer.safeFetchText(response));
542
550
  this.callback.setFileUploadStatus(fileUpload.id, !response.ok);
543
551
  }
544
552
  this.callback.updateCapabilities({ allowFileUploads: false });
@@ -563,10 +571,10 @@ class SFServiceDesk extends ServiceDeskImpl.ServiceDeskImpl {
563
571
  response = await this.sendToSalesforce('POST', url, '{}');
564
572
  }
565
573
  catch (error) {
566
- cdsAichatInternal.consoleError(`Failed calling ${url}`, error);
574
+ AppContainer.consoleError(`Failed calling ${url}`, error);
567
575
  }
568
576
  if (!response?.ok) {
569
- cdsAichatInternal.consoleError(`Failed calling ${url}, response code: ${response.status}`);
577
+ AppContainer.consoleError(`Failed calling ${url}, response code: ${response.status}`);
570
578
  }
571
579
  }
572
580
  }
@@ -583,8 +591,8 @@ class SFServiceDesk extends ServiceDeskImpl.ServiceDeskImpl {
583
591
  * If no agents are available, "routingInfoQueue" will be left an empty array.
584
592
  */
585
593
  async areAnyAgentsOnline(connectMessage) {
586
- cdsAichatInternal.debugLog(`${PREFIX} Called areAnyAgentsOnline`, connectMessage);
587
- const connectItem = connectMessage.output.generic.find(cdsAichatInternal.isConnectToAgent);
594
+ AppContainer.debugLog(`${PREFIX} Called areAnyAgentsOnline`, connectMessage);
595
+ const connectItem = connectMessage.output.generic.find(AppContainer.isConnectToAgent);
588
596
  this.buildRoutingInfos(connectItem);
589
597
  await this.checkRoutingInfoQueue();
590
598
  return this.routingInfoQueue.length !== 0;
@@ -634,7 +642,7 @@ class SFServiceDesk extends ServiceDeskImpl.ServiceDeskImpl {
634
642
  button_overrides.forEach(id => {
635
643
  // Pull out the IDs to check. This may either be an agent ID or a button ID but it may also be a
636
644
  // "agentID_buttonID" in which case we need both.
637
- cdsAichatInternal.pushAll(idsToCheck, id.split('_'));
645
+ AppContainer.pushAll(idsToCheck, id.split('_'));
638
646
  });
639
647
  }
640
648
  else if (button_id) {
@@ -656,7 +664,7 @@ class SFServiceDesk extends ServiceDeskImpl.ServiceDeskImpl {
656
664
  }
657
665
  catch (error) {
658
666
  // In case of an error, we want to return false so that agent unavailability message is rendered.
659
- cdsAichatInternal.consoleError('Error in callAgentAvailabilityAPI', error);
667
+ AppContainer.consoleError('Error in callAgentAvailabilityAPI', error);
660
668
  return false;
661
669
  }
662
670
  }
@@ -679,10 +687,10 @@ class SFServiceDesk extends ServiceDeskImpl.ServiceDeskImpl {
679
687
  credentials: 'include',
680
688
  headers: this.getHeaders(false),
681
689
  });
682
- cdsAichatInternal.debugLog(`${PREFIX} Got response in getMessagesFromAgent`, await cdsAichatInternal.safeFetchText(response));
690
+ AppContainer.debugLog(`${PREFIX} Got response in getMessagesFromAgent`, await AppContainer.safeFetchText(response));
683
691
  if (response.status === 200) {
684
692
  const parsedResponse = await response.json();
685
- cdsAichatInternal.debugLog(`${PREFIX} Parsed response`, parsedResponse);
693
+ AppContainer.debugLog(`${PREFIX} Parsed response`, parsedResponse);
686
694
  // Update sequence to use in future calls.
687
695
  this.updatePersistedState({ fromAgentSequence: parsedResponse.sequence });
688
696
  // If offset is provided, it is only provided for messages that have data, not most connection messages, store it
@@ -729,7 +737,7 @@ class SFServiceDesk extends ServiceDeskImpl.ServiceDeskImpl {
729
737
  // This will send messages to the agent to start the chat. We don't want to wait for that process to finish
730
738
  // so no await here.
731
739
  this.handleChatEstablished(element.message).catch(error => {
732
- cdsAichatInternal.consoleError('Error establishing chat', error);
740
+ AppContainer.consoleError('Error establishing chat', error);
733
741
  });
734
742
  break;
735
743
  }
@@ -753,7 +761,7 @@ class SFServiceDesk extends ServiceDeskImpl.ServiceDeskImpl {
753
761
  // handle this, we remove the current routing info from the queue and start the process over using
754
762
  // whatever routing infos may still be in the queue (if any).
755
763
  this.routingInfoQueue.splice(0, 1);
756
- this.startChatInternal().catch(error => cdsAichatInternal.consoleError('Error restarting chat', error));
764
+ this.startChatInternal().catch(error => AppContainer.consoleError('Error restarting chat', error));
757
765
  }
758
766
  else {
759
767
  // If the user is chatting with an agent, however the agent suddenly goes offline,
@@ -814,8 +822,8 @@ class SFServiceDesk extends ServiceDeskImpl.ServiceDeskImpl {
814
822
  this.callback.updateCapabilities({ allowFileUploads: true });
815
823
  this.updatePersistedState({ fileUploadRequest: element.message });
816
824
  const messageText = this.getIntlText('fileSharing_request');
817
- const message = cdsAichatInternal.createMessageResponseForText(messageText);
818
- message.output.generic[0].agent_message_type = cdsAichatInternal.AgentMessageType.SYSTEM;
825
+ const message = AppContainer.createMessageResponseForText(messageText);
826
+ message.output.generic[0].agent_message_type = AppContainer.AgentMessageType.SYSTEM;
819
827
  await this.callback.sendMessageToUser(message);
820
828
  }
821
829
  else if (request.type === 'Canceled') {
@@ -825,13 +833,13 @@ class SFServiceDesk extends ServiceDeskImpl.ServiceDeskImpl {
825
833
  break;
826
834
  }
827
835
  default: {
828
- cdsAichatInternal.consoleError(`unhandled Salesforce message: ${element.type}`);
836
+ AppContainer.consoleError(`unhandled Salesforce message: ${element.type}`);
829
837
  break;
830
838
  }
831
839
  }
832
840
  }
833
841
  }
834
- else if (response.status === cdsAichatInternal.StatusCodes.SERVICE_UNAVAILABLE) {
842
+ else if (response.status === AppContainer.StatusCodes.SERVICE_UNAVAILABLE) {
835
843
  await this.issueReconnect();
836
844
  }
837
845
  else if (!response.ok) {
@@ -857,7 +865,7 @@ class SFServiceDesk extends ServiceDeskImpl.ServiceDeskImpl {
857
865
  credentials: 'include',
858
866
  headers: this.getHeaders(false),
859
867
  });
860
- cdsAichatInternal.debugLog(`${PREFIX} Got response in issueReconnect`, await cdsAichatInternal.safeFetchText(response));
868
+ AppContainer.debugLog(`${PREFIX} Got response in issueReconnect`, await AppContainer.safeFetchText(response));
861
869
  // Check that the call is okay. After this call the next call to /Messages should return a ChasitorSessionData
862
870
  // response type and we'll continue trying to reconnect there.
863
871
  if (!response || !response.ok) {
@@ -895,8 +903,8 @@ class SFServiceDesk extends ServiceDeskImpl.ServiceDeskImpl {
895
903
  body,
896
904
  headers: headers || this.getHeaders(true),
897
905
  });
898
- cdsAichatInternal.debugLog(`${PREFIX} Got response in sendToSalesforce`, await cdsAichatInternal.safeFetchText(response));
899
- if (response.status === cdsAichatInternal.StatusCodes.CONFLICT) {
906
+ AppContainer.debugLog(`${PREFIX} Got response in sendToSalesforce`, await AppContainer.safeFetchText(response));
907
+ if (response.status === AppContainer.StatusCodes.CONFLICT) {
900
908
  // There is an error in the sequence number. Salesforce will respond with something like:
901
909
  // "Out of sync Ack. Expected 498. Actual 4"
902
910
  // This is unfortunate as the expected is wrong, it is just an echo of the sequence number we sent. The actual is
@@ -921,7 +929,7 @@ class SFServiceDesk extends ServiceDeskImpl.ServiceDeskImpl {
921
929
  }
922
930
  else {
923
931
  /* eslint-disable-next-line no-await-in-loop */
924
- await cdsAichatInternal.sleep(RETRY_DELAY);
932
+ await AppContainer.sleep(RETRY_DELAY);
925
933
  }
926
934
  }
927
935
  } while (retry !== MAX_POST_RETRIES && !response.ok);
@@ -947,7 +955,7 @@ class SFServiceDesk extends ServiceDeskImpl.ServiceDeskImpl {
947
955
  body: JSON.stringify({ organizationId: this.routingInfoQueue[0].org_id }),
948
956
  headers: this.getHeaders(false),
949
957
  });
950
- cdsAichatInternal.debugLog(`${PREFIX} Got response in resyncState`, await cdsAichatInternal.safeFetchText(response));
958
+ AppContainer.debugLog(`${PREFIX} Got response in resyncState`, await AppContainer.safeFetchText(response));
951
959
  if (!response || !response.ok) {
952
960
  throw new Error(`Failed to resync state: ${response.status}`);
953
961
  }
@@ -979,16 +987,16 @@ class SFServiceDesk extends ServiceDeskImpl.ServiceDeskImpl {
979
987
  catch (error) {
980
988
  if (++numFailures === MAX_POLLING_RETRIES) {
981
989
  if (!poller.stop) {
982
- this.callback.setErrorStatus({ type: cdsAichatInternal.ErrorType.DISCONNECTED, isDisconnected: true });
990
+ this.callback.setErrorStatus({ type: AppContainer.ErrorType.DISCONNECTED, isDisconnected: true });
983
991
  }
984
992
  else {
985
- this.callback.setErrorStatus({ type: cdsAichatInternal.ErrorType.CONNECTING });
993
+ this.callback.setErrorStatus({ type: AppContainer.ErrorType.CONNECTING });
986
994
  }
987
995
  poller.stop = true;
988
996
  }
989
997
  else {
990
998
  /* eslint-disable-next-line no-await-in-loop */
991
- await cdsAichatInternal.sleep(RETRY_DELAY);
999
+ await AppContainer.sleep(RETRY_DELAY);
992
1000
  }
993
1001
  }
994
1002
  } while (!poller.stop);
@@ -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