@pageproof/sdk-pr 272.0.1603254932734 → 272.0.1603750692307
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 +8 -1
- package/lib/api/ProofsCustomTools.d.ts +6 -5
- package/lib/api/admin/Team.d.ts +7 -0
- package/lib/api/admin/Team.js +26 -14
- package/lib/api/admin/TeamCustomTools.d.ts +22 -0
- package/lib/api/admin/TeamCustomTools.js +63 -0
- package/lib/api/admin/TeamDashboardGroups.d.ts +4 -4
- package/lib/api/admin/TeamDashboardGroups.js +4 -4
- package/lib/models/Proof.d.ts +9 -1
- package/lib/models/Proof.js +1 -1
- package/lib/models/ProofGroup.d.ts +8 -0
- package/lib/models/ProofGroup.js +1 -1
- package/lib/network/endpoints.json +10 -0
- package/lib/pageproof.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,13 +1,20 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
## 2.0.0-beta.
|
|
4
|
+
## 2.0.0-beta.143
|
|
5
5
|
|
|
6
6
|
Released on the 16th of October 2020.
|
|
7
7
|
|
|
8
8
|
- [[#272](https://github.com/PageProofCom/sdk/pull/272)] Team administrators can now load their team's groups - see [TeamDashboardGroups](https://docs.pageproof.tech/@pageproof/sdk/beta/class/src/api/admin/TeamDashboardGroups.js~TeamDashboardGroups.html). The Proof model now contains the team ID, it belongs to ([Proof.teamId](https://docs.pageproof.tech/@pageproof/sdk/beta/class/src/models/Proof.js~Proof.html#instance-member-teamId))
|
|
9
9
|
|
|
10
10
|
|
|
11
|
+
## 2.0.0-beta.142
|
|
12
|
+
|
|
13
|
+
Released on the 22nd of October 2020.
|
|
14
|
+
|
|
15
|
+
- Support for team-level custom tools.
|
|
16
|
+
|
|
17
|
+
|
|
11
18
|
## 2.0.0-beta.141
|
|
12
19
|
|
|
13
20
|
Released on the 19th of October 2020.
|
|
@@ -42,16 +42,17 @@ declare class ProofsCustomTools extends API {
|
|
|
42
42
|
/**
|
|
43
43
|
* Loads the custom tools definition for a proof.
|
|
44
44
|
*
|
|
45
|
-
* @param {string} proofId
|
|
46
|
-
* @returns {any}
|
|
45
|
+
* @param {string} proofId The proof ID
|
|
46
|
+
* @returns {Promise<any>}
|
|
47
47
|
*/
|
|
48
|
-
load(proofId: string): any
|
|
48
|
+
load(proofId: string): Promise<any>;
|
|
49
49
|
/**
|
|
50
50
|
* Updates a custom tools definition for a proof.
|
|
51
51
|
*
|
|
52
|
-
* @param {string} proofId
|
|
52
|
+
* @param {string} proofId The proof ID
|
|
53
53
|
* @param {any} updates
|
|
54
|
+
* @returns {Promise<any>}
|
|
54
55
|
*/
|
|
55
|
-
update(proofId: string, updates: any): any
|
|
56
|
+
update(proofId: string, updates: any): Promise<any>;
|
|
56
57
|
}
|
|
57
58
|
import API from "./API";
|
package/lib/api/admin/Team.d.ts
CHANGED
|
@@ -44,6 +44,12 @@ declare class Team extends API {
|
|
|
44
44
|
* @type {Integrations}
|
|
45
45
|
*/
|
|
46
46
|
integrations: Integrations;
|
|
47
|
+
/**
|
|
48
|
+
* The Admin Team Custom Tools API.
|
|
49
|
+
*
|
|
50
|
+
* @type {TeamCustomTools}
|
|
51
|
+
*/
|
|
52
|
+
customTools: TeamCustomTools;
|
|
47
53
|
}
|
|
48
54
|
import API from "../API";
|
|
49
55
|
import TeamUsers from "./TeamUsers";
|
|
@@ -53,3 +59,4 @@ import TeamPreferences from "./TeamPreferences";
|
|
|
53
59
|
import TeamCustomWebhooks from "./TeamCustomWebhooks";
|
|
54
60
|
import TeamSCIM from "./TeamSCIM";
|
|
55
61
|
import Integrations from "../Integrations";
|
|
62
|
+
import TeamCustomTools from "./TeamCustomTools";
|
package/lib/api/admin/Team.js
CHANGED
|
@@ -34,6 +34,10 @@ var _Integrations = require('../Integrations');
|
|
|
34
34
|
|
|
35
35
|
var _Integrations2 = _interopRequireDefault(_Integrations);
|
|
36
36
|
|
|
37
|
+
var _TeamCustomTools = require('./TeamCustomTools');
|
|
38
|
+
|
|
39
|
+
var _TeamCustomTools2 = _interopRequireDefault(_TeamCustomTools);
|
|
40
|
+
|
|
37
41
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
38
42
|
|
|
39
43
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
@@ -53,23 +57,29 @@ var Team = function (_API) {
|
|
|
53
57
|
|
|
54
58
|
|
|
55
59
|
/**
|
|
56
|
-
* The Admin Team
|
|
60
|
+
* The Admin Team Integrations API.
|
|
57
61
|
*
|
|
58
|
-
* @type {
|
|
62
|
+
* @type {Integrations}
|
|
59
63
|
*/
|
|
60
64
|
|
|
61
65
|
|
|
62
66
|
/**
|
|
63
|
-
* The Admin
|
|
67
|
+
* The Admin Custom Webhooks API.
|
|
64
68
|
*
|
|
65
|
-
* @type {
|
|
69
|
+
* @type {TeamCustomWebhooks}
|
|
66
70
|
*/
|
|
67
71
|
|
|
68
72
|
|
|
69
73
|
/**
|
|
70
|
-
* The Admin Team
|
|
74
|
+
* The Admin Team Features API.
|
|
71
75
|
*
|
|
72
|
-
* @type {
|
|
76
|
+
* @type {TeamFeatures}
|
|
77
|
+
*/
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* The Admin Team Users API.
|
|
81
|
+
*
|
|
82
|
+
* @type {TeamUsers}
|
|
73
83
|
*/
|
|
74
84
|
function Team(client) {
|
|
75
85
|
_classCallCheck(this, Team);
|
|
@@ -84,33 +94,35 @@ var Team = function (_API) {
|
|
|
84
94
|
_this.customWebhooks = new _TeamCustomWebhooks2.default(client);
|
|
85
95
|
_this.scim = new _TeamSCIM2.default(client);
|
|
86
96
|
_this.integrations = new _Integrations2.default(client, 'team');
|
|
97
|
+
_this.customTools = new _TeamCustomTools2.default(client);
|
|
87
98
|
return _this;
|
|
88
99
|
}
|
|
89
100
|
|
|
90
101
|
/**
|
|
91
|
-
* The Admin Team
|
|
102
|
+
* The Admin Team Custom Tools API.
|
|
92
103
|
*
|
|
93
|
-
* @type {
|
|
104
|
+
* @type {TeamCustomTools}
|
|
94
105
|
*/
|
|
95
106
|
|
|
96
107
|
|
|
97
108
|
/**
|
|
98
|
-
* The Admin
|
|
109
|
+
* The Admin Team SCIM API.
|
|
99
110
|
*
|
|
100
|
-
* @type {
|
|
111
|
+
* @type {TeamSCIM}
|
|
101
112
|
*/
|
|
102
113
|
|
|
103
114
|
|
|
104
115
|
/**
|
|
105
|
-
* The Admin Team
|
|
116
|
+
* The Admin Team Preferences API.
|
|
106
117
|
*
|
|
107
|
-
* @type {
|
|
118
|
+
* @type {TeamPreferences}
|
|
108
119
|
*/
|
|
109
120
|
|
|
121
|
+
|
|
110
122
|
/**
|
|
111
|
-
* The Admin Team
|
|
123
|
+
* The Admin Team Dashboard API.
|
|
112
124
|
*
|
|
113
|
-
* @type {
|
|
125
|
+
* @type {TeamDashboard}
|
|
114
126
|
*/
|
|
115
127
|
|
|
116
128
|
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export default TeamCustomTools;
|
|
2
|
+
declare class TeamCustomTools extends API {
|
|
3
|
+
constructor(client: any);
|
|
4
|
+
/**
|
|
5
|
+
* Loads the custom tools for your team.
|
|
6
|
+
*
|
|
7
|
+
* Note: This feature is only available to enterprise teams.
|
|
8
|
+
*
|
|
9
|
+
* @returns {Promise<any>}
|
|
10
|
+
*/
|
|
11
|
+
load(): Promise<any>;
|
|
12
|
+
/**
|
|
13
|
+
* Updates a custom tools definition for your team.
|
|
14
|
+
*
|
|
15
|
+
* Note: This feature is only available to enterprise teams.
|
|
16
|
+
*
|
|
17
|
+
* @param {any} updates
|
|
18
|
+
* @returns {Promise<any>}
|
|
19
|
+
*/
|
|
20
|
+
update(updates: any): Promise<any>;
|
|
21
|
+
}
|
|
22
|
+
import API from "../API";
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
|
|
5
|
+
var _API2 = require('../API');
|
|
6
|
+
|
|
7
|
+
var _API3 = _interopRequireDefault(_API2);
|
|
8
|
+
|
|
9
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
|
+
|
|
11
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
12
|
+
|
|
13
|
+
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
|
14
|
+
|
|
15
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } /* Copyright (C) 2018 PageProof Holdings Limited - All Rights Reserved.
|
|
16
|
+
* Unauthorized copying of this file, via any medium is strictly prohibited.
|
|
17
|
+
* Proprietary and confidential.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
var TeamCustomTools = function (_API) {
|
|
22
|
+
_inherits(TeamCustomTools, _API);
|
|
23
|
+
|
|
24
|
+
function TeamCustomTools() {
|
|
25
|
+
_classCallCheck(this, TeamCustomTools);
|
|
26
|
+
|
|
27
|
+
return _possibleConstructorReturn(this, _API.apply(this, arguments));
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Loads the custom tools for your team.
|
|
32
|
+
*
|
|
33
|
+
* Note: This feature is only available to enterprise teams.
|
|
34
|
+
*
|
|
35
|
+
* @returns {Promise<any>}
|
|
36
|
+
*/
|
|
37
|
+
TeamCustomTools.prototype.load = function load() {
|
|
38
|
+
return this.client.request('admin.team.custom-tools.load').then(function (response) {
|
|
39
|
+
return response.data.tools;
|
|
40
|
+
});
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Updates a custom tools definition for your team.
|
|
45
|
+
*
|
|
46
|
+
* Note: This feature is only available to enterprise teams.
|
|
47
|
+
*
|
|
48
|
+
* @param {any} updates
|
|
49
|
+
* @returns {Promise<any>}
|
|
50
|
+
*/
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
TeamCustomTools.prototype.update = function update(updates) {
|
|
54
|
+
return this.client.request('admin.team.custom-tools.update', { updates: updates }).then(function (response) {
|
|
55
|
+
return response.data.tools;
|
|
56
|
+
});
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
return TeamCustomTools;
|
|
60
|
+
}(_API3.default);
|
|
61
|
+
|
|
62
|
+
exports.default = TeamCustomTools;
|
|
63
|
+
//# sourceMappingURL=TeamCustomTools.js.map
|
|
@@ -5,7 +5,7 @@ declare class TeamDashboardGroups extends API {
|
|
|
5
5
|
* Loads all groups info for current authenticated team dashboard, based on filter
|
|
6
6
|
*
|
|
7
7
|
* @private
|
|
8
|
-
* @since v2.0.0-beta.
|
|
8
|
+
* @since v2.0.0-beta.143
|
|
9
9
|
* @param {string} filterBy filter name for getting all groups of a user
|
|
10
10
|
* @returns {Promise}
|
|
11
11
|
*/
|
|
@@ -18,7 +18,7 @@ declare class TeamDashboardGroups extends API {
|
|
|
18
18
|
* const teamGroup = await admin.team.dashboard.groups.load('GVNM8NTI1VSTCRN5');
|
|
19
19
|
* console.log('Team's group data: ', teamGroup); // {ProofGroup}
|
|
20
20
|
*
|
|
21
|
-
* @since v2.0.0-beta.
|
|
21
|
+
* @since v2.0.0-beta.143
|
|
22
22
|
* @param {string} groupId The group id
|
|
23
23
|
* @returns {Promise<ProofGroup>}
|
|
24
24
|
*/
|
|
@@ -31,7 +31,7 @@ declare class TeamDashboardGroups extends API {
|
|
|
31
31
|
* const currentGroupsForTeam = await admin.team.dashboard.groups.current();
|
|
32
32
|
* console.log(currentGroupsForTeam); // [ProofGroup, ProofGroup, ...]
|
|
33
33
|
*
|
|
34
|
-
* @since v2.0.0-beta.
|
|
34
|
+
* @since v2.0.0-beta.143
|
|
35
35
|
* @returns {Promise<Array<ProofGroup>>}
|
|
36
36
|
*/
|
|
37
37
|
current(): Promise<any[]>;
|
|
@@ -43,7 +43,7 @@ declare class TeamDashboardGroups extends API {
|
|
|
43
43
|
* const archivedGroupsForTeam = await admin.team.dashboard.groups.archived();
|
|
44
44
|
* console.log(archivedGroupsForTeam); // [ProofGroup, ProofGroup, ...]
|
|
45
45
|
*
|
|
46
|
-
* @since v2.0.0-beta.
|
|
46
|
+
* @since v2.0.0-beta.143
|
|
47
47
|
* @returns {Promise<Array<ProofGroup>>}
|
|
48
48
|
*/
|
|
49
49
|
archived(): Promise<any[]>;
|
|
@@ -41,7 +41,7 @@ var TeamDashboardGroups = function (_API) {
|
|
|
41
41
|
* Loads all groups info for current authenticated team dashboard, based on filter
|
|
42
42
|
*
|
|
43
43
|
* @private
|
|
44
|
-
* @since v2.0.0-beta.
|
|
44
|
+
* @since v2.0.0-beta.143
|
|
45
45
|
* @param {string} filterBy filter name for getting all groups of a user
|
|
46
46
|
* @returns {Promise}
|
|
47
47
|
*/
|
|
@@ -61,7 +61,7 @@ var TeamDashboardGroups = function (_API) {
|
|
|
61
61
|
* const teamGroup = await admin.team.dashboard.groups.load('GVNM8NTI1VSTCRN5');
|
|
62
62
|
* console.log('Team's group data: ', teamGroup); // {ProofGroup}
|
|
63
63
|
*
|
|
64
|
-
* @since v2.0.0-beta.
|
|
64
|
+
* @since v2.0.0-beta.143
|
|
65
65
|
* @param {string} groupId The group id
|
|
66
66
|
* @returns {Promise<ProofGroup>}
|
|
67
67
|
*/
|
|
@@ -81,7 +81,7 @@ var TeamDashboardGroups = function (_API) {
|
|
|
81
81
|
* const currentGroupsForTeam = await admin.team.dashboard.groups.current();
|
|
82
82
|
* console.log(currentGroupsForTeam); // [ProofGroup, ProofGroup, ...]
|
|
83
83
|
*
|
|
84
|
-
* @since v2.0.0-beta.
|
|
84
|
+
* @since v2.0.0-beta.143
|
|
85
85
|
* @returns {Promise<Array<ProofGroup>>}
|
|
86
86
|
*/
|
|
87
87
|
|
|
@@ -98,7 +98,7 @@ var TeamDashboardGroups = function (_API) {
|
|
|
98
98
|
* const archivedGroupsForTeam = await admin.team.dashboard.groups.archived();
|
|
99
99
|
* console.log(archivedGroupsForTeam); // [ProofGroup, ProofGroup, ...]
|
|
100
100
|
*
|
|
101
|
-
* @since v2.0.0-beta.
|
|
101
|
+
* @since v2.0.0-beta.143
|
|
102
102
|
* @returns {Promise<Array<ProofGroup>>}
|
|
103
103
|
*/
|
|
104
104
|
|
package/lib/models/Proof.d.ts
CHANGED
|
@@ -321,10 +321,18 @@ declare class Proof {
|
|
|
321
321
|
/**
|
|
322
322
|
* The proof owner's team.
|
|
323
323
|
*
|
|
324
|
-
* @since v2.0.0-beta.
|
|
324
|
+
* @since v2.0.0-beta.143
|
|
325
325
|
* @type {string}
|
|
326
326
|
*/
|
|
327
327
|
teamId: string;
|
|
328
|
+
/**
|
|
329
|
+
* If logged in user is an admin and can access this proof
|
|
330
|
+
*
|
|
331
|
+
* @since v2.0.0-beta.143
|
|
332
|
+
* @param {User} This {@link_User} object may be subset of only these 2 properties (teamId and isAdmin)
|
|
333
|
+
* @returns {boolean}
|
|
334
|
+
*/
|
|
335
|
+
isAdminOnProofTeam(user: any): boolean;
|
|
328
336
|
/**
|
|
329
337
|
* @private
|
|
330
338
|
* @returns {string}
|
package/lib/models/Proof.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";exports.__esModule=true;var _transform=require("./transform");var _transform2=_interopRequireDefault(_transform);var _ProofState=require("../enum/ProofState");var _ProofState2=_interopRequireDefault(_ProofState);var _ProofStatus=require("../enum/ProofStatus");var _ProofStatus2=_interopRequireDefault(_ProofStatus);var _ProofType=require("../enum/ProofType");var _ProofType2=_interopRequireDefault(_ProofType);var _FileStatus=require("../enum/FileStatus");var _FileStatus2=_interopRequireDefault(_FileStatus);var _id=require("../util/id");var _getPercentage=require("../util/getPercentage");var _getPercentage2=_interopRequireDefault(_getPercentage);var _User=require("./User");var _User2=_interopRequireDefault(_User);var _DecisionSummary=require("./DecisionSummary");var _DecisionSummary2=_interopRequireDefault(_DecisionSummary);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")}}function isOverdue(){return this.dueDate&&this.dueDate.getTime()<Date.now()}var proofSchema={id:"ProofId",name:"Title",status:"Status",workflowId:"WorkflowId",version:"Version",dueDate:(0,_transform.date)("DueDate"),createdDate:(0,_transform.date)("CreateDate"),approvedDate:(0,_transform.date)("ApprovedDate"),isLocked:"Locked",isArchived:"Closed",isOverdue:isOverdue,uploaderUserId:"UserId",ownerUserIds:"OwnerIds",editorUserId:"EditorId",editorUserIds:"EditorIds",lockerUserId:"ProofLockerId",messageToReviewers:"Description",messageToOwners:"OwnerMessage",messageToEditor:"EditorMessage",fileId:"FileId",fileExtension:"Extension",fileStatus:"FileStatus",fileMessage:"FileStatusMessage",fileSize:"FileSize",pageCount:(0,_transform.number)("Pages"),commentCount:(0,_transform.number)("ParentComments"),canDownload:(0,_transform.truthy)("DownloadOriginal"),type:"Type",processStatus:"ProcessStatus",recipient:"Recipient",recipientEmail:"RecipientEmail",todoCommentCount:(0,_transform.number)("CountTodoComments"),doneCommentCount:(0,_transform.number)("CountDoneComments"),fileCategory:"FileCategory",isAdminOnProof:"IsAdminOnProof",groupId:"GroupId",canReupload:"CanReupload",hasEditors:"HasEditors",groupName:"GroupName",role:"Role",canOthersEditComments:"FeatureEditComments",hasDecisionsEnabled:"FeatureDecisions",reference:"Reference",isReferenceEnabled:"FeatureProofReference",source:"Source",owners:(0,_transform.each)("Owners",function(ownerData){return(new _User2.default).fromUser(ownerData)}),decisionSummary:(0,_transform.each)("Decisions",function(decisionsData){return(new _DecisionSummary2.default).fromDecisionSummary(decisionsData)}),tags:(0,_transform.each)("Tags",function(tag){return tag.Value}),teamId:"TeamId"};var Proof=function(){function Proof(){_classCallCheck(this,Proof)}Proof.prototype.getState=function getState(){var state=_ProofState2.default.ACTIVE;if(this.fileStatus===_FileStatus2.default.UPLOADING){state=_ProofState2.default.UPLOADING}else if(this.hasFileError()){state=_ProofState2.default.FILE_ERROR}else if(this.isProcessing()){state=_ProofState2.default.PROCESSING}else if(this.type===_ProofType2.default.BRIEF){switch(this.status){case _ProofStatus2.default.NEW:state=_ProofState2.default.SETUP_NEEDED;break;case _ProofStatus2.default.PROOFING:state=_ProofState2.default.BRIEFING;break;case _ProofStatus2.default.AWAITING_NEW_VERSION:state=_ProofState2.default.AWAITING_PROOF;break;case _ProofStatus2.default.HAS_NEW_VERSION:state=_ProofState2.default.HAS_NEW_VERSION;break;case _ProofStatus2.default.ARCHIVED:state=_ProofState2.default.ARCHIVED;break}}else if(this.status===_ProofStatus2.default.ARCHIVED){state=_ProofState2.default.ARCHIVED}else if(this.status===_ProofStatus2.default.TODOS_REQUESTED){state=_ProofState2.default.TODOS_REQUESTED}else if(this.status===_ProofStatus2.default.AWAITING_NEW_VERSION){state=_ProofState2.default.AWAITING_NEW_VERSION}else if(this.status===_ProofStatus2.default.HAS_NEW_VERSION){state=_ProofState2.default.HAS_NEW_VERSION}else if(this.status===_ProofStatus2.default.APPROVED){state=_ProofState2.default.APPROVED}else if(!this.hasWorkflow()){state=_ProofState2.default.PROOFERS_NEEDED}else if(!this.hasWorkflowStarted()){state=_ProofState2.default.NOT_STARTED}else if(this.isOverdue){state=_ProofState2.default.OVERDUE}return state};Proof.prototype.getVideoProcessingProgress=function getVideoProcessingProgress(){var percent=0;var message=String(this.fileMessage);if(message){var thumbMatch=/^Thumb-\w+\-([-+]?[0-9]*\.?[0-9]*)/g.exec(message);var videoMatch=/^Video-\w+\-([-+]?[0-9]*\.?[0-9]*)/g.exec(message);if(message.startsWith("Video-Scheduled-")){percent=0}else if(videoMatch){percent=(0,_getPercentage2.default)(parseFloat(videoMatch[1])/100,0,.2)}else if(thumbMatch){percent=(0,_getPercentage2.default)(parseFloat(thumbMatch[1])/100,.8,0)}}return percent};Proof.prototype.hasWorkflowStarted=function hasWorkflowStarted(){return this.hasWorkflow()&&this.status!==_ProofStatus2.default.NEW};Proof.prototype.isProcessing=function isProcessing(){return this.fileStatus===_FileStatus2.default.UPLOADING||this.fileStatus===_FileStatus2.default.QUEUED||this.fileStatus===_FileStatus2.default.RIPPING};Proof.prototype.isAwaitingFile=function isAwaitingFile(){return this.source&&this.fileStatus===_FileStatus2.default.CREATED};Proof.prototype.getProcessingProgress=function getProcessingProgress(){switch(this.fileStatus){case _FileStatus2.default.UPLOADING:return.1;case _FileStatus2.default.QUEUED:return.2;case _FileStatus2.default.RIPPING:if(this.fileCategory==="video"){return(0,_getPercentage2.default)(this.getVideoProcessingProgress(),.2,.1).toFixed(2)}return.6;default:return-1}};Proof.prototype.hasWorkflow=function hasWorkflow(){return(0,_id.isWorkflowId)(this.workflowId)};Proof.prototype.hasFile=function hasFile(){return(0,_id.isFileId)(this.fileId)};Proof.prototype.hasFileError=function hasFileError(){return this.fileStatus===_FileStatus2.default.ERROR||!this.fileStatus||!this.hasFile()};Proof.prototype.hasEditor=function hasEditor(){return(0,_id.isUserId)(this.editorUserId)};Proof.prototype.hasThumbnail=function hasThumbnail(){return this.fileStatus===_FileStatus2.default.OK};Proof.prototype.canUserUploadNewVersion=function canUserUploadNewVersion(userId){return this.getState()===_ProofState2.default.AWAITING_NEW_VERSION&&(this.isEditor(userId)||this.isOwner(userId))||this.getState()===_ProofState2.default.AWAITING_PROOF&&(this.isEditor(userId)||this.isRecipient(userId))};Proof.prototype.isOwner=function isOwner(userId){return this.ownerUserIds.indexOf(userId)!==-1};Proof.prototype.isEditor=function isEditor(userId){return this.editorUserIds.indexOf(userId)!==-1};Proof.prototype.isRecipient=function isRecipient(userId){return this.recipient===userId};Proof.prototype.calculateState=function calculateState(){this.state=this.getState()};Proof.prototype.fromProof=function fromProof(proofData){(0,_transform2.default)(this,proofSchema,proofData);this.calculateState();return this};return Proof}();exports.default=Proof;
|
|
1
|
+
"use strict";exports.__esModule=true;var _transform=require("./transform");var _transform2=_interopRequireDefault(_transform);var _ProofState=require("../enum/ProofState");var _ProofState2=_interopRequireDefault(_ProofState);var _ProofStatus=require("../enum/ProofStatus");var _ProofStatus2=_interopRequireDefault(_ProofStatus);var _ProofType=require("../enum/ProofType");var _ProofType2=_interopRequireDefault(_ProofType);var _FileStatus=require("../enum/FileStatus");var _FileStatus2=_interopRequireDefault(_FileStatus);var _id=require("../util/id");var _getPercentage=require("../util/getPercentage");var _getPercentage2=_interopRequireDefault(_getPercentage);var _User=require("./User");var _User2=_interopRequireDefault(_User);var _DecisionSummary=require("./DecisionSummary");var _DecisionSummary2=_interopRequireDefault(_DecisionSummary);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")}}function isOverdue(){return this.dueDate&&this.dueDate.getTime()<Date.now()}var proofSchema={id:"ProofId",name:"Title",status:"Status",workflowId:"WorkflowId",version:"Version",dueDate:(0,_transform.date)("DueDate"),createdDate:(0,_transform.date)("CreateDate"),approvedDate:(0,_transform.date)("ApprovedDate"),isLocked:"Locked",isArchived:"Closed",isOverdue:isOverdue,uploaderUserId:"UserId",ownerUserIds:"OwnerIds",editorUserId:"EditorId",editorUserIds:"EditorIds",lockerUserId:"ProofLockerId",messageToReviewers:"Description",messageToOwners:"OwnerMessage",messageToEditor:"EditorMessage",fileId:"FileId",fileExtension:"Extension",fileStatus:"FileStatus",fileMessage:"FileStatusMessage",fileSize:"FileSize",pageCount:(0,_transform.number)("Pages"),commentCount:(0,_transform.number)("ParentComments"),canDownload:(0,_transform.truthy)("DownloadOriginal"),type:"Type",processStatus:"ProcessStatus",recipient:"Recipient",recipientEmail:"RecipientEmail",todoCommentCount:(0,_transform.number)("CountTodoComments"),doneCommentCount:(0,_transform.number)("CountDoneComments"),fileCategory:"FileCategory",isAdminOnProof:"IsAdminOnProof",groupId:"GroupId",canReupload:"CanReupload",hasEditors:"HasEditors",groupName:"GroupName",role:"Role",canOthersEditComments:"FeatureEditComments",hasDecisionsEnabled:"FeatureDecisions",reference:"Reference",isReferenceEnabled:"FeatureProofReference",source:"Source",owners:(0,_transform.each)("Owners",function(ownerData){return(new _User2.default).fromUser(ownerData)}),decisionSummary:(0,_transform.each)("Decisions",function(decisionsData){return(new _DecisionSummary2.default).fromDecisionSummary(decisionsData)}),tags:(0,_transform.each)("Tags",function(tag){return tag.Value}),teamId:"TeamId"};var Proof=function(){function Proof(){_classCallCheck(this,Proof)}Proof.prototype.isAdminOnProofTeam=function isAdminOnProofTeam(user){console.debug("i m here canadmin access proof",user);return user.isAdmin&&this.teamId===user.teamId};Proof.prototype.getState=function getState(){var state=_ProofState2.default.ACTIVE;if(this.fileStatus===_FileStatus2.default.UPLOADING){state=_ProofState2.default.UPLOADING}else if(this.hasFileError()){state=_ProofState2.default.FILE_ERROR}else if(this.isProcessing()){state=_ProofState2.default.PROCESSING}else if(this.type===_ProofType2.default.BRIEF){switch(this.status){case _ProofStatus2.default.NEW:state=_ProofState2.default.SETUP_NEEDED;break;case _ProofStatus2.default.PROOFING:state=_ProofState2.default.BRIEFING;break;case _ProofStatus2.default.AWAITING_NEW_VERSION:state=_ProofState2.default.AWAITING_PROOF;break;case _ProofStatus2.default.HAS_NEW_VERSION:state=_ProofState2.default.HAS_NEW_VERSION;break;case _ProofStatus2.default.ARCHIVED:state=_ProofState2.default.ARCHIVED;break}}else if(this.status===_ProofStatus2.default.ARCHIVED){state=_ProofState2.default.ARCHIVED}else if(this.status===_ProofStatus2.default.TODOS_REQUESTED){state=_ProofState2.default.TODOS_REQUESTED}else if(this.status===_ProofStatus2.default.AWAITING_NEW_VERSION){state=_ProofState2.default.AWAITING_NEW_VERSION}else if(this.status===_ProofStatus2.default.HAS_NEW_VERSION){state=_ProofState2.default.HAS_NEW_VERSION}else if(this.status===_ProofStatus2.default.APPROVED){state=_ProofState2.default.APPROVED}else if(!this.hasWorkflow()){state=_ProofState2.default.PROOFERS_NEEDED}else if(!this.hasWorkflowStarted()){state=_ProofState2.default.NOT_STARTED}else if(this.isOverdue){state=_ProofState2.default.OVERDUE}return state};Proof.prototype.getVideoProcessingProgress=function getVideoProcessingProgress(){var percent=0;var message=String(this.fileMessage);if(message){var thumbMatch=/^Thumb-\w+\-([-+]?[0-9]*\.?[0-9]*)/g.exec(message);var videoMatch=/^Video-\w+\-([-+]?[0-9]*\.?[0-9]*)/g.exec(message);if(message.startsWith("Video-Scheduled-")){percent=0}else if(videoMatch){percent=(0,_getPercentage2.default)(parseFloat(videoMatch[1])/100,0,.2)}else if(thumbMatch){percent=(0,_getPercentage2.default)(parseFloat(thumbMatch[1])/100,.8,0)}}return percent};Proof.prototype.hasWorkflowStarted=function hasWorkflowStarted(){return this.hasWorkflow()&&this.status!==_ProofStatus2.default.NEW};Proof.prototype.isProcessing=function isProcessing(){return this.fileStatus===_FileStatus2.default.UPLOADING||this.fileStatus===_FileStatus2.default.QUEUED||this.fileStatus===_FileStatus2.default.RIPPING};Proof.prototype.isAwaitingFile=function isAwaitingFile(){return this.source&&this.fileStatus===_FileStatus2.default.CREATED};Proof.prototype.getProcessingProgress=function getProcessingProgress(){switch(this.fileStatus){case _FileStatus2.default.UPLOADING:return.1;case _FileStatus2.default.QUEUED:return.2;case _FileStatus2.default.RIPPING:if(this.fileCategory==="video"){return(0,_getPercentage2.default)(this.getVideoProcessingProgress(),.2,.1).toFixed(2)}return.6;default:return-1}};Proof.prototype.hasWorkflow=function hasWorkflow(){return(0,_id.isWorkflowId)(this.workflowId)};Proof.prototype.hasFile=function hasFile(){return(0,_id.isFileId)(this.fileId)};Proof.prototype.hasFileError=function hasFileError(){return this.fileStatus===_FileStatus2.default.ERROR||!this.fileStatus||!this.hasFile()};Proof.prototype.hasEditor=function hasEditor(){return(0,_id.isUserId)(this.editorUserId)};Proof.prototype.hasThumbnail=function hasThumbnail(){return this.fileStatus===_FileStatus2.default.OK};Proof.prototype.canUserUploadNewVersion=function canUserUploadNewVersion(userId){return this.getState()===_ProofState2.default.AWAITING_NEW_VERSION&&(this.isEditor(userId)||this.isOwner(userId))||this.getState()===_ProofState2.default.AWAITING_PROOF&&(this.isEditor(userId)||this.isRecipient(userId))};Proof.prototype.isOwner=function isOwner(userId){return this.ownerUserIds.indexOf(userId)!==-1};Proof.prototype.isEditor=function isEditor(userId){return this.editorUserIds.indexOf(userId)!==-1};Proof.prototype.isRecipient=function isRecipient(userId){return this.recipient===userId};Proof.prototype.calculateState=function calculateState(){this.state=this.getState()};Proof.prototype.fromProof=function fromProof(proofData){(0,_transform2.default)(this,proofSchema,proofData);this.calculateState();return this};return Proof}();exports.default=Proof;
|
|
@@ -66,6 +66,14 @@ declare class ProofGroup {
|
|
|
66
66
|
* @type {string}
|
|
67
67
|
*/
|
|
68
68
|
createdBy: string;
|
|
69
|
+
/**
|
|
70
|
+
* If logged in user is an admin and can access this group
|
|
71
|
+
*
|
|
72
|
+
* @since v2.0.0-beta.143
|
|
73
|
+
* @param {User} This {@link_User} object may be subset of only these 2 properties (teamId and isAdmin)
|
|
74
|
+
* @returns {boolean}
|
|
75
|
+
*/
|
|
76
|
+
isAdminOnGroupTeam(user: any): boolean;
|
|
69
77
|
/**
|
|
70
78
|
* @private
|
|
71
79
|
*/
|
package/lib/models/ProofGroup.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";exports.__esModule=true;var _transform=require("./transform");var _transform2=_interopRequireDefault(_transform);var _Proof=require("./Proof");var _Proof2=_interopRequireDefault(_Proof);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 proofGroupSchema={canAddProofs:"CanAddProofs",id:"GroupId",name:"Name",isEmpty:"IsEmpty",isArchived:"Archived",teamId:"TeamId",createdBy:"CreatedBy",isOwnedByTeam:"OwnedByTeam",proofs:(0,_transform.each)("ProofInfo",function(proofData){return(new _Proof2.default).fromProof(proofData)})};var ProofGroup=function(){function ProofGroup(){_classCallCheck(this,ProofGroup)}ProofGroup.prototype.fromProofGroup=function fromProofGroup(proofGroupData){(0,_transform2.default)(this,proofGroupSchema,proofGroupData);return this};return ProofGroup}();exports.default=ProofGroup;
|
|
1
|
+
"use strict";exports.__esModule=true;var _transform=require("./transform");var _transform2=_interopRequireDefault(_transform);var _Proof=require("./Proof");var _Proof2=_interopRequireDefault(_Proof);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 proofGroupSchema={canAddProofs:"CanAddProofs",id:"GroupId",name:"Name",isEmpty:"IsEmpty",isArchived:"Archived",teamId:"TeamId",createdBy:"CreatedBy",isOwnedByTeam:"OwnedByTeam",proofs:(0,_transform.each)("ProofInfo",function(proofData){return(new _Proof2.default).fromProof(proofData)})};var ProofGroup=function(){function ProofGroup(){_classCallCheck(this,ProofGroup)}ProofGroup.prototype.isAdminOnGroupTeam=function isAdminOnGroupTeam(user){console.debug("i m here canadmin access group",user);return user.isAdmin&&this.teamId===user.teamId};ProofGroup.prototype.fromProofGroup=function fromProofGroup(proofGroupData){(0,_transform2.default)(this,proofGroupSchema,proofGroupData);return this};return ProofGroup}();exports.default=ProofGroup;
|
|
@@ -756,6 +756,16 @@
|
|
|
756
756
|
"path": "/api/admin/preferences/notifications/set",
|
|
757
757
|
"body": ["ownerAddedByAdmin"]
|
|
758
758
|
},
|
|
759
|
+
"admin.team.custom-tools.load": {
|
|
760
|
+
"method": "GET",
|
|
761
|
+
"path": "/api/custom-tools/admin/team"
|
|
762
|
+
},
|
|
763
|
+
"admin.team.custom-tools.update": {
|
|
764
|
+
"version": 2,
|
|
765
|
+
"method": "PATCH",
|
|
766
|
+
"path": "/api/custom-tools/admin/team",
|
|
767
|
+
"body": "updates"
|
|
768
|
+
},
|
|
759
769
|
"sessions.check": {
|
|
760
770
|
"method": "GET",
|
|
761
771
|
"path": "/api/sessions/check"
|