fix ACTIONS import in redux/actions/rewards

This commit is contained in:
Akinwale Ariwodola 2018-07-23 15:12:22 +01:00
parent 0cca6c1811
commit 8e33473daa
3 changed files with 338 additions and 334 deletions

233
dist/bundle.js vendored
View file

@ -106,16 +106,7 @@ Object.defineProperty(exports, "__esModule", {
});
exports.selectUserInviteNewErrorMessage = exports.selectUserInviteNewIsPending = exports.selectUserInviteStatusFailed = exports.selectUserInvitees = exports.selectUserInvitesRemaining = exports.selectUserInviteStatusIsPending = exports.selectAccessToken = exports.selectUserIsVerificationCandidate = exports.selectIdentityVerifyErrorMessage = exports.selectIdentityVerifyIsPending = exports.selectPhoneVerifyErrorMessage = exports.selectEmailVerifyErrorMessage = exports.selectEmailVerifyIsPending = exports.selectPhoneNewErrorMessage = exports.selectEmailNewErrorMessage = exports.selectEmailNewIsPending = exports.selectUserIsRewardApproved = exports.selectPhoneToVerify = exports.selectEmailToVerify = exports.selectUserCountryCode = exports.selectUserPhone = exports.selectUserEmail = exports.selectUser = exports.selectUserIsPending = exports.selectAuthenticationIsPending = exports.selectRewardByType = exports.selectClaimRewardError = exports.selectClaimErrorsByType = exports.selectIsClaimRewardPending = exports.selectClaimsPendingByType = exports.selectUnclaimedRewardValue = exports.selectFetchingRewards = exports.selectUnclaimedRewards = exports.selectClaimedRewardsByTransactionId = exports.selectClaimedRewards = exports.selectClaimedRewardsById = exports.selectUnclaimedRewardsByType = exports.makeSelectRewardByType = exports.makeSelectRewardAmountByType = exports.makeSelectIsRewardClaimPending = exports.makeSelectClaimRewardError = exports.selectAuthToken = exports.userReducer = exports.rewardsReducer = exports.authReducer = exports.doUserFetch = exports.doAuthenticate = exports.doInstallNew = exports.doFetchInviteStatus = exports.doClaimRewardClearError = exports.doClaimEligiblePurchaseRewards = exports.doClaimRewardType = exports.doRewardList = exports.doGenerateAuthToken = exports.Lbryio = exports.LBRYINC_ACTIONS = undefined;
var _lbryio = __webpack_require__(1);
Object.defineProperty(exports, 'Lbryio', {
enumerable: true,
get: function get() {
return _lbryio.Lbryio;
}
});
var _auth = __webpack_require__(4);
var _auth = __webpack_require__(1);
Object.defineProperty(exports, 'doGenerateAuthToken', {
enumerable: true,
@ -466,10 +457,16 @@ Object.defineProperty(exports, 'selectUserInviteNewErrorMessage', {
}
});
var _action_types = __webpack_require__(5);
var _action_types = __webpack_require__(2);
var LBRYINC_ACTIONS = _interopRequireWildcard(_action_types);
var _lbryio = __webpack_require__(3);
var _lbryio2 = _interopRequireDefault(_lbryio);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
// constants
@ -477,10 +474,81 @@ exports.LBRYINC_ACTIONS = LBRYINC_ACTIONS;
// Lbryio
exports.Lbryio = _lbryio2.default;
// actions
/***/ }),
/* 1 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.doGenerateAuthToken = doGenerateAuthToken;
var _action_types = __webpack_require__(2);
var ACTIONS = _interopRequireWildcard(_action_types);
var _lbryio = __webpack_require__(3);
var _lbryio2 = _interopRequireDefault(_lbryio);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
function doGenerateAuthToken(installationId) {
return function (dispatch) {
dispatch({
type: ACTIONS.GENERATE_AUTH_TOKEN_STARTED
});
_lbryio2.default.call('user', 'new', {
auth_token: '',
language: 'en',
app_id: installationId
}, 'post').then(function (response) {
if (!response.auth_token) {
dispatch({
type: ACTIONS.GENERATE_AUTH_TOKEN_FAILURE
});
} else {
dispatch({
type: ACTIONS.GENERATE_AUTH_TOKEN_SUCCESS,
data: { authToken: response.auth_token }
});
}
}).catch(function () {
dispatch({
type: ACTIONS.GENERATE_AUTH_TOKEN_FAILURE
});
});
};
}
/***/ }),
/* 2 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var GENERATE_AUTH_TOKEN_FAILURE = exports.GENERATE_AUTH_TOKEN_FAILURE = 'GENERATE_AUTH_TOKEN_FAILURE';
var GENERATE_AUTH_TOKEN_STARTED = exports.GENERATE_AUTH_TOKEN_STARTED = 'GENERATE_AUTH_TOKEN_STARTED';
var GENERATE_AUTH_TOKEN_SUCCESS = exports.GENERATE_AUTH_TOKEN_SUCCESS = 'GENERATE_AUTH_TOKEN_SUCCESS';
/***/ }),
/* 3 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/* WEBPACK VAR INJECTION */(function(process) {
@ -490,9 +558,9 @@ Object.defineProperty(exports, "__esModule", {
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _lbryRedux = __webpack_require__(3);
var _lbryRedux = __webpack_require__(5);
var _auth = __webpack_require__(4);
var _auth = __webpack_require__(1);
var _querystring = __webpack_require__(6);
@ -573,7 +641,9 @@ Lbryio.getAuthToken = function () {
if (Lbryio.authToken) {
resolve(Lbryio.authToken);
} else {
var store = window.store;
var _window = window,
store = _window.store;
if (store) {
var state = store.getState();
var token = state.auth ? state.auth.authToken : null;
@ -623,9 +693,11 @@ Lbryio.authenticate = function () {
}
return _lbryRedux.Lbry.status().then(function (status) {
var store = window.store;
var _window2 = window,
store = _window2.store;
if (store) {
store.dispatch(doGenerateAuthToken(status.installation_id));
store.dispatch((0, _auth.doGenerateAuthToken)(status.installation_id));
return resolve();
}
@ -643,10 +715,10 @@ Lbryio.getStripeToken = function () {
};
exports.default = Lbryio;
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(2)))
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(4)))
/***/ }),
/* 2 */
/* 4 */
/***/ (function(module, exports) {
// shim for using process in browser
@ -836,7 +908,7 @@ process.umask = function() { return 0; };
/***/ }),
/* 3 */
/* 5 */
/***/ (function(module, exports, __webpack_require__) {
(function webpackUniversalModuleDefinition(root, factory) {
@ -6816,73 +6888,6 @@ var KEEP_DAEMON_RUNNING = exports.KEEP_DAEMON_RUNNING = 'keepDaemonRunning';
/******/ ]);
});
/***/ }),
/* 4 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.doGenerateAuthToken = doGenerateAuthToken;
var _action_types = __webpack_require__(5);
var ACTIONS = _interopRequireWildcard(_action_types);
var _lbryio = __webpack_require__(1);
var _lbryio2 = _interopRequireDefault(_lbryio);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
function doGenerateAuthToken(installationId) {
return function (dispatch) {
dispatch({
type: ACTIONS.GENERATE_AUTH_TOKEN_STARTED
});
_lbryio2.default.call('user', 'new', {
auth_token: '',
language: 'en',
app_id: installationId
}, 'post').then(function (response) {
if (!response.auth_token) {
dispatch({
type: ACTIONS.GENERATE_AUTH_TOKEN_FAILURE
});
} else {
dispatch({
type: ACTIONS.GENERATE_AUTH_TOKEN_SUCCESS,
data: { authToken: response.auth_token }
});
}
}).catch(function () {
dispatch({
type: ACTIONS.GENERATE_AUTH_TOKEN_FAILURE
});
});
};
}
/***/ }),
/* 5 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var GENERATE_AUTH_TOKEN_FAILURE = exports.GENERATE_AUTH_TOKEN_FAILURE = 'GENERATE_AUTH_TOKEN_FAILURE';
var GENERATE_AUTH_TOKEN_STARTED = exports.GENERATE_AUTH_TOKEN_STARTED = 'GENERATE_AUTH_TOKEN_STARTED';
var GENERATE_AUTH_TOKEN_SUCCESS = exports.GENERATE_AUTH_TOKEN_SUCCESS = 'GENERATE_AUTH_TOKEN_SUCCESS';
/***/ }),
/* 6 */
/***/ (function(module, exports, __webpack_require__) {
@ -7092,15 +7097,11 @@ exports.doClaimRewardType = doClaimRewardType;
exports.doClaimEligiblePurchaseRewards = doClaimEligiblePurchaseRewards;
exports.doClaimRewardClearError = doClaimRewardClearError;
var _action_types = __webpack_require__(5);
var ACTIONS = _interopRequireWildcard(_action_types);
var _lbryio = __webpack_require__(1);
var _lbryio = __webpack_require__(3);
var _lbryio2 = _interopRequireDefault(_lbryio);
var _lbryRedux = __webpack_require__(3);
var _lbryRedux = __webpack_require__(5);
var _rewards = __webpack_require__(10);
@ -7112,22 +7113,20 @@ var _rewards3 = _interopRequireDefault(_rewards2);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
function doRewardList() {
return function (dispatch) {
dispatch({
type: ACTIONS.FETCH_REWARDS_STARTED
type: _lbryRedux.ACTIONS.FETCH_REWARDS_STARTED
});
_lbryio2.default.call('reward', 'list', { multiple_rewards_per_type: true }).then(function (userRewards) {
dispatch({
type: ACTIONS.FETCH_REWARDS_COMPLETED,
type: _lbryRedux.ACTIONS.FETCH_REWARDS_COMPLETED,
data: { userRewards: userRewards }
});
}).catch(function () {
dispatch({
type: ACTIONS.FETCH_REWARDS_COMPLETED,
type: _lbryRedux.ACTIONS.FETCH_REWARDS_COMPLETED,
data: { userRewards: [] }
});
});
@ -7159,13 +7158,13 @@ function doClaimRewardType(rewardType, options) {
}
dispatch({
type: ACTIONS.CLAIM_REWARD_STARTED,
type: _lbryRedux.ACTIONS.CLAIM_REWARD_STARTED,
data: { reward: reward }
});
var success = function success(successReward) {
dispatch({
type: ACTIONS.CLAIM_REWARD_SUCCESS,
type: _lbryRedux.ACTIONS.CLAIM_REWARD_SUCCESS,
data: {
reward: successReward
}
@ -7181,7 +7180,7 @@ function doClaimRewardType(rewardType, options) {
var failure = function failure(error) {
dispatch({
type: ACTIONS.CLAIM_REWARD_FAILURE,
type: _lbryRedux.ACTIONS.CLAIM_REWARD_FAILURE,
data: {
reward: reward,
error: !options || !options.failSilently ? error : undefined
@ -7218,7 +7217,7 @@ function doClaimEligiblePurchaseRewards() {
function doClaimRewardClearError(reward) {
return function (dispatch) {
dispatch({
type: ACTIONS.CLAIM_REWARD_CLEAR_ERROR,
type: _lbryRedux.ACTIONS.CLAIM_REWARD_CLEAR_ERROR,
data: { reward: reward }
});
};
@ -7582,9 +7581,9 @@ Object.defineProperty(exports, "__esModule", {
value: true
});
var _lbryRedux = __webpack_require__(3);
var _lbryRedux = __webpack_require__(5);
var _lbryio = __webpack_require__(1);
var _lbryio = __webpack_require__(3);
var _lbryio2 = _interopRequireDefault(_lbryio);
@ -7690,17 +7689,23 @@ exports.doInstallNew = doInstallNew;
exports.doAuthenticate = doAuthenticate;
exports.doUserFetch = doUserFetch;
var _lbryRedux = __webpack_require__(3);
var _lbryRedux = __webpack_require__(5);
var _rewards = __webpack_require__(9);
var _lbryio = __webpack_require__(3);
var _lbryio2 = _interopRequireDefault(_lbryio);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function doFetchInviteStatus() {
return function (dispatch) {
dispatch({
type: _lbryRedux.ACTIONS.USER_INVITE_STATUS_FETCH_STARTED
});
Lbryio.call('user', 'invite_status').then(function (status) {
_lbryio2.default.call('user', 'invite_status').then(function (status) {
dispatch({
type: _lbryRedux.ACTIONS.USER_INVITE_STATUS_FETCH_SUCCESS,
data: {
@ -7728,7 +7733,7 @@ function doInstallNew(appVersion) {
payload.daemon_version = version.lbrynet_version;
payload.operating_system = version.os_system;
payload.platform = version.platform;
Lbryio.call('install', 'new', payload);
_lbryio2.default.call('install', 'new', payload);
});
});
}
@ -7741,8 +7746,8 @@ function doAuthenticate(appVersion) {
dispatch({
type: _lbryRedux.ACTIONS.AUTHENTICATION_STARTED
});
Lbryio.authenticate().then(function (user) {
//analytics.setUser(user);
_lbryio2.default.authenticate().then(function (user) {
// analytics.setUser(user);
dispatch({
type: _lbryRedux.ACTIONS.AUTHENTICATION_SUCCESS,
data: { user: user }
@ -7751,7 +7756,7 @@ function doAuthenticate(appVersion) {
dispatch(doFetchInviteStatus());
doInstallNew(appVersion, deviceId);
}).catch(function (error) {
dispatch(doNotify({ id: MODALS.AUTHENTICATION_FAILURE }));
dispatch((0, _lbryRedux.doNotify)({ id: _lbryRedux.MODALS.AUTHENTICATION_FAILURE }));
dispatch({
type: _lbryRedux.ACTIONS.AUTHENTICATION_FAILURE,
data: { error: error }
@ -7765,8 +7770,8 @@ function doUserFetch() {
dispatch({
type: _lbryRedux.ACTIONS.USER_FETCH_STARTED
});
Lbryio.getCurrentUser().then(function (user) {
analytics.setUser(user);
_lbryio2.default.getCurrentUser().then(function (user) {
// analytics.setUser(user);
dispatch((0, _rewards.doRewardList)());
dispatch({
@ -7794,7 +7799,7 @@ Object.defineProperty(exports, "__esModule", {
});
exports.authReducer = authReducer;
var _action_types = __webpack_require__(5);
var _action_types = __webpack_require__(2);
var ACTIONS = _interopRequireWildcard(_action_types);
@ -7849,7 +7854,7 @@ var _extends = Object.assign || function (target) { for (var i = 1; i < argument
exports.rewardsReducer = rewardsReducer;
var _lbryRedux = __webpack_require__(3);
var _lbryRedux = __webpack_require__(5);
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
@ -7977,7 +7982,7 @@ Object.defineProperty(exports, "__esModule", {
});
exports.userReducer = userReducer;
var _lbryRedux = __webpack_require__(3);
var _lbryRedux = __webpack_require__(5);
var reducers = {};

View file

@ -1,6 +1,5 @@
import * as ACTIONS from 'constants/action_types';
import Lbryio from 'lbryio';
import { doNotify, MODALS } from 'lbry-redux';
import { doNotify, ACTIONS, MODALS } from 'lbry-redux';
import { selectUnclaimedRewards } from 'redux/selectors/rewards';
import { selectUserIsRewardApproved } from 'redux/selectors/user';
import rewards from 'rewards';