diff --git a/__tests__/__snapshots__/index.js.snap b/__tests__/__snapshots__/index.js.snap index 151af59b..7994385b 100644 --- a/__tests__/__snapshots__/index.js.snap +++ b/__tests__/__snapshots__/index.js.snap @@ -129,6 +129,8 @@ Object { "updateProfileInit": [Function], "uploadPhotoDone": [Function], "uploadPhotoInit": [Function], + "verifyMemberNewEmailDone": [Function], + "verifyMemberNewEmailInit": [Function], }, "reviewOpportunity": Object { "cancelApplicationsDone": [Function], diff --git a/__tests__/actions/__snapshots__/profile.js.snap b/__tests__/actions/__snapshots__/profile.js.snap index 47b779ea..6a439578 100644 --- a/__tests__/actions/__snapshots__/profile.js.snap +++ b/__tests__/actions/__snapshots__/profile.js.snap @@ -45,6 +45,8 @@ Object { "updateProfileInit": [Function], "uploadPhotoDone": [Function], "uploadPhotoInit": [Function], + "verifyMemberNewEmailDone": [Function], + "verifyMemberNewEmailInit": [Function], }, } `; diff --git a/__tests__/reducers/__snapshots__/profile.js.snap b/__tests__/reducers/__snapshots__/profile.js.snap index fcd97829..a76358ad 100644 --- a/__tests__/reducers/__snapshots__/profile.js.snap +++ b/__tests__/reducers/__snapshots__/profile.js.snap @@ -41,8 +41,10 @@ Object { }, ], "stats": null, + "updateProfileSuccess": true, "updatingProfile": false, "uploadingPhoto": false, + "verifyError": null, } `; @@ -82,8 +84,10 @@ Object { "profileForHandle": "tcscoder", "skills": null, "stats": null, + "updateProfileSuccess": true, "updatingProfile": false, "uploadingPhoto": false, + "verifyError": null, } `; @@ -130,8 +134,10 @@ Object { "profileForHandle": "tcscoder", "skills": Array [], "stats": null, + "updateProfileSuccess": true, "updatingProfile": false, "uploadingPhoto": false, + "verifyError": null, } `; @@ -173,8 +179,10 @@ Object { "profileForHandle": "tcscoder", "skills": Array [], "stats": null, + "updateProfileSuccess": true, "updatingProfile": false, "uploadingPhoto": false, + "verifyError": null, } `; @@ -212,7 +220,9 @@ Object { "profileForHandle": "tcscoder", "skills": null, "stats": null, + "updateProfileSuccess": null, "uploadingPhoto": false, + "verifyError": null, } `; @@ -250,7 +260,9 @@ Object { "profileForHandle": "tcscoder", "skills": null, "stats": null, + "updateProfileSuccess": null, "uploadingPhoto": false, + "verifyError": null, } `; @@ -293,8 +305,10 @@ Object { "profileForHandle": "tcscoder", "skills": Array [], "stats": null, + "updateProfileSuccess": true, "updatingProfile": false, "uploadingPhoto": false, + "verifyError": null, } `; @@ -342,8 +356,10 @@ Object { "profileForHandle": "tcscoder", "skills": Array [], "stats": null, + "updateProfileSuccess": true, "updatingProfile": false, "uploadingPhoto": false, + "verifyError": null, } `; @@ -376,6 +392,8 @@ Object { "profileForHandle": "tcscoder", "skills": null, "stats": null, + "updateProfileSuccess": null, + "verifyError": null, } `; @@ -411,6 +429,8 @@ Object { "profileForHandle": "tcscoder", "skills": null, "stats": null, + "updateProfileSuccess": null, + "verifyError": null, } `; @@ -433,6 +453,8 @@ Object { "profileForHandle": "tcscoder", "skills": null, "stats": null, + "updateProfileSuccess": null, + "verifyError": null, } `; @@ -462,6 +484,8 @@ Object { "profileForHandle": "tcscoder", "skills": null, "stats": null, + "updateProfileSuccess": null, + "verifyError": null, } `; @@ -477,6 +501,8 @@ Object { "profileForHandle": "tcscoder", "skills": null, "stats": null, + "updateProfileSuccess": null, + "verifyError": null, } `; @@ -517,8 +543,10 @@ Object { "profileForHandle": "tcscoder", "skills": Array [], "stats": null, + "updateProfileSuccess": true, "updatingProfile": false, "uploadingPhoto": false, + "verifyError": null, } `; @@ -564,8 +592,10 @@ Object { }, ], "stats": null, + "updateProfileSuccess": true, "updatingProfile": false, "uploadingPhoto": false, + "verifyError": null, } `; @@ -578,6 +608,8 @@ Object { "loadingError": false, "skills": null, "stats": null, + "updateProfileSuccess": null, + "verifyError": null, } `; @@ -626,8 +658,10 @@ Object { "profileForHandle": "tcscoder", "skills": Array [], "stats": null, + "updateProfileSuccess": true, "updatingProfile": false, "uploadingPhoto": false, + "verifyError": null, } `; @@ -671,8 +705,10 @@ Object { "profileForHandle": "tcscoder", "skills": Array [], "stats": null, + "updateProfileSuccess": true, "updatingProfile": false, "uploadingPhoto": false, + "verifyError": null, } `; @@ -686,6 +722,8 @@ Object { "profileForHandle": "tcscoder", "skills": null, "stats": null, + "updateProfileSuccess": null, + "verifyError": null, } `; @@ -731,8 +769,10 @@ Object { "skills": Array [], "stats": null, "unlinkingExternalAccount": false, + "updateProfileSuccess": true, "updatingProfile": false, "uploadingPhoto": false, + "verifyError": null, } `; @@ -778,8 +818,10 @@ Object { "skills": Array [], "stats": null, "unlinkingExternalAccount": false, + "updateProfileSuccess": true, "updatingProfile": false, "uploadingPhoto": false, + "verifyError": null, } `; @@ -824,8 +866,10 @@ Object { "skills": Array [], "stats": null, "unlinkingExternalAccount": false, + "updateProfileSuccess": true, "updatingProfile": false, "uploadingPhoto": false, + "verifyError": null, } `; @@ -875,8 +919,10 @@ Object { "skills": Array [], "stats": null, "unlinkingExternalAccount": true, + "updateProfileSuccess": true, "updatingProfile": false, "uploadingPhoto": false, + "verifyError": null, } `; @@ -922,9 +968,11 @@ Object { "skills": Array [], "stats": null, "unlinkingExternalAccount": false, + "updateProfileSuccess": true, "updatingPassword": false, "updatingProfile": false, "uploadingPhoto": false, + "verifyError": null, } `; @@ -970,9 +1018,11 @@ Object { "skills": Array [], "stats": null, "unlinkingExternalAccount": false, + "updateProfileSuccess": true, "updatingPassword": true, "updatingProfile": false, "uploadingPhoto": false, + "verifyError": null, } `; @@ -1011,8 +1061,10 @@ Object { "profileForHandle": "tcscoder", "skills": null, "stats": null, + "updateProfileSuccess": true, "updatingProfile": false, "uploadingPhoto": false, + "verifyError": null, } `; @@ -1050,8 +1102,10 @@ Object { "profileForHandle": "tcscoder", "skills": null, "stats": null, + "updateProfileSuccess": null, "updatingProfile": true, "uploadingPhoto": false, + "verifyError": null, } `; @@ -1088,7 +1142,9 @@ Object { "profileForHandle": "tcscoder", "skills": null, "stats": null, + "updateProfileSuccess": null, "uploadingPhoto": false, + "verifyError": null, } `; @@ -1124,7 +1180,9 @@ Object { "profileForHandle": "tcscoder", "skills": null, "stats": null, + "updateProfileSuccess": null, "uploadingPhoto": true, + "verifyError": null, } `; @@ -1169,8 +1227,10 @@ Object { }, ], "stats": null, + "updateProfileSuccess": true, "updatingProfile": false, "uploadingPhoto": false, + "verifyError": null, } `; @@ -1210,8 +1270,10 @@ Object { "profileForHandle": "tcscoder", "skills": null, "stats": null, + "updateProfileSuccess": true, "updatingProfile": false, "uploadingPhoto": false, + "verifyError": null, } `; @@ -1258,8 +1320,10 @@ Object { "profileForHandle": "tcscoder", "skills": Array [], "stats": null, + "updateProfileSuccess": true, "updatingProfile": false, "uploadingPhoto": false, + "verifyError": null, } `; @@ -1301,8 +1365,10 @@ Object { "profileForHandle": "tcscoder", "skills": Array [], "stats": null, + "updateProfileSuccess": true, "updatingProfile": false, "uploadingPhoto": false, + "verifyError": null, } `; @@ -1340,7 +1406,9 @@ Object { "profileForHandle": "tcscoder", "skills": null, "stats": null, + "updateProfileSuccess": null, "uploadingPhoto": false, + "verifyError": null, } `; @@ -1378,7 +1446,9 @@ Object { "profileForHandle": "tcscoder", "skills": null, "stats": null, + "updateProfileSuccess": null, "uploadingPhoto": false, + "verifyError": null, } `; @@ -1421,8 +1491,10 @@ Object { "profileForHandle": "tcscoder", "skills": Array [], "stats": null, + "updateProfileSuccess": true, "updatingProfile": false, "uploadingPhoto": false, + "verifyError": null, } `; @@ -1470,8 +1542,10 @@ Object { "profileForHandle": "tcscoder", "skills": Array [], "stats": null, + "updateProfileSuccess": true, "updatingProfile": false, "uploadingPhoto": false, + "verifyError": null, } `; @@ -1504,6 +1578,8 @@ Object { "profileForHandle": "tcscoder", "skills": null, "stats": null, + "updateProfileSuccess": null, + "verifyError": null, } `; @@ -1539,6 +1615,8 @@ Object { "profileForHandle": "tcscoder", "skills": null, "stats": null, + "updateProfileSuccess": null, + "verifyError": null, } `; @@ -1561,6 +1639,8 @@ Object { "profileForHandle": "tcscoder", "skills": null, "stats": null, + "updateProfileSuccess": null, + "verifyError": null, } `; @@ -1590,6 +1670,8 @@ Object { "profileForHandle": "tcscoder", "skills": null, "stats": null, + "updateProfileSuccess": null, + "verifyError": null, } `; @@ -1605,6 +1687,8 @@ Object { "profileForHandle": "tcscoder", "skills": null, "stats": null, + "updateProfileSuccess": null, + "verifyError": null, } `; @@ -1645,8 +1729,10 @@ Object { "profileForHandle": "tcscoder", "skills": Array [], "stats": null, + "updateProfileSuccess": true, "updatingProfile": false, "uploadingPhoto": false, + "verifyError": null, } `; @@ -1692,8 +1778,10 @@ Object { }, ], "stats": null, + "updateProfileSuccess": true, "updatingProfile": false, "uploadingPhoto": false, + "verifyError": null, } `; @@ -1706,6 +1794,8 @@ Object { "loadingError": false, "skills": null, "stats": null, + "updateProfileSuccess": null, + "verifyError": null, } `; @@ -1754,8 +1844,10 @@ Object { "profileForHandle": "tcscoder", "skills": Array [], "stats": null, + "updateProfileSuccess": true, "updatingProfile": false, "uploadingPhoto": false, + "verifyError": null, } `; @@ -1799,8 +1891,10 @@ Object { "profileForHandle": "tcscoder", "skills": Array [], "stats": null, + "updateProfileSuccess": true, "updatingProfile": false, "uploadingPhoto": false, + "verifyError": null, } `; @@ -1814,6 +1908,8 @@ Object { "profileForHandle": "tcscoder", "skills": null, "stats": null, + "updateProfileSuccess": null, + "verifyError": null, } `; @@ -1859,8 +1955,10 @@ Object { "skills": Array [], "stats": null, "unlinkingExternalAccount": false, + "updateProfileSuccess": true, "updatingProfile": false, "uploadingPhoto": false, + "verifyError": null, } `; @@ -1906,8 +2004,10 @@ Object { "skills": Array [], "stats": null, "unlinkingExternalAccount": false, + "updateProfileSuccess": true, "updatingProfile": false, "uploadingPhoto": false, + "verifyError": null, } `; @@ -1952,8 +2052,10 @@ Object { "skills": Array [], "stats": null, "unlinkingExternalAccount": false, + "updateProfileSuccess": true, "updatingProfile": false, "uploadingPhoto": false, + "verifyError": null, } `; @@ -2003,8 +2105,10 @@ Object { "skills": Array [], "stats": null, "unlinkingExternalAccount": true, + "updateProfileSuccess": true, "updatingProfile": false, "uploadingPhoto": false, + "verifyError": null, } `; @@ -2050,9 +2154,11 @@ Object { "skills": Array [], "stats": null, "unlinkingExternalAccount": false, + "updateProfileSuccess": true, "updatingPassword": false, "updatingProfile": false, "uploadingPhoto": false, + "verifyError": null, } `; @@ -2098,9 +2204,11 @@ Object { "skills": Array [], "stats": null, "unlinkingExternalAccount": false, + "updateProfileSuccess": true, "updatingPassword": true, "updatingProfile": false, "uploadingPhoto": false, + "verifyError": null, } `; @@ -2139,8 +2247,10 @@ Object { "profileForHandle": "tcscoder", "skills": null, "stats": null, + "updateProfileSuccess": true, "updatingProfile": false, "uploadingPhoto": false, + "verifyError": null, } `; @@ -2178,8 +2288,10 @@ Object { "profileForHandle": "tcscoder", "skills": null, "stats": null, + "updateProfileSuccess": null, "updatingProfile": true, "uploadingPhoto": false, + "verifyError": null, } `; @@ -2216,7 +2328,9 @@ Object { "profileForHandle": "tcscoder", "skills": null, "stats": null, + "updateProfileSuccess": null, "uploadingPhoto": false, + "verifyError": null, } `; @@ -2252,6 +2366,8 @@ Object { "profileForHandle": "tcscoder", "skills": null, "stats": null, + "updateProfileSuccess": null, "uploadingPhoto": true, + "verifyError": null, } `; diff --git a/docs/actions.profile.md b/docs/actions.profile.md index 3b2bb991..528d0612 100644 --- a/docs/actions.profile.md +++ b/docs/actions.profile.md @@ -51,13 +51,15 @@ Actions for interactions with profile details API. * [.saveEmailPreferencesDone(profile, tokenV3, preferences)](#module_actions.profile.saveEmailPreferencesDone) ⇒ <code>Action</code> * [.updatePasswordInit()](#module_actions.profile.updatePasswordInit) ⇒ <code>Action</code> * [.updatePasswordDone(profile, tokenV3, newPassword, oldPassword)](#module_actions.profile.updatePasswordDone) ⇒ <code>Action</code> + * [.verifyMemberNewEmailInit()](#module_actions.profile.verifyMemberNewEmailInit) ⇒ <code>Action</code> + * [.verifyMemberNewEmailDone(handle, tokenV3, emailVerifyToken)](#module_actions.profile.verifyMemberNewEmailDone) ⇒ <code>Action</code> <a name="module_actions.profile.loadProfile"></a> ### actions.profile.loadProfile(handle) ⇒ <code>Action</code> Creates and action that loads user profile. -**Kind**: static method of [<code>actions.profile</code>](#module_actions.profile) +**Kind**: static method of [<code>actions.profile</code>](#module_actions.profile) **Todo** - [ ] This action does not follow the pattern with init/done pairs of @@ -73,7 +75,7 @@ Creates and action that loads user profile. ### actions.profile.clearProfile() ⇒ <code>Action</code> Creates and action that clear user profile. -**Kind**: static method of [<code>actions.profile</code>](#module_actions.profile) +**Kind**: static method of [<code>actions.profile</code>](#module_actions.profile) **Todo** - [ ] This action does not follow the pattern with init/done pairs of @@ -84,7 +86,7 @@ Creates and action that clear user profile. ### actions.profile.getAchievementsInit() ⇒ <code>Action</code> Creates an action that signals beginning of user achievements loading. -**Kind**: static method of [<code>actions.profile</code>](#module_actions.profile) +**Kind**: static method of [<code>actions.profile</code>](#module_actions.profile) **Todo** - [ ] This duplicates similar action in [actions.members.md](actions.members.md)! @@ -94,7 +96,7 @@ Creates an action that signals beginning of user achievements loading. ### actions.profile.getAchievementsDone(handle) ⇒ <code>Action</code> Creates an action that loads user achievements. -**Kind**: static method of [<code>actions.profile</code>](#module_actions.profile) +**Kind**: static method of [<code>actions.profile</code>](#module_actions.profile) **Todo** - [ ] This duplicates similar action in [actions.members.md](actions.members.md)! @@ -107,7 +109,7 @@ Creates an action that loads user achievements. <a name="module_actions.profile.getExternalAccountsInit"></a> ### actions.profile.getExternalAccountsInit() ⇒ <code>Action</code> -**Kind**: static method of [<code>actions.profile</code>](#module_actions.profile) +**Kind**: static method of [<code>actions.profile</code>](#module_actions.profile) **Todo** - [ ] To be documented. @@ -115,7 +117,7 @@ Creates an action that loads user achievements. <a name="module_actions.profile.getExternalAccountsDone"></a> ### actions.profile.getExternalAccountsDone(handle) ⇒ <code>Action</code> -**Kind**: static method of [<code>actions.profile</code>](#module_actions.profile) +**Kind**: static method of [<code>actions.profile</code>](#module_actions.profile) **Todo** - [ ] To be documented. @@ -128,7 +130,7 @@ Creates an action that loads user achievements. <a name="module_actions.profile.getExternalLinksInit"></a> ### actions.profile.getExternalLinksInit() ⇒ <code>Action</code> -**Kind**: static method of [<code>actions.profile</code>](#module_actions.profile) +**Kind**: static method of [<code>actions.profile</code>](#module_actions.profile) **Todo** - [ ] Figure out what does this action do. @@ -136,7 +138,7 @@ Creates an action that loads user achievements. <a name="module_actions.profile.getExternalLinksDone"></a> ### actions.profile.getExternalLinksDone(handle) ⇒ <code>Action</code> -**Kind**: static method of [<code>actions.profile</code>](#module_actions.profile) +**Kind**: static method of [<code>actions.profile</code>](#module_actions.profile) **Todo** - [ ] Figure out the purpose of this action @@ -149,7 +151,7 @@ Creates an action that loads user achievements. <a name="module_actions.profile.getInfoInit"></a> ### actions.profile.getInfoInit() ⇒ <code>Action</code> -**Kind**: static method of [<code>actions.profile</code>](#module_actions.profile) +**Kind**: static method of [<code>actions.profile</code>](#module_actions.profile) **Todo** - [ ] Figure out the purpose of this action. @@ -157,7 +159,7 @@ Creates an action that loads user achievements. <a name="module_actions.profile.getInfoDone"></a> ### actions.profile.getInfoDone(handle) ⇒ <code>Action</code> -**Kind**: static method of [<code>actions.profile</code>](#module_actions.profile) +**Kind**: static method of [<code>actions.profile</code>](#module_actions.profile) **Todo** - [ ] Figure out the purpose of this action. @@ -173,13 +175,13 @@ Creates an action that loads user achievements. Creates an action that signals beginning of loading the member's skills info. -**Kind**: static method of [<code>actions.profile</code>](#module_actions.profile) +**Kind**: static method of [<code>actions.profile</code>](#module_actions.profile) <a name="module_actions.profile.getSkillsDone"></a> ### actions.profile.getSkillsDone(handle) ⇒ <code>Action</code> Creates an action that loads member's skills info. -**Kind**: static method of [<code>actions.profile</code>](#module_actions.profile) +**Kind**: static method of [<code>actions.profile</code>](#module_actions.profile) | Param | Type | Description | | --- | --- | --- | @@ -190,7 +192,7 @@ Creates an action that loads member's skills info. ### actions.profile.getStatsInit() ⇒ <code>Action</code> Creates an action that signals beginning of loading member's stats. -**Kind**: static method of [<code>actions.profile</code>](#module_actions.profile) +**Kind**: static method of [<code>actions.profile</code>](#module_actions.profile) **Todo** - [ ] This is similar to [actions.members.md#module_actions.members.getStatsInit](actions.members.md#module_actions.members.getStatsInit)! @@ -200,7 +202,7 @@ Creates an action that signals beginning of loading member's stats. ### actions.profile.getStatsDone(handle) ⇒ <code>Action</code> Creates an action that loads member's stats. -**Kind**: static method of [<code>actions.profile</code>](#module_actions.profile) +**Kind**: static method of [<code>actions.profile</code>](#module_actions.profile) | Param | Type | Description | | --- | --- | --- | @@ -211,13 +213,13 @@ Creates an action that loads member's stats. ### actions.profile.getLinkedAccountsInit() ⇒ <code>Action</code> Creates an action that signals beginning of getting linked accounts. -**Kind**: static method of [<code>actions.profile</code>](#module_actions.profile) +**Kind**: static method of [<code>actions.profile</code>](#module_actions.profile) <a name="module_actions.profile.getLinkedAccountsDone"></a> ### actions.profile.getLinkedAccountsDone(profile, tokenV3) ⇒ <code>Action</code> Creates an action that gets linked accounts. -**Kind**: static method of [<code>actions.profile</code>](#module_actions.profile) +**Kind**: static method of [<code>actions.profile</code>](#module_actions.profile) | Param | Type | Description | | --- | --- | --- | @@ -229,13 +231,13 @@ Creates an action that gets linked accounts. ### actions.profile.getCredentialInit() ⇒ <code>Action</code> Creates an action that signals beginning of getting credential. -**Kind**: static method of [<code>actions.profile</code>](#module_actions.profile) +**Kind**: static method of [<code>actions.profile</code>](#module_actions.profile) <a name="module_actions.profile.getCredentialDone"></a> ### actions.profile.getCredentialDone(profile, tokenV3) ⇒ <code>Action</code> Creates an action that gets credential. -**Kind**: static method of [<code>actions.profile</code>](#module_actions.profile) +**Kind**: static method of [<code>actions.profile</code>](#module_actions.profile) | Param | Type | Description | | --- | --- | --- | @@ -247,13 +249,13 @@ Creates an action that gets credential. ### actions.profile.getEmailPreferencesInit() ⇒ <code>Action</code> Creates an action that signals beginning of getting email preferences. -**Kind**: static method of [<code>actions.profile</code>](#module_actions.profile) +**Kind**: static method of [<code>actions.profile</code>](#module_actions.profile) <a name="module_actions.profile.getEmailPreferencesDone"></a> ### actions.profile.getEmailPreferencesDone(profile, tokenV3) ⇒ <code>Action</code> Creates an action that gets email preferences. -**Kind**: static method of [<code>actions.profile</code>](#module_actions.profile) +**Kind**: static method of [<code>actions.profile</code>](#module_actions.profile) | Param | Type | Description | | --- | --- | --- | @@ -265,13 +267,13 @@ Creates an action that gets email preferences. ### actions.profile.uploadPhotoInit() ⇒ <code>Action</code> Creates an action that signals beginning of uploading user's photo. -**Kind**: static method of [<code>actions.profile</code>](#module_actions.profile) +**Kind**: static method of [<code>actions.profile</code>](#module_actions.profile) <a name="module_actions.profile.uploadPhotoDone"></a> ### actions.profile.uploadPhotoDone(handle, tokenV3, file) ⇒ <code>Action</code> Creates an action that uploads user's photo. -**Kind**: static method of [<code>actions.profile</code>](#module_actions.profile) +**Kind**: static method of [<code>actions.profile</code>](#module_actions.profile) | Param | Type | Description | | --- | --- | --- | @@ -284,19 +286,19 @@ Creates an action that uploads user's photo. ### actions.profile.deletePhotoInit() ⇒ <code>Action</code> Creates an action that signals beginning of deleting user's photo. -**Kind**: static method of [<code>actions.profile</code>](#module_actions.profile) +**Kind**: static method of [<code>actions.profile</code>](#module_actions.profile) <a name="module_actions.profile.updateProfileInit"></a> ### actions.profile.updateProfileInit() ⇒ <code>Action</code> Creates an action that signals beginning of updating user's profile. -**Kind**: static method of [<code>actions.profile</code>](#module_actions.profile) +**Kind**: static method of [<code>actions.profile</code>](#module_actions.profile) <a name="module_actions.profile.updateProfileDone"></a> ### actions.profile.updateProfileDone(profile, tokenV3) ⇒ <code>Action</code> Creates an action that updates user's profile. -**Kind**: static method of [<code>actions.profile</code>](#module_actions.profile) +**Kind**: static method of [<code>actions.profile</code>](#module_actions.profile) | Param | Type | Description | | --- | --- | --- | @@ -308,13 +310,13 @@ Creates an action that updates user's profile. ### actions.profile.addSkillInit() ⇒ <code>Action</code> Creates an action that signals beginning of adding user's skill. -**Kind**: static method of [<code>actions.profile</code>](#module_actions.profile) +**Kind**: static method of [<code>actions.profile</code>](#module_actions.profile) <a name="module_actions.profile.addSkillDone"></a> ### actions.profile.addSkillDone(handle, tokenV3, skill) ⇒ <code>Action</code> Creates an action that adds user's skill. -**Kind**: static method of [<code>actions.profile</code>](#module_actions.profile) +**Kind**: static method of [<code>actions.profile</code>](#module_actions.profile) | Param | Type | Description | | --- | --- | --- | @@ -327,13 +329,13 @@ Creates an action that adds user's skill. ### actions.profile.hideSkillInit() ⇒ <code>Action</code> Creates an action that signals beginning of hiding user's skill. -**Kind**: static method of [<code>actions.profile</code>](#module_actions.profile) +**Kind**: static method of [<code>actions.profile</code>](#module_actions.profile) <a name="module_actions.profile.hideSkillDone"></a> ### actions.profile.hideSkillDone(handle, tokenV3, skill) ⇒ <code>Action</code> Creates an action that hides user's skill. -**Kind**: static method of [<code>actions.profile</code>](#module_actions.profile) +**Kind**: static method of [<code>actions.profile</code>](#module_actions.profile) | Param | Type | Description | | --- | --- | --- | @@ -346,13 +348,13 @@ Creates an action that hides user's skill. ### actions.profile.addWebLinkInit() ⇒ <code>Action</code> Creates an action that signals beginning of adding user's web link. -**Kind**: static method of [<code>actions.profile</code>](#module_actions.profile) +**Kind**: static method of [<code>actions.profile</code>](#module_actions.profile) <a name="module_actions.profile.addWebLinkDone"></a> ### actions.profile.addWebLinkDone(handle, tokenV3, webLink) ⇒ <code>Action</code> Creates an action that adds user's web link. -**Kind**: static method of [<code>actions.profile</code>](#module_actions.profile) +**Kind**: static method of [<code>actions.profile</code>](#module_actions.profile) | Param | Type | Description | | --- | --- | --- | @@ -365,7 +367,7 @@ Creates an action that adds user's web link. ### actions.profile.deleteWebLinkInit(key) ⇒ <code>Action</code> Creates an action that signals beginning of deleting user's web link. -**Kind**: static method of [<code>actions.profile</code>](#module_actions.profile) +**Kind**: static method of [<code>actions.profile</code>](#module_actions.profile) | Param | Type | Description | | --- | --- | --- | @@ -376,7 +378,7 @@ Creates an action that signals beginning of deleting user's web link. ### actions.profile.deleteWebLinkDone(handle, tokenV3, webLink) ⇒ <code>Action</code> Creates an action that deletes user's web link. -**Kind**: static method of [<code>actions.profile</code>](#module_actions.profile) +**Kind**: static method of [<code>actions.profile</code>](#module_actions.profile) | Param | Type | Description | | --- | --- | --- | @@ -389,13 +391,13 @@ Creates an action that deletes user's web link. ### actions.profile.linkExternalAccountInit() ⇒ <code>Action</code> Creates an action that signals beginning of linking external account. -**Kind**: static method of [<code>actions.profile</code>](#module_actions.profile) +**Kind**: static method of [<code>actions.profile</code>](#module_actions.profile) <a name="module_actions.profile.linkExternalAccountDone"></a> ### actions.profile.linkExternalAccountDone(profile, tokenV3, providerType, callbackUrl) ⇒ <code>Action</code> Creates an action that links external account. -**Kind**: static method of [<code>actions.profile</code>](#module_actions.profile) +**Kind**: static method of [<code>actions.profile</code>](#module_actions.profile) | Param | Type | Description | | --- | --- | --- | @@ -409,7 +411,7 @@ Creates an action that links external account. ### actions.profile.unlinkExternalAccountInit(providerType) ⇒ <code>Action</code> Creates an action that signals beginning of unlinking external account. -**Kind**: static method of [<code>actions.profile</code>](#module_actions.profile) +**Kind**: static method of [<code>actions.profile</code>](#module_actions.profile) | Param | Type | Description | | --- | --- | --- | @@ -420,7 +422,7 @@ Creates an action that signals beginning of unlinking external account. ### actions.profile.unlinkExternalAccountDone(profile, tokenV3, providerType) ⇒ <code>Action</code> Creates an action that unlinks external account. -**Kind**: static method of [<code>actions.profile</code>](#module_actions.profile) +**Kind**: static method of [<code>actions.profile</code>](#module_actions.profile) | Param | Type | Description | | --- | --- | --- | @@ -433,13 +435,13 @@ Creates an action that unlinks external account. ### actions.profile.saveEmailPreferencesInit() ⇒ <code>Action</code> Creates an action that signals beginning of saving email preferences. -**Kind**: static method of [<code>actions.profile</code>](#module_actions.profile) +**Kind**: static method of [<code>actions.profile</code>](#module_actions.profile) <a name="module_actions.profile.saveEmailPreferencesDone"></a> ### actions.profile.saveEmailPreferencesDone(profile, tokenV3, preferences) ⇒ <code>Action</code> Creates an action that saves email preferences. -**Kind**: static method of [<code>actions.profile</code>](#module_actions.profile) +**Kind**: static method of [<code>actions.profile</code>](#module_actions.profile) | Param | Type | Description | | --- | --- | --- | @@ -452,13 +454,13 @@ Creates an action that saves email preferences. ### actions.profile.updatePasswordInit() ⇒ <code>Action</code> Creates an action that signals beginning of updating user password. -**Kind**: static method of [<code>actions.profile</code>](#module_actions.profile) +**Kind**: static method of [<code>actions.profile</code>](#module_actions.profile) <a name="module_actions.profile.updatePasswordDone"></a> ### actions.profile.updatePasswordDone(profile, tokenV3, newPassword, oldPassword) ⇒ <code>Action</code> Creates an action that updates user password. -**Kind**: static method of [<code>actions.profile</code>](#module_actions.profile) +**Kind**: static method of [<code>actions.profile</code>](#module_actions.profile) | Param | Type | Description | | --- | --- | --- | @@ -467,3 +469,26 @@ Creates an action that updates user password. | newPassword | <code>String</code> | The new password | | oldPassword | <code>String</code> | The old password | + + +### actions.profile.verifyMemberNewEmailInit() ⇒ <code>Action</code> + +Creates an action that signals beginning of verify member new email. + +**Kind**: static method of [<code>actions.profile</code>](#module_actions.profile) + +<a name="module_actions.profile.verifyMemberNewEmailInit"></a> + + +### actions.profile.verifyMemberNewEmailDone(handle, tokenV3, emailVerifyToken) ⇒ <code>Action</code> +Creates an action that verify member new email. + +**Kind**: static method of [<code>actions.profile</code>](#module_actions.profile) + +<a name="module_actions.profile.verifyMemberNewEmailDone"></a> + +| Param | Type | Description | +| --- | --- | --- | +| handle | <code>String</code> | Topcoder member handle. | +| tokenV3 | <code>String</code> | Topcoder auth token v3. | +| emailVerifyToken | <code>String</code> | The verify token of new email | diff --git a/docs/reducers.profile.md b/docs/reducers.profile.md index 979675c0..43d9ad78 100644 --- a/docs/reducers.profile.md +++ b/docs/reducers.profile.md @@ -1,317 +1,491 @@ -<a name="module_reducers.profile"></a> +<a name="module_actions.profile"></a> -## reducers.profile -Reducer for Profile API data +## actions.profile +Actions for interactions with profile details API. **Todo** -- [ ] Document reducer state structure. - - -* [reducers.profile](#module_reducers.profile) - * _static_ - * [.factory()](#module_reducers.profile.factory) ⇒ <code>Promise</code> - * _inner_ - * [~onGetAchievementsDone(state, action)](#module_reducers.profile..onGetAchievementsDone) ⇒ <code>Object</code> - * [~onGetExternalAccountsDone(state, action)](#module_reducers.profile..onGetExternalAccountsDone) ⇒ <code>Object</code> - * [~onGetExternalLinksDone(state, action)](#module_reducers.profile..onGetExternalLinksDone) ⇒ <code>Object</code> - * [~onGetInfoDone(state, action)](#module_reducers.profile..onGetInfoDone) ⇒ <code>Object</code> - * [~onGetSkillsDone(state, action)](#module_reducers.profile..onGetSkillsDone) ⇒ <code>Object</code> - * [~onGetStatsDone(state, action)](#module_reducers.profile..onGetStatsDone) ⇒ <code>Object</code> - * [~onGetLinkedAccountsDone(state, action)](#module_reducers.profile..onGetLinkedAccountsDone) ⇒ <code>Object</code> - * [~onGetCredentialDone(state, action)](#module_reducers.profile..onGetCredentialDone) ⇒ <code>Object</code> - * [~onGetEmailPreferencesDone(state, action)](#module_reducers.profile..onGetEmailPreferencesDone) ⇒ <code>Object</code> - * [~onUploadPhotoDone(state, action)](#module_reducers.profile..onUploadPhotoDone) ⇒ <code>Object</code> - * [~onDeletePhotoDone(state, action)](#module_reducers.profile..onDeletePhotoDone) ⇒ <code>Object</code> - * [~onUpdateProfileDone(state, action)](#module_reducers.profile..onUpdateProfileDone) ⇒ <code>Object</code> - * [~onAddSkillDone(state, action)](#module_reducers.profile..onAddSkillDone) ⇒ <code>Object</code> - * [~onHideSkillDone(state, action)](#module_reducers.profile..onHideSkillDone) ⇒ <code>Object</code> - * [~onAddWebLinkDone(state, action)](#module_reducers.profile..onAddWebLinkDone) ⇒ <code>Object</code> - * [~onDeleteWebLinkDone(state, action)](#module_reducers.profile..onDeleteWebLinkDone) ⇒ <code>Object</code> - * [~onLinkExternalAccountDone(state, action)](#module_reducers.profile..onLinkExternalAccountDone) ⇒ <code>Object</code> - * [~onUnlinkExternalAccountDone(state, action)](#module_reducers.profile..onUnlinkExternalAccountDone) ⇒ <code>Object</code> - * [~onSaveEmailPreferencesDone(state, action)](#module_reducers.profile..onSaveEmailPreferencesDone) ⇒ <code>Object</code> - * [~onUpdatePasswordDone(state, action)](#module_reducers.profile..onUpdatePasswordDone) ⇒ <code>Object</code> - * [~create(initialState)](#module_reducers.profile..create) ⇒ <code>function</code> - -<a name="module_reducers.profile.factory"></a> - -### reducers.profile.factory() ⇒ <code>Promise</code> -Factory which creates a new reducer with its initial state tailored to the -given options object, if specified (for server-side rendering). If options -object is not specified, it creates just the default reducer. Accepted options are: - -**Kind**: static method of [<code>reducers.profile</code>](#module_reducers.profile) -**Resolves**: <code>Function(state, action): state</code> New reducer. -<a name="module_reducers.profile..onGetAchievementsDone"></a> - -### reducers.profile~onGetAchievementsDone(state, action) ⇒ <code>Object</code> -Handles PROFILE/GET_ACHIEVEMENTS_DONE action. - -**Kind**: inner method of [<code>reducers.profile</code>](#module_reducers.profile) -**Returns**: <code>Object</code> - New state +- [ ] Some of them repeat actions in [actions.members.md](actions.members.md). The code + should be refactored to avoid redundancy. + + +* [actions.profile](#module_actions.profile) + * [.loadProfile(handle)](#module_actions.profile.loadProfile) ⇒ <code>Action</code> + * [.clearProfile()](#module_actions.profile.clearProfile) ⇒ <code>Action</code> + * [.getAchievementsInit()](#module_actions.profile.getAchievementsInit) ⇒ <code>Action</code> + * [.getAchievementsDone(handle)](#module_actions.profile.getAchievementsDone) ⇒ <code>Action</code> + * [.getExternalAccountsInit()](#module_actions.profile.getExternalAccountsInit) ⇒ <code>Action</code> + * [.getExternalAccountsDone(handle)](#module_actions.profile.getExternalAccountsDone) ⇒ <code>Action</code> + * [.getExternalLinksInit()](#module_actions.profile.getExternalLinksInit) ⇒ <code>Action</code> + * [.getExternalLinksDone(handle)](#module_actions.profile.getExternalLinksDone) ⇒ <code>Action</code> + * [.getInfoInit()](#module_actions.profile.getInfoInit) ⇒ <code>Action</code> + * [.getInfoDone(handle)](#module_actions.profile.getInfoDone) ⇒ <code>Action</code> + * [.getSkillsInit()](#module_actions.profile.getSkillsInit) ⇒ <code>Action</code> + * [.getSkillsDone(handle)](#module_actions.profile.getSkillsDone) ⇒ <code>Action</code> + * [.getStatsInit()](#module_actions.profile.getStatsInit) ⇒ <code>Action</code> + * [.getStatsDone(handle)](#module_actions.profile.getStatsDone) ⇒ <code>Action</code> + * [.getLinkedAccountsInit()](#module_actions.profile.getLinkedAccountsInit) ⇒ <code>Action</code> + * [.getLinkedAccountsDone(profile, tokenV3)](#module_actions.profile.getLinkedAccountsDone) ⇒ <code>Action</code> + * [.getCredentialInit()](#module_actions.profile.getCredentialInit) ⇒ <code>Action</code> + * [.getCredentialDone(profile, tokenV3)](#module_actions.profile.getCredentialDone) ⇒ <code>Action</code> + * [.getEmailPreferencesInit()](#module_actions.profile.getEmailPreferencesInit) ⇒ <code>Action</code> + * [.getEmailPreferencesDone(profile, tokenV3)](#module_actions.profile.getEmailPreferencesDone) ⇒ <code>Action</code> + * [.uploadPhotoInit()](#module_actions.profile.uploadPhotoInit) ⇒ <code>Action</code> + * [.uploadPhotoDone(handle, tokenV3, file)](#module_actions.profile.uploadPhotoDone) ⇒ <code>Action</code> + * [.deletePhotoInit()](#module_actions.profile.deletePhotoInit) ⇒ <code>Action</code> + * [.updateProfileInit()](#module_actions.profile.updateProfileInit) ⇒ <code>Action</code> + * [.updateProfileDone(profile, tokenV3)](#module_actions.profile.updateProfileDone) ⇒ <code>Action</code> + * [.addSkillInit()](#module_actions.profile.addSkillInit) ⇒ <code>Action</code> + * [.addSkillDone(handle, tokenV3, skill)](#module_actions.profile.addSkillDone) ⇒ <code>Action</code> + * [.hideSkillInit()](#module_actions.profile.hideSkillInit) ⇒ <code>Action</code> + * [.hideSkillDone(handle, tokenV3, skill)](#module_actions.profile.hideSkillDone) ⇒ <code>Action</code> + * [.addWebLinkInit()](#module_actions.profile.addWebLinkInit) ⇒ <code>Action</code> + * [.addWebLinkDone(handle, tokenV3, webLink)](#module_actions.profile.addWebLinkDone) ⇒ <code>Action</code> + * [.deleteWebLinkInit(key)](#module_actions.profile.deleteWebLinkInit) ⇒ <code>Action</code> + * [.deleteWebLinkDone(handle, tokenV3, webLink)](#module_actions.profile.deleteWebLinkDone) ⇒ <code>Action</code> + * [.linkExternalAccountInit()](#module_actions.profile.linkExternalAccountInit) ⇒ <code>Action</code> + * [.linkExternalAccountDone(profile, tokenV3, providerType, callbackUrl)](#module_actions.profile.linkExternalAccountDone) ⇒ <code>Action</code> + * [.unlinkExternalAccountInit(providerType)](#module_actions.profile.unlinkExternalAccountInit) ⇒ <code>Action</code> + * [.unlinkExternalAccountDone(profile, tokenV3, providerType)](#module_actions.profile.unlinkExternalAccountDone) ⇒ <code>Action</code> + * [.saveEmailPreferencesInit()](#module_actions.profile.saveEmailPreferencesInit) ⇒ <code>Action</code> + * [.saveEmailPreferencesDone(profile, tokenV3, preferences)](#module_actions.profile.saveEmailPreferencesDone) ⇒ <code>Action</code> + * [.updatePasswordInit()](#module_actions.profile.updatePasswordInit) ⇒ <code>Action</code> + * [.updatePasswordDone(profile, tokenV3, newPassword, oldPassword)](#module_actions.profile.updatePasswordDone) ⇒ <code>Action</code> + * [.verifyMemberNewEmailInit()](#module_actions.profile.verifyMemberNewEmailInit) ⇒ <code>Action</code> + * [.verifyMemberNewEmailDone(handle, tokenV3, emailVerifyToken)](#module_actions.profile.verifyMemberNewEmailDone) ⇒ <code>Action</code> + +<a name="module_actions.profile.loadProfile"></a> + +### actions.profile.loadProfile(handle) ⇒ <code>Action</code> +Creates and action that loads user profile. + +**Kind**: static method of [<code>actions.profile</code>](#module_actions.profile) +**Todo** + +- [ ] This action does not follow the pattern with init/done pairs of + actions. Should be improved. + + +| Param | Type | Description | +| --- | --- | --- | +| handle | <code>String</code> | User handle. | + +<a name="module_actions.profile.clearProfile"></a> + +### actions.profile.clearProfile() ⇒ <code>Action</code> +Creates and action that clear user profile. + +**Kind**: static method of [<code>actions.profile</code>](#module_actions.profile) +**Todo** + +- [ ] This action does not follow the pattern with init/done pairs of + actions. Should be improved. + +<a name="module_actions.profile.getAchievementsInit"></a> + +### actions.profile.getAchievementsInit() ⇒ <code>Action</code> +Creates an action that signals beginning of user achievements loading. + +**Kind**: static method of [<code>actions.profile</code>](#module_actions.profile) +**Todo** + +- [ ] This duplicates similar action in [actions.members.md](actions.members.md)! + +<a name="module_actions.profile.getAchievementsDone"></a> + +### actions.profile.getAchievementsDone(handle) ⇒ <code>Action</code> +Creates an action that loads user achievements. + +**Kind**: static method of [<code>actions.profile</code>](#module_actions.profile) +**Todo** + +- [ ] This duplicates similar action in [actions.members.md](actions.members.md)! + | Param | Type | Description | | --- | --- | --- | -| state | <code>Object</code> | | -| action | <code>Object</code> | Payload will be JSON from api call | +| handle | <code>String</code> | User handle. | + +<a name="module_actions.profile.getExternalAccountsInit"></a> + +### actions.profile.getExternalAccountsInit() ⇒ <code>Action</code> +**Kind**: static method of [<code>actions.profile</code>](#module_actions.profile) +**Todo** -<a name="module_reducers.profile..onGetExternalAccountsDone"></a> +- [ ] To be documented. -### reducers.profile~onGetExternalAccountsDone(state, action) ⇒ <code>Object</code> -Handles PROFILE/GET_EXTERNAL_ACCOUNTS_DONE action. +<a name="module_actions.profile.getExternalAccountsDone"></a> + +### actions.profile.getExternalAccountsDone(handle) ⇒ <code>Action</code> +**Kind**: static method of [<code>actions.profile</code>](#module_actions.profile) +**Todo** + +- [ ] To be documented. -**Kind**: inner method of [<code>reducers.profile</code>](#module_reducers.profile) -**Returns**: <code>Object</code> - New state | Param | Type | Description | | --- | --- | --- | -| state | <code>Object</code> | | -| action | <code>Object</code> | Payload will be JSON from api call | +| handle | <code>String</code> | User handle. | + +<a name="module_actions.profile.getExternalLinksInit"></a> + +### actions.profile.getExternalLinksInit() ⇒ <code>Action</code> +**Kind**: static method of [<code>actions.profile</code>](#module_actions.profile) +**Todo** + +- [ ] Figure out what does this action do. -<a name="module_reducers.profile..onGetExternalLinksDone"></a> +<a name="module_actions.profile.getExternalLinksDone"></a> -### reducers.profile~onGetExternalLinksDone(state, action) ⇒ <code>Object</code> -Handles PROFILE/GET_EXTERNAL_LINKS_DONE action. +### actions.profile.getExternalLinksDone(handle) ⇒ <code>Action</code> +**Kind**: static method of [<code>actions.profile</code>](#module_actions.profile) +**Todo** + +- [ ] Figure out the purpose of this action -**Kind**: inner method of [<code>reducers.profile</code>](#module_reducers.profile) -**Returns**: <code>Object</code> - New state | Param | Type | Description | | --- | --- | --- | -| state | <code>Object</code> | | -| action | <code>Object</code> | Payload will be JSON from api call | +| handle | <code>String</code> | User handle. | + +<a name="module_actions.profile.getInfoInit"></a> -<a name="module_reducers.profile..onGetInfoDone"></a> +### actions.profile.getInfoInit() ⇒ <code>Action</code> +**Kind**: static method of [<code>actions.profile</code>](#module_actions.profile) +**Todo** + +- [ ] Figure out the purpose of this action. + +<a name="module_actions.profile.getInfoDone"></a> + +### actions.profile.getInfoDone(handle) ⇒ <code>Action</code> +**Kind**: static method of [<code>actions.profile</code>](#module_actions.profile) +**Todo** -### reducers.profile~onGetInfoDone(state, action) ⇒ <code>Object</code> -Handles PROFILE/GET_INFO_DONE action. +- [ ] Figure out the purpose of this action. -**Kind**: inner method of [<code>reducers.profile</code>](#module_reducers.profile) -**Returns**: <code>Object</code> - New state | Param | Type | Description | | --- | --- | --- | -| state | <code>Object</code> | | -| action | <code>Object</code> | Payload will be JSON from api call | +| handle | <code>String</code> | User handle. | -<a name="module_reducers.profile..onGetSkillsDone"></a> +<a name="module_actions.profile.getSkillsInit"></a> -### reducers.profile~onGetSkillsDone(state, action) ⇒ <code>Object</code> -Handles PROFILE/GET_SKILLS_DONE action. +### actions.profile.getSkillsInit() ⇒ <code>Action</code> +Creates an action that signals beginning of loading the member's + skills info. -**Kind**: inner method of [<code>reducers.profile</code>](#module_reducers.profile) -**Returns**: <code>Object</code> - New state +**Kind**: static method of [<code>actions.profile</code>](#module_actions.profile) +<a name="module_actions.profile.getSkillsDone"></a> + +### actions.profile.getSkillsDone(handle) ⇒ <code>Action</code> +Creates an action that loads member's skills info. + +**Kind**: static method of [<code>actions.profile</code>](#module_actions.profile) | Param | Type | Description | | --- | --- | --- | -| state | <code>Object</code> | | -| action | <code>Object</code> | Payload will be JSON from api call | +| handle | <code>String</code> | Member handle. | + +<a name="module_actions.profile.getStatsInit"></a> + +### actions.profile.getStatsInit() ⇒ <code>Action</code> +Creates an action that signals beginning of loading member's stats. + +**Kind**: static method of [<code>actions.profile</code>](#module_actions.profile) +**Todo** + +- [ ] This is similar to [actions.members.md#module_actions.members.getStatsInit](actions.members.md#module_actions.members.getStatsInit)! -<a name="module_reducers.profile..onGetStatsDone"></a> +<a name="module_actions.profile.getStatsDone"></a> -### reducers.profile~onGetStatsDone(state, action) ⇒ <code>Object</code> -Handles PROFILE/GET_STATS_DONE action. +### actions.profile.getStatsDone(handle) ⇒ <code>Action</code> +Creates an action that loads member's stats. -**Kind**: inner method of [<code>reducers.profile</code>](#module_reducers.profile) -**Returns**: <code>Object</code> - New state +**Kind**: static method of [<code>actions.profile</code>](#module_actions.profile) | Param | Type | Description | | --- | --- | --- | -| state | <code>Object</code> | | -| action | <code>Object</code> | Payload will be JSON from api call | +| handle | <code>String</code> | Member handle. | + +<a name="module_actions.profile.getLinkedAccountsInit"></a> -<a name="module_reducers.profile..onGetLinkedAccountsDone"></a> +### actions.profile.getLinkedAccountsInit() ⇒ <code>Action</code> +Creates an action that signals beginning of getting linked accounts. -### reducers.profile~onGetLinkedAccountsDone(state, action) ⇒ <code>Object</code> -Handles PROFILE/GET_LINKED_ACCOUNTS_DONE action. +**Kind**: static method of [<code>actions.profile</code>](#module_actions.profile) +<a name="module_actions.profile.getLinkedAccountsDone"></a> -**Kind**: inner method of [<code>reducers.profile</code>](#module_reducers.profile) -**Returns**: <code>Object</code> - New state +### actions.profile.getLinkedAccountsDone(profile, tokenV3) ⇒ <code>Action</code> +Creates an action that gets linked accounts. + +**Kind**: static method of [<code>actions.profile</code>](#module_actions.profile) | Param | Type | Description | | --- | --- | --- | -| state | <code>Object</code> | | -| action | <code>Object</code> | Payload will be JSON from api call | +| profile | <code>Object</code> | Topcoder member profile. | +| tokenV3 | <code>String</code> | Topcoder auth token v3. | + +<a name="module_actions.profile.getCredentialInit"></a> -<a name="module_reducers.profile..onGetCredentialDone"></a> +### actions.profile.getCredentialInit() ⇒ <code>Action</code> +Creates an action that signals beginning of getting credential. -### reducers.profile~onGetCredentialDone(state, action) ⇒ <code>Object</code> -Handles PROFILE/GET_CREDENTIAL_DONE action. +**Kind**: static method of [<code>actions.profile</code>](#module_actions.profile) +<a name="module_actions.profile.getCredentialDone"></a> -**Kind**: inner method of [<code>reducers.profile</code>](#module_reducers.profile) -**Returns**: <code>Object</code> - New state +### actions.profile.getCredentialDone(profile, tokenV3) ⇒ <code>Action</code> +Creates an action that gets credential. + +**Kind**: static method of [<code>actions.profile</code>](#module_actions.profile) | Param | Type | Description | | --- | --- | --- | -| state | <code>Object</code> | | -| action | <code>Object</code> | Payload will be JSON from api call | +| profile | <code>Object</code> | Topcoder member profile. | +| tokenV3 | <code>String</code> | Topcoder auth token v3. | + +<a name="module_actions.profile.getEmailPreferencesInit"></a> + +### actions.profile.getEmailPreferencesInit() ⇒ <code>Action</code> +Creates an action that signals beginning of getting email preferences. -<a name="module_reducers.profile..onGetEmailPreferencesDone"></a> +**Kind**: static method of [<code>actions.profile</code>](#module_actions.profile) +<a name="module_actions.profile.getEmailPreferencesDone"></a> -### reducers.profile~onGetEmailPreferencesDone(state, action) ⇒ <code>Object</code> -Handles PROFILE/GET_EMAIL_PREFERENCES_DONE action. +### actions.profile.getEmailPreferencesDone(profile, tokenV3) ⇒ <code>Action</code> +Creates an action that gets email preferences. -**Kind**: inner method of [<code>reducers.profile</code>](#module_reducers.profile) -**Returns**: <code>Object</code> - New state +**Kind**: static method of [<code>actions.profile</code>](#module_actions.profile) | Param | Type | Description | | --- | --- | --- | -| state | <code>Object</code> | | -| action | <code>Object</code> | Payload will be JSON from api call | +| profile | <code>Object</code> | Topcoder member profile. | +| tokenV3 | <code>String</code> | Topcoder auth token v3. | + +<a name="module_actions.profile.uploadPhotoInit"></a> + +### actions.profile.uploadPhotoInit() ⇒ <code>Action</code> +Creates an action that signals beginning of uploading user's photo. -<a name="module_reducers.profile..onUploadPhotoDone"></a> +**Kind**: static method of [<code>actions.profile</code>](#module_actions.profile) +<a name="module_actions.profile.uploadPhotoDone"></a> -### reducers.profile~onUploadPhotoDone(state, action) ⇒ <code>Object</code> -Handles PROFILE/UPLOAD_PHOTO_DONE action. +### actions.profile.uploadPhotoDone(handle, tokenV3, file) ⇒ <code>Action</code> +Creates an action that uploads user's photo. -**Kind**: inner method of [<code>reducers.profile</code>](#module_reducers.profile) -**Returns**: <code>Object</code> - New state +**Kind**: static method of [<code>actions.profile</code>](#module_actions.profile) | Param | Type | Description | | --- | --- | --- | -| state | <code>Object</code> | | -| action | <code>Object</code> | Payload will be JSON from api call | +| handle | <code>String</code> | Topcoder user handle. | +| tokenV3 | <code>String</code> | Topcoder auth token v3. | +| file | <code>String</code> | The photo file. | -<a name="module_reducers.profile..onDeletePhotoDone"></a> +<a name="module_actions.profile.deletePhotoInit"></a> -### reducers.profile~onDeletePhotoDone(state, action) ⇒ <code>Object</code> -Handles PROFILE/DELETE_PHOTO_DONE action. +### actions.profile.deletePhotoInit() ⇒ <code>Action</code> +Creates an action that signals beginning of deleting user's photo. -**Kind**: inner method of [<code>reducers.profile</code>](#module_reducers.profile) -**Returns**: <code>Object</code> - New state +**Kind**: static method of [<code>actions.profile</code>](#module_actions.profile) +<a name="module_actions.profile.updateProfileInit"></a> + +### actions.profile.updateProfileInit() ⇒ <code>Action</code> +Creates an action that signals beginning of updating user's profile. + +**Kind**: static method of [<code>actions.profile</code>](#module_actions.profile) +<a name="module_actions.profile.updateProfileDone"></a> + +### actions.profile.updateProfileDone(profile, tokenV3) ⇒ <code>Action</code> +Creates an action that updates user's profile. + +**Kind**: static method of [<code>actions.profile</code>](#module_actions.profile) | Param | Type | Description | | --- | --- | --- | -| state | <code>Object</code> | | -| action | <code>Object</code> | Payload will be JSON from api call | +| profile | <code>String</code> | Topcoder user profile. | +| tokenV3 | <code>String</code> | Topcoder auth token v3. | + +<a name="module_actions.profile.addSkillInit"></a> -<a name="module_reducers.profile..onUpdateProfileDone"></a> +### actions.profile.addSkillInit() ⇒ <code>Action</code> +Creates an action that signals beginning of adding user's skill. -### reducers.profile~onUpdateProfileDone(state, action) ⇒ <code>Object</code> -Handles PROFILE/UPDATE_PROFILE_DONE action. +**Kind**: static method of [<code>actions.profile</code>](#module_actions.profile) +<a name="module_actions.profile.addSkillDone"></a> -**Kind**: inner method of [<code>reducers.profile</code>](#module_reducers.profile) -**Returns**: <code>Object</code> - New state +### actions.profile.addSkillDone(handle, tokenV3, skill) ⇒ <code>Action</code> +Creates an action that adds user's skill. + +**Kind**: static method of [<code>actions.profile</code>](#module_actions.profile) | Param | Type | Description | | --- | --- | --- | -| state | <code>Object</code> | | -| action | <code>Object</code> | Payload will be JSON from api call | +| handle | <code>String</code> | Topcoder user handle. | +| tokenV3 | <code>String</code> | Topcoder auth token v3. | +| skill | <code>Object</code> | Skill to add. | + +<a name="module_actions.profile.hideSkillInit"></a> + +### actions.profile.hideSkillInit() ⇒ <code>Action</code> +Creates an action that signals beginning of hiding user's skill. -<a name="module_reducers.profile..onAddSkillDone"></a> +**Kind**: static method of [<code>actions.profile</code>](#module_actions.profile) +<a name="module_actions.profile.hideSkillDone"></a> -### reducers.profile~onAddSkillDone(state, action) ⇒ <code>Object</code> -Handles PROFILE/ADD_SKILL_DONE action. +### actions.profile.hideSkillDone(handle, tokenV3, skill) ⇒ <code>Action</code> +Creates an action that hides user's skill. -**Kind**: inner method of [<code>reducers.profile</code>](#module_reducers.profile) -**Returns**: <code>Object</code> - New state +**Kind**: static method of [<code>actions.profile</code>](#module_actions.profile) | Param | Type | Description | | --- | --- | --- | -| state | <code>Object</code> | | -| action | <code>Object</code> | Payload will be JSON from api call | +| handle | <code>String</code> | Topcoder user handle. | +| tokenV3 | <code>String</code> | Topcoder auth token v3. | +| skill | <code>Object</code> | Skill to hide. | + +<a name="module_actions.profile.addWebLinkInit"></a> + +### actions.profile.addWebLinkInit() ⇒ <code>Action</code> +Creates an action that signals beginning of adding user's web link. -<a name="module_reducers.profile..onHideSkillDone"></a> +**Kind**: static method of [<code>actions.profile</code>](#module_actions.profile) +<a name="module_actions.profile.addWebLinkDone"></a> -### reducers.profile~onHideSkillDone(state, action) ⇒ <code>Object</code> -Handles PROFILE/HIDE_SKILL_DONE action. +### actions.profile.addWebLinkDone(handle, tokenV3, webLink) ⇒ <code>Action</code> +Creates an action that adds user's web link. -**Kind**: inner method of [<code>reducers.profile</code>](#module_reducers.profile) -**Returns**: <code>Object</code> - New state +**Kind**: static method of [<code>actions.profile</code>](#module_actions.profile) | Param | Type | Description | | --- | --- | --- | -| state | <code>Object</code> | | -| action | <code>Object</code> | Payload will be JSON from api call | +| handle | <code>String</code> | Topcoder user handle. | +| tokenV3 | <code>String</code> | Topcoder auth token v3. | +| webLink | <code>String</code> | Web link to add. | -<a name="module_reducers.profile..onAddWebLinkDone"></a> +<a name="module_actions.profile.deleteWebLinkInit"></a> -### reducers.profile~onAddWebLinkDone(state, action) ⇒ <code>Object</code> -Handles PROFILE/ADD_WEB_LINK_DONE action. +### actions.profile.deleteWebLinkInit(key) ⇒ <code>Action</code> +Creates an action that signals beginning of deleting user's web link. -**Kind**: inner method of [<code>reducers.profile</code>](#module_reducers.profile) -**Returns**: <code>Object</code> - New state +**Kind**: static method of [<code>actions.profile</code>](#module_actions.profile) | Param | Type | Description | | --- | --- | --- | -| state | <code>Object</code> | | -| action | <code>Object</code> | Payload will be JSON from api call | +| key | <code>Object</code> | Web link key to delete. | -<a name="module_reducers.profile..onDeleteWebLinkDone"></a> +<a name="module_actions.profile.deleteWebLinkDone"></a> -### reducers.profile~onDeleteWebLinkDone(state, action) ⇒ <code>Object</code> -Handles PROFILE/DELETE_WEB_LINK_DONE action. +### actions.profile.deleteWebLinkDone(handle, tokenV3, webLink) ⇒ <code>Action</code> +Creates an action that deletes user's web link. -**Kind**: inner method of [<code>reducers.profile</code>](#module_reducers.profile) -**Returns**: <code>Object</code> - New state +**Kind**: static method of [<code>actions.profile</code>](#module_actions.profile) | Param | Type | Description | | --- | --- | --- | -| state | <code>Object</code> | | -| action | <code>Object</code> | Payload will be JSON from api call | +| handle | <code>String</code> | Topcoder user handle. | +| tokenV3 | <code>String</code> | Topcoder auth token v3. | +| webLink | <code>String</code> | Web link to delete. | -<a name="module_reducers.profile..onLinkExternalAccountDone"></a> +<a name="module_actions.profile.linkExternalAccountInit"></a> -### reducers.profile~onLinkExternalAccountDone(state, action) ⇒ <code>Object</code> -Handles PROFILE/LINK_EXTERNAL_ACCOUNT_DONE action. +### actions.profile.linkExternalAccountInit() ⇒ <code>Action</code> +Creates an action that signals beginning of linking external account. -**Kind**: inner method of [<code>reducers.profile</code>](#module_reducers.profile) -**Returns**: <code>Object</code> - New state +**Kind**: static method of [<code>actions.profile</code>](#module_actions.profile) +<a name="module_actions.profile.linkExternalAccountDone"></a> + +### actions.profile.linkExternalAccountDone(profile, tokenV3, providerType, callbackUrl) ⇒ <code>Action</code> +Creates an action that links external account. + +**Kind**: static method of [<code>actions.profile</code>](#module_actions.profile) | Param | Type | Description | | --- | --- | --- | -| state | <code>Object</code> | | -| action | <code>Object</code> | Payload will be JSON from api call | +| profile | <code>Object</code> | Topcoder member handle. | +| tokenV3 | <code>String</code> | Topcoder auth token v3. | +| providerType | <code>String</code> | The external account service provider | +| callbackUrl | <code>String</code> | Optional. The callback url | -<a name="module_reducers.profile..onUnlinkExternalAccountDone"></a> +<a name="module_actions.profile.unlinkExternalAccountInit"></a> -### reducers.profile~onUnlinkExternalAccountDone(state, action) ⇒ <code>Object</code> -Handles PROFILE/UNLINK_EXTERNAL_ACCOUNT_DONE action. +### actions.profile.unlinkExternalAccountInit(providerType) ⇒ <code>Action</code> +Creates an action that signals beginning of unlinking external account. -**Kind**: inner method of [<code>reducers.profile</code>](#module_reducers.profile) -**Returns**: <code>Object</code> - New state +**Kind**: static method of [<code>actions.profile</code>](#module_actions.profile) | Param | Type | Description | | --- | --- | --- | -| state | <code>Object</code> | | -| action | <code>Object</code> | Payload will be JSON from api call | +| providerType | <code>Object</code> | External account provider type to delete. | -<a name="module_reducers.profile..onSaveEmailPreferencesDone"></a> +<a name="module_actions.profile.unlinkExternalAccountDone"></a> -### reducers.profile~onSaveEmailPreferencesDone(state, action) ⇒ <code>Object</code> -Handles PROFILE/SAVE_EMAIL_PREFERENCES_DONE action. +### actions.profile.unlinkExternalAccountDone(profile, tokenV3, providerType) ⇒ <code>Action</code> +Creates an action that unlinks external account. -**Kind**: inner method of [<code>reducers.profile</code>](#module_reducers.profile) -**Returns**: <code>Object</code> - New state +**Kind**: static method of [<code>actions.profile</code>](#module_actions.profile) | Param | Type | Description | | --- | --- | --- | -| state | <code>Object</code> | | -| action | <code>Object</code> | Payload will be JSON from api call | +| profile | <code>Object</code> | Topcoder member profile. | +| tokenV3 | <code>String</code> | Topcoder auth token v3. | +| providerType | <code>String</code> | The external account service provider | + +<a name="module_actions.profile.saveEmailPreferencesInit"></a> -<a name="module_reducers.profile..onUpdatePasswordDone"></a> +### actions.profile.saveEmailPreferencesInit() ⇒ <code>Action</code> +Creates an action that signals beginning of saving email preferences. -### reducers.profile~onUpdatePasswordDone(state, action) ⇒ <code>Object</code> -Handles PROFILE/UPDATE_PASSWORD_DONE action. +**Kind**: static method of [<code>actions.profile</code>](#module_actions.profile) +<a name="module_actions.profile.saveEmailPreferencesDone"></a> -**Kind**: inner method of [<code>reducers.profile</code>](#module_reducers.profile) -**Returns**: <code>Object</code> - New state +### actions.profile.saveEmailPreferencesDone(profile, tokenV3, preferences) ⇒ <code>Action</code> +Creates an action that saves email preferences. + +**Kind**: static method of [<code>actions.profile</code>](#module_actions.profile) | Param | Type | Description | | --- | --- | --- | -| state | <code>Object</code> | | -| action | <code>Object</code> | Payload will be JSON from api call | +| profile | <code>Object</code> | Topcoder member profile. | +| tokenV3 | <code>String</code> | Topcoder auth token v3. | +| preferences | <code>Object</code> | The email preferences | + +<a name="module_actions.profile.updatePasswordInit"></a> -<a name="module_reducers.profile..create"></a> +### actions.profile.updatePasswordInit() ⇒ <code>Action</code> +Creates an action that signals beginning of updating user password. -### reducers.profile~create(initialState) ⇒ <code>function</code> -Creates a new Profile reducer with the specified initial state. +**Kind**: static method of [<code>actions.profile</code>](#module_actions.profile) +<a name="module_actions.profile.updatePasswordDone"></a> -**Kind**: inner method of [<code>reducers.profile</code>](#module_reducers.profile) -**Returns**: <code>function</code> - Profile reducer. +### actions.profile.updatePasswordDone(profile, tokenV3, newPassword, oldPassword) ⇒ <code>Action</code> +Creates an action that updates user password. + +**Kind**: static method of [<code>actions.profile</code>](#module_actions.profile) | Param | Type | Description | | --- | --- | --- | -| initialState | <code>Object</code> | Optional. Initial state. | +| profile | <code>Object</code> | Topcoder member profile. | +| tokenV3 | <code>String</code> | Topcoder auth token v3. | +| newPassword | <code>String</code> | The new password | +| oldPassword | <code>String</code> | The old password | + + + +### actions.profile.verifyMemberNewEmailInit() ⇒ <code>Action</code> +Creates an action that signals beginning of verify member new email. + +**Kind**: static method of [<code>actions.profile</code>](#module_actions.profile) +<a name="module_actions.profile.verifyMemberNewEmailInit"></a> + +### actions.profile.verifyMemberNewEmailDone(handle, tokenV3, emailVerifyToken) ⇒ <code>Action</code> +Creates an action that verify member new email. + +**Kind**: static method of [<code>actions.profile</code>](#module_actions.profile) +<a name="module_actions.profile.verifyMemberNewEmailDone"></a> + +| Param | Type | Description | +| --- | --- | --- | +| handle | <code>String</code> | Topcoder member handle. | +| tokenV3 | <code>String</code> | Topcoder auth token v3. | +| emailVerifyToken | <code>String</code> | The verify token of new email | diff --git a/docs/services.members.md b/docs/services.members.md index 3ecc99b0..e13b9a46 100644 --- a/docs/services.members.md +++ b/docs/services.members.md @@ -28,14 +28,15 @@ members via API V3. * [.getPresignedUrl(userHandle, file)](#module_services.members..MembersService+getPresignedUrl) ⇒ <code>Promise</code> * [.updateMemberPhoto(S3Response)](#module_services.members..MembersService+updateMemberPhoto) ⇒ <code>Promise</code> * [.uploadFileToS3(presignedUrlResponse)](#module_services.members..MembersService+uploadFileToS3) ⇒ <code>Promise</code> + * [.verifyMemberNewEmail(handle, emailVerifyToken)](#module_services.members..MembersService+verifyMemberNewEmail) ⇒ <code>Promise</code> <a name="module_services.members.getService"></a> ### services.members.getService(tokenV3) ⇒ <code>MembersService</code> Returns a new or existing members service. -**Kind**: static method of [<code>services.members</code>](#module_services.members) -**Returns**: <code>MembersService</code> - Members service object +**Kind**: static method of [<code>services.members</code>](#module_services.members) +**Returns**: <code>MembersService</code> - Members service object | Param | Type | Description | | --- | --- | --- | @@ -46,7 +47,7 @@ Returns a new or existing members service. ### services.members~MembersService Service class. -**Kind**: inner class of [<code>services.members</code>](#module_services.members) +**Kind**: inner class of [<code>services.members</code>](#module_services.members) * [~MembersService](#module_services.members..MembersService) * [new MembersService(tokenV3)](#new_module_services.members..MembersService_new) @@ -67,6 +68,7 @@ Service class. * [.getPresignedUrl(userHandle, file)](#module_services.members..MembersService+getPresignedUrl) ⇒ <code>Promise</code> * [.updateMemberPhoto(S3Response)](#module_services.members..MembersService+updateMemberPhoto) ⇒ <code>Promise</code> * [.uploadFileToS3(presignedUrlResponse)](#module_services.members..MembersService+uploadFileToS3) ⇒ <code>Promise</code> + * [.verifyMemberNewEmail(handle, emailVerifyToken)](#module_services.members..MembersService+verifyMemberNewEmail) ⇒ <code>Promise</code> <a name="new_module_services.members..MembersService_new"></a> @@ -81,8 +83,8 @@ Service class. #### membersService.getMemberFinances(handle) ⇒ <code>Promise</code> Gets member's financial information. -**Kind**: instance method of [<code>MembersService</code>](#module_services.members..MembersService) -**Returns**: <code>Promise</code> - Resolves to the financial information object. +**Kind**: instance method of [<code>MembersService</code>](#module_services.members..MembersService) +**Returns**: <code>Promise</code> - Resolves to the financial information object. | Param | Type | Description | | --- | --- | --- | @@ -95,8 +97,8 @@ Gets public information on a member. This method does not require any authorization. -**Kind**: instance method of [<code>MembersService</code>](#module_services.members..MembersService) -**Returns**: <code>Promise</code> - Resolves to the data object. +**Kind**: instance method of [<code>MembersService</code>](#module_services.members..MembersService) +**Returns**: <code>Promise</code> - Resolves to the data object. | Param | Type | Description | | --- | --- | --- | @@ -107,8 +109,8 @@ This method does not require any authorization. #### membersService.getExternalAccounts(handle) ⇒ <code>Promise</code> Gets member external account info. -**Kind**: instance method of [<code>MembersService</code>](#module_services.members..MembersService) -**Returns**: <code>Promise</code> - Resolves to the stats object. +**Kind**: instance method of [<code>MembersService</code>](#module_services.members..MembersService) +**Returns**: <code>Promise</code> - Resolves to the stats object. | Param | Type | | --- | --- | @@ -119,8 +121,8 @@ Gets member external account info. #### membersService.getExternalLinks(handle) ⇒ <code>Promise</code> Gets member external links. -**Kind**: instance method of [<code>MembersService</code>](#module_services.members..MembersService) -**Returns**: <code>Promise</code> - Resolves to the stats object. +**Kind**: instance method of [<code>MembersService</code>](#module_services.members..MembersService) +**Returns**: <code>Promise</code> - Resolves to the stats object. | Param | Type | | --- | --- | @@ -131,8 +133,8 @@ Gets member external links. #### membersService.getSkills(handle) ⇒ <code>Promise</code> Gets member skills. -**Kind**: instance method of [<code>MembersService</code>](#module_services.members..MembersService) -**Returns**: <code>Promise</code> - Resolves to the stats object. +**Kind**: instance method of [<code>MembersService</code>](#module_services.members..MembersService) +**Returns**: <code>Promise</code> - Resolves to the stats object. | Param | Type | | --- | --- | @@ -143,8 +145,8 @@ Gets member skills. #### membersService.getStats(handle) ⇒ <code>Promise</code> Gets member statistics. -**Kind**: instance method of [<code>MembersService</code>](#module_services.members..MembersService) -**Returns**: <code>Promise</code> - Resolves to the stats object. +**Kind**: instance method of [<code>MembersService</code>](#module_services.members..MembersService) +**Returns**: <code>Promise</code> - Resolves to the stats object. | Param | Type | | --- | --- | @@ -155,8 +157,8 @@ Gets member statistics. #### membersService.getStatsHistory(handle) ⇒ <code>Promise</code> Gets member statistics history -**Kind**: instance method of [<code>MembersService</code>](#module_services.members..MembersService) -**Returns**: <code>Promise</code> - Resolves to the stats object. +**Kind**: instance method of [<code>MembersService</code>](#module_services.members..MembersService) +**Returns**: <code>Promise</code> - Resolves to the stats object. | Param | Type | | --- | --- | @@ -167,8 +169,8 @@ Gets member statistics history #### membersService.getStatsDistribution(handle, track, subTrack) ⇒ <code>Promise</code> Gets member statistics distribution -**Kind**: instance method of [<code>MembersService</code>](#module_services.members..MembersService) -**Returns**: <code>Promise</code> - Resolves to the stats object. +**Kind**: instance method of [<code>MembersService</code>](#module_services.members..MembersService) +**Returns**: <code>Promise</code> - Resolves to the stats object. | Param | Type | | --- | --- | @@ -183,8 +185,8 @@ Gets a list of suggested member names for the supplied partial. WARNING: This method requires v3 authorization. -**Kind**: instance method of [<code>MembersService</code>](#module_services.members..MembersService) -**Returns**: <code>Promise</code> - Resolves to the api response content +**Kind**: instance method of [<code>MembersService</code>](#module_services.members..MembersService) +**Returns**: <code>Promise</code> - Resolves to the api response content | Param | Type | Description | | --- | --- | --- | @@ -195,8 +197,8 @@ WARNING: This method requires v3 authorization. #### membersService.addWebLink(userHandle, webLink) ⇒ <code>Promise</code> Adds external web link for member. -**Kind**: instance method of [<code>MembersService</code>](#module_services.members..MembersService) -**Returns**: <code>Promise</code> - Resolves to the api response content +**Kind**: instance method of [<code>MembersService</code>](#module_services.members..MembersService) +**Returns**: <code>Promise</code> - Resolves to the api response content | Param | Type | Description | | --- | --- | --- | @@ -208,8 +210,8 @@ Adds external web link for member. #### membersService.deleteWebLink(userHandle, webLinkHandle) ⇒ <code>Promise</code> Deletes external web link for member. -**Kind**: instance method of [<code>MembersService</code>](#module_services.members..MembersService) -**Returns**: <code>Promise</code> - Resolves to the api response content +**Kind**: instance method of [<code>MembersService</code>](#module_services.members..MembersService) +**Returns**: <code>Promise</code> - Resolves to the api response content | Param | Type | Description | | --- | --- | --- | @@ -221,8 +223,8 @@ Deletes external web link for member. #### membersService.addSkill(handle, skillTagId) ⇒ <code>Promise</code> Adds user skill. -**Kind**: instance method of [<code>MembersService</code>](#module_services.members..MembersService) -**Returns**: <code>Promise</code> - Resolves to operation result +**Kind**: instance method of [<code>MembersService</code>](#module_services.members..MembersService) +**Returns**: <code>Promise</code> - Resolves to operation result | Param | Type | Description | | --- | --- | --- | @@ -234,8 +236,8 @@ Adds user skill. #### membersService.hideSkill(handle, skillTagId) ⇒ <code>Promise</code> Hides user skill. -**Kind**: instance method of [<code>MembersService</code>](#module_services.members..MembersService) -**Returns**: <code>Promise</code> - Resolves to operation result +**Kind**: instance method of [<code>MembersService</code>](#module_services.members..MembersService) +**Returns**: <code>Promise</code> - Resolves to operation result | Param | Type | Description | | --- | --- | --- | @@ -247,8 +249,8 @@ Hides user skill. #### membersService.updateMemberProfile(profile) ⇒ <code>Promise</code> Updates member profile. -**Kind**: instance method of [<code>MembersService</code>](#module_services.members..MembersService) -**Returns**: <code>Promise</code> - Resolves to the api response content +**Kind**: instance method of [<code>MembersService</code>](#module_services.members..MembersService) +**Returns**: <code>Promise</code> - Resolves to the api response content | Param | Type | Description | | --- | --- | --- | @@ -259,8 +261,8 @@ Updates member profile. #### membersService.getPresignedUrl(userHandle, file) ⇒ <code>Promise</code> Gets presigned url for member photo file. -**Kind**: instance method of [<code>MembersService</code>](#module_services.members..MembersService) -**Returns**: <code>Promise</code> - Resolves to the api response content +**Kind**: instance method of [<code>MembersService</code>](#module_services.members..MembersService) +**Returns**: <code>Promise</code> - Resolves to the api response content | Param | Type | Description | | --- | --- | --- | @@ -272,8 +274,8 @@ Gets presigned url for member photo file. #### membersService.updateMemberPhoto(S3Response) ⇒ <code>Promise</code> Updates member photo. -**Kind**: instance method of [<code>MembersService</code>](#module_services.members..MembersService) -**Returns**: <code>Promise</code> - Resolves to the api response content +**Kind**: instance method of [<code>MembersService</code>](#module_services.members..MembersService) +**Returns**: <code>Promise</code> - Resolves to the api response content | Param | Type | Description | | --- | --- | --- | @@ -284,10 +286,22 @@ Updates member photo. #### membersService.uploadFileToS3(presignedUrlResponse) ⇒ <code>Promise</code> Uploads file to S3. -**Kind**: instance method of [<code>MembersService</code>](#module_services.members..MembersService) -**Returns**: <code>Promise</code> - Resolves to the api response content +**Kind**: instance method of [<code>MembersService</code>](#module_services.members..MembersService) +**Returns**: <code>Promise</code> - Resolves to the api response content | Param | Type | Description | | --- | --- | --- | | presignedUrlResponse | <code>Object</code> | The presigned url response from getPresignedUrl() function. | +<a name="module_services.members..MembersService+verifyMemberNewEmail"></a> + +#### membersService.verifyMemberNewEmail(handle, emailVerifyToken) ⇒ <code>Promise</code> +Verify member new email. + +**Kind**: instance method of [<code>MembersService</code>](#module_services.members..MembersService) +**Returns**: <code>Promise</code> - Resolves to the api response content + +| Param | Type | Description | +| --- | --- | --- | +| handle | <code>String</code> | The member handle | +| emailVerifyToken | <code>String</code> | The verify token of new email | diff --git a/src/actions/profile.js b/src/actions/profile.js index 58dc2cbf..f877b3ab 100644 --- a/src/actions/profile.js +++ b/src/actions/profile.js @@ -412,6 +412,28 @@ function updatePasswordDone(profile, tokenV3, newPassword, oldPassword) { .then(res => ({ data: res, handle: profile.handle })); } +/** + * @static + * @desc Creates an action that signals beginning of verify member new email. + * @return {Action} + */ +function verifyMemberNewEmailInit() {} + +/** + * @static + * @desc Creates an action that verify member new email. + * + * @param {Object} handle Topcoder member handle. + * @param {String} tokenV3 Topcoder auth token v3. + * @param {String} emailVerifyToken The verify token of new email. + * @return {Action} + */ +function verifyMemberNewEmailDone(handle, tokenV3, emailVerifyToken) { + const service = getMembersService(tokenV3); + return service.verifyMemberNewEmail(handle, emailVerifyToken) + .then(res => ({ data: res })); +} + export default createActions({ PROFILE: { LOAD_PROFILE: loadProfile, @@ -456,5 +478,7 @@ export default createActions({ SAVE_EMAIL_PREFERENCES_DONE: saveEmailPreferencesDone, UPDATE_PASSWORD_INIT: updatePasswordInit, UPDATE_PASSWORD_DONE: updatePasswordDone, + VERIFY_MEMBER_NEW_EMAIL_INIT: verifyMemberNewEmailInit, + VERIFY_MEMBER_NEW_EMAIL_DONE: verifyMemberNewEmailDone, }, }); diff --git a/src/reducers/profile.js b/src/reducers/profile.js index c2b1610e..c463bf10 100644 --- a/src/reducers/profile.js +++ b/src/reducers/profile.js @@ -215,11 +215,17 @@ function onUpdateProfileDone(state, { payload, error }) { if (error) { logger.error('Failed to update user profile', payload); fireErrorMessage('ERROR: Failed to update user profile!'); - return newState; + return { + ...newState, + updateProfileSuccess: false, + }; } if (!newState.info || newState.info.handle !== payload.handle) { - return newState; + return { + ...newState, + updateProfileSuccess: true, + }; } return { @@ -228,6 +234,7 @@ function onUpdateProfileDone(state, { payload, error }) { ...newState.info, ...payload, }, + updateProfileSuccess: true, }; } @@ -425,6 +432,29 @@ function onUpdatePasswordDone(state, { payload, error }) { return newState; } +/** + * Handles PROFILE/VERIFY_MEMBER_NEW_EMAIL_DONE action. + * @param {Object} state + * @param {Object} action Payload will be JSON from api call + * @return {Object} New state + */ +function onVerifyMemberNewEmailDone(state, { payload, error }) { + const newState = { ...state, verifyingEmail: false }; + + if (error) { + logger.error('Failed to verify member new email', payload); + return { + ...newState, + verifyError: true, + }; + } + + return { + ...newState, + verifyError: false, + }; +} + /** * Creates a new Profile reducer with the specified initial state. * @param {Object} initialState Optional. Initial state. @@ -477,6 +507,8 @@ function create(initialState) { [a.saveEmailPreferencesDone]: onSaveEmailPreferencesDone, [a.updatePasswordInit]: state => ({ ...state, updatingPassword: true }), [a.updatePasswordDone]: onUpdatePasswordDone, + [a.verifyMemberNewEmailInit]: state => ({ ...state, verifyingEmail: true }), + [a.verifyMemberNewEmailDone]: onVerifyMemberNewEmailDone, }, _.defaults(initialState, { achievements: null, copilot: false, @@ -485,6 +517,8 @@ function create(initialState) { loadingError: false, skills: null, stats: null, + verifyError: null, + updateProfileSuccess: null, })); } diff --git a/src/services/members.js b/src/services/members.js index 0e573dc9..84b97f56 100644 --- a/src/services/members.js +++ b/src/services/members.js @@ -202,12 +202,8 @@ class MembersService { * @return {Promise} Resolves to the api response content */ async updateMemberProfile(profile) { - const changeEmail = !!(_.get(profile, 'successUrl') || _.get(profile, 'failUrl')); - let url = `/members/${profile.handle}`; - if (changeEmail) { - url = `${url}?successUrl=${_.get(profile, 'successUrl')}&failUrl=${_.get(profile, 'failUrl')}`; - } - const res = await this.private.api.putJson(url, { param: _.omit(profile, ['successUrl', 'failUrl']) }); + const url = profile.verifyUrl ? `/members/${profile.handle}?verifyUrl=${profile.verifyUrl}` : `/members/${profile.handle}`; + const res = await this.private.api.putJson(url, { param: profile.verifyUrl ? _.omit(profile, ['verifyUrl']) : profile }); return getApiResponsePayload(res); } @@ -279,6 +275,17 @@ class MembersService { xhr.send(presignedUrlResponse.file); }); } + + /** + * Verify member new email + * @param {String} handle handle Topcoder user handle + * @param {String} emailVerifyToken The verify token of new email + * @returns {Promise} Resolves to the api response content + */ + async verifyMemberNewEmail(handle, emailVerifyToken) { + const res = await this.private.api.get(`/members/${handle}/verify?token=${emailVerifyToken}`); + return getApiResponsePayload(res); + } } let lastInstance = null;