@pageproof/sdk-pr 449.0.1660686313886 → 451.0.1658799772717

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,29 +1,5 @@
1
1
  # Changelog
2
2
 
3
- ## 2.0.0-beta.297
4
-
5
- Released on the 17th of August 2022.
6
-
7
- - [[PP-2627](https://goto.pageproof.dev/PP-2627)] Added support for `Approved with changes` decision. See [TeamProofFeatures.allowedDecisions](https://docs.pageproof.tech/@pageproof/sdk/beta/class/src/models/TeamProofFeatures.js~TeamProofFeatures.html#instance-member-allowedDecisions) and [TeamFeatures.update](https://docs.pageproof.tech/@pageproof/sdk/beta/class/src/api/admin/TeamFeatures.js~TeamFeatures.html#instance-method-update).
8
-
9
- ## 2.0.0-beta.296
10
-
11
- Released on the 16th of August 2022.
12
-
13
- - [[PP-3583](https://goto.pageproof.dev/PP-3583)] Added support for managing checklists templates.
14
-
15
- ## 2.0.0-beta.295
16
-
17
- Released on the 5th of August 2022.
18
-
19
- - [[PP-2345](https://goto.pageproof.dev/PP-2345)] Added support for creating proofs with checklists.
20
-
21
- ## 2.0.0-beta.294
22
-
23
- Released on the 26th of July 2022.
24
-
25
- - [[PP-3452](https://goto.pageproof.dev/PP-3452)] Added support for accessing a file's import URL. See [File.importUrl](https://docs.pageproof.tech/@pageproof/sdk/beta/class/src/models/File.js~File.html#instance-member-importUrl).
26
-
27
3
  ## 2.0.0-beta.293
28
4
 
29
5
  Released on the 31st of May 2022.
@@ -177,29 +177,29 @@ 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 }, 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 }} options The options
180
+ * @param {{ name: string, tags?: string[], dueDate?: Date | string, messageToReviewers?: string, workflow?: { id: string }, workflowTemplate?: { 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 }} options The options
181
181
  *
182
182
  * @param options.name The name of the proof
183
- * @param [options.tags] The tags to add to the proof (defaults to no tags)
184
- * @param [options.dueDate] The due date of the proof (defaults to 3 days in the future)
185
- * @param [options.messageToReviewers] The message to reviewers
186
- * @param [options.workflow.id] The workflow id to assign to the proof
187
- * @param [options.workflowTemplate.id] The workflow template id to duplicate and assign to the proof
188
- * @param [options.checklist.templateId] The checklist template id to be used to create a checklist for the proof
189
- * @param [options.checklist.isRequiredForFinalApproval] Whether the checklist must be completed before final approval can be given
190
- * @param [options.checklist.shouldOpenOnProofLoad] Whether the checklist should be opened automatically when the proof is loaded
191
- * @param [options.file.id] The file id to assign to the proof
192
- * @param [options.group.id] The proof group id to add the proof to
193
- * @param [options.previousProof.id] The proof id of the previous proof to attach this new version to
194
- * @param [options.team.slug] The team slug (user-friendly identifier)
195
- * @param [options.reference] The proof reference to add the proof to (to integration with other applications)
196
- * @param [options.customTools] Any custom tools to expose on the proofing screen
197
- * @param [options.integrationReferences] The integration references to attach to the proof
198
- * @param [options.reminders] The proof reminders to add the proof to (to nudge users)
199
- * @param [options.owners] The users to assign as owners for the proof (if omitted and a new version, the previous version's owners are inherited, otherwise, the user creating the proof is assigned as the only owner)
200
- * @param [options.canDownload] Whether the file attached to the proof can be download
201
- * @param [options.isPublic] Whether the proof is publicly accessible
202
- * @param [options.start] Whether to immediately start the proof (sends invitation emails to reviewers in the workflow)
183
+ * @param options.tags The tags to add to the proof (defaults to no tags)
184
+ * @param options.dueDate The due date of the proof (defaults to 3 days in the future)
185
+ * @param options.messageToReviewers The message to reviewers
186
+ * @param options.workflow.id The workflow id to assign to the proof
187
+ * @param options.workflowTemplate.id The workflow template id to duplicate and assign to the proof
188
+ * @param options.checklist.templateId The checklist template id to be used to create a checklist for the proof
189
+ * @param options.checklist.isRequiredForFinalApproval Whether the checklist must be completed before final approval can be given
190
+ * @param options.checklist.shouldOpenOnProofLoad Whether the checklist should be opened automatically when the proof is loaded
191
+ * @param options.file.id The file id to assign to the proof
192
+ * @param options.group.id The proof group id to add the proof to
193
+ * @param options.previousProof.id The proof id of the previous proof to attach this new version to
194
+ * @param options.team.slug The team slug (user-friendly identifier)
195
+ * @param options.reference The proof reference to add the proof to (to integration with other applications)
196
+ * @param options.customTools Any custom tools to expose on the proofing screen
197
+ * @param options.integrationReferences The integration references to attach to the proof
198
+ * @param options.reminders The proof reminders to add the proof to (to nudge users)
199
+ * @param options.owners The users to assign as owners for the proof (if omitted and a new version, the previous version's owners are inherited, otherwise, the user creating the proof is assigned as the only owner)
200
+ * @param options.canDownload Whether the file attached to the proof can be download
201
+ * @param options.isPublic Whether the proof is publicly accessible
202
+ * @param options.start Whether to immediately start the proof (sends invitation emails to reviewers in the workflow)
203
203
  * @returns {Promise<Proof>}
204
204
  */
205
205
  create({ name, tags, dueDate, messageToReviewers, workflow, workflowTemplate, checklist, file, group, previousProof, team, reference, customTools, integrationReferences, reminders, owners, canDownload, isPublic, start, }: {
@@ -232,7 +232,7 @@ declare class Proofs extends API {
232
232
  };
233
233
  reference?: string;
234
234
  customTools?: any;
235
- integrationReferences?: any[];
235
+ integrationReferences: any[];
236
236
  reminders?: any[];
237
237
  owners?: {
238
238
  email?: string;
@@ -37,7 +37,6 @@ declare class TeamFeatures extends API {
37
37
  * @param {boolean} options.proofs.publicProofs Whether the public proofs feature is enabled.
38
38
  * @param {boolean} options.proofs.defaultIsPublic The default value for whether a proof is public on the proof setup page.
39
39
  * @param {boolean} options.proofs.messageToOwners Whether reviewers can send a message to the proof owners.
40
- * @param {Array<Decision>} options.proofs.allowedDecisions The array of proof decisions that allowed to the reviewer.
41
40
  * @returns {Promise}
42
41
  */
43
42
  update({ emails, comments, proofs, }: {
@@ -59,7 +58,6 @@ declare class TeamFeatures extends API {
59
58
  publicProofs: boolean;
60
59
  defaultIsPublic: boolean;
61
60
  messageToOwners: boolean;
62
- allowedDecisions: Decision[];
63
61
  };
64
62
  }): Promise<any>;
65
63
  /**
@@ -75,7 +75,6 @@ var TeamFeatures = function (_API) {
75
75
  * @param {boolean} options.proofs.publicProofs Whether the public proofs feature is enabled.
76
76
  * @param {boolean} options.proofs.defaultIsPublic The default value for whether a proof is public on the proof setup page.
77
77
  * @param {boolean} options.proofs.messageToOwners Whether reviewers can send a message to the proof owners.
78
- * @param {Array<Decision>} options.proofs.allowedDecisions The array of proof decisions that allowed to the reviewer.
79
78
  * @returns {Promise}
80
79
  */
81
80
 
@@ -98,7 +97,6 @@ var TeamFeatures = function (_API) {
98
97
  var publicProofs = proofs && proofs.publicProofs;
99
98
  var defaultProofIsPublic = proofs && proofs.defaultIsPublic;
100
99
  var messageToOwners = proofs && proofs.messageToOwners;
101
- var allowedDecisions = proofs && proofs.allowedDecisions;
102
100
  return this.client.request('admin.team.features.update', {
103
101
  displayComments: displayComments,
104
102
  displayTeamName: displayTeamName,
@@ -112,8 +110,7 @@ var TeamFeatures = function (_API) {
112
110
  proofReference: proofReference,
113
111
  publicProofs: publicProofs,
114
112
  defaultProofIsPublic: defaultProofIsPublic,
115
- messageToOwners: messageToOwners,
116
- allowedDecisions: allowedDecisions
113
+ messageToOwners: messageToOwners
117
114
  });
118
115
  };
119
116
 
@@ -8,8 +8,6 @@ declare class PageProof {
8
8
  events: any;
9
9
  /** @private */
10
10
  options: any;
11
- /** @private */
12
- clientId: any;
13
11
  /**
14
12
  * The repository of registered adapters.
15
13
  *
@@ -133,12 +131,6 @@ declare class PageProof {
133
131
  * @type {FreeTrial}
134
132
  */
135
133
  freeTrial: FreeTrial;
136
- /**
137
- * The Checklist Templates API.
138
- *
139
- * @type {ChecklistTemplates}
140
- */
141
- checklistTemplates: ChecklistTemplates;
142
134
  /**
143
135
  * The current session.
144
136
  *
@@ -225,32 +217,6 @@ declare class PageProof {
225
217
  * @returns {Promise<Response>}
226
218
  */
227
219
  request(name: string, params: any, options: any): Promise<Response>;
228
- /**
229
- * Executes an arbitrary GraphQL operation.
230
- *
231
- * @private
232
- * @param {string} document The GraphQL document.
233
- * @param {object} [variables] The values of any variables references within the GraphQL document.
234
- * @param {object} [options] Additional options.
235
- * @param {boolean} [options.throwOnError=true] Whether to throw an AggregateError if the operation fails.
236
- * @param {boolean} [options.minifyDocument=true] Whether to minify the GraphQL document.
237
- * @returns {Promise<{ data?: any; errors?: { message: string; locations?: { line: number; column: number }[]; path?: string[]; extensions?: any }[] }>}
238
- */
239
- graphql(document: string, variables?: any, options?: {
240
- throwOnError?: boolean;
241
- minifyDocument?: boolean;
242
- }): Promise<{
243
- data?: any;
244
- errors?: {
245
- message: string;
246
- locations?: {
247
- line: number;
248
- column: number;
249
- }[];
250
- path?: string[];
251
- extensions?: any;
252
- }[];
253
- }>;
254
220
  /**
255
221
  * Returns the Admin API (experimental).
256
222
  *
@@ -359,7 +325,6 @@ import Reports from "../api/Reports";
359
325
  import Teams from "../api/Teams";
360
326
  import Printing from "../api/Printing";
361
327
  import FreeTrial from "../api/FreeTrial";
362
- import ChecklistTemplates from "../api/ChecklistTemplates";
363
328
  import Session from "../models/Session";
364
329
  import Admin from "../api/admin/Admin";
365
330
  import Response from "../network/Response";
@@ -1 +1 @@
1
- "use strict";exports.__esModule=true;var _AdapterRepository=require("./AdapterRepository");var _AdapterRepository2=_interopRequireDefault(_AdapterRepository);var _Cache=require("./Cache");var _Cache2=_interopRequireDefault(_Cache);var _Request=require("../network/Request");var _Request2=_interopRequireDefault(_Request);var _Response=require("../network/Response");var _Response2=_interopRequireDefault(_Response);var _Accounts=require("../api/Accounts");var _Accounts2=_interopRequireDefault(_Accounts);var _Dashboard=require("../api/Dashboard");var _Dashboard2=_interopRequireDefault(_Dashboard);var _Users=require("../api/Users");var _Users2=_interopRequireDefault(_Users);var _Proofs=require("../api/Proofs");var _Proofs2=_interopRequireDefault(_Proofs);var _Briefs=require("../api/Briefs");var _Briefs2=_interopRequireDefault(_Briefs);var _Files=require("../api/Files");var _Files2=_interopRequireDefault(_Files);var _Admin=require("../api/admin/Admin");var _Admin2=_interopRequireDefault(_Admin);var _Workflows=require("../api/Workflows");var _Workflows2=_interopRequireDefault(_Workflows);var _Preferences=require("../api/Preferences");var _Preferences2=_interopRequireDefault(_Preferences);var _Comments=require("../api/Comments");var _Comments2=_interopRequireDefault(_Comments);var _Profile=require("../api/Profile");var _Profile2=_interopRequireDefault(_Profile);var _Sessions=require("../api/Sessions");var _Sessions2=_interopRequireDefault(_Sessions);var _Encryption=require("../api/Encryption");var _Encryption2=_interopRequireDefault(_Encryption);var _Live=require("../api/Live");var _Live2=_interopRequireDefault(_Live);var _Brian=require("../api/brian/Brian");var _Brian2=_interopRequireDefault(_Brian);var _Session=require("../models/Session");var _Session2=_interopRequireDefault(_Session);var _EventEmitter=require("../events/EventEmitter");var _EventEmitter2=_interopRequireDefault(_EventEmitter);var _ResponseStatus=require("../enum/ResponseStatus");var _ResponseStatus2=_interopRequireDefault(_ResponseStatus);var _sleep=require("../util/sleep");var _sleep2=_interopRequireDefault(_sleep);var _constants=require("../util/constants");var _getTimezone=require("../util/getTimezone");var _getTimezone2=_interopRequireDefault(_getTimezone);var _AggregateError=require("../util/AggregateError");var _GraphQLError=require("../util/GraphQLError");var _Reports=require("../api/Reports");var _Reports2=_interopRequireDefault(_Reports);var _Teams=require("../api/Teams");var _Teams2=_interopRequireDefault(_Teams);var _Printing=require("../api/Printing");var _Printing2=_interopRequireDefault(_Printing);var _FreeTrial=require("../api/FreeTrial");var _FreeTrial2=_interopRequireDefault(_FreeTrial);var _KeyPairs=require("./KeyPairs");var _KeyPairs2=_interopRequireDefault(_KeyPairs);var _ChecklistTemplates=require("../api/ChecklistTemplates");var _ChecklistTemplates2=_interopRequireDefault(_ChecklistTemplates);var _version=require("../util/version");var _version2=_interopRequireDefault(_version);var _uuid=require("../util/uuid");var _uuid2=_interopRequireDefault(_uuid);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 debug=require("debug")("PageProof");var PageProof=function(){function PageProof(){var _ref=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{},_ref$options=_ref.options,options=_ref$options===undefined?{}:_ref$options,_ref$adapters=_ref.adapters,adapters=_ref$adapters===undefined?[]:_ref$adapters;_classCallCheck(this,PageProof);this.options=options;this.clientId=options.clientId||(0,_uuid2.default)();this.events=new _EventEmitter2.default;this.adapters=new _AdapterRepository2.default(adapters);this.cache=new _Cache2.default(this);this.keyPairs=new _KeyPairs2.default(this);this.accounts=new _Accounts2.default(this);this.comments=new _Comments2.default(this);this.dashboard=new _Dashboard2.default(this);this.files=new _Files2.default(this);this.profile=new _Profile2.default(this);this.proofs=new _Proofs2.default(this);this.briefs=new _Briefs2.default(this);this.users=new _Users2.default(this);this.workflows=new _Workflows2.default(this);this.preferences=new _Preferences2.default(this);this.sessions=new _Sessions2.default(this);this.encryption=new _Encryption2.default(this);this.live=new _Live2.default(this);this.reports=new _Reports2.default(this);this.teams=new _Teams2.default(this);this.printing=new _Printing2.default(this);this.freeTrial=new _FreeTrial2.default(this);this.checklistTemplates=new _ChecklistTemplates2.default(this);this.__admin=new _Admin2.default(this);this._hijackAdmin();this._init();this._registerCoreHooks();this._enhance()}PageProof.prototype._init=function _init(){var requestAdapter=this.adapters.getRequestAdapter();if(!this.options.endpoint){this.options.endpoint=requestAdapter.options.endpoint}if(!this.options.applicationId){this.options.applicationId=requestAdapter.options.applicationId}if(!this.options.subscriptionKey){this.options.subscriptionKey=requestAdapter.options.key||this.options.key}if(this.options.subscriptionKey&&!this.options.applicationId){throw new Error("You must provide an applicationId.")}};PageProof.prototype._hijackAdmin=function _hijackAdmin(){var _this=this;var adminKeys=Object.getOwnPropertyNames(this.__admin);adminKeys.forEach(function(adminKey){return _this.admin[adminKey]=_this.__admin[adminKey]})};PageProof.prototype._registerCoreHooks=function _registerCoreHooks(){this.on("error.throttled",function(event){var ms=event.data.response.data.timeout;debug("Sleeping "+ms+"ms until rate limit resets");return(0,_sleep2.default)(ms)})};PageProof.prototype._enhance=function _enhance(){var _this2=this;var adapters=this.adapters.getEnhancementAdapters();adapters.forEach(function(adapter){return adapter.onClientReady(_this2)})};PageProof.prototype.setSession=function setSession(session){if(session&&!(session instanceof _Session2.default)){this.session=(new _Session2.default).fromJSON(session)}else{this.session=session||null}return this.session};PageProof.prototype.rawRequest=function rawRequest(_ref2,options){var method=_ref2.method,url=_ref2.url,host=_ref2.host,path=_ref2.path,query=_ref2.query,body=_ref2.body,headers=_ref2.headers;var adapter=this.adapters.getRequestAdapter();if(url){host=url.origin;path=url.pathname;query=url.search}return adapter.send({host:host,method:method,path:path,query:query,body:body,headers:headers,credentials:false},options)};PageProof.prototype.getRequestLocalEncodedMetadata=function getRequestLocalEncodedMetadata(){return[(0,_getTimezone2.default)()].map(function(value){return value!==null&&value!==undefined?encodeURIComponent(value):"#"}).join(":")};PageProof.prototype.request=function request(name,params,options){var _this3=this;var request=new _Request2.default(this.options.endpoint,name,params);var adapter=this.adapters.getRequestAdapter();var start=Promise.resolve();if(!request.endpoint.anonymous){if(!this.session){return Promise.reject(new Error("Cannot make call to endpoint ("+name+") when unauthorized."))}var crypto=this.adapters.getCryptoAdapter();start=crypto.generateAuthorizationHeaders(request.getMethod(),request.getPath(),this.session).then(function(headers){return request.addHeaders(headers)})}if(this.options.applicationId){request.addHeader(_constants.DEVICE_ID_HEADER,this.options.applicationId)}if(this.options.subscriptionKey){request.addHeader(_constants.SUBSCRIPTION_KEY_HEADER,this.options.subscriptionKey)}if(name==="graphql"){request.addHeader("apollographql-client-name",this.options.applicationId?this.options.applicationId+" (via @pageproof/sdk)":"@pageproof/sdk");request.addHeader("apollographql-client-version",_version2.default);if(this.clientId){request.addHeader("spider-client-id",this.clientId)}}var localEncodedMetadata=this.getRequestLocalEncodedMetadata();if(localEncodedMetadata){request.addHeader(_constants.LOCAL_ENCODED_METADATA_HEADER,localEncodedMetadata)}var meta={request:request};return start.then(function(){var data=request.build();return _this3.events.emit("experimental.request.before",meta,true).then(function(){return data})}).then(function(data){return adapter.send(data,options)}).then(_Response2.default.parse).then(function(response){meta.response=response;_this3.events.emit("experimental.request.after",meta);if(response.code===_ResponseStatus2.default.ERROR_THROTTLED){var handlers=_this3.events.emit("error.throttled",meta);if(handlers.some(Boolean)){return Promise.all(handlers).then(function(){_this3.events.emit("experimental.request.retry",meta);return _this3.request(name,params,options)})}}if(response.code===_ResponseStatus2.default.ERROR_UNAUTHORISED){var sessionToken=_this3.session?_this3.session.token:null;return _this3.events.emit("error.unauthorized",meta,true).then(function(){if(_this3.session&&_this3.session.token!==sessionToken){return _this3.request(name,params,options)}return response})}if(response.deprecated){var message="The "+name+" API has been deprecated. "+(response.deprecated||"");_this3.events.emit("error.deprecated",{name:name,message:message})}return response}).then(function(response){try{if(response.error){_this3.events.emit("error.response",meta);var err=new Error(response.message+" ["+name+"]");err.response=response;err.request=request;return Promise.reject(err)}else{_this3.events.emit("experimental.request.resolve",meta);return Promise.resolve(response)}}finally{_this3.events.emit("experimental.request.finally",meta)}})};PageProof.prototype.graphql=function graphql(document,variables){var options=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{throwOnError:true,minifyDocument:true};var throwOnError=!options||options.throwOnError!==false;var minifyDocument=options.minifyDocument===true;var query=minifyDocument?document.replace(/\s+/g," ").replace(/ { /g,"{").replace(/ } /g,"}").trim():document;return this.request("graphql",{query:query,variables:variables}).then(function(response){var body=response.data;if(body.errors&&body.errors.length&&throwOnError){var err=new _AggregateError.AggregateError("One or more GraphQL errors occurred.",body.errors.map(function(error){return new _GraphQLError.GraphQLError(error.message,error.locations,error.path)}));throw err}return body})};PageProof.prototype.admin=function admin(){if(!this.session){return Promise.reject(new Error("You must be logged in to use the Admin API."))}if(!this.session.user.isAdmin){return Promise.reject(new Error("The current user must be an administrator of a team or enterprise account."))}if(!this._admin){this._admin=Promise.resolve(this.__admin)}return this._admin};PageProof.prototype.brian=function brian(){if(!this.session||this.session.userId!==_constants.BRIAN_USER_ID){return Promise.reject(new Error("You do not have permission to use this API."))}if(!this._brian){this._brian=Promise.resolve(new _Brian2.default(this))}return this._brian};PageProof.prototype.crypto=function crypto(){return this.adapters.getCryptoAdapter()};PageProof.prototype.protobuf=function protobuf(){return this.adapters.getProtobufAdapter()};PageProof.prototype.on=function on(event,handler){return this.events.on(event,handler)};return PageProof}();exports.default=PageProof;
1
+ "use strict";exports.__esModule=true;var _AdapterRepository=require("./AdapterRepository");var _AdapterRepository2=_interopRequireDefault(_AdapterRepository);var _Cache=require("./Cache");var _Cache2=_interopRequireDefault(_Cache);var _Request=require("../network/Request");var _Request2=_interopRequireDefault(_Request);var _Response=require("../network/Response");var _Response2=_interopRequireDefault(_Response);var _Accounts=require("../api/Accounts");var _Accounts2=_interopRequireDefault(_Accounts);var _Dashboard=require("../api/Dashboard");var _Dashboard2=_interopRequireDefault(_Dashboard);var _Users=require("../api/Users");var _Users2=_interopRequireDefault(_Users);var _Proofs=require("../api/Proofs");var _Proofs2=_interopRequireDefault(_Proofs);var _Briefs=require("../api/Briefs");var _Briefs2=_interopRequireDefault(_Briefs);var _Files=require("../api/Files");var _Files2=_interopRequireDefault(_Files);var _Admin=require("../api/admin/Admin");var _Admin2=_interopRequireDefault(_Admin);var _Workflows=require("../api/Workflows");var _Workflows2=_interopRequireDefault(_Workflows);var _Preferences=require("../api/Preferences");var _Preferences2=_interopRequireDefault(_Preferences);var _Comments=require("../api/Comments");var _Comments2=_interopRequireDefault(_Comments);var _Profile=require("../api/Profile");var _Profile2=_interopRequireDefault(_Profile);var _Sessions=require("../api/Sessions");var _Sessions2=_interopRequireDefault(_Sessions);var _Encryption=require("../api/Encryption");var _Encryption2=_interopRequireDefault(_Encryption);var _Live=require("../api/Live");var _Live2=_interopRequireDefault(_Live);var _Brian=require("../api/brian/Brian");var _Brian2=_interopRequireDefault(_Brian);var _Session=require("../models/Session");var _Session2=_interopRequireDefault(_Session);var _EventEmitter=require("../events/EventEmitter");var _EventEmitter2=_interopRequireDefault(_EventEmitter);var _ResponseStatus=require("../enum/ResponseStatus");var _ResponseStatus2=_interopRequireDefault(_ResponseStatus);var _sleep=require("../util/sleep");var _sleep2=_interopRequireDefault(_sleep);var _constants=require("../util/constants");var _getTimezone=require("../util/getTimezone");var _getTimezone2=_interopRequireDefault(_getTimezone);var _Reports=require("../api/Reports");var _Reports2=_interopRequireDefault(_Reports);var _Teams=require("../api/Teams");var _Teams2=_interopRequireDefault(_Teams);var _Printing=require("../api/Printing");var _Printing2=_interopRequireDefault(_Printing);var _FreeTrial=require("../api/FreeTrial");var _FreeTrial2=_interopRequireDefault(_FreeTrial);var _KeyPairs=require("./KeyPairs");var _KeyPairs2=_interopRequireDefault(_KeyPairs);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 debug=require("debug")("PageProof");var PageProof=function(){function PageProof(){var _ref=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{},_ref$options=_ref.options,options=_ref$options===undefined?{}:_ref$options,_ref$adapters=_ref.adapters,adapters=_ref$adapters===undefined?[]:_ref$adapters;_classCallCheck(this,PageProof);this.options=options;this.events=new _EventEmitter2.default;this.adapters=new _AdapterRepository2.default(adapters);this.cache=new _Cache2.default(this);this.keyPairs=new _KeyPairs2.default(this);this.accounts=new _Accounts2.default(this);this.comments=new _Comments2.default(this);this.dashboard=new _Dashboard2.default(this);this.files=new _Files2.default(this);this.profile=new _Profile2.default(this);this.proofs=new _Proofs2.default(this);this.briefs=new _Briefs2.default(this);this.users=new _Users2.default(this);this.workflows=new _Workflows2.default(this);this.preferences=new _Preferences2.default(this);this.sessions=new _Sessions2.default(this);this.encryption=new _Encryption2.default(this);this.live=new _Live2.default(this);this.reports=new _Reports2.default(this);this.teams=new _Teams2.default(this);this.printing=new _Printing2.default(this);this.freeTrial=new _FreeTrial2.default(this);this.__admin=new _Admin2.default(this);this._hijackAdmin();this._init();this._registerCoreHooks();this._enhance()}PageProof.prototype._init=function _init(){var requestAdapter=this.adapters.getRequestAdapter();if(!this.options.endpoint){this.options.endpoint=requestAdapter.options.endpoint}if(!this.options.applicationId){this.options.applicationId=requestAdapter.options.applicationId}if(!this.options.subscriptionKey){this.options.subscriptionKey=requestAdapter.options.key||this.options.key}if(this.options.subscriptionKey&&!this.options.applicationId){throw new Error("You must provide an applicationId.")}};PageProof.prototype._hijackAdmin=function _hijackAdmin(){var _this=this;var adminKeys=Object.getOwnPropertyNames(this.__admin);adminKeys.forEach(function(adminKey){return _this.admin[adminKey]=_this.__admin[adminKey]})};PageProof.prototype._registerCoreHooks=function _registerCoreHooks(){this.on("error.throttled",function(event){var ms=event.data.response.data.timeout;debug("Sleeping "+ms+"ms until rate limit resets");return(0,_sleep2.default)(ms)})};PageProof.prototype._enhance=function _enhance(){var _this2=this;var adapters=this.adapters.getEnhancementAdapters();adapters.forEach(function(adapter){return adapter.onClientReady(_this2)})};PageProof.prototype.setSession=function setSession(session){if(session&&!(session instanceof _Session2.default)){this.session=(new _Session2.default).fromJSON(session)}else{this.session=session||null}return this.session};PageProof.prototype.rawRequest=function rawRequest(_ref2,options){var method=_ref2.method,url=_ref2.url,host=_ref2.host,path=_ref2.path,query=_ref2.query,body=_ref2.body,headers=_ref2.headers;var adapter=this.adapters.getRequestAdapter();if(url){host=url.origin;path=url.pathname;query=url.search}return adapter.send({host:host,method:method,path:path,query:query,body:body,headers:headers,credentials:false},options)};PageProof.prototype.getRequestLocalEncodedMetadata=function getRequestLocalEncodedMetadata(){return[(0,_getTimezone2.default)()].map(function(value){return value!==null&&value!==undefined?encodeURIComponent(value):"#"}).join(":")};PageProof.prototype.request=function request(name,params,options){var _this3=this;var request=new _Request2.default(this.options.endpoint,name,params);var adapter=this.adapters.getRequestAdapter();var start=Promise.resolve();if(!request.endpoint.anonymous){if(!this.session){return Promise.reject(new Error("Cannot make call to endpoint ("+name+") when unauthorized."))}var crypto=this.adapters.getCryptoAdapter();start=crypto.generateAuthorizationHeaders(request.getMethod(),request.getPath(),this.session).then(function(headers){return request.addHeaders(headers)})}if(this.options.applicationId){request.addHeader(_constants.DEVICE_ID_HEADER,this.options.applicationId)}if(this.options.subscriptionKey){request.addHeader(_constants.SUBSCRIPTION_KEY_HEADER,this.options.subscriptionKey)}var localEncodedMetadata=this.getRequestLocalEncodedMetadata();if(localEncodedMetadata){request.addHeader(_constants.LOCAL_ENCODED_METADATA_HEADER,localEncodedMetadata)}var meta={request:request};return start.then(function(){var data=request.build();return _this3.events.emit("experimental.request.before",meta,true).then(function(){return data})}).then(function(data){return adapter.send(data,options)}).then(_Response2.default.parse).then(function(response){meta.response=response;_this3.events.emit("experimental.request.after",meta);if(response.code===_ResponseStatus2.default.ERROR_THROTTLED){var handlers=_this3.events.emit("error.throttled",meta);if(handlers.some(Boolean)){return Promise.all(handlers).then(function(){_this3.events.emit("experimental.request.retry",meta);return _this3.request(name,params,options)})}}if(response.code===_ResponseStatus2.default.ERROR_UNAUTHORISED){var sessionToken=_this3.session?_this3.session.token:null;return _this3.events.emit("error.unauthorized",meta,true).then(function(){if(_this3.session&&_this3.session.token!==sessionToken){return _this3.request(name,params,options)}return response})}if(response.deprecated){var message="The "+name+" API has been deprecated. "+(response.deprecated||"");_this3.events.emit("error.deprecated",{name:name,message:message})}return response}).then(function(response){try{if(response.error){_this3.events.emit("error.response",meta);var err=new Error(response.message+" ["+name+"]");err.response=response;err.request=request;return Promise.reject(err)}else{_this3.events.emit("experimental.request.resolve",meta);return Promise.resolve(response)}}finally{_this3.events.emit("experimental.request.finally",meta)}})};PageProof.prototype.admin=function admin(){if(!this.session){return Promise.reject(new Error("You must be logged in to use the Admin API."))}if(!this.session.user.isAdmin){return Promise.reject(new Error("The current user must be an administrator of a team or enterprise account."))}if(!this._admin){this._admin=Promise.resolve(this.__admin)}return this._admin};PageProof.prototype.brian=function brian(){if(!this.session||this.session.userId!==_constants.BRIAN_USER_ID){return Promise.reject(new Error("You do not have permission to use this API."))}if(!this._brian){this._brian=Promise.resolve(new _Brian2.default(this))}return this._brian};PageProof.prototype.crypto=function crypto(){return this.adapters.getCryptoAdapter()};PageProof.prototype.protobuf=function protobuf(){return this.adapters.getProtobufAdapter()};PageProof.prototype.on=function on(event,handler){return this.events.on(event,handler)};return PageProof}();exports.default=PageProof;
@@ -69,12 +69,6 @@ declare class File {
69
69
  * @type {object|null}
70
70
  */
71
71
  adobeExportData: object | null;
72
- /**
73
- * If the file was created by importing from an external URL, this will be that URL.
74
- *
75
- * @type {string|null}
76
- */
77
- importUrl: string | null;
78
72
  /** @private */
79
73
  fromFile(fileData: any): File;
80
74
  /** @private */
@@ -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 fileSchema={id:"FileId",name:"Name",blocks:"Chunks",size:"Size",downloadable:"Downloadable",assignedTo:"AssignedTo",assignedType:"AssignedType",status:"Status",message:"Message",adobeExportData:function adobeExportData(data){var exportData=data.AdobeExportData;if(exportData&&exportData.length){try{return JSON.parse(exportData)}catch(err){}}return null},sourceMetadata:function sourceMetadata(data){var sourceMetadata=data.SourceMetadata;if(sourceMetadata&&sourceMetadata.length){try{return JSON.parse(sourceMetadata)}catch(err){}}return null},importUrl:"ImportURL"};var commentAttachmentSchema={id:"FileId",name:"Name",blocks:"Chunks",assignedTo:"CommentId",assignedType:function assignedType(){return"attachment"},status:"Status",message:function message(){return""}};var File=function(){function File(){_classCallCheck(this,File)}File.prototype.fromFile=function fromFile(fileData){(0,_transform2.default)(this,fileSchema,fileData);return this};File.prototype.fromCommentAttachment=function fromCommentAttachment(commentAttachmentData){(0,_transform2.default)(this,commentAttachmentSchema,commentAttachmentData);return this};return File}();exports.default=File;
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 fileSchema={id:"FileId",name:"Name",blocks:"Chunks",size:"Size",downloadable:"Downloadable",assignedTo:"AssignedTo",assignedType:"AssignedType",status:"Status",message:"Message",adobeExportData:function adobeExportData(data){var exportData=data.AdobeExportData;if(exportData&&exportData.length){try{return JSON.parse(exportData)}catch(err){}}return null},sourceMetadata:function sourceMetadata(data){var sourceMetadata=data.SourceMetadata;if(sourceMetadata&&sourceMetadata.length){try{return JSON.parse(sourceMetadata)}catch(err){}}return null}};var commentAttachmentSchema={id:"FileId",name:"Name",blocks:"Chunks",assignedTo:"CommentId",assignedType:function assignedType(){return"attachment"},status:"Status",message:function message(){return""}};var File=function(){function File(){_classCallCheck(this,File)}File.prototype.fromFile=function fromFile(fileData){(0,_transform2.default)(this,fileSchema,fileData);return this};File.prototype.fromCommentAttachment=function fromCommentAttachment(commentAttachmentData){(0,_transform2.default)(this,commentAttachmentSchema,commentAttachmentData);return this};return File}();exports.default=File;
@@ -251,12 +251,6 @@ declare class Proof {
251
251
  * @type {string}
252
252
  */
253
253
  groupName: string;
254
- /**
255
- * Whether the proof can have a checklist added to it.
256
- *
257
- * @type {boolean}
258
- */
259
- canAddChecklist: boolean;
260
254
  /**
261
255
  * Whether the proof has the decisions feature enabled
262
256
  *
@@ -1 +1 @@
1
- "use strict";exports.__esModule=true;var _transform=require("./transform");var _transform2=_interopRequireDefault(_transform);var _ProofState=require("../enum/ProofState");var _ProofState2=_interopRequireDefault(_ProofState);var _ProofStatus=require("../enum/ProofStatus");var _ProofStatus2=_interopRequireDefault(_ProofStatus);var _ProofType=require("../enum/ProofType");var _ProofType2=_interopRequireDefault(_ProofType);var _FileStatus=require("../enum/FileStatus");var _FileStatus2=_interopRequireDefault(_FileStatus);var _id=require("../util/id");var _getPercentage=require("../util/getPercentage");var _getPercentage2=_interopRequireDefault(_getPercentage);var _User=require("./User");var _User2=_interopRequireDefault(_User);var _DecisionSummary=require("./DecisionSummary");var _DecisionSummary2=_interopRequireDefault(_DecisionSummary);var _ProofIntegrationReference=require("./ProofIntegrationReference");var _ProofIntegrationReference2=_interopRequireDefault(_ProofIntegrationReference);var _ProofChecklist=require("./ProofChecklist");var _ProofChecklist2=_interopRequireDefault(_ProofChecklist);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}function isOverdue(){return this.dueDate&&this.dueDate.getTime()<Date.now()}var proofSchema={id:"ProofId",name:"Title",status:"Status",workflowId:"WorkflowId",version:"Version",dueDate:(0,_transform.date)("DueDate"),createdDate:(0,_transform.date)("CreateDate"),approvedDate:(0,_transform.date)("ApprovedDate"),isLocked:"Locked",isArchived:"Closed",isOverdue:isOverdue,uploaderUserId:"UserId",ownerUserIds:"OwnerIds",editorUserId:"EditorId",editorUserIds:"EditorIds",lockerUserId:"ProofLockerId",messageToReviewers:"Description",messageToOwners:"OwnerMessage",messageToEditor:"EditorMessage",fileId:"FileId",fileExtension:"Extension",fileStatus:"FileStatus",fileMessage:"FileStatusMessage",fileSize:"FileSize",pageCount:(0,_transform.number)("Pages"),commentCount:(0,_transform.number)("ParentComments"),canDownload:(0,_transform.truthy)("DownloadOriginal"),type:"Type",processStatus:"ProcessStatus",recipient:"Recipient",recipientEmail:"RecipientEmail",todoCommentCount:(0,_transform.number)("CountTodoComments"),doneCommentCount:(0,_transform.number)("CountDoneComments"),fileCategory:"FileCategory",isAdminOnProof:"IsAdminOnProof",groupId:"GroupId",canReupload:"CanReupload",hasEditors:"HasEditors",groupName:"GroupName",role:"Role",canOthersEditComments:"FeatureEditComments",canAddCommentReplies:"FeatureCanAddCommentReplies",canHaveGeneralComments:"FeatureGeneralComments",canAddChecklist:"FeatureCanAddChecklist",hasDecisionsEnabled:"FeatureDecisions",hasColorSeparations:"HasColorSeparations",reference:"Reference",integrationReferences:(0,_transform.each)("IntegrationReferences",function(data){return(new _ProofIntegrationReference2.default).fromProofIntegrationReference(data)}),checklist:function checklist(data){return data.Checklist&&(new _ProofChecklist2.default).fromProofChecklist(data.Checklist)},isReferenceEnabled:"FeatureProofReference",source:"Source",owners:(0,_transform.each)("Owners",function(ownerData){return(new _User2.default).fromUser(ownerData)}),decisionSummary:(0,_transform.each)("Decisions",function(decisionsData){return(new _DecisionSummary2.default).fromDecisionSummary(decisionsData)}),tags:(0,_transform.each)("Tags",function(tag){return tag.Value}),teamId:"TeamId",isPublic:"IsPublic",canBePublic:"FeaturePublicProofs",canSendShareLink:"FeatureSendShareLink",publicProofKeyPair:function publicProofKeyPair(data){return data.PublicProofKeyPair&&{publicKeyPEM:data.PublicProofKeyPair.PublicKey,privateKeyPEM:data.PublicProofKeyPair.PrivateKey}},canSendMessageToOwners:"FeatureMessageToOwners",workflowMetrics:"WorkflowMetrics"};var Proof=function(){function Proof(){_classCallCheck(this,Proof)}Proof.prototype.isUserAdminOfProofTeam=function isUserAdminOfProofTeam(user){return user.isAdmin&&this.teamId===user.teamId};Proof.prototype.getState=function getState(){var state=_ProofState2.default.ACTIVE;if(this.fileStatus===_FileStatus2.default.UPLOADING){state=_ProofState2.default.UPLOADING}else if(this.hasFileError()){state=_ProofState2.default.FILE_ERROR}else if(this.isProcessing()){state=_ProofState2.default.PROCESSING}else if(this.type===_ProofType2.default.BRIEF){switch(this.status){case _ProofStatus2.default.NEW:state=_ProofState2.default.SETUP_NEEDED;break;case _ProofStatus2.default.PROOFING:state=_ProofState2.default.BRIEFING;break;case _ProofStatus2.default.AWAITING_NEW_VERSION:state=_ProofState2.default.AWAITING_PROOF;break;case _ProofStatus2.default.HAS_NEW_VERSION:state=_ProofState2.default.HAS_NEW_VERSION;break;case _ProofStatus2.default.ARCHIVED:state=_ProofState2.default.ARCHIVED;break}}else if(this.status===_ProofStatus2.default.ARCHIVED){state=_ProofState2.default.ARCHIVED}else if(this.status===_ProofStatus2.default.TODOS_REQUESTED){state=_ProofState2.default.TODOS_REQUESTED}else if(this.status===_ProofStatus2.default.AWAITING_NEW_VERSION){state=_ProofState2.default.AWAITING_NEW_VERSION}else if(this.status===_ProofStatus2.default.HAS_NEW_VERSION){state=_ProofState2.default.HAS_NEW_VERSION}else if(this.status===_ProofStatus2.default.APPROVED){state=_ProofState2.default.APPROVED}else if(!this.hasWorkflow()){state=_ProofState2.default.PROOFERS_NEEDED}else if(!this.hasWorkflowStarted()){state=_ProofState2.default.NOT_STARTED}else if(this.isOverdue){state=_ProofState2.default.OVERDUE}return state};Proof.prototype.getVideoProcessingProgress=function getVideoProcessingProgress(){var percent=0;var message=String(this.fileMessage);if(message){var thumbMatch=/^Thumb-\w+\-([-+]?[0-9]*\.?[0-9]*)/g.exec(message);var videoMatch=/^Video-\w+\-([-+]?[0-9]*\.?[0-9]*)/g.exec(message);if(message.startsWith("Video-Scheduled-")){percent=0}else if(videoMatch){percent=(0,_getPercentage2.default)(parseFloat(videoMatch[1])/100,0,.2)}else if(thumbMatch){percent=(0,_getPercentage2.default)(parseFloat(thumbMatch[1])/100,.8,0)}}return percent};Proof.prototype.hasWorkflowStarted=function hasWorkflowStarted(){return this.hasWorkflow()&&this.status!==_ProofStatus2.default.NEW};Proof.prototype.isProcessing=function isProcessing(){return this.fileStatus===_FileStatus2.default.UPLOADING||this.fileStatus===_FileStatus2.default.QUEUED||this.fileStatus===_FileStatus2.default.RIPPING};Proof.prototype.isAwaitingFile=function isAwaitingFile(){return this.source&&this.fileStatus===_FileStatus2.default.CREATED};Proof.prototype.getProcessingProgress=function getProcessingProgress(){switch(this.fileStatus){case _FileStatus2.default.UPLOADING:return.1;case _FileStatus2.default.QUEUED:return.2;case _FileStatus2.default.RIPPING:if(this.fileCategory==="video"){return(0,_getPercentage2.default)(this.getVideoProcessingProgress(),.2,.1).toFixed(2)}return.6;default:return-1}};Proof.prototype.hasWorkflow=function hasWorkflow(){return(0,_id.isWorkflowId)(this.workflowId)};Proof.prototype.hasFile=function hasFile(){return(0,_id.isFileId)(this.fileId)};Proof.prototype.hasFileError=function hasFileError(){return this.fileStatus===_FileStatus2.default.ERROR||!this.fileStatus||!this.hasFile()};Proof.prototype.hasEditor=function hasEditor(){return(0,_id.isUserId)(this.editorUserId)};Proof.prototype.hasThumbnail=function hasThumbnail(){return this.fileStatus===_FileStatus2.default.OK};Proof.prototype.canUserUploadNewVersion=function canUserUploadNewVersion(userId){return this.getState()===_ProofState2.default.AWAITING_NEW_VERSION&&(this.isEditor(userId)||this.isOwner(userId))||this.getState()===_ProofState2.default.AWAITING_PROOF&&(this.isEditor(userId)||this.isRecipient(userId))};Proof.prototype.isOwner=function isOwner(userId){return this.ownerUserIds.indexOf(userId)!==-1};Proof.prototype.isEditor=function isEditor(userId){return this.editorUserIds.indexOf(userId)!==-1};Proof.prototype.isRecipient=function isRecipient(userId){return this.recipient===userId};Proof.prototype.calculateState=function calculateState(){this.state=this.getState()};Proof.prototype.fromProof=function fromProof(proofData){(0,_transform2.default)(this,proofSchema,proofData);this.calculateState();return this};return Proof}();exports.default=Proof;
1
+ "use strict";exports.__esModule=true;var _transform=require("./transform");var _transform2=_interopRequireDefault(_transform);var _ProofState=require("../enum/ProofState");var _ProofState2=_interopRequireDefault(_ProofState);var _ProofStatus=require("../enum/ProofStatus");var _ProofStatus2=_interopRequireDefault(_ProofStatus);var _ProofType=require("../enum/ProofType");var _ProofType2=_interopRequireDefault(_ProofType);var _FileStatus=require("../enum/FileStatus");var _FileStatus2=_interopRequireDefault(_FileStatus);var _id=require("../util/id");var _getPercentage=require("../util/getPercentage");var _getPercentage2=_interopRequireDefault(_getPercentage);var _User=require("./User");var _User2=_interopRequireDefault(_User);var _DecisionSummary=require("./DecisionSummary");var _DecisionSummary2=_interopRequireDefault(_DecisionSummary);var _ProofIntegrationReference=require("./ProofIntegrationReference");var _ProofIntegrationReference2=_interopRequireDefault(_ProofIntegrationReference);var _ProofChecklist=require("./ProofChecklist");var _ProofChecklist2=_interopRequireDefault(_ProofChecklist);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}function isOverdue(){return this.dueDate&&this.dueDate.getTime()<Date.now()}var proofSchema={id:"ProofId",name:"Title",status:"Status",workflowId:"WorkflowId",version:"Version",dueDate:(0,_transform.date)("DueDate"),createdDate:(0,_transform.date)("CreateDate"),approvedDate:(0,_transform.date)("ApprovedDate"),isLocked:"Locked",isArchived:"Closed",isOverdue:isOverdue,uploaderUserId:"UserId",ownerUserIds:"OwnerIds",editorUserId:"EditorId",editorUserIds:"EditorIds",lockerUserId:"ProofLockerId",messageToReviewers:"Description",messageToOwners:"OwnerMessage",messageToEditor:"EditorMessage",fileId:"FileId",fileExtension:"Extension",fileStatus:"FileStatus",fileMessage:"FileStatusMessage",fileSize:"FileSize",pageCount:(0,_transform.number)("Pages"),commentCount:(0,_transform.number)("ParentComments"),canDownload:(0,_transform.truthy)("DownloadOriginal"),type:"Type",processStatus:"ProcessStatus",recipient:"Recipient",recipientEmail:"RecipientEmail",todoCommentCount:(0,_transform.number)("CountTodoComments"),doneCommentCount:(0,_transform.number)("CountDoneComments"),fileCategory:"FileCategory",isAdminOnProof:"IsAdminOnProof",groupId:"GroupId",canReupload:"CanReupload",hasEditors:"HasEditors",groupName:"GroupName",role:"Role",canOthersEditComments:"FeatureEditComments",canAddCommentReplies:"FeatureCanAddCommentReplies",canHaveGeneralComments:"FeatureGeneralComments",hasDecisionsEnabled:"FeatureDecisions",hasColorSeparations:"HasColorSeparations",reference:"Reference",integrationReferences:(0,_transform.each)("IntegrationReferences",function(data){return(new _ProofIntegrationReference2.default).fromProofIntegrationReference(data)}),checklist:function checklist(data){return data.Checklist&&(new _ProofChecklist2.default).fromProofChecklist(data.Checklist)},isReferenceEnabled:"FeatureProofReference",source:"Source",owners:(0,_transform.each)("Owners",function(ownerData){return(new _User2.default).fromUser(ownerData)}),decisionSummary:(0,_transform.each)("Decisions",function(decisionsData){return(new _DecisionSummary2.default).fromDecisionSummary(decisionsData)}),tags:(0,_transform.each)("Tags",function(tag){return tag.Value}),teamId:"TeamId",isPublic:"IsPublic",canBePublic:"FeaturePublicProofs",canSendShareLink:"FeatureSendShareLink",publicProofKeyPair:function publicProofKeyPair(data){return data.PublicProofKeyPair&&{publicKeyPEM:data.PublicProofKeyPair.PublicKey,privateKeyPEM:data.PublicProofKeyPair.PrivateKey}},canSendMessageToOwners:"FeatureMessageToOwners",workflowMetrics:"WorkflowMetrics"};var Proof=function(){function Proof(){_classCallCheck(this,Proof)}Proof.prototype.isUserAdminOfProofTeam=function isUserAdminOfProofTeam(user){return user.isAdmin&&this.teamId===user.teamId};Proof.prototype.getState=function getState(){var state=_ProofState2.default.ACTIVE;if(this.fileStatus===_FileStatus2.default.UPLOADING){state=_ProofState2.default.UPLOADING}else if(this.hasFileError()){state=_ProofState2.default.FILE_ERROR}else if(this.isProcessing()){state=_ProofState2.default.PROCESSING}else if(this.type===_ProofType2.default.BRIEF){switch(this.status){case _ProofStatus2.default.NEW:state=_ProofState2.default.SETUP_NEEDED;break;case _ProofStatus2.default.PROOFING:state=_ProofState2.default.BRIEFING;break;case _ProofStatus2.default.AWAITING_NEW_VERSION:state=_ProofState2.default.AWAITING_PROOF;break;case _ProofStatus2.default.HAS_NEW_VERSION:state=_ProofState2.default.HAS_NEW_VERSION;break;case _ProofStatus2.default.ARCHIVED:state=_ProofState2.default.ARCHIVED;break}}else if(this.status===_ProofStatus2.default.ARCHIVED){state=_ProofState2.default.ARCHIVED}else if(this.status===_ProofStatus2.default.TODOS_REQUESTED){state=_ProofState2.default.TODOS_REQUESTED}else if(this.status===_ProofStatus2.default.AWAITING_NEW_VERSION){state=_ProofState2.default.AWAITING_NEW_VERSION}else if(this.status===_ProofStatus2.default.HAS_NEW_VERSION){state=_ProofState2.default.HAS_NEW_VERSION}else if(this.status===_ProofStatus2.default.APPROVED){state=_ProofState2.default.APPROVED}else if(!this.hasWorkflow()){state=_ProofState2.default.PROOFERS_NEEDED}else if(!this.hasWorkflowStarted()){state=_ProofState2.default.NOT_STARTED}else if(this.isOverdue){state=_ProofState2.default.OVERDUE}return state};Proof.prototype.getVideoProcessingProgress=function getVideoProcessingProgress(){var percent=0;var message=String(this.fileMessage);if(message){var thumbMatch=/^Thumb-\w+\-([-+]?[0-9]*\.?[0-9]*)/g.exec(message);var videoMatch=/^Video-\w+\-([-+]?[0-9]*\.?[0-9]*)/g.exec(message);if(message.startsWith("Video-Scheduled-")){percent=0}else if(videoMatch){percent=(0,_getPercentage2.default)(parseFloat(videoMatch[1])/100,0,.2)}else if(thumbMatch){percent=(0,_getPercentage2.default)(parseFloat(thumbMatch[1])/100,.8,0)}}return percent};Proof.prototype.hasWorkflowStarted=function hasWorkflowStarted(){return this.hasWorkflow()&&this.status!==_ProofStatus2.default.NEW};Proof.prototype.isProcessing=function isProcessing(){return this.fileStatus===_FileStatus2.default.UPLOADING||this.fileStatus===_FileStatus2.default.QUEUED||this.fileStatus===_FileStatus2.default.RIPPING};Proof.prototype.isAwaitingFile=function isAwaitingFile(){return this.source&&this.fileStatus===_FileStatus2.default.CREATED};Proof.prototype.getProcessingProgress=function getProcessingProgress(){switch(this.fileStatus){case _FileStatus2.default.UPLOADING:return.1;case _FileStatus2.default.QUEUED:return.2;case _FileStatus2.default.RIPPING:if(this.fileCategory==="video"){return(0,_getPercentage2.default)(this.getVideoProcessingProgress(),.2,.1).toFixed(2)}return.6;default:return-1}};Proof.prototype.hasWorkflow=function hasWorkflow(){return(0,_id.isWorkflowId)(this.workflowId)};Proof.prototype.hasFile=function hasFile(){return(0,_id.isFileId)(this.fileId)};Proof.prototype.hasFileError=function hasFileError(){return this.fileStatus===_FileStatus2.default.ERROR||!this.fileStatus||!this.hasFile()};Proof.prototype.hasEditor=function hasEditor(){return(0,_id.isUserId)(this.editorUserId)};Proof.prototype.hasThumbnail=function hasThumbnail(){return this.fileStatus===_FileStatus2.default.OK};Proof.prototype.canUserUploadNewVersion=function canUserUploadNewVersion(userId){return this.getState()===_ProofState2.default.AWAITING_NEW_VERSION&&(this.isEditor(userId)||this.isOwner(userId))||this.getState()===_ProofState2.default.AWAITING_PROOF&&(this.isEditor(userId)||this.isRecipient(userId))};Proof.prototype.isOwner=function isOwner(userId){return this.ownerUserIds.indexOf(userId)!==-1};Proof.prototype.isEditor=function isEditor(userId){return this.editorUserIds.indexOf(userId)!==-1};Proof.prototype.isRecipient=function isRecipient(userId){return this.recipient===userId};Proof.prototype.calculateState=function calculateState(){this.state=this.getState()};Proof.prototype.fromProof=function fromProof(proofData){(0,_transform2.default)(this,proofSchema,proofData);this.calculateState();return this};return Proof}();exports.default=Proof;
@@ -26,12 +26,6 @@ declare class TeamProofFeatures {
26
26
  * @type {boolean}
27
27
  */
28
28
  messageToOwners: boolean;
29
- /**
30
- * Array of proof decisions that allowed to the reviewer.
31
- *
32
- * @type {Array<Decision>}
33
- */
34
- allowedDecisions: Array<Decision>;
35
29
  /** @private */
36
30
  fromTeamProofFeatures(teamProofFeaturesData: any): TeamProofFeatures;
37
31
  }
@@ -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",publicProofs:"PublicProofs",defaultIsPublic:"DefaultProofIsPublic",messageToOwners:"MessageToOwners",allowedDecisions:"AllowedDecisions"};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",publicProofs:"PublicProofs",defaultIsPublic:"DefaultProofIsPublic",messageToOwners:"MessageToOwners"};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;
@@ -853,7 +853,7 @@
853
853
  "version": 2,
854
854
  "method": "POST",
855
855
  "path": "/api/admin/settings",
856
- "body": ["displayComments", "generalComments", "editComments", "proofReference", "displayTeamName", "emailTitleTextColor", "emailLinkTextColor", "emailButtonBackgroundColor", "emailButtonTextColor", "disableReplyingToCommentsInStatuses", "publicProofs", "defaultProofIsPublic", "messageToOwners", "allowedDecisions"]
856
+ "body": ["displayComments", "generalComments", "editComments", "proofReference", "displayTeamName", "emailTitleTextColor", "emailLinkTextColor", "emailButtonBackgroundColor", "emailButtonTextColor", "disableReplyingToCommentsInStatuses", "publicProofs", "defaultProofIsPublic", "messageToOwners"]
857
857
  },
858
858
  "admin.team.features.sender-email.set": {
859
859
  "version": 2,
@@ -1130,11 +1130,5 @@
1130
1130
  "method": "POST",
1131
1131
  "path": "/api/public-proofs/proof/send-share-link",
1132
1132
  "body": ["proofId", "message", "emailAddresses"]
1133
- },
1134
- "graphql": {
1135
- "version": 2,
1136
- "method": "POST",
1137
- "path": "/spider/graphql",
1138
- "body": true
1139
1133
  }
1140
1134
  }