diff --git a/README.md b/README.md index f2158298..4a82dfab 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,10 @@ The [Topcoder](https://www.topcoder.com) lib for internal ReactJS projects. +### Configuration for AV-Scan scorer review type ID + +Change the property in `AV_SCAN_SCORER_REVIEW_TYPE_ID` in config. + ### Development ```shell # Install dependencies diff --git a/__tests__/__snapshots__/index.js.snap b/__tests__/__snapshots__/index.js.snap index e7ee51bc..6f0cf737 100644 --- a/__tests__/__snapshots__/index.js.snap +++ b/__tests__/__snapshots__/index.js.snap @@ -17,6 +17,8 @@ Object { "getActiveChallengesCountInit": [Function], "getDetailsDone": [Function], "getDetailsInit": [Function], + "getMmSubmissionsDone": [Function], + "getMmSubmissionsInit": [Function], "getSubmissionsDone": [Function], "getSubmissionsInit": [Function], "loadResultsDone": [Function], @@ -467,6 +469,7 @@ Object { "getApiV2": [Function], "getApiV3": [Function], "getApiV4": [Function], + "getApiV5": [Function], "getTcM2mToken": [Function], }, "billing": Object { @@ -510,6 +513,10 @@ Object { "default": undefined, "getReviewOpportunitiesService": [Function], }, + "submissions": Object { + "default": undefined, + "getService": [Function], + }, "terms": Object { "default": undefined, "getService": [Function], @@ -527,6 +534,12 @@ Object { "getService": [Function], }, }, + "submission": Object { + "default": undefined, + "getFinalScore": [Function], + "getProvisionalScore": [Function], + "processMMSubmissions": [Function], + }, "tc": Object { "COMPETITION_TRACKS": Object { "DATA_SCIENCE": "data_science", diff --git a/__tests__/reducers/__snapshots__/challenge.js.snap b/__tests__/reducers/__snapshots__/challenge.js.snap index 9db7c531..7ddb822b 100644 --- a/__tests__/reducers/__snapshots__/challenge.js.snap +++ b/__tests__/reducers/__snapshots__/challenge.js.snap @@ -6,7 +6,9 @@ Object { "details": null, "loadingCheckpoints": false, "loadingDetailsForChallengeId": "", + "loadingMMSubmissionsForChallengeId": "", "loadingResultsForChallengeId": "", + "mmSubmissions": Array [], "mySubmissions": Object {}, "mySubmissionsManagement": Object {}, "registering": false, @@ -27,7 +29,9 @@ Object { "fetchChallengeFailure": false, "loadingCheckpoints": false, "loadingDetailsForChallengeId": "", + "loadingMMSubmissionsForChallengeId": "", "loadingResultsForChallengeId": "", + "mmSubmissions": Array [], "mySubmissions": Object {}, "mySubmissionsManagement": Object {}, "registering": false, @@ -48,7 +52,9 @@ Object { "fetchChallengeFailure": "Unknown error", "loadingCheckpoints": false, "loadingDetailsForChallengeId": "", + "loadingMMSubmissionsForChallengeId": "", "loadingResultsForChallengeId": "", + "mmSubmissions": Array [], "mySubmissions": Object {}, "mySubmissionsManagement": Object {}, "registering": false, @@ -66,7 +72,9 @@ Object { "fetchChallengeFailure": false, "loadingCheckpoints": false, "loadingDetailsForChallengeId": "12345", + "loadingMMSubmissionsForChallengeId": "", "loadingResultsForChallengeId": "", + "mmSubmissions": Array [], "mySubmissions": Object {}, "mySubmissionsManagement": Object {}, "registering": false, @@ -87,8 +95,10 @@ Object { "fetchChallengeFailure": "Unknown error", "loadingCheckpoints": false, "loadingDetailsForChallengeId": "", + "loadingMMSubmissionsForChallengeId": "", "loadingResultsForChallengeId": "", "loadingSubmissionsForChallengeId": "", + "mmSubmissions": Array [], "mySubmissions": Object { "challengeId": "12345", "v2": Array [], @@ -114,8 +124,10 @@ Object { "fetchChallengeFailure": "Unknown error", "loadingCheckpoints": false, "loadingDetailsForChallengeId": "", + "loadingMMSubmissionsForChallengeId": "", "loadingResultsForChallengeId": "", "loadingSubmissionsForChallengeId": "", + "mmSubmissions": Array [], "mySubmissions": Object { "challengeId": "12345", "v2": Array [ @@ -143,8 +155,10 @@ Object { "fetchChallengeFailure": "Unknown error", "loadingCheckpoints": false, "loadingDetailsForChallengeId": "", + "loadingMMSubmissionsForChallengeId": "", "loadingResultsForChallengeId": "", "loadingSubmissionsForChallengeId": "", + "mmSubmissions": Array [], "mySubmissions": Object { "challengeId": "", "v2": null, @@ -170,8 +184,10 @@ Object { "fetchChallengeFailure": "Unknown error", "loadingCheckpoints": false, "loadingDetailsForChallengeId": "", + "loadingMMSubmissionsForChallengeId": "", "loadingResultsForChallengeId": "", "loadingSubmissionsForChallengeId": "12345", + "mmSubmissions": Array [], "mySubmissions": Object { "challengeId": "", "v2": null, @@ -196,8 +212,10 @@ Object { "fetchChallengeFailure": "Unknown error", "loadingCheckpoints": false, "loadingDetailsForChallengeId": "", + "loadingMMSubmissionsForChallengeId": "", "loadingResultsForChallengeId": "", "loadingSubmissionsForChallengeId": "", + "mmSubmissions": Array [], "mySubmissions": Object { "challengeId": "", "v2": null, @@ -223,8 +241,10 @@ Object { "fetchChallengeFailure": false, "loadingCheckpoints": false, "loadingDetailsForChallengeId": "", + "loadingMMSubmissionsForChallengeId": "", "loadingResultsForChallengeId": "", "loadingSubmissionsForChallengeId": "", + "mmSubmissions": Array [], "mySubmissions": Object { "challengeId": "12345", "v2": Array [ @@ -252,8 +272,10 @@ Object { "fetchChallengeFailure": false, "loadingCheckpoints": false, "loadingDetailsForChallengeId": "", + "loadingMMSubmissionsForChallengeId": "", "loadingResultsForChallengeId": "", "loadingSubmissionsForChallengeId": "", + "mmSubmissions": Array [], "mySubmissions": Object { "challengeId": "12345", "v2": Array [ @@ -281,8 +303,10 @@ Object { "fetchChallengeFailure": "Unknown error", "loadingCheckpoints": false, "loadingDetailsForChallengeId": "", + "loadingMMSubmissionsForChallengeId": "", "loadingResultsForChallengeId": "", "loadingSubmissionsForChallengeId": "", + "mmSubmissions": Array [], "mySubmissions": Object { "challengeId": "12345", "v2": Array [ @@ -310,8 +334,10 @@ Object { "fetchChallengeFailure": false, "loadingCheckpoints": false, "loadingDetailsForChallengeId": "12345", + "loadingMMSubmissionsForChallengeId": "", "loadingResultsForChallengeId": "", "loadingSubmissionsForChallengeId": "", + "mmSubmissions": Array [], "mySubmissions": Object { "challengeId": "12345", "v2": Array [ @@ -339,8 +365,10 @@ Object { "fetchChallengeFailure": "Unknown error", "loadingCheckpoints": false, "loadingDetailsForChallengeId": "", + "loadingMMSubmissionsForChallengeId": "", "loadingResultsForChallengeId": "", "loadingSubmissionsForChallengeId": "", + "mmSubmissions": Array [], "mySubmissions": Object { "challengeId": "12345", "v2": Array [], @@ -366,8 +394,10 @@ Object { "fetchChallengeFailure": "Unknown error", "loadingCheckpoints": false, "loadingDetailsForChallengeId": "", + "loadingMMSubmissionsForChallengeId": "", "loadingResultsForChallengeId": "", "loadingSubmissionsForChallengeId": "", + "mmSubmissions": Array [], "mySubmissions": Object { "challengeId": "12345", "v2": Array [ @@ -395,8 +425,10 @@ Object { "fetchChallengeFailure": "Unknown error", "loadingCheckpoints": false, "loadingDetailsForChallengeId": "", + "loadingMMSubmissionsForChallengeId": "", "loadingResultsForChallengeId": "", "loadingSubmissionsForChallengeId": "", + "mmSubmissions": Array [], "mySubmissions": Object { "challengeId": "", "v2": null, @@ -422,8 +454,10 @@ Object { "fetchChallengeFailure": "Unknown error", "loadingCheckpoints": false, "loadingDetailsForChallengeId": "", + "loadingMMSubmissionsForChallengeId": "", "loadingResultsForChallengeId": "", "loadingSubmissionsForChallengeId": "12345", + "mmSubmissions": Array [], "mySubmissions": Object { "challengeId": "", "v2": null, @@ -448,8 +482,10 @@ Object { "fetchChallengeFailure": "Unknown error", "loadingCheckpoints": false, "loadingDetailsForChallengeId": "", + "loadingMMSubmissionsForChallengeId": "", "loadingResultsForChallengeId": "", "loadingSubmissionsForChallengeId": "", + "mmSubmissions": Array [], "mySubmissions": Object { "challengeId": "", "v2": null, @@ -471,7 +507,9 @@ Object { "details": null, "loadingCheckpoints": false, "loadingDetailsForChallengeId": "", + "loadingMMSubmissionsForChallengeId": "", "loadingResultsForChallengeId": "", + "mmSubmissions": Array [], "mySubmissions": Object {}, "mySubmissionsManagement": Object {}, "registering": false, @@ -492,7 +530,9 @@ Object { "fetchChallengeFailure": false, "loadingCheckpoints": false, "loadingDetailsForChallengeId": "", + "loadingMMSubmissionsForChallengeId": "", "loadingResultsForChallengeId": "", + "mmSubmissions": Array [], "mySubmissions": Object {}, "mySubmissionsManagement": Object {}, "registering": false, @@ -513,7 +553,9 @@ Object { "fetchChallengeFailure": "Unknown error", "loadingCheckpoints": false, "loadingDetailsForChallengeId": "", + "loadingMMSubmissionsForChallengeId": "", "loadingResultsForChallengeId": "", + "mmSubmissions": Array [], "mySubmissions": Object {}, "mySubmissionsManagement": Object {}, "registering": false, @@ -531,7 +573,9 @@ Object { "fetchChallengeFailure": false, "loadingCheckpoints": false, "loadingDetailsForChallengeId": "12345", + "loadingMMSubmissionsForChallengeId": "", "loadingResultsForChallengeId": "", + "mmSubmissions": Array [], "mySubmissions": Object {}, "mySubmissionsManagement": Object {}, "registering": false, @@ -552,8 +596,10 @@ Object { "fetchChallengeFailure": "Unknown error", "loadingCheckpoints": false, "loadingDetailsForChallengeId": "", + "loadingMMSubmissionsForChallengeId": "", "loadingResultsForChallengeId": "", "loadingSubmissionsForChallengeId": "", + "mmSubmissions": Array [], "mySubmissions": Object { "challengeId": "12345", "v2": Array [], @@ -579,8 +625,10 @@ Object { "fetchChallengeFailure": "Unknown error", "loadingCheckpoints": false, "loadingDetailsForChallengeId": "", + "loadingMMSubmissionsForChallengeId": "", "loadingResultsForChallengeId": "", "loadingSubmissionsForChallengeId": "", + "mmSubmissions": Array [], "mySubmissions": Object { "challengeId": "12345", "v2": Array [ @@ -608,8 +656,10 @@ Object { "fetchChallengeFailure": "Unknown error", "loadingCheckpoints": false, "loadingDetailsForChallengeId": "", + "loadingMMSubmissionsForChallengeId": "", "loadingResultsForChallengeId": "", "loadingSubmissionsForChallengeId": "", + "mmSubmissions": Array [], "mySubmissions": Object { "challengeId": "", "v2": null, @@ -635,8 +685,10 @@ Object { "fetchChallengeFailure": "Unknown error", "loadingCheckpoints": false, "loadingDetailsForChallengeId": "", + "loadingMMSubmissionsForChallengeId": "", "loadingResultsForChallengeId": "", "loadingSubmissionsForChallengeId": "12345", + "mmSubmissions": Array [], "mySubmissions": Object { "challengeId": "", "v2": null, @@ -661,8 +713,10 @@ Object { "fetchChallengeFailure": "Unknown error", "loadingCheckpoints": false, "loadingDetailsForChallengeId": "", + "loadingMMSubmissionsForChallengeId": "", "loadingResultsForChallengeId": "", "loadingSubmissionsForChallengeId": "", + "mmSubmissions": Array [], "mySubmissions": Object { "challengeId": "", "v2": null, @@ -684,7 +738,9 @@ Object { "details": null, "loadingCheckpoints": false, "loadingDetailsForChallengeId": "", + "loadingMMSubmissionsForChallengeId": "", "loadingResultsForChallengeId": "", + "mmSubmissions": Array [], "mySubmissions": Object {}, "mySubmissionsManagement": Object {}, "registering": false, @@ -705,7 +761,9 @@ Object { "fetchChallengeFailure": false, "loadingCheckpoints": false, "loadingDetailsForChallengeId": "", + "loadingMMSubmissionsForChallengeId": "", "loadingResultsForChallengeId": "", + "mmSubmissions": Array [], "mySubmissions": Object {}, "mySubmissionsManagement": Object {}, "registering": false, @@ -726,7 +784,9 @@ Object { "fetchChallengeFailure": "Unknown error", "loadingCheckpoints": false, "loadingDetailsForChallengeId": "", + "loadingMMSubmissionsForChallengeId": "", "loadingResultsForChallengeId": "", + "mmSubmissions": Array [], "mySubmissions": Object {}, "mySubmissionsManagement": Object {}, "registering": false, @@ -744,7 +804,9 @@ Object { "fetchChallengeFailure": false, "loadingCheckpoints": false, "loadingDetailsForChallengeId": "12345", + "loadingMMSubmissionsForChallengeId": "", "loadingResultsForChallengeId": "", + "mmSubmissions": Array [], "mySubmissions": Object {}, "mySubmissionsManagement": Object {}, "registering": false, @@ -765,8 +827,10 @@ Object { "fetchChallengeFailure": "Unknown error", "loadingCheckpoints": false, "loadingDetailsForChallengeId": "", + "loadingMMSubmissionsForChallengeId": "", "loadingResultsForChallengeId": "", "loadingSubmissionsForChallengeId": "", + "mmSubmissions": Array [], "mySubmissions": Object { "challengeId": "12345", "v2": Array [], @@ -792,8 +856,10 @@ Object { "fetchChallengeFailure": "Unknown error", "loadingCheckpoints": false, "loadingDetailsForChallengeId": "", + "loadingMMSubmissionsForChallengeId": "", "loadingResultsForChallengeId": "", "loadingSubmissionsForChallengeId": "", + "mmSubmissions": Array [], "mySubmissions": Object { "challengeId": "12345", "v2": Array [ @@ -821,8 +887,10 @@ Object { "fetchChallengeFailure": "Unknown error", "loadingCheckpoints": false, "loadingDetailsForChallengeId": "", + "loadingMMSubmissionsForChallengeId": "", "loadingResultsForChallengeId": "", "loadingSubmissionsForChallengeId": "", + "mmSubmissions": Array [], "mySubmissions": Object { "challengeId": "", "v2": null, @@ -848,8 +916,10 @@ Object { "fetchChallengeFailure": "Unknown error", "loadingCheckpoints": false, "loadingDetailsForChallengeId": "", + "loadingMMSubmissionsForChallengeId": "", "loadingResultsForChallengeId": "", "loadingSubmissionsForChallengeId": "12345", + "mmSubmissions": Array [], "mySubmissions": Object { "challengeId": "", "v2": null, @@ -874,8 +944,10 @@ Object { "fetchChallengeFailure": "Unknown error", "loadingCheckpoints": false, "loadingDetailsForChallengeId": "", + "loadingMMSubmissionsForChallengeId": "", "loadingResultsForChallengeId": "", "loadingSubmissionsForChallengeId": "", + "mmSubmissions": Array [], "mySubmissions": Object { "challengeId": "", "v2": null, diff --git a/config/default.json b/config/default.json new file mode 100644 index 00000000..23136c0f --- /dev/null +++ b/config/default.json @@ -0,0 +1,5 @@ +{ + "AV_SCAN_SCORER_REVIEW_TYPE_ID": "", + "PAGE_SIZE": 50, + "REVIEW_OPPORTUNITY_PAGE_SIZE": 1000 +} diff --git a/config/development.json b/config/development.json new file mode 100644 index 00000000..19bd4acd --- /dev/null +++ b/config/development.json @@ -0,0 +1,3 @@ +{ + "AV_SCAN_SCORER_REVIEW_TYPE_ID": "68c5a381-c8ab-48af-92a7-7a869a4ee6c3" +} diff --git a/config/jest/default.js b/config/jest/default.js index 9479649f..aa792822 100644 --- a/config/jest/default.js +++ b/config/jest/default.js @@ -1,3 +1,9 @@ const config = require('topcoder-react-utils/config/jest/default'); +const nodeConfig = require('config'); -module.exports = config; +module.exports = { + ...config, + globals: { + CONFIG: nodeConfig, + }, +}; diff --git a/config/production.json b/config/production.json new file mode 100644 index 00000000..43e880e5 --- /dev/null +++ b/config/production.json @@ -0,0 +1,3 @@ +{ + "AV_SCAN_SCORER_REVIEW_TYPE_ID": "55bbb17d-aac2-45a6-89c3-a8d102863d05" +} diff --git a/config/webpack/default.js b/config/webpack/default.js index 932840d6..a1a3c63b 100644 --- a/config/webpack/default.js +++ b/config/webpack/default.js @@ -1,7 +1,15 @@ +// eslint-disable-next-line import/no-extraneous-dependencies +const webpack = require('webpack'); + module.exports = { + plugins: [ + // eslint-disable-next-line global-require + new webpack.DefinePlugin({ CONFIG: JSON.stringify(require('config')) }), + ], // Don't include the dependencies to keep built bundle small, // they will be provided by the app using this lib externals: [ + 'config', 'qs', 'lodash', 'le_node', @@ -17,4 +25,7 @@ module.exports = { 'to-capital-case', 'topcoder-react-utils', ], + node: { + fs: 'empty', + }, }; diff --git a/dist/dev/index.js b/dist/dev/index.js index 350b11d1..47b7facd 100644 --- a/dist/dev/index.js +++ b/dist/dev/index.js @@ -436,7 +436,11 @@ eval("/* WEBPACK VAR INJECTION */(function(module) {\n\nObject.defineProperty(ex /***/ (function(module, exports, __webpack_require__) { "use strict"; +<<<<<<< HEAD +eval("/* WEBPACK VAR INJECTION */(function(module) {\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _slicedToArray2 = __webpack_require__(/*! babel-runtime/helpers/slicedToArray */ \"babel-runtime/helpers/slicedToArray\");\n\nvar _slicedToArray3 = _interopRequireDefault(_slicedToArray2);\n\nvar _promise = __webpack_require__(/*! babel-runtime/core-js/promise */ \"babel-runtime/core-js/promise\");\n\nvar _promise2 = _interopRequireDefault(_promise);\n\nvar _lodash = __webpack_require__(/*! lodash */ \"lodash\");\n\nvar _lodash2 = _interopRequireDefault(_lodash);\n\nvar _topcoderReactUtils = __webpack_require__(/*! topcoder-react-utils */ \"topcoder-react-utils\");\n\nvar _reduxActions = __webpack_require__(/*! redux-actions */ \"redux-actions\");\n\nvar _challenges = __webpack_require__(/*! ../services/challenges */ \"./src/services/challenges.js\");\n\nvar _submissions = __webpack_require__(/*! ../services/submissions */ \"./src/services/submissions.js\");\n\nvar _members = __webpack_require__(/*! ../services/members */ \"./src/services/members.js\");\n\nvar _api = __webpack_require__(/*! ../services/api */ \"./src/services/api.js\");\n\nvar _submission = __webpack_require__(/*! ../utils/submission */ \"./src/utils/submission.js\");\n\nvar submissionUtil = _interopRequireWildcard(_submission);\n\nfunction _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; } }\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n(function () {\n var enterModule = __webpack_require__(/*! react-hot-loader */ \"react-hot-loader\").enterModule;\n\n enterModule && enterModule(module);\n})(); /**\n * @module \"actions.challenge\"\n * @desc Actions related to Topcoder challenges APIs.\n */\n\n/* global CONFIG */\n\n\nvar _CONFIG = {\"AV_SCAN_SCORER_REVIEW_TYPE_ID\":\"68c5a381-c8ab-48af-92a7-7a869a4ee6c3\",\"PAGE_SIZE\":50,\"REVIEW_OPPORTUNITY_PAGE_SIZE\":1000},\n PAGE_SIZE = _CONFIG.PAGE_SIZE;\n\n/**\n * Private. Loads from the backend all data matching some conditions.\n * @param {Function} getter Given params object of shape { limit, offset }\n * loads from the backend at most \"limit\" data, skipping the first\n * \"offset\" ones. Returns loaded data as an array.\n * @param {Number} page Optional. Next page of data to load.\n * @param {Array} prev Optional. data loaded so far.\n */\n\nfunction getAll(getter) {\n var page = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;\n var prev = arguments[2];\n\n /* Amount of submissions to fetch in one API call. 50 is the current maximum\n * amount of submissions the backend returns, event when the larger limit is\n * explicitely required. */\n return getter({\n page: page,\n perPage: PAGE_SIZE\n }).then(function (res) {\n if (res.length === 0) {\n return prev || res;\n }\n // parse submissions\n var current = [];\n if (prev) {\n current = prev.concat(res);\n } else {\n current = res;\n }\n return getAll(getter, 1 + page, current);\n });\n}\n\n/**\n * @static\n * @desc Creates an action that drops from Redux store all checkpoints loaded\n * before.\n * @return {Action}\n */\nfunction dropCheckpoints() {}\n\n/**\n * @static\n * @desc Creates an action that drops from Redux store all challenge results\n * loaded before.\n * @return {Action}\n */\nfunction dropResults() {}\n\n/**\n * @static\n * @desc Creates an action that signals beginning of challenge details loading.\n * @param {Number|String} challengeId Challenge ID\n * @return {Action}\n */\nfunction getDetailsInit(challengeId) {\n return _lodash2.default.toString(challengeId);\n}\n\n/**\n * @static\n * @desc Creates an action that loads challenge details.\n * @param {Number|String} challengeId Challenge ID.\n * @param {String} tokenV3 Topcoder v3 auth token.\n * @param {String} tokenV2 Topcoder v2 auth token.\n * @return {Action}\n */\nfunction getDetailsDone(challengeId, tokenV3, tokenV2) {\n var service = (0, _challenges.getService)(tokenV3, tokenV2);\n var v3Promise = service.getChallengeDetails(challengeId);\n return v3Promise;\n}\n\n/**\n * @static\n * @desc Creates an action that signals beginning of user submissions loading.\n * @param {String} challengeId Challenge ID.\n * @return {Action}\n */\nfunction getSubmissionsInit(challengeId) {\n /* As a safeguard, we enforce challengeId to be string (in case somebody\n * passes in a number, by mistake). */\n return _lodash2.default.toString(challengeId);\n}\n\n/**\n * @static\n * @desc Creates an action that loads user's submissions to the specified\n * challenge.\n * @param {String} challengeId Challenge ID.\n * @param {String} tokenV2 Topcoder auth token v2.\n * @return {Action}\n */\nfunction getSubmissionsDone(challengeId, tokenV2) {\n return (0, _api.getApi)('V2', tokenV2).fetch('/challenges/submissions/' + challengeId + '/mySubmissions').then(function (response) {\n return response.json();\n }).then(function (response) {\n return {\n challengeId: _lodash2.default.toString(challengeId),\n submissions: response.submissions\n };\n }).catch(function (error) {\n var err = { challengeId: _lodash2.default.toString(challengeId), error: error };\n throw err;\n });\n}\n\n/**\n * @static\n * @desc Creates an action that signals beginning of Marathon Match submissions loading.\n * @param {String} challengeId Challenge ID.\n * @return {Action}\n */\nfunction getMMSubmissionsInit(challengeId) {\n /* As a safeguard, we enforce challengeId to be string (in case somebody\n * passes in a number, by mistake). */\n return _lodash2.default.toString(challengeId);\n}\n\n/**\n * @static\n * @desc Creates an action that loads Marathon Match submissions to the specified\n * challenge.\n * @param {String} challengeId Challenge ID.\n * @param {Array} submitterIds The array of submitter ids.\n * @param {Array} registrants The array of register.\n * @param {String} tokenV3 Topcoder auth token v3.\n * @return {Action}\n */\nfunction getMMSubmissionsDone(challengeId, submitterIds, registrants, tokenV3) {\n var filter = { challengeId: challengeId };\n var memberService = (0, _members.getService)(tokenV3);\n var submissionsService = (0, _submissions.getService)(tokenV3);\n var calls = [memberService.getMembersInformation(submitterIds), getAll(function (params) {\n return submissionsService.getSubmissions(filter, params);\n })];\n return _promise2.default.all(calls).then(function (_ref) {\n var _ref2 = (0, _slicedToArray3.default)(_ref, 2),\n resources = _ref2[0],\n submissions = _ref2[1];\n\n var finalSubmissions = submissionUtil.processMMSubmissions(submissions, resources, registrants);\n return {\n challengeId: challengeId,\n submissions: finalSubmissions,\n tokenV3: tokenV3\n };\n });\n}\n\n/**\n * @static\n * @desc Creates an action that signals beginning of registration for a\n * challenge.\n * @return {Action}\n */\nfunction registerInit() {}\n\n/**\n * @static\n * @desc Creates an action that registers user for a challenge.\n * @param {Object} auth An object that holds auth tokens. You can directly pass\n * here the `auth` segment of Redux store.\n * @param [auth.tokenV2]{String} Topcoder auth token v2.\n * @param [auth.tokenV3]{String} Topcoder auth token v3.\n * @param {String} challengeId Challenge ID.\n * @return {Action}\n */\nfunction registerDone(auth, challengeId) {\n return (0, _challenges.getService)(auth.tokenV3).register(challengeId)\n /* As a part of registration flow we silently update challenge details,\n * reusing for this purpose the corresponding action handler. */\n // Uses a delay to allow API time to update\n .then(function () {\n return new _promise2.default(function (resolve) {\n return setTimeout(function () {\n return resolve(getDetailsDone(challengeId, auth.tokenV3, auth.tokenV2));\n }, _topcoderReactUtils.config.CHALLENGE_DETAILS_REFRESH_DELAY);\n });\n });\n}\n\n/**\n * @static\n * @desc Creates an action that signals beginning of user unregistration from a\n * challenge.\n * @return {Action}\n */\nfunction unregisterInit() {}\n\n/**\n * @static\n * @desc Creates an action that unregisters user from a challenge.\n * @param {Object} auth Object that holds Topcoder auth tokens.\n * @param {String} [auth.tokenV2] v2 token.\n * @param {String} [auth.tokenV3] v3 token.\n * @param {String} challengeId Challenge ID.\n * @return {Action}\n */\nfunction unregisterDone(auth, challengeId) {\n return (0, _challenges.getService)(auth.tokenV3).unregister(challengeId)\n /* As a part of unregistration flow we silently update challenge details,\n * reusing for this purpose the corresponding action handler. */\n // Uses a delay to allow API time to update\n .then(function () {\n return new _promise2.default(function (resolve) {\n return setTimeout(function () {\n return resolve(getDetailsDone(challengeId, auth.tokenV3, auth.tokenV2));\n }, _topcoderReactUtils.config.CHALLENGE_DETAILS_REFRESH_DELAY);\n });\n });\n}\n\n/**\n * @static\n * @desc Creates an action that signals beginning of challenge results loading.\n * @param {Number|String} challengeId Challenge ID\n * @return {Action}\n */\nfunction loadResultsInit(challengeId) {\n return _lodash2.default.toString(challengeId);\n}\n\n/**\n * @static\n * @desc Creates an action that loads challenge results.\n * @param {Object} auth Object that holds Topcoder auth tokens.\n * @param {String} [auth.tokenV2] v2 token.\n * @param {String} [auth.tokenV3] v3 token.\n * @param {Number|String} challengeId Challenge ID. Should match the one passed\n * in the previous {@link module:actions.challenge.loadResultsInit} call.\n * @param {String} type Challenge type.\n * @return {Action}\n */\nfunction loadResultsDone(auth, challengeId, type) {\n return (0, _api.getApi)('V2', auth.tokenV2).fetch('/' + type + '/challenges/result/' + challengeId).then(function (response) {\n return response.json();\n }).then(function (response) {\n return {\n challengeId: _lodash2.default.toString(challengeId),\n results: response.results\n };\n });\n}\n\n/**\n * @static\n * @desc Creates an action that signals beginning of challenge checkpoints data\n * loading.\n * @return {Action}\n */\nfunction fetchCheckpointsInit() {}\n\n/**\n * @static\n * @desc Creates an action that loads challenge checkpoints data.\n * @param {String} tokenV2 Topcoder v2 auth token.\n * @param {String} challengeId Challenge ID.\n */\nfunction fetchCheckpointsDone(tokenV2, challengeId) {\n var endpoint = '/design/challenges/checkpoint/' + challengeId;\n return (0, _api.getApi)('V2', tokenV2).fetch(endpoint).then(function (response) {\n if (response.status !== 200) {\n throw response.status;\n } else {\n return response.json();\n }\n }).then(function (response) {\n // Expanded key is used for UI expand/collapse.\n response.checkpointResults.forEach(function (checkpoint, index) {\n response.checkpointResults[index].expanded = false;\n });\n return {\n challengeId: Number(challengeId),\n checkpoints: response\n };\n }).catch(function (error) {\n return {\n error: error,\n challengeId: Number(challengeId)\n };\n });\n}\n\n/**\n * @static\n * @desc Creates an action that Toggles checkpoint details panel in the Topcoder\n * Submission Management Page.\n * @todo This is UI action relevant to a specific page in specific app. Must be\n * moved back to Community App.\n * @param {Number} id Checkpoint ID.\n * @param {Boolean} open Target state: `true` to expand, `false` to collapse the\n * details.\n * @return {Action}\n */\nfunction toggleCheckpointFeedback(id, open) {\n return { id: id, open: open };\n}\n\n/**\n * @static\n * @desc Creates an action that signals beginning of challenge details update.\n * @todo No idea, why we have this action. This functionality should be covered\n * by {@link module:actions.challenge.getDetailsInit} and\n * {@link module:actions.challenge.getDetailsDone}. We need to refactor this.\n * @param {String} uuid UUID of the operation (the same should be passed into\n * the corresponding {@link module:actions.challenge.updateChallengeDone}).\n * @return {Action}\n */\nfunction updateChallengeInit(uuid) {\n return uuid;\n}\n\n/**\n * @static\n * @desc Creates an action that updates challenge details.\n * @todo No idea, why we have this action. This functionality should be covered\n * by {@link module:actions.challenge.getDetailsInit} and\n * {@link module:actions.challenge.getDetailsDone}. We need to refactor this.\n * @param {String} uuid Operation UUID. Should match the one passed into the\n * previous {@link module:actions.challenge.updateChallengeInit} call.\n * @param {Object} challenge Challenge data.\n * @param {String} tokenV3 Topcoder v3 auth token.\n * @return {Action}\n */\nfunction updateChallengeDone(uuid, challenge, tokenV3) {\n return (0, _challenges.getService)(tokenV3).updateChallenge(challenge).then(function (res) {\n return { uuid: uuid, res: res };\n });\n}\n\n/**\n * @static\n * @desc Creates an action that signals beginning of getting count of user's active challenges.\n * @return {Action}\n */\nfunction getActiveChallengesCountInit() {}\n\n/**\n * @static\n * @desc Creates an action that gets count of user's active challenges from the backend.\n * @param {String} handle Topcoder user handle.\n * @param {String} tokenV3 Optional. Topcoder auth token v3. Without token only\n * public challenges will be counted. With the token provided, the action will\n * also count private challenges related to this user.\n * @return {Action}\n */\nfunction getActiveChallengesCountDone(handle, tokenV3) {\n return (0, _challenges.getService)(tokenV3).getActiveChallengesCount(handle);\n}\n\nvar _default = (0, _reduxActions.createActions)({\n CHALLENGE: {\n DROP_CHECKPOINTS: dropCheckpoints,\n DROP_RESULTS: dropResults,\n FETCH_CHECKPOINTS_INIT: fetchCheckpointsInit,\n FETCH_CHECKPOINTS_DONE: fetchCheckpointsDone,\n GET_DETAILS_INIT: getDetailsInit,\n GET_DETAILS_DONE: getDetailsDone,\n GET_SUBMISSIONS_INIT: getSubmissionsInit,\n GET_SUBMISSIONS_DONE: getSubmissionsDone,\n LOAD_RESULTS_INIT: loadResultsInit,\n LOAD_RESULTS_DONE: loadResultsDone,\n REGISTER_INIT: registerInit,\n REGISTER_DONE: registerDone,\n TOGGLE_CHECKPOINT_FEEDBACK: toggleCheckpointFeedback,\n UNREGISTER_INIT: unregisterInit,\n UNREGISTER_DONE: unregisterDone,\n UPDATE_CHALLENGE_INIT: updateChallengeInit,\n UPDATE_CHALLENGE_DONE: updateChallengeDone,\n GET_ACTIVE_CHALLENGES_COUNT_INIT: getActiveChallengesCountInit,\n GET_ACTIVE_CHALLENGES_COUNT_DONE: getActiveChallengesCountDone,\n GET_MM_SUBMISSIONS_INIT: getMMSubmissionsInit,\n GET_MM_SUBMISSIONS_DONE: getMMSubmissionsDone\n }\n});\n\nexports.default = _default;\n;\n\n(function () {\n var reactHotLoader = __webpack_require__(/*! react-hot-loader */ \"react-hot-loader\").default;\n\n var leaveModule = __webpack_require__(/*! react-hot-loader */ \"react-hot-loader\").leaveModule;\n\n if (!reactHotLoader) {\n return;\n }\n\n reactHotLoader.register(PAGE_SIZE, 'PAGE_SIZE', '/Users/thomaskranitsas/Desktop/topcoder-react-lib/src/actions/challenge.js');\n reactHotLoader.register(getAll, 'getAll', '/Users/thomaskranitsas/Desktop/topcoder-react-lib/src/actions/challenge.js');\n reactHotLoader.register(dropCheckpoints, 'dropCheckpoints', '/Users/thomaskranitsas/Desktop/topcoder-react-lib/src/actions/challenge.js');\n reactHotLoader.register(dropResults, 'dropResults', '/Users/thomaskranitsas/Desktop/topcoder-react-lib/src/actions/challenge.js');\n reactHotLoader.register(getDetailsInit, 'getDetailsInit', '/Users/thomaskranitsas/Desktop/topcoder-react-lib/src/actions/challenge.js');\n reactHotLoader.register(getDetailsDone, 'getDetailsDone', '/Users/thomaskranitsas/Desktop/topcoder-react-lib/src/actions/challenge.js');\n reactHotLoader.register(getSubmissionsInit, 'getSubmissionsInit', '/Users/thomaskranitsas/Desktop/topcoder-react-lib/src/actions/challenge.js');\n reactHotLoader.register(getSubmissionsDone, 'getSubmissionsDone', '/Users/thomaskranitsas/Desktop/topcoder-react-lib/src/actions/challenge.js');\n reactHotLoader.register(getMMSubmissionsInit, 'getMMSubmissionsInit', '/Users/thomaskranitsas/Desktop/topcoder-react-lib/src/actions/challenge.js');\n reactHotLoader.register(getMMSubmissionsDone, 'getMMSubmissionsDone', '/Users/thomaskranitsas/Desktop/topcoder-react-lib/src/actions/challenge.js');\n reactHotLoader.register(registerInit, 'registerInit', '/Users/thomaskranitsas/Desktop/topcoder-react-lib/src/actions/challenge.js');\n reactHotLoader.register(registerDone, 'registerDone', '/Users/thomaskranitsas/Desktop/topcoder-react-lib/src/actions/challenge.js');\n reactHotLoader.register(unregisterInit, 'unregisterInit', '/Users/thomaskranitsas/Desktop/topcoder-react-lib/src/actions/challenge.js');\n reactHotLoader.register(unregisterDone, 'unregisterDone', '/Users/thomaskranitsas/Desktop/topcoder-react-lib/src/actions/challenge.js');\n reactHotLoader.register(loadResultsInit, 'loadResultsInit', '/Users/thomaskranitsas/Desktop/topcoder-react-lib/src/actions/challenge.js');\n reactHotLoader.register(loadResultsDone, 'loadResultsDone', '/Users/thomaskranitsas/Desktop/topcoder-react-lib/src/actions/challenge.js');\n reactHotLoader.register(fetchCheckpointsInit, 'fetchCheckpointsInit', '/Users/thomaskranitsas/Desktop/topcoder-react-lib/src/actions/challenge.js');\n reactHotLoader.register(fetchCheckpointsDone, 'fetchCheckpointsDone', '/Users/thomaskranitsas/Desktop/topcoder-react-lib/src/actions/challenge.js');\n reactHotLoader.register(toggleCheckpointFeedback, 'toggleCheckpointFeedback', '/Users/thomaskranitsas/Desktop/topcoder-react-lib/src/actions/challenge.js');\n reactHotLoader.register(updateChallengeInit, 'updateChallengeInit', '/Users/thomaskranitsas/Desktop/topcoder-react-lib/src/actions/challenge.js');\n reactHotLoader.register(updateChallengeDone, 'updateChallengeDone', '/Users/thomaskranitsas/Desktop/topcoder-react-lib/src/actions/challenge.js');\n reactHotLoader.register(getActiveChallengesCountInit, 'getActiveChallengesCountInit', '/Users/thomaskranitsas/Desktop/topcoder-react-lib/src/actions/challenge.js');\n reactHotLoader.register(getActiveChallengesCountDone, 'getActiveChallengesCountDone', '/Users/thomaskranitsas/Desktop/topcoder-react-lib/src/actions/challenge.js');\n reactHotLoader.register(_default, 'default', '/Users/thomaskranitsas/Desktop/topcoder-react-lib/src/actions/challenge.js');\n leaveModule(module);\n})();\n\n;\n/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../node_modules/webpack/buildin/module.js */ \"./node_modules/webpack/buildin/module.js\")(module)))\n\n//# sourceURL=webpack://topcoder-react-lib/./src/actions/challenge.js?"); +======= eval("/* WEBPACK VAR INJECTION */(function(module) {\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _promise = __webpack_require__(/*! babel-runtime/core-js/promise */ \"babel-runtime/core-js/promise\");\n\nvar _promise2 = _interopRequireDefault(_promise);\n\nvar _lodash = __webpack_require__(/*! lodash */ \"lodash\");\n\nvar _lodash2 = _interopRequireDefault(_lodash);\n\nvar _topcoderReactUtils = __webpack_require__(/*! topcoder-react-utils */ \"topcoder-react-utils\");\n\nvar _reduxActions = __webpack_require__(/*! redux-actions */ \"redux-actions\");\n\nvar _challenges = __webpack_require__(/*! ../services/challenges */ \"./src/services/challenges.js\");\n\nvar _api = __webpack_require__(/*! ../services/api */ \"./src/services/api.js\");\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n(function () {\n var enterModule = __webpack_require__(/*! react-hot-loader */ \"react-hot-loader\").enterModule;\n\n enterModule && enterModule(module);\n})(); /**\n * @module \"actions.challenge\"\n * @desc Actions related to Topcoder challenges APIs.\n */\n\n/**\n * @static\n * @desc Creates an action that drops from Redux store all checkpoints loaded\n * before.\n * @return {Action}\n */\nfunction dropCheckpoints() {}\n\n/**\n * @static\n * @desc Creates an action that drops from Redux store all challenge results\n * loaded before.\n * @return {Action}\n */\nfunction dropResults() {}\n\n/**\n * @static\n * @desc Creates an action that signals beginning of challenge details loading.\n * @param {Number|String} challengeId Challenge ID\n * @return {Action}\n */\nfunction getDetailsInit(challengeId) {\n return _lodash2.default.toString(challengeId);\n}\n\n/**\n * @static\n * @desc Creates an action that loads challenge details.\n * @param {Number|String} challengeId Challenge ID.\n * @param {String} tokenV3 Topcoder v3 auth token.\n * @param {String} tokenV2 Topcoder v2 auth token.\n * @return {Action}\n */\nfunction getDetailsDone(challengeId, tokenV3, tokenV2) {\n var service = (0, _challenges.getService)(tokenV3, tokenV2);\n var v3Promise = service.getChallengeDetails(challengeId);\n return v3Promise;\n}\n\n/**\n * @static\n * @desc Creates an action that signals beginning of user submissions loading.\n * @param {String} challengeId Challenge ID.\n * @return {Action}\n */\nfunction getSubmissionsInit(challengeId) {\n /* As a safeguard, we enforce challengeId to be string (in case somebody\n * passes in a number, by mistake). */\n return _lodash2.default.toString(challengeId);\n}\n\n/**\n * @static\n * @desc Creates an action that loads user's submissions to the specified\n * challenge.\n * @param {String} challengeId Challenge ID.\n * @param {String} tokenV2 Topcoder auth token v2.\n * @return {Action}\n */\nfunction getSubmissionsDone(challengeId, tokenV2) {\n return (0, _api.getApi)('V2', tokenV2).fetch('/challenges/submissions/' + challengeId + '/mySubmissions').then(function (response) {\n return response.json();\n }).then(function (response) {\n return {\n challengeId: _lodash2.default.toString(challengeId),\n submissions: response.submissions\n };\n }).catch(function (error) {\n var err = { challengeId: _lodash2.default.toString(challengeId), error: error };\n throw err;\n });\n}\n\n/**\n * @static\n * @desc Creates an action that signals beginning of registration for a\n * challenge.\n * @return {Action}\n */\nfunction registerInit() {}\n\n/**\n * @static\n * @desc Creates an action that registers user for a challenge.\n * @param {Object} auth An object that holds auth tokens. You can directly pass\n * here the `auth` segment of Redux store.\n * @param [auth.tokenV2]{String} Topcoder auth token v2.\n * @param [auth.tokenV3]{String} Topcoder auth token v3.\n * @param {String} challengeId Challenge ID.\n * @return {Action}\n */\nfunction registerDone(auth, challengeId) {\n return (0, _challenges.getService)(auth.tokenV3).register(challengeId)\n /* As a part of registration flow we silently update challenge details,\n * reusing for this purpose the corresponding action handler. */\n // Uses a delay to allow API time to update\n .then(function () {\n return new _promise2.default(function (resolve) {\n return setTimeout(function () {\n return resolve(getDetailsDone(challengeId, auth.tokenV3, auth.tokenV2));\n }, _topcoderReactUtils.config.CHALLENGE_DETAILS_REFRESH_DELAY);\n });\n });\n}\n\n/**\n * @static\n * @desc Creates an action that signals beginning of user unregistration from a\n * challenge.\n * @return {Action}\n */\nfunction unregisterInit() {}\n\n/**\n * @static\n * @desc Creates an action that unregisters user from a challenge.\n * @param {Object} auth Object that holds Topcoder auth tokens.\n * @param {String} [auth.tokenV2] v2 token.\n * @param {String} [auth.tokenV3] v3 token.\n * @param {String} challengeId Challenge ID.\n * @return {Action}\n */\nfunction unregisterDone(auth, challengeId) {\n return (0, _challenges.getService)(auth.tokenV3).unregister(challengeId)\n /* As a part of unregistration flow we silently update challenge details,\n * reusing for this purpose the corresponding action handler. */\n // Uses a delay to allow API time to update\n .then(function () {\n return new _promise2.default(function (resolve) {\n return setTimeout(function () {\n return resolve(getDetailsDone(challengeId, auth.tokenV3, auth.tokenV2));\n }, _topcoderReactUtils.config.CHALLENGE_DETAILS_REFRESH_DELAY);\n });\n });\n}\n\n/**\n * @static\n * @desc Creates an action that signals beginning of challenge results loading.\n * @param {Number|String} challengeId Challenge ID\n * @return {Action}\n */\nfunction loadResultsInit(challengeId) {\n return _lodash2.default.toString(challengeId);\n}\n\n/**\n * @static\n * @desc Creates an action that loads challenge results.\n * @param {Object} auth Object that holds Topcoder auth tokens.\n * @param {String} [auth.tokenV2] v2 token.\n * @param {String} [auth.tokenV3] v3 token.\n * @param {Number|String} challengeId Challenge ID. Should match the one passed\n * in the previous {@link module:actions.challenge.loadResultsInit} call.\n * @param {String} type Challenge type.\n * @return {Action}\n */\nfunction loadResultsDone(auth, challengeId, type) {\n return (0, _api.getApi)('V2', auth.tokenV2).fetch('/' + type + '/challenges/result/' + challengeId).then(function (response) {\n return response.json();\n }).then(function (response) {\n return {\n challengeId: _lodash2.default.toString(challengeId),\n results: response.results\n };\n });\n}\n\n/**\n * @static\n * @desc Creates an action that signals beginning of challenge checkpoints data\n * loading.\n * @return {Action}\n */\nfunction fetchCheckpointsInit() {}\n\n/**\n * @static\n * @desc Creates an action that loads challenge checkpoints data.\n * @param {String} tokenV2 Topcoder v2 auth token.\n * @param {String} challengeId Challenge ID.\n */\nfunction fetchCheckpointsDone(tokenV2, challengeId) {\n var endpoint = '/design/challenges/checkpoint/' + challengeId;\n return (0, _api.getApi)('V2', tokenV2).fetch(endpoint).then(function (response) {\n if (response.status !== 200) {\n throw response.status;\n } else {\n return response.json();\n }\n }).then(function (response) {\n // Expanded key is used for UI expand/collapse.\n response.checkpointResults.forEach(function (checkpoint, index) {\n response.checkpointResults[index].expanded = false;\n });\n return {\n challengeId: Number(challengeId),\n checkpoints: response\n };\n }).catch(function (error) {\n return {\n error: error,\n challengeId: Number(challengeId)\n };\n });\n}\n\n/**\n * @static\n * @desc Creates an action that Toggles checkpoint details panel in the Topcoder\n * Submission Management Page.\n * @todo This is UI action relevant to a specific page in specific app. Must be\n * moved back to Community App.\n * @param {Number} id Checkpoint ID.\n * @param {Boolean} open Target state: `true` to expand, `false` to collapse the\n * details.\n * @return {Action}\n */\nfunction toggleCheckpointFeedback(id, open) {\n return { id: id, open: open };\n}\n\n/**\n * @static\n * @desc Creates an action that signals beginning of challenge details update.\n * @todo No idea, why we have this action. This functionality should be covered\n * by {@link module:actions.challenge.getDetailsInit} and\n * {@link module:actions.challenge.getDetailsDone}. We need to refactor this.\n * @param {String} uuid UUID of the operation (the same should be passed into\n * the corresponding {@link module:actions.challenge.updateChallengeDone}).\n * @return {Action}\n */\nfunction updateChallengeInit(uuid) {\n return uuid;\n}\n\n/**\n * @static\n * @desc Creates an action that updates challenge details.\n * @todo No idea, why we have this action. This functionality should be covered\n * by {@link module:actions.challenge.getDetailsInit} and\n * {@link module:actions.challenge.getDetailsDone}. We need to refactor this.\n * @param {String} uuid Operation UUID. Should match the one passed into the\n * previous {@link module:actions.challenge.updateChallengeInit} call.\n * @param {Object} challenge Challenge data.\n * @param {String} tokenV3 Topcoder v3 auth token.\n * @return {Action}\n */\nfunction updateChallengeDone(uuid, challenge, tokenV3) {\n return (0, _challenges.getService)(tokenV3).updateChallenge(challenge).then(function (res) {\n return { uuid: uuid, res: res };\n });\n}\n\n/**\n * @static\n * @desc Creates an action that signals beginning of getting count of user's active challenges.\n * @return {Action}\n */\nfunction getActiveChallengesCountInit() {}\n\n/**\n * @static\n * @desc Creates an action that gets count of user's active challenges from the backend.\n * @param {String} userId Topcoder user ID.\n * @param {String} handle Topcoder user handle.\n * @param {String} tokenV3 Optional. Topcoder auth token v3. Without token only\n * public challenges will be counted. With the token provided, the action will\n * also count private challenges related to this user.\n * @return {Action}\n */\nfunction getActiveChallengesCountDone(userId, handle, tokenV3) {\n return (0, _challenges.getService)(tokenV3).getActiveChallengesCount(userId, handle);\n}\n\nvar _default = (0, _reduxActions.createActions)({\n CHALLENGE: {\n DROP_CHECKPOINTS: dropCheckpoints,\n DROP_RESULTS: dropResults,\n FETCH_CHECKPOINTS_INIT: fetchCheckpointsInit,\n FETCH_CHECKPOINTS_DONE: fetchCheckpointsDone,\n GET_DETAILS_INIT: getDetailsInit,\n GET_DETAILS_DONE: getDetailsDone,\n GET_SUBMISSIONS_INIT: getSubmissionsInit,\n GET_SUBMISSIONS_DONE: getSubmissionsDone,\n LOAD_RESULTS_INIT: loadResultsInit,\n LOAD_RESULTS_DONE: loadResultsDone,\n REGISTER_INIT: registerInit,\n REGISTER_DONE: registerDone,\n TOGGLE_CHECKPOINT_FEEDBACK: toggleCheckpointFeedback,\n UNREGISTER_INIT: unregisterInit,\n UNREGISTER_DONE: unregisterDone,\n UPDATE_CHALLENGE_INIT: updateChallengeInit,\n UPDATE_CHALLENGE_DONE: updateChallengeDone,\n GET_ACTIVE_CHALLENGES_COUNT_INIT: getActiveChallengesCountInit,\n GET_ACTIVE_CHALLENGES_COUNT_DONE: getActiveChallengesCountDone\n }\n});\n\nexports.default = _default;\n;\n\n(function () {\n var reactHotLoader = __webpack_require__(/*! react-hot-loader */ \"react-hot-loader\").default;\n\n var leaveModule = __webpack_require__(/*! react-hot-loader */ \"react-hot-loader\").leaveModule;\n\n if (!reactHotLoader) {\n return;\n }\n\n reactHotLoader.register(dropCheckpoints, 'dropCheckpoints', '/Users/thomaskranitsas/Desktop/topcoder-react-lib/src/actions/challenge.js');\n reactHotLoader.register(dropResults, 'dropResults', '/Users/thomaskranitsas/Desktop/topcoder-react-lib/src/actions/challenge.js');\n reactHotLoader.register(getDetailsInit, 'getDetailsInit', '/Users/thomaskranitsas/Desktop/topcoder-react-lib/src/actions/challenge.js');\n reactHotLoader.register(getDetailsDone, 'getDetailsDone', '/Users/thomaskranitsas/Desktop/topcoder-react-lib/src/actions/challenge.js');\n reactHotLoader.register(getSubmissionsInit, 'getSubmissionsInit', '/Users/thomaskranitsas/Desktop/topcoder-react-lib/src/actions/challenge.js');\n reactHotLoader.register(getSubmissionsDone, 'getSubmissionsDone', '/Users/thomaskranitsas/Desktop/topcoder-react-lib/src/actions/challenge.js');\n reactHotLoader.register(registerInit, 'registerInit', '/Users/thomaskranitsas/Desktop/topcoder-react-lib/src/actions/challenge.js');\n reactHotLoader.register(registerDone, 'registerDone', '/Users/thomaskranitsas/Desktop/topcoder-react-lib/src/actions/challenge.js');\n reactHotLoader.register(unregisterInit, 'unregisterInit', '/Users/thomaskranitsas/Desktop/topcoder-react-lib/src/actions/challenge.js');\n reactHotLoader.register(unregisterDone, 'unregisterDone', '/Users/thomaskranitsas/Desktop/topcoder-react-lib/src/actions/challenge.js');\n reactHotLoader.register(loadResultsInit, 'loadResultsInit', '/Users/thomaskranitsas/Desktop/topcoder-react-lib/src/actions/challenge.js');\n reactHotLoader.register(loadResultsDone, 'loadResultsDone', '/Users/thomaskranitsas/Desktop/topcoder-react-lib/src/actions/challenge.js');\n reactHotLoader.register(fetchCheckpointsInit, 'fetchCheckpointsInit', '/Users/thomaskranitsas/Desktop/topcoder-react-lib/src/actions/challenge.js');\n reactHotLoader.register(fetchCheckpointsDone, 'fetchCheckpointsDone', '/Users/thomaskranitsas/Desktop/topcoder-react-lib/src/actions/challenge.js');\n reactHotLoader.register(toggleCheckpointFeedback, 'toggleCheckpointFeedback', '/Users/thomaskranitsas/Desktop/topcoder-react-lib/src/actions/challenge.js');\n reactHotLoader.register(updateChallengeInit, 'updateChallengeInit', '/Users/thomaskranitsas/Desktop/topcoder-react-lib/src/actions/challenge.js');\n reactHotLoader.register(updateChallengeDone, 'updateChallengeDone', '/Users/thomaskranitsas/Desktop/topcoder-react-lib/src/actions/challenge.js');\n reactHotLoader.register(getActiveChallengesCountInit, 'getActiveChallengesCountInit', '/Users/thomaskranitsas/Desktop/topcoder-react-lib/src/actions/challenge.js');\n reactHotLoader.register(getActiveChallengesCountDone, 'getActiveChallengesCountDone', '/Users/thomaskranitsas/Desktop/topcoder-react-lib/src/actions/challenge.js');\n reactHotLoader.register(_default, 'default', '/Users/thomaskranitsas/Desktop/topcoder-react-lib/src/actions/challenge.js');\n leaveModule(module);\n})();\n\n;\n/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../node_modules/webpack/buildin/module.js */ \"./node_modules/webpack/buildin/module.js\")(module)))\n\n//# sourceURL=webpack://topcoder-react-lib/./src/actions/challenge.js?"); +>>>>>>> origin/ssf /***/ }), @@ -628,7 +632,11 @@ eval("\n\nmodule.exports = {\n PAGE_SIZE: 50,\n REVIEW_OPPORTUNITY_PAGE_SIZE: /***/ (function(module, exports, __webpack_require__) { "use strict"; +<<<<<<< HEAD +eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.submission = exports.mock = exports.time = exports.tc = exports.errors = exports.logger = exports.challenge = exports.services = exports.actions = exports.reducers = exports.reducerFactory = undefined;\n\nvar _actions = __webpack_require__(/*! ./actions */ \"./src/actions/index.js\");\n\nObject.defineProperty(exports, 'actions', {\n enumerable: true,\n get: function get() {\n return _actions.actions;\n }\n});\n\nvar _services = __webpack_require__(/*! ./services */ \"./src/services/index.js\");\n\nObject.defineProperty(exports, 'services', {\n enumerable: true,\n get: function get() {\n return _services.services;\n }\n});\n\nvar _utils = __webpack_require__(/*! ./utils */ \"./src/utils/index.js\");\n\nObject.defineProperty(exports, 'challenge', {\n enumerable: true,\n get: function get() {\n return _utils.challenge;\n }\n});\nObject.defineProperty(exports, 'logger', {\n enumerable: true,\n get: function get() {\n return _utils.logger;\n }\n});\nObject.defineProperty(exports, 'errors', {\n enumerable: true,\n get: function get() {\n return _utils.errors;\n }\n});\nObject.defineProperty(exports, 'tc', {\n enumerable: true,\n get: function get() {\n return _utils.tc;\n }\n});\nObject.defineProperty(exports, 'time', {\n enumerable: true,\n get: function get() {\n return _utils.time;\n }\n});\nObject.defineProperty(exports, 'mock', {\n enumerable: true,\n get: function get() {\n return _utils.mock;\n }\n});\nObject.defineProperty(exports, 'submission', {\n enumerable: true,\n get: function get() {\n return _utils.submission;\n }\n});\n\nvar _reducers = __webpack_require__(/*! ./reducers */ \"./src/reducers/index.js\");\n\nvar _reducers2 = _interopRequireDefault(_reducers);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nexports.reducerFactory = _reducers.factory; /**\n * Export the lib.\n */\n\nexports.reducers = _reducers2.default;\n\n//# sourceURL=webpack://topcoder-react-lib/./src/index.js?"); +======= eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.url = exports.mock = exports.time = exports.tc = exports.errors = exports.logger = exports.challenge = exports.services = exports.actions = exports.reducers = exports.reducerFactory = undefined;\n\nvar _actions = __webpack_require__(/*! ./actions */ \"./src/actions/index.js\");\n\nObject.defineProperty(exports, 'actions', {\n enumerable: true,\n get: function get() {\n return _actions.actions;\n }\n});\n\nvar _services = __webpack_require__(/*! ./services */ \"./src/services/index.js\");\n\nObject.defineProperty(exports, 'services', {\n enumerable: true,\n get: function get() {\n return _services.services;\n }\n});\n\nvar _utils = __webpack_require__(/*! ./utils */ \"./src/utils/index.js\");\n\nObject.defineProperty(exports, 'challenge', {\n enumerable: true,\n get: function get() {\n return _utils.challenge;\n }\n});\nObject.defineProperty(exports, 'logger', {\n enumerable: true,\n get: function get() {\n return _utils.logger;\n }\n});\nObject.defineProperty(exports, 'errors', {\n enumerable: true,\n get: function get() {\n return _utils.errors;\n }\n});\nObject.defineProperty(exports, 'tc', {\n enumerable: true,\n get: function get() {\n return _utils.tc;\n }\n});\nObject.defineProperty(exports, 'time', {\n enumerable: true,\n get: function get() {\n return _utils.time;\n }\n});\nObject.defineProperty(exports, 'mock', {\n enumerable: true,\n get: function get() {\n return _utils.mock;\n }\n});\nObject.defineProperty(exports, 'url', {\n enumerable: true,\n get: function get() {\n return _utils.url;\n }\n});\n\nvar _reducers = __webpack_require__(/*! ./reducers */ \"./src/reducers/index.js\");\n\nvar _reducers2 = _interopRequireDefault(_reducers);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nexports.reducerFactory = _reducers.factory; /**\n * Export the lib.\n */\n\nexports.reducers = _reducers2.default;\n\n//# sourceURL=webpack://topcoder-react-lib/./src/index.js?"); +>>>>>>> origin/ssf /***/ }), @@ -664,7 +672,7 @@ eval("/* WEBPACK VAR INJECTION */(function(module) {\n\nObject.defineProperty(ex /***/ (function(module, exports, __webpack_require__) { "use strict"; -eval("/* WEBPACK VAR INJECTION */(function(module) {\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _slicedToArray2 = __webpack_require__(/*! babel-runtime/helpers/slicedToArray */ \"babel-runtime/helpers/slicedToArray\");\n\nvar _slicedToArray3 = _interopRequireDefault(_slicedToArray2);\n\nvar _promise = __webpack_require__(/*! babel-runtime/core-js/promise */ \"babel-runtime/core-js/promise\");\n\nvar _promise2 = _interopRequireDefault(_promise);\n\nvar _defineProperty2 = __webpack_require__(/*! babel-runtime/helpers/defineProperty */ \"babel-runtime/helpers/defineProperty\");\n\nvar _defineProperty3 = _interopRequireDefault(_defineProperty2);\n\nvar _extends2 = __webpack_require__(/*! babel-runtime/helpers/extends */ \"babel-runtime/helpers/extends\");\n\nvar _extends3 = _interopRequireDefault(_extends2);\n\nexports.factory = factory;\n\nvar _lodash = __webpack_require__(/*! lodash */ \"lodash\");\n\nvar _lodash2 = _interopRequireDefault(_lodash);\n\nvar _reduxActions = __webpack_require__(/*! redux-actions */ \"redux-actions\");\n\nvar _topcoderReactUtils = __webpack_require__(/*! topcoder-react-utils */ \"topcoder-react-utils\");\n\nvar _challenge = __webpack_require__(/*! ../actions/challenge */ \"./src/actions/challenge.js\");\n\nvar _challenge2 = _interopRequireDefault(_challenge);\n\nvar _smp = __webpack_require__(/*! ../actions/smp */ \"./src/actions/smp.js\");\n\nvar _smp2 = _interopRequireDefault(_smp);\n\nvar _logger = __webpack_require__(/*! ../utils/logger */ \"./src/utils/logger.js\");\n\nvar _logger2 = _interopRequireDefault(_logger);\n\nvar _errors = __webpack_require__(/*! ../utils/errors */ \"./src/utils/errors.js\");\n\nvar _mySubmissionsManagement = __webpack_require__(/*! ./my-submissions-management */ \"./src/reducers/my-submissions-management.js\");\n\nvar _mySubmissionsManagement2 = _interopRequireDefault(_mySubmissionsManagement);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n(function () {\n var enterModule = __webpack_require__(/*! react-hot-loader */ \"react-hot-loader\").enterModule;\n\n enterModule && enterModule(module);\n})(); /**\n * @module \"reducers.challenge\"\n * @desc Reducer for {@link module:actions.challenge} actions.\n *\n * State segment managed by this reducer has the following strcuture:\n * @todo Document the structure.\n */\n\n/**\n * Handles CHALLENGE/GET_DETAILS_INIT action.\n * @param {Object} state\n * @param {Object} action\n * @return {Object} New state\n */\nfunction onGetDetailsInit(state, action) {\n var challengeId = action.payload;\n return state.details && _lodash2.default.toString(state.details.id) !== challengeId ? (0, _extends3.default)({}, state, {\n fetchChallengeFailure: false,\n loadingDetailsForChallengeId: challengeId,\n details: null\n }) : (0, _extends3.default)({}, state, {\n fetchChallengeFailure: false,\n loadingDetailsForChallengeId: challengeId\n });\n}\n\n/**\n * Handles CHALLENGE/GET_DETAILS_DONE action.\n * Note, that it silently discards received details if the ID of received\n * challenge mismatches the one stored in loadingDetailsForChallengeId field\n * of the state.\n * @param {Object} state\n * @param {Object} action\n * @return {Object} New state.\n */\nfunction onGetDetailsDone(state, action) {\n if (action.error) {\n _logger2.default.error('Failed to get challenge details!', action.payload);\n (0, _errors.fireErrorMessage)('ERROR: Failed to load the challenge', 'Please, try again a bit later');\n return (0, _extends3.default)({}, state, {\n fetchChallengeFailure: action.error,\n loadingDetailsForChallengeId: ''\n });\n }\n\n var details = action.payload;\n if (_lodash2.default.toString(details.id) !== state.loadingDetailsForChallengeId) {\n return state;\n }\n\n return (0, _extends3.default)({}, state, {\n details: details,\n fetchChallengeFailure: false,\n loadingDetailsForChallengeId: ''\n });\n}\n\n/**\n * Handles CHALLENGE/GET_SUBMISSION_INIT action.\n * @param {Object} state\n * @param {Object} action\n * @return {Object} New state.\n */\nfunction onGetSubmissionsInit(state, action) {\n return (0, _extends3.default)({}, state, {\n loadingSubmissionsForChallengeId: action.payload,\n mySubmissions: { challengeId: '', v2: null }\n });\n}\n\n/**\n * Handles challengeActions.fetchSubmissionsDone action.\n * @param {Object} state Previous state.\n * @param {Object} action Action.\n */\nfunction onGetSubmissionsDone(state, action) {\n if (action.error) {\n _logger2.default.error('Failed to get user\\'s submissions for the challenge', action.payload);\n return (0, _extends3.default)({}, state, {\n loadingSubmissionsForChallengeId: '',\n mySubmissions: { challengeId: '', v2: null }\n });\n }\n\n var _action$payload = action.payload,\n challengeId = _action$payload.challengeId,\n submissions = _action$payload.submissions;\n\n if (challengeId !== state.loadingSubmissionsForChallengeId) return state;\n\n return (0, _extends3.default)({}, state, {\n loadingSubmissionsForChallengeId: '',\n mySubmissions: { challengeId: challengeId, v2: submissions }\n });\n}\n\n/**\n * Handles challengeActions.fetchCheckpointsDone action.\n * @param {Object} state Previous state.\n * @param {Object} action Action.\n */\nfunction onFetchCheckpointsDone(state, action) {\n if (action.error) {\n return (0, _extends3.default)({}, state, {\n loadingCheckpoints: false\n });\n }\n if (state.details && state.details.id === action.payload.challengeId) {\n return (0, _extends3.default)({}, state, {\n checkpoints: action.payload.checkpoints,\n loadingCheckpoints: false\n });\n }\n return state;\n}\n\n/**\n * Handles CHALLENGE/LOAD_RESULTS_INIT action.\n * @param {Object} state\n * @param {Object} action\n * @return {Object}\n */\nfunction onLoadResultsInit(state, _ref) {\n var payload = _ref.payload;\n\n return (0, _extends3.default)({}, state, { loadingResultsForChallengeId: payload });\n}\n\n/**\n * Handles CHALLENGE/LOAD_RESULTS_DONE action.\n * @param {Object} state\n * @param {Object} action\n * @return {Object}\n */\nfunction onLoadResultsDone(state, action) {\n if (action.payload.challengeId !== state.loadingResultsForChallengeId) {\n return state;\n }\n if (action.error) {\n _logger2.default.error(action.payload);\n return (0, _extends3.default)({}, state, {\n loadingResultsForChallengeId: '',\n results: null,\n resultsLoadedForChallengeId: ''\n });\n }\n return (0, _extends3.default)({}, state, {\n loadingResultsForChallengeId: '',\n results: action.payload.results,\n resultsLoadedForChallengeId: action.payload.challengeId\n });\n}\n\n/**\n * Handles CHALLENGE/REGISTER_DONE action.\n * @param {Object} state\n * @param {Object} action\n * @return {Object}\n */\nfunction onRegisterDone(state, action) {\n if (action.error) {\n _logger2.default.error('Failed to register for the challenge!', action.payload);\n (0, _errors.fireErrorMessage)('ERROR: Failed to register for the challenge!');\n return (0, _extends3.default)({}, state, { registering: false });\n }\n /* As a part of registration flow we silently update challenge details,\n * reusing for this purpose the corresponding action handler. Thus, we\n * should also reuse corresponding reducer to generate proper state. */\n return onGetDetailsDone((0, _extends3.default)({}, state, {\n registering: false,\n loadingDetailsForChallengeId: _lodash2.default.toString(state.details.id)\n }), action);\n}\n\n/**\n * Handles CHALLENGE/UNREGISTER_DONE action.\n * @param {Object} state\n * @param {Object} action\n * @return {Object}\n */\nfunction onUnregisterDone(state, action) {\n if (action.error) {\n _logger2.default.error('Failed to register for the challenge!', action.payload);\n (0, _errors.fireErrorMessage)('ERROR: Failed to unregister for the challenge!');\n return (0, _extends3.default)({}, state, { unregistering: false });\n }\n /* As a part of unregistration flow we silently update challenge details,\n * reusing for this purpose the corresponding action handler. Thus, we\n * should also reuse corresponding reducer to generate proper state. */\n return onGetDetailsDone((0, _extends3.default)({}, state, {\n unregistering: false,\n loadingDetailsForChallengeId: _lodash2.default.toString(state.details.id)\n }), action);\n}\n\n/**\n * Handles CHALLENGE/UPDATE_CHALLENGE_INIT.\n * @param {Object} state Old state.\n * @param {Object} actions Action.\n * @return {Object} New state.\n */\nfunction onUpdateChallengeInit(state, _ref2) {\n var payload = _ref2.payload;\n\n return (0, _extends3.default)({}, state, { updatingChallengeUuid: payload });\n}\n\n/**\n * Handles CHALLENGE/UPDATE_CHALLENGE_DONE.\n * @param {Object} state Old state.\n * @param {Object} actions Action.\n * @return {Object} New state.\n */\nfunction onUpdateChallengeDone(state, _ref3) {\n var error = _ref3.error,\n payload = _ref3.payload;\n\n if (error) {\n (0, _errors.fireErrorMessage)('Failed to save the challenge!', '');\n _logger2.default.error('Failed to save the challenge', payload);\n return state;\n }\n if (payload.uuid !== state.updatingChallengeUuid) return state;\n\n /* Due to the normalization of challenge APIs responses done when a challenge\n * is loaded, many pieces of our code expect different information in a format\n * different from API v3 response, thus if we just save entire payload.res\n * into the Redux state segment, it will break our app. As a rapid fix, let's\n * just save only the data which are really supposed to be updated in the\n * current use case (editing of challenge specs). */\n var res = _lodash2.default.pick(payload.res, ['detailedRequirements', 'introduction', 'round1Introduction', 'round2Introduction', 'submissionGuidelines']);\n\n return (0, _extends3.default)({}, state, {\n details: (0, _extends3.default)({}, state.details, res),\n updatingChallengeUuid: ''\n });\n}\n\n/**\n * Handles CHALLENGE/GET_ACTIVE_CHALLENGES_COUNT_DONE action.\n * @param {Object} state Old state.\n * @param {Object} action Action payload/error\n * @return {Object} New state\n */\nfunction onGetActiveChallengesCountDone(state, _ref4) {\n var payload = _ref4.payload,\n error = _ref4.error;\n\n if (error) {\n (0, _errors.fireErrorMessage)('Failed to get active challenges count!', '');\n _logger2.default.error('Failed to get active challenges count', payload);\n return state;\n }\n\n return (0, _extends3.default)({}, state, { activeChallengesCount: payload });\n}\n\n/**\n * Creates a new Challenge reducer with the specified initial state.\n * @param {Object} initialState Optional. Initial state.\n * @return {Function} Challenge reducer.\n */\nfunction create(initialState) {\n var _handleActions;\n\n var a = _challenge2.default.challenge;\n return (0, _reduxActions.handleActions)((_handleActions = {}, (0, _defineProperty3.default)(_handleActions, a.dropCheckpoints, function (state) {\n return (0, _extends3.default)({}, state, { checkpoints: null });\n }), (0, _defineProperty3.default)(_handleActions, a.dropResults, function (state) {\n return (0, _extends3.default)({}, state, { results: null });\n }), (0, _defineProperty3.default)(_handleActions, a.getDetailsInit, onGetDetailsInit), (0, _defineProperty3.default)(_handleActions, a.getDetailsDone, onGetDetailsDone), (0, _defineProperty3.default)(_handleActions, a.getSubmissionsInit, onGetSubmissionsInit), (0, _defineProperty3.default)(_handleActions, a.getSubmissionsDone, onGetSubmissionsDone), (0, _defineProperty3.default)(_handleActions, _smp2.default.smp.deleteSubmissionDone, function (state, _ref5) {\n var payload = _ref5.payload;\n return (0, _extends3.default)({}, state, {\n mySubmissions: (0, _extends3.default)({}, state.mySubmissions, {\n v2: state.mySubmissions.v2.filter(function (subm) {\n return subm.submissionId !== payload;\n })\n })\n });\n }), (0, _defineProperty3.default)(_handleActions, a.registerInit, function (state) {\n return (0, _extends3.default)({}, state, { registering: true });\n }), (0, _defineProperty3.default)(_handleActions, a.registerDone, onRegisterDone), (0, _defineProperty3.default)(_handleActions, a.unregisterInit, function (state) {\n return (0, _extends3.default)({}, state, { unregistering: true });\n }), (0, _defineProperty3.default)(_handleActions, a.unregisterDone, onUnregisterDone), (0, _defineProperty3.default)(_handleActions, a.loadResultsInit, onLoadResultsInit), (0, _defineProperty3.default)(_handleActions, a.loadResultsDone, onLoadResultsDone), (0, _defineProperty3.default)(_handleActions, a.fetchCheckpointsInit, function (state) {\n return (0, _extends3.default)({}, state, {\n checkpoints: null,\n loadingCheckpoints: true\n });\n }), (0, _defineProperty3.default)(_handleActions, a.fetchCheckpointsDone, onFetchCheckpointsDone), (0, _defineProperty3.default)(_handleActions, a.updateChallengeInit, onUpdateChallengeInit), (0, _defineProperty3.default)(_handleActions, a.updateChallengeDone, onUpdateChallengeDone), (0, _defineProperty3.default)(_handleActions, a.getActiveChallengesCountInit, function (state) {\n return state;\n }), (0, _defineProperty3.default)(_handleActions, a.getActiveChallengesCountDone, onGetActiveChallengesCountDone), _handleActions), _lodash2.default.defaults(initialState, {\n details: null,\n loadingCheckpoints: false,\n loadingDetailsForChallengeId: '',\n loadingResultsForChallengeId: '',\n mySubmissions: {},\n checkpoints: null,\n registering: false,\n results: null,\n resultsLoadedForChallengeId: '',\n unregistering: false,\n updatingChallengeUuid: ''\n }));\n}\n\n/**\n * Factory which creates a new reducer with its initial state tailored to the\n * given options object, if specified (for server-side rendering). If options\n * object is not specified, it creates just the default reducer. Accepted options are:\n *\n * @param {Object} options={} Optional. Factory options.\n * @param {String} [options.auth.tokenV2=''] Optional. Topcoder v2 auth token.\n * @param {String} [options.auth.tokenV3=''] Optional. Topcoder v3 auth token.\n * @param {String} [options.challenge.challengeDetails.id=''] Optional. ID of\n * the challenge to load details for.\n * @param {Boolean} [options.challenge.challengeDetails.mySubmission=false]\n * Optional. The flag indicates whether load my submission.\n * @return {Promise}\n * @resolves {Function(state, action): state} New reducer.\n */\nfunction factory() {\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n /* Server-side rendering of Submission Management Page. */\n\n /* TODO: This shares some common logic with the next \"if\" block, which\n * should be re-used there. */\n /* TODO: For completely server-side rendering it is also necessary to load\n * terms, etc. */\n\n var tokens = {\n tokenV2: _lodash2.default.get(options.auth, 'tokenV2'),\n tokenV3: _lodash2.default.get(options.auth, 'tokenV3')\n };\n\n var state = {};\n var challengeId = _lodash2.default.get(options, 'challenge.challengeDetails.id');\n var mySubmission = _lodash2.default.get(options, 'challenge.challengeDetails.mySubmission');\n\n if (challengeId && !mySubmission) {\n return _topcoderReactUtils.redux.resolveAction(_challenge2.default.challenge.getDetailsDone(challengeId, tokens.tokenV3, tokens.tokenV2)).then(function (details) {\n var track = _lodash2.default.get(details, 'payload.track', '').toLowerCase();\n var checkpointsPromise = track === 'design' ? _topcoderReactUtils.redux.resolveAction(_challenge2.default.challenge.fetchCheckpointsDone(tokens.tokenV2, challengeId)) : null;\n var resultsPromise = _lodash2.default.get(details, 'payload.status', '') === 'COMPLETED' ? _topcoderReactUtils.redux.resolveAction(_challenge2.default.challenge.loadResultsDone(tokens, challengeId, track)) : null;\n return _promise2.default.all([details, checkpointsPromise, resultsPromise]);\n }).then(function (_ref6) {\n var _ref7 = (0, _slicedToArray3.default)(_ref6, 3),\n details = _ref7[0],\n checkpoints = _ref7[1],\n results = _ref7[2];\n\n state = (0, _extends3.default)({}, state, {\n loadingCheckpoints: true,\n loadingDetailsForChallengeId: challengeId,\n loadingResultsForChallengeId: challengeId\n });\n state = onGetDetailsDone(state, details);\n if (checkpoints) state = onFetchCheckpointsDone(state, checkpoints);\n if (results) state = onLoadResultsDone(state, results);\n return state;\n }).then(function (res) {\n return _topcoderReactUtils.redux.combineReducers(create(res), { mySubmissionsManagement: _mySubmissionsManagement2.default });\n });\n }\n\n if (challengeId && mySubmission) {\n return _promise2.default.all([_topcoderReactUtils.redux.resolveAction(_challenge2.default.challenge.getDetailsDone(challengeId, tokens.tokenV3, tokens.tokenV2)), _topcoderReactUtils.redux.resolveAction(_challenge2.default.challenge.getSubmissionsDone(challengeId, tokens.tokenV2))]).then(function (_ref8) {\n var _ref9 = (0, _slicedToArray3.default)(_ref8, 2),\n challenge = _ref9[0],\n submissions = _ref9[1];\n\n state = (0, _extends3.default)({}, state, {\n loadingSubmissionsForChallengeId: challengeId,\n loadingDetailsForChallengeId: challengeId\n });\n state = onGetDetailsDone(state, challenge);\n return onGetSubmissionsDone(state, submissions);\n }).then(function (res) {\n return _topcoderReactUtils.redux.combineReducers(create(res), { mySubmissionsManagement: _mySubmissionsManagement2.default });\n });\n }\n\n /* Otherwise this part of Redux state is initialized empty. */\n return _promise2.default.resolve(_topcoderReactUtils.redux.combineReducers(create(state), { mySubmissionsManagement: _mySubmissionsManagement2.default }));\n}\n\n/**\n * @static\n * @member default\n * @desc Reducer with default intial state.\n */\n\nvar _default = _topcoderReactUtils.redux.combineReducers(create(), { mySubmissionsManagement: _mySubmissionsManagement2.default });\n\nexports.default = _default;\n;\n\n(function () {\n var reactHotLoader = __webpack_require__(/*! react-hot-loader */ \"react-hot-loader\").default;\n\n var leaveModule = __webpack_require__(/*! react-hot-loader */ \"react-hot-loader\").leaveModule;\n\n if (!reactHotLoader) {\n return;\n }\n\n reactHotLoader.register(onGetDetailsInit, 'onGetDetailsInit', '/Users/thomaskranitsas/Desktop/topcoder-react-lib/src/reducers/challenge.js');\n reactHotLoader.register(onGetDetailsDone, 'onGetDetailsDone', '/Users/thomaskranitsas/Desktop/topcoder-react-lib/src/reducers/challenge.js');\n reactHotLoader.register(onGetSubmissionsInit, 'onGetSubmissionsInit', '/Users/thomaskranitsas/Desktop/topcoder-react-lib/src/reducers/challenge.js');\n reactHotLoader.register(onGetSubmissionsDone, 'onGetSubmissionsDone', '/Users/thomaskranitsas/Desktop/topcoder-react-lib/src/reducers/challenge.js');\n reactHotLoader.register(onFetchCheckpointsDone, 'onFetchCheckpointsDone', '/Users/thomaskranitsas/Desktop/topcoder-react-lib/src/reducers/challenge.js');\n reactHotLoader.register(onLoadResultsInit, 'onLoadResultsInit', '/Users/thomaskranitsas/Desktop/topcoder-react-lib/src/reducers/challenge.js');\n reactHotLoader.register(onLoadResultsDone, 'onLoadResultsDone', '/Users/thomaskranitsas/Desktop/topcoder-react-lib/src/reducers/challenge.js');\n reactHotLoader.register(onRegisterDone, 'onRegisterDone', '/Users/thomaskranitsas/Desktop/topcoder-react-lib/src/reducers/challenge.js');\n reactHotLoader.register(onUnregisterDone, 'onUnregisterDone', '/Users/thomaskranitsas/Desktop/topcoder-react-lib/src/reducers/challenge.js');\n reactHotLoader.register(onUpdateChallengeInit, 'onUpdateChallengeInit', '/Users/thomaskranitsas/Desktop/topcoder-react-lib/src/reducers/challenge.js');\n reactHotLoader.register(onUpdateChallengeDone, 'onUpdateChallengeDone', '/Users/thomaskranitsas/Desktop/topcoder-react-lib/src/reducers/challenge.js');\n reactHotLoader.register(onGetActiveChallengesCountDone, 'onGetActiveChallengesCountDone', '/Users/thomaskranitsas/Desktop/topcoder-react-lib/src/reducers/challenge.js');\n reactHotLoader.register(create, 'create', '/Users/thomaskranitsas/Desktop/topcoder-react-lib/src/reducers/challenge.js');\n reactHotLoader.register(factory, 'factory', '/Users/thomaskranitsas/Desktop/topcoder-react-lib/src/reducers/challenge.js');\n reactHotLoader.register(_default, 'default', '/Users/thomaskranitsas/Desktop/topcoder-react-lib/src/reducers/challenge.js');\n leaveModule(module);\n})();\n\n;\n/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../node_modules/webpack/buildin/module.js */ \"./node_modules/webpack/buildin/module.js\")(module)))\n\n//# sourceURL=webpack://topcoder-react-lib/./src/reducers/challenge.js?"); +eval("/* WEBPACK VAR INJECTION */(function(module) {\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _slicedToArray2 = __webpack_require__(/*! babel-runtime/helpers/slicedToArray */ \"babel-runtime/helpers/slicedToArray\");\n\nvar _slicedToArray3 = _interopRequireDefault(_slicedToArray2);\n\nvar _promise = __webpack_require__(/*! babel-runtime/core-js/promise */ \"babel-runtime/core-js/promise\");\n\nvar _promise2 = _interopRequireDefault(_promise);\n\nvar _defineProperty2 = __webpack_require__(/*! babel-runtime/helpers/defineProperty */ \"babel-runtime/helpers/defineProperty\");\n\nvar _defineProperty3 = _interopRequireDefault(_defineProperty2);\n\nvar _extends2 = __webpack_require__(/*! babel-runtime/helpers/extends */ \"babel-runtime/helpers/extends\");\n\nvar _extends3 = _interopRequireDefault(_extends2);\n\nexports.factory = factory;\n\nvar _lodash = __webpack_require__(/*! lodash */ \"lodash\");\n\nvar _lodash2 = _interopRequireDefault(_lodash);\n\nvar _reduxActions = __webpack_require__(/*! redux-actions */ \"redux-actions\");\n\nvar _topcoderReactUtils = __webpack_require__(/*! topcoder-react-utils */ \"topcoder-react-utils\");\n\nvar _challenge = __webpack_require__(/*! ../actions/challenge */ \"./src/actions/challenge.js\");\n\nvar _challenge2 = _interopRequireDefault(_challenge);\n\nvar _smp = __webpack_require__(/*! ../actions/smp */ \"./src/actions/smp.js\");\n\nvar _smp2 = _interopRequireDefault(_smp);\n\nvar _logger = __webpack_require__(/*! ../utils/logger */ \"./src/utils/logger.js\");\n\nvar _logger2 = _interopRequireDefault(_logger);\n\nvar _errors = __webpack_require__(/*! ../utils/errors */ \"./src/utils/errors.js\");\n\nvar _mySubmissionsManagement = __webpack_require__(/*! ./my-submissions-management */ \"./src/reducers/my-submissions-management.js\");\n\nvar _mySubmissionsManagement2 = _interopRequireDefault(_mySubmissionsManagement);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n(function () {\n var enterModule = __webpack_require__(/*! react-hot-loader */ \"react-hot-loader\").enterModule;\n\n enterModule && enterModule(module);\n})(); /**\n * @module \"reducers.challenge\"\n * @desc Reducer for {@link module:actions.challenge} actions.\n *\n * State segment managed by this reducer has the following strcuture:\n * @todo Document the structure.\n */\n\n/**\n * Handles CHALLENGE/GET_DETAILS_INIT action.\n * @param {Object} state\n * @param {Object} action\n * @return {Object} New state\n */\nfunction onGetDetailsInit(state, action) {\n var challengeId = action.payload;\n return state.details && _lodash2.default.toString(state.details.id) !== challengeId ? (0, _extends3.default)({}, state, {\n fetchChallengeFailure: false,\n loadingDetailsForChallengeId: challengeId,\n details: null\n }) : (0, _extends3.default)({}, state, {\n fetchChallengeFailure: false,\n loadingDetailsForChallengeId: challengeId\n });\n}\n\n/**\n * Handles CHALLENGE/GET_DETAILS_DONE action.\n * Note, that it silently discards received details if the ID of received\n * challenge mismatches the one stored in loadingDetailsForChallengeId field\n * of the state.\n * @param {Object} state\n * @param {Object} action\n * @return {Object} New state.\n */\nfunction onGetDetailsDone(state, action) {\n if (action.error) {\n _logger2.default.error('Failed to get challenge details!', action.payload);\n (0, _errors.fireErrorMessage)('ERROR: Failed to load the challenge', 'Please, try again a bit later');\n return (0, _extends3.default)({}, state, {\n fetchChallengeFailure: action.error,\n loadingDetailsForChallengeId: ''\n });\n }\n\n var details = action.payload;\n if (_lodash2.default.toString(details.id) !== state.loadingDetailsForChallengeId) {\n return state;\n }\n\n return (0, _extends3.default)({}, state, {\n details: details,\n fetchChallengeFailure: false,\n loadingDetailsForChallengeId: ''\n });\n}\n\n/**\n * Handles CHALLENGE/GET_SUBMISSION_INIT action.\n * @param {Object} state\n * @param {Object} action\n * @return {Object} New state.\n */\nfunction onGetSubmissionsInit(state, action) {\n return (0, _extends3.default)({}, state, {\n loadingSubmissionsForChallengeId: action.payload,\n mySubmissions: { challengeId: '', v2: null }\n });\n}\n\n/**\n * Handles challengeActions.fetchSubmissionsDone action.\n * @param {Object} state Previous state.\n * @param {Object} action Action.\n */\nfunction onGetSubmissionsDone(state, action) {\n if (action.error) {\n _logger2.default.error('Failed to get user\\'s submissions for the challenge', action.payload);\n return (0, _extends3.default)({}, state, {\n loadingSubmissionsForChallengeId: '',\n mySubmissions: { challengeId: '', v2: null }\n });\n }\n\n var _action$payload = action.payload,\n challengeId = _action$payload.challengeId,\n submissions = _action$payload.submissions;\n\n if (challengeId !== state.loadingSubmissionsForChallengeId) return state;\n\n return (0, _extends3.default)({}, state, {\n loadingSubmissionsForChallengeId: '',\n mySubmissions: { challengeId: challengeId, v2: submissions }\n });\n}\n\n/**\n * Handles CHALLENGE/GET_MM_SUBMISSION_INIT action.\n * @param {Object} state\n * @param {Object} action\n * @return {Object} New state.\n */\nfunction onGetMMSubmissionsInit(state, action) {\n return (0, _extends3.default)({}, state, {\n loadingMMSubmissionsForChallengeId: action.payload,\n mmSubmissions: []\n });\n}\n\n/**\n * Handles CHALLENGE/GET_MM_SUBMISSION_DONE action.\n * @param {Object} state Previous state.\n * @param {Object} action Action.\n */\nfunction onGetMMSubmissionsDone(state, action) {\n if (action.error) {\n _logger2.default.error('Failed to get Marathon Match submissions for the challenge', action.payload);\n return (0, _extends3.default)({}, state, {\n loadingMMSubmissionsForChallengeId: '',\n mmSubmissions: []\n });\n }\n\n var _action$payload2 = action.payload,\n challengeId = _action$payload2.challengeId,\n submissions = _action$payload2.submissions;\n\n if (challengeId.toString() !== state.loadingMMSubmissionsForChallengeId) return state;\n return (0, _extends3.default)({}, state, {\n loadingMMSubmissionsForChallengeId: '',\n mmSubmissions: submissions\n });\n}\n\n/**\n * Handles challengeActions.fetchCheckpointsDone action.\n * @param {Object} state Previous state.\n * @param {Object} action Action.\n */\nfunction onFetchCheckpointsDone(state, action) {\n if (action.error) {\n return (0, _extends3.default)({}, state, {\n loadingCheckpoints: false\n });\n }\n if (state.details && state.details.id === action.payload.challengeId) {\n return (0, _extends3.default)({}, state, {\n checkpoints: action.payload.checkpoints,\n loadingCheckpoints: false\n });\n }\n return state;\n}\n\n/**\n * Handles CHALLENGE/LOAD_RESULTS_INIT action.\n * @param {Object} state\n * @param {Object} action\n * @return {Object}\n */\nfunction onLoadResultsInit(state, _ref) {\n var payload = _ref.payload;\n\n return (0, _extends3.default)({}, state, { loadingResultsForChallengeId: payload });\n}\n\n/**\n * Handles CHALLENGE/LOAD_RESULTS_DONE action.\n * @param {Object} state\n * @param {Object} action\n * @return {Object}\n */\nfunction onLoadResultsDone(state, action) {\n if (action.payload.challengeId !== state.loadingResultsForChallengeId) {\n return state;\n }\n if (action.error) {\n _logger2.default.error(action.payload);\n return (0, _extends3.default)({}, state, {\n loadingResultsForChallengeId: '',\n results: null,\n resultsLoadedForChallengeId: ''\n });\n }\n return (0, _extends3.default)({}, state, {\n loadingResultsForChallengeId: '',\n results: action.payload.results,\n resultsLoadedForChallengeId: action.payload.challengeId\n });\n}\n\n/**\n * Handles CHALLENGE/REGISTER_DONE action.\n * @param {Object} state\n * @param {Object} action\n * @return {Object}\n */\nfunction onRegisterDone(state, action) {\n if (action.error) {\n _logger2.default.error('Failed to register for the challenge!', action.payload);\n (0, _errors.fireErrorMessage)('ERROR: Failed to register for the challenge!');\n return (0, _extends3.default)({}, state, { registering: false });\n }\n /* As a part of registration flow we silently update challenge details,\n * reusing for this purpose the corresponding action handler. Thus, we\n * should also reuse corresponding reducer to generate proper state. */\n return onGetDetailsDone((0, _extends3.default)({}, state, {\n registering: false,\n loadingDetailsForChallengeId: _lodash2.default.toString(state.details.id)\n }), action);\n}\n\n/**\n * Handles CHALLENGE/UNREGISTER_DONE action.\n * @param {Object} state\n * @param {Object} action\n * @return {Object}\n */\nfunction onUnregisterDone(state, action) {\n if (action.error) {\n _logger2.default.error('Failed to register for the challenge!', action.payload);\n (0, _errors.fireErrorMessage)('ERROR: Failed to unregister for the challenge!');\n return (0, _extends3.default)({}, state, { unregistering: false });\n }\n /* As a part of unregistration flow we silently update challenge details,\n * reusing for this purpose the corresponding action handler. Thus, we\n * should also reuse corresponding reducer to generate proper state. */\n return onGetDetailsDone((0, _extends3.default)({}, state, {\n unregistering: false,\n loadingDetailsForChallengeId: _lodash2.default.toString(state.details.id)\n }), action);\n}\n\n/**\n * Handles CHALLENGE/UPDATE_CHALLENGE_INIT.\n * @param {Object} state Old state.\n * @param {Object} actions Action.\n * @return {Object} New state.\n */\nfunction onUpdateChallengeInit(state, _ref2) {\n var payload = _ref2.payload;\n\n return (0, _extends3.default)({}, state, { updatingChallengeUuid: payload });\n}\n\n/**\n * Handles CHALLENGE/UPDATE_CHALLENGE_DONE.\n * @param {Object} state Old state.\n * @param {Object} actions Action.\n * @return {Object} New state.\n */\nfunction onUpdateChallengeDone(state, _ref3) {\n var error = _ref3.error,\n payload = _ref3.payload;\n\n if (error) {\n (0, _errors.fireErrorMessage)('Failed to save the challenge!', '');\n _logger2.default.error('Failed to save the challenge', payload);\n return state;\n }\n if (payload.uuid !== state.updatingChallengeUuid) return state;\n\n /* Due to the normalization of challenge APIs responses done when a challenge\n * is loaded, many pieces of our code expect different information in a format\n * different from API v3 response, thus if we just save entire payload.res\n * into the Redux state segment, it will break our app. As a rapid fix, let's\n * just save only the data which are really supposed to be updated in the\n * current use case (editing of challenge specs). */\n var res = _lodash2.default.pick(payload.res, ['detailedRequirements', 'introduction', 'round1Introduction', 'round2Introduction', 'submissionGuidelines']);\n\n return (0, _extends3.default)({}, state, {\n details: (0, _extends3.default)({}, state.details, res),\n updatingChallengeUuid: ''\n });\n}\n\n/**\n * Handles CHALLENGE/GET_ACTIVE_CHALLENGES_COUNT_DONE action.\n * @param {Object} state Old state.\n * @param {Object} action Action payload/error\n * @return {Object} New state\n */\nfunction onGetActiveChallengesCountDone(state, _ref4) {\n var payload = _ref4.payload,\n error = _ref4.error;\n\n if (error) {\n (0, _errors.fireErrorMessage)('Failed to get active challenges count!', '');\n _logger2.default.error('Failed to get active challenges count', payload);\n return state;\n }\n\n return (0, _extends3.default)({}, state, { activeChallengesCount: payload });\n}\n\n/**\n * Creates a new Challenge reducer with the specified initial state.\n * @param {Object} initialState Optional. Initial state.\n * @return {Function} Challenge reducer.\n */\nfunction create(initialState) {\n var _handleActions;\n\n var a = _challenge2.default.challenge;\n return (0, _reduxActions.handleActions)((_handleActions = {}, (0, _defineProperty3.default)(_handleActions, a.dropCheckpoints, function (state) {\n return (0, _extends3.default)({}, state, { checkpoints: null });\n }), (0, _defineProperty3.default)(_handleActions, a.dropResults, function (state) {\n return (0, _extends3.default)({}, state, { results: null });\n }), (0, _defineProperty3.default)(_handleActions, a.getDetailsInit, onGetDetailsInit), (0, _defineProperty3.default)(_handleActions, a.getDetailsDone, onGetDetailsDone), (0, _defineProperty3.default)(_handleActions, a.getSubmissionsInit, onGetSubmissionsInit), (0, _defineProperty3.default)(_handleActions, a.getSubmissionsDone, onGetSubmissionsDone), (0, _defineProperty3.default)(_handleActions, a.getMmSubmissionsInit, onGetMMSubmissionsInit), (0, _defineProperty3.default)(_handleActions, a.getMmSubmissionsDone, onGetMMSubmissionsDone), (0, _defineProperty3.default)(_handleActions, _smp2.default.smp.deleteSubmissionDone, function (state, _ref5) {\n var payload = _ref5.payload;\n return (0, _extends3.default)({}, state, {\n mySubmissions: (0, _extends3.default)({}, state.mySubmissions, {\n v2: state.mySubmissions.v2.filter(function (subm) {\n return subm.submissionId !== payload;\n })\n })\n });\n }), (0, _defineProperty3.default)(_handleActions, a.registerInit, function (state) {\n return (0, _extends3.default)({}, state, { registering: true });\n }), (0, _defineProperty3.default)(_handleActions, a.registerDone, onRegisterDone), (0, _defineProperty3.default)(_handleActions, a.unregisterInit, function (state) {\n return (0, _extends3.default)({}, state, { unregistering: true });\n }), (0, _defineProperty3.default)(_handleActions, a.unregisterDone, onUnregisterDone), (0, _defineProperty3.default)(_handleActions, a.loadResultsInit, onLoadResultsInit), (0, _defineProperty3.default)(_handleActions, a.loadResultsDone, onLoadResultsDone), (0, _defineProperty3.default)(_handleActions, a.fetchCheckpointsInit, function (state) {\n return (0, _extends3.default)({}, state, {\n checkpoints: null,\n loadingCheckpoints: true\n });\n }), (0, _defineProperty3.default)(_handleActions, a.fetchCheckpointsDone, onFetchCheckpointsDone), (0, _defineProperty3.default)(_handleActions, a.updateChallengeInit, onUpdateChallengeInit), (0, _defineProperty3.default)(_handleActions, a.updateChallengeDone, onUpdateChallengeDone), (0, _defineProperty3.default)(_handleActions, a.getActiveChallengesCountInit, function (state) {\n return state;\n }), (0, _defineProperty3.default)(_handleActions, a.getActiveChallengesCountDone, onGetActiveChallengesCountDone), _handleActions), _lodash2.default.defaults(initialState, {\n details: null,\n loadingCheckpoints: false,\n loadingDetailsForChallengeId: '',\n loadingResultsForChallengeId: '',\n loadingMMSubmissionsForChallengeId: '',\n mySubmissions: {},\n checkpoints: null,\n registering: false,\n results: null,\n resultsLoadedForChallengeId: '',\n unregistering: false,\n updatingChallengeUuid: '',\n mmSubmissions: []\n }));\n}\n\n/**\n * Factory which creates a new reducer with its initial state tailored to the\n * given options object, if specified (for server-side rendering). If options\n * object is not specified, it creates just the default reducer. Accepted options are:\n *\n * @param {Object} options={} Optional. Factory options.\n * @param {String} [options.auth.tokenV2=''] Optional. Topcoder v2 auth token.\n * @param {String} [options.auth.tokenV3=''] Optional. Topcoder v3 auth token.\n * @param {String} [options.challenge.challengeDetails.id=''] Optional. ID of\n * the challenge to load details for.\n * @param {Boolean} [options.challenge.challengeDetails.mySubmission=false]\n * Optional. The flag indicates whether load my submission.\n * @return {Promise}\n * @resolves {Function(state, action): state} New reducer.\n */\nfunction factory() {\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n /* Server-side rendering of Submission Management Page. */\n\n /* TODO: This shares some common logic with the next \"if\" block, which\n * should be re-used there. */\n /* TODO: For completely server-side rendering it is also necessary to load\n * terms, etc. */\n\n var tokens = {\n tokenV2: _lodash2.default.get(options.auth, 'tokenV2'),\n tokenV3: _lodash2.default.get(options.auth, 'tokenV3')\n };\n\n var state = {};\n var challengeId = _lodash2.default.get(options, 'challenge.challengeDetails.id');\n var mySubmission = _lodash2.default.get(options, 'challenge.challengeDetails.mySubmission');\n\n if (challengeId && !mySubmission) {\n return _topcoderReactUtils.redux.resolveAction(_challenge2.default.challenge.getDetailsDone(challengeId, tokens.tokenV3, tokens.tokenV2)).then(function (details) {\n var track = _lodash2.default.get(details, 'payload.track', '').toLowerCase();\n var checkpointsPromise = track === 'design' ? _topcoderReactUtils.redux.resolveAction(_challenge2.default.challenge.fetchCheckpointsDone(tokens.tokenV2, challengeId)) : null;\n var resultsPromise = _lodash2.default.get(details, 'payload.status', '') === 'COMPLETED' ? _topcoderReactUtils.redux.resolveAction(_challenge2.default.challenge.loadResultsDone(tokens, challengeId, track)) : null;\n return _promise2.default.all([details, checkpointsPromise, resultsPromise]);\n }).then(function (_ref6) {\n var _ref7 = (0, _slicedToArray3.default)(_ref6, 3),\n details = _ref7[0],\n checkpoints = _ref7[1],\n results = _ref7[2];\n\n state = (0, _extends3.default)({}, state, {\n loadingCheckpoints: true,\n loadingDetailsForChallengeId: challengeId,\n loadingResultsForChallengeId: challengeId\n });\n state = onGetDetailsDone(state, details);\n if (checkpoints) state = onFetchCheckpointsDone(state, checkpoints);\n if (results) state = onLoadResultsDone(state, results);\n return state;\n }).then(function (res) {\n return _topcoderReactUtils.redux.combineReducers(create(res), { mySubmissionsManagement: _mySubmissionsManagement2.default });\n });\n }\n\n if (challengeId && mySubmission) {\n return _promise2.default.all([_topcoderReactUtils.redux.resolveAction(_challenge2.default.challenge.getDetailsDone(challengeId, tokens.tokenV3, tokens.tokenV2)), _topcoderReactUtils.redux.resolveAction(_challenge2.default.challenge.getSubmissionsDone(challengeId, tokens.tokenV2))]).then(function (_ref8) {\n var _ref9 = (0, _slicedToArray3.default)(_ref8, 2),\n challenge = _ref9[0],\n submissions = _ref9[1];\n\n state = (0, _extends3.default)({}, state, {\n loadingSubmissionsForChallengeId: challengeId,\n loadingDetailsForChallengeId: challengeId\n });\n state = onGetDetailsDone(state, challenge);\n return onGetSubmissionsDone(state, submissions);\n }).then(function (res) {\n return _topcoderReactUtils.redux.combineReducers(create(res), { mySubmissionsManagement: _mySubmissionsManagement2.default });\n });\n }\n\n /* Otherwise this part of Redux state is initialized empty. */\n return _promise2.default.resolve(_topcoderReactUtils.redux.combineReducers(create(state), { mySubmissionsManagement: _mySubmissionsManagement2.default }));\n}\n\n/**\n * @static\n * @member default\n * @desc Reducer with default intial state.\n */\n\nvar _default = _topcoderReactUtils.redux.combineReducers(create(), { mySubmissionsManagement: _mySubmissionsManagement2.default });\n\nexports.default = _default;\n;\n\n(function () {\n var reactHotLoader = __webpack_require__(/*! react-hot-loader */ \"react-hot-loader\").default;\n\n var leaveModule = __webpack_require__(/*! react-hot-loader */ \"react-hot-loader\").leaveModule;\n\n if (!reactHotLoader) {\n return;\n }\n\n reactHotLoader.register(onGetDetailsInit, 'onGetDetailsInit', '/Users/thomaskranitsas/Desktop/topcoder-react-lib/src/reducers/challenge.js');\n reactHotLoader.register(onGetDetailsDone, 'onGetDetailsDone', '/Users/thomaskranitsas/Desktop/topcoder-react-lib/src/reducers/challenge.js');\n reactHotLoader.register(onGetSubmissionsInit, 'onGetSubmissionsInit', '/Users/thomaskranitsas/Desktop/topcoder-react-lib/src/reducers/challenge.js');\n reactHotLoader.register(onGetSubmissionsDone, 'onGetSubmissionsDone', '/Users/thomaskranitsas/Desktop/topcoder-react-lib/src/reducers/challenge.js');\n reactHotLoader.register(onGetMMSubmissionsInit, 'onGetMMSubmissionsInit', '/Users/thomaskranitsas/Desktop/topcoder-react-lib/src/reducers/challenge.js');\n reactHotLoader.register(onGetMMSubmissionsDone, 'onGetMMSubmissionsDone', '/Users/thomaskranitsas/Desktop/topcoder-react-lib/src/reducers/challenge.js');\n reactHotLoader.register(onFetchCheckpointsDone, 'onFetchCheckpointsDone', '/Users/thomaskranitsas/Desktop/topcoder-react-lib/src/reducers/challenge.js');\n reactHotLoader.register(onLoadResultsInit, 'onLoadResultsInit', '/Users/thomaskranitsas/Desktop/topcoder-react-lib/src/reducers/challenge.js');\n reactHotLoader.register(onLoadResultsDone, 'onLoadResultsDone', '/Users/thomaskranitsas/Desktop/topcoder-react-lib/src/reducers/challenge.js');\n reactHotLoader.register(onRegisterDone, 'onRegisterDone', '/Users/thomaskranitsas/Desktop/topcoder-react-lib/src/reducers/challenge.js');\n reactHotLoader.register(onUnregisterDone, 'onUnregisterDone', '/Users/thomaskranitsas/Desktop/topcoder-react-lib/src/reducers/challenge.js');\n reactHotLoader.register(onUpdateChallengeInit, 'onUpdateChallengeInit', '/Users/thomaskranitsas/Desktop/topcoder-react-lib/src/reducers/challenge.js');\n reactHotLoader.register(onUpdateChallengeDone, 'onUpdateChallengeDone', '/Users/thomaskranitsas/Desktop/topcoder-react-lib/src/reducers/challenge.js');\n reactHotLoader.register(onGetActiveChallengesCountDone, 'onGetActiveChallengesCountDone', '/Users/thomaskranitsas/Desktop/topcoder-react-lib/src/reducers/challenge.js');\n reactHotLoader.register(create, 'create', '/Users/thomaskranitsas/Desktop/topcoder-react-lib/src/reducers/challenge.js');\n reactHotLoader.register(factory, 'factory', '/Users/thomaskranitsas/Desktop/topcoder-react-lib/src/reducers/challenge.js');\n reactHotLoader.register(_default, 'default', '/Users/thomaskranitsas/Desktop/topcoder-react-lib/src/reducers/challenge.js');\n leaveModule(module);\n})();\n\n;\n/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../node_modules/webpack/buildin/module.js */ \"./node_modules/webpack/buildin/module.js\")(module)))\n\n//# sourceURL=webpack://topcoder-react-lib/./src/reducers/challenge.js?"); /***/ }), @@ -922,7 +930,7 @@ eval("/* WEBPACK VAR INJECTION */(function(module) {\n\nObject.defineProperty(ex /***/ (function(module, exports, __webpack_require__) { "use strict"; -eval("/* WEBPACK VAR INJECTION */(function(module) {\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.getTcM2mToken = exports.getApiV4 = exports.getApiV3 = exports.getApiV2 = undefined;\n\nvar _keys = __webpack_require__(/*! babel-runtime/core-js/object/keys */ \"babel-runtime/core-js/object/keys\");\n\nvar _keys2 = _interopRequireDefault(_keys);\n\nvar _promise = __webpack_require__(/*! babel-runtime/core-js/promise */ \"babel-runtime/core-js/promise\");\n\nvar _promise2 = _interopRequireDefault(_promise);\n\nvar _stringify = __webpack_require__(/*! babel-runtime/core-js/json/stringify */ \"babel-runtime/core-js/json/stringify\");\n\nvar _stringify2 = _interopRequireDefault(_stringify);\n\nvar _regenerator = __webpack_require__(/*! babel-runtime/regenerator */ \"babel-runtime/regenerator\");\n\nvar _regenerator2 = _interopRequireDefault(_regenerator);\n\nvar _extends2 = __webpack_require__(/*! babel-runtime/helpers/extends */ \"babel-runtime/helpers/extends\");\n\nvar _extends3 = _interopRequireDefault(_extends2);\n\nvar _asyncToGenerator2 = __webpack_require__(/*! babel-runtime/helpers/asyncToGenerator */ \"babel-runtime/helpers/asyncToGenerator\");\n\nvar _asyncToGenerator3 = _interopRequireDefault(_asyncToGenerator2);\n\nvar _classCallCheck2 = __webpack_require__(/*! babel-runtime/helpers/classCallCheck */ \"babel-runtime/helpers/classCallCheck\");\n\nvar _classCallCheck3 = _interopRequireDefault(_classCallCheck2);\n\nvar _createClass2 = __webpack_require__(/*! babel-runtime/helpers/createClass */ \"babel-runtime/helpers/createClass\");\n\nvar _createClass3 = _interopRequireDefault(_createClass2);\n\n/**\n * Gets a valid TC M2M token, either requesting one from TC Auth0 API, or\n * serving one from internal cache.\n *\n * @return {Promise} Resolves to a token, valid at least next\n * getTcM2mToken.MIN_LIFETIME milliseconds.\n *\n * @throw if called outside of the server.s\n */\nvar getTcM2mToken = exports.getTcM2mToken = function () {\n var _ref2 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee2() {\n var now, cached, TC_M2M, res;\n return _regenerator2.default.wrap(function _callee2$(_context2) {\n while (1) {\n switch (_context2.prev = _context2.next) {\n case 0:\n if (_topcoderReactUtils.isomorphy.isServerSide()) {\n _context2.next = 2;\n break;\n }\n\n throw new Error('getTcM2mToken() called outside the server');\n\n case 2:\n now = Date.now();\n cached = getTcM2mToken.cached;\n TC_M2M = _topcoderReactUtils.config.SECRET.TC_M2M;\n\n if (!(!cached || cached.expires < now + getTcM2mToken.MIN_LIFETIME)) {\n _context2.next = 13;\n break;\n }\n\n _context2.next = 8;\n return (0, _isomorphicFetch2.default)('https://' + _topcoderReactUtils.config.AUTH0.DOMAIN + '/oauth/token', {\n headers: { 'Content-Type': 'application/json' },\n body: (0, _stringify2.default)({\n client_id: TC_M2M.CLIENT_ID,\n client_secret: TC_M2M.CLIENT_SECRET,\n audience: TC_M2M.AUDIENCE,\n grant_type: TC_M2M.GRANT_TYPE\n }),\n method: 'POST'\n });\n\n case 8:\n res = _context2.sent;\n _context2.next = 11;\n return res.json();\n\n case 11:\n res = _context2.sent;\n\n getTcM2mToken.cached = {\n expires: now + 1000 * res.expires_in, // [ms]\n token: res.access_token\n };\n\n case 13:\n return _context2.abrupt('return', getTcM2mToken.cached.token);\n\n case 14:\n case 'end':\n return _context2.stop();\n }\n }\n }, _callee2, this);\n }));\n\n return function getTcM2mToken() {\n return _ref2.apply(this, arguments);\n };\n}();\n\nexports.getApi = getApi;\n\nvar _lodash = __webpack_require__(/*! lodash */ \"lodash\");\n\nvar _lodash2 = _interopRequireDefault(_lodash);\n\nvar _isomorphicFetch = __webpack_require__(/*! isomorphic-fetch */ \"isomorphic-fetch\");\n\nvar _isomorphicFetch2 = _interopRequireDefault(_isomorphicFetch);\n\nvar _topcoderReactUtils = __webpack_require__(/*! topcoder-react-utils */ \"topcoder-react-utils\");\n\nvar _time = __webpack_require__(/*! ../utils/time */ \"./src/utils/time.js\");\n\nvar _errors = __webpack_require__(/*! ../utils/errors */ \"./src/utils/errors.js\");\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n(function () {\n var enterModule = __webpack_require__(/*! react-hot-loader */ \"react-hot-loader\").enterModule;\n\n enterModule && enterModule(module);\n})(); /**\n * @module \"services.api\"\n * @desc This module provides a service for conventient access to Topcoder APIs.\n */\n\n/* The minimal delay [ms] between API calls. To avoid problems with the requests\n * rate limits configured in Topcoder APIs, we throttle requests rate at the\n * client side, and at server-side, in dev mode (which is meant to be used for\n * local development. */\nvar MIN_API_CALL_DELAY = _topcoderReactUtils.isomorphy.isDevBuild() ? 1000 : 200;\n\nvar API_THROTTLING = true;\n\nvar lastApiCallTimestamp = Date.now();\n\n/**\n * @static\n * @member default\n * @desc The default export from the module is\n * {@link module:services.api~Api} class.\n */\n\n/**\n * API service object. It is reused for both Topcoder API v2 and v3,\n * as in these cases we are fine with the same interface, and the only\n * thing we need to be different is the base URL and auth token to use.\n */\n\nvar Api = function () {\n /**\n * Creates a new Api object.\n * @param {String} base Base URL of the API.\n * @param {String} token Optional. Authorization token.\n */\n function Api(base, token) {\n (0, _classCallCheck3.default)(this, Api);\n\n this.private = {\n base: base,\n token: token\n };\n }\n\n /**\n * Sends HTTP request to the specified API endpoint. This method is just\n * a convenient wrapper around isomorphic fetch(..):\n *\n * - If API service has auth token, Authorization header is automatically\n * added to the request;\n *\n * - If no Content-Type header set in options, it is automatically set to\n * \"application/json\". In case you want to avoid it, pass null into\n * Content-Type header option.\n *\n * For additional details see https://github.github.io/fetch/\n * @param {String} enpoint Should start with slash, like /endpoint.\n * @param {Object} options Optional. Fetch options.\n * @return {Promise} It resolves to the HTTP response object. To get the\n * actual data you probably want to call .json() method of that object.\n * Mind that this promise rejects only on network errors. In case of\n * HTTP errors (404, etc.) the promise will be resolved successfully,\n * and you should check .status or .ok fields of the response object\n * to find out the response status.\n */\n\n\n (0, _createClass3.default)(Api, [{\n key: 'fetch',\n value: function () {\n var _ref = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee(endpoint) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n\n var _private, base, token, headers, now;\n\n return _regenerator2.default.wrap(function _callee$(_context) {\n while (1) {\n switch (_context.prev = _context.next) {\n case 0:\n _private = this.private, base = _private.base, token = _private.token;\n headers = options.headers ? _lodash2.default.clone(options.headers) : {};\n\n if (token) headers.Authorization = 'Bearer ' + token;\n\n _context.t0 = headers['Content-Type'];\n _context.next = _context.t0 === null ? 6 : _context.t0 === undefined ? 8 : 10;\n break;\n\n case 6:\n delete headers['Content-Type'];\n return _context.abrupt('break', 10);\n\n case 8:\n headers['Content-Type'] = 'application/json';\n return _context.abrupt('break', 10);\n\n case 10:\n if (!(API_THROTTLING && (_topcoderReactUtils.isomorphy.isClientSide() || _topcoderReactUtils.isomorphy.isDevBuild()))) {\n _context.next = 19;\n break;\n }\n\n now = Date.now();\n\n lastApiCallTimestamp += MIN_API_CALL_DELAY;\n\n if (!(lastApiCallTimestamp > now)) {\n _context.next = 18;\n break;\n }\n\n _context.next = 16;\n return (0, _time.delay)(lastApiCallTimestamp - now);\n\n case 16:\n _context.next = 19;\n break;\n\n case 18:\n lastApiCallTimestamp = now;\n\n case 19:\n return _context.abrupt('return', (0, _isomorphicFetch2.default)('' + base + endpoint, (0, _extends3.default)({}, options, {\n headers: headers\n })).catch(function (e) {\n (0, _errors.setErrorIcon)(_errors.ERROR_ICON_TYPES.NETWORK, '' + base + endpoint, e.message);\n throw e;\n }));\n\n case 20:\n case 'end':\n return _context.stop();\n }\n }\n }, _callee, this);\n }));\n\n function fetch(_x) {\n return _ref.apply(this, arguments);\n }\n\n return fetch;\n }()\n\n /**\n * Sends DELETE request to the specified endpoint.\n * @param {String} endpoint\n * @param {Blob|BufferSource|FormData|String} body\n * @return {Promise}\n */\n\n }, {\n key: 'delete',\n value: function _delete(endpoint, body) {\n return this.fetch(endpoint, {\n body: body,\n method: 'DELETE'\n });\n }\n\n /**\n * Sends GET request to the specified endpoint.\n * @param {String} endpoint\n * @return {Promise}\n */\n\n }, {\n key: 'get',\n value: function get(endpoint) {\n return this.fetch(endpoint);\n }\n\n /**\n * Sends POST request to the specified endpoint.\n * @param {String} endpoint\n * @param {Blob|BufferSource|FormData|String} body\n * @return {Promise}\n */\n\n }, {\n key: 'post',\n value: function post(endpoint, body) {\n return this.fetch(endpoint, {\n body: body,\n method: 'POST'\n });\n }\n\n /**\n * Sends POST request to the specified endpoint, with JSON payload.\n * @param {String} endpoint\n * @param {JSON} json\n * @return {Promise}\n */\n\n }, {\n key: 'postJson',\n value: function postJson(endpoint, json) {\n return this.post(endpoint, (0, _stringify2.default)(json));\n }\n\n /**\n * Sends PUT request to the specified endpoint.\n * @param {String} endpoint\n * @param {Blob|BufferSource|FormData|String} body\n * @return {Promise}\n */\n\n }, {\n key: 'put',\n value: function put(endpoint, body) {\n return this.fetch(endpoint, {\n body: body,\n method: 'PUT'\n });\n }\n\n /**\n * Sends PUT request to the specified endpoint.\n * @param {String} endpoint\n * @param {JSON} json\n * @return {Promise}\n */\n\n }, {\n key: 'putJson',\n value: function putJson(endpoint, json) {\n return this.put(endpoint, (0, _stringify2.default)(json));\n }\n\n /**\n * Sends PATCH request to the specified endpoint.\n * @param {String} endpoint\n * @param {Blob|BufferSource|FormData|String} body\n * @return {Promise}\n */\n\n }, {\n key: 'patch',\n value: function patch(endpoint, body) {\n return this.fetch(endpoint, {\n body: body,\n method: 'PATCH'\n });\n }\n\n /**\n * Sends PATCH request to the specified endpoint.\n * @param {String} endpoint\n * @param {JSON} json\n * @return {Promise}\n */\n\n }, {\n key: 'patchJson',\n value: function patchJson(endpoint, json) {\n return this.patch(endpoint, (0, _stringify2.default)(json));\n }\n\n /**\n * Upload with progress\n * @param {String} endpoint\n * @param {Object} body and headers\n * @param {Function} callback handler for update progress only works for client side for now\n * @return {Promise}\n */\n\n }, {\n key: 'upload',\n value: function upload(endpoint, options, onProgress) {\n var _private2 = this.private,\n base = _private2.base,\n token = _private2.token;\n\n var headers = options.headers ? _lodash2.default.clone(options.headers) : {};\n if (token) headers.Authorization = 'Bearer ' + token;\n if (_topcoderReactUtils.isomorphy.isClientSide()) {\n return new _promise2.default(function (res, rej) {\n var xhr = new XMLHttpRequest(); //eslint-disable-line\n xhr.open(options.method, '' + base + endpoint);\n (0, _keys2.default)(headers).forEach(function (key) {\n if (headers[key] != null) {\n xhr.setRequestHeader(key, headers[key]);\n }\n });\n xhr.onload = function (e) {\n return res(e.target.responseText);\n };\n xhr.onerror = rej;\n if (xhr.upload && onProgress) {\n xhr.upload.onprogress = function (evt) {\n if (evt.lengthComputable) onProgress(evt.loaded / evt.total);\n };\n }\n xhr.send(options.body);\n });\n }\n return this.fetch(endpoint, options);\n }\n }, {\n key: '__reactstandin__regenerateByEval',\n // @ts-ignore\n value: function __reactstandin__regenerateByEval(key, code) {\n // @ts-ignore\n this[key] = eval(code);\n }\n }]);\n return Api;\n}();\n\nvar _default = Api;\nexports.default = _default;\n\n/*\n * Topcoder API\n */\n\nvar lastApiInstances = {};\n\n/**\n * Returns a new or existing Api object for Topcoder API.\n * @param {String} version The API version.\n * @param {String} token Optional. Auth token for Topcoder API.\n * @return {Api} API service object.\n */\nfunction getApi(version, token) {\n if (!version || !_topcoderReactUtils.config.API[version]) {\n throw new Error(version + ' is not a valid API version');\n }\n if (!lastApiInstances[version] || lastApiInstances[version].private.token !== token) {\n lastApiInstances[version] = new Api(_topcoderReactUtils.config.API[version], token);\n }\n return lastApiInstances[version];\n}\n\n/**\n * Keep the old API factories for backwards compatibility\n * DO NOT USE THEM FOR NEW IMPLEMENTATIONS.\n * USE THE getApi(version, token) FACTORY.\n */\nvar getApiV2 = exports.getApiV2 = function getApiV2(token) {\n return getApi('V2', token);\n};\nvar getApiV3 = exports.getApiV3 = function getApiV3(token) {\n return getApi('V3', token);\n};\nvar getApiV4 = exports.getApiV4 = function getApiV4(token) {\n return getApi('V4', token);\n};\n\ngetTcM2mToken.MIN_LIFETIME = 30 * 1000; // [ms]\n\n;\n\n(function () {\n var reactHotLoader = __webpack_require__(/*! react-hot-loader */ \"react-hot-loader\").default;\n\n var leaveModule = __webpack_require__(/*! react-hot-loader */ \"react-hot-loader\").leaveModule;\n\n if (!reactHotLoader) {\n return;\n }\n\n reactHotLoader.register(MIN_API_CALL_DELAY, 'MIN_API_CALL_DELAY', '/Users/thomaskranitsas/Desktop/topcoder-react-lib/src/services/api.js');\n reactHotLoader.register(API_THROTTLING, 'API_THROTTLING', '/Users/thomaskranitsas/Desktop/topcoder-react-lib/src/services/api.js');\n reactHotLoader.register(lastApiCallTimestamp, 'lastApiCallTimestamp', '/Users/thomaskranitsas/Desktop/topcoder-react-lib/src/services/api.js');\n reactHotLoader.register(Api, 'Api', '/Users/thomaskranitsas/Desktop/topcoder-react-lib/src/services/api.js');\n reactHotLoader.register(lastApiInstances, 'lastApiInstances', '/Users/thomaskranitsas/Desktop/topcoder-react-lib/src/services/api.js');\n reactHotLoader.register(getApi, 'getApi', '/Users/thomaskranitsas/Desktop/topcoder-react-lib/src/services/api.js');\n reactHotLoader.register(getApiV2, 'getApiV2', '/Users/thomaskranitsas/Desktop/topcoder-react-lib/src/services/api.js');\n reactHotLoader.register(getApiV3, 'getApiV3', '/Users/thomaskranitsas/Desktop/topcoder-react-lib/src/services/api.js');\n reactHotLoader.register(getApiV4, 'getApiV4', '/Users/thomaskranitsas/Desktop/topcoder-react-lib/src/services/api.js');\n reactHotLoader.register(getTcM2mToken, 'getTcM2mToken', '/Users/thomaskranitsas/Desktop/topcoder-react-lib/src/services/api.js');\n reactHotLoader.register(_default, 'default', '/Users/thomaskranitsas/Desktop/topcoder-react-lib/src/services/api.js');\n leaveModule(module);\n})();\n\n;\n/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../node_modules/webpack/buildin/module.js */ \"./node_modules/webpack/buildin/module.js\")(module)))\n\n//# sourceURL=webpack://topcoder-react-lib/./src/services/api.js?"); +eval("/* WEBPACK VAR INJECTION */(function(module) {\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.getTcM2mToken = exports.getApiV5 = exports.getApiV4 = exports.getApiV3 = exports.getApiV2 = undefined;\n\nvar _keys = __webpack_require__(/*! babel-runtime/core-js/object/keys */ \"babel-runtime/core-js/object/keys\");\n\nvar _keys2 = _interopRequireDefault(_keys);\n\nvar _promise = __webpack_require__(/*! babel-runtime/core-js/promise */ \"babel-runtime/core-js/promise\");\n\nvar _promise2 = _interopRequireDefault(_promise);\n\nvar _stringify = __webpack_require__(/*! babel-runtime/core-js/json/stringify */ \"babel-runtime/core-js/json/stringify\");\n\nvar _stringify2 = _interopRequireDefault(_stringify);\n\nvar _regenerator = __webpack_require__(/*! babel-runtime/regenerator */ \"babel-runtime/regenerator\");\n\nvar _regenerator2 = _interopRequireDefault(_regenerator);\n\nvar _extends2 = __webpack_require__(/*! babel-runtime/helpers/extends */ \"babel-runtime/helpers/extends\");\n\nvar _extends3 = _interopRequireDefault(_extends2);\n\nvar _asyncToGenerator2 = __webpack_require__(/*! babel-runtime/helpers/asyncToGenerator */ \"babel-runtime/helpers/asyncToGenerator\");\n\nvar _asyncToGenerator3 = _interopRequireDefault(_asyncToGenerator2);\n\nvar _classCallCheck2 = __webpack_require__(/*! babel-runtime/helpers/classCallCheck */ \"babel-runtime/helpers/classCallCheck\");\n\nvar _classCallCheck3 = _interopRequireDefault(_classCallCheck2);\n\nvar _createClass2 = __webpack_require__(/*! babel-runtime/helpers/createClass */ \"babel-runtime/helpers/createClass\");\n\nvar _createClass3 = _interopRequireDefault(_createClass2);\n\n/**\n * Gets a valid TC M2M token, either requesting one from TC Auth0 API, or\n * serving one from internal cache.\n *\n * @return {Promise} Resolves to a token, valid at least next\n * getTcM2mToken.MIN_LIFETIME milliseconds.\n *\n * @throw if called outside of the server.s\n */\nvar getTcM2mToken = exports.getTcM2mToken = function () {\n var _ref2 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee2() {\n var now, cached, TC_M2M, res;\n return _regenerator2.default.wrap(function _callee2$(_context2) {\n while (1) {\n switch (_context2.prev = _context2.next) {\n case 0:\n if (_topcoderReactUtils.isomorphy.isServerSide()) {\n _context2.next = 2;\n break;\n }\n\n throw new Error('getTcM2mToken() called outside the server');\n\n case 2:\n now = Date.now();\n cached = getTcM2mToken.cached;\n TC_M2M = _topcoderReactUtils.config.SECRET.TC_M2M;\n\n if (!(!cached || cached.expires < now + getTcM2mToken.MIN_LIFETIME)) {\n _context2.next = 13;\n break;\n }\n\n _context2.next = 8;\n return (0, _isomorphicFetch2.default)('https://' + _topcoderReactUtils.config.AUTH0.DOMAIN + '/oauth/token', {\n headers: { 'Content-Type': 'application/json' },\n body: (0, _stringify2.default)({\n client_id: TC_M2M.CLIENT_ID,\n client_secret: TC_M2M.CLIENT_SECRET,\n audience: TC_M2M.AUDIENCE,\n grant_type: TC_M2M.GRANT_TYPE\n }),\n method: 'POST'\n });\n\n case 8:\n res = _context2.sent;\n _context2.next = 11;\n return res.json();\n\n case 11:\n res = _context2.sent;\n\n getTcM2mToken.cached = {\n expires: now + 1000 * res.expires_in, // [ms]\n token: res.access_token\n };\n\n case 13:\n return _context2.abrupt('return', getTcM2mToken.cached.token);\n\n case 14:\n case 'end':\n return _context2.stop();\n }\n }\n }, _callee2, this);\n }));\n\n return function getTcM2mToken() {\n return _ref2.apply(this, arguments);\n };\n}();\n\nexports.getApi = getApi;\n\nvar _lodash = __webpack_require__(/*! lodash */ \"lodash\");\n\nvar _lodash2 = _interopRequireDefault(_lodash);\n\nvar _isomorphicFetch = __webpack_require__(/*! isomorphic-fetch */ \"isomorphic-fetch\");\n\nvar _isomorphicFetch2 = _interopRequireDefault(_isomorphicFetch);\n\nvar _topcoderReactUtils = __webpack_require__(/*! topcoder-react-utils */ \"topcoder-react-utils\");\n\nvar _time = __webpack_require__(/*! ../utils/time */ \"./src/utils/time.js\");\n\nvar _errors = __webpack_require__(/*! ../utils/errors */ \"./src/utils/errors.js\");\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n(function () {\n var enterModule = __webpack_require__(/*! react-hot-loader */ \"react-hot-loader\").enterModule;\n\n enterModule && enterModule(module);\n})(); /**\n * @module \"services.api\"\n * @desc This module provides a service for conventient access to Topcoder APIs.\n */\n\n/* The minimal delay [ms] between API calls. To avoid problems with the requests\n * rate limits configured in Topcoder APIs, we throttle requests rate at the\n * client side, and at server-side, in dev mode (which is meant to be used for\n * local development. */\nvar MIN_API_CALL_DELAY = _topcoderReactUtils.isomorphy.isDevBuild() ? 1000 : 200;\n\nvar API_THROTTLING = true;\n\nvar lastApiCallTimestamp = Date.now();\n\n/**\n * @static\n * @member default\n * @desc The default export from the module is\n * {@link module:services.api~Api} class.\n */\n\n/**\n * API service object. It is reused for both Topcoder API v2 and v3,\n * as in these cases we are fine with the same interface, and the only\n * thing we need to be different is the base URL and auth token to use.\n */\n\nvar Api = function () {\n /**\n * Creates a new Api object.\n * @param {String} base Base URL of the API.\n * @param {String} token Optional. Authorization token.\n */\n function Api(base, token) {\n (0, _classCallCheck3.default)(this, Api);\n\n this.private = {\n base: base,\n token: token\n };\n }\n\n /**\n * Sends HTTP request to the specified API endpoint. This method is just\n * a convenient wrapper around isomorphic fetch(..):\n *\n * - If API service has auth token, Authorization header is automatically\n * added to the request;\n *\n * - If no Content-Type header set in options, it is automatically set to\n * \"application/json\". In case you want to avoid it, pass null into\n * Content-Type header option.\n *\n * For additional details see https://github.github.io/fetch/\n * @param {String} enpoint Should start with slash, like /endpoint.\n * @param {Object} options Optional. Fetch options.\n * @return {Promise} It resolves to the HTTP response object. To get the\n * actual data you probably want to call .json() method of that object.\n * Mind that this promise rejects only on network errors. In case of\n * HTTP errors (404, etc.) the promise will be resolved successfully,\n * and you should check .status or .ok fields of the response object\n * to find out the response status.\n */\n\n\n (0, _createClass3.default)(Api, [{\n key: 'fetch',\n value: function () {\n var _ref = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee(endpoint) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n\n var _private, base, token, headers, now;\n\n return _regenerator2.default.wrap(function _callee$(_context) {\n while (1) {\n switch (_context.prev = _context.next) {\n case 0:\n _private = this.private, base = _private.base, token = _private.token;\n headers = options.headers ? _lodash2.default.clone(options.headers) : {};\n\n if (token) headers.Authorization = 'Bearer ' + token;\n\n _context.t0 = headers['Content-Type'];\n _context.next = _context.t0 === null ? 6 : _context.t0 === undefined ? 8 : 10;\n break;\n\n case 6:\n delete headers['Content-Type'];\n return _context.abrupt('break', 10);\n\n case 8:\n headers['Content-Type'] = 'application/json';\n return _context.abrupt('break', 10);\n\n case 10:\n if (!(API_THROTTLING && (_topcoderReactUtils.isomorphy.isClientSide() || _topcoderReactUtils.isomorphy.isDevBuild()))) {\n _context.next = 19;\n break;\n }\n\n now = Date.now();\n\n lastApiCallTimestamp += MIN_API_CALL_DELAY;\n\n if (!(lastApiCallTimestamp > now)) {\n _context.next = 18;\n break;\n }\n\n _context.next = 16;\n return (0, _time.delay)(lastApiCallTimestamp - now);\n\n case 16:\n _context.next = 19;\n break;\n\n case 18:\n lastApiCallTimestamp = now;\n\n case 19:\n return _context.abrupt('return', (0, _isomorphicFetch2.default)('' + base + endpoint, (0, _extends3.default)({}, options, {\n headers: headers\n })).catch(function (e) {\n (0, _errors.setErrorIcon)(_errors.ERROR_ICON_TYPES.NETWORK, '' + base + endpoint, e.message);\n throw e;\n }));\n\n case 20:\n case 'end':\n return _context.stop();\n }\n }\n }, _callee, this);\n }));\n\n function fetch(_x) {\n return _ref.apply(this, arguments);\n }\n\n return fetch;\n }()\n\n /**\n * Sends DELETE request to the specified endpoint.\n * @param {String} endpoint\n * @param {Blob|BufferSource|FormData|String} body\n * @return {Promise}\n */\n\n }, {\n key: 'delete',\n value: function _delete(endpoint, body) {\n return this.fetch(endpoint, {\n body: body,\n method: 'DELETE'\n });\n }\n\n /**\n * Sends GET request to the specified endpoint.\n * @param {String} endpoint\n * @return {Promise}\n */\n\n }, {\n key: 'get',\n value: function get(endpoint) {\n return this.fetch(endpoint);\n }\n\n /**\n * Sends POST request to the specified endpoint.\n * @param {String} endpoint\n * @param {Blob|BufferSource|FormData|String} body\n * @return {Promise}\n */\n\n }, {\n key: 'post',\n value: function post(endpoint, body) {\n return this.fetch(endpoint, {\n body: body,\n method: 'POST'\n });\n }\n\n /**\n * Sends POST request to the specified endpoint, with JSON payload.\n * @param {String} endpoint\n * @param {JSON} json\n * @return {Promise}\n */\n\n }, {\n key: 'postJson',\n value: function postJson(endpoint, json) {\n return this.post(endpoint, (0, _stringify2.default)(json));\n }\n\n /**\n * Sends PUT request to the specified endpoint.\n * @param {String} endpoint\n * @param {Blob|BufferSource|FormData|String} body\n * @return {Promise}\n */\n\n }, {\n key: 'put',\n value: function put(endpoint, body) {\n return this.fetch(endpoint, {\n body: body,\n method: 'PUT'\n });\n }\n\n /**\n * Sends PUT request to the specified endpoint.\n * @param {String} endpoint\n * @param {JSON} json\n * @return {Promise}\n */\n\n }, {\n key: 'putJson',\n value: function putJson(endpoint, json) {\n return this.put(endpoint, (0, _stringify2.default)(json));\n }\n\n /**\n * Sends PATCH request to the specified endpoint.\n * @param {String} endpoint\n * @param {Blob|BufferSource|FormData|String} body\n * @return {Promise}\n */\n\n }, {\n key: 'patch',\n value: function patch(endpoint, body) {\n return this.fetch(endpoint, {\n body: body,\n method: 'PATCH'\n });\n }\n\n /**\n * Sends PATCH request to the specified endpoint.\n * @param {String} endpoint\n * @param {JSON} json\n * @return {Promise}\n */\n\n }, {\n key: 'patchJson',\n value: function patchJson(endpoint, json) {\n return this.patch(endpoint, (0, _stringify2.default)(json));\n }\n\n /**\n * Upload with progress\n * @param {String} endpoint\n * @param {Object} body and headers\n * @param {Function} callback handler for update progress only works for client side for now\n * @return {Promise}\n */\n\n }, {\n key: 'upload',\n value: function upload(endpoint, options, onProgress) {\n var _private2 = this.private,\n base = _private2.base,\n token = _private2.token;\n\n var headers = options.headers ? _lodash2.default.clone(options.headers) : {};\n if (token) headers.Authorization = 'Bearer ' + token;\n if (_topcoderReactUtils.isomorphy.isClientSide()) {\n return new _promise2.default(function (res, rej) {\n var xhr = new XMLHttpRequest(); //eslint-disable-line\n xhr.open(options.method, '' + base + endpoint);\n (0, _keys2.default)(headers).forEach(function (key) {\n if (headers[key] != null) {\n xhr.setRequestHeader(key, headers[key]);\n }\n });\n xhr.onload = function (e) {\n return res(e.target.responseText);\n };\n xhr.onerror = rej;\n if (xhr.upload && onProgress) {\n xhr.upload.onprogress = function (evt) {\n if (evt.lengthComputable) onProgress(evt.loaded / evt.total);\n };\n }\n xhr.send(options.body);\n });\n }\n return this.fetch(endpoint, options);\n }\n }, {\n key: '__reactstandin__regenerateByEval',\n // @ts-ignore\n value: function __reactstandin__regenerateByEval(key, code) {\n // @ts-ignore\n this[key] = eval(code);\n }\n }]);\n return Api;\n}();\n\nvar _default = Api;\nexports.default = _default;\n\n/*\n * Topcoder API\n */\n\nvar lastApiInstances = {};\n\n/**\n * Returns a new or existing Api object for Topcoder API.\n * @param {String} version The API version.\n * @param {String} token Optional. Auth token for Topcoder API.\n * @return {Api} API service object.\n */\nfunction getApi(version, token) {\n if (!version || !_topcoderReactUtils.config.API[version]) {\n throw new Error(version + ' is not a valid API version');\n }\n if (!lastApiInstances[version] || lastApiInstances[version].private.token !== token) {\n lastApiInstances[version] = new Api(_topcoderReactUtils.config.API[version], token);\n }\n return lastApiInstances[version];\n}\n\n/**\n * Keep the old API factories for backwards compatibility\n * DO NOT USE THEM FOR NEW IMPLEMENTATIONS.\n * USE THE getApi(version, token) FACTORY.\n */\nvar getApiV2 = exports.getApiV2 = function getApiV2(token) {\n return getApi('V2', token);\n};\nvar getApiV3 = exports.getApiV3 = function getApiV3(token) {\n return getApi('V3', token);\n};\nvar getApiV4 = exports.getApiV4 = function getApiV4(token) {\n return getApi('V4', token);\n};\nvar getApiV5 = exports.getApiV5 = function getApiV5(token) {\n return getApi('V5', token);\n};\n\ngetTcM2mToken.MIN_LIFETIME = 30 * 1000; // [ms]\n\n;\n\n(function () {\n var reactHotLoader = __webpack_require__(/*! react-hot-loader */ \"react-hot-loader\").default;\n\n var leaveModule = __webpack_require__(/*! react-hot-loader */ \"react-hot-loader\").leaveModule;\n\n if (!reactHotLoader) {\n return;\n }\n\n reactHotLoader.register(MIN_API_CALL_DELAY, 'MIN_API_CALL_DELAY', '/Users/thomaskranitsas/Desktop/topcoder-react-lib/src/services/api.js');\n reactHotLoader.register(API_THROTTLING, 'API_THROTTLING', '/Users/thomaskranitsas/Desktop/topcoder-react-lib/src/services/api.js');\n reactHotLoader.register(lastApiCallTimestamp, 'lastApiCallTimestamp', '/Users/thomaskranitsas/Desktop/topcoder-react-lib/src/services/api.js');\n reactHotLoader.register(Api, 'Api', '/Users/thomaskranitsas/Desktop/topcoder-react-lib/src/services/api.js');\n reactHotLoader.register(lastApiInstances, 'lastApiInstances', '/Users/thomaskranitsas/Desktop/topcoder-react-lib/src/services/api.js');\n reactHotLoader.register(getApi, 'getApi', '/Users/thomaskranitsas/Desktop/topcoder-react-lib/src/services/api.js');\n reactHotLoader.register(getApiV2, 'getApiV2', '/Users/thomaskranitsas/Desktop/topcoder-react-lib/src/services/api.js');\n reactHotLoader.register(getApiV3, 'getApiV3', '/Users/thomaskranitsas/Desktop/topcoder-react-lib/src/services/api.js');\n reactHotLoader.register(getApiV4, 'getApiV4', '/Users/thomaskranitsas/Desktop/topcoder-react-lib/src/services/api.js');\n reactHotLoader.register(getApiV5, 'getApiV5', '/Users/thomaskranitsas/Desktop/topcoder-react-lib/src/services/api.js');\n reactHotLoader.register(getTcM2mToken, 'getTcM2mToken', '/Users/thomaskranitsas/Desktop/topcoder-react-lib/src/services/api.js');\n reactHotLoader.register(_default, 'default', '/Users/thomaskranitsas/Desktop/topcoder-react-lib/src/services/api.js');\n leaveModule(module);\n})();\n\n;\n/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../node_modules/webpack/buildin/module.js */ \"./node_modules/webpack/buildin/module.js\")(module)))\n\n//# sourceURL=webpack://topcoder-react-lib/./src/services/api.js?"); /***/ }), @@ -994,7 +1002,7 @@ eval("/* WEBPACK VAR INJECTION */(function(module) {\n\nObject.defineProperty(ex /***/ (function(module, exports, __webpack_require__) { "use strict"; -eval("/* WEBPACK VAR INJECTION */(function(module) {\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.services = undefined;\n\nvar _api = __webpack_require__(/*! ./api */ \"./src/services/api.js\");\n\nvar api = _interopRequireWildcard(_api);\n\nvar _billing = __webpack_require__(/*! ./billing */ \"./src/services/billing.js\");\n\nvar billing = _interopRequireWildcard(_billing);\n\nvar _challenges = __webpack_require__(/*! ./challenges */ \"./src/services/challenges.js\");\n\nvar challenge = _interopRequireWildcard(_challenges);\n\nvar _direct = __webpack_require__(/*! ./direct */ \"./src/services/direct.js\");\n\nvar direct = _interopRequireWildcard(_direct);\n\nvar _groups = __webpack_require__(/*! ./groups */ \"./src/services/groups.js\");\n\nvar groups = _interopRequireWildcard(_groups);\n\nvar _members = __webpack_require__(/*! ./members */ \"./src/services/members.js\");\n\nvar members = _interopRequireWildcard(_members);\n\nvar _terms = __webpack_require__(/*! ./terms */ \"./src/services/terms.js\");\n\nvar terms = _interopRequireWildcard(_terms);\n\nvar _communities = __webpack_require__(/*! ./communities */ \"./src/services/communities.js\");\n\nvar communities = _interopRequireWildcard(_communities);\n\nvar _reviewOpportunities = __webpack_require__(/*! ./reviewOpportunities */ \"./src/services/reviewOpportunities.js\");\n\nvar reviewOpportunities = _interopRequireWildcard(_reviewOpportunities);\n\nvar _userSettings = __webpack_require__(/*! ./user-settings */ \"./src/services/user-settings.js\");\n\nvar userSetting = _interopRequireWildcard(_userSettings);\n\nvar _user = __webpack_require__(/*! ./user */ \"./src/services/user.js\");\n\nvar user = _interopRequireWildcard(_user);\n\nvar _lookup = __webpack_require__(/*! ./lookup */ \"./src/services/lookup.js\");\n\nvar lookup = _interopRequireWildcard(_lookup);\n\nvar _userTraits = __webpack_require__(/*! ./user-traits */ \"./src/services/user-traits.js\");\n\nvar userTraits = _interopRequireWildcard(_userTraits);\n\nfunction _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; } }\n\n(function () {\n var enterModule = __webpack_require__(/*! react-hot-loader */ \"react-hot-loader\").enterModule;\n\n enterModule && enterModule(module);\n})(); /**\n * Export services.\n */\n\n\nvar services = exports.services = {\n api: api,\n billing: billing,\n terms: terms,\n communities: communities,\n challenge: challenge,\n direct: direct,\n groups: groups,\n members: members,\n user: user,\n userSetting: userSetting,\n reviewOpportunities: reviewOpportunities,\n lookup: lookup,\n userTraits: userTraits\n};\n\nvar _default = undefined;\nexports.default = _default;\n;\n\n(function () {\n var reactHotLoader = __webpack_require__(/*! react-hot-loader */ \"react-hot-loader\").default;\n\n var leaveModule = __webpack_require__(/*! react-hot-loader */ \"react-hot-loader\").leaveModule;\n\n if (!reactHotLoader) {\n return;\n }\n\n reactHotLoader.register(services, 'services', '/Users/thomaskranitsas/Desktop/topcoder-react-lib/src/services/index.js');\n reactHotLoader.register(_default, 'default', '/Users/thomaskranitsas/Desktop/topcoder-react-lib/src/services/index.js');\n leaveModule(module);\n})();\n\n;\n/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../node_modules/webpack/buildin/module.js */ \"./node_modules/webpack/buildin/module.js\")(module)))\n\n//# sourceURL=webpack://topcoder-react-lib/./src/services/index.js?"); +eval("/* WEBPACK VAR INJECTION */(function(module) {\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.services = undefined;\n\nvar _api = __webpack_require__(/*! ./api */ \"./src/services/api.js\");\n\nvar api = _interopRequireWildcard(_api);\n\nvar _billing = __webpack_require__(/*! ./billing */ \"./src/services/billing.js\");\n\nvar billing = _interopRequireWildcard(_billing);\n\nvar _challenges = __webpack_require__(/*! ./challenges */ \"./src/services/challenges.js\");\n\nvar challenge = _interopRequireWildcard(_challenges);\n\nvar _direct = __webpack_require__(/*! ./direct */ \"./src/services/direct.js\");\n\nvar direct = _interopRequireWildcard(_direct);\n\nvar _groups = __webpack_require__(/*! ./groups */ \"./src/services/groups.js\");\n\nvar groups = _interopRequireWildcard(_groups);\n\nvar _members = __webpack_require__(/*! ./members */ \"./src/services/members.js\");\n\nvar members = _interopRequireWildcard(_members);\n\nvar _terms = __webpack_require__(/*! ./terms */ \"./src/services/terms.js\");\n\nvar terms = _interopRequireWildcard(_terms);\n\nvar _communities = __webpack_require__(/*! ./communities */ \"./src/services/communities.js\");\n\nvar communities = _interopRequireWildcard(_communities);\n\nvar _reviewOpportunities = __webpack_require__(/*! ./reviewOpportunities */ \"./src/services/reviewOpportunities.js\");\n\nvar reviewOpportunities = _interopRequireWildcard(_reviewOpportunities);\n\nvar _userSettings = __webpack_require__(/*! ./user-settings */ \"./src/services/user-settings.js\");\n\nvar userSetting = _interopRequireWildcard(_userSettings);\n\nvar _user = __webpack_require__(/*! ./user */ \"./src/services/user.js\");\n\nvar user = _interopRequireWildcard(_user);\n\nvar _lookup = __webpack_require__(/*! ./lookup */ \"./src/services/lookup.js\");\n\nvar lookup = _interopRequireWildcard(_lookup);\n\nvar _userTraits = __webpack_require__(/*! ./user-traits */ \"./src/services/user-traits.js\");\n\nvar userTraits = _interopRequireWildcard(_userTraits);\n\nvar _submissions = __webpack_require__(/*! ./submissions */ \"./src/services/submissions.js\");\n\nvar submissions = _interopRequireWildcard(_submissions);\n\nfunction _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; } }\n\n(function () {\n var enterModule = __webpack_require__(/*! react-hot-loader */ \"react-hot-loader\").enterModule;\n\n enterModule && enterModule(module);\n})(); /**\n * Export services.\n */\n\n\nvar services = exports.services = {\n api: api,\n billing: billing,\n terms: terms,\n communities: communities,\n challenge: challenge,\n direct: direct,\n groups: groups,\n members: members,\n user: user,\n userSetting: userSetting,\n reviewOpportunities: reviewOpportunities,\n lookup: lookup,\n userTraits: userTraits,\n submissions: submissions\n};\n\nvar _default = undefined;\nexports.default = _default;\n;\n\n(function () {\n var reactHotLoader = __webpack_require__(/*! react-hot-loader */ \"react-hot-loader\").default;\n\n var leaveModule = __webpack_require__(/*! react-hot-loader */ \"react-hot-loader\").leaveModule;\n\n if (!reactHotLoader) {\n return;\n }\n\n reactHotLoader.register(services, 'services', '/Users/thomaskranitsas/Desktop/topcoder-react-lib/src/services/index.js');\n reactHotLoader.register(_default, 'default', '/Users/thomaskranitsas/Desktop/topcoder-react-lib/src/services/index.js');\n leaveModule(module);\n})();\n\n;\n/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../node_modules/webpack/buildin/module.js */ \"./node_modules/webpack/buildin/module.js\")(module)))\n\n//# sourceURL=webpack://topcoder-react-lib/./src/services/index.js?"); /***/ }), @@ -1030,7 +1038,7 @@ eval("/* WEBPACK VAR INJECTION */(function(module) {\n\nObject.defineProperty(ex /***/ (function(module, exports, __webpack_require__) { "use strict"; -eval("/* WEBPACK VAR INJECTION */(function(module) {\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _assign = __webpack_require__(/*! babel-runtime/core-js/object/assign */ \"babel-runtime/core-js/object/assign\");\n\nvar _assign2 = _interopRequireDefault(_assign);\n\nvar _promise = __webpack_require__(/*! babel-runtime/core-js/promise */ \"babel-runtime/core-js/promise\");\n\nvar _promise2 = _interopRequireDefault(_promise);\n\nvar _defineProperty2 = __webpack_require__(/*! babel-runtime/helpers/defineProperty */ \"babel-runtime/helpers/defineProperty\");\n\nvar _defineProperty3 = _interopRequireDefault(_defineProperty2);\n\nvar _stringify = __webpack_require__(/*! babel-runtime/core-js/json/stringify */ \"babel-runtime/core-js/json/stringify\");\n\nvar _stringify2 = _interopRequireDefault(_stringify);\n\nvar _regenerator = __webpack_require__(/*! babel-runtime/regenerator */ \"babel-runtime/regenerator\");\n\nvar _regenerator2 = _interopRequireDefault(_regenerator);\n\nvar _asyncToGenerator2 = __webpack_require__(/*! babel-runtime/helpers/asyncToGenerator */ \"babel-runtime/helpers/asyncToGenerator\");\n\nvar _asyncToGenerator3 = _interopRequireDefault(_asyncToGenerator2);\n\nvar _classCallCheck2 = __webpack_require__(/*! babel-runtime/helpers/classCallCheck */ \"babel-runtime/helpers/classCallCheck\");\n\nvar _classCallCheck3 = _interopRequireDefault(_classCallCheck2);\n\nvar _createClass2 = __webpack_require__(/*! babel-runtime/helpers/createClass */ \"babel-runtime/helpers/createClass\");\n\nvar _createClass3 = _interopRequireDefault(_createClass2);\n\nexports.getService = getService;\n\nvar _lodash = __webpack_require__(/*! lodash */ \"lodash\");\n\nvar _lodash2 = _interopRequireDefault(_lodash);\n\nvar _qs = __webpack_require__(/*! qs */ \"qs\");\n\nvar _qs2 = _interopRequireDefault(_qs);\n\nvar _logger = __webpack_require__(/*! ../utils/logger */ \"./src/utils/logger.js\");\n\nvar _logger2 = _interopRequireDefault(_logger);\n\nvar _tc = __webpack_require__(/*! ../utils/tc */ \"./src/utils/tc.js\");\n\nvar _api = __webpack_require__(/*! ./api */ \"./src/services/api.js\");\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n(function () {\n var enterModule = __webpack_require__(/*! react-hot-loader */ \"react-hot-loader\").enterModule;\n\n enterModule && enterModule(module);\n})(); /**\n * @module \"services.members\"\n * @desc This module provides a service for searching for Topcoder\n * members via API V3.\n */\n\n/* global XMLHttpRequest */\n\n\n/**\n * Service class.\n */\nvar MembersService = function () {\n /**\n * @param {String} tokenV3 Optional. Auth token for Topcoder API v3.\n */\n function MembersService(tokenV3) {\n (0, _classCallCheck3.default)(this, MembersService);\n\n this.private = {\n api: (0, _api.getApi)('V3', tokenV3),\n tokenV3: tokenV3\n };\n }\n\n /**\n * Gets member's financial information.\n * @param {String} handle User handle.\n * @return {Promise} Resolves to the financial information object.\n */\n\n\n (0, _createClass3.default)(MembersService, [{\n key: 'getMemberFinances',\n value: function () {\n var _ref = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee(handle) {\n var res;\n return _regenerator2.default.wrap(function _callee$(_context) {\n while (1) {\n switch (_context.prev = _context.next) {\n case 0:\n _context.next = 2;\n return this.private.api.get('/members/' + handle + '/financial');\n\n case 2:\n res = _context.sent;\n return _context.abrupt('return', (0, _tc.getApiResponsePayload)(res));\n\n case 4:\n case 'end':\n return _context.stop();\n }\n }\n }, _callee, this);\n }));\n\n function getMemberFinances(_x) {\n return _ref.apply(this, arguments);\n }\n\n return getMemberFinances;\n }()\n\n /**\n * Gets public information on a member.\n *\n * This method does not require any authorization.\n *\n * @param {String} handle Member handle.\n * @return {Promise} Resolves to the data object.\n */\n\n }, {\n key: 'getMemberInfo',\n value: function () {\n var _ref2 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee2(handle) {\n var res;\n return _regenerator2.default.wrap(function _callee2$(_context2) {\n while (1) {\n switch (_context2.prev = _context2.next) {\n case 0:\n _context2.next = 2;\n return this.private.api.get('/members/' + handle);\n\n case 2:\n res = _context2.sent;\n return _context2.abrupt('return', (0, _tc.getApiResponsePayload)(res));\n\n case 4:\n case 'end':\n return _context2.stop();\n }\n }\n }, _callee2, this);\n }));\n\n function getMemberInfo(_x2) {\n return _ref2.apply(this, arguments);\n }\n\n return getMemberInfo;\n }()\n\n /**\n * Gets member external account info.\n * @param {String} handle\n * @return {Promise} Resolves to the stats object.\n */\n\n }, {\n key: 'getExternalAccounts',\n value: function () {\n var _ref3 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee3(handle) {\n var res;\n return _regenerator2.default.wrap(function _callee3$(_context3) {\n while (1) {\n switch (_context3.prev = _context3.next) {\n case 0:\n _context3.next = 2;\n return this.private.api.get('/members/' + handle + '/externalAccounts');\n\n case 2:\n res = _context3.sent;\n return _context3.abrupt('return', (0, _tc.getApiResponsePayload)(res));\n\n case 4:\n case 'end':\n return _context3.stop();\n }\n }\n }, _callee3, this);\n }));\n\n function getExternalAccounts(_x3) {\n return _ref3.apply(this, arguments);\n }\n\n return getExternalAccounts;\n }()\n\n /**\n * Gets member external links.\n * @param {String} handle\n * @return {Promise} Resolves to the stats object.\n */\n\n }, {\n key: 'getExternalLinks',\n value: function () {\n var _ref4 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee4(handle) {\n var res;\n return _regenerator2.default.wrap(function _callee4$(_context4) {\n while (1) {\n switch (_context4.prev = _context4.next) {\n case 0:\n _context4.next = 2;\n return this.private.api.get('/members/' + handle + '/externalLinks');\n\n case 2:\n res = _context4.sent;\n return _context4.abrupt('return', (0, _tc.getApiResponsePayload)(res));\n\n case 4:\n case 'end':\n return _context4.stop();\n }\n }\n }, _callee4, this);\n }));\n\n function getExternalLinks(_x4) {\n return _ref4.apply(this, arguments);\n }\n\n return getExternalLinks;\n }()\n\n /**\n * Gets member skills.\n * @param {String} handle\n * @return {Promise} Resolves to the stats object.\n */\n\n }, {\n key: 'getSkills',\n value: function () {\n var _ref5 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee5(handle) {\n var res;\n return _regenerator2.default.wrap(function _callee5$(_context5) {\n while (1) {\n switch (_context5.prev = _context5.next) {\n case 0:\n _context5.next = 2;\n return this.private.api.get('/members/' + handle + '/skills');\n\n case 2:\n res = _context5.sent;\n return _context5.abrupt('return', (0, _tc.getApiResponsePayload)(res));\n\n case 4:\n case 'end':\n return _context5.stop();\n }\n }\n }, _callee5, this);\n }));\n\n function getSkills(_x5) {\n return _ref5.apply(this, arguments);\n }\n\n return getSkills;\n }()\n\n /**\n * Gets member statistics.\n * @param {String} handle\n * @return {Promise} Resolves to the stats object.\n */\n\n }, {\n key: 'getStats',\n value: function () {\n var _ref6 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee6(handle) {\n var res;\n return _regenerator2.default.wrap(function _callee6$(_context6) {\n while (1) {\n switch (_context6.prev = _context6.next) {\n case 0:\n _context6.next = 2;\n return this.private.api.get('/members/' + handle + '/stats');\n\n case 2:\n res = _context6.sent;\n return _context6.abrupt('return', (0, _tc.getApiResponsePayload)(res));\n\n case 4:\n case 'end':\n return _context6.stop();\n }\n }\n }, _callee6, this);\n }));\n\n function getStats(_x6) {\n return _ref6.apply(this, arguments);\n }\n\n return getStats;\n }()\n\n /**\n * Gets member statistics history\n * @param {String} handle\n * @return {Promise} Resolves to the stats object.\n */\n\n }, {\n key: 'getStatsHistory',\n value: function () {\n var _ref7 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee7(handle) {\n var res;\n return _regenerator2.default.wrap(function _callee7$(_context7) {\n while (1) {\n switch (_context7.prev = _context7.next) {\n case 0:\n _context7.next = 2;\n return this.private.api.get('/members/' + handle + '/stats/history');\n\n case 2:\n res = _context7.sent;\n return _context7.abrupt('return', (0, _tc.getApiResponsePayload)(res));\n\n case 4:\n case 'end':\n return _context7.stop();\n }\n }\n }, _callee7, this);\n }));\n\n function getStatsHistory(_x7) {\n return _ref7.apply(this, arguments);\n }\n\n return getStatsHistory;\n }()\n\n /**\n * Gets member statistics distribution\n * @param {String} handle\n * @param {String} track\n * @param {String} subTrack\n * @return {Promise} Resolves to the stats object.\n */\n\n }, {\n key: 'getStatsDistribution',\n value: function () {\n var _ref8 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee8(handle, track, subTrack) {\n var res;\n return _regenerator2.default.wrap(function _callee8$(_context8) {\n while (1) {\n switch (_context8.prev = _context8.next) {\n case 0:\n _context8.next = 2;\n return this.private.api.get('/members/stats/distribution?filter=' + encodeURIComponent(_qs2.default.stringify({\n track: track,\n subTrack: subTrack\n })));\n\n case 2:\n res = _context8.sent;\n return _context8.abrupt('return', (0, _tc.getApiResponsePayload)(res));\n\n case 4:\n case 'end':\n return _context8.stop();\n }\n }\n }, _callee8, this);\n }));\n\n function getStatsDistribution(_x8, _x9, _x10) {\n return _ref8.apply(this, arguments);\n }\n\n return getStatsDistribution;\n }()\n\n /**\n * Gets a list of suggested member names for the supplied partial.\n *\n * WARNING: This method requires v3 authorization.\n *\n * @param {String} keyword Partial string to find suggestions for\n * @return {Promise} Resolves to the api response content\n */\n\n }, {\n key: 'getMemberSuggestions',\n value: function () {\n var _ref9 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee9(keyword) {\n var res;\n return _regenerator2.default.wrap(function _callee9$(_context9) {\n while (1) {\n switch (_context9.prev = _context9.next) {\n case 0:\n _context9.next = 2;\n return this.private.api.get('/members/_suggest/' + keyword);\n\n case 2:\n res = _context9.sent;\n return _context9.abrupt('return', (0, _tc.getApiResponsePayload)(res));\n\n case 4:\n case 'end':\n return _context9.stop();\n }\n }\n }, _callee9, this);\n }));\n\n function getMemberSuggestions(_x11) {\n return _ref9.apply(this, arguments);\n }\n\n return getMemberSuggestions;\n }()\n\n /**\n * Adds external web link for member.\n * @param {String} userHandle The user handle\n * @param {String} webLink The external web link\n * @return {Promise} Resolves to the api response content\n */\n\n }, {\n key: 'addWebLink',\n value: function () {\n var _ref10 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee10(userHandle, webLink) {\n var res;\n return _regenerator2.default.wrap(function _callee10$(_context10) {\n while (1) {\n switch (_context10.prev = _context10.next) {\n case 0:\n _context10.next = 2;\n return this.private.api.postJson('/members/' + userHandle + '/externalLinks', { param: { url: webLink } });\n\n case 2:\n res = _context10.sent;\n return _context10.abrupt('return', (0, _tc.getApiResponsePayload)(res));\n\n case 4:\n case 'end':\n return _context10.stop();\n }\n }\n }, _callee10, this);\n }));\n\n function addWebLink(_x12, _x13) {\n return _ref10.apply(this, arguments);\n }\n\n return addWebLink;\n }()\n\n /**\n * Deletes external web link for member.\n * @param {String} userHandle The user handle\n * @param {String} webLinkHandle The external web link handle\n * @return {Promise} Resolves to the api response content\n */\n\n }, {\n key: 'deleteWebLink',\n value: function () {\n var _ref11 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee11(userHandle, webLinkHandle) {\n var body, res;\n return _regenerator2.default.wrap(function _callee11$(_context11) {\n while (1) {\n switch (_context11.prev = _context11.next) {\n case 0:\n body = {\n param: {\n handle: webLinkHandle\n }\n };\n _context11.next = 3;\n return this.private.api.delete('/members/' + userHandle + '/externalLinks/' + webLinkHandle, (0, _stringify2.default)(body));\n\n case 3:\n res = _context11.sent;\n return _context11.abrupt('return', (0, _tc.getApiResponsePayload)(res));\n\n case 5:\n case 'end':\n return _context11.stop();\n }\n }\n }, _callee11, this);\n }));\n\n function deleteWebLink(_x14, _x15) {\n return _ref11.apply(this, arguments);\n }\n\n return deleteWebLink;\n }()\n\n /**\n * Adds user skill.\n * @param {String} handle Topcoder user handle\n * @param {Number} skillTagId Skill tag id\n * @return {Promise} Resolves to operation result\n */\n\n }, {\n key: 'addSkill',\n value: function () {\n var _ref12 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee12(handle, skillTagId) {\n var body, res;\n return _regenerator2.default.wrap(function _callee12$(_context12) {\n while (1) {\n switch (_context12.prev = _context12.next) {\n case 0:\n body = {\n param: {\n skills: (0, _defineProperty3.default)({}, skillTagId, {\n hidden: false\n })\n }\n };\n _context12.next = 3;\n return this.private.api.patchJson('/members/' + handle + '/skills', body);\n\n case 3:\n res = _context12.sent;\n return _context12.abrupt('return', (0, _tc.getApiResponsePayload)(res));\n\n case 5:\n case 'end':\n return _context12.stop();\n }\n }\n }, _callee12, this);\n }));\n\n function addSkill(_x16, _x17) {\n return _ref12.apply(this, arguments);\n }\n\n return addSkill;\n }()\n\n /**\n * Hides user skill.\n * @param {String} handle Topcoder user handle\n * @param {Number} skillTagId Skill tag id\n * @return {Promise} Resolves to operation result\n */\n\n }, {\n key: 'hideSkill',\n value: function () {\n var _ref13 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee13(handle, skillTagId) {\n var body, res;\n return _regenerator2.default.wrap(function _callee13$(_context13) {\n while (1) {\n switch (_context13.prev = _context13.next) {\n case 0:\n body = {\n param: {\n skills: (0, _defineProperty3.default)({}, skillTagId, {\n hidden: true\n })\n }\n };\n _context13.next = 3;\n return this.private.api.fetch('/members/' + handle + '/skills', {\n body: (0, _stringify2.default)(body),\n method: 'PATCH'\n });\n\n case 3:\n res = _context13.sent;\n return _context13.abrupt('return', (0, _tc.getApiResponsePayload)(res));\n\n case 5:\n case 'end':\n return _context13.stop();\n }\n }\n }, _callee13, this);\n }));\n\n function hideSkill(_x18, _x19) {\n return _ref13.apply(this, arguments);\n }\n\n return hideSkill;\n }()\n\n /**\n * Updates member profile.\n * @param {Object} profile The profile to update.\n * @return {Promise} Resolves to the api response content\n */\n\n }, {\n key: 'updateMemberProfile',\n value: function () {\n var _ref14 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee14(profile) {\n var url, res;\n return _regenerator2.default.wrap(function _callee14$(_context14) {\n while (1) {\n switch (_context14.prev = _context14.next) {\n case 0:\n url = profile.verifyUrl ? '/members/' + profile.handle + '?verifyUrl=' + profile.verifyUrl : '/members/' + profile.handle;\n _context14.next = 3;\n return this.private.api.putJson(url, { param: profile.verifyUrl ? _lodash2.default.omit(profile, ['verifyUrl']) : profile });\n\n case 3:\n res = _context14.sent;\n\n if (!(profile.verifyUrl && res.status === 409)) {\n _context14.next = 6;\n break;\n }\n\n return _context14.abrupt('return', _promise2.default.resolve((0, _assign2.default)({}, profile, { isEmailConflict: true })));\n\n case 6:\n return _context14.abrupt('return', (0, _tc.getApiResponsePayload)(res));\n\n case 7:\n case 'end':\n return _context14.stop();\n }\n }\n }, _callee14, this);\n }));\n\n function updateMemberProfile(_x20) {\n return _ref14.apply(this, arguments);\n }\n\n return updateMemberProfile;\n }()\n\n /**\n * Gets presigned url for member photo file.\n * @param {String} userHandle The user handle\n * @param {File} file The file to get its presigned url\n * @return {Promise} Resolves to the api response content\n */\n\n }, {\n key: 'getPresignedUrl',\n value: function () {\n var _ref15 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee15(userHandle, file) {\n var res, payload;\n return _regenerator2.default.wrap(function _callee15$(_context15) {\n while (1) {\n switch (_context15.prev = _context15.next) {\n case 0:\n _context15.next = 2;\n return this.private.api.postJson('/members/' + userHandle + '/photoUploadUrl', { param: { contentType: file.type } });\n\n case 2:\n res = _context15.sent;\n _context15.next = 5;\n return (0, _tc.getApiResponsePayload)(res);\n\n case 5:\n payload = _context15.sent;\n return _context15.abrupt('return', {\n preSignedURL: payload.preSignedURL,\n token: payload.token,\n file: file,\n userHandle: userHandle\n });\n\n case 7:\n case 'end':\n return _context15.stop();\n }\n }\n }, _callee15, this);\n }));\n\n function getPresignedUrl(_x21, _x22) {\n return _ref15.apply(this, arguments);\n }\n\n return getPresignedUrl;\n }()\n\n /**\n * Updates member photo.\n * @param {Object} S3Response The response from uploadFileToS3() function.\n * @return {Promise} Resolves to the api response content\n */\n\n }, {\n key: 'updateMemberPhoto',\n value: function () {\n var _ref16 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee16(S3Response) {\n var res;\n return _regenerator2.default.wrap(function _callee16$(_context16) {\n while (1) {\n switch (_context16.prev = _context16.next) {\n case 0:\n _context16.next = 2;\n return this.private.api.putJson('/members/' + S3Response.userHandle + '/photo', { param: S3Response.body });\n\n case 2:\n res = _context16.sent;\n return _context16.abrupt('return', (0, _tc.getApiResponsePayload)(res));\n\n case 4:\n case 'end':\n return _context16.stop();\n }\n }\n }, _callee16, this);\n }));\n\n function updateMemberPhoto(_x23) {\n return _ref16.apply(this, arguments);\n }\n\n return updateMemberPhoto;\n }()\n\n /**\n * Uploads file to S3.\n * @param {Object} presignedUrlResponse The presigned url response from\n * getPresignedUrl() function.\n * @return {Promise} Resolves to the api response content\n */\n\n }, {\n key: 'uploadFileToS3',\n value: function uploadFileToS3(presignedUrlResponse) {\n _lodash2.default.noop(this);\n return new _promise2.default(function (resolve, reject) {\n var xhr = new XMLHttpRequest();\n\n xhr.open('PUT', presignedUrlResponse.preSignedURL, true);\n xhr.setRequestHeader('Content-Type', presignedUrlResponse.file.type);\n\n xhr.onreadystatechange = function () {\n var status = xhr.status;\n\n if ((status >= 200 && status < 300 || status === 304) && xhr.readyState === 4) {\n resolve({\n userHandle: presignedUrlResponse.userHandle,\n body: {\n token: presignedUrlResponse.token,\n contentType: presignedUrlResponse.file.type\n }\n });\n } else if (status >= 400) {\n var err = new Error('Could not upload image to S3');\n err.status = status;\n reject(err);\n }\n };\n\n xhr.onerror = function (err) {\n _logger2.default.error('Could not upload image to S3', err);\n\n reject(err);\n };\n\n xhr.send(presignedUrlResponse.file);\n });\n }\n\n /**\n * Verify member new email\n * @param {String} handle handle Topcoder user handle\n * @param {String} emailVerifyToken The verify token of new email\n * @returns {Promise} Resolves to the api response content\n */\n\n }, {\n key: 'verifyMemberNewEmail',\n value: function () {\n var _ref17 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee17(handle, emailVerifyToken) {\n var res;\n return _regenerator2.default.wrap(function _callee17$(_context17) {\n while (1) {\n switch (_context17.prev = _context17.next) {\n case 0:\n _context17.next = 2;\n return this.private.api.get('/members/' + handle + '/verify?token=' + emailVerifyToken);\n\n case 2:\n res = _context17.sent;\n return _context17.abrupt('return', (0, _tc.getApiResponsePayload)(res));\n\n case 4:\n case 'end':\n return _context17.stop();\n }\n }\n }, _callee17, this);\n }));\n\n function verifyMemberNewEmail(_x24, _x25) {\n return _ref17.apply(this, arguments);\n }\n\n return verifyMemberNewEmail;\n }()\n }, {\n key: '__reactstandin__regenerateByEval',\n // @ts-ignore\n value: function __reactstandin__regenerateByEval(key, code) {\n // @ts-ignore\n this[key] = eval(code);\n }\n }]);\n return MembersService;\n}();\n\nvar lastInstance = null;\n/**\n * Returns a new or existing members service.\n * @param {String} tokenV3 Optional. Auth token for Topcoder API v3.\n * @return {MembersService} Members service object\n */\nfunction getService(tokenV3) {\n if (!lastInstance || tokenV3 !== lastInstance.private.tokenV3) {\n lastInstance = new MembersService(tokenV3);\n }\n return lastInstance;\n}\n\n/* Using default export would be confusing in this case. */\nvar _default = undefined;\nexports.default = _default;\n;\n\n(function () {\n var reactHotLoader = __webpack_require__(/*! react-hot-loader */ \"react-hot-loader\").default;\n\n var leaveModule = __webpack_require__(/*! react-hot-loader */ \"react-hot-loader\").leaveModule;\n\n if (!reactHotLoader) {\n return;\n }\n\n reactHotLoader.register(MembersService, 'MembersService', '/Users/thomaskranitsas/Desktop/topcoder-react-lib/src/services/members.js');\n reactHotLoader.register(lastInstance, 'lastInstance', '/Users/thomaskranitsas/Desktop/topcoder-react-lib/src/services/members.js');\n reactHotLoader.register(getService, 'getService', '/Users/thomaskranitsas/Desktop/topcoder-react-lib/src/services/members.js');\n reactHotLoader.register(_default, 'default', '/Users/thomaskranitsas/Desktop/topcoder-react-lib/src/services/members.js');\n leaveModule(module);\n})();\n\n;\n/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../node_modules/webpack/buildin/module.js */ \"./node_modules/webpack/buildin/module.js\")(module)))\n\n//# sourceURL=webpack://topcoder-react-lib/./src/services/members.js?"); +eval("/* WEBPACK VAR INJECTION */(function(module) {\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _assign = __webpack_require__(/*! babel-runtime/core-js/object/assign */ \"babel-runtime/core-js/object/assign\");\n\nvar _assign2 = _interopRequireDefault(_assign);\n\nvar _promise = __webpack_require__(/*! babel-runtime/core-js/promise */ \"babel-runtime/core-js/promise\");\n\nvar _promise2 = _interopRequireDefault(_promise);\n\nvar _defineProperty2 = __webpack_require__(/*! babel-runtime/helpers/defineProperty */ \"babel-runtime/helpers/defineProperty\");\n\nvar _defineProperty3 = _interopRequireDefault(_defineProperty2);\n\nvar _stringify = __webpack_require__(/*! babel-runtime/core-js/json/stringify */ \"babel-runtime/core-js/json/stringify\");\n\nvar _stringify2 = _interopRequireDefault(_stringify);\n\nvar _regenerator = __webpack_require__(/*! babel-runtime/regenerator */ \"babel-runtime/regenerator\");\n\nvar _regenerator2 = _interopRequireDefault(_regenerator);\n\nvar _asyncToGenerator2 = __webpack_require__(/*! babel-runtime/helpers/asyncToGenerator */ \"babel-runtime/helpers/asyncToGenerator\");\n\nvar _asyncToGenerator3 = _interopRequireDefault(_asyncToGenerator2);\n\nvar _classCallCheck2 = __webpack_require__(/*! babel-runtime/helpers/classCallCheck */ \"babel-runtime/helpers/classCallCheck\");\n\nvar _classCallCheck3 = _interopRequireDefault(_classCallCheck2);\n\nvar _createClass2 = __webpack_require__(/*! babel-runtime/helpers/createClass */ \"babel-runtime/helpers/createClass\");\n\nvar _createClass3 = _interopRequireDefault(_createClass2);\n\nexports.getService = getService;\n\nvar _lodash = __webpack_require__(/*! lodash */ \"lodash\");\n\nvar _lodash2 = _interopRequireDefault(_lodash);\n\nvar _qs = __webpack_require__(/*! qs */ \"qs\");\n\nvar _qs2 = _interopRequireDefault(_qs);\n\nvar _logger = __webpack_require__(/*! ../utils/logger */ \"./src/utils/logger.js\");\n\nvar _logger2 = _interopRequireDefault(_logger);\n\nvar _tc = __webpack_require__(/*! ../utils/tc */ \"./src/utils/tc.js\");\n\nvar _api = __webpack_require__(/*! ./api */ \"./src/services/api.js\");\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n(function () {\n var enterModule = __webpack_require__(/*! react-hot-loader */ \"react-hot-loader\").enterModule;\n\n enterModule && enterModule(module);\n})(); /**\n * @module \"services.members\"\n * @desc This module provides a service for searching for Topcoder\n * members via API V3.\n */\n\n/* global XMLHttpRequest */\n\n\n/**\n * Service class.\n */\nvar MembersService = function () {\n /**\n * @param {String} tokenV3 Optional. Auth token for Topcoder API v3.\n */\n function MembersService(tokenV3) {\n (0, _classCallCheck3.default)(this, MembersService);\n\n this.private = {\n api: (0, _api.getApi)('V3', tokenV3),\n tokenV3: tokenV3\n };\n }\n\n /**\n * Gets member's financial information.\n * @param {String} handle User handle.\n * @return {Promise} Resolves to the financial information object.\n */\n\n\n (0, _createClass3.default)(MembersService, [{\n key: 'getMemberFinances',\n value: function () {\n var _ref = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee(handle) {\n var res;\n return _regenerator2.default.wrap(function _callee$(_context) {\n while (1) {\n switch (_context.prev = _context.next) {\n case 0:\n _context.next = 2;\n return this.private.api.get('/members/' + handle + '/financial');\n\n case 2:\n res = _context.sent;\n return _context.abrupt('return', (0, _tc.getApiResponsePayload)(res));\n\n case 4:\n case 'end':\n return _context.stop();\n }\n }\n }, _callee, this);\n }));\n\n function getMemberFinances(_x) {\n return _ref.apply(this, arguments);\n }\n\n return getMemberFinances;\n }()\n\n /**\n * Gets public information on a member.\n *\n * This method does not require any authorization.\n *\n * @param {String} handle Member handle.\n * @return {Promise} Resolves to the data object.\n */\n\n }, {\n key: 'getMemberInfo',\n value: function () {\n var _ref2 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee2(handle) {\n var res;\n return _regenerator2.default.wrap(function _callee2$(_context2) {\n while (1) {\n switch (_context2.prev = _context2.next) {\n case 0:\n _context2.next = 2;\n return this.private.api.get('/members/' + handle);\n\n case 2:\n res = _context2.sent;\n return _context2.abrupt('return', (0, _tc.getApiResponsePayload)(res));\n\n case 4:\n case 'end':\n return _context2.stop();\n }\n }\n }, _callee2, this);\n }));\n\n function getMemberInfo(_x2) {\n return _ref2.apply(this, arguments);\n }\n\n return getMemberInfo;\n }()\n\n /**\n * Gets member external account info.\n * @param {String} handle\n * @return {Promise} Resolves to the stats object.\n */\n\n }, {\n key: 'getExternalAccounts',\n value: function () {\n var _ref3 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee3(handle) {\n var res;\n return _regenerator2.default.wrap(function _callee3$(_context3) {\n while (1) {\n switch (_context3.prev = _context3.next) {\n case 0:\n _context3.next = 2;\n return this.private.api.get('/members/' + handle + '/externalAccounts');\n\n case 2:\n res = _context3.sent;\n return _context3.abrupt('return', (0, _tc.getApiResponsePayload)(res));\n\n case 4:\n case 'end':\n return _context3.stop();\n }\n }\n }, _callee3, this);\n }));\n\n function getExternalAccounts(_x3) {\n return _ref3.apply(this, arguments);\n }\n\n return getExternalAccounts;\n }()\n\n /**\n * Gets member external links.\n * @param {String} handle\n * @return {Promise} Resolves to the stats object.\n */\n\n }, {\n key: 'getExternalLinks',\n value: function () {\n var _ref4 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee4(handle) {\n var res;\n return _regenerator2.default.wrap(function _callee4$(_context4) {\n while (1) {\n switch (_context4.prev = _context4.next) {\n case 0:\n _context4.next = 2;\n return this.private.api.get('/members/' + handle + '/externalLinks');\n\n case 2:\n res = _context4.sent;\n return _context4.abrupt('return', (0, _tc.getApiResponsePayload)(res));\n\n case 4:\n case 'end':\n return _context4.stop();\n }\n }\n }, _callee4, this);\n }));\n\n function getExternalLinks(_x4) {\n return _ref4.apply(this, arguments);\n }\n\n return getExternalLinks;\n }()\n\n /**\n * Gets member skills.\n * @param {String} handle\n * @return {Promise} Resolves to the stats object.\n */\n\n }, {\n key: 'getSkills',\n value: function () {\n var _ref5 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee5(handle) {\n var res;\n return _regenerator2.default.wrap(function _callee5$(_context5) {\n while (1) {\n switch (_context5.prev = _context5.next) {\n case 0:\n _context5.next = 2;\n return this.private.api.get('/members/' + handle + '/skills');\n\n case 2:\n res = _context5.sent;\n return _context5.abrupt('return', (0, _tc.getApiResponsePayload)(res));\n\n case 4:\n case 'end':\n return _context5.stop();\n }\n }\n }, _callee5, this);\n }));\n\n function getSkills(_x5) {\n return _ref5.apply(this, arguments);\n }\n\n return getSkills;\n }()\n\n /**\n * Gets member statistics.\n * @param {String} handle\n * @return {Promise} Resolves to the stats object.\n */\n\n }, {\n key: 'getStats',\n value: function () {\n var _ref6 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee6(handle) {\n var res;\n return _regenerator2.default.wrap(function _callee6$(_context6) {\n while (1) {\n switch (_context6.prev = _context6.next) {\n case 0:\n _context6.next = 2;\n return this.private.api.get('/members/' + handle + '/stats');\n\n case 2:\n res = _context6.sent;\n return _context6.abrupt('return', (0, _tc.getApiResponsePayload)(res));\n\n case 4:\n case 'end':\n return _context6.stop();\n }\n }\n }, _callee6, this);\n }));\n\n function getStats(_x6) {\n return _ref6.apply(this, arguments);\n }\n\n return getStats;\n }()\n\n /**\n * Gets member statistics history\n * @param {String} handle\n * @return {Promise} Resolves to the stats object.\n */\n\n }, {\n key: 'getStatsHistory',\n value: function () {\n var _ref7 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee7(handle) {\n var res;\n return _regenerator2.default.wrap(function _callee7$(_context7) {\n while (1) {\n switch (_context7.prev = _context7.next) {\n case 0:\n _context7.next = 2;\n return this.private.api.get('/members/' + handle + '/stats/history');\n\n case 2:\n res = _context7.sent;\n return _context7.abrupt('return', (0, _tc.getApiResponsePayload)(res));\n\n case 4:\n case 'end':\n return _context7.stop();\n }\n }\n }, _callee7, this);\n }));\n\n function getStatsHistory(_x7) {\n return _ref7.apply(this, arguments);\n }\n\n return getStatsHistory;\n }()\n\n /**\n * Gets member statistics distribution\n * @param {String} handle\n * @param {String} track\n * @param {String} subTrack\n * @return {Promise} Resolves to the stats object.\n */\n\n }, {\n key: 'getStatsDistribution',\n value: function () {\n var _ref8 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee8(handle, track, subTrack) {\n var res;\n return _regenerator2.default.wrap(function _callee8$(_context8) {\n while (1) {\n switch (_context8.prev = _context8.next) {\n case 0:\n _context8.next = 2;\n return this.private.api.get('/members/stats/distribution?filter=' + encodeURIComponent(_qs2.default.stringify({\n track: track,\n subTrack: subTrack\n })));\n\n case 2:\n res = _context8.sent;\n return _context8.abrupt('return', (0, _tc.getApiResponsePayload)(res));\n\n case 4:\n case 'end':\n return _context8.stop();\n }\n }\n }, _callee8, this);\n }));\n\n function getStatsDistribution(_x8, _x9, _x10) {\n return _ref8.apply(this, arguments);\n }\n\n return getStatsDistribution;\n }()\n\n /**\n * Gets a list of suggested member names for the supplied partial.\n *\n * WARNING: This method requires v3 authorization.\n *\n * @param {String} keyword Partial string to find suggestions for\n * @return {Promise} Resolves to the api response content\n */\n\n }, {\n key: 'getMemberSuggestions',\n value: function () {\n var _ref9 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee9(keyword) {\n var res;\n return _regenerator2.default.wrap(function _callee9$(_context9) {\n while (1) {\n switch (_context9.prev = _context9.next) {\n case 0:\n _context9.next = 2;\n return this.private.api.get('/members/_suggest/' + keyword);\n\n case 2:\n res = _context9.sent;\n return _context9.abrupt('return', (0, _tc.getApiResponsePayload)(res));\n\n case 4:\n case 'end':\n return _context9.stop();\n }\n }\n }, _callee9, this);\n }));\n\n function getMemberSuggestions(_x11) {\n return _ref9.apply(this, arguments);\n }\n\n return getMemberSuggestions;\n }()\n\n /**\n * Adds external web link for member.\n * @param {String} userHandle The user handle\n * @param {String} webLink The external web link\n * @return {Promise} Resolves to the api response content\n */\n\n }, {\n key: 'addWebLink',\n value: function () {\n var _ref10 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee10(userHandle, webLink) {\n var res;\n return _regenerator2.default.wrap(function _callee10$(_context10) {\n while (1) {\n switch (_context10.prev = _context10.next) {\n case 0:\n _context10.next = 2;\n return this.private.api.postJson('/members/' + userHandle + '/externalLinks', { param: { url: webLink } });\n\n case 2:\n res = _context10.sent;\n return _context10.abrupt('return', (0, _tc.getApiResponsePayload)(res));\n\n case 4:\n case 'end':\n return _context10.stop();\n }\n }\n }, _callee10, this);\n }));\n\n function addWebLink(_x12, _x13) {\n return _ref10.apply(this, arguments);\n }\n\n return addWebLink;\n }()\n\n /**\n * Deletes external web link for member.\n * @param {String} userHandle The user handle\n * @param {String} webLinkHandle The external web link handle\n * @return {Promise} Resolves to the api response content\n */\n\n }, {\n key: 'deleteWebLink',\n value: function () {\n var _ref11 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee11(userHandle, webLinkHandle) {\n var body, res;\n return _regenerator2.default.wrap(function _callee11$(_context11) {\n while (1) {\n switch (_context11.prev = _context11.next) {\n case 0:\n body = {\n param: {\n handle: webLinkHandle\n }\n };\n _context11.next = 3;\n return this.private.api.delete('/members/' + userHandle + '/externalLinks/' + webLinkHandle, (0, _stringify2.default)(body));\n\n case 3:\n res = _context11.sent;\n return _context11.abrupt('return', (0, _tc.getApiResponsePayload)(res));\n\n case 5:\n case 'end':\n return _context11.stop();\n }\n }\n }, _callee11, this);\n }));\n\n function deleteWebLink(_x14, _x15) {\n return _ref11.apply(this, arguments);\n }\n\n return deleteWebLink;\n }()\n\n /**\n * Adds user skill.\n * @param {String} handle Topcoder user handle\n * @param {Number} skillTagId Skill tag id\n * @return {Promise} Resolves to operation result\n */\n\n }, {\n key: 'addSkill',\n value: function () {\n var _ref12 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee12(handle, skillTagId) {\n var body, res;\n return _regenerator2.default.wrap(function _callee12$(_context12) {\n while (1) {\n switch (_context12.prev = _context12.next) {\n case 0:\n body = {\n param: {\n skills: (0, _defineProperty3.default)({}, skillTagId, {\n hidden: false\n })\n }\n };\n _context12.next = 3;\n return this.private.api.patchJson('/members/' + handle + '/skills', body);\n\n case 3:\n res = _context12.sent;\n return _context12.abrupt('return', (0, _tc.getApiResponsePayload)(res));\n\n case 5:\n case 'end':\n return _context12.stop();\n }\n }\n }, _callee12, this);\n }));\n\n function addSkill(_x16, _x17) {\n return _ref12.apply(this, arguments);\n }\n\n return addSkill;\n }()\n\n /**\n * Hides user skill.\n * @param {String} handle Topcoder user handle\n * @param {Number} skillTagId Skill tag id\n * @return {Promise} Resolves to operation result\n */\n\n }, {\n key: 'hideSkill',\n value: function () {\n var _ref13 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee13(handle, skillTagId) {\n var body, res;\n return _regenerator2.default.wrap(function _callee13$(_context13) {\n while (1) {\n switch (_context13.prev = _context13.next) {\n case 0:\n body = {\n param: {\n skills: (0, _defineProperty3.default)({}, skillTagId, {\n hidden: true\n })\n }\n };\n _context13.next = 3;\n return this.private.api.fetch('/members/' + handle + '/skills', {\n body: (0, _stringify2.default)(body),\n method: 'PATCH'\n });\n\n case 3:\n res = _context13.sent;\n return _context13.abrupt('return', (0, _tc.getApiResponsePayload)(res));\n\n case 5:\n case 'end':\n return _context13.stop();\n }\n }\n }, _callee13, this);\n }));\n\n function hideSkill(_x18, _x19) {\n return _ref13.apply(this, arguments);\n }\n\n return hideSkill;\n }()\n\n /**\n * Updates member profile.\n * @param {Object} profile The profile to update.\n * @return {Promise} Resolves to the api response content\n */\n\n }, {\n key: 'updateMemberProfile',\n value: function () {\n var _ref14 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee14(profile) {\n var url, res;\n return _regenerator2.default.wrap(function _callee14$(_context14) {\n while (1) {\n switch (_context14.prev = _context14.next) {\n case 0:\n url = profile.verifyUrl ? '/members/' + profile.handle + '?verifyUrl=' + profile.verifyUrl : '/members/' + profile.handle;\n _context14.next = 3;\n return this.private.api.putJson(url, { param: profile.verifyUrl ? _lodash2.default.omit(profile, ['verifyUrl']) : profile });\n\n case 3:\n res = _context14.sent;\n\n if (!(profile.verifyUrl && res.status === 409)) {\n _context14.next = 6;\n break;\n }\n\n return _context14.abrupt('return', _promise2.default.resolve((0, _assign2.default)({}, profile, { isEmailConflict: true })));\n\n case 6:\n return _context14.abrupt('return', (0, _tc.getApiResponsePayload)(res));\n\n case 7:\n case 'end':\n return _context14.stop();\n }\n }\n }, _callee14, this);\n }));\n\n function updateMemberProfile(_x20) {\n return _ref14.apply(this, arguments);\n }\n\n return updateMemberProfile;\n }()\n\n /**\n * Gets presigned url for member photo file.\n * @param {String} userHandle The user handle\n * @param {File} file The file to get its presigned url\n * @return {Promise} Resolves to the api response content\n */\n\n }, {\n key: 'getPresignedUrl',\n value: function () {\n var _ref15 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee15(userHandle, file) {\n var res, payload;\n return _regenerator2.default.wrap(function _callee15$(_context15) {\n while (1) {\n switch (_context15.prev = _context15.next) {\n case 0:\n _context15.next = 2;\n return this.private.api.postJson('/members/' + userHandle + '/photoUploadUrl', { param: { contentType: file.type } });\n\n case 2:\n res = _context15.sent;\n _context15.next = 5;\n return (0, _tc.getApiResponsePayload)(res);\n\n case 5:\n payload = _context15.sent;\n return _context15.abrupt('return', {\n preSignedURL: payload.preSignedURL,\n token: payload.token,\n file: file,\n userHandle: userHandle\n });\n\n case 7:\n case 'end':\n return _context15.stop();\n }\n }\n }, _callee15, this);\n }));\n\n function getPresignedUrl(_x21, _x22) {\n return _ref15.apply(this, arguments);\n }\n\n return getPresignedUrl;\n }()\n\n /**\n * Updates member photo.\n * @param {Object} S3Response The response from uploadFileToS3() function.\n * @return {Promise} Resolves to the api response content\n */\n\n }, {\n key: 'updateMemberPhoto',\n value: function () {\n var _ref16 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee16(S3Response) {\n var res;\n return _regenerator2.default.wrap(function _callee16$(_context16) {\n while (1) {\n switch (_context16.prev = _context16.next) {\n case 0:\n _context16.next = 2;\n return this.private.api.putJson('/members/' + S3Response.userHandle + '/photo', { param: S3Response.body });\n\n case 2:\n res = _context16.sent;\n return _context16.abrupt('return', (0, _tc.getApiResponsePayload)(res));\n\n case 4:\n case 'end':\n return _context16.stop();\n }\n }\n }, _callee16, this);\n }));\n\n function updateMemberPhoto(_x23) {\n return _ref16.apply(this, arguments);\n }\n\n return updateMemberPhoto;\n }()\n\n /**\n * Uploads file to S3.\n * @param {Object} presignedUrlResponse The presigned url response from\n * getPresignedUrl() function.\n * @return {Promise} Resolves to the api response content\n */\n\n }, {\n key: 'uploadFileToS3',\n value: function uploadFileToS3(presignedUrlResponse) {\n _lodash2.default.noop(this);\n return new _promise2.default(function (resolve, reject) {\n var xhr = new XMLHttpRequest();\n\n xhr.open('PUT', presignedUrlResponse.preSignedURL, true);\n xhr.setRequestHeader('Content-Type', presignedUrlResponse.file.type);\n\n xhr.onreadystatechange = function () {\n var status = xhr.status;\n\n if ((status >= 200 && status < 300 || status === 304) && xhr.readyState === 4) {\n resolve({\n userHandle: presignedUrlResponse.userHandle,\n body: {\n token: presignedUrlResponse.token,\n contentType: presignedUrlResponse.file.type\n }\n });\n } else if (status >= 400) {\n var err = new Error('Could not upload image to S3');\n err.status = status;\n reject(err);\n }\n };\n\n xhr.onerror = function (err) {\n _logger2.default.error('Could not upload image to S3', err);\n\n reject(err);\n };\n\n xhr.send(presignedUrlResponse.file);\n });\n }\n\n /**\n * Verify member new email\n * @param {String} handle handle Topcoder user handle\n * @param {String} emailVerifyToken The verify token of new email\n * @returns {Promise} Resolves to the api response content\n */\n\n }, {\n key: 'verifyMemberNewEmail',\n value: function () {\n var _ref17 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee17(handle, emailVerifyToken) {\n var res;\n return _regenerator2.default.wrap(function _callee17$(_context17) {\n while (1) {\n switch (_context17.prev = _context17.next) {\n case 0:\n _context17.next = 2;\n return this.private.api.get('/members/' + handle + '/verify?token=' + emailVerifyToken);\n\n case 2:\n res = _context17.sent;\n return _context17.abrupt('return', (0, _tc.getApiResponsePayload)(res));\n\n case 4:\n case 'end':\n return _context17.stop();\n }\n }\n }, _callee17, this);\n }));\n\n function verifyMemberNewEmail(_x24, _x25) {\n return _ref17.apply(this, arguments);\n }\n\n return verifyMemberNewEmail;\n }()\n\n /**\n * Get members information\n * @param {Array} userIds the member ids\n */\n\n }, {\n key: 'getMembersInformation',\n value: function () {\n var _ref18 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee18(userIds) {\n var query, limit, url, res;\n return _regenerator2.default.wrap(function _callee18$(_context18) {\n while (1) {\n switch (_context18.prev = _context18.next) {\n case 0:\n query = 'query=' + encodeURI(_lodash2.default.map(userIds, function (id) {\n return 'userId:' + id;\n }).join(' OR '));\n limit = 'limit=' + userIds.length;\n url = '/members/_search?fields=userId%2Chandle%2CphotoURL%2CfirstName%2ClastName&' + query + '&' + limit;\n _context18.next = 5;\n return this.private.api.get(url);\n\n case 5:\n res = _context18.sent;\n return _context18.abrupt('return', (0, _tc.getApiResponsePayload)(res));\n\n case 7:\n case 'end':\n return _context18.stop();\n }\n }\n }, _callee18, this);\n }));\n\n function getMembersInformation(_x26) {\n return _ref18.apply(this, arguments);\n }\n\n return getMembersInformation;\n }()\n }, {\n key: '__reactstandin__regenerateByEval',\n // @ts-ignore\n value: function __reactstandin__regenerateByEval(key, code) {\n // @ts-ignore\n this[key] = eval(code);\n }\n }]);\n return MembersService;\n}();\n\nvar lastInstance = null;\n/**\n * Returns a new or existing members service.\n * @param {String} tokenV3 Optional. Auth token for Topcoder API v3.\n * @return {MembersService} Members service object\n */\nfunction getService(tokenV3) {\n if (!lastInstance || tokenV3 !== lastInstance.private.tokenV3) {\n lastInstance = new MembersService(tokenV3);\n }\n return lastInstance;\n}\n\n/* Using default export would be confusing in this case. */\nvar _default = undefined;\nexports.default = _default;\n;\n\n(function () {\n var reactHotLoader = __webpack_require__(/*! react-hot-loader */ \"react-hot-loader\").default;\n\n var leaveModule = __webpack_require__(/*! react-hot-loader */ \"react-hot-loader\").leaveModule;\n\n if (!reactHotLoader) {\n return;\n }\n\n reactHotLoader.register(MembersService, 'MembersService', '/Users/thomaskranitsas/Desktop/topcoder-react-lib/src/services/members.js');\n reactHotLoader.register(lastInstance, 'lastInstance', '/Users/thomaskranitsas/Desktop/topcoder-react-lib/src/services/members.js');\n reactHotLoader.register(getService, 'getService', '/Users/thomaskranitsas/Desktop/topcoder-react-lib/src/services/members.js');\n reactHotLoader.register(_default, 'default', '/Users/thomaskranitsas/Desktop/topcoder-react-lib/src/services/members.js');\n leaveModule(module);\n})();\n\n;\n/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../node_modules/webpack/buildin/module.js */ \"./node_modules/webpack/buildin/module.js\")(module)))\n\n//# sourceURL=webpack://topcoder-react-lib/./src/services/members.js?"); /***/ }), @@ -1046,6 +1054,18 @@ eval("/* WEBPACK VAR INJECTION */(function(module) {\n\nObject.defineProperty(ex /***/ }), +/***/ "./src/services/submissions.js": +/*!*************************************!*\ + !*** ./src/services/submissions.js ***! + \*************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +eval("/* WEBPACK VAR INJECTION */(function(module) {\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _regenerator = __webpack_require__(/*! babel-runtime/regenerator */ \"babel-runtime/regenerator\");\n\nvar _regenerator2 = _interopRequireDefault(_regenerator);\n\nvar _extends2 = __webpack_require__(/*! babel-runtime/helpers/extends */ \"babel-runtime/helpers/extends\");\n\nvar _extends3 = _interopRequireDefault(_extends2);\n\nvar _asyncToGenerator2 = __webpack_require__(/*! babel-runtime/helpers/asyncToGenerator */ \"babel-runtime/helpers/asyncToGenerator\");\n\nvar _asyncToGenerator3 = _interopRequireDefault(_asyncToGenerator2);\n\nvar _classCallCheck2 = __webpack_require__(/*! babel-runtime/helpers/classCallCheck */ \"babel-runtime/helpers/classCallCheck\");\n\nvar _classCallCheck3 = _interopRequireDefault(_classCallCheck2);\n\nvar _createClass2 = __webpack_require__(/*! babel-runtime/helpers/createClass */ \"babel-runtime/helpers/createClass\");\n\nvar _createClass3 = _interopRequireDefault(_createClass2);\n\nexports.getService = getService;\n\nvar _qs = __webpack_require__(/*! qs */ \"qs\");\n\nvar _qs2 = _interopRequireDefault(_qs);\n\nvar _api = __webpack_require__(/*! ./api */ \"./src/services/api.js\");\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n(function () {\n var enterModule = __webpack_require__(/*! react-hot-loader */ \"react-hot-loader\").enterModule;\n\n enterModule && enterModule(module);\n})(); /**\n * @module \"services.submission\"\n * @desc This module provides a service for convenient manipulation with\n * Topcoder submissions via TC API. Currently only used for MM challenges\n */\n\n/**\n * Submission service.\n */\nvar SubmissionsService = function () {\n /**\n * Creates a new SubmissionService instance.\n * @param {String} tokenV3 Optional. Auth token for Topcoder API v3.\n */\n function SubmissionsService(tokenV3) {\n (0, _classCallCheck3.default)(this, SubmissionsService);\n\n this.private = {\n apiV5: (0, _api.getApi)('V5', tokenV3),\n tokenV3: tokenV3\n };\n }\n\n /**\n * Get submissions of challenge\n * @param {Object} filters\n * @param {Object} params\n * @return {Promise} Resolves to the api response.\n */\n\n\n (0, _createClass3.default)(SubmissionsService, [{\n key: 'getSubmissions',\n value: function () {\n var _ref = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee(filters, params) {\n var query, url;\n return _regenerator2.default.wrap(function _callee$(_context) {\n while (1) {\n switch (_context.prev = _context.next) {\n case 0:\n query = (0, _extends3.default)({}, filters, params);\n url = '/submissions?' + _qs2.default.stringify(query, { encode: false });\n return _context.abrupt('return', this.private.apiV5.get(url).then(function (res) {\n return res.ok ? res.json() : new Error(res.statusText);\n }).then(function (res) {\n return res;\n }));\n\n case 3:\n case 'end':\n return _context.stop();\n }\n }\n }, _callee, this);\n }));\n\n function getSubmissions(_x, _x2) {\n return _ref.apply(this, arguments);\n }\n\n return getSubmissions;\n }()\n }, {\n key: '__reactstandin__regenerateByEval',\n // @ts-ignore\n value: function __reactstandin__regenerateByEval(key, code) {\n // @ts-ignore\n this[key] = eval(code);\n }\n }]);\n return SubmissionsService;\n}();\n\nvar lastInstance = null;\n/**\n * Returns a new or existing submissions service.\n * @param {String} tokenV3 Optional. Auth token for Topcoder API v3.\n * @return {SubmissionsService} Submissions service object\n */\nfunction getService(tokenV3) {\n if (!lastInstance || lastInstance.private.tokenV3 !== tokenV3) {\n lastInstance = new SubmissionsService(tokenV3);\n }\n return lastInstance;\n}\n\n/* Using default export would be confusing in this case. */\nvar _default = undefined;\nexports.default = _default;\n;\n\n(function () {\n var reactHotLoader = __webpack_require__(/*! react-hot-loader */ \"react-hot-loader\").default;\n\n var leaveModule = __webpack_require__(/*! react-hot-loader */ \"react-hot-loader\").leaveModule;\n\n if (!reactHotLoader) {\n return;\n }\n\n reactHotLoader.register(SubmissionsService, 'SubmissionsService', '/Users/thomaskranitsas/Desktop/topcoder-react-lib/src/services/submissions.js');\n reactHotLoader.register(lastInstance, 'lastInstance', '/Users/thomaskranitsas/Desktop/topcoder-react-lib/src/services/submissions.js');\n reactHotLoader.register(getService, 'getService', '/Users/thomaskranitsas/Desktop/topcoder-react-lib/src/services/submissions.js');\n reactHotLoader.register(_default, 'default', '/Users/thomaskranitsas/Desktop/topcoder-react-lib/src/services/submissions.js');\n leaveModule(module);\n})();\n\n;\n/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../node_modules/webpack/buildin/module.js */ \"./node_modules/webpack/buildin/module.js\")(module)))\n\n//# sourceURL=webpack://topcoder-react-lib/./src/services/submissions.js?"); + +/***/ }), + /***/ "./src/services/terms.js": /*!*******************************!*\ !*** ./src/services/terms.js ***! @@ -1150,7 +1170,11 @@ eval("/* WEBPACK VAR INJECTION */(function(module) {\n\nObject.defineProperty(ex /***/ (function(module, exports, __webpack_require__) { "use strict"; +<<<<<<< HEAD +eval("/* WEBPACK VAR INJECTION */(function(module) {\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.submission = exports.errors = exports.mock = exports.time = exports.tc = exports.logger = exports.challenge = undefined;\n\nvar _logger = __webpack_require__(/*! ./logger */ \"./src/utils/logger.js\");\n\nvar _logger2 = _interopRequireDefault(_logger);\n\nvar _tc = __webpack_require__(/*! ./tc */ \"./src/utils/tc.js\");\n\nvar tc = _interopRequireWildcard(_tc);\n\nvar _time = __webpack_require__(/*! ./time */ \"./src/utils/time.js\");\n\nvar time = _interopRequireWildcard(_time);\n\nvar _mock = __webpack_require__(/*! ./mock */ \"./src/utils/mock.js\");\n\nvar mock = _interopRequireWildcard(_mock);\n\nvar _errors = __webpack_require__(/*! ./errors */ \"./src/utils/errors.js\");\n\nvar errors = _interopRequireWildcard(_errors);\n\nvar _filter = __webpack_require__(/*! ./challenge/filter */ \"./src/utils/challenge/filter.js\");\n\nvar filter = _interopRequireWildcard(_filter);\n\nvar _submission = __webpack_require__(/*! ./submission */ \"./src/utils/submission.js\");\n\nvar submission = _interopRequireWildcard(_submission);\n\nfunction _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; } }\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n(function () {\n var enterModule = __webpack_require__(/*! react-hot-loader */ \"react-hot-loader\").enterModule;\n\n enterModule && enterModule(module);\n})(); /**\n * Export utils.\n */\n\n\nvar challenge = {\n filter: filter\n};\n\nexports.challenge = challenge;\nexports.logger = _logger2.default;\nexports.tc = tc;\nexports.time = time;\nexports.mock = mock;\nexports.errors = errors;\nexports.submission = submission;\n;\n\n(function () {\n var reactHotLoader = __webpack_require__(/*! react-hot-loader */ \"react-hot-loader\").default;\n\n var leaveModule = __webpack_require__(/*! react-hot-loader */ \"react-hot-loader\").leaveModule;\n\n if (!reactHotLoader) {\n return;\n }\n\n reactHotLoader.register(challenge, 'challenge', '/Users/thomaskranitsas/Desktop/topcoder-react-lib/src/utils/index.js');\n leaveModule(module);\n})();\n\n;\n/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../node_modules/webpack/buildin/module.js */ \"./node_modules/webpack/buildin/module.js\")(module)))\n\n//# sourceURL=webpack://topcoder-react-lib/./src/utils/index.js?"); +======= eval("/* WEBPACK VAR INJECTION */(function(module) {\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.url = exports.errors = exports.mock = exports.time = exports.tc = exports.logger = exports.challenge = undefined;\n\nvar _logger = __webpack_require__(/*! ./logger */ \"./src/utils/logger.js\");\n\nvar _logger2 = _interopRequireDefault(_logger);\n\nvar _tc = __webpack_require__(/*! ./tc */ \"./src/utils/tc.js\");\n\nvar tc = _interopRequireWildcard(_tc);\n\nvar _time = __webpack_require__(/*! ./time */ \"./src/utils/time.js\");\n\nvar time = _interopRequireWildcard(_time);\n\nvar _mock = __webpack_require__(/*! ./mock */ \"./src/utils/mock.js\");\n\nvar mock = _interopRequireWildcard(_mock);\n\nvar _errors = __webpack_require__(/*! ./errors */ \"./src/utils/errors.js\");\n\nvar errors = _interopRequireWildcard(_errors);\n\nvar _filter = __webpack_require__(/*! ./challenge/filter */ \"./src/utils/challenge/filter.js\");\n\nvar filter = _interopRequireWildcard(_filter);\n\nvar _buckets = __webpack_require__(/*! ./challenge/buckets */ \"./src/utils/challenge/buckets.js\");\n\nvar buckets = _interopRequireWildcard(_buckets);\n\nvar _sort = __webpack_require__(/*! ./challenge/sort */ \"./src/utils/challenge/sort.js\");\n\nvar sort = _interopRequireWildcard(_sort);\n\nvar _url = __webpack_require__(/*! ./url */ \"./src/utils/url.js\");\n\nvar url = _interopRequireWildcard(_url);\n\nfunction _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; } }\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n(function () {\n var enterModule = __webpack_require__(/*! react-hot-loader */ \"react-hot-loader\").enterModule;\n\n enterModule && enterModule(module);\n})(); /**\n * Export utils.\n */\n\n\nvar challenge = {\n filter: filter,\n buckets: buckets,\n sort: sort\n};\n\nexports.challenge = challenge;\nexports.logger = _logger2.default;\nexports.tc = tc;\nexports.time = time;\nexports.mock = mock;\nexports.errors = errors;\nexports.url = url;\n;\n\n(function () {\n var reactHotLoader = __webpack_require__(/*! react-hot-loader */ \"react-hot-loader\").default;\n\n var leaveModule = __webpack_require__(/*! react-hot-loader */ \"react-hot-loader\").leaveModule;\n\n if (!reactHotLoader) {\n return;\n }\n\n reactHotLoader.register(challenge, 'challenge', '/Users/thomaskranitsas/Desktop/topcoder-react-lib/src/utils/index.js');\n leaveModule(module);\n})();\n\n;\n/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../node_modules/webpack/buildin/module.js */ \"./node_modules/webpack/buildin/module.js\")(module)))\n\n//# sourceURL=webpack://topcoder-react-lib/./src/utils/index.js?"); +>>>>>>> origin/ssf /***/ }), @@ -1178,6 +1202,18 @@ eval("/* WEBPACK VAR INJECTION */(function(module) {\n\nObject.defineProperty(ex /***/ }), +/***/ "./src/utils/submission.js": +/*!*********************************!*\ + !*** ./src/utils/submission.js ***! + \*********************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +eval("/* WEBPACK VAR INJECTION */(function(module) {\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _toConsumableArray2 = __webpack_require__(/*! babel-runtime/helpers/toConsumableArray */ \"babel-runtime/helpers/toConsumableArray\");\n\nvar _toConsumableArray3 = _interopRequireDefault(_toConsumableArray2);\n\nexports.getProvisionalScore = getProvisionalScore;\nexports.getFinalScore = getFinalScore;\nexports.processMMSubmissions = processMMSubmissions;\n\nvar _lodash = __webpack_require__(/*! lodash */ \"lodash\");\n\nvar _lodash2 = _interopRequireDefault(_lodash);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n(function () {\n var enterModule = __webpack_require__(/*! react-hot-loader */ \"react-hot-loader\").enterModule;\n\n enterModule && enterModule(module);\n})(); /**\n * Various submissions functions.\n */\n/* global CONFIG */\n/* eslint-disable no-param-reassign */\n\n\nvar _CONFIG = {\"AV_SCAN_SCORER_REVIEW_TYPE_ID\":\"68c5a381-c8ab-48af-92a7-7a869a4ee6c3\",\"PAGE_SIZE\":50,\"REVIEW_OPPORTUNITY_PAGE_SIZE\":1000},\n AV_SCAN_SCORER_REVIEW_TYPE_ID = _CONFIG.AV_SCAN_SCORER_REVIEW_TYPE_ID;\n\n\nfunction round(num, decimal) {\n if (_lodash2.default.isNaN(num)) {\n return 0;\n }\n var p1 = Math.pow(10, decimal + 1);\n var p2 = Math.pow(10, decimal);\n return Math.round(num * p1 / 10) / p2;\n}\n\nfunction removeDecimal(num, decimal) {\n return (num % decimal + decimal) % decimal;\n}\n\nfunction toFixed(num, decimal) {\n var result = _lodash2.default.toFinite(round(num, decimal).toFixed(decimal));\n var integerResult = _lodash2.default.toFinite(removeDecimal(result, decimal));\n if (_lodash2.default.isInteger(integerResult)) {\n return integerResult;\n }\n return result;\n}\n\nfunction getMMChallengeHandleStyle(handle, registrants) {\n var style = _lodash2.default.get(_lodash2.default.find(registrants, function (m) {\n return m.handle === handle;\n }), 'colorStyle', null);\n if (style) return JSON.parse(style.replace(/(\\w+):\\s*([^;]*)/g, '{\"$1\": \"$2\"}'));\n return {};\n}\n\n/**\n * Process each submission rank of MM challenge\n * @param submissions the array of submissions\n */\nfunction processRanks(submissions) {\n var maxFinalScore = 0;\n submissions.sort(function (a, b) {\n var pA = _lodash2.default.get(a, 'submissions[0]', { provisionalScore: 0 }).provisionalScore;\n var pB = _lodash2.default.get(b, 'submissions[0]', { provisionalScore: 0 }).provisionalScore;\n if (pA === '-') pA = 0;\n if (pB === '-') pB = 0;\n if (pA === pB) {\n var timeA = new Date(_lodash2.default.get(a, 'submissions[0].submissionTime'));\n var timeB = new Date(_lodash2.default.get(b, 'submissions[0].submissionTime'));\n return timeA - timeB;\n }\n return pB - pA;\n });\n _lodash2.default.each(submissions, function (submission, i) {\n submissions[i].provisionalRank = i + 1;\n });\n\n submissions.sort(function (a, b) {\n var pA = _lodash2.default.get(a, 'submissions[0]', { finalScore: 0 }).finalScore;\n var pB = _lodash2.default.get(b, 'submissions[0]', { finalScore: 0 }).finalScore;\n if (pA === '-') pA = 0;\n if (pB === '-') pB = 0;\n if (pA > 0) maxFinalScore = pA;\n if (pB > 0) maxFinalScore = pB;\n if (pA === pB) {\n var timeA = new Date(_lodash2.default.get(a, 'submissions[0].submissionTime'));\n var timeB = new Date(_lodash2.default.get(b, 'submissions[0].submissionTime'));\n return timeA - timeB;\n }\n return pB - pA;\n });\n if (maxFinalScore > 0) {\n _lodash2.default.each(submissions, function (submission, i) {\n submissions[i].finalRank = i + 1;\n });\n }\n return { submissions: submissions, maxFinalScore: maxFinalScore };\n}\n\n/**\n * Get provisional score of submission\n * @param submission\n */\nfunction getProvisionalScore(submission) {\n var subs = submission.submissions;\n\n if (!subs || subs.length === 0) {\n return 0;\n }\n var provisionalScore = subs[0].provisionalScore;\n\n if (!provisionalScore || provisionalScore < 0) {\n return 0;\n }\n return provisionalScore;\n}\n\n/**\n * Get final score of submission\n * @param submission\n */\nfunction getFinalScore(submission) {\n var subs = submission.submissions;\n\n if (!subs || subs.length === 0) {\n return 0;\n }\n var finalScore = subs[0].finalScore;\n\n if (!finalScore || finalScore < 0) {\n return 0;\n }\n return finalScore;\n}\n\n/**\n * Process submissions of MM challenge\n * @param submissions the array of submissions\n * @param resources the challenge resources\n * @param registrants the challenge registrants\n */\nfunction processMMSubmissions(submissions, resources, registrants) {\n var data = {};\n var result = [];\n\n _lodash2.default.each(submissions, function (submission) {\n var memberId = submission.memberId;\n\n var memberHandle = void 0;\n var resource = _lodash2.default.find(resources, function (r) {\n return _lodash2.default.get(r, 'userId').toString() === memberId.toString();\n });\n if (_lodash2.default.isEmpty(resource)) {\n memberHandle = memberId;\n } else {\n memberHandle = _lodash2.default.has(resource, 'handle') ? _lodash2.default.get(resource, 'handle') : memberId.toString();\n }\n if (!data[memberHandle]) {\n data[memberHandle] = [];\n }\n var validReviews = _lodash2.default.filter(submission.review, function (r) {\n return !_lodash2.default.isEmpty(r) && r.typeId !== AV_SCAN_SCORER_REVIEW_TYPE_ID;\n });\n validReviews.sort(function (a, b) {\n var dateA = new Date(a.created);\n var dateB = new Date(b.created);\n return dateB - dateA;\n });\n\n var provisionalScore = toFixed(parseFloat(_lodash2.default.get(validReviews, '[0].score', '-')), 5);\n var finalScore = toFixed(parseFloat(_lodash2.default.get(submission, 'reviewSummation[0].aggregateScore', '-')), 5);\n\n data[memberHandle].push({\n submissionId: submission.id,\n submissionTime: submission.created,\n provisionalScore: provisionalScore,\n finalScore: finalScore\n });\n });\n\n _lodash2.default.each(data, function (value, key) {\n result.push({\n submissions: [].concat((0, _toConsumableArray3.default)(value.sort(function (a, b) {\n return new Date(b.submissionTime).getTime() - new Date(a.submissionTime).getTime();\n }))),\n member: key,\n colorStyle: getMMChallengeHandleStyle(key, registrants)\n });\n });\n\n var _processRanks = processRanks(result),\n finalSubmissions = _processRanks.submissions,\n maxFinalScore = _processRanks.maxFinalScore;\n\n finalSubmissions.sort(function (a, b) {\n if (maxFinalScore === 0) {\n return a.provisionalRank - b.provisionalRank;\n }\n return a.finalRank - b.finalRank;\n });\n\n return finalSubmissions;\n}\n\nvar _default = undefined;\nexports.default = _default;\n;\n\n(function () {\n var reactHotLoader = __webpack_require__(/*! react-hot-loader */ \"react-hot-loader\").default;\n\n var leaveModule = __webpack_require__(/*! react-hot-loader */ \"react-hot-loader\").leaveModule;\n\n if (!reactHotLoader) {\n return;\n }\n\n reactHotLoader.register(AV_SCAN_SCORER_REVIEW_TYPE_ID, 'AV_SCAN_SCORER_REVIEW_TYPE_ID', '/Users/thomaskranitsas/Desktop/topcoder-react-lib/src/utils/submission.js');\n reactHotLoader.register(round, 'round', '/Users/thomaskranitsas/Desktop/topcoder-react-lib/src/utils/submission.js');\n reactHotLoader.register(removeDecimal, 'removeDecimal', '/Users/thomaskranitsas/Desktop/topcoder-react-lib/src/utils/submission.js');\n reactHotLoader.register(toFixed, 'toFixed', '/Users/thomaskranitsas/Desktop/topcoder-react-lib/src/utils/submission.js');\n reactHotLoader.register(getMMChallengeHandleStyle, 'getMMChallengeHandleStyle', '/Users/thomaskranitsas/Desktop/topcoder-react-lib/src/utils/submission.js');\n reactHotLoader.register(processRanks, 'processRanks', '/Users/thomaskranitsas/Desktop/topcoder-react-lib/src/utils/submission.js');\n reactHotLoader.register(getProvisionalScore, 'getProvisionalScore', '/Users/thomaskranitsas/Desktop/topcoder-react-lib/src/utils/submission.js');\n reactHotLoader.register(getFinalScore, 'getFinalScore', '/Users/thomaskranitsas/Desktop/topcoder-react-lib/src/utils/submission.js');\n reactHotLoader.register(processMMSubmissions, 'processMMSubmissions', '/Users/thomaskranitsas/Desktop/topcoder-react-lib/src/utils/submission.js');\n reactHotLoader.register(_default, 'default', '/Users/thomaskranitsas/Desktop/topcoder-react-lib/src/utils/submission.js');\n leaveModule(module);\n})();\n\n;\n/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../node_modules/webpack/buildin/module.js */ \"./node_modules/webpack/buildin/module.js\")(module)))\n\n//# sourceURL=webpack://topcoder-react-lib/./src/utils/submission.js?"); + +/***/ }), + /***/ "./src/utils/tc.js": /*!*************************!*\ !*** ./src/utils/tc.js ***! diff --git a/dist/prod/index.js b/dist/prod/index.js new file mode 100644 index 00000000..941708b4 --- /dev/null +++ b/dist/prod/index.js @@ -0,0 +1,6 @@ +!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("lodash"),require("babel-runtime/core-js/promise"),require("redux-actions"),require("babel-runtime/helpers/extends"),require("babel-runtime/regenerator"),require("babel-runtime/helpers/asyncToGenerator"),require("babel-runtime/helpers/defineProperty"),require("babel-runtime/helpers/classCallCheck"),require("babel-runtime/helpers/createClass"),require("topcoder-react-utils"),require("qs"),require("babel-runtime/core-js/json/stringify"),require("babel-runtime/helpers/slicedToArray"),require("babel-runtime/helpers/toConsumableArray"),require("tc-accounts"),require("moment"),require("babel-runtime/core-js/set"),require("isomorphic-fetch"),require("babel-runtime/core-js/object/keys"),require("moment-duration-format"),require("babel-runtime/core-js/set-immediate"),require("le_node"),require("babel-runtime/core-js/object/assign"),require("to-capital-case"),require("babel-runtime/core-js/object/values")):"function"==typeof define&&define.amd?define(["lodash","babel-runtime/core-js/promise","redux-actions","babel-runtime/helpers/extends","babel-runtime/regenerator","babel-runtime/helpers/asyncToGenerator","babel-runtime/helpers/defineProperty","babel-runtime/helpers/classCallCheck","babel-runtime/helpers/createClass","topcoder-react-utils","qs","babel-runtime/core-js/json/stringify","babel-runtime/helpers/slicedToArray","babel-runtime/helpers/toConsumableArray","tc-accounts","moment","babel-runtime/core-js/set","isomorphic-fetch","babel-runtime/core-js/object/keys","moment-duration-format","babel-runtime/core-js/set-immediate","le_node","babel-runtime/core-js/object/assign","to-capital-case","babel-runtime/core-js/object/values"],t):"object"==typeof exports?exports["topcoder-react-lib"]=t(require("lodash"),require("babel-runtime/core-js/promise"),require("redux-actions"),require("babel-runtime/helpers/extends"),require("babel-runtime/regenerator"),require("babel-runtime/helpers/asyncToGenerator"),require("babel-runtime/helpers/defineProperty"),require("babel-runtime/helpers/classCallCheck"),require("babel-runtime/helpers/createClass"),require("topcoder-react-utils"),require("qs"),require("babel-runtime/core-js/json/stringify"),require("babel-runtime/helpers/slicedToArray"),require("babel-runtime/helpers/toConsumableArray"),require("tc-accounts"),require("moment"),require("babel-runtime/core-js/set"),require("isomorphic-fetch"),require("babel-runtime/core-js/object/keys"),require("moment-duration-format"),require("babel-runtime/core-js/set-immediate"),require("le_node"),require("babel-runtime/core-js/object/assign"),require("to-capital-case"),require("babel-runtime/core-js/object/values")):e["topcoder-react-lib"]=t(e.lodash,e["babel-runtime/core-js/promise"],e["redux-actions"],e["babel-runtime/helpers/extends"],e["babel-runtime/regenerator"],e["babel-runtime/helpers/asyncToGenerator"],e["babel-runtime/helpers/defineProperty"],e["babel-runtime/helpers/classCallCheck"],e["babel-runtime/helpers/createClass"],e["topcoder-react-utils"],e.qs,e["babel-runtime/core-js/json/stringify"],e["babel-runtime/helpers/slicedToArray"],e["babel-runtime/helpers/toConsumableArray"],e["tc-accounts"],e.moment,e["babel-runtime/core-js/set"],e["isomorphic-fetch"],e["babel-runtime/core-js/object/keys"],e["moment-duration-format"],e["babel-runtime/core-js/set-immediate"],e.le_node,e["babel-runtime/core-js/object/assign"],e["to-capital-case"],e["babel-runtime/core-js/object/values"])}("undefined"!=typeof self?self:this,function(__WEBPACK_EXTERNAL_MODULE__0__,__WEBPACK_EXTERNAL_MODULE__1__,__WEBPACK_EXTERNAL_MODULE__2__,__WEBPACK_EXTERNAL_MODULE__3__,__WEBPACK_EXTERNAL_MODULE__4__,__WEBPACK_EXTERNAL_MODULE__5__,__WEBPACK_EXTERNAL_MODULE__7__,__WEBPACK_EXTERNAL_MODULE__8__,__WEBPACK_EXTERNAL_MODULE__9__,__WEBPACK_EXTERNAL_MODULE__10__,__WEBPACK_EXTERNAL_MODULE__14__,__WEBPACK_EXTERNAL_MODULE__15__,__WEBPACK_EXTERNAL_MODULE__16__,__WEBPACK_EXTERNAL_MODULE__17__,__WEBPACK_EXTERNAL_MODULE__18__,__WEBPACK_EXTERNAL_MODULE__21__,__WEBPACK_EXTERNAL_MODULE__24__,__WEBPACK_EXTERNAL_MODULE__29__,__WEBPACK_EXTERNAL_MODULE__55__,__WEBPACK_EXTERNAL_MODULE__56__,__WEBPACK_EXTERNAL_MODULE__57__,__WEBPACK_EXTERNAL_MODULE__58__,__WEBPACK_EXTERNAL_MODULE__66__,__WEBPACK_EXTERNAL_MODULE__93__,__WEBPACK_EXTERNAL_MODULE__106__){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=53)}([function(e,t){e.exports=__WEBPACK_EXTERNAL_MODULE__0__},function(e,t){e.exports=__WEBPACK_EXTERNAL_MODULE__1__},function(e,t){e.exports=__WEBPACK_EXTERNAL_MODULE__2__},function(e,t){e.exports=__WEBPACK_EXTERNAL_MODULE__3__},function(e,t){e.exports=__WEBPACK_EXTERNAL_MODULE__4__},function(e,t){e.exports=__WEBPACK_EXTERNAL_MODULE__5__},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getTcM2mToken=t.getApiV5=t.getApiV4=t.getApiV3=t.getApiV2=void 0;var r=y(n(55)),o=y(n(1)),i=y(n(15)),a=y(n(4)),s=y(n(3)),u=y(n(5)),l=y(n(8)),c=y(n(9)),d=t.getTcM2mToken=function(){var e=(0,u.default)(a.default.mark(function e(){var t,n,r,o;return a.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(h.isomorphy.isServerSide()){e.next=2;break}throw new Error("getTcM2mToken() called outside the server");case 2:if(t=Date.now(),n=d.cached,r=h.config.SECRET.TC_M2M,n&&!(n.expires1&&void 0!==arguments[1]?arguments[1]:{};return a.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:n=this.private,r=n.base,o=n.token,i=l.headers?f.default.clone(l.headers):{},o&&(i.Authorization="Bearer "+o),e.t0=i["Content-Type"],e.next=null===e.t0?6:void 0===e.t0?8:10;break;case 6:return delete i["Content-Type"],e.abrupt("break",10);case 8:return i["Content-Type"]="application/json",e.abrupt("break",10);case 10:if(!h.isomorphy.isClientSide()&&!h.isomorphy.isDevBuild()){e.next=19;break}if(u=Date.now(),!((b+=v)>u)){e.next=18;break}return e.next=16,(0,m.delay)(b-u);case 16:e.next=19;break;case 18:b=u;case 19:return e.abrupt("return",(0,p.default)(""+r+t,(0,s.default)({},l,{headers:i})).catch(function(e){throw(0,g.setErrorIcon)(g.ERROR_ICON_TYPES.NETWORK,""+r+t,e.message),e}));case 20:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"delete",value:function(e,t){return this.fetch(e,{body:t,method:"DELETE"})}},{key:"get",value:function(e){return this.fetch(e)}},{key:"post",value:function(e,t){return this.fetch(e,{body:t,method:"POST"})}},{key:"postJson",value:function(e,t){return this.post(e,(0,i.default)(t))}},{key:"put",value:function(e,t){return this.fetch(e,{body:t,method:"PUT"})}},{key:"putJson",value:function(e,t){return this.put(e,(0,i.default)(t))}},{key:"patch",value:function(e,t){return this.fetch(e,{body:t,method:"PATCH"})}},{key:"patchJson",value:function(e,t){return this.patch(e,(0,i.default)(t))}},{key:"upload",value:function(e,t,n){var i=this.private,a=i.base,s=i.token,u=t.headers?f.default.clone(t.headers):{};return s&&(u.Authorization="Bearer "+s),h.isomorphy.isClientSide()?new o.default(function(o,i){var s=new XMLHttpRequest;s.open(t.method,""+a+e),(0,r.default)(u).forEach(function(e){null!=u[e]&&s.setRequestHeader(e,u[e])}),s.onload=function(e){return o(e.target.responseText)},s.onerror=i,s.upload&&n&&(s.upload.onprogress=function(e){e.lengthComputable&&n(e.loaded/e.total)}),s.send(t.body)}):this.fetch(e,t)}}]),e}();t.default=_;var w={};function E(e,t){if(!e||!h.config.API[e])throw new Error(e+" is not a valid API version");return w[e]&&w[e].private.token===t||(w[e]=new _(h.config.API[e],t)),w[e]}t.getApiV2=function(e){return E("V2",e)},t.getApiV3=function(e){return E("V3",e)},t.getApiV4=function(e){return E("V4",e)},t.getApiV5=function(e){return E("V5",e)};d.MIN_LIFETIME=3e4},function(e,t){e.exports=__WEBPACK_EXTERNAL_MODULE__7__},function(e,t){e.exports=__WEBPACK_EXTERNAL_MODULE__8__},function(e,t){e.exports=__WEBPACK_EXTERNAL_MODULE__9__},function(e,t){e.exports=__WEBPACK_EXTERNAL_MODULE__10__},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=a(n(15)),o=a(n(0)),i=n(10);function a(e){return e&&e.__esModule?e:{default:e}}var s={};o.default.functions(console).forEach(function(e){s[e]=i.isomorphy.isDevBuild()||i.isomorphy.isServerSide()?console[e]:o.default.noop});var u=void 0;if(i.isomorphy.isServerSide()){var l=i.config.LOG_ENTRIES_TOKEN;if(l){var c=n(58);u=new c({token:l})}}else{var d=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),o=1;o=500&&(0,y.setErrorIcon)(y.ERROR_ICON_TYPES.API,"/challenges",t.statusText),new Error(t.statusText);case 3:return e.next=5,t.json();case 5:if(200===(n=e.sent.result).status){e.next=8;break}throw new Error(n.content);case 8:return e.abrupt("return",n);case 9:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}();t.normalizeChallengeDetails=w,t.normalizeChallenge=E,t.getService=function(e,t){C&&C.private.tokenV3===e&&C.tokenV2===t||(C=new T(e,t));return C};var f=_(n(0)),p=_(n(21)),h=_(n(14)),m=n(18),g=_(n(11)),y=n(12),v=n(13),b=n(6);function _(e){return e&&e.__esModule?e:{default:e}}t.ORDER_BY={SUBMISSION_END_DATE:"submissionEndDate"};function w(e,t,n,r){var o=(0,c.default)({},e,{id:e.challengeId,reliabilityBonus:f.default.get(t,"reliabilityBonus",0),status:(e.currentStatus||"").toUpperCase(),allPhases:[],currentPhases:[],name:e.challengeName||e.challengeTitle,projectId:Number(e.projectId),forumId:Number(e.forumId),introduction:e.introduction||"",detailedRequirements:"null"===e.detailedRequirements?"":e.detailedRequirements,finalSubmissionGuidelines:"null"===e.finalSubmissionGuidelines?"":e.finalSubmissionGuidelines,screeningScorecardId:Number(e.screeningScorecardId),reviewScorecardId:Number(e.reviewScorecardId),numberOfCheckpointsPrizes:e.numberOfCheckpointsPrizes,topCheckPointPrize:e.topCheckPointPrize,submissionsViewable:e.submissionsViewable||"false",reviewType:e.reviewType,allowStockArt:"true"===e.allowStockArt,fileTypes:e.filetypes||[],environment:e.environment,codeRepo:e.codeRepo,forumLink:e.forumLink,submissionLimit:Number(e.submissionLimit)||0,drPoints:e.digitalRunPoints,directUrl:e.directUrl,technologies:e.technologies||e.technology||[],platforms:e.platforms||[],prizes:e.prize||e.prizes||[],events:f.default.map(e.event,function(e){return{eventName:e.eventShortDesc,eventId:e.id,description:e.eventDescription}}),terms:e.terms,submissions:e.submissions,track:f.default.toUpper(e.challengeCommunity),subTrack:e.subTrack,checkpoints:e.checkpoints,documents:e.documents||[],numRegistrants:e.numberOfRegistrants,numberOfCheckpointSubmissions:e.numberOfCheckpointSubmissions,registrants:e.registrants||[]});if(o.winners=f.default.map(e.winners,function(e,t){return(0,c.default)({},e,{handle:e.submitter,placement:e.rank||t+1})}),"MARATHON_MATCH"===o.subTrack&&(o.track="DATA_SCIENCE"),o.mainEvent=o.events[0]||{},t){var i={};t.groupIds&&t.groupIds.forEach(function(e){i[e]=!0}),f.default.merge(o,{componentId:t.componentId,contestId:t.contestId,submissionEndDate:t.submissionEndDate,submissionEndTimestamp:t.submissionEndDate,allPhases:t.allPhases||[],currentPhases:t.currentPhases||[],numSubmissions:t.numSubmissions,groups:i})}n&&f.default.defaults(o,{userDetails:n.userDetails});var a=f.default.some(o.allPhases,function(e){return"Registration"===e.phaseType&&"Open"===e.phaseStatus})?"Yes":"No";return f.default.defaults(o,{communities:new l.default([v.COMPETITION_TRACKS[o.track]]),registrationOpen:a,users:r?(0,u.default)({},r,!0):{}}),o.submissions&&o.submissions.length||(o.submissions=o.registrants.filter(function(e){return e.submissionDate||""}).sort(function(e,t){return(e.submissionDate||"").localeCompare(t.submissionDate||"")})),o.allPhases||(o.allPhases=[]),o.track||(o.track=""),o}function E(e,t){var n="Open"===e.allPhases.filter(function(e){return"Registration"===e.phaseType})[0].phaseStatus?"Yes":"No",r={};e.groupIds&&e.groupIds.forEach(function(e){r[e]=!0}),e.prizes||(e.prizes=e.prize||[]),e.totalPrize||(e.totalPrize=e.prizes.reduce(function(e,t){return e+t},0)),e.technologies||(e.technologies=[]),e.platforms||(e.platforms=[]),"DEVELOP_MARATHON_MATCH"===e.subTrack&&(e.track="DATA_SCIENCE"),f.default.defaults(e,{communities:new l.default([v.COMPETITION_TRACKS[e.track]]),groups:r,registrationOpen:n,submissionEndTimestamp:e.submissionEndDate,users:t?(0,u.default)({},t,!0):{}})}var T=function(){function e(t,n){var r=this;(0,o.default)(this,e);var i=function(){var e=(0,s.default)(a.default.mark(function e(t){var n,o,i,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return a.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n=(0,c.default)({filter:h.default.stringify(s,{encode:!1})},u),o=t+"?"+h.default.stringify(n),e.next=4,r.private.api.get(o).then(d);case 4:return i=e.sent,e.abrupt("return",{challenges:i.content||[],totalCount:i.metadata.totalCount,meta:i.metadata});case 6:case"end":return e.stop()}},e,r)}));return function(t){return e.apply(this,arguments)}}();this.private={api:(0,b.getApi)("V4",t),apiV2:(0,b.getApi)("V2",n),getChallenges:i,tokenV2:n,tokenV3:t}}return(0,i.default)(e,[{key:"activate",value:function(){var e=(0,s.default)(a.default.mark(function e(t){var n;return a.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.private.api.post("/challenges/"+t+"/activate");case 2:if((n=e.sent).ok){e.next=5;break}throw new Error(n.statusText);case 5:return e.next=7,n.json();case 7:if(200===(n=e.sent.result).status){e.next=10;break}throw new Error(n.content);case 10:return e.abrupt("return",n.content);case 11:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"close",value:function(){var e=(0,s.default)(a.default.mark(function e(t,n){var r,o;return a.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r="/challenges/"+t+"/close",n&&(r=r+"?winnerId="+n),e.next=4,this.private.api.post(r);case 4:if((o=e.sent).ok){e.next=7;break}throw new Error(o.statusText);case 7:return e.next=9,o.json();case 9:if(200===(o=e.sent.result).status){e.next=12;break}throw new Error(o.content);case 12:return e.abrupt("return",o.content);case 13:case"end":return e.stop()}},e,this)}));return function(t,n){return e.apply(this,arguments)}}()},{key:"createTask",value:function(){var e=(0,s.default)(a.default.mark(function e(t,n,r,o,i,s,u,l,c,d){var h,m;return a.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return h={param:{assignees:[i],billingAccountId:n,confidentialityType:"public",detailedRequirements:o,submissionGuidelines:u,milestoneId:1,name:r,technologies:d,prizes:s?[s]:[],projectId:t,registrationStartsAt:(0,p.default)().toISOString(),reviewType:"INTERNAL",subTrack:"FIRST_2_FINISH",task:!0}},l&&f.default.assign(h.param,{copilotId:l,copilotFee:c}),e.next=4,this.private.api.postJson("/challenges",h);case 4:if((m=e.sent).ok){e.next=7;break}throw new Error(m.statusText);case 7:return e.next=9,m.json();case 9:if(200===(m=e.sent.result).status){e.next=12;break}throw new Error(m.content);case 12:return e.abrupt("return",m.content);case 13:case"end":return e.stop()}},e,this)}));return function(t,n,r,o,i,a,s,u,l,c){return e.apply(this,arguments)}}()},{key:"getChallengeDetails",value:function(){var e=(0,s.default)(a.default.mark(function e(t){var n,r,o,i,s;return a.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.private.api.get("/challenges/"+t).then(d).then(function(e){return e.content});case 2:return n=e.sent,e.next=5,this.private.getChallenges("/challenges/",{id:t}).then(function(e){return e.challenges[0]});case 5:if(r=e.sent,o=this.private.tokenV3&&(0,m.decodeToken)(this.private.tokenV3).handle,e.t0=o,!e.t0){e.next=12;break}return e.next=11,this.getUserChallenges(o,{id:t}).then(function(e){return e.challenges[0]}).catch(function(){return null});case 11:e.t0=e.sent;case 12:return i=e.t0,(s=w(n,r,i,o)).fetchedWithAuth=Boolean(this.private.api.private.token),e.abrupt("return",s);case 16:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"getChallengeSubtracks",value:function(){return this.private.api.get("/challenge-types").then(function(e){return e.ok?e.json():new Error(e.statusText)}).then(function(e){return 200===e.result.status?e.result.content:new Error(e.result.content)})}},{key:"getChallengeTags",value:function(){return this.private.api.get("/technologies").then(function(e){return e.ok?e.json():new Error(e.statusText)}).then(function(e){return 200===e.result.status?e.result.content:new Error(e.result.content)})}},{key:"getChallenges",value:function(e,t){return this.private.getChallenges("/challenges/",e,t).then(function(e){return e.challenges.forEach(function(e){return E(e)}),e})}},{key:"getSrms",value:function(){var e=(0,s.default)(a.default.mark(function e(t){var n;return a.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.private.api.get("/srms/?"+h.default.stringify(t));case 2:return n=e.sent,e.abrupt("return",(0,v.getApiResponsePayload)(n));case 4:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"getUserChallenges",value:function(e,t,n){var r="/members/"+e.toLowerCase()+"/challenges/";return this.private.getChallenges(r,t,n).then(function(t){return t.challenges.forEach(function(t){return E(t,e)}),t})}},{key:"getUserMarathonMatches",value:function(e,t,n){var r="/members/"+e.toLowerCase()+"/mms/";return this.private.getChallenges(r,t,n)}},{key:"getUserSrms",value:function(){var e=(0,s.default)(a.default.mark(function e(t,n){var r,o;return a.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r="/members/"+t+"/srms/?"+h.default.stringify(n),e.next=3,this.private.api.get(r);case 3:return o=e.sent,e.abrupt("return",(0,v.getApiResponsePayload)(o));case 5:case"end":return e.stop()}},e,this)}));return function(t,n){return e.apply(this,arguments)}}()},{key:"register",value:function(){var e=(0,s.default)(a.default.mark(function e(t){var n,r;return a.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n="/challenges/"+t+"/register",e.next=3,this.private.api.postJson(n);case 3:if((r=e.sent).ok){e.next=6;break}throw new Error(r.statusText);case 6:return e.abrupt("return",r.json());case 7:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"unregister",value:function(){var e=(0,s.default)(a.default.mark(function e(t){var n,r;return a.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n="/challenges/"+t+"/unregister",e.next=3,this.private.api.post(n);case 3:if((r=e.sent).ok){e.next=6;break}throw new Error(r.statusText);case 6:return e.abrupt("return",r.json());case 7:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"getActiveChallengesCount",value:function(e){return this.getUserChallenges(e,{status:"ACTIVE"},{limit:1,offset:0}).then(function(e){return e.totalCount})}},{key:"submit",value:function(e,t,n,o){var i=void 0,a=void 0,s=void 0;return"DESIGN"===n?(i=this.private.api,a="application/json",s="/submissions/"):(i=this.private.apiV2,a=null,s="/develop/challenges/"+t+"/upload"),i.upload(s,{body:e,headers:{"Content-Type":a},method:"POST"},o).then(function(e){var t=JSON.parse(e);if("DEVELOP"===n)return t;var s=t.result.content.id;return i.upload("/submissions/"+s+"/process/",{body:(0,r.default)({param:t.result.content}),headers:{"Content-Type":a},method:"POST"},o).then(function(e){return JSON.parse(e)})},function(e){throw g.default.error("Failed to submit to the challenge #"+t,e),e})}},{key:"updateChallenge",value:function(){var e=(0,s.default)(a.default.mark(function e(t){var n,r,o;return a.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n="/challenges/"+t.id,r={param:t},e.next=4,this.private.api.putJson(n,r);case 4:if((o=e.sent).ok){e.next=7;break}throw new Error(o.statusText);case 7:return e.next=9,o.json();case 9:if(200===(o=e.sent.result).status){e.next=12;break}throw new Error(o.content);case 12:return e.abrupt("return",o.content);case 13:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()}]),e}(),C=null;t.default=void 0},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=g(n(66)),o=g(n(1)),i=g(n(7)),a=g(n(15)),s=g(n(4)),u=g(n(5)),l=g(n(8)),c=g(n(9));t.getService=function(e){v&&e===v.private.tokenV3||(v=new y(e));return v};var d=g(n(0)),f=g(n(14)),p=g(n(11)),h=n(13),m=n(6);function g(e){return e&&e.__esModule?e:{default:e}}var y=function(){function e(t){(0,l.default)(this,e),this.private={api:(0,m.getApi)("V3",t),tokenV3:t}}return(0,c.default)(e,[{key:"getMemberFinances",value:function(){var e=(0,u.default)(s.default.mark(function e(t){var n;return s.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.private.api.get("/members/"+t+"/financial");case 2:return n=e.sent,e.abrupt("return",(0,h.getApiResponsePayload)(n));case 4:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"getMemberInfo",value:function(){var e=(0,u.default)(s.default.mark(function e(t){var n;return s.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.private.api.get("/members/"+t);case 2:return n=e.sent,e.abrupt("return",(0,h.getApiResponsePayload)(n));case 4:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"getExternalAccounts",value:function(){var e=(0,u.default)(s.default.mark(function e(t){var n;return s.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.private.api.get("/members/"+t+"/externalAccounts");case 2:return n=e.sent,e.abrupt("return",(0,h.getApiResponsePayload)(n));case 4:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"getExternalLinks",value:function(){var e=(0,u.default)(s.default.mark(function e(t){var n;return s.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.private.api.get("/members/"+t+"/externalLinks");case 2:return n=e.sent,e.abrupt("return",(0,h.getApiResponsePayload)(n));case 4:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"getSkills",value:function(){var e=(0,u.default)(s.default.mark(function e(t){var n;return s.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.private.api.get("/members/"+t+"/skills");case 2:return n=e.sent,e.abrupt("return",(0,h.getApiResponsePayload)(n));case 4:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"getStats",value:function(){var e=(0,u.default)(s.default.mark(function e(t){var n;return s.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.private.api.get("/members/"+t+"/stats");case 2:return n=e.sent,e.abrupt("return",(0,h.getApiResponsePayload)(n));case 4:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"getStatsHistory",value:function(){var e=(0,u.default)(s.default.mark(function e(t){var n;return s.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.private.api.get("/members/"+t+"/stats/history");case 2:return n=e.sent,e.abrupt("return",(0,h.getApiResponsePayload)(n));case 4:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"getStatsDistribution",value:function(){var e=(0,u.default)(s.default.mark(function e(t,n,r){var o;return s.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.private.api.get("/members/stats/distribution?filter="+encodeURIComponent(f.default.stringify({track:n,subTrack:r})));case 2:return o=e.sent,e.abrupt("return",(0,h.getApiResponsePayload)(o));case 4:case"end":return e.stop()}},e,this)}));return function(t,n,r){return e.apply(this,arguments)}}()},{key:"getMemberSuggestions",value:function(){var e=(0,u.default)(s.default.mark(function e(t){var n;return s.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.private.api.get("/members/_suggest/"+t);case 2:return n=e.sent,e.abrupt("return",(0,h.getApiResponsePayload)(n));case 4:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"addWebLink",value:function(){var e=(0,u.default)(s.default.mark(function e(t,n){var r;return s.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.private.api.postJson("/members/"+t+"/externalLinks",{param:{url:n}});case 2:return r=e.sent,e.abrupt("return",(0,h.getApiResponsePayload)(r));case 4:case"end":return e.stop()}},e,this)}));return function(t,n){return e.apply(this,arguments)}}()},{key:"deleteWebLink",value:function(){var e=(0,u.default)(s.default.mark(function e(t,n){var r,o;return s.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r={param:{handle:n}},e.next=3,this.private.api.delete("/members/"+t+"/externalLinks/"+n,(0,a.default)(r));case 3:return o=e.sent,e.abrupt("return",(0,h.getApiResponsePayload)(o));case 5:case"end":return e.stop()}},e,this)}));return function(t,n){return e.apply(this,arguments)}}()},{key:"addSkill",value:function(){var e=(0,u.default)(s.default.mark(function e(t,n){var r,o;return s.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r={param:{skills:(0,i.default)({},n,{hidden:!1})}},e.next=3,this.private.api.patchJson("/members/"+t+"/skills",r);case 3:return o=e.sent,e.abrupt("return",(0,h.getApiResponsePayload)(o));case 5:case"end":return e.stop()}},e,this)}));return function(t,n){return e.apply(this,arguments)}}()},{key:"hideSkill",value:function(){var e=(0,u.default)(s.default.mark(function e(t,n){var r,o;return s.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r={param:{skills:(0,i.default)({},n,{hidden:!0})}},e.next=3,this.private.api.fetch("/members/"+t+"/skills",{body:(0,a.default)(r),method:"PATCH"});case 3:return o=e.sent,e.abrupt("return",(0,h.getApiResponsePayload)(o));case 5:case"end":return e.stop()}},e,this)}));return function(t,n){return e.apply(this,arguments)}}()},{key:"updateMemberProfile",value:function(){var e=(0,u.default)(s.default.mark(function e(t){var n,i;return s.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.verifyUrl?"/members/"+t.handle+"?verifyUrl="+t.verifyUrl:"/members/"+t.handle,e.next=3,this.private.api.putJson(n,{param:t.verifyUrl?d.default.omit(t,["verifyUrl"]):t});case 3:if(i=e.sent,!t.verifyUrl||409!==i.status){e.next=6;break}return e.abrupt("return",o.default.resolve((0,r.default)({},t,{isEmailConflict:!0})));case 6:return e.abrupt("return",(0,h.getApiResponsePayload)(i));case 7:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"getPresignedUrl",value:function(){var e=(0,u.default)(s.default.mark(function e(t,n){var r,o;return s.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.private.api.postJson("/members/"+t+"/photoUploadUrl",{param:{contentType:n.type}});case 2:return r=e.sent,e.next=5,(0,h.getApiResponsePayload)(r);case 5:return o=e.sent,e.abrupt("return",{preSignedURL:o.preSignedURL,token:o.token,file:n,userHandle:t});case 7:case"end":return e.stop()}},e,this)}));return function(t,n){return e.apply(this,arguments)}}()},{key:"updateMemberPhoto",value:function(){var e=(0,u.default)(s.default.mark(function e(t){var n;return s.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.private.api.putJson("/members/"+t.userHandle+"/photo",{param:t.body});case 2:return n=e.sent,e.abrupt("return",(0,h.getApiResponsePayload)(n));case 4:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"uploadFileToS3",value:function(e){return d.default.noop(this),new o.default(function(t,n){var r=new XMLHttpRequest;r.open("PUT",e.preSignedURL,!0),r.setRequestHeader("Content-Type",e.file.type),r.onreadystatechange=function(){var o=r.status;if((o>=200&&o<300||304===o)&&4===r.readyState)t({userHandle:e.userHandle,body:{token:e.token,contentType:e.file.type}});else if(o>=400){var i=new Error("Could not upload image to S3");i.status=o,n(i)}},r.onerror=function(e){p.default.error("Could not upload image to S3",e),n(e)},r.send(e.file)})}},{key:"verifyMemberNewEmail",value:function(){var e=(0,u.default)(s.default.mark(function e(t,n){var r;return s.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.private.api.get("/members/"+t+"/verify?token="+n);case 2:return r=e.sent,e.abrupt("return",(0,h.getApiResponsePayload)(r));case 4:case"end":return e.stop()}},e,this)}));return function(t,n){return e.apply(this,arguments)}}()},{key:"getMembersInformation",value:function(){var e=(0,u.default)(s.default.mark(function e(t){var n,r,o,i;return s.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n="query="+encodeURI(d.default.map(t,function(e){return"userId:"+e}).join(" OR ")),r="limit="+t.length,o="/members/_search?fields=userId%2Chandle%2CphotoURL%2CfirstName%2ClastName&"+n+"&"+r,e.next=5,this.private.api.get(o);case 5:return i=e.sent,e.abrupt("return",(0,h.getApiResponsePayload)(i));case 7:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()}]),e}(),v=null;t.default=void 0},function(e,t){e.exports=__WEBPACK_EXTERNAL_MODULE__21__},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(e){return e&&e.__esModule?e:{default:e}}(n(0)),o=n(2);t.default=(0,o.createActions)({ERRORS:{CLEAR_ERROR:r.default.noop,NEW_ERROR:function(e,t){return{title:e,details:t}},CLEAR_ALL_ERROR_ICONS:r.default.noop,SET_ERROR_ICON:function(e,t,n){return{id:e,title:t,message:n}},CLEAR_ERROR_ICON:function(e){return{id:e}}}})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(e){return e&&e.__esModule?e:{default:e}}(n(0)),o=n(2),i=n(6);t.default=(0,o.createActions)({SMP:{DELETE_SUBMISSION_DONE:function(e,t){return(0,i.getApi)("V3",e).delete("/submissions/"+t).then(function(){return t})},DELETE_SUBMISSION_INIT:function(){},DOWNLOAD_SUBMISSION:function(e,t,n){r.default.noop(e,t,n)}}})},function(e,t){e.exports=__WEBPACK_EXTERNAL_MODULE__24__},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=p(n(4)),o=p(n(5)),i=p(n(1)),a=p(n(8)),s=p(n(9)),u=p(n(24));t.addDescendantGroups=function(e,t){var n=l.default.isArray(e)?e:[e],r=new u.default,o=0;for(;o1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=[],o=[],i=[],a=[],s=Date.now(),c=new u.default;return(l.default.isArray(e)?e:[e]).forEach(function(e){if(!c.has(e)){c.add(e);var u=t[e];u||a.push(e),u&&(s-u.timestamp||0)1&&void 0!==arguments[1])||arguments[1])&&(t+="/getSubGroups?includeSubGroups=true&oneLevel=false"),this.private.api.get(t).then(m)}},{key:"getGroupMap",value:function(e){var t=this,n={},r=new u.default,o=(l.default.isArray(e)?e:[e]).map(function(e){return r.has(e)?null:(r.add(e),t.getGroup(e).then(function(e){return function e(t,n){var r=n.subGroups;n.timestamp=Date.now(),r&&r.length&&(n.subGroupIds=r.map(function(e){return e.id}),r.forEach(function(n){return e(t,n)})),delete n.subGroups,t[n.id]=n}(n,e)}).catch(function(t){d.default.error("Failed to get user group #"+e,t),n[e]={id:e,timestamp:Date.now()}}))});return i.default.all(o).then(function(){return n})}},{key:"getGroupTreeIds",value:function(){var e=(0,o.default)(r.default.mark(function e(t){var n,o,i,a,s,u=arguments.length>1&&void 0!==arguments[1]?arguments[1]:3e5;return r.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(n=Date.now(),o=this.private.cache.groupTreeIds,i=864e5,n-o.lastCleanUp>i&&(l.default.forOwn(o,function(e,t){var r=e.timestamp;n-r>i&&delete o[t]}),o.lastCleanUp=n),!((a=o[t])&&n-a.timestamp0&&void 0!==arguments[0]&&arguments[0]}}})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=h(n(15)),o=h(n(1)),i=h(n(4)),a=h(n(5)),s=h(n(8)),u=h(n(9)),l=h(n(16));t.getService=function(e,t){b&&b.private.tokenV2===t&&b.private.tokenV3===e||(b=new v(e,t));return b};var c=n(10),d=h(n(11)),f=n(13),p=n(6);function h(e){return e&&e.__esModule?e:{default:e}}var m=void 0;function g(){if(!m&&c.isomorphy.isClientSide()){var e=n(67);m=new e({domain:c.config.AUTH0.DOMAIN,clientID:c.config.AUTH0.CLIENT_ID,callbackOnLocationHash:!0,sso:!1})}return m}function y(e,t){var n=e.identities[0].connection,r="",o="",i="",a=e.email||"",s=e.user_id.substring(e.user_id.lastIndexOf("|")+1),u=void 0;if("google-oauth2"===n)r=e.given_name,o=e.family_name,i=e.nickname;else if("facebook"===n)i=(r=e.given_name)+"."+(o=e.family_name);else if("twitter"===n){var c=u=e.name.split(" ");if(r=(0,l.default)(c,1)[0],u.length>1){var d=u;o=(0,l.default)(d,2)[1]}i=e.screen_name}else if("github"===n){var f=u=e.name.split(" ");if(r=(0,l.default)(f,1)[0],u.length>1){var p=u;o=(0,l.default)(p,2)[1]}i=e.nickname}else"bitbucket"===n?(r=e.first_name,o=e.last_name,i=e.username):"stackoverflow"===n?(r=e.first_name,o=e.last_name,i=s):"dribbble"===n&&(r=e.first_name,o=e.last_name,i=s);var h=t,m=null;return e.identities[0].access_token&&(h=e.identities[0].access_token),e.identities[0].access_token_secret&&(m=e.identities[0].access_token_secret),{socialUserId:s,username:i,firstname:r,lastname:o,email:a,socialProfile:e,socialProvider:n,accessToken:h,accessTokenSecret:m}}var v=function(){function e(t,n){(0,s.default)(this,e),this.private={api:(0,p.getApi)("V3",t),apiV2:(0,p.getApi)("V2",n),tokenV2:n,tokenV3:t}}return(0,u.default)(e,[{key:"getAchievements",value:function(){var e=(0,a.default)(i.default.mark(function e(t){var n;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.private.apiV2.get("/users/"+t);case 2:if((n=e.sent).ok){e.next=5;break}throw new Error(n.statusText);case 5:return e.next=7,n.json();case 7:if(e.t0=e.sent.Achievements,e.t0){e.next=10;break}e.t0=[];case 10:return e.abrupt("return",e.t0);case 11:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"getUserPublic",value:function(){var e=(0,a.default)(i.default.mark(function e(t){var n;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.private.apiV2.get("/users/"+t);case 2:if((n=e.sent).ok){e.next=5;break}throw new Error(n.statusText);case 5:return e.abrupt("return",n.json()||null);case 6:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"getUserPublicV3",value:function(){var e=(0,a.default)(i.default.mark(function e(t){var n;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.private.api.get("/members/"+t);case 2:return n=e.sent,e.abrupt("return",(0,f.getApiResponsePayload)(n));case 4:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"getUser",value:function(){var e=(0,a.default)(i.default.mark(function e(t){var n,r;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n="/users?filter=handle%3D"+t,e.next=3,this.private.api.get(n);case 3:return r=e.sent,e.next=6,(0,f.getApiResponsePayload)(r);case 6:return e.abrupt("return",e.sent[0]);case 7:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"getEmailPreferences",value:function(){var e=(0,a.default)(i.default.mark(function e(t){var n,r,o;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n="/users/"+t+"/preferences/email",e.next=3,this.private.api.get(n);case 3:return r=e.sent,e.next=6,r.json();case 6:return o=e.sent.result,e.abrupt("return",o.content);case 8:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"saveEmailPreferences",value:function(){var e=(0,a.default)(i.default.mark(function e(t,n){var r,o,a,s=t.firstName,u=t.lastName,l=t.userId;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r={firstName:s,lastName:u,subscriptions:{}},n?r.subscriptions=n:r.subscriptions.TOPCODER_NL_GEN=!0,o="/users/"+l+"/preferences/email",e.next=5,this.private.api.putJson(o,{param:r});case 5:return a=e.sent,e.abrupt("return",(0,f.getApiResponsePayload)(a));case 7:case"end":return e.stop()}},e,this)}));return function(t,n){return e.apply(this,arguments)}}()},{key:"getCredential",value:function(){var e=(0,a.default)(i.default.mark(function e(t){var n,r;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n="/users/"+t+"?fields=credential",e.next=3,this.private.api.get(n);case 3:return r=e.sent,e.abrupt("return",(0,f.getApiResponsePayload)(r));case 5:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"updatePassword",value:function(){var e=(0,a.default)(i.default.mark(function e(t,n,r){var o,a,s;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return o={password:n,currentPassword:r},a="/users/"+t,e.next=4,this.private.api.patchJson(a,{param:{credential:o}});case 4:return s=e.sent,e.abrupt("return",(0,f.getApiResponsePayload)(s));case 6:case"end":return e.stop()}},e,this)}));return function(t,n,r){return e.apply(this,arguments)}}()},{key:"getLinkedAccounts",value:function(){var e=(0,a.default)(i.default.mark(function e(t){var n,r;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n="/users/"+t+"?fields=profiles",e.next=3,this.private.api.get(n);case 3:return r=e.sent,e.abrupt("return",(0,f.getApiResponsePayload)(r));case 5:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"unlinkExternalAccount",value:function(){var e=(0,a.default)(i.default.mark(function e(t,n){var r,o;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r="/users/"+t+"/profiles/"+n,e.next=3,this.private.api.delete(r);case 3:return o=e.sent,e.abrupt("return",(0,f.getApiResponsePayload)(o));case 5:case"end":return e.stop()}},e,this)}));return function(t,n){return e.apply(this,arguments)}}()},{key:"linkExternalAccount",value:function(){var e=(0,a.default)(i.default.mark(function e(t,n,a){var s=this;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new o.default(function(e,o){g().signin({popup:!0,connection:n,scope:"openid profile offline_access",state:a},function(n,i,a,u){if(n)return d.default.error("Error signing in - onSocialLoginFailure",n),void o(n);var l=y(i,u),c={userId:l.socialUserId,name:l.username,email:l.email,emailVerified:!1,providerType:l.socialProvider,context:{handle:l.username,accessToken:l.accessToken,auth0UserId:i.user_id}};l.accessTokenSecret&&(c.context.accessTokenSecret=l.accessTokenSecret),d.default.debug("link API postdata: "+(0,r.default)(c)),s.private.api.postJson("/users/"+t+"/profiles",{param:c}).then(function(t){return(0,f.getApiResponsePayload)(t).then(function(t){d.default.debug("Succesfully linked account: "+(0,r.default)(t)),e(c)})}).catch(function(e){d.default.error("Error linking account",e),o(e)})})}));case 1:case"end":return e.stop()}},e,this)}));return function(t,n,r){return e.apply(this,arguments)}}()}]),e}(),b=null;t.default=v},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=l(n(3)),o=l(n(16)),i=l(n(1)),a=n(2),s=n(18),u=n(6);function l(e){return e&&e.__esModule?e:{default:e}}t.default=(0,a.createActions)({AUTH:{LOAD_PROFILE:function(e){if(!e)return i.default.resolve(null);var t=(0,s.decodeToken)(e),n=(0,u.getApi)("V3",e);return i.default.all([n.get("/members/"+t.handle).then(function(e){return e.json()}).then(function(e){return 200===e.result.status?e.result.content:{}}),n.get("/groups?memberId="+t.userId+"&membershipType=user").then(function(e){return e.json()}).then(function(e){return 200===e.result.status?e.result.content:[]})]).then(function(e){var t=(0,o.default)(e,2),n=t[0],i=t[1];return(0,r.default)({},n,{groups:i})})},SET_TC_TOKEN_V2:function(e){return e},SET_TC_TOKEN_V3:function(e){return e}}})},function(e,t){e.exports=__WEBPACK_EXTERNAL_MODULE__29__},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.formatDuration=t.delay=void 0;var r=s(n(4)),o=s(n(1)),i=s(n(5)),a=(t.delay=function(){var e=(0,i.default)(r.default.mark(function e(t){return r.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new o.default(function(e){return setTimeout(function(){return e()},t)}));case 1:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}(),s(n(21)));function s(e){return e&&e.__esModule?e:{default:e}}n(56);t.formatDuration=function(e){var t=void 0;return t=e>864e5?"D[d] H[h]":e>36e5?"H[h] m[min]":"m[min] s[s]",a.default.duration(e).format(t)};t.default=void 0},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=c(n(4)),o=c(n(5)),i=function(){var e=(0,o.default)(r.default.mark(function e(t,n,o,i){var s,c,d,f,p,h;return r.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,s=o.filter(function(e){return"ACTIVE"===e.status}),t.challengeFilter&&(c=u.getFilterFunction(t.challengeFilter),s=s.filter(c)),d=Math.round(s.reduce(function(e,t){return e+(t.totalPrize||0)},0)),f=(0,l.getService)(i),p={community:t.communityId,stats:{},uuid:n},s.length&&(p.stats.numChallenges=s.length),d&&(p.stats.openPrizes="$"+d.toLocaleString()),!(h=a.default.get(t,"groupIds[0]"))){e.next=13;break}return e.next=12,f.getMembersCount(h,!0);case 12:p.stats.numMembers=e.sent;case 13:return e.abrupt("return",p);case 16:return e.prev=16,e.t0=e.catch(0),e.abrupt("return",{community:t.communityId,stats:{},uuid:n});case 19:case"end":return e.stop()}},e,this,[[0,16]])}));return function(t,n,r,o){return e.apply(this,arguments)}}(),a=c(n(0)),s=n(2),u=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(n(32)),l=n(25);function c(e){return e&&e.__esModule?e:{default:e}}t.default=(0,s.createActions)({STATS:{GET_COMMUNITY_STATS_INIT:function(e,t){return{community:e.communityId,uuid:t}},GET_COMMUNITY_STATS_DONE:i}})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=u(n(24)),o=u(n(3));t.addTrack=function(e,t){if(!e.tracks)return e;var n=i.default.clone(e);n.tracks=i.default.clone(n.tracks),n.tracks[t]=!0,i.default.values(s.COMPETITION_TRACKS).some(function(e){return!n.tracks[e]})||delete n.tracks;return n},t.getFilterFunction=function e(t){return function(n){var r=function(e,t){return!t.status||t.status.includes(e.status)}(n,t)&&h(n,t)&&function(e,t){return!!i.default.isUndefined(t.upcoming)||(0,a.default)().isBefore(e.registrationStartDate)}(n,t)&&function(e,t){return!t.groupIds||t.groupIds.some(function(t){return e.groups[t]})}(n,t)&&p(n,t)&&f(n,t)&&d(n,t)&&function(e,t){return!t.users||t.users.find(function(t){return e.users[t]})}(n,t)&&l(n,t)&&c(n,t)&&function(e,t){return!!i.default.isUndefined(t.started)||(0,a.default)(e.registrationStartDate).isBefore(Date.now())}(n,t)&&function(e,t){return!!i.default.isUndefined(t.registrationOpen)||function(){if(e.registrationOpen)return"Yes"===e.registrationOpen;if("MARATHON_MATCH"===e.subTrack)return"PAST"!==e.status;var t=e.allPhases.find(function(e){return"Registration"===e.phaseType});if(!t||"Open"!==t.phaseStatus)return!1;if("DESIGN"===e.track){var n=e.allPhases.find(function(e){return"Checkpoint Submission"===e.phaseType});return!n||"Closed"!==n.phaseStatus}return!0}()===t.registrationOpen}(n,t);if(!r&&t.or)for(var o=0;!r&&o3&&void 0!==arguments[3]&&arguments[3];e[n]&&t[n]?e[n]=r?i.default.uniq(e[n].concat(t[n])):i.default.intersection(e[n],t[n]):t[n]&&(e[n]=t[n])}t.default=void 0},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=u(n(1)),o=u(n(0)),i=n(2),a=n(10),s=n(34);function u(e){return e&&e.__esModule?e:{default:e}}function l(e,t,n){var r=(0,s.getService)(t.tokenV2),o=void 0,i=n?Array(11).join("1").split("").map(function(){return!0}):[];switch(e.type){case"challenge":o=r.getChallengeTerms(e.id,i);break;case"community":o=r.getCommunityTerms(e.id,t.tokenV3,i);break;case"reviewOpportunity":o=r.getReviewOpportunityTerms(e.reviewOpportunityTerms);break;default:throw new Error("Entity type '"+e.type+"' is not supported by getTermsDone.")}return o.then(function(t){return{entity:e,terms:t.terms}})}t.default=(0,i.createActions)({TERMS:{GET_TERMS_INIT:function(e){return e},GET_TERMS_DONE:l,GET_TERM_DETAILS_INIT:function(e){return o.default.toString(e)},GET_TERM_DETAILS_DONE:function(e,t){return(0,s.getService)(t).getTermDetails(e).then(function(t){return{termId:e,details:t}})},GET_DOCU_SIGN_URL_INIT:function(e){return o.default.toString(e)},GET_DOCU_SIGN_URL_DONE:function(e,t,n){return(0,s.getService)(n).getDocuSignUrl(e,t).then(function(t){return{templateId:e,docuSignUrl:t.recipientViewUrl}})},AGREE_TERM_INIT:function(e){return o.default.toString(e)},AGREE_TERM_DONE:function(e,t){return(0,s.getService)(t).agreeTerm(e).then(function(t){return{termId:e,success:t.success}})},CHECK_STATUS_INIT:function(){},CHECK_STATUS_DONE:function(e,t){var n=a.config.MOCK_TERMS_SERVICE;return function i(a){return l(e,t,n).then(function(e){return!o.default.every(e.terms,"agreed")&&a>1?function(e){return new r.default(function(t){setTimeout(t,e)})}(5e3).then(function(){return i(a-1)}):e.terms})}(5)}}})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=c(n(1)),o=c(n(8)),i=c(n(9));t.getService=function(e){if(s.config.MOCK_TERMS_SERVICE)return n(59).getService(e);(!f||e&&f.private.tokenV2!==e)&&(f=new d(e));return f};var a=c(n(0)),s=n(10),u=n(35),l=n(6);function c(e){return e&&e.__esModule?e:{default:e}}var d=function(){function e(t){(0,o.default)(this,e),this.private={api:(0,l.getApi)("V2",t),tokenV2:t}}return(0,i.default)(e,[{key:"getChallengeTerms",value:function(e){var t=this;if(this.private.tokenV2){var n=!1;return this.private.api.get("/terms/"+e+"?role=Submitter").then(function(e){return e.json()}).then(function(r){return r.error?("You are already registered for this challenge."===r.error.details&&(n=!0),t.private.api.get("/terms/"+e+"?role=Submitter&noauth=true").then(function(e){return e.ok?e.json().then(function(e){return n&&a.default.forEach(e.terms,function(e){e.agreed=!0}),e}):new Error(e.statusText)})):r})}return this.private.api.get("/terms/"+e+"?role=Submitter&noauth=true").then(function(e){if(e.ok)return e.json();throw new Error(e.statusText)})}},{key:"getCommunityTerms",value:function(e,t){var n=this;return(0,u.getService)(t).getMetadata(e).then(function(e){return e.terms&&e.terms.length?r.default.all(e.terms.map(function(e){return n.getTermDetails(e)})).then(function(e){return e.map(function(e){return a.default.omit(e,"text")})}):[]}).then(function(e){return{terms:e}})}},{key:"getReviewOpportunityTerms",value:function(e){var t=this,n=e.map(function(e){return e.agreed?r.default.resolve(e):t.getTermDetails(e.termsOfUseId).then(function(e){return a.default.pick(e,["termsOfUseId","agreed","title"])})});return r.default.all(n).then(function(e){return{terms:e}})}},{key:"getTermDetails",value:function(e){var t=(new Date).getTime();return this.private.api.get("/terms/detail/"+e+"?nocache="+t).then(function(e){return e.ok?e.json():r.default.reject(e.json())})}},{key:"getDocuSignUrl",value:function(e,t){return this.private.api.post("/terms/docusign/viewURL?templateId="+e+"&returnUrl="+t).then(function(e){return e.ok?e.json():r.default.reject(e.json())})}},{key:"agreeTerm",value:function(e){return this.private.api.post("/terms/"+e+"/agree").then(function(e){return e.ok?e.json():r.default.reject(e.json())})}}]),e}(),f=null;t.default=void 0},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=d(n(4)),o=d(n(5)),i=d(n(8)),a=d(n(9));t.getService=function(e){h&&e===h.private.tokenV3||(h=new p(e));return h};var s=d(n(0)),u=d(n(29)),l=d(n(14)),c=n(10);function d(e){return e&&e.__esModule?e:{default:e}}function f(){var e=s.default.get(c.config,"URL.COMMUNITY_APP");if(!e)throw new Error("No URL.COMMUNITY_APP param found in config");return e}var p=function(){function e(t){(0,i.default)(this,e),this.private={tokenV3:t}}return(0,a.default)(e,[{key:"getList",value:function(){var e=(0,o.default)(r.default.mark(function e(t){var n,o;return r.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n=f(),n+="/community-app-assets/api/tc-communities?",n+=l.default.stringify({groups:t}),e.next=5,(0,u.default)(n,{headers:{authorization:this.private.tokenV3}});case 5:return o=e.sent,e.abrupt("return",o.json());case 7:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"getMetadata",value:function(){var e=(0,o.default)(r.default.mark(function e(t){var n,o;return r.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n=f(),n+="/community-app-assets/api/tc-communities/"+t+"/meta",e.next=4,(0,u.default)(n,{headers:{authorization:this.private.tokenV3}});case 4:return o=e.sent,e.abrupt("return",o.json());case 6:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()}]),e}(),h=null;t.default=void 0},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=l(n(4)),o=l(n(5)),i=function(){var e=(0,o.default)(r.default.mark(function e(t,n){var o,i;return r.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return o={},n&&(o.hasActiveBillingAccount=!0),e.next=4,(0,u.getService)(t).getUserProjects(o);case 4:return i=e.sent,e.abrupt("return",{tokenV3:t,projects:i});case 6:case"end":return e.stop()}},e,this)}));return function(t,n){return e.apply(this,arguments)}}(),a=l(n(0)),s=n(2),u=n(37);function l(e){return e&&e.__esModule?e:{default:e}}t.default=(0,s.createActions)({DIRECT:{DROP_ALL:function(){return null},GET_PROJECT_DETAILS_INIT:function(e){return e},GET_PROJECT_DETAILS_DONE:function(e,t){return(0,u.getService)(t).getProjectDetails(e)},GET_PROJECT_PERMISSIONS_INIT:function(e){return a.default.toNumber(e)},GET_PROJECT_PERMISSIONS_DONE:function(e,t){return(0,u.getService)(t).getProjectPermissions(e).then(function(t){return{permissions:t,projectId:e}})},GET_USER_PROJECTS_INIT:function(e){return e},GET_USER_PROJECTS_DONE:i}})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=l(n(4)),o=l(n(5)),i=l(n(8)),a=l(n(9));t.getService=function(e){d&&d.private.tokenV3===e||(d=new c(e));return d};var s=l(n(14)),u=n(6);function l(e){return e&&e.__esModule?e:{default:e}}var c=function(){function e(t){(0,i.default)(this,e),this.private={api:(0,u.getApi)("V3",t),tokenV3:t}}return(0,a.default)(e,[{key:"getProjectDetails",value:function(){var e=(0,o.default)(r.default.mark(function e(t){var n;return r.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.private.api.get("/direct/projects/"+t);case 2:if((n=e.sent).ok){e.next=5;break}throw new Error(n.statusText);case 5:return e.next=7,n.json();case 7:if(200===(n=e.sent.result).status){e.next=10;break}throw new Error(n.content);case 10:return e.abrupt("return",n.content);case 11:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"getProjectPermissions",value:function(){var e=(0,o.default)(r.default.mark(function e(t){var n,o;return r.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n="/direct/projects/"+t+"/permissions",e.next=3,this.private.api.get(n);case 3:if((o=e.sent).ok){e.next=6;break}throw new Error(o.statusText);case 6:return e.next=8,o.json();case 8:if(200===(o=e.sent.result).status){e.next=11;break}throw new Error(o.content);case 11:return e.abrupt("return",o.content);case 12:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"getUserProjects",value:function(){var e=(0,o.default)(r.default.mark(function e(t){var n,o;return r.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n="/direct/projects/user",t&&(n+="?"+s.default.stringify(t)),e.next=4,this.private.api.get(n);case 4:if((o=e.sent).ok){e.next=7;break}throw new Error(o.statusText);case 7:return e.next=9,o.json();case 9:if(200===(o=e.sent.result).status){e.next=12;break}throw new Error(o.content);case 12:return e.abrupt("return",o.content);case 13:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()}]),e}(),d=null;t.default=void 0},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(2),o=n(25);t.default=(0,r.createActions)({GROUPS:{DROP_GROUPS:function(){},GET_GROUPS_INIT:function(e){return e},GET_GROUPS_DONE:function(e,t){return(0,o.getService)(t).getGroupMap(e)}}})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=p(n(16)),o=p(n(1)),i=p(n(0)),a=n(10),s=n(2),u=n(19),l=n(40),c=n(20),d=n(6),f=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(n(41));function p(e){return e&&e.__esModule?e:{default:e}}var h=50;function m(e,t,n){return(0,u.getService)(t,n).getChallengeDetails(e)}t.default=(0,s.createActions)({CHALLENGE:{DROP_CHECKPOINTS:function(){},DROP_RESULTS:function(){},FETCH_CHECKPOINTS_INIT:function(){},FETCH_CHECKPOINTS_DONE:function(e,t){var n="/design/challenges/checkpoint/"+t;return(0,d.getApi)("V2",e).fetch(n).then(function(e){if(200!==e.status)throw e.status;return e.json()}).then(function(e){return e.checkpointResults.forEach(function(t,n){e.checkpointResults[n].expanded=!1}),{challengeId:Number(t),checkpoints:e}}).catch(function(e){return{error:e,challengeId:Number(t)}})},GET_DETAILS_INIT:function(e){return i.default.toString(e)},GET_DETAILS_DONE:m,GET_SUBMISSIONS_INIT:function(e){return i.default.toString(e)},GET_SUBMISSIONS_DONE:function(e,t){return(0,d.getApi)("V2",t).fetch("/challenges/submissions/"+e+"/mySubmissions").then(function(e){return e.json()}).then(function(t){return{challengeId:i.default.toString(e),submissions:t.submissions}}).catch(function(t){throw{challengeId:i.default.toString(e),error:t}})},LOAD_RESULTS_INIT:function(e){return i.default.toString(e)},LOAD_RESULTS_DONE:function(e,t,n){return(0,d.getApi)("V2",e.tokenV2).fetch("/"+n+"/challenges/result/"+t).then(function(e){return e.json()}).then(function(e){return{challengeId:i.default.toString(t),results:e.results}})},REGISTER_INIT:function(){},REGISTER_DONE:function(e,t){return(0,u.getService)(e.tokenV3).register(t).then(function(){return new o.default(function(n){return setTimeout(function(){return n(m(t,e.tokenV3,e.tokenV2))},a.config.CHALLENGE_DETAILS_REFRESH_DELAY)})})},TOGGLE_CHECKPOINT_FEEDBACK:function(e,t){return{id:e,open:t}},UNREGISTER_INIT:function(){},UNREGISTER_DONE:function(e,t){return(0,u.getService)(e.tokenV3).unregister(t).then(function(){return new o.default(function(n){return setTimeout(function(){return n(m(t,e.tokenV3,e.tokenV2))},a.config.CHALLENGE_DETAILS_REFRESH_DELAY)})})},UPDATE_CHALLENGE_INIT:function(e){return e},UPDATE_CHALLENGE_DONE:function(e,t,n){return(0,u.getService)(n).updateChallenge(t).then(function(t){return{uuid:e,res:t}})},GET_ACTIVE_CHALLENGES_COUNT_INIT:function(){},GET_ACTIVE_CHALLENGES_COUNT_DONE:function(e,t){return(0,u.getService)(t).getActiveChallengesCount(e)},GET_MM_SUBMISSIONS_INIT:function(e){return i.default.toString(e)},GET_MM_SUBMISSIONS_DONE:function(e,t,n,i){var a={challengeId:e},s=(0,c.getService)(i),u=(0,l.getService)(i),d=[s.getMembersInformation(t),function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=arguments[2];return t({page:n,perPage:h}).then(function(o){if(0===o.length)return r||o;var i=[];return i=r?r.concat(o):o,e(t,1+n,i)})}(function(e){return u.getSubmissions(a,e)})];return o.default.all(d).then(function(t){var o=(0,r.default)(t,2),a=o[0],s=o[1],u=f.processMMSubmissions(s,a,n);return{challengeId:e,submissions:u,tokenV3:i}})}}})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=c(n(4)),o=c(n(3)),i=c(n(5)),a=c(n(8)),s=c(n(9));t.getService=function(e){f&&f.private.tokenV3===e||(f=new d(e));return f};var u=c(n(14)),l=n(6);function c(e){return e&&e.__esModule?e:{default:e}}var d=function(){function e(t){(0,a.default)(this,e),this.private={apiV5:(0,l.getApi)("V5",t),tokenV3:t}}return(0,s.default)(e,[{key:"getSubmissions",value:function(){var e=(0,i.default)(r.default.mark(function e(t,n){var i,a;return r.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return i=(0,o.default)({},t,n),a="/submissions?"+u.default.stringify(i,{encode:!1}),e.abrupt("return",this.private.apiV5.get(a).then(function(e){return e.ok?e.json():new Error(e.statusText)}).then(function(e){return e}));case 3:case"end":return e.stop()}},e,this)}));return function(t,n){return e.apply(this,arguments)}}()}]),e}(),f=null;t.default=void 0},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=i(n(17));t.getProvisionalScore=function(e){var t=e.submissions;if(!t||0===t.length)return 0;var n=t[0].provisionalScore;if(!n||n<0)return 0;return n},t.getFinalScore=function(e){var t=e.submissions;if(!t||0===t.length)return 0;var n=t[0].finalScore;if(!n||n<0)return 0;return n},t.processMMSubmissions=function(e,t,n){var i={},u=[];o.default.each(e,function(e){var n=e.memberId,r=void 0,u=o.default.find(t,function(e){return o.default.get(e,"userId").toString()===n.toString()});r=o.default.isEmpty(u)?n:o.default.has(u,"handle")?o.default.get(u,"handle"):n.toString(),i[r]||(i[r]=[]);var l=o.default.filter(e.review,function(e){return!o.default.isEmpty(e)&&e.typeId!==a});l.sort(function(e,t){var n=new Date(e.created),r=new Date(t.created);return r-n});var c=s(parseFloat(o.default.get(l,"[0].score","-")),5),d=s(parseFloat(o.default.get(e,"reviewSummation[0].aggregateScore","-")),5);i[r].push({submissionId:e.id,submissionTime:e.created,provisionalScore:c,finalScore:d})}),o.default.each(i,function(e,t){u.push({submissions:[].concat((0,r.default)(e.sort(function(e,t){return new Date(t.submissionTime).getTime()-new Date(e.submissionTime).getTime()}))),member:t,colorStyle:function(e,t){var n=o.default.get(o.default.find(t,function(t){return t.handle===e}),"colorStyle",null);return n?JSON.parse(n.replace(/(\w+):\s*([^;]*)/g,'{"$1": "$2"}')):{}}(t,n)})});var l=function(e){var t=0;e.sort(function(e,t){var n=o.default.get(e,"submissions[0]",{provisionalScore:0}).provisionalScore,r=o.default.get(t,"submissions[0]",{provisionalScore:0}).provisionalScore;return"-"===n&&(n=0),"-"===r&&(r=0),n===r?new Date(o.default.get(e,"submissions[0].submissionTime"))-new Date(o.default.get(t,"submissions[0].submissionTime")):r-n}),o.default.each(e,function(t,n){e[n].provisionalRank=n+1}),e.sort(function(e,n){var r=o.default.get(e,"submissions[0]",{finalScore:0}).finalScore,i=o.default.get(n,"submissions[0]",{finalScore:0}).finalScore;return"-"===r&&(r=0),"-"===i&&(i=0),r>0&&(t=r),i>0&&(t=i),r===i?new Date(o.default.get(e,"submissions[0].submissionTime"))-new Date(o.default.get(n,"submissions[0].submissionTime")):i-r}),t>0&&o.default.each(e,function(t,n){e[n].finalRank=n+1});return{submissions:e,maxFinalScore:t}}(u),c=l.submissions,d=l.maxFinalScore;return c.sort(function(e,t){return 0===d?e.provisionalRank-t.provisionalRank:e.finalRank-t.finalRank}),c};var o=i(n(0));function i(e){return e&&e.__esModule?e:{default:e}}var a="68c5a381-c8ab-48af-92a7-7a869a4ee6c3";function s(e,t){var n=o.default.toFinite(function(e,t){if(o.default.isNaN(e))return 0;var n=Math.pow(10,t+1),r=Math.pow(10,t);return Math.round(e*n/10)/r}(e,t).toFixed(t)),r=o.default.toFinite(function(e,t){return(e%t+t)%t}(n,t));return o.default.isInteger(r)?r:n}t.default=void 0},function(e,t,n){e.exports=void 0===window.JSON?n(89).parse:window.JSON.parse},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=A(n(1)),o=A(n(16)),i=A(n(4)),a=A(n(5)),s=function(){var e=(0,a.default)(i.default.mark(function e(t,n){var r;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=void 0,e.prev=1,e.next=4,(0,k.getService)().getAchievements(t);case 4:r=e.sent,e.next=10;break;case 7:e.prev=7,e.t0=e.catch(1),r=[];case 10:return e.abrupt("return",{data:r,handle:t,uuid:n});case 11:case"end":return e.stop()}},e,this,[[1,7]])}));return function(t,n){return e.apply(this,arguments)}}(),u=function(){var e=(0,a.default)(i.default.mark(function e(t,n){var r;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=void 0,e.prev=1,e.next=4,(0,k.getService)().getAchievementsV3(t);case 4:r=e.sent,e.next=10;break;case 7:e.prev=7,e.t0=e.catch(1),r=[];case 10:return e.abrupt("return",{data:r,handle:t,uuid:n});case 11:case"end":return e.stop()}},e,this,[[1,7]])}));return function(t,n){return e.apply(this,arguments)}}(),l=function(){var e=(0,a.default)(i.default.mark(function e(t,n,r){var o;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,I.getService)(r).getMemberFinances(t);case 2:return o=e.sent,e.abrupt("return",{data:o,handle:t,uuid:n});case 4:case"end":return e.stop()}},e,this)}));return function(t,n,r){return e.apply(this,arguments)}}(),c=function(){var e=(0,a.default)(i.default.mark(function e(t,n){return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",{handle:t,uuid:n});case 1:case"end":return e.stop()}},e,this)}));return function(t,n){return e.apply(this,arguments)}}(),d=function(){var e=(0,a.default)(i.default.mark(function e(t,n,r){var o;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,I.getService)(r).getStats(t);case 2:return o=e.sent,e.abrupt("return",{data:o,handle:t,uuid:n});case 4:case"end":return e.stop()}},e,this)}));return function(t,n,r){return e.apply(this,arguments)}}(),f=function(){var e=(0,a.default)(i.default.mark(function e(t,n){return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",{handle:t,uuid:n});case 1:case"end":return e.stop()}},e,this)}));return function(t,n){return e.apply(this,arguments)}}(),p=function(){var e=(0,a.default)(i.default.mark(function e(t,n,a){var s,u,l,c,d,f,p;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return l=function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return t({limit:50,offset:50*n}).then(function(o){var i=o.challenges;return i.length?e(t,1+n,r?r.concat(i):i):r||[]})},s={status:"ACTIVE"},u=(0,O.getService)(a),c=[l(function(e){return u.getUserChallenges(t,s,e)})],e.next=6,r.default.all(c);case 6:return d=e.sent,f=(0,o.default)(d,1),p=f[0],e.abrupt("return",{handle:t,challenges:p,uuid:n});case 10:case"end":return e.stop()}},e,this)}));return function(t,n,r){return e.apply(this,arguments)}}(),h=function(){var e=(0,a.default)(i.default.mark(function e(t,n){return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",{handle:t,uuid:n});case 1:case"end":return e.stop()}},e,this)}));return function(t,n){return e.apply(this,arguments)}}(),m=function(){var e=(0,a.default)(i.default.mark(function e(t,n,r){var o;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,I.getService)(r).getStatsHistory(t);case 2:return o=e.sent,e.abrupt("return",{data:o,handle:t,uuid:n});case 4:case"end":return e.stop()}},e,this)}));return function(t,n,r){return e.apply(this,arguments)}}(),g=function(){var e=(0,a.default)(i.default.mark(function e(t,n){return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",{handle:t,uuid:n});case 1:case"end":return e.stop()}},e,this)}));return function(t,n){return e.apply(this,arguments)}}(),y=function(){var e=(0,a.default)(i.default.mark(function e(t,n,r,o,a){var s;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,I.getService)(a).getStatsDistribution(t,n,r);case 2:return s=e.sent,e.abrupt("return",{data:s,handle:t,uuid:o});case 4:case"end":return e.stop()}},e,this)}));return function(t,n,r,o,i){return e.apply(this,arguments)}}(),v=function(){var e=(0,a.default)(i.default.mark(function e(t,n){return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",{handle:t,uuid:n});case 1:case"end":return e.stop()}},e,this)}));return function(t,n){return e.apply(this,arguments)}}(),b=function(){var e=(0,a.default)(i.default.mark(function e(t,n,r,o,a,s,u,l){var c,d,f;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return c={status:"completed",hasUserSubmittedForReview:"true",track:o,subTrack:a},(d={}).orderBy="submissionEndDate desc",d.limit=u,d.offset=s*u,f=(0,O.getService)(r),e.abrupt("return",f.getUserChallenges(n,c,d).then(function(e){return{uuid:t,challenges:e.challenges,refresh:l,handle:n}}));case 7:case"end":return e.stop()}},e,this)}));return function(t,n,r,o,i,a,s,u){return e.apply(this,arguments)}}(),_=function(){var e=(0,a.default)(i.default.mark(function e(t,n){return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",{handle:t,uuid:n});case 1:case"end":return e.stop()}},e,this)}));return function(t,n){return e.apply(this,arguments)}}(),w=function(){var e=(0,a.default)(i.default.mark(function e(t,n,r,o,a,s){var u,l,c;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return u={status:"past",isRatedForSRM:"true"},l={filter:C.default.stringify(u,{encode:!1}),limit:a,offset:o*a},c=(0,O.getService)(r),e.abrupt("return",c.getUserSrms(n,l).then(function(e){return{uuid:t,srms:e,refresh:s,handle:n}}));case 4:case"end":return e.stop()}},e,this)}));return function(t,n,r,o,i,a){return e.apply(this,arguments)}}(),E=function(){var e=(0,a.default)(i.default.mark(function e(t,n){return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",{handle:t,uuid:n});case 1:case"end":return e.stop()}},e,this)}));return function(t,n){return e.apply(this,arguments)}}(),T=function(){var e=(0,a.default)(i.default.mark(function e(t,n,r,o,a,s){var u,l,c;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return u={status:"PAST",isRatedForMM:"true"},(l={}).orderBy="endDate desc",l.limit=a,l.offset=o*a,c=(0,O.getService)(r),e.abrupt("return",c.getUserMarathonMatches(n,u,l).then(function(e){return{uuid:t,marathons:e,refresh:s,handle:n}}));case 7:case"end":return e.stop()}},e,this)}));return function(t,n,r,o,i,a){return e.apply(this,arguments)}}(),C=A(n(14)),S=n(2),I=n(20),k=n(27),O=n(19);function A(e){return e&&e.__esModule?e:{default:e}}t.default=(0,S.createActions)({MEMBERS:{DROP:function(e){return e},DROP_ALL:function(){},GET_ACHIEVEMENTS_INIT:function(e,t){return{handle:e,uuid:t}},GET_ACHIEVEMENTS_DONE:s,GET_ACHIEVEMENTS_V3_DONE:u,GET_FINANCES_INIT:function(e,t){return{handle:e,uuid:t}},GET_FINANCES_DONE:l,GET_STATS_INIT:c,GET_STATS_DONE:d,GET_STATS_HISTORY_INIT:h,GET_STATS_HISTORY_DONE:m,GET_STATS_DISTRIBUTION_INIT:g,GET_STATS_DISTRIBUTION_DONE:y,GET_ACTIVE_CHALLENGES_INIT:f,GET_ACTIVE_CHALLENGES_DONE:p,GET_SUBTRACK_CHALLENGES_INIT:v,GET_SUBTRACK_CHALLENGES_DONE:b,GET_USER_SRM_INIT:_,GET_USER_SRM_DONE:w,GET_USER_MARATHON_INIT:E,GET_USER_MARATHON_DONE:T}})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PAGE_SIZE=void 0;var r=n(2),o=n(19),i=t.PAGE_SIZE=50;t.default=(0,r.createActions)({MEMBER_TASKS:{DROP_ALL:function(){return null},GET_INIT:function(e,t){return{pageNum:t,uuid:e}},GET_DONE:function(e,t,n,r){return(0,o.getService)(r).getChallenges({isTask:1,projectId:t},{limit:i,offset:n*i}).then(function(n){var r=n.challenges,o=n.totalCount;return{projectId:t,tasks:r,totalCount:o,uuid:e}})}}})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(e){return e&&e.__esModule?e:{default:e}}(n(1)),o=n(2),i=n(46),a=n(12);t.default=(0,o.createActions)({REVIEW_OPPORTUNITY:{CANCEL_APPLICATIONS_INIT:function(){},CANCEL_APPLICATIONS_DONE:function(e,t,n){return(0,i.getReviewOpportunitiesService)(n).cancelApplications(e,t)},GET_DETAILS_INIT:function(){},GET_DETAILS_DONE:function(e,t){return(0,i.getReviewOpportunitiesService)(t).getDetails(e).catch(function(e){return 401!==e.status&&(0,a.fireErrorMessage)("Error Getting Review Opportunity Details",e.content||e),r.default.reject(e.status)})},SUBMIT_APPLICATIONS_INIT:function(){},SUBMIT_APPLICATIONS_DONE:function(e,t,n){return(0,i.getReviewOpportunitiesService)(n).submitApplications(e,t)}}})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=s(n(1)),o=s(n(8)),i=s(n(9));t.getReviewOpportunitiesService=function(e){l&&e===l.private.tokenV3||(l=new u(e));return l};var a=n(6);function s(e){return e&&e.__esModule?e:{default:e}}var u=function(){function e(t){(0,o.default)(this,e),this.private={api:(0,a.getApi)("V3",t),tokenV3:t}}return(0,i.default)(e,[{key:"getReviewOpportunities",value:function(e,t){var n="/reviewOpportunities?limit="+e+"&offset="+t;return this.private.api.get(n).then(function(e){return e.ok?e.json():r.default.reject(new Error("Error Code: "+e.status))}).then(function(e){return 200===e.result.status?e.result.content:r.default.reject(e.result.content)})}},{key:"getDetails",value:function(e){var t="/reviewOpportunities/"+e;return this.private.api.get(t).then(function(e){return e.json()}).then(function(e){return 200===e.result.status?e.result.content:r.default.reject(e.result)})}},{key:"submitApplications",value:function(e,t){var n="/reviewOpportunities/"+e+"/applications?reviewApplicationRoleIds="+t.join(",");return this.private.api.post(n,{}).then(function(e){return JSON.parse(e)})}},{key:"cancelApplications",value:function(e,t){var n="/reviewOpportunities/"+e+"/applications?reviewApplicationRoleIds="+t.join(",");return this.private.api.delete(n,{}).then(function(e){return JSON.parse(e)})}}]),e}(),l=null;t.default=void 0},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(2),o=n(48);t.default=(0,r.createActions)({LOOKUP:{GET_SKILL_TAGS_INIT:function(){},GET_SKILL_TAGS_DONE:function(){return(0,o.getService)().getTags({domain:"SKILLS",status:"APPROVED"})},GET_COUNTRIES_INIT:function(){},GET_COUNTRIES_DONE:function(){return(0,o.getService)().getCountries()}}})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=c(n(4)),o=c(n(5)),i=c(n(8)),a=c(n(9));t.getService=function(e){f&&e===f.private.tokenV3||(f=new d(e));return f};var s=c(n(14)),u=n(13),l=n(6);function c(e){return e&&e.__esModule?e:{default:e}}var d=function(){function e(t){(0,i.default)(this,e),this.private={api:(0,l.getApi)("V3",t),tokenV3:t}}return(0,a.default)(e,[{key:"getTags",value:function(){var e=(0,o.default)(r.default.mark(function e(t){var n;return r.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.private.api.get("/tags/?"+s.default.stringify(t));case 2:return n=e.sent,e.abrupt("return",(0,u.getApiResponsePayload)(n));case 4:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"getCountries",value:function(){var e=(0,o.default)(r.default.mark(function e(){var t;return r.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.private.api.get("/members/lookup/countries");case 2:return t=e.sent,e.abrupt("return",(0,u.getApiResponsePayload)(t));case 4:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()}]),e}(),f=null;t.default=void 0},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=f(n(4)),o=f(n(5)),i=function(){var e=(0,o.default)(r.default.mark(function e(t,n){var o;return r.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,d.getService)(n).getAllUserTraits(t);case 2:return o=e.sent,e.abrupt("return",{data:o,handle:t});case 4:case"end":return e.stop()}},e,this)}));return function(t,n){return e.apply(this,arguments)}}(),a=function(){var e=(0,o.default)(r.default.mark(function e(t,n,o,i){var a;return r.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,d.getService)(i).addUserTrait(t,n,o);case 2:return a=e.sent,e.abrupt("return",{result:a,handle:t,traitId:n});case 4:case"end":return e.stop()}},e,this)}));return function(t,n,r,o){return e.apply(this,arguments)}}(),s=function(){var e=(0,o.default)(r.default.mark(function e(t,n,o,i){var a;return r.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,d.getService)(i).updateUserTrait(t,n,o);case 2:return a=e.sent,e.abrupt("return",{result:a,handle:t,traitId:n});case 4:case"end":return e.stop()}},e,this)}));return function(t,n,r,o){return e.apply(this,arguments)}}(),u=function(){var e=(0,o.default)(r.default.mark(function e(t,n,o){var i;return r.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,d.getService)(o).deleteUserTrait(t,n);case 2:return i=e.sent,e.abrupt("return",{data:i,handle:t,traitId:n});case 4:case"end":return e.stop()}},e,this)}));return function(t,n,r){return e.apply(this,arguments)}}(),l=n(2),c=f(n(0)),d=n(50);function f(e){return e&&e.__esModule?e:{default:e}}t.default=(0,l.createActions)({SETTINGS:{GET_ALL_USER_TRAITS:i,ADD_USER_TRAIT:a,DELETE_USER_TRAIT:u,UPDATE_USER_TRAIT:s,MODIFY_USER_TRAIT_INIT:c.default.noop}})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=c(n(4)),o=c(n(5)),i=c(n(8)),a=c(n(9));t.getService=function(e){f&&e===f.private.tokenV3||(f=new d(e));return f};var s=c(n(93)),u=n(13),l=n(6);function c(e){return e&&e.__esModule?e:{default:e}}var d=function(){function e(t){(0,i.default)(this,e),this.private={api:(0,l.getApi)("V3",t),tokenV3:t}}return(0,a.default)(e,[{key:"getAllUserTraits",value:function(){var e=(0,o.default)(r.default.mark(function e(t){var n;return r.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.private.api.get("/members/"+t.toLowerCase()+"/traits");case 2:return n=e.sent,e.abrupt("return",(0,u.getApiResponsePayload)(n));case 4:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"addUserTrait",value:function(){var e=(0,o.default)(r.default.mark(function e(t,n,o){var i,a;return r.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return i={param:[{traitId:n,categoryName:(0,s.default)(n),traits:{data:o}}]},e.next=3,this.private.api.postJson("/members/"+t+"/traits",i);case 3:return a=e.sent,e.abrupt("return",(0,u.getApiResponsePayload)(a));case 5:case"end":return e.stop()}},e,this)}));return function(t,n,r){return e.apply(this,arguments)}}()},{key:"updateUserTrait",value:function(){var e=(0,o.default)(r.default.mark(function e(t,n,o){var i,a;return r.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return i={param:[{traitId:n,categoryName:(0,s.default)(n),traits:{data:o}}]},e.next=3,this.private.api.putJson("/members/"+t+"/traits",i);case 3:return a=e.sent,e.abrupt("return",(0,u.getApiResponsePayload)(a));case 5:case"end":return e.stop()}},e,this)}));return function(t,n,r){return e.apply(this,arguments)}}()},{key:"deleteUserTrait",value:function(){var e=(0,o.default)(r.default.mark(function e(t,n){var o;return r.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.private.api.delete("/members/"+t+"/traits?traitIds="+n);case 2:return o=e.sent,e.abrupt("return",(0,u.getApiResponsePayload)(o));case 4:case"end":return e.stop()}},e,this)}));return function(t,n){return e.apply(this,arguments)}}()}]),e}(),f=null;t.default=void 0},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=u(n(4)),o=u(n(5)),i=function(){var e=(0,o.default)(r.default.mark(function e(t){var n;return r.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,s.getService)().getLooker(t);case 2:return n=e.sent,e.abrupt("return",{data:n,lookerId:t});case 4:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}(),a=n(2),s=n(94);function u(e){return e&&e.__esModule?e:{default:e}}t.default=(0,a.createActions)({LOOKER:{GET_LOOKER_DONE:i}})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=l(n(1)),o=l(n(7)),i=l(n(3));t.factory=function(){return r.default.resolve(c())};var a=l(n(0)),s=n(2),u=l(n(23));function l(e){return e&&e.__esModule?e:{default:e}}function c(e){var t;return(0,s.handleActions)((t={},(0,o.default)(t,u.default.smp.deleteSubmissionDone,function(e){return(0,i.default)({},e,{deletingSubmission:!1})}),(0,o.default)(t,u.default.smp.deleteSubmissionInit,function(e){return(0,i.default)({},e,{deletingSubmission:!0})}),t),a.default.defaults(e,{}))}t.default=c()},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.submission=t.mock=t.time=t.tc=t.errors=t.logger=t.challenge=t.services=t.actions=t.reducers=t.reducerFactory=void 0;var r=n(54);Object.defineProperty(t,"actions",{enumerable:!0,get:function(){return r.actions}});var o=n(95);Object.defineProperty(t,"services",{enumerable:!0,get:function(){return o.services}});var i=n(98);Object.defineProperty(t,"challenge",{enumerable:!0,get:function(){return i.challenge}}),Object.defineProperty(t,"logger",{enumerable:!0,get:function(){return i.logger}}),Object.defineProperty(t,"errors",{enumerable:!0,get:function(){return i.errors}}),Object.defineProperty(t,"tc",{enumerable:!0,get:function(){return i.tc}}),Object.defineProperty(t,"time",{enumerable:!0,get:function(){return i.time}}),Object.defineProperty(t,"mock",{enumerable:!0,get:function(){return i.mock}}),Object.defineProperty(t,"submission",{enumerable:!0,get:function(){return i.submission}});var a=n(100),s=function(e){return e&&e.__esModule?e:{default:e}}(a);t.reducerFactory=a.factory,t.reducers=s.default},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.actions=void 0;var r=v(n(28)),o=v(n(23)),i=v(n(31)),a=v(n(33)),s=v(n(36)),u=v(n(38)),l=v(n(22)),c=v(n(39)),d=v(n(26)),f=v(n(43)),p=v(n(44)),h=v(n(45)),m=v(n(47)),g=v(n(49)),y=v(n(51));function v(e){return e&&e.__esModule?e:{default:e}}t.actions={auth:r.default.auth,smp:o.default.smp,challenge:c.default.challenge,terms:a.default.terms,stats:i.default.stats,direct:s.default.direct,groups:u.default.groups,errors:l.default.errors,profile:d.default.profile,members:f.default.members,memberTasks:p.default.memberTasks,reviewOpportunity:h.default.reviewOpportunity,lookup:m.default.lookup,settings:g.default.settings,looker:y.default.looker};t.default=void 0},function(e,t){e.exports=__WEBPACK_EXTERNAL_MODULE__55__},function(e,t){e.exports=__WEBPACK_EXTERNAL_MODULE__56__},function(e,t){e.exports=__WEBPACK_EXTERNAL_MODULE__57__},function(e,t){e.exports=__WEBPACK_EXTERNAL_MODULE__58__},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=p(n(1)),o=p(n(8)),i=p(n(9));t.getService=function(e){console.error("WARNING:\n Mock version of DocuSign service is used! Should you see this message in\n production, contact support as soon as possible!"),(!g||e&&g.private.tokenV2!==e)&&(g=new m(e));return g};var a=p(n(0)),s=p(n(60)),u=p(n(61)),l=p(n(62)),c=p(n(63)),d=p(n(64)),f=p(n(65));function p(e){return e&&e.__esModule?e:{default:e}}var h=!1,m=function(){function e(t){(0,o.default)(this,e),this.private={tokenV2:t}}return(0,i.default)(e,[{key:"getChallengeTerms",value:function(e,t){var n=a.default.clone(this.private.tokenV2?s.default:l.default);if(n.serverInformation.currentTime=Date.now(),n.requesterInformation.receivedParams.challengeId=a.default.toString(e),this.private.tokenV2&&a.default.isArray(t))for(var o=0;o\r\nTo agree to the Appirio NDA, please electronically sign the document by following this link:\r\n\r\nhttps://community.topcoder.com/tc?module=SignDocument&templateId=fake-template-id\r\n

\r\n\r\n

\r\nOnce signed, you will be automatically added to the NDA terms of use and notified by email. \r\n

',agreed:!1,docusignTemplateId:"fake-template-id",serverInformation:{serverName:"TopCoder API",apiVersion:"0.0.1",requestDuration:4,currentTime:1504891122158},requesterInformation:{id:"d9994de712597c11d1caad64996d9fa0d9b4aa2c-w2VCwwGwnN6EeyhK",remoteIP:"12.34.56.789",receivedParams:{apiVersion:"v2",termsOfUseId:"21153",action:"getTermsOfUse"}}}},function(e){e.exports={terms:[{termsOfUseId:21193,title:"Standard Terms for Topcoder Competitions v2.1",url:"",agreeabilityType:"Electronically-agreeable",templateId:null},{termsOfUseId:21153,title:"Appirio NDA v2.0",url:"http://community.topcoder.com/tc?module=Terms&tuid=21153",agreeabilityType:"DocuSignable",templateId:"fake-template-id"}],serverInformation:{serverName:"Topcoder API",apiVersion:"0.0.1",requestDuration:11471,currentTime:1504879510947},requesterInformation:{id:"456f987dee6e9823179c8184fd3509ffdf9c613a-FyefLdEpb8UHgFQF",remoteIP:"12.34.567.890",receivedParams:{role:"Submitter",noauth:"true",apiVersion:"v2",challengeId:"30059255",action:"getChallengeTerms"}}}},function(e){e.exports={terms:[{termsOfUseId:21153,title:"Appirio NDA v2.0",url:"http://community.topcoder.com/tc?module=Terms&tuid=21153",agreeabilityType:"DocuSignable",agreed:!1,templateId:"fake-template-id"},{termsOfUseId:20704,title:"Standard Reviewer Terms v1.0",url:"",agreeabilityType:"Electronically-agreeable",agreed:!1,templateId:null}],serverInformation:{serverName:"Topcoder API",apiVersion:"0.0.1",requestDuration:29,currentTime:1504878884618},requesterInformation:{id:"1b37607c519c318194ce6da08c519c0a3f7c9855-7FSFCyd6oSX2mV6Z",remoteIP:"12.34.567.890",receivedParams:{role:"Submitter",apiVersion:"v2",challengeId:"30059255",action:"getChallengeTerms"}}}},function(e){e.exports={termsOfUseId:20704,title:"Standard Reviewer Terms v1.0",url:"",text:'

Standard Reviewer Terms (Version 1.0)

\r\n\r\n

THESE ARE THE TERMS AND CONDITIONS ("TERMS") UNDER WHICH YOU AGREE TO WORK UNDER AS A TOPCODER REVIEW BOARD MEMBER. THESE TERMS AND CONDITIONS AFFECT YOUR RIGHTS AND YOU SHOULD READ THEM CAREFULLY BEFORE AGREEING TO THEM. IN THESE TERMS AND CONDITIONS, "WE," "US," "ITS" AND "OUR" REFER TO TOPCODER, INC. AND "YOU" AND "YOUR" REFER TO YOU.

\r\n\r\n

It is understood that We need, and You have, expertise in evaluating and critiquing software designs and/or software development solutions. Furthermore, You agree that You are ready, willing, and able to undertake the performance of evaluating and critiquing such software designs and/or software development solutions submitted to Us, and You agree to assign and transfer your rights as a result of performing such services.

\r\n\r\n

In consideration of the premises and the mutual promises and covenants set forth herein, and for other good and valuable consideration, the receipt and sufficiency of which are hereby acknowledged, the parties agree as follows:

\r\n\r\n

1.0\tDefinitions:

\r\n

As used in these Terms, the following capitalized terms shall have the following meanings unless otherwise indicated:

\r\n\r\n

1.1.\t"Development(s)" shall mean any idea, design, concept, development, component, algorithm, process, method, formula, code, software, technique, technology, discovery or improvement, whether or not patentable, made, conceived, created, discovered, invented or reduced to practice by You in connection with the performance of services hereunder.

\r\n\r\n

1.2.\t"Intellectual Property Rights" shall mean all intellectual property rights worldwide arising under statutory or common law or by contract and whether or not perfected, now existing or hereafter filed, issued or acquired, including all patent rights; all rights associated with works of authorship including copyrights and moral rights; rights relating to the protection of trade secrets and confidential information; and any right analogous to those set forth herein and any other proprietary rights relating to intangible property, other than Trademarks.

\r\n\r\n

1.3.\t"TopCoder Information" shall mean TopCoder\'s and TopCoder Software\'s specifications, descriptions, architecture, plans, interfaces, and code for TopCoder\'s and TopCoder Software\'s hardware, software, and web site; TopCoder\'s competitions and competition operation procedures; TopCoder\'s and TopCoder Software\'s business and operational plans; and derivatives of the foregoing. The TopCoder Information shall be Confidential Information hereunder.

\r\n\r\n

1.4.\t"Software Component" shall mean all software and related materials, technology and documentation (including without limitation design documents, source code and object code) to be evaluated and assessed by You for Us hereunder in accordance with our requirements, as set forth herein and in other documents provided by Us. The Software Component shall be Confidential Information hereunder.

\r\n\r\n

2.\tServices:

\r\n\r\n

2.1\tYou hereby agree to provide services relating to the evaluation and assessment of the Software Component. You agree to perform such services according to and in conformity with the following specifications, in addition to any specifications and/or scheduled provided by Us in our sole discretion (the "Services"):

\r\n\r\n
    Architecture Review Board requirements per component project:\r\n
  • If assigned the role of Primary Architect, as designated by Us, You will review all component submissions to check if all required elements are present as defined in the Design Screening Scorecard. If all required elements are present, then the reviewer objectively scores the design on a series of questions in the Design Screening Scorecard. This process will narrow down the component submissions to the top components, which will go on to a more detailed review.
  • \r\n
  • All Architecture Review Board members for a component will fill out a subjective review for each component that passes the screening phase. This review is performed through a series of questions in the Design Review Scorecard. Each question requires both a score and comments.
  • \r\n
  • The Primary Architect is responsible for aggregating all review comments. This includes resolving any conflicts between differing architect comments. The Primary Architect may deem some suggestions as mandatory with our permission.
  • \r\n
  • The Primary Architect is responsible for giving final review to the component submission once the comments have been applied. This includes ensuring that mandatory suggestions have been implemented, and that all suggestions implemented have been done correctly.
  • \r\n
  • All interaction with designers, our personnel and other Architecture Review Board members should occur in the online forum on www.topcodersoftware.com.
  • \r\n
\r\n\r\n
    Development Review Board requirements per component project:\r\n\r\n
  • If assigned the role of Primary Reviewer, as designated by Us, You will review all component submissions to check if all required elements are present as defined in the Development Screening Scorecard. If all required elements are present, then the reviewer objectively scores the development solution on a series of questions in the Development Screening Scorecard. This process will narrow down the component submissions to the top components, which will go on to a more detailed review.
  • \r\n
  • All Development Review Board members for a component will fill out a subjective review for each component that passes the screening phase. This review is performed through a series of questions in the Development Review Scorecard. Each question requires both a score and comments. In addition, the reviewers will each be assigned one of the following roles, which defines what type of test cases they are responsible for submitting:
  • \r\n
      \r\n
    • Stress Tester - Develop test cases to stress test component solutions in order to get performance metrics on throughput and capacity.
    • \r\n
    • Accuracy Tester - Develop test cases to test the accuracy of the component. Each public method should be tested to ensure it returns the expected result.
    • \r\n
    • Failure Tester - Develop test cases to test different input types for all constructor methods and public methods that are not covered in the developer unit test cases or the designer test cases.
    • \r\n
    \r\n
  • All interaction with designers, developers, our personnel and other Development Review Board members should occur in the online forum on www.topcodersoftware.com.
  • \r\n
\r\n\r\n

2.2\tYou agree to commit sufficient time and resources to perform the Services according to the schedule set forth by Us. You shall promptly notify Us of any circumstances, as such circumstances arise, that may reasonably be anticipated to lead to a material deviation from the schedule.

\r\n\r\n

2.3\tYou agree to keep Us updated, promptly upon our request, of any progress, problems, and/or developments of which You are aware regarding the Services. We shall have the right to require such updates in writing from You in a format specified by Us or acceptable to Us in our sole discretion. You shall conduct and conclude the Services in a professional manner.

\r\n\r\n

3.\tConsideration/Compensation:

\r\n\r\n

3.1\tFee. In consideration for performance of the Services required by You, We shall pay You the fee set forth on TopCoder\'s website and/or in other correspondence from Us to You (the "Fee"). The Fee shall be in U.S. Dollars and may be paid in installments, as set forth on our website or in other correspondence from Us. The Fee shall be paid upon the conclusion of the review period, and once completed scorecards have been received, provided the completed scorecards are submitted to Us by the deadline as set forth on the website and/or in the correspondence from Us.

\r\n\r\n

3.2\tRoyalty Payments.

\r\n \r\n

(a)\tDefinitions. As used in this Section 3, the following capitalized terms shall have the following meanings unless otherwise indicated:

\r\n
    \r\n
  • (i)\t"Royalty Percentage" shall mean the percentage of the Royalty Pool to be distributed by Us, at our sole discretion, to all review board members who evaluate the Software Components.
  • \r\n
  • (ii) "Royalty Pool Percentage" shall mean the percentage of total revenue We derive from the sale of Software Components. We, in our sole discretion, shall determine the Royalty Pool Percentage and may modify or amend the Royalty Pool Percentage at any time for any or no reason.
  • \r\n
  • (iii) "Royalty Pool" shall mean the portion of our revenues that We distribute as royalty payments to the designers, architects, developers and quality assurance developers who designed, evaluated, developed and tested the applicable Software Components. The Royalty Pool shall be determined by multiplying (x) the Royalty Pool Percentage by (y) the total revenues received by Us from licenses of the applicable Software Components during the respective fiscal quarter.
  • \r\n
  • (iv) "Revenue Receipt Date" shall mean the date on which We first receive payment of revenue from licenses of an applicable Software Components.
  • \r\n
\r\n\r\n

(b)\tIn consideration of Your evaluation of the Software Components and performance of Your obligations hereunder, We may pay to You a royalty (the "Royalty Payment"). The Royalty Payment to be paid shall be a portion of the Royalty Pool. The Royalty Pool shall be distributed as follows:

\r\n\r\n
    \r\n
  • (i) 25% to all Architecture Review Board members. (This amount will be distributed equally amongst all review board members.)
  • \r\n
  • (ii) 25% to all Development Review Board members. (This amount will be distributed equally amongst all review board members.)
  • \r\n
  • (iii) 25% to the winning designer
  • \r\n
  • (iv) 25% to the winning developer
  • \r\n
\r\n\r\n

3.3\tTotal Payment. The sum of the Fee and the Royalty Payments shall be the total payment due to You. Any and all out-of-pocket expenses incurred by You in connection with performing the obligations hereunder are your sole responsibility. We will not reimburse You for any expenses incurred.

\r\n\r\n

3.4\tYou shall not be entitled to receive any other compensation or any benefits from Us in connection with the Services. Except as otherwise required by law, We shall not withhold any sums or payments made to You for social security or other federal, state or local tax liabilities or contributions, and all withholdings, liabilities, and contributions shall be solely your responsibility. Further, You understand and agree that the Services are not covered under the unemployment compensation laws and are not intended to be covered by workers\' compensation laws.

\r\n\r\n

4.\tOwnership and Rights:

\r\n\r\n

4.1\tYou hereby acknowledge and agree that We own, solely and exclusively, all right, title and interest, including all Intellectual Property Rights, in and to the TopCoder Information. In addition, You hereby irrevocably and unconditionally transfer and assign to Us all right, title and interest You had, have, may have or acquire in or to all Developments and Software Components, and You agree to execute and deliver such documents, certificates, assignments and other writings, and take such other actions as may be necessary or desirable to vest in Us the ownership rights granted to Us hereunder.

\r\n\r\n

4.2\tYou further agree that any and all works of authorship created, authored or developed by You hereunder shall be deemed to be "works made for hire" within the meaning of the United States Copyright Law and, as such, all rights therein including copyright shall belong solely and exclusively to Us from the time of their creation. To the extent any such work of authorship may not be deemed to be a work made for hire, You agree to, and do hereby, irrevocably and unconditionally transfer and assign to Us all right, title and interest including copyright in and to such work.

\r\n\r\n

4.3\tYou agree that if We are unable, because of your unavailability, or for any other reason, to secure your signature to apply for or to pursue any application for any United States or foreign patents, mask work, copyright or trademark registrations covering the assignments to Us above, then You hereby irrevocably designates and appoints Us and your duly authorized officers and agents as your agent and attorney in fact, to act for and in your behalf and stead to execute and file any such applications and to do all other lawfully permitted acts to further the prosecution and issuance of patents, copyright, mask work and trademark registrations thereon with the same legal force and effect as if executed by your authorized agent.

\r\n\r\n

4.4\tAll Intellectual Property Rights owned by a party as of the date You agree to these Terms shall remain the property of such party and no licenses or other rights with respect to such intellectual property are granted to the other party except as expressly set forth herein.

\r\n\r\n

4.5\tNothing in these terms shall be construed as granting You any right or license under any of our Intellectual Property Right (including any rights We may have in any patents, copyrights, trademarks, service marks or any trade secrets), by implication, estoppel or otherwise, except as expressly set forth herein.

\r\n\r\n

5.\tConfidential Information:

\r\n\r\n

5.1\t"Confidential Information" shall mean any information, in whatever form, provided by Us to You with obligation of confidentiality, or designated by Us in writing as confidential, proprietary or marked with words of like import when provided to You, and information orally conveyed if We state at the time of oral conveyance or promptly thereafter that such information is confidential. Notwithstanding anything to the contrary contained herein, information about or relating to our software, our system interfaces, our hardware and software architecture, our business, operational and marketing plans, our member lists and database, all information and technology provided by Us to You to enable You to perform your obligations hereunder, TopCoder Information, and any and all Developments shall be considered Confidential Information.

\r\n\r\n

5.2\tConfidential Information shall not include information which (a) was in your possession without confidentiality restriction prior to disclosure by Us hereunder; (b) at or after the time of disclosure by Us becomes generally available to the public through no act or omission on our part; (c) is developed by You independently of and without reference to any Confidential Information You receive from Us; or (d) has come into your possession without confidentiality restriction from a third party and such third party is under no obligation to Us to maintain the confidentiality of such information.

\r\n\r\n

5.3\tYou acknowledge the confidential and proprietary nature of Confidential Information and agree (i) to hold Confidential Information in confidence and to take all reasonable precautions to protect such Confidential Information (including, without limitation, all precautions You employ with respect to your own confidential materials), (ii) not to divulge any such Confidential Information to any third person; and (iii) not to make any use whatsoever of such Confidential Information except as expressly authorized herein.

\r\n\r\n

5.4\tIn the event You are ordered to disclose Confidential Information pursuant to a judicial or government request, requirement or order, You shall promptly notify Us and upon our request, You shall, at our expense, take reasonable steps to assist Us in contesting such request, requirement or order or in otherwise protecting our rights prior to disclosure.

\r\n\r\n

5.5\tYou agree not to reproduce or copy by any means Confidential Information, except as reasonably required to perform the Services. Upon termination of your performance of the Services as a review board member, your right to use Confidential Information shall immediately terminate. In addition, upon such termination, or upon demand by Us at any time, You shall return promptly to Us or destroy, at our option, all tangible materials and computer data that disclose or embody Confidential Information.

\r\n\r\n

5.6\tYou agree that any breach of these terms by You could cause irreparable damage to Us. In view of the difficulties of placing a monetary value on the Confidential Information, We shall have, in addition to any and all remedies of law, the right to an injunction or other equitable relief, and may be entitled to a preliminary and final injunction without the necessity of posting any bond or undertaking in connection therewith to prevent any further breach or further unauthorized use of Confidential Information. This remedy is separate from any other remedy We may have.

\r\n\r\n

6.\tRepresentations and Warranties:

\r\n\r\n

6.1\tYou represent and warrant that:\r\n

    \r\n
  • (a) You are at least 18 years old;
  • \r\n
  • (b) You are either (i) a U.S. citizen, (ii) a lawful permanent resident of the U.S., (iii) currently residing in the U.S. with proper and valid work authorization to work as an independent contractor, or (iv) a non-U.S. citizen, not living in the U.S. and performing the Services while residing in your country of residence;
  • \r\n
  • (c)\tYou are legally able and have the power and authority to execute, deliver and perform the Services and any other agreements contemplated hereby and to consummate the transactions contemplated hereby;
  • \r\n
  • (d)\tNo impediment exists to You agreeing to these Terms, and no other agreement has been or shall be made with any third party which will interfere with its performance;
  • \r\n
  • (e)\tYou shall use Your own independently developed code, and shall not copy or include code from any other party, including publicly available "Open Source" code that is or may be subject to licensing restrictions, without our prior written permission; and
  • \r\n
  • (f)\tAny services performed by You as a review board member shall be performed in a professional and workmanlike manner.
  • \r\n
\r\n

\r\n\r\n

7.\tIntellectual Property Indemnification:

\r\n\r\n

7.1\tYou shall indemnify, hold harmless and defend Us and our customers from and against any and all suits, actions, damages, costs, losses, expenses (including settlement awards and reasonable attorneys\' fees) and other liabilities arising from or in connection with any claim alleging that, to your knowledge, any Development and/or Software Component violates any trade secret right, or infringes any copyright, patent, trademark, or other intellectual property interest, in any country, and shall pay all costs and damages awarded. We shall promptly notify You of any such claim of which We are aware.

\r\n\r\n

7.2\tYour obligations shall not extend to any claim for violation or infringement resulting solely from your compliance with any specific or direct written instructions from Us if such infringement would have been avoided but for such compliance.

\r\n\r\n

8.\tIndependent Contractors:

\r\n\r\n

8.1\tBoth parties expressly agree and understand that You are an independent contractor and nothing herein nor the services rendered hereunder is meant, or shall be construed in any way or manner, to create a relationship of employer and employee, principal and agent, partners or any other relationship other than that of independent parties contracting with each other solely for the purpose of carrying out the provisions of these Terms. Accordingly, You acknowledge and agree that You shall not be entitled to any benefits provided by Us to our employees. You shall be responsible for any and all out-of-pocket expenses incurred in connection with performing the Services. In addition, You shall have sole and exclusive responsibility for the payment of all federal, state and local income taxes, for all employment and disability insurance and for Social Security and other similar taxes with respect to any compensation provided by Us hereunder. You further agree that if We pay or become liable for such taxes or related civil penalties or interest as a result of your failure to pay taxes or report same, or due to our failure to withhold taxes, You shall indemnify and hold us harmless for any such liability. You shall assume and accept all responsibilities which are imposed on independent contractors by any statute, regulation, rule of law, or otherwise. You are not our agent and are not authorized and shall not have the power or authority to bind Us or incur any liability or obligation, or act on behalf of Us. At no time shall You represent that You are our agent, or that any of the views, advice, statements and/or information that may be provided while performing the Services are ours.

\r\n\r\n

8.2\tWe are entitled to provide You with general guidance to assist You in completing the scope of work to our satisfaction, You are ultimately responsible for directing and controlling the performance of the task and the scope of work, in accordance with these Terms. You shall use your best efforts, energy and skill in your own name and in such manner as You see fit.

',agreeabilityType:"Electronically-agreeable",serverInformation:{serverName:"Topcoder API",apiVersion:"0.0.1",requestDuration:52,currentTime:1504892902498},requesterInformation:{id:"d8c441f8332161f71533f368c09aeead856e4366-K1RdFai7LCAgXVu5",remoteIP:"12.34.56.78",receivedParams:{apiVersion:"v2",termsOfUseId:"21193",action:"getTermsOfUse"}}}},function(e){e.exports={termsOfUseId:21193,title:"Standard Terms for Topcoder Competitions v2.1",url:"",agreeabilityType:"Electronically-agreeable",text:'\r\n\r\n\r\n\r\n\r\n\r\n
\r\n\r\n

Terms & Conditions of Use at topcoder

\r\n\r\n

Acceptance of Terms and Conditions

\r\n\r\nWelcome to topcoder.com (and related sub-domains (the "Website"). By using the Website, you are indicating your agreement to these Terms and Conditions of Use ("Terms of Use"), including, without limitation, our privacy policy. If you do not agree to these Terms of Use, please do not use the Website and exit now. \r\n

\r\n\r\nThroughout these Terms of Use, the words "we," "us," "our," and topcoder refer to Topcoder, Inc., Appirio Inc. and their parents, subsidiaries and affiliates collectively. The term "Submissions" shall refer to any entry, component of an entry, or contents of a posting onto the Website submitted in connection with Competitions. "Competitions" shall refer to challenges, matches, tournaments or other competitions that take place on the Website or in connection with the topcoder Open ("TCO"). You and any other user of this Website that enters any Submissions with respect to Competitions shall be referred to herein as a "Contestant" in such capacity.\r\n

\r\n\r\n\r\nWe may revise these Terms of Use at any time without prior notice by updating this page and such revisions will be effective upon posting to this page. Please check this page periodically for any changes. Your continued use of this Website following the posting of any revisions to these Terms of Use will mean you accept those changes. We reserve the right to alter, suspend or discontinue any aspect of www.topcoder.com, including your access to it. Unless explicitly stated, any new features will be subject to these Terms of Use. \r\n

\r\n\r\n

General Eligibility

\r\nOur Website is not intended for use by children under the age of 13. You must have your parents" permission to use this Website if you have not reached the age of majority in your jurisdiction of primary residence and citizenship. You must be at least 18 years old and have reached the age of majority in your jurisdiction of primary residence and citizenship to participate in any Competitions. \r\n

\r\n\r\nUnless otherwise stated in the rules of a Competition, you are not eligible to participate in such Competition if you are a resident of the Quebec province of Canada, Iran, Cuba, North Korea, Crimea Region of Ukraine, Sudan or Syria. In addition, you are not eligible to participate in any Competition if you are on the Specially Designated National list promulgated and amended, from time to time, by the United States Department of the Treasury.\r\n

\r\n\r\nFor Competitions that offer a cash prize and/or to participate in TCO, additional eligibility requirements apply. Please see the "Prize Payments" and "Additional TCO Terms" sections of this Terms of Use for additional eligibility requirements.\r\n

\r\n\r\nWe may assign, novate or subcontract any or all of our rights and obligations under these Terms of Use at any time. \r\n

\r\n\r\nIf you have any questions regarding these Terms of Use, contact us at support@topcoder.com.\r\n

\r\n\r\n

Accounts; Passwords; Security

\r\nYou may need to set up an account in order to use some of the features of the Website. You may not use a third party"s account without permission. When you are setting up your account, you must give us accurate and complete information. This means that you cannot set up an account using a name or contact information that does not apply to you, and you must provide accurate and current information on all registration forms that are part of the Website. You may only set up one account. You have complete responsibility for your account and everything that happens on your account. This means you need to be careful with your password. If you find out that someone is using your account without your permission, you must let us know immediately. You may not transfer your account to someone else. We are not liable for any damages or losses caused by someone using your account without your permission. However, if we (or anyone else) suffer any damage due to the unauthorized use of your account, you may be liable. \r\n

\r\n\r\nBy registering for an account with us, you are also hereby registered to compete in the TCO. The TCO is a series of Competitions held in four (4) online periods (each, a "Period") throughout the year (which such periods are posted on the Website), and which leads up to an onsite tournament annually which will be held at a location and time to be determined by topcoder. Your registration and participation in the TCO constitutes agreement with any additional applicable TCO terms and conditions (the "TCO Rules") that topocder may impose at its sole discretion as well as these Terms of Use, including those available at: http://tco15.topcoder.com/overview/competition-rules/. NO PURCHASE NECESSARY TO ENTER OR WIN, A PURCHASE WILL NOT INCREASE YOUR CHANCE OF WINNING.\r\n\r\n\r\n

Competitions

\r\n\r\n\r\nIn addition to these Terms of Use, we may provide specific Official Rules and Regulations and other documentation for certain activities on this Website, including with respect to Competitions conducted by us and those in conjunction with third parties. These Terms of Use are incorporated by reference into the specific Official Rules and Regulations which appear in connection with information about a particular Competition. To the extent that any conflict exists between these Terms of Use and any specific Official Rules and Regulations, the Official Rules and Regulations for that Competition in which you choose to participate shall govern. \r\n\r\n

Ownership Rights of Submissions

\r\n

Winning Submissions

\r\n\r\nExcept with respect to "Fun Challenges", you hereby assign, grant and transfer and agree to assign, grant and transfer to us all right and title in and to any and all Submissions made by you in connection with a Competition for which you are paid a cash prize or other good and valuable compensation (or for which topcoder has in good faith made available for payment pending your completion of tocpoder"s payment requirements) (any such Submission, a "Winning Submission"), along with any and all copyright, patent, trade secret, moral right, and other intellectual property rights, in and to any and all such Winning Submissions. To the extent any rights in a Winning Submission are not assignable, you hereby grant and agree to grant to topcoder under any and all such rights an irrevocable, paid-up, royalty free, perpetual, exclusive, sublicensable (directly or indirectly through multiple tiers), transferable, and worldwide license to use and permit others to use such Winning Submission in any manner desired by us (and/or our contest sponsors or customers) without restriction or accounting to you, including, without limitation, the right to make, have made, sell, offer for sale, use, rent, lease, import, copy, prepare derivative works, publicly display, publicly perform, and distribute all or any part of such Winning Submission and modifications and combinations thereof and to sublicense (directly or indirectly through multiple tiers) or transfer any and all such rights. Further, you hereby waive and agree to waive in favor of topcoder any moral right or other right or claim that is contrary to the intent of a complete transfer of rights to topcoder in each Winning Submission. You agree to promptly execute such documents and perform such acts as we may reasonably require to perfect our entire right, title, and interest in and to each and every Winning Submission, including a topcoder Competition Assignment Agreement if requested by topcoder and/or a sponsor of a Competition. \r\n\r\n

\r\n

Other Submissions

\r\n\r\nExcept with respect to "Fun Challenges", the ownership rights in and to any Submission that is not a Winning Submission shall remain with the Contestant, except that to the extent you are required to enter into a Non-Disclosure Agreement in connection with a Competition (a "Competition NDA"), you understand and agree that the rights in and to any confidential information of the sponsor of a Competition shall remain the property of such Competition sponsor and you shall be bound by and the terms of such Competition NDA shall apply with respect to your rights in and to the Submission. The current version of the Competition NDA is posted in the "direct tool" available on the Website. In addition, by participating in a Competition and uploading a Submission, regardless of whether it is a Winning Submission or not, you consent to and you hereby grant Topcoder, other Topcoder members, Appirio, the Competition sponsor and their affiliates, employees, contractors and third parties engaged by them a license to review, revise, scan, comment on and/or update your Submission in connection with the Competition, without any payment to or further approval from you. You agree that this consent and license spans the length of the Competition and cannot be revoked.\r\n\r\n

\r\n

Fun Challenges

\r\n\r\n"Fun Challenges" are Competitions that do not have any winners or prizes associated with them, and are intended purely for the fun of participating and collaborating with fellow topcoder members throughout the world. All Submissions in connection with Fun Challenges will be made publicly available and without any restrictions on use by anyone worldwide. By entering into a Fun Challenge and uploading a Submission in connection with a Fun Challenge, you hereby waive and release any and all ownership, copyright, patent, trade secret, moral right, and other intellectual property rights, in and to any and all such Submissions without the expectation of any payment or consideration of any kind.\r\n\r\n

\r\n

Contest Materials

\r\n\r\nYou hereby further acknowledge and understand that Competition sponsors, topcoder and Appirio engage, has engaged and will in the future engage in the development, preparation, production, acquisition and dissemination of creative, educational, artistic and other material (collectively, the "Materials"), including without limitation Materials that may be similar or identical to your Submission. You also acknowledge that other persons, including our employees and employees of a Competition sponsor, may previously have originated and may hereafter originate Materials that are similar or identical to your Submission. You agree that you will not be entitled to any compensation because of the use by Sponsor of any such similar or identical material. Without limitation of the foregoing, we, our customers and any Competition sponsor may use, without any payment or other obligation whatsoever to you, any part of the Materials, and any idea or concept contained therein, that (a) is similar or identical to, or contains significant elements encompassed in, a concept that is under consideration or in development by us or the Competition sponsor before or at the time of your entry, (b) is not unique, novel, original, and concrete so as to be entitled to protection under applicable laws, (c) has been made public by anyone at the time of its submission to the Competition sponsor or us or otherwise is in the public domain, (d) would be freely usable by a third person if it had not been accepted as a Submission or the subject of any agreement, (e) is not protected by United States copyright law, or (f) is similar or identical to, or contains significant elements encompassed in, an idea, concept or material that is independently created by us, a Competition sponsor or any third party. You agree that our or a Competition sponsor"s development, preparation, production, acquisition, dissemination and/or exploitation of Materials similar or identical to your Submission or containing features, ideas, material and/or elements similar to or identical with those contained in your Submission shall not entitle you to any compensation or other right or remedy. As an inducement to us or a Competition sponsor to accept your Submission for entry into the contest, you hereby waive any claim or right of action against us, the Competition sponsor"s and their successors in connection with use of any Materials (or any portions thereof) whether or not such Materials are similar or identical to your Submission or contain any features, ideas, material and/or elements that are similar or identical to those contained in your Submission. Acceptance by us (or a Competition sponsor, as applicable) of a Submission is not an admission by us or a Competition sponsor of the novelty or originality of the Submission.\r\n

\r\n\r\n\r\nUnless agreed otherwise in writing, the sponsor of a contest administered through the Website, topcoder or Appirio (as applicable) owns and will retain ownership (including all intellectual property rights) in and to any materials that are not Submissions, which materials may be tangible or intangible, that you develop that are a result of a contest administered through the Website ("Contest Materials"), and any modifications, improvements and derivative works thereto (including any such materials that incorporate any of Contestant"s ideas, feedback or suggestions). \r\n\r\n

\r\n

U.S. Federal Government Rights & Restrictions

\r\n\r\nFor any Competition sponsored by, on behalf of, or for the benefit of the U.S. Federal Government, Contestants may be subject to the Federal Acquisition Regulations and agree to comply with applicable provisions of the Federal Acquisition Regulations ("FAR") and all other laws and regulations applicable to providing goods and services to the U.S. Federal Government. In particular, Winning Submissions be considered "Commercial Items" and Contestants may be classified as "Subcontractors" according to the U.S. Federal Government, and by entering a Submission in connection with a Competition, the Contestant hereby agrees to be bound by all laws and regulations applicable to the sale of commercial items by subcontractors to the U.S. Federal Government including FAR 52.212-5(e) and FAR 52.244-6(c)(1).. \r\nUser Content\r\n

\r\n\r\nYou are solely responsible for any User Content you post to the Website, and the consequences of posting or publishing it. By "User Content", we mean any Content you post to the Website. "Content" means information, data, text, software, music, sound, photos, graphics, videos, messages, tags, interactive features, or any other materials. When we say "post", we include posting, uploading, sharing, submitting or otherwise providing User Content in any manner in connection with the Website. For the avoidance of doubt, Submissions and Contest Materials are User Content.\r\n

\r\n\r\nYou may not:\r\n

\r\n
    \r\n
  • Use our Website for any illegal purpose
  • \r\n
  • Submit User Content that you don"t have the right to submit (including but not limited to material covered by someone else"s copyright, patent, trade secret, privacy policy, publicity policy, or any other proprietary right)
  • \r\n
  • Disguise in any way the origin of any User Content you submit (including but not limited to forging headers)
  • \r\n
  • Submit any User Content that contains lies or misrepresentations that could damage Us or anyone else
  • \r\n
  • Submit User Content that is obscene, illegal, defamatory, libelous, threatening, pornographic, harassing, hateful, or encourages criminal conduct, give rise to civil liability, violate any law, or is otherwise inappropriate
  • \r\n
  • Transmit any advertising, promotional materials, junk mail, spam, chain letters, pyramid schemes or any other solicitation
  • \r\n
  • Impersonate anyone else or misrepresent your affiliation with any other person or entity
  • \r\n
  • Use meta tags or any other hidden text utilizing any of our or our suppliers" names, products names, or trademarks
  • \r\n
  • Upload, launch, post email or transmit any material (including any bot, worm, spider, script, or virus) that may harm or corrupt this Website, or anyone else"s computer systems or data
  • \r\n
  • Use our Website to harm minors in any way
  • \r\n
  • Collect or gather other people"s personal information (including account information)
  • \r\n
  • Submit User Content that disparages us or our partners and affiliates
  • \r\n
  • Solicit any users of our Website for any commercial purpose
  • \r\n
\r\n

\r\n\r\nWe have the sole right, but not necessarily the obligation, to delete at any time any User Content that violates these rules or that we believe to be inappropriate for any reason.\r\n

\r\n\r\nIf you post User Content, you are making a guarantee to us that you either own all the Content you are posting, or you have the right to post the Content. Unless otherwise expressly permitted, you may not copy or include in any User Content any code from any third party, including "open source" code or other code that is or may be subject to license terms. Furthermore, you are guaranteeing that you have the right to allow us to make your User Content available for others to view and use as part of the Website without requiring that any such use be subject to additional obligations or terms. If you do not have these rights, do not post the Content. By posting your User Content, you do not lose any ownership rights you may have to it. However, unless otherwise governed by the Official Rules and Regulations governing a specific Competition, you do grant us a worldwide, irrevocable, non-exclusive, royalty-free, fully-paid, sublicenseable (through multiple tiers of distribution) and transferable license to use, reproduce, modify, distribute, prepare derivative works of, display, and perform your User Content in connection with the Website and our business, in any media formats or in tangible form and through any media channels now known or hereinafter developed. You also grant each user of the Website a non-exclusive royalty-free, fully-paid, sublicenseable and transferable license to access your User Content through the Website, and to use, reproduce, distribute, prepare derivative works of, display and perform your User Content as permitted through the functionality of the Website and under these Terms of Service.\r\n

\r\n\r\nYou understand that once you post User Content, your content becomes public. We are not responsible for keeping any User Content confidential.\r\n

\r\n\r\nWe generally do not review any of the User Content posted by our users. We do not endorse any User Content or support any views, opinions, recommendations, or advice that may be in user submissions. User Content comes from a variety of sources, and we make no promises about the reliability of any source or the accuracy, usefulness, safety, or intellectual property rights of any user submission. You may be offended by User Content that you see on the Website. You may find some of it to be inaccurate, offensive, indecent, or objectionable. However, you agree not to hold us responsible in any way for your use of our Website, including your exposure to User Content.\r\n

\r\n\r\nWe reserve the right to remove any postings or other uploaded materials in response to complaints of infringement, obscenity or defamation or to otherwise review or edit such materials as appropriate, in our sole discretion and without notice.\r\n

\r\n\r\nIn addition to the above terms governing User Content, as a condition of participating in the TCO, you agree to permit topcoder to describe, publicize, and link to any User Content submitted or posted in connection with TCO. You may not cheat; all ideas for Submissions submitted in connection with the TCO shall be solely yours; you may not collaborate on any Submissions entered in connection with the TCO unless otherwise set forth in the TCO Rules. IN ORDER TO BE ELIGIBLE FOR THE TCO, YOU WARRANT THAT YOUR SUBMISSION FOR EACH COMPETITION THAT IS PART OF THE TCO:\r\n

\r\nDoes not include or anticipate the inclusion of any unsuitable or offensive content, including nudity, sexually explicit, disparaging, libelous or other inappropriate content;\r\n

\r\n\r\nDoes not include or anticipate the inclusion of any content that is in violation of or infringes third party intellectual property rights including, but not limited to copyrights, including music copyrights, trademarks, and rights of publicity;\r\n

\r\n\r\nHas not been entered in previous contests, or won previous awards;\r\n

\r\n\r\nHas not been published or distributed previously in any media;\r\n

\r\n\r\nIs suitable for a general audience; and\r\n

\r\n\r\nDoes not contain any claims that are not and cannot be substantiated or that would be false and/or misleading to a reasonable consumer.\r\n\r\n

Copyright, Trademark and Other Intellectual Property

\r\n\r\n

Protection

\r\nExcept as otherwise indicated, this Website and its entire contents (including, but not limited to, the text, photographs, information, software, graphics, images, sound, and animation) are owned by us and are protected by domestic and international copyright, trademark, patent, and other intellectual property laws. All copyrightable text and graphics, the selection, arrangement, and presentation of all materials (including information in the public domain), and the overall design of this Website are "2014 topcoder. All rights reserved. We hereby give you permission to download and print materials from this Website for the sole purposes of viewing, reading, and retaining for reference the materials for non-commercial use. Any other copying, distribution, retransmission, or modification of information or materials on this Website, whether in electronic or other form, without our express prior written permission is strictly prohibited. You further agree that you will not disassemble, decompile, reverse engineer or otherwise modify the material on this Website. Any unauthorized or prohibited use may subject the offender to civil liability and criminal prosecution under applicable laws. \r\n\r\n

\r\n

Notice

\r\nAll trademarks, service marks, and trade names are proprietary to us or other respective owners that have granted us the right and license to use their marks. \r\n\r\n

\r\n

Copyright Complaints

\r\nWe respect the intellectual property of others, and we ask you to do the same. We may, in appropriate circumstances and at our sole discretion, terminate the access of users who infringe the copyright rights of others. \r\nIf you believe that your work has been copied and is accessible at our Website in a way that constitutes copyright infringement, or that our Website contains links or other references to another online location that contains material or activity that infringes your copyright rights, you may notify us by providing our copyright agent the information required by the U.S. Online Copyright Infringement Liability Limitation Act of the U.S. Digital Millennium Copyright Act, 17 U.S.C. "512. Our agent for notice of claims of copyright infringement on or regarding this Website can be reached as follows: \r\n

\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n
BY E-MAIL:GC@appirio.com
BY MAIL:Dan Lascell
\r\n\r\nTopcoder, Inc.
\r\n\r\n760 Market Street
\r\n\r\nSan Francisco, CA 94102
BY PHONE:(650) 268-9911
\r\n

\r\n\r\nRepeat infringers will be blocked from accessing the topcoder Website. \r\n\r\n

\r\n

Marketing Materials

\r\n\r\n\r\nYou hereby authorize us and any Competition sponsors to publicize the results of any Competition, including your name and account name (handle). Contestant hereby grants to us and any Competition sponsors the absolute right and permission to use your name, address (city and state), testimonial statement (or statements in different words which have substantially the same meaning), voice, photograph and/or other likeness in any and all advertising and promotional materials, or to refrain from doing so, in any manner or media whatsoever, worldwide, for advertising and promotional purposes in conjunction with this and similar Competitions without notice to you and without further compensation. You shall have no right of approval, no claim to any compensation, and no claim arising out of the use, alteration, distortion or illusionary effect or use in any composite form of your name, address, testimonial statement, voice, photograph or likeness.

\r\n\r\nYou understand that we own all photographs of you taken by us and we may copyright material containing such photographs.\r\n

\r\n\r\n

Indemnification and Release

\r\nBy accessing our Website, you agree to indemnify us and any parent, subsidiary, sponsor or affiliated entities, our officers and employees, and officers and employees of any parent, subsidiary, sponsor or affiliated entities and hold them harmless from any and all claims and expenses, including attorney\'s fees, arising from your use of our Website including any material (including third-party material) that you post on our Website and any services or products available through our Website. In addition, you hereby release us and any parent, subsidiary, sponsor or affiliated entities, our officers and employees, and officers and employees of any parent, subsidiary, sponsor or affiliated entities from any and all claims, demands, debts, obligations, damages (actual or consequential), costs, and expenses of any kind or nature whatsoever, whether known or unknown, suspected or unsuspected, disclosed or undisclosed, that you may have against them arising out of or in any way related to such disputes and/or to any services or products available at our Website. You hereby agree to waive all laws that may limit the efficacy of such releases. \r\n

\r\n\r\nBy registering and/or participating in the TCO or a Competition, you agree to release topcoder and any Competition sponsor(s), and its affiliates and agents, and the officers, employees, affiliates, advertising and promotions agencies, prize suppliers, and all of their employees, officers, directors, shareholder\'s and agents (collectively, the "Releasees") from any and all liability or any injuries, loss or damage of any kind arising from or in connection with the TCO or a Competition, the use of any Submission, or the acceptance or use of any prize won, except where prohibited by law. Releasees assume no responsibility for incomplete, misdirected, damaged or illegible entries nor for any delayed Submissions or those not received for whatever reason, including without limitation due to internet or e-mail server failure, telephone, human, or other higherror or for any technical or other malfunctions that may occur including any injury or damage to your or any other person\'s computer relating to or resulting from participation in the Tournament or a Competition or downloading any materials during or for the TCO or a Competition.\r\n

\r\n\r\n

Disclaimer

\r\nTHE MATERIALS AND SERVICES ON OUR WEB SITE ARE PROVIDED "AS IS" AND WITHOUT WARRANTIES OF ANY KIND EITHER EXPRESS OR IMPLIED. TO THE FULLEST EXTENT PERMISSIBLE PURSUANT TO APPLICABLE LAW, WE DISCLAIM ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. WE DO NOT WARRANT THAT THE FUNCTIONS CONTAINED IN THE MATERIALS WILL BE UNINTERRUPTED OR ERROR-FREE, THAT DEFECTS WILL BE CORRECTED, OR THAT THIS WEB SITE OR THE SERVER(S) THAT MAKES OUR WEB SITE AVAILABLE OR ANY ADVERTISED OR HYPERLINKED SITE ARE FREE OF VIRUSES OR OTHER HARMFUL COMPONENTS OR THAT OUR SITE, SERVER(S), ADVERTISED OR HYPERLINKED SITES WILL BE ACCESSIBLE AT ALL TIMES. WE DO NOT WARRANT THAT SUCH ERRORS, DEFECTS OR INTERRUPTIONS IN SERVICE WILL NOT AFFECT THE RESULTS OF OUR COMPETITIONS, AND WE DISCLAIM ANY RESPONSIBILITY FOR REDUCED PERFORMANCE IN COMPETITIONS DUE TO SUCH PROBLEMS. WE DO NOT WARRANT OR MAKE ANY REPRESENTATIONS REGARDING THE USE OR THE RESULTS OF OUR WEB SITE WITH RESPECT TO CORRECTNESS, ACCURACY, RELIABILITY, GRAPHICS, LINKS OR OTHERWISE. YOU ASSUME THE ENTIRE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. TO THE EXTENT THAT APPLICABLE LAW MAY NOT ALLOW THE EXCLUSION OF IMPLIED WARRANTIES, THE ABOVE EXCLUSIONS MAY NOT APPLY TO YOU. \r\n

\r\n\r\nDocuments, graphics and other materials appearing at our Website may include technical inaccuracies, typographical errors, and out-of-date information and use of such documents, graphics or other materials is at your own risk. \r\nYou represent and warrant that neither you nor any member of your immediate family, nor anyone living in your household, is an employee of topcoder or Competition sponsors, regardless of commitment date as sponsor, including any companies involved in the production (including prize suppliers), implementation and distribution of this tournament and their advertising or promotion agencies, parent companies, service providers, agents, officers, subsidiaries or affiliates, or any other persons or entities directly associated with the tournament, and that neither you nor any immediate family member nor anyone living in your household is connected with any of the above.\r\n\r\n

\r\n

Limitation of Liability

\r\n\r\nTO THE FULLEST EXTENT PERMISSIBLE PURSUANT TO APPLICABLE LAW, TOPCODER] SHALL NOT BE LIABLE FOR ANY DAMAGES (INCLUDING, BUT NOT LIMITED TO, DIRECT, INDIRECT, INCIDENTAL, SPECIAL OR CONSEQUENTIAL DAMAGES), WHETHER BASED ON WARRANTY, CONTRACT, TORT, OR ANY OTHER LEGAL THEORY, INCLUDING, BUT NOT LIMITED TO, DAMAGES FOR LOSS OF WINNINGS, DATA OR OTHER DAMAGE TO ANY OTHER INTANGIBLE PROPERTY, EVEN IF TOPCODER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES, RESULTING FROM (i) THE USE OR INABILITY TO USE THIS WEB SITE, (ii) THE DISCLOSURE OF, UNAUTHORIZED ACCESS TO OR ALTERATION OF ANY TRANSMISSION OR DATA, (iii) THE STATEMENTS OR CONDUCT OF ANY THIRD PARTY OR (iv) ANY OTHER MATTER RELATING TO TOPCODER. \r\n\r\n

\r\n

Prize Payment

\r\n\r\nYou understand that neither we, the Competition sponsors nor their parent corporations, subsidiaries, affiliates, agents, assigns, etc. or any entity connected with a Competition will be responsible for any costs (including, without limitation, any federal, state or local taxes) Contestant may incur in connection with any Contest or any prize Contestant may be awarded. However, Contestant understands that topcoder may make withholdings from any prize that Contestant may be awarded in order to comply with applicable tax laws. Contestant agrees to sign any applicable forms necessary to distribute the prize as required by tax authorities.\r\n

\r\n\r\nAll cash prizes are listed and shall be awarded in USD. All prizes will be awarded in each Competition, provided a qualified number of Submissions are received and the requisite number of Contestants participate in a round of a Competition. A Competition sponsor may award prizes to more than one Submission with respect to any Competition. If a Contestant cannot or will not accept a prize, then the prize will be forfeited and may be awarded to the next highest scoring Submission. Unless otherwise provided herein, by participating in a Competition and/or the TCO, a Contestant acknowledges and agrees that if his/her Submission is selected as a winner, the Contestant will receive a cash award only upon verification of all applicable eligibility requirements. Cash prizes will be paid out by topcoder (or its designee) in the US in US dollars no later than 90 days following the conclusion of the Competition or the conclusion of the TCO (as applicable). Taxes, if any, are the sole responsibility of the winner(s). Prizes which remain unclaimed or undeliverable for a period of six (6) months will be forfeited. \r\n

\r\n\r\nAs a condition of winning and redeeming a cash prize, Contestants will be required to submit a completed (i) Contestant Questionnaire and all post Competition surveys, (ii) if requested, an Affidavit of Eligibility and Liability and Publicity Release, unless a notarized copy is already on file with topcoder (iii) IRS Form W-9 or W-8BEN, as appropriate if one is not already on file with topcoder, (iv) with respect to the TCO, a topcoder Competition Assignment Agreement, if one is not already on file with topcoder, and (v) with respect to the TCO, a Travel form. In completing any requested Affidavit of Eligibility and Liability and Publicity Release, a Contestant who wins a cash prize (a) confirms his/her eligibility, (b) represents and warrants that he/she has not cheated, (c) verifies the accuracy of the demographic information submitted to, and contained in, the topcoder member database, (d) authorizes topcoder to publicize the results of the Competition and/or the TCO, (e) agrees to sign any applicable forms required by tax authorities, (f) grants topcoder a license to all information submitted during the Competition and/or the TCO, and (g) releases topcoder from liability arising out of any prize won. topcoder requires all Contestants to complete the Form W-9 or W-8BEN for tax reporting purposes. Providing false information in the registration process or in the required forms described in this paragraph will result in a forfeiture of a cash prize. If a winning Contestant (i) does not reply to a notification from topcoder or the notification is undeliverable, (ii) in the case of TCO, does not return a requested Affidavit of Eligibility/Liability/Publicity release completed and signed within ten (10) days of date of prize notification, or (iii) is not otherwise in compliance with these Rules or the rules of a Competition, the Contestant will be disqualified and forfeit any prize, and topcoder may, at our discretion, select and notify another Contestant. Participatory prizes and non-cash prizes will be mailed within one month following the conclusion of the Competition or the TCO (as applicable) to the address provided by the Contestant in their topcoder profile. Unclaimed or undeliverable participatory prizes will be forfeited. Contestants who do not submit the required information by the applicable deadlines forfeit their prizes. Please allow 6-12 weeks for delivery. If a Contestant"s prize is returned, topcoder will resend that prize to a secondary address provided a request is made by the prizewinning Contestant. topcoder is not responsible for lost or stolen items and will not send additional prizes in the event a prize is not received. Each Contestant that participates in the Onsite portion of the TCO is eligible to receive only one (1) TCO T-shirt during the TCO, which may only be picked up by the Contestant at the TCO.\r\n\r\n

\r\n

Links to Other Web Sites and Services

\r\n\r\nTo the extent that our Website contains links to other Websites and outside services and resources, we do not control the availability and content of those Websites, services or resources, nor do we necessarily review or endorse materials available at or through such other Websites. Viewing other Websites or utilizing outside services and resources is done at your own risk. We shall not be liable for any loss or damage caused or alleged to be caused by or in connection with use of or reliance on any such content, goods or services available on or through any such site or resource. \r\n

\r\n\r\n

Other Restrictions on Conduct

\r\nWe are making the Website available to you for your information and personal use only. You may not (and you agree not to) use, copy, distribute, transmit, broadcast, sell, or do anything else with the Website for any other purpose.\r\n

\r\n\r\nYou agree not to disrupt, modify or interfere with the functioning of our Website or any services provided on or through our Website or with any associated software, hardware or servers in any way and you agree not to impede or interfere with others\' use of our Website. This includes your agreement that you will not cheat; that the idea for the code and/or challenge(s) submitted by you is yours alone. This also includes your agreement that you will not provide your topcoder information including, but not limited to, your topcoder handle and rating, to any third party for the purpose of pursuing employment opportunities without the written consent of topcoder. If you are contacted by a third-party regarding employment opportunities and/or media interest as a result in your participation in topcoder Competitions, you agree to promptly notify topcoder of such contact. You also agree not to alter or tamper with any information or materials on, or associated with our Website or services provided on or through our Website. \r\nWe do not necessarily endorse, support, sanction, encourage, verify or agree with the comments, opinions, or other statements made public at our Website by users through our Competitions, forums or other interactive services available at our Website. Any information or material sent by users to any forums, including advice and opinions, represents the views and is the responsibility of those users and does not necessarily represent our views. \r\n

\r\n\r\nYou agree that no impediment exists to you joining the topcoder Website, and your participation in topcoder\'s Website and the Competitions it offers will not interfere with your performance of any other agreement or obligation which has been or will be made with any third party. \r\n

\r\n\r\n

Provisions Applicable to Chinese Citizens and Expatriates Residing in China

\r\ntopcoder hereby incorporates into these Terms of Use and into our Privacy Policy the provisions of China\'s Decision on Safeguarding the Security of the Internet (the "Decision"). \r\n

\r\n\r\nAccording to Section 1 of the Decision "to ensure operational security of the Internet, the person or organization perpetrating any of the following acts in violation of the criminal law shall be penalized according to the criminal code:\r\n

\r\n
    \r\n
  1. 1.\tUnauthorized penetration into the computer and information system of the state affair, national defense or high-tech departments of the state;
  2. \r\n
  3. 2.\tIntentional composition or dissemination of computer virus or other destructive programs, or attacking the computer system or telecommunication network and resulting in damage or destruction of such computer systems or telecommunication network;
  4. \r\n
  5. 3.\tUnauthorized disruption of operation of the computer network or telecommunication service and resulting in malfunction of such network or telecommunication systems in violation of the laws or regulations of the state."
  6. \r\n
\r\n

\r\nAccording to Section 2 of the Decision, "to protect national security and social stability, the person or organization perpetrating any of the following acts in violation of the criminal law shall be penalized according to the criminal code:\r\n

\r\n
    \r\n
  1. 1.\tDisseminating rumor or slander on the Internet, or publishing or diffusing maleficent information to instigate subversion of the state power or socialist system, advocate abruption of the country or harm unity of the country;
  2. \r\n
  3. 2.\tStealing or disclosing the national or military secrets on the Internet;
  4. \r\n
  5. 3.\tInstigating inter-ethnic enmity or prejudice, or disrupting ethnic unity on the Internet; and
  6. \r\n
  7. 4.\tEstablishing or organizing heresies on the Internet and impeding the implementation of laws and regulations of the state."
  8. \r\n
\r\n

\r\n\r\nSection 3 of the Decision also stipulates that "to safeguard the order of the socialist market economy and social stability, the person or organization perpetrating any of the following acts in violation of the criminal law shall be penalized according to the criminal code:\r\n

\r\n
    \r\n
  1. 1.\tSelling fake or shoddy goods on the Internet or making false or misleading propaganda of commodities on the Internet;
  2. \r\n
  3. 2.\tHurting others\' commercial fame or reputation of products on the Internet;
  4. \r\n
  5. 3.\tInfringing upon others\' intellectual property rights on the Internet;
  6. \r\n
  7. 4.\tCompiling and distributing false information on the Internet to affect securities or futures transactions or disrupt order of the financial markets; and
  8. \r\n
  9. 5.\tEstablishing pornographic web sites or web pages, providing links to pornographic web sites, or disseminating pornographic magazines, films, audio and videos materials or graphics on the Internet."
  10. \r\n
\r\n

\r\nSection 4 of the Decision stipulates that "to protect the legal rights of personal safety and property of individuals, legal persons and other organizations, the person or organization perpetrating any of the following acts in violation of the criminal law shall be penalized according to the criminal code:\r\n

\r\n
    \r\n
  1. 1.\tInsulting others or drawing up slanders against others on the Internet;
  2. \r\n
  3. 2.\tIllegally intercepting, modifying or deleting others\' emails or other database materials and infringing rights of the citizen of freedom and secrets in communicating and letter transmitting; and
  4. \r\n
  5. 3.\tPerpetrating theft, fraud, or blackmailing on the Internet."
  6. \r\n
\r\n\r\n

Choice of Law and Forum

\r\n\r\nThese Terms of Use are governed by the laws of the state of California. You hereby agree to submit to the exclusive jurisdiction of the courts of San Francisco County, California. To the extent that applicable laws have mandatory application to this agreement or give you the right to bring action in any other courts, the above limitations may not apply to you. Use of this Website is unauthorized in any jurisdiction that does not give full effect to all provisions of these Terms of Use. \r\n\r\n

\r\n

Severability and Enforceability

\r\n\r\nIf any provision or portion of these Terms of Use is held illegal, invalid, or unenforceable, in whole or in part, it shall be modified to the minimum extent necessary to correct any deficiencies or replaced with a provision which is as close as is legally permissible to the provision found invalid or unenforceable and shall not affect the legality, validity or enforceability of any other provisions or portions of these Terms of Use. \r\n\r\n

\r\n

Termination/Exclusion

\r\n\r\nWe reserve the right, in our sole discretion, to revoke any and all privileges associated with accessing and/or competing on our Website, and to take any other action we deem appropriate including but not limited to terminating or suspending your use of www.topcoder.com, for no reason or any reason whatsoever, including improper use of this Website or failure to comply with these Terms of Use. \r\n

\r\n\r\n

Additional TCO Terms

\r\n\r\n

Eligibility

\r\nThe TCO and each Competition that is part of the TCO is open to all members of the topcoder Website who have agreed to these Terms of Use and who are at least 18 years of age at the time of registration and have attained the age of majority in their jurisdiction of primary residence and citizenship. In addition to the other terms and eligibility criteria set forth in these Terms and Use, to be eligible to participate in the TCO, you must be (i) a U.S. citizen, (ii) a lawful permanent resident of the U.S., (iii) a temporary resident, asylee, refugee of the U.S., or have a lawfully issued work authorization card permitting unrestricted employment in the U.S., or (iv) a non-U.S. resident authorized in the country in which the member resides while participating in the TCO to perform services as an independent contractor; or (v) with respect to any Competition designated by us as an "Algorithm Competition", be in the United States under a valid and current visa issued by the United States government which does not prohibit receiving a cash prize. \r\n

\r\n\r\nViolation of these Terms of Use may result in disqualification from the TCO and/or further consequences as determined in our sole discretion. Current employees of topcoder and those involved in the development, production (including prize suppliers and sponsors), implementation and distribution of the TCO (including Competitions run as part of the TCO) and their advertising or promotion agencies, parent companies, service providers, agents, officers, subsidiaries or affiliates, or any other persons or entities directly associated with the TCO and members of their immediate families and/or persons living in the same household as such persons, are ineligible to enter the TCO and related Competitions. Current employees of any TCO sponsor (or Competition sponsor that is part of TCO) or their parent companies, subsidiaries or affiliates which such Competition sponsor or TCO Sponsor, as applicable, is involved in the preparation, administration or judging of the TCO (and any related Competitions) and members of their employees\' immediate families and/or persons living in the same household as such employees, are ineligible to enter the TCO.\r\n\r\n

\r\n

topcoder"s Discretion regarding the TCO

\r\n\r\nAll decisions relating to the viability of Submissions, the ranking of Submissions and all other matters pertaining to the TCO are within the sole discretion of topcoder or its designee and shall be final and binding in all respects. By participating in the TCO and/or a Competition that is part of the TCO, a Contestant who wins a prize releases and agrees to hold harmless topcoder its affiliates, subsidiaries, sponsors, advertising and promotion agencies, and prize suppliers, and all of their respective directors, officers, employees, representatives and agents, from and against any and all liability for any loss, property damage or damage to person, including without limitation, death and injury, due in whole or in part, directly or indirectly, from or arising out of participation in the TCO, or participation in any TCO-related activity, or the receipt, use or misuse of a prize. topcoder reserves the right to limit the participation of any person in the TCO, amend or interpret these rules or official communications governing the TCO or cancel the TCO or any TCO-related Competition for any reason with prior notice. Notices for any such amendment, interpretation or cancellation will be deemed to have been given by posting on the Website and by virtue of a Contestant\'s continued participation in the TCO. A Contestant may terminate participation in the TCO upon written notice to topcoder.\r\n\r\n

\r\n

TCO Logistics

\r\n\r\nAll Contestants who have advanced or won a trip to the onsite portion of the TCO ("Onsite Contestants") must arrive at the event no later than the date and time specified in the TCO Rules. All Onsite Contestants must confirm their attendance at the onsite event no later than the date specified in the TCO Rules. In order to confirm attendance, Onsite Contestants must have acquired any necessary travel visas and confirm their ability to travel to the United States no later than the date specified in the TCO Rules. If an Onsite Contestant is required to travel from outside the United States, the Onsite Contestant must show proof of a visa and/or passport by the date specified in the TCO Rules. Onsite Contestants may email a copy of their documents as instructed in the TCO Rules. Onsite Contestants who fail to meet this requirement may be replaced as an Onsite Contestant. Contestants who are otherwise eligible to compete in any or all of the Competitions will be permitted to participate in the online portions of any/all of them. However, in the event a Contestant advances to the onsite finals in more than one Competition and any of the times for the onsite rounds of the Competitions overlap, the Onsite Contestant may participate in either, but not both, Competitions. The Onsite Contestant must notify topcoder of the Competition in which she/he will participate as an Onsite Contestant no later than the date specified in the TCO Rules.\r\n

\r\n\r\ntopcoderwill issue visa invitation letters (upon request) to international Contestants who require one to obtain a travel visa to enter the United States. All registered TCO Contestants may request a visa invitation letter in respect of the year of the upcoming TCO. Contestants must fill out the visa letter request form in its entirety before a visa letter will be mailed. Contestants have until the date and time specified in the TCO Rules to request a letter. Visas can take a significant amount of time to obtain in certain countries, so it is in a Contestant\'s best interests to request one well before the deadline. The cost of obtaining a visa is the sole responsibility of the Contestant. See more information about travel visas. The TCO involves a large number of visa applications by topcoder members. By applying for a visa to attend the TCO, Contestant understands that topcoder will cooperate with all requests by consulates, the Department of Homeland Security, and law enforcement in connection with such Contestant\'s visa, including information about the visa applicants\' attendance at the TCO. Any abuse of the visa application process or any visa obtained for the TCO is considered a serious violation of US law and these Terms of Use, and, among other things, the Contestant will be subject to discipline by topcoder.\r\n

\r\n\r\ntopcoder will provide air travel arrangements for each Onsite Contestant. The flight will be reserved and paid for by topcoder. Onsite Contestants will arrive on the date specified in the TCO Rules and depart the day after the final day of the Onsite portion of the TCO. At topcoder\'s sole discretion, topcoder will pay for each Onsite Contestant\'s airfare up to $1,500, but reserves the right to make exceptions to the maximum amount based on individual circumstances. If an Onsite Contestant wishes to take a flight other than the one provided by topcoder and/or wishes to stay at a hotel other than the one provided by topcoder, the Onsite Contestant shall be responsible for the entire cost of such deviation from the accommodations and travel arrangements provided by topcoder. In addition, the Onsite Contestant agrees to reimburse topcoder for any costs, penalties, fines or fees incurred by topcoder as a result of such deviation. Ground transportation to and from the airport will be provided for each Onsite Contestant by topcoder, as well as private hotel accommodations and certain meals. All other expenses are the responsibility of the Onsite Contestant. topcoder will not provide travel, lodging accommodations, or visa assistance for any guests of an Onsite Contestant. If an Onsite Contestant is eliminated or chooses not to utilize the travel accommodations provide by topcoder for any reason after he/she is confirmed as a finalist and travel accommodations have already been made for the Onsite Contestant by topcoder for the onsite finals, that Onsite Contestant may be held responsible for reimbursing topcoder for the cost of such accommodations. topcoder reserves the right to withhold any future cash prizes won by the Onsite Contestant until the cost of such accommodations has been fully reimbursed. Onsite Contestants must complete the following items and submit them to topcoder by the date specified in the TCO Rules (failure to submit these items will disqualify an Onsite Contestant from advancing to the onsite event):\r\n

\r\n\r\nConfirmation of attendance/proof of travel documents " Please confirm your attendance onsite as directed in the TCO Rules. If you require a passport and/or visa to visit the United States, you must show proof of your documents.\r\n

\r\n\r\nPlease submit a member photo, if you have not already done so.\r\n

\r\n\r\nPlease also submit a fun photo to be shared during your onsite introduction.\r\n

\r\n\r\nPlease ensure the information listed in your topcoder profile is current. We may need to mail your plane tickets or contact you via telephone.\r\n

\r\n\r\nComplete the Onsite Contestant Questionnaire - your responses may be published in the program for the TCO.\r\n

\r\n\r\nTravel form - provide topcoder with the appropriate travel information for your trip to the onsite event.\r\n

\r\n\r\nApplicable tax forms (unless one is already on file with topcoder).\r\n\r\n\r\n
\r\n\r\n\r\n\r\n\r\n',agreed:!1,serverInformation:{serverName:"Topcoder API",apiVersion:"0.0.1",requestDuration:52,currentTime:1504892902498},requesterInformation:{id:"d8c441f8332161f71533f368c09aeead856e4366-K1RdFai7LCAgXVu5",remoteIP:"12.34.56.78",receivedParams:{apiVersion:"v2",termsOfUseId:"21193",action:"getTermsOfUse"}}}},function(e,t){e.exports=__WEBPACK_EXTERNAL_MODULE__66__},function(e,t,n){(function(t){var r=n(69),o=n(71),i=n(72),a=n(73),s=n(14),u=n(74),l=n(80),c=n(81),d=n(82),f=n(83),p={param:"cbx",timeout:8e3,prefix:"__auth0jp"},h=n(88),m=n(42),g=n(90),y=n(91);function v(){var e=-1,t=navigator.userAgent;return"Microsoft Internet Explorer"===navigator.appName?null!=new RegExp("MSIE ([0-9]{1,}[.0-9]{0,})").exec(t)&&(e=parseFloat(RegExp.$1)):t.indexOf("Trident")>-1&&null!==new RegExp("rv:([0-9]{2,2}[.0-9]{0,})").exec(t)&&(e=parseFloat(RegExp.$1)),e}function b(e){var t="";for(var n in e)t+=n+"="+e[n]+",";return t.slice(0,-1)}function _(e,t){return!(!e||null==e[t])}function w(e,t){var n=e.status,r="string"==typeof e.responseText?e.responseText:e,o=10===v()||11===v(),i=!n||0===n,a=!!window.navigator.onLine;i&&!a?(n=0,r={code:"offline"}):i&&o?(n=401,r={code:"invalid_user_password"}):i&&(n=0,r={code:"connection_refused_timeout"}),t(new g(n,r))}function E(e,t,n){return e+"//"+t+n}function T(e){if(!(this instanceof T))return new T(e);o(e,"clientID"),o(e,"domain"),this._useJSONP=null!=e.forceJSONP?!!e.forceJSONP:y()&&!h("https:",e.domain),this._clientID=e.clientID,this._callbackURL=e.callbackURL||document.location.href,this._shouldRedirect=!!e.callbackURL,this._domain=e.domain,this._callbackOnLocationHash=e.callbackOnLocationHash,this._cordovaSocialPlugins={facebook:this._phonegapFacebookLogin},this._useCordovaSocialPlugins=e.useCordovaSocialPlugins,this._sendClientInfo=null==e.sendSDKClientInfo||e.sendSDKClientInfo}T.version=n(92).str,T.clientInfo={name:"auth0.js",version:T.version},T.prototype.openWindow=function(e,t,n){return window.open(e,t,b(n))},T.prototype._redirect=function(e){t.window.location=e},T.prototype._getCallbackOnLocationHash=function(e){return e&&void 0!==e.callbackOnLocationHash?e.callbackOnLocationHash:this._callbackOnLocationHash},T.prototype._getCallbackURL=function(e){return e&&void 0!==e.callbackURL?e.callbackURL:this._callbackURL},T.prototype._getClientInfoString=function(){var e=JSON.stringify(T.clientInfo);return r.encode(e)},T.prototype._getClientInfoHeader=function(){return{"Auth0-Client":this._getClientInfoString()}},T.prototype._renderAndSubmitWSFedForm=function(e,t){var n=document.createElement("div");n.innerHTML=t;var r=document.body.appendChild(n).children[0];e.popup&&!this._getCallbackOnLocationHash(e)&&(r.target="auth0_signup_popup"),r.submit()},T.prototype._getMode=function(e){return{scope:"openid",response_type:this._getCallbackOnLocationHash(e)?"token":"code"}},T.prototype._configureOfflineMode=function(e){e.scope&&e.scope.indexOf("offline_access")>=0&&(e.device=e.device||"Browser")},T.prototype._getUserInfo=function(e,t,n){if(!e||e.user_id)return n(null,e);var r=this._domain,o=E("https:",r,"/tokeninfo"),i=function(e,t){var r=new Error(e+": "+(t||""));r.error=e,r.error_description=t,n(r)};return this._useJSONP?f(o+"?"+s.stringify({id_token:t}),p,function(e,t){return e?i(0,e.toString()):200===t.status?n(null,t.user):i(t.status,t.err||t.error)}):c({url:h("https:",r)?"/tokeninfo":o,method:"post",type:"json",crossOrigin:!h("https:",r),data:{id_token:t}}).fail(function(e){i(e.status,e.responseText)}).then(function(e){n(null,e)})},T.prototype.getProfile=function(e,t){if("function"!=typeof t)throw new Error("A callback function is required");if(!e||"string"!=typeof e)return t(new Error("Invalid token"));this._getUserInfo(this.decodeJwt(e),e,t)},T.prototype.validateUser=function(e,t){var n=this._domain,r="/public/api/users/validate_userpassword",o=E("https:",n,r),i=u(e,{client_id:this._clientID,username:l(e.username||e.email||"")});if(this._useJSONP)return f(o+"?"+s.stringify(i),p,function(e,n){return e?t(e):"error"in n&&404!==n.status?t(new Error(n.error)):void t(null,200===n.status)});c({url:h("https:",n)?r:o,method:"post",type:"text",data:i,crossOrigin:!h("https:",n),error:function(e){if(404!==e.status)return t(new Error(e.responseText));t(null,!1)},success:function(e){t(null,200===e.status)}})},T.prototype.decodeJwt=function(e){var t=e&&e.split(".")[1];return m(r.decode(t))},T.prototype.parseHash=function(e){var t;if((e=e||window.location.hash).match(/error/))return e=e.substr(1).replace(/^\//,""),{error:(t=s.parse(e)).error,error_description:t.error_description};if(!e.match(/access_token/))return null;e=e.substr(1).replace(/^\//,"");var n=(t=s.parse(e)).id_token,r=t.refresh_token,o=this.decodeJwt(n),u=function(e){return{error:"invalid_token",error_description:e}},l=i(o.aud)?o.aud:[o.aud];return-1===a(l,this._clientID)?u("The clientID configured ("+this._clientID+") does not match with the clientID set in the token ("+l.join(", ")+")."):o.iss&&o.iss!=="https://"+this._domain+"/"?u("The domain configured (https://"+this._domain+"/) does not match with the domain set in the token ("+o.iss+")."):{profile:o,id_token:n,access_token:t.access_token,state:t.state,refresh_token:r}},T.prototype.signup=function(e,t){var n,r=this,o={client_id:this._clientID,redirect_uri:this._getCallbackURL(e),username:l(e.username||""),email:l(e.email||e.username||""),tenant:this._domain.split(".")[0]},i=u(this._getMode(e),e,o);function a(){return e.auto_login?r.login(e,t):"function"==typeof t?t():void 0}function d(e,r){var o=new g(e,r);if(n&&"function"==typeof n.kill&&n.kill(),"function"==typeof t)return t(o);throw o}this._configureOfflineMode(i),_(e,"sso")||(e.sso=!0),_(e,"auto_login")||(e.auto_login=!0),e.auto_login&&e.popup&&(!this._getCallbackOnLocationHash(e)||e.sso)&&(n=this._buildPopupWindow(e));var m=this._domain,y=E("https:",m,"/dbconnections/signup");if(this._useJSONP)return f(y+"?"+s.stringify(i),p,function(e,t){return e?d(0,e):200==t.status?a():d(t.status,t.err||t.error)});c({url:h("https:",m)?"/dbconnections/signup":y,method:"post",type:"html",data:i,success:a,crossOrigin:!h("https:",m),error:function(e){d(e.status,e.responseText)}})},T.prototype.changePassword=function(e,t){var n={tenant:this._domain.split(".")[0],client_id:this._clientID,connection:e.connection,username:l(e.username||""),email:l(e.email||e.username||""),password:e.password};function r(e,n){var r=new g(e,n);if(t)return t(r)}var o=this._domain,i="/dbconnections/change_password",a=E("https:",o,i);if(this._useJSONP)return f(a+"?"+s.stringify(n),p,function(e,n){return e?r(0,e):200==n.status?t(null,n.message):r(n.status,n.err||n.error)});c({url:h("https:",o)?i:a,method:"post",type:"html",data:n,crossOrigin:!h("https:",o),error:function(e){r(e.status,e.responseText)},success:function(e){t(null,e)}})},T.prototype._buildAuthorizeQueryString=function(e,t){var n=this._buildAuthorizationParameters(e,t);return s.stringify(n)},T.prototype._buildAuthorizationParameters=function(e,t){var n,r=u.apply(null,e);for(this._configureOfflineMode(r),this._sendClientInfo&&(r.auth0Client=this._getClientInfoString()),t=t||["popup","popupOptions"],n=0;n1&&(!e.sso||window.cordova))return this.loginWithResourceOwner(e,t);var n,r=this;if(e.popup&&!this._getCallbackOnLocationHash(e)&&(n=this._buildPopupWindow(e)),t&&t.length>1&&e.sso)return this.loginWithUsernamePasswordAndSSO(e,t);var o=u(this._getMode(e),e,{client_id:this._clientID,redirect_uri:this._getCallbackURL(e),username:l(e.username||e.email||""),tenant:this._domain.split(".")[0]});this._configureOfflineMode(o);var i=this._domain,a=E("https:",i,"/usernamepassword/login");if(this._useJSONP)return f(a+"?"+s.stringify(o),p,function(o,i){if(o)return n&&n.kill&&n.kill(),t(o);if("error"in i){n&&n.kill&&n.kill();var a=new g(i.status,i.error);return t(a)}r._renderAndSubmitWSFedForm(e,i.form)});function d(e){if(t)return t(e);throw e}c({url:h("https:",i)?"/usernamepassword/login":a,method:"post",type:"html",data:o,headers:this._getClientInfoHeader(),crossOrigin:!h("https:",i),success:function(t){r._renderAndSubmitWSFedForm(e,t)},error:function(e){n&&n.kill&&n.kill(),w(e,d)}})},T.prototype.loginWithPasscode=function(e,t){if(null==e.email&&null==e.phoneNumber)throw new Error("email or phoneNumber is required for authentication");if(null==e.passcode)throw new Error("passcode is required for authentication");if(e.connection=null==e.email?"sms":"email",!this._shouldRedirect)return delete(e=u(e,{username:null==e.email?e.phoneNumber:e.email,password:e.passcode,sso:!1})).email,delete e.phoneNumber,delete e.passcode,this.loginWithResourceOwner(e,t);var n={connection:e.connection};e.phoneNumber&&(e.phone_number=e.phoneNumber,delete e.phoneNumber,n.phone_number=e.phone_number),e.email&&(n.email=e.email),e.verification_code=e.passcode,delete e.passcode,n.verification_code=e.verification_code;var r=this;this._verify(n,function(n){if(n)return t(n);r._verify_redirect(e)})},T.prototype._verify=function(e,t){var n=this._domain,r=E("https:",n,"/passwordless/verify"),o=e;return this._useJSONP?(this._sendClientInfo&&(o.auth0Client=this._getClientInfoString()),f(r+"?"+s.stringify(o),p,function(e,n){return e?t(new Error("0: "+e.toString())):200===n.status?t(null,!0):t({status:n.status})})):c({url:h("https:",n)?"/passwordless/verify":r,method:"post",headers:this._getClientInfoHeader(),crossOrigin:!h("https:",n),data:o}).fail(function(e){try{t(JSON.parse(e.responseText))}catch(r){var n=new Error(e.status+"("+e.statusText+"): "+e.responseText);n.statusCode=e.status,n.error=e.statusText,n.message=e.responseText,t(n)}}).then(function(e){t(null,e)})},T.prototype._verify_redirect=function(e){var t=[this._getMode(e),e,{client_id:this._clientID,redirect_uri:this._getCallbackURL(e)}],n=this._buildAuthorizeQueryString(t),r=E("https:",this._domain,"/passwordless/verify_redirect?"+n);this._redirect(r)},T.prototype.renewIdToken=function(e,t){this.getDelegationToken({id_token:e,scope:"passthrough",api:"auth0"},t)},T.prototype.refreshToken=function(e,t){this.getDelegationToken({refresh_token:e,scope:"passthrough",api:"auth0"},t)},T.prototype.getDelegationToken=function(e,t){if(!(e=e||{}).id_token&&!e.refresh_token)throw new Error("You must send either an id_token or a refresh_token to get a delegation token.");var n=u({grant_type:"urn:ietf:params:oauth:grant-type:jwt-bearer",client_id:this._clientID,target:e.targetClientId||this._clientID,api_type:e.api},e);delete n.hasOwnProperty,delete n.targetClientId,delete n.api;var r=this._domain,o=E("https:",r,"/delegation");if(this._useJSONP)return f(o+"?"+s.stringify(n),p,function(e,n){if(e)return t(e);if("error"in n){var r=new g(n.status,n.error_description||n.error);return t(r)}t(null,n)});c({url:h("https:",r)?"/delegation":o,method:"post",type:"json",data:n,crossOrigin:!h("https:",r),success:function(e){t(null,e)},error:function(e){try{t(JSON.parse(e.responseText))}catch(i){var n=e,r=10===v()||11===v(),o=!n.status||0===n.status;o&&!window.navigator.onLine?((n={}).status=0,n.responseText={code:"offline"}):o&&r?((n={}).status=401,n.responseText={code:"invalid_operation"}):o?((n={}).status=0,n.responseText={code:"connection_refused_timeout"}):n.responseText=e,t(new g(n.status,n.responseText))}}})},T.prototype.logout=function(e){var t=E("https:",this._domain,"/logout");e&&(t+="?"+s.stringify(e)),this._redirect(t)},T.prototype.getSSOData=function(e,t){"function"==typeof e&&(t=e,e=!1);var n={sso:!1},r=this._domain,o=E("https:",r,"/user/ssodata"),i=h("https:",r),a={};if(e&&(a={ldaps:1,client_id:this._clientID}),this._useJSONP){var l=u({},p,{timeout:3e3});return a.auth0Client=this._getClientInfoString(),o+="?"+s.stringify(a),f(o,l,function(e,r){t(null,e?n:r)})}c({url:i?"/user/ssodata":o,method:"get",type:"json",data:a,crossOrigin:!i,withCredentials:!i,timeout:3e3}).fail(function(e){new Error("There was an error in the request that obtains the user's country").cause=e,t(null,n)}).then(function(e){t(null,e)})},T.prototype.getConnections=function(e){return f("https://"+this._domain+"/public/api/"+this._clientID+"/connections",p,e)},T.prototype.startPasswordless=function(e,t){if("object"!=typeof e)throw new Error("An options object is required");if("function"!=typeof t)throw new Error("A callback function is required");if(!e.email&&!e.phoneNumber)throw new Error("An `email` or a `phoneNumber` is required.");var n=this._domain,r=E("https:",n,"/passwordless/start"),o={client_id:this._clientID};return e.email?(o.email=e.email,o.connection="email",e.authParams&&(o.authParams=e.authParams),e.send&&"link"!==e.send||(o.authParams||(o.authParams={}),o.authParams.redirect_uri=this._callbackURL,o.authParams.response_type=this._shouldRedirect&&!this._callbackOnLocationHash?"code":"token"),e.send&&(o.send=e.send)):(o.phone_number=e.phoneNumber,o.connection="sms"),this._useJSONP?(this._sendClientInfo&&(o.auth0Client=this._getClientInfoString()),f(r+"?"+s.stringify(o),p,function(e,n){return e?t(new Error("0: "+e.toString())):200===n.status?t(null,!0):t(n.err||n.error)})):c({url:h("https:",n)?"/passwordless/start":r,method:"post",type:"json",headers:this._getClientInfoHeader(),crossOrigin:!h("https:",n),data:o}).fail(function(e){try{t(JSON.parse(e.responseText))}catch(r){var n=new Error(e.status+"("+e.statusText+"): "+e.responseText);n.statusCode=e.status,n.error=e.statusText,n.message=e.responseText,t(n)}}).then(function(e){t(null,e)})},T.prototype.requestMagicLink=function(e,t){return this.startPasswordless(e,t)},T.prototype.requestEmailCode=function(e,t){return e.send="code",this.startPasswordless(e,t)},T.prototype.verifyEmailCode=function(e,t){return e.passcode=e.code,delete e.code,this.login(e,t)},T.prototype.requestSMSCode=function(e,t){return this.startPasswordless(e,t)},T.prototype.verifySMSCode=function(e,t){return e.passcode=e.code,delete e.code,this.login(e,t)},e.exports=T}).call(this,n(68))},function(e,t){var n;n=function(){return this}();try{n=n||Function("return this")()||(0,eval)("this")}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t,n){var r=n(70);e.exports={encode:function(e){return r.btoa(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")},decode:function(e){return e=(e+=Array(5-e.length%4).join("=")).replace(/\-/g,"+").replace(/\_/g,"/"),r.atob(e)}}},function(e,t,n){!function(){var e=t,n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",r=function(){try{document.createElement("$")}catch(e){return e}}();e.btoa||(e.btoa=function(e){for(var t,o,i=0,a=n,s="";e.charAt(0|i)||(a="=",i%1);s+=a.charAt(63&t>>8-i%1*8)){if((o=e.charCodeAt(i+=.75))>255)throw r;t=t<<8|o}return s}),e.atob||(e.atob=function(e){if((e=e.replace(/=+$/,"")).length%4==1)throw r;for(var t,o,i=0,a=0,s="";o=e.charAt(a++);~o&&(t=i%4?64*t+o:o,i++%4)?s+=String.fromCharCode(255&t>>(-2*i&6)):0)o=n.indexOf(o);return s})}()},function(e,t){e.exports=function(e,t){if(!e[t])throw new Error(t+" is required.")}},function(e,t){var n=Object.prototype.toString;e.exports=null!=Array.isArray?Array.isArray:function(e){return"[object Array]"===n.call(e)}},function(e,t){e.exports=Array.prototype.indexOf?function(e,t,n){return e.indexOf(t,n)}:function(e,t,n){var r;if(null==e)throw new TypeError('"array" is null or not defined');var o=Object(e),i=o.length>>>0;if(0===i)return-1;var a=+n||0;Math.abs(a)===1/0&&(a=0);if(a>=i)return-1;r=Math.max(a>=0?a:i-Math.abs(a),0);for(;r2?arguments[2]:null;if(s===+s)for(o=0;o=0&&"[object Function]"===n.call(e.callee)),r}},function(e,t){e.exports=function(e){return null!==e&&("object"==typeof e||"function"==typeof e)}},function(e,t){(t=e.exports=function(e){return e.replace(/^\s*|\s*$/g,"")}).left=function(e){return e.replace(/^\s*/,"")},t.right=function(e){return e.replace(/\s*$/,"")}},function(module,exports,__webpack_require__){var __WEBPACK_AMD_DEFINE_FACTORY__,__WEBPACK_AMD_DEFINE_RESULT__; +/*! + * Reqwest! A general purpose XHR connection manager + * license MIT (c) Dustin Diaz 2014 + * https://github.com/ded/reqwest + */!function(e,t,n){module.exports?module.exports=n():void 0===(__WEBPACK_AMD_DEFINE_RESULT__="function"==typeof(__WEBPACK_AMD_DEFINE_FACTORY__=n)?__WEBPACK_AMD_DEFINE_FACTORY__.call(exports,__webpack_require__,exports,module):__WEBPACK_AMD_DEFINE_FACTORY__)||(module.exports=__WEBPACK_AMD_DEFINE_RESULT__)}(0,0,function(){var win=window,doc=document,httpsRe=/^http/,protocolRe=/(^\w+):\/\//,twoHundo=/^(20\d|1223)$/,byTag="getElementsByTagName",readyState="readyState",contentType="Content-Type",requestedWith="X-Requested-With",head=doc[byTag]("head")[0],uniqid=0,callbackPrefix="reqwest_"+ +new Date,lastValue,xmlHttpRequest="XMLHttpRequest",xDomainRequest="XDomainRequest",noop=function(){},isArray="function"==typeof Array.isArray?Array.isArray:function(e){return e instanceof Array},defaultHeaders={contentType:"application/x-www-form-urlencoded",requestedWith:xmlHttpRequest,accept:{"*":"text/javascript, text/html, application/xml, text/xml, */*",xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript",js:"application/javascript, text/javascript"}},xhr=function(e){if(!0===e.crossOrigin){var t=win[xmlHttpRequest]?new XMLHttpRequest:null;if(t&&"withCredentials"in t)return t;if(win[xDomainRequest])return new XDomainRequest;throw new Error("Browser does not support cross-origin requests")}return win[xmlHttpRequest]?new XMLHttpRequest:new ActiveXObject("Microsoft.XMLHTTP")},globalSetupOptions={dataFilter:function(e){return e}};function succeed(e){var t=protocolRe.exec(e.url);return t=t&&t[1]||window.location.protocol,httpsRe.test(t)?twoHundo.test(e.request.status):!!e.request.response}function handleReadyState(e,t,n){return function(){return e._aborted?n(e.request):e._timedOut?n(e.request,"Request is aborted: timeout"):void(e.request&&4==e.request[readyState]&&(e.request.onreadystatechange=noop,succeed(e)?t(e.request):n(e.request)))}}function setHeaders(e,t){var n,r=t.headers||{};r.Accept=r.Accept||defaultHeaders.accept[t.type]||defaultHeaders.accept["*"];var o="function"==typeof FormData&&t.data instanceof FormData;for(n in t.crossOrigin||r[requestedWith]||(r[requestedWith]=defaultHeaders.requestedWith),r[contentType]||o||(r[contentType]=t.contentType||defaultHeaders.contentType),r)r.hasOwnProperty(n)&&"setRequestHeader"in e&&e.setRequestHeader(n,r[n])}function setCredentials(e,t){void 0!==t.withCredentials&&void 0!==e.withCredentials&&(e.withCredentials=!!t.withCredentials)}function generalCallback(e){lastValue=e}function urlappend(e,t){return e+(/\?/.test(e)?"&":"?")+t}function handleJsonp(e,t,n,r){var o=uniqid++,i=e.jsonpCallback||"callback",a=e.jsonpCallbackName||reqwest.getcallbackPrefix(o),s=new RegExp("((^|\\?|&)"+i+")=([^&]+)"),u=r.match(s),l=doc.createElement("script"),c=0,d=-1!==navigator.userAgent.indexOf("MSIE 10.0");return u?"?"===u[3]?r=r.replace(s,"$1="+a):a=u[3]:r=urlappend(r,i+"="+a),win[a]=generalCallback,l.type="text/javascript",l.src=r,l.async=!0,void 0===l.onreadystatechange||d||(l.htmlFor=l.id="_reqwest_"+o),l.onload=l.onreadystatechange=function(){if(l[readyState]&&"complete"!==l[readyState]&&"loaded"!==l[readyState]||c)return!1;l.onload=l.onreadystatechange=null,l.onclick&&l.onclick(),t(lastValue),lastValue=void 0,head.removeChild(l),c=1},head.appendChild(l),{abort:function(){l.onload=l.onreadystatechange=null,n({},"Request is aborted: timeout",{}),lastValue=void 0,head.removeChild(l),c=1}}}function getRequest(e,t){var n,r=this.o,o=(r.method||"GET").toUpperCase(),i="string"==typeof r?r:r.url,a=!1!==r.processData&&r.data&&"string"!=typeof r.data?reqwest.toQueryString(r.data):r.data||null,s=!1;return"jsonp"!=r.type&&"GET"!=o||!a||(i=urlappend(i,a),a=null),"jsonp"==r.type?handleJsonp(r,e,t,i):((n=r.xhr&&r.xhr(r)||xhr(r)).open(o,i,!1!==r.async),setHeaders(n,r),setCredentials(n,r),win[xDomainRequest]&&n instanceof win[xDomainRequest]?(n.onload=e,n.onerror=t,n.onprogress=function(){},s=!0):n.onreadystatechange=handleReadyState(this,e,t),r.before&&r.before(n),s?setTimeout(function(){n.send(a)},200):n.send(a),n)}function Reqwest(e,t){this.o=e,this.fn=t,init.apply(this,arguments)}function setType(e){return e.match("json")?"json":e.match("javascript")?"js":e.match("text")?"html":e.match("xml")?"xml":void 0}function init(o,fn){this.url="string"==typeof o?o:o.url,this.timeout=null,this._fulfilled=!1,this._successHandler=function(){},this._fulfillmentHandlers=[],this._errorHandlers=[],this._completeHandlers=[],this._erred=!1,this._responseArgs={};var self=this;function complete(e){for(o.timeout&&clearTimeout(self.timeout),self.timeout=null;self._completeHandlers.length>0;)self._completeHandlers.shift()(e)}function success(resp){var type=o.type||resp&&setType(resp.getResponseHeader("Content-Type"));resp="jsonp"!==type?self.request:resp;var filteredResponse=globalSetupOptions.dataFilter(resp.responseText,type),r=filteredResponse;try{resp.responseText=r}catch(e){}if(r)switch(type){case"json":try{resp=win.JSON?win.JSON.parse(r):eval("("+r+")")}catch(e){return error(resp,"Could not parse JSON in response",e)}break;case"js":resp=eval(r);break;case"html":resp=r;break;case"xml":resp=resp.responseXML&&resp.responseXML.parseError&&resp.responseXML.parseError.errorCode&&resp.responseXML.parseError.reason?null:resp.responseXML}for(self._responseArgs.resp=resp,self._fulfilled=!0,fn(resp),self._successHandler(resp);self._fulfillmentHandlers.length>0;)resp=self._fulfillmentHandlers.shift()(resp);complete(resp)}function timedOut(){self._timedOut=!0,self.request.abort()}function error(e,t,n){for(e=self.request,self._responseArgs.resp=e,self._responseArgs.msg=t,self._responseArgs.t=n,self._erred=!0;self._errorHandlers.length>0;)self._errorHandlers.shift()(e,t,n);complete(e)}fn=fn||function(){},o.timeout&&(this.timeout=setTimeout(function(){timedOut()},o.timeout)),o.success&&(this._successHandler=function(){o.success.apply(o,arguments)}),o.error&&this._errorHandlers.push(function(){o.error.apply(o,arguments)}),o.complete&&this._completeHandlers.push(function(){o.complete.apply(o,arguments)}),this.request=getRequest.call(this,success,error)}function reqwest(e,t){return new Reqwest(e,t)}function normalize(e){return e?e.replace(/\r?\n/g,"\r\n"):""}function serial(e,t){var n,r,o,i,a=e.name,s=e.tagName.toLowerCase(),u=function(e){e&&!e.disabled&&t(a,normalize(e.attributes.value&&e.attributes.value.specified?e.value:e.text))};if(!e.disabled&&a)switch(s){case"input":/reset|button|image|file/i.test(e.type)||(n=/checkbox/i.test(e.type),r=/radio/i.test(e.type),o=e.value,(!n&&!r||e.checked)&&t(a,normalize(n&&""===o?"on":o)));break;case"textarea":t(a,normalize(e.value));break;case"select":if("select-one"===e.type.toLowerCase())u(e.selectedIndex>=0?e.options[e.selectedIndex]:null);else for(i=0;e.length&&i-1&&null!==new RegExp("rv:([0-9]{2,2}[.0-9]{0,})").exec(t)&&(e=parseFloat(RegExp.$1));return e>=8}();return"undefined"!=typeof window&&window.JSON&&window.JSON.stringify&&window.JSON.parse&&window.postMessage?{open:function(a,s){if(!s)throw"missing required callback argument";var u,l;a.url||(u="missing required 'url' parameter"),a.relay_url||(u="missing required 'relay_url' parameter"),u&&setTimeout(function(){s(u)},0),a.window_name||(a.window_name=null),a.window_features&&!function(){try{var e=navigator.userAgent;return-1!=e.indexOf("Fennec/")||-1!=e.indexOf("Firefox/")&&-1!=e.indexOf("Android")}catch(e){}return!1}()||(a.window_features=void 0);var c,d=o(a.url);if(d!==o(a.relay_url))return setTimeout(function(){s("invalid arguments: origin of url and relay_url must match")},0);i&&((l=document.createElement("iframe")).setAttribute("src",a.relay_url),l.style.display="none",l.setAttribute("name",e),document.body.appendChild(l),c=l.contentWindow);var f=a.popup||window.open(a.url,a.window_name,a.window_features);a.popup&&(f.location.href=a.url),c||(c=f);var p=setInterval(function(){f&&f.closed&&(m(),s&&(s("User closed the popup window"),s=null))},500),h=JSON.stringify({a:"request",d:a.params});function m(){if(l&&document.body.removeChild(l),l=void 0,p&&(p=clearInterval(p)),r(window,"message",g),r(window,"unload",m),f)try{f.close()}catch(e){c.postMessage(t,d)}f=c=void 0}function g(e){if(e.origin===d)try{var t=JSON.parse(e.data);"ready"===t.a?c.postMessage(h,d):"error"===t.a?(m(),s&&(s(t.d),s=null)):"response"===t.a&&(m(),s&&(s(null,t.d),s=null))}catch(e){}}return n(window,"unload",m),n(window,"message",g),{close:m,focus:function(){if(f)try{f.focus()}catch(e){}}}},onOpen:function(o){var a="*",s=i?function(){window.location;for(var t=window.opener.frames,n=t.length-1;n>=0;n--)try{if(t[n].location.protocol===window.location.protocol&&t[n].location.host===window.location.host&&t[n].name===e)return t[n]}catch(e){}}():window.opener;if(!s)throw"can't find relay frame";function u(e){e=JSON.stringify(e),i?s.doPost(e,a):s.postMessage(e,a)}function l(e){if(e.data===t)try{window.close()}catch(e){}}n(i?s:window,"message",function e(t){var n;try{n=JSON.parse(t.data)}catch(e){}n&&"request"===n.a&&(r(window,"message",e),a=t.origin,o&&setTimeout(function(){o(a,n.d,function(e){o=void 0,u({a:"response",d:e})})},0))}),n(i?s:window,"message",l);try{u({a:"ready"})}catch(e){n(s,"load",function(e){u({a:"ready"})})}var c=function(){try{r(i?s:window,"message",l)}catch(e){}o&&u({a:"error",d:"client closed window"}),o=void 0;try{window.close()}catch(e){}};return n(window,"unload",c),{detach:function(){r(window,"unload",c)}}}}:{open:function(e,t,n,r){setTimeout(function(){r("unsupported browser")},0)},onOpen:function(e){setTimeout(function(){e("unsupported browser")},0)}}}();e.exports&&(e.exports=r)},function(e,t,n){var r=n(84)("jsonp");e.exports=function(e,t,n){"function"==typeof t&&(n=t,t={});t||(t={});var a,s,u=t.prefix||"__jp",l=t.param||"callback",c=null!=t.timeout?t.timeout:6e4,d=encodeURIComponent,f=document.getElementsByTagName("script")[0]||document.head,p=u+o++;c&&(s=setTimeout(function(){h(),n&&n(new Error("Timeout"))},c));function h(){a.parentNode.removeChild(a),window[p]=i}window[p]=function(e){r("jsonp got",e),s&&clearTimeout(s),h(),n&&n(null,e)},e=(e+=(~e.indexOf("?")?"&":"?")+l+"="+d(p)).replace("?&","?"),r('jsonp req "%s"',e),(a=document.createElement("script")).src=e,f.parentNode.insertBefore(a,f)};var o=0;function i(){}},function(e,t,n){(function(r){t.log=function(...e){return"object"==typeof console&&console.log&&console.log(...e)},t.formatArgs=function(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const n="color: "+this.color;t.splice(1,0,n,"color: inherit");let r=0,o=0;t[0].replace(/%[a-zA-Z%]/g,e=>{"%%"!==e&&"%c"===e&&(o=++r)}),t.splice(o,0,n)},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(e){}},t.load=function(){let e;try{e=t.storage.getItem("debug")}catch(e){}!e&&void 0!==r&&"env"in r&&(e=Object({BABEL_ENV:"production",NODE_ENV:"production"}).DEBUG);return e},t.useColors=function(){if("undefined"!=typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs))return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},t.storage=function(){try{return localStorage}catch(e){}}(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],e.exports=n(86)(t);const{formatters:o}=e.exports;o.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}).call(this,n(85))},function(e,t){var n,r,o=e.exports={};function i(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function s(e){if(n===setTimeout)return setTimeout(e,0);if((n===i||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:i}catch(e){n=i}try{r="function"==typeof clearTimeout?clearTimeout:a}catch(e){r=a}}();var u,l=[],c=!1,d=-1;function f(){c&&u&&(c=!1,u.length?l=u.concat(l):d=-1,l.length&&p())}function p(){if(!c){var e=s(f);c=!0;for(var t=l.length;t;){for(u=l,l=[];++d1)for(var n=1;n{if("%%"===n)return n;s++;const i=r.formatters[o];if("function"==typeof i){const r=e[s];n=i.call(t,r),e.splice(s,1),s--}return n}),r.formatArgs.call(t,e),(t.log||r.log).apply(t,e)}return a.namespace=e,a.enabled=r.enabled(e),a.useColors=r.useColors(),a.color=t(e),a.destroy=o,a.extend=i,"function"==typeof r.init&&r.init(a),r.instances.push(a),a}function o(){const e=r.instances.indexOf(this);return-1!==e&&(r.instances.splice(e,1),!0)}function i(e,t){return r(this.namespace+(void 0===t?":":t)+e)}function a(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}return r.debug=r,r.default=r,r.coerce=function(e){return e instanceof Error?e.stack||e.message:e},r.disable=function(){const e=[...r.names.map(a),...r.skips.map(a).map(e=>"-"+e)].join(",");return r.enable(""),e},r.enable=function(e){let t;r.save(e),r.names=[],r.skips=[];const n=("string"==typeof e?e:"").split(/[\s,]+/),o=n.length;for(t=0;t{r[t]=e[t]}),r.instances=[],r.names=[],r.skips=[],r.formatters={},r.selectColor=t,r.enable(r.load()),r}},function(e,t){var n=1e3,r=60*n,o=60*r,i=24*o,a=7*i,s=365.25*i;function u(e,t,n,r){var o=t>=1.5*n;return Math.round(e/n)+" "+r+(o?"s":"")}e.exports=function(e,t){t=t||{};var l=typeof e;if("string"===l&&e.length>0)return function(e){if((e=String(e)).length>100)return;var t=/^((?:\d+)?\-?\d?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(!t)return;var u=parseFloat(t[1]);switch((t[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return u*s;case"weeks":case"week":case"w":return u*a;case"days":case"day":case"d":return u*i;case"hours":case"hour":case"hrs":case"hr":case"h":return u*o;case"minutes":case"minute":case"mins":case"min":case"m":return u*r;case"seconds":case"second":case"secs":case"sec":case"s":return u*n;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return u;default:return}}(e);if("number"===l&&!1===isNaN(e))return t.long?function(e){var t=Math.abs(e);if(t>=i)return u(e,t,i,"day");if(t>=o)return u(e,t,o,"hour");if(t>=r)return u(e,t,r,"minute");if(t>=n)return u(e,t,n,"second");return e+" ms"}(e):function(e){var t=Math.abs(e);if(t>=i)return Math.round(e/i)+"d";if(t>=o)return Math.round(e/o)+"h";if(t>=r)return Math.round(e/r)+"m";if(t>=n)return Math.round(e/n)+"s";return e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},function(e,t){var n=window.location.protocol,r=window.location.hostname,o=window.location.port;e.exports=function(e,t,i){return i=i||"",n===e&&r===t&&o===i}},function(module,exports){var JSON={};!function(){"use strict";function f(e){return e<10?"0"+e:e}"function"!=typeof Date.prototype.toJSON&&(Date.prototype.toJSON=function(e){return isFinite(this.valueOf())?this.getUTCFullYear()+"-"+f(this.getUTCMonth()+1)+"-"+f(this.getUTCDate())+"T"+f(this.getUTCHours())+":"+f(this.getUTCMinutes())+":"+f(this.getUTCSeconds())+"Z":null},String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(e){return this.valueOf()});var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,escapable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},rep;function quote(e){return escapable.lastIndex=0,escapable.test(e)?'"'+e.replace(escapable,function(e){var t=meta[e];return"string"==typeof t?t:"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+e+'"'}function str(e,t){var n,r,o,i,a,s=gap,u=t[e];switch(u&&"object"==typeof u&&"function"==typeof u.toJSON&&(u=u.toJSON(e)),"function"==typeof rep&&(u=rep.call(t,e,u)),typeof u){case"string":return quote(u);case"number":return isFinite(u)?String(u):"null";case"boolean":case"null":return String(u);case"object":if(!u)return"null";if(gap+=indent,a=[],"[object Array]"===Object.prototype.toString.apply(u)){for(i=u.length,n=0;n0&&void 0!==arguments[0]?arguments[0]:{};return r.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!(t={tokenV2:s.default.get(o.auth,"tokenV2"),tokenV3:s.default.get(o.auth,"tokenV3")}).tokenV3){e.next=8;break}return t.user=(0,u.decodeToken)(t.tokenV3),n=c.default.auth.loadProfile(t.tokenV3),e.next=6,l.redux.resolveAction(n);case 6:return n=e.sent,e.abrupt("return",h(p(t,n)));case 8:return e.abrupt("return",h(t));case 9:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}(),f(n(0))),u=n(18),l=n(10),c=f(n(28)),d=f(n(26));function f(e){return e&&e.__esModule?e:{default:e}}function p(e,t){return(0,a.default)({},e,{authenticating:!1,profile:t.payload})}function h(e){var t;return l.redux.handleActions((t={},(0,i.default)(t,c.default.auth.loadProfile,p),(0,i.default)(t,c.default.auth.setTcTokenV2,function(e,t){return(0,a.default)({},e,{tokenV2:t.payload})}),(0,i.default)(t,c.default.auth.setTcTokenV3,function(e,t){var n=t.payload;return(0,a.default)({},e,{tokenV3:n,user:n?(0,u.decodeToken)(n):null})}),(0,i.default)(t,"COMMUNITY_ACTIONS/TC_COMMUNITY/JOIN_DONE",function(e,t){var n=t.payload;return(0,a.default)({},e,{profile:(0,a.default)({},e.profile,{groups:e.profile.groups.concat({id:n.groupId.toString()})})})}),(0,i.default)(t,d.default.profile.uploadPhotoDone,function(e,t){var n=t.payload;return t.error?e:e.profile&&e.profile.handle===n.handle?(0,a.default)({},e,{profile:(0,a.default)({},e.profile,{photoURL:n.photoURL})}):e}),(0,i.default)(t,d.default.profile.deletePhotoDone,function(e,t){var n=t.payload;return t.error?e:e.profile&&e.profile.handle===n.handle?(0,a.default)({},e,{profile:(0,a.default)({},e.profile,{photoURL:null})}):e}),(0,i.default)(t,d.default.profile.updateProfileDone,function(e,t){var n=t.payload;return t.error?e:e.profile&&e.profile.handle===n.handle?(0,a.default)({},e,{profile:(0,a.default)({},e.profile,n)}):e}),t),s.default.defaults(e,{authenticating:!0,profile:null,tokenV2:"",tokenV3:"",user:null}))}t.default=h()},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=d(n(1)),o=d(n(7)),i=d(n(3));t.factory=function(){return r.default.resolve(h())};var a=d(n(0)),s=n(2),u=d(n(11)),l=d(n(31)),c=n(12);function d(e){return e&&e.__esModule?e:{default:e}}function f(e,t){var n=t.payload,r=n.community,s=n.uuid,u=e.communities[r];return(u=u?a.default.clone(u):{}).loadingUuid=s,(0,i.default)({},e,{communities:(0,i.default)({},e.communities,(0,o.default)({},r,u))})}function p(e,t){var n=t.error,r=t.payload;if(n)return u.default.error("Failed to load community stats",r),(0,c.fireErrorMessage)("Failed to load community stats",""),e;var s=r.community,l=r.stats,d=r.uuid;return a.default.get(e.communities[s],"loadingUuid")!==d?e:(0,i.default)({},e,{communities:(0,i.default)({},e.communities,(0,o.default)({},s,{data:l,timestamp:Date.now()}))})}function h(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=l.default.stats;return(0,s.handleActions)((e={},(0,o.default)(e,n.getCommunityStatsInit,f),(0,o.default)(e,n.getCommunityStatsDone,p),e),a.default.defaults(a.default.clone(t),{communities:{}}))}t.default=h()},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=c(n(1)),o=c(n(7)),i=c(n(3));t.factory=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=a.default.get(e,"terms.entity.type"),n=a.default.get(e,"terms.entity.id");if(t&&n){var o=e.terms.entity,i={tokenV2:a.default.get(e.auth,"tokenV2"),tokenV3:a.default.get(e.auth,"tokenV3")};return s.redux.resolveAction(l.default.terms.getTermsDone(o,i)).then(function(e){var t=p({},l.default.terms.getTermsInit(o));return v(t=f(t,e))})}return r.default.resolve(v())};var a=c(n(0)),s=n(10),u=c(n(11)),l=c(n(33));function c(e){return e&&e.__esModule?e:{default:e}}function d(e){return a.default.sortBy(e,function(e){return e.agreed?0:1})}function f(e,t){return t.error?(u.default.error("Failed to get terms!",t.payload),(0,i.default)({},e,{terms:[],getTermsFailure:t.error,loadingTermsForEntity:null})):a.default.isEqual(t.payload.entity,e.loadingTermsForEntity)?(0,i.default)({},e,{entity:t.payload.entity,terms:d(t.payload.terms),getTermsFailure:!1,loadingTermsForEntity:null}):e}function p(e,t){return(0,i.default)({},e,{getTermsFailure:!1,loadingTermsForEntity:t.payload,terms:[],entity:t.payload})}function h(e,t){if(t.error)return u.default.error("Check terms status failed!",t.payload),(0,i.default)({},e,{checkingStatus:!1,checkStatusError:t.payload,canRegister:!1});var n=a.default.every(t.payload,"agreed"),r=a.default.find(t.payload,function(e){return!e.agreed});return(0,i.default)({},e,{checkingStatus:!1,checkStatusError:!1,canRegister:n,terms:d(t.payload),selectedTerm:r})}function m(e,t){return t.error?(u.default.error("Failed to get term details!",t.payload),(0,i.default)({},e,{details:null,getTermDetailsFailure:t.payload,loadingDetailsForTermId:""})):a.default.toString(t.payload.termId)!==e.loadingDetailsForTermId?e:(0,i.default)({},e,t.payload,{getTermDetailsFailure:!1,loadingDetailsForTermId:""})}function g(e,t){return t.error?(u.default.error("Failed to get docu sign url!",t.payload),(0,i.default)({},e,{docuSignUrl:"",getDocuSignUrlFailure:t.payload,loadingDocuSignUrl:""})):a.default.toString(t.payload.templateId)!==e.loadingDocuSignUrl?e:(0,i.default)({},e,t.payload,{getDocuSignUrlFailure:!1,loadingDocuSignUrl:""})}function y(e,t){if(t.error)return u.default.error("Failed to agree term!",t.payload),(0,i.default)({},e,{agreeTermFailure:t.payload,agreeingTerm:""});if(a.default.toString(t.payload.termId)!==e.agreeingTerm)return e;if(t.payload.success){var n=a.default.cloneDeep(e.terms);a.default.find(n,["termsOfUseId",t.payload.termId]).agreed=!0;var r=a.default.find(n,function(e){return!e.agreed});return(0,i.default)({},e,{terms:n,selectedTerm:r,agreeTermFailure:!1,agreeingTerm:""})}return(0,i.default)({},e,{agreeTermFailure:!1,agreeingTerm:""})}function v(e){var t;return s.redux.handleActions((t={},(0,o.default)(t,l.default.terms.getTermsInit,p),(0,o.default)(t,l.default.terms.getTermsDone,f),(0,o.default)(t,l.default.terms.getTermDetailsInit,function(e,t){var n=t.payload;return(0,i.default)({},e,{getTermDetailsFailure:!1,loadingDetailsForTermId:n,details:null,termId:n})}),(0,o.default)(t,l.default.terms.getTermDetailsDone,m),(0,o.default)(t,l.default.terms.getDocuSignUrlInit,function(e,t){var n=t.payload;return(0,i.default)({},e,{getDocuSignUrlFailure:!1,loadingDocuSignUrl:n,docuSignUrl:"",templateId:n})}),(0,o.default)(t,l.default.terms.getDocuSignUrlDone,g),(0,o.default)(t,l.default.terms.agreeTermInit,function(e,t){var n=t.payload;return(0,i.default)({},e,{agreeTermFailure:!1,agreeingTerm:n})}),(0,o.default)(t,l.default.terms.agreeTermDone,y),(0,o.default)(t,l.default.terms.checkStatusInit,function(e){return(0,i.default)({},e,{checkingStatus:!0})}),(0,o.default)(t,l.default.terms.checkStatusDone,h),t),a.default.defaults(e,{terms:[],selectedTerm:null}))}t.default=v()},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=f(n(1)),o=f(n(7)),i=f(n(3));t.factory=function(){return r.default.resolve(w())};var a=f(n(0)),s=n(2),u=n(18),l=f(n(36)),c=f(n(11)),d=n(12);function f(e){return e&&e.__esModule?e:{default:e}}var p="Cannot get user projects without auth token";function h(e){return(0,i.default)({},e,{loadingProjectDetailsForId:0,loadingProjectsForUsername:"",projectDetails:{},projects:[]})}function m(e,t){var n=t.payload;return(0,i.default)({},e,{loadingProjectDetailsForId:n})}function g(e,t){var n=t.error,r=t.payload;if(n)throw c.default.error("Failed to load project details",r),r;return r.project.projectId!==e.loadingProjectDetailsForId?e:(0,i.default)({},e,{loadingProjectDetailsForId:0,projectDetails:r})}function y(e,t){var n=t.payload,r=(0,i.default)({},e.projectPermissions,{loadingForProjectId:n});return(0,i.default)({},e,{projectPermissions:r})}function v(e,t){var n=t.error,r=t.payload;n&&((0,d.fireErrorMessage)("Failed to load project permissions",""),c.default.error("Failed to load project permissions",r));var o=r.permissions,a=r.projectId;if(a!==e.projectPermissions.loadingForProjectId)return e;var s={loadingForProjectId:0,permissions:o,projectId:a,timestamp:Date.now()};return(0,i.default)({},e,{projectPermissions:s})}function b(e,t){var n=t.payload;if(!n)throw c.default.error(p),new Error(p);return(0,i.default)({},e,{loadingProjectsForUsername:(0,u.decodeToken)(n).handle})}function _(e,t){var n=t.error,r=t.payload;if(n)throw c.default.error(r),r;var o=r.projects,a=r.tokenV3;if(!a)throw c.default.error(p),new Error(p);return(0,u.decodeToken)(a).handle!==e.loadingProjectsForUsername?e:(0,i.default)({},e,{loadingProjectsForUsername:"",projects:o.sort(function(e,t){return e.name.localeCompare(t.name)})})}function w(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=l.default.direct;return(0,s.handleActions)((e={},(0,o.default)(e,n.dropAll,h),(0,o.default)(e,n.getProjectDetailsInit,m),(0,o.default)(e,n.getProjectDetailsDone,g),(0,o.default)(e,n.getProjectPermissionsInit,y),(0,o.default)(e,n.getProjectPermissionsDone,v),(0,o.default)(e,n.getUserProjectsInit,b),(0,o.default)(e,n.getUserProjectsDone,_),e),a.default.defaults(t,{loadingProjectDetailsForId:0,loadingProjectsForUsername:"",projectDetails:{},projectPermissions:{loadingForProjectId:0,permissions:[],projectId:0,timestamp:0},projects:[]}))}t.default=w()},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=c(n(1)),o=c(n(7)),i=c(n(106)),a=c(n(3));t.factory=function(){return r.default.resolve(h())};var s=c(n(0)),u=n(2),l=c(n(38));function c(e){return e&&e.__esModule?e:{default:e}}function d(e){return(0,a.default)({},e,{groups:{},loading:{}})}function f(e,t){var n=t.payload,r=s.default.isArray(n)?n:[n],o=s.default.clone(e.loading);return r.forEach(function(e){o[e]=!0}),(0,a.default)({},e,{loading:o})}function p(e,t){var n=s.default.clone(e.groups),r=s.default.clone(e.loading),o=t.payload;return(0,i.default)(o).forEach(function(e){var t=e.id;r[t]&&(!function e(t,n,r){var o=n[r];t[r]=o,o.subGroupIds&&o.subGroupIds.forEach(function(r){return e(t,n,r)})}(n,o,t),delete r[t])}),(0,a.default)({},e,{groups:n,loading:r})}function h(e){var t,n=l.default.groups;return(0,u.handleActions)((t={},(0,o.default)(t,n.dropGroups,d),(0,o.default)(t,n.getGroupsInit,f),(0,o.default)(t,n.getGroupsDone,p),t),s.default.defaults(e?s.default.clone(e):{},{groups:{},loading:{}}))}t.default=h()},function(e,t){e.exports=__WEBPACK_EXTERNAL_MODULE__106__},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,o=f(n(1)),i=f(n(17)),a=f(n(3)),s=f(n(7));t.factory=function(){return o.default.resolve(h())};var u=f(n(0)),l=n(2),c=f(n(22)),d=n(12);function f(e){return e&&e.__esModule?e:{default:e}}var p=(r={},(0,s.default)(r,d.ERROR_ICON_TYPES.NETWORK,[]),(0,s.default)(r,d.ERROR_ICON_TYPES.API,[]),r);function h(e){var t,n=c.default.errors;return(0,l.handleActions)((t={},(0,s.default)(t,n.clearError,function(e){return(0,a.default)({},e,{alerts:e.alerts.slice(1)})}),(0,s.default)(t,n.newError,function(e,t){var n=t.payload;return(0,a.default)({},e,{alerts:[].concat((0,i.default)(e.alerts),[{title:n.title,details:n.details}])})}),(0,s.default)(t,n.clearAllErrorIcons,function(e){return(0,a.default)({},e,{icons:p})}),(0,s.default)(t,n.setErrorIcon,function(e,t){var n=t.payload,r=n.id,o=n.title,u=n.message;return(0,a.default)({},e,{icons:(0,a.default)({},e.icons,(0,s.default)({},r,[].concat((0,i.default)(e.icons[r]),[{title:o,message:u}])))})}),(0,s.default)(t,n.clearErrorIcon,function(e,t){var n=t.payload.id;return(0,a.default)({},e,{icons:(0,a.default)({},e.icons,(0,s.default)({},n,[]))})}),t),u.default.defaults(e,{alerts:[],icons:p}))}t.default=h()},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=m(n(16)),o=m(n(1)),i=m(n(7)),a=m(n(3));t.factory=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t={tokenV2:s.default.get(e.auth,"tokenV2"),tokenV3:s.default.get(e.auth,"tokenV3")},n={},i=s.default.get(e,"challenge.challengeDetails.id"),u=s.default.get(e,"challenge.challengeDetails.mySubmission");if(i&&!u)return l.redux.resolveAction(c.default.challenge.getDetailsDone(i,t.tokenV3,t.tokenV2)).then(function(e){var n=s.default.get(e,"payload.track","").toLowerCase(),r="design"===n?l.redux.resolveAction(c.default.challenge.fetchCheckpointsDone(t.tokenV2,i)):null,a="COMPLETED"===s.default.get(e,"payload.status","")?l.redux.resolveAction(c.default.challenge.loadResultsDone(t,i,n)):null;return o.default.all([e,r,a])}).then(function(e){var t=(0,r.default)(e,3),o=t[0],s=t[1],u=t[2];return n=y(n=(0,a.default)({},n,{loadingCheckpoints:!0,loadingDetailsForChallengeId:i,loadingResultsForChallengeId:i}),o),s&&(n=E(n,s)),u&&(n=C(n,u)),n}).then(function(e){return l.redux.combineReducers(R(e),{mySubmissionsManagement:h.default})});if(i&&u)return o.default.all([l.redux.resolveAction(c.default.challenge.getDetailsDone(i,t.tokenV3,t.tokenV2)),l.redux.resolveAction(c.default.challenge.getSubmissionsDone(i,t.tokenV2))]).then(function(e){var t=(0,r.default)(e,2),o=t[0],s=t[1];return b(n=y(n=(0,a.default)({},n,{loadingSubmissionsForChallengeId:i,loadingDetailsForChallengeId:i}),o),s)}).then(function(e){return l.redux.combineReducers(R(e),{mySubmissionsManagement:h.default})});return o.default.resolve(l.redux.combineReducers(R(n),{mySubmissionsManagement:h.default}))};var s=m(n(0)),u=n(2),l=n(10),c=m(n(39)),d=m(n(23)),f=m(n(11)),p=n(12),h=m(n(52));function m(e){return e&&e.__esModule?e:{default:e}}function g(e,t){var n=t.payload;return e.details&&s.default.toString(e.details.id)!==n?(0,a.default)({},e,{fetchChallengeFailure:!1,loadingDetailsForChallengeId:n,details:null}):(0,a.default)({},e,{fetchChallengeFailure:!1,loadingDetailsForChallengeId:n})}function y(e,t){if(t.error)return f.default.error("Failed to get challenge details!",t.payload),(0,p.fireErrorMessage)("ERROR: Failed to load the challenge","Please, try again a bit later"),(0,a.default)({},e,{fetchChallengeFailure:t.error,loadingDetailsForChallengeId:""});var n=t.payload;return s.default.toString(n.id)!==e.loadingDetailsForChallengeId?e:(0,a.default)({},e,{details:n,fetchChallengeFailure:!1,loadingDetailsForChallengeId:""})}function v(e,t){return(0,a.default)({},e,{loadingSubmissionsForChallengeId:t.payload,mySubmissions:{challengeId:"",v2:null}})}function b(e,t){if(t.error)return f.default.error("Failed to get user's submissions for the challenge",t.payload),(0,a.default)({},e,{loadingSubmissionsForChallengeId:"",mySubmissions:{challengeId:"",v2:null}});var n=t.payload,r=n.challengeId,o=n.submissions;return r!==e.loadingSubmissionsForChallengeId?e:(0,a.default)({},e,{loadingSubmissionsForChallengeId:"",mySubmissions:{challengeId:r,v2:o}})}function _(e,t){return(0,a.default)({},e,{loadingMMSubmissionsForChallengeId:t.payload,mmSubmissions:[]})}function w(e,t){if(t.error)return f.default.error("Failed to get Marathon Match submissions for the challenge",t.payload),(0,a.default)({},e,{loadingMMSubmissionsForChallengeId:"",mmSubmissions:[]});var n=t.payload,r=n.challengeId,o=n.submissions;return r.toString()!==e.loadingMMSubmissionsForChallengeId?e:(0,a.default)({},e,{loadingMMSubmissionsForChallengeId:"",mmSubmissions:o})}function E(e,t){return t.error?(0,a.default)({},e,{loadingCheckpoints:!1}):e.details&&e.details.id===t.payload.challengeId?(0,a.default)({},e,{checkpoints:t.payload.checkpoints,loadingCheckpoints:!1}):e}function T(e,t){var n=t.payload;return(0,a.default)({},e,{loadingResultsForChallengeId:n})}function C(e,t){return t.payload.challengeId!==e.loadingResultsForChallengeId?e:t.error?(f.default.error(t.payload),(0,a.default)({},e,{loadingResultsForChallengeId:"",results:null,resultsLoadedForChallengeId:""})):(0,a.default)({},e,{loadingResultsForChallengeId:"",results:t.payload.results,resultsLoadedForChallengeId:t.payload.challengeId})}function S(e,t){return t.error?(f.default.error("Failed to register for the challenge!",t.payload),(0,p.fireErrorMessage)("ERROR: Failed to register for the challenge!"),(0,a.default)({},e,{registering:!1})):y((0,a.default)({},e,{registering:!1,loadingDetailsForChallengeId:s.default.toString(e.details.id)}),t)}function I(e,t){return t.error?(f.default.error("Failed to register for the challenge!",t.payload),(0,p.fireErrorMessage)("ERROR: Failed to unregister for the challenge!"),(0,a.default)({},e,{unregistering:!1})):y((0,a.default)({},e,{unregistering:!1,loadingDetailsForChallengeId:s.default.toString(e.details.id)}),t)}function k(e,t){var n=t.payload;return(0,a.default)({},e,{updatingChallengeUuid:n})}function O(e,t){var n=t.error,r=t.payload;if(n)return(0,p.fireErrorMessage)("Failed to save the challenge!",""),f.default.error("Failed to save the challenge",r),e;if(r.uuid!==e.updatingChallengeUuid)return e;var o=s.default.pick(r.res,["detailedRequirements","introduction","round1Introduction","round2Introduction","submissionGuidelines"]);return(0,a.default)({},e,{details:(0,a.default)({},e.details,o),updatingChallengeUuid:""})}function A(e,t){var n=t.payload;return t.error?((0,p.fireErrorMessage)("Failed to get active challenges count!",""),f.default.error("Failed to get active challenges count",n),e):(0,a.default)({},e,{activeChallengesCount:n})}function R(e){var t,n=c.default.challenge;return(0,u.handleActions)((t={},(0,i.default)(t,n.dropCheckpoints,function(e){return(0,a.default)({},e,{checkpoints:null})}),(0,i.default)(t,n.dropResults,function(e){return(0,a.default)({},e,{results:null})}),(0,i.default)(t,n.getDetailsInit,g),(0,i.default)(t,n.getDetailsDone,y),(0,i.default)(t,n.getSubmissionsInit,v),(0,i.default)(t,n.getSubmissionsDone,b),(0,i.default)(t,n.getMmSubmissionsInit,_),(0,i.default)(t,n.getMmSubmissionsDone,w),(0,i.default)(t,d.default.smp.deleteSubmissionDone,function(e,t){var n=t.payload;return(0,a.default)({},e,{mySubmissions:(0,a.default)({},e.mySubmissions,{v2:e.mySubmissions.v2.filter(function(e){return e.submissionId!==n})})})}),(0,i.default)(t,n.registerInit,function(e){return(0,a.default)({},e,{registering:!0})}),(0,i.default)(t,n.registerDone,S),(0,i.default)(t,n.unregisterInit,function(e){return(0,a.default)({},e,{unregistering:!0})}),(0,i.default)(t,n.unregisterDone,I),(0,i.default)(t,n.loadResultsInit,T),(0,i.default)(t,n.loadResultsDone,C),(0,i.default)(t,n.fetchCheckpointsInit,function(e){return(0,a.default)({},e,{checkpoints:null,loadingCheckpoints:!0})}),(0,i.default)(t,n.fetchCheckpointsDone,E),(0,i.default)(t,n.updateChallengeInit,k),(0,i.default)(t,n.updateChallengeDone,O),(0,i.default)(t,n.getActiveChallengesCountInit,function(e){return e}),(0,i.default)(t,n.getActiveChallengesCountDone,A),t),s.default.defaults(e,{details:null,loadingCheckpoints:!1,loadingDetailsForChallengeId:"",loadingResultsForChallengeId:"",loadingMMSubmissionsForChallengeId:"",mySubmissions:{},checkpoints:null,registering:!1,results:null,resultsLoadedForChallengeId:"",unregistering:!1,updatingChallengeUuid:"",mmSubmissions:[]}))}t.default=l.redux.combineReducers(R(),{mySubmissionsManagement:h.default})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=f(n(1)),o=f(n(7)),i=f(n(17)),a=f(n(3));t.factory=function(){return r.default.resolve(L())};var s=f(n(0)),u=n(2),l=f(n(26)),c=f(n(11)),d=n(12);function f(e){return e&&e.__esModule?e:{default:e}}function p(e,t){var n=t.payload;return t.error?(0,a.default)({},e,{loadingError:!0}):(0,a.default)({},e,{achievements:n.Achievements,copilot:n.copilot,country:n.country,loadingError:!1})}function h(e,t){var n=t.payload;return t.error?(0,a.default)({},e,{loadingError:!0}):(0,a.default)({},e,{achievements:n.achievements||[],copilot:n.copilot,country:n.country,loadingError:!1})}function m(e,t){var n=t.payload;return t.error?(0,a.default)({},e,{loadingError:!0}):(0,a.default)({},e,{externalAccounts:n})}function g(e,t){var n=t.payload;return t.error?(0,a.default)({},e,{loadingError:!0}):(0,a.default)({},e,{externalLinks:n})}function y(e,t){var n=t.payload;return t.error?(0,a.default)({},e,{loadingError:!0}):(0,a.default)({},e,{info:n,loadingError:!1})}function v(e,t){var n=t.payload;return t.error?(0,a.default)({},e,{loadingError:!0}):(0,a.default)({},e,{skills:n.skills,loadingError:!1})}function b(e,t){var n=t.payload;return t.error?(0,a.default)({},e,{loadingError:!0}):(0,a.default)({},e,{stats:n,loadingError:!1})}function _(e,t){var n=t.payload;return t.error?(0,a.default)({},e,{loadingError:!0}):(0,a.default)({},e,{linkedAccounts:n.profiles,loadingError:!1})}function w(e,t){var n=t.payload;return t.error?(0,a.default)({},e,{loadingError:!0}):(0,a.default)({},e,{credential:n.credential,loadingError:!1})}function E(e,t){var n=t.payload;return t.error?(0,a.default)({},e,{loadingError:!0}):(0,a.default)({},e,{emailPreferences:n.subscriptions,loadingError:!1})}function T(e,t){var n=t.payload,r=t.error,o=(0,a.default)({},e,{uploadingPhoto:!1});return r?(c.default.error("Failed to upload user photo",n),(0,d.fireErrorMessage)("ERROR: Failed to upload photo!"),o):o.info&&o.info.handle===n.handle?(0,a.default)({},o,{info:(0,a.default)({},o.info,{photoURL:n.photoURL})}):o}function C(e,t){var n=t.payload,r=t.error,o=(0,a.default)({},e,{deletingPhoto:!1});return r?(c.default.error("Failed to delete user photo",n),(0,d.fireErrorMessage)("ERROR: Failed to delete photo!"),o):o.info&&o.info.handle===n.handle?(0,a.default)({},o,{info:(0,a.default)({},o.info,{photoURL:null})}):o}function S(e,t){var n=t.payload,r=t.error,o=(0,a.default)({},e,{updatingProfile:!1});return n.isEmailConflict?(0,a.default)({},o,{isEmailConflict:!0,updateProfileSuccess:!1}):r?(c.default.error("Failed to update user profile",n),(0,d.fireErrorMessage)("ERROR: Failed to update user profile!"),(0,a.default)({},o,{updateProfileSuccess:!1})):o.info&&o.info.handle===n.handle?(0,a.default)({},o,{info:(0,a.default)({},o.info,n),updateProfileSuccess:!0}):(0,a.default)({},o,{updateProfileSuccess:!0})}function I(e,t){var n=t.payload,r=t.error,o=(0,a.default)({},e,{addingSkill:!1});return r?(c.default.error("Failed to add user skill",n),(0,d.fireErrorMessage)("ERROR: Failed to add user skill!"),o):o.profileForHandle!==n.handle?o:(0,a.default)({},o,{skills:n.skills})}function k(e,t){var n=t.payload,r=t.error,o=(0,a.default)({},e,{hidingSkill:!1});return r?(c.default.error("Failed to remove user skill",n),(0,d.fireErrorMessage)("ERROR: Failed to remove user skill!"),o):o.profileForHandle!==n.handle?o:(0,a.default)({},o,{skills:n.skills})}function O(e,t){var n=t.payload,r=t.error,o=(0,a.default)({},e,{addingWebLink:!1});return r?(c.default.error("Failed to add web link",n),(0,d.fireErrorMessage)("ERROR: Failed to add web link!"),o):o.profileForHandle===n.handle&&n.data?(0,a.default)({},o,{externalLinks:[].concat((0,i.default)(o.externalLinks),[n.data])}):o}function A(e,t){var n=t.payload,r=t.error,o=(0,a.default)({},e,{deletingWebLink:!1});return r?(c.default.error("Failed to delete web link",n),(0,d.fireErrorMessage)("ERROR: Failed to delete web link!"),o):o.profileForHandle===n.handle&&n.data?(0,a.default)({},o,{externalLinks:s.default.filter(o.externalLinks,function(e){return e.key!==n.data.key})}):o}function R(e,t){var n=t.payload,r=t.error,o=(0,a.default)({},e,{linkingExternalAccount:!1});return r?(c.default.error("Failed to link external account",n),(0,d.fireErrorMessage)("ERROR: Failed to link external account!"),o):o.profileForHandle===n.handle&&n.data?(0,a.default)({},o,{linkedAccounts:[].concat((0,i.default)(o.linkedAccounts),[n.data])}):o}function D(e,t){var n=t.payload,r=t.error,o=(0,a.default)({},e,{unlinkingExternalAccount:!1});return r?(c.default.error("Failed to unlink external account",n),(0,d.fireErrorMessage)("ERROR: Failed to unlink external account!"),o):o.profileForHandle!==n.handle?o:(0,a.default)({},o,{linkedAccounts:s.default.filter(o.linkedAccounts,function(e){return e.providerType!==n.providerType})})}function P(e,t){var n=t.payload,r=t.error,o=(0,a.default)({},e,{savingEmailPreferences:!1});return r?(c.default.error("Failed to save email preferences",n),(0,d.fireErrorMessage)("ERROR: Failed to save email preferences!"),o):o.profileForHandle===n.handle&&n.data?(0,a.default)({},o,{emailPreferences:n.data.subscriptions}):o}function x(e,t){var n=t.payload,r=t.error,o=(0,a.default)({},e,{updatingPassword:!1});return r&&(c.default.error("Failed to update password",n),(0,d.fireErrorMessage)("The old password is invalid")),o}function N(e,t){var n=t.payload,r=t.error,o=(0,a.default)({},e,{verifyingEmail:!1});return r?(c.default.error("Failed to verify member new email",n),(0,a.default)({},o,{verifyError:!0})):(0,a.default)({},o,{verifyError:!1,emailChangeResult:n.data})}function U(e,t){var n=t.payload;return(0,a.default)({},e,{isEmailConflict:n})}function L(e){var t,n=l.default.profile;return(0,u.handleActions)((t={},(0,o.default)(t,n.clearProfile,function(e){return(0,a.default)({},e,{achievements:null,country:"",info:null,skills:null,stats:null})}),(0,o.default)(t,n.loadProfile,function(e,t){return(0,a.default)({},e,{profileForHandle:t.payload})}),(0,o.default)(t,n.getAchievementsInit,function(e){return e}),(0,o.default)(t,n.getAchievementsDone,p),(0,o.default)(t,n.getAchievementsV3Done,h),(0,o.default)(t,n.getExternalAccountsInit,function(e){return e}),(0,o.default)(t,n.getExternalAccountsDone,m),(0,o.default)(t,n.getExternalLinksInit,function(e){return e}),(0,o.default)(t,n.getExternalLinksDone,g),(0,o.default)(t,n.getInfoInit,function(e){return e}),(0,o.default)(t,n.getInfoDone,y),(0,o.default)(t,n.getSkillsInit,function(e){return e}),(0,o.default)(t,n.getSkillsDone,v),(0,o.default)(t,n.getStatsInit,function(e){return e}),(0,o.default)(t,n.getStatsDone,b),(0,o.default)(t,n.getLinkedAccountsInit,function(e){return e}),(0,o.default)(t,n.getLinkedAccountsDone,_),(0,o.default)(t,n.uploadPhotoInit,function(e){return(0,a.default)({},e,{uploadingPhoto:!0})}),(0,o.default)(t,n.uploadPhotoDone,T),(0,o.default)(t,n.deletePhotoInit,function(e){return(0,a.default)({},e,{deletingPhoto:!0})}),(0,o.default)(t,n.deletePhotoDone,C),(0,o.default)(t,n.updateProfileInit,function(e){return(0,a.default)({},e,{updatingProfile:!0})}),(0,o.default)(t,n.updateProfileDone,S),(0,o.default)(t,n.addSkillInit,function(e){return(0,a.default)({},e,{addingSkill:!0})}),(0,o.default)(t,n.addSkillDone,I),(0,o.default)(t,n.hideSkillInit,function(e){return(0,a.default)({},e,{hidingSkill:!0})}),(0,o.default)(t,n.hideSkillDone,k),(0,o.default)(t,n.addWebLinkInit,function(e){return(0,a.default)({},e,{addingWebLink:!0})}),(0,o.default)(t,n.addWebLinkDone,O),(0,o.default)(t,n.deleteWebLinkInit,function(e){return(0,a.default)({},e,{deletingWebLink:!0})}),(0,o.default)(t,n.deleteWebLinkDone,A),(0,o.default)(t,n.linkExternalAccountInit,function(e){return(0,a.default)({},e,{linkingExternalAccount:!0})}),(0,o.default)(t,n.linkExternalAccountDone,R),(0,o.default)(t,n.unlinkExternalAccountInit,function(e){return(0,a.default)({},e,{unlinkingExternalAccount:!0})}),(0,o.default)(t,n.unlinkExternalAccountDone,D),(0,o.default)(t,n.getCredentialInit,function(e){return e}),(0,o.default)(t,n.getCredentialDone,w),(0,o.default)(t,n.getEmailPreferencesInit,function(e){return e}),(0,o.default)(t,n.getEmailPreferencesDone,E),(0,o.default)(t,n.saveEmailPreferencesInit,function(e){return(0,a.default)({},e,{savingEmailPreferences:!0})}),(0,o.default)(t,n.saveEmailPreferencesDone,P),(0,o.default)(t,n.updatePasswordInit,function(e){return(0,a.default)({},e,{updatingPassword:!0})}),(0,o.default)(t,n.updatePasswordDone,x),(0,o.default)(t,n.verifyMemberNewEmailInit,function(e){return(0,a.default)({},e,{verifyingEmail:!0})}),(0,o.default)(t,n.verifyMemberNewEmailDone,N),(0,o.default)(t,n.updateEmailConflict,U),t),s.default.defaults(e,{achievements:null,copilot:!1,country:"",info:null,loadingError:!1,skills:null,stats:null,verifyError:null,updateProfileSuccess:null}))}t.default=L()},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=f(n(1)),o=f(n(17)),i=f(n(7)),a=f(n(3));t.factory=function(){return r.default.resolve(x())};var s=f(n(0)),u=n(2),l=f(n(11)),c=f(n(43)),d=n(12);function f(e){return e&&e.__esModule?e:{default:e}}function p(e,t){var n=t.payload;return e[n]?s.default.omit(e,n):e}function h(){return{}}function m(e,t){var n=t.payload,r=n.handle,o=n.uuid,u=e[r];return(u=u?s.default.clone(u):{}).achievements={loadingUuid:o},(0,a.default)({},e,(0,i.default)({},r,u))}function g(e,t){var n=t.error,r=t.payload;if(n)return l.default.error("Failed to load member achievements",r),(0,d.fireErrorMessage)("Failed to load member achievements"),e;var o=r.data,u=r.handle;return r.uuid!==s.default.get(e[u],"achievements.loadingUuid")?e:(0,a.default)({},e,(0,i.default)({},u,(0,a.default)({},e[u],{achievements:{data:o,timestamp:Date.now()}})))}function y(e,t){var n=t.payload,r=n.handle,o=n.uuid,s=(0,a.default)({},e[r]||{},{finances:{loadingUuid:o,timestamp:0}});return(0,a.default)({},e,(0,i.default)({},r,s))}function v(e,t){var n=t.error,r=t.payload;if(n)return l.default.error("Failed to get user financial info",r),(0,d.fireErrorMessage)("Failed to get user financial info",""),e;var o=r.data,u=r.handle;return r.uuid!==s.default.get(e[u],"finances.loadingUuid")?e:(0,a.default)({},e,(0,i.default)({},u,(0,a.default)({},e[u],{finances:{data:o,loadingUuid:"",timestamp:Date.now()}})))}function b(e,t){var n=t.payload,r=n.handle,o=n.uuid,u=e[r];return(u=u?s.default.clone(u):{}).stats={loadingUuid:o},(0,a.default)({},e,(0,i.default)({},r,u))}function _(e,t){var n=t.error,r=t.payload;if(n)return l.default.error("Failed to get member stats",r),(0,d.fireErrorMessage)("Failed to get member stats",""),e;var o=r.data,u=r.handle;return r.uuid!==s.default.get(e[u],"stats.loadingUuid")?e:(0,a.default)({},e,(0,i.default)({},u,(0,a.default)({},e[u],{stats:{data:o,timestamp:Date.now()}})))}function w(e,t){var n=t.payload,r=n.handle,o=n.uuid,u=e[r];return(u=u?s.default.clone(u):{}).statsHistory={loadingUuid:o},(0,a.default)({},e,(0,i.default)({},r,u))}function E(e,t){var n=t.error,r=t.payload;if(n)return l.default.error("Failed to get member statsHistory",r),(0,d.fireErrorMessage)("Failed to get member statsHistory",""),e;var o=r.data,u=r.handle;return r.uuid!==s.default.get(e[u],"statsHistory.loadingUuid")?e:(0,a.default)({},e,(0,i.default)({},u,(0,a.default)({},e[u],{statsHistory:{data:o,timestamp:Date.now()}})))}function T(e,t){var n=t.payload,r=n.handle,o=n.uuid,u=e[r];return(u=u?s.default.clone(u):{}).statsDistribution={loadingUuid:o},(0,a.default)({},e,(0,i.default)({},r,u))}function C(e,t){var n=t.error,r=t.payload;if(n)return l.default.error("Failed to get member statsDistribution",r),(0,d.fireErrorMessage)("Failed to get member statsDistribution",""),e;var o=r.data,u=r.handle;return r.uuid!==s.default.get(e[u],"statsDistribution.loadingUuid")?e:(0,a.default)({},e,(0,i.default)({},u,(0,a.default)({},e[u],{statsDistribution:{data:o,timestamp:Date.now()}})))}function S(e,t){var n=t.payload.handle;return(0,a.default)({},e,(0,i.default)({},n,(0,a.default)({},e[n],{activeChallengesCount:null})))}function I(e,t){var n=t.error,r=t.payload;if(n)return l.default.error("Failed to get member active challenges",r),(0,d.fireErrorMessage)("Failed to get member active challenges",""),e;var o=r.handle,s=r.challenges;return(0,a.default)({},e,(0,i.default)({},o,(0,a.default)({},e[o],{activeChallengesCount:s.length})))}function k(e,t){var n=t.payload,r=n.handle,o=n.uuid;return(0,a.default)({},e,(0,i.default)({},r,(0,a.default)({},e[r],{loadingSubTrackChallengesUUID:o})))}function O(e,t){var n=t.error,r=t.payload;if(n)return l.default.error("Failed to get member subtrack challenges",r),(0,d.fireErrorMessage)("Failed to get member subtrack challenges",""),e;var s=r.uuid,u=r.challenges,c=r.refresh,f=r.handle;return s!==e[f].loadingSubTrackChallengesUUID?e:(0,a.default)({},e,(0,i.default)({},f,(0,a.default)({},e[f],{subtrackChallenges:e[f].subtrackChallenges&&!c?[].concat((0,o.default)(e[f].subtrackChallenges),(0,o.default)(u)):u,subtrackChallengesHasMore:u&&u.length>0,loadingSubTrackChallengesUUID:""})))}function A(e,t){var n=t.payload,r=n.handle,o=n.uuid;return(0,a.default)({},e,(0,i.default)({},r,(0,a.default)({},e[r],{loadingSRMUUID:o})))}function R(e,t){var n=t.error,r=t.payload;if(n)return l.default.error("Failed to get member SRMs",r),(0,d.fireErrorMessage)("Failed to get member SRMs",""),e;var s=r.uuid,u=r.srms,c=r.refresh,f=r.handle;return s!==e[f].loadingSRMUUID?e:(0,a.default)({},e,(0,i.default)({},f,(0,a.default)({},e[f],{userSRMs:e[f].userSRMs&&!c?[].concat((0,o.default)(e[f].userSRMs),(0,o.default)(u)):u,userSRMHasMore:u&&u.length>0,loadingSRMUUID:""})))}function D(e,t){var n=t.payload,r=n.handle,o=n.uuid;return(0,a.default)({},e,(0,i.default)({},r,(0,a.default)({},e[r],{loadingMarathonUUID:o})))}function P(e,t){var n=t.error,r=t.payload;if(n)return l.default.error("Failed to get member marathons",r),(0,d.fireErrorMessage)("Failed to get member marathons",""),e;var s=r.uuid,u=r.marathons,c=r.refresh,f=r.handle;return s!==e[f].loadingMarathonUUID?e:(0,a.default)({},e,(0,i.default)({},f,(0,a.default)({},e[f],{userMarathons:e[f].userMarathons&&!c?[].concat((0,o.default)(e[f].userMarathons),(0,o.default)(u.challenges)):u.challenges,userMarathonHasMore:u&&u.challenges&&u.challenges.length>0,loadingMarathonUUID:""})))}function x(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=c.default.members;return(0,u.handleActions)((e={},(0,i.default)(e,n.drop,p),(0,i.default)(e,n.dropAll,h),(0,i.default)(e,n.getAchievementsInit,m),(0,i.default)(e,n.getAchievementsDone,g),(0,i.default)(e,n.getAchievementsV3Done,g),(0,i.default)(e,n.getFinancesInit,y),(0,i.default)(e,n.getFinancesDone,v),(0,i.default)(e,n.getStatsInit,b),(0,i.default)(e,n.getStatsDone,_),(0,i.default)(e,n.getStatsHistoryInit,w),(0,i.default)(e,n.getStatsHistoryDone,E),(0,i.default)(e,n.getStatsDistributionInit,T),(0,i.default)(e,n.getStatsDistributionDone,C),(0,i.default)(e,n.getActiveChallengesInit,S),(0,i.default)(e,n.getActiveChallengesDone,I),(0,i.default)(e,n.getSubtrackChallengesInit,k),(0,i.default)(e,n.getSubtrackChallengesDone,O),(0,i.default)(e,n.getUserSrmInit,A),(0,i.default)(e,n.getUserSrmDone,R),(0,i.default)(e,n.getUserMarathonInit,D),(0,i.default)(e,n.getUserMarathonDone,P),e),t)}t.default=x()},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=c(n(1)),o=c(n(7)),i=c(n(3));t.factory=function(){return r.default.resolve(p())};var a=c(n(0)),s=n(2),u=c(n(11)),l=c(n(47));function c(e){return e&&e.__esModule?e:{default:e}}function d(e,t){var n=t.payload;return t.error?(u.default.error("Failed to get skill tags",n),(0,i.default)({},e,{loadingSkillTagsError:!0})):(0,i.default)({},e,{loadingSkillTagsError:!1,skillTags:n})}function f(e,t){var n=t.payload;return t.error?(u.default.error("Failed to get countries",n),(0,i.default)({},e,{loadingCountriesError:!0})):(0,i.default)({},e,{loadingCountriesError:!1,countries:n})}function p(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=l.default.lookup;return(0,s.handleActions)((e={},(0,o.default)(e,n.getSkillTagsInit,function(e){return e}),(0,o.default)(e,n.getSkillTagsDone,d),(0,o.default)(e,n.getCountriesInit,function(e){return e}),(0,o.default)(e,n.getCountriesDone,f),e),a.default.defaults(t,{skillTags:[],countries:[]}))}t.default=p()},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=d(n(1)),o=d(n(7)),i=d(n(3));t.factory=function(){return r.default.resolve(m())};var a=d(n(0)),s=n(10),u=d(n(11)),l=n(44),c=d(l);function d(e){return e&&e.__esModule?e:{default:e}}function f(e){return(0,i.default)({},e,{allLoaded:!1,lastRequestedPageNum:-1,loadingUuid:"",tasks:[],timestamp:0})}function p(e,t){var n=t.payload;return(0,i.default)({},e,{lastRequestedPageNum:n.pageNum,loadingUuid:n.uuid})}function h(e,t){var n=t.error,r=t.payload;if(n)return u.default.error(r),s.isomorphy.isClientSide()&&alert("Failed to load member tasks"),e;var o=r.projectId,c=r.tasks;if(r.uuid!==e.loadingUuid)return e;var d={};e.tasks.forEach(function(e){d[e.id]=e}),c.forEach(function(e){d[e.id]=e});var f=e.timestamps;return e.lastRequestedPageNum||((f=a.default.clone(f))[o]=Date.now()),(0,i.default)({},e,{allLoaded:c.length0&&void 0!==arguments[0]?arguments[0]:{},n=c.default.memberTasks;return s.redux.handleActions((e={},(0,o.default)(e,n.dropAll,f),(0,o.default)(e,n.getInit,p),(0,o.default)(e,n.getDone,h),e),a.default.defaults(t,{allLoaded:!1,lastRequestedPageNum:-1,loadingUuid:"",tasks:[],timestamps:{}}))}t.default=m()},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=l(n(1)),o=l(n(7)),i=l(n(3));t.factory=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=a.default.get(e,"reviewOpportunity.challenge.id");if(t){var n={tokenV2:a.default.get(e.auth,"tokenV2"),tokenV3:a.default.get(e.auth,"tokenV3")},o=u.default.reviewOpportunity;return s.redux.resolveAction(o.getDetailsDone(t,n.tokenV3)).then(function(e){var t=e.error,n=e.payload,r={};r.details=t?null:n,r.requiredTerms=t?[]:c(n),f(r)})}return r.default.resolve(f())};var a=l(n(0)),s=n(10),u=l(n(45));function l(e){return e&&e.__esModule?e:{default:e}}function c(e){var t=e.payments.map(function(e){return e.role});return a.default.uniqBy(e.challenge.terms.filter(function(e){return"Reviewer"===e.role||a.default.includes(t,e.role)}).map(function(e){return a.default.pick(e,["termsOfUseId","agreed","title"])}),function(e){return e.termsOfUseId})||[]}function d(e,t){var n=t.payload;return t.error?(0,i.default)({},e,{authError:!0,isLoadingDetails:!1}):(0,i.default)({},e,{details:n,isLoadingDetails:!1,requiredTerms:c(n)})}function f(e){var t,n=u.default.reviewOpportunity;return s.redux.handleActions((t={},(0,o.default)(t,n.cancelApplicationsInit,function(e){return e}),(0,o.default)(t,n.cancelApplicationsDone,function(e){return e}),(0,o.default)(t,n.getDetailsInit,function(e){return(0,i.default)({},e,{isLoadingDetails:!0})}),(0,o.default)(t,n.getDetailsDone,d),(0,o.default)(t,n.submitApplicationsInit,function(e){return e}),(0,o.default)(t,n.submitApplicationsDone,function(e){return e}),t),a.default.defaults(e,{authError:!1,details:null,isLoadingDetails:!1,requiredTerms:[]}))}t.default=f()},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=d(n(1)),o=d(n(7)),i=d(n(17)),a=d(n(3));t.factory=function(){return r.default.resolve(y())};var s=n(2),u=d(n(11)),l=d(n(49)),c=n(12);function d(e){return e&&e.__esModule?e:{default:e}}function f(e,t){var n=t.error,r=t.payload;return n?(u.default.error("Failed to get all user traits",r),(0,a.default)({},e,{userTraits:[]})):(0,a.default)({},e,{userTraits:r.data})}function p(e){return(0,a.default)({},e,{traitRequestCount:e.traitRequestCount+1})}function h(e,t){var n=t.error,r=t.payload;if(n)return u.default.error("Failed to add user trait",r),(0,c.fireErrorMessage)("Failed to add user trait",""),(0,a.default)({},e,{traitRequestCount:e.traitRequestCount-1});var o=r.result[0];return(0,a.default)({},e,{userTraits:[].concat((0,i.default)(e.userTraits),[o]),traitRequestCount:e.traitRequestCount-1})}function m(e,t){var n=t.error,r=t.payload;if(n)return u.default.error("Failed to update user trait",r),(0,c.fireErrorMessage)("Failed to update user trait",""),(0,a.default)({},e,{traitRequestCount:e.traitRequestCount-1});var o=r.result[0],i=e.userTraits.filter(function(e){return e.traitId!==r.traitId});return i.push(o),(0,a.default)({},e,{userTraits:i,traitRequestCount:e.traitRequestCount-1})}function g(e,t){var n=t.error,r=t.payload;if(n)return u.default.error("Failed to delete user trait",r),(0,c.fireErrorMessage)("Failed to delete user trait",""),(0,a.default)({},e,{traitRequestCount:e.traitRequestCount-1});var o=e.userTraits.filter(function(e){return e.traitId!==r.traitId});return(0,a.default)({},e,{userTraits:o,traitRequestCount:e.traitRequestCount-1})}function y(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{traitRequestCount:0,userTraits:[]},n=l.default.settings;return(0,s.handleActions)((e={},(0,o.default)(e,n.getAllUserTraits,f),(0,o.default)(e,n.modifyUserTraitInit,p),(0,o.default)(e,n.addUserTrait,h),(0,o.default)(e,n.deleteUserTrait,g),(0,o.default)(e,n.updateUserTrait,m),e),t)}t.default=y()},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=l(n(1)),o=l(n(7)),i=l(n(3));t.factory=function(){return r.default.resolve(d())};var a=l(n(0)),s=n(2),u=l(n(51));function l(e){return e&&e.__esModule?e:{default:e}}function c(e,t){var n=t.payload,r=n.data,o=r.res,a=r.error,s=n.lookerId,u=(0,i.default)({},e.dataSet);return u[s]={lookerData:o,error:a,msg:o.message},(0,i.default)({},e,{dataSet:u})}function d(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=u.default.looker;return(0,s.handleActions)((0,o.default)({},t.getLookerDone,c),a.default.defaults(e,{dataSet:{}}))}t.default=d()}])}); \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 5ec4c684..e27bd6bb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1198,7 +1198,7 @@ "Base64": "~0.1.3", "json-fallback": "0.0.1", "jsonp": "~0.0.4", - "qs": "qs@git+https://github.com/jfromaniello/node-querystring.git#5d96513991635e3e22d7aa54a8584d6ce97cace8", + "qs": "git+https://github.com/jfromaniello/node-querystring.git#fix_ie7_bug_with_arrays", "reqwest": "^1.1.4", "trim": "~0.0.1", "winchan": "^0.1.1", @@ -1207,7 +1207,7 @@ "dependencies": { "qs": { "version": "git+https://github.com/jfromaniello/node-querystring.git#5d96513991635e3e22d7aa54a8584d6ce97cace8", - "from": "qs@git+https://github.com/jfromaniello/node-querystring.git#5d96513991635e3e22d7aa54a8584d6ce97cace8" + "from": "git+https://github.com/jfromaniello/node-querystring.git#fix_ie7_bug_with_arrays" } } }, @@ -3358,6 +3358,16 @@ } } }, + "bourbon": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/bourbon/-/bourbon-4.3.4.tgz", + "integrity": "sha1-TaOAAp6SwMj5dkx3lFGhNLEefMM=" + }, + "bourbon-neat": { + "version": "1.7.2", + "resolved": "https://registry.npmjs.org/bourbon-neat/-/bourbon-neat-1.7.2.tgz", + "integrity": "sha1-oiixJ0R53iR20yszFTEHylBTzz0=" + }, "brace-expansion": { "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", @@ -4197,9 +4207,9 @@ } }, "config": { - "version": "1.31.0", - "resolved": "https://registry.npmjs.org/config/-/config-1.31.0.tgz", - "integrity": "sha512-Ep/l9Rd1J9IPueztJfpbOqVzuKHQh4ZODMNt9xqTYdBBNRXbV4oTu34kCkkfdRVcDq0ohtpaeXGgb+c0LQxFRA==", + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/config/-/config-3.2.2.tgz", + "integrity": "sha512-rOsfIOAcG82AWouK4/vBS/OKz3UPl2T/kP0irExmXJJOoWg2CmdfPLdx56bCoMUMFNh+7soQkQWCUC8DyemiwQ==", "requires": { "json5": "^1.0.1" } @@ -10405,6 +10415,14 @@ "resolved": "https://registry.npmjs.org/nocache/-/nocache-2.0.0.tgz", "integrity": "sha1-ICtIAhoMTL3i34DeFaF0Q8i0OYA=" }, + "node-bourbon": { + "version": "4.2.8", + "resolved": "https://registry.npmjs.org/node-bourbon/-/node-bourbon-4.2.8.tgz", + "integrity": "sha1-5ETx8JQ0q3ZQ6jGMKOLhA9P5Qs0=", + "requires": { + "bourbon": "^4.2.6" + } + }, "node-fetch": { "version": "1.7.3", "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-1.7.3.tgz", @@ -17470,10 +17488,7 @@ "appirio-styles": { "version": "0.0.30", "resolved": "https://registry.npmjs.org/appirio-styles/-/appirio-styles-0.0.30.tgz", - "integrity": "sha1-VZx5umDjDW/2Ib2r+RvUeRTTzGE=", - "requires": { - "node-neat": "~1.7.1-beta1" - } + "integrity": "sha1-VZx5umDjDW/2Ib2r+RvUeRTTzGE=" }, "appirio-tech-api-schemas": { "version": "5.0.70", @@ -17746,6 +17761,7 @@ "react-textarea-autosize": "^5.2.1", "react-transition-group": "^2.2.1", "redux-thunk": "^2.1.0", + "tc-ui": "git+https://github.com/appirio-tech/tc-ui.git#feature/connectv2", "uncontrollable": "^4.0.1" }, "dependencies": { @@ -17837,7 +17853,7 @@ }, "tc-ui": { "version": "git+https://github.com/appirio-tech/tc-ui.git#e577a0e704136f1e9ecce92ce4c0626aab932691", - "from": "git+https://github.com/appirio-tech/tc-ui.git#e577a0e704136f1e9ecce92ce4c0626aab932691", + "from": "git+https://github.com/appirio-tech/tc-ui.git#feature/connectv2", "requires": { "classnames": "^2.2.3", "lodash": "^4.0.0", @@ -17853,6 +17869,15 @@ "redux": "^3.3.1" }, "dependencies": { + "node-neat": { + "version": "1.7.2", + "resolved": "https://registry.npmjs.org/node-neat/-/node-neat-1.7.2.tgz", + "integrity": "sha1-OEcpELgV4mG4sbmbpRmZRGWhXCE=", + "requires": { + "bourbon-neat": "1.7.2", + "node-bourbon": "^4.2.3" + } + }, "react": { "version": "0.14.9", "resolved": "https://registry.npmjs.org/react/-/react-0.14.9.tgz", @@ -19095,16 +19120,6 @@ "hoek": "2.x.x" } }, - "bourbon": { - "version": "4.3.4", - "resolved": "https://registry.npmjs.org/bourbon/-/bourbon-4.3.4.tgz", - "integrity": "sha1-TaOAAp6SwMj5dkx3lFGhNLEefMM=" - }, - "bourbon-neat": { - "version": "1.7.2", - "resolved": "https://registry.npmjs.org/bourbon-neat/-/bourbon-neat-1.7.2.tgz", - "integrity": "sha1-oiixJ0R53iR20yszFTEHylBTzz0=" - }, "bowser": { "version": "1.9.4", "resolved": "https://registry.npmjs.org/bowser/-/bowser-1.9.4.tgz", @@ -21059,22 +21074,26 @@ "dependencies": { "abbrev": { "version": "1.1.1", - "bundled": true, + "resolved": false, + "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==", "optional": true }, "ansi-regex": { "version": "2.1.1", - "bundled": true, + "resolved": false, + "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", "optional": true }, "aproba": { "version": "1.2.0", - "bundled": true, + "resolved": false, + "integrity": "sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw==", "optional": true }, "are-we-there-yet": { "version": "1.1.5", - "bundled": true, + "resolved": false, + "integrity": "sha512-5hYdAkZlcG8tOLujVDTgCT+uPX0VnpAH28gWsLfzpXYm7wP6mp5Q/gYyR7YQ0cKVJcXJnl3j2kpBan13PtQf6w==", "optional": true, "requires": { "delegates": "^1.0.0", @@ -21083,12 +21102,14 @@ }, "balanced-match": { "version": "1.0.0", - "bundled": true, + "resolved": false, + "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", "optional": true }, "brace-expansion": { "version": "1.1.11", - "bundled": true, + "resolved": false, + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", "optional": true, "requires": { "balanced-match": "^1.0.0", @@ -21097,32 +21118,38 @@ }, "chownr": { "version": "1.1.1", - "bundled": true, + "resolved": false, + "integrity": "sha512-j38EvO5+LHX84jlo6h4UzmOwi0UgW61WRyPtJz4qaadK5eY3BTS5TY/S1Stc3Uk2lIM6TPevAlULiEJwie860g==", "optional": true }, "code-point-at": { "version": "1.1.0", - "bundled": true, + "resolved": false, + "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=", "optional": true }, "concat-map": { "version": "0.0.1", - "bundled": true, + "resolved": false, + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", "optional": true }, "console-control-strings": { "version": "1.1.0", - "bundled": true, + "resolved": false, + "integrity": "sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4=", "optional": true }, "core-util-is": { "version": "1.0.2", - "bundled": true, + "resolved": false, + "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", "optional": true }, "debug": { "version": "4.1.1", - "bundled": true, + "resolved": false, + "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", "optional": true, "requires": { "ms": "^2.1.1" @@ -21130,22 +21157,26 @@ }, "deep-extend": { "version": "0.6.0", - "bundled": true, + "resolved": false, + "integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==", "optional": true }, "delegates": { "version": "1.0.0", - "bundled": true, + "resolved": false, + "integrity": "sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o=", "optional": true }, "detect-libc": { "version": "1.0.3", - "bundled": true, + "resolved": false, + "integrity": "sha1-+hN8S9aY7fVc1c0CrFWfkaTEups=", "optional": true }, "fs-minipass": { "version": "1.2.5", - "bundled": true, + "resolved": false, + "integrity": "sha512-JhBl0skXjUPCFH7x6x61gQxrKyXsxB5gcgePLZCwfyCGGsTISMoIeObbrvVeP6Xmyaudw4TT43qV2Gz+iyd2oQ==", "optional": true, "requires": { "minipass": "^2.2.1" @@ -21153,12 +21184,14 @@ }, "fs.realpath": { "version": "1.0.0", - "bundled": true, + "resolved": false, + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", "optional": true }, "gauge": { "version": "2.7.4", - "bundled": true, + "resolved": false, + "integrity": "sha1-LANAXHU4w51+s3sxcCLjJfsBi/c=", "optional": true, "requires": { "aproba": "^1.0.3", @@ -21173,7 +21206,8 @@ }, "glob": { "version": "7.1.3", - "bundled": true, + "resolved": false, + "integrity": "sha512-vcfuiIxogLV4DlGBHIUOwI0IbrJ8HWPc4MU7HzviGeNho/UJDfi6B5p3sHeWIQ0KGIU0Jpxi5ZHxemQfLkkAwQ==", "optional": true, "requires": { "fs.realpath": "^1.0.0", @@ -21186,12 +21220,14 @@ }, "has-unicode": { "version": "2.0.1", - "bundled": true, + "resolved": false, + "integrity": "sha1-4Ob+aijPUROIVeCG0Wkedx3iqLk=", "optional": true }, "iconv-lite": { "version": "0.4.24", - "bundled": true, + "resolved": false, + "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", "optional": true, "requires": { "safer-buffer": ">= 2.1.2 < 3" @@ -21199,7 +21235,8 @@ }, "ignore-walk": { "version": "3.0.1", - "bundled": true, + "resolved": false, + "integrity": "sha512-DTVlMx3IYPe0/JJcYP7Gxg7ttZZu3IInhuEhbchuqneY9wWe5Ojy2mXLBaQFUQmo0AW2r3qG7m1mg86js+gnlQ==", "optional": true, "requires": { "minimatch": "^3.0.4" @@ -21207,7 +21244,8 @@ }, "inflight": { "version": "1.0.6", - "bundled": true, + "resolved": false, + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", "optional": true, "requires": { "once": "^1.3.0", @@ -21216,17 +21254,20 @@ }, "inherits": { "version": "2.0.3", - "bundled": true, + "resolved": false, + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", "optional": true }, "ini": { "version": "1.3.5", - "bundled": true, + "resolved": false, + "integrity": "sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw==", "optional": true }, "is-fullwidth-code-point": { "version": "1.0.0", - "bundled": true, + "resolved": false, + "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", "optional": true, "requires": { "number-is-nan": "^1.0.0" @@ -21234,12 +21275,14 @@ }, "isarray": { "version": "1.0.0", - "bundled": true, + "resolved": false, + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", "optional": true }, "minimatch": { "version": "3.0.4", - "bundled": true, + "resolved": false, + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", "optional": true, "requires": { "brace-expansion": "^1.1.7" @@ -21247,12 +21290,14 @@ }, "minimist": { "version": "0.0.8", - "bundled": true, + "resolved": false, + "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", "optional": true }, "minipass": { "version": "2.3.5", - "bundled": true, + "resolved": false, + "integrity": "sha512-Gi1W4k059gyRbyVUZQ4mEqLm0YIUiGYfvxhF6SIlk3ui1WVxMTGfGdQ2SInh3PDrRTVvPKgULkpJtT4RH10+VA==", "optional": true, "requires": { "safe-buffer": "^5.1.2", @@ -21261,7 +21306,8 @@ }, "minizlib": { "version": "1.2.1", - "bundled": true, + "resolved": false, + "integrity": "sha512-7+4oTUOWKg7AuL3vloEWekXY2/D20cevzsrNT2kGWm+39J9hGTCBv8VI5Pm5lXZ/o3/mdR4f8rflAPhnQb8mPA==", "optional": true, "requires": { "minipass": "^2.2.1" @@ -21269,7 +21315,8 @@ }, "mkdirp": { "version": "0.5.1", - "bundled": true, + "resolved": false, + "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", "optional": true, "requires": { "minimist": "0.0.8" @@ -21277,7 +21324,8 @@ }, "ms": { "version": "2.1.1", - "bundled": true, + "resolved": false, + "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==", "optional": true }, "nan": { @@ -21288,7 +21336,8 @@ }, "needle": { "version": "2.3.0", - "bundled": true, + "resolved": false, + "integrity": "sha512-QBZu7aAFR0522EyaXZM0FZ9GLpq6lvQ3uq8gteiDUp7wKdy0lSd2hPlgFwVuW1CBkfEs9PfDQsQzZghLs/psdg==", "optional": true, "requires": { "debug": "^4.1.0", @@ -21298,7 +21347,8 @@ }, "node-pre-gyp": { "version": "0.12.0", - "bundled": true, + "resolved": false, + "integrity": "sha512-4KghwV8vH5k+g2ylT+sLTjy5wmUOb9vPhnM8NHvRf9dHmnW/CndrFXy2aRPaPST6dugXSdHXfeaHQm77PIz/1A==", "optional": true, "requires": { "detect-libc": "^1.0.2", @@ -21315,7 +21365,8 @@ }, "nopt": { "version": "4.0.1", - "bundled": true, + "resolved": false, + "integrity": "sha1-0NRoWv1UFRk8jHUFYC0NF81kR00=", "optional": true, "requires": { "abbrev": "1", @@ -21324,12 +21375,14 @@ }, "npm-bundled": { "version": "1.0.6", - "bundled": true, + "resolved": false, + "integrity": "sha512-8/JCaftHwbd//k6y2rEWp6k1wxVfpFzB6t1p825+cUb7Ym2XQfhwIC5KwhrvzZRJu+LtDE585zVaS32+CGtf0g==", "optional": true }, "npm-packlist": { "version": "1.4.1", - "bundled": true, + "resolved": false, + "integrity": "sha512-+TcdO7HJJ8peiiYhvPxsEDhF3PJFGUGRcFsGve3vxvxdcpO2Z4Z7rkosRM0kWj6LfbK/P0gu3dzk5RU1ffvFcw==", "optional": true, "requires": { "ignore-walk": "^3.0.1", @@ -21338,7 +21391,8 @@ }, "npmlog": { "version": "4.1.2", - "bundled": true, + "resolved": false, + "integrity": "sha512-2uUqazuKlTaSI/dC8AzicUck7+IrEaOnN/e0jd3Xtt1KcGpwx30v50mL7oPyr/h9bL3E4aZccVwpwP+5W9Vjkg==", "optional": true, "requires": { "are-we-there-yet": "~1.1.2", @@ -21349,17 +21403,20 @@ }, "number-is-nan": { "version": "1.0.1", - "bundled": true, + "resolved": false, + "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=", "optional": true }, "object-assign": { "version": "4.1.1", - "bundled": true, + "resolved": false, + "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=", "optional": true }, "once": { "version": "1.4.0", - "bundled": true, + "resolved": false, + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", "optional": true, "requires": { "wrappy": "1" @@ -21367,17 +21424,20 @@ }, "os-homedir": { "version": "1.0.2", - "bundled": true, + "resolved": false, + "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=", "optional": true }, "os-tmpdir": { "version": "1.0.2", - "bundled": true, + "resolved": false, + "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=", "optional": true }, "osenv": { "version": "0.1.5", - "bundled": true, + "resolved": false, + "integrity": "sha512-0CWcCECdMVc2Rw3U5w9ZjqX6ga6ubk1xDVKxtBQPK7wis/0F2r9T6k4ydGYhecl7YUBxBVxhL5oisPsNxAPe2g==", "optional": true, "requires": { "os-homedir": "^1.0.0", @@ -21386,17 +21446,20 @@ }, "path-is-absolute": { "version": "1.0.1", - "bundled": true, + "resolved": false, + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", "optional": true }, "process-nextick-args": { "version": "2.0.0", - "bundled": true, + "resolved": false, + "integrity": "sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw==", "optional": true }, "rc": { "version": "1.2.8", - "bundled": true, + "resolved": false, + "integrity": "sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==", "optional": true, "requires": { "deep-extend": "^0.6.0", @@ -21407,14 +21470,16 @@ "dependencies": { "minimist": { "version": "1.2.0", - "bundled": true, + "resolved": false, + "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", "optional": true } } }, "readable-stream": { "version": "2.3.6", - "bundled": true, + "resolved": false, + "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", "optional": true, "requires": { "core-util-is": "~1.0.0", @@ -21428,7 +21493,8 @@ }, "rimraf": { "version": "2.6.3", - "bundled": true, + "resolved": false, + "integrity": "sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA==", "optional": true, "requires": { "glob": "^7.1.3" @@ -21436,37 +21502,44 @@ }, "safe-buffer": { "version": "5.1.2", - "bundled": true, + "resolved": false, + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", "optional": true }, "safer-buffer": { "version": "2.1.2", - "bundled": true, + "resolved": false, + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", "optional": true }, "sax": { "version": "1.2.4", - "bundled": true, + "resolved": false, + "integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==", "optional": true }, "semver": { "version": "5.7.0", - "bundled": true, + "resolved": false, + "integrity": "sha512-Ya52jSX2u7QKghxeoFGpLwCtGlt7j0oY9DYb5apt9nPlJ42ID+ulTXESnt/qAQcoSERyZ5sl3LDIOw0nAn/5DA==", "optional": true }, "set-blocking": { "version": "2.0.0", - "bundled": true, + "resolved": false, + "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=", "optional": true }, "signal-exit": { "version": "3.0.2", - "bundled": true, + "resolved": false, + "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=", "optional": true }, "string-width": { "version": "1.0.2", - "bundled": true, + "resolved": false, + "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", "optional": true, "requires": { "code-point-at": "^1.0.0", @@ -21476,7 +21549,8 @@ }, "string_decoder": { "version": "1.1.1", - "bundled": true, + "resolved": false, + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", "optional": true, "requires": { "safe-buffer": "~5.1.0" @@ -21484,7 +21558,8 @@ }, "strip-ansi": { "version": "3.0.1", - "bundled": true, + "resolved": false, + "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", "optional": true, "requires": { "ansi-regex": "^2.0.0" @@ -21492,12 +21567,14 @@ }, "strip-json-comments": { "version": "2.0.1", - "bundled": true, + "resolved": false, + "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=", "optional": true }, "tar": { "version": "4.4.8", - "bundled": true, + "resolved": false, + "integrity": "sha512-LzHF64s5chPQQS0IYBn9IN5h3i98c12bo4NCO7e0sGM2llXQ3p2FGC5sdENN4cTW48O915Sh+x+EXx7XW96xYQ==", "optional": true, "requires": { "chownr": "^1.1.1", @@ -21511,12 +21588,14 @@ }, "util-deprecate": { "version": "1.0.2", - "bundled": true, + "resolved": false, + "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", "optional": true }, "wide-align": { "version": "1.1.3", - "bundled": true, + "resolved": false, + "integrity": "sha512-QGkOQc8XL6Bt5PwnsExKBPuMKBxnGxWWW3fU55Xt4feHozMUhdUMaBCk290qpm/wG5u/RSKzwdAC4i51YigihA==", "optional": true, "requires": { "string-width": "^1.0.2 || 2" @@ -21524,12 +21603,14 @@ }, "wrappy": { "version": "1.0.2", - "bundled": true, + "resolved": false, + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", "optional": true }, "yallist": { "version": "3.0.3", - "bundled": true, + "resolved": false, + "integrity": "sha512-S+Zk8DEWE6oKpV+vI3qWkaK+jSbIK86pCwe2IF/xwIpQ8jEuxpw9NyaGjmp9+BoJv5FV2piqCDcoCtStppiq2A==", "optional": true } } @@ -23129,14 +23210,6 @@ "lower-case": "^1.1.1" } }, - "node-bourbon": { - "version": "4.2.8", - "resolved": "https://registry.npmjs.org/node-bourbon/-/node-bourbon-4.2.8.tgz", - "integrity": "sha1-5ETx8JQ0q3ZQ6jGMKOLhA9P5Qs0=", - "requires": { - "bourbon": "^4.2.6" - } - }, "node-fetch": { "version": "1.7.3", "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-1.7.3.tgz", @@ -23274,15 +23347,6 @@ } } }, - "node-neat": { - "version": "1.7.2", - "resolved": "https://registry.npmjs.org/node-neat/-/node-neat-1.7.2.tgz", - "integrity": "sha1-OEcpELgV4mG4sbmbpRmZRGWhXCE=", - "requires": { - "bourbon-neat": "1.7.2", - "node-bourbon": "^4.2.3" - } - }, "node-sass": { "version": "3.13.1", "resolved": "https://registry.npmjs.org/node-sass/-/node-sass-3.13.1.tgz", @@ -26215,7 +26279,6 @@ "classnames": "^2.2.3", "lodash": "^4.0.0", "moment": "^2.11.2", - "node-neat": "~1.7.1-beta1", "react": "^0.14.7", "react-datetime": "^2.0.2", "react-dom": "^0.14.7", @@ -27446,6 +27509,14 @@ "regenerator-runtime": "^0.11.0" } }, + "config": { + "version": "1.31.0", + "resolved": "https://registry.npmjs.org/config/-/config-1.31.0.tgz", + "integrity": "sha512-Ep/l9Rd1J9IPueztJfpbOqVzuKHQh4ZODMNt9xqTYdBBNRXbV4oTu34kCkkfdRVcDq0ohtpaeXGgb+c0LQxFRA==", + "requires": { + "json5": "^1.0.1" + } + }, "react-redux": { "version": "5.0.7", "resolved": "http://registry.npmjs.org/react-redux/-/react-redux-5.0.7.tgz", diff --git a/package.json b/package.json index b05527b7..0e285c9b 100644 --- a/package.json +++ b/package.json @@ -34,6 +34,7 @@ "version": "0.7.16-1", "dependencies": { "auth0-js": "^6.8.4", + "config": "^3.2.0", "isomorphic-fetch": "^2.2.1", "le_node": "^1.7.0", "lodash": "^4.17.10", diff --git a/src/actions/challenge.js b/src/actions/challenge.js index fb8fa2de..20f8e429 100644 --- a/src/actions/challenge.js +++ b/src/actions/challenge.js @@ -3,11 +3,48 @@ * @desc Actions related to Topcoder challenges APIs. */ +/* global CONFIG */ import _ from 'lodash'; import { config } from 'topcoder-react-utils'; import { createActions } from 'redux-actions'; import { getService as getChallengesService } from '../services/challenges'; +import { getService as getSubmissionService } from '../services/submissions'; +import { getService as getMemberService } from '../services/members'; import { getApi } from '../services/api'; +import * as submissionUtil from '../utils/submission'; + +const { PAGE_SIZE } = CONFIG; + +/** + * Private. Loads from the backend all data matching some conditions. + * @param {Function} getter Given params object of shape { limit, offset } + * loads from the backend at most "limit" data, skipping the first + * "offset" ones. Returns loaded data as an array. + * @param {Number} page Optional. Next page of data to load. + * @param {Number} perPage Optional. The size of the page content to load. + * @param {Array} prev Optional. data loaded so far. + */ +function getAll(getter, page = 1, perPage = PAGE_SIZE, prev) { + /* Amount of submissions to fetch in one API call. 50 is the current maximum + * amount of submissions the backend returns, event when the larger limit is + * explicitely required. */ + return getter({ + page, + perPage, + }).then((res) => { + if (res.length === 0) { + return prev || res; + } + // parse submissions + let current = []; + if (prev) { + current = prev.concat(res); + } else { + current = res; + } + return getAll(getter, 1 + page, perPage, current); + }); +} /** * @static @@ -83,6 +120,49 @@ function getSubmissionsDone(challengeId, tokenV2) { }); } +/** + * @static + * @desc Creates an action that signals beginning of Marathon Match submissions loading. + * @param {String} challengeId Challenge ID. + * @return {Action} + */ +function getMMSubmissionsInit(challengeId) { + /* As a safeguard, we enforce challengeId to be string (in case somebody + * passes in a number, by mistake). */ + return _.toString(challengeId); +} + + +/** + * @static + * @desc Creates an action that loads Marathon Match submissions to the specified + * challenge. + * @param {String} challengeId Challenge ID. + * @param {Array} submitterIds The array of submitter ids. + * @param {Array} registrants The array of register. + * @param {String} tokenV3 Topcoder auth token v3. + * @return {Action} + */ +function getMMSubmissionsDone(challengeId, submitterIds, registrants, tokenV3) { + const filter = { challengeId }; + const memberService = getMemberService(tokenV3); + const submissionsService = getSubmissionService(tokenV3); + const calls = [ + memberService.getMembersInformation(submitterIds), + // TODO: Move those numbers to configs + getAll(params => submissionsService.getSubmissions(filter, params), 1, 500), + ]; + return Promise.all(calls).then(([resources, submissions]) => { + const finalSubmissions = submissionUtil + .processMMSubmissions(submissions, resources, registrants); + return { + challengeId, + submissions: finalSubmissions, + tokenV3, + }; + }); +} + /** * @static * @desc Creates an action that signals beginning of registration for a @@ -306,5 +386,7 @@ export default createActions({ UPDATE_CHALLENGE_DONE: updateChallengeDone, GET_ACTIVE_CHALLENGES_COUNT_INIT: getActiveChallengesCountInit, GET_ACTIVE_CHALLENGES_COUNT_DONE: getActiveChallengesCountDone, + GET_MM_SUBMISSIONS_INIT: getMMSubmissionsInit, + GET_MM_SUBMISSIONS_DONE: getMMSubmissionsDone, }, }); diff --git a/src/index.js b/src/index.js index 15b0e7d7..6c18bec4 100644 --- a/src/index.js +++ b/src/index.js @@ -12,5 +12,5 @@ export { actions } from './actions'; export { services } from './services'; export { - challenge, logger, errors, tc, time, mock, url, + challenge, logger, errors, tc, time, mock, submission, url, } from './utils'; diff --git a/src/reducers/challenge.js b/src/reducers/challenge.js index 889623e1..2d5b47c9 100644 --- a/src/reducers/challenge.js +++ b/src/reducers/challenge.js @@ -113,6 +113,44 @@ function onGetSubmissionsDone(state, action) { }; } +/** + * Handles CHALLENGE/GET_MM_SUBMISSION_INIT action. + * @param {Object} state + * @param {Object} action + * @return {Object} New state. + */ +function onGetMMSubmissionsInit(state, action) { + return { + ...state, + loadingMMSubmissionsForChallengeId: action.payload, + mmSubmissions: [], + }; +} + +/** + * Handles CHALLENGE/GET_MM_SUBMISSION_DONE action. + * @param {Object} state Previous state. + * @param {Object} action Action. + */ +function onGetMMSubmissionsDone(state, action) { + if (action.error) { + logger.error('Failed to get Marathon Match submissions for the challenge', action.payload); + return { + ...state, + loadingMMSubmissionsForChallengeId: '', + mmSubmissions: [], + }; + } + + const { challengeId, submissions } = action.payload; + if (challengeId.toString() !== state.loadingMMSubmissionsForChallengeId) return state; + return { + ...state, + loadingMMSubmissionsForChallengeId: '', + mmSubmissions: submissions, + }; +} + /** * Handles challengeActions.fetchCheckpointsDone action. * @param {Object} state Previous state. @@ -294,6 +332,8 @@ function create(initialState) { [a.getDetailsDone]: onGetDetailsDone, [a.getSubmissionsInit]: onGetSubmissionsInit, [a.getSubmissionsDone]: onGetSubmissionsDone, + [a.getMmSubmissionsInit]: onGetMMSubmissionsInit, + [a.getMmSubmissionsDone]: onGetMMSubmissionsDone, [smpActions.smp.deleteSubmissionDone]: (state, { payload }) => ({ ...state, mySubmissions: { @@ -324,6 +364,7 @@ function create(initialState) { loadingCheckpoints: false, loadingDetailsForChallengeId: '', loadingResultsForChallengeId: '', + loadingMMSubmissionsForChallengeId: '', mySubmissions: {}, checkpoints: null, registering: false, @@ -331,6 +372,7 @@ function create(initialState) { resultsLoadedForChallengeId: '', unregistering: false, updatingChallengeUuid: '', + mmSubmissions: [], })); } diff --git a/src/services/api.js b/src/services/api.js index 7c1e3355..97a045a1 100644 --- a/src/services/api.js +++ b/src/services/api.js @@ -264,6 +264,7 @@ export function getApi(version, token) { export const getApiV2 = token => getApi('V2', token); export const getApiV3 = token => getApi('V3', token); export const getApiV4 = token => getApi('V4', token); +export const getApiV5 = token => getApi('V5', token); /** * Gets a valid TC M2M token, either requesting one from TC Auth0 API, or diff --git a/src/services/index.js b/src/services/index.js index b9707791..4d776832 100644 --- a/src/services/index.js +++ b/src/services/index.js @@ -14,6 +14,7 @@ import * as userSetting from './user-settings'; import * as user from './user'; import * as lookup from './lookup'; import * as userTraits from './user-traits'; +import * as submissions from './submissions'; export const services = { api, @@ -29,6 +30,7 @@ export const services = { reviewOpportunities, lookup, userTraits, + submissions, }; export default undefined; diff --git a/src/services/members.js b/src/services/members.js index 62afbf36..9afa0311 100644 --- a/src/services/members.js +++ b/src/services/members.js @@ -289,6 +289,18 @@ class MembersService { const res = await this.private.api.get(`/members/${handle}/verify?token=${emailVerifyToken}`); return getApiResponsePayload(res); } + + /** + * Get members information + * @param {Array} userIds the member ids + */ + async getMembersInformation(userIds) { + const query = `query=${encodeURI(_.map(userIds, id => `userId:${id}`).join(' OR '))}`; + const limit = `limit=${userIds.length}`; + const url = `/members/_search?fields=userId%2Chandle%2CphotoURL%2CfirstName%2ClastName&${query}&${limit}`; + const res = await this.private.api.get(url); + return getApiResponsePayload(res); + } } let lastInstance = null; diff --git a/src/services/submissions.js b/src/services/submissions.js new file mode 100644 index 00000000..6de0e6c2 --- /dev/null +++ b/src/services/submissions.js @@ -0,0 +1,57 @@ +/** + * @module "services.submission" + * @desc This module provides a service for convenient manipulation with + * Topcoder submissions via TC API. Currently only used for MM challenges + */ + +import qs from 'qs'; +import { getApi } from './api'; + +/** + * Submission service. + */ +class SubmissionsService { + /** + * Creates a new SubmissionService instance. + * @param {String} tokenV3 Optional. Auth token for Topcoder API v3. + */ + constructor(tokenV3) { + this.private = { + apiV5: getApi('V5', tokenV3), + tokenV3, + }; + } + + /** + * Get submissions of challenge + * @param {Object} filters + * @param {Object} params + * @return {Promise} Resolves to the api response. + */ + async getSubmissions(filters, params) { + const query = { + ...filters, + ...params, + }; + const url = `/submissions?${qs.stringify(query, { encode: false })}`; + return this.private.apiV5.get(url) + .then(res => (res.ok ? res.json() : new Error(res.statusText))) + .then(res => res); + } +} + +let lastInstance = null; +/** + * Returns a new or existing submissions service. + * @param {String} tokenV3 Optional. Auth token for Topcoder API v3. + * @return {SubmissionsService} Submissions service object + */ +export function getService(tokenV3) { + if (!lastInstance || lastInstance.private.tokenV3 !== tokenV3) { + lastInstance = new SubmissionsService(tokenV3); + } + return lastInstance; +} + +/* Using default export would be confusing in this case. */ +export default undefined; diff --git a/src/utils/index.js b/src/utils/index.js index e7e4ff52..fd0985eb 100644 --- a/src/utils/index.js +++ b/src/utils/index.js @@ -7,6 +7,7 @@ import * as time from './time'; import * as mock from './mock'; import * as errors from './errors'; import * as filter from './challenge/filter'; +import * as submission from './submission'; import * as buckets from './challenge/buckets'; import * as sort from './challenge/sort'; import * as url from './url'; @@ -24,5 +25,6 @@ export { time, mock, errors, + submission, url, }; diff --git a/src/utils/submission.js b/src/utils/submission.js new file mode 100644 index 00000000..27c6d8b2 --- /dev/null +++ b/src/utils/submission.js @@ -0,0 +1,175 @@ +/** + * Various submissions functions. + */ +/* global CONFIG */ +/* eslint-disable no-param-reassign */ +import _ from 'lodash'; + +const { AV_SCAN_SCORER_REVIEW_TYPE_ID } = CONFIG; + +function round(num, decimal) { + if (_.isNaN(num)) { + return 0; + } + const p1 = 10 ** (decimal + 1); + const p2 = 10 ** decimal; + return Math.round(num * p1 / 10) / p2; +} + +function removeDecimal(num, decimal) { + return ((num % decimal) + decimal) % decimal; +} + +function toFixed(num, decimal) { + const result = _.toFinite(round(num, decimal).toFixed(decimal)); + const integerResult = _.toFinite(removeDecimal(result, decimal)); + if (_.isInteger(integerResult)) { + return integerResult; + } + return result; +} + +function getMMChallengeHandleStyle(handle, registrants) { + const style = _.get(_.find(registrants, m => m.handle === handle), 'colorStyle', null); + if (style) return JSON.parse(style.replace(/(\w+):\s*([^;]*)/g, '{"$1": "$2"}')); + return {}; +} + +/** + * Process each submission rank of MM challenge + * @param submissions the array of submissions + */ +function processRanks(submissions) { + let maxFinalScore = 0; + submissions.sort((a, b) => { + let pA = _.get(a, 'submissions[0]', { provisionalScore: 0 }).provisionalScore; + let pB = _.get(b, 'submissions[0]', { provisionalScore: 0 }).provisionalScore; + if (pA === '-') pA = 0; + if (pB === '-') pB = 0; + if (pA === pB) { + const timeA = new Date(_.get(a, 'submissions[0].submissionTime')); + const timeB = new Date(_.get(b, 'submissions[0].submissionTime')); + return timeA - timeB; + } + return pB - pA; + }); + _.each(submissions, (submission, i) => { + submissions[i].provisionalRank = i + 1; + }); + + submissions.sort((a, b) => { + let pA = _.get(a, 'submissions[0]', { finalScore: 0 }).finalScore; + let pB = _.get(b, 'submissions[0]', { finalScore: 0 }).finalScore; + if (pA === '-') pA = 0; + if (pB === '-') pB = 0; + if (pA > 0) maxFinalScore = pA; + if (pB > 0) maxFinalScore = pB; + if (pA === pB) { + const timeA = new Date(_.get(a, 'submissions[0].submissionTime')); + const timeB = new Date(_.get(b, 'submissions[0].submissionTime')); + return timeA - timeB; + } + return pB - pA; + }); + if (maxFinalScore > 0) { + _.each(submissions, (submission, i) => { + submissions[i].finalRank = i + 1; + }); + } + return { submissions, maxFinalScore }; +} + +/** + * Get provisional score of submission + * @param submission + */ +export function getProvisionalScore(submission) { + const { submissions: subs } = submission; + if (!subs || subs.length === 0) { + return 0; + } + const { provisionalScore } = subs[0]; + if (!provisionalScore || provisionalScore < 0) { + return 0; + } + return provisionalScore; +} + +/** + * Get final score of submission + * @param submission + */ +export function getFinalScore(submission) { + const { submissions: subs } = submission; + if (!subs || subs.length === 0) { + return 0; + } + const { finalScore } = subs[0]; + if (!finalScore || finalScore < 0) { + return 0; + } + return finalScore; +} + +/** + * Process submissions of MM challenge + * @param submissions the array of submissions + * @param resources the challenge resources + * @param registrants the challenge registrants + */ +export function processMMSubmissions(submissions, resources, registrants) { + const data = {}; + const result = []; + + _.each(submissions, (submission) => { + const { memberId } = submission; + let memberHandle; + const resource = _.find(resources, r => _.get(r, 'userId').toString() === memberId.toString()); + if (_.isEmpty(resource)) { + memberHandle = memberId; + } else { + memberHandle = _.has(resource, 'handle') ? _.get(resource, 'handle') : memberId.toString(); + } + if (!data[memberHandle]) { + data[memberHandle] = []; + } + const validReviews = _.filter(submission.review, + r => !_.isEmpty(r) && (r.typeId !== AV_SCAN_SCORER_REVIEW_TYPE_ID)); + validReviews.sort((a, b) => { + const dateA = new Date(a.created); + const dateB = new Date(b.created); + return dateB - dateA; + }); + + const provisionalScore = toFixed(parseFloat(_.get(validReviews, '[0].score', '-')), 5); + const finalScore = toFixed(parseFloat(_.get(submission, 'reviewSummation[0].aggregateScore', '-')), 5); + + data[memberHandle].push({ + submissionId: submission.id, + submissionTime: submission.created, + provisionalScore, + finalScore, + }); + }); + + _.each(data, (value, key) => { + result.push({ + submissions: [...value.sort((a, b) => new Date(b.submissionTime) + .getTime() - new Date(a.submissionTime).getTime())], + member: key, + colorStyle: getMMChallengeHandleStyle(key, registrants), + }); + }); + + const { submissions: finalSubmissions, maxFinalScore } = processRanks(result); + finalSubmissions.sort((a, b) => { + if (maxFinalScore === 0) { + return a.provisionalRank - b.provisionalRank; + } + return a.finalRank - b.finalRank; + }); + + return finalSubmissions; +} + +export default undefined;