diff --git a/dist/bundle.es.js b/dist/bundle.es.js index 792fc07..e3e7fc6 100644 --- a/dist/bundle.es.js +++ b/dist/bundle.es.js @@ -1397,31 +1397,29 @@ function doAuthenticate(appVersion, os = null, firebaseToken = null, shareUsageD }; } function doUserFetch() { - return dispatch => { - return new Promise((resolve, reject) => { + return dispatch => new Promise((resolve, reject) => { + dispatch({ + type: USER_FETCH_STARTED + }); + Lbryio.getCurrentUser().then(user => { + dispatch(doRewardList()); dispatch({ - type: USER_FETCH_STARTED + type: USER_FETCH_SUCCESS, + data: { + user + } }); - Lbryio.getCurrentUser().then(user => { - dispatch(doRewardList()); - dispatch({ - type: USER_FETCH_SUCCESS, - data: { - user - } - }); - resolve(user); - }).catch(error => { - reject(error); - dispatch({ - type: USER_FETCH_FAILURE, - data: { - error - } - }); + resolve(user); + }).catch(error => { + reject(error); + dispatch({ + type: USER_FETCH_FAILURE, + data: { + error + } }); }); - }; + }); } function doUserCheckEmailVerified() { // This will happen in the background so we don't need loading booleans @@ -1579,6 +1577,9 @@ function doUserCheckIfEmailExists(email) { email } }); + dispatch({ + type: USER_EMAIL_NEW_EXISTS + }); if (response.has_password) { dispatch({ @@ -1782,7 +1783,7 @@ function doClearEmailEntry() { type: USER_EMAIL_NEW_CLEAR_ENTRY }; } -function doClearPasswordEntries() { +function doClearPasswordEntry() { return { type: USER_PASSWORD_SET_CLEAR }; @@ -3395,13 +3396,19 @@ reducers$2[USER_EMAIL_NEW_FAILURE] = (state, action) => Object.assign({}, state, emailNewErrorMessage: action.data.error }); -reducers$2[USER_EMAIL_NEW_CLEAR_ENTRY] = state => Object.assign({}, state, { - emailNewErrorMessage: null, - emailAlreadyExists: false, - emailDoesNotExist: false, - passwordExistsForUser: false, - emailToVerify: null -}); +reducers$2[USER_EMAIL_NEW_CLEAR_ENTRY] = state => { + const newUser = { ...state.user + }; + delete newUser.primary_email; + return Object.assign({}, state, { + emailNewErrorMessage: null, + emailAlreadyExists: false, + emailDoesNotExist: false, + passwordExistsForUser: false, + emailToVerify: null, + user: newUser + }); +}; reducers$2[USER_PASSWORD_SET_CLEAR] = state => Object.assign({}, state, { passwordResetSuccess: false, @@ -3972,7 +3979,7 @@ exports.doClaimRewardClearError = doClaimRewardClearError; exports.doClaimRewardType = doClaimRewardType; exports.doClaimYoutubeChannels = doClaimYoutubeChannels; exports.doClearEmailEntry = doClearEmailEntry; -exports.doClearPasswordEntries = doClearPasswordEntries; +exports.doClearPasswordEntry = doClearPasswordEntry; exports.doCompleteFirstRun = doCompleteFirstRun; exports.doFetchAccessToken = doFetchAccessToken; exports.doFetchCostInfoForUri = doFetchCostInfoForUri; diff --git a/dist/bundle.js b/dist/bundle.js index 2f11ed5..f6fb246 100644 --- a/dist/bundle.js +++ b/dist/bundle.js @@ -225,7 +225,7 @@ __webpack_require__.r(__webpack_exports__); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "doClearEmailEntry", function() { return redux_actions_user__WEBPACK_IMPORTED_MODULE_11__["doClearEmailEntry"]; }); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "doClearPasswordEntries", function() { return redux_actions_user__WEBPACK_IMPORTED_MODULE_11__["doClearPasswordEntries"]; }); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "doClearPasswordEntry", function() { return redux_actions_user__WEBPACK_IMPORTED_MODULE_11__["doClearPasswordEntry"]; }); /* harmony import */ var redux_actions_cost_info__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(30); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "doFetchCostInfoForUri", function() { return redux_actions_cost_info__WEBPACK_IMPORTED_MODULE_12__["doFetchCostInfoForUri"]; }); @@ -4955,7 +4955,7 @@ __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "doUserPasswordSet", function() { return doUserPasswordSet; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "doUserResendVerificationEmail", function() { return doUserResendVerificationEmail; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "doClearEmailEntry", function() { return doClearEmailEntry; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "doClearPasswordEntries", function() { return doClearPasswordEntries; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "doClearPasswordEntry", function() { return doClearPasswordEntry; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "doUserEmailVerifyFailure", function() { return doUserEmailVerifyFailure; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "doUserEmailVerify", function() { return doUserEmailVerify; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "doFetchAccessToken", function() { return doFetchAccessToken; }); @@ -5295,6 +5295,9 @@ function doUserCheckIfEmailExists(email) { email: email } }); + dispatch({ + type: constants_action_types__WEBPACK_IMPORTED_MODULE_1__["USER_EMAIL_NEW_EXISTS"] + }); if (response.has_password) { dispatch({ @@ -5502,7 +5505,7 @@ function doClearEmailEntry() { type: constants_action_types__WEBPACK_IMPORTED_MODULE_1__["USER_EMAIL_NEW_CLEAR_ENTRY"] }; } -function doClearPasswordEntries() { +function doClearPasswordEntry() { return { type: constants_action_types__WEBPACK_IMPORTED_MODULE_1__["USER_PASSWORD_SET_CLEAR"] }; @@ -7168,6 +7171,10 @@ function rewardsReducer() { __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "userReducer", function() { return userReducer; }); /* harmony import */ var constants_action_types__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1); +function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; } + +function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } + var reducers = {}; var defaultState = { @@ -7337,12 +7344,16 @@ reducers[constants_action_types__WEBPACK_IMPORTED_MODULE_0__["USER_EMAIL_NEW_FAI }; reducers[constants_action_types__WEBPACK_IMPORTED_MODULE_0__["USER_EMAIL_NEW_CLEAR_ENTRY"]] = function (state) { + var newUser = _objectSpread({}, state.user); + + delete newUser.primary_email; return Object.assign({}, state, { emailNewErrorMessage: null, emailAlreadyExists: false, emailDoesNotExist: false, passwordExistsForUser: false, - emailToVerify: null + emailToVerify: null, + user: newUser }); }; diff --git a/src/index.js b/src/index.js index 1be936d..d626b93 100644 --- a/src/index.js +++ b/src/index.js @@ -73,7 +73,7 @@ export { doUserPasswordSet, doUserCheckIfEmailExists, doClearEmailEntry, - doClearPasswordEntries, + doClearPasswordEntry, } from 'redux/actions/user'; export { doFetchCostInfoForUri } from 'redux/actions/cost_info'; export { doBlackListedOutpointsSubscribe } from 'redux/actions/blacklist'; diff --git a/src/redux/actions/user.js b/src/redux/actions/user.js index 629cc46..ceec3ab 100644 --- a/src/redux/actions/user.js +++ b/src/redux/actions/user.js @@ -318,6 +318,10 @@ export function doUserCheckIfEmailExists(email) { data: { email }, }); + dispatch({ + type: ACTIONS.USER_EMAIL_NEW_EXISTS, + }); + if (response.has_password) { dispatch({ type: ACTIONS.USER_PASSWORD_EXISTS, @@ -509,7 +513,7 @@ export function doClearEmailEntry() { }; } -export function doClearPasswordEntries() { +export function doClearPasswordEntry() { return { type: ACTIONS.USER_PASSWORD_SET_CLEAR, }; diff --git a/src/redux/reducers/user.js b/src/redux/reducers/user.js index b6af630..67699ac 100644 --- a/src/redux/reducers/user.js +++ b/src/redux/reducers/user.js @@ -152,14 +152,19 @@ reducers[ACTIONS.USER_EMAIL_NEW_FAILURE] = (state, action) => emailNewErrorMessage: action.data.error, }); -reducers[ACTIONS.USER_EMAIL_NEW_CLEAR_ENTRY] = state => - Object.assign({}, state, { +reducers[ACTIONS.USER_EMAIL_NEW_CLEAR_ENTRY] = state => { + const newUser = { ...state.user }; + delete newUser.primary_email; + + return Object.assign({}, state, { emailNewErrorMessage: null, emailAlreadyExists: false, emailDoesNotExist: false, passwordExistsForUser: false, emailToVerify: null, + user: newUser, }); +}; reducers[ACTIONS.USER_PASSWORD_SET_CLEAR] = state => Object.assign({}, state, {