new referrals
provides referral code setting referrers claim referee reward fixes accessToken state
This commit is contained in:
parent
174465878b
commit
81dd94572d
8 changed files with 264 additions and 26 deletions
89
dist/bundle.es.js
vendored
89
dist/bundle.es.js
vendored
|
@ -49,7 +49,10 @@ const USER_INVITE_NEW_FAILURE = 'USER_INVITE_NEW_FAILURE';
|
||||||
const FETCH_ACCESS_TOKEN_SUCCESS = 'FETCH_ACCESS_TOKEN_SUCCESS';
|
const FETCH_ACCESS_TOKEN_SUCCESS = 'FETCH_ACCESS_TOKEN_SUCCESS';
|
||||||
const USER_YOUTUBE_IMPORT_STARTED = 'USER_YOUTUBE_IMPORT_STARTED';
|
const USER_YOUTUBE_IMPORT_STARTED = 'USER_YOUTUBE_IMPORT_STARTED';
|
||||||
const USER_YOUTUBE_IMPORT_FAILURE = 'USER_YOUTUBE_IMPORT_FAILURE';
|
const USER_YOUTUBE_IMPORT_FAILURE = 'USER_YOUTUBE_IMPORT_FAILURE';
|
||||||
const USER_YOUTUBE_IMPORT_SUCCESS = 'USER_YOUTUBE_IMPORT_SUCCESS'; // Claims
|
const USER_YOUTUBE_IMPORT_SUCCESS = 'USER_YOUTUBE_IMPORT_SUCCESS';
|
||||||
|
const USER_SET_REFERRER_STARTED = 'USER_SET_REFERRER_STARTED';
|
||||||
|
const USER_SET_REFERRER_SUCCESS = 'USER_SET_REFERRER_SUCCESS';
|
||||||
|
const USER_SET_REFERRER_FAILURE = 'USER_SET_REFERRER_FAILURE'; // Claims
|
||||||
|
|
||||||
const FETCH_FEATURED_CONTENT_STARTED = 'FETCH_FEATURED_CONTENT_STARTED';
|
const FETCH_FEATURED_CONTENT_STARTED = 'FETCH_FEATURED_CONTENT_STARTED';
|
||||||
const FETCH_FEATURED_CONTENT_COMPLETED = 'FETCH_FEATURED_CONTENT_COMPLETED';
|
const FETCH_FEATURED_CONTENT_COMPLETED = 'FETCH_FEATURED_CONTENT_COMPLETED';
|
||||||
|
@ -176,6 +179,9 @@ var action_types = /*#__PURE__*/Object.freeze({
|
||||||
USER_YOUTUBE_IMPORT_STARTED: USER_YOUTUBE_IMPORT_STARTED,
|
USER_YOUTUBE_IMPORT_STARTED: USER_YOUTUBE_IMPORT_STARTED,
|
||||||
USER_YOUTUBE_IMPORT_FAILURE: USER_YOUTUBE_IMPORT_FAILURE,
|
USER_YOUTUBE_IMPORT_FAILURE: USER_YOUTUBE_IMPORT_FAILURE,
|
||||||
USER_YOUTUBE_IMPORT_SUCCESS: USER_YOUTUBE_IMPORT_SUCCESS,
|
USER_YOUTUBE_IMPORT_SUCCESS: USER_YOUTUBE_IMPORT_SUCCESS,
|
||||||
|
USER_SET_REFERRER_STARTED: USER_SET_REFERRER_STARTED,
|
||||||
|
USER_SET_REFERRER_SUCCESS: USER_SET_REFERRER_SUCCESS,
|
||||||
|
USER_SET_REFERRER_FAILURE: USER_SET_REFERRER_FAILURE,
|
||||||
FETCH_FEATURED_CONTENT_STARTED: FETCH_FEATURED_CONTENT_STARTED,
|
FETCH_FEATURED_CONTENT_STARTED: FETCH_FEATURED_CONTENT_STARTED,
|
||||||
FETCH_FEATURED_CONTENT_COMPLETED: FETCH_FEATURED_CONTENT_COMPLETED,
|
FETCH_FEATURED_CONTENT_COMPLETED: FETCH_FEATURED_CONTENT_COMPLETED,
|
||||||
FETCH_TRENDING_CONTENT_STARTED: FETCH_TRENDING_CONTENT_STARTED,
|
FETCH_TRENDING_CONTENT_STARTED: FETCH_TRENDING_CONTENT_STARTED,
|
||||||
|
@ -485,6 +491,7 @@ rewards.TYPE_FIRST_STREAM = 'first_stream';
|
||||||
rewards.TYPE_MANY_DOWNLOADS = 'many_downloads';
|
rewards.TYPE_MANY_DOWNLOADS = 'many_downloads';
|
||||||
rewards.TYPE_FIRST_PUBLISH = 'first_publish';
|
rewards.TYPE_FIRST_PUBLISH = 'first_publish';
|
||||||
rewards.TYPE_REFERRAL = 'referral';
|
rewards.TYPE_REFERRAL = 'referral';
|
||||||
|
rewards.TYPE_REFEREE = 'referee';
|
||||||
rewards.TYPE_REWARD_CODE = 'reward_code';
|
rewards.TYPE_REWARD_CODE = 'reward_code';
|
||||||
rewards.TYPE_SUBSCRIPTION = 'subscription';
|
rewards.TYPE_SUBSCRIPTION = 'subscription';
|
||||||
rewards.YOUTUBE_CREATOR = 'youtube_creator';
|
rewards.YOUTUBE_CREATOR = 'youtube_creator';
|
||||||
|
@ -1214,8 +1221,11 @@ const selectUserInviteStatusFailed = reselect.createSelector(selectUserInvitesRe
|
||||||
const selectUserInviteNewIsPending = reselect.createSelector(selectState$2, state => state.inviteNewIsPending);
|
const selectUserInviteNewIsPending = reselect.createSelector(selectState$2, state => state.inviteNewIsPending);
|
||||||
const selectUserInviteNewErrorMessage = reselect.createSelector(selectState$2, state => state.inviteNewErrorMessage);
|
const selectUserInviteNewErrorMessage = reselect.createSelector(selectState$2, state => state.inviteNewErrorMessage);
|
||||||
const selectUserInviteReferralLink = reselect.createSelector(selectState$2, state => state.referralLink);
|
const selectUserInviteReferralLink = reselect.createSelector(selectState$2, state => state.referralLink);
|
||||||
|
const selectUserInviteReferralCode = reselect.createSelector(selectState$2, state => state.referralCode);
|
||||||
const selectYouTubeImportPending = reselect.createSelector(selectState$2, state => state.youtubeChannelImportPending);
|
const selectYouTubeImportPending = reselect.createSelector(selectState$2, state => state.youtubeChannelImportPending);
|
||||||
const selectYouTubeImportError = reselect.createSelector(selectState$2, state => state.youtubeChannelImportErrorMessage);
|
const selectYouTubeImportError = reselect.createSelector(selectState$2, state => state.youtubeChannelImportErrorMessage);
|
||||||
|
const selectSetReferrerPending = reselect.createSelector(selectState$2, state => state.setReferrerIsPending);
|
||||||
|
const selectSetReferrerError = reselect.createSelector(selectState$2, state => state.setReferrerError);
|
||||||
const selectYouTubeImportVideosComplete = reselect.createSelector(selectState$2, state => {
|
const selectYouTubeImportVideosComplete = reselect.createSelector(selectState$2, state => {
|
||||||
const total = state.youtubeChannelImportTotal;
|
const total = state.youtubeChannelImportTotal;
|
||||||
const complete = state.youtubeChannelImportComplete || 0;
|
const complete = state.youtubeChannelImportComplete || 0;
|
||||||
|
@ -1237,7 +1247,8 @@ function doFetchInviteStatus() {
|
||||||
data: {
|
data: {
|
||||||
invitesRemaining: status.invites_remaining ? status.invites_remaining : 0,
|
invitesRemaining: status.invites_remaining ? status.invites_remaining : 0,
|
||||||
invitees: status.invitees,
|
invitees: status.invitees,
|
||||||
referralLink: `${Lbryio.CONNECTION_STRING}user/refer?r=${code}`
|
referralLink: `${Lbryio.CONNECTION_STRING}user/refer?r=${code}`,
|
||||||
|
referralCode: code
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
|
@ -1276,12 +1287,12 @@ function doAuthenticate(appVersion, os = null, firebaseToken = null) {
|
||||||
dispatch({
|
dispatch({
|
||||||
type: AUTHENTICATION_STARTED
|
type: AUTHENTICATION_STARTED
|
||||||
});
|
});
|
||||||
Lbryio.authenticate().then(user => {
|
Lbryio.authenticate().then(accessToken => {
|
||||||
// analytics.setUser(user);
|
// analytics.setUser(user);
|
||||||
dispatch({
|
dispatch({
|
||||||
type: AUTHENTICATION_SUCCESS,
|
type: AUTHENTICATION_SUCCESS,
|
||||||
data: {
|
data: {
|
||||||
user
|
accessToken
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
dispatch(doRewardList());
|
dispatch(doRewardList());
|
||||||
|
@ -1574,9 +1585,9 @@ function doUserInviteNew(email) {
|
||||||
dispatch({
|
dispatch({
|
||||||
type: USER_INVITE_NEW_STARTED
|
type: USER_INVITE_NEW_STARTED
|
||||||
});
|
});
|
||||||
Lbryio.call('user', 'invite', {
|
return Lbryio.call('user', 'invite', {
|
||||||
email
|
email
|
||||||
}, 'post').then(() => {
|
}, 'post').then(success => {
|
||||||
dispatch({
|
dispatch({
|
||||||
type: USER_INVITE_NEW_SUCCESS,
|
type: USER_INVITE_NEW_SUCCESS,
|
||||||
data: {
|
data: {
|
||||||
|
@ -1587,6 +1598,7 @@ function doUserInviteNew(email) {
|
||||||
message: __(`Invite sent to ${email}`)
|
message: __(`Invite sent to ${email}`)
|
||||||
}));
|
}));
|
||||||
dispatch(doFetchInviteStatus());
|
dispatch(doFetchInviteStatus());
|
||||||
|
return success;
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
dispatch({
|
dispatch({
|
||||||
type: USER_INVITE_NEW_FAILURE,
|
type: USER_INVITE_NEW_FAILURE,
|
||||||
|
@ -1597,6 +1609,38 @@ function doUserInviteNew(email) {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
function doUserSetReferrer(referrer, shouldClaim) {
|
||||||
|
return dispatch => {
|
||||||
|
dispatch({
|
||||||
|
type: USER_SET_REFERRER_STARTED
|
||||||
|
});
|
||||||
|
return Lbryio.call('user', 'referral', {
|
||||||
|
referrer
|
||||||
|
}, 'post').then(() => {
|
||||||
|
dispatch({
|
||||||
|
type: USER_SET_REFERRER_SUCCESS
|
||||||
|
}); // for testing
|
||||||
|
|
||||||
|
dispatch(lbryRedux.doToast({
|
||||||
|
message: __(`Set Referrer to ${referrer}`)
|
||||||
|
})); // we need to userFetch because once you claim this,
|
||||||
|
|
||||||
|
if (shouldClaim) {
|
||||||
|
dispatch(doClaimRewardType(rewards.TYPE_REFEREE));
|
||||||
|
dispatch(doUserFetch());
|
||||||
|
} else {
|
||||||
|
dispatch(doUserFetch());
|
||||||
|
}
|
||||||
|
}).catch(error => {
|
||||||
|
dispatch({
|
||||||
|
type: USER_SET_REFERRER_FAILURE,
|
||||||
|
data: {
|
||||||
|
error
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
}
|
||||||
function doClaimYoutubeChannels() {
|
function doClaimYoutubeChannels() {
|
||||||
return dispatch => {
|
return dispatch => {
|
||||||
dispatch({
|
dispatch({
|
||||||
|
@ -2879,21 +2923,26 @@ const defaultState$3 = {
|
||||||
inviteStatusIsPending: false,
|
inviteStatusIsPending: false,
|
||||||
invitesRemaining: undefined,
|
invitesRemaining: undefined,
|
||||||
invitees: undefined,
|
invitees: undefined,
|
||||||
|
referralLink: undefined,
|
||||||
|
referralCode: undefined,
|
||||||
user: undefined,
|
user: undefined,
|
||||||
|
accessToken: undefined,
|
||||||
youtubeChannelImportPending: false,
|
youtubeChannelImportPending: false,
|
||||||
youtubeChannelImportErrorMessage: ''
|
youtubeChannelImportErrorMessage: '',
|
||||||
|
setReferrerIsPending: false,
|
||||||
|
setReferrerError: ''
|
||||||
};
|
};
|
||||||
|
|
||||||
reducers$2[AUTHENTICATION_STARTED] = state => Object.assign({}, state, {
|
reducers$2[AUTHENTICATION_STARTED] = state => Object.assign({}, state, {
|
||||||
authenticationIsPending: true,
|
authenticationIsPending: true,
|
||||||
userIsPending: true,
|
userIsPending: true,
|
||||||
user: defaultState$3.user
|
accessToken: defaultState$3.accessToken
|
||||||
});
|
});
|
||||||
|
|
||||||
reducers$2[AUTHENTICATION_SUCCESS] = (state, action) => Object.assign({}, state, {
|
reducers$2[AUTHENTICATION_SUCCESS] = (state, action) => Object.assign({}, state, {
|
||||||
authenticationIsPending: false,
|
authenticationIsPending: false,
|
||||||
userIsPending: false,
|
userIsPending: false,
|
||||||
user: action.data.user
|
accessToken: action.data.accessToken
|
||||||
});
|
});
|
||||||
|
|
||||||
reducers$2[AUTHENTICATION_FAILURE] = state => Object.assign({}, state, {
|
reducers$2[AUTHENTICATION_FAILURE] = state => Object.assign({}, state, {
|
||||||
|
@ -3039,7 +3088,8 @@ reducers$2[USER_INVITE_STATUS_FETCH_SUCCESS] = (state, action) => Object.assign(
|
||||||
inviteStatusIsPending: false,
|
inviteStatusIsPending: false,
|
||||||
invitesRemaining: action.data.invitesRemaining,
|
invitesRemaining: action.data.invitesRemaining,
|
||||||
invitees: action.data.invitees,
|
invitees: action.data.invitees,
|
||||||
referralLink: action.data.referralLink
|
referralLink: action.data.referralLink,
|
||||||
|
referralCode: action.data.referralCode
|
||||||
});
|
});
|
||||||
|
|
||||||
reducers$2[USER_INVITE_NEW_STARTED] = state => Object.assign({}, state, {
|
reducers$2[USER_INVITE_NEW_STARTED] = state => Object.assign({}, state, {
|
||||||
|
@ -3096,6 +3146,21 @@ reducers$2[USER_EMAIL_VERIFY_RETRY_FAILURE] = state => Object.assign({}, state,
|
||||||
resendingVerificationEmail: false
|
resendingVerificationEmail: false
|
||||||
});
|
});
|
||||||
|
|
||||||
|
reducers$2[USER_SET_REFERRER_STARTED] = state => Object.assign({}, state, {
|
||||||
|
setReferrerIsPending: true,
|
||||||
|
setReferrerError: defaultState$3.setReferrerError
|
||||||
|
});
|
||||||
|
|
||||||
|
reducers$2[USER_SET_REFERRER_SUCCESS] = state => Object.assign({}, state, {
|
||||||
|
setReferrerIsPending: false,
|
||||||
|
setReferrerError: defaultState$3.setReferrerError
|
||||||
|
});
|
||||||
|
|
||||||
|
reducers$2[USER_SET_REFERRER_FAILURE] = (state, action) => Object.assign({}, state, {
|
||||||
|
setReferrerIsPending: false,
|
||||||
|
setReferrerError: action.data.error.message
|
||||||
|
});
|
||||||
|
|
||||||
function userReducer(state = defaultState$3, action) {
|
function userReducer(state = defaultState$3, action) {
|
||||||
const handler = reducers$2[action.type];
|
const handler = reducers$2[action.type];
|
||||||
if (handler) return handler(state, action);
|
if (handler) return handler(state, action);
|
||||||
|
@ -3528,6 +3593,7 @@ exports.doUserPhoneReset = doUserPhoneReset;
|
||||||
exports.doUserPhoneVerify = doUserPhoneVerify;
|
exports.doUserPhoneVerify = doUserPhoneVerify;
|
||||||
exports.doUserPhoneVerifyFailure = doUserPhoneVerifyFailure;
|
exports.doUserPhoneVerifyFailure = doUserPhoneVerifyFailure;
|
||||||
exports.doUserResendVerificationEmail = doUserResendVerificationEmail;
|
exports.doUserResendVerificationEmail = doUserResendVerificationEmail;
|
||||||
|
exports.doUserSetReferrer = doUserSetReferrer;
|
||||||
exports.filteredReducer = filteredReducer;
|
exports.filteredReducer = filteredReducer;
|
||||||
exports.homepageReducer = homepageReducer;
|
exports.homepageReducer = homepageReducer;
|
||||||
exports.lbrytvReducer = lbrytvReducer;
|
exports.lbrytvReducer = lbrytvReducer;
|
||||||
|
@ -3586,6 +3652,8 @@ exports.selectPhoneVerifyIsPending = selectPhoneVerifyIsPending;
|
||||||
exports.selectReferralReward = selectReferralReward;
|
exports.selectReferralReward = selectReferralReward;
|
||||||
exports.selectResendingVerificationEmail = selectResendingVerificationEmail;
|
exports.selectResendingVerificationEmail = selectResendingVerificationEmail;
|
||||||
exports.selectRewardContentClaimIds = selectRewardContentClaimIds;
|
exports.selectRewardContentClaimIds = selectRewardContentClaimIds;
|
||||||
|
exports.selectSetReferrerError = selectSetReferrerError;
|
||||||
|
exports.selectSetReferrerPending = selectSetReferrerPending;
|
||||||
exports.selectSetSyncErrorMessage = selectSetSyncErrorMessage;
|
exports.selectSetSyncErrorMessage = selectSetSyncErrorMessage;
|
||||||
exports.selectSetSyncIsPending = selectSetSyncIsPending;
|
exports.selectSetSyncIsPending = selectSetSyncIsPending;
|
||||||
exports.selectShowSuggestedSubs = selectShowSuggestedSubs;
|
exports.selectShowSuggestedSubs = selectShowSuggestedSubs;
|
||||||
|
@ -3612,6 +3680,7 @@ exports.selectUserCountryCode = selectUserCountryCode;
|
||||||
exports.selectUserEmail = selectUserEmail;
|
exports.selectUserEmail = selectUserEmail;
|
||||||
exports.selectUserInviteNewErrorMessage = selectUserInviteNewErrorMessage;
|
exports.selectUserInviteNewErrorMessage = selectUserInviteNewErrorMessage;
|
||||||
exports.selectUserInviteNewIsPending = selectUserInviteNewIsPending;
|
exports.selectUserInviteNewIsPending = selectUserInviteNewIsPending;
|
||||||
|
exports.selectUserInviteReferralCode = selectUserInviteReferralCode;
|
||||||
exports.selectUserInviteReferralLink = selectUserInviteReferralLink;
|
exports.selectUserInviteReferralLink = selectUserInviteReferralLink;
|
||||||
exports.selectUserInviteStatusFailed = selectUserInviteStatusFailed;
|
exports.selectUserInviteStatusFailed = selectUserInviteStatusFailed;
|
||||||
exports.selectUserInviteStatusIsPending = selectUserInviteStatusIsPending;
|
exports.selectUserInviteStatusIsPending = selectUserInviteStatusIsPending;
|
||||||
|
|
109
dist/bundle.js
vendored
109
dist/bundle.js
vendored
|
@ -205,6 +205,8 @@ __webpack_require__.r(__webpack_exports__);
|
||||||
|
|
||||||
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "doCheckYoutubeTransfer", function() { return redux_actions_user__WEBPACK_IMPORTED_MODULE_10__["doCheckYoutubeTransfer"]; });
|
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "doCheckYoutubeTransfer", function() { return redux_actions_user__WEBPACK_IMPORTED_MODULE_10__["doCheckYoutubeTransfer"]; });
|
||||||
|
|
||||||
|
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "doUserSetReferrer", function() { return redux_actions_user__WEBPACK_IMPORTED_MODULE_10__["doUserSetReferrer"]; });
|
||||||
|
|
||||||
/* harmony import */ var redux_actions_cost_info__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(29);
|
/* harmony import */ var redux_actions_cost_info__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(29);
|
||||||
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "doFetchCostInfoForUri", function() { return redux_actions_cost_info__WEBPACK_IMPORTED_MODULE_11__["doFetchCostInfoForUri"]; });
|
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "doFetchCostInfoForUri", function() { return redux_actions_cost_info__WEBPACK_IMPORTED_MODULE_11__["doFetchCostInfoForUri"]; });
|
||||||
|
|
||||||
|
@ -404,6 +406,8 @@ __webpack_require__.r(__webpack_exports__);
|
||||||
|
|
||||||
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "selectUserInviteReferralLink", function() { return redux_selectors_user__WEBPACK_IMPORTED_MODULE_31__["selectUserInviteReferralLink"]; });
|
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "selectUserInviteReferralLink", function() { return redux_selectors_user__WEBPACK_IMPORTED_MODULE_31__["selectUserInviteReferralLink"]; });
|
||||||
|
|
||||||
|
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "selectUserInviteReferralCode", function() { return redux_selectors_user__WEBPACK_IMPORTED_MODULE_31__["selectUserInviteReferralCode"]; });
|
||||||
|
|
||||||
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "selectUserVerifiedEmail", function() { return redux_selectors_user__WEBPACK_IMPORTED_MODULE_31__["selectUserVerifiedEmail"]; });
|
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "selectUserVerifiedEmail", function() { return redux_selectors_user__WEBPACK_IMPORTED_MODULE_31__["selectUserVerifiedEmail"]; });
|
||||||
|
|
||||||
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "selectYoutubeChannels", function() { return redux_selectors_user__WEBPACK_IMPORTED_MODULE_31__["selectYoutubeChannels"]; });
|
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "selectYoutubeChannels", function() { return redux_selectors_user__WEBPACK_IMPORTED_MODULE_31__["selectYoutubeChannels"]; });
|
||||||
|
@ -414,6 +418,10 @@ __webpack_require__.r(__webpack_exports__);
|
||||||
|
|
||||||
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "selectYouTubeImportVideosComplete", function() { return redux_selectors_user__WEBPACK_IMPORTED_MODULE_31__["selectYouTubeImportVideosComplete"]; });
|
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "selectYouTubeImportVideosComplete", function() { return redux_selectors_user__WEBPACK_IMPORTED_MODULE_31__["selectYouTubeImportVideosComplete"]; });
|
||||||
|
|
||||||
|
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "selectSetReferrerPending", function() { return redux_selectors_user__WEBPACK_IMPORTED_MODULE_31__["selectSetReferrerPending"]; });
|
||||||
|
|
||||||
|
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "selectSetReferrerError", function() { return redux_selectors_user__WEBPACK_IMPORTED_MODULE_31__["selectSetReferrerError"]; });
|
||||||
|
|
||||||
/* harmony import */ var redux_selectors_cost_info__WEBPACK_IMPORTED_MODULE_32__ = __webpack_require__(47);
|
/* harmony import */ var redux_selectors_cost_info__WEBPACK_IMPORTED_MODULE_32__ = __webpack_require__(47);
|
||||||
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "makeSelectFetchingCostInfoForUri", function() { return redux_selectors_cost_info__WEBPACK_IMPORTED_MODULE_32__["makeSelectFetchingCostInfoForUri"]; });
|
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "makeSelectFetchingCostInfoForUri", function() { return redux_selectors_cost_info__WEBPACK_IMPORTED_MODULE_32__["makeSelectFetchingCostInfoForUri"]; });
|
||||||
|
|
||||||
|
@ -568,6 +576,9 @@ __webpack_require__.r(__webpack_exports__);
|
||||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "USER_YOUTUBE_IMPORT_STARTED", function() { return USER_YOUTUBE_IMPORT_STARTED; });
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "USER_YOUTUBE_IMPORT_STARTED", function() { return USER_YOUTUBE_IMPORT_STARTED; });
|
||||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "USER_YOUTUBE_IMPORT_FAILURE", function() { return USER_YOUTUBE_IMPORT_FAILURE; });
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "USER_YOUTUBE_IMPORT_FAILURE", function() { return USER_YOUTUBE_IMPORT_FAILURE; });
|
||||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "USER_YOUTUBE_IMPORT_SUCCESS", function() { return USER_YOUTUBE_IMPORT_SUCCESS; });
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "USER_YOUTUBE_IMPORT_SUCCESS", function() { return USER_YOUTUBE_IMPORT_SUCCESS; });
|
||||||
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "USER_SET_REFERRER_STARTED", function() { return USER_SET_REFERRER_STARTED; });
|
||||||
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "USER_SET_REFERRER_SUCCESS", function() { return USER_SET_REFERRER_SUCCESS; });
|
||||||
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "USER_SET_REFERRER_FAILURE", function() { return USER_SET_REFERRER_FAILURE; });
|
||||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FETCH_FEATURED_CONTENT_STARTED", function() { return FETCH_FEATURED_CONTENT_STARTED; });
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FETCH_FEATURED_CONTENT_STARTED", function() { return FETCH_FEATURED_CONTENT_STARTED; });
|
||||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FETCH_FEATURED_CONTENT_COMPLETED", function() { return FETCH_FEATURED_CONTENT_COMPLETED; });
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FETCH_FEATURED_CONTENT_COMPLETED", function() { return FETCH_FEATURED_CONTENT_COMPLETED; });
|
||||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FETCH_TRENDING_CONTENT_STARTED", function() { return FETCH_TRENDING_CONTENT_STARTED; });
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FETCH_TRENDING_CONTENT_STARTED", function() { return FETCH_TRENDING_CONTENT_STARTED; });
|
||||||
|
@ -684,7 +695,10 @@ var USER_INVITE_NEW_FAILURE = 'USER_INVITE_NEW_FAILURE';
|
||||||
var FETCH_ACCESS_TOKEN_SUCCESS = 'FETCH_ACCESS_TOKEN_SUCCESS';
|
var FETCH_ACCESS_TOKEN_SUCCESS = 'FETCH_ACCESS_TOKEN_SUCCESS';
|
||||||
var USER_YOUTUBE_IMPORT_STARTED = 'USER_YOUTUBE_IMPORT_STARTED';
|
var USER_YOUTUBE_IMPORT_STARTED = 'USER_YOUTUBE_IMPORT_STARTED';
|
||||||
var USER_YOUTUBE_IMPORT_FAILURE = 'USER_YOUTUBE_IMPORT_FAILURE';
|
var USER_YOUTUBE_IMPORT_FAILURE = 'USER_YOUTUBE_IMPORT_FAILURE';
|
||||||
var USER_YOUTUBE_IMPORT_SUCCESS = 'USER_YOUTUBE_IMPORT_SUCCESS'; // Claims
|
var USER_YOUTUBE_IMPORT_SUCCESS = 'USER_YOUTUBE_IMPORT_SUCCESS';
|
||||||
|
var USER_SET_REFERRER_STARTED = 'USER_SET_REFERRER_STARTED';
|
||||||
|
var USER_SET_REFERRER_SUCCESS = 'USER_SET_REFERRER_SUCCESS';
|
||||||
|
var USER_SET_REFERRER_FAILURE = 'USER_SET_REFERRER_FAILURE'; // Claims
|
||||||
|
|
||||||
var FETCH_FEATURED_CONTENT_STARTED = 'FETCH_FEATURED_CONTENT_STARTED';
|
var FETCH_FEATURED_CONTENT_STARTED = 'FETCH_FEATURED_CONTENT_STARTED';
|
||||||
var FETCH_FEATURED_CONTENT_COMPLETED = 'FETCH_FEATURED_CONTENT_COMPLETED';
|
var FETCH_FEATURED_CONTENT_COMPLETED = 'FETCH_FEATURED_CONTENT_COMPLETED';
|
||||||
|
@ -1255,6 +1269,7 @@ rewards.TYPE_FIRST_STREAM = 'first_stream';
|
||||||
rewards.TYPE_MANY_DOWNLOADS = 'many_downloads';
|
rewards.TYPE_MANY_DOWNLOADS = 'many_downloads';
|
||||||
rewards.TYPE_FIRST_PUBLISH = 'first_publish';
|
rewards.TYPE_FIRST_PUBLISH = 'first_publish';
|
||||||
rewards.TYPE_REFERRAL = 'referral';
|
rewards.TYPE_REFERRAL = 'referral';
|
||||||
|
rewards.TYPE_REFEREE = 'referee';
|
||||||
rewards.TYPE_REWARD_CODE = 'reward_code';
|
rewards.TYPE_REWARD_CODE = 'reward_code';
|
||||||
rewards.TYPE_SUBSCRIPTION = 'subscription';
|
rewards.TYPE_SUBSCRIPTION = 'subscription';
|
||||||
rewards.YOUTUBE_CREATOR = 'youtube_creator';
|
rewards.YOUTUBE_CREATOR = 'youtube_creator';
|
||||||
|
@ -4648,8 +4663,11 @@ __webpack_require__.r(__webpack_exports__);
|
||||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "selectUserInviteNewIsPending", function() { return selectUserInviteNewIsPending; });
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "selectUserInviteNewIsPending", function() { return selectUserInviteNewIsPending; });
|
||||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "selectUserInviteNewErrorMessage", function() { return selectUserInviteNewErrorMessage; });
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "selectUserInviteNewErrorMessage", function() { return selectUserInviteNewErrorMessage; });
|
||||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "selectUserInviteReferralLink", function() { return selectUserInviteReferralLink; });
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "selectUserInviteReferralLink", function() { return selectUserInviteReferralLink; });
|
||||||
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "selectUserInviteReferralCode", function() { return selectUserInviteReferralCode; });
|
||||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "selectYouTubeImportPending", function() { return selectYouTubeImportPending; });
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "selectYouTubeImportPending", function() { return selectYouTubeImportPending; });
|
||||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "selectYouTubeImportError", function() { return selectYouTubeImportError; });
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "selectYouTubeImportError", function() { return selectYouTubeImportError; });
|
||||||
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "selectSetReferrerPending", function() { return selectSetReferrerPending; });
|
||||||
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "selectSetReferrerError", function() { return selectSetReferrerError; });
|
||||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "selectYouTubeImportVideosComplete", function() { return selectYouTubeImportVideosComplete; });
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "selectYouTubeImportVideosComplete", function() { return selectYouTubeImportVideosComplete; });
|
||||||
/* harmony import */ var reselect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(14);
|
/* harmony import */ var reselect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(14);
|
||||||
/* harmony import */ var reselect__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(reselect__WEBPACK_IMPORTED_MODULE_0__);
|
/* harmony import */ var reselect__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(reselect__WEBPACK_IMPORTED_MODULE_0__);
|
||||||
|
@ -4753,12 +4771,21 @@ var selectUserInviteNewErrorMessage = Object(reselect__WEBPACK_IMPORTED_MODULE_0
|
||||||
var selectUserInviteReferralLink = Object(reselect__WEBPACK_IMPORTED_MODULE_0__["createSelector"])(selectState, function (state) {
|
var selectUserInviteReferralLink = Object(reselect__WEBPACK_IMPORTED_MODULE_0__["createSelector"])(selectState, function (state) {
|
||||||
return state.referralLink;
|
return state.referralLink;
|
||||||
});
|
});
|
||||||
|
var selectUserInviteReferralCode = Object(reselect__WEBPACK_IMPORTED_MODULE_0__["createSelector"])(selectState, function (state) {
|
||||||
|
return state.referralCode;
|
||||||
|
});
|
||||||
var selectYouTubeImportPending = Object(reselect__WEBPACK_IMPORTED_MODULE_0__["createSelector"])(selectState, function (state) {
|
var selectYouTubeImportPending = Object(reselect__WEBPACK_IMPORTED_MODULE_0__["createSelector"])(selectState, function (state) {
|
||||||
return state.youtubeChannelImportPending;
|
return state.youtubeChannelImportPending;
|
||||||
});
|
});
|
||||||
var selectYouTubeImportError = Object(reselect__WEBPACK_IMPORTED_MODULE_0__["createSelector"])(selectState, function (state) {
|
var selectYouTubeImportError = Object(reselect__WEBPACK_IMPORTED_MODULE_0__["createSelector"])(selectState, function (state) {
|
||||||
return state.youtubeChannelImportErrorMessage;
|
return state.youtubeChannelImportErrorMessage;
|
||||||
});
|
});
|
||||||
|
var selectSetReferrerPending = Object(reselect__WEBPACK_IMPORTED_MODULE_0__["createSelector"])(selectState, function (state) {
|
||||||
|
return state.setReferrerIsPending;
|
||||||
|
});
|
||||||
|
var selectSetReferrerError = Object(reselect__WEBPACK_IMPORTED_MODULE_0__["createSelector"])(selectState, function (state) {
|
||||||
|
return state.setReferrerError;
|
||||||
|
});
|
||||||
var selectYouTubeImportVideosComplete = Object(reselect__WEBPACK_IMPORTED_MODULE_0__["createSelector"])(selectState, function (state) {
|
var selectYouTubeImportVideosComplete = Object(reselect__WEBPACK_IMPORTED_MODULE_0__["createSelector"])(selectState, function (state) {
|
||||||
var total = state.youtubeChannelImportTotal;
|
var total = state.youtubeChannelImportTotal;
|
||||||
var complete = state.youtubeChannelImportComplete || 0;
|
var complete = state.youtubeChannelImportComplete || 0;
|
||||||
|
@ -4791,6 +4818,7 @@ __webpack_require__.r(__webpack_exports__);
|
||||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "doFetchAccessToken", function() { return doFetchAccessToken; });
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "doFetchAccessToken", function() { return doFetchAccessToken; });
|
||||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "doUserIdentityVerify", function() { return doUserIdentityVerify; });
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "doUserIdentityVerify", function() { return doUserIdentityVerify; });
|
||||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "doUserInviteNew", function() { return doUserInviteNew; });
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "doUserInviteNew", function() { return doUserInviteNew; });
|
||||||
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "doUserSetReferrer", function() { return doUserSetReferrer; });
|
||||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "doClaimYoutubeChannels", function() { return doClaimYoutubeChannels; });
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "doClaimYoutubeChannels", function() { return doClaimYoutubeChannels; });
|
||||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "doCheckYoutubeTransfer", function() { return doCheckYoutubeTransfer; });
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "doCheckYoutubeTransfer", function() { return doCheckYoutubeTransfer; });
|
||||||
/* harmony import */ var lbry_redux__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(4);
|
/* harmony import */ var lbry_redux__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(4);
|
||||||
|
@ -4830,7 +4858,8 @@ function doFetchInviteStatus() {
|
||||||
data: {
|
data: {
|
||||||
invitesRemaining: status.invites_remaining ? status.invites_remaining : 0,
|
invitesRemaining: status.invites_remaining ? status.invites_remaining : 0,
|
||||||
invitees: status.invitees,
|
invitees: status.invitees,
|
||||||
referralLink: "".concat(lbryio__WEBPACK_IMPORTED_MODULE_5__["default"].CONNECTION_STRING, "user/refer?r=").concat(code)
|
referralLink: "".concat(lbryio__WEBPACK_IMPORTED_MODULE_5__["default"].CONNECTION_STRING, "user/refer?r=").concat(code),
|
||||||
|
referralCode: code
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
})["catch"](function (error) {
|
})["catch"](function (error) {
|
||||||
|
@ -4873,12 +4902,12 @@ function doAuthenticate(appVersion) {
|
||||||
dispatch({
|
dispatch({
|
||||||
type: constants_action_types__WEBPACK_IMPORTED_MODULE_1__["AUTHENTICATION_STARTED"]
|
type: constants_action_types__WEBPACK_IMPORTED_MODULE_1__["AUTHENTICATION_STARTED"]
|
||||||
});
|
});
|
||||||
lbryio__WEBPACK_IMPORTED_MODULE_5__["default"].authenticate().then(function (user) {
|
lbryio__WEBPACK_IMPORTED_MODULE_5__["default"].authenticate().then(function (accessToken) {
|
||||||
// analytics.setUser(user);
|
// analytics.setUser(user);
|
||||||
dispatch({
|
dispatch({
|
||||||
type: constants_action_types__WEBPACK_IMPORTED_MODULE_1__["AUTHENTICATION_SUCCESS"],
|
type: constants_action_types__WEBPACK_IMPORTED_MODULE_1__["AUTHENTICATION_SUCCESS"],
|
||||||
data: {
|
data: {
|
||||||
user: user
|
accessToken: accessToken
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
dispatch(Object(redux_actions_rewards__WEBPACK_IMPORTED_MODULE_2__["doRewardList"])());
|
dispatch(Object(redux_actions_rewards__WEBPACK_IMPORTED_MODULE_2__["doRewardList"])());
|
||||||
|
@ -5177,9 +5206,9 @@ function doUserInviteNew(email) {
|
||||||
dispatch({
|
dispatch({
|
||||||
type: constants_action_types__WEBPACK_IMPORTED_MODULE_1__["USER_INVITE_NEW_STARTED"]
|
type: constants_action_types__WEBPACK_IMPORTED_MODULE_1__["USER_INVITE_NEW_STARTED"]
|
||||||
});
|
});
|
||||||
lbryio__WEBPACK_IMPORTED_MODULE_5__["default"].call('user', 'invite', {
|
return lbryio__WEBPACK_IMPORTED_MODULE_5__["default"].call('user', 'invite', {
|
||||||
email: email
|
email: email
|
||||||
}, 'post').then(function () {
|
}, 'post').then(function (success) {
|
||||||
dispatch({
|
dispatch({
|
||||||
type: constants_action_types__WEBPACK_IMPORTED_MODULE_1__["USER_INVITE_NEW_SUCCESS"],
|
type: constants_action_types__WEBPACK_IMPORTED_MODULE_1__["USER_INVITE_NEW_SUCCESS"],
|
||||||
data: {
|
data: {
|
||||||
|
@ -5190,6 +5219,7 @@ function doUserInviteNew(email) {
|
||||||
message: __("Invite sent to ".concat(email))
|
message: __("Invite sent to ".concat(email))
|
||||||
}));
|
}));
|
||||||
dispatch(doFetchInviteStatus());
|
dispatch(doFetchInviteStatus());
|
||||||
|
return success;
|
||||||
})["catch"](function (error) {
|
})["catch"](function (error) {
|
||||||
dispatch({
|
dispatch({
|
||||||
type: constants_action_types__WEBPACK_IMPORTED_MODULE_1__["USER_INVITE_NEW_FAILURE"],
|
type: constants_action_types__WEBPACK_IMPORTED_MODULE_1__["USER_INVITE_NEW_FAILURE"],
|
||||||
|
@ -5200,6 +5230,38 @@ function doUserInviteNew(email) {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
function doUserSetReferrer(referrer, shouldClaim) {
|
||||||
|
return function (dispatch) {
|
||||||
|
dispatch({
|
||||||
|
type: constants_action_types__WEBPACK_IMPORTED_MODULE_1__["USER_SET_REFERRER_STARTED"]
|
||||||
|
});
|
||||||
|
return lbryio__WEBPACK_IMPORTED_MODULE_5__["default"].call('user', 'referral', {
|
||||||
|
referrer: referrer
|
||||||
|
}, 'post').then(function () {
|
||||||
|
dispatch({
|
||||||
|
type: constants_action_types__WEBPACK_IMPORTED_MODULE_1__["USER_SET_REFERRER_SUCCESS"]
|
||||||
|
}); // for testing
|
||||||
|
|
||||||
|
dispatch(Object(lbry_redux__WEBPACK_IMPORTED_MODULE_0__["doToast"])({
|
||||||
|
message: __("Set Referrer to ".concat(referrer))
|
||||||
|
})); // we need to userFetch because once you claim this,
|
||||||
|
|
||||||
|
if (shouldClaim) {
|
||||||
|
dispatch(Object(redux_actions_rewards__WEBPACK_IMPORTED_MODULE_2__["doClaimRewardType"])(rewards__WEBPACK_IMPORTED_MODULE_4__["default"].TYPE_REFEREE));
|
||||||
|
dispatch(doUserFetch());
|
||||||
|
} else {
|
||||||
|
dispatch(doUserFetch());
|
||||||
|
}
|
||||||
|
})["catch"](function (error) {
|
||||||
|
dispatch({
|
||||||
|
type: constants_action_types__WEBPACK_IMPORTED_MODULE_1__["USER_SET_REFERRER_FAILURE"],
|
||||||
|
data: {
|
||||||
|
error: error
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
}
|
||||||
function doClaimYoutubeChannels() {
|
function doClaimYoutubeChannels() {
|
||||||
return function (dispatch) {
|
return function (dispatch) {
|
||||||
dispatch({
|
dispatch({
|
||||||
|
@ -6629,16 +6691,21 @@ var defaultState = {
|
||||||
inviteStatusIsPending: false,
|
inviteStatusIsPending: false,
|
||||||
invitesRemaining: undefined,
|
invitesRemaining: undefined,
|
||||||
invitees: undefined,
|
invitees: undefined,
|
||||||
|
referralLink: undefined,
|
||||||
|
referralCode: undefined,
|
||||||
user: undefined,
|
user: undefined,
|
||||||
|
accessToken: undefined,
|
||||||
youtubeChannelImportPending: false,
|
youtubeChannelImportPending: false,
|
||||||
youtubeChannelImportErrorMessage: ''
|
youtubeChannelImportErrorMessage: '',
|
||||||
|
setReferrerIsPending: false,
|
||||||
|
setReferrerError: ''
|
||||||
};
|
};
|
||||||
|
|
||||||
reducers[constants_action_types__WEBPACK_IMPORTED_MODULE_0__["AUTHENTICATION_STARTED"]] = function (state) {
|
reducers[constants_action_types__WEBPACK_IMPORTED_MODULE_0__["AUTHENTICATION_STARTED"]] = function (state) {
|
||||||
return Object.assign({}, state, {
|
return Object.assign({}, state, {
|
||||||
authenticationIsPending: true,
|
authenticationIsPending: true,
|
||||||
userIsPending: true,
|
userIsPending: true,
|
||||||
user: defaultState.user
|
accessToken: defaultState.accessToken
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -6646,7 +6713,7 @@ reducers[constants_action_types__WEBPACK_IMPORTED_MODULE_0__["AUTHENTICATION_SUC
|
||||||
return Object.assign({}, state, {
|
return Object.assign({}, state, {
|
||||||
authenticationIsPending: false,
|
authenticationIsPending: false,
|
||||||
userIsPending: false,
|
userIsPending: false,
|
||||||
user: action.data.user
|
accessToken: action.data.accessToken
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -6832,7 +6899,8 @@ reducers[constants_action_types__WEBPACK_IMPORTED_MODULE_0__["USER_INVITE_STATUS
|
||||||
inviteStatusIsPending: false,
|
inviteStatusIsPending: false,
|
||||||
invitesRemaining: action.data.invitesRemaining,
|
invitesRemaining: action.data.invitesRemaining,
|
||||||
invitees: action.data.invitees,
|
invitees: action.data.invitees,
|
||||||
referralLink: action.data.referralLink
|
referralLink: action.data.referralLink,
|
||||||
|
referralCode: action.data.referralCode
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -6912,6 +6980,27 @@ reducers[constants_action_types__WEBPACK_IMPORTED_MODULE_0__["USER_EMAIL_VERIFY_
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
reducers[constants_action_types__WEBPACK_IMPORTED_MODULE_0__["USER_SET_REFERRER_STARTED"]] = function (state) {
|
||||||
|
return Object.assign({}, state, {
|
||||||
|
setReferrerIsPending: true,
|
||||||
|
setReferrerError: defaultState.setReferrerError
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
reducers[constants_action_types__WEBPACK_IMPORTED_MODULE_0__["USER_SET_REFERRER_SUCCESS"]] = function (state) {
|
||||||
|
return Object.assign({}, state, {
|
||||||
|
setReferrerIsPending: false,
|
||||||
|
setReferrerError: defaultState.setReferrerError
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
reducers[constants_action_types__WEBPACK_IMPORTED_MODULE_0__["USER_SET_REFERRER_FAILURE"]] = function (state, action) {
|
||||||
|
return Object.assign({}, state, {
|
||||||
|
setReferrerIsPending: false,
|
||||||
|
setReferrerError: action.data.error.message
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
function userReducer() {
|
function userReducer() {
|
||||||
var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : defaultState;
|
var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : defaultState;
|
||||||
var action = arguments.length > 1 ? arguments[1] : undefined;
|
var action = arguments.length > 1 ? arguments[1] : undefined;
|
||||||
|
|
|
@ -40,6 +40,9 @@ export const FETCH_ACCESS_TOKEN_SUCCESS = 'FETCH_ACCESS_TOKEN_SUCCESS';
|
||||||
export const USER_YOUTUBE_IMPORT_STARTED = 'USER_YOUTUBE_IMPORT_STARTED';
|
export const USER_YOUTUBE_IMPORT_STARTED = 'USER_YOUTUBE_IMPORT_STARTED';
|
||||||
export const USER_YOUTUBE_IMPORT_FAILURE = 'USER_YOUTUBE_IMPORT_FAILURE';
|
export const USER_YOUTUBE_IMPORT_FAILURE = 'USER_YOUTUBE_IMPORT_FAILURE';
|
||||||
export const USER_YOUTUBE_IMPORT_SUCCESS = 'USER_YOUTUBE_IMPORT_SUCCESS';
|
export const USER_YOUTUBE_IMPORT_SUCCESS = 'USER_YOUTUBE_IMPORT_SUCCESS';
|
||||||
|
export const USER_SET_REFERRER_STARTED = 'USER_SET_REFERRER_STARTED';
|
||||||
|
export const USER_SET_REFERRER_SUCCESS = 'USER_SET_REFERRER_SUCCESS';
|
||||||
|
export const USER_SET_REFERRER_FAILURE = 'USER_SET_REFERRER_FAILURE';
|
||||||
|
|
||||||
// Claims
|
// Claims
|
||||||
export const FETCH_FEATURED_CONTENT_STARTED = 'FETCH_FEATURED_CONTENT_STARTED';
|
export const FETCH_FEATURED_CONTENT_STARTED = 'FETCH_FEATURED_CONTENT_STARTED';
|
||||||
|
|
|
@ -63,6 +63,7 @@ export {
|
||||||
doUserInviteNew,
|
doUserInviteNew,
|
||||||
doClaimYoutubeChannels,
|
doClaimYoutubeChannels,
|
||||||
doCheckYoutubeTransfer,
|
doCheckYoutubeTransfer,
|
||||||
|
doUserSetReferrer,
|
||||||
} from 'redux/actions/user';
|
} from 'redux/actions/user';
|
||||||
export { doFetchCostInfoForUri } from 'redux/actions/cost_info';
|
export { doFetchCostInfoForUri } from 'redux/actions/cost_info';
|
||||||
export { doBlackListedOutpointsSubscribe } from 'redux/actions/blacklist';
|
export { doBlackListedOutpointsSubscribe } from 'redux/actions/blacklist';
|
||||||
|
@ -162,11 +163,14 @@ export {
|
||||||
selectUserInviteNewIsPending,
|
selectUserInviteNewIsPending,
|
||||||
selectUserInviteNewErrorMessage,
|
selectUserInviteNewErrorMessage,
|
||||||
selectUserInviteReferralLink,
|
selectUserInviteReferralLink,
|
||||||
|
selectUserInviteReferralCode,
|
||||||
selectUserVerifiedEmail,
|
selectUserVerifiedEmail,
|
||||||
selectYoutubeChannels,
|
selectYoutubeChannels,
|
||||||
selectYouTubeImportPending,
|
selectYouTubeImportPending,
|
||||||
selectYouTubeImportError,
|
selectYouTubeImportError,
|
||||||
selectYouTubeImportVideosComplete,
|
selectYouTubeImportVideosComplete,
|
||||||
|
selectSetReferrerPending,
|
||||||
|
selectSetReferrerError,
|
||||||
} from 'redux/selectors/user';
|
} from 'redux/selectors/user';
|
||||||
export {
|
export {
|
||||||
makeSelectFetchingCostInfoForUri,
|
makeSelectFetchingCostInfoForUri,
|
||||||
|
|
|
@ -25,6 +25,7 @@ export function doFetchInviteStatus() {
|
||||||
invitesRemaining: status.invites_remaining ? status.invites_remaining : 0,
|
invitesRemaining: status.invites_remaining ? status.invites_remaining : 0,
|
||||||
invitees: status.invitees,
|
invitees: status.invitees,
|
||||||
referralLink: `${Lbryio.CONNECTION_STRING}user/refer?r=${code}`,
|
referralLink: `${Lbryio.CONNECTION_STRING}user/refer?r=${code}`,
|
||||||
|
referralCode: code,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
|
@ -63,11 +64,11 @@ export function doAuthenticate(appVersion, os = null, firebaseToken = null) {
|
||||||
});
|
});
|
||||||
|
|
||||||
Lbryio.authenticate()
|
Lbryio.authenticate()
|
||||||
.then(user => {
|
.then(accessToken => {
|
||||||
// analytics.setUser(user);
|
// analytics.setUser(user);
|
||||||
dispatch({
|
dispatch({
|
||||||
type: ACTIONS.AUTHENTICATION_SUCCESS,
|
type: ACTIONS.AUTHENTICATION_SUCCESS,
|
||||||
data: { user },
|
data: { accessToken },
|
||||||
});
|
});
|
||||||
dispatch(doRewardList());
|
dispatch(doRewardList());
|
||||||
dispatch(doFetchInviteStatus());
|
dispatch(doFetchInviteStatus());
|
||||||
|
@ -363,8 +364,8 @@ export function doUserInviteNew(email) {
|
||||||
type: ACTIONS.USER_INVITE_NEW_STARTED,
|
type: ACTIONS.USER_INVITE_NEW_STARTED,
|
||||||
});
|
});
|
||||||
|
|
||||||
Lbryio.call('user', 'invite', { email }, 'post')
|
return Lbryio.call('user', 'invite', { email }, 'post')
|
||||||
.then(() => {
|
.then(success => {
|
||||||
dispatch({
|
dispatch({
|
||||||
type: ACTIONS.USER_INVITE_NEW_SUCCESS,
|
type: ACTIONS.USER_INVITE_NEW_SUCCESS,
|
||||||
data: { email },
|
data: { email },
|
||||||
|
@ -377,6 +378,7 @@ export function doUserInviteNew(email) {
|
||||||
);
|
);
|
||||||
|
|
||||||
dispatch(doFetchInviteStatus());
|
dispatch(doFetchInviteStatus());
|
||||||
|
return success;
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
dispatch({
|
dispatch({
|
||||||
|
@ -387,6 +389,40 @@ export function doUserInviteNew(email) {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function doUserSetReferrer(referrer, shouldClaim) {
|
||||||
|
return dispatch => {
|
||||||
|
dispatch({
|
||||||
|
type: ACTIONS.USER_SET_REFERRER_STARTED,
|
||||||
|
});
|
||||||
|
|
||||||
|
return Lbryio.call('user', 'referral', { referrer }, 'post')
|
||||||
|
.then(() => {
|
||||||
|
dispatch({
|
||||||
|
type: ACTIONS.USER_SET_REFERRER_SUCCESS,
|
||||||
|
});
|
||||||
|
// for testing
|
||||||
|
dispatch(
|
||||||
|
doToast({
|
||||||
|
message: __(`Set Referrer to ${referrer}`),
|
||||||
|
})
|
||||||
|
);
|
||||||
|
// we need to userFetch because once you claim this,
|
||||||
|
if (shouldClaim) {
|
||||||
|
dispatch(doClaimRewardType(rewards.TYPE_REFEREE));
|
||||||
|
dispatch(doUserFetch());
|
||||||
|
} else {
|
||||||
|
dispatch(doUserFetch());
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
|
dispatch({
|
||||||
|
type: ACTIONS.USER_SET_REFERRER_FAILURE,
|
||||||
|
data: { error },
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
export function doClaimYoutubeChannels() {
|
export function doClaimYoutubeChannels() {
|
||||||
return dispatch => {
|
return dispatch => {
|
||||||
dispatch({
|
dispatch({
|
||||||
|
|
|
@ -15,23 +15,28 @@ const defaultState = {
|
||||||
inviteStatusIsPending: false,
|
inviteStatusIsPending: false,
|
||||||
invitesRemaining: undefined,
|
invitesRemaining: undefined,
|
||||||
invitees: undefined,
|
invitees: undefined,
|
||||||
|
referralLink: undefined,
|
||||||
|
referralCode: undefined,
|
||||||
user: undefined,
|
user: undefined,
|
||||||
|
accessToken: undefined,
|
||||||
youtubeChannelImportPending: false,
|
youtubeChannelImportPending: false,
|
||||||
youtubeChannelImportErrorMessage: '',
|
youtubeChannelImportErrorMessage: '',
|
||||||
|
setReferrerIsPending: false,
|
||||||
|
setReferrerError: '',
|
||||||
};
|
};
|
||||||
|
|
||||||
reducers[ACTIONS.AUTHENTICATION_STARTED] = state =>
|
reducers[ACTIONS.AUTHENTICATION_STARTED] = state =>
|
||||||
Object.assign({}, state, {
|
Object.assign({}, state, {
|
||||||
authenticationIsPending: true,
|
authenticationIsPending: true,
|
||||||
userIsPending: true,
|
userIsPending: true,
|
||||||
user: defaultState.user,
|
accessToken: defaultState.accessToken,
|
||||||
});
|
});
|
||||||
|
|
||||||
reducers[ACTIONS.AUTHENTICATION_SUCCESS] = (state, action) =>
|
reducers[ACTIONS.AUTHENTICATION_SUCCESS] = (state, action) =>
|
||||||
Object.assign({}, state, {
|
Object.assign({}, state, {
|
||||||
authenticationIsPending: false,
|
authenticationIsPending: false,
|
||||||
userIsPending: false,
|
userIsPending: false,
|
||||||
user: action.data.user,
|
accessToken: action.data.accessToken,
|
||||||
});
|
});
|
||||||
|
|
||||||
reducers[ACTIONS.AUTHENTICATION_FAILURE] = state =>
|
reducers[ACTIONS.AUTHENTICATION_FAILURE] = state =>
|
||||||
|
@ -198,6 +203,7 @@ reducers[ACTIONS.USER_INVITE_STATUS_FETCH_SUCCESS] = (state, action) =>
|
||||||
invitesRemaining: action.data.invitesRemaining,
|
invitesRemaining: action.data.invitesRemaining,
|
||||||
invitees: action.data.invitees,
|
invitees: action.data.invitees,
|
||||||
referralLink: action.data.referralLink,
|
referralLink: action.data.referralLink,
|
||||||
|
referralCode: action.data.referralCode,
|
||||||
});
|
});
|
||||||
|
|
||||||
reducers[ACTIONS.USER_INVITE_NEW_STARTED] = state =>
|
reducers[ACTIONS.USER_INVITE_NEW_STARTED] = state =>
|
||||||
|
@ -265,6 +271,24 @@ reducers[ACTIONS.USER_EMAIL_VERIFY_RETRY_FAILURE] = state =>
|
||||||
resendingVerificationEmail: false,
|
resendingVerificationEmail: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
reducers[ACTIONS.USER_SET_REFERRER_STARTED] = state =>
|
||||||
|
Object.assign({}, state, {
|
||||||
|
setReferrerIsPending: true,
|
||||||
|
setReferrerError: defaultState.setReferrerError,
|
||||||
|
});
|
||||||
|
|
||||||
|
reducers[ACTIONS.USER_SET_REFERRER_SUCCESS] = state =>
|
||||||
|
Object.assign({}, state, {
|
||||||
|
setReferrerIsPending: false,
|
||||||
|
setReferrerError: defaultState.setReferrerError,
|
||||||
|
});
|
||||||
|
|
||||||
|
reducers[ACTIONS.USER_SET_REFERRER_FAILURE] = (state, action) =>
|
||||||
|
Object.assign({}, state, {
|
||||||
|
setReferrerIsPending: false,
|
||||||
|
setReferrerError: action.data.error.message,
|
||||||
|
});
|
||||||
|
|
||||||
export function userReducer(state = defaultState, action) {
|
export function userReducer(state = defaultState, action) {
|
||||||
const handler = reducers[action.type];
|
const handler = reducers[action.type];
|
||||||
if (handler) return handler(state, action);
|
if (handler) return handler(state, action);
|
||||||
|
|
|
@ -152,6 +152,11 @@ export const selectUserInviteReferralLink = createSelector(
|
||||||
state => state.referralLink
|
state => state.referralLink
|
||||||
);
|
);
|
||||||
|
|
||||||
|
export const selectUserInviteReferralCode = createSelector(
|
||||||
|
selectState,
|
||||||
|
state => state.referralCode
|
||||||
|
);
|
||||||
|
|
||||||
export const selectYouTubeImportPending = createSelector(
|
export const selectYouTubeImportPending = createSelector(
|
||||||
selectState,
|
selectState,
|
||||||
state => state.youtubeChannelImportPending
|
state => state.youtubeChannelImportPending
|
||||||
|
@ -162,6 +167,13 @@ export const selectYouTubeImportError = createSelector(
|
||||||
state => state.youtubeChannelImportErrorMessage
|
state => state.youtubeChannelImportErrorMessage
|
||||||
);
|
);
|
||||||
|
|
||||||
|
export const selectSetReferrerPending = createSelector(
|
||||||
|
selectState,
|
||||||
|
state => state.setReferrerIsPending
|
||||||
|
);
|
||||||
|
|
||||||
|
export const selectSetReferrerError = createSelector(selectState, state => state.setReferrerError);
|
||||||
|
|
||||||
export const selectYouTubeImportVideosComplete = createSelector(selectState, state => {
|
export const selectYouTubeImportVideosComplete = createSelector(selectState, state => {
|
||||||
const total = state.youtubeChannelImportTotal;
|
const total = state.youtubeChannelImportTotal;
|
||||||
const complete = state.youtubeChannelImportComplete || 0;
|
const complete = state.youtubeChannelImportComplete || 0;
|
||||||
|
|
|
@ -11,6 +11,7 @@ rewards.TYPE_FIRST_STREAM = 'first_stream';
|
||||||
rewards.TYPE_MANY_DOWNLOADS = 'many_downloads';
|
rewards.TYPE_MANY_DOWNLOADS = 'many_downloads';
|
||||||
rewards.TYPE_FIRST_PUBLISH = 'first_publish';
|
rewards.TYPE_FIRST_PUBLISH = 'first_publish';
|
||||||
rewards.TYPE_REFERRAL = 'referral';
|
rewards.TYPE_REFERRAL = 'referral';
|
||||||
|
rewards.TYPE_REFEREE = 'referee';
|
||||||
rewards.TYPE_REWARD_CODE = 'reward_code';
|
rewards.TYPE_REWARD_CODE = 'reward_code';
|
||||||
rewards.TYPE_SUBSCRIPTION = 'subscription';
|
rewards.TYPE_SUBSCRIPTION = 'subscription';
|
||||||
rewards.YOUTUBE_CREATOR = 'youtube_creator';
|
rewards.YOUTUBE_CREATOR = 'youtube_creator';
|
||||||
|
|
Loading…
Reference in a new issue