@pageproof/sdk-pr 678.0.1772428732673 → 680.0.1775532378819
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 +20 -0
- package/lib/adapters/XHRRequestAdapter.js +1 -1
- package/lib/api/Files.js +1 -1
- package/lib/api/Proofs.d.ts +7 -2
- package/lib/api/Proofs.js +1 -1
- package/lib/api/admin/TeamFeatures.d.ts +3 -0
- package/lib/api/admin/TeamFeatures.js +10 -1
- package/lib/models/TeamAccountFeatures.js +1 -1
- package/lib/models/TeamIntelligenceFeatures.d.ts +12 -0
- package/lib/models/TeamIntelligenceFeatures.js +1 -1
- package/lib/models/TeamProofFeatures.d.ts +6 -0
- package/lib/models/TeamProofFeatures.js +1 -1
- package/lib/network/endpoints.json +6 -1
- package/lib/pageproof.js +1 -1
- package/lib/xhr-request-adapter.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,23 @@
|
|
|
1
|
+
## 2.15.1
|
|
2
|
+
|
|
3
|
+
Released on the 19th of March 2026.
|
|
4
|
+
|
|
5
|
+
- [[PP-8526](https://pageproof.atlassian.net/browse/PP-8526)] Added SSO feature flags.
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
## 2.15.0
|
|
9
|
+
|
|
10
|
+
Released on the 17th of March 2026.
|
|
11
|
+
|
|
12
|
+
- [[PP-9567](https://pageproof.atlassian.net/browse/PP-9567)] Added new proofs-service endpoints and TeamDashboard Bin request to support new proof schedule deletion feature.
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
## 2.14.0
|
|
16
|
+
|
|
17
|
+
Released on the 6th of March 2026.
|
|
18
|
+
|
|
19
|
+
- [[PP-9566](https://pageproof.atlassian.net/browse/PP-9566)] Added support for displaying the PageProof Intelligence® insights button on the proofing screen.
|
|
20
|
+
|
|
1
21
|
## 2.13.2
|
|
2
22
|
|
|
3
23
|
Released on the 2nd of March 2026.
|
|
@@ -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 _IRequestAdapter2=require("./IRequestAdapter");var _IRequestAdapter3=_interopRequireDefault(_IRequestAdapter2);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 debug=require("debug")("XHRRequestAdapter");var CONTENT_LENGTH_HEADER="ppcl";var defaultOptions={async:true};var XHRRequestAdapter=function(_IRequestAdapter){_inherits(XHRRequestAdapter,_IRequestAdapter);function XHRRequestAdapter(){var options=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};_classCallCheck(this,XHRRequestAdapter);var _this=_possibleConstructorReturn(this,_IRequestAdapter.call(this));_this.options=_extends({},defaultOptions,options);return _this}XHRRequestAdapter.prototype.send=function send(request){var _this2=this;var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};debug(request.method+" "+request.path);return new Promise(function(resolve,reject){var xhr=new XMLHttpRequest;xhr.onreadystatechange=function(){if(xhr.readyState===4){debug(request.method+" "+request.path+" ("+xhr.status+")");var headers={};try{var lines=xhr.getAllResponseHeaders().split("\n");lines.forEach(function(line){if(line){var _line$split=line.split(": ",2),name=_line$split[0],value=_line$split[1];headers[name.toLowerCase()]=value}})}catch(err){debug(err)}resolve({status:xhr.status,headers:headers,body:options.bluffer?xhr.response:xhr.responseText})}};xhr.onerror=function(){debug(request.method+" "+request.path+" (Unknown error)");reject(new Error("A network level error occurred."))};if(options.onUploadProgress){xhr.upload.onprogress=function(event){if(event.loaded&&event.total){options.onUploadProgress(event.loaded/event.total*100)}}}if(options.onDownloadProgress){var length=null;xhr.onprogress=function(event){if(length===null){length=event.total;try{if(!length){length=parseInt(xhr.getResponseHeader(CONTENT_LENGTH_HEADER),10)}}catch(err){length=0}}if(length){options.onDownloadProgress(event.loaded/length*100)}}}xhr.open(request.method,request.host+request.path+request.query,_this2.options.async);if(options.bluffer){xhr.responseType="blob"}if(request.credentials){xhr.withCredentials=true}if(request.headers){Object.keys(request.headers).forEach(function(name){var value=request.headers[name];if(value!=null){xhr.setRequestHeader(name,value)}})}xhr.send(request.body)})};return XHRRequestAdapter}(_IRequestAdapter3.default);exports.default=XHRRequestAdapter;
|
|
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 _IRequestAdapter2=require("./IRequestAdapter");var _IRequestAdapter3=_interopRequireDefault(_IRequestAdapter2);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 debug=require("debug")("XHRRequestAdapter");var CONTENT_LENGTH_HEADER="ppcl";var defaultOptions={async:true};var XHRRequestAdapter=function(_IRequestAdapter){_inherits(XHRRequestAdapter,_IRequestAdapter);function XHRRequestAdapter(){var options=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};_classCallCheck(this,XHRRequestAdapter);var _this=_possibleConstructorReturn(this,_IRequestAdapter.call(this));_this.options=_extends({},defaultOptions,options);return _this}XHRRequestAdapter.prototype.send=function send(request){var _this2=this;var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};debug(request.method+" "+request.path);return new Promise(function(resolve,reject){var xhr=new XMLHttpRequest;xhr.onreadystatechange=function(){if(xhr.readyState===4){debug(request.method+" "+request.path+" ("+xhr.status+")");var headers={};try{var lines=xhr.getAllResponseHeaders().split("\n");lines.forEach(function(line){if(line){var _line$split=line.split(": ",2),name=_line$split[0],value=_line$split[1];headers[name.toLowerCase()]=value}})}catch(err){debug(err)}resolve({status:xhr.status,headers:headers,body:options.bluffer?xhr.response:xhr.responseText})}};xhr.onerror=function(){debug(request.method+" "+request.path+" (Unknown error)");reject(new Error("A network level error occurred."))};if(options.timeout){xhr.timeout=options.timeout;xhr.ontimeout=function(){debug(request.method+" "+request.path+" (Timeout after "+options.timeout+"ms)");reject(new Error("Request timed out after "+options.timeout+"ms."))}}if(options.onUploadProgress){xhr.upload.onprogress=function(event){if(event.loaded&&event.total){options.onUploadProgress(event.loaded/event.total*100)}}}if(options.onDownloadProgress){var length=null;xhr.onprogress=function(event){if(length===null){length=event.total;try{if(!length){length=parseInt(xhr.getResponseHeader(CONTENT_LENGTH_HEADER),10)}}catch(err){length=0}}if(length){options.onDownloadProgress(event.loaded/length*100)}}}xhr.open(request.method,request.host+request.path+request.query,_this2.options.async);if(options.bluffer){xhr.responseType="blob"}if(request.credentials){xhr.withCredentials=true}if(request.headers){Object.keys(request.headers).forEach(function(name){var value=request.headers[name];if(value!=null){xhr.setRequestHeader(name,value)}})}xhr.send(request.body)})};return XHRRequestAdapter}(_IRequestAdapter3.default);exports.default=XHRRequestAdapter;
|
package/lib/api/Files.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";exports.__esModule=true;var _API2=require("./API");var _API3=_interopRequireDefault(_API2);var _File=require("../models/File");var _File2=_interopRequireDefault(_File);var _FileStatus=require("../enum/FileStatus");var _FileStatus2=_interopRequireDefault(_FileStatus);var _ImportProvider=require("../enum/ImportProvider");var _ImportProvider2=_interopRequireDefault(_ImportProvider);var _streamBlocks=require("../util/streamBlocks");var _streamBlocks2=_interopRequireDefault(_streamBlocks);var _bluffer=require("../bluffer");var _bluffer2=_interopRequireDefault(_bluffer);var _constants=require("../util/constants");var _throttle=require("../util/throttle");var _throttle2=_interopRequireDefault(_throttle);var _concurrent=require("../util/concurrent");var _concurrent2=_interopRequireDefault(_concurrent);var _sleep=require("../util/sleep");var _sleep2=_interopRequireDefault(_sleep);var _fileValidation=require("../util/fileValidation");function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _objectWithoutProperties(obj,keys){var target={};for(var i in obj){if(keys.indexOf(i)>=0)continue;if(!Object.prototype.hasOwnProperty.call(obj,i))continue;target[i]=obj[i]}return target}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 containPercentage(percent,left,right){var total=1-(left+right);return total*percent+left}var Files=function(_API){_inherits(Files,_API);function Files(){_classCallCheck(this,Files);return _possibleConstructorReturn(this,_API.apply(this,arguments))}Files.prototype.generateToken=function generateToken(assignedTo,assignedType){if(assignedTo&&!assignedType){return Promise.reject(Error('The "assignedType" option is required when specifying the "assignedTo" option.'))}if(!assignedTo&&assignedType){return Promise.reject(Error('The "assignedTo" option is required when specifying the "assignedType" option.'))}return this.client.request("files.legacy.generate-token",{relatedId:assignedTo,fileType:assignedType}).then(function(response){return response.data.Token})};Files.prototype.setCanDownload=function setCanDownload(fileId,canDownload){return this.client.request("files.can-download.update",{fileId:fileId,downloadOriginal:canDownload?1:0})};Files.prototype._waitFileProcessed=function _waitFileProcessed(id){var _this2=this;return new Promise(function(resolve,reject){var checkTimeout=null;var timeoutTimeout=null;var check=function check(){_this2.details(id).then(function(file){checkTimeout=null;switch(file.status){case _FileStatus2.default.OK:{resolve(file);break}case _FileStatus2.default.ERROR:{reject(new Error("File "+id+" encountered a processing error: "+file.message));break}default:{checkTimeout=setTimeout(check,5e3);break}}if(!checkTimeout||file.status===_FileStatus2.default.RIPPING){clearTimeout(timeoutTimeout)}}).catch(reject)};check();timeoutTimeout=setTimeout(function(){clearTimeout(checkTimeout);reject(new Error("File did not finish processing within specified duration."))},3e4)})};Files.prototype._createWebsiteFile=function _createWebsiteFile(url){var _this3=this;return this._generateKeyIVEnvelope().then(function(_ref){var envelope=_ref.envelope;return _this3.client.request("files.import.web",{url:url,envelope:envelope})}).then(function(response){return response.data})};Files.prototype._importFileFromUrl=function _importFileFromUrl(_ref2){var _this4=this;var name=_ref2.name,url=_ref2.url,provider=_ref2.provider,auth=_ref2.auth,download=_ref2.download;var endpoint=provider;if(provider===_ImportProvider2.default.NONE){endpoint="generic"}var _parseFilename=(0,_fileValidation.parseFilename)(name),filename=_parseFilename.name,extension=_parseFilename.extension;return this._generateKeyIVEnvelope().then(function(_ref3){var envelope=_ref3.envelope;return _this4.client.request("files.import."+endpoint,{extn:extension,filename:filename,url:url,envelope:envelope,accessToken:auth,storeOriginal:download})}).then(function(response){return response.data})};Files.prototype.import=function _import(_ref4){var _this5=this;var name=_ref4.name,url=_ref4.url,_ref4$provider=_ref4.provider,provider=_ref4$provider===undefined?_ImportProvider2.default.NONE:_ref4$provider,auth=_ref4.auth,_ref4$download=_ref4.download,download=_ref4$download===undefined?false:_ref4$download,_ref4$process=_ref4.process,process=_ref4$process===undefined?false:_ref4$process;var providerSupported=Object.keys(_ImportProvider2.default).some(function(key){return _ImportProvider2.default[key]===provider});if(!providerSupported){return Promise.reject(new Error('Unsupported provider "'+provider+'"'))}return(provider===_ImportProvider2.default.WEBSITE?this._createWebsiteFile(url):this._importFileFromUrl({name:name,url:url,provider:provider,auth:auth,download:download})).then(function(token){if(process){return _this5._waitFileProcessed(token)}else{var file=new _File2.default;file.id=token;return file}})};Files.prototype.email=function email(){return this.client.request("files.create-email").then(function(response){return response.data})};Files.prototype._generateKeyIVEnvelope=function _generateKeyIVEnvelope(){var _this6=this;return this.client.crypto().generateKeyIV().then(function(keyIV){return Promise.all([keyIV,_this6.client.crypto().envelopeSeal(keyIV.keyIV,_this6.client.keyPairs.getPublicKeyPEMs())])}).then(function(_ref5){var keyIV=_ref5[0],envelope=_ref5[1];return{keyIV:keyIV,envelope:envelope}})};Files.prototype.upload=function upload(){return this.upload__v2.apply(this,arguments)};Files.prototype.upload__v2=function upload__v2(files){var _this7=this;var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};var _options$concurrent=options.concurrent,concurrency=_options$concurrent===undefined?6:_options$concurrent,opts=_objectWithoutProperties(options,["concurrent"]);var scheduleChunk=(0,_concurrent2.default)(concurrency);var scheduleDone=(0,_concurrent2.default)(1);var doneFiles=[];var multipleFiles=Array.isArray(files);var filesList=multipleFiles?files:[files];var filesWithParsedNames=void 0;try{filesWithParsedNames=(0,_fileValidation.prepareFilesForUpload)(filesList)}catch(error){return Promise.reject(error)}var done=function done(result){doneFiles.push(result);return scheduleDone(function(){if(doneFiles.length){var _doneFiles=doneFiles.slice();doneFiles.length=0;return _this7.client.request("files.v2.upload-complete",{files:_doneFiles})}return null})};var bluffer=new _bluffer2.default;return this.client.request("files.v2.generate-credentials",{supports:{providers:["abs","custom"]},files:filesWithParsedNames.map(function(file){var name=void 0;var extension=void 0;if(file.extension){var _ref6=[file.name,file.extension];name=_ref6[0];extension=_ref6[1]}else{var _ref7=[file.parsedFilename.name,file.parsedFilename.extension];name=_ref7[0];extension=_ref7[1]}var size=bluffer.size(file.contents);var chunks=Math.ceil(size/_constants.BYTES_PER_BLOCK);if(file.onProgress){file.onProgress(0)}return{name:name,extension:extension,chunks:chunks,size:size,fileTypeOverride:file.fileTypeOverride,hash:null,adobeExportData:file.adobeExportData?JSON.stringify(file.adobeExportData):null,assignedTo:file.assignedTo,assignedType:file.assignedType,canDownload:typeof file.download!=="undefined"?!!file.download:true}})}).then(function(response){return Promise.all(filesWithParsedNames.map(function(file,index){var definition=response.data[index];if(file.onProgress){file.onProgress(1)}var entity=new _File2.default;entity.id=definition.FileId;if(file.onFileDetails){file.onFileDetails(entity)}return _this7._upload__v2(file,definition,opts,scheduleChunk,done).then(function(){return entity})}))}).then(function(results){return multipleFiles?results:results[0]})};Files.prototype._upload__v2=function _upload__v2(file,definition,options,schedule,done){var _this8=this;return this._generateKeyIVEnvelope().then(function(_ref8){var keyIV=_ref8.keyIV,envelope=_ref8.envelope;return new Promise(function(resolve,reject){var fileId=definition.FileId,uploadCredentials=definition.UploadCredentials;var bluffer=new _bluffer2.default;var complete=false;var index=0;var blocks=(0,_streamBlocks2.default)(file.contents,function(b){return bluffer.readBase64(b)});var tasks=[];var count=Math.ceil(bluffer.size(file.contents)/_constants.BYTES_PER_BLOCK);var percent=new Array(count);var lastPercent=1;var onUploadProgress=function onUploadProgress(){};var onProgress=file.onProgress;if(onProgress){onUploadProgress=function onUploadProgress(blockIndex,progress){percent[blockIndex]=Math.max(progress,percent[blockIndex]||0);var totalPercent=containPercentage(percent.reduce(function(a,b){return a+(b||0)},0)/count/100,.01,.01)*100;if(typeof options.progressDecimalPlaces!=="undefined"){totalPercent=+totalPercent.toFixed(options.progressDecimalPlaces)}if(lastPercent!==totalPercent){onProgress(totalPercent);lastPercent=totalPercent}}}function handle(block,blockIndex){var task=encryptAndUpload(block,blockIndex);tasks.push(task);return task}var abs=function abs(block,blockIndex){return _this8.client.rawRequest({method:"PUT",host:uploadCredentials.url,path:"/"+fileId+"/"+blockIndex,query:uploadCredentials.sas,body:block,headers:{"x-ms-blob-type":"BlockBlob"}},{onUploadProgress:onUploadProgress.bind(null,blockIndex)})};var custom=function custom(block,blockIndex){var values={"file.id":fileId,"chunk.index":blockIndex};var interpolate=function interpolate(str){var map=arguments.length>1&&arguments[1]!==undefined?arguments[1]:function(a){return a};return str.replace(/\{([\w\.]+)\}/g,function(_,key){return map(values[key])})};var interpolatedHeaders={};Object.keys(uploadCredentials.headers).forEach(function(name){var value=interpolate(uploadCredentials.headers[name]);interpolatedHeaders[interpolate(name)]=value});return _this8.client.rawRequest({method:uploadCredentials.method,host:interpolate(uploadCredentials.host),path:interpolate(uploadCredentials.path,encodeURIComponent),query:interpolate(uploadCredentials.query,encodeURIComponent),body:block,headers:interpolatedHeaders},{onUploadProgress:onUploadProgress.bind(null,blockIndex)})};var uploadData={abs:abs,custom:custom}[uploadCredentials.type];var encryptAndUpload=function encryptAndUpload(block,blockIndex){return _this8.client.crypto().encryptFileBlock(keyIV,block,true).then(function(block$_){return bluffer.createBase64(block$_)}).then(function(block$){return bluffer.readArrayBuffer(block$)}).then(function(block$){var retries=0;var chunkRetryLimit=typeof options.chunkRetryLimit!=="undefined"?options.chunkRetryLimit:3;function attemptUploadData(){return uploadData(block$,blockIndex).then(function(response){if([200,201].indexOf(response.status)===-1){if(retries<chunkRetryLimit){retries++;if(options.chunkRetryDelay){return(0,_sleep2.default)(options.chunkRetryDelay).then(attemptUploadData)}return attemptUploadData()}else{var err=new Error("Failed to upload block #"+blockIndex+" (retried "+retries+" times).");reject(err);complete=true;throw err}}return response})}return attemptUploadData()})};var finish=function finish(){return done({fileId:fileId,envelope:envelope}).then(function(){if(onProgress)onProgress(100)})};function next(){if(complete){return}schedule(function(){return blocks().then(function(data){if(data){next();return handle(data,index++)}else if(!complete){complete=true;var final=Promise.all(tasks).then(finish);resolve(final)}})})}next();if(file.async!==false){resolve()}})})};Files.prototype.upload__legacy=function upload__legacy(_ref9){var _this9=this;var name=_ref9.name,contents=_ref9.contents,adobeExportData=_ref9.adobeExportData,assignedTo=_ref9.assignedTo,assignedType=_ref9.assignedType,_ref9$download=_ref9.download,download=_ref9$download===undefined?false:_ref9$download,_ref9$async=_ref9.async,async=_ref9$async===undefined?true:_ref9$async,onProgress=_ref9.onProgress,onError=_ref9.onError;var parsedFilename=void 0;try{parsedFilename=(0,_fileValidation.parseFilename)(name)}catch(error){return Promise.reject(error)}return this.generateToken(assignedTo,assignedType).then(function(token){return Promise.all([token,_this9._generateKeyIVEnvelope()])}).then(function(_ref10){var token=_ref10[0],_ref10$=_ref10[1],keyIV=_ref10$.keyIV,envelope=_ref10$.envelope;var process=_this9._upload__legacy({parsedFilename:parsedFilename,contents:contents,adobeExportData:adobeExportData,download:download,token:token,keyIV:keyIV,envelope:envelope,onProgress:onProgress,onError:onError});if(async){process=Promise.resolve()}return process.then(function(){return token})}).then(function(token){var file=new _File2.default;file.id=token;return file})};Files.prototype._upload__legacy=function _upload__legacy(_ref11){var _this10=this;var parsedFilename=_ref11.parsedFilename,contents=_ref11.contents,adobeExportData=_ref11.adobeExportData,download=_ref11.download,token=_ref11.token,keyIV=_ref11.keyIV,envelope=_ref11.envelope,onProgress=_ref11.onProgress;return new Promise(function(resolve){var concurrent=4;var filename=parsedFilename.name,extension=parsedFilename.extension;var blocks=(0,_streamBlocks2.default)(contents);var chain=Promise.resolve();var index=0;var end=false;var bluffer=new _bluffer2.default;var count=Math.ceil(bluffer.size(contents)/_constants.BYTES_PER_BLOCK);var percent=new Array(count);var onUploadProgress=function onUploadProgress(){};if(onProgress){onUploadProgress=function onUploadProgress(blockIndex,progress){percent[blockIndex]=Math.max(progress,percent[blockIndex]||0);onProgress(percent.reduce(function(a,b){return a+(b||0)},0)/count*.99)}}var process=function process(block,blockIndex){return _this10.client.crypto().encryptFileBlock(keyIV,block).then(function(block$){return _this10.client.request("files.legacy.upload-block",{block:blockIndex,part:1,token:token,data:block$},{onUploadProgress:onUploadProgress.bind(null,blockIndex)})})};function next(){blocks().then(function(block){if(end)return;if(block===null){end=true;resolve(chain.then(complete))}else{var handle=process(block,index++);chain=chain.then(function(){return handle});handle.then(next)}})}var complete=function complete(){return _this10.client.request("files.legacy.upload-complete",{block:0,blockCount:index,part:0,token:token,extn:extension,pages:1,filename:filename,storeoriginal:download?1:0,adobeExportData:adobeExportData?JSON.stringify(adobeExportData):null,envelope:envelope}).then(function(){return onProgress&&onProgress(100)})};while(concurrent--){next()}})};Files.prototype.download=function download(_options){var _this11=this;var options=typeof _options==="string"?{fileId:_options}:_options;var fileId=options.fileId,onFileDetails=options.onFileDetails;return this.details(fileId).then(function(file){if(!options.silent){if(!file.downloadable){throw new Error("File "+fileId+" is not downloadable.")}if(file.status!==_FileStatus2.default.OK){throw new Error("File "+fileId+" cannot be download. The file may still be uploading, processing or has errored.")}if(!file.blocks){throw new Error("File "+fileId+" is empty.")}}if(onFileDetails){onFileDetails(file)}return _this11._downloadFile(file,options)})};Files.prototype._downloadFile=function _downloadFile(file,options){var _this12=this;return new Promise(function(resolve){var concurrent=4;var bluffer=new _bluffer2.default;var count=file.blocks;var blocks=new Array(count);var chain=Promise.resolve();var onData=options.onData||function onData(block,index){blocks[index]=block};var onDownloadProgress=function onDownloadProgress(){};if(options.onProgress){var percent=new Array(count);onDownloadProgress=function onDownloadProgress(blockIndex,progress){percent[blockIndex]=Math.max(progress,percent[blockIndex]||0);options.onProgress(percent.reduce(function(a,b){return a+(b||0)},0)/count*.99)}}var process=function process(blockIndex){return _this12.client.request("files.download-block",{proofId:file.assignedTo,fileId:file.id,block:blockIndex+1,s:options.silent?1:undefined},{onDownloadProgress:onDownloadProgress.bind(null,blockIndex)}).then(function(response){return _this12.client.crypto().decryptFileBlock(response.data,_this12.client.keyPairs.getPrivateKeyPEMs()).then(function(blockBase64){return bluffer.createBase64(blockBase64)})})};var index=0;var end=false;function next(){if(end)return;if(index<blocks.length){var blockIndex=index++;var block=process(blockIndex);chain=chain.then(function(){return block.then(function(data){return onData(data,blockIndex,count)})});block.then(next)}else{end=true;resolve(chain.then(complete))}}var complete=function complete(){if(options.onProgress){options.onProgress(100)}if(!options.onData){return bluffer.combine.apply(bluffer,blocks)}return null};while(concurrent--){next()}})};Files.prototype.details=function details(fileId){return this.client.request("files.details",{fileId:fileId}).then(function(response){return(new _File2.default).fromFile(response.data)})};Files.prototype.thumbnail=function thumbnail(fileId){var _this13=this;return this.client.cache.auto(_constants.THUMBNAIL_CACHE_PREFIX+fileId,function(){return _this13._thumbnail(fileId)})};Files.prototype._thumbnail=function _thumbnail(fileId){var _this14=this;return this.client.request("files.thumbnail",{fileId:fileId}).then(function(response){return _this14.client.crypto().decryptImage(response.data,_this14.client.keyPairs.getPrivateKeyPEMs())}).then(function(imageBase64){var bluffer=new _bluffer2.default;return bluffer.createBase64(imageBase64)})};Files.prototype.preview=function preview(fileId){var _this15=this;var pageNumber=arguments.length>1&&arguments[1]!==undefined?arguments[1]:1;var quality=arguments.length>2&&arguments[2]!==undefined?arguments[2]:"low";return this.client.cache.auto(_constants.PREVIEW_CACHE_PREFIX+fileId+pageNumber+quality,function(){return _this15._preview(fileId,pageNumber,quality)})};Files.prototype._preview=function _preview(fileId,pageNumber,quality){var _this16=this;return this.client.request("files.preview",{fileId:fileId,pageNumber:pageNumber,quality:{low:"lo",high:"hi"}[quality]||quality}).then(function(response){return _this16.client.crypto().decryptImage(response.data,_this16.client.keyPairs.getPrivateKeyPEMs())}).then(function(imageBase64){var bluffer=new _bluffer2.default;return bluffer.createBase64(imageBase64)})};Files.prototype.thumbnails=function thumbnails(fileIds,_ref12){var _this17=this;var _ref12$async=_ref12.async,async=_ref12$async===undefined?false:_ref12$async,onLoadThumbnail=_ref12.onLoadThumbnail,onLoadThumbnails=_ref12.onLoadThumbnails,_ref12$onLoadThumbnai=_ref12.onLoadThumbnailsThrottleMs,onLoadThumbnailsThrottleMs=_ref12$onLoadThumbnai===undefined?1e3:_ref12$onLoadThumbnai,onLoadError=_ref12.onLoadError;var scheduled=[];var pendingBatch={};var scheduleOnLoadThumbnails=onLoadThumbnails?(0,_throttle2.default)(function(){if(Object.keys(pendingBatch).length){onLoadThumbnails(pendingBatch);pendingBatch={}}},onLoadThumbnailsThrottleMs):function(){};return Promise.all(fileIds.map(function(fileId){return _this17.client.cache.auto(_constants.THUMBNAIL_CACHE_PREFIX+fileId,function(resolve){scheduled.push({fileId:fileId,resolve:resolve})}).then(function(thumbnail){var _ref13;return thumbnail&&(_ref13={},_ref13[fileId]=thumbnail,_ref13)})})).then(function(entries){var more=Promise.all(scheduled.map(function(_ref14){var fileId=_ref14.fileId,resolve=_ref14.resolve;return _this17._thumbnail(fileId).then(function(thumbnail){var _ref15;resolve(thumbnail);if(onLoadThumbnail){var _onLoadThumbnail;onLoadThumbnail((_onLoadThumbnail={},_onLoadThumbnail[fileId]=thumbnail,_onLoadThumbnail))}pendingBatch[fileId]=thumbnail;scheduleOnLoadThumbnails();return _ref15={},_ref15[fileId]=thumbnail,_ref15}).catch(function(err){if(onLoadError){onLoadError(err,fileId)}if(!async){return Promise.reject(err)}return{}})}));if(async){return entries}else{return more.then(function(moreEntries){return[].concat(entries,moreEntries)})}}).then(function(entries){return Object.assign.apply(Object,[{}].concat(entries))})};Files.prototype.duplicate=function duplicate(id){return this.client.request("files.duplicate",{id:id}).then(function(response){return response.data.file})};return Files}(_API3.default);exports.default=Files;
|
|
1
|
+
"use strict";exports.__esModule=true;var _API2=require("./API");var _API3=_interopRequireDefault(_API2);var _File=require("../models/File");var _File2=_interopRequireDefault(_File);var _FileStatus=require("../enum/FileStatus");var _FileStatus2=_interopRequireDefault(_FileStatus);var _ImportProvider=require("../enum/ImportProvider");var _ImportProvider2=_interopRequireDefault(_ImportProvider);var _streamBlocks=require("../util/streamBlocks");var _streamBlocks2=_interopRequireDefault(_streamBlocks);var _bluffer=require("../bluffer");var _bluffer2=_interopRequireDefault(_bluffer);var _constants=require("../util/constants");var _throttle=require("../util/throttle");var _throttle2=_interopRequireDefault(_throttle);var _concurrent=require("../util/concurrent");var _concurrent2=_interopRequireDefault(_concurrent);var _sleep=require("../util/sleep");var _sleep2=_interopRequireDefault(_sleep);var _fileValidation=require("../util/fileValidation");function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _objectWithoutProperties(obj,keys){var target={};for(var i in obj){if(keys.indexOf(i)>=0)continue;if(!Object.prototype.hasOwnProperty.call(obj,i))continue;target[i]=obj[i]}return target}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 DEFAULT_CHUNK_UPLOAD_TIMEOUT=1*60*1e3;function containPercentage(percent,left,right){var total=1-(left+right);return total*percent+left}var Files=function(_API){_inherits(Files,_API);function Files(){_classCallCheck(this,Files);return _possibleConstructorReturn(this,_API.apply(this,arguments))}Files.prototype.generateToken=function generateToken(assignedTo,assignedType){if(assignedTo&&!assignedType){return Promise.reject(Error('The "assignedType" option is required when specifying the "assignedTo" option.'))}if(!assignedTo&&assignedType){return Promise.reject(Error('The "assignedTo" option is required when specifying the "assignedType" option.'))}return this.client.request("files.legacy.generate-token",{relatedId:assignedTo,fileType:assignedType}).then(function(response){return response.data.Token})};Files.prototype.setCanDownload=function setCanDownload(fileId,canDownload){return this.client.request("files.can-download.update",{fileId:fileId,downloadOriginal:canDownload?1:0})};Files.prototype._waitFileProcessed=function _waitFileProcessed(id){var _this2=this;return new Promise(function(resolve,reject){var checkTimeout=null;var timeoutTimeout=null;var check=function check(){_this2.details(id).then(function(file){checkTimeout=null;switch(file.status){case _FileStatus2.default.OK:{resolve(file);break}case _FileStatus2.default.ERROR:{reject(new Error("File "+id+" encountered a processing error: "+file.message));break}default:{checkTimeout=setTimeout(check,5e3);break}}if(!checkTimeout||file.status===_FileStatus2.default.RIPPING){clearTimeout(timeoutTimeout)}}).catch(reject)};check();timeoutTimeout=setTimeout(function(){clearTimeout(checkTimeout);reject(new Error("File did not finish processing within specified duration."))},3e4)})};Files.prototype._createWebsiteFile=function _createWebsiteFile(url){var _this3=this;return this._generateKeyIVEnvelope().then(function(_ref){var envelope=_ref.envelope;return _this3.client.request("files.import.web",{url:url,envelope:envelope})}).then(function(response){return response.data})};Files.prototype._importFileFromUrl=function _importFileFromUrl(_ref2){var _this4=this;var name=_ref2.name,url=_ref2.url,provider=_ref2.provider,auth=_ref2.auth,download=_ref2.download;var endpoint=provider;if(provider===_ImportProvider2.default.NONE){endpoint="generic"}var _parseFilename=(0,_fileValidation.parseFilename)(name),filename=_parseFilename.name,extension=_parseFilename.extension;return this._generateKeyIVEnvelope().then(function(_ref3){var envelope=_ref3.envelope;return _this4.client.request("files.import."+endpoint,{extn:extension,filename:filename,url:url,envelope:envelope,accessToken:auth,storeOriginal:download})}).then(function(response){return response.data})};Files.prototype.import=function _import(_ref4){var _this5=this;var name=_ref4.name,url=_ref4.url,_ref4$provider=_ref4.provider,provider=_ref4$provider===undefined?_ImportProvider2.default.NONE:_ref4$provider,auth=_ref4.auth,_ref4$download=_ref4.download,download=_ref4$download===undefined?false:_ref4$download,_ref4$process=_ref4.process,process=_ref4$process===undefined?false:_ref4$process;var providerSupported=Object.keys(_ImportProvider2.default).some(function(key){return _ImportProvider2.default[key]===provider});if(!providerSupported){return Promise.reject(new Error('Unsupported provider "'+provider+'"'))}return(provider===_ImportProvider2.default.WEBSITE?this._createWebsiteFile(url):this._importFileFromUrl({name:name,url:url,provider:provider,auth:auth,download:download})).then(function(token){if(process){return _this5._waitFileProcessed(token)}else{var file=new _File2.default;file.id=token;return file}})};Files.prototype.email=function email(){return this.client.request("files.create-email").then(function(response){return response.data})};Files.prototype._generateKeyIVEnvelope=function _generateKeyIVEnvelope(){var _this6=this;return this.client.crypto().generateKeyIV().then(function(keyIV){return Promise.all([keyIV,_this6.client.crypto().envelopeSeal(keyIV.keyIV,_this6.client.keyPairs.getPublicKeyPEMs())])}).then(function(_ref5){var keyIV=_ref5[0],envelope=_ref5[1];return{keyIV:keyIV,envelope:envelope}})};Files.prototype.upload=function upload(){return this.upload__v2.apply(this,arguments)};Files.prototype.upload__v2=function upload__v2(files){var _this7=this;var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};var _options$concurrent=options.concurrent,concurrency=_options$concurrent===undefined?6:_options$concurrent,opts=_objectWithoutProperties(options,["concurrent"]);var scheduleChunk=(0,_concurrent2.default)(concurrency);var scheduleDone=(0,_concurrent2.default)(1);var doneFiles=[];var multipleFiles=Array.isArray(files);var filesList=multipleFiles?files:[files];var filesWithParsedNames=void 0;try{filesWithParsedNames=(0,_fileValidation.prepareFilesForUpload)(filesList)}catch(error){return Promise.reject(error)}var done=function done(result){doneFiles.push(result);return scheduleDone(function(){if(doneFiles.length){var _doneFiles=doneFiles.slice();doneFiles.length=0;return _this7.client.request("files.v2.upload-complete",{files:_doneFiles})}return null})};var bluffer=new _bluffer2.default;return this.client.request("files.v2.generate-credentials",{supports:{providers:["abs","custom"]},files:filesWithParsedNames.map(function(file){var name=void 0;var extension=void 0;if(file.extension){var _ref6=[file.name,file.extension];name=_ref6[0];extension=_ref6[1]}else{var _ref7=[file.parsedFilename.name,file.parsedFilename.extension];name=_ref7[0];extension=_ref7[1]}var size=bluffer.size(file.contents);var chunks=Math.ceil(size/_constants.BYTES_PER_BLOCK);if(file.onProgress){file.onProgress(0)}return{name:name,extension:extension,chunks:chunks,size:size,fileTypeOverride:file.fileTypeOverride,hash:null,adobeExportData:file.adobeExportData?JSON.stringify(file.adobeExportData):null,assignedTo:file.assignedTo,assignedType:file.assignedType,canDownload:typeof file.download!=="undefined"?!!file.download:true}})}).then(function(response){return Promise.all(filesWithParsedNames.map(function(file,index){var definition=response.data[index];if(file.onProgress){file.onProgress(1)}var entity=new _File2.default;entity.id=definition.FileId;if(file.onFileDetails){file.onFileDetails(entity)}return _this7._upload__v2(file,definition,opts,scheduleChunk,done).then(function(){return entity})}))}).then(function(results){return multipleFiles?results:results[0]})};Files.prototype._upload__v2=function _upload__v2(file,definition,options,schedule,done){var _this8=this;return this._generateKeyIVEnvelope().then(function(_ref8){var keyIV=_ref8.keyIV,envelope=_ref8.envelope;return new Promise(function(resolve,reject){var fileId=definition.FileId,uploadCredentials=definition.UploadCredentials;var bluffer=new _bluffer2.default;var complete=false;var index=0;var blocks=(0,_streamBlocks2.default)(file.contents,function(b){return bluffer.readBase64(b)});var tasks=[];var count=Math.ceil(bluffer.size(file.contents)/_constants.BYTES_PER_BLOCK);var percent=new Array(count);var lastPercent=1;var onUploadProgress=function onUploadProgress(){};var onProgress=file.onProgress;if(onProgress){onUploadProgress=function onUploadProgress(blockIndex,progress){percent[blockIndex]=Math.max(progress,percent[blockIndex]||0);var totalPercent=containPercentage(percent.reduce(function(a,b){return a+(b||0)},0)/count/100,.01,.01)*100;if(typeof options.progressDecimalPlaces!=="undefined"){totalPercent=+totalPercent.toFixed(options.progressDecimalPlaces)}if(lastPercent!==totalPercent){onProgress(totalPercent);lastPercent=totalPercent}}}function handle(block,blockIndex){var task=encryptAndUpload(block,blockIndex);tasks.push(task);return task}var chunkUploadTimeout=typeof options.chunkUploadTimeout!=="undefined"?options.chunkUploadTimeout:DEFAULT_CHUNK_UPLOAD_TIMEOUT;var abs=function abs(block,blockIndex){return _this8.client.rawRequest({method:"PUT",host:uploadCredentials.url,path:"/"+fileId+"/"+blockIndex,query:uploadCredentials.sas,body:block,headers:{"x-ms-blob-type":"BlockBlob"}},{onUploadProgress:onUploadProgress.bind(null,blockIndex),timeout:chunkUploadTimeout})};var custom=function custom(block,blockIndex){var values={"file.id":fileId,"chunk.index":blockIndex};var interpolate=function interpolate(str){var map=arguments.length>1&&arguments[1]!==undefined?arguments[1]:function(a){return a};return str.replace(/\{([\w\.]+)\}/g,function(_,key){return map(values[key])})};var interpolatedHeaders={};Object.keys(uploadCredentials.headers).forEach(function(name){var value=interpolate(uploadCredentials.headers[name]);interpolatedHeaders[interpolate(name)]=value});return _this8.client.rawRequest({method:uploadCredentials.method,host:interpolate(uploadCredentials.host),path:interpolate(uploadCredentials.path,encodeURIComponent),query:interpolate(uploadCredentials.query,encodeURIComponent),body:block,headers:interpolatedHeaders},{onUploadProgress:onUploadProgress.bind(null,blockIndex),timeout:chunkUploadTimeout})};var uploadData={abs:abs,custom:custom}[uploadCredentials.type];var encryptAndUpload=function encryptAndUpload(block,blockIndex){return _this8.client.crypto().encryptFileBlock(keyIV,block,true).then(function(block$_){return bluffer.createBase64(block$_)}).then(function(block$){return bluffer.readArrayBuffer(block$)}).then(function(block$){var retries=0;var chunkRetryLimit=typeof options.chunkRetryLimit!=="undefined"?options.chunkRetryLimit:3;function attemptUploadData(){return uploadData(block$,blockIndex).then(function(response){if([200,201].indexOf(response.status)===-1){if(retries<chunkRetryLimit){retries++;if(options.chunkRetryDelay){return(0,_sleep2.default)(options.chunkRetryDelay).then(attemptUploadData)}return attemptUploadData()}else{var err=new Error("Failed to upload block #"+blockIndex+" (retried "+retries+" times).");reject(err);complete=true;throw err}}return response}).catch(function(err){if(retries<chunkRetryLimit){retries++;if(options.chunkRetryDelay){return(0,_sleep2.default)(options.chunkRetryDelay).then(attemptUploadData)}return attemptUploadData()}else{var finalErr=new Error("Failed to upload block #"+blockIndex+" after "+retries+" retries: "+err.message);reject(finalErr);complete=true;throw finalErr}})}return attemptUploadData()})};var finish=function finish(){return done({fileId:fileId,envelope:envelope}).then(function(){if(onProgress)onProgress(100)})};var reportUploadError=function reportUploadError(message){return _this8.client.request("files.event",{fileId:fileId,type:"upload-error",message:message}).catch(function(){})};function next(){if(complete){return}schedule(function(){return blocks().then(function(data){if(data){next();return handle(data,index++)}else if(!complete){complete=true;var final=Promise.all(tasks).then(finish).catch(function(err){reportUploadError(err.message);throw err});resolve(final)}})})}next();if(file.async!==false){resolve()}})})};Files.prototype.upload__legacy=function upload__legacy(_ref9){var _this9=this;var name=_ref9.name,contents=_ref9.contents,adobeExportData=_ref9.adobeExportData,assignedTo=_ref9.assignedTo,assignedType=_ref9.assignedType,_ref9$download=_ref9.download,download=_ref9$download===undefined?false:_ref9$download,_ref9$async=_ref9.async,async=_ref9$async===undefined?true:_ref9$async,onProgress=_ref9.onProgress,onError=_ref9.onError;var parsedFilename=void 0;try{parsedFilename=(0,_fileValidation.parseFilename)(name)}catch(error){return Promise.reject(error)}return this.generateToken(assignedTo,assignedType).then(function(token){return Promise.all([token,_this9._generateKeyIVEnvelope()])}).then(function(_ref10){var token=_ref10[0],_ref10$=_ref10[1],keyIV=_ref10$.keyIV,envelope=_ref10$.envelope;var process=_this9._upload__legacy({parsedFilename:parsedFilename,contents:contents,adobeExportData:adobeExportData,download:download,token:token,keyIV:keyIV,envelope:envelope,onProgress:onProgress,onError:onError});if(async){process=Promise.resolve()}return process.then(function(){return token})}).then(function(token){var file=new _File2.default;file.id=token;return file})};Files.prototype._upload__legacy=function _upload__legacy(_ref11){var _this10=this;var parsedFilename=_ref11.parsedFilename,contents=_ref11.contents,adobeExportData=_ref11.adobeExportData,download=_ref11.download,token=_ref11.token,keyIV=_ref11.keyIV,envelope=_ref11.envelope,onProgress=_ref11.onProgress;return new Promise(function(resolve){var concurrent=4;var filename=parsedFilename.name,extension=parsedFilename.extension;var blocks=(0,_streamBlocks2.default)(contents);var chain=Promise.resolve();var index=0;var end=false;var bluffer=new _bluffer2.default;var count=Math.ceil(bluffer.size(contents)/_constants.BYTES_PER_BLOCK);var percent=new Array(count);var onUploadProgress=function onUploadProgress(){};if(onProgress){onUploadProgress=function onUploadProgress(blockIndex,progress){percent[blockIndex]=Math.max(progress,percent[blockIndex]||0);onProgress(percent.reduce(function(a,b){return a+(b||0)},0)/count*.99)}}var process=function process(block,blockIndex){return _this10.client.crypto().encryptFileBlock(keyIV,block).then(function(block$){return _this10.client.request("files.legacy.upload-block",{block:blockIndex,part:1,token:token,data:block$},{onUploadProgress:onUploadProgress.bind(null,blockIndex)})})};function next(){blocks().then(function(block){if(end)return;if(block===null){end=true;resolve(chain.then(complete))}else{var handle=process(block,index++);chain=chain.then(function(){return handle});handle.then(next)}})}var complete=function complete(){return _this10.client.request("files.legacy.upload-complete",{block:0,blockCount:index,part:0,token:token,extn:extension,pages:1,filename:filename,storeoriginal:download?1:0,adobeExportData:adobeExportData?JSON.stringify(adobeExportData):null,envelope:envelope}).then(function(){return onProgress&&onProgress(100)})};while(concurrent--){next()}})};Files.prototype.download=function download(_options){var _this11=this;var options=typeof _options==="string"?{fileId:_options}:_options;var fileId=options.fileId,onFileDetails=options.onFileDetails;return this.details(fileId).then(function(file){if(!options.silent){if(!file.downloadable){throw new Error("File "+fileId+" is not downloadable.")}if(file.status!==_FileStatus2.default.OK){throw new Error("File "+fileId+" cannot be download. The file may still be uploading, processing or has errored.")}if(!file.blocks){throw new Error("File "+fileId+" is empty.")}}if(onFileDetails){onFileDetails(file)}return _this11._downloadFile(file,options)})};Files.prototype._downloadFile=function _downloadFile(file,options){var _this12=this;return new Promise(function(resolve){var concurrent=4;var bluffer=new _bluffer2.default;var count=file.blocks;var blocks=new Array(count);var chain=Promise.resolve();var onData=options.onData||function onData(block,index){blocks[index]=block};var onDownloadProgress=function onDownloadProgress(){};if(options.onProgress){var percent=new Array(count);onDownloadProgress=function onDownloadProgress(blockIndex,progress){percent[blockIndex]=Math.max(progress,percent[blockIndex]||0);options.onProgress(percent.reduce(function(a,b){return a+(b||0)},0)/count*.99)}}var process=function process(blockIndex){return _this12.client.request("files.download-block",{proofId:file.assignedTo,fileId:file.id,block:blockIndex+1,s:options.silent?1:undefined},{onDownloadProgress:onDownloadProgress.bind(null,blockIndex)}).then(function(response){return _this12.client.crypto().decryptFileBlock(response.data,_this12.client.keyPairs.getPrivateKeyPEMs()).then(function(blockBase64){return bluffer.createBase64(blockBase64)})})};var index=0;var end=false;function next(){if(end)return;if(index<blocks.length){var blockIndex=index++;var block=process(blockIndex);chain=chain.then(function(){return block.then(function(data){return onData(data,blockIndex,count)})});block.then(next)}else{end=true;resolve(chain.then(complete))}}var complete=function complete(){if(options.onProgress){options.onProgress(100)}if(!options.onData){return bluffer.combine.apply(bluffer,blocks)}return null};while(concurrent--){next()}})};Files.prototype.details=function details(fileId){return this.client.request("files.details",{fileId:fileId}).then(function(response){return(new _File2.default).fromFile(response.data)})};Files.prototype.thumbnail=function thumbnail(fileId){var _this13=this;return this.client.cache.auto(_constants.THUMBNAIL_CACHE_PREFIX+fileId,function(){return _this13._thumbnail(fileId)})};Files.prototype._thumbnail=function _thumbnail(fileId){var _this14=this;return this.client.request("files.thumbnail",{fileId:fileId}).then(function(response){return _this14.client.crypto().decryptImage(response.data,_this14.client.keyPairs.getPrivateKeyPEMs())}).then(function(imageBase64){var bluffer=new _bluffer2.default;return bluffer.createBase64(imageBase64)})};Files.prototype.preview=function preview(fileId){var _this15=this;var pageNumber=arguments.length>1&&arguments[1]!==undefined?arguments[1]:1;var quality=arguments.length>2&&arguments[2]!==undefined?arguments[2]:"low";return this.client.cache.auto(_constants.PREVIEW_CACHE_PREFIX+fileId+pageNumber+quality,function(){return _this15._preview(fileId,pageNumber,quality)})};Files.prototype._preview=function _preview(fileId,pageNumber,quality){var _this16=this;return this.client.request("files.preview",{fileId:fileId,pageNumber:pageNumber,quality:{low:"lo",high:"hi"}[quality]||quality}).then(function(response){return _this16.client.crypto().decryptImage(response.data,_this16.client.keyPairs.getPrivateKeyPEMs())}).then(function(imageBase64){var bluffer=new _bluffer2.default;return bluffer.createBase64(imageBase64)})};Files.prototype.thumbnails=function thumbnails(fileIds,_ref12){var _this17=this;var _ref12$async=_ref12.async,async=_ref12$async===undefined?false:_ref12$async,onLoadThumbnail=_ref12.onLoadThumbnail,onLoadThumbnails=_ref12.onLoadThumbnails,_ref12$onLoadThumbnai=_ref12.onLoadThumbnailsThrottleMs,onLoadThumbnailsThrottleMs=_ref12$onLoadThumbnai===undefined?1e3:_ref12$onLoadThumbnai,onLoadError=_ref12.onLoadError;var scheduled=[];var pendingBatch={};var scheduleOnLoadThumbnails=onLoadThumbnails?(0,_throttle2.default)(function(){if(Object.keys(pendingBatch).length){onLoadThumbnails(pendingBatch);pendingBatch={}}},onLoadThumbnailsThrottleMs):function(){};return Promise.all(fileIds.map(function(fileId){return _this17.client.cache.auto(_constants.THUMBNAIL_CACHE_PREFIX+fileId,function(resolve){scheduled.push({fileId:fileId,resolve:resolve})}).then(function(thumbnail){var _ref13;return thumbnail&&(_ref13={},_ref13[fileId]=thumbnail,_ref13)})})).then(function(entries){var more=Promise.all(scheduled.map(function(_ref14){var fileId=_ref14.fileId,resolve=_ref14.resolve;return _this17._thumbnail(fileId).then(function(thumbnail){var _ref15;resolve(thumbnail);if(onLoadThumbnail){var _onLoadThumbnail;onLoadThumbnail((_onLoadThumbnail={},_onLoadThumbnail[fileId]=thumbnail,_onLoadThumbnail))}pendingBatch[fileId]=thumbnail;scheduleOnLoadThumbnails();return _ref15={},_ref15[fileId]=thumbnail,_ref15}).catch(function(err){if(onLoadError){onLoadError(err,fileId)}if(!async){return Promise.reject(err)}return{}})}));if(async){return entries}else{return more.then(function(moreEntries){return[].concat(entries,moreEntries)})}}).then(function(entries){return Object.assign.apply(Object,[{}].concat(entries))})};Files.prototype.duplicate=function duplicate(id){return this.client.request("files.duplicate",{id:id}).then(function(response){return response.data.file})};return Files}(_API3.default);exports.default=Files;
|
package/lib/api/Proofs.d.ts
CHANGED
|
@@ -177,7 +177,7 @@ declare class Proofs extends API {
|
|
|
177
177
|
*
|
|
178
178
|
* @see {@link Proofs.start}
|
|
179
179
|
*
|
|
180
|
-
* @param {{ name: string, tags?: string[], dueDate?: Date | string, messageToReviewers?: string, workflow?: { id: string }, workflowTemplate?: { id: string }, proofTemplate?: { id: string }, checklist?: { templateId?: string, isRequiredForFinalApproval?: boolean, shouldOpenOnProofLoad?: boolean }, file?: { id: string }, group?: { id: string }, previousProof?: { id: string }, team?: { slug: string }, reference?: string, customTools?: any, integrationReferences?: any[], reminders?: Reminder[], owners?: { email?: string, id?: string }[], canDownload?: boolean, start?: boolean, commentVisibility?: string | null }} options The options
|
|
180
|
+
* @param {{ name: string, tags?: string[], dueDate?: Date | string, messageToReviewers?: string, workflow?: { id: string }, workflowTemplate?: { id: string }, proofTemplate?: { id: string }, checklist?: { templateId?: string, isRequiredForFinalApproval?: boolean, shouldOpenOnProofLoad?: boolean }, file?: { id: string }, group?: { id: string }, previousProof?: { id: string }, team?: { slug: string }, reference?: string, customTools?: any, integrationReferences?: any[], reminders?: Reminder[], owners?: { email?: string, id?: string }[], canDownload?: boolean, start?: boolean, commentVisibility?: string | null, isDigitalVerificationEnabled?: boolean, isProofInsightsEnabled?: boolean, isProofInsightsCommentsEnabled?: boolean }} options The options
|
|
181
181
|
*
|
|
182
182
|
* @param options.name The name of the proof
|
|
183
183
|
* @param [options.tags] The tags to add to the proof (defaults to no tags)
|
|
@@ -204,9 +204,11 @@ declare class Proofs extends API {
|
|
|
204
204
|
* @param [options.commentVisibility] Controls the visibility of comments on the proof
|
|
205
205
|
* @param [options.priority] The priority of the proof from 1 to 5. 5 is the highest priority and 1 is the lowest.
|
|
206
206
|
* @param [options.isDigitalVerificationEnabled] Whether the proof has digital verification enabled.
|
|
207
|
+
* @param [options.isProofInsightsEnabled] Whether the proof has proof insights enabled.
|
|
208
|
+
* @param [options.isProofInsightsCommentsEnabled] Whether the proof has proof insights comments enabled.
|
|
207
209
|
* @returns {Promise<Proof>}
|
|
208
210
|
*/
|
|
209
|
-
create({ name, tags, dueDate, messageToReviewers, workflow, workflowTemplate, proofTemplate, checklist, file, group, previousProof, team, reference, customTools, integrationReferences, reminders, owners, canDownload, isPublic, start, commentVisibility, priority, isDigitalVerificationEnabled, scheduledDate, }: {
|
|
211
|
+
create({ name, tags, dueDate, messageToReviewers, workflow, workflowTemplate, proofTemplate, checklist, file, group, previousProof, team, reference, customTools, integrationReferences, reminders, owners, canDownload, isPublic, start, commentVisibility, priority, isDigitalVerificationEnabled, scheduledDate, isProofInsightsEnabled, isProofInsightsCommentsEnabled, }: {
|
|
210
212
|
name: string;
|
|
211
213
|
tags?: string[];
|
|
212
214
|
dueDate?: Date | string;
|
|
@@ -248,6 +250,9 @@ declare class Proofs extends API {
|
|
|
248
250
|
canDownload?: boolean;
|
|
249
251
|
start?: boolean;
|
|
250
252
|
commentVisibility?: string | null;
|
|
253
|
+
isDigitalVerificationEnabled?: boolean;
|
|
254
|
+
isProofInsightsEnabled?: boolean;
|
|
255
|
+
isProofInsightsCommentsEnabled?: boolean;
|
|
251
256
|
}): Promise<Proof>;
|
|
252
257
|
/**
|
|
253
258
|
* Manually archives a proof or proofs. This action hides the proof from all user's who have access to it, but can still be
|
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,proofTemplate=_ref.proofTemplate,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,_ref$commentVisibilit=_ref.commentVisibility,commentVisibility=_ref$commentVisibilit===undefined?null:_ref$commentVisibilit,priority=_ref.priority,isDigitalVerificationEnabled=_ref.isDigitalVerificationEnabled,_ref$scheduledDate=_ref.scheduledDate,scheduledDate=_ref$scheduledDate===undefined?null:_ref$scheduledDate;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,proofTemplateId:proofTemplate&&proofTemplate.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,commentVisibility:commentVisibility,priority:priority,scheduledDate:scheduledDate&&scheduledDate.toISOString?scheduledDate.toISOString():null,isDigitalVerificationEnabled:isDigitalVerificationEnabled}}).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.recoverFromBin=function recoverFromBin(proofId){return this.client.request("proofs.delete.recover",{proofId:proofId})};Proofs.prototype.deleteFromBin=function deleteFromBin(proofId){return this.client.request("proofs.delete.permanently",{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){try{return JSON.parse(videoCredentials)}catch(err){var _videoCredentials$spl=videoCredentials.split(VIDEO_URL_TOKEN_SEPARATOR),unsafeBaseStreamingUrl=_videoCredentials$spl[0],accessToken=_videoCredentials$spl[1];return{streamingUrl:unsafeBaseStreamingUrl.replace("http://","https://")+"/manifest(format=m3u8-aapl,encryption=cbc)",accessToken:accessToken,manifestUrl:unsafeBaseStreamingUrl.replace("http://","https://")+"/manifest",bearerToken:accessToken}}})};Proofs.prototype._getProofSetup=function _getProofSetup(integrationKey,id){return this.client.request("integrations.get-proof-setup",{integration_key:integrationKey,id:id}).then(function(response){return{payload:response.data.payload}})};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,group=_concat$.group,proofTemplate=_concat$.proofTemplate,file=_concat$.file,reference=_concat$.reference,integrationReferences=_concat$.integrationReferences,reminders=_concat$.reminders,owners=_concat$.owners,canDownload=_concat$.canDownload,isPublic=_concat$.isPublic,start=_concat$.start,commentVisibility=_concat$.commentVisibility,priority=_concat$.priority,scheduledDate=_concat$.scheduledDate,isDigitalVerificationEnabled=_concat$.isDigitalVerificationEnabled;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,proofTemplateId:proofTemplate&&proofTemplate.id||undefined,checklist:checklist,fileId:file&&file.id||undefined,groupId:group&&group.id||undefined,reference:reference,integrationReferences:integrationReferences,reminders:reminders?[].concat(reminders):undefined,owners:owners,canDownload:canDownload,isPublic:isPublic,start:start,commentVisibility:commentVisibility,priority:priority,scheduledDate:scheduledDate&&scheduledDate.toISOString?scheduledDate.toISOString():scheduledDate,isDigitalVerificationEnabled:isDigitalVerificationEnabled}}).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,proofTemplate=_ref.proofTemplate,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,_ref$commentVisibilit=_ref.commentVisibility,commentVisibility=_ref$commentVisibilit===undefined?null:_ref$commentVisibilit,priority=_ref.priority,isDigitalVerificationEnabled=_ref.isDigitalVerificationEnabled,_ref$scheduledDate=_ref.scheduledDate,scheduledDate=_ref$scheduledDate===undefined?null:_ref$scheduledDate,isProofInsightsEnabled=_ref.isProofInsightsEnabled,isProofInsightsCommentsEnabled=_ref.isProofInsightsCommentsEnabled;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,proofTemplateId:proofTemplate&&proofTemplate.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,commentVisibility:commentVisibility,priority:priority,scheduledDate:scheduledDate&&scheduledDate.toISOString?scheduledDate.toISOString():null,isDigitalVerificationEnabled:isDigitalVerificationEnabled,isProofInsightsEnabled:isProofInsightsEnabled,isProofInsightsCommentsEnabled:isProofInsightsCommentsEnabled}}).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.recoverFromBin=function recoverFromBin(proofId){return this.client.request("proofs.delete.recover",{proofId:proofId})};Proofs.prototype.deleteFromBin=function deleteFromBin(proofId){return this.client.request("proofs.delete.permanently",{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){try{return JSON.parse(videoCredentials)}catch(err){var _videoCredentials$spl=videoCredentials.split(VIDEO_URL_TOKEN_SEPARATOR),unsafeBaseStreamingUrl=_videoCredentials$spl[0],accessToken=_videoCredentials$spl[1];return{streamingUrl:unsafeBaseStreamingUrl.replace("http://","https://")+"/manifest(format=m3u8-aapl,encryption=cbc)",accessToken:accessToken,manifestUrl:unsafeBaseStreamingUrl.replace("http://","https://")+"/manifest",bearerToken:accessToken}}})};Proofs.prototype._getProofSetup=function _getProofSetup(integrationKey,id){return this.client.request("integrations.get-proof-setup",{integration_key:integrationKey,id:id}).then(function(response){return{payload:response.data.payload}})};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,group=_concat$.group,proofTemplate=_concat$.proofTemplate,file=_concat$.file,reference=_concat$.reference,integrationReferences=_concat$.integrationReferences,reminders=_concat$.reminders,owners=_concat$.owners,canDownload=_concat$.canDownload,isPublic=_concat$.isPublic,start=_concat$.start,commentVisibility=_concat$.commentVisibility,priority=_concat$.priority,scheduledDate=_concat$.scheduledDate,isDigitalVerificationEnabled=_concat$.isDigitalVerificationEnabled,isProofInsightsEnabled=_concat$.isProofInsightsEnabled,isProofInsightsCommentsEnabled=_concat$.isProofInsightsCommentsEnabled;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,proofTemplateId:proofTemplate&&proofTemplate.id||undefined,checklist:checklist,fileId:file&&file.id||undefined,groupId:group&&group.id||undefined,reference:reference,integrationReferences:integrationReferences,reminders:reminders?[].concat(reminders):undefined,owners:owners,canDownload:canDownload,isPublic:isPublic,start:start,commentVisibility:commentVisibility,priority:priority,scheduledDate:scheduledDate&&scheduledDate.toISOString?scheduledDate.toISOString():scheduledDate,isDigitalVerificationEnabled:isDigitalVerificationEnabled,isProofInsightsEnabled:isProofInsightsEnabled,isProofInsightsCommentsEnabled:isProofInsightsCommentsEnabled}}).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;
|
|
@@ -59,6 +59,8 @@ declare class TeamFeatures extends API {
|
|
|
59
59
|
* @param {boolean} options.intelligence.licenseIntelligenceInsightsInProofing Whether PI Insights in Proofing is licensed for the team.
|
|
60
60
|
* @param {boolean} options.intelligence.enableIntelligenceInsightsInProofing Whether PI Insights in Proofing is enabled for the team.
|
|
61
61
|
* @param {boolean} options.intelligence.defaultIntelligenceInsightsInProofing The default setting for PI Insights in Proofing for the team.
|
|
62
|
+
* @param {boolean} options.intelligence.enableIntelligenceInsightsCommentsInProofing Whether PI Comments in Proofing is enabled for the team.
|
|
63
|
+
* @param {boolean} options.intelligence.defaultIntelligenceInsightsCommentsInProofing The default setting for PI Comments in Proofing for the team.
|
|
62
64
|
* @param {boolean} options.intelligence.licenseIntelligenceInsightsOnDashboard Whether PI Insights on Dashboard is licensed for the team.
|
|
63
65
|
* @param {boolean} options.intelligence.enableIntelligenceInsightsOnDashboard Whether PI Insights on Dashboard is enabled for the team.
|
|
64
66
|
* @param {boolean} options.intelligence.licenseIntelligenceInsightsInReports WhWhether PI Insights in Reports is licensed for the team.
|
|
@@ -66,6 +68,7 @@ declare class TeamFeatures extends API {
|
|
|
66
68
|
* @param {boolean} options.intelligence.enableSmartTags Whether Smart Tags is enabled for the team's proofs.
|
|
67
69
|
* @param {boolean} options.intelligence.enableSmartCheckCr Whether Smart Check: CR is enabled for the team's proofs.
|
|
68
70
|
* @param {boolean} options.general.enableCelebrations Whether celebrations are enabled for the team.
|
|
71
|
+
* @param {boolean} options.proofs.enableProofSoftDeletion Whether the scheduled deletion feature is enabled for the team.
|
|
69
72
|
* @returns {Promise}
|
|
70
73
|
*/
|
|
71
74
|
update({ emails, comments, proofs, workflows, addressBook, userGroups, webhooks, intelligence, general, }: {
|
|
@@ -97,6 +97,8 @@ var TeamFeatures = function (_API) {
|
|
|
97
97
|
* @param {boolean} options.intelligence.licenseIntelligenceInsightsInProofing Whether PI Insights in Proofing is licensed for the team.
|
|
98
98
|
* @param {boolean} options.intelligence.enableIntelligenceInsightsInProofing Whether PI Insights in Proofing is enabled for the team.
|
|
99
99
|
* @param {boolean} options.intelligence.defaultIntelligenceInsightsInProofing The default setting for PI Insights in Proofing for the team.
|
|
100
|
+
* @param {boolean} options.intelligence.enableIntelligenceInsightsCommentsInProofing Whether PI Comments in Proofing is enabled for the team.
|
|
101
|
+
* @param {boolean} options.intelligence.defaultIntelligenceInsightsCommentsInProofing The default setting for PI Comments in Proofing for the team.
|
|
100
102
|
* @param {boolean} options.intelligence.licenseIntelligenceInsightsOnDashboard Whether PI Insights on Dashboard is licensed for the team.
|
|
101
103
|
* @param {boolean} options.intelligence.enableIntelligenceInsightsOnDashboard Whether PI Insights on Dashboard is enabled for the team.
|
|
102
104
|
* @param {boolean} options.intelligence.licenseIntelligenceInsightsInReports WhWhether PI Insights in Reports is licensed for the team.
|
|
@@ -104,6 +106,7 @@ var TeamFeatures = function (_API) {
|
|
|
104
106
|
* @param {boolean} options.intelligence.enableSmartTags Whether Smart Tags is enabled for the team's proofs.
|
|
105
107
|
* @param {boolean} options.intelligence.enableSmartCheckCr Whether Smart Check: CR is enabled for the team's proofs.
|
|
106
108
|
* @param {boolean} options.general.enableCelebrations Whether celebrations are enabled for the team.
|
|
109
|
+
* @param {boolean} options.proofs.enableProofSoftDeletion Whether the scheduled deletion feature is enabled for the team.
|
|
107
110
|
* @returns {Promise}
|
|
108
111
|
*/
|
|
109
112
|
|
|
@@ -150,6 +153,8 @@ var TeamFeatures = function (_API) {
|
|
|
150
153
|
var licenseIntelligenceInsightsInProofing = intelligence && intelligence.licenseIntelligenceInsightsInProofing;
|
|
151
154
|
var enableIntelligenceInsightsInProofing = intelligence && intelligence.enableIntelligenceInsightsInProofing;
|
|
152
155
|
var defaultIntelligenceInsightsInProofing = intelligence && intelligence.defaultIntelligenceInsightsInProofing;
|
|
156
|
+
var enableIntelligenceInsightsCommentsInProofing = intelligence && intelligence.enableIntelligenceInsightsCommentsInProofing;
|
|
157
|
+
var defaultIntelligenceInsightsCommentsInProofing = intelligence && intelligence.defaultIntelligenceInsightsCommentsInProofing;
|
|
153
158
|
var licenseIntelligenceInsightsOnDashboard = intelligence && intelligence.licenseIntelligenceInsightsOnDashboard;
|
|
154
159
|
var enableIntelligenceInsightsOnDashboard = intelligence && intelligence.enableIntelligenceInsightsOnDashboard;
|
|
155
160
|
var licenseIntelligenceInsightsInReports = intelligence && intelligence.licenseIntelligenceInsightsInReports;
|
|
@@ -161,6 +166,7 @@ var TeamFeatures = function (_API) {
|
|
|
161
166
|
var enableDigitalVerification = proofs && proofs.enableDigitalVerification;
|
|
162
167
|
var defaultDigitalVerification = proofs && proofs.defaultDigitalVerification;
|
|
163
168
|
var reauthentication = proofs && proofs.reauthentication;
|
|
169
|
+
var enableProofSoftDeletion = proofs && proofs.enableProofSoftDeletion;
|
|
164
170
|
return this.client.request('admin.team.features.update', {
|
|
165
171
|
displayComments: displayComments,
|
|
166
172
|
displayTeamName: displayTeamName,
|
|
@@ -190,6 +196,8 @@ var TeamFeatures = function (_API) {
|
|
|
190
196
|
licenseIntelligenceInsightsInProofing: licenseIntelligenceInsightsInProofing,
|
|
191
197
|
enableIntelligenceInsightsInProofing: enableIntelligenceInsightsInProofing,
|
|
192
198
|
defaultIntelligenceInsightsInProofing: defaultIntelligenceInsightsInProofing,
|
|
199
|
+
enableIntelligenceInsightsCommentsInProofing: enableIntelligenceInsightsCommentsInProofing,
|
|
200
|
+
defaultIntelligenceInsightsCommentsInProofing: defaultIntelligenceInsightsCommentsInProofing,
|
|
193
201
|
licenseIntelligenceInsightsOnDashboard: licenseIntelligenceInsightsOnDashboard,
|
|
194
202
|
enableIntelligenceInsightsOnDashboard: enableIntelligenceInsightsOnDashboard,
|
|
195
203
|
licenseIntelligenceInsightsInReports: licenseIntelligenceInsightsInReports,
|
|
@@ -203,7 +211,8 @@ var TeamFeatures = function (_API) {
|
|
|
203
211
|
licenseDigitalVerification: licenseDigitalVerification,
|
|
204
212
|
enableDigitalVerification: enableDigitalVerification,
|
|
205
213
|
defaultDigitalVerification: defaultDigitalVerification,
|
|
206
|
-
reauthentication: reauthentication
|
|
214
|
+
reauthentication: reauthentication,
|
|
215
|
+
enableProofSoftDeletion: enableProofSoftDeletion
|
|
207
216
|
});
|
|
208
217
|
};
|
|
209
218
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";exports.__esModule=true;var _transform=require("./transform");var _transform2=_interopRequireDefault(_transform);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}var TeamAccountFeatureSchema={teamId:"Id",teamName:"Name",teamType:"Type",teamIsPlus:"IsPlus",teamIsTrial:"IsTrial"};var TeamAccountFeatures=function(){function TeamAccountFeatures(){_classCallCheck(this,TeamAccountFeatures)}TeamAccountFeatures.prototype.fromTeamAccountFeatures=function fromTeamAccountFeatures(teamAccountFeaturesData){(0,_transform2.default)(this,TeamAccountFeatureSchema,teamAccountFeaturesData);return this};return TeamAccountFeatures}();exports.default=TeamAccountFeatures;
|
|
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 TeamAccountFeatureSchema={teamId:"Id",teamName:"Name",teamType:"Type",teamIsPlus:"IsPlus",teamIsTrial:"IsTrial",teamSSOEnabled:"SSOEnabled",teamSSOEnforced:"SSOEnforced"};var TeamAccountFeatures=function(){function TeamAccountFeatures(){_classCallCheck(this,TeamAccountFeatures)}TeamAccountFeatures.prototype.fromTeamAccountFeatures=function fromTeamAccountFeatures(teamAccountFeaturesData){(0,_transform2.default)(this,TeamAccountFeatureSchema,teamAccountFeaturesData);return this};return TeamAccountFeatures}();exports.default=TeamAccountFeatures;
|
|
@@ -40,6 +40,18 @@ declare class TeamIntelligenceFeatures {
|
|
|
40
40
|
* @type {boolean}
|
|
41
41
|
*/
|
|
42
42
|
defaultIntelligenceInsightsInProofing: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Whether PI Comments in Proofing is enabled for the team.
|
|
45
|
+
*
|
|
46
|
+
* @type {boolean}
|
|
47
|
+
*/
|
|
48
|
+
enableIntelligenceInsightsCommentsInProofing: boolean;
|
|
49
|
+
/**
|
|
50
|
+
* The default setting for PI Comments in Proofing for the team.
|
|
51
|
+
*
|
|
52
|
+
* @type {boolean}
|
|
53
|
+
*/
|
|
54
|
+
defaultIntelligenceInsightsCommentsInProofing: boolean;
|
|
43
55
|
/**
|
|
44
56
|
* Whether PI Insights on Dashboard is licensed for the team.
|
|
45
57
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";exports.__esModule=true;var _transform=require("./transform");var _transform2=_interopRequireDefault(_transform);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}var TeamIntelligenceFeatureSchema={enableIntelligence:"EnableIntelligence",enableSmartTags:"EnableIntelligenceSmartTags",enableSmartCheckCr:"EnableIntelligenceSmartCheckCr",licenseIntelligenceInsightsInProofing:"LicenseIntelligenceInsightsInProofing",enableIntelligenceInsightsInProofing:"EnableIntelligenceInsightsInProofing",defaultIntelligenceInsightsInProofing:"DefaultIntelligenceInsightsInProofing",licenseIntelligenceInsightsOnDashboard:"LicenseIntelligenceInsightsOnDashboard",enableIntelligenceInsightsOnDashboard:"EnableIntelligenceInsightsOnDashboard",licenseIntelligenceInsightsInReports:"LicenseIntelligenceInsightsInReports",enableIntelligenceInsightsInReports:"EnableIntelligenceInsightsInReports"};var TeamIntelligenceFeatures=function(){function TeamIntelligenceFeatures(){_classCallCheck(this,TeamIntelligenceFeatures)}TeamIntelligenceFeatures.prototype.fromTeamIntelligenceFeatures=function fromTeamIntelligenceFeatures(teamIntelligenceFeaturesData){(0,_transform2.default)(this,TeamIntelligenceFeatureSchema,teamIntelligenceFeaturesData);return this};return TeamIntelligenceFeatures}();exports.default=TeamIntelligenceFeatures;
|
|
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 TeamIntelligenceFeatureSchema={enableIntelligence:"EnableIntelligence",enableSmartTags:"EnableIntelligenceSmartTags",enableSmartCheckCr:"EnableIntelligenceSmartCheckCr",licenseIntelligenceInsightsInProofing:"LicenseIntelligenceInsightsInProofing",enableIntelligenceInsightsInProofing:"EnableIntelligenceInsightsInProofing",defaultIntelligenceInsightsInProofing:"DefaultIntelligenceInsightsInProofing",enableIntelligenceInsightsCommentsInProofing:"EnableIntelligenceInsightsCommentsInProofing",defaultIntelligenceInsightsCommentsInProofing:"DefaultIntelligenceInsightsCommentsInProofing",licenseIntelligenceInsightsOnDashboard:"LicenseIntelligenceInsightsOnDashboard",enableIntelligenceInsightsOnDashboard:"EnableIntelligenceInsightsOnDashboard",licenseIntelligenceInsightsInReports:"LicenseIntelligenceInsightsInReports",enableIntelligenceInsightsInReports:"EnableIntelligenceInsightsInReports"};var TeamIntelligenceFeatures=function(){function TeamIntelligenceFeatures(){_classCallCheck(this,TeamIntelligenceFeatures)}TeamIntelligenceFeatures.prototype.fromTeamIntelligenceFeatures=function fromTeamIntelligenceFeatures(teamIntelligenceFeaturesData){(0,_transform2.default)(this,TeamIntelligenceFeatureSchema,teamIntelligenceFeaturesData);return this};return TeamIntelligenceFeatures}();exports.default=TeamIntelligenceFeatures;
|
|
@@ -87,6 +87,12 @@ declare class TeamProofFeatures {
|
|
|
87
87
|
* @type {number}
|
|
88
88
|
*/
|
|
89
89
|
reauthentication: number;
|
|
90
|
+
/**
|
|
91
|
+
* Whether the scheduled deletion feature is enabled for the team.
|
|
92
|
+
*
|
|
93
|
+
* @type {boolean}
|
|
94
|
+
*/
|
|
95
|
+
enableProofSoftDeletion: boolean;
|
|
90
96
|
/** @private */
|
|
91
97
|
private fromTeamProofFeatures;
|
|
92
98
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";exports.__esModule=true;var _transform=require("./transform");var _transform2=_interopRequireDefault(_transform);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}var TeamProofFeatureSchema={reference:"ProofReference",referenceRequired:"ProofReferenceRequired",publicProofs:"PublicProofs",usePreviousVersionDueDate:"UsePreviousVersionDueDate",defaultIsPublic:"DefaultProofIsPublic",messageToOwners:"MessageToOwners",allowedDecisions:"AllowedDecisions",enableChecklists:"EnableChecklists",defaultGifOutput:"DefaultGifOutput",enableProofMagicAccess:"EnableProofMagicAccess",licenseDigitalVerification:"LicenseDigitalVerification",enableDigitalVerification:"EnableDigitalVerification",defaultDigitalVerification:"DefaultDigitalVerification",reauthentication:"Reauthentication"};var TeamProofFeatures=function(){function TeamProofFeatures(){_classCallCheck(this,TeamProofFeatures)}TeamProofFeatures.prototype.fromTeamProofFeatures=function fromTeamProofFeatures(teamProofFeaturesData){(0,_transform2.default)(this,TeamProofFeatureSchema,teamProofFeaturesData);return this};return TeamProofFeatures}();exports.default=TeamProofFeatures;
|
|
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 TeamProofFeatureSchema={reference:"ProofReference",referenceRequired:"ProofReferenceRequired",publicProofs:"PublicProofs",usePreviousVersionDueDate:"UsePreviousVersionDueDate",defaultIsPublic:"DefaultProofIsPublic",messageToOwners:"MessageToOwners",allowedDecisions:"AllowedDecisions",enableChecklists:"EnableChecklists",defaultGifOutput:"DefaultGifOutput",enableProofMagicAccess:"EnableProofMagicAccess",licenseDigitalVerification:"LicenseDigitalVerification",enableDigitalVerification:"EnableDigitalVerification",defaultDigitalVerification:"DefaultDigitalVerification",reauthentication:"Reauthentication",enableProofSoftDeletion:"EnableProofSoftDeletion"};var TeamProofFeatures=function(){function TeamProofFeatures(){_classCallCheck(this,TeamProofFeatures)}TeamProofFeatures.prototype.fromTeamProofFeatures=function fromTeamProofFeatures(teamProofFeaturesData){(0,_transform2.default)(this,TeamProofFeatureSchema,teamProofFeaturesData);return this};return TeamProofFeatures}();exports.default=TeamProofFeatures;
|
|
@@ -559,6 +559,11 @@
|
|
|
559
559
|
"path": "/api/media/file/queue",
|
|
560
560
|
"body": ["files"]
|
|
561
561
|
},
|
|
562
|
+
"files.event": {
|
|
563
|
+
"method": "POST",
|
|
564
|
+
"path": "/api/media/file/event",
|
|
565
|
+
"body": ["fileId", "type", "message"]
|
|
566
|
+
},
|
|
562
567
|
"files.can-download.update": {
|
|
563
568
|
"method": "POST",
|
|
564
569
|
"path": "/api/media/downloadoption",
|
|
@@ -906,7 +911,7 @@
|
|
|
906
911
|
"version": 2,
|
|
907
912
|
"method": "POST",
|
|
908
913
|
"path": "/api/admin/settings",
|
|
909
|
-
"body": ["displayComments", "generalComments", "privateComments", "enableWebhooks", "editComments", "ownerCanDeleteComments", "proofReference", "proofReferenceRequired", "displayTeamName", "emailTitleTextColor", "emailLinkTextColor", "emailButtonBackgroundColor", "emailButtonTextColor", "disableReplyingToCommentsInStatuses", "publicProofs", "defaultProofIsPublic", "messageToOwners", "allowedDecisions", "enableChecklists", "suggestionsIncludeTeamMembers", "enableUserGroups", "enableCommentVisibility", "defaultCommentVisibility", "usePreviousVersionDueDate", "enableViewOnlyReviewers", "enableIntelligence", "licenseIntelligenceInsightsInProofing", "enableIntelligenceInsightsInProofing", "defaultIntelligenceInsightsInProofing", "licenseIntelligenceInsightsOnDashboard", "enableIntelligenceInsightsOnDashboard", "licenseIntelligenceInsightsInReports", "enableIntelligenceInsightsInReports", "enableIntelligenceSmartTags", "enableProofMagicAccess", "enableIntelligenceSmartCheckCr", "defaultGifOutput", "enableCelebrations", "licenseDigitalVerification", "enableDigitalVerification", "defaultDigitalVerification", "reauthentication"]
|
|
914
|
+
"body": ["displayComments", "generalComments", "privateComments", "enableWebhooks", "editComments", "ownerCanDeleteComments", "proofReference", "proofReferenceRequired", "displayTeamName", "emailTitleTextColor", "emailLinkTextColor", "emailButtonBackgroundColor", "emailButtonTextColor", "disableReplyingToCommentsInStatuses", "publicProofs", "defaultProofIsPublic", "messageToOwners", "allowedDecisions", "enableChecklists", "suggestionsIncludeTeamMembers", "enableUserGroups", "enableCommentVisibility", "defaultCommentVisibility", "usePreviousVersionDueDate", "enableViewOnlyReviewers", "enableIntelligence", "licenseIntelligenceInsightsInProofing", "enableIntelligenceInsightsInProofing", "defaultIntelligenceInsightsInProofing", "enableIntelligenceInsightsCommentsInProofing", "defaultIntelligenceInsightsCommentsInProofing", "licenseIntelligenceInsightsOnDashboard", "defaultIntelligenceInsightsCommentsOnDashboard", "enableIntelligenceInsightsOnDashboard", "licenseIntelligenceInsightsInReports", "enableIntelligenceInsightsInReports", "enableIntelligenceSmartTags", "enableProofMagicAccess", "enableIntelligenceSmartCheckCr", "defaultGifOutput", "enableCelebrations", "licenseDigitalVerification", "enableDigitalVerification", "defaultDigitalVerification", "reauthentication", "enableProofSoftDeletion"]
|
|
910
915
|
},
|
|
911
916
|
"admin.team.features.sender-email.set": {
|
|
912
917
|
"version": 2,
|