diff --git a/dist/bundle.es.js b/dist/bundle.es.js index e98f81f..08066ed 100644 --- a/dist/bundle.es.js +++ b/dist/bundle.es.js @@ -2437,6 +2437,13 @@ const selectMyClaimsRaw = reselect.createSelector(selectState$2, selectClaimsByI const selectAbandoningIds = reselect.createSelector(selectState$2, state => Object.keys(state.abandoningById || {})); +const makeSelectAbandoningClaimById = claimId => reselect.createSelector(selectAbandoningIds, ids => ids.includes(claimId)); + +const makeSelectIsAbandoningClaimForUri = uri => reselect.createSelector(selectClaimIdsByUri, selectAbandoningIds, (claimIdsByUri, abandoningById) => { + const claimId = claimIdsByUri[normalizeURI(uri)]; + return abandoningById.indexOf(claimId) >= 0; +}); + const selectMyActiveClaims = reselect.createSelector(selectMyClaimsRaw, selectAbandoningIds, (claims, abandoningIds) => new Set(claims && claims.map(claim => claim.claim_id).filter(claimId => Object.keys(abandoningIds).indexOf(claimId) === -1))); const makeSelectClaimIsMine = rawUri => { @@ -6824,6 +6831,7 @@ exports.isClaimNsfw = isClaimNsfw; exports.isNameValid = isNameValid; exports.isURIClaimable = isURIClaimable; exports.isURIValid = isURIValid; +exports.makeSelectAbandoningClaimById = makeSelectAbandoningClaimById; exports.makeSelectAmountForUri = makeSelectAmountForUri; exports.makeSelectCanonicalUrlForUri = makeSelectCanonicalUrlForUri; exports.makeSelectChannelForClaimUri = makeSelectChannelForClaimUri; @@ -6846,6 +6854,7 @@ exports.makeSelectFileNameForUri = makeSelectFileNameForUri; exports.makeSelectFilePartlyDownloaded = makeSelectFilePartlyDownloaded; exports.makeSelectFilteredTransactionsForPage = makeSelectFilteredTransactionsForPage; exports.makeSelectFirstRecommendedFileForUri = makeSelectFirstRecommendedFileForUri; +exports.makeSelectIsAbandoningClaimForUri = makeSelectIsAbandoningClaimForUri; exports.makeSelectIsFollowingTag = makeSelectIsFollowingTag; exports.makeSelectIsUriResolving = makeSelectIsUriResolving; exports.makeSelectLatestTransactions = makeSelectLatestTransactions; diff --git a/src/index.js b/src/index.js index 4d28494..163dbaf 100644 --- a/src/index.js +++ b/src/index.js @@ -197,6 +197,8 @@ export { makeSelectSupportsForUri, makeSelectMyPurchasesForPage, makeSelectClaimWasPurchased, + makeSelectAbandoningClaimById, + makeSelectIsAbandoningClaimForUri, selectReflectingById, selectClaimsById, selectClaimsByUri, diff --git a/src/redux/selectors/claims.js b/src/redux/selectors/claims.js index eadd945..188a979 100644 --- a/src/redux/selectors/claims.js +++ b/src/redux/selectors/claims.js @@ -165,6 +165,21 @@ export const selectAbandoningIds = createSelector( state => Object.keys(state.abandoningById || {}) ); +export const makeSelectAbandoningClaimById = (claimId: string) => createSelector( + selectAbandoningIds, + ids => ids.includes(claimId) +); + +export const makeSelectIsAbandoningClaimForUri = (uri: string) => + createSelector( + selectClaimIdsByUri, + selectAbandoningIds, + (claimIdsByUri, abandoningById) => { + const claimId = claimIdsByUri[normalizeURI(uri)]; + return abandoningById.indexOf(claimId) >= 0; + } + ); + export const selectMyActiveClaims = createSelector( selectMyClaimsRaw, selectAbandoningIds,