import { _ as _defineProperty } from '../../../defineProperty-Dcer7TUY.js';
import { isNotPresent } from '@bigbinary/neeto-cist';
import usePersistedQuery from '../usePersistedQuery/usePersistedQuery.js';
import neetoAppsApi from './apis/neeto_apps.js';
import { NEETO_APPS_LIST_STALE_TIME } from '../constants/constants.js';
import { QUERY_KEYS } from '../constants/query.js';
import '../../../toPropertyKey-BAXkSB3z.js';
import '../../../typeof-D-UKOauR.js';
import 'react';
import '@tanstack/react-query';
import 'ramda';
import '../../utils/general.js';
import '../../../objectWithoutProperties-DN7d1SzH.js';
import '../../../slicedToArray-DmsZvA_9.js';
import '../../../unsupportedIterableToArray-Dqz8Y8_I.js';
import '../../../asyncToGenerator-CPKhuIh2.js';
import '@bigbinary/neeto-atoms';
import 'i18next';
import 'qs';
import 'axios';

function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
var useFetchNeetoApps = function useFetchNeetoApps(options) {
  var _globalProps$user;
  var scopedQueryKey = ["".concat(QUERY_KEYS.NEETO_APPS_LIST, "-").concat((_globalProps$user = globalProps.user) === null || _globalProps$user === void 0 ? void 0 : _globalProps$user.id)];
  var _ref = usePersistedQuery.getCache(scopedQueryKey) || {},
    data = _ref.data,
    modifiedAt = _ref.modifiedAt;
  var expired = modifiedAt <= Date.now() - NEETO_APPS_LIST_STALE_TIME;
  return usePersistedQuery(scopedQueryKey, neetoAppsApi.fetch, _objectSpread({
    staleTime: NEETO_APPS_LIST_STALE_TIME,
    enabled: expired || isNotPresent(data)
  }, options));
};

export { useFetchNeetoApps as default };
//# sourceMappingURL=useFetchNeetoApps.js.map
