@pageproof/sdk-pr 272.0.1602710709012 → 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 CHANGED
@@ -1,11 +1,27 @@
1
1
  # Changelog
2
2
 
3
- ## 2.0.0-beta.142
3
+
4
+ ## 2.0.0-beta.143
4
5
 
5
6
  Released on the 16th of October 2020.
6
7
 
7
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))
8
9
 
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
+
18
+ ## 2.0.0-beta.141
19
+
20
+ Released on the 19th of October 2020.
21
+
22
+ - [[#270](https://github.com/PageProofCom/sdk/pull/270)] Support for retrieving configurations for services integrated with PageProof.
23
+
24
+
9
25
  ## 2.0.0-beta.140
10
26
 
11
27
  Released on the 9th of October 2020.
@@ -0,0 +1,40 @@
1
+ export default Integrations;
2
+ declare class Integrations extends API {
3
+ /** @private */
4
+ constructor(client: any, level: any);
5
+ /** @private */
6
+ level: any;
7
+ /**
8
+ * Gets the configurations for the available integrations
9
+ *
10
+ * @example <caption>Retrieving configurations for a team</caption>
11
+ * const admin = await client.admin();
12
+ * const availableConfigurations = await admin.team.integrations.configurations();
13
+ *
14
+ * @example <caption>Retrieving configurations for a user</caption>
15
+ * const availableConfigurations = await client.profile.integrations.configurations();
16
+ *
17
+ * @since 2.0.0-beta.141
18
+ * @returns {Promise<object|null>}
19
+ */
20
+ configurations(): Promise<any>;
21
+ /**
22
+ * Gets the URL for setting up an integration
23
+ *
24
+ * @example <caption>Retrieving the integration setup url for a team</caption>
25
+ * const admin = await client.admin();
26
+ * const { url, windowFeatures } = await admin.team.integrations.getSetupUrl('monday.com');
27
+ *
28
+ * @example <caption>Retrieving the integration setup url for a user</caption>
29
+ * const { url, windowFeatures } = await client.profile.integrations.getSetupUrl('monday.com');
30
+ *
31
+ * @since 2.0.0-beta.141
32
+ * @param {string|Array<string>} integrationKey The unique identifier/identifiers for the integration/integrations
33
+ * @returns {Promise<{ url: string, windowFeatures: string}>}
34
+ */
35
+ getSetupUrl(integrationKey: string | string[]): Promise<{
36
+ url: string;
37
+ windowFeatures: string;
38
+ }>;
39
+ }
40
+ import API from "./API";
@@ -0,0 +1 @@
1
+ "use strict";exports.__esModule=true;var _API2=require("./API");var _API3=_interopRequireDefault(_API2);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}var Integrations=function(_API){_inherits(Integrations,_API);function Integrations(client,level){_classCallCheck(this,Integrations);var _this=_possibleConstructorReturn(this,_API.call(this,client));_this.level=level;return _this}Integrations.prototype.configurations=function configurations(){return this.client.request("integrations.get-configurations",{level:this.level}).then(function(response){if(response.data){return response.data.integrations}return null})};Integrations.prototype.getSetupUrl=function getSetupUrl(integrationKey){return this.client.request("integrations.get-setup-url",{integration_key:integrationKey}).then(function(response){return{url:response.data.url,windowFeatures:response.data.windowFeatures}})};return Integrations}(_API3.default);exports.default=Integrations;
@@ -1,6 +1,13 @@
1
1
  export default Profile;
2
2
  declare class Profile extends API {
3
+ /** @private */
3
4
  constructor(client: any);
5
+ /**
6
+ * The Integrations API.
7
+ *
8
+ * @type {Integrations}
9
+ */
10
+ integrations: Integrations;
4
11
  /**
5
12
  * Uploads the avatar for the current user.
6
13
  *
@@ -76,3 +83,4 @@ declare class Profile extends API {
76
83
  clearStatus(): Promise<any>;
77
84
  }
78
85
  import API from "./API";
86
+ import Integrations from "./Integrations";
@@ -1 +1 @@
1
- "use strict";exports.__esModule=true;var _API2=require("./API");var _API3=_interopRequireDefault(_API2);var _bluffer=require("../bluffer");var _bluffer2=_interopRequireDefault(_bluffer);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}var Profile=function(_API){_inherits(Profile,_API);function Profile(){_classCallCheck(this,Profile);return _possibleConstructorReturn(this,_API.apply(this,arguments))}Profile.prototype.uploadAvatar=function uploadAvatar(file){var _this2=this;var bluffer=new _bluffer2.default;return bluffer.readBase64(file).then(function(base64){return _this2.client.request("profile.upload-avatar",{uploadedImage:"data:image/png;base64,"+base64})})};Profile.prototype.changePassword=function changePassword(currentPassword,password){var _this3=this;var crypto=this.client.crypto();return Promise.all([crypto.generatePasswordHash(currentPassword),crypto.generatePasswordHash(password),crypto.encryptPrivateKey(this.client.session.privateKeyPEM,password)]).then(function(_ref){var oldPassword=_ref[0],newPassword=_ref[1],newPrivateKey=_ref[2];return _this3.client.request("profile.change-password",{oldPassword:oldPassword,newPassword:newPassword,newPrivateKey:newPrivateKey})})};Profile.prototype.getStatus=function getStatus(){return this.client.request("profile.status").then(function(response){return response.data.status})};Profile.prototype.setStatus=function setStatus(status){return this.client.request("profile.set-status",status)};Profile.prototype.clearStatus=function clearStatus(){return this.client.request("profile.clear-status")};return Profile}(_API3.default);exports.default=Profile;
1
+ "use strict";exports.__esModule=true;var _API2=require("./API");var _API3=_interopRequireDefault(_API2);var _bluffer=require("../bluffer");var _bluffer2=_interopRequireDefault(_bluffer);var _Integrations=require("./Integrations");var _Integrations2=_interopRequireDefault(_Integrations);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}var Profile=function(_API){_inherits(Profile,_API);function Profile(client){_classCallCheck(this,Profile);var _this=_possibleConstructorReturn(this,_API.call(this,client));_this.integrations=new _Integrations2.default(client,"user");return _this}Profile.prototype.uploadAvatar=function uploadAvatar(file){var _this2=this;var bluffer=new _bluffer2.default;return bluffer.readBase64(file).then(function(base64){return _this2.client.request("profile.upload-avatar",{uploadedImage:"data:image/png;base64,"+base64})})};Profile.prototype.changePassword=function changePassword(currentPassword,password){var _this3=this;var crypto=this.client.crypto();return Promise.all([crypto.generatePasswordHash(currentPassword),crypto.generatePasswordHash(password),crypto.encryptPrivateKey(this.client.session.privateKeyPEM,password)]).then(function(_ref){var oldPassword=_ref[0],newPassword=_ref[1],newPrivateKey=_ref[2];return _this3.client.request("profile.change-password",{oldPassword:oldPassword,newPassword:newPassword,newPrivateKey:newPrivateKey})})};Profile.prototype.getStatus=function getStatus(){return this.client.request("profile.status").then(function(response){return response.data.status})};Profile.prototype.setStatus=function setStatus(status){return this.client.request("profile.set-status",status)};Profile.prototype.clearStatus=function clearStatus(){return this.client.request("profile.clear-status")};return Profile}(_API3.default);exports.default=Profile;
@@ -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";
@@ -41,10 +41,15 @@ declare class Team extends API {
41
41
  /**
42
42
  * The Admin Team Integrations API.
43
43
  *
44
- * @type {TeamIntegrations}
44
+ * @type {Integrations}
45
45
  */
46
- teamIntegrations: TeamIntegrations;
47
- integrations: TeamIntegrations;
46
+ integrations: Integrations;
47
+ /**
48
+ * The Admin Team Custom Tools API.
49
+ *
50
+ * @type {TeamCustomTools}
51
+ */
52
+ customTools: TeamCustomTools;
48
53
  }
49
54
  import API from "../API";
50
55
  import TeamUsers from "./TeamUsers";
@@ -53,4 +58,5 @@ import TeamFeatures from "./TeamFeatures";
53
58
  import TeamPreferences from "./TeamPreferences";
54
59
  import TeamCustomWebhooks from "./TeamCustomWebhooks";
55
60
  import TeamSCIM from "./TeamSCIM";
56
- import TeamIntegrations from "./TeamIntegrations";
61
+ import Integrations from "../Integrations";
62
+ import TeamCustomTools from "./TeamCustomTools";
@@ -30,9 +30,13 @@ var _TeamSCIM = require('./TeamSCIM');
30
30
 
31
31
  var _TeamSCIM2 = _interopRequireDefault(_TeamSCIM);
32
32
 
33
- var _TeamIntegrations = require('./TeamIntegrations');
33
+ var _Integrations = require('../Integrations');
34
34
 
35
- var _TeamIntegrations2 = _interopRequireDefault(_TeamIntegrations);
35
+ var _Integrations2 = _interopRequireDefault(_Integrations);
36
+
37
+ var _TeamCustomTools = require('./TeamCustomTools');
38
+
39
+ var _TeamCustomTools2 = _interopRequireDefault(_TeamCustomTools);
36
40
 
37
41
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
38
42
 
@@ -53,23 +57,29 @@ var Team = function (_API) {
53
57
 
54
58
 
55
59
  /**
56
- * The Admin Team SCIM API.
60
+ * The Admin Team Integrations API.
57
61
  *
58
- * @type {TeamSCIM}
62
+ * @type {Integrations}
59
63
  */
60
64
 
61
65
 
62
66
  /**
63
- * The Admin Team Preferences API.
67
+ * The Admin Custom Webhooks API.
64
68
  *
65
- * @type {TeamPreferences}
69
+ * @type {TeamCustomWebhooks}
66
70
  */
67
71
 
68
72
 
69
73
  /**
70
- * The Admin Team Dashboard API.
74
+ * The Admin Team Features API.
71
75
  *
72
- * @type {TeamDashboard}
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);
@@ -83,34 +93,36 @@ var Team = function (_API) {
83
93
  _this.preferences = new _TeamPreferences2.default(client);
84
94
  _this.customWebhooks = new _TeamCustomWebhooks2.default(client);
85
95
  _this.scim = new _TeamSCIM2.default(client);
86
- _this.integrations = new _TeamIntegrations2.default(client);
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 Integrations API.
102
+ * The Admin Team Custom Tools API.
92
103
  *
93
- * @type {TeamIntegrations}
104
+ * @type {TeamCustomTools}
94
105
  */
95
106
 
96
107
 
97
108
  /**
98
- * The Admin Custom Webhooks API.
109
+ * The Admin Team SCIM API.
99
110
  *
100
- * @type {TeamCustomWebhooks}
111
+ * @type {TeamSCIM}
101
112
  */
102
113
 
103
114
 
104
115
  /**
105
- * The Admin Team Features API.
116
+ * The Admin Team Preferences API.
106
117
  *
107
- * @type {TeamFeatures}
118
+ * @type {TeamPreferences}
108
119
  */
109
120
 
121
+
110
122
  /**
111
- * The Admin Team Users API.
123
+ * The Admin Team Dashboard API.
112
124
  *
113
- * @type {TeamUsers}
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";
@@ -18,35 +18,46 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
18
18
  */
19
19
 
20
20
 
21
- var TeamMondayDotCom = function (_API) {
22
- _inherits(TeamMondayDotCom, _API);
21
+ var TeamCustomTools = function (_API) {
22
+ _inherits(TeamCustomTools, _API);
23
23
 
24
- function TeamMondayDotCom() {
25
- _classCallCheck(this, TeamMondayDotCom);
24
+ function TeamCustomTools() {
25
+ _classCallCheck(this, TeamCustomTools);
26
26
 
27
27
  return _possibleConstructorReturn(this, _API.apply(this, arguments));
28
28
  }
29
29
 
30
30
  /**
31
- * Gets URL used to authenticate against monday.com.
31
+ * Loads the custom tools for your team.
32
32
  *
33
- * @example
34
- * const admin = await client.admin();
35
- * const authUrl = await admin.team.integrations.mondayDotCom.getAuthUrl();
33
+ * Note: This feature is only available to enterprise teams.
36
34
  *
37
- * @returns {Promise<string>}
35
+ * @returns {Promise<any>}
38
36
  */
39
- TeamMondayDotCom.prototype.getAuthUrl = function getAuthUrl() {
40
- return this.client.request('admin.team.integrations.monday-dot-com.get-request-url').then(function (response) {
41
- if (response.data) {
42
- return response.data.url;
43
- }
44
- return null;
37
+ TeamCustomTools.prototype.load = function load() {
38
+ return this.client.request('admin.team.custom-tools.load').then(function (response) {
39
+ return response.data.tools;
45
40
  });
46
41
  };
47
42
 
48
- return TeamMondayDotCom;
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;
49
60
  }(_API3.default);
50
61
 
51
- exports.default = TeamMondayDotCom;
52
- //# sourceMappingURL=TeamMondayDotCom.js.map
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.142
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.142
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.142
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.142
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.142
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.142
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.142
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.142
101
+ * @since v2.0.0-beta.143
102
102
  * @returns {Promise<Array<ProofGroup>>}
103
103
  */
104
104
 
@@ -321,10 +321,18 @@ declare class Proof {
321
321
  /**
322
322
  * The proof owner's team.
323
323
  *
324
- * @since v2.0.0-beta.142
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}
@@ -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
  */
@@ -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;
@@ -736,9 +736,15 @@
736
736
  "path": "/api/admin/settings",
737
737
  "body": ["displayComments", "editComments", "proofReference"]
738
738
  },
739
- "admin.team.integrations.monday-dot-com.get-request-url": {
739
+ "integrations.get-setup-url": {
740
740
  "method": "GET",
741
- "path": "/api/integrations/monday-dot-com/oauth/requesturl"
741
+ "path": "/api/integrations/setup_url",
742
+ "query": ["integration_key"]
743
+ },
744
+ "integrations.get-configurations": {
745
+ "method": "GET",
746
+ "path": "/api/integrations/configuration",
747
+ "query": ["level"]
742
748
  },
743
749
  "admin.team.preferences.notifications.load": {
744
750
  "method": "GET",
@@ -750,6 +756,16 @@
750
756
  "path": "/api/admin/preferences/notifications/set",
751
757
  "body": ["ownerAddedByAdmin"]
752
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
+ },
753
769
  "sessions.check": {
754
770
  "method": "GET",
755
771
  "path": "/api/sessions/check"