@carbon/ai-chat 0.1.6 → 0.1.7-test-no-cjs

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/es/{cds-aichat-internal.js → AppContainer.js} +50756 -18310
  2. package/dist/es/Carousel.js +14 -8
  3. package/dist/es/GenesysMessengerServiceDesk.js +17 -11
  4. package/dist/es/HumanAgentServiceImpl.js +17 -12
  5. package/dist/es/NiceDFOServiceDesk.js +17 -12
  6. package/dist/es/PDFViewerContainer.js +15 -108
  7. package/dist/es/ReactPlayer.js +2 -2
  8. package/dist/es/SFServiceDesk.js +18 -11
  9. package/dist/es/ServiceDeskImpl.js +2 -2
  10. package/dist/es/Table.js +429 -315
  11. package/dist/es/ZendeskServiceDesk.js +17 -11
  12. package/dist/es/_node-resolve_empty.js +2 -2
  13. package/dist/es/aiChatEntry.js +137 -120
  14. package/dist/es/ar-dz.js +3 -4
  15. package/dist/es/ar-kw.js +3 -4
  16. package/dist/es/ar-ly.js +3 -4
  17. package/dist/es/ar-ma.js +3 -4
  18. package/dist/es/ar-sa.js +3 -4
  19. package/dist/es/ar-tn.js +3 -4
  20. package/dist/es/ar.js +3 -4
  21. package/dist/es/ar2.js +2 -2
  22. package/dist/es/cds-aichat-container.js +104 -18
  23. package/dist/es/cds-aichat-custom-element.js +31 -21
  24. package/dist/es/cs.js +3 -4
  25. package/dist/es/cs2.js +2 -2
  26. package/dist/es/de-at.js +3 -4
  27. package/dist/es/de-ch.js +3 -4
  28. package/dist/es/de.js +3 -4
  29. package/dist/es/de2.js +2 -2
  30. package/dist/es/en-au.js +3 -4
  31. package/dist/es/en-ca.js +3 -4
  32. package/dist/es/en-gb.js +3 -4
  33. package/dist/es/en-ie.js +3 -4
  34. package/dist/es/en-il.js +3 -4
  35. package/dist/es/en-nz.js +3 -4
  36. package/dist/es/es-do.js +3 -4
  37. package/dist/es/es-us.js +3 -4
  38. package/dist/es/es.js +3 -4
  39. package/dist/es/es2.js +2 -2
  40. package/dist/es/export.js +3 -3
  41. package/dist/es/export.legacy.js +3 -3
  42. package/dist/es/fontUtils.js +2 -2
  43. package/dist/es/fr-ca.js +3 -4
  44. package/dist/es/fr-ch.js +3 -4
  45. package/dist/es/fr.js +3 -4
  46. package/dist/es/fr2.js +2 -2
  47. package/dist/es/it-ch.js +3 -4
  48. package/dist/es/it.js +3 -4
  49. package/dist/es/it2.js +2 -2
  50. package/dist/es/ja.js +3 -4
  51. package/dist/es/ja2.js +2 -2
  52. package/dist/es/ko.js +3 -4
  53. package/dist/es/ko2.js +2 -2
  54. package/dist/es/mockServiceDesk.js +17 -11
  55. package/dist/es/nl.js +3 -4
  56. package/dist/es/nl2.js +2 -2
  57. package/dist/es/pt-br.js +3 -4
  58. package/dist/es/pt-br2.js +2 -2
  59. package/dist/es/pt.js +3 -4
  60. package/dist/es/render.js +25 -12
  61. package/dist/es/zh-cn.js +3 -4
  62. package/dist/es/zh-tw.js +3 -4
  63. package/dist/es/zh-tw2.js +2 -2
  64. package/dist/es/zh.js +2 -2
  65. package/dist/types/aiChatEntry.d.ts +599 -11
  66. package/package.json +29 -21
  67. package/dist/cjs/Carousel.js +0 -5711
  68. package/dist/cjs/Chat.js +0 -8838
  69. package/dist/cjs/GenesysMessengerServiceDesk.js +0 -598
  70. package/dist/cjs/HumanAgentServiceImpl.js +0 -1145
  71. package/dist/cjs/NiceDFOServiceDesk.js +0 -2116
  72. package/dist/cjs/PDFViewerContainer.js +0 -83227
  73. package/dist/cjs/ReactPlayer.js +0 -57
  74. package/dist/cjs/SFServiceDesk.js +0 -1031
  75. package/dist/cjs/ServiceDeskImpl.js +0 -74
  76. package/dist/cjs/Table.js +0 -3146
  77. package/dist/cjs/ZendeskServiceDesk.js +0 -670
  78. package/dist/cjs/_node-resolve_empty.js +0 -27
  79. package/dist/cjs/agentActions.js +0 -214
  80. package/dist/cjs/aiChatEntry.js +0 -354
  81. package/dist/cjs/anonymousUserIDStorage.js +0 -254
  82. package/dist/cjs/ar-dz.js +0 -57
  83. package/dist/cjs/ar-kw.js +0 -57
  84. package/dist/cjs/ar-ly.js +0 -57
  85. package/dist/cjs/ar-ma.js +0 -57
  86. package/dist/cjs/ar-sa.js +0 -57
  87. package/dist/cjs/ar-tn.js +0 -57
  88. package/dist/cjs/ar.js +0 -57
  89. package/dist/cjs/ar2.js +0 -763
  90. package/dist/cjs/cds-aichat-container.js +0 -143
  91. package/dist/cjs/cds-aichat-custom-element.js +0 -200
  92. package/dist/cjs/cds-aichat-internal.js +0 -39150
  93. package/dist/cjs/cs.js +0 -57
  94. package/dist/cjs/cs2.js +0 -763
  95. package/dist/cjs/de-at.js +0 -57
  96. package/dist/cjs/de-ch.js +0 -57
  97. package/dist/cjs/de.js +0 -57
  98. package/dist/cjs/de2.js +0 -763
  99. package/dist/cjs/en-au.js +0 -57
  100. package/dist/cjs/en-ca.js +0 -57
  101. package/dist/cjs/en-gb.js +0 -57
  102. package/dist/cjs/en-ie.js +0 -57
  103. package/dist/cjs/en-il.js +0 -57
  104. package/dist/cjs/en-nz.js +0 -57
  105. package/dist/cjs/es-do.js +0 -57
  106. package/dist/cjs/es-us.js +0 -57
  107. package/dist/cjs/es.js +0 -57
  108. package/dist/cjs/es2.js +0 -763
  109. package/dist/cjs/export.js +0 -27
  110. package/dist/cjs/export.legacy.js +0 -27
  111. package/dist/cjs/fontUtils.js +0 -1038
  112. package/dist/cjs/fr-ca.js +0 -57
  113. package/dist/cjs/fr-ch.js +0 -57
  114. package/dist/cjs/fr.js +0 -57
  115. package/dist/cjs/fr2.js +0 -763
  116. package/dist/cjs/highlight_js.js +0 -15325
  117. package/dist/cjs/it-ch.js +0 -57
  118. package/dist/cjs/it.js +0 -57
  119. package/dist/cjs/it2.js +0 -763
  120. package/dist/cjs/ja.js +0 -57
  121. package/dist/cjs/ja2.js +0 -763
  122. package/dist/cjs/jstz.min.js +0 -43
  123. package/dist/cjs/ko.js +0 -57
  124. package/dist/cjs/ko2.js +0 -763
  125. package/dist/cjs/markdown.js +0 -8505
  126. package/dist/cjs/markdown_attrs.js +0 -805
  127. package/dist/cjs/mockServiceDesk.js +0 -887
  128. package/dist/cjs/nl.js +0 -57
  129. package/dist/cjs/nl2.js +0 -763
  130. package/dist/cjs/pt-br.js +0 -57
  131. package/dist/cjs/pt-br2.js +0 -763
  132. package/dist/cjs/pt.js +0 -57
  133. package/dist/cjs/render.js +0 -94
  134. package/dist/cjs/zh-cn.js +0 -57
  135. package/dist/cjs/zh-tw.js +0 -57
  136. package/dist/cjs/zh-tw2.js +0 -763
  137. package/dist/cjs/zh.js +0 -763
  138. package/dist/es/Chat.js +0 -8836
  139. package/dist/es/agentActions.js +0 -186
  140. package/dist/es/anonymousUserIDStorage.js +0 -249
  141. package/dist/es/highlight_js.js +0 -15320
  142. package/dist/es/jstz.min.js +0 -41
  143. package/dist/es/markdown.js +0 -8501
  144. package/dist/es/markdown_attrs.js +0 -803
@@ -1,27 +0,0 @@
1
- /*
2
-
3
-
4
- (C) Copyright IBM Corp. 2017, 2025. All Rights Reserved.
5
-
6
- Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
7
- in compliance with the License. You may obtain a copy of the License at
8
-
9
- http://www.apache.org/licenses/LICENSE-2.0
10
-
11
- Unless required by applicable law or agreed to in writing, software distributed under the License
12
- is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
13
- or implied. See the License for the specific language governing permissions and limitations under
14
- the License.
15
-
16
- @carbon/ai-chat 0.1.6
17
-
18
- Built: Feb 3 2025 9:58 am -05:00
19
-
20
-
21
-
22
- */
23
- 'use strict';
24
-
25
- var _nodeResolve_empty = {};
26
-
27
- exports.default = _nodeResolve_empty;
@@ -1,214 +0,0 @@
1
- /*
2
-
3
-
4
- (C) Copyright IBM Corp. 2017, 2025. All Rights Reserved.
5
-
6
- Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
7
- in compliance with the License. You may obtain a copy of the License at
8
-
9
- http://www.apache.org/licenses/LICENSE-2.0
10
-
11
- Unless required by applicable law or agreed to in writing, software distributed under the License
12
- is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
13
- or implied. See the License for the specific language governing permissions and limitations under
14
- the License.
15
-
16
- @carbon/ai-chat 0.1.6
17
-
18
- Built: Feb 3 2025 9:58 am -05:00
19
-
20
-
21
-
22
- */
23
- 'use strict';
24
-
25
- var cdsAichatInternal = require('./cds-aichat-internal.js');
26
-
27
- /**
28
- *
29
- * IBM Confidential
30
- *
31
- * (C) Copyright IBM Corp. 2020, 2023
32
- *
33
- * The source code for this program is not published or otherwise
34
- * divested of its trade secrets, irrespective of what has been
35
- * deposited with the U. S. Copyright Office
36
- *
37
- * US Government Users Restricted Rights - Use, duplication or
38
- * disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
39
- *
40
- */
41
- /**
42
- * Takes data from the v2 message API and transforms into something usable by WAC.
43
- *
44
- * @param message Takes an object in the shape of a v2 message API Send object. With an additional `ui_state`
45
- * object for local state.
46
- * @param originalUserText The original text provided by the user before it was potentially modified on the
47
- * underlying {@link MessageRequest}. This value may be null if there is no text from the user to display.
48
- * instance.
49
- * @param id If you have already generated an id, it's ok to pass it in. If not, one will be generated.
50
- */
51
- function inputItemToLocalItem(message, originalUserText, id = cdsAichatInternal.uuid(cdsAichatInternal.UUIDType.LOCAL_MESSAGE)) {
52
- const localMessage = {
53
- // The individual message in the format of an item from output.generic in the docs above.
54
- item: {
55
- response_type: cdsAichatInternal.MessageResponseTypes.TEXT,
56
- ...message.input,
57
- },
58
- // ui_state is for rendering concerns and is not persistent.
59
- ui_state: {
60
- id,
61
- originalUserText,
62
- needsAnnouncement: false, // We don't announce text that came from the user.
63
- },
64
- fullMessageID: message.id,
65
- };
66
- return localMessage;
67
- }
68
-
69
- /**
70
- *
71
- * IBM Confidential
72
- *
73
- * (C) Copyright IBM Corp. 2019, 2023
74
- *
75
- * The source code for this program is not published or otherwise
76
- * divested of its trade secrets, irrespective of what has been
77
- * deposited with the U. S. Copyright Office
78
- *
79
- * US Government Users Restricted Rights - Use, duplication or
80
- * disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
81
- *
82
- */
83
- /**
84
- * Redux action creators for human agent actions.
85
- */
86
- const HA_SET_AGENT_AVAILABILITY = 'HA_SET_AGENT_AVAILABILITY';
87
- const HA_SET_IS_CONNECTING = 'HA_SET_IS_CONNECTING';
88
- const HA_SET_IS_RECONNECTING = 'HA_SET_IS_RECONNECTING';
89
- const HA_SET_AGENT_JOINED = 'HA_SET_AGENT_JOINED';
90
- const HA_SET_AGENT_LEFT_CHAT = 'HA_SET_AGENT_LEFT_CHAT';
91
- const HA_END_CHAT = 'HA_END_CHAT';
92
- const HA_UPDATE_CAPABILITIES = 'HA_UPDATE_CAPABILITIES';
93
- const HA_UPDATE_FILE_UPLOAD_IN_PROGRESS = 'HA_UPDATE_FILE_UPLOAD_IN_PROGRESS';
94
- const HA_SET_SHOW_SCREEN_SHARE_REQUEST = 'HA_SET_SHOW_SCREEN_SHARE_REQUEST';
95
- const HA_SET_IS_SCREEN_SHARING = 'HA_SET_IS_SCREEN_SHARING';
96
- const HA_SET_PERSISTED_STATE = 'HA_SET_PERSISTED_STATE';
97
- const HA_UPDATE_IS_SUSPENDED = 'HA_UPDATE_IS_SUSPENDED';
98
- const HA_UPDATE_IS_TYPING = 'HA_UPDATE_IS_TYPING';
99
- /**
100
- * Sets the "is connecting" status for a human agent.
101
- */
102
- function setIsConnecting(isConnecting, localMessageID) {
103
- return {
104
- type: HA_SET_IS_CONNECTING,
105
- isConnecting,
106
- localMessageID,
107
- };
108
- }
109
- /**
110
- * Sets the "is reconnecting" status for a human agent.
111
- */
112
- function setIsReconnecting(isReconnecting) {
113
- return { type: HA_SET_IS_RECONNECTING, isReconnecting };
114
- }
115
- /**
116
- * Indicate agent has left chat.
117
- */
118
- function setAgentLeftChat() {
119
- return { type: HA_SET_AGENT_LEFT_CHAT };
120
- }
121
- /**
122
- * Ends the current chat.
123
- */
124
- function endChat() {
125
- return { type: HA_END_CHAT };
126
- }
127
- /**
128
- * Sets the availability information for a user who is waiting to be connected to an agent.
129
- */
130
- function setAgentAvailability(availability) {
131
- return {
132
- type: HA_SET_AGENT_AVAILABILITY,
133
- availability,
134
- };
135
- }
136
- /**
137
- * Sets the availability information for a user who is waiting to be connected to an agent.
138
- */
139
- function setAgentJoined(agentProfile) {
140
- return {
141
- type: HA_SET_AGENT_JOINED,
142
- agentProfile,
143
- };
144
- }
145
- /**
146
- * Updates web chat with the capabilities supported by the service desk.
147
- */
148
- function updateCapabilities(capabilities) {
149
- return { type: HA_UPDATE_CAPABILITIES, capabilities };
150
- }
151
- /**
152
- * Updates the indicator for if any files are being uploaded.
153
- */
154
- function updateFilesUploadInProgress(fileUploadInProgress) {
155
- return { type: HA_UPDATE_FILE_UPLOAD_IN_PROGRESS, fileUploadInProgress };
156
- }
157
- /**
158
- * Sets the state of the screen sharing modal.
159
- */
160
- function setShowScreenShareRequest(showRequest) {
161
- return { type: HA_SET_SHOW_SCREEN_SHARE_REQUEST, showRequest };
162
- }
163
- /**
164
- * Sets the state of screen sharing.
165
- */
166
- function setIsScreenSharing(isSharing) {
167
- return { type: HA_SET_IS_SCREEN_SHARING, isSharing };
168
- }
169
- /**
170
- * Updates the object that is stored containing state for the service desk.
171
- */
172
- function setPersistedServiceDeskState(state) {
173
- return { type: HA_SET_PERSISTED_STATE, state };
174
- }
175
- /**
176
- * Updates the suspended status for the current service desk.
177
- */
178
- function agentUpdateIsSuspended(isSuspended) {
179
- return { type: HA_UPDATE_IS_SUSPENDED, isSuspended };
180
- }
181
- /**
182
- * Updates the suspended status for the current service desk.
183
- */
184
- function agentUpdateIsTyping(isTyping) {
185
- return { type: HA_UPDATE_IS_TYPING, isTyping };
186
- }
187
-
188
- exports.HA_END_CHAT = HA_END_CHAT;
189
- exports.HA_SET_AGENT_AVAILABILITY = HA_SET_AGENT_AVAILABILITY;
190
- exports.HA_SET_AGENT_JOINED = HA_SET_AGENT_JOINED;
191
- exports.HA_SET_AGENT_LEFT_CHAT = HA_SET_AGENT_LEFT_CHAT;
192
- exports.HA_SET_IS_CONNECTING = HA_SET_IS_CONNECTING;
193
- exports.HA_SET_IS_RECONNECTING = HA_SET_IS_RECONNECTING;
194
- exports.HA_SET_IS_SCREEN_SHARING = HA_SET_IS_SCREEN_SHARING;
195
- exports.HA_SET_PERSISTED_STATE = HA_SET_PERSISTED_STATE;
196
- exports.HA_SET_SHOW_SCREEN_SHARE_REQUEST = HA_SET_SHOW_SCREEN_SHARE_REQUEST;
197
- exports.HA_UPDATE_CAPABILITIES = HA_UPDATE_CAPABILITIES;
198
- exports.HA_UPDATE_FILE_UPLOAD_IN_PROGRESS = HA_UPDATE_FILE_UPLOAD_IN_PROGRESS;
199
- exports.HA_UPDATE_IS_SUSPENDED = HA_UPDATE_IS_SUSPENDED;
200
- exports.HA_UPDATE_IS_TYPING = HA_UPDATE_IS_TYPING;
201
- exports.agentUpdateIsSuspended = agentUpdateIsSuspended;
202
- exports.agentUpdateIsTyping = agentUpdateIsTyping;
203
- exports.endChat = endChat;
204
- exports.inputItemToLocalItem = inputItemToLocalItem;
205
- exports.setAgentAvailability = setAgentAvailability;
206
- exports.setAgentJoined = setAgentJoined;
207
- exports.setAgentLeftChat = setAgentLeftChat;
208
- exports.setIsConnecting = setIsConnecting;
209
- exports.setIsReconnecting = setIsReconnecting;
210
- exports.setIsScreenSharing = setIsScreenSharing;
211
- exports.setPersistedServiceDeskState = setPersistedServiceDeskState;
212
- exports.setShowScreenShareRequest = setShowScreenShareRequest;
213
- exports.updateCapabilities = updateCapabilities;
214
- exports.updateFilesUploadInProgress = updateFilesUploadInProgress;
@@ -1,354 +0,0 @@
1
- /*
2
-
3
-
4
- (C) Copyright IBM Corp. 2017, 2025. All Rights Reserved.
5
-
6
- Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
7
- in compliance with the License. You may obtain a copy of the License at
8
-
9
- http://www.apache.org/licenses/LICENSE-2.0
10
-
11
- Unless required by applicable law or agreed to in writing, software distributed under the License
12
- is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
13
- or implied. See the License for the specific language governing permissions and limitations under
14
- the License.
15
-
16
- @carbon/ai-chat 0.1.6
17
-
18
- Built: Feb 3 2025 9:58 am -05:00
19
-
20
-
21
-
22
- */
23
- 'use strict';
24
-
25
- var cdsAichatInternal = require('./cds-aichat-internal.js');
26
- var React = require('react');
27
- var lit = require('lit');
28
- var decorators_js = require('lit/decorators.js');
29
- require('react-dom');
30
- require('./highlight_js.js');
31
- require('@carbon/react');
32
- require('react-intl');
33
- require('react-redux');
34
- require('./markdown.js');
35
- require('./markdown_attrs.js');
36
- require('@carbon/web-components/es/components/button/index.js');
37
- require('@carbon/web-components/es/components/overflow-menu/index.js');
38
- require('lit/directives/unsafe-html.js');
39
- require('@carbon/web-components/es/components/slug/index.js');
40
- require('@carbon/web-components/es/components/popover/defs.js');
41
- require('@carbon/web-components/es/components/slug/defs.js');
42
- require('@carbon/web-components/es/components/slug/slug-action-button.js');
43
- require('@carbon/web-components/es/components/slug/slug.js');
44
- require('@carbon/web-components/es/components/textarea/index.js');
45
- require('@carbon/web-components/es/components/icon-button/index.js');
46
- require('lit/directives/unsafe-svg.js');
47
- require('@carbon/web-components/es/components/tag/index.js');
48
- require('@carbon/web-components/es/components/chat-button/index.js');
49
- require('@carbon/web-components/es/components/button/button.js');
50
- require('@carbon/web-components/es/components/layer/index.js');
51
-
52
- /**
53
- *
54
- * IBM Confidential
55
- *
56
- * (C) Copyright IBM Corp. 2024
57
- *
58
- * The source code for this program is not published or otherwise
59
- * divested of its trade secrets, irrespective of what has been
60
- * deposited with the U. S. Copyright Office
61
- *
62
- * US Government Users Restricted Rights - Use, duplication or
63
- * disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
64
- *
65
- */
66
- /**
67
- * The component adds slots for writeable elements and user_defined responses and then injects the elements for them
68
- * into slots.
69
- */
70
- let ChatContainerReact = class ChatContainerReact extends lit.LitElement {
71
- constructor() {
72
- super(...arguments);
73
- /**
74
- * The existing array of slots for all user_defined components.
75
- */
76
- this._userDefinedElements = [];
77
- /**
78
- * The existing array of slot names for all writeable elements.
79
- */
80
- this._writeableElementSlots = [];
81
- /**
82
- * Adds the slot attribute to the element for the user_defined response type and then injects it into the component by
83
- * updating this._userDefinedElements;
84
- */
85
- this._userDefinedHandler = (event) => {
86
- // This element already has `slot` as an attribute.
87
- const { element } = event.data;
88
- if (!this._userDefinedElements.includes(element)) {
89
- this._userDefinedElements = [...this._userDefinedElements, element];
90
- }
91
- };
92
- this._onBeforeRenderOverride = (instance) => {
93
- if (instance) {
94
- this._instance = instance;
95
- this._instance.on({ type: "userDefinedResponse" /* BusEventType.USER_DEFINED_RESPONSE */, handler: this._userDefinedHandler });
96
- this._instance.on({ type: "chunk:userDefinedResponse" /* BusEventType.CHUNK_USER_DEFINED_RESPONSE */, handler: this._userDefinedHandler });
97
- this._addWriteableElementSlots();
98
- this.onBeforeRender?.(instance);
99
- }
100
- };
101
- }
102
- _addWriteableElementSlots() {
103
- const writeableElementSlots = [this._instance.customPanels.getPanel().hostElement];
104
- Object.keys(this._instance.writeableElements).forEach(writeableElementKey => {
105
- const element = this._instance.writeableElements[writeableElementKey];
106
- element.setAttribute('slot', writeableElementKey);
107
- writeableElementSlots.push(element);
108
- });
109
- this._writeableElementSlots = writeableElementSlots;
110
- }
111
- createRenderRoot() {
112
- return this;
113
- }
114
- render() {
115
- return lit.html `<style>
116
- cds-aichat-react {
117
- width: 100%;
118
- height: 100%;
119
- }
120
- </style>
121
- <cds-aichat-internal
122
- .config=${this.config}
123
- .onAfterRender=${this.onAfterRender}
124
- .onBeforeRender=${this._onBeforeRenderOverride}
125
- .renderUserDefinedResponse=${this.renderUserDefinedResponse}
126
- .renderWriteableElements=${this.renderWriteableElements}
127
- isReact
128
- .forceReact17Mode=${this.forceReact17Mode}
129
- >
130
- ${this._writeableElementSlots.map(element => lit.html `${element}`)}
131
- ${this._userDefinedElements.map(element => lit.html `${element}`)}
132
- </cds-aichat-internal>`;
133
- }
134
- };
135
- cdsAichatInternal.__decorate([
136
- decorators_js.property({ type: Object })
137
- ], ChatContainerReact.prototype, "config", void 0);
138
- cdsAichatInternal.__decorate([
139
- decorators_js.property()
140
- ], ChatContainerReact.prototype, "onBeforeRender", void 0);
141
- cdsAichatInternal.__decorate([
142
- decorators_js.property()
143
- ], ChatContainerReact.prototype, "onAfterRender", void 0);
144
- cdsAichatInternal.__decorate([
145
- decorators_js.property({ type: Boolean })
146
- ], ChatContainerReact.prototype, "forceReact17Mode", void 0);
147
- cdsAichatInternal.__decorate([
148
- decorators_js.property()
149
- ], ChatContainerReact.prototype, "renderUserDefinedResponse", void 0);
150
- cdsAichatInternal.__decorate([
151
- decorators_js.property({ type: Object })
152
- ], ChatContainerReact.prototype, "renderWriteableElements", void 0);
153
- cdsAichatInternal.__decorate([
154
- decorators_js.state()
155
- ], ChatContainerReact.prototype, "_userDefinedElements", void 0);
156
- cdsAichatInternal.__decorate([
157
- decorators_js.state()
158
- ], ChatContainerReact.prototype, "_writeableElementSlots", void 0);
159
- cdsAichatInternal.__decorate([
160
- decorators_js.state()
161
- ], ChatContainerReact.prototype, "_instance", void 0);
162
- ChatContainerReact = cdsAichatInternal.__decorate([
163
- cdsAichatInternal.carbonElement('cds-aichat-react')
164
- ], ChatContainerReact);
165
- var ChatContainerReact$1 = ChatContainerReact;
166
-
167
- /**
168
- *
169
- * IBM Confidential
170
- *
171
- * (C) Copyright IBM Corp. 2024
172
- *
173
- * The source code for this program is not published or otherwise
174
- * divested of its trade secrets, irrespective of what has been
175
- * deposited with the U. S. Copyright Office
176
- *
177
- * US Government Users Restricted Rights - Use, duplication or
178
- * disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
179
- *
180
- */
181
- /**
182
- * This is the React component for people injecting a classic floating web chat. It simply takes properties and
183
- * forwards them into the web component ChatContainer.
184
- */
185
- const CWXChatContainer = cdsAichatInternal.o({
186
- tagName: 'cds-aichat-react',
187
- elementClass: ChatContainerReact$1,
188
- react: React,
189
- });
190
- function ChatContainer({ config, onBeforeRender, onAfterRender, renderUserDefinedResponse, renderWriteableElements, forceReact17Mode, }) {
191
- return (React.createElement(CWXChatContainer, { config: config, onBeforeRender: onBeforeRender, onAfterRender: onAfterRender, renderUserDefinedResponse: renderUserDefinedResponse, renderWriteableElements: renderWriteableElements, forceReact17Mode: forceReact17Mode }));
192
- }
193
-
194
- /**
195
- *
196
- * IBM Confidential
197
- *
198
- * (C) Copyright IBM Corp. 2024
199
- *
200
- * The source code for this program is not published or otherwise
201
- * divested of its trade secrets, irrespective of what has been
202
- * deposited with the U. S. Copyright Office
203
- *
204
- * US Government Users Restricted Rights - Use, duplication or
205
- * disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
206
- *
207
- */
208
- function ChatCustomElement({ config, onBeforeRender, onAfterRender, renderUserDefinedResponse, renderWriteableElements, className, id, onViewChange, }) {
209
- const [customElement, setCustomElement] = React.useState();
210
- const originalStyles = React.useRef({ width: undefined, height: undefined });
211
- // Make sure to memoize the config object. If we pass a new object to WebChatContainer (even if all the properties
212
- // inside of it are the same), the container will just continually destroy and recreate the web chat instance
213
- // because it thinks the config keeps changing.
214
- const useConfig = React.useMemo(() => {
215
- return {
216
- ...config,
217
- element: customElement,
218
- };
219
- }, [config, customElement]);
220
- const onBeforeRenderOverride = React.useCallback(async (instance) => {
221
- /**
222
- * A default handler for the "view:change" event. This will be used to show or hide the web chat main window
223
- * using a simple classname.
224
- */
225
- function defaultViewChangeHandler(event, instance) {
226
- if (event.newViewState.mainWindow) {
227
- customElement.style.width = originalStyles.current.width;
228
- customElement.style.height = originalStyles.current.height;
229
- instance.elements.getMainWindow().removeClassName('HideWebChat');
230
- }
231
- else {
232
- originalStyles.current = { width: customElement.style.width, height: customElement.style.height };
233
- customElement.style.width = '0px';
234
- customElement.style.height = '0px';
235
- instance.elements.getMainWindow().addClassName('HideWebChat');
236
- }
237
- }
238
- instance.on({ type: "view:change" /* BusEventType.VIEW_CHANGE */, handler: onViewChange || defaultViewChangeHandler });
239
- return onBeforeRender?.(instance);
240
- }, [onBeforeRender, onViewChange, customElement]);
241
- return (React.createElement("div", { className: className, id: id, ref: setCustomElement }, customElement && (React.createElement(ChatContainer, { config: useConfig, onBeforeRender: onBeforeRenderOverride, onAfterRender: onAfterRender, renderUserDefinedResponse: renderUserDefinedResponse, renderWriteableElements: renderWriteableElements }))));
242
- }
243
-
244
- Object.defineProperty(exports, "AgentMessageType", {
245
- enumerable: true,
246
- get: function () { return cdsAichatInternal.AgentMessageType; }
247
- });
248
- Object.defineProperty(exports, "AgentsOnlineStatus", {
249
- enumerable: true,
250
- get: function () { return cdsAichatInternal.AgentsOnlineStatus; }
251
- });
252
- Object.defineProperty(exports, "BusEventType", {
253
- enumerable: true,
254
- get: function () { return cdsAichatInternal.BusEventType; }
255
- });
256
- Object.defineProperty(exports, "ButtonItemKind", {
257
- enumerable: true,
258
- get: function () { return cdsAichatInternal.ButtonItemKind; }
259
- });
260
- Object.defineProperty(exports, "ButtonItemType", {
261
- enumerable: true,
262
- get: function () { return cdsAichatInternal.ButtonItemType; }
263
- });
264
- Object.defineProperty(exports, "CarbonTheme", {
265
- enumerable: true,
266
- get: function () { return cdsAichatInternal.CarbonTheme; }
267
- });
268
- Object.defineProperty(exports, "CatastrophicErrorType", {
269
- enumerable: true,
270
- get: function () { return cdsAichatInternal.CatastrophicErrorType; }
271
- });
272
- exports.ChatHeaderObjectType = cdsAichatInternal.ChatHeaderObjectType;
273
- Object.defineProperty(exports, "CornersType", {
274
- enumerable: true,
275
- get: function () { return cdsAichatInternal.CornersType; }
276
- });
277
- Object.defineProperty(exports, "CustomEventType", {
278
- enumerable: true,
279
- get: function () { return cdsAichatInternal.CustomEventType; }
280
- });
281
- Object.defineProperty(exports, "ErrorType", {
282
- enumerable: true,
283
- get: function () { return cdsAichatInternal.ErrorType; }
284
- });
285
- Object.defineProperty(exports, "FeedbackInteractionType", {
286
- enumerable: true,
287
- get: function () { return cdsAichatInternal.FeedbackInteractionType; }
288
- });
289
- Object.defineProperty(exports, "FileStatusValue", {
290
- enumerable: true,
291
- get: function () { return cdsAichatInternal.FileStatusValue; }
292
- });
293
- Object.defineProperty(exports, "HomeScreenBackgroundType", {
294
- enumerable: true,
295
- get: function () { return cdsAichatInternal.HomeScreenBackgroundType; }
296
- });
297
- Object.defineProperty(exports, "IFrameItemDisplayOption", {
298
- enumerable: true,
299
- get: function () { return cdsAichatInternal.IFrameItemDisplayOption; }
300
- });
301
- Object.defineProperty(exports, "LauncherType", {
302
- enumerable: true,
303
- get: function () { return cdsAichatInternal.LauncherType; }
304
- });
305
- Object.defineProperty(exports, "MessageInputType", {
306
- enumerable: true,
307
- get: function () { return cdsAichatInternal.MessageInputType; }
308
- });
309
- Object.defineProperty(exports, "MessageResponseTypes", {
310
- enumerable: true,
311
- get: function () { return cdsAichatInternal.MessageResponseTypes; }
312
- });
313
- Object.defineProperty(exports, "MessageSendSource", {
314
- enumerable: true,
315
- get: function () { return cdsAichatInternal.MessageSendSource; }
316
- });
317
- Object.defineProperty(exports, "MinimizeButtonIconType", {
318
- enumerable: true,
319
- get: function () { return cdsAichatInternal.MinimizeButtonIconType; }
320
- });
321
- Object.defineProperty(exports, "OnErrorType", {
322
- enumerable: true,
323
- get: function () { return cdsAichatInternal.OnErrorType; }
324
- });
325
- Object.defineProperty(exports, "OptionItemPreference", {
326
- enumerable: true,
327
- get: function () { return cdsAichatInternal.OptionItemPreference; }
328
- });
329
- Object.defineProperty(exports, "ScreenShareState", {
330
- enumerable: true,
331
- get: function () { return cdsAichatInternal.ScreenShareState; }
332
- });
333
- Object.defineProperty(exports, "TourEndReason", {
334
- enumerable: true,
335
- get: function () { return cdsAichatInternal.TourEndReason; }
336
- });
337
- Object.defineProperty(exports, "TourStartReason", {
338
- enumerable: true,
339
- get: function () { return cdsAichatInternal.TourStartReason; }
340
- });
341
- Object.defineProperty(exports, "ViewChangeReason", {
342
- enumerable: true,
343
- get: function () { return cdsAichatInternal.ViewChangeReason; }
344
- });
345
- Object.defineProperty(exports, "ViewType", {
346
- enumerable: true,
347
- get: function () { return cdsAichatInternal.ViewType; }
348
- });
349
- Object.defineProperty(exports, "WriteableElementName", {
350
- enumerable: true,
351
- get: function () { return cdsAichatInternal.WriteableElementName; }
352
- });
353
- exports.ChatContainer = ChatContainer;
354
- exports.ChatCustomElement = ChatCustomElement;