"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = useUserFeed;
var _tsSdkReactNative = require("@amityco/ts-sdk-react-native");
var _useLiveCollection = require("../useLiveCollection");
function useUserFeed({
  userId,
  limit = 20,
  enabled = true,
  ...params
}) {
  const {
    items,
    ...rest
  } = (0, _useLiveCollection.useLiveCollection)({
    fetcher: _tsSdkReactNative.FeedRepository.getUserFeed,
    params: {
      userId,
      limit,
      ...params
    },
    enabled: enabled && !!userId
  });
  const filteredPosts = items === null || items === void 0 ? void 0 : items.filter(post => {
    var _post$childrenPosts;
    const hasFileOrAudioChild = post === null || post === void 0 || (_post$childrenPosts = post.childrenPosts) === null || _post$childrenPosts === void 0 ? void 0 : _post$childrenPosts.some(child => child.dataType === 'file' || child.dataType === 'audio');
    return !hasFileOrAudioChild;
  });
  return {
    ...rest,
    posts: filteredPosts
  };
}
//# sourceMappingURL=useUserFeed.js.map