@copart/ops-tool-kit 1.12.5-alpha.0 → 1.12.5-alpha.1

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.
@@ -47,7 +47,7 @@ var React__namespace = /*#__PURE__*/_interopNamespace(React);
47
47
  var ReactDOM__default = /*#__PURE__*/_interopDefaultLegacy(ReactDOM);
48
48
 
49
49
  const name$r = "@copart/ops-tool-kit";
50
- const version$8 = "1.12.5-alpha.0";
50
+ const version$8 = "1.12.5-alpha.1";
51
51
  const main$1 = "dist/ops-tool-kit.js";
52
52
  const style = "dist/ops-tool-kit.css";
53
53
  const files = [
@@ -69645,36 +69645,93 @@ var AppFrame = function AppFrame(props) {
69645
69645
  isNavBarOpen = _useState10[0],
69646
69646
  setIsNavBarOpen = _useState10[1];
69647
69647
  var setChatBotEnableStatus = function setChatBotEnableStatus() {
69648
+ console.log('[AppFrame] setChatBotEnableStatus called');
69648
69649
  var coreAppConfig = storage$1.getLocalItem('opsportal-core:config');
69649
- var tileData = findAppData(coreAppConfig.tiles, coreAppConfig.tileOverrides) || {};
69650
- var enableChatBot = coreAppConfig.enableChatBot,
69651
- chatBotAppFunctionId = coreAppConfig.chatBotAppFunctionId;
69652
- var isCoreRoute = ['settings', 'home', 'webChat', 'embedded', ''].includes(getRouteName());
69650
+ console.log('[AppFrame] coreAppConfig:', coreAppConfig);
69651
+ console.log('[AppFrame] coreAppConfig exists:', !!coreAppConfig);
69652
+ console.log('[AppFrame] coreAppConfig keys:', coreAppConfig ? Object.keys(coreAppConfig) : 'N/A');
69653
+ var tileData = findAppData(coreAppConfig === null || coreAppConfig === void 0 ? void 0 : coreAppConfig.tiles, coreAppConfig === null || coreAppConfig === void 0 ? void 0 : coreAppConfig.tileOverrides) || {};
69654
+ console.log('[AppFrame] tileData:', tileData);
69655
+ var _ref = coreAppConfig || {},
69656
+ enableChatBot = _ref.enableChatBot,
69657
+ chatBotAppFunctionId = _ref.chatBotAppFunctionId;
69658
+ console.log('[AppFrame] enableChatBot:', enableChatBot);
69659
+ console.log('[AppFrame] chatBotAppFunctionId:', chatBotAppFunctionId);
69660
+ var routeName = getRouteName();
69661
+ console.log('[AppFrame] routeName:', routeName);
69662
+ var isCoreRoute = ['settings', 'home', 'webChat', 'embedded', ''].includes(routeName);
69663
+ console.log('[AppFrame] isCoreRoute:', isCoreRoute);
69664
+ console.log('[AppFrame] window.location.pathname:', window.location.pathname);
69665
+ console.log('[AppFrame] pathname includes embedded:', window.location.pathname.includes('embedded'));
69653
69666
  var hasChatBotAccess = userHasChatBotAccess(chatBotAppFunctionId);
69667
+ console.log('[AppFrame] hasChatBotAccess:', hasChatBotAccess);
69654
69668
  var chatBotEnabled = isCoreRoute && !window.location.pathname.includes('embedded') ? enableChatBot && hasChatBotAccess : (tileData === null || tileData === void 0 ? void 0 : tileData.enableChatBot) && hasChatBotAccess;
69669
+ console.log('[AppFrame] chatBotEnabled calculated:', chatBotEnabled);
69670
+ console.log('[AppFrame] chatBotEnabled logic breakdown:', {
69671
+ isCoreRoute: isCoreRoute,
69672
+ pathnameIncludesEmbedded: window.location.pathname.includes('embedded'),
69673
+ usingCoreRoute: isCoreRoute && !window.location.pathname.includes('embedded'),
69674
+ enableChatBot: enableChatBot,
69675
+ tileDataEnableChatBot: tileData === null || tileData === void 0 ? void 0 : tileData.enableChatBot,
69676
+ hasChatBotAccess: hasChatBotAccess
69677
+ });
69655
69678
  setChatBotEnabled(chatBotEnabled);
69656
69679
  chatBotEnabledRef.current = chatBotEnabled;
69680
+ console.log('[AppFrame] chatBotEnabled state set to:', chatBotEnabled);
69657
69681
  };
69658
69682
  React.useEffect(function () {
69683
+ console.log('[AppFrame] useEffect for config polling triggered');
69659
69684
  // Check if config is not loaded, start polling
69660
69685
  var coreAppConfig = storage$1.getLocalItem('opsportal-core:config');
69686
+ console.log('[AppFrame] Initial config check:', {
69687
+ exists: !!coreAppConfig,
69688
+ isEmpty: !coreAppConfig || Object.keys(coreAppConfig).length === 0,
69689
+ keys: coreAppConfig ? Object.keys(coreAppConfig) : []
69690
+ });
69661
69691
  if (!coreAppConfig || Object.keys(coreAppConfig).length === 0) {
69692
+ console.log('[AppFrame] Config not found or empty, starting polling...');
69693
+ var pollCount = 0;
69662
69694
  // Poll for config until it's available
69663
69695
  var pollInterval = setInterval(function () {
69696
+ pollCount++;
69664
69697
  var config = storage$1.getLocalItem('opsportal-core:config');
69698
+ console.log("[AppFrame] Poll attempt #".concat(pollCount, ":"), {
69699
+ configExists: !!config,
69700
+ configKeys: config ? Object.keys(config) : [],
69701
+ configLength: config ? Object.keys(config).length : 0
69702
+ });
69665
69703
  if (config && Object.keys(config).length > 0) {
69704
+ console.log('[AppFrame] Config found after polling, calling setChatBotEnableStatus');
69666
69705
  setChatBotEnableStatus();
69667
69706
  clearInterval(pollInterval);
69707
+ console.log('[AppFrame] Polling interval cleared');
69668
69708
  }
69669
69709
  }, 100);
69670
69710
 
69671
69711
  // Stop polling after 5 seconds
69672
- setTimeout(function () {
69712
+ var timeoutId = setTimeout(function () {
69713
+ console.log('[AppFrame] Polling timeout reached (5 seconds), stopping polling');
69673
69714
  clearInterval(pollInterval);
69715
+ var finalConfig = storage$1.getLocalItem('opsportal-core:config');
69716
+ console.log('[AppFrame] Final config state after timeout:', {
69717
+ exists: !!finalConfig,
69718
+ keys: finalConfig ? Object.keys(finalConfig) : []
69719
+ });
69720
+ if (finalConfig && Object.keys(finalConfig).length > 0) {
69721
+ console.log('[AppFrame] Config available at timeout, calling setChatBotEnableStatus');
69722
+ setChatBotEnableStatus();
69723
+ } else {
69724
+ console.warn('[AppFrame] Config still not available after 5 second timeout');
69725
+ }
69674
69726
  }, 5000);
69675
69727
  return function () {
69728
+ console.log('[AppFrame] Cleaning up polling interval and timeout');
69676
69729
  clearInterval(pollInterval);
69730
+ clearTimeout(timeoutId);
69677
69731
  };
69732
+ } else {
69733
+ console.log('[AppFrame] Config already available, calling setChatBotEnableStatus immediately');
69734
+ setChatBotEnableStatus();
69678
69735
  }
69679
69736
  }, []);
69680
69737
  React.useEffect(function () {