@pageproof/sdk-pr 212.0.1571007785424 → 212.0.1571268337792
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/lib/api/admin/Team.js +29 -0
- package/lib/api/admin/TeamUsers.js +22 -5
- package/lib/models/Teams.js +1 -0
- package/lib/network/endpoints.json +6 -0
- package/lib/pageproof.js +1 -1
- package/lib/util/Scheduler.js +1 -1
- package/lib/worker-crypto-adapter.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/lib/api/admin/Team.js
CHANGED
|
@@ -22,6 +22,10 @@ var _TeamCustomWebhooks = require('./TeamCustomWebhooks');
|
|
|
22
22
|
|
|
23
23
|
var _TeamCustomWebhooks2 = _interopRequireDefault(_TeamCustomWebhooks);
|
|
24
24
|
|
|
25
|
+
var _Teams = require('../../models/Teams');
|
|
26
|
+
|
|
27
|
+
var _Teams2 = _interopRequireDefault(_Teams);
|
|
28
|
+
|
|
25
29
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
26
30
|
|
|
27
31
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
@@ -64,6 +68,19 @@ var Team = function (_API) {
|
|
|
64
68
|
return _this;
|
|
65
69
|
}
|
|
66
70
|
|
|
71
|
+
/**
|
|
72
|
+
* Loads the team data for anonymous user, who have got invitation to join a team.
|
|
73
|
+
*
|
|
74
|
+
* @example <caption>Load team data by anonymous user</caption>
|
|
75
|
+
* const teams = await client.team.load('<token>', 'inviteduser@mail.com')
|
|
76
|
+
*
|
|
77
|
+
* @since v2.0.0-beta.101
|
|
78
|
+
* @param {string} token The token send in inviting email
|
|
79
|
+
* @param {string} email The user email who got invitation
|
|
80
|
+
* @returns {Promise}
|
|
81
|
+
*/
|
|
82
|
+
|
|
83
|
+
|
|
67
84
|
/**
|
|
68
85
|
* The Admin Custom Webhooks API.
|
|
69
86
|
*
|
|
@@ -78,6 +95,18 @@ var Team = function (_API) {
|
|
|
78
95
|
*/
|
|
79
96
|
|
|
80
97
|
|
|
98
|
+
Team.prototype.load = function load(token, email) {
|
|
99
|
+
return this.client.request('team.info.load', {
|
|
100
|
+
token: token,
|
|
101
|
+
email: email
|
|
102
|
+
}).then(function (response) {
|
|
103
|
+
if (response.data) {
|
|
104
|
+
return new _Teams2.default().fromTeams(response.data);
|
|
105
|
+
}
|
|
106
|
+
return null;
|
|
107
|
+
});
|
|
108
|
+
};
|
|
109
|
+
|
|
81
110
|
return Team;
|
|
82
111
|
}(_API3.default);
|
|
83
112
|
|
|
@@ -10,6 +10,10 @@ var _User = require('../../models/User');
|
|
|
10
10
|
|
|
11
11
|
var _User2 = _interopRequireDefault(_User);
|
|
12
12
|
|
|
13
|
+
var _Accounts = require('../Accounts');
|
|
14
|
+
|
|
15
|
+
var _Accounts2 = _interopRequireDefault(_Accounts);
|
|
16
|
+
|
|
13
17
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
18
|
|
|
15
19
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
@@ -32,18 +36,22 @@ function transformResponseUsers(response) {
|
|
|
32
36
|
var TeamUsers = function (_API) {
|
|
33
37
|
_inherits(TeamUsers, _API);
|
|
34
38
|
|
|
35
|
-
function TeamUsers() {
|
|
39
|
+
function TeamUsers(client) {
|
|
36
40
|
_classCallCheck(this, TeamUsers);
|
|
37
41
|
|
|
38
|
-
|
|
39
|
-
}
|
|
42
|
+
var _this = _possibleConstructorReturn(this, _API.call(this, client));
|
|
40
43
|
|
|
44
|
+
_this.accounts = new _Accounts2.default(client);
|
|
45
|
+
return _this;
|
|
46
|
+
}
|
|
41
47
|
/**
|
|
42
48
|
* Retrieves a list of all enabled ("active") users in your team.
|
|
43
49
|
*
|
|
44
50
|
* @since v2.0.0-beta.13
|
|
45
51
|
* @returns {Promise<User>}
|
|
46
52
|
*/
|
|
53
|
+
|
|
54
|
+
|
|
47
55
|
TeamUsers.prototype.enabled = function enabled() {
|
|
48
56
|
return this.client.request('admin.team.users.enabled').then(transformResponseUsers);
|
|
49
57
|
};
|
|
@@ -169,7 +177,7 @@ var TeamUsers = function (_API) {
|
|
|
169
177
|
var passwordHash = _ref3[0],
|
|
170
178
|
keyPair = _ref3[1],
|
|
171
179
|
privateKeyPEM$ = _ref3[2];
|
|
172
|
-
return _this3.client.request('team.users.invite.accept', {
|
|
180
|
+
return Promise.all([keyPair, _this3.client.request('team.users.invite.accept', {
|
|
173
181
|
email: email,
|
|
174
182
|
authCode: authCode,
|
|
175
183
|
token: token,
|
|
@@ -177,7 +185,16 @@ var TeamUsers = function (_API) {
|
|
|
177
185
|
privateKey: privateKeyPEM$,
|
|
178
186
|
publicKey: keyPair.publicKeyPEM,
|
|
179
187
|
isTemp: isTemp
|
|
180
|
-
});
|
|
188
|
+
})]);
|
|
189
|
+
}).then(function (_ref4) {
|
|
190
|
+
var keyPair = _ref4[0];
|
|
191
|
+
return Promise.all([keyPair, _this3.accounts.login(email, password, false)]);
|
|
192
|
+
}).then(function (_ref5) {
|
|
193
|
+
var keyPair = _ref5[0],
|
|
194
|
+
session = _ref5[1];
|
|
195
|
+
|
|
196
|
+
session.privateKeyPEM = keyPair.privateKeyPEM;
|
|
197
|
+
return session;
|
|
181
198
|
});
|
|
182
199
|
} else {
|
|
183
200
|
return this.client.request('team.users.invite.accept', {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";exports.__esModule=true;var _transform=require("./transform");var _transform2=_interopRequireDefault(_transform);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}var teamSchema={teamId:"TeamId",name:"Name",logo:"Logo"};var Teams=function(){function Teams(){_classCallCheck(this,Teams)}Teams.prototype.fromTeams=function fromTeams(teamData){(0,_transform2.default)(this,teamSchema,teamData);return this};return Teams}();exports.default=Teams;
|
|
@@ -614,6 +614,12 @@
|
|
|
614
614
|
"body": ["email", "token", "authCode", "password", "isTemp", "publicKey", "privateKey"],
|
|
615
615
|
"anonymous": true
|
|
616
616
|
},
|
|
617
|
+
"team.info.load": {
|
|
618
|
+
"method": "POST",
|
|
619
|
+
"path": "/api/teams/info/",
|
|
620
|
+
"body": ["email", "token"],
|
|
621
|
+
"anonymous": true
|
|
622
|
+
},
|
|
617
623
|
"admin.team.features.load": {
|
|
618
624
|
"method": "GET",
|
|
619
625
|
"path": "/api/admin/settings",
|