@copart/ops-tool-kit 1.12.4 → 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.4";
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,27 +69645,95 @@ 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;
69655
- console.log("***chatBotEnabled=", chatBotEnabled, coreAppConfig);
69656
- console.log("***isCoreRoute=", isCoreRoute, enableChatBot, window.location.pathname, !window.location.pathname.includes('embedded'));
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
+ });
69657
69678
  setChatBotEnabled(chatBotEnabled);
69658
69679
  chatBotEnabledRef.current = chatBotEnabled;
69680
+ console.log('[AppFrame] chatBotEnabled state set to:', chatBotEnabled);
69659
69681
  };
69682
+ React.useEffect(function () {
69683
+ console.log('[AppFrame] useEffect for config polling triggered');
69684
+ // Check if config is not loaded, start polling
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
+ });
69691
+ if (!coreAppConfig || Object.keys(coreAppConfig).length === 0) {
69692
+ console.log('[AppFrame] Config not found or empty, starting polling...');
69693
+ var pollCount = 0;
69694
+ // Poll for config until it's available
69695
+ var pollInterval = setInterval(function () {
69696
+ pollCount++;
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
+ });
69703
+ if (config && Object.keys(config).length > 0) {
69704
+ console.log('[AppFrame] Config found after polling, calling setChatBotEnableStatus');
69705
+ setChatBotEnableStatus();
69706
+ clearInterval(pollInterval);
69707
+ console.log('[AppFrame] Polling interval cleared');
69708
+ }
69709
+ }, 100);
69660
69710
 
69661
- // useEffect(() => {
69662
- // setChatBotEnableStatus()
69663
-
69664
- // setTimeout(()=>{ // if storage not loaded on first time login
69665
- // setChatBotEnableStatus()
69666
- // },1000)
69667
- // }, [])
69668
-
69711
+ // Stop polling after 5 seconds
69712
+ var timeoutId = setTimeout(function () {
69713
+ console.log('[AppFrame] Polling timeout reached (5 seconds), stopping polling');
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
+ }
69726
+ }, 5000);
69727
+ return function () {
69728
+ console.log('[AppFrame] Cleaning up polling interval and timeout');
69729
+ clearInterval(pollInterval);
69730
+ clearTimeout(timeoutId);
69731
+ };
69732
+ } else {
69733
+ console.log('[AppFrame] Config already available, calling setChatBotEnableStatus immediately');
69734
+ setChatBotEnableStatus();
69735
+ }
69736
+ }, []);
69669
69737
  React.useEffect(function () {
69670
69738
  if (appBarMounted) {
69671
69739
  var event = new Event('localStorageChanged');
@@ -69677,7 +69745,6 @@ var AppFrame = function AppFrame(props) {
69677
69745
  if (props.env) {
69678
69746
  window.toolkitEnv = props.env;
69679
69747
  }
69680
- console.log('***props=', props.location.pathname);
69681
69748
  setChatBotEnableStatus();
69682
69749
  }, [props]);
69683
69750
  var authGuardProps = _objectSpread2(_objectSpread2({}, props), {}, {