@pageproof/sdk-pr 272.0.1600399572806 → 272.0.1600407431256
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/ProofsGroups.d.ts +4 -2
- package/lib/api/ProofsGroups.js +1 -1
- package/lib/api/admin/TeamDashboardGroups.d.ts +4 -4
- package/lib/api/admin/TeamDashboardGroups.js +4 -4
- package/lib/models/Proof.d.ts +7 -0
- package/lib/models/Proof.js +1 -1
- package/lib/models/ProofGroup.d.ts +23 -1
- package/lib/models/ProofGroup.js +1 -1
- package/lib/models/User.d.ts +7 -0
- package/lib/models/User.js +1 -1
- package/lib/network/endpoints.json +2 -2
- package/lib/pageproof.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 2.0.0-beta.138
|
|
4
|
+
|
|
5
|
+
Released on the 18th of September 2020.
|
|
6
|
+
|
|
7
|
+
- [[#274](https://github.com/PageProofCom/sdk/pull/274)] Support for sharing a group with team. See [ProofGroup.isOwnedByTeam](https://docs.pageproof.tech/@pageproof/sdk/beta/class/src/models/ProofGroup.js~ProofGroup.html#instance-member-isOwnedByTeam) [ProofsGroups.create](https://docs.pageproof.tech/@pageproof/sdk/beta/class/src/api/ProofsGroups.js~ProofsGroups.html#instance-method-create) [ProofsGroups.update](https://docs.pageproof.tech/@pageproof/sdk/beta/class/src/api/ProofsGroups.js~ProofsGroups.html#instance-method-update)
|
|
8
|
+
|
|
3
9
|
## 2.0.0-beta.137
|
|
4
10
|
|
|
5
11
|
Released on the 10th of September 2020.
|
|
@@ -20,9 +20,10 @@ declare class ProofsGroups extends API {
|
|
|
20
20
|
* @since v2.0.0-beta.31
|
|
21
21
|
* @param {object} [option]
|
|
22
22
|
* @param {string} [options.name] An optional name of the group
|
|
23
|
+
* @param {string} [options.isOwnedByTeam] Whether the group should belong to your team
|
|
23
24
|
* @returns {Promise<ProofGroup>}
|
|
24
25
|
*/
|
|
25
|
-
create({ name, }?: any): Promise<ProofGroup>;
|
|
26
|
+
create({ name, isOwnedByTeam, }?: any): Promise<ProofGroup>;
|
|
26
27
|
/**
|
|
27
28
|
* Loads a single proof group by id.
|
|
28
29
|
*
|
|
@@ -47,9 +48,10 @@ declare class ProofsGroups extends API {
|
|
|
47
48
|
* @param {string} groupId The group id
|
|
48
49
|
* @param {object} [option]
|
|
49
50
|
* @param {string} [options.name] The name of the group to update
|
|
51
|
+
* @param {string} [options.isOwnedByTeam] If group can be shared with team
|
|
50
52
|
* @returns {Promise<ProofGroup>}
|
|
51
53
|
*/
|
|
52
|
-
update(groupId: string, { name }?: any): Promise<ProofGroup>;
|
|
54
|
+
update(groupId: string, { name, isOwnedByTeam, }?: any): Promise<ProofGroup>;
|
|
53
55
|
/**
|
|
54
56
|
* Removes a proof from a group.
|
|
55
57
|
*
|
package/lib/api/ProofsGroups.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";exports.__esModule=true;var _API2=require("./API");var _API3=_interopRequireDefault(_API2);var _ProofGroup=require("../models/ProofGroup");var _ProofGroup2=_interopRequireDefault(_ProofGroup);var _GroupsOwners=require("./GroupsOwners");var _GroupsOwners2=_interopRequireDefault(_GroupsOwners);var _GroupsWorkflows=require("./GroupsWorkflows");var _GroupsWorkflows2=_interopRequireDefault(_GroupsWorkflows);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 _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}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}function mapResponseToGroup(response){return(new _ProofGroup2.default).fromProofGroup(response.data)}var ProofsGroups=function(_API){_inherits(ProofsGroups,_API);function ProofsGroups(client){_classCallCheck(this,ProofsGroups);var _this=_possibleConstructorReturn(this,_API.call(this,client));_this.owners=new _GroupsOwners2.default(client);_this.workflows=new _GroupsWorkflows2.default(client);return _this}ProofsGroups.prototype.create=function create(){var _ref=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{},name=_ref.name;return this.client.request("proofs.groups.create",{name:name}).then(mapResponseToGroup)};ProofsGroups.prototype.load=function load(groupId){return this.client.request("proofs.groups.load",{groupId:groupId}).then(mapResponseToGroup)};ProofsGroups.prototype.ready=function ready(groupId){return this.client.request("proofs.groups.ready",{groupId:groupId})};ProofsGroups.prototype.update=function update(groupId,_ref2){var name=_ref2.name;return this.client.request("proofs.groups.update",{groupId:groupId,name:name}).then(mapResponseToGroup)};ProofsGroups.prototype.removeProof=function removeProof(proofId){return this.client.request("proofs.groups.remove-proof",{proofId:proofId})};ProofsGroups.prototype.addProof=function addProof(groupId,proofId){return this.client.request("proofs.groups.add-proof",{groupId:groupId,proofId:proofId})};ProofsGroups.prototype.delete=function _delete(groupId){return this.client.request("proofs.groups.delete",{groupId:groupId})};ProofsGroups.prototype.archive=function archive(){for(var _len=arguments.length,groupIds=Array(_len),_key=0;_key<_len;_key++){groupIds[_key]=arguments[_key]}return this.client.request("proofs.groups.archive",{groupIds:groupIds})};ProofsGroups.prototype.reopen=function reopen(){for(var _len2=arguments.length,groupIds=Array(_len2),_key2=0;_key2<_len2;_key2++){groupIds[_key2]=arguments[_key2]}return this.client.request("proofs.groups.reopen",{groupIds:groupIds})};return ProofsGroups}(_API3.default);exports.default=ProofsGroups;
|
|
1
|
+
"use strict";exports.__esModule=true;var _API2=require("./API");var _API3=_interopRequireDefault(_API2);var _ProofGroup=require("../models/ProofGroup");var _ProofGroup2=_interopRequireDefault(_ProofGroup);var _GroupsOwners=require("./GroupsOwners");var _GroupsOwners2=_interopRequireDefault(_GroupsOwners);var _GroupsWorkflows=require("./GroupsWorkflows");var _GroupsWorkflows2=_interopRequireDefault(_GroupsWorkflows);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 _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}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}function mapResponseToGroup(response){return(new _ProofGroup2.default).fromProofGroup(response.data)}var ProofsGroups=function(_API){_inherits(ProofsGroups,_API);function ProofsGroups(client){_classCallCheck(this,ProofsGroups);var _this=_possibleConstructorReturn(this,_API.call(this,client));_this.owners=new _GroupsOwners2.default(client);_this.workflows=new _GroupsWorkflows2.default(client);return _this}ProofsGroups.prototype.create=function create(){var _ref=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{},name=_ref.name,isOwnedByTeam=_ref.isOwnedByTeam;return this.client.request("proofs.groups.create",{name:name,ownedByTeam:isOwnedByTeam}).then(mapResponseToGroup)};ProofsGroups.prototype.load=function load(groupId){return this.client.request("proofs.groups.load",{groupId:groupId}).then(mapResponseToGroup)};ProofsGroups.prototype.ready=function ready(groupId){return this.client.request("proofs.groups.ready",{groupId:groupId})};ProofsGroups.prototype.update=function update(groupId,_ref2){var name=_ref2.name,isOwnedByTeam=_ref2.isOwnedByTeam;return this.client.request("proofs.groups.update",{groupId:groupId,name:name,ownedByTeam:isOwnedByTeam}).then(mapResponseToGroup)};ProofsGroups.prototype.removeProof=function removeProof(proofId){return this.client.request("proofs.groups.remove-proof",{proofId:proofId})};ProofsGroups.prototype.addProof=function addProof(groupId,proofId){return this.client.request("proofs.groups.add-proof",{groupId:groupId,proofId:proofId})};ProofsGroups.prototype.delete=function _delete(groupId){return this.client.request("proofs.groups.delete",{groupId:groupId})};ProofsGroups.prototype.archive=function archive(){for(var _len=arguments.length,groupIds=Array(_len),_key=0;_key<_len;_key++){groupIds[_key]=arguments[_key]}return this.client.request("proofs.groups.archive",{groupIds:groupIds})};ProofsGroups.prototype.reopen=function reopen(){for(var _len2=arguments.length,groupIds=Array(_len2),_key2=0;_key2<_len2;_key2++){groupIds[_key2]=arguments[_key2]}return this.client.request("proofs.groups.reopen",{groupIds:groupIds})};return ProofsGroups}(_API3.default);exports.default=ProofsGroups;
|
|
@@ -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.139
|
|
9
9
|
* @param {string} filterBy filter name for getting all groups of a user
|
|
10
10
|
* @returns {Promise}
|
|
11
11
|
*/
|
|
@@ -17,7 +17,7 @@ declare class TeamDashboardGroups extends API {
|
|
|
17
17
|
* const admin = await client.admin();
|
|
18
18
|
* await admin.team.dashboard.groups.load('GVNM8NTI1VSTCRN5');
|
|
19
19
|
*
|
|
20
|
-
* @since v2.0.0-beta.
|
|
20
|
+
* @since v2.0.0-beta.139
|
|
21
21
|
* @param {string} groupId The group id
|
|
22
22
|
* @returns {Promise<ProofGroup>}
|
|
23
23
|
*/
|
|
@@ -29,7 +29,7 @@ declare class TeamDashboardGroups extends API {
|
|
|
29
29
|
* const admin = await client.admin();
|
|
30
30
|
* const currentGroupsForTeam = await admin.team.dashboard.groups.current();
|
|
31
31
|
*
|
|
32
|
-
* @since v2.0.0-beta.
|
|
32
|
+
* @since v2.0.0-beta.139
|
|
33
33
|
* @returns {Promise<Array<ProofGroup>>}
|
|
34
34
|
*/
|
|
35
35
|
current(): Promise<any[]>;
|
|
@@ -40,7 +40,7 @@ declare class TeamDashboardGroups extends API {
|
|
|
40
40
|
* const admin = await client.admin();
|
|
41
41
|
* const archivedGroupsForTeam = await admin.team.dashboard.groups.archived();
|
|
42
42
|
*
|
|
43
|
-
* @since v2.0.0-beta.
|
|
43
|
+
* @since v2.0.0-beta.139
|
|
44
44
|
* @returns {Promise<Array<ProofGroup>>}
|
|
45
45
|
*/
|
|
46
46
|
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.139
|
|
45
45
|
* @param {string} filterBy filter name for getting all groups of a user
|
|
46
46
|
* @returns {Promise}
|
|
47
47
|
*/
|
|
@@ -60,7 +60,7 @@ var TeamDashboardGroups = function (_API) {
|
|
|
60
60
|
* const admin = await client.admin();
|
|
61
61
|
* await admin.team.dashboard.groups.load('GVNM8NTI1VSTCRN5');
|
|
62
62
|
*
|
|
63
|
-
* @since v2.0.0-beta.
|
|
63
|
+
* @since v2.0.0-beta.139
|
|
64
64
|
* @param {string} groupId The group id
|
|
65
65
|
* @returns {Promise<ProofGroup>}
|
|
66
66
|
*/
|
|
@@ -79,7 +79,7 @@ var TeamDashboardGroups = function (_API) {
|
|
|
79
79
|
* const admin = await client.admin();
|
|
80
80
|
* const currentGroupsForTeam = await admin.team.dashboard.groups.current();
|
|
81
81
|
*
|
|
82
|
-
* @since v2.0.0-beta.
|
|
82
|
+
* @since v2.0.0-beta.139
|
|
83
83
|
* @returns {Promise<Array<ProofGroup>>}
|
|
84
84
|
*/
|
|
85
85
|
|
|
@@ -95,7 +95,7 @@ var TeamDashboardGroups = function (_API) {
|
|
|
95
95
|
* const admin = await client.admin();
|
|
96
96
|
* const archivedGroupsForTeam = await admin.team.dashboard.groups.archived();
|
|
97
97
|
*
|
|
98
|
-
* @since v2.0.0-beta.
|
|
98
|
+
* @since v2.0.0-beta.139
|
|
99
99
|
* @returns {Promise<Array<ProofGroup>>}
|
|
100
100
|
*/
|
|
101
101
|
|
package/lib/models/Proof.d.ts
CHANGED
|
@@ -318,6 +318,13 @@ declare class Proof {
|
|
|
318
318
|
* @type {Array<string>}
|
|
319
319
|
*/
|
|
320
320
|
tags: Array<string>;
|
|
321
|
+
/**
|
|
322
|
+
* The proof owner's team.
|
|
323
|
+
*
|
|
324
|
+
* @since v2.0.0-beta.139
|
|
325
|
+
* @type {Array<string>}
|
|
326
|
+
*/
|
|
327
|
+
teamId: Array<string>;
|
|
321
328
|
/**
|
|
322
329
|
* @private
|
|
323
330
|
* @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})};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.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;
|
|
@@ -37,13 +37,35 @@ declare class ProofGroup {
|
|
|
37
37
|
*/
|
|
38
38
|
proofs: Array<Proof>;
|
|
39
39
|
/**
|
|
40
|
-
* Whether the user can add new proofs to the
|
|
40
|
+
* Whether the user can add new proofs to the group.
|
|
41
41
|
*
|
|
42
42
|
* @since v2.0.0-beta.56
|
|
43
43
|
*
|
|
44
44
|
* @type {boolean}
|
|
45
45
|
*/
|
|
46
46
|
canAddProofs: boolean;
|
|
47
|
+
/**
|
|
48
|
+
* The group owner's team.
|
|
49
|
+
*
|
|
50
|
+
* @since v2.0.0-beta.138
|
|
51
|
+
* @type {string}
|
|
52
|
+
*/
|
|
53
|
+
teamId: string;
|
|
54
|
+
/**
|
|
55
|
+
* Whether the group is also owned by the group owner's team.
|
|
56
|
+
*
|
|
57
|
+
* @since v2.0.0-beta.138
|
|
58
|
+
* @type {boolean}
|
|
59
|
+
*/
|
|
60
|
+
isOwnedByTeam: boolean;
|
|
61
|
+
/**
|
|
62
|
+
* The group owner's user Id.
|
|
63
|
+
*
|
|
64
|
+
* @since v2.0.0-beta.138
|
|
65
|
+
*
|
|
66
|
+
* @type {string}
|
|
67
|
+
*/
|
|
68
|
+
createdBy: string;
|
|
47
69
|
/**
|
|
48
70
|
* @private
|
|
49
71
|
*/
|
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",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.fromProofGroup=function fromProofGroup(proofGroupData){(0,_transform2.default)(this,proofGroupSchema,proofGroupData);return this};return ProofGroup}();exports.default=ProofGroup;
|
package/lib/models/User.d.ts
CHANGED
|
@@ -100,6 +100,13 @@ declare class User {
|
|
|
100
100
|
* @type {Object}
|
|
101
101
|
*/
|
|
102
102
|
features: Object;
|
|
103
|
+
/**
|
|
104
|
+
* The user's team ID.
|
|
105
|
+
*
|
|
106
|
+
* @since v2.0.0-beta.138
|
|
107
|
+
* @type {string}
|
|
108
|
+
*/
|
|
109
|
+
teamId: string;
|
|
103
110
|
/**
|
|
104
111
|
* @private
|
|
105
112
|
* @param {object} userJSON The serialised user object
|
package/lib/models/User.js
CHANGED
|
@@ -1 +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 userSchema={id:"UserId",name:"Name",email:"Email",hasActivated:"Activated",hasRegistered:"IsRegistered",hasAvatar:"HasAvatar",accountType:"AccountType",teamType:"TeamType",teamLogo:"Branding.LogoURL",registeredDate:(0,_transform.date)("Registered"),lastLoginDate:(0,_transform.date)("LastLogin"),lastUploadDate:(0,_transform.date)("LastUpload"),isAdmin:"IsDomainAdmin",features:"Features"};var User=function(){function User(){_classCallCheck(this,User)}User.prototype.fromJSON=function fromJSON(userJSON){(0,_transform2.default)(this,Object.keys(userSchema),userJSON);return this};User.prototype.fromUser=function fromUser(userData){(0,_transform2.default)(this,userSchema,userData);return this};return User}();exports.default=User;
|
|
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 userSchema={id:"UserId",name:"Name",email:"Email",hasActivated:"Activated",hasRegistered:"IsRegistered",hasAvatar:"HasAvatar",accountType:"AccountType",teamType:"TeamType",teamLogo:"Branding.LogoURL",registeredDate:(0,_transform.date)("Registered"),lastLoginDate:(0,_transform.date)("LastLogin"),lastUploadDate:(0,_transform.date)("LastUpload"),isAdmin:"IsDomainAdmin",features:"Features",teamId:"DomainId"};var User=function(){function User(){_classCallCheck(this,User)}User.prototype.fromJSON=function fromJSON(userJSON){(0,_transform2.default)(this,Object.keys(userSchema),userJSON);return this};User.prototype.fromUser=function fromUser(userData){(0,_transform2.default)(this,userSchema,userData);return this};return User}();exports.default=User;
|
|
@@ -298,12 +298,12 @@
|
|
|
298
298
|
"proofs.groups.create": {
|
|
299
299
|
"method": "POST",
|
|
300
300
|
"path": "/api/proofs/groups/create",
|
|
301
|
-
"body": ["name"]
|
|
301
|
+
"body": ["name", "ownedByTeam"]
|
|
302
302
|
},
|
|
303
303
|
"proofs.groups.update": {
|
|
304
304
|
"method": "POST",
|
|
305
305
|
"path": "/api/proofs/groups/update",
|
|
306
|
-
"body": ["groupId", "name"]
|
|
306
|
+
"body": ["groupId", "name", "ownedByTeam"]
|
|
307
307
|
},
|
|
308
308
|
"proofs.groups.delete": {
|
|
309
309
|
"method": "POST",
|