@pageproof/sdk-pr 248.0.1596765484937 → 248.0.1598306897364

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,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 2.0.0-beta.133
4
+
5
+ Released on the 18th of August 2020.
6
+
7
+ - Added support for team email notifcation settings. See [TeamNotifications](https://docs.pageproof.tech/@pageproof/sdk/beta/class/src/api/admin/TeamNotifications.js~TeamNotifications.html)
8
+
3
9
  ## 2.0.0-beta.132
4
10
 
5
11
  Released on the 3th of August 2020.
@@ -195,16 +195,24 @@ declare class Workflows extends API {
195
195
  * });
196
196
  *
197
197
  * @param {string} workflowId The workflow template id
198
+ * @param {object} [options]
199
+ * @param {boolean} [options.includeOwners=true] Whether to copy the proof owners permissions along with the workflow
198
200
  * @returns {Promise<Workflow>}
199
201
  */
200
- use(workflowId: string): Promise<Workflow>;
202
+ use(workflowId: string, options?: {
203
+ includeOwners?: boolean;
204
+ }): Promise<Workflow>;
201
205
  /**
202
206
  * Duplicates a workflow template and returns the duplicated {@link Workflow}.
203
207
  *
204
208
  * @param {string} workflowId The workflow template id
209
+ * @param {object} [options]
210
+ * @param {boolean} [options.includeOwners=true] Whether to copy the proof owners permissions along with the workflow
205
211
  * @returns {Promise<Workflow>}
206
212
  */
207
- duplicate(workflowId: string): Promise<Workflow>;
213
+ duplicate(workflowId: string, options?: {
214
+ includeOwners?: boolean;
215
+ }): Promise<Workflow>;
208
216
  /**
209
217
  * Deletes a workflow template.
210
218
  *
@@ -279,7 +287,7 @@ declare class Workflows extends API {
279
287
  */
280
288
  setStartingStep(workflowId: string, stepId: string): Promise<any>;
281
289
  /** @private */
282
- _duplicateWorkflow(workflowId: any): any;
290
+ _duplicateWorkflow(workflowId: any, options: any): any;
283
291
  /** @private */
284
292
  _deleteWorkflow(workflowId: any): any;
285
293
  /** @private */
@@ -1 +1 @@
1
- "use strict";exports.__esModule=true;var _API2=require("./API");var _API3=_interopRequireDefault(_API2);var _Workflow=require("../models/Workflow");var _Workflow2=_interopRequireDefault(_Workflow);var _WorkflowStep=require("../models/WorkflowStep");var _WorkflowStep2=_interopRequireDefault(_WorkflowStep);var _WorkflowUser=require("../models/WorkflowUser");var _WorkflowUser2=_interopRequireDefault(_WorkflowUser);var _id=require("../util/id");var _WorkflowsSteps=require("./WorkflowsSteps");var _WorkflowsSteps2=_interopRequireDefault(_WorkflowsSteps);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 hasEnoughUserDetails(workflowUser){return workflowUser&&((0,_id.isUserId)(workflowUser.id)||workflowUser.email)}function transformWorkflows(workflows){return(workflows||[]).map(function(workflowData){return(new _Workflow2.default).fromWorkflow(workflowData)})}var Workflows=function(_API){_inherits(Workflows,_API);function Workflows(client){_classCallCheck(this,Workflows);var _this=_possibleConstructorReturn(this,_API.call(this,client));_this.steps=new _WorkflowsSteps2.default(client);return _this}Workflows.prototype.create=function create(_ref){var _this2=this;var _ref$save=_ref.save,save=_ref$save===undefined?false:_ref$save,name=_ref.name,_ref$steps=_ref.steps,_steps=_ref$steps===undefined?[]:_ref$steps,reviewers=_ref.reviewers,approver=_ref.approver,owners=_ref.owners;if(!hasEnoughUserDetails(approver)){return Promise.reject(Error("An approver is required to create a workflow."))}if(save&&!name){return Promise.reject(Error("A workflow must have a name when saving it as a workflow template."))}var steps=_steps;if(reviewers&&reviewers.length){steps.splice(0,0,{users:reviewers})}if(approver){steps.push({position:1e3,users:[approver]})}var largestPosition=0;for(var i=0;i<steps.length;i++){var step=steps[i];if(!step.users||!step.users.length){return Promise.reject(Error("Workflow steps must contain users."))}if(!step.position||step.position<largestPosition){step.position=largestPosition+1}largestPosition=Math.max(largestPosition,step.position);for(var ii=0;ii<step.users.length;ii++){var user=step.users[ii];if(!hasEnoughUserDetails(user)){return Promise.reject(Error("A user id or email address must be provided for a workflow user."))}}}var workflowId=void 0;return this._createWorkflow(name).then(function(workflow){workflowId=workflow.id;return Promise.all([workflow,Promise.all(steps.map(function(step){var workflowStep=workflow.getStepByPosition(step.position);return workflowStep?_this2._setWorkflowStepUsersMutate(workflow.id,workflowStep,step.users):_this2._addWorkflowStepAndUsers(workflow.id,step)})),owners&&Promise.all(owners.map(function(owner){return _this2._addProofOwnerToWorkflowTemplate(workflowId,owner)}))])}).then(function(_ref2){var workflow=_ref2[0],workflowSteps=_ref2[1];workflow.steps=workflowSteps;return workflow}).then(function(workflow){if(save){return _this2._duplicateWorkflow(workflowId)}return workflow}).catch(function(err){return Promise.resolve(workflowId&&_this2._deleteWorkflow(workflowId)).then(function(){return Promise.reject(err)})})};Workflows.prototype.load=function load(workflowId){return this.client.request("workflows.load",{workflowId:workflowId}).then(function(response){return(new _Workflow2.default).fromWorkflow(response.data)})};Workflows.prototype.use=function use(workflowId){return this.duplicate(workflowId)};Workflows.prototype.duplicate=function duplicate(workflowId){return this._duplicateWorkflow(workflowId)};Workflows.prototype.delete=function _delete(workflowId){return this._deleteWorkflow(workflowId)};Workflows.prototype.all=function all(){return Promise.all([this.owned(),this.shared()]).then(function(_ref3){var owned=_ref3[0],shared=_ref3[1];return[].concat(owned,shared)})};Workflows.prototype.owned=function owned(){return this.client.request("workflows.owned").then(function(response){return transformWorkflows(response.data)})};Workflows.prototype.shared=function shared(){return this.client.request("workflows.shared").then(function(response){return transformWorkflows(response.data)})};Workflows.prototype.setApprover=function setApprover(workflowId,user){return this.client.request("workflows.users.set",{workflowId:workflowId,position:1e3,users:[user]})};Workflows.prototype.skipAll=function skipAll(workflowId){return this.client.request("workflows.users.skip-all",{workflowId:workflowId})};Workflows.prototype.setStartingStep=function setStartingStep(workflowId,stepId){return this.client.request("workflows.set-starting-step",{workflowId:workflowId,stepId:stepId})};Workflows.prototype._duplicateWorkflow=function _duplicateWorkflow(workflowId){var _this3=this;return this.client.request("workflows.duplicate",{workflowId:workflowId}).then(function(response){var duplicatedWorkflowId=response.data.WorkflowId;return _this3.load(duplicatedWorkflowId)})};Workflows.prototype._deleteWorkflow=function _deleteWorkflow(workflowId){return this.client.request("workflows.delete",{workflowId:workflowId})};Workflows.prototype._createWorkflow=function _createWorkflow(name){return this.client.request("workflows.create",{title:name}).then(function(response){return(new _Workflow2.default).fromWorkflow(response.data)})};Workflows.prototype._addWorkflowStepAndUsers=function _addWorkflowStepAndUsers(workflowId,step){var _this4=this;return this.client.request("workflows.steps.add",{workflowId:workflowId,title:step.name,position:step.position}).then(function(response){var workflowStep=(new _WorkflowStep2.default).fromWorkflowStep(response.data);return _this4._setWorkflowStepUsersMutate(workflowId,workflowStep,step.users)})};Workflows.prototype._setWorkflowStepUsersMutate=function _setWorkflowStepUsersMutate(workflowId,workflowStep,users){return this.client.request("workflows.users.set",{workflowId:workflowId,stepId:workflowStep.id,users:users.map(function(user){return{email:user.email,userId:user.id,role:user.role,permissions:user.permissions&&{inviter:!!user.permissions.inviter}}})}).then(function(response){var workflowUsers=response.data.map(function(user){return(new _WorkflowUser2.default).fromWorkflowUser(user)});workflowStep.users=workflowUsers;return workflowStep})};Workflows.prototype._addProofOwnerToWorkflowTemplate=function _addProofOwnerToWorkflowTemplate(workflowId,user){return this.client.request("workflows.proof-owners.add",{relatedId:workflowId,workflowCopyToProof:1,userId:user.id,email:user.email})};return Workflows}(_API3.default);exports.default=Workflows;
1
+ "use strict";exports.__esModule=true;var _API2=require("./API");var _API3=_interopRequireDefault(_API2);var _Workflow=require("../models/Workflow");var _Workflow2=_interopRequireDefault(_Workflow);var _WorkflowStep=require("../models/WorkflowStep");var _WorkflowStep2=_interopRequireDefault(_WorkflowStep);var _WorkflowUser=require("../models/WorkflowUser");var _WorkflowUser2=_interopRequireDefault(_WorkflowUser);var _id=require("../util/id");var _WorkflowsSteps=require("./WorkflowsSteps");var _WorkflowsSteps2=_interopRequireDefault(_WorkflowsSteps);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 hasEnoughUserDetails(workflowUser){return workflowUser&&((0,_id.isUserId)(workflowUser.id)||workflowUser.email)}function transformWorkflows(workflows){return(workflows||[]).map(function(workflowData){return(new _Workflow2.default).fromWorkflow(workflowData)})}var Workflows=function(_API){_inherits(Workflows,_API);function Workflows(client){_classCallCheck(this,Workflows);var _this=_possibleConstructorReturn(this,_API.call(this,client));_this.steps=new _WorkflowsSteps2.default(client);return _this}Workflows.prototype.create=function create(_ref){var _this2=this;var _ref$save=_ref.save,save=_ref$save===undefined?false:_ref$save,name=_ref.name,_ref$steps=_ref.steps,_steps=_ref$steps===undefined?[]:_ref$steps,reviewers=_ref.reviewers,approver=_ref.approver,owners=_ref.owners;if(!hasEnoughUserDetails(approver)){return Promise.reject(Error("An approver is required to create a workflow."))}if(save&&!name){return Promise.reject(Error("A workflow must have a name when saving it as a workflow template."))}var steps=_steps;if(reviewers&&reviewers.length){steps.splice(0,0,{users:reviewers})}if(approver){steps.push({position:1e3,users:[approver]})}var largestPosition=0;for(var i=0;i<steps.length;i++){var step=steps[i];if(!step.users||!step.users.length){return Promise.reject(Error("Workflow steps must contain users."))}if(!step.position||step.position<largestPosition){step.position=largestPosition+1}largestPosition=Math.max(largestPosition,step.position);for(var ii=0;ii<step.users.length;ii++){var user=step.users[ii];if(!hasEnoughUserDetails(user)){return Promise.reject(Error("A user id or email address must be provided for a workflow user."))}}}var workflowId=void 0;return this._createWorkflow(name).then(function(workflow){workflowId=workflow.id;return Promise.all([workflow,Promise.all(steps.map(function(step){var workflowStep=workflow.getStepByPosition(step.position);return workflowStep?_this2._setWorkflowStepUsersMutate(workflow.id,workflowStep,step.users):_this2._addWorkflowStepAndUsers(workflow.id,step)})),owners&&Promise.all(owners.map(function(owner){return _this2._addProofOwnerToWorkflowTemplate(workflowId,owner)}))])}).then(function(_ref2){var workflow=_ref2[0],workflowSteps=_ref2[1];workflow.steps=workflowSteps;return workflow}).then(function(workflow){if(save){return _this2._duplicateWorkflow(workflowId)}return workflow}).catch(function(err){return Promise.resolve(workflowId&&_this2._deleteWorkflow(workflowId)).then(function(){return Promise.reject(err)})})};Workflows.prototype.load=function load(workflowId){return this.client.request("workflows.load",{workflowId:workflowId}).then(function(response){return(new _Workflow2.default).fromWorkflow(response.data)})};Workflows.prototype.use=function use(workflowId,options){return this.duplicate(workflowId,options)};Workflows.prototype.duplicate=function duplicate(workflowId,options){return this._duplicateWorkflow(workflowId,options)};Workflows.prototype.delete=function _delete(workflowId){return this._deleteWorkflow(workflowId)};Workflows.prototype.all=function all(){return Promise.all([this.owned(),this.shared()]).then(function(_ref3){var owned=_ref3[0],shared=_ref3[1];return[].concat(owned,shared)})};Workflows.prototype.owned=function owned(){return this.client.request("workflows.owned").then(function(response){return transformWorkflows(response.data)})};Workflows.prototype.shared=function shared(){return this.client.request("workflows.shared").then(function(response){return transformWorkflows(response.data)})};Workflows.prototype.setApprover=function setApprover(workflowId,user){return this.client.request("workflows.users.set",{workflowId:workflowId,position:1e3,users:[user]})};Workflows.prototype.skipAll=function skipAll(workflowId){return this.client.request("workflows.users.skip-all",{workflowId:workflowId})};Workflows.prototype.setStartingStep=function setStartingStep(workflowId,stepId){return this.client.request("workflows.set-starting-step",{workflowId:workflowId,stepId:stepId})};Workflows.prototype._duplicateWorkflow=function _duplicateWorkflow(workflowId,options){var _this3=this;return this.client.request("workflows.duplicate",{workflowId:workflowId,noOwners:options&&options.includeOwners===false?true:undefined}).then(function(response){var duplicatedWorkflowId=response.data.WorkflowId;return _this3.load(duplicatedWorkflowId)})};Workflows.prototype._deleteWorkflow=function _deleteWorkflow(workflowId){return this.client.request("workflows.delete",{workflowId:workflowId})};Workflows.prototype._createWorkflow=function _createWorkflow(name){return this.client.request("workflows.create",{title:name}).then(function(response){return(new _Workflow2.default).fromWorkflow(response.data)})};Workflows.prototype._addWorkflowStepAndUsers=function _addWorkflowStepAndUsers(workflowId,step){var _this4=this;return this.client.request("workflows.steps.add",{workflowId:workflowId,title:step.name,position:step.position}).then(function(response){var workflowStep=(new _WorkflowStep2.default).fromWorkflowStep(response.data);return _this4._setWorkflowStepUsersMutate(workflowId,workflowStep,step.users)})};Workflows.prototype._setWorkflowStepUsersMutate=function _setWorkflowStepUsersMutate(workflowId,workflowStep,users){return this.client.request("workflows.users.set",{workflowId:workflowId,stepId:workflowStep.id,users:users.map(function(user){return{email:user.email,userId:user.id,role:user.role,permissions:user.permissions&&{inviter:!!user.permissions.inviter}}})}).then(function(response){var workflowUsers=response.data.map(function(user){return(new _WorkflowUser2.default).fromWorkflowUser(user)});workflowStep.users=workflowUsers;return workflowStep})};Workflows.prototype._addProofOwnerToWorkflowTemplate=function _addProofOwnerToWorkflowTemplate(workflowId,user){return this.client.request("workflows.proof-owners.add",{relatedId:workflowId,workflowCopyToProof:1,userId:user.id,email:user.email})};return Workflows}(_API3.default);exports.default=Workflows;
@@ -20,6 +20,12 @@ declare class Team extends API {
20
20
  * @type {TeamFeatures}
21
21
  */
22
22
  features: TeamFeatures;
23
+ /**
24
+ * The Admin Team Preferences API.
25
+ *
26
+ * @type {TeamPreferences}
27
+ */
28
+ preferences: TeamPreferences;
23
29
  /**
24
30
  * The Admin Custom Webhooks API.
25
31
  *
@@ -37,5 +43,6 @@ import API from "../API";
37
43
  import TeamUsers from "./TeamUsers";
38
44
  import TeamDashboard from "./TeamDashboard";
39
45
  import TeamFeatures from "./TeamFeatures";
46
+ import TeamPreferences from "./TeamPreferences";
40
47
  import TeamCustomWebhooks from "./TeamCustomWebhooks";
41
48
  import TeamSCIM from "./TeamSCIM";
@@ -18,6 +18,10 @@ var _TeamFeatures = require('./TeamFeatures');
18
18
 
19
19
  var _TeamFeatures2 = _interopRequireDefault(_TeamFeatures);
20
20
 
21
+ var _TeamPreferences = require('./TeamPreferences');
22
+
23
+ var _TeamPreferences2 = _interopRequireDefault(_TeamPreferences);
24
+
21
25
  var _TeamCustomWebhooks = require('./TeamCustomWebhooks');
22
26
 
23
27
  var _TeamCustomWebhooks2 = _interopRequireDefault(_TeamCustomWebhooks);
@@ -52,9 +56,15 @@ var Team = function (_API) {
52
56
 
53
57
 
54
58
  /**
55
- * The Admin Team Dashboard API.
59
+ * The Admin Team Features API.
56
60
  *
57
- * @type {TeamDashboard}
61
+ * @type {TeamFeatures}
62
+ */
63
+
64
+ /**
65
+ * The Admin Team Users API.
66
+ *
67
+ * @type {TeamUsers}
58
68
  */
59
69
  function Team(client) {
60
70
  _classCallCheck(this, Team);
@@ -65,6 +75,7 @@ var Team = function (_API) {
65
75
  _this.users = new _TeamUsers2.default(client);
66
76
  _this.dashboard = new _TeamDashboard2.default(client);
67
77
  _this.features = new _TeamFeatures2.default(client);
78
+ _this.preferences = new _TeamPreferences2.default(client);
68
79
  _this.customWebhooks = new _TeamCustomWebhooks2.default(client);
69
80
  _this.scim = new _TeamSCIM2.default(client);
70
81
  return _this;
@@ -78,15 +89,16 @@ var Team = function (_API) {
78
89
 
79
90
 
80
91
  /**
81
- * The Admin Team Features API.
92
+ * The Admin Team Preferences API.
82
93
  *
83
- * @type {TeamFeatures}
94
+ * @type {TeamPreferences}
84
95
  */
85
96
 
97
+
86
98
  /**
87
- * The Admin Team Users API.
99
+ * The Admin Team Dashboard API.
88
100
  *
89
- * @type {TeamUsers}
101
+ * @type {TeamDashboard}
90
102
  */
91
103
 
92
104
 
@@ -0,0 +1,31 @@
1
+ export default TeamNotifications;
2
+ declare class TeamNotifications extends API {
3
+ constructor(client: any);
4
+ /**
5
+ * Loads the administrator's team notifications.
6
+ *
7
+ * @example
8
+ * const admin = await client.admin();
9
+ * const preferences = admin.team.preferences.notifications.load();
10
+ *
11
+ * @since v2.0.0-beta.134
12
+ * @returns {Promise<TeamNotifications>}
13
+ */
14
+ load(): Promise<TeamNotifications>;
15
+ /**
16
+ * Set the notifications preferences for the administrator's team.
17
+ *
18
+ * @example <caption>Disabling the owner add email from admin</caption>
19
+ * const admin = await client.admin();
20
+ * const preferences = admin.team.preferences.notifications.set({ownerAddedByAdmin: false});
21
+ *
22
+ * @since v2.0.0-beta.134
23
+ * @param {object} options
24
+ * @param {boolean} options.ownerAddedByAdmin Whether the email should be sent or not to other owners, when an owner added on a proof by admin.
25
+ * @returns {Promise}
26
+ */
27
+ set({ ownerAddedByAdmin, }: {
28
+ ownerAddedByAdmin: boolean;
29
+ }): Promise<any>;
30
+ }
31
+ import API from "../API";
@@ -0,0 +1,79 @@
1
+ 'use strict';
2
+
3
+ exports.__esModule = true;
4
+
5
+ var _API2 = require('../API');
6
+
7
+ var _API3 = _interopRequireDefault(_API2);
8
+
9
+ var _TeamNotifications = require('../../models/TeamNotifications');
10
+
11
+ var _TeamNotifications2 = _interopRequireDefault(_TeamNotifications);
12
+
13
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14
+
15
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
16
+
17
+ 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; }
18
+
19
+ 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.
20
+ * Unauthorized copying of this file, via any medium is strictly prohibited.
21
+ * Proprietary and confidential.
22
+ */
23
+
24
+
25
+ var TeamNotifications = function (_API) {
26
+ _inherits(TeamNotifications, _API);
27
+
28
+ function TeamNotifications() {
29
+ _classCallCheck(this, TeamNotifications);
30
+
31
+ return _possibleConstructorReturn(this, _API.apply(this, arguments));
32
+ }
33
+
34
+ /**
35
+ * Loads the administrator's team notifications.
36
+ *
37
+ * @example
38
+ * const admin = await client.admin();
39
+ * const preferences = admin.team.preferences.notifications.load();
40
+ *
41
+ * @since v2.0.0-beta.134
42
+ * @returns {Promise<TeamNotifications>}
43
+ */
44
+ TeamNotifications.prototype.load = function load() {
45
+ return this.client.request('admin.team.preferences.notifications.load').then(function (response) {
46
+ if (response.data) {
47
+ return new _TeamNotifications2.default().fromTeamNotifications(response.data);
48
+ }
49
+ return null;
50
+ });
51
+ };
52
+
53
+ /**
54
+ * Set the notifications preferences for the administrator's team.
55
+ *
56
+ * @example <caption>Disabling the owner add email from admin</caption>
57
+ * const admin = await client.admin();
58
+ * const preferences = admin.team.preferences.notifications.set({ownerAddedByAdmin: false});
59
+ *
60
+ * @since v2.0.0-beta.134
61
+ * @param {object} options
62
+ * @param {boolean} options.ownerAddedByAdmin Whether the email should be sent or not to other owners, when an owner added on a proof by admin.
63
+ * @returns {Promise}
64
+ */
65
+
66
+
67
+ TeamNotifications.prototype.set = function set(_ref) {
68
+ var ownerAddedByAdmin = _ref.ownerAddedByAdmin;
69
+
70
+ return this.client.request('admin.team.preferences.notifications.set', {
71
+ ownerAddedByAdmin: ownerAddedByAdmin
72
+ });
73
+ };
74
+
75
+ return TeamNotifications;
76
+ }(_API3.default);
77
+
78
+ exports.default = TeamNotifications;
79
+ //# sourceMappingURL=TeamNotifications.js.map
@@ -0,0 +1,10 @@
1
+ export default TeamPreferences;
2
+ declare class TeamPreferences extends API {
3
+ /** @private */
4
+ constructor(client: any);
5
+ /**
6
+ * The Admin Team Notification API.
7
+ */
8
+ notifications: any;
9
+ }
10
+ import API from "../API";
@@ -0,0 +1,47 @@
1
+ 'use strict';
2
+
3
+ exports.__esModule = true;
4
+
5
+ var _API2 = require('../API');
6
+
7
+ var _API3 = _interopRequireDefault(_API2);
8
+
9
+ var _TeamNotifications = require('./TeamNotifications');
10
+
11
+ var _TeamNotifications2 = _interopRequireDefault(_TeamNotifications);
12
+
13
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14
+
15
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
16
+
17
+ 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; }
18
+
19
+ 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.
20
+ * Unauthorized copying of this file, via any medium is strictly prohibited.
21
+ * Proprietary and confidential.
22
+ */
23
+
24
+
25
+ var TeamPreferences = function (_API) {
26
+ _inherits(TeamPreferences, _API);
27
+
28
+ /** @private */
29
+ function TeamPreferences(client) {
30
+ _classCallCheck(this, TeamPreferences);
31
+
32
+ // Nested APIs
33
+ var _this = _possibleConstructorReturn(this, _API.call(this, client));
34
+
35
+ _this.notifications = new _TeamNotifications2.default(client);
36
+ return _this;
37
+ }
38
+ /**
39
+ * The Admin Team Notification API.
40
+ */
41
+
42
+
43
+ return TeamPreferences;
44
+ }(_API3.default);
45
+
46
+ exports.default = TeamPreferences;
47
+ //# sourceMappingURL=TeamPreferences.js.map
@@ -101,6 +101,14 @@ declare class Proof {
101
101
  * @type {Array<string>}
102
102
  */
103
103
  ownerUserIds: Array<string>;
104
+ /**
105
+ * The user objects for owners of the proof.
106
+ *
107
+ * Note: The user objects only contain partial details (id, email).
108
+ *
109
+ * @type {Array<User>}
110
+ */
111
+ owners: Array<User>;
104
112
  /**
105
113
  * If a user has been assigned to make changes to the file (when to-dos have been requested), this is their user id.
106
114
  *
@@ -413,5 +421,6 @@ declare class Proof {
413
421
  */
414
422
  fromProof(proofData: any): Proof;
415
423
  }
424
+ import User from "./User";
416
425
  import ProofType from "../enum/ProofType";
417
426
  import DecisionSummary from "./DecisionSummary";
@@ -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 _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",pageCount:(0,_transform.number)("Pages"),commentCount:(0,_transform.number)("ParentComments"),canDownload:(0,_transform.truthy)("DownloadOriginal"),type:"Type",processStatus:"ProcessStatus",recipient:"Recipient",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",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",pageCount:(0,_transform.number)("Pages"),commentCount:(0,_transform.number)("ParentComments"),canDownload:(0,_transform.truthy)("DownloadOriginal"),type:"Type",processStatus:"ProcessStatus",recipient:"Recipient",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;
@@ -0,0 +1,19 @@
1
+ export default TeamNotifications;
2
+ declare class TeamNotifications {
3
+ /**
4
+ * The team id.
5
+ *
6
+ * @since v2.0.0-beta.134
7
+ * @type {string}
8
+ */
9
+ teamId: string;
10
+ /**
11
+ * The notification type (when owner added by admin).
12
+ *
13
+ * @since v2.0.0-beta.134
14
+ * @type {boolean}
15
+ */
16
+ ownerAddedByAdmin: boolean;
17
+ /** @private */
18
+ fromTeamNotifications(teamNotificationsData: any): TeamNotifications;
19
+ }
@@ -0,0 +1 @@
1
+ "use strict";exports.__esModule=true;var _transform=require("./transform");var _transform2=_interopRequireDefault(_transform);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}var teamNotificationsSchema={teamId:"TeamId",ownerAddedByAdmin:"OwnerAddedByAdmin"};var TeamNotifications=function(){function TeamNotifications(){_classCallCheck(this,TeamNotifications)}TeamNotifications.prototype.fromTeamNotifications=function fromTeamNotifications(teamNotificationsData){(0,_transform2.default)(this,teamNotificationsSchema,teamNotificationsData);return this};return TeamNotifications}();exports.default=TeamNotifications;
@@ -557,7 +557,7 @@
557
557
  "workflows.duplicate": {
558
558
  "method": "POST",
559
559
  "path": "/api/workflows/duplicateonly",
560
- "body": ["workflowId"]
560
+ "body": ["workflowId", "noOwners"]
561
561
  },
562
562
  "workflows.set-starting-step": {
563
563
  "method": "POST",
@@ -698,6 +698,16 @@
698
698
  "path": "/api/admin/settings",
699
699
  "body": ["displayComments", "editComments", "proofReference"]
700
700
  },
701
+ "admin.team.preferences.notifications.load": {
702
+ "method": "GET",
703
+ "path": "/api/admin/preferences/notifications",
704
+ "trailing": true
705
+ },
706
+ "admin.team.preferences.notifications.set": {
707
+ "method": "POST",
708
+ "path": "/api/admin/preferences/notifications/set",
709
+ "body": ["ownerAddedByAdmin"]
710
+ },
701
711
  "sessions.check": {
702
712
  "method": "GET",
703
713
  "path": "/api/sessions/check"