2019-12-30 14:54:53 -05:00
|
|
|
import { connect } from 'react-redux';
|
|
|
|
import EmbedWrapperPage from './view';
|
2021-11-16 12:43:28 +08:00
|
|
|
import { makeSelectClaimForUri, selectIsUriResolving } from 'redux/selectors/claims';
|
2021-10-17 16:36:14 +08:00
|
|
|
import { makeSelectStreamingUrlForUri } from 'redux/selectors/file_info';
|
|
|
|
import { doResolveUri } from 'redux/actions/claims';
|
|
|
|
import { buildURI } from 'util/lbryURI';
|
2020-05-21 17:11:56 -04:00
|
|
|
import { doPlayUri } from 'redux/actions/content';
|
2021-11-19 10:40:01 +08:00
|
|
|
import { selectCostInfoForUri, doFetchCostInfoForUri, selectBlackListedOutpoints } from 'lbryinc';
|
2019-12-30 14:54:53 -05:00
|
|
|
|
|
|
|
const select = (state, props) => {
|
|
|
|
const { match } = props;
|
|
|
|
const { params } = match;
|
|
|
|
const { claimName, claimId } = params;
|
2020-06-12 17:23:16 -04:00
|
|
|
const uri = claimName ? buildURI({ claimName, claimId }) : '';
|
2019-12-30 14:54:53 -05:00
|
|
|
return {
|
|
|
|
uri,
|
|
|
|
claim: makeSelectClaimForUri(uri)(state),
|
2021-11-19 10:40:01 +08:00
|
|
|
costInfo: selectCostInfoForUri(state, uri),
|
2020-05-21 21:26:46 -04:00
|
|
|
streamingUrl: makeSelectStreamingUrlForUri(uri)(state),
|
2021-11-16 12:43:28 +08:00
|
|
|
isResolvingUri: selectIsUriResolving(state, uri),
|
2020-11-10 01:23:08 -05:00
|
|
|
blackListedOutpoints: selectBlackListedOutpoints(state),
|
2019-12-30 14:54:53 -05:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2021-10-17 16:36:14 +08:00
|
|
|
const perform = (dispatch) => {
|
2020-01-31 14:33:40 -05:00
|
|
|
return {
|
2021-10-17 16:36:14 +08:00
|
|
|
resolveUri: (uri) => dispatch(doResolveUri(uri)),
|
|
|
|
doPlayUri: (uri) => dispatch(doPlayUri(uri)),
|
|
|
|
doFetchCostInfoForUri: (uri) => dispatch(doFetchCostInfoForUri(uri)),
|
2020-01-31 14:33:40 -05:00
|
|
|
};
|
|
|
|
};
|
2019-12-30 14:54:53 -05:00
|
|
|
|
2020-04-13 19:48:11 -04:00
|
|
|
export default connect(select, perform)(EmbedWrapperPage);
|