impact-chatbot 2.4.2 → 3.1.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 (39) hide show
  1. package/dist/components/ag-grid/AgGridComponent.d.ts +2 -0
  2. package/dist/components/ag-grid/columnFormatter.d.ts +10 -0
  3. package/dist/components/ag-grid/constants.d.ts +3 -0
  4. package/dist/components/ag-grid/formatters.d.ts +11 -0
  5. package/dist/components/ag-grid/index.d.ts +3 -0
  6. package/dist/components/core-chart/CoreChart.d.ts +22 -0
  7. package/dist/components/core-chart/index.d.ts +2 -0
  8. package/dist/components/date-range-picker/DateRangePickerComponent.d.ts +4 -0
  9. package/dist/components/date-range-picker/index.d.ts +2 -0
  10. package/dist/constants.d.ts +1 -0
  11. package/dist/hooks/useBotConfiguration.d.ts +1 -1
  12. package/dist/index.cjs.css +93 -0
  13. package/dist/index.cjs.js +2172 -926
  14. package/dist/index.cjs.js.map +1 -1
  15. package/dist/index.d.ts +4 -0
  16. package/dist/index.esm.css +93 -0
  17. package/dist/index.esm.js +2030 -801
  18. package/dist/index.esm.js.map +1 -1
  19. package/dist/provider/ChatbotProvider.d.ts +32 -0
  20. package/dist/provider/types.d.ts +49 -0
  21. package/dist/services/apiConstants.d.ts +14 -0
  22. package/dist/services/chatbot-services.d.ts +42 -14
  23. package/dist/services/http.d.ts +53 -0
  24. package/dist/store/actions.d.ts +13 -0
  25. package/dist/store/index.d.ts +3 -0
  26. package/dist/store/reducer.d.ts +205 -0
  27. package/dist/store/types.d.ts +18 -0
  28. package/dist/utils/coreUtils.d.ts +16 -9
  29. package/package.json +47 -5
  30. package/dist/components/chatbot-input/index_new.d.ts +0 -3
  31. package/dist/components/chatbot-input/index_old_backup.d.ts +0 -3
  32. package/dist/components/chatbot-save-filter-component/ChatbotSaveFilterComponent.d.ts +0 -2
  33. package/dist/components/skill-upload-modal/index.d.ts +0 -2
  34. package/dist/core/commonComponents/custom-group-accordion/index.d.ts +0 -5
  35. package/dist/core/constants/index.d.ts +0 -5
  36. package/dist/core/utils/functions.d.ts +0 -8
  37. package/dist/core/utils/replaceSpecialCharacter.d.ts +0 -1
  38. /package/dist/{core/styles → styles}/colours.d.ts +0 -0
  39. /package/dist/{core/styles → styles}/globalStyles.d.ts +0 -0
package/dist/index.cjs.js CHANGED
@@ -5,11 +5,6 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var jsxRuntime = require('react/jsx-runtime');
6
6
  var lodash = require('lodash');
7
7
  var React = require('react');
8
- var api = require('config/api');
9
- var axiosInstance = require('core/Utils/axios');
10
- var tenantConfigActions = require('core/actions/tenantConfigActions');
11
- var userAccessActions = require('core/actions/userAccessActions');
12
- var snackbarActions = require('core/actions/snackbarActions');
13
8
  var axios = require('axios');
14
9
  var moment = require('moment');
15
10
  var isEmpty = require('lodash/isEmpty.js');
@@ -22,32 +17,36 @@ var remarkBreaks = require('remark-breaks');
22
17
  var remarkGfm = require('remark-gfm');
23
18
  var DOMPurify = require('dompurify');
24
19
  var reactRouterDomV5Compat = require('react-router-dom-v5-compat');
25
- var filterAction = require('core/actions/filterAction');
26
- var smartBotActions = require('core/actions/smartBotActions');
27
20
  var RefreshIcon = require('@mui/icons-material/Refresh');
28
21
  var styled = require('styled-components');
29
22
  var material = require('@mui/material');
30
- var utils = require('core/Utils/functions/utils');
31
23
  var impactUiV3 = require('impact-ui-v3');
32
24
  var isArray$1 = require('lodash/isArray');
33
25
  var isEmpty$1 = require('lodash/isEmpty');
34
- var chatbotServices = require('core/commonComponents/smartBot/services/chatbot-services');
35
- var conversationService = require('core/commonComponents/smartBot/services/conversation-service');
36
- var AgGridComponent = require('core/Utils/agGridV36');
37
- var agGridColumnFormatter = require('core/Utils/agGridV36/columnFormatter');
38
- var CoreChart = require('core/Utils/core-charts');
26
+ var agGridEnterprise = require('ag-grid-enterprise');
27
+ var agGridCommunity = require('ag-grid-community');
28
+ var agGridReact = require('ag-grid-react');
29
+ var TableV36 = require('impact-ui-v3/TableV36');
30
+ var classNames = require('classnames');
31
+ var HighchartsReact = require('highcharts-react-official');
32
+ var Highcharts = require('highcharts/esm/highcharts.js');
33
+ require('highcharts/esm/highcharts-more.js');
34
+ require('highcharts/esm/highcharts-3d.js');
35
+ require('highcharts/esm/modules/exporting.js');
36
+ require('highcharts/esm/modules/export-data.js');
37
+ require('highcharts/esm/modules/map.js');
38
+ require('highcharts/esm/modules/pattern-fill.js');
39
+ require('highcharts/esm/modules/treemap.js');
40
+ require('highcharts/esm/modules/heatmap.js');
41
+ require('highcharts/esm/modules/pareto.js');
39
42
  var makeStyles = require('@mui/styles/makeStyles');
40
43
  var ChevronRightIcon$1 = require('@mui/icons-material/ChevronRight');
41
44
  var DescriptionOutlinedIcon = require('@mui/icons-material/DescriptionOutlined');
42
45
  var OpenInNewIcon = require('@mui/icons-material/OpenInNew');
43
46
  var FormatListBulletedOutlinedIcon = require('@mui/icons-material/FormatListBulletedOutlined');
44
47
  var PsychologyOutlinedIcon = require('@mui/icons-material/PsychologyOutlined');
45
- var colours$1 = require('core/Styles/colours');
46
48
  var SaveOutlinedIcon = require('@mui/icons-material/SaveOutlined');
47
- var RangePicker = require('core/commonComponents/dateRangePicker');
48
- var NoFilterSetSavedIcon = require('core/coreAssets/chatbot/noFilterSetSaved.svg');
49
- var CoreComponentScreen = require('core/commonComponents/coreComponentScreen');
50
- var utils$1 = require('core/commonComponents/coreComponentScreen/utils');
49
+ require('react-dates/lib/css/_datepicker.css');
51
50
  var reactDom = require('react-dom');
52
51
  var VisibilityOutlinedIcon = require('@mui/icons-material/VisibilityOutlined');
53
52
  var OpenInFullIcon = require('@mui/icons-material/OpenInFull');
@@ -55,7 +54,6 @@ var CloseFullscreenIcon = require('@mui/icons-material/CloseFullscreen');
55
54
  var CloseIcon = require('@mui/icons-material/Close');
56
55
  var ExpandMoreIcon = require('@mui/icons-material/ExpandMore');
57
56
  var ArrowForwardIcon = require('@mui/icons-material/ArrowForward');
58
- var utils$2 = require('core/Utils/utils');
59
57
 
60
58
  function _interopNamespaceDefault(e) {
61
59
  var n = Object.create(null);
@@ -77,15 +75,530 @@ function _interopNamespaceDefault(e) {
77
75
  var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
78
76
 
79
77
  /**
80
- * Constants extracted from core/constants
81
- * Only includes constants used by chatbot-v2
78
+ * Internal HTTP client module for impact-chatbot.
79
+ *
80
+ * Instead of importing `axiosInstance` from `core/Utils/axios` (which ties the
81
+ * package to the host's core submodule), every service file in this package
82
+ * imports `getHttpClient()` from this module.
83
+ *
84
+ * The client is set once at startup via `initHttpClient()`, which is called
85
+ * from `ChatbotProvider` when the component tree mounts.
86
+ *
87
+ * Phase 3 of the segregation roadmap.
88
+ */
89
+ // ── Module-level singletons ────────────────────────────────────────────────
90
+ let _httpClient = null;
91
+ let _apiConstants = null;
92
+ /**
93
+ * Called once when <ChatbotProvider> mounts.
94
+ * Stores the consumer-provided HTTP client and API constants so every
95
+ * internal service can access them without prop-drilling.
96
+ */
97
+ function initHttpClient(httpClient, apiConstants) {
98
+ _httpClient = httpClient;
99
+ _apiConstants = apiConstants;
100
+ }
101
+ /**
102
+ * Returns the HTTP client set by the consumer.
103
+ *
104
+ * All internal service files use this as a drop-in replacement for the old
105
+ * `import axiosInstance from "core/Utils/axios"`.
106
+ *
107
+ * The returned client is "callable" in the same way Axios instances are — it
108
+ * supports `.get()`, `.post()`, `.put()`, `.delete()` and can also be invoked
109
+ * directly as a function (Axios config object style). To support the latter
110
+ * pattern transparently we return a wrapper that delegates to the right method.
82
111
  */
112
+ function getHttpClient() {
113
+ if (!_httpClient) {
114
+ throw new Error("[impact-chatbot] HTTP client not initialized. " +
115
+ "Ensure <ChatbotProvider> is rendered before any API call.");
116
+ }
117
+ return _httpClient;
118
+ }
119
+ /**
120
+ * Callable wrapper that mimics `axiosInstance({ url, method, data, params, ... })`.
121
+ *
122
+ * The old code uses `axiosInstance(config)` everywhere (Axios request-config
123
+ * style). This function translates that call into the structural `HttpClient`
124
+ * interface (.get / .post / .put / .delete).
125
+ */
126
+ function httpRequest(config) {
127
+ const client = getHttpClient();
128
+ const method = (config.method || "GET").toUpperCase();
129
+ // Build a config object to pass as the last argument (covers params,
130
+ // headers, signal, responseType, onDownloadProgress, etc.)
131
+ const requestConfig = { ...config };
132
+ delete requestConfig.url;
133
+ delete requestConfig.method;
134
+ delete requestConfig.data;
135
+ switch (method) {
136
+ case "GET":
137
+ return client.get(config.url, requestConfig);
138
+ case "POST":
139
+ return client.post(config.url, config.data, requestConfig);
140
+ case "PUT":
141
+ return client.put(config.url, config.data, requestConfig);
142
+ case "DELETE":
143
+ return client.delete(config.url, requestConfig);
144
+ case "PATCH":
145
+ // PATCH is not on the base HttpClient interface but Axios instances
146
+ // support it. Fall through to a generic call.
147
+ if (client.patch) {
148
+ return client.patch(config.url, config.data, requestConfig);
149
+ }
150
+ // Fallback: use post with _method override or just post
151
+ return client.post(config.url, config.data, {
152
+ ...requestConfig,
153
+ headers: { ...requestConfig.headers, "X-HTTP-Method-Override": "PATCH" },
154
+ });
155
+ default:
156
+ // For any other method, try calling the client directly (it may be
157
+ // a real Axios instance that supports arbitrary methods).
158
+ if (typeof client === "function") {
159
+ return client(config);
160
+ }
161
+ return client.get(config.url, requestConfig);
162
+ }
163
+ }
164
+ /**
165
+ * Returns the API constants set by the consumer.
166
+ */
167
+ function getApiConstants() {
168
+ if (!_apiConstants) {
169
+ throw new Error("[impact-chatbot] API constants not initialized. " +
170
+ "Ensure <ChatbotProvider> is rendered before any API call.");
171
+ }
172
+ return _apiConstants;
173
+ }
83
174
 
175
+ // Special character mapping for text replacement
176
+ const SPECIAL_CHARACTER_MAPPING = {
177
+ __ia_char_01: "'",
178
+ __ia_char_02: '"',
179
+ __ia_char_03: "/",
180
+ __ia_char_04: "\\",
181
+ __ia_char_05: "`",
182
+ __ia_char_06: "~",
183
+ __ia_char_07: "!",
184
+ __ia_char_08: "@",
185
+ __ia_char_09: "#",
186
+ __ia_char_10: "$",
187
+ __ia_char_11: "%",
188
+ __ia_char_12: "^",
189
+ __ia_char_13: "&",
190
+ __ia_char_14: "*",
191
+ __ia_char_15: "(",
192
+ __ia_char_16: ")",
193
+ __ia_char_19: "=",
194
+ __ia_char_20: "+",
195
+ __ia_char_21: "{",
196
+ __ia_char_22: "}",
197
+ __ia_char_23: "[",
198
+ __ia_char_24: "]",
199
+ __ia_char_25: "|",
200
+ __ia_char_26: ":",
201
+ __ia_char_27: ";",
202
+ __ia_char_28: "<",
203
+ __ia_char_29: ">",
204
+ __ia_char_30: ",",
205
+ __ia_char_31: ".",
206
+ __ia_char_32: "?",
207
+ __ia_char_33: "/",
208
+ };
84
209
  const COMBINED_CROSS_DIMENSIONAL_API_V4 = "/combined-cross-dimensional-v4";
210
+ const navigationOptions = [
211
+ {
212
+ link: "/inventory-smart/decision-dashboard",
213
+ screen_name: "Dashboard",
214
+ flow_type: "navigation",
215
+ },
216
+ {
217
+ link: `/inventory-smart/create-allocation/?step=0`,
218
+ flow_type: "navigation",
219
+ screen_name: "Allocation",
220
+ },
221
+ {
222
+ link: "/inventory-smart/configuration",
223
+ flow_type: "navigation",
224
+ screen_name: "Configurations",
225
+ },
226
+ {
227
+ link: "/inventory-smart/store-eligibility-grouping",
228
+ flow_type: "navigation",
229
+ screen_name: "Grouping",
230
+ },
231
+ {
232
+ link: "/inventory-smart/constraints",
233
+ flow_type: "navigation",
234
+ screen_name: "Constraints",
235
+ },
236
+ {
237
+ link: "/inventory-smart/ada/dashboard",
238
+ flow_type: "navigation",
239
+ screen_name: "ADA Visual",
240
+ },
241
+ ];
242
+ const insightsOptions = [
243
+ {
244
+ link: "/inventory-smart/decision-dashboard",
245
+ screen_name: "Dashboard",
246
+ flow_type: "insights",
247
+ },
248
+ {
249
+ link: `/inventory-smart/create-allocation/?step=0`,
250
+ flow_type: "insights",
251
+ screen_name: "Allocation",
252
+ },
253
+ {
254
+ link: "/inventory-smart/store-eligibility-grouping",
255
+ flow_type: "insights",
256
+ screen_name: "Configurations",
257
+ },
258
+ {
259
+ link: "/inventory-smart/configuration",
260
+ flow_type: "insights",
261
+ screen_name: "Grouping",
262
+ },
263
+ {
264
+ link: "/inventory-smart/constraints",
265
+ flow_type: "insights",
266
+ screen_name: "Constraints",
267
+ },
268
+ {
269
+ link: "/inventory-smart/ada/dashboard",
270
+ flow_type: "insights",
271
+ screen_name: "ADA Visual",
272
+ },
273
+ ];
274
+ const screenOptions = [
275
+ {
276
+ link: "/inventory-smart/decision-dashboard",
277
+ screen_name: "InventoryDashboard",
278
+ filterCongfigurationName: "decisionDashboardFilterConfiguration",
279
+ },
280
+ {
281
+ link: "/inventory-smart/product-profile",
282
+ screen_name: "Product Profile",
283
+ filterCongfigurationName: "productProfileDashboardFilterConfig",
284
+ },
285
+ {
286
+ link: `/inventory-smart/create-allocation/?step=0`,
287
+ screen_name: "Allocation",
288
+ filterCongfigurationName: "createAllocationFilterConfiguration",
289
+ },
290
+ {
291
+ link: "/inventory-smart/store-eligibility-grouping",
292
+ screen_name: "Inventorysmart Store Eligibility Group",
293
+ filterCongfigurationName: "storeGroupingFilterConfiguration",
294
+ },
295
+ {
296
+ link: "/inventory-smart/configuration",
297
+ screen_name: "Inventorysmart Configurations",
298
+ filterCongfigurationName: "productStatusFilterConfiguration",
299
+ },
300
+ {
301
+ link: "/inventory-smart/constraints",
302
+ screen_name: "Inventorysmart Constraints",
303
+ filterCongfigurationName: "rulesConstraintsFilterConfig",
304
+ },
305
+ {
306
+ link: "/inventory-smart/allocation-reports",
307
+ screen_name: "Inventorysmart Reportings",
308
+ filterCongfigurationName: "lostSalesFilterConfiguration",
309
+ },
310
+ {
311
+ link: "/inventory-smart/ada/dashboard",
312
+ screen_name: "Inventorysmart ADA Dashboard",
313
+ filterCongfigurationName: "adaVisualFilterConfiguration",
314
+ },
315
+ ];
316
+
317
+ /**
318
+ * Core utility functions copied from core/Utils/functions/utils
319
+ * These are internalized to make chatbot-v2 self-contained
320
+ */
321
+ /**
322
+ * pxToRem function will convert the px value to rem value
323
+ */
324
+ const pxToRem = (pxValue) => {
325
+ try {
326
+ return pxValue / 16 + "rem";
327
+ }
328
+ catch (error) {
329
+ console.error("pxToRem error:", error);
330
+ return "0rem";
331
+ }
332
+ };
333
+ /**
334
+ * Replace special characters in a string
335
+ */
336
+ const replaceSpecialCharacter$2 = (str) => {
337
+ if (typeof str === "object") {
338
+ return str;
339
+ }
340
+ else {
341
+ let result = str;
342
+ if (SPECIAL_CHARACTER_MAPPING) {
343
+ Object.keys(SPECIAL_CHARACTER_MAPPING).forEach((key) => {
344
+ if (result?.includes(key)) {
345
+ result = result.replaceAll(key, SPECIAL_CHARACTER_MAPPING[key]);
346
+ }
347
+ });
348
+ }
349
+ return result;
350
+ }
351
+ };
352
+ /**
353
+ * @function
354
+ * @description Function is used to return string by replacing the special characters with respective key mapped to SPECIAL_CHARACTER_MAPPING
355
+ * @param {String} str
356
+ * @returns {String} key of mapped special character used in the string
357
+ */
358
+ const replaceSpecialCharToCharCode = (str) => {
359
+ let re = new RegExp(`[${Object.values(SPECIAL_CHARACTER_MAPPING).join("")}]`, "g");
360
+ return str.replace(re, function (matched) {
361
+ let code;
362
+ for (const [key, value] of Object.entries(SPECIAL_CHARACTER_MAPPING)) {
363
+ if (value === matched) {
364
+ code = key;
365
+ return code;
366
+ }
367
+ }
368
+ return code;
369
+ });
370
+ };
371
+ /**
372
+ * Get user name from session storage
373
+ * Matches core/Utils/functions/utils.getUserName exactly
374
+ */
375
+ const getUserName = () => {
376
+ const userDetails = JSON.parse(sessionStorage.getItem("userDetails") || "{}");
377
+ return userDetails?.user_name || "User";
378
+ };
379
+ /**
380
+ * Get formatted application name based on URL path segment
381
+ * Matches core/Utils/functions/utils.getFormattedApplicationName exactly
382
+ */
383
+ /**
384
+ * Get application code from localStorage applicationCodesList by matching application name.
385
+ * Mirrors core/Utils/utils.getApplicationCodeFromURL exactly.
386
+ */
387
+ const getApplicationCodeFromURL = (applicationName) => {
388
+ try {
389
+ const applicationCodesList = JSON.parse(localStorage.getItem("applicationCodesList") || "[]");
390
+ const matched = applicationCodesList?.find((app) => app.name?.toUpperCase() === applicationName?.toUpperCase());
391
+ return matched?.application_code || "";
392
+ }
393
+ catch (error) {
394
+ console.error("getApplicationCodeFromURL error:", error);
395
+ return "";
396
+ }
397
+ };
398
+ const getFormattedApplicationName = (applicationURL) => {
399
+ switch (applicationURL) {
400
+ case "user-management":
401
+ case "tenantconfig":
402
+ return "application access management";
403
+ case "assort-smart":
404
+ return "AssortSmart";
405
+ case "configurator":
406
+ return "module configurator";
407
+ case "inventory-smart":
408
+ return "InventorySmart";
409
+ case "ada":
410
+ return "ADA";
411
+ case "plan-smart":
412
+ return "PlanSmart";
413
+ case "adaconfigurator":
414
+ return "ADAConfigurator";
415
+ case "item-smart":
416
+ return "ItemSmart";
417
+ case "item-smart-new":
418
+ return "ItemSmart-New";
419
+ case "source-smart":
420
+ return "SourceSmart";
421
+ case "pricesmart-markdown":
422
+ return "PriceSmart Markdown";
423
+ case "pricesmart-promo":
424
+ return "PriceSmart Promo";
425
+ case "agentic-assort":
426
+ return "AssortSmart";
427
+ case "size-smart":
428
+ return "SizeSmart";
429
+ default:
430
+ return "workflow input center";
431
+ }
432
+ };
85
433
 
434
+ /**
435
+ * API endpoint constants used by chatbot service functions.
436
+ *
437
+ * Previously scattered across `config/api`, `core/actions/tenantConfigActions`,
438
+ * and `core/actions/userAccessActions` in the host app. Now internalized so the
439
+ * package is fully self-contained.
440
+ */
441
+ // ─── Tenant Config & Application ─────────────────────────────────────────────
442
+ const GET_TENANT_CONFIG = "core/tenant-config";
443
+ const GET_APPLICATION_MASTER = "/core/applications";
444
+ // ─── User Management ─────────────────────────────────────────────────────────
445
+ const GET_USERS_URL = "/core/user-mgmt/list";
446
+ const GET_MODULE_LEVEL_ACCESS = "/master/user-management/module-hierarchy";
447
+ const GET_USER_APP_ACCESS_HIERARCHY = "/master/user-management/app-role-hierarchy";
448
+ // ─── Filter ──────────────────────────────────────────────────────────────────
449
+ const SAVE_FILTER_GET = "/core/filter/user-preference/screen";
450
+
451
+ // ─── In-memory tenant-config cache ──────────────────────────────────────
452
+ // Mirrors core tenantConfigApiCache but uses a simple Map instead of Redux.
453
+ const _tenantConfigCache = {};
454
+ /**
455
+ * processData – filters a tenant-config API response by attribute_name.
456
+ * Mirrors core/Utils/functions/utils.processData exactly.
457
+ */
458
+ const processData = (responseData, queryParam) => {
459
+ if (Object.keys(queryParam).length === 0) {
460
+ return responseData;
461
+ }
462
+ const { data } = responseData;
463
+ const filteredData = data?.data?.filter((item) => item.name === queryParam?.attribute_name);
464
+ return {
465
+ ...responseData,
466
+ data: {
467
+ ...data,
468
+ data: filteredData,
469
+ },
470
+ };
471
+ };
472
+ /**
473
+ * tenantConfigApiCache – fetches tenant config for an application code,
474
+ * caching the full response in memory. Returns a thunk (function) to
475
+ * match the core signature: `tenantConfigApiCache(appCode, query)()`
476
+ *
477
+ * Mirrors core/actions/tenantConfigActions.tenantConfigApiCache.
478
+ */
479
+ const tenantConfigApiCache = (applicationCode = 1, queryParam = {}) => async () => {
480
+ const cachedData = _tenantConfigCache[applicationCode];
481
+ if (cachedData) {
482
+ return processData(cachedData, queryParam);
483
+ }
484
+ const resp = await httpRequest({
485
+ url: `${GET_TENANT_CONFIG}/${applicationCode}`,
486
+ params: {},
487
+ method: "GET",
488
+ });
489
+ _tenantConfigCache[applicationCode] = resp;
490
+ return processData(resp, queryParam);
491
+ };
492
+ /**
493
+ * getApplicationMaster – fetches the list of applications.
494
+ * Mirrors core/actions/tenantConfigActions.getApplicationMaster.
495
+ * The original returns a thunk `(postBody) => async () => ...`.
496
+ * We simplify to a direct async call since the package never passes postBody.
497
+ */
498
+ const getApplicationMaster = async () => {
499
+ return httpRequest({
500
+ url: GET_APPLICATION_MASTER,
501
+ method: "GET",
502
+ });
503
+ };
504
+ // Resolve the current user's code via the users API, matching the logged-in
505
+ // email (localStorage "name"). Mirrors core/Utils/functions/utils.getCurrentUserId.
506
+ const getCurrentUserId = async () => {
507
+ try {
508
+ const postBody = {
509
+ meta: {
510
+ search: [],
511
+ range: [],
512
+ sort: [],
513
+ },
514
+ };
515
+ const users = await httpRequest({
516
+ url: GET_USERS_URL,
517
+ method: "POST",
518
+ data: postBody,
519
+ });
520
+ const loggedInUserEmail = localStorage.getItem("name");
521
+ const user = users?.data?.data?.filter((item) => {
522
+ return item.email === loggedInUserEmail;
523
+ });
524
+ return user[0]?.user_code;
525
+ }
526
+ catch (error) {
527
+ console.error("getCurrentUserId error", error);
528
+ }
529
+ };
530
+ // Helper to get current application details from localStorage
531
+ const getCurrentApplicationDetails = () => {
532
+ if (localStorage.getItem("applicationCodesList") &&
533
+ localStorage.getItem("applicationCodesList") !== "undefined") {
534
+ const applicationCodesList = JSON.parse(localStorage.getItem("applicationCodesList"));
535
+ const applicationURL = window.location.pathname.split("/")?.[1];
536
+ const applicationName = getFormattedApplicationName(applicationURL);
537
+ const applicationCode = applicationCodesList?.find((app) => app.name?.toUpperCase() === applicationName?.toUpperCase());
538
+ return {
539
+ applicationCode: applicationCode?.application_code,
540
+ applicationName,
541
+ applicationCodesList,
542
+ };
543
+ }
544
+ return { applicationCode: "", applicationName: "", applicationCodesList: [] };
545
+ };
546
+ // Fetch application code – mirrors core/Utils/functions/utils.fetchApplicationCode
547
+ const fetchApplicationCodeFromConfig = async () => {
548
+ const { applicationCode, applicationCodesList } = getCurrentApplicationDetails();
549
+ let finalApplicationCode = applicationCode;
550
+ let finalApplicationCodesList = applicationCodesList;
551
+ if (!finalApplicationCode) {
552
+ let applicationURL = window.location.pathname.split("/")?.[1];
553
+ let applicationName = getFormattedApplicationName(applicationURL);
554
+ if (applicationName === "workflow input center") {
555
+ applicationName = "Workflow Input Center";
556
+ }
557
+ let getApplicationMasterList = await getApplicationMaster();
558
+ localStorage.setItem("applicationCodesList", JSON.stringify(getApplicationMasterList?.data?.data));
559
+ finalApplicationCodesList = getApplicationMasterList?.data?.data;
560
+ finalApplicationCodesList?.forEach((app) => {
561
+ if (app.name === applicationName) {
562
+ finalApplicationCode = app.application_code;
563
+ }
564
+ });
565
+ }
566
+ return {
567
+ applicationCode: finalApplicationCode,
568
+ applicationCodesList: finalApplicationCodesList,
569
+ };
570
+ };
571
+ // Fetch base URL from tenant config – mirrors core/Utils/functions/utils.fetchBaseUrl exactly
572
+ const fetchBaseUrl = async () => {
573
+ try {
574
+ let { applicationCode } = await fetchApplicationCodeFromConfig();
575
+ let baseUrlData = await tenantConfigApiCache(applicationCode, {
576
+ attribute_name: "base_url",
577
+ })();
578
+ return baseUrlData?.data?.data?.[0]?.attribute_value?.value;
579
+ }
580
+ catch (error) {
581
+ console.error("fetchBaseUrl error", error);
582
+ return null;
583
+ }
584
+ };
585
+ // Fetch legacy agent screen flag – mirrors core/Utils/functions/utils.fetchLegacyAgentScreen exactly
586
+ const fetchLegacyAgentScreen = async () => {
587
+ try {
588
+ let { applicationCode } = await fetchApplicationCodeFromConfig();
589
+ let legacyAgentScreenData = await tenantConfigApiCache(applicationCode, {
590
+ attribute_name: "legacy_agent_screen",
591
+ })();
592
+ return legacyAgentScreenData?.data?.data?.[0]?.attribute_value?.value;
593
+ }
594
+ catch (error) {
595
+ console.error("fetchLegacyAgentScreen error", error);
596
+ return null;
597
+ }
598
+ };
86
599
  const resolveChatQuery = (body, flowType) => {
87
600
  try {
88
- return axiosInstance({
601
+ return httpRequest({
89
602
  url: `/core/chatbot/${flowType}`,
90
603
  method: "PUT",
91
604
  data: body,
@@ -98,7 +611,7 @@ const resolveChatQuery = (body, flowType) => {
98
611
  };
99
612
  const fetchRelatedQuestions = (flowType, screen_name) => {
100
613
  try {
101
- return axiosInstance({
614
+ return httpRequest({
102
615
  url: `/core/chatbot/${flowType}/question/${screen_name}`,
103
616
  method: "GET",
104
617
  });
@@ -110,7 +623,7 @@ const fetchRelatedQuestions = (flowType, screen_name) => {
110
623
  };
111
624
  const getAgentVisibilityData = () => {
112
625
  try {
113
- return tenantConfigActions.tenantConfigApiCache(3, {
626
+ return tenantConfigApiCache(3, {
114
627
  attribute_name: "show_agent_icon",
115
628
  })();
116
629
  }
@@ -120,7 +633,7 @@ const getAgentVisibilityData = () => {
120
633
  };
121
634
  const getHideNavbotData = async (applicationCode) => {
122
635
  try {
123
- let { data } = await tenantConfigActions.tenantConfigApiCache(applicationCode, {
636
+ let { data } = await tenantConfigApiCache(applicationCode, {
124
637
  attribute_name: "hide_navbot",
125
638
  })();
126
639
  return data?.data?.[0]?.attribute_value?.value;
@@ -132,7 +645,7 @@ const getHideNavbotData = async (applicationCode) => {
132
645
  };
133
646
  const getEnableMultiChatData = async (applicationCode) => {
134
647
  try {
135
- let { data } = await tenantConfigActions.tenantConfigApiCache(applicationCode, {
648
+ let { data } = await tenantConfigApiCache(applicationCode, {
136
649
  attribute_name: "enable_multi_chat",
137
650
  })();
138
651
  return data?.data?.[0]?.attribute_value?.value;
@@ -145,7 +658,7 @@ const getEnableMultiChatData = async (applicationCode) => {
145
658
  // Cloud-function base URL for the multi-chat history API, per client + env.
146
659
  const getMultiChatCfUrl = async (applicationCode) => {
147
660
  try {
148
- let { data } = await tenantConfigActions.tenantConfigApiCache(applicationCode, {
661
+ let { data } = await tenantConfigApiCache(applicationCode, {
149
662
  attribute_name: "agent_multi_chat_cf_url",
150
663
  })();
151
664
  return data?.data?.[0]?.attribute_value?.value;
@@ -157,7 +670,7 @@ const getMultiChatCfUrl = async (applicationCode) => {
157
670
  };
158
671
  const getAgentExceptionUserList = (applicationCode) => {
159
672
  try {
160
- return tenantConfigActions.tenantConfigApiCache(applicationCode, {
673
+ return tenantConfigApiCache(applicationCode, {
161
674
  attribute_name: "agent_exception_user_list",
162
675
  })();
163
676
  }
@@ -167,7 +680,7 @@ const getAgentExceptionUserList = (applicationCode) => {
167
680
  };
168
681
  const refreshAndUpdateUserManualApi = async (body) => {
169
682
  try {
170
- return axiosInstance({
683
+ return httpRequest({
171
684
  url: `core/chatbot/manualdoc`,
172
685
  method: "PUT",
173
686
  data: body,
@@ -180,7 +693,7 @@ const refreshAndUpdateUserManualApi = async (body) => {
180
693
  };
181
694
  const fetchScreensForModule = async (flowType) => {
182
695
  try {
183
- return axiosInstance({
696
+ return httpRequest({
184
697
  url: `core/chatbot/${flowType}/screen`,
185
698
  method: "GET",
186
699
  });
@@ -193,7 +706,7 @@ const fetchScreensForModule = async (flowType) => {
193
706
  // Like/Dislike Messages
194
707
  const likeDislikeComment = async (payload) => {
195
708
  try {
196
- return axiosInstance({
709
+ return httpRequest({
197
710
  url: `core/chatbot/analytics/like`,
198
711
  data: payload,
199
712
  method: "POST",
@@ -207,7 +720,7 @@ const likeDislikeComment = async (payload) => {
207
720
  // Like/Dislike Messages for agent
208
721
  const likeDislikeCommentForAgent = async (payload, baseUrl) => {
209
722
  try {
210
- return axiosInstance({
723
+ return httpRequest({
211
724
  url: `${baseUrl}/chatbot/agent/analytics/like`,
212
725
  data: payload,
213
726
  method: "POST",
@@ -220,7 +733,7 @@ const likeDislikeCommentForAgent = async (payload, baseUrl) => {
220
733
  };
221
734
  const fetchIntentApiResponse = async (input = "@apply_filter What is sales discount in cabezon mtd?") => {
222
735
  try {
223
- return axiosInstance({
736
+ return httpRequest({
224
737
  url: `core/chatbot/intent`,
225
738
  method: "POST",
226
739
  data: {
@@ -234,7 +747,7 @@ const fetchIntentApiResponse = async (input = "@apply_filter What is sales disco
234
747
  };
235
748
  const fetchAgentsInfo = async (baseUrl) => {
236
749
  try {
237
- return axiosInstance({
750
+ return httpRequest({
238
751
  url: `${baseUrl}/chatbot/agent/info`,
239
752
  method: 'GET'
240
753
  });
@@ -246,7 +759,7 @@ const fetchAgentsInfo = async (baseUrl) => {
246
759
  };
247
760
  const initiateAgent = async (payload, baseUrl) => {
248
761
  try {
249
- return axiosInstance({
762
+ return httpRequest({
250
763
  url: `${baseUrl}/chatbot/agent/init`,
251
764
  method: 'POST',
252
765
  data: payload,
@@ -259,7 +772,7 @@ const initiateAgent = async (payload, baseUrl) => {
259
772
  };
260
773
  const uploadFile = async (payload) => {
261
774
  try {
262
- return axiosInstance({
775
+ return httpRequest({
263
776
  url: `core/chatbot/upload/signed-url`,
264
777
  method: 'POST',
265
778
  data: payload,
@@ -270,33 +783,9 @@ const uploadFile = async (payload) => {
270
783
  return null;
271
784
  }
272
785
  };
273
- /** Saves a skill for the signed-in user: its SKILL.md and the files it refers to, each keyed by its path in
274
- * the skill's folder ({"SKILL.md": text, "references/x.md": text}). The agent checks it as its harness would
275
- * serve it and answers {name, version, characters, files, missing_files, trigger, trigger_said, turn_on}; a
276
- * skill it refuses is a 422 whose detail says why. Errors reach the caller, which shows them. */
277
- const uploadSkill = async (files, baseUrl) => {
278
- return axiosInstance({
279
- url: `${baseUrl}/chatbot/agent/skills`,
280
- method: 'POST',
281
- data: { files },
282
- });
283
- };
284
- /** Whether the agent takes skill uploads: its /info answer carries skills.upload beside the cards. Any
285
- * failure, or an agent that does not say so, is false (no "Upload Skill" item). */
286
- const fetchSkillUploadOn = async (baseUrl) => {
287
- try {
288
- const response = await fetchAgentsInfo(baseUrl);
289
- const body = response?.data || {};
290
- return body?.skills?.upload === true || body?.data?.skills?.upload === true;
291
- }
292
- catch (error) {
293
- console.error('fetchSkillUploadOn error:', error);
294
- return false;
295
- }
296
- };
297
786
  const triggerRefresh = async (baseUrl) => {
298
787
  try {
299
- return axiosInstance({
788
+ return httpRequest({
300
789
  url: `core/chatbot/trigger-refresh`,
301
790
  method: 'GET'
302
791
  });
@@ -308,7 +797,7 @@ const triggerRefresh = async (baseUrl) => {
308
797
  };
309
798
  const fetchChatbotFilterConfig = async () => {
310
799
  try {
311
- return axiosInstance({
800
+ return httpRequest({
312
801
  url: `core/filter/generic-schema-mapping?screen_name=Chatbot`,
313
802
  method: "GET",
314
803
  });
@@ -319,17 +808,30 @@ const fetchChatbotFilterConfig = async () => {
319
808
  }
320
809
  };
321
810
  const getFilterOptions = (postBody) => async () => {
322
- return axiosInstance({
811
+ return httpRequest({
323
812
  url: sessionStorage.getItem("crossFilterVersion") === "cross-filter-v4"
324
813
  ? COMBINED_CROSS_DIMENSIONAL_API_V4
325
- : api.COMBINED_CROSS_DIMENSIONAL_API,
814
+ : getApiConstants().COMBINED_CROSS_DIMENSIONAL_API,
326
815
  method: "POST",
327
816
  data: postBody,
328
817
  });
329
818
  };
819
+ const stopAgentFlow = async (payload, baseUrl) => {
820
+ try {
821
+ return httpRequest({
822
+ url: `${baseUrl}/chatbot/agent/stop`,
823
+ method: 'POST',
824
+ data: payload,
825
+ });
826
+ }
827
+ catch (error) {
828
+ console.error('stopAgentFlow error:', error);
829
+ return null;
830
+ }
831
+ };
330
832
  const getTableRecords = async (payload, baseUrl, tableName) => {
331
833
  try {
332
- return axiosInstance({
834
+ return httpRequest({
333
835
  url: `${baseUrl}/chatbot/agent/tabular-data/${tableName}`,
334
836
  method: 'POST',
335
837
  data: payload,
@@ -357,7 +859,7 @@ const postUiQuery = async (payload, baseUrl) => {
357
859
  };
358
860
  const getTableRecordsByUrl = async (payload, url) => {
359
861
  try {
360
- return axiosInstance({
862
+ return httpRequest({
361
863
  url: url,
362
864
  method: 'POST',
363
865
  data: payload,
@@ -367,22 +869,149 @@ const getTableRecordsByUrl = async (payload, url) => {
367
869
  console.error('getTableRecordsByUrl error:', error);
368
870
  return null;
369
871
  }
370
- };
872
+ };
873
+ // ─── Internalized from core/actions/userAccessActions.js ─────────────────────
874
+ // Previously injected via ChatbotProvider actions; now lives inside the package
875
+ // so consumers don't need to provide these functions.
876
+ /**
877
+ * convertAccessHierarchyToOldFormat — transforms the new module-level access
878
+ * response into the legacy format the chatbot code expects.
879
+ * Mirrors core/Utils/functions/utils.convertAccessHierarchyToOldFormat exactly.
880
+ */
881
+ const convertAccessHierarchyToOldFormat = (appModuleActions, accessHierarchy = []) => {
882
+ const result = {};
883
+ for (const [module, access] of Object.entries(appModuleActions)) {
884
+ const updatedAccess = Object.fromEntries(Object.entries(access).map(([key, value]) => [
885
+ key,
886
+ value === "limited" ? accessHierarchy : {},
887
+ ]));
888
+ result[module] = updatedAccess;
889
+ }
890
+ return result;
891
+ };
892
+ /**
893
+ * getUserAccessHierarchy — fetches the access hierarchy for an application.
894
+ * Mirrors core/actions/userAccessActions.getUserAccessHierarchy.
895
+ */
896
+ const getUserAccessHierarchy = (app) => {
897
+ return httpRequest({
898
+ url: GET_USER_APP_ACCESS_HIERARCHY,
899
+ method: "GET",
900
+ params: { app },
901
+ });
902
+ };
903
+ /**
904
+ * getModuleLevelAccessHelper — fetches module-level access permissions.
905
+ * Mirrors core/actions/userAccessActions.getModuleLevelAccessHelper.
906
+ */
907
+ const getModuleLevelAccessHelper = (app, modules) => {
908
+ const body = {
909
+ applications: {
910
+ [app]: modules,
911
+ },
912
+ };
913
+ return httpRequest({
914
+ url: GET_MODULE_LEVEL_ACCESS,
915
+ data: body,
916
+ method: "POST",
917
+ });
918
+ };
919
+ /**
920
+ * getModuleLevelAccessUtility — fetches both the access hierarchy and module
921
+ * permissions in parallel, then merges them into the legacy format.
922
+ * Mirrors core/actions/userAccessActions.getModuleLevelAccessUtility exactly.
923
+ *
924
+ * Unlike the original (which was a Redux thunk returning a function), this is
925
+ * a direct async function: `await getModuleLevelAccessUtility({...})`.
926
+ */
927
+ const getModuleLevelAccessUtility = async ({ app, module: modules, }) => {
928
+ const [hierarchyResponse, accessResponse] = await Promise.all([
929
+ getUserAccessHierarchy(app),
930
+ getModuleLevelAccessHelper(app, modules),
931
+ ]);
932
+ return convertAccessHierarchyToOldFormat(accessResponse?.data?.data[app], hierarchyResponse?.data?.data);
933
+ };
934
+ // ─── Internalized from core/actions/filterAction.js ──────────────────────────
935
+ /**
936
+ * getFilterUserConfiguration — fetches saved filter configurations for a screen.
937
+ * Mirrors core/actions/filterAction.getFilterUserConfiguration exactly.
938
+ *
939
+ * Unlike the original (which was a bare async function), the interface is the
940
+ * same: `const data = await getFilterUserConfiguration("Chatbot")`.
941
+ */
942
+ const getFilterUserConfiguration = async (screenName) => {
943
+ const { data } = await httpRequest({
944
+ url: `${SAVE_FILTER_GET}/${screenName}`,
945
+ method: "GET",
946
+ });
947
+ return data.data;
948
+ };
949
+
950
+ /**
951
+ * Stable default selector references used as fallbacks when the consumer
952
+ * does not provide selectors via the provider. Module-level constants
953
+ * avoid creating new function references on every render (which would
954
+ * cause useSelector to re-subscribe and potentially loop).
955
+ */
956
+ const NULL_SELECTOR = () => null;
957
+ const EMPTY_ARRAY_SELECTOR = () => [];
958
+ const ChatbotContext = React.createContext(null);
959
+ /**
960
+ * Wrap <SmartBot> with this provider to inject host-level dependencies
961
+ * (HTTP client, API constants, actions, selectors, heavy components).
962
+ *
963
+ * On mount (and whenever the value changes) the provider also initializes
964
+ * the module-level HTTP client singleton so that service files can call
965
+ * `getHttpClient()` / `httpRequest()` without prop-drilling.
966
+ *
967
+ * @example
968
+ * <ChatbotProvider value={{ httpClient: axiosInstance, apiConstants: { BASE_API, COMBINED_CROSS_DIMENSIONAL_API } }}>
969
+ * <SmartBot userName={userName} />
970
+ * </ChatbotProvider>
971
+ */
972
+ const ChatbotProvider = ({ value, children }) => {
973
+ // Eagerly initialize the HTTP singleton so even the very first render
974
+ // cycle of child components (which may trigger API calls in useEffect)
975
+ // has the client available.
976
+ if (value?.httpClient && value?.apiConstants) {
977
+ initHttpClient(value.httpClient, value.apiConstants);
978
+ }
979
+ // Also keep it in sync if the consumer swaps the value at runtime.
980
+ React.useEffect(() => {
981
+ if (value?.httpClient && value?.apiConstants) {
982
+ initHttpClient(value.httpClient, value.apiConstants);
983
+ }
984
+ }, [value?.httpClient, value?.apiConstants]);
985
+ return (jsxRuntime.jsx(ChatbotContext.Provider, { value: value, children: children }));
986
+ };
987
+ /**
988
+ * Hook consumed by internal package components to access host dependencies.
989
+ * Throws if called outside a <ChatbotProvider>.
990
+ */
991
+ function useChatbotDeps() {
992
+ const ctx = React.useContext(ChatbotContext);
993
+ if (!ctx) {
994
+ throw new Error("useChatbotDeps() must be used within a <ChatbotProvider>. " +
995
+ "Wrap your <SmartBot> component with <ChatbotProvider value={{...}}>.");
996
+ }
997
+ return ctx;
998
+ }
371
999
 
372
- const useBotConfiguration = (setRefreshLoader, setEnableRefreshAction, dispatch) => {
1000
+ const useBotConfiguration = (setRefreshLoader, setEnableRefreshAction) => {
1001
+ const { callbacks } = useChatbotDeps();
373
1002
  const displaySnackMessages = React.useCallback((message, variant) => {
374
1003
  try {
375
- dispatch(snackbarActions.addSnack({
376
- message: message,
377
- options: {
378
- variant: variant,
379
- },
380
- }));
1004
+ if (callbacks?.onSnackbar) {
1005
+ callbacks.onSnackbar(message, variant);
1006
+ }
1007
+ else {
1008
+ console.warn("onSnackbar callback not provided via ChatbotProvider");
1009
+ }
381
1010
  }
382
1011
  catch (error) {
383
1012
  console.error("displaySnackMessages error", error);
384
1013
  }
385
- }, [dispatch]);
1014
+ }, [callbacks]);
386
1015
  const refreshAndUpdateUserManual = React.useCallback(async () => {
387
1016
  try {
388
1017
  setRefreshLoader(true);
@@ -408,11 +1037,10 @@ const useBotConfiguration = (setRefreshLoader, setEnableRefreshAction, dispatch)
408
1037
  const configureBotActions = React.useCallback(async () => {
409
1038
  try {
410
1039
  const APP = "Workflow Input Center", MODULE = "Chatbot Module";
411
- let accessDataResponse = await userAccessActions.getModuleLevelAccessUtility({
1040
+ let accessDataResponse = await getModuleLevelAccessUtility({
412
1041
  app: APP,
413
1042
  module: [MODULE],
414
- skipHierarchyCall: true,
415
- })();
1043
+ });
416
1044
  let rolesBasedModulesPermission = Object.fromEntries(Object.entries(accessDataResponse).map(([module, actions]) => [
417
1045
  module,
418
1046
  Object.keys(actions),
@@ -532,10 +1160,30 @@ const updateQuestionFeedback = async (sessionId, isLiked) => {
532
1160
  return null;
533
1161
  }
534
1162
  };
1163
+ // PATCH /questions/{session_id} — persist how long a turn took.
1164
+ // All three fields are required; `duration` is an integer in milliseconds.
1165
+ const updateQuestionTiming = async (sessionId, { startTime, endTime, duration } = {}) => {
1166
+ try {
1167
+ return axios({
1168
+ url: `${getChatHistoryBaseUrl()}/questions/${sessionId}`,
1169
+ method: "PATCH",
1170
+ headers: { "Content-Type": "application/json" },
1171
+ data: {
1172
+ start_time: startTime,
1173
+ end_time: endTime,
1174
+ duration,
1175
+ },
1176
+ });
1177
+ }
1178
+ catch (error) {
1179
+ console.error("updateQuestionTiming error", error);
1180
+ return null;
1181
+ }
1182
+ };
535
1183
  const fetchConversations = async (currentMode) => {
536
1184
  try {
537
1185
  // Will be replaced with actual API call
538
- return axiosInstance({
1186
+ return httpRequest({
539
1187
  url: `core/chatbot/conversation/${currentMode}`,
540
1188
  method: "GET"
541
1189
  });
@@ -562,7 +1210,7 @@ const fetchConversations = async (currentMode) => {
562
1210
  };
563
1211
  const createConversation = async (payload) => {
564
1212
  try {
565
- return axiosInstance({
1213
+ return httpRequest({
566
1214
  url: `core/chatbot/conversation`,
567
1215
  method: "POST",
568
1216
  data: payload
@@ -575,7 +1223,7 @@ const createConversation = async (payload) => {
575
1223
  };
576
1224
  const updateConversation = async (conversationId, payload) => {
577
1225
  try {
578
- return axiosInstance({
1226
+ return httpRequest({
579
1227
  url: `core/chatbot/conversation/update`,
580
1228
  method: "POST",
581
1229
  data: payload
@@ -588,7 +1236,7 @@ const updateConversation = async (conversationId, payload) => {
588
1236
  };
589
1237
  const deleteConversation = async (conversationId) => {
590
1238
  try {
591
- return axiosInstance({
1239
+ return httpRequest({
592
1240
  url: `core/chatbot/conversation/${conversationId}`,
593
1241
  method: "DELETE"
594
1242
  });
@@ -600,7 +1248,7 @@ const deleteConversation = async (conversationId) => {
600
1248
  };
601
1249
  const saveChat = async (payload) => {
602
1250
  try {
603
- return axiosInstance({
1251
+ return httpRequest({
604
1252
  url: `core/chatbot/conversation`,
605
1253
  method: "POST",
606
1254
  data: payload
@@ -1122,363 +1770,94 @@ const getDynamicFunction = async (path, functionName) => {
1122
1770
  try {
1123
1771
  // Dynamic imports are resolved by the host application's bundler
1124
1772
  // The path should be relative to the host app's dynamic folder
1125
- const module = await import(/* webpackIgnore: true */ `dynamic/${path}`);
1126
- return module[functionName];
1127
- }
1128
- catch (error) {
1129
- console.error(`Error loading dynamic function ${functionName} from ${path}:`, error);
1130
- return null;
1131
- }
1132
- };
1133
- const generateConversationId = () => {
1134
- try {
1135
- return Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15);
1136
- }
1137
- catch (error) {
1138
- console.error("generateConversationId error", error);
1139
- return 0;
1140
- }
1141
- };
1142
- /**
1143
- * Generates a conversation object structure with empty messages array and current timestamp
1144
- * @returns {object} - The conversation object structure
1145
- */
1146
- const generateConversationObject = (conversationId) => {
1147
- try {
1148
- return {
1149
- id: conversationId,
1150
- name: `Conversation ${conversationId}`,
1151
- timestamp: new Date().toISOString(),
1152
- messages: [],
1153
- };
1154
- }
1155
- catch (error) {
1156
- console.error("generateConversationObject error", error);
1157
- return {
1158
- id: conversationId,
1159
- name: `Conversation ${conversationId}`,
1160
- timestamp: new Date().toISOString(),
1161
- messages: [],
1162
- };
1163
- }
1164
- };
1165
- /**
1166
- * Extracts userExplicitInput and textWithColumnNames from a saved filter set.
1167
- * @param {object} selectedFilterSet - The selected saved filter set object
1168
- * @param {string} userText - The user's input text (used to build textWithColumnNames)
1169
- * @param {object} existingExplicitInput - Optional existing userExplicitInput to merge with (e.g. from @ mentions)
1170
- * @returns {{ userExplicitInput: object, textWithColumnNames: string }}
1171
- */
1172
- const extractSavedFilterData = (selectedFilterSet, userText = "", existingExplicitInput = {}) => {
1173
- let userExplicitInput = { ...existingExplicitInput };
1174
- let textWithColumnNames = "";
1175
- if (!selectedFilterSet?.saved_filter_preference) {
1176
- return { userExplicitInput: existingExplicitInput, textWithColumnNames };
1177
- }
1178
- selectedFilterSet.saved_filter_preference.forEach((filter) => {
1179
- const attrName = filter.attribute_name;
1180
- if (!attrName)
1181
- return;
1182
- let filterValues = [];
1183
- if (Array.isArray(filter.values)) {
1184
- filter.values.forEach((v) => {
1185
- if (v && Array.isArray(v.values)) {
1186
- filterValues.push(...v.values.map(String));
1187
- }
1188
- else if (typeof v === "string" || typeof v === "number") {
1189
- filterValues.push(String(v));
1190
- }
1191
- });
1192
- }
1193
- if (filterValues.length > 0) {
1194
- if (userExplicitInput[attrName]) {
1195
- userExplicitInput[attrName] = [
1196
- ...new Set([...userExplicitInput[attrName], ...filterValues]),
1197
- ];
1198
- }
1199
- else {
1200
- userExplicitInput[attrName] = [...new Set(filterValues)];
1201
- }
1202
- const filterText = `${attrName}: ${filterValues.join(", ")}`;
1203
- textWithColumnNames = textWithColumnNames
1204
- ? `${filterText} ${textWithColumnNames}`
1205
- : `${filterText} ${userText}`;
1206
- }
1207
- });
1208
- // Ensure textWithColumnNames ends with the user's text
1209
- if (textWithColumnNames && !textWithColumnNames.includes(userText) && userText.trim()) {
1210
- textWithColumnNames = `${textWithColumnNames} ${userText}`.trim();
1211
- }
1212
- return { userExplicitInput, textWithColumnNames };
1213
- };
1214
-
1215
- // Special character mapping for text replacement
1216
- const SPECIAL_CHARACTER_MAPPING = {
1217
- __ia_char_01: "'",
1218
- __ia_char_02: '"',
1219
- __ia_char_03: "/",
1220
- __ia_char_04: "\\",
1221
- __ia_char_05: "`",
1222
- __ia_char_06: "~",
1223
- __ia_char_07: "!",
1224
- __ia_char_08: "@",
1225
- __ia_char_09: "#",
1226
- __ia_char_10: "$",
1227
- __ia_char_11: "%",
1228
- __ia_char_12: "^",
1229
- __ia_char_13: "&",
1230
- __ia_char_14: "*",
1231
- __ia_char_15: "(",
1232
- __ia_char_16: ")",
1233
- __ia_char_19: "=",
1234
- __ia_char_20: "+",
1235
- __ia_char_21: "{",
1236
- __ia_char_22: "}",
1237
- __ia_char_23: "[",
1238
- __ia_char_24: "]",
1239
- __ia_char_25: "|",
1240
- __ia_char_26: ":",
1241
- __ia_char_27: ";",
1242
- __ia_char_28: "<",
1243
- __ia_char_29: ">",
1244
- __ia_char_30: ",",
1245
- __ia_char_31: ".",
1246
- __ia_char_32: "?",
1247
- __ia_char_33: "/",
1248
- };
1249
- const navigationOptions = [
1250
- {
1251
- link: "/inventory-smart/decision-dashboard",
1252
- screen_name: "Dashboard",
1253
- flow_type: "navigation",
1254
- },
1255
- {
1256
- link: `/inventory-smart/create-allocation/?step=0`,
1257
- flow_type: "navigation",
1258
- screen_name: "Allocation",
1259
- },
1260
- {
1261
- link: "/inventory-smart/configuration",
1262
- flow_type: "navigation",
1263
- screen_name: "Configurations",
1264
- },
1265
- {
1266
- link: "/inventory-smart/store-eligibility-grouping",
1267
- flow_type: "navigation",
1268
- screen_name: "Grouping",
1269
- },
1270
- {
1271
- link: "/inventory-smart/constraints",
1272
- flow_type: "navigation",
1273
- screen_name: "Constraints",
1274
- },
1275
- {
1276
- link: "/inventory-smart/ada/dashboard",
1277
- flow_type: "navigation",
1278
- screen_name: "ADA Visual",
1279
- },
1280
- ];
1281
- const insightsOptions = [
1282
- {
1283
- link: "/inventory-smart/decision-dashboard",
1284
- screen_name: "Dashboard",
1285
- flow_type: "insights",
1286
- },
1287
- {
1288
- link: `/inventory-smart/create-allocation/?step=0`,
1289
- flow_type: "insights",
1290
- screen_name: "Allocation",
1291
- },
1292
- {
1293
- link: "/inventory-smart/store-eligibility-grouping",
1294
- flow_type: "insights",
1295
- screen_name: "Configurations",
1296
- },
1297
- {
1298
- link: "/inventory-smart/configuration",
1299
- flow_type: "insights",
1300
- screen_name: "Grouping",
1301
- },
1302
- {
1303
- link: "/inventory-smart/constraints",
1304
- flow_type: "insights",
1305
- screen_name: "Constraints",
1306
- },
1307
- {
1308
- link: "/inventory-smart/ada/dashboard",
1309
- flow_type: "insights",
1310
- screen_name: "ADA Visual",
1311
- },
1312
- ];
1313
- const screenOptions = [
1314
- {
1315
- link: "/inventory-smart/decision-dashboard",
1316
- screen_name: "InventoryDashboard",
1317
- filterCongfigurationName: "decisionDashboardFilterConfiguration",
1318
- },
1319
- {
1320
- link: "/inventory-smart/product-profile",
1321
- screen_name: "Product Profile",
1322
- filterCongfigurationName: "productProfileDashboardFilterConfig",
1323
- },
1324
- {
1325
- link: `/inventory-smart/create-allocation/?step=0`,
1326
- screen_name: "Allocation",
1327
- filterCongfigurationName: "createAllocationFilterConfiguration",
1328
- },
1329
- {
1330
- link: "/inventory-smart/store-eligibility-grouping",
1331
- screen_name: "Inventorysmart Store Eligibility Group",
1332
- filterCongfigurationName: "storeGroupingFilterConfiguration",
1333
- },
1334
- {
1335
- link: "/inventory-smart/configuration",
1336
- screen_name: "Inventorysmart Configurations",
1337
- filterCongfigurationName: "productStatusFilterConfiguration",
1338
- },
1339
- {
1340
- link: "/inventory-smart/constraints",
1341
- screen_name: "Inventorysmart Constraints",
1342
- filterCongfigurationName: "rulesConstraintsFilterConfig",
1343
- },
1344
- {
1345
- link: "/inventory-smart/allocation-reports",
1346
- screen_name: "Inventorysmart Reportings",
1347
- filterCongfigurationName: "lostSalesFilterConfiguration",
1348
- },
1349
- {
1350
- link: "/inventory-smart/ada/dashboard",
1351
- screen_name: "Inventorysmart ADA Dashboard",
1352
- filterCongfigurationName: "adaVisualFilterConfiguration",
1353
- },
1354
- ];
1355
-
1773
+ const module = await import(/* webpackIgnore: true */ `dynamic/${path}`);
1774
+ return module[functionName];
1775
+ }
1776
+ catch (error) {
1777
+ console.error(`Error loading dynamic function ${functionName} from ${path}:`, error);
1778
+ return null;
1779
+ }
1780
+ };
1781
+ const generateConversationId = () => {
1782
+ try {
1783
+ return Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15);
1784
+ }
1785
+ catch (error) {
1786
+ console.error("generateConversationId error", error);
1787
+ return 0;
1788
+ }
1789
+ };
1356
1790
  /**
1357
- * Core utility functions copied from core/Utils/functions/utils
1358
- * These are internalized to make chatbot-v2 self-contained
1791
+ * Generates a conversation object structure with empty messages array and current timestamp
1792
+ * @returns {object} - The conversation object structure
1359
1793
  */
1794
+ const generateConversationObject = (conversationId) => {
1795
+ try {
1796
+ return {
1797
+ id: conversationId,
1798
+ name: `Conversation ${conversationId}`,
1799
+ timestamp: new Date().toISOString(),
1800
+ messages: [],
1801
+ };
1802
+ }
1803
+ catch (error) {
1804
+ console.error("generateConversationObject error", error);
1805
+ return {
1806
+ id: conversationId,
1807
+ name: `Conversation ${conversationId}`,
1808
+ timestamp: new Date().toISOString(),
1809
+ messages: [],
1810
+ };
1811
+ }
1812
+ };
1360
1813
  /**
1361
- * Replace special characters in a string
1814
+ * Extracts userExplicitInput and textWithColumnNames from a saved filter set.
1815
+ * @param {object} selectedFilterSet - The selected saved filter set object
1816
+ * @param {string} userText - The user's input text (used to build textWithColumnNames)
1817
+ * @param {object} existingExplicitInput - Optional existing userExplicitInput to merge with (e.g. from @ mentions)
1818
+ * @returns {{ userExplicitInput: object, textWithColumnNames: string }}
1362
1819
  */
1363
- const replaceSpecialCharacter = (str) => {
1364
- if (typeof str === "object") {
1365
- return str;
1820
+ const extractSavedFilterData = (selectedFilterSet, userText = "", existingExplicitInput = {}) => {
1821
+ let userExplicitInput = { ...existingExplicitInput };
1822
+ let textWithColumnNames = "";
1823
+ if (!selectedFilterSet?.saved_filter_preference) {
1824
+ return { userExplicitInput: existingExplicitInput, textWithColumnNames };
1366
1825
  }
1367
- else {
1368
- let result = str;
1369
- if (SPECIAL_CHARACTER_MAPPING) {
1370
- Object.keys(SPECIAL_CHARACTER_MAPPING).forEach((key) => {
1371
- if (result?.includes(key)) {
1372
- result = result.replaceAll(key, SPECIAL_CHARACTER_MAPPING[key]);
1826
+ selectedFilterSet.saved_filter_preference.forEach((filter) => {
1827
+ const attrName = filter.attribute_name;
1828
+ if (!attrName)
1829
+ return;
1830
+ let filterValues = [];
1831
+ if (Array.isArray(filter.values)) {
1832
+ filter.values.forEach((v) => {
1833
+ if (v && Array.isArray(v.values)) {
1834
+ filterValues.push(...v.values.map(String));
1835
+ }
1836
+ else if (typeof v === "string" || typeof v === "number") {
1837
+ filterValues.push(String(v));
1373
1838
  }
1374
1839
  });
1375
1840
  }
1376
- return result;
1377
- }
1378
- };
1379
- /**
1380
- * @function
1381
- * @description Function is used to return string by replacing the special characters with respective key mapped to SPECIAL_CHARACTER_MAPPING
1382
- * @param {String} str
1383
- * @returns {String} key of mapped special character used in the string
1384
- */
1385
- const replaceSpecialCharToCharCode = (str) => {
1386
- let re = new RegExp(`[${Object.values(SPECIAL_CHARACTER_MAPPING).join("")}]`, "g");
1387
- return str.replace(re, function (matched) {
1388
- let code;
1389
- for (const [key, value] of Object.entries(SPECIAL_CHARACTER_MAPPING)) {
1390
- if (value === matched) {
1391
- code = key;
1392
- return code;
1841
+ if (filterValues.length > 0) {
1842
+ if (userExplicitInput[attrName]) {
1843
+ userExplicitInput[attrName] = [
1844
+ ...new Set([...userExplicitInput[attrName], ...filterValues]),
1845
+ ];
1846
+ }
1847
+ else {
1848
+ userExplicitInput[attrName] = [...new Set(filterValues)];
1393
1849
  }
1850
+ const filterText = `${attrName}: ${filterValues.join(", ")}`;
1851
+ textWithColumnNames = textWithColumnNames
1852
+ ? `${filterText} ${textWithColumnNames}`
1853
+ : `${filterText} ${userText}`;
1394
1854
  }
1395
- return code;
1396
- });
1397
- };
1398
-
1399
- /**
1400
- * Utility functions extracted from core/Utils/functions/utils.js
1401
- * Only includes functions used by chatbot-v2
1402
- */
1403
-
1404
- // Users listing endpoint (same as core's GET_USERS). Inlined here so this
1405
- // standalone package doesn't depend on the core user-management service.
1406
- const GET_USERS_URL = "/core/user-mgmt/list";
1407
-
1408
- // Convert pixels to rem
1409
- const pxToRem = (px) => `${px / 16}rem`;
1410
-
1411
- // Resolve the current user's code via the users API, matching the logged-in
1412
- // email (localStorage "name"). Mirrors core/Utils/functions/utils.getCurrentUserId
1413
- // so the multi-chat history APIs receive a real user_id (sessionStorage may not
1414
- // carry it in the standalone package host).
1415
- const getCurrentUserId = async () => {
1416
- try {
1417
- const postBody = {
1418
- meta: {
1419
- search: [],
1420
- range: [],
1421
- sort: [],
1422
- },
1423
- };
1424
- const users = await axiosInstance({
1425
- url: GET_USERS_URL,
1426
- method: "POST",
1427
- data: postBody,
1428
- });
1429
- const loggedInUserEmail = localStorage.getItem("name");
1430
- const user = users?.data?.data?.filter((item) => {
1431
- return item.email === loggedInUserEmail;
1432
1855
  });
1433
- return user[0]?.user_code;
1434
- } catch (error) {
1435
- console.error("getCurrentUserId error", error);
1436
- }
1437
- };
1438
-
1439
- // Get user name from session storage
1440
- const getUserName = () => {
1441
- const userDetails = JSON.parse(sessionStorage.getItem("userDetails") || "{}");
1442
- return userDetails?.user_name || "User";
1443
- };
1444
-
1445
- // Get formatted application name based on URL
1446
- const getFormattedApplicationName = (applicationURL) => {
1447
- switch (applicationURL) {
1448
- case "user-management":
1449
- case "tenantconfig":
1450
- return "application access management";
1451
- case "assort-smart":
1452
- return "AssortSmart";
1453
- case "configurator":
1454
- return "module configurator";
1455
- case "inventory-smart":
1456
- return "InventorySmart";
1457
- case "ada":
1458
- return "ADA";
1459
- case "plan-smart":
1460
- return "PlanSmart";
1461
- case "adaconfigurator":
1462
- return "ADAConfigurator";
1463
- case "item-smart":
1464
- return "ItemSmart";
1465
- case "item-smart-new":
1466
- return "ItemSmart-New";
1467
- case "source-smart":
1468
- return "SourceSmart";
1469
- case "pricesmart-markdown":
1470
- return "PriceSmart Markdown";
1471
- case "pricesmart-promo":
1472
- return "PriceSmart Promo";
1473
- case "agentic-assort":
1474
- return "AssortSmart";
1475
- case "source-smart":
1476
- return "SourceSmart"
1477
- case "size-smart":
1478
- return "SizeSmart"
1479
- default:
1480
- return "workflow input center";
1481
- }
1856
+ // Ensure textWithColumnNames ends with the user's text
1857
+ if (textWithColumnNames && !textWithColumnNames.includes(userText) && userText.trim()) {
1858
+ textWithColumnNames = `${textWithColumnNames} ${userText}`.trim();
1859
+ }
1860
+ return { userExplicitInput, textWithColumnNames };
1482
1861
  };
1483
1862
 
1484
1863
  /**
@@ -2514,12 +2893,12 @@ const useAgentFlow = (dateFormat, chatDataRef, currentMode, setShowChatPlacehold
2514
2893
  : chatbotContext[key]?.type === "number" ? Number(value) : value.toString();
2515
2894
  // Decode special characters for chat_input display
2516
2895
  if (isArray(value)) {
2517
- value = value.map((item) => replaceSpecialCharacter(item.toString()));
2896
+ value = value.map((item) => replaceSpecialCharacter$2(item.toString()));
2518
2897
  }
2519
2898
  else {
2520
- value = replaceSpecialCharacter(value.toString());
2899
+ value = replaceSpecialCharacter$2(value.toString());
2521
2900
  }
2522
- payload.chat_input = payload.chat_input + `${replaceSpecialCharacter(value)},`;
2901
+ payload.chat_input = payload.chat_input + `${replaceSpecialCharacter$2(value)},`;
2523
2902
  }
2524
2903
  }
2525
2904
  dispatch(setChatbotContext({}));
@@ -2663,7 +3042,72 @@ const useAgentFlow = (dateFormat, chatDataRef, currentMode, setShowChatPlacehold
2663
3042
  };
2664
3043
  };
2665
3044
 
3045
+ /**
3046
+ * SmartBot Redux action type constants.
3047
+ * These MUST match the consumer's core/actions/types.js values exactly
3048
+ * so actions dispatched by the package are handled by the host reducer.
3049
+ */
3050
+ const SET_SMART_BOT_ACTIVE = "SET_SMART_BOT_ACTIVE";
3051
+ const SET_IS_SMART_BOT_RESTRICTED = "SET_IS_SMART_BOT_RESTRICTED";
3052
+ const SET_CHATBOT_CONTEXT = "SET_CHATBOT_CONTEXT";
3053
+ const SET_THINKING_CONTEXT = "SET_THINKING_CONTEXT";
3054
+ const SET_HIERARCHY_KEY_VALUE_PAIR = "SET_HIERARCHY_KEY_VALUE_PAIR";
3055
+ const SET_CURRENT_AGENT_CHAT_ID = "SET_CURRENT_AGENT_CHAT_ID";
3056
+ const SET_PERSISTED_FORM_VALUES = "SET_PERSISTED_FORM_VALUES";
3057
+ const CLEAR_PERSISTED_FORM_VALUES = "CLEAR_PERSISTED_FORM_VALUES";
3058
+ const SET_SAVED_FILTER_SETS = "SET_SAVED_FILTER_SETS";
3059
+ const SET_STEP_FORM_RESTREAM_PAYLOAD = "SET_STEP_FORM_RESTREAM_PAYLOAD";
3060
+ const SET_STEP_FORM_STREAM_DATA = "SET_STEP_FORM_STREAM_DATA";
3061
+ const SET_MINIMIZED_STREAM_DATA = "SET_MINIMIZED_STREAM_DATA";
3062
+ const SET_CHATBOT_FILTER_OPTIONS = "SET_CHATBOT_FILTER_OPTIONS";
3063
+
3064
+ /**
3065
+ * SmartBot Redux action creators.
3066
+ * Each is a thunk `(value) => (dispatch) => dispatch({...})` matching the
3067
+ * consumer's core/actions/smartBotActions.js signatures exactly.
3068
+ */
3069
+ const setSmartBotActive = (value) => (dispatch) => {
3070
+ dispatch({ type: SET_SMART_BOT_ACTIVE, payload: value });
3071
+ };
3072
+ const setIsSmartBotRestricted = (value) => (dispatch) => {
3073
+ dispatch({ type: SET_IS_SMART_BOT_RESTRICTED, payload: value });
3074
+ };
3075
+ const setChatbotContext = (value) => (dispatch) => {
3076
+ dispatch({ type: SET_CHATBOT_CONTEXT, payload: value });
3077
+ };
3078
+ const setThinkingContext = (value) => (dispatch) => {
3079
+ dispatch({ type: SET_THINKING_CONTEXT, payload: value });
3080
+ };
3081
+ const setHierarchyKeyValue = (value) => (dispatch) => {
3082
+ dispatch({ type: SET_HIERARCHY_KEY_VALUE_PAIR, payload: value });
3083
+ };
3084
+ const setCurrentAgentChatId = (value) => (dispatch) => {
3085
+ dispatch({ type: SET_CURRENT_AGENT_CHAT_ID, payload: value });
3086
+ };
3087
+ const setPersistedFormValues = (value) => (dispatch) => {
3088
+ dispatch({ type: SET_PERSISTED_FORM_VALUES, payload: value });
3089
+ };
3090
+ const clearPersistedFormValues = () => (dispatch) => {
3091
+ dispatch({ type: CLEAR_PERSISTED_FORM_VALUES });
3092
+ };
3093
+ const setStepFormRestreamPayload = (value) => (dispatch) => {
3094
+ dispatch({ type: SET_STEP_FORM_RESTREAM_PAYLOAD, payload: value });
3095
+ };
3096
+ const setSavedFilterSets = (value) => (dispatch) => {
3097
+ dispatch({ type: SET_SAVED_FILTER_SETS, payload: value });
3098
+ };
3099
+ const setStepFormStreamData = (value) => (dispatch) => {
3100
+ dispatch({ type: SET_STEP_FORM_STREAM_DATA, payload: value });
3101
+ };
3102
+ const setMinimizedStreamData = (value) => (dispatch) => {
3103
+ dispatch({ type: SET_MINIMIZED_STREAM_DATA, payload: value });
3104
+ };
3105
+ const setChatbotFilterOptions = (value) => (dispatch) => {
3106
+ dispatch({ type: SET_CHATBOT_FILTER_OPTIONS, payload: value });
3107
+ };
3108
+
2666
3109
  const useChatFlow = (chatDataRef, setLoader, setFlowType, setScreenName, setUserInput, setQuestionIndex, setCurrentAppLink, flowType, screenName, questionIndex, userInput, dateFormat, currentMode, activeConversationId, setIsModuleChanged, chatBodyRef, filterReducerState, dispatch, navigate, setShowChatPlaceholder, baseUrl, setChatDataState, setCurrentSessionId, customChatConfig, chatDataInfoRef, chatbotContext, setInitValue, setSessionId, thinkingContent, setThinkingContent, isThinking, setIsThinking, chatId, setChatId, isStop, setIsStop, functionsRef, functionsState, setFunctionsState, thinkingHeaderMessage, setThinkingHeaderMessage, uniqueChatId, initValue, sessionId, fieldNumber, setFieldNumber, additionalArgs, setActiveConversationId, navSessionId, setNavSessionId, setUniqueChatId, setAdditionalArgs, answerMode) => {
3110
+ const { callbacks } = useChatbotDeps();
2667
3111
  const navSessionIdRef = React.useRef(navSessionId);
2668
3112
  React.useEffect(() => {
2669
3113
  navSessionIdRef.current = navSessionId;
@@ -2869,7 +3313,7 @@ const useChatFlow = (chatDataRef, setLoader, setFlowType, setScreenName, setUser
2869
3313
  // streamStartTime stays null here: processStream sets it, so a question
2870
3314
  // has exactly one start time (two would make the new header look like a
2871
3315
  // superseded one and freeze it at 0m:00s).
2872
- dispatch(smartBotActions.setThinkingContext({
3316
+ dispatch(setThinkingContext({
2873
3317
  thinkingContent: "",
2874
3318
  thinkingHeaderMessage: "Working for 0m:00s",
2875
3319
  streamStartTime: null,
@@ -2878,7 +3322,7 @@ const useChatFlow = (chatDataRef, setLoader, setFlowType, setScreenName, setUser
2878
3322
  }));
2879
3323
  prepareDataAndSendToAgent(data, false, {
2880
3324
  chatbotContext: chatbotContext,
2881
- setChatbotContext: smartBotActions.setChatbotContext,
3325
+ setChatbotContext: setChatbotContext,
2882
3326
  dispatch: dispatch,
2883
3327
  initValue: initValue,
2884
3328
  sessionId: sessionId,
@@ -3112,7 +3556,9 @@ const useChatFlow = (chatDataRef, setLoader, setFlowType, setScreenName, setUser
3112
3556
  });
3113
3557
  }
3114
3558
  for (const key in preSelectedFilters) {
3115
- dispatch(filterAction.setSelectedFilters({ [key]: preSelectedFilters[key] }));
3559
+ if (callbacks?.onSetSelectedFilters) {
3560
+ callbacks.onSetSelectedFilters({ [key]: preSelectedFilters[key] });
3561
+ }
3116
3562
  }
3117
3563
  for (const key in preSelectedFilters) {
3118
3564
  preSelectedFilters[key].forEach((selectedFilter) => {
@@ -3130,7 +3576,9 @@ const useChatFlow = (chatDataRef, setLoader, setFlowType, setScreenName, setUser
3130
3576
  filterConfig: updateFilterConfigData,
3131
3577
  appliedFilterData: appliedFilterData,
3132
3578
  };
3133
- dispatch(filterAction.setFilterConfiguration(obj));
3579
+ if (callbacks?.onSetFilterConfiguration) {
3580
+ callbacks.onSetFilterConfiguration(obj);
3581
+ }
3134
3582
  const applyFilterBtn = document.getElementById("filterBtn");
3135
3583
  setTimeout(() => {
3136
3584
  applyFilterBtn.click();
@@ -4060,19 +4508,6 @@ const useStyles$b = styles.makeStyles((theme) => ({
4060
4508
  fontSize: "14px",
4061
4509
  marginRight: "7px",
4062
4510
  },
4063
- userViewBlock: {
4064
- display: "inline-flex", // Automatically adjust width to fit content
4065
- alignSelf: "flex-end", // Align message bubble to the right
4066
- background: theme.palette.grey[300], // Grey background for the message bubble
4067
- padding: "0.75rem", // Padding around the message
4068
- borderRadius: "0.5rem",
4069
- marginBottom: "0.5rem",
4070
- maxWidth: "80%", // Cap the width for long messages
4071
- minWidth: "20%", // Ensure small messages like "Hi" take minimal space
4072
- wordWrap: "break-word", // Wrap long words or URLs
4073
- textAlign: "left",
4074
- width: "fit-content",
4075
- },
4076
4511
  firstRow: {
4077
4512
  display: "flex",
4078
4513
  alignItems: "center", // Align time and double ticks vertically
@@ -4108,9 +4543,6 @@ const useStyles$b = styles.makeStyles((theme) => ({
4108
4543
  fontSize: "14px",
4109
4544
  lineHeight: "21px",
4110
4545
  },
4111
- boldText: {
4112
- fontWeight: 600,
4113
- },
4114
4546
  combinedBlockHeaderTitle: {
4115
4547
  marginBottom: "0.5rem",
4116
4548
  },
@@ -4677,8 +5109,9 @@ const useChatState = () => {
4677
5109
  const [deleteOpen, setDeleteOpen] = React.useState(false);
4678
5110
  const [deleteTargetId, setDeleteTargetId] = React.useState(null);
4679
5111
  // Selectors
4680
- const filterReducerState = reactRedux.useSelector((state) => state.filterReducer);
4681
- const notificationData = reactRedux.useSelector((state) => state.notificationReducer.notificationData);
5112
+ const { selectors } = useChatbotDeps();
5113
+ const filterReducerState = reactRedux.useSelector(selectors?.getFilterState ?? NULL_SELECTOR);
5114
+ const notificationData = reactRedux.useSelector(selectors?.getNotificationData ?? EMPTY_ARRAY_SELECTOR);
4682
5115
  const chatbotContext = reactRedux.useSelector((state) => state.smartBotReducer.chatbotContext);
4683
5116
  const thinkingContext = reactRedux.useSelector((state) => state.smartBotReducer.thinkingContext);
4684
5117
  // All useRef declarations
@@ -5338,7 +5771,7 @@ const ChatPlaceholder = (props) => {
5338
5771
  });
5339
5772
  const getBaseUrl = async () => {
5340
5773
  try {
5341
- let basUrl = await utils.fetchBaseUrl();
5774
+ let basUrl = await fetchBaseUrl();
5342
5775
  setBaseUrl(basUrl);
5343
5776
  return basUrl;
5344
5777
  }
@@ -6005,7 +6438,7 @@ const AxiosSource = (url, opts, messageToStoreRef) => {
6005
6438
  let lastProcessedLength = 0;
6006
6439
  // Carry-over for partial SSE frames between progress events
6007
6440
  let carryOver = "";
6008
- axiosInstance({
6441
+ httpRequest({
6009
6442
  method: opts.method || "GET",
6010
6443
  url: url,
6011
6444
  headers: opts.headers,
@@ -6186,7 +6619,7 @@ const ButtonContent = ({ bodyText, isFormDisabled = false, isStepFormSubmit = fa
6186
6619
  }
6187
6620
  }
6188
6621
  }
6189
- dispatch(smartBotActions.setChatbotContext({}));
6622
+ dispatch(setChatbotContext({}));
6190
6623
  // Call the init API via SSE directly
6191
6624
  callInitApiStream(userInput);
6192
6625
  return;
@@ -6222,9 +6655,10 @@ const ButtonContent = ({ bodyText, isFormDisabled = false, isStepFormSubmit = fa
6222
6655
  messageStoreRef.current.initValue = false;
6223
6656
  stepFormStreamControl.initValue = false;
6224
6657
  }
6658
+ const { BASE_API } = getApiConstants();
6225
6659
  const endPoint = baseUrl
6226
- ? `${api.BASE_API}${baseUrl}/chatbot/agent/init`
6227
- : `${api.BASE_API}/core/chatbot/agent/init`;
6660
+ ? `${BASE_API}${baseUrl}/chatbot/agent/init`
6661
+ : `${BASE_API}/core/chatbot/agent/init`;
6228
6662
  // Collect all chunks, dispatch once when stream ends
6229
6663
  const chunksRef = [];
6230
6664
  // Expose stream control BEFORE Redux dispatch so SmartBot index.jsx can show stop icon
@@ -6238,12 +6672,12 @@ const ButtonContent = ({ bodyText, isFormDisabled = false, isStepFormSubmit = fa
6238
6672
  stepFormStreamControl.abort = null;
6239
6673
  // Stop the agent flow on the backend (same as StreamedContent.abortStreaming)
6240
6674
  if (sessionId) {
6241
- chatbotServices.stopAgentFlow({ session_id: sessionId }, baseUrl);
6675
+ stopAgentFlow({ session_id: sessionId }, baseUrl);
6242
6676
  }
6243
- dispatch(smartBotActions.setStepFormStreamData({ status: "error", chunks: [...chunksRef], sessionId }));
6677
+ dispatch(setStepFormStreamData({ status: "error", chunks: [...chunksRef], sessionId }));
6244
6678
  };
6245
6679
  // Signal that streaming has started (after setting stepFormStreamControl so useEffect sees the flag)
6246
- dispatch(smartBotActions.setStepFormStreamData({ status: "streaming_start", chunks: [], sessionId }));
6680
+ dispatch(setStepFormStreamData({ status: "streaming_start", chunks: [], sessionId }));
6247
6681
  // Fire DOM event so SmartBot can show stop icon (Redux gets cleared by TabularContent before parent effects run)
6248
6682
  window.dispatchEvent(new CustomEvent("stepFormStreamStart"));
6249
6683
  // Capture start time for computing elapsed on completion.
@@ -6253,7 +6687,7 @@ const ButtonContent = ({ bodyText, isFormDisabled = false, isStepFormSubmit = fa
6253
6687
  // Track the latest question for minimized widget updates
6254
6688
  let latestQuestionForMinimized = "Processing";
6255
6689
  // Update minimized widget to reflect new stream starting (clear step_form state)
6256
- dispatch(smartBotActions.setMinimizedStreamData({
6690
+ dispatch(setMinimizedStreamData({
6257
6691
  isStreaming: true,
6258
6692
  stepHeader: "Thinking",
6259
6693
  stepSubHeader: "Working on the next step...",
@@ -6288,17 +6722,17 @@ const ButtonContent = ({ bodyText, isFormDisabled = false, isStepFormSubmit = fa
6288
6722
  chunksRef.push(data);
6289
6723
  // Dispatch step/step_form/questions/widget chunks immediately for real-time rendering
6290
6724
  if (data?.status === "widget") {
6291
- dispatch(smartBotActions.setStepFormStreamData({ status: "widget_chunk", chunks: [data], sessionId }));
6725
+ dispatch(setStepFormStreamData({ status: "widget_chunk", chunks: [data], sessionId }));
6292
6726
  }
6293
6727
  else if (data?.status === "step" || data?.status === "step_form" || data?.status === "questions") {
6294
- dispatch(smartBotActions.setStepFormStreamData({ status: "step_chunk", chunks: [data], sessionId }));
6728
+ dispatch(setStepFormStreamData({ status: "step_chunk", chunks: [data], sessionId }));
6295
6729
  }
6296
6730
  // Update minimized widget with latest step data
6297
6731
  if (data?.status === "questions") {
6298
6732
  const intent = data?.current_intent || data?.widget_data?.[0]?.current_intent;
6299
6733
  if (intent)
6300
6734
  latestQuestionForMinimized = intent;
6301
- dispatch(smartBotActions.setMinimizedStreamData({
6735
+ dispatch(setMinimizedStreamData({
6302
6736
  isStreaming: true,
6303
6737
  stepHeader: latestQuestionForMinimized,
6304
6738
  stepSubHeader: "Working on the next step...",
@@ -6312,7 +6746,7 @@ const ButtonContent = ({ bodyText, isFormDisabled = false, isStepFormSubmit = fa
6312
6746
  const intent = data?.current_intent || stepData?.current_intent;
6313
6747
  if (intent)
6314
6748
  latestQuestionForMinimized = intent;
6315
- dispatch(smartBotActions.setMinimizedStreamData({
6749
+ dispatch(setMinimizedStreamData({
6316
6750
  isStreaming: true,
6317
6751
  stepHeader: latestQuestionForMinimized,
6318
6752
  stepSubHeader: stepData?.sub_header || stepData?.header || "Processing...",
@@ -6326,7 +6760,7 @@ const ButtonContent = ({ bodyText, isFormDisabled = false, isStepFormSubmit = fa
6326
6760
  const intent = data?.current_intent || stepData?.current_intent;
6327
6761
  if (intent)
6328
6762
  latestQuestionForMinimized = intent;
6329
- dispatch(smartBotActions.setMinimizedStreamData({
6763
+ dispatch(setMinimizedStreamData({
6330
6764
  isStreaming: true,
6331
6765
  stepHeader: latestQuestionForMinimized,
6332
6766
  stepSubHeader: "Waiting for your response",
@@ -6340,7 +6774,7 @@ const ButtonContent = ({ bodyText, isFormDisabled = false, isStepFormSubmit = fa
6340
6774
  stepFormStreamControl.isStreaming = false;
6341
6775
  stepFormStreamControl.abort = null;
6342
6776
  window.dispatchEvent(new CustomEvent("stepFormStreamEnd"));
6343
- dispatch(smartBotActions.setStepFormStreamData({ status: "done", chunks: [...chunksRef], sessionId }));
6777
+ dispatch(setStepFormStreamData({ status: "done", chunks: [...chunksRef], sessionId }));
6344
6778
  }
6345
6779
  }
6346
6780
  else if (data?.status === "completed" || data?.status === "follow-up" || data?.message === "[DONE]") {
@@ -6353,7 +6787,7 @@ const ButtonContent = ({ bodyText, isFormDisabled = false, isStepFormSubmit = fa
6353
6787
  // Extract widget_data from completed/[DONE] chunks (e.g. graph widgets)
6354
6788
  if (!isEmpty$1(data?.widget_data)) {
6355
6789
  chunksRef.push({ ...data, status: "widget" });
6356
- dispatch(smartBotActions.setStepFormStreamData({
6790
+ dispatch(setStepFormStreamData({
6357
6791
  status: "widget_chunk",
6358
6792
  chunks: [{ ...data, status: "widget" }],
6359
6793
  sessionId,
@@ -6361,7 +6795,7 @@ const ButtonContent = ({ bodyText, isFormDisabled = false, isStepFormSubmit = fa
6361
6795
  }
6362
6796
  // Clear minimized widget on completion
6363
6797
  if (data?.status === "completed") {
6364
- dispatch(smartBotActions.setMinimizedStreamData(null));
6798
+ dispatch(setMinimizedStreamData(null));
6365
6799
  }
6366
6800
  // Update messageStoreRef the same way AxiosEventSource does for completed/follow-up
6367
6801
  if (data?.status === "completed" || data?.status === "follow-up") {
@@ -6391,7 +6825,7 @@ const ButtonContent = ({ bodyText, isFormDisabled = false, isStepFormSubmit = fa
6391
6825
  const sfMin = Math.floor(totalElapsed / 60);
6392
6826
  const sfSec = totalElapsed % 60;
6393
6827
  const sfWorkedLabel = `Completed in ${sfMin}m:${String(sfSec).padStart(2, '0')}s`;
6394
- dispatch(smartBotActions.setThinkingContext({
6828
+ dispatch(setThinkingContext({
6395
6829
  streamStartTime: originalStartTime,
6396
6830
  isStreamCompleted: true,
6397
6831
  finalElapsedSeconds: totalElapsed,
@@ -6404,7 +6838,7 @@ const ButtonContent = ({ bodyText, isFormDisabled = false, isStepFormSubmit = fa
6404
6838
  if (turnSessionId) {
6405
6839
  const endMs = Date.now();
6406
6840
  const durationMs = Math.max(0, Math.round(endMs - originalStartTime));
6407
- conversationService.updateQuestionTiming(turnSessionId, {
6841
+ updateQuestionTiming(turnSessionId, {
6408
6842
  startTime: new Date(originalStartTime).toISOString(),
6409
6843
  endTime: new Date(endMs).toISOString(),
6410
6844
  duration: durationMs,
@@ -6417,7 +6851,7 @@ const ButtonContent = ({ bodyText, isFormDisabled = false, isStepFormSubmit = fa
6417
6851
  if (data?.status === "completed" && !hasStepForm) {
6418
6852
  window.dispatchEvent(new CustomEvent("stepFormStreamCompleted"));
6419
6853
  }
6420
- dispatch(smartBotActions.setStepFormStreamData({ status: "done", chunks: [...chunksRef], sessionId }));
6854
+ dispatch(setStepFormStreamData({ status: "done", chunks: [...chunksRef], sessionId }));
6421
6855
  }
6422
6856
  else if (data?.message) {
6423
6857
  chunksRef.push({ status: "content", message: data.message });
@@ -6436,7 +6870,7 @@ const ButtonContent = ({ bodyText, isFormDisabled = false, isStepFormSubmit = fa
6436
6870
  // Check if we can auto-retry (abrupt close or 503, but not user abort)
6437
6871
  if (!isUserAbort && retryCountRef.current < MAX_RETRY_COUNT_BUTTON) {
6438
6872
  // Dispatch a "retrying" status so TabularContent can show countdown UI
6439
- dispatch(smartBotActions.setStepFormStreamData({ status: "retrying", chunks: [...chunksRef], sessionId, countdown: RETRY_COUNTDOWN_SECONDS_BUTTON }));
6873
+ dispatch(setStepFormStreamData({ status: "retrying", chunks: [...chunksRef], sessionId, countdown: RETRY_COUNTDOWN_SECONDS_BUTTON }));
6440
6874
  // Start countdown and auto-retry
6441
6875
  let countdown = RETRY_COUNTDOWN_SECONDS_BUTTON;
6442
6876
  retryTimerRef.current = setInterval(() => {
@@ -6450,14 +6884,14 @@ const ButtonContent = ({ bodyText, isFormDisabled = false, isStepFormSubmit = fa
6450
6884
  }
6451
6885
  else {
6452
6886
  // Update countdown in Redux for UI
6453
- dispatch(smartBotActions.setStepFormStreamData({ status: "retrying", chunks: [...chunksRef], sessionId, countdown }));
6887
+ dispatch(setStepFormStreamData({ status: "retrying", chunks: [...chunksRef], sessionId, countdown }));
6454
6888
  }
6455
6889
  }, 1000);
6456
6890
  }
6457
6891
  else {
6458
6892
  // Retries exhausted or user-aborted — show final message
6459
6893
  chunksRef.push({ status: "content", message: "Please reach out to IA for this, as this didn't work even after retry" });
6460
- dispatch(smartBotActions.setStepFormStreamData({ status: "error", chunks: [...chunksRef], sessionId }));
6894
+ dispatch(setStepFormStreamData({ status: "error", chunks: [...chunksRef], sessionId }));
6461
6895
  }
6462
6896
  });
6463
6897
  sourceRef.current.addEventListener("close", () => {
@@ -6466,7 +6900,7 @@ const ButtonContent = ({ bodyText, isFormDisabled = false, isStepFormSubmit = fa
6466
6900
  stepFormStreamControl.abort = null;
6467
6901
  window.dispatchEvent(new CustomEvent("stepFormStreamEnd"));
6468
6902
  if (retryCountRef.current < MAX_RETRY_COUNT_BUTTON) {
6469
- dispatch(smartBotActions.setStepFormStreamData({ status: "retrying", chunks: [...chunksRef], sessionId, countdown: RETRY_COUNTDOWN_SECONDS_BUTTON }));
6903
+ dispatch(setStepFormStreamData({ status: "retrying", chunks: [...chunksRef], sessionId, countdown: RETRY_COUNTDOWN_SECONDS_BUTTON }));
6470
6904
  let countdown = RETRY_COUNTDOWN_SECONDS_BUTTON;
6471
6905
  retryTimerRef.current = setInterval(() => {
6472
6906
  countdown -= 1;
@@ -6477,25 +6911,813 @@ const ButtonContent = ({ bodyText, isFormDisabled = false, isStepFormSubmit = fa
6477
6911
  callInitApiStream(retryPayloadRef.current);
6478
6912
  }
6479
6913
  else {
6480
- dispatch(smartBotActions.setStepFormStreamData({ status: "retrying", chunks: [...chunksRef], sessionId, countdown }));
6914
+ dispatch(setStepFormStreamData({ status: "retrying", chunks: [...chunksRef], sessionId, countdown }));
6481
6915
  }
6482
6916
  }, 1000);
6483
6917
  }
6484
6918
  else {
6485
- chunksRef.push({ status: "content", message: "Please reach out to IA for this, as this didn't work even after retry" });
6486
- dispatch(smartBotActions.setStepFormStreamData({ status: "error", chunks: [...chunksRef], sessionId }));
6919
+ chunksRef.push({ status: "content", message: "Please reach out to IA for this, as this didn't work even after retry" });
6920
+ dispatch(setStepFormStreamData({ status: "error", chunks: [...chunksRef], sessionId }));
6921
+ }
6922
+ }
6923
+ });
6924
+ };
6925
+ const renderButtons = () => {
6926
+ if (!Array.isArray(bodyText.buttons)) {
6927
+ return null;
6928
+ }
6929
+ return bodyText.buttons.map((button, index) => (jsxRuntime.jsx("div", { children: jsxRuntime.jsx(impactUiV3.Button, { variant: button.variant || "primary", size: button.size || "medium", onClick: () => handleButtonClick(), disabled: button.disabled || isFormDisabled || (isStepFormSubmit && !isFormValid), className: button.className, icon: button.icon, iconPlacement: button.iconPlacement || "left", children: button.label }) }, index)));
6930
+ };
6931
+ return (jsxRuntime.jsxs("div", { className: classes.buttonContainer, children: [bodyText.message && (jsxRuntime.jsx("div", { className: classes.message, children: bodyText.message })), jsxRuntime.jsx("div", { className: classes.buttonRow, children: renderButtons() })] }));
6932
+ };
6933
+
6934
+ // AG Grid Enterprise License Key
6935
+ const AG_GRID_V36_LICENCE_KEY = "Using_this_{AG_Grid}_Enterprise_key_{AG-082017}_in_excess_of_the_licence_granted_is_not_permitted___Please_report_misuse_to_legal@ag-grid.com___For_help_with_changing_this_key_please_contact_info@ag-grid.com___{Impact_Analytics}_is_granted_a_{Multiple_Applications}_Developer_License_for_{1}_Front-End_JavaScript_developer___All_Front-End_JavaScript_developers_need_to_be_licensed_in_addition_to_the_ones_working_with_{AG_Grid}_Enterprise___This_key_has_not_been_granted_a_Deployment_License_Add-on___This_key_works_with_{AG_Grid}_Enterprise_versions_released_before_{28_February_2027}____[v3]_[01]_MTgwMzc3MjgwMDAwMA==d3fb103fa88b52d1f7ad90bf7e94f9a5";
6936
+ // Default decimal rounding
6937
+ const DEFAULT_ROUNDOFF = 2;
6938
+ // Column types that should not be rounded
6939
+ const IGNORE_ROUNDOFF = ["int"];
6940
+
6941
+ const modules = [
6942
+ agGridEnterprise.AllEnterpriseModule,
6943
+ agGridCommunity.ClientSideRowModelModule,
6944
+ agGridEnterprise.ServerSideRowModelModule,
6945
+ agGridCommunity.ValidationModule,
6946
+ ];
6947
+ // ─── Local State ────────────────────────────────────────────────────────────
6948
+ const ACTIONS = {
6949
+ SET_AGGRID_STATE: "SET_AGGRID_STATE",
6950
+ SET_CLIENT_SIDE_TABLE_DATA: "SET_CLIENT_SIDE_TABLE_DATA",
6951
+ SET_PAGINATION_ENABLED: "SET_PAGINATION_ENABLED",
6952
+ };
6953
+ const initialState = {
6954
+ agGrid: {},
6955
+ clientSideTableData: [],
6956
+ paginationEnabled: true,
6957
+ };
6958
+ const agGridReducer = (state, action) => {
6959
+ switch (action.type) {
6960
+ case ACTIONS.SET_AGGRID_STATE:
6961
+ return { ...state, agGrid: action.payload };
6962
+ case ACTIONS.SET_CLIENT_SIDE_TABLE_DATA:
6963
+ return { ...state, clientSideTableData: action.payload };
6964
+ case ACTIONS.SET_PAGINATION_ENABLED:
6965
+ return { ...state, paginationEnabled: action.payload };
6966
+ default:
6967
+ return state;
6968
+ }
6969
+ };
6970
+ // ─── Server-Side Datasource ─────────────────────────────────────────────────
6971
+ const createServerSideDatasource = (config) => ({
6972
+ getRows: async (params) => {
6973
+ const { cacheBlockSize, manualCallBackRef } = config;
6974
+ try {
6975
+ const { startRow, sortModel, filterModel } = params.request;
6976
+ const page = Math.floor(startRow / cacheBlockSize);
6977
+ // Build a simple meta payload with sort and search info
6978
+ const meta = { search: [], range: [], sort: [] };
6979
+ if (sortModel?.length) {
6980
+ meta.sort = sortModel.map((s) => ({
6981
+ column: s.colId,
6982
+ order: s.sort,
6983
+ }));
6984
+ }
6985
+ const manualCallBack = manualCallBackRef.current;
6986
+ if (!manualCallBack) {
6987
+ params.fail();
6988
+ return;
6989
+ }
6990
+ const paginatedRows = await manualCallBack(meta, page, params);
6991
+ if (!paginatedRows?.data?.length) {
6992
+ if (params.request.startRow === 0) {
6993
+ params.api.showNoRowsOverlay();
6994
+ }
6995
+ params.success({ rowData: [], rowCount: startRow });
6996
+ return;
6997
+ }
6998
+ params.api.hideOverlay();
6999
+ const rowCount = paginatedRows.data.length < cacheBlockSize
7000
+ ? startRow + paginatedRows.data.length
7001
+ : paginatedRows.totalCount;
7002
+ params.success({ rowData: paginatedRows.data, rowCount });
7003
+ }
7004
+ catch (error) {
7005
+ console.error("Server-side datasource error:", error);
7006
+ params.fail();
7007
+ }
7008
+ },
7009
+ });
7010
+ // ─── Component ──────────────────────────────────────────────────────────────
7011
+ const AgGridComponent = (props) => {
7012
+ const {
7013
+ // Data
7014
+ rowModelType = "clientSide", cacheBlockSize, serverSideStoreType,
7015
+ // Selection
7016
+ onSelectionChanged,
7017
+ // ─── Impact UI / Custom Props ───
7018
+ customClass = "",
7019
+ // Callbacks
7020
+ selectAllHeaderComponent, uniqueRowId, manualCallBack,
7021
+ // Sizing
7022
+ sizeColumnsToFitFlag = false, } = props;
7023
+ const [localState, localDispatch] = React.useReducer(agGridReducer, initialState);
7024
+ const manualCallBackRef = React.useRef(manualCallBack);
7025
+ manualCallBackRef.current = manualCallBack;
7026
+ const setPaginationEnabled = React.useCallback((shouldEnable) => localDispatch({
7027
+ type: ACTIONS.SET_PAGINATION_ENABLED,
7028
+ payload: shouldEnable,
7029
+ }), []);
7030
+ // Default column definition
7031
+ const defaultColDef = React.useMemo(() => ({
7032
+ resizable: true,
7033
+ sortable: false,
7034
+ minWidth: 150,
7035
+ wrapText: false,
7036
+ autoHeight: false,
7037
+ }), []);
7038
+ // Grid options for row selection
7039
+ const gridOptions = React.useMemo(() => {
7040
+ const opts = {};
7041
+ if (selectAllHeaderComponent) {
7042
+ opts.rowSelection = {
7043
+ mode: "multiRow",
7044
+ groupSelects: "self",
7045
+ checkboxes: true,
7046
+ };
7047
+ opts.selectionColumnDef = {
7048
+ pinned: "left",
7049
+ suppressSizeToFit: true,
7050
+ lockPosition: "left",
7051
+ suppressHeaderMenuButton: true,
7052
+ minWidth: 56,
7053
+ maxWidth: 56,
7054
+ cellStyle: { display: "flex" },
7055
+ headerClass: "ag-selection-column-header",
7056
+ };
7057
+ }
7058
+ // When no selectAllHeaderComponent, don't set rowSelection at all
7059
+ // — AG Grid will default to no selection column
7060
+ return opts;
7061
+ }, [selectAllHeaderComponent]);
7062
+ // Server-side datasource
7063
+ const datasource = React.useMemo(() => {
7064
+ if (!rowModelType || rowModelType === "clientSide")
7065
+ return undefined;
7066
+ if (rowModelType === "serverSide") {
7067
+ return createServerSideDatasource({
7068
+ cacheBlockSize: cacheBlockSize || 100,
7069
+ manualCallBackRef,
7070
+ });
7071
+ }
7072
+ return undefined;
7073
+ }, [rowModelType, cacheBlockSize]);
7074
+ // Process columns
7075
+ const processedColumns = React.useMemo(() => {
7076
+ try {
7077
+ if (lodash.isEmpty(props.columns))
7078
+ return [];
7079
+ return lodash.cloneDeep(props.columns);
7080
+ }
7081
+ catch (error) {
7082
+ console.error("Error processing columns:", error);
7083
+ return [];
7084
+ }
7085
+ }, [props.columns]);
7086
+ // Update client-side data when rowdata changes
7087
+ React.useEffect(() => {
7088
+ if (lodash.isEmpty(props.rowdata) && lodash.isEmpty(localState?.clientSideTableData))
7089
+ return;
7090
+ localDispatch({
7091
+ type: ACTIONS.SET_CLIENT_SIDE_TABLE_DATA,
7092
+ payload: props.rowdata ?? [],
7093
+ });
7094
+ if (props?.pagination === true) {
7095
+ const pageSize = props?.paginationPageSize || 10;
7096
+ const shouldEnable = (props.rowdata?.length || 0) > pageSize;
7097
+ if (shouldEnable !== localState.paginationEnabled) {
7098
+ setPaginationEnabled(shouldEnable);
7099
+ }
7100
+ }
7101
+ }, [props.rowdata]);
7102
+ // Export to Excel handler
7103
+ const handleExportToExcel = () => {
7104
+ const api = localState.agGrid?.api;
7105
+ if (!api)
7106
+ return;
7107
+ api.exportDataAsExcel();
7108
+ };
7109
+ // Build customSystemButton with download
7110
+ const resolvedCustomSystemButton = React.useMemo(() => {
7111
+ // If props.customSystemButton is provided, use it directly
7112
+ // The parent (TableContent) already builds the full JSX
7113
+ return props.customSystemButton || null;
7114
+ }, [props.customSystemButton]);
7115
+ return (jsxRuntime.jsx(agGridReact.AgGridProvider, { modules: modules, licenseKey: AG_GRID_V36_LICENCE_KEY, children: jsxRuntime.jsx("div", { className: classNames("core-ag-theme-alpine", customClass), children: jsxRuntime.jsx(TableV36.TableV36
7116
+ // AG Grid Props
7117
+ , {
7118
+ // AG Grid Props
7119
+ columnDefs: processedColumns, rowData: !rowModelType || rowModelType === "clientSide"
7120
+ ? localState?.clientSideTableData
7121
+ : undefined, serverSideDatasource: rowModelType === "serverSide" ? datasource : null, tableHeader: props?.tableHeader ?? null, pagination: props?.pagination === false ? false : localState.paginationEnabled, domLayout: props?.domLayout ?? "autoHeight", animateRows: false, suppressFieldDotNotation: props?.suppressFieldDotNotation ?? false, paginationPageSizeSelector: props?.paginationPageSize
7122
+ ? [props.paginationPageSize]
7123
+ : [10, 20], suppressColumnMoveAnimation: true, onGridReady: (params) => {
7124
+ localDispatch({
7125
+ type: ACTIONS.SET_AGGRID_STATE,
7126
+ payload: params,
7127
+ });
7128
+ }, onFirstDataRendered: (params) => {
7129
+ if (sizeColumnsToFitFlag) {
7130
+ params.api.sizeColumnsToFit();
7131
+ }
7132
+ }, onSelectionChanged: (event) => {
7133
+ if (onSelectionChanged && typeof onSelectionChanged === "function") {
7134
+ onSelectionChanged(event);
7135
+ }
7136
+ }, onGridSizeChanged: (params) => {
7137
+ if (sizeColumnsToFitFlag) {
7138
+ params.api.sizeColumnsToFit();
7139
+ }
7140
+ }, getRowId: uniqueRowId
7141
+ ? (params) => String(params.data?.[uniqueRowId] ?? "")
7142
+ : undefined, rowModelType: rowModelType, cacheBlockSize: cacheBlockSize, serverSideStoreType: serverSideStoreType, tooltipShowMode: "whenTruncated", enableBrowserTooltips: false,
7143
+ // Core props
7144
+ defaultColDef: defaultColDef, ...gridOptions,
7145
+ // Impact UI Props
7146
+ hideTableSetting: props?.hideTableSetting ?? false, topRightOptions: props?.topRightOptions ?? null, customSystemButton: resolvedCustomSystemButton, hideTableActions: props?.hideTableActions ?? false, isSaveViewEnabled: props?.isSaveViewEnabled ?? false, hidePaginationPageSizeSelector: true, hideRowHeightOptionMenu: true, enableHeaderTextWrap: true, hideTableFormat: true, hideMarginBottom: true, cardContainer: true, showDownloadButton: props?.downloadAsExcel && !props?.customSystemButton, onDownloadButtonClick: handleExportToExcel }) }) }));
7147
+ };
7148
+
7149
+ // ─── Number Formatter Cache ─────────────────────────────────────────────────
7150
+ const formatCache = new Map();
7151
+ const getNumberFormatter = (minimumFractionDigits = DEFAULT_ROUNDOFF, maximumFractionDigits = DEFAULT_ROUNDOFF, p_instance) => {
7152
+ if (IGNORE_ROUNDOFF?.includes(p_instance?.colDef?.type)) {
7153
+ return new Intl.NumberFormat("en-US");
7154
+ }
7155
+ const cacheKey = `${minimumFractionDigits}-${maximumFractionDigits}`;
7156
+ if (!formatCache.has(cacheKey)) {
7157
+ formatCache.set(cacheKey, new Intl.NumberFormat("en-US", {
7158
+ minimumFractionDigits,
7159
+ maximumFractionDigits,
7160
+ }));
7161
+ }
7162
+ return formatCache.get(cacheKey);
7163
+ };
7164
+ // ─── Formatting Functions ───────────────────────────────────────────────────
7165
+ const numbersWithComma = (value, roundOffTo, disableCommaFormatting = false, displayBlank = false) => {
7166
+ const nf = getNumberFormatter(roundOffTo, roundOffTo, value);
7167
+ if (value?.value === "-" || value?.value === null) {
7168
+ if (displayBlank)
7169
+ return "";
7170
+ else
7171
+ return "-";
7172
+ }
7173
+ else if (disableCommaFormatting) {
7174
+ return value?.value || "";
7175
+ }
7176
+ else if (value?.value) {
7177
+ if (Number.isInteger(value?.value)) {
7178
+ let tempValue = parseInt(value?.value) > -1 ? Math.abs(value?.value) : value?.value;
7179
+ return nf.format(tempValue);
7180
+ }
7181
+ else {
7182
+ let replaceCommaValue = (value?.value).toString().replace(",", "");
7183
+ let tempValue = parseFloat(replaceCommaValue) > -1
7184
+ ? Math.abs(replaceCommaValue)
7185
+ : replaceCommaValue;
7186
+ if (roundOffTo > 0) {
7187
+ return nf.format(Number.parseFloat(tempValue).toFixed(roundOffTo));
7188
+ }
7189
+ else {
7190
+ return nf.format(Math.round(tempValue));
7191
+ }
7192
+ }
7193
+ }
7194
+ else if (value?.value === 0) {
7195
+ return nf.format(value?.value);
7196
+ }
7197
+ else {
7198
+ return value?.value || "";
7199
+ }
7200
+ };
7201
+ const percentFormatter = function (value, roundOffTo, dontMultiply, displayBlank = false) {
7202
+ if (value && value.value && !isNaN(Number(value.value))) {
7203
+ let cellData;
7204
+ let multiplier = dontMultiply ? 1 : 100;
7205
+ if (typeof value.value == Number || !isNaN(Number(value.value))) {
7206
+ cellData = value.value;
7207
+ let newVal = (cellData * multiplier).toFixed(roundOffTo);
7208
+ if (Math.abs(Number(newVal)) === 0) {
7209
+ newVal = 0?.toFixed(roundOffTo);
7210
+ }
7211
+ return newVal + "%";
7212
+ }
7213
+ else {
7214
+ return value.value;
7215
+ }
7216
+ }
7217
+ else if (value.value === 0) {
7218
+ return value.value?.toFixed(roundOffTo) + "%";
7219
+ }
7220
+ else if (displayBlank && (value.value === null || isNaN(value.value))) {
7221
+ return "";
7222
+ }
7223
+ else {
7224
+ return "-";
7225
+ }
7226
+ };
7227
+ const decimalsFormatter = function (x, toFix, shouldRoundOff, displayBlank = false) {
7228
+ const nf = getNumberFormatter(toFix, toFix, x);
7229
+ if (displayBlank && (x.value === null || isNaN(x.value))) {
7230
+ return "";
7231
+ }
7232
+ if (x?.colDef?.extra?.displayActualValue) {
7233
+ return x.value;
7234
+ }
7235
+ if (toFix === 3) {
7236
+ if (x.value === null || isNaN(x.value))
7237
+ return "-";
7238
+ else
7239
+ return parseFloat(x.value).toFixed(3);
7240
+ }
7241
+ if (x.value === 0) {
7242
+ return nf.format(0);
7243
+ }
7244
+ else if (x.value > 0) {
7245
+ if (toFix === 0) {
7246
+ return Math.round(x.value);
7247
+ }
7248
+ let roundOffTo = x?.colDef?.extra?.hasOwnProperty("roundOffTo")
7249
+ ? x?.colDef?.extra?.roundOffTo
7250
+ : toFix
7251
+ ? toFix
7252
+ : 2;
7253
+ if (x?.colDef?.extra?.doNotRoundOff)
7254
+ return parseFloat(x.value).toFixed(roundOffTo);
7255
+ else {
7256
+ let roundOffNumber = +("1" + "0".repeat(roundOffTo));
7257
+ let multipliedValue = x.value * roundOffNumber;
7258
+ let res = multipliedValue < 1 && multipliedValue > 0
7259
+ ? parseFloat(multipliedValue.toFixed(roundOffTo))
7260
+ : Math.round(multipliedValue) / roundOffNumber;
7261
+ return shouldRoundOff ? nf.format(res) : res;
7262
+ }
7263
+ }
7264
+ else {
7265
+ if (!x?.value || isNaN(Number(x?.value))) {
7266
+ if (x?.node?.group) {
7267
+ return "";
7268
+ }
7269
+ return "-";
7270
+ }
7271
+ if (toFix === 0 && x.value < 0) {
7272
+ return Math.round(x.value);
7273
+ }
7274
+ if (toFix > 0 &&
7275
+ x.value < 0 &&
7276
+ (x.is_negative_value_allowed || !x.is_negative_value_allowed)) {
7277
+ return shouldRoundOff
7278
+ ? nf.format(parseFloat((Math.round(x.value * 100) / 100).toFixed(toFix)))
7279
+ : parseFloat((Math.round(x.value * 100) / 100).toFixed(toFix));
7280
+ }
7281
+ return shouldRoundOff
7282
+ ? nf.format(parseFloat(x.value))
7283
+ : parseFloat(x.value);
7284
+ }
7285
+ };
7286
+ const currencyFormatter = function (value, roundOffTo, symbol) {
7287
+ const nf = getNumberFormatter(roundOffTo, roundOffTo, value);
7288
+ if (!value.value && value.value !== 0) {
7289
+ return value.value || "";
7290
+ }
7291
+ if (typeof value.value == Number || !isNaN(Number(value.value))) {
7292
+ let valsfor;
7293
+ const cellData = value.value;
7294
+ const toVal = Math.abs(value.value);
7295
+ if (toVal < 1 && toVal > -1) {
7296
+ valsfor = toVal.toFixed(roundOffTo);
7297
+ }
7298
+ else {
7299
+ valsfor = roundOffTo ? toVal : Math.round(toVal);
7300
+ }
7301
+ let newvalsfor = nf.format(Math.abs(Number(valsfor)).toFixed(roundOffTo));
7302
+ if (cellData >= 0) {
7303
+ return `${symbol}` + newvalsfor;
7304
+ }
7305
+ else {
7306
+ return `-${symbol}` + newvalsfor;
7307
+ }
7308
+ }
7309
+ else {
7310
+ return value?.value
7311
+ ? value?.value
7312
+ : value?.cell?.row?.subRows?.length > 0
7313
+ ? ""
7314
+ : "-";
7315
+ }
7316
+ };
7317
+ // Date format constants used by formattedDate
7318
+ const DATE_FORMATS = [
7319
+ "YYYY-MM-DD",
7320
+ "YYYY-MM-DDTHH:mm:ss",
7321
+ "YYYY-MM-DDTHH:mm:ssZ",
7322
+ "YYYY-MM-DDTHH:mm:ss.SSSZ",
7323
+ "MM/DD/YYYY",
7324
+ "DD/MM/YYYY",
7325
+ "MM-DD-YYYY",
7326
+ "DD-MM-YYYY",
7327
+ "YYYY/MM/DD",
7328
+ moment.ISO_8601,
7329
+ ];
7330
+ const formattedDate = (date, format, currentDateFormat) => {
7331
+ const updatedCurrentFormat = date && moment(date, DATE_FORMATS);
7332
+ return date && updatedCurrentFormat.isValid()
7333
+ ? moment(date, currentDateFormat ? currentDateFormat : updatedCurrentFormat._f).format(format)
7334
+ : "-";
7335
+ };
7336
+ const arrayToCommaFormatter = (value) => {
7337
+ if (value) {
7338
+ return lodash.isArray(value) && value?.length ? value?.join(", ") : value;
7339
+ }
7340
+ return "";
7341
+ };
7342
+ // ─── Non-Editable Cell Value Formatter ──────────────────────────────────────
7343
+ const DEFAULT_DATE_FORMAT$1 = "MM/DD/YYYY";
7344
+ const getDateFormat = (column) => {
7345
+ if (column?.dateFormatter)
7346
+ return column.dateFormatter;
7347
+ if (column?.formatter)
7348
+ return column.formatter;
7349
+ const tenantDateFormat = typeof localStorage !== "undefined"
7350
+ ? localStorage.getItem("tenantDateFormat")
7351
+ : null;
7352
+ return tenantDateFormat || DEFAULT_DATE_FORMAT$1;
7353
+ };
7354
+ const replaceSpecialCharacter$1 = (str) => {
7355
+ if (!str)
7356
+ return str;
7357
+ return String(str)
7358
+ .replace(/__ia_char_38__/g, "&")
7359
+ .replace(/__ia_char_60__/g, "<")
7360
+ .replace(/__ia_char_62__/g, ">")
7361
+ .replace(/__ia_char_34__/g, '"')
7362
+ .replace(/__ia_char_39__/g, "'")
7363
+ .replace(/__ia_char_96__/g, "`");
7364
+ };
7365
+ const fetchDefaultValue = (ins) => {
7366
+ if (lodash.isNil(ins?.value))
7367
+ return "";
7368
+ if (Array.isArray(ins.value))
7369
+ return ins.value
7370
+ .map((item) => !lodash.isNil(item) ? replaceSpecialCharacter$1(item.toString()) : "")
7371
+ .toString();
7372
+ else if (typeof ins.value === "boolean")
7373
+ return ins.value.toString();
7374
+ else
7375
+ return ins.value;
7376
+ };
7377
+ const getRoundOff$1 = (formatter) => {
7378
+ const map = {
7379
+ roundOff: 0,
7380
+ roundOfftoOneDecimals: 1,
7381
+ roundOfftoTwoDecimals: 2,
7382
+ roundOfftoThreeDecimals: 3,
7383
+ };
7384
+ return map[formatter] ?? DEFAULT_ROUNDOFF;
7385
+ };
7386
+ /**
7387
+ * Returns a valueFormatter function for non-editable cells based on column type.
7388
+ * This is the simplified version that handles display-only columns.
7389
+ */
7390
+ const nonEditableCellValueFormatter = (item, forFooter, shouldRoundOff) => {
7391
+ const roundOffTo = getRoundOff$1(item.formatter);
7392
+ switch (item.type) {
7393
+ case "percentage":
7394
+ return (ins) => percentFormatter(ins, roundOffTo, (forFooter && item.is_editable) ||
7395
+ item?.multiplier ||
7396
+ item?.extra?.multiplier
7397
+ ? true
7398
+ : false, item?.extra?.displayBlank);
7399
+ case "int":
7400
+ return (ins) => numbersWithComma(ins, roundOffTo, item?.extra?.disableCommaFormatting, item?.extra?.displayBlank);
7401
+ case "float":
7402
+ return (ins) => decimalsFormatter(ins, roundOffTo, shouldRoundOff, item?.extra?.displayBlank);
7403
+ case "dollar":
7404
+ return (ins) => currencyFormatter(ins, roundOffTo, "$");
7405
+ case "euro":
7406
+ return (ins) => currencyFormatter(ins, roundOffTo, "€");
7407
+ case "bool":
7408
+ return (ins) => ins?.value || "";
7409
+ case "array":
7410
+ return (ins) => arrayToCommaFormatter(ins.value);
7411
+ case "percent_range":
7412
+ return (ins) => (ins?.value ? `${ins.value} %` : "");
7413
+ case "formatted_number":
7414
+ return (ins) => Number(ins?.value)?.toFixed(2) || "";
7415
+ case "date":
7416
+ case "datetime":
7417
+ case "dateStr":
7418
+ case "DateTimeField":
7419
+ return (ins) => {
7420
+ if (item?.extra?.displayBlank && ins?.value === null) {
7421
+ return "";
7422
+ }
7423
+ else {
7424
+ return formattedDate(ins?.value, getDateFormat(item));
6487
7425
  }
6488
- }
6489
- });
7426
+ };
7427
+ case "list":
7428
+ case "dynamic-list":
7429
+ return (ins) => {
7430
+ const listValue = ins?.value;
7431
+ const toDisplay = (v) => {
7432
+ if (lodash.isNil(v))
7433
+ return "";
7434
+ const raw = lodash.isObject(v) ? v?.value : v;
7435
+ return replaceSpecialCharacter$1(String(raw));
7436
+ };
7437
+ if (Array.isArray(listValue))
7438
+ return listValue.map(toDisplay).filter(Boolean).join(", ");
7439
+ if (lodash.isObject(listValue))
7440
+ return toDisplay(listValue);
7441
+ return fetchDefaultValue(ins);
7442
+ };
7443
+ default:
7444
+ return (ins) => {
7445
+ if (item.formatter && item.formatter === "numbersWithComma") {
7446
+ return numbersWithComma(ins, roundOffTo);
7447
+ }
7448
+ else if (ins.value === 0 || ins.value === false || ins.value) {
7449
+ return fetchDefaultValue(ins);
7450
+ }
7451
+ return "";
7452
+ };
7453
+ }
7454
+ };
7455
+
7456
+ // ─── Constants ──────────────────────────────────────────────────────────────
7457
+ const NUMERIC_TYPES = new Set(["int", "percentage", "float", "dollar", "euro"]);
7458
+ // Plain text types that use valueFormatter instead of cellRenderer
7459
+ const PLAIN_TEXT_TYPES = new Set([
7460
+ "percentage",
7461
+ "int",
7462
+ "float",
7463
+ "dollar",
7464
+ "euro",
7465
+ "bool",
7466
+ "date",
7467
+ "datetime",
7468
+ "dateStr",
7469
+ "DateTimeField",
7470
+ "list",
7471
+ "dynamic-list",
7472
+ "str",
7473
+ "link",
7474
+ "percent_range",
7475
+ "formatted_number",
7476
+ ]);
7477
+ // ─── Helpers ────────────────────────────────────────────────────────────────
7478
+ const replaceSpecialCharacter = (str) => {
7479
+ if (!str)
7480
+ return str;
7481
+ return String(str)
7482
+ .replace(/__ia_char_38__/g, "&")
7483
+ .replace(/__ia_char_60__/g, "<")
7484
+ .replace(/__ia_char_62__/g, ">")
7485
+ .replace(/__ia_char_34__/g, '"')
7486
+ .replace(/__ia_char_39__/g, "'")
7487
+ .replace(/__ia_char_96__/g, "`");
7488
+ };
7489
+ const generateHeader = (item) => {
7490
+ item.label = item.label
7491
+ ? replaceSpecialCharacter(item.label.toString())
7492
+ : item.label;
7493
+ return item.label;
7494
+ };
7495
+ const getNestedTableData = (data, columnName, label) => {
7496
+ if (!data)
7497
+ return "";
7498
+ // Handle dot-separated paths
7499
+ if (columnName && columnName.includes(".")) {
7500
+ const parts = columnName.split(".");
7501
+ let value = data;
7502
+ for (const part of parts) {
7503
+ if (value == null)
7504
+ return "";
7505
+ value = value[part];
7506
+ }
7507
+ return value;
7508
+ }
7509
+ return data[columnName];
7510
+ };
7511
+ const getRoundOff = (formatter) => {
7512
+ const map = {
7513
+ roundOff: 0,
7514
+ roundOfftoOneDecimals: 1,
7515
+ roundOfftoTwoDecimals: 2,
7516
+ roundOfftoThreeDecimals: 3,
6490
7517
  };
6491
- const renderButtons = () => {
6492
- if (!Array.isArray(bodyText.buttons)) {
6493
- return null;
6494
- }
6495
- return bodyText.buttons.map((button, index) => (jsxRuntime.jsx("div", { children: jsxRuntime.jsx(impactUiV3.Button, { variant: button.variant || "primary", size: button.size || "medium", onClick: () => handleButtonClick(), disabled: button.disabled || isFormDisabled || (isStepFormSubmit && !isFormValid), className: button.className, icon: button.icon, iconPlacement: button.iconPlacement || "left", children: button.label }) }, index)));
7518
+ return map[formatter] ?? DEFAULT_ROUNDOFF;
7519
+ };
7520
+ const formatDecimalNumber = (value, roundOffTo) => {
7521
+ if (value === "" || value === null || value === undefined)
7522
+ return "";
7523
+ const num = Number(value);
7524
+ if (isNaN(num))
7525
+ return value;
7526
+ return roundOffTo === 0 ? Math.round(num) : num.toFixed(roundOffTo);
7527
+ };
7528
+ // ─── Base Props ─────────────────────────────────────────────────────────────
7529
+ const applyBaseProps = (item) => {
7530
+ if (!item.originalLabel)
7531
+ item.originalLabel = item.label;
7532
+ Object.assign(item, {
7533
+ headerClass: item?.label?.split(" ").join("_"),
7534
+ field: item.column_name,
7535
+ accessor: item.column_name,
7536
+ id: item.column_name,
7537
+ sortable: item.is_sortable ?? true,
7538
+ sort: item?.extra?.defaultSortBy,
7539
+ headerName: generateHeader(item),
7540
+ pinned: item?.extra?.pinned || (item.is_frozen ? "left" : null),
7541
+ required: item.is_required,
7542
+ resizable: !item.not_resizable,
7543
+ columnGroupShow: item?.columnGroupShow || item?.extra?.columnGroupShow,
7544
+ floatingFilter: false,
7545
+ filter: false,
7546
+ });
7547
+ if (item?.extra?.width) {
7548
+ item.suppressSizeToFit = true;
7549
+ item.width = item.extra.width;
7550
+ }
7551
+ // Right-align numeric types
7552
+ if (item?.extra?.rightAlign ||
7553
+ ["int", "percentage", "float", "dollar", "trend", "euro"]?.includes(item?.type)) {
7554
+ item.cellStyle = { ...item?.cellStyle, textAlign: "right" };
7555
+ item.headerClass = `${item?.headerClass || ""} number-cell`;
7556
+ item.cellClass = `${item?.cellClass || ""} number-cell`;
7557
+ }
7558
+ // Handle sub_headers (grouped columns)
7559
+ if (item.sub_headers?.length) {
7560
+ item.children = item.sub_headers.map((data) => formatColumn(data));
7561
+ }
7562
+ return item;
7563
+ };
7564
+ // ─── Numeric Config ─────────────────────────────────────────────────────────
7565
+ const applyNumericConfig = (item) => {
7566
+ if (!NUMERIC_TYPES.has(item.type))
7567
+ return;
7568
+ item.headerClass = `${item.headerClass} flex-reverse-column`;
7569
+ item.cellClass = `${item.cellClass} flex-reverse-cell`;
7570
+ if (item.extra?.overrideWidth)
7571
+ item.extra = { ...item.extra, width: item.extra.overrideWidth };
7572
+ if (!item?.extra?.ignoreSuppressSizeToFit)
7573
+ item.suppressSizeToFit = true;
7574
+ // Tooltip for numeric columns
7575
+ if (!item.extra?.hideToolTip) {
7576
+ const fixedUpto = item.type === "percentage" ? 4 : 2;
7577
+ item.tooltipField = null;
7578
+ item.tooltipValueGetter = (params) => {
7579
+ if (params.value === "-")
7580
+ return "";
7581
+ if (item.extra?.staticToolTip != null &&
7582
+ item.extra?.hasOwnProperty("staticToolTip")) {
7583
+ if ((item.extra?.showNullAsEmpty && params?.value === null) ||
7584
+ !item.extra?.showNullAsEmpty) {
7585
+ return item.extra.staticToolTip;
7586
+ }
7587
+ }
7588
+ return !Number.isInteger(Number(params.value))
7589
+ ? params.value
7590
+ ? Number(params.value).toFixed(fixedUpto)
7591
+ : 0
7592
+ : params.value;
7593
+ };
7594
+ }
7595
+ // Value getters for numeric types
7596
+ if (item.type === "percentage") {
7597
+ item.valueGetter = (params) => params?.data?.[params?.column?.colId] === undefined
7598
+ ? ""
7599
+ : params?.data?.[params?.column?.colId];
7600
+ }
7601
+ if (["int", "dollar", "euro"].includes(item.type) &&
7602
+ !item?.extra?.ignoreValueGetter) {
7603
+ item.valueGetter = (params) => {
7604
+ const roundOffTo = getRoundOff(item.formatter);
7605
+ let finalValue = formatDecimalNumber(params.data?.[item.column_name] ?? "", roundOffTo);
7606
+ if (isNaN(parseInt(finalValue)))
7607
+ return item.extra?.isHyphenDisplayedForEmpty ? "-" : "";
7608
+ return item.type === "int" ? parseInt(finalValue) : finalValue;
7609
+ };
7610
+ }
7611
+ if (item.type === "float" && !item?.extra?.ignoreValueGetter) {
7612
+ getRoundOff(item.formatter);
7613
+ item.valueGetter = (params) => {
7614
+ const value = params?.data?.[item.column_name];
7615
+ if (value === "" || value == null)
7616
+ return value;
7617
+ const num = Number(value);
7618
+ return isNaN(num) ? value : num;
7619
+ };
7620
+ }
7621
+ };
7622
+ // ─── Text Config ────────────────────────────────────────────────────────────
7623
+ const applyTextConfig = (item) => {
7624
+ if (item.type !== "str" && item.type !== "link")
7625
+ return;
7626
+ if (!item.is_editable || item.type === "link") {
7627
+ item.valueGetter = (params) => {
7628
+ if (!params?.data)
7629
+ return;
7630
+ let cellValue = getNestedTableData(params.data, item.column_name, item.label) ?? "";
7631
+ let finalValue = cellValue
7632
+ ? replaceSpecialCharacter(cellValue.toString())
7633
+ : cellValue;
7634
+ if (finalValue == null || finalValue === "")
7635
+ return item.extra?.isHyphenDisplayedForEmpty ? "-" : "";
7636
+ return finalValue;
7637
+ };
7638
+ }
7639
+ };
7640
+ // ─── Cross-Cutting ──────────────────────────────────────────────────────────
7641
+ const applyCrossCutting = (item) => {
7642
+ // Default tooltip for non-numeric, non-action types
7643
+ if (!NUMERIC_TYPES.has(item.type) && !item.extra?.hideToolTip) {
7644
+ item.tooltipValueGetter = (params) => {
7645
+ if (!params?.value)
7646
+ return;
7647
+ if (Array.isArray(params.value))
7648
+ return params.value.map((o) => o.label || o).join(" | ");
7649
+ const v = typeof params.value === "object" ? params.value.value : params.value;
7650
+ return v ? replaceSpecialCharacter(v.toString()) : v;
7651
+ };
7652
+ }
7653
+ // Default comparator
7654
+ item.comparator = (a, b) => {
7655
+ if (typeof a === "string" && typeof b === "string" && isNaN(+a) && a !== "-" && b !== "-") {
7656
+ return a.localeCompare(b);
7657
+ }
7658
+ if (a == null && b == null)
7659
+ return 0;
7660
+ if (a == null)
7661
+ return -1;
7662
+ if (b == null)
7663
+ return 1;
7664
+ if (a === b)
7665
+ return 0;
7666
+ return a > b ? 1 : -1;
6496
7667
  };
6497
- return (jsxRuntime.jsxs("div", { className: classes.buttonContainer, children: [bodyText.message && (jsxRuntime.jsx("div", { className: classes.message, children: bodyText.message })), jsxRuntime.jsx("div", { className: classes.buttonRow, children: renderButtons() })] }));
6498
7668
  };
7669
+ // ─── Cell Renderer ──────────────────────────────────────────────────────────
7670
+ const applyCellRenderer = (item) => {
7671
+ // Only handle non-editable columns (chatbot tables are display-only)
7672
+ if (PLAIN_TEXT_TYPES.has(item.type)) {
7673
+ const formatter = nonEditableCellValueFormatter(item, null, true);
7674
+ item.valueFormatter = (params) => formatter(params);
7675
+ }
7676
+ else {
7677
+ // For types we don't handle, just display the raw value
7678
+ item.valueFormatter = (params) => {
7679
+ if (params?.value === 0 || params?.value === false || params?.value) {
7680
+ return params.value;
7681
+ }
7682
+ return "";
7683
+ };
7684
+ }
7685
+ };
7686
+ // ─── Pipeline ───────────────────────────────────────────────────────────────
7687
+ const formatColumn = (item) => {
7688
+ applyBaseProps(item);
7689
+ // Type-specific
7690
+ applyNumericConfig(item);
7691
+ applyTextConfig(item);
7692
+ // Cross-cutting
7693
+ applyCrossCutting(item);
7694
+ // Cell renderer (non-editable only)
7695
+ applyCellRenderer(item);
7696
+ return item;
7697
+ };
7698
+ // ─── Entry Point ────────────────────────────────────────────────────────────
7699
+ /**
7700
+ * Simplified column formatter for chatbot tables.
7701
+ * Handles non-editable display-only columns. Does not support editable cells,
7702
+ * advanced search, range filters, or complex cell renderers.
7703
+ *
7704
+ * API-compatible with the core agGridColumnFormatter signature:
7705
+ * agGridColumnFormatter(data, levelsJson, actions, formatSetAllLabel, hideValueGetter, isView)
7706
+ * but ignores all args except `data`.
7707
+ */
7708
+ function agGridColumnFormatter(data, _levelsJson, _actions, _formatSetAllLabel, _hideValueGetter, _isView) {
7709
+ if (!data)
7710
+ return data;
7711
+ return data.filter((item) => {
7712
+ if (item.special_field)
7713
+ return false;
7714
+ formatColumn(item);
7715
+ if (item?.columns) {
7716
+ item.columns = item.columns.map((innerItem) => formatColumn(innerItem));
7717
+ }
7718
+ return true;
7719
+ });
7720
+ }
6499
7721
 
6500
7722
  var _path$k;
6501
7723
  function _extends$p() { return _extends$p = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$p.apply(null, arguments); }
@@ -6544,7 +7766,7 @@ const TableContent = ({ bodyText }) => {
6544
7766
  const dispatch = reactRedux.useDispatch();
6545
7767
  React.useEffect(() => {
6546
7768
  let formattedColumns = getFormattedTableConfig(table_config);
6547
- formattedColumns = agGridColumnFormatter(formattedColumns, {}, {}, false, null, false);
7769
+ formattedColumns = agGridColumnFormatter(formattedColumns);
6548
7770
  if (lodash.isEmpty(columns)) {
6549
7771
  setColumns(formattedColumns);
6550
7772
  }
@@ -6593,7 +7815,7 @@ const TableContent = ({ bodyText }) => {
6593
7815
  try {
6594
7816
  const selectedList = event.api.getSelectedRows();
6595
7817
  const latestContext = chatbotContextRef.current;
6596
- dispatch(smartBotActions.setChatbotContext({
7818
+ dispatch(setChatbotContext({
6597
7819
  ...latestContext,
6598
7820
  tables: { ...latestContext?.tables, [table_name]: selectedList },
6599
7821
  }));
@@ -6639,6 +7861,40 @@ const TableContent = ({ bodyText }) => {
6639
7861
  }) }) })] }));
6640
7862
  };
6641
7863
 
7864
+ // Set default Highcharts options
7865
+ Highcharts.setOptions({
7866
+ lang: {
7867
+ decimalPoint: '.',
7868
+ thousandsSep: ',',
7869
+ },
7870
+ });
7871
+ /**
7872
+ * CoreChart Component
7873
+ * A simple wrapper around the Highcharts React component.
7874
+ * Directly passes the provided options to Highcharts.
7875
+ *
7876
+ * @param {Object} props - Component props
7877
+ * @param {Object} props.options - Highcharts options configuration
7878
+ * @param {Function} [props.handleChartRef] - Optional callback to get a reference to the chart
7879
+ * @param {Object} [props.containerProps] - Optional props for the chart container
7880
+ * @returns {JSX.Element} Rendered chart component
7881
+ */
7882
+ const CoreChart = (props) => {
7883
+ const { options, handleChartRef, containerProps = {} } = props;
7884
+ const chartRef = React.useRef(null);
7885
+ React.useEffect(() => {
7886
+ if (handleChartRef && chartRef && chartRef.current) {
7887
+ handleChartRef(chartRef.current);
7888
+ }
7889
+ }, [chartRef, handleChartRef]);
7890
+ // Create a new options object with credits disabled
7891
+ const chartOptions = {
7892
+ ...options,
7893
+ credits: options.credits || { enabled: false }
7894
+ };
7895
+ return (jsxRuntime.jsx("div", { children: jsxRuntime.jsx(HighchartsReact, { highcharts: Highcharts, options: chartOptions, ref: chartRef, ...containerProps }) }));
7896
+ };
7897
+
6642
7898
  const GraphContent = ({ bodyText }) => {
6643
7899
  const { chartOptions, title } = bodyText || {};
6644
7900
  const classes = useStyles$b();
@@ -7436,7 +8692,7 @@ const fetchCrossFilterOptions = async (filterConfig, existingSelections = [], al
7436
8692
  ? primaryValues.map((value) => {
7437
8693
  const stringValue = String(value);
7438
8694
  return {
7439
- label: replaceSpecialCharacter(stringValue),
8695
+ label: replaceSpecialCharacter$2(stringValue),
7440
8696
  value: stringValue,
7441
8697
  };
7442
8698
  })
@@ -7448,7 +8704,7 @@ const fetchCrossFilterOptions = async (filterConfig, existingSelections = [], al
7448
8704
  extraOptionsMap[key] = responseData[key].map((value) => {
7449
8705
  const stringValue = String(value);
7450
8706
  return {
7451
- label: replaceSpecialCharacter(stringValue),
8707
+ label: replaceSpecialCharacter$2(stringValue),
7452
8708
  value: stringValue,
7453
8709
  };
7454
8710
  });
@@ -7468,7 +8724,7 @@ const fetchCrossFilterOptions = async (filterConfig, existingSelections = [], al
7468
8724
  primaryOptions = responseData[altKey].map((value) => {
7469
8725
  const stringValue = String(value);
7470
8726
  return {
7471
- label: replaceSpecialCharacter(stringValue),
8727
+ label: replaceSpecialCharacter$2(stringValue),
7472
8728
  value: stringValue,
7473
8729
  };
7474
8730
  });
@@ -7535,7 +8791,7 @@ const SliderContent = ({ bodyText, isFormDisabled = false, messageIndex }) => {
7535
8791
  const newValue = value?.target?.value;
7536
8792
  setSliderValue(newValue);
7537
8793
  const latestContext = chatbotContextRef.current;
7538
- dispatch(smartBotActions.setChatbotContext({
8794
+ dispatch(setChatbotContext({
7539
8795
  ...latestContext,
7540
8796
  [bodyText?.paramName]: {
7541
8797
  ...latestContext?.[bodyText?.paramName],
@@ -7543,7 +8799,7 @@ const SliderContent = ({ bodyText, isFormDisabled = false, messageIndex }) => {
7543
8799
  updated: true,
7544
8800
  },
7545
8801
  }));
7546
- dispatch(smartBotActions.setPersistedFormValues({ [formKey]: newValue }));
8802
+ dispatch(setPersistedFormValues({ [formKey]: newValue }));
7547
8803
  }
7548
8804
  catch (error) {
7549
8805
  console.error("Error in slider handleChange", error);
@@ -7557,7 +8813,7 @@ const LOAD_MORE_COUNT = 100;
7557
8813
  const SEARCH_DISPLAY_LIMIT = 500;
7558
8814
  const formatOption = (option) => ({
7559
8815
  ...option,
7560
- label: replaceSpecialCharacter(option.label.toString()),
8816
+ label: replaceSpecialCharacter$2(option.label.toString()),
7561
8817
  });
7562
8818
  const formatSlice = (options, start, end) => {
7563
8819
  return options.slice(start, end).map(formatOption);
@@ -7613,8 +8869,8 @@ const SelectContent = ({ bodyText, isFormDisabled = false, messageIndex }) => {
7613
8869
  // [bodyText?.paramName]: selectedOptions,
7614
8870
  // updated: true
7615
8871
  // };
7616
- dispatch(smartBotActions.setChatbotContext(updatedContext));
7617
- dispatch(smartBotActions.setPersistedFormValues({ [formKey]: Array.isArray(selectedOptions) ? selectedOptions : [selectedOptions] }));
8872
+ dispatch(setChatbotContext(updatedContext));
8873
+ dispatch(setPersistedFormValues({ [formKey]: Array.isArray(selectedOptions) ? selectedOptions : [selectedOptions] }));
7618
8874
  // Notify cross-filter context if cascading is active
7619
8875
  if (isCascading) {
7620
8876
  crossFilterCtx.onFilterChange(paramName, Array.isArray(value) ? value : [value]);
@@ -7661,7 +8917,7 @@ const SelectContent = ({ bodyText, isFormDisabled = false, messageIndex }) => {
7661
8917
  setIsAllSelected(false);
7662
8918
  // Also clear from chatbotContext and persistedFormValues
7663
8919
  const ctx = chatbotContextRef.current;
7664
- dispatch(smartBotActions.setChatbotContext({
8920
+ dispatch(setChatbotContext({
7665
8921
  ...ctx,
7666
8922
  [bodyText?.paramName]: {
7667
8923
  ...ctx?.[bodyText?.paramName],
@@ -7669,7 +8925,7 @@ const SelectContent = ({ bodyText, isFormDisabled = false, messageIndex }) => {
7669
8925
  updated: true,
7670
8926
  },
7671
8927
  }));
7672
- dispatch(smartBotActions.setPersistedFormValues({ [formKey]: [] }));
8928
+ dispatch(setPersistedFormValues({ [formKey]: [] }));
7673
8929
  }
7674
8930
  }
7675
8931
  }, [isCascading, crossFilterCtx?.selectionsMap?.[paramName]]);
@@ -7723,7 +8979,7 @@ const SelectContent = ({ bodyText, isFormDisabled = false, messageIndex }) => {
7723
8979
  setCurrentSelectedOptions([]);
7724
8980
  setIsAllSelected(false);
7725
8981
  const ctx1 = chatbotContextRef.current;
7726
- dispatch(smartBotActions.setChatbotContext({
8982
+ dispatch(setChatbotContext({
7727
8983
  ...ctx1,
7728
8984
  __fromSavedFilter: false,
7729
8985
  [bodyText?.paramName]: {
@@ -7732,7 +8988,7 @@ const SelectContent = ({ bodyText, isFormDisabled = false, messageIndex }) => {
7732
8988
  updated: true,
7733
8989
  },
7734
8990
  }));
7735
- dispatch(smartBotActions.setPersistedFormValues({ [formKey]: [], [selectAllKey]: 0 }));
8991
+ dispatch(setPersistedFormValues({ [formKey]: [], [selectAllKey]: 0 }));
7736
8992
  // Notify cross-filter context to clear downstream filters
7737
8993
  if (isCascading) {
7738
8994
  crossFilterCtx.onFilterChange(paramName, []);
@@ -7815,7 +9071,7 @@ const SelectContent = ({ bodyText, isFormDisabled = false, messageIndex }) => {
7815
9071
  }
7816
9072
  setIsAllSelected(true);
7817
9073
  const ctx2 = chatbotContextRef.current;
7818
- dispatch(smartBotActions.setChatbotContext({
9074
+ dispatch(setChatbotContext({
7819
9075
  ...ctx2,
7820
9076
  __fromSavedFilter: false,
7821
9077
  [bodyText?.paramName]: {
@@ -7825,7 +9081,7 @@ const SelectContent = ({ bodyText, isFormDisabled = false, messageIndex }) => {
7825
9081
  },
7826
9082
  }));
7827
9083
  // Persist only the currently visible options (not all 100k+) to avoid Redux memory bloat
7828
- dispatch(smartBotActions.setPersistedFormValues({
9084
+ dispatch(setPersistedFormValues({
7829
9085
  [formKey]: [...currentOptions],
7830
9086
  [selectAllKey]: selectAllCountRef.current,
7831
9087
  }));
@@ -7838,7 +9094,7 @@ const SelectContent = ({ bodyText, isFormDisabled = false, messageIndex }) => {
7838
9094
  setCurrentSelectedOptions([]);
7839
9095
  setIsAllSelected(false);
7840
9096
  const ctx3 = chatbotContextRef.current;
7841
- dispatch(smartBotActions.setChatbotContext({
9097
+ dispatch(setChatbotContext({
7842
9098
  ...ctx3,
7843
9099
  __fromSavedFilter: false,
7844
9100
  [bodyText?.paramName]: {
@@ -7847,7 +9103,7 @@ const SelectContent = ({ bodyText, isFormDisabled = false, messageIndex }) => {
7847
9103
  updated: true,
7848
9104
  },
7849
9105
  }));
7850
- dispatch(smartBotActions.setPersistedFormValues({ [formKey]: [], [selectAllKey]: 0 }));
9106
+ dispatch(setPersistedFormValues({ [formKey]: [], [selectAllKey]: 0 }));
7851
9107
  // Notify cross-filter context of deselection
7852
9108
  if (isCascading) {
7853
9109
  crossFilterCtx.onFilterChange(paramName, []);
@@ -7875,7 +9131,7 @@ const DatePickerContent = ({ bodyText, isFormDisabled = false, messageIndex }) =
7875
9131
  try {
7876
9132
  setSelectedDate(date);
7877
9133
  const latestContext = chatbotContextRef.current;
7878
- dispatch(smartBotActions.setChatbotContext({
9134
+ dispatch(setChatbotContext({
7879
9135
  ...latestContext,
7880
9136
  [bodyText?.paramName]: {
7881
9137
  ...latestContext?.[bodyText?.paramName],
@@ -7883,7 +9139,7 @@ const DatePickerContent = ({ bodyText, isFormDisabled = false, messageIndex }) =
7883
9139
  updated: true,
7884
9140
  },
7885
9141
  }));
7886
- dispatch(smartBotActions.setPersistedFormValues({ [formKey]: date }));
9142
+ dispatch(setPersistedFormValues({ [formKey]: date }));
7887
9143
  }
7888
9144
  catch (error) {
7889
9145
  console.error("Error in datepicker handleChange", error);
@@ -7919,7 +9175,7 @@ const DateRangePickerContent = ({ bodyText, isFormDisabled = false, messageIndex
7919
9175
  setStartDate(start);
7920
9176
  setEndDate(end);
7921
9177
  const latestContext = chatbotContextRef.current;
7922
- dispatch(smartBotActions.setChatbotContext({
9178
+ dispatch(setChatbotContext({
7923
9179
  ...latestContext,
7924
9180
  [bodyText?.paramName]: {
7925
9181
  ...latestContext?.[bodyText?.paramName],
@@ -7930,7 +9186,7 @@ const DateRangePickerContent = ({ bodyText, isFormDisabled = false, messageIndex
7930
9186
  updated: true,
7931
9187
  },
7932
9188
  }));
7933
- dispatch(smartBotActions.setPersistedFormValues({ [formKey]: { startDate: start, endDate: end } }));
9189
+ dispatch(setPersistedFormValues({ [formKey]: { startDate: start, endDate: end } }));
7934
9190
  }
7935
9191
  catch (error) {
7936
9192
  console.error("Error in dateRangePicker handleDatesChange", error);
@@ -7968,7 +9224,7 @@ const CheckboxContent = ({ bodyText, isFormDisabled = false, messageIndex }) =>
7968
9224
  try {
7969
9225
  setChecked(isChecked?.currentTarget?.checked);
7970
9226
  const latestContext = chatbotContextRef.current;
7971
- dispatch(smartBotActions.setChatbotContext({
9227
+ dispatch(setChatbotContext({
7972
9228
  ...latestContext,
7973
9229
  [bodyText?.paramName]: {
7974
9230
  ...latestContext?.[bodyText?.paramName],
@@ -7976,7 +9232,7 @@ const CheckboxContent = ({ bodyText, isFormDisabled = false, messageIndex }) =>
7976
9232
  updated: true,
7977
9233
  },
7978
9234
  }));
7979
- dispatch(smartBotActions.setPersistedFormValues({ [formKey]: isChecked?.currentTarget?.checked }));
9235
+ dispatch(setPersistedFormValues({ [formKey]: isChecked?.currentTarget?.checked }));
7980
9236
  }
7981
9237
  catch (error) {
7982
9238
  console.error("Error in checkbox handleChange", error);
@@ -8007,7 +9263,7 @@ const CheckboxGroupContent = ({ bodyText, isFormDisabled = false, messageIndex }
8007
9263
  const groupDisabled = isDisabled || isFormDisabled;
8008
9264
  const dispatchSelection = (newValues) => {
8009
9265
  const latestContext = chatbotContextRef.current;
8010
- dispatch(smartBotActions.setChatbotContext({
9266
+ dispatch(setChatbotContext({
8011
9267
  ...latestContext,
8012
9268
  [bodyText?.paramName]: {
8013
9269
  ...latestContext?.[bodyText?.paramName],
@@ -8015,7 +9271,7 @@ const CheckboxGroupContent = ({ bodyText, isFormDisabled = false, messageIndex }
8015
9271
  updated: true,
8016
9272
  },
8017
9273
  }));
8018
- dispatch(smartBotActions.setPersistedFormValues({ [formKey]: newValues }));
9274
+ dispatch(setPersistedFormValues({ [formKey]: newValues }));
8019
9275
  };
8020
9276
  const handleChange = (optionValue, isChecked) => {
8021
9277
  try {
@@ -8070,7 +9326,7 @@ const RadioContent = ({ bodyText, isFormDisabled = false, messageIndex }) => {
8070
9326
  },
8071
9327
  });
8072
9328
  });
8073
- dispatch(smartBotActions.setPersistedFormValues({ [formKey]: defaultSelected }));
9329
+ dispatch(setPersistedFormValues({ [formKey]: defaultSelected }));
8074
9330
  }
8075
9331
  }, []);
8076
9332
  if (lodash.isEmpty(bodyText))
@@ -8085,7 +9341,7 @@ const RadioContent = ({ bodyText, isFormDisabled = false, messageIndex }) => {
8085
9341
  // updated: true,
8086
9342
  // };
8087
9343
  const latestContext = chatbotContextRef.current;
8088
- dispatch(smartBotActions.setChatbotContext({
9344
+ dispatch(setChatbotContext({
8089
9345
  ...latestContext,
8090
9346
  [bodyText?.paramName]: {
8091
9347
  ...latestContext?.[bodyText?.paramName],
@@ -8093,7 +9349,7 @@ const RadioContent = ({ bodyText, isFormDisabled = false, messageIndex }) => {
8093
9349
  updated: true,
8094
9350
  },
8095
9351
  }));
8096
- dispatch(smartBotActions.setPersistedFormValues({ [formKey]: value }));
9352
+ dispatch(setPersistedFormValues({ [formKey]: value }));
8097
9353
  }
8098
9354
  catch (error) {
8099
9355
  console.error("Error in radio handleChange", error);
@@ -8118,7 +9374,7 @@ const InputContent = ({ bodyText, isFormDisabled = false, messageIndex }) => {
8118
9374
  const newValue = event?.target?.value || event?.currentTarget?.value || "";
8119
9375
  setValue(newValue);
8120
9376
  const latestContext = chatbotContextRef.current;
8121
- dispatch(smartBotActions.setChatbotContext({
9377
+ dispatch(setChatbotContext({
8122
9378
  ...latestContext,
8123
9379
  [bodyText?.paramName]: {
8124
9380
  ...latestContext?.[bodyText?.paramName],
@@ -8127,7 +9383,7 @@ const InputContent = ({ bodyText, isFormDisabled = false, messageIndex }) => {
8127
9383
  type: inputType,
8128
9384
  },
8129
9385
  }));
8130
- dispatch(smartBotActions.setPersistedFormValues({ [formKey]: newValue }));
9386
+ dispatch(setPersistedFormValues({ [formKey]: newValue }));
8131
9387
  }
8132
9388
  catch (error) {
8133
9389
  console.error("Error in input handleChange", error);
@@ -8297,10 +9553,10 @@ const SurfaceFrameContent = ({ frame, isFormDisabled = false, messageIndex = 0 }
8297
9553
  const empty = value === "" || value === null || value === undefined || (Array.isArray(value) && value.length === 0);
8298
9554
  context[name] = { ...context[name], [name]: value, updated: !empty };
8299
9555
  }
8300
- dispatch(smartBotActions.setChatbotContext(context));
9556
+ dispatch(setChatbotContext(context));
8301
9557
  // only what was filled in: ButtonContent sends a persisted value even when it is empty
8302
9558
  const filled = Object.entries(values).filter(([name]) => context[name].updated);
8303
- dispatch(smartBotActions.setPersistedFormValues(Object.fromEntries(filled.map(([name, value]) => [`${messageIndex}_${name}`, value]))));
9559
+ dispatch(setPersistedFormValues(Object.fromEntries(filled.map(([name, value]) => [`${messageIndex}_${name}`, value]))));
8304
9560
  }
8305
9561
  // anything else: a message type this chat does not know, ignored
8306
9562
  };
@@ -8389,12 +9645,14 @@ const SavedFilterCascadeBridge = ({ chatbotContext, crossFilterConfigs }) => {
8389
9645
  */
8390
9646
  const StepFormContent = ({ formData, messageIndex = 0, isFormDisabled = false, showSavedFilters = true, preSelectedFilters = null, botProps = null, currentMode = "", agentId = "", sessionId = "", }) => {
8391
9647
  const dispatch = reactRedux.useDispatch();
9648
+ const { selectors, components } = useChatbotDeps();
9649
+ const hasFilterComponent = !!components?.FilterComponent;
8392
9650
  const savedFilterSets = reactRedux.useSelector((state) => state.smartBotReducer.savedFilterSets);
8393
9651
  const persistedFormValues = reactRedux.useSelector((state) => state.smartBotReducer.persistedFormValues);
8394
9652
  const chatbotContext = reactRedux.useSelector((state) => state.smartBotReducer.chatbotContext);
8395
9653
  const stepFormStreamData = reactRedux.useSelector((state) => state.smartBotReducer.stepFormStreamData);
8396
9654
  const chatbotFilterOptions = reactRedux.useSelector((state) => state.smartBotReducer.chatbotFilterOptions);
8397
- const dimensionHierarchies = reactRedux.useSelector((state) => state.userRoleManagementService?.dimensionHierarchies);
9655
+ const dimensionHierarchies = reactRedux.useSelector(selectors?.getDimensionHierarchies ?? NULL_SELECTOR);
8398
9656
  const [isFormSubmitted, setIsFormSubmitted] = React.useState(false);
8399
9657
  const [isTimedOut, setIsTimedOut] = React.useState(() => sessionStorage.getItem(STEP_FORM_TIMEOUT_KEY) === "true");
8400
9658
  const timeoutRef = React.useRef(null);
@@ -8461,7 +9719,7 @@ const StepFormContent = ({ formData, messageIndex = 0, isFormDisabled = false, s
8461
9719
  if (!selectedValue) {
8462
9720
  // Only remove saved filter flags; keep dropdown values and persisted state intact
8463
9721
  const { __fromSavedFilter, __savedFilterSelection, ...rest } = chatbotContext || {};
8464
- dispatch(smartBotActions.setChatbotContext(rest));
9722
+ dispatch(setChatbotContext(rest));
8465
9723
  return;
8466
9724
  }
8467
9725
  const fullFilterObj = (savedFilterSets || []).find((f) => (f.fuc_code || f.name || f.label) === selectedValue);
@@ -8504,7 +9762,7 @@ const StepFormContent = ({ formData, messageIndex = 0, isFormDisabled = false, s
8504
9762
  });
8505
9763
  mergedContext.__fromSavedFilter = true;
8506
9764
  mergedContext.__savedFilterSelection = selected;
8507
- dispatch(smartBotActions.setChatbotContext(mergedContext));
9765
+ dispatch(setChatbotContext(mergedContext));
8508
9766
  // Build persisted values for ALL form select fields.
8509
9767
  // Matching fields get the saved filter values; unmatched fields get [] (cleared).
8510
9768
  const formPersisted = {};
@@ -8528,7 +9786,7 @@ const StepFormContent = ({ formData, messageIndex = 0, isFormDisabled = false, s
8528
9786
  // Always reset select-all count when a saved filter is applied
8529
9787
  formPersisted[selectAllKey] = 0;
8530
9788
  });
8531
- dispatch(smartBotActions.setPersistedFormValues(formPersisted));
9789
+ dispatch(setPersistedFormValues(formPersisted));
8532
9790
  }
8533
9791
  catch (error) {
8534
9792
  console.error("[StepFormContent] onFilterSetChange error:", error);
@@ -8792,7 +10050,7 @@ const StepFormContent = ({ formData, messageIndex = 0, isFormDisabled = false, s
8792
10050
  });
8793
10051
  if (formFields.length === 0 && buttonItems.length === 0)
8794
10052
  return null;
8795
- return (jsxRuntime.jsxs("div", { className: "step-form-content", children: [showSavedFilters && filterSetOptions.length > 0 && (jsxRuntime.jsx("div", { style: { width: "100%", marginTop: "10px" }, children: jsxRuntime.jsx(impactUiV3.Select, { currentOptions: filterSetCurrentOptions, setCurrentOptions: setFilterSetCurrentOptions, label: "Saved Filter Sets", labelOrientation: "top", isRequired: false, isDisabled: savedFilterDisabled, handleChange: (selected) => onFilterSetChange(selected), isCloseWhenClickOutside: true, setIsOpen: setIsFilterSetOpen, isOpen: isFilterSetOpen, selectedOptions: selectedFilterSet, setSelectedOptions: setSelectedFilterSet, initialOptions: filterSetOptions, isMulti: false, isClearable: true }) })), showSavedFilters && filterSetOptions.length > 0 && (jsxRuntime.jsx("hr", { style: { border: "none", borderTop: "1px solid #E0E0E0", margin: "12px 0" } })), jsxRuntime.jsx("div", { children: crossFilterConfigs.length >= 1 ? (jsxRuntime.jsxs(CrossFilterProvider, { filters: crossFilterConfigs, fetchOptionsFn: (filterConfig, existingSelections, allFilters) => fetchCrossFilterOptions(filterConfig, existingSelections, allFilters, preSelectedFilters), initialSelections: crossFilterInitialSelections, fetchOnMount: false, children: [jsxRuntime.jsx(SavedFilterCascadeBridge, { chatbotContext: chatbotContext, crossFilterConfigs: crossFilterConfigs }), formFields] })) : (formFields) }), buttonItems] }));
10053
+ return (jsxRuntime.jsxs("div", { className: "step-form-content", children: [hasFilterComponent && showSavedFilters && filterSetOptions.length > 0 && (jsxRuntime.jsx("div", { style: { width: "100%", marginTop: "10px" }, children: jsxRuntime.jsx(impactUiV3.Select, { currentOptions: filterSetCurrentOptions, setCurrentOptions: setFilterSetCurrentOptions, label: "Saved Filter Sets", labelOrientation: "top", isRequired: false, isDisabled: savedFilterDisabled, handleChange: (selected) => onFilterSetChange(selected), isCloseWhenClickOutside: true, setIsOpen: setIsFilterSetOpen, isOpen: isFilterSetOpen, selectedOptions: selectedFilterSet, setSelectedOptions: setSelectedFilterSet, initialOptions: filterSetOptions, isMulti: false, isClearable: true }) })), hasFilterComponent && showSavedFilters && filterSetOptions.length > 0 && (jsxRuntime.jsx("hr", { style: { border: "none", borderTop: "1px solid #E0E0E0", margin: "12px 0" } })), jsxRuntime.jsx("div", { children: crossFilterConfigs.length >= 1 ? (jsxRuntime.jsxs(CrossFilterProvider, { filters: crossFilterConfigs, fetchOptionsFn: (filterConfig, existingSelections, allFilters) => fetchCrossFilterOptions(filterConfig, existingSelections, allFilters, preSelectedFilters), initialSelections: crossFilterInitialSelections, fetchOnMount: false, children: [jsxRuntime.jsx(SavedFilterCascadeBridge, { chatbotContext: chatbotContext, crossFilterConfigs: crossFilterConfigs }), formFields] })) : (formFields) }), buttonItems] }));
8796
10054
  };
8797
10055
  /** Reset the timeout flag (call when a new conversation/message starts) */
8798
10056
  const resetStepFormTimeoutFlag = () => {
@@ -9831,14 +11089,14 @@ const StepsResponseTab = (props) => {
9831
11089
  setTimeoutMessage("This session timed out due to inactivity. Please start a new message to continue.");
9832
11090
  setIsTimedOut(true);
9833
11091
  setTabValue("agent_response");
9834
- dispatch(smartBotActions.setMinimizedStreamData(null));
11092
+ dispatch(setMinimizedStreamData(null));
9835
11093
  const elapsed = streamStartTimeRef.current
9836
11094
  ? Math.floor((Date.now() - streamStartTimeRef.current) / 1000)
9837
11095
  : null;
9838
11096
  const mins = elapsed != null ? Math.floor(elapsed / 60) : 0;
9839
11097
  const secs = elapsed != null ? elapsed % 60 : 0;
9840
11098
  const timedOutLabel = `Worked for ${mins}m:${String(secs).padStart(2, '0')}s`;
9841
- dispatch(smartBotActions.setThinkingContext({
11099
+ dispatch(setThinkingContext({
9842
11100
  streamStartTime: null,
9843
11101
  isStreamCompleted: true,
9844
11102
  finalElapsedSeconds: elapsed,
@@ -10213,7 +11471,7 @@ const StreamedContent = ({ botData, botProps }) => {
10213
11471
  }).length;
10214
11472
  if (lastQCompleted && !stepsDone) {
10215
11473
  // Last question completed but stream not done — show "Thinking"
10216
- dispatch(smartBotActions.setMinimizedStreamData({
11474
+ dispatch(setMinimizedStreamData({
10217
11475
  isStreaming: true,
10218
11476
  stepHeader: "Thinking",
10219
11477
  stepSubHeader: "Working on the next step...",
@@ -10226,7 +11484,7 @@ const StreamedContent = ({ botData, botProps }) => {
10226
11484
  // Normal step update — show the latest question + sub-header
10227
11485
  const latestStep = stepRef.current[stepRef.current.length - 1];
10228
11486
  const latestQuestion = qs[qs.length - 1] || latestStep?.header || "Processing";
10229
- dispatch(smartBotActions.setMinimizedStreamData({
11487
+ dispatch(setMinimizedStreamData({
10230
11488
  isStreaming: true,
10231
11489
  stepHeader: latestQuestion,
10232
11490
  stepSubHeader: latestStep?.sub_header || "",
@@ -10333,9 +11591,10 @@ const StreamedContent = ({ botData, botProps }) => {
10333
11591
  // botData.inputBody = {
10334
11592
  // "query": "get product status for this l2_name 10_Trey Heckmann"
10335
11593
  // }
11594
+ const { BASE_API } = getApiConstants();
10336
11595
  let endPoint = botData?.utilityObject?.endpoint
10337
- ? `${api.BASE_API}${botData?.utilityObject?.endpoint}`
10338
- : `${api.BASE_API}/core/chatbot/navigation-v2`;
11596
+ ? `${BASE_API}${botData?.utilityObject?.endpoint}`
11597
+ : `${BASE_API}/core/chatbot/navigation-v2`;
10339
11598
  let method = botData?.utilityObject?.method
10340
11599
  ? botData?.utilityObject?.method
10341
11600
  : "PUT";
@@ -10345,7 +11604,7 @@ const StreamedContent = ({ botData, botProps }) => {
10345
11604
  // Start the timer immediately when the API is called
10346
11605
  if (!streamStartTimeRef.current) {
10347
11606
  streamStartTimeRef.current = Date.now();
10348
- dispatch(smartBotActions.setThinkingContext({
11607
+ dispatch(setThinkingContext({
10349
11608
  streamStartTime: streamStartTimeRef.current,
10350
11609
  isStreamCompleted: false,
10351
11610
  finalElapsedSeconds: null,
@@ -10373,7 +11632,7 @@ const StreamedContent = ({ botData, botProps }) => {
10373
11632
  state.initiated = true;
10374
11633
  }
10375
11634
  // Dispatch initial minimized widget data
10376
- dispatch(smartBotActions.setMinimizedStreamData({
11635
+ dispatch(setMinimizedStreamData({
10377
11636
  isStreaming: true,
10378
11637
  stepHeader: "Processing Request",
10379
11638
  stepSubHeader: "Analyzing the current request",
@@ -10440,7 +11699,7 @@ const StreamedContent = ({ botData, botProps }) => {
10440
11699
  const doneState = streamStateMap.get(streamKey);
10441
11700
  if (doneState)
10442
11701
  doneState.completed = true;
10443
- dispatch(smartBotActions.setMinimizedStreamData({
11702
+ dispatch(setMinimizedStreamData({
10444
11703
  isStreaming: false,
10445
11704
  stepHeader: questionsRef.current[questionsRef.current.length - 1] || "Completed",
10446
11705
  stepSubHeader: "Done",
@@ -10469,7 +11728,7 @@ const StreamedContent = ({ botData, botProps }) => {
10469
11728
  questionsStepsMapRef.current = initialMap;
10470
11729
  setQuestionsStepsMap(lodash.cloneDeep(initialMap));
10471
11730
  // Dispatch minimized widget data when questions arrive
10472
- dispatch(smartBotActions.setMinimizedStreamData({
11731
+ dispatch(setMinimizedStreamData({
10473
11732
  isStreaming: true,
10474
11733
  stepHeader: incomingQuestions[0] || "Processing Request",
10475
11734
  stepSubHeader: "Analyzing the current request",
@@ -10489,7 +11748,7 @@ const StreamedContent = ({ botData, botProps }) => {
10489
11748
  setThinkingContentRef.current(newValue);
10490
11749
  thinkingContentRef.current = thinkingContentRef.current + data.message;
10491
11750
  messageToStoreRef.current.chatData.thinkingResponse.thinkingStream = newValue;
10492
- dispatch(smartBotActions.setThinkingContext({
11751
+ dispatch(setThinkingContext({
10493
11752
  streamStartTime: streamStartTimeRef.current,
10494
11753
  isStreamCompleted: false,
10495
11754
  finalElapsedSeconds: null,
@@ -10637,7 +11896,7 @@ const StreamedContent = ({ botData, botProps }) => {
10637
11896
  const lastStepForIntent = questionsStepsMapRef.current[latestQuestion];
10638
11897
  const lastStepEntry = lastStepForIntent?.[lastStepForIntent.length - 1];
10639
11898
  const stepFormSubHeader = lastStepEntry?.sub_header || "Waiting for your response";
10640
- dispatch(smartBotActions.setMinimizedStreamData({
11899
+ dispatch(setMinimizedStreamData({
10641
11900
  isStreaming: true,
10642
11901
  stepHeader: latestQuestion,
10643
11902
  stepSubHeader: stepFormSubHeader,
@@ -10686,7 +11945,7 @@ const StreamedContent = ({ botData, botProps }) => {
10686
11945
  thinkingTimeFinalRef.current = finalThinkingTime;
10687
11946
  // Keep timer running — do NOT set "Worked for" here.
10688
11947
  // Timer continues showing "Working for Xm:Ys" until status:"completed" arrives.
10689
- dispatch(smartBotActions.setThinkingContext({
11948
+ dispatch(setThinkingContext({
10690
11949
  streamStartTime: streamStartTimeRef.current,
10691
11950
  isStreamCompleted: false,
10692
11951
  finalElapsedSeconds: null,
@@ -10708,7 +11967,7 @@ const StreamedContent = ({ botData, botProps }) => {
10708
11967
  if (doneState)
10709
11968
  doneState.completed = true;
10710
11969
  // Mark streaming as done in minimized widget data
10711
- dispatch(smartBotActions.setMinimizedStreamData({
11970
+ dispatch(setMinimizedStreamData({
10712
11971
  isStreaming: false,
10713
11972
  stepHeader: questionsRef.current[questionsRef.current.length - 1] || "Completed",
10714
11973
  stepSubHeader: "Done",
@@ -10780,7 +12039,7 @@ const StreamedContent = ({ botData, botProps }) => {
10780
12039
  messageToStoreRef.current.chatData.response = agentUnavailableMessage;
10781
12040
  }
10782
12041
  setContent(agentUnavailableMessage);
10783
- dispatch(smartBotActions.setMinimizedStreamData({
12042
+ dispatch(setMinimizedStreamData({
10784
12043
  isStreaming: false,
10785
12044
  stepHeader: questionsRef.current[questionsRef.current.length - 1] || "Agent unavailable",
10786
12045
  stepSubHeader: "Connection closed",
@@ -10833,7 +12092,7 @@ const StreamedContent = ({ botData, botProps }) => {
10833
12092
  messageToStoreRef.current.chatData.response = finalMessage;
10834
12093
  }
10835
12094
  setContent(finalMessage);
10836
- dispatch(smartBotActions.setMinimizedStreamData({
12095
+ dispatch(setMinimizedStreamData({
10837
12096
  isStreaming: false,
10838
12097
  stepHeader: questionsRef.current[questionsRef.current.length - 1] || "Ended unexpectedly",
10839
12098
  stepSubHeader: "Connection closed",
@@ -10907,7 +12166,7 @@ const StreamedContent = ({ botData, botProps }) => {
10907
12166
  messageToStoreRef.current.chatData.response = finalMessage;
10908
12167
  }
10909
12168
  setContent(finalMessage);
10910
- dispatch(smartBotActions.setMinimizedStreamData({
12169
+ dispatch(setMinimizedStreamData({
10911
12170
  isStreaming: false,
10912
12171
  stepHeader: questionsRef.current[questionsRef.current.length - 1] || "Ended unexpectedly",
10913
12172
  stepSubHeader: "Connection closed",
@@ -10987,7 +12246,7 @@ const StreamedContent = ({ botData, botProps }) => {
10987
12246
  localStorage.setItem("isStreaming", "false");
10988
12247
  // Clear minimized widget when streaming is fully done (unless step_form waiting for user)
10989
12248
  if (stepsDone) {
10990
- dispatch(smartBotActions.setMinimizedStreamData(null));
12249
+ dispatch(setMinimizedStreamData(null));
10991
12250
  }
10992
12251
  setIsStop(false);
10993
12252
  if (currentMode === "agent") {
@@ -11005,7 +12264,7 @@ const StreamedContent = ({ botData, botProps }) => {
11005
12264
  // Completed — use a static string so this chat's heading won't
11006
12265
  // re-animate when a future chat dispatches a new streamStartTime.
11007
12266
  messageToStoreRef.current.chatData.thinkingResponse.thinkingHeading = workedForLabel;
11008
- dispatch(smartBotActions.setThinkingContext({
12267
+ dispatch(setThinkingContext({
11009
12268
  streamStartTime: streamStartTimeRef.current,
11010
12269
  isStreamCompleted: true,
11011
12270
  finalElapsedSeconds: completedElapsed,
@@ -11043,7 +12302,7 @@ const StreamedContent = ({ botData, botProps }) => {
11043
12302
  : {});
11044
12303
  if (!wasStreamingAbortedRef.current) {
11045
12304
  botData.utilityObject.setUniqueChatId(messageToStoreRef.current.uniqueChatId);
11046
- dispatch(smartBotActions.setCurrentAgentChatId(messageToStoreRef.current.uniqueChatId));
12305
+ dispatch(setCurrentAgentChatId(messageToStoreRef.current.uniqueChatId));
11047
12306
  }
11048
12307
  // Persist IDs for step form restream (ButtonContent reads these)
11049
12308
  const _sid2 = messageToStoreRef.current.sessionId || "";
@@ -11128,7 +12387,7 @@ const StreamedContent = ({ botData, botProps }) => {
11128
12387
  const endMs = Date.now();
11129
12388
  const startMs = streamStartTimeRef.current || endMs - completedElapsed * 1000;
11130
12389
  const durationMs = Math.max(0, Math.round(endMs - startMs));
11131
- conversationService.updateQuestionTiming(messageChatSessionId, {
12390
+ updateQuestionTiming(messageChatSessionId, {
11132
12391
  startTime: new Date(startMs).toISOString(),
11133
12392
  endTime: new Date(endMs).toISOString(),
11134
12393
  duration: durationMs,
@@ -11320,7 +12579,7 @@ const StreamedContent = ({ botData, botProps }) => {
11320
12579
  }
11321
12580
  // Stop the agent flow on the backend
11322
12581
  if (messageToStoreRef.current.sessionId) {
11323
- chatbotServices.stopAgentFlow({ session_id: messageToStoreRef.current.sessionId }, baseUrl);
12582
+ stopAgentFlow({ session_id: messageToStoreRef.current.sessionId }, baseUrl);
11324
12583
  }
11325
12584
  // Clear timeout if exists
11326
12585
  if (streamTimeoutRef.current) {
@@ -11345,7 +12604,7 @@ const StreamedContent = ({ botData, botProps }) => {
11345
12604
  const abortMin = Math.floor(abortElapsed / 60);
11346
12605
  const abortSec = abortElapsed % 60;
11347
12606
  const abortLabel = `Completed in ${abortMin}m:${String(abortSec).padStart(2, '0')}s`;
11348
- dispatch(smartBotActions.setThinkingContext({
12607
+ dispatch(setThinkingContext({
11349
12608
  streamStartTime: streamStartTimeRef.current,
11350
12609
  isStreamCompleted: true,
11351
12610
  finalElapsedSeconds: abortElapsed,
@@ -11801,14 +13060,14 @@ const TabularContent = ({ steps: initialSteps, currentTabValue, children, questi
11801
13060
  setStepFormSubmitted(true);
11802
13061
  setIsTimedOut(true);
11803
13062
  setTabValue("agent_response");
11804
- dispatch(smartBotActions.setMinimizedStreamData(null));
13063
+ dispatch(setMinimizedStreamData(null));
11805
13064
  const elapsed = streamStartTimeRef.current
11806
13065
  ? Math.floor((Date.now() - streamStartTimeRef.current) / 1000)
11807
13066
  : null;
11808
13067
  const mins = elapsed != null ? Math.floor(elapsed / 60) : 0;
11809
13068
  const secs = elapsed != null ? elapsed % 60 : 0;
11810
13069
  const timedOutLabel = `Worked for ${mins}m:${String(secs).padStart(2, '0')}s`;
11811
- dispatch(smartBotActions.setThinkingContext({
13070
+ dispatch(setThinkingContext({
11812
13071
  streamStartTime: null,
11813
13072
  isStreamCompleted: true,
11814
13073
  finalElapsedSeconds: elapsed,
@@ -11890,7 +13149,7 @@ const TabularContent = ({ steps: initialSteps, currentTabValue, children, questi
11890
13149
  }
11891
13150
  const payload = stepFormStreamData;
11892
13151
  // Clear Redux immediately
11893
- dispatch(smartBotActions.setStepFormStreamData(null));
13152
+ dispatch(setStepFormStreamData(null));
11894
13153
  if (payload.status === "retrying") {
11895
13154
  setRetryCountdown(payload.countdown || 0);
11896
13155
  return;
@@ -12036,8 +13295,8 @@ const TabularContent = ({ steps: initialSteps, currentTabValue, children, questi
12036
13295
  setHasNewStepFormFromRestream(true);
12037
13296
  setActiveFormIntent(latestIntent || null);
12038
13297
  activeTabularInstanceId = instanceIdRef.current;
12039
- dispatch(smartBotActions.clearPersistedFormValues());
12040
- dispatch(smartBotActions.setChatbotContext({}));
13298
+ dispatch(clearPersistedFormValues());
13299
+ dispatch(setChatbotContext({}));
12041
13300
  }
12042
13301
  return;
12043
13302
  }
@@ -12200,8 +13459,8 @@ const TabularContent = ({ steps: initialSteps, currentTabValue, children, questi
12200
13459
  // Re-register as active instance since this TabularContent now owns the new form
12201
13460
  activeTabularInstanceId = instanceIdRef.current;
12202
13461
  // Clear stale persisted form values and context so the new form starts fresh
12203
- dispatch(smartBotActions.clearPersistedFormValues());
12204
- dispatch(smartBotActions.setChatbotContext({}));
13462
+ dispatch(clearPersistedFormValues());
13463
+ dispatch(setChatbotContext({}));
12205
13464
  }
12206
13465
  setIsRestreaming(false);
12207
13466
  }, [stepFormStreamData]);
@@ -12497,7 +13756,7 @@ var SvgGenericModuleIcon = function SvgGenericModuleIcon(props) {
12497
13756
 
12498
13757
  const fetchAllMemories = async (baseUrl) => {
12499
13758
  try {
12500
- let data = await axiosInstance({
13759
+ let data = await httpRequest({
12501
13760
  url: `${baseUrl}/chatbot/agent/memory/get_all`,
12502
13761
  method: "GET",
12503
13762
  });
@@ -12510,7 +13769,7 @@ const fetchAllMemories = async (baseUrl) => {
12510
13769
  };
12511
13770
  const editMemory = async (baseUrl, memoryId, data) => {
12512
13771
  try {
12513
- let response = await axiosInstance({
13772
+ let response = await httpRequest({
12514
13773
  url: `${baseUrl}/chatbot/agent/memory/update/${memoryId}`,
12515
13774
  method: "PUT",
12516
13775
  data,
@@ -12524,7 +13783,7 @@ const editMemory = async (baseUrl, memoryId, data) => {
12524
13783
  };
12525
13784
  const deleteMemory = async (baseUrl, memoryId) => {
12526
13785
  try {
12527
- let response = await axiosInstance({
13786
+ let response = await httpRequest({
12528
13787
  url: `${baseUrl}/chatbot/agent/memory/delete/${memoryId}`,
12529
13788
  method: "DELETE",
12530
13789
  });
@@ -12736,7 +13995,7 @@ const MemoryModal = (props) => {
12736
13995
  };
12737
13996
  const getBaseUrl = async () => {
12738
13997
  try {
12739
- let basUrl = await utils.fetchBaseUrl();
13998
+ let basUrl = await fetchBaseUrl();
12740
13999
  setBaseUrl(basUrl);
12741
14000
  return basUrl;
12742
14001
  }
@@ -12885,117 +14144,14 @@ function UploadModal(props) {
12885
14144
  return (jsxRuntime.jsx(impactUiV3.Modal, { onClose: handleModalClose, onPrimaryButtonClick: handleFileUpload, onSecondaryButtonClick: handleModalClose, open: isUploadModalOpen, size: "small", title: "Upload Document", primaryButtonLabel: "Upload", secondaryButtonLabel: "Cancel", primaryButtonProps: { disabled: isLoading }, secondaryButtonProps: { disabled: isLoading }, children: isLoading ? (jsxRuntime.jsx(impactUiV3.Loader, { text: "Uploading file..." })) : (jsxRuntime.jsxs("div", { className: classes.uploadModalInnerSec, children: [jsxRuntime.jsx("input", { type: "file", ref: fileInputRef, onChange: handleFileSelect, accept: ".pdf", style: { display: "none" }, disabled: isLoading }), jsxRuntime.jsx(impactUiV3.Button, { onClick: () => fileInputRef.current.click(), variant: "outlined", disabled: isLoading, children: "Select PDF File" }), selectedFile && (jsxRuntime.jsxs("p", { style: { marginTop: "10px" }, children: ["Selected File: ", selectedFile.name] }))] })) }));
12886
14145
  }
12887
14146
 
12888
- /** A skill is a folder: SKILL.md (its name and description, then its steps) and the files it refers to, such
12889
- * as references/mcp-contracts.md. Picked files are read here as text, keyed by their path in that folder,
12890
- * and saved for the signed-in user by the agent (POST {baseUrl}/chatbot/agent/skills). Unlike a paste into
12891
- * the chat, an upload keeps the line breaks and the skill's other files. */
12892
- const MAX_FILES = 50;
12893
- const TEXT_EXTENSIONS = [".md", ".txt", ".json", ".yaml", ".yml", ".csv"];
12894
- const isSkillFile = (path) => path === "SKILL.md" || path.endsWith("/SKILL.md");
12895
- const isText = (name) => TEXT_EXTENSIONS.some((ext) => name.toLowerCase().endsWith(ext));
12896
- /** What the agent answered; a 200 may be the object itself or wrapped as {data: {...}}. */
12897
- const savedOf = (response) => response?.data?.data || response?.data || {};
12898
- /** Why the agent did not save it: the 422's detail ("not saved: ..."), else the message or status. */
12899
- const whyNot = (error) => {
12900
- const body = error?.response?.data;
12901
- const said = body?.detail || body?.message || body?.data?.detail;
12902
- if (typeof said === "string" && said)
12903
- return said;
12904
- if (said)
12905
- return JSON.stringify(said);
12906
- return error?.response?.status ? `the agent answered ${error.response.status}` : String(error?.message || error);
12907
- };
12908
- function SkillUploadModal(props) {
12909
- const { isOpen, setIsOpen, baseUrl, displaySnackMessages, onUseText } = props;
12910
- const [picked, setPicked] = React.useState({});
12911
- const [skipped, setSkipped] = React.useState(0);
12912
- const [isSaving, setIsSaving] = React.useState(false);
12913
- const [saved, setSaved] = React.useState(null);
12914
- const [error, setError] = React.useState("");
12915
- const folderRef = React.useRef(null);
12916
- const filesRef = React.useRef(null);
12917
- const classes = useStyles$b();
12918
- const reset = () => {
12919
- setPicked({});
12920
- setSkipped(0);
12921
- setSaved(null);
12922
- setError("");
12923
- };
12924
- const handleClose = () => {
12925
- if (isSaving)
12926
- return;
12927
- setIsOpen(false);
12928
- reset();
12929
- };
12930
- const take = async (list) => {
12931
- if (!list)
12932
- return;
12933
- const next = { ...picked };
12934
- let left = 0;
12935
- for (const file of Array.from(list)) {
12936
- const path = file.webkitRelativePath || file.name;
12937
- if (!isText(file.name)) {
12938
- left += 1; // a folder may hold images or .DS_Store: only text files are a skill's
12939
- continue;
12940
- }
12941
- if (!(path in next) && Object.keys(next).length >= MAX_FILES) {
12942
- displaySnackMessages(`A skill can have at most ${MAX_FILES} files`, "error");
12943
- break;
12944
- }
12945
- next[path] = await file.text();
12946
- }
12947
- setPicked(next);
12948
- setSkipped(skipped + left);
12949
- setSaved(null);
12950
- setError("");
12951
- };
12952
- const paths = Object.keys(picked);
12953
- const hasSkill = paths.some(isSkillFile);
12954
- const handleSave = async () => {
12955
- if (!hasSkill) {
12956
- displaySnackMessages("Pick the skill's SKILL.md (or its folder) first", "error");
12957
- return;
12958
- }
12959
- try {
12960
- setIsSaving(true);
12961
- setError("");
12962
- const response = await uploadSkill(picked, baseUrl);
12963
- setSaved(savedOf(response));
12964
- displaySnackMessages("Skill saved", "success");
12965
- }
12966
- catch (err) {
12967
- console.error("uploadSkill error:", err);
12968
- setError(whyNot(err));
12969
- }
12970
- finally {
12971
- setIsSaving(false);
12972
- }
12973
- };
12974
- const use = (text) => {
12975
- onUseText?.(text);
12976
- setIsOpen(false);
12977
- reset();
12978
- };
12979
- const files = saved?.files || [];
12980
- const missing = saved?.missing_files || [];
12981
- const runText = saved?.name ? `Run skill ${saved.name} in Preview mode` : "";
12982
- return (jsxRuntime.jsx(impactUiV3.Modal, { onClose: handleClose, onPrimaryButtonClick: saved ? handleClose : handleSave, onSecondaryButtonClick: handleClose, open: isOpen, size: "small", title: "Upload Skill", primaryButtonLabel: saved ? "Done" : "Save the skill", secondaryButtonLabel: "Cancel", primaryButtonProps: { disabled: isSaving || (!saved && !hasSkill) }, secondaryButtonProps: { disabled: isSaving }, children: isSaving ? (jsxRuntime.jsx(impactUiV3.Loader, { text: "Saving the skill..." })) : saved ? (jsxRuntime.jsxs("div", { style: { padding: "16px 20px", lineHeight: 1.5 }, children: [jsxRuntime.jsxs("p", { style: { margin: "0 0 8px" }, children: ["Saved ", jsxRuntime.jsx("b", { children: saved.name }), " (version ", saved.version, typeof saved.characters === "number" ? `, ${saved.characters.toLocaleString()} characters` : "", files.length ? `, with ${files.join(", ")}` : "", ")."] }), missing.length > 0 && (jsxRuntime.jsxs("p", { style: { margin: "0 0 8px" }, children: ["It refers to ", missing.join(", "), ", which was not uploaded."] })), saved.trigger && (jsxRuntime.jsxs("p", { style: { margin: "0 0 8px" }, children: ["It has a trigger: it ", saved.trigger_said, ". It is not on yet. To turn it on, send Iris:", " ", jsxRuntime.jsx("i", { children: saved.turn_on })] })), jsxRuntime.jsxs("div", { style: { display: "flex", gap: "8px", flexWrap: "wrap", marginTop: "12px" }, children: [runText && (jsxRuntime.jsxs(impactUiV3.Button, { variant: "outlined", onClick: () => use(runText), children: ["Put \"", runText, "\" in the chat"] })), saved.trigger && saved.turn_on && (jsxRuntime.jsxs(impactUiV3.Button, { variant: "outlined", onClick: () => use(saved.turn_on), children: ["Put \"", saved.turn_on, "\" in the chat"] }))] })] })) : (jsxRuntime.jsxs("div", { className: classes.uploadModalInnerSec, style: { height: "auto", minHeight: "150px" }, children: [jsxRuntime.jsx("input", { type: "file", ref: folderRef, onChange: (e) => {
12983
- take(e.target.files);
12984
- e.target.value = "";
12985
- }, style: { display: "none" }, multiple: true, ...{ webkitdirectory: "", directory: "" } }), jsxRuntime.jsx("input", { type: "file", ref: filesRef, onChange: (e) => {
12986
- take(e.target.files);
12987
- e.target.value = "";
12988
- }, style: { display: "none" }, multiple: true, accept: TEXT_EXTENSIONS.join(",") }), jsxRuntime.jsxs("div", { style: { display: "flex", gap: "8px", flexWrap: "wrap", justifyContent: "center" }, children: [jsxRuntime.jsx(impactUiV3.Button, { variant: "outlined", onClick: () => folderRef.current?.click(), children: "Pick the skill's folder" }), jsxRuntime.jsx(impactUiV3.Button, { variant: "outlined", onClick: () => filesRef.current?.click(), children: "Pick its files" })] }), paths.length > 0 ? (jsxRuntime.jsxs("div", { style: { marginTop: "12px", width: "100%" }, children: [jsxRuntime.jsx("ul", { style: { margin: 0, paddingLeft: "18px", maxHeight: "140px", overflowY: "auto" }, children: paths.map((path) => (jsxRuntime.jsx("li", { children: path }, path))) }), !hasSkill && jsxRuntime.jsx("p", { style: { margin: "8px 0 0" }, children: "No SKILL.md picked yet." }), skipped > 0 && (jsxRuntime.jsxs("p", { style: { margin: "8px 0 0" }, children: [skipped, " file", skipped === 1 ? " was" : "s were", " left out: a skill's files are text (", TEXT_EXTENSIONS.join(" "), ")."] }))] })) : (jsxRuntime.jsx("p", { style: { marginTop: "12px", textAlign: "center" }, children: "A skill is a SKILL.md and any files it refers to. Once saved, ask Iris to run it by name, now or on a schedule." })), error && jsxRuntime.jsxs("p", { style: { marginTop: "10px", color: "#b42318" }, children: ["Not saved: ", error.replace(/^not saved:\s*/i, "")] })] })) }));
12989
- }
12990
-
12991
14147
  const useStyles$2 = styles.makeStyles(() => ({
12992
14148
  input: {
12993
14149
  width: "100%",
12994
- padding: `${utils.pxToRem(8)} ${utils.pxToRem(12)}`,
14150
+ padding: `${pxToRem(8)} ${pxToRem(12)}`,
12995
14151
  fontFamily: "Manrope",
12996
- fontSize: utils.pxToRem(14),
12997
- border: `${utils.pxToRem(1)} solid ${colours$1.neutralBorder}`,
12998
- borderRadius: utils.pxToRem(4),
14152
+ fontSize: pxToRem(14),
14153
+ border: `${pxToRem(1)} solid ${colours.neutralBorder}`,
14154
+ borderRadius: pxToRem(4),
12999
14155
  outline: "none",
13000
14156
  boxSizing: "border-box",
13001
14157
  },
@@ -13172,6 +14328,219 @@ var SvgClearFilter = function SvgClearFilter(props) {
13172
14328
  })))));
13173
14329
  };
13174
14330
 
14331
+ // Internalized constants (were from config/constants)
14332
+ const DEFAULT_DATE_FORMAT = "MM/DD/YYYY";
14333
+ const START_DATE = "2000-01-01";
14334
+ const END_DATE = "2050-12-31";
14335
+ const useStyles$1 = makeStyles((theme) => ({
14336
+ monthYearDropDown: {
14337
+ display: "inline-flex",
14338
+ },
14339
+ styledSelect: {
14340
+ border: "none",
14341
+ margin: "0 0.5rem",
14342
+ outline: "none",
14343
+ ...theme.typography.subtitle1,
14344
+ fontWeight: 600,
14345
+ },
14346
+ }));
14347
+ /**
14348
+ *
14349
+ * @param {moment} startDate
14350
+ * @param {moment} endDate
14351
+ * @param {string} disableType
14352
+ * @returns year
14353
+ *
14354
+ * This function takes in start date, end date and disable type as parameters
14355
+ * and based on the disable type conditions, it will return the current year,
14356
+ * from the calendar rendering should start
14357
+ *
14358
+ * For ex: if the dates are past disabled, we will either start rendering the calendar from
14359
+ * the start date year or if start date is not mentioned, we will render from the present year
14360
+ * Similarly if we have future disabled, we will either end rendering the calendar from the
14361
+ * end date year or if end date is not mentioned, we will render till the present year
14362
+ */
14363
+ const getCurrentYear = (startDate, endDate, disableType) => {
14364
+ //If it is past disabled and we have a valid start date
14365
+ if (disableType &&
14366
+ disableType?.includes("Past") &&
14367
+ moment(startDate).isValid()) {
14368
+ return moment(startDate).year(); //return start date year
14369
+ }
14370
+ //If it is future disabled and we have a valid end date
14371
+ if (disableType &&
14372
+ disableType?.includes("Future") &&
14373
+ moment(endDate).isValid()) {
14374
+ return moment(endDate).year(); //return end date year
14375
+ }
14376
+ return moment().year(); //else return present date year
14377
+ };
14378
+ const DateRangePickerComponent = (props) => {
14379
+ useStyles$1();
14380
+ const [focusedInput, setfocusedInput] = React.useState(null);
14381
+ const [yearArray, setyearArray] = React.useState([moment().year()]);
14382
+ const [startDate, setStartDate] = React.useState(props.startDate);
14383
+ const [endDate, setEndDate] = React.useState(props.endDate);
14384
+ const [reset, setReset] = React.useState(false);
14385
+ // Read tenantDateFormat from props first, fallback to localStorage
14386
+ const tenantDateFormat = props.tenantDateFormat ||
14387
+ (typeof localStorage !== "undefined"
14388
+ ? localStorage.getItem("tenantDateFormat")
14389
+ : null) ||
14390
+ DEFAULT_DATE_FORMAT;
14391
+ React.useEffect(() => {
14392
+ if ((startDate && props.startDate && startDate.diff(props.startDate)) ||
14393
+ (endDate && props.endDate && endDate.diff(props.endDate)) ||
14394
+ (!startDate && props.startDate) ||
14395
+ (!endDate && props.endDate)) {
14396
+ setStartDate(props.startDate);
14397
+ setEndDate(props.endDate);
14398
+ }
14399
+ else if (lodash.isNull(props.startDate) &&
14400
+ lodash.isNull(props.endDate) &&
14401
+ !lodash.isNull(startDate) &&
14402
+ !lodash.isNull(endDate)) {
14403
+ setStartDate(null);
14404
+ setEndDate(null);
14405
+ }
14406
+ }, [props.startDate, props.endDate]);
14407
+ const configureYear = () => {
14408
+ const startYear = props.startDate
14409
+ ? props.startDate.isBefore(props.startYear)
14410
+ : props.startYear;
14411
+ const currentYearBasedOnDate = getCurrentYear(startYear, props.endDate, props.disableType);
14412
+ let yearArr = [currentYearBasedOnDate];
14413
+ //till 2050, it will add all the years
14414
+ for (let i = 0; i < 2050 - currentYearBasedOnDate; i++) {
14415
+ if (props.disableType && props.disableType.includes("Future")) {
14416
+ yearArr.push(yearArr[i] - 1);
14417
+ }
14418
+ else {
14419
+ yearArr.push(yearArr[i] + 1);
14420
+ }
14421
+ }
14422
+ if (props.startYear) {
14423
+ // Start year from 2019 incase of cluster plan
14424
+ let startYear = props.startYear;
14425
+ let pastYearArray = [];
14426
+ while (startYear < yearArr[0]) {
14427
+ pastYearArray.push(startYear);
14428
+ startYear++;
14429
+ }
14430
+ yearArr.unshift(...pastYearArray);
14431
+ }
14432
+ const currentYear = moment().year();
14433
+ if (!yearArr.includes(currentYear)) {
14434
+ yearArr.unshift(currentYear);
14435
+ }
14436
+ setyearArray(yearArr);
14437
+ };
14438
+ const isOutsideRange = (day) => {
14439
+ switch (props.disableType) {
14440
+ case "disableOnlyPast":
14441
+ //disables strictly past i.e current/today's date is not included
14442
+ return Boolean(moment(day.format(DEFAULT_DATE_FORMAT)).isBefore(moment().format(DEFAULT_DATE_FORMAT)));
14443
+ case "disablePast":
14444
+ //disables past i.e current/today's date is included
14445
+ return Boolean(moment(day.format(DEFAULT_DATE_FORMAT)).isSame(moment().format(DEFAULT_DATE_FORMAT), "days") ||
14446
+ moment(day.format(DEFAULT_DATE_FORMAT)).isBefore(moment().format(DEFAULT_DATE_FORMAT)));
14447
+ case "disableOnlyFuture":
14448
+ //disables strictly future i.e current/today's date is not included
14449
+ return Boolean(moment(day.format(DEFAULT_DATE_FORMAT)).isAfter(moment().format(DEFAULT_DATE_FORMAT)));
14450
+ case "disableFuture":
14451
+ //disables future i.e current/today's date is included
14452
+ return Boolean(moment(day.format(DEFAULT_DATE_FORMAT)).isSame(moment().format(DEFAULT_DATE_FORMAT), "days") ||
14453
+ moment(day.format(DEFAULT_DATE_FORMAT)).isAfter(moment().format(DEFAULT_DATE_FORMAT)));
14454
+ case "customRange":
14455
+ //we can pass custom range which evaluates if the date to be disabled or not
14456
+ //For example: disabling specific dates or only fridays etc..
14457
+ return props.customOutsideRange(day);
14458
+ default:
14459
+ //By default, it doesn't disable any date
14460
+ return false;
14461
+ }
14462
+ };
14463
+ const dateRangeCalculator = async (startDate, endDate) => {
14464
+ /**
14465
+ * If the date selection is weekly, we keep start date as starting day of the week,
14466
+ * i.e if we select a day, we return the output as starting day in that week
14467
+ */
14468
+ let weekStart = props.weeklySelection
14469
+ ? moment(startDate).startOf("week")
14470
+ : startDate;
14471
+ /**
14472
+ * If we make the date selection as weekly
14473
+ * End date would be end of the week but if the end date
14474
+ * is outside the range i.e future including today, we set
14475
+ * enddate as one day prior to today i.e subtract 1 day from today
14476
+ * We also make sure if the endDate is either null or invalid, we don't check for outside range
14477
+ */
14478
+ const validEndDate = endDate &&
14479
+ endDate.isValid() &&
14480
+ isOutsideRange(moment(endDate).endOf("week"))
14481
+ ? moment().subtract(1, "days")
14482
+ : moment(endDate).endOf("week");
14483
+ let weekEnd = props.weeklySelection ? validEndDate : endDate;
14484
+ if (weekStart && !weekStart.isValid()) {
14485
+ weekStart = null;
14486
+ }
14487
+ if (weekEnd && !weekEnd.isValid()) {
14488
+ weekEnd = null;
14489
+ }
14490
+ //If we clear, both weekStart and weekEnd will become null
14491
+ //Then we shift the month and year to current date
14492
+ if (!weekStart && !weekEnd) {
14493
+ await setTimeout(() => {
14494
+ }, 100);
14495
+ }
14496
+ props.onDatesChange(weekStart, weekEnd);
14497
+ };
14498
+ const isDayBlocked = (date) => {
14499
+ if (focusedInput === "startDate") {
14500
+ return (props.enabledStartDays &&
14501
+ !props.enabledStartDays.includes(moment(date).format("dddd")));
14502
+ }
14503
+ if (focusedInput === "endDate") {
14504
+ return (props.enabledEndDays &&
14505
+ !props.enabledEndDays.includes(moment(date).format("dddd")));
14506
+ }
14507
+ return false;
14508
+ };
14509
+ React.useEffect(() => {
14510
+ configureYear();
14511
+ }, []);
14512
+ React.useEffect(() => {
14513
+ if (props.resetOptions) {
14514
+ setStartDate(null);
14515
+ setEndDate(null);
14516
+ }
14517
+ }, [props.resetOptions]);
14518
+ const defaultYears = React.useMemo(() => {
14519
+ const startYear = Number(START_DATE.split("-")[0]);
14520
+ const endYear = Number(END_DATE.split("-")[0]);
14521
+ return Array.from({ length: endYear - startYear + 1 }, (_, index) => ({
14522
+ label: String(startYear + index),
14523
+ value: String(startYear + index),
14524
+ }));
14525
+ }, []); // Only calculate once
14526
+ const yearList = props?.customYears ?? defaultYears;
14527
+ React.useEffect(() => {
14528
+ if (props?.extra?.autoApplyDateRange && !reset) {
14529
+ dateRangeCalculator(startDate, endDate);
14530
+ }
14531
+ }, [startDate, endDate]);
14532
+ return (jsxRuntime.jsx("div", { id: "dateRangePicker", children: jsxRuntime.jsx(impactUiV3.DateRangePicker, { label: props?.label || "", placeholder: props?.placeholder || "", setStartDate: setStartDate, setEndDate: setEndDate, startDate: startDate, endDate: endDate, isDisabled: props.disabled, showClearDates: true, displayFormat: tenantDateFormat, startDateId: props.startDateId || "startDate", endDateId: props.endDateId || "endDate", withPortal: !props.noPortal, isOutsideRange: isOutsideRange, isDayBlocked: isDayBlocked, autoFocus: true, showMonthYearSelect: true, isRequired: props.isRequired, onPrimaryButtonClick: () => dateRangeCalculator(startDate, endDate), onSecondaryButtonClick: () => {
14533
+ setStartDate(null);
14534
+ setEndDate(null);
14535
+ }, onResetClick: () => {
14536
+ setStartDate(null);
14537
+ setEndDate(null);
14538
+ setReset(true);
14539
+ dateRangeCalculator(null, null);
14540
+ setTimeout(() => setReset(false), 0);
14541
+ }, customYears: yearList, hideKeyboardShortcutsPanel: true, enabledStartDays: props.enabledStartDays, enabledEndDays: props.enabledEndDays, handleStartDateFocus: () => setfocusedInput("startDate"), handleEndDateFocus: () => setfocusedInput("endDate"), isAgGridCellRenderer: props?.isAgGridCellRenderer, labelOrientation: props?.labelOrientation || "top" }) }));
14542
+ };
14543
+
13175
14544
  /**
13176
14545
  * Component to render filter value input based on display_type
13177
14546
  * This component handles different field types similar to form/index.jsx
@@ -13299,7 +14668,7 @@ const FilterValueInput = ({ filterConfig, value, onChange, options = [], isLoadi
13299
14668
  const dateFormat = extra.dateFormat || "MM-DD-YYYY";
13300
14669
  const disableType = extra.disableType || extra.disablePast ? "disablePast" : null;
13301
14670
  const startYear = extra.startYear;
13302
- return (jsxRuntime.jsx(RangePicker, { label: filterConfig?.label || extra.label || "Select date range", startDateId: extra.startDateId || "start_date_id", endDateId: extra.endDateId || "end_date_id", showMonthYearSelect: extra.showMonthYearSelect !== false, startDate: localValue?.[0]
14671
+ return (jsxRuntime.jsx(DateRangePickerComponent, { label: filterConfig?.label || extra.label || "Select date range", startDateId: extra.startDateId || "start_date_id", endDateId: extra.endDateId || "end_date_id", showMonthYearSelect: extra.showMonthYearSelect !== false, startDate: localValue?.[0]
13303
14672
  ? moment.isMoment(localValue[0])
13304
14673
  ? localValue[0]
13305
14674
  : moment(localValue[0]).isValid()
@@ -13452,7 +14821,7 @@ const fetchFilterValues = async (filterConfig, existingFilters = [], filterOptio
13452
14821
  return {
13453
14822
  // Show decoded label to the user, but keep the original
13454
14823
  // encoded value (with __ia_char) for backend requests.
13455
- label: utils.replaceSpecialCharacter(stringValue),
14824
+ label: replaceSpecialCharacter$2(stringValue),
13456
14825
  value: stringValue,
13457
14826
  };
13458
14827
  });
@@ -13710,7 +15079,7 @@ const formatMentionDisplay = (filterName, values, maxVisible = 3) => {
13710
15079
  const visibleValues = values.slice(0, maxVisible);
13711
15080
  values.length - maxVisible;
13712
15081
  // Decode any special character codes for display purposes only.
13713
- const displayVisibleValues = visibleValues.map((v) => replaceSpecialCharacter(String(v)));
15082
+ const displayVisibleValues = visibleValues.map((v) => replaceSpecialCharacter$2(String(v)));
13714
15083
  let display = `@${filterName}::${displayVisibleValues.join(",")}`;
13715
15084
  return display;
13716
15085
  };
@@ -13851,6 +15220,8 @@ const useMentionState = () => {
13851
15220
 
13852
15221
  const ChatbotInput = (props) => {
13853
15222
  const { newChatScreen, inputValue, setInputValue, isStopIcon, handleMicClick, handleRefresh, onSendIconClick, onStopIconClick, currentMode, filterOptions, onSaveClick, savedFilterSets, onFilterSetSelect, onTriggerRefresh, selectedFilterSet, onClearFilterSet, answerMode, setAnswerMode, } = props;
15223
+ const { components } = useChatbotDeps();
15224
+ const hasFilterComponent = !!components?.FilterComponent;
13854
15225
  const editorRef = React.useRef(null);
13855
15226
  const selectRef = React.useRef(null);
13856
15227
  const filterSetSelectRef = React.useRef(null);
@@ -13894,7 +15265,7 @@ const ChatbotInput = (props) => {
13894
15265
  // Decode special character placeholders only for the label shown
13895
15266
  // to the user. The underlying value (used in payloads) remains
13896
15267
  // unchanged so that backend continues to receive the ia_char codes.
13897
- const label = replaceSpecialCharacter(rawLabel);
15268
+ const label = replaceSpecialCharacter$2(rawLabel);
13898
15269
  // Handle duplicate labels
13899
15270
  if (labelCount[label]) {
13900
15271
  labelCount[label]++;
@@ -14851,7 +16222,7 @@ const ChatbotInput = (props) => {
14851
16222
  */
14852
16223
  const handleSendMessage = () => {
14853
16224
  // Decode any ia_char placeholders for display
14854
- const formattedText = replaceSpecialCharacter(getFormattedTextForSending());
16225
+ const formattedText = replaceSpecialCharacter$2(getFormattedTextForSending());
14855
16226
  if (!formattedText.trim() && lodash.isEmpty(chatbotContext))
14856
16227
  return;
14857
16228
  // Extract user explicit input from mentions
@@ -15162,12 +16533,12 @@ const ChatbotInput = (props) => {
15162
16533
  !target.closest(".answer-mode-wrapper")) {
15163
16534
  editorRef.current.focus();
15164
16535
  }
15165
- }, children: jsxRuntime.jsxs("div", { className: `chat-input-wrapper ${isFixed ? "stacked" : ""} ${selectedFilterSet ? "has-filter-selected" : ""} ${(!isFixed || inputValue === "") && !newChatScreen && !selectedFilterSet ? "empty" : ""} ${!newChatScreen && !isFixed && !selectedFilterSet ? "single-line-textarea" : ""}`, style: { height }, children: [jsxRuntime.jsxs("div", { className: "chat-input-left-actions", children: [jsxRuntime.jsxs("div", { className: "filter-set-trigger-wrapper", ref: filterSetSelectRef, children: [jsxRuntime.jsx(impactUiV3.Tooltip, { title: hasMentionsInEditor || showMentionSelect ? "Cannot use filter set while @ mentions are active" : "Add filter set", children: jsxRuntime.jsx("button", { type: "button", className: `filter-set-plus-btn${hasMentionsInEditor || showMentionSelect ? " disabled" : ""}`, onClick: () => {
16536
+ }, children: jsxRuntime.jsxs("div", { className: `chat-input-wrapper ${isFixed ? "stacked" : ""} ${selectedFilterSet ? "has-filter-selected" : ""} ${(!isFixed || inputValue === "") && !newChatScreen && !selectedFilterSet ? "empty" : ""} ${!newChatScreen && !isFixed && !selectedFilterSet ? "single-line-textarea" : ""}`, style: { height }, children: [hasFilterComponent && (jsxRuntime.jsxs("div", { className: "chat-input-left-actions", children: [jsxRuntime.jsxs("div", { className: "filter-set-trigger-wrapper", ref: filterSetSelectRef, children: [jsxRuntime.jsx(impactUiV3.Tooltip, { title: hasMentionsInEditor || showMentionSelect ? "Cannot use filter set while @ mentions are active" : "Add filter set", children: jsxRuntime.jsx("button", { type: "button", className: `filter-set-plus-btn${hasMentionsInEditor || showMentionSelect ? " disabled" : ""}`, onClick: () => {
15166
16537
  if (hasMentionsInEditor || showMentionSelect)
15167
16538
  return;
15168
16539
  setShowFilterSetMenu(!showFilterSetMenu);
15169
16540
  setIsFilterSetMenuOpen(!showFilterSetMenu);
15170
- }, children: jsxRuntime.jsx(SvgAddFilter, {}) }) }), showFilterSetMenu && (jsxRuntime.jsx("div", { className: "filter-set-select-dropdown", children: jsxRuntime.jsx(impactUiV3.Select, { currentOptions: filterSetMenuOptions, setCurrentOptions: () => { }, initialOptions: filterSetMenuOptions, placeholder: "Select...", handleChange: handleFilterSetMenuChange, isOpen: isFilterSetMenuOpen, setIsOpen: setIsFilterSetMenuOpen, selectedOptions: filterSetSelectedOptions, setSelectedOptions: () => { }, isCloseWhenClickOutside: false, isWithSearch: false, isMulti: false, disabled: false, isLoading: false, emptyMessage: "No options" }) }))] }), selectedFilterSet && (jsxRuntime.jsxs("div", { className: "filter-set-chip", children: [jsxRuntime.jsx(SvgFilterFolder, { className: "filter-set-chip-icon" }), jsxRuntime.jsx("span", { className: "filter-set-chip-label", children: selectedFilterSet.name || selectedFilterSet.label }), jsxRuntime.jsx("button", { type: "button", className: "filter-set-chip-clear", onClick: () => onClearFilterSet?.(), children: jsxRuntime.jsx(SvgClearFilter, {}) })] }))] }), jsxRuntime.jsx("div", { ref: editorRef, className: "chat-input-editor", contentEditable: true, tabIndex: 0, role: "textbox", "aria-label": "Ask anything...", "aria-multiline": "true", "data-placeholder": "Ask anything...", onInput: handleInput, onKeyDown: (e) => {
16541
+ }, children: jsxRuntime.jsx(SvgAddFilter, {}) }) }), showFilterSetMenu && (jsxRuntime.jsx("div", { className: "filter-set-select-dropdown", children: jsxRuntime.jsx(impactUiV3.Select, { currentOptions: filterSetMenuOptions, setCurrentOptions: () => { }, initialOptions: filterSetMenuOptions, placeholder: "Select...", handleChange: handleFilterSetMenuChange, isOpen: isFilterSetMenuOpen, setIsOpen: setIsFilterSetMenuOpen, selectedOptions: filterSetSelectedOptions, setSelectedOptions: () => { }, isCloseWhenClickOutside: false, isWithSearch: false, isMulti: false, disabled: false, isLoading: false, emptyMessage: "No options" }) }))] }), selectedFilterSet && (jsxRuntime.jsxs("div", { className: "filter-set-chip", children: [jsxRuntime.jsx(SvgFilterFolder, { className: "filter-set-chip-icon" }), jsxRuntime.jsx("span", { className: "filter-set-chip-label", children: selectedFilterSet.name || selectedFilterSet.label }), jsxRuntime.jsx("button", { type: "button", className: "filter-set-chip-clear", onClick: () => onClearFilterSet?.(), children: jsxRuntime.jsx(SvgClearFilter, {}) })] }))] })), jsxRuntime.jsx("div", { ref: editorRef, className: "chat-input-editor", contentEditable: true, tabIndex: 0, role: "textbox", "aria-label": "Ask anything...", "aria-multiline": "true", "data-placeholder": "Ask anything...", onInput: handleInput, onKeyDown: (e) => {
15171
16542
  if (e.key === "Escape") {
15172
16543
  // Don't handle Escape for date range picker - it has its own Cancel button
15173
16544
  if (showMentionSelect) {
@@ -15316,7 +16687,7 @@ const ChatbotInput = (props) => {
15316
16687
  top: `680px`,
15317
16688
  left: `${dropdownPosition.left}px`,
15318
16689
  zIndex: 10000,
15319
- }, children: jsxRuntime.jsx(RangePicker
16690
+ }, children: jsxRuntime.jsx(DateRangePickerComponent
15320
16691
  // disableType="disableOnlyPast"
15321
16692
  , {
15322
16693
  // disableType="disableOnlyPast"
@@ -15928,185 +17299,6 @@ const useConversationManagement = (chatDataRef, currentMode, activeConversationI
15928
17299
  };
15929
17300
  };
15930
17301
 
15931
- const useStyles$1 = styles.makeStyles({
15932
- container: {
15933
- display: "flex",
15934
- flexDirection: "column",
15935
- alignItems: "center",
15936
- justifyContent: "center",
15937
- width: "100%",
15938
- height: "100%",
15939
- padding: "16px",
15940
- boxSizing: "border-box",
15941
- },
15942
- icon: {
15943
- flexShrink: 0,
15944
- overflow: "visible",
15945
- },
15946
- title: {
15947
- color: "#31416E",
15948
- textAlign: "center",
15949
- fontFamily: "Manrope",
15950
- fontSize: "20px",
15951
- fontStyle: "normal",
15952
- fontWeight: 800,
15953
- lineHeight: "150%",
15954
- margin: 0,
15955
- padding: "20px 0 0 0",
15956
- },
15957
- subtitle: {
15958
- color: "#31416E",
15959
- textAlign: "center",
15960
- fontFamily: "Manrope",
15961
- fontSize: "14px",
15962
- fontStyle: "normal",
15963
- fontWeight: 400,
15964
- lineHeight: "160%",
15965
- margin: 0,
15966
- padding: 0,
15967
- },
15968
- buttonWrapper: {
15969
- marginTop: "16px",
15970
- },
15971
- hidden: {
15972
- display: "none",
15973
- },
15974
- });
15975
- const ChatbotSaveFilterComponent = (props) => {
15976
- const classes = useStyles$1();
15977
- const { savedFilterSets, partialClose, chatBotWidth } = props;
15978
- const [showFilter, setShowFilter] = React.useState(!lodash.isEmpty(savedFilterSets));
15979
- /**
15980
- * onFilterDashboardClick function is called when we click the apply filter
15981
- * button in the select filter option
15982
- * @param {object} dependencyData
15983
- */
15984
- const onFilterDashboardClick = async (dependencyData) => {
15985
- console.log("dependencyData4321", dependencyData);
15986
- };
15987
- const setChatbotFilterConfiguration = async (screenName) => {
15988
- if (lodash.isEmpty(props.chatbotFilterDashboardConfiguration)) {
15989
- const data = await utils$1.fetchFilterFieldValues("Chatbot", props.savedFilterSelection);
15990
- if (lodash.isEmpty(props.filterDashboardConfiguration)) {
15991
- let filterConfigData = [
15992
- {
15993
- filterDashboardData: data,
15994
- isCrossDimensionFilter: false,
15995
- screen_name: screenName,
15996
- },
15997
- ];
15998
- const filterConfig = utils$1.formattedFilterConfiguration("chatbotFilterConfiguration", filterConfigData, "Chatbot");
15999
- props.setFilterConfiguration(filterConfig);
16000
- }
16001
- }
16002
- };
16003
- React.useEffect(() => {
16004
- setChatbotFilterConfiguration("Chatbot");
16005
- }, []);
16006
- React.useEffect(() => {
16007
- if (!lodash.isEmpty(savedFilterSets)) {
16008
- setShowFilter(true);
16009
- }
16010
- }, [savedFilterSets]);
16011
- React.useEffect(() => {
16012
- const drawer = document.querySelector(".MuiModal-root.MuiDrawer-root");
16013
- if (drawer) {
16014
- drawer.style.display = partialClose ? "none" : "";
16015
- }
16016
- }, [partialClose]);
16017
- React.useEffect(() => {
16018
- if (!showFilter)
16019
- return;
16020
- const Z_INDEX = "9999";
16021
- const patchDrawer = () => {
16022
- const drawer = document.querySelector(".MuiModal-root.MuiDrawer-root");
16023
- if (drawer && drawer.style.zIndex !== Z_INDEX) {
16024
- drawer.style.zIndex = Z_INDEX;
16025
- }
16026
- if (drawer) {
16027
- drawer.style.setProperty("position", "relative");
16028
- }
16029
- const mainContainer = document.querySelector(".impact-drawer-filter-main-container");
16030
- if (mainContainer) {
16031
- mainContainer.style.setProperty("flex-direction", "column", "important");
16032
- }
16033
- const leftPanel = document.querySelector(".impact_drawer_filter_container_left_panel");
16034
- if (leftPanel) {
16035
- leftPanel.style.setProperty("height", "50px");
16036
- leftPanel.style.setProperty("background", "white");
16037
- leftPanel.style.setProperty("border", "none");
16038
- }
16039
- const filterHeader = document.querySelector(".impact_drawer_filter_header");
16040
- if (filterHeader) {
16041
- filterHeader.style.setProperty("display", "none");
16042
- }
16043
- const filterTabs = document.querySelector(".impact_drawer_filter_left_filters_tabs");
16044
- if (filterTabs) {
16045
- filterTabs.style.setProperty("flex-direction", "row");
16046
- filterTabs.style.setProperty("background", "white");
16047
- }
16048
- const filterContainer = document.querySelector(".impact_drawer_filter_container.impact_drawer_filter_container_large");
16049
- if (filterContainer) {
16050
- const computedWidth = chatBotWidth ? `${chatBotWidth - 86}px` : "616px";
16051
- filterContainer.style.setProperty("width", computedWidth);
16052
- }
16053
- const rightPanel = document.querySelector(".impact_drawer_filter_container .impact_drawer_filter_container_right_panel");
16054
- if (rightPanel) {
16055
- rightPanel.style.setProperty("height", "600px");
16056
- rightPanel.style.setProperty("width", "100%");
16057
- }
16058
- const backdrop = document.querySelector(".MuiBackdrop-root.MuiModal-backdrop");
16059
- if (backdrop) {
16060
- backdrop.style.setProperty("position", "unset");
16061
- }
16062
- const drawerPaper = document.querySelector(".MuiDrawer-paper.MuiDrawer-paperAnchorRight");
16063
- if (drawerPaper) {
16064
- drawerPaper.style.setProperty("box-shadow", "none");
16065
- drawerPaper.style.setProperty("top", "110px");
16066
- drawerPaper.style.setProperty("right", "3px");
16067
- }
16068
- const filterSeparator = document.querySelector(".impact-drawer-filter-separator");
16069
- if (filterSeparator) {
16070
- filterSeparator.style.setProperty("display", "none");
16071
- }
16072
- const paperRounded = document.querySelector(".MuiPaper-root.MuiPaper-elevation0.MuiPaper-rounded");
16073
- if (paperRounded) {
16074
- paperRounded.style.setProperty("margin-right", "24px");
16075
- }
16076
- const filterFooter = document.querySelector(".impact_drawer_filter_footer");
16077
- if (filterFooter) {
16078
- filterFooter.style.setProperty("bottom", "120px");
16079
- filterFooter.style.setProperty("left", "0");
16080
- }
16081
- const filterBody = document.querySelector(".impact_drawer_filter_body.impact_drawer_filter_footer_no_buttons");
16082
- if (filterBody) {
16083
- filterBody.style.setProperty("padding-right", "40px");
16084
- }
16085
- };
16086
- patchDrawer();
16087
- const observer = new MutationObserver(patchDrawer);
16088
- observer.observe(document.body, { childList: true, subtree: true });
16089
- return () => observer.disconnect();
16090
- }, [showFilter, chatBotWidth]);
16091
- return (jsxRuntime.jsx("div", { className: partialClose ? classes.hidden : undefined, children: !showFilter ?
16092
- jsxRuntime.jsxs("div", { className: classes.container, children: [jsxRuntime.jsx(NoFilterSetSavedIcon, { width: "189px", height: "126px", className: classes.icon }), jsxRuntime.jsx("p", { className: classes.title, children: "No filter set saved!" }), jsxRuntime.jsx("p", { className: classes.subtitle, children: "Create and save a filter set to use as your default scope or apply it anytime during a conversation" }), jsxRuntime.jsx("div", { className: classes.buttonWrapper, children: jsxRuntime.jsx(impactUiV3.Button, { variant: "primary", onClick: () => setShowFilter(true), children: "Create A Filter Set" }) })] }) :
16093
- jsxRuntime.jsx("div", { children: jsxRuntime.jsx(CoreComponentScreen, { showPageHeader: false,
16094
- // Filter dashboard props
16095
- showFilterDashboard: true, filterConfigKey: "chatbotFilterConfiguration", onApplyFilter: onFilterDashboardClick, autoApplyEnabled: false, hideNoDataFound: true, defaultOpenModel: true }) }) }));
16096
- };
16097
- const mapStateToProps = (state) => {
16098
- return {
16099
- chatbotFilterDashboardConfiguration: state.filterReducer.filterDashboardConfiguration["chatbotFilterConfiguration"],
16100
- savedFilterSelection: state.filterReducer.savedFilterSelection,
16101
- };
16102
- };
16103
- const mapDispatchToProps = (dispatch) => {
16104
- return {
16105
- setFilterConfiguration: (filterConfiguration) => dispatch(filterAction.setFilterConfiguration(filterConfiguration)),
16106
- };
16107
- };
16108
- var ChatbotSaveFilterComponent$1 = reactRedux.connect(mapStateToProps, mapDispatchToProps)(ChatbotSaveFilterComponent);
16109
-
16110
17302
  var _mask$1, _path$5, _path2$1, _defs$1;
16111
17303
  function _extends$6() { return _extends$6 = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$6.apply(null, arguments); }
16112
17304
  var SvgMimimizedIconLogo = function SvgMimimizedIconLogo(props) {
@@ -16762,8 +17954,72 @@ const AllocationDetailPanel = () => {
16762
17954
  return reactDom.createPortal(panel, document.body);
16763
17955
  };
16764
17956
 
17957
+ /**
17958
+ * SmartBot Redux reducer.
17959
+ * State shape and behaviour match the consumer's core/reducers/smartBotReducer.js exactly.
17960
+ */
17961
+ const smartBotInitialState = {
17962
+ smartBotActive: false,
17963
+ isSmartBotRestricted: true,
17964
+ chatbotContext: {},
17965
+ thinkingContext: {
17966
+ thinkingContent: "",
17967
+ thinkingHeaderMessage: "Working for 0m:00s",
17968
+ streamStartTime: null,
17969
+ isStreamCompleted: false,
17970
+ finalElapsedSeconds: null,
17971
+ },
17972
+ heirarchyKeyValuePairs: {},
17973
+ currentAgentChatId: "",
17974
+ persistedFormValues: {},
17975
+ savedFilterSets: [],
17976
+ stepFormRestreamPayload: null,
17977
+ stepFormStreamData: null,
17978
+ minimizedStreamData: null,
17979
+ chatbotFilterOptions: [],
17980
+ };
17981
+ function smartBotReducer(state = smartBotInitialState, action) {
17982
+ switch (action.type) {
17983
+ case SET_SMART_BOT_ACTIVE:
17984
+ return { ...state, smartBotActive: action.payload };
17985
+ case SET_IS_SMART_BOT_RESTRICTED:
17986
+ return { ...state, isSmartBotRestricted: action.payload };
17987
+ case SET_CHATBOT_CONTEXT:
17988
+ return { ...state, chatbotContext: action.payload };
17989
+ case SET_THINKING_CONTEXT:
17990
+ return { ...state, thinkingContext: action.payload };
17991
+ case SET_HIERARCHY_KEY_VALUE_PAIR:
17992
+ return { ...state, heirarchyKeyValuePairs: action.payload };
17993
+ case SET_CURRENT_AGENT_CHAT_ID:
17994
+ return { ...state, currentAgentChatId: action.payload };
17995
+ case SET_PERSISTED_FORM_VALUES:
17996
+ return {
17997
+ ...state,
17998
+ persistedFormValues: {
17999
+ ...state.persistedFormValues,
18000
+ ...action.payload,
18001
+ },
18002
+ };
18003
+ case CLEAR_PERSISTED_FORM_VALUES:
18004
+ return { ...state, persistedFormValues: {} };
18005
+ case SET_SAVED_FILTER_SETS:
18006
+ return { ...state, savedFilterSets: action.payload };
18007
+ case SET_STEP_FORM_RESTREAM_PAYLOAD:
18008
+ return { ...state, stepFormRestreamPayload: action.payload };
18009
+ case SET_STEP_FORM_STREAM_DATA:
18010
+ return { ...state, stepFormStreamData: action.payload };
18011
+ case SET_MINIMIZED_STREAM_DATA:
18012
+ return { ...state, minimizedStreamData: action.payload };
18013
+ case SET_CHATBOT_FILTER_OPTIONS:
18014
+ return { ...state, chatbotFilterOptions: action.payload };
18015
+ default:
18016
+ return state;
18017
+ }
18018
+ }
18019
+
16765
18020
  const SmartBot = (props) => {
16766
18021
  const { userName, partialClose, setPartialClose, forceOpen, customBaseUrl = "", displayQuestions, questions = [] } = props;
18022
+ const { callbacks, components, selectors } = useChatbotDeps();
16767
18023
  const { showModal, setShowModal, minimizedMode, setMinimizedMode, userInput, setUserInput, position, setPosition, flowType, setFlowType, screenName, setScreenName, questionIndex, setQuestionIndex, currentAppLink, setCurrentAppLink, loader, setLoader, enableRefreshAction, setEnableRefreshAction, refreshLoader, setRefreshLoader, chatDataState, setChatDataState, showExtendedContent, setShowExtendedContent, currentMode, setCurrentMode, selectedModule, setSelectedModule, isCardVisible, setIsCardVisible, templateData, setTemplateData, showAlert, setShowAlert, grabPositionRef, chatDataRef, chatBodyRef, minimizedBtnRef, chatDataScreenLinkRef, navigate, location, dispatch, globalClasses, classes, dateFormat, filterReducerState, activeConversationId, setActiveConversationId, isModuleChanged, setIsModuleChanged, showChatPlaceholder, setShowChatPlaceholder, currentAgentId, setCurrentAgentId, baseUrl = customBaseUrl, setBaseUrl, currentSessionId, setCurrentSessionId, notificationData, agentTaskCompleted, setAgentTaskCompleted, customChatConfig, setCustomChatConfig, setMiddleWareFunction, chatBotInfoRef, chatDataInfoRef, initValue, setInitValue, sessionId, setSessionId, thinkingContent, setThinkingContent, isThinking, setIsThinking, chatId, setChatId, isStop, setIsStop, functionsRef, functionsState, setFunctionsState, thinkingHeaderMessage, setThinkingHeaderMessage, legacyAgentScreen, setLegacyAgentScreen, uniqueChatId, setUniqueChatId, fieldNumber, setFieldNumber, thinkingContext, isModalOpen, setIsModalOpen, utilityList, setUtilityList, isUploadModalOpen, setIsUploadModalOpen, isRefreshTriggered, setIsRefreshTriggered, additionalArgs, setAdditionalArgs, showSavedFilters, setShowSavedFilters, navSessionId, setNavSessionId, renameOpen, setRenameOpen, renameTargetId, setRenameTargetId, renameValue, setRenameValue, deleteOpen, setDeleteOpen, deleteTargetId, setDeleteTargetId, } = useChatState();
16768
18024
  // Add state for confirmation dialogs
16769
18025
  React.useState(false);
@@ -16771,11 +18027,8 @@ const SmartBot = (props) => {
16771
18027
  React.useState(false);
16772
18028
  React.useState(false);
16773
18029
  const [conversation, setConversation] = React.useState({});
16774
- // "Upload Skill": offered only when the agent's /info says skills.upload (asked once per base URL)
16775
- const [skillUploadOn, setSkillUploadOn] = React.useState(false);
16776
- const [isSkillUploadOpen, setIsSkillUploadOpen] = React.useState(false);
16777
18030
  const { chatbotContext, currentAgentChatId, minimizedStreamData } = reactRedux.useSelector((state) => state.smartBotReducer);
16778
- const savedFilterDashboard = reactRedux.useSelector((state) => state.filterReducer?.savedFilterDashboard);
18031
+ const savedFilterDashboard = reactRedux.useSelector(selectors?.getSavedFilterDashboard ?? NULL_SELECTOR);
16779
18032
  // Per-mode conversation ID tracking — prevents cross-mode contamination when
16780
18033
  // switching tabs while streams are pending.
16781
18034
  React.useRef({});
@@ -16797,7 +18050,7 @@ const SmartBot = (props) => {
16797
18050
  const [isLandingScreen, setIsLandingScreen] = React.useState(true);
16798
18051
  const [showSuggestionBanner, setShowSuggestionBanner] = React.useState(true);
16799
18052
  const [filterOptions, setFilterOptions] = React.useState([]);
16800
- const [savedFilterSets, setSavedFilterSets] = React.useState([]);
18053
+ const [savedFilterSets, setSavedFilterSets$1] = React.useState([]);
16801
18054
  const [selectedFilterSet, setSelectedFilterSet] = React.useState(null);
16802
18055
  const [answerMode, setAnswerMode] = React.useState("fast");
16803
18056
  const [chatBotWidth, setChatBotWidth] = React.useState(null);
@@ -16805,7 +18058,7 @@ const SmartBot = (props) => {
16805
18058
  React.useRef(0);
16806
18059
  const { setUserFlow, setUserScreenAndFlow, fetchUserResultsFromQuery, getCurrentDateTimeString, setLink, } = useChatFlow(chatDataRef, setLoader, setFlowType, setScreenName, setUserInput, setQuestionIndex, setCurrentAppLink, flowType, screenName, questionIndex, userInput, dateFormat, currentMode, activeConversationId, setIsModuleChanged, chatBodyRef, filterReducerState, dispatch, navigate, setShowChatPlaceholder, baseUrl, setChatDataState, setCurrentSessionId, customChatConfig, chatDataInfoRef, chatbotContext, setInitValue, setSessionId, thinkingContent, setThinkingContent, isThinking, setIsThinking, chatId, setChatId, isStop, setIsStop, functionsRef, functionsState, setFunctionsState, thinkingHeaderMessage, setThinkingHeaderMessage, uniqueChatId, initValue, sessionId, fieldNumber, setFieldNumber, additionalArgs, setActiveConversationId, navSessionId, setNavSessionId, setUniqueChatId, setAdditionalArgs, answerMode);
16807
18060
  const { parseSavedFlow, saveCurrentChanges, endCurrentSession, clearChatSession, initiateNewChat, hasUnsavedChanges, } = useChatSession(chatDataRef, setFlowType, setScreenName, setUserInput, setTemplateData, chatDataScreenLinkRef, setShowModal, setMinimizedMode, setSelectedModule, setChatDataState, currentMode, setUserFlow, getCurrentDateTimeString, setCurrentAppLink, selectedModule, fetchUserResultsFromQuery, props.closeBot, activeConversationId, setActiveConversationId, setShowChatPlaceholder);
16808
- const { refreshAndUpdateUserManual, configureBotActions, displaySnackMessages, } = useBotConfiguration(setRefreshLoader, setEnableRefreshAction, dispatch);
18061
+ const { refreshAndUpdateUserManual, configureBotActions, displaySnackMessages, } = useBotConfiguration(setRefreshLoader, setEnableRefreshAction);
16809
18062
  const { prepareDataAndSendToAgent, processResponse } = useAgentFlow(dateFormat, chatDataRef, currentMode, setShowChatPlaceholder, setLoader, baseUrl, setCurrentSessionId, customChatConfig, chatDataInfoRef, {
16810
18063
  setChatDataState,
16811
18064
  activeConversationId,
@@ -16948,11 +18201,10 @@ const SmartBot = (props) => {
16948
18201
  try {
16949
18202
  let applicationURL = window.location.pathname.split("/")?.[1];
16950
18203
  let applicationName = getFormattedApplicationName(applicationURL).toLowerCase();
16951
- let accessDataResponse = await userAccessActions.getModuleLevelAccessUtility({
18204
+ let accessDataResponse = await getModuleLevelAccessUtility({
16952
18205
  app: applicationName,
16953
18206
  module: ["Chatbot Upload"],
16954
- skipHierarchyCall: true,
16955
- })();
18207
+ });
16956
18208
  if (!lodash.isEmpty(accessDataResponse)) {
16957
18209
  setUtilityList([
16958
18210
  ...utilityList,
@@ -16986,9 +18238,9 @@ const SmartBot = (props) => {
16986
18238
  }
16987
18239
  });
16988
18240
  // Dispatch hierarchy key-value pairs to store
16989
- dispatch(smartBotActions.setHierarchyKeyValue(hierarchyKeyValuePairs));
18241
+ dispatch(setHierarchyKeyValue(hierarchyKeyValuePairs));
16990
18242
  setFilterOptions(combinedOptions);
16991
- dispatch(smartBotActions.setChatbotFilterOptions(combinedOptions));
18243
+ dispatch(setChatbotFilterOptions(combinedOptions));
16992
18244
  // Fetch saved filter sets for the plus-button menu
16993
18245
  fetchSavedFilterSets();
16994
18246
  }
@@ -17000,13 +18252,12 @@ const SmartBot = (props) => {
17000
18252
  try {
17001
18253
  let applicationURL = window.location.pathname.split("/")?.[1];
17002
18254
  let applicationName = getFormattedApplicationName(applicationURL).toLowerCase();
17003
- let accessDataResponse = await userAccessActions.getModuleLevelAccessUtility({
18255
+ let accessDataResponse = await getModuleLevelAccessUtility({
17004
18256
  app: applicationName,
17005
18257
  module: ["ChatbotAgent"],
17006
- skipHierarchyCall: true,
17007
- })();
18258
+ });
17008
18259
  let showAgentIcon = await getAgentVisibilityData();
17009
- let appCode = utils$2.getApplicationCodeFromURL(applicationName);
18260
+ let appCode = getApplicationCodeFromURL(applicationName);
17010
18261
  let hideNavbot = await getHideNavbotData(appCode);
17011
18262
  let multiChatEnabled = await getEnableMultiChatData(appCode);
17012
18263
  setEnableMultiChat(Boolean(multiChatEnabled));
@@ -17015,6 +18266,7 @@ const SmartBot = (props) => {
17015
18266
  let multiChatCfUrl = await getMultiChatCfUrl(appCode);
17016
18267
  setChatHistoryBaseUrl(multiChatCfUrl);
17017
18268
  const filterNavigationTab = (tabs) => hideNavbot ? tabs.filter((tab) => tab.name !== "Navigation") : tabs;
18269
+ const filterSavedFiltersTab = (tabs) => components?.FilterComponent ? tabs : tabs.filter((tab) => tab.name !== "Saved Filters");
17018
18270
  if (!lodash.isEmpty(accessDataResponse) &&
17019
18271
  showAgentIcon?.data?.data[0]?.attribute_value?.value) {
17020
18272
  let list = await getAgentExceptionUserList(appCode);
@@ -17228,7 +18480,7 @@ const SmartBot = (props) => {
17228
18480
  icon: jsxRuntime.jsx(SvgNavigationIcon, {}),
17229
18481
  }
17230
18482
  ];
17231
- setTabList(filterNavigationTab(tabListData));
18483
+ setTabList(filterSavedFiltersTab(filterNavigationTab(tabListData)));
17232
18484
  }
17233
18485
  else {
17234
18486
  setCurrentMode("navigation");
@@ -17295,14 +18547,14 @@ const SmartBot = (props) => {
17295
18547
  };
17296
18548
  const fetchSavedFilterSets = async () => {
17297
18549
  try {
17298
- const savedFilters = await filterAction.getFilterUserConfiguration("Chatbot");
17299
- setSavedFilterSets(savedFilters || []);
17300
- dispatch(smartBotActions.setSavedFilterSets(savedFilters || []));
18550
+ const savedFilters = await getFilterUserConfiguration("Chatbot");
18551
+ setSavedFilterSets$1(savedFilters || []);
18552
+ dispatch(setSavedFilterSets(savedFilters || []));
17301
18553
  }
17302
18554
  catch (error) {
17303
18555
  console.error("fetchSavedFilterSets error", error);
17304
- setSavedFilterSets([]);
17305
- dispatch(smartBotActions.setSavedFilterSets([]));
18556
+ setSavedFilterSets$1([]);
18557
+ dispatch(setSavedFilterSets([]));
17306
18558
  }
17307
18559
  };
17308
18560
  // Re-fetch saved filter sets when:
@@ -17333,29 +18585,6 @@ const SmartBot = (props) => {
17333
18585
  React.useEffect(() => {
17334
18586
  fetchCustomBotConfigurations();
17335
18587
  }, [baseUrl]);
17336
- React.useEffect(() => {
17337
- let live = true;
17338
- if (!baseUrl) {
17339
- setSkillUploadOn(false);
17340
- return;
17341
- }
17342
- fetchSkillUploadOn(baseUrl).then((on) => {
17343
- if (live)
17344
- setSkillUploadOn(on);
17345
- });
17346
- return () => {
17347
- live = false;
17348
- };
17349
- }, [baseUrl]);
17350
- // kept apart from utilityList: handleUploadAccess sets that list from its first value once its access
17351
- // check returns, which would drop an item added meanwhile
17352
- const skillUploadItem = {
17353
- key: "Upload Skill",
17354
- onClick: () => {
17355
- setIsSkillUploadOpen(true);
17356
- },
17357
- icon: (jsxRuntime.jsx("div", { className: classes.memoryModalIconDiv, children: jsxRuntime.jsx(SvgUploadIcon, { style: { width: 20, height: 20 } }) })),
17358
- };
17359
18588
  // Sync showModal state with props.showModal OR props.invokeBot (backward compatibility)
17360
18589
  // Host app passes showModal prop, but some integrations may use invokeBot
17361
18590
  React.useEffect(() => {
@@ -17562,7 +18791,7 @@ const SmartBot = (props) => {
17562
18791
  }, [chatDataState, currentMode, activeConversationId]);
17563
18792
  const fetchLegacyAgentInfo = async () => {
17564
18793
  try {
17565
- let legacyAgentScreenData = await utils.fetchLegacyAgentScreen();
18794
+ let legacyAgentScreenData = await fetchLegacyAgentScreen();
17566
18795
  setLegacyAgentScreen(legacyAgentScreenData);
17567
18796
  }
17568
18797
  catch (error) {
@@ -17645,7 +18874,7 @@ const SmartBot = (props) => {
17645
18874
  // ThinkinHeaderInfo doesn't freeze on it. streamStartTime stays null
17646
18875
  // here: processStream sets it, so a question has exactly one start
17647
18876
  // time (two would make the new header look like a superseded one).
17648
- dispatch(smartBotActions.setThinkingContext({
18877
+ dispatch(setThinkingContext({
17649
18878
  thinkingContent: "",
17650
18879
  thinkingHeaderMessage: "Working for 0m:00s",
17651
18880
  streamStartTime: null,
@@ -17655,7 +18884,7 @@ const SmartBot = (props) => {
17655
18884
  // }
17656
18885
  prepareDataAndSendToAgent(data, true, {
17657
18886
  chatbotContext: chatbotContext,
17658
- setChatbotContext: smartBotActions.setChatbotContext,
18887
+ setChatbotContext: setChatbotContext,
17659
18888
  dispatch: dispatch,
17660
18889
  initValue: lodash.isEmpty(userInput) ? initValue : true,
17661
18890
  sessionId: lodash.isEmpty(userInput) ? sessionId : "",
@@ -17677,7 +18906,7 @@ const SmartBot = (props) => {
17677
18906
  const onSendIconClick = (params, params2) => {
17678
18907
  try {
17679
18908
  // Reset step form stream state so old TabularContent instances don't process new data
17680
- dispatch(smartBotActions.setStepFormStreamData(null));
18909
+ dispatch(setStepFormStreamData(null));
17681
18910
  resetActiveTabularInstance();
17682
18911
  // Reset stepFormStreamControl so stale session_id doesn't leak into new prompts
17683
18912
  stepFormStreamControl.sessionId = "";
@@ -17885,11 +19114,11 @@ const SmartBot = (props) => {
17885
19114
  // Abort any in-flight stream FIRST so its completion handler doesn't
17886
19115
  // re-populate the window we're about to clear.
17887
19116
  functionsState?.abortStreaming?.();
17888
- dispatch(smartBotActions.setChatbotContext({}));
17889
- dispatch(smartBotActions.clearPersistedFormValues());
17890
- dispatch(smartBotActions.setStepFormStreamData(null));
17891
- dispatch(smartBotActions.setMinimizedStreamData(null));
17892
- dispatch(smartBotActions.setThinkingContext({
19117
+ dispatch(setChatbotContext({}));
19118
+ dispatch(clearPersistedFormValues());
19119
+ dispatch(setStepFormStreamData(null));
19120
+ dispatch(setMinimizedStreamData(null));
19121
+ dispatch(setThinkingContext({
17893
19122
  thinkingContent: "",
17894
19123
  thinkingHeaderMessage: "Working for 0m:00s",
17895
19124
  streamStartTime: null,
@@ -17903,7 +19132,7 @@ const SmartBot = (props) => {
17903
19132
  setChatDataState({});
17904
19133
  setActiveConversationId("");
17905
19134
  setUniqueChatId("");
17906
- dispatch(smartBotActions.setCurrentAgentChatId(""));
19135
+ dispatch(setCurrentAgentChatId(""));
17907
19136
  setSessionId("");
17908
19137
  setInitValue(true);
17909
19138
  setAdditionalArgs({});
@@ -18013,7 +19242,7 @@ const SmartBot = (props) => {
18013
19242
  return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [partialClose && (minimizedStreamData?.isStreaming || minimizedStreamData?.stepStatus === "step_form") && (jsxRuntime.jsx(MinimizedChatWidget, { onExpand: () => {
18014
19243
  setShowModal(true);
18015
19244
  setPartialClose(false);
18016
- } })), jsxRuntime.jsxs("div", { ref: smartBotWrapperRef, className: `${classes.agentStyleOverride} ${partialClose || !(showModal || forceOpen) ? classes.hideBotStyle : ""} `, children: [jsxRuntime.jsx(RenameModal, { open: renameOpen, renameValue: renameValue, setRenameValue: setRenameValue, onConfirm: handleRenameConfirm, onCancel: handleRenameCancel }), jsxRuntime.jsx(DeleteConfirmModal, { open: deleteOpen, onConfirm: handleDeleteConfirm, onCancel: handleDeleteCancel }), jsxRuntime.jsx(MemoryModal, { isModalOpen: isModalOpen, setIsModalOpen: setIsModalOpen, displaySnackMessages: displaySnackMessages }), jsxRuntime.jsx(UploadModal, { isUploadModalOpen: isUploadModalOpen, setIsUploadModalOpen: setIsUploadModalOpen, displaySnackMessages: displaySnackMessages }), skillUploadOn && (jsxRuntime.jsx(SkillUploadModal, { isOpen: isSkillUploadOpen, setIsOpen: setIsSkillUploadOpen, baseUrl: baseUrl, displaySnackMessages: displaySnackMessages, onUseText: (text) => setUserInput(text) })), jsxRuntime.jsx(impactUiV3.ChatBotComponent, { isFullWidth: forceOpen, userName: userName, showHistoryPanel: enableMultiChat, isConversationLoading: conversationLoading, customInputComponent: currentMode === "agent" && !showSavedFilters ? (jsxRuntime.jsx(ChatbotInput, { newChatScreen: newChatScreen, inputValue: userInput, setInputValue: setUserInput, isStopIcon: isStop, onSendIconClick: onSendIconClick, onStopIconClick: onStopIconClick, currentMode: currentMode, filterOptions: filterOptions,
19245
+ } })), jsxRuntime.jsxs("div", { ref: smartBotWrapperRef, className: `${classes.agentStyleOverride} ${partialClose || !(showModal || forceOpen) ? classes.hideBotStyle : ""} `, children: [jsxRuntime.jsx(RenameModal, { open: renameOpen, renameValue: renameValue, setRenameValue: setRenameValue, onConfirm: handleRenameConfirm, onCancel: handleRenameCancel }), jsxRuntime.jsx(DeleteConfirmModal, { open: deleteOpen, onConfirm: handleDeleteConfirm, onCancel: handleDeleteCancel }), jsxRuntime.jsx(MemoryModal, { isModalOpen: isModalOpen, setIsModalOpen: setIsModalOpen, displaySnackMessages: displaySnackMessages }), jsxRuntime.jsx(UploadModal, { isUploadModalOpen: isUploadModalOpen, setIsUploadModalOpen: setIsUploadModalOpen, displaySnackMessages: displaySnackMessages }), jsxRuntime.jsx(impactUiV3.ChatBotComponent, { isFullWidth: forceOpen, userName: userName, showHistoryPanel: enableMultiChat, isConversationLoading: conversationLoading, customInputComponent: currentMode === "agent" && !showSavedFilters ? (jsxRuntime.jsx(ChatbotInput, { newChatScreen: newChatScreen, inputValue: userInput, setInputValue: setUserInput, isStopIcon: isStop, onSendIconClick: onSendIconClick, onStopIconClick: onStopIconClick, currentMode: currentMode, filterOptions: filterOptions,
18017
19246
  // onSaveClick={saveCurrentChat}
18018
19247
  savedFilterSets: savedFilterSets, selectedFilterSet: selectedFilterSet, onFilterSetSelect: (filterSet) => setSelectedFilterSet(filterSet), onClearFilterSet: () => setSelectedFilterSet(null), onTriggerRefresh: triggerRefreshAction, answerMode: answerMode, setAnswerMode: setAnswerMode })) : showSavedFilters ? jsxRuntime.jsx(jsxRuntime.Fragment, {}) : null, isChatBotOpen: showModal || forceOpen, historyPanelData: historyPanelData, onHistorySearchChange: (params) => { console.log("History Search Change", params); }, onHistorySelectConversation: (params) => {
18019
19248
  const convId = params?.conversation_id;
@@ -18026,8 +19255,8 @@ const SmartBot = (props) => {
18026
19255
  localStorage.setItem("isStreaming", "false");
18027
19256
  setIsStop(false);
18028
19257
  resetActiveTabularInstance();
18029
- dispatch(smartBotActions.setMinimizedStreamData(null));
18030
- dispatch(smartBotActions.setThinkingContext({
19258
+ dispatch(setMinimizedStreamData(null));
19259
+ dispatch(setThinkingContext({
18031
19260
  thinkingContent: "",
18032
19261
  thinkingHeaderMessage: "Working for 0m:00s",
18033
19262
  streamStartTime: null,
@@ -18037,7 +19266,7 @@ const SmartBot = (props) => {
18037
19266
  // Bind subsequent inputs to this existing chat so the agent appends
18038
19267
  // the new turn to it (chat_id = uniqueChatId || currentAgentChatId).
18039
19268
  setUniqueChatId(convId);
18040
- dispatch(smartBotActions.setCurrentAgentChatId(convId));
19269
+ dispatch(setCurrentAgentChatId(convId));
18041
19270
  // Treat the next message as a fresh turn *within* this chat.
18042
19271
  setSessionId("");
18043
19272
  setCurrentSessionId("");
@@ -18045,9 +19274,9 @@ const SmartBot = (props) => {
18045
19274
  setAdditionalArgs({});
18046
19275
  // Clear transient per-turn / step-form context without wiping the
18047
19276
  // replayed messages.
18048
- dispatch(smartBotActions.setChatbotContext({}));
18049
- dispatch(smartBotActions.clearPersistedFormValues());
18050
- dispatch(smartBotActions.setStepFormStreamData(null));
19277
+ dispatch(setChatbotContext({}));
19278
+ dispatch(clearPersistedFormValues());
19279
+ dispatch(setStepFormStreamData(null));
18051
19280
  fetchConversationChats(convId, "agent");
18052
19281
  }, onHistoryPanelClick: (item, open) => {
18053
19282
  // Only refetch when the panel is being opened.
@@ -18056,14 +19285,14 @@ const SmartBot = (props) => {
18056
19285
  }
18057
19286
  }, onHistoryMenuAction: (action, conversationData) => {
18058
19287
  handleHistoryMenuAction(action, conversationData);
18059
- }, activeConversationId: activeConversationId,
19288
+ }, activeConversationId: activeConversationId, isConversationLoading: conversationLoading,
18060
19289
  // landingScreen={true}
18061
19290
  handleNewChatClick: () => {
18062
19291
  localStorage.setItem("isStreaming", "false");
18063
- dispatch(smartBotActions.setChatbotContext({}));
18064
- dispatch(smartBotActions.clearPersistedFormValues());
18065
- dispatch(smartBotActions.setStepFormStreamData(null));
18066
- dispatch(smartBotActions.setMinimizedStreamData(null));
19292
+ dispatch(setChatbotContext({}));
19293
+ dispatch(clearPersistedFormValues());
19294
+ dispatch(setStepFormStreamData(null));
19295
+ dispatch(setMinimizedStreamData(null));
18067
19296
  resetActiveTabularInstance();
18068
19297
  setConversation([]);
18069
19298
  chatDataInfoRef.current[currentMode] = {
@@ -18075,7 +19304,7 @@ const SmartBot = (props) => {
18075
19304
  // Abort FIRST so its setThinkingContext(isStreamCompleted:true) fires
18076
19305
  // before our reset below overwrites it with isStreamCompleted:false.
18077
19306
  functionsState?.abortStreaming?.();
18078
- dispatch(smartBotActions.setThinkingContext({
19307
+ dispatch(setThinkingContext({
18079
19308
  thinkingContent: "",
18080
19309
  thinkingHeaderMessage: "Working for 0m:00s",
18081
19310
  streamStartTime: null,
@@ -18089,7 +19318,7 @@ const SmartBot = (props) => {
18089
19318
  setUserInput("");
18090
19319
  setUniqueChatId("");
18091
19320
  chatDataRef.current[currentMode] = [];
18092
- dispatch(smartBotActions.setCurrentAgentChatId(""));
19321
+ dispatch(setCurrentAgentChatId(""));
18093
19322
  return {
18094
19323
  tabName: currentMode,
18095
19324
  isInitialClickPresent: true,
@@ -18116,7 +19345,7 @@ const SmartBot = (props) => {
18116
19345
  else {
18117
19346
  // If streaming is not active, clear minimized data so widget won't show
18118
19347
  if (localStorage.getItem("isStreaming") !== "true") {
18119
- dispatch(smartBotActions.setMinimizedStreamData(null));
19348
+ dispatch(setMinimizedStreamData(null));
18120
19349
  }
18121
19350
  setPartialClose(true);
18122
19351
  window.dispatchEvent(new CustomEvent("closeAllocationDetailPanel"));
@@ -18126,10 +19355,10 @@ const SmartBot = (props) => {
18126
19355
  onSendIconClick: onSendIconClick, conversation: conversation, onModuleClick: (id, name, param) => {
18127
19356
  // activeTab.current.activeTab = name.toLowerCase();
18128
19357
  handleModuleSelect(name);
18129
- }, moduleList: modules, tabList: tabList, utilityList: skillUploadOn ? [...utilityList, skillUploadItem] : utilityList, isAssistantThinking: false, isCustomScreen: showChatPlaceholder ? showChatPlaceholder : showSavedFilters, customScreenJsx: showChatPlaceholder ?
19358
+ }, moduleList: modules, tabList: tabList, utilityList: utilityList, isAssistantThinking: false, isCustomScreen: showChatPlaceholder ? showChatPlaceholder : showSavedFilters, customScreenJsx: showChatPlaceholder ?
18130
19359
  jsxRuntime.jsx(ChatPlaceholder, { dateFormat: dateFormat, chatDataRef: chatDataRef, currentMode: currentMode, setShowChatPlaceholder: setShowChatPlaceholder, setLoader: setLoader, setCurrentAgentId: setCurrentAgentId, baseUrl: baseUrl, setBaseUrl: setBaseUrl, setCurrentSessionId: setCurrentSessionId, customChatConfig: customChatConfig, chatDataInfoRef: chatDataInfoRef, setChatDataState: setChatDataState, userInput: userInput, legacyAgentScreen: legacyAgentScreen, activeConversationId: activeConversationId, chatBodyRef: chatBodyRef, chatbotContext: chatbotContext, setInitValue: setInitValue, setSessionId: setSessionId, thinkingContent: thinkingContext?.thinkingContent, setThinkingContent: setThinkingContent, isThinking: isThinking, setIsThinking: setIsThinking, chatId: chatId, setChatId: setChatId, isStop: isStop, setIsStop: setIsStop, functionsRef: functionsRef, functionsState: functionsState, setFunctionsState: setFunctionsState, thinkingHeaderMessage: thinkingContext?.thinkingHeaderMessage, setThinkingHeaderMessage: setThinkingHeaderMessage, uniqueChatId: uniqueChatId, setUniqueChatId: setUniqueChatId, fieldNumber: fieldNumber, setFieldNumber: setFieldNumber, setAdditionalArgs: setAdditionalArgs, displayQuestions: displayQuestions, questions: questions, setActiveConversationId: setActiveConversationId, selectedFilterSet: selectedFilterSet, answerMode: answerMode })
18131
19360
  :
18132
- jsxRuntime.jsx(ChatbotSaveFilterComponent$1, { savedFilterSets: savedFilterSets, partialClose: partialClose, chatBotWidth: chatBotWidth }), inputText: userInput, threadList: ["Home"], hideMenuArrow: true, newChatScreen: newChatScreen, isModuleListLoading: modulesLoading, suggestionBanner: {
19361
+ components?.FilterComponent ? jsxRuntime.jsx(components.FilterComponent, { savedFilterSets: savedFilterSets, partialClose: partialClose, chatBotWidth: chatBotWidth, onSetFilterConfiguration: callbacks?.onSetFilterConfiguration }) : null, inputText: userInput, threadList: ["Home"], hideMenuArrow: true, newChatScreen: newChatScreen, isModuleListLoading: modulesLoading, suggestionBanner: {
18133
19362
  freeTextHeading: "Try adding more details :",
18134
19363
  freeTextContent: "Iris works better when you provide more context and pointed questions",
18135
19364
  }, isStopIcon: isStop, onStopIconClick: onStopIconClick, footerText: "AI-generated responses may contain errors\u2014please verify important information", showSuggestionBanner: showSavedFilters ? false : showSuggestionBanner, onCloseSuggestionBanner: () => {
@@ -18154,5 +19383,22 @@ const SmartBot = (props) => {
18154
19383
  } })] }), jsxRuntime.jsx(AllocationDetailPanel, {})] }));
18155
19384
  };
18156
19385
 
19386
+ exports.ChatbotProvider = ChatbotProvider;
19387
+ exports.clearPersistedFormValues = clearPersistedFormValues;
18157
19388
  exports.default = SmartBot;
19389
+ exports.setChatbotContext = setChatbotContext;
19390
+ exports.setChatbotFilterOptions = setChatbotFilterOptions;
19391
+ exports.setCurrentAgentChatId = setCurrentAgentChatId;
19392
+ exports.setHierarchyKeyValue = setHierarchyKeyValue;
19393
+ exports.setIsSmartBotRestricted = setIsSmartBotRestricted;
19394
+ exports.setMinimizedStreamData = setMinimizedStreamData;
19395
+ exports.setPersistedFormValues = setPersistedFormValues;
19396
+ exports.setSavedFilterSets = setSavedFilterSets;
19397
+ exports.setSmartBotActive = setSmartBotActive;
19398
+ exports.setStepFormRestreamPayload = setStepFormRestreamPayload;
19399
+ exports.setStepFormStreamData = setStepFormStreamData;
19400
+ exports.setThinkingContext = setThinkingContext;
19401
+ exports.smartBotInitialState = smartBotInitialState;
19402
+ exports.smartBotReducer = smartBotReducer;
19403
+ exports.useChatbotDeps = useChatbotDeps;
18158
19404
  //# sourceMappingURL=index.cjs.js.map