@pageproof/sdk-pr 487.0.1692827098020 → 488.0.1688092553379

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,17 +1,5 @@
1
1
  # Changelog
2
2
 
3
- ## 2.0.0-beta.307
4
-
5
- Released on the 22nd of August 2023.
6
-
7
- - [[PP-5902](https://goto.pageproof.dev/PP-5902)] Added support for updating multiple proof's message to reviewers in bulk.
8
-
9
- ## 2.0.0-beta.306
10
-
11
- Released on the 30th of June 2023.
12
-
13
- - [[PP-3859](https://goto.pageproof.dev/PP-3859)] Added support for importing comments from annotations on a PDF file. Now available in beta to all customers.
14
-
15
3
  ## 2.0.0-beta.305
16
4
 
17
5
  Released on the 19th of June 2023.
@@ -54,13 +54,11 @@ declare class Accounts extends API {
54
54
  * @param {object} [options] Further, more advanced options
55
55
  * @param {string} [options.activationCode] The user's activation code (optional, if that information isn't available to you)
56
56
  * @param {string} [options.referrer] The unique identifier for the referrer of the account creation. Omit if you are unsure about this option.
57
- * @param {string} [options.setupToken] A setup token used to determine details about the user. Omit if you are unsure about this option.
58
57
  * @returns {Promise<Session>}
59
58
  */
60
59
  register(email: string, password: string, options?: {
61
60
  activationCode?: string;
62
61
  referrer?: string;
63
- setupToken?: string;
64
62
  }): Promise<Session>;
65
63
  /**
66
64
  * Generates a new activation code for a newly created account. The activation code is sent to the user's email
@@ -1 +1 @@
1
- "use strict";exports.__esModule=true;var _API2=require("./API");var _API3=_interopRequireDefault(_API2);var _Session=require("../models/Session");var _Session2=_interopRequireDefault(_Session);var _AccountsSSO=require("./AccountsSSO");var _AccountsSSO2=_interopRequireDefault(_AccountsSSO);var _AccountsMFA=require("./AccountsMFA");var _AccountsMFA2=_interopRequireDefault(_AccountsMFA);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 Accounts=function(_API){_inherits(Accounts,_API);function Accounts(client){_classCallCheck(this,Accounts);var _this=_possibleConstructorReturn(this,_API.call(this,client));_this.sso=new _AccountsSSO2.default(client);_this.mfa=new _AccountsMFA2.default(client);return _this}Accounts.prototype._generateCredentials=function _generateCredentials(password){var _this2=this;return this.client.crypto().generatePasswordHash(password).then(function(passwordHash){return Promise.all([passwordHash,_this2.client.crypto().generateKeyPair()])}).then(function(_ref){var passwordHash=_ref[0],keyPair=_ref[1];return Promise.all([passwordHash,keyPair,_this2.client.crypto().encryptPrivateKey(keyPair.privateKeyPEM,password)])})};Accounts.prototype.register=function register(email,password){var _this3=this;var options=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{};if(typeof options==="string"){console.warn("Warning: Passing the user's activation code during account creation has been moved into an options object. For compatibility reasons, the legacy behaviour still functions as expected, but please update your code as this will be changed in a future version.");options={activationCode:options}}return this._generateCredentials(password).then(function(_ref2){var passwordHash=_ref2[0],keyPair=_ref2[1],privateKeyPEM$=_ref2[2];return Promise.all([keyPair,_this3.client.request("accounts.register",{email:email,password:passwordHash,privateKey:privateKeyPEM$,publicKey:keyPair.publicKeyPEM,referrer:options.referrer,setupToken:options.setupToken})])}).then(function(_ref3){var keyPair=_ref3[0];return Promise.all([keyPair,_this3.login(email,password,undefined,false)])}).then(function(_ref4){var keyPair=_ref4[0],session=_ref4[1];return Promise.all([keyPair,session,options.activationCode?_this3.activate(options.activationCode).catch(function(){return _this3.generateActivationCode()}):_this3.generateActivationCode()])}).then(function(_ref5){var keyPair=_ref5[0],session=_ref5[1];session.privateKeyPEM=keyPair.privateKeyPEM;return session})};Accounts.prototype.generateActivationCode=function generateActivationCode(){return this.client.request("accounts.generate-activation-code",{userId:this.client.session.userId})};Accounts.prototype.activate=function activate(activationCode){var _this4=this;return this.client.request("accounts.activate",{userId:this.client.session.userId,authCode:activationCode}).then(function(){_this4.client.session.user.hasActivated=true})};Accounts.prototype.login=function login(email,password,totp){var _this5=this;var _decryptPrivateKey=arguments.length>3&&arguments[3]!==undefined?arguments[3]:true;return this.client.crypto().generatePasswordHash(password).then(function(passwordHash){return _this5.client.request("accounts.login",{email:email,password:passwordHash,totp:totp})}).then(function(response){var session=(new _Session2.default).fromSession(response.data);session.user.email=email;return session}).then(function(session){if(_decryptPrivateKey){return _this5.client.crypto().decryptPrivateKey(session.privateKeyPEM$,password).then(function(privateKeyPEM){session.privateKeyPEM=privateKeyPEM;return session})}return session}).then(function(session){_this5.client.setSession(session);return session})};Accounts.prototype.resetPassword=function resetPassword(_ref6){var _this6=this;var email=_ref6.email,code=_ref6.code,password=_ref6.password;return this._generateCredentials(password).then(function(_ref7){var passwordHash=_ref7[0],keyPair=_ref7[1],privateKeyPEM$=_ref7[2];return Promise.all([keyPair,_this6.client.request("accounts.reset-password",{email:email,secret:code,newPassword:passwordHash,newPrivateKey:privateKeyPEM$,newPublicKey:keyPair.publicKeyPEM})])}).then(function(_ref8){var keyPair=_ref8[0];return Promise.all([keyPair,_this6.login(email,password,undefined,false)])}).then(function(_ref9){var keyPair=_ref9[0],session=_ref9[1];session.privateKeyPEM=keyPair.privateKeyPEM;return session})};Accounts.prototype.forgotPassword=function forgotPassword(email){return this.client.request("accounts.forgot-password",{email:email})};Accounts.prototype.setPasswordRequest=function setPasswordRequest(email){return this.client.request("accounts.set-password-request",{email:email})};Accounts.prototype.setPassword=function setPassword(_ref10){var _this7=this;var email=_ref10.email,code=_ref10.code,password=_ref10.password;return this._generateCredentials(password).then(function(_ref11){var passwordHash=_ref11[0],keyPair=_ref11[1],privateKeyPEM$=_ref11[2];return Promise.all([keyPair,_this7.client.request("accounts.set-password",{email:email,secret:code,newPassword:passwordHash,newPrivateKey:privateKeyPEM$,newPublicKey:keyPair.publicKeyPEM})])}).then(function(_ref12){var keyPair=_ref12[0];return Promise.all([keyPair,_this7.login(email,password,undefined,false)])}).then(function(_ref13){var keyPair=_ref13[0],session=_ref13[1];session.privateKeyPEM=keyPair.privateKeyPEM;return session})};Accounts.prototype.logout=function logout(){var _this8=this;return this.client.request("accounts.logout").catch(function(err){_this8.client.setSession(null);return Promise.reject(err)}).then(function(){_this8.client.setSession(null)})};return Accounts}(_API3.default);exports.default=Accounts;
1
+ "use strict";exports.__esModule=true;var _API2=require("./API");var _API3=_interopRequireDefault(_API2);var _Session=require("../models/Session");var _Session2=_interopRequireDefault(_Session);var _AccountsSSO=require("./AccountsSSO");var _AccountsSSO2=_interopRequireDefault(_AccountsSSO);var _AccountsMFA=require("./AccountsMFA");var _AccountsMFA2=_interopRequireDefault(_AccountsMFA);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 Accounts=function(_API){_inherits(Accounts,_API);function Accounts(client){_classCallCheck(this,Accounts);var _this=_possibleConstructorReturn(this,_API.call(this,client));_this.sso=new _AccountsSSO2.default(client);_this.mfa=new _AccountsMFA2.default(client);return _this}Accounts.prototype._generateCredentials=function _generateCredentials(password){var _this2=this;return this.client.crypto().generatePasswordHash(password).then(function(passwordHash){return Promise.all([passwordHash,_this2.client.crypto().generateKeyPair()])}).then(function(_ref){var passwordHash=_ref[0],keyPair=_ref[1];return Promise.all([passwordHash,keyPair,_this2.client.crypto().encryptPrivateKey(keyPair.privateKeyPEM,password)])})};Accounts.prototype.register=function register(email,password){var _this3=this;var options=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{};if(typeof options==="string"){console.warn("Warning: Passing the user's activation code during account creation has been moved into an options object. For compatibility reasons, the legacy behaviour still functions as expected, but please update your code as this will be changed in a future version.");options={activationCode:options}}return this._generateCredentials(password).then(function(_ref2){var passwordHash=_ref2[0],keyPair=_ref2[1],privateKeyPEM$=_ref2[2];return Promise.all([keyPair,_this3.client.request("accounts.register",{email:email,password:passwordHash,privateKey:privateKeyPEM$,publicKey:keyPair.publicKeyPEM,referrer:options.referrer})])}).then(function(_ref3){var keyPair=_ref3[0];return Promise.all([keyPair,_this3.login(email,password,undefined,false)])}).then(function(_ref4){var keyPair=_ref4[0],session=_ref4[1];return Promise.all([keyPair,session,options.activationCode?_this3.activate(options.activationCode).catch(function(){return _this3.generateActivationCode()}):_this3.generateActivationCode()])}).then(function(_ref5){var keyPair=_ref5[0],session=_ref5[1];session.privateKeyPEM=keyPair.privateKeyPEM;return session})};Accounts.prototype.generateActivationCode=function generateActivationCode(){return this.client.request("accounts.generate-activation-code",{userId:this.client.session.userId})};Accounts.prototype.activate=function activate(activationCode){var _this4=this;return this.client.request("accounts.activate",{userId:this.client.session.userId,authCode:activationCode}).then(function(){_this4.client.session.user.hasActivated=true})};Accounts.prototype.login=function login(email,password,totp){var _this5=this;var _decryptPrivateKey=arguments.length>3&&arguments[3]!==undefined?arguments[3]:true;return this.client.crypto().generatePasswordHash(password).then(function(passwordHash){return _this5.client.request("accounts.login",{email:email,password:passwordHash,totp:totp})}).then(function(response){var session=(new _Session2.default).fromSession(response.data);session.user.email=email;return session}).then(function(session){if(_decryptPrivateKey){return _this5.client.crypto().decryptPrivateKey(session.privateKeyPEM$,password).then(function(privateKeyPEM){session.privateKeyPEM=privateKeyPEM;return session})}return session}).then(function(session){_this5.client.setSession(session);return session})};Accounts.prototype.resetPassword=function resetPassword(_ref6){var _this6=this;var email=_ref6.email,code=_ref6.code,password=_ref6.password;return this._generateCredentials(password).then(function(_ref7){var passwordHash=_ref7[0],keyPair=_ref7[1],privateKeyPEM$=_ref7[2];return Promise.all([keyPair,_this6.client.request("accounts.reset-password",{email:email,secret:code,newPassword:passwordHash,newPrivateKey:privateKeyPEM$,newPublicKey:keyPair.publicKeyPEM})])}).then(function(_ref8){var keyPair=_ref8[0];return Promise.all([keyPair,_this6.login(email,password,undefined,false)])}).then(function(_ref9){var keyPair=_ref9[0],session=_ref9[1];session.privateKeyPEM=keyPair.privateKeyPEM;return session})};Accounts.prototype.forgotPassword=function forgotPassword(email){return this.client.request("accounts.forgot-password",{email:email})};Accounts.prototype.setPasswordRequest=function setPasswordRequest(email){return this.client.request("accounts.set-password-request",{email:email})};Accounts.prototype.setPassword=function setPassword(_ref10){var _this7=this;var email=_ref10.email,code=_ref10.code,password=_ref10.password;return this._generateCredentials(password).then(function(_ref11){var passwordHash=_ref11[0],keyPair=_ref11[1],privateKeyPEM$=_ref11[2];return Promise.all([keyPair,_this7.client.request("accounts.set-password",{email:email,secret:code,newPassword:passwordHash,newPrivateKey:privateKeyPEM$,newPublicKey:keyPair.publicKeyPEM})])}).then(function(_ref12){var keyPair=_ref12[0];return Promise.all([keyPair,_this7.login(email,password,undefined,false)])}).then(function(_ref13){var keyPair=_ref13[0],session=_ref13[1];session.privateKeyPEM=keyPair.privateKeyPEM;return session})};Accounts.prototype.logout=function logout(){var _this8=this;return this.client.request("accounts.logout").catch(function(err){_this8.client.setSession(null);return Promise.reject(err)}).then(function(){_this8.client.setSession(null)})};return Accounts}(_API3.default);exports.default=Accounts;
@@ -418,24 +418,20 @@ declare class Proofs extends API {
418
418
  /** @private */
419
419
  _videoCredentials(proofId: any): any;
420
420
  /**
421
- * Set message to reviewers on one or multiple proofs.
421
+ * Set message to reviewers on a proof.
422
422
  *
423
423
  * @example <caption>Set message to reviewers</caption>
424
424
  * const proof = await client.proofs.setMessageToReviewers(
425
425
  * 'PIA76GGP3I4LDJXB',
426
426
  * 'Take a look at this proof please'
427
427
  * );
428
- * @example <caption>Set message to reviewers on multiple proofs</caption>
429
- * const proof = await client.proofs.setMessageToReviewers(
430
- * ['PIA76GGP3I4LDJXB', 'PIA76GGP3I4LDJXD'],
431
- * 'Message for reviewers example'
432
- * );
433
428
  *
434
- * @param {string|Array<string>} proofIds The proof id or array of proof Ids
429
+ * @since v2.0.0-beta.82
430
+ * @param {string} proofId The proof id
435
431
  * @param {string} messageToReviewers The message to reviewers
436
432
  * @returns {Promise}
437
433
  */
438
- setMessageToReviewers(proofIdOrIds: any, messageToReviewers: string): Promise<any>;
434
+ setMessageToReviewers(proofId: string, messageToReviewers: string): Promise<any>;
439
435
  /**
440
436
  * Returns a to-do list to owners, so that owners can start working through them, and marking comments as done. (Can only be performed an owner.)
441
437
  *
package/lib/api/Proofs.js CHANGED
@@ -1 +1 @@
1
- "use strict";exports.__esModule=true;var _extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key]}}}return target};var _API2=require("./API");var _API3=_interopRequireDefault(_API2);var _ProofsOwners=require("./ProofsOwners");var _ProofsOwners2=_interopRequireDefault(_ProofsOwners);var _ProofsEditors=require("./ProofsEditors");var _ProofsEditors2=_interopRequireDefault(_ProofsEditors);var _ProofsReviewers=require("./ProofsReviewers");var _ProofsReviewers2=_interopRequireDefault(_ProofsReviewers);var _ProofsVersions=require("./ProofsVersions");var _ProofsVersions2=_interopRequireDefault(_ProofsVersions);var _ProofsGroups=require("./ProofsGroups");var _ProofsGroups2=_interopRequireDefault(_ProofsGroups);var _ProofsAudit=require("./ProofsAudit");var _ProofsAudit2=_interopRequireDefault(_ProofsAudit);var _ProofsAssets=require("./ProofsAssets");var _ProofsAssets2=_interopRequireDefault(_ProofsAssets);var _ProofsCustomTools=require("./ProofsCustomTools");var _ProofsCustomTools2=_interopRequireDefault(_ProofsCustomTools);var _ProofsIntegrationReferences=require("./ProofsIntegrationReferences");var _ProofsIntegrationReferences2=_interopRequireDefault(_ProofsIntegrationReferences);var _ProofsLinkCheck=require("./ProofsLinkCheck");var _ProofsLinkCheck2=_interopRequireDefault(_ProofsLinkCheck);var _ProofsDecisions=require("./ProofsDecisions");var _ProofsDecisions2=_interopRequireDefault(_ProofsDecisions);var _Proof=require("../models/Proof");var _Proof2=_interopRequireDefault(_Proof);var _Reminders=require("./Reminders");var _Reminders2=_interopRequireDefault(_Reminders);var _whatwgURL=require("../util/whatwgURL");var _whatwgURL2=_interopRequireDefault(_whatwgURL);var _constants=require("../util/constants");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 VIDEO_URL_TOKEN_SEPARATOR="|";function transformProofsForUpdate(proofs){var proofsArrForUpdate=[].concat(proofs);proofsArrForUpdate.forEach(function(proof){proof.proofId=proof.id;delete proof.id});return proofsArrForUpdate}var Proofs=function(_API){_inherits(Proofs,_API);function Proofs(client){_classCallCheck(this,Proofs);var _this=_possibleConstructorReturn(this,_API.call(this,client));_this.owners=new _ProofsOwners2.default(client);_this.editors=new _ProofsEditors2.default(client);_this.reviewers=new _ProofsReviewers2.default(client);_this.versions=new _ProofsVersions2.default(client);_this.groups=new _ProofsGroups2.default(client);_this.reminders=new _Reminders2.default(client);_this.audit=new _ProofsAudit2.default(client);_this.assets=new _ProofsAssets2.default(client);_this.customTools=new _ProofsCustomTools2.default(client);_this.integrationReferences=new _ProofsIntegrationReferences2.default(client);_this.linkCheck=new _ProofsLinkCheck2.default(client);_this.decisions=new _ProofsDecisions2.default(client);return _this}Proofs.prototype.setWorkflow=function setWorkflow(proofId,workflowId){var _this2=this;return this.client.request("proofs.normalize-workflow",{proofId:proofId,workflowId:workflowId}).then(function(){return _this2.client.request("proofs.set-workflow",{proofId:proofId,workflowId:workflowId})})};Proofs.prototype.setTags=function setTags(proofId,tags){return this.client.request("proofs.set-tags",{relatedId:proofId,tag:tags.join(",")})};Proofs.prototype.deleteTag=function deleteTag(proofId,tag){return this.client.request("proofs.tag-delete",{relatedId:proofId,tag:tag})};Proofs.prototype.setFile=function setFile(proofId,fileId){var _this3=this;return this.client.request("proofs.set-file",{proofId:proofId,fileId:fileId}).then(function(){return _this3.client.request("proofs.distribute-file",{proofId:proofId})})};Proofs.prototype.create=function create(_ref){var _this4=this;var name=_ref.name,_ref$tags=_ref.tags,tags=_ref$tags===undefined?[]:_ref$tags,_ref$dueDate=_ref.dueDate,dueDate=_ref$dueDate===undefined?new Date(Date.now()+3*_constants.DAY_IN_MS):_ref$dueDate,messageToReviewers=_ref.messageToReviewers,workflow=_ref.workflow,workflowTemplate=_ref.workflowTemplate,checklist=_ref.checklist,file=_ref.file,group=_ref.group,previousProof=_ref.previousProof,team=_ref.team,reference=_ref.reference,customTools=_ref.customTools,integrationReferences=_ref.integrationReferences,_ref$reminders=_ref.reminders,reminders=_ref$reminders===undefined?[]:_ref$reminders,owners=_ref.owners,canDownload=_ref.canDownload,isPublic=_ref.isPublic,_ref$start=_ref.start,start=_ref$start===undefined?true:_ref$start;return this.client.request("proofs.create",{proof:{name:name,tags:tags,dueDate:dueDate.toISOString?dueDate.toISOString():String(dueDate),messageToReviewers:messageToReviewers,workflowId:workflow&&workflow.id||undefined,workflowTemplateId:workflowTemplate&&workflowTemplate.id||undefined,checklist:checklist,fileId:file&&file.id||undefined,groupId:group&&group.id||undefined,previousProofId:previousProof&&previousProof.id||undefined,teamSlug:team&&team.slug||undefined,reference:reference,integrationReferences:integrationReferences,reminders:[].concat(reminders),owners:owners,canDownload:canDownload,isPublic:isPublic,start:start}}).then(function(response){var proof=(new _Proof2.default).fromProof(response.data);proof.calculateState();if(customTools&&!previousProof){return _this4.customTools.update(proof.id,customTools).then(function(){return proof})}return proof})};Proofs.prototype.archive=function archive(proofIdOrIds){return this.client.request("proofs.archive",{proofIds:proofIdOrIds})};Proofs.prototype.unarchive=function unarchive(proofId){return this.client.request("proofs.unarchive",{proofId:proofId})};Proofs.prototype.delete=function _delete(proofId){return this.client.request("proofs.delete",{proofId:proofId})};Proofs.prototype.finish=function finish(proofId,decision){return this.client.request("proofs.finish",{proofId:proofId,decision:decision})};Proofs.prototype.approve=function approve(proofId,message){return this.client.request("proofs.manual-approval",{proofId:proofId,message:message})};Proofs.prototype.withdrawApproval=function withdrawApproval(proofId,messageToSender){return this.client.request("proofs.withdraw-approval",{proofId:proofId,messageToSender:messageToSender})};Proofs.prototype.generateEmail=function generateEmail(proofId){var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};return this.client.request("email.proofs.generate",_extends({proofId:proofId},options)).then(function(response){return response.data})};Proofs.prototype.return=function _return(proofIdOrIds){return this.client.request("proofs.return",{proofIds:[].concat(proofIdOrIds)}).then(function(response){return{proofIds:response.data.ProofIds,errors:response.data.Errors.map(function(error){return{proofId:error.ProofId,errorCode:error.ErrorCode,errorMessage:error.ErrorMessage}})}})};Proofs.prototype.start=function start(proofId){return this.client.request("proofs.start",{proofId:proofId})};Proofs.prototype.removeEditor=function removeEditor(id){return this.client.request("proofs.remove-editor",{proofId:id})};Proofs.prototype.load=function load(proofId){return this.client.request("proofs.load",{proofId:proofId}).then(function(response){return(new _Proof2.default).fromProof(response.data)})};Proofs.prototype.lock=function lock(proofId){return this.client.request("proofs.lock",{proofId:proofId})};Proofs.prototype.unlock=function unlock(proofId){return this.client.request("proofs.unlock",{proofId:proofId})};Proofs.prototype.requestUnlock=function requestUnlock(proofId){return this.client.request("proofs.request-unlock",{proofId:proofId})};Proofs.prototype.requestAccess=function requestAccess(proofId){return this.client.request("proofs.request-access",{proofId:proofId})};Proofs.prototype.images=function images(proofId){return this.client.request("proofs.images",{proofId:proofId}).then(function(response){return response.data.proof.file})};Proofs.prototype.videoCredentials=function videoCredentials(proofId){var _this5=this;return this.client.cache.auto(_constants.VIDEO_CREDENTIALS_CACHE_PREFIX+proofId,function(){return _this5._videoCredentials(proofId)})};Proofs.prototype._videoCredentials=function _videoCredentials(proofId){var _this6=this;var bluffer=new _bluffer2.default;return this.client.request("proofs.video-credentials",{proofId:proofId}).then(function(response){return Promise.all([response.data.envelope.envelope,_this6.client.rawRequest({method:"GET",url:new _whatwgURL2.default(response.data.videoCredentials.url)}).then(function(videoCredentialsResponse){return videoCredentialsResponse.body})])}).then(function(_ref2){var envelope=_ref2[0],videoCredentials$=_ref2[1];return _this6.client.crypto().decryptImage(envelope+"-"+videoCredentials$,_this6.client.keyPairs.getPrivateKeyPEMs())}).then(function(videoCredentialsBase64){return bluffer.createBase64(videoCredentialsBase64).then(function(buffer){return bluffer.read(buffer)})}).then(function(videoCredentials){var _videoCredentials$spl=videoCredentials.split(VIDEO_URL_TOKEN_SEPARATOR),url=_videoCredentials$spl[0],bearerToken=_videoCredentials$spl[1];var manifestUrl=url.replace("http://","https://");manifestUrl+="/manifest";return{manifestUrl:manifestUrl,bearerToken:bearerToken}})};Proofs.prototype.setMessageToReviewers=function setMessageToReviewers(proofIdOrIds,messageToReviewers){return this.client.request("proofs.set-message-to-reviewers",{proofIds:[].concat(proofIdOrIds),messageToReviewers:messageToReviewers})};Proofs.prototype.returnTodos=function returnTodos(proofIdOrIds,_ref3){var messageToOwners=_ref3.messageToOwners,_ref3$markCommentsAsT=_ref3.markCommentsAsTodo,markCommentsAsTodo=_ref3$markCommentsAsT===undefined?false:_ref3$markCommentsAsT;return this.client.request("proofs.return-todos",{proofIds:[].concat(proofIdOrIds),messageToOwners:messageToOwners,markCommentAsTodo:markCommentsAsTodo})};Proofs.prototype.updateDecision=function updateDecision(proofId,decision){return this.client.request("proofs.update-decision",{proofId:proofId,decision:decision})};Proofs.prototype.update=function update(proofOrProofs){if(proofOrProofs.length===1||typeof proofOrProofs.length==="undefined"){var _concat$=[].concat(proofOrProofs)[0],id=_concat$.id,name=_concat$.name,tags=_concat$.tags,dueDate=_concat$.dueDate,messageToReviewers=_concat$.messageToReviewers,workflow=_concat$.workflow,checklist=_concat$.checklist,file=_concat$.file,reference=_concat$.reference,integrationReferences=_concat$.integrationReferences,reminders=_concat$.reminders,owners=_concat$.owners,canDownload=_concat$.canDownload,isPublic=_concat$.isPublic,start=_concat$.start;return this.client.request("proofs.update",{proof:{id:id,name:name,tags:tags,dueDate:dueDate?dueDate.toISOString():undefined,messageToReviewers:messageToReviewers,workflowId:workflow&&workflow.id||undefined,checklist:checklist,fileId:file&&file.id||undefined,reference:reference,integrationReferences:integrationReferences,reminders:reminders?[].concat(reminders):undefined,owners:owners,canDownload:canDownload,isPublic:isPublic,start:start}}).then(function(response){var proof=(new _Proof2.default).fromProof(response.data);proof.calculateState();return proof})}return this.client.request("proofs.bulk-update",{proofs:transformProofsForUpdate(proofOrProofs)})};Proofs.prototype.next=function next(proofId){return this.client.request("proofs.next",{proofId:proofId}).then(function(response){return(new _Proof2.default).fromProof(response.data)})};Proofs.prototype.addWorkflow=function addWorkflow(proofIdOrIds,workflowTemplateId){return this.client.request("proofs-workflow.add-bulk",{proofIds:[].concat(proofIdOrIds),workflowTemplateId:workflowTemplateId})};Proofs.prototype.sendShareLink=function sendShareLink(_ref4){var proofId=_ref4.proofId,message=_ref4.message,emailAddresses=_ref4.emailAddresses;return this.client.request("proofs.send-share-link",{proofId:proofId,message:message,emailAddresses:emailAddresses})};Proofs.prototype.getWorkflowMetrics=function getWorkflowMetrics(proofId){return this.client.request("proofs.get-workflow-metrics",{proofId:proofId}).then(function(response){if(response.data){return response.data.workflowMetrics}return null})};return Proofs}(_API3.default);exports.default=Proofs;
1
+ "use strict";exports.__esModule=true;var _extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key]}}}return target};var _API2=require("./API");var _API3=_interopRequireDefault(_API2);var _ProofsOwners=require("./ProofsOwners");var _ProofsOwners2=_interopRequireDefault(_ProofsOwners);var _ProofsEditors=require("./ProofsEditors");var _ProofsEditors2=_interopRequireDefault(_ProofsEditors);var _ProofsReviewers=require("./ProofsReviewers");var _ProofsReviewers2=_interopRequireDefault(_ProofsReviewers);var _ProofsVersions=require("./ProofsVersions");var _ProofsVersions2=_interopRequireDefault(_ProofsVersions);var _ProofsGroups=require("./ProofsGroups");var _ProofsGroups2=_interopRequireDefault(_ProofsGroups);var _ProofsAudit=require("./ProofsAudit");var _ProofsAudit2=_interopRequireDefault(_ProofsAudit);var _ProofsAssets=require("./ProofsAssets");var _ProofsAssets2=_interopRequireDefault(_ProofsAssets);var _ProofsCustomTools=require("./ProofsCustomTools");var _ProofsCustomTools2=_interopRequireDefault(_ProofsCustomTools);var _ProofsIntegrationReferences=require("./ProofsIntegrationReferences");var _ProofsIntegrationReferences2=_interopRequireDefault(_ProofsIntegrationReferences);var _ProofsLinkCheck=require("./ProofsLinkCheck");var _ProofsLinkCheck2=_interopRequireDefault(_ProofsLinkCheck);var _ProofsDecisions=require("./ProofsDecisions");var _ProofsDecisions2=_interopRequireDefault(_ProofsDecisions);var _Proof=require("../models/Proof");var _Proof2=_interopRequireDefault(_Proof);var _Reminders=require("./Reminders");var _Reminders2=_interopRequireDefault(_Reminders);var _whatwgURL=require("../util/whatwgURL");var _whatwgURL2=_interopRequireDefault(_whatwgURL);var _constants=require("../util/constants");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 VIDEO_URL_TOKEN_SEPARATOR="|";function transformProofsForUpdate(proofs){var proofsArrForUpdate=[].concat(proofs);proofsArrForUpdate.forEach(function(proof){proof.proofId=proof.id;delete proof.id});return proofsArrForUpdate}var Proofs=function(_API){_inherits(Proofs,_API);function Proofs(client){_classCallCheck(this,Proofs);var _this=_possibleConstructorReturn(this,_API.call(this,client));_this.owners=new _ProofsOwners2.default(client);_this.editors=new _ProofsEditors2.default(client);_this.reviewers=new _ProofsReviewers2.default(client);_this.versions=new _ProofsVersions2.default(client);_this.groups=new _ProofsGroups2.default(client);_this.reminders=new _Reminders2.default(client);_this.audit=new _ProofsAudit2.default(client);_this.assets=new _ProofsAssets2.default(client);_this.customTools=new _ProofsCustomTools2.default(client);_this.integrationReferences=new _ProofsIntegrationReferences2.default(client);_this.linkCheck=new _ProofsLinkCheck2.default(client);_this.decisions=new _ProofsDecisions2.default(client);return _this}Proofs.prototype.setWorkflow=function setWorkflow(proofId,workflowId){var _this2=this;return this.client.request("proofs.normalize-workflow",{proofId:proofId,workflowId:workflowId}).then(function(){return _this2.client.request("proofs.set-workflow",{proofId:proofId,workflowId:workflowId})})};Proofs.prototype.setTags=function setTags(proofId,tags){return this.client.request("proofs.set-tags",{relatedId:proofId,tag:tags.join(",")})};Proofs.prototype.deleteTag=function deleteTag(proofId,tag){return this.client.request("proofs.tag-delete",{relatedId:proofId,tag:tag})};Proofs.prototype.setFile=function setFile(proofId,fileId){var _this3=this;return this.client.request("proofs.set-file",{proofId:proofId,fileId:fileId}).then(function(){return _this3.client.request("proofs.distribute-file",{proofId:proofId})})};Proofs.prototype.create=function create(_ref){var _this4=this;var name=_ref.name,_ref$tags=_ref.tags,tags=_ref$tags===undefined?[]:_ref$tags,_ref$dueDate=_ref.dueDate,dueDate=_ref$dueDate===undefined?new Date(Date.now()+3*_constants.DAY_IN_MS):_ref$dueDate,messageToReviewers=_ref.messageToReviewers,workflow=_ref.workflow,workflowTemplate=_ref.workflowTemplate,checklist=_ref.checklist,file=_ref.file,group=_ref.group,previousProof=_ref.previousProof,team=_ref.team,reference=_ref.reference,customTools=_ref.customTools,integrationReferences=_ref.integrationReferences,_ref$reminders=_ref.reminders,reminders=_ref$reminders===undefined?[]:_ref$reminders,owners=_ref.owners,canDownload=_ref.canDownload,isPublic=_ref.isPublic,_ref$start=_ref.start,start=_ref$start===undefined?true:_ref$start;return this.client.request("proofs.create",{proof:{name:name,tags:tags,dueDate:dueDate.toISOString?dueDate.toISOString():String(dueDate),messageToReviewers:messageToReviewers,workflowId:workflow&&workflow.id||undefined,workflowTemplateId:workflowTemplate&&workflowTemplate.id||undefined,checklist:checklist,fileId:file&&file.id||undefined,groupId:group&&group.id||undefined,previousProofId:previousProof&&previousProof.id||undefined,teamSlug:team&&team.slug||undefined,reference:reference,integrationReferences:integrationReferences,reminders:[].concat(reminders),owners:owners,canDownload:canDownload,isPublic:isPublic,start:start}}).then(function(response){var proof=(new _Proof2.default).fromProof(response.data);proof.calculateState();if(customTools&&!previousProof){return _this4.customTools.update(proof.id,customTools).then(function(){return proof})}return proof})};Proofs.prototype.archive=function archive(proofIdOrIds){return this.client.request("proofs.archive",{proofIds:proofIdOrIds})};Proofs.prototype.unarchive=function unarchive(proofId){return this.client.request("proofs.unarchive",{proofId:proofId})};Proofs.prototype.delete=function _delete(proofId){return this.client.request("proofs.delete",{proofId:proofId})};Proofs.prototype.finish=function finish(proofId,decision){return this.client.request("proofs.finish",{proofId:proofId,decision:decision})};Proofs.prototype.approve=function approve(proofId,message){return this.client.request("proofs.manual-approval",{proofId:proofId,message:message})};Proofs.prototype.withdrawApproval=function withdrawApproval(proofId,messageToSender){return this.client.request("proofs.withdraw-approval",{proofId:proofId,messageToSender:messageToSender})};Proofs.prototype.generateEmail=function generateEmail(proofId){var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};return this.client.request("email.proofs.generate",_extends({proofId:proofId},options)).then(function(response){return response.data})};Proofs.prototype.return=function _return(proofIdOrIds){return this.client.request("proofs.return",{proofIds:[].concat(proofIdOrIds)}).then(function(response){return{proofIds:response.data.ProofIds,errors:response.data.Errors.map(function(error){return{proofId:error.ProofId,errorCode:error.ErrorCode,errorMessage:error.ErrorMessage}})}})};Proofs.prototype.start=function start(proofId){return this.client.request("proofs.start",{proofId:proofId})};Proofs.prototype.removeEditor=function removeEditor(id){return this.client.request("proofs.remove-editor",{proofId:id})};Proofs.prototype.load=function load(proofId){return this.client.request("proofs.load",{proofId:proofId}).then(function(response){return(new _Proof2.default).fromProof(response.data)})};Proofs.prototype.lock=function lock(proofId){return this.client.request("proofs.lock",{proofId:proofId})};Proofs.prototype.unlock=function unlock(proofId){return this.client.request("proofs.unlock",{proofId:proofId})};Proofs.prototype.requestUnlock=function requestUnlock(proofId){return this.client.request("proofs.request-unlock",{proofId:proofId})};Proofs.prototype.requestAccess=function requestAccess(proofId){return this.client.request("proofs.request-access",{proofId:proofId})};Proofs.prototype.images=function images(proofId){return this.client.request("proofs.images",{proofId:proofId}).then(function(response){return response.data.proof.file})};Proofs.prototype.videoCredentials=function videoCredentials(proofId){var _this5=this;return this.client.cache.auto(_constants.VIDEO_CREDENTIALS_CACHE_PREFIX+proofId,function(){return _this5._videoCredentials(proofId)})};Proofs.prototype._videoCredentials=function _videoCredentials(proofId){var _this6=this;var bluffer=new _bluffer2.default;return this.client.request("proofs.video-credentials",{proofId:proofId}).then(function(response){return Promise.all([response.data.envelope.envelope,_this6.client.rawRequest({method:"GET",url:new _whatwgURL2.default(response.data.videoCredentials.url)}).then(function(videoCredentialsResponse){return videoCredentialsResponse.body})])}).then(function(_ref2){var envelope=_ref2[0],videoCredentials$=_ref2[1];return _this6.client.crypto().decryptImage(envelope+"-"+videoCredentials$,_this6.client.keyPairs.getPrivateKeyPEMs())}).then(function(videoCredentialsBase64){return bluffer.createBase64(videoCredentialsBase64).then(function(buffer){return bluffer.read(buffer)})}).then(function(videoCredentials){var _videoCredentials$spl=videoCredentials.split(VIDEO_URL_TOKEN_SEPARATOR),url=_videoCredentials$spl[0],bearerToken=_videoCredentials$spl[1];var manifestUrl=url.replace("http://","https://");manifestUrl+="/manifest";return{manifestUrl:manifestUrl,bearerToken:bearerToken}})};Proofs.prototype.setMessageToReviewers=function setMessageToReviewers(proofId,messageToReviewers){return this.client.request("proofs.set-reviewers-message",{proofId:proofId,messageToReviewers:messageToReviewers})};Proofs.prototype.returnTodos=function returnTodos(proofIdOrIds,_ref3){var messageToOwners=_ref3.messageToOwners,_ref3$markCommentsAsT=_ref3.markCommentsAsTodo,markCommentsAsTodo=_ref3$markCommentsAsT===undefined?false:_ref3$markCommentsAsT;return this.client.request("proofs.return-todos",{proofIds:[].concat(proofIdOrIds),messageToOwners:messageToOwners,markCommentAsTodo:markCommentsAsTodo})};Proofs.prototype.updateDecision=function updateDecision(proofId,decision){return this.client.request("proofs.update-decision",{proofId:proofId,decision:decision})};Proofs.prototype.update=function update(proofOrProofs){if(proofOrProofs.length===1||typeof proofOrProofs.length==="undefined"){var _concat$=[].concat(proofOrProofs)[0],id=_concat$.id,name=_concat$.name,tags=_concat$.tags,dueDate=_concat$.dueDate,messageToReviewers=_concat$.messageToReviewers,workflow=_concat$.workflow,checklist=_concat$.checklist,file=_concat$.file,reference=_concat$.reference,integrationReferences=_concat$.integrationReferences,reminders=_concat$.reminders,owners=_concat$.owners,canDownload=_concat$.canDownload,isPublic=_concat$.isPublic,start=_concat$.start;return this.client.request("proofs.update",{proof:{id:id,name:name,tags:tags,dueDate:dueDate?dueDate.toISOString():undefined,messageToReviewers:messageToReviewers,workflowId:workflow&&workflow.id||undefined,checklist:checklist,fileId:file&&file.id||undefined,reference:reference,integrationReferences:integrationReferences,reminders:reminders?[].concat(reminders):undefined,owners:owners,canDownload:canDownload,isPublic:isPublic,start:start}}).then(function(response){var proof=(new _Proof2.default).fromProof(response.data);proof.calculateState();return proof})}return this.client.request("proofs.bulk-update",{proofs:transformProofsForUpdate(proofOrProofs)})};Proofs.prototype.next=function next(proofId){return this.client.request("proofs.next",{proofId:proofId}).then(function(response){return(new _Proof2.default).fromProof(response.data)})};Proofs.prototype.addWorkflow=function addWorkflow(proofIdOrIds,workflowTemplateId){return this.client.request("proofs-workflow.add-bulk",{proofIds:[].concat(proofIdOrIds),workflowTemplateId:workflowTemplateId})};Proofs.prototype.sendShareLink=function sendShareLink(_ref4){var proofId=_ref4.proofId,message=_ref4.message,emailAddresses=_ref4.emailAddresses;return this.client.request("proofs.send-share-link",{proofId:proofId,message:message,emailAddresses:emailAddresses})};Proofs.prototype.getWorkflowMetrics=function getWorkflowMetrics(proofId){return this.client.request("proofs.get-workflow-metrics",{proofId:proofId}).then(function(response){if(response.data){return response.data.workflowMetrics}return null})};return Proofs}(_API3.default);exports.default=Proofs;
@@ -2,7 +2,7 @@
2
2
  "accounts.register": {
3
3
  "method": "POST",
4
4
  "path": "/api/users/register",
5
- "body": ["email", "password", "privateKey", "publicKey", "referrer", "setupToken"],
5
+ "body": ["email", "password", "privateKey", "publicKey", "referrer"],
6
6
  "anonymous": true
7
7
  },
8
8
  "accounts.login": {
@@ -799,11 +799,10 @@
799
799
  "path": "/api/proofs/returntodos",
800
800
  "body": ["proofIds", "messageToOwners", "markCommentAsTodo"]
801
801
  },
802
- "proofs.set-message-to-reviewers": {
803
- "version": 2,
802
+ "proofs.set-reviewers-message": {
804
803
  "method": "POST",
805
- "path": "/api/proofs/messagetoreviewers/update/bulk",
806
- "body": ["proofIds", "messageToReviewers"]
804
+ "path": "/api/proofs/update/messagetoreviewers",
805
+ "body": ["proofId", "messageToReviewers"]
807
806
  },
808
807
  "proofs.remove-editor": {
809
808
  "method": "GET",