'use strict';

var defineProperty = require('../../../defineProperty-COGyJ6Og.js');
var neetoCist = require('@bigbinary/neeto-cist');
var v2_reactUtils_usePersistedQuery_usePersistedQuery = require('../usePersistedQuery/usePersistedQuery.js');
var v2_reactUtils_useFetchNeetoApps_apis_neeto_apps = require('./apis/neeto_apps.js');
var v2_reactUtils_constants_constants = require('../constants/constants.js');
var v2_reactUtils_constants_query = require('../constants/query.js');
require('../../../toPropertyKey-DW-YC76_.js');
require('../../../typeof-D4ZZ_FlZ.js');
require('react');
require('@tanstack/react-query');
require('ramda');
require('../../utils/general.js');
require('../../../objectWithoutProperties-wSsbHFcG.js');
require('../../../slicedToArray-BcL7fKuL.js');
require('../../../unsupportedIterableToArray-BoHMiKNA.js');
require('../../../asyncToGenerator-8vhqAwJl.js');
require('@bigbinary/neeto-atoms');
require('i18next');
require('qs');
require('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._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(v2_reactUtils_constants_query.QUERY_KEYS.NEETO_APPS_LIST, "-").concat((_globalProps$user = globalProps.user) === null || _globalProps$user === void 0 ? void 0 : _globalProps$user.id)];
  var _ref = v2_reactUtils_usePersistedQuery_usePersistedQuery.getCache(scopedQueryKey) || {},
    data = _ref.data,
    modifiedAt = _ref.modifiedAt;
  var expired = modifiedAt <= Date.now() - v2_reactUtils_constants_constants.NEETO_APPS_LIST_STALE_TIME;
  return v2_reactUtils_usePersistedQuery_usePersistedQuery(scopedQueryKey, v2_reactUtils_useFetchNeetoApps_apis_neeto_apps.fetch, _objectSpread({
    staleTime: v2_reactUtils_constants_constants.NEETO_APPS_LIST_STALE_TIME,
    enabled: expired || neetoCist.isNotPresent(data)
  }, options));
};

module.exports = useFetchNeetoApps;
//# sourceMappingURL=useFetchNeetoApps.js.map
