@pageproof/sdk-pr 397.0.1647384920467 → 399.0.1639628437022
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 +0 -121
- package/README.md +0 -1
- package/lib/api/Accounts.d.ts +1 -9
- package/lib/api/Accounts.js +1 -1
- package/lib/api/Comments.d.ts +24 -73
- package/lib/api/Comments.js +1 -1
- package/lib/api/Files.d.ts +1 -4
- package/lib/api/admin/TeamFeatures.d.ts +0 -25
- package/lib/api/admin/TeamFeatures.js +0 -49
- package/lib/models/Comment.d.ts +4 -33
- package/lib/models/Comment.js +1 -1
- package/lib/models/Pin.d.ts +43 -0
- package/lib/models/Pin.js +1 -0
- package/lib/models/PinFill.d.ts +16 -0
- package/lib/models/PinFill.js +1 -0
- package/lib/models/TeamEmailFeatures.d.ts +0 -36
- package/lib/models/TeamEmailFeatures.js +1 -1
- package/lib/models/User.d.ts +0 -6
- package/lib/models/User.js +1 -1
- package/lib/models/index.d.ts +2 -1
- package/lib/models/index.js +1 -1
- package/lib/network/endpoints.json +2 -22
- package/lib/pageproof.js +1 -1
- package/lib/types/FileV2.d.ts +7 -28
- package/lib/util/exports.d.ts +0 -6
- package/lib/util/exports.js +1 -1
- package/package.json +1 -1
- package/lib/api/AccountsMFA.d.ts +0 -28
- package/lib/api/AccountsMFA.js +0 -1
- package/lib/types/Pin.d.ts +0 -33
- package/lib/types/Pin.js +0 -1
- package/lib/types/SpfRecordDefinition.d.ts +0 -17
- package/lib/types/SpfRecordDefinition.js +0 -1
- package/lib/types/TeamSenderEmail.d.ts +0 -21
- package/lib/types/TeamSenderEmail.js +0 -1
- package/lib/util/pins/parsePins.d.ts +0 -1
- package/lib/util/pins/parsePins.js +0 -78
- package/lib/util/pins/serializePins.d.ts +0 -1
- package/lib/util/pins/serializePins.js +0 -51
- package/lib/util/pins/utils.d.ts +0 -3
- package/lib/util/pins/utils.js +0 -18
package/CHANGELOG.md
CHANGED
|
@@ -1,126 +1,5 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
## 2.0.0-beta.287
|
|
4
|
-
|
|
5
|
-
Released on the 16th of March 2022.
|
|
6
|
-
|
|
7
|
-
- [[PP-1644](https://goto.pageproof.dev/PP-1644)] Added support for customizing email title, link, and button colors. See [TeamEmailFeatures](https://docs.pageproof.tech/@pageproof/sdk/beta/class/src/models/TeamEmailFeatures.js~TeamEmailFeatures.html) 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.286
|
|
10
|
-
|
|
11
|
-
Released on the 2nd of February 2022.
|
|
12
|
-
|
|
13
|
-
- [[PP-1654](https://goto.pageproof.dev/PP-1654)] Added support for enterprise teams to reset their custom email address. See [TeamFeatures.setSenderEmail](https://docs.pageproof.tech/@pageproof/sdk/beta/class/src/api/admin/TeamFeatures.js~TeamFeatures.html#instance-method-setSenderEmail).
|
|
14
|
-
|
|
15
|
-
## 2.0.0-beta.285
|
|
16
|
-
|
|
17
|
-
Released on the 1st of February 2022.
|
|
18
|
-
|
|
19
|
-
_This release contains nothing new._
|
|
20
|
-
|
|
21
|
-
## 2.0.0-beta.284
|
|
22
|
-
|
|
23
|
-
Released on the 23rd of December 2021.
|
|
24
|
-
|
|
25
|
-
This release introduces support for comments with multiple pins. This means it's now possible to create a comment that has more than one pin (previously the limit). Because of this, we've made some changes that you'll want to know about, to ensure your transition to this version (and subsequent versions) are as seamless as possible.
|
|
26
|
-
|
|
27
|
-
We've removed the following things:
|
|
28
|
-
- The `Pin` and `PinFill` models have been removed. The objects you get by accessing pin fields now return a plain JavaScript object instead of an instance of the `Pin` class. The fields on this object are no different than before - but if you were previously checking the prototype of these objects, these checks will now produce a false-negative.
|
|
29
|
-
|
|
30
|
-
We're pretty confident that this change should have little to no impact on your integration with PageProof. And if you currently use the SDK sidecar, absolutely no impact whatsoever. This is highly edge-case.
|
|
31
|
-
|
|
32
|
-
We've deprecated a few model properties:
|
|
33
|
-
- The `Comment` model
|
|
34
|
-
- The `pin` property has been replaced by the new `pins` property. This property is an array of pins attached to the comment. As mentioned above, the objects you get from this array is a plain JavaScript object - but contains all the same properties. Accessing the deprecated `pin` property will yield the first pin attached to the comment - for backwards compatibility reasons only. The `pin` property will be removed in a later release.
|
|
35
|
-
|
|
36
|
-
> Change any code like `comment.pin` to `comment.pins[0]`. Ideally, also change your code to have support for multiple pins (this change may be more complex than the example).
|
|
37
|
-
- The `mediaTime` property has been replaced by the `time` property on the pin object. This change means it's possible for video and auto proofs to have pins added at different times along the timeline. This is not currently something we support in PageProof, but is making way for that functionality to be implemented in the future. Accessing the deprecated `mediaTime` property will yield the first pin's time - for backwards compatibility reasons only. The `mediaTime` property will be removed in a later release.
|
|
38
|
-
|
|
39
|
-
> Change any code like `comment.mediaTime` to `comment.pins[0].time`. And again, ideally you'd also want to change your code to have support for multiple pins.
|
|
40
|
-
- The `mediaDuration` property has been replaced by the `duration` property on the pin object. This change has been made for the same reasons as the change to the `mediaTime` property (above). Accessing the deprecated `mediaDuration` property will yield the first pin's duration - for backwards compatibility reasons only. The `mediaDuration` property will be removed in a later release.
|
|
41
|
-
|
|
42
|
-
> Change any code like `comment.mediaDuration` to `comment.pins[0].duration`. And again, ideally you'd also want to change your code to have support for multiple pins.
|
|
43
|
-
|
|
44
|
-
We've deprecated a few API options:
|
|
45
|
-
- The `Comments.create()` method
|
|
46
|
-
- The `pin` option has been replaced by the new `pins` option. This property is array of pins to attach to the comment. Providing this option behaves exactly as it did in earlier versions of the SDK, but it is recommended you switch to using the `pins` option, as we plan on removing the `pin` option in the future.
|
|
47
|
-
- The `mediaTime` option has been replaced by the `time` property on the pin object(s). Providing this option automatically assigns the first pin with the `time` property - but we recommend that you switch to manually specifying the `time` property, as we plan on removing the `mediaTime` option in the future.
|
|
48
|
-
- The `mediaDuration` option has been replaced by the `duration` property on the pin object(s). Providing this option automatically assigns the first pin with the `duration` property - but we recommend that you switch to manually specifying the `duration` property, as we plan on removing the `mediaDuration` option in the future.
|
|
49
|
-
|
|
50
|
-
### TL;DR
|
|
51
|
-
|
|
52
|
-
Here are a couple of code snippets of code that you may have in your PageProof integration code. If you're in a rush - here's a quick example of the changes you'll want to make.
|
|
53
|
-
|
|
54
|
-
**Creating comments**
|
|
55
|
-
|
|
56
|
-
Before (deprecated):
|
|
57
|
-
```js
|
|
58
|
-
await client.comments.create({
|
|
59
|
-
proofId: 'PR4G1XDX6W4QC579',
|
|
60
|
-
raw: 'Hello World',
|
|
61
|
-
pin: {
|
|
62
|
-
x: 0.024566473,
|
|
63
|
-
y: 0.756634520,
|
|
64
|
-
},
|
|
65
|
-
mediaTime: 17.3605,
|
|
66
|
-
mediaDuration: 1.5,
|
|
67
|
-
});
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
After (recommended, and the way forward):
|
|
71
|
-
```js
|
|
72
|
-
await client.comments.create({
|
|
73
|
-
proofId: 'PR4G1XDX6W4QC579',
|
|
74
|
-
raw: 'Hello World',
|
|
75
|
-
pins: [
|
|
76
|
-
{
|
|
77
|
-
x: 0.024566473,
|
|
78
|
-
y: 0.756634520,
|
|
79
|
-
time: 17.3605,
|
|
80
|
-
duration: 1.5,
|
|
81
|
-
},
|
|
82
|
-
],
|
|
83
|
-
});
|
|
84
|
-
```
|
|
85
|
-
|
|
86
|
-
**Loading & accessing comment/pin info**
|
|
87
|
-
|
|
88
|
-
Before (deprecated):
|
|
89
|
-
```js
|
|
90
|
-
const comments = await client.comments.load('PR4G1XDX6W4QC579');
|
|
91
|
-
comments[0].pin.x === 0.024566473;
|
|
92
|
-
comments[0].pin.y === 0.756634520;
|
|
93
|
-
comments[0].mediaTime === 17.3605;
|
|
94
|
-
comments[0].mediaDuration === 1.5;
|
|
95
|
-
```
|
|
96
|
-
|
|
97
|
-
After (recommended, and the way forward):
|
|
98
|
-
```js
|
|
99
|
-
const comments = await client.comments.load('PR4G1XDX6W4QC579');
|
|
100
|
-
comments[0].pins[0].x === 0.024566473;
|
|
101
|
-
comments[0].pins[0].y === 0.756634520;
|
|
102
|
-
comments[0].pins[0].time === 17.3605;
|
|
103
|
-
comments[0].pins[0].duration === 1.5;
|
|
104
|
-
```
|
|
105
|
-
|
|
106
|
-
## 2.0.0-beta.283
|
|
107
|
-
|
|
108
|
-
Released on the 21th of December 2021.
|
|
109
|
-
|
|
110
|
-
- [[PP-1689](https://goto.pageproof.dev/PP-1689)] Added support for MFA (multi-factor authenticator). See [Accounts.login](https://docs.pageproof.tech/@pageproof/sdk/beta/class/src/api/Accounts.js~Accounts.html#instance-method-login).
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
## 2.0.0-beta.282
|
|
114
|
-
|
|
115
|
-
Released on the 20th of December 2021.
|
|
116
|
-
|
|
117
|
-
- [[PP-1654](https://goto.pageproof.dev/PP-1654)] Added support enterprise teams to specify a custom email address for all of their emails to be sent from (requires SPF verification). See [TeamFeatures.setSenderEmail](https://docs.pageproof.tech/@pageproof/sdk/beta/class/src/api/admin/TeamFeatures.js~TeamFeatures.html#instance-method-setSenderEmail).
|
|
118
|
-
|
|
119
|
-
## 2.0.0-beta.281
|
|
120
|
-
|
|
121
|
-
Released on the 17th of December 2021.
|
|
122
|
-
|
|
123
|
-
- [[PP-1536](https://pageproof.atlassian.net/browse/PP-1536)] Added support for duplicating files. See [Files.duplicate](https://docs.pageproof.tech/@pageproof/sdk/beta/class/src/api/Files.js~Files.html#instance-method-duplicate).
|
|
124
3
|
|
|
125
4
|
## 2.0.0-beta.280
|
|
126
5
|
|
package/README.md
CHANGED
|
@@ -286,7 +286,6 @@ Name | Namespace | Description | Admin-only | Stability
|
|
|
286
286
|
--- | --- | --- | --- | ---
|
|
287
287
|
[Accounts API](./class/src/api/Accounts.js~Accounts.html) | `accounts` | Used to create accounts, activate and login. | No | Stable
|
|
288
288
|
[Accounts SSO API](./class/src/api/AccountsSSO.js~AccountsSSO.html) | `accounts.sso` | Used to login using a SSO provider. | No | Experimental
|
|
289
|
-
[Accounts MFA API](./class/src/api/AccountsMFA.js~AccountsMFA.html) | `accounts.mfa` | Used to activate, de-activate and enable user mfa login. | No | experimental
|
|
290
289
|
[Comments API](./class/src/api/Comments.js~Comments.html) | `comments` | Used to load comments. | No | Stable
|
|
291
290
|
[Dashboard API](./class/src/api/Dashboard.js~Dashboard.html) | `dashboard` | Used to load the authenticated user's dashboard & search for/filter proofs. | No | Stable
|
|
292
291
|
[Dashboard Groups API](./class/src/api/DashboardGroups.js~DashboardGroups.html) | `dashboard.groups` | Used to load proof groups | No | Experimental
|
package/lib/api/Accounts.d.ts
CHANGED
|
@@ -8,12 +8,6 @@ declare class Accounts extends API {
|
|
|
8
8
|
* @type {AccountsSSO}
|
|
9
9
|
*/
|
|
10
10
|
sso: AccountsSSO;
|
|
11
|
-
/**
|
|
12
|
-
* The Accounts MFA API.
|
|
13
|
-
*
|
|
14
|
-
* @type {AccountsMFA}
|
|
15
|
-
*/
|
|
16
|
-
mfa: AccountsMFA;
|
|
17
11
|
/** @private */
|
|
18
12
|
_generateCredentials(password: any): any;
|
|
19
13
|
/**
|
|
@@ -107,10 +101,9 @@ declare class Accounts extends API {
|
|
|
107
101
|
*
|
|
108
102
|
* @param {string} email The user's email address
|
|
109
103
|
* @param {string} password The user's secure password
|
|
110
|
-
* @param {string} [totp] The user's timed one time passcode produced from their authenticator app
|
|
111
104
|
* @returns {Promise<Session>}
|
|
112
105
|
*/
|
|
113
|
-
login(email: string, password: string,
|
|
106
|
+
login(email: string, password: string, _decryptPrivateKey?: boolean): Promise<Session>;
|
|
114
107
|
/**
|
|
115
108
|
* Resets the password for an account.
|
|
116
109
|
*
|
|
@@ -213,5 +206,4 @@ declare class Accounts extends API {
|
|
|
213
206
|
}
|
|
214
207
|
import API from "./API";
|
|
215
208
|
import AccountsSSO from "./AccountsSSO";
|
|
216
|
-
import AccountsMFA from "./AccountsMFA";
|
|
217
209
|
import Session from "../models/Session";
|
package/lib/api/Accounts.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";exports.__esModule=true;var _API2=require("./API");var _API3=_interopRequireDefault(_API2);var _Session=require("../models/Session");var _Session2=_interopRequireDefault(_Session);var _AccountsSSO=require("./AccountsSSO");var _AccountsSSO2=_interopRequireDefault(_AccountsSSO);
|
|
1
|
+
"use strict";exports.__esModule=true;var _API2=require("./API");var _API3=_interopRequireDefault(_API2);var _Session=require("../models/Session");var _Session2=_interopRequireDefault(_Session);var _AccountsSSO=require("./AccountsSSO");var _AccountsSSO2=_interopRequireDefault(_AccountsSSO);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}function _possibleConstructorReturn(self,call){if(!self){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return call&&(typeof call==="object"||typeof call==="function")?call:self}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function, not "+typeof superClass)}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:false,writable:true,configurable:true}});if(superClass)Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass}var Accounts=function(_API){_inherits(Accounts,_API);function Accounts(client){_classCallCheck(this,Accounts);var _this=_possibleConstructorReturn(this,_API.call(this,client));_this.sso=new _AccountsSSO2.default(client);return _this}Accounts.prototype._generateCredentials=function _generateCredentials(password){var _this2=this;return this.client.crypto().generatePasswordHash(password).then(function(passwordHash){return Promise.all([passwordHash,_this2.client.crypto().generateKeyPair()])}).then(function(_ref){var passwordHash=_ref[0],keyPair=_ref[1];return Promise.all([passwordHash,keyPair,_this2.client.crypto().encryptPrivateKey(keyPair.privateKeyPEM,password)])})};Accounts.prototype.register=function register(email,password){var _this3=this;var options=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{};if(typeof options==="string"){console.warn("Warning: Passing the user's activation code during account creation has been moved into an options object. For compatibility reasons, the legacy behaviour still functions as expected, but please update your code as this will be changed in a future version.");options={activationCode:options}}return this._generateCredentials(password).then(function(_ref2){var passwordHash=_ref2[0],keyPair=_ref2[1],privateKeyPEM$=_ref2[2];return Promise.all([keyPair,_this3.client.request("accounts.register",{email:email,password:passwordHash,privateKey:privateKeyPEM$,publicKey:keyPair.publicKeyPEM,referrer:options.referrer})])}).then(function(_ref3){var keyPair=_ref3[0];return Promise.all([keyPair,_this3.login(email,password,false)])}).then(function(_ref4){var keyPair=_ref4[0],session=_ref4[1];return Promise.all([keyPair,session,options.activationCode?_this3.activate(options.activationCode).catch(function(){return _this3.generateActivationCode()}):_this3.generateActivationCode()])}).then(function(_ref5){var keyPair=_ref5[0],session=_ref5[1];session.privateKeyPEM=keyPair.privateKeyPEM;return session})};Accounts.prototype.generateActivationCode=function generateActivationCode(){return this.client.request("accounts.generate-activation-code",{userId:this.client.session.userId})};Accounts.prototype.activate=function activate(activationCode){var _this4=this;return this.client.request("accounts.activate",{userId:this.client.session.userId,authCode:activationCode}).then(function(){_this4.client.session.user.hasActivated=true})};Accounts.prototype.login=function login(email,password){var _this5=this;var _decryptPrivateKey=arguments.length>2&&arguments[2]!==undefined?arguments[2]:true;return this.client.crypto().generatePasswordHash(password).then(function(passwordHash){return _this5.client.request("accounts.login",{email:email,password:passwordHash})}).then(function(response){var session=(new _Session2.default).fromSession(response.data);session.user.email=email;return session}).then(function(session){if(_decryptPrivateKey){return _this5.client.crypto().decryptPrivateKey(session.privateKeyPEM$,password).then(function(privateKeyPEM){session.privateKeyPEM=privateKeyPEM;return session})}return session}).then(function(session){_this5.client.setSession(session);return session})};Accounts.prototype.resetPassword=function resetPassword(_ref6){var _this6=this;var email=_ref6.email,code=_ref6.code,password=_ref6.password;return this._generateCredentials(password).then(function(_ref7){var passwordHash=_ref7[0],keyPair=_ref7[1],privateKeyPEM$=_ref7[2];return Promise.all([keyPair,_this6.client.request("accounts.reset-password",{email:email,secret:code,newPassword:passwordHash,newPrivateKey:privateKeyPEM$,newPublicKey:keyPair.publicKeyPEM})])}).then(function(_ref8){var keyPair=_ref8[0];return Promise.all([keyPair,_this6.login(email,password,false)])}).then(function(_ref9){var keyPair=_ref9[0],session=_ref9[1];session.privateKeyPEM=keyPair.privateKeyPEM;return session})};Accounts.prototype.forgotPassword=function forgotPassword(email){return this.client.request("accounts.forgot-password",{email:email})};Accounts.prototype.setPasswordRequest=function setPasswordRequest(email){return this.client.request("accounts.set-password-request",{email:email})};Accounts.prototype.setPassword=function setPassword(_ref10){var _this7=this;var email=_ref10.email,code=_ref10.code,password=_ref10.password;return this._generateCredentials(password).then(function(_ref11){var passwordHash=_ref11[0],keyPair=_ref11[1],privateKeyPEM$=_ref11[2];return Promise.all([keyPair,_this7.client.request("accounts.set-password",{email:email,secret:code,newPassword:passwordHash,newPrivateKey:privateKeyPEM$,newPublicKey:keyPair.publicKeyPEM})])}).then(function(_ref12){var keyPair=_ref12[0];return Promise.all([keyPair,_this7.login(email,password,false)])}).then(function(_ref13){var keyPair=_ref13[0],session=_ref13[1];session.privateKeyPEM=keyPair.privateKeyPEM;return session})};Accounts.prototype.logout=function logout(){var _this8=this;return this.client.request("accounts.logout").catch(function(err){_this8.client.setSession(null);return Promise.reject(err)}).then(function(){_this8.client.setSession(null)})};return Accounts}(_API3.default);exports.default=Accounts;
|
package/lib/api/Comments.d.ts
CHANGED
|
@@ -164,21 +164,6 @@ declare class Comments extends API {
|
|
|
164
164
|
* @returns {Promise<Array<Comment>>}
|
|
165
165
|
*/
|
|
166
166
|
load(_options: any): Promise<Comment[]>;
|
|
167
|
-
/**
|
|
168
|
-
* @typedef {object} CreateCommentOptions The options for creating a new comment
|
|
169
|
-
* @property {string} [raw] The comment text (plain text)
|
|
170
|
-
* @property {object} [tokens] The comment tokens (rich text)
|
|
171
|
-
* @property {string} [proofId] The proof ID the comment should be attached to
|
|
172
|
-
* @property {number} [pageNumber=1] For comments (not replies) - the page number the comment was placed on
|
|
173
|
-
* @property {Pin} [pin] For comments (not replies) - the comment's pin coordinates (deprecated: provide an array of pins instead)
|
|
174
|
-
* @property {Pin[]} [pins] For comments (not replies) - the comment's pin(s) coordinates
|
|
175
|
-
* @property {number} [mediaTime] For audio/video proofs - the time (in seconds) that the pin was placed (deprecated: set the time within the pin object)
|
|
176
|
-
* @property {number} [mediaDuration] For audio/video proofs - the duration (in seconds) that the pin spans (deprecated: set the duration within the pin object)
|
|
177
|
-
* @property {string} [parentCommentId] For replies - the parent comment ID
|
|
178
|
-
* @property {object} [metadata] For web proofs - additional metadata relating to the comment snapshot. It is recommended that you do not provide metadata through the SDK currently, as the format for the metadata is not documented (and is subject to change).
|
|
179
|
-
* @property {string} [state] For comments (not replies) - The state of the comment (currently only supports to-dos)
|
|
180
|
-
* @property {string} [creationToken] Only required if you're retrying (token can be extracted from the error object which is resolved (rejected, in this case) from the Promise)
|
|
181
|
-
*/
|
|
182
167
|
/**
|
|
183
168
|
* Creates a new comment (or reply).
|
|
184
169
|
*
|
|
@@ -199,12 +184,10 @@ declare class Comments extends API {
|
|
|
199
184
|
* await client.comments.create({
|
|
200
185
|
* proofId: 'PPTMHIVPYMB2XRTK',
|
|
201
186
|
* raw: 'Hello World!',
|
|
202
|
-
*
|
|
203
|
-
*
|
|
204
|
-
*
|
|
205
|
-
*
|
|
206
|
-
* },
|
|
207
|
-
* ],
|
|
187
|
+
* pin: {
|
|
188
|
+
* x: 0, // add the pin to the center of the proof
|
|
189
|
+
* y: 0,
|
|
190
|
+
* },
|
|
208
191
|
* });
|
|
209
192
|
*
|
|
210
193
|
* @example <caption>Single retry logic</caption>
|
|
@@ -212,7 +195,7 @@ declare class Comments extends API {
|
|
|
212
195
|
* await client.comments.create({
|
|
213
196
|
* proofId: 'PPTMHIVPYMB2XRTK',
|
|
214
197
|
* raw: 'Hello World!',
|
|
215
|
-
*
|
|
198
|
+
* pin: { x: 0, y: 0 },
|
|
216
199
|
* creationToken: retryCreationToken,
|
|
217
200
|
* });
|
|
218
201
|
* }
|
|
@@ -232,59 +215,27 @@ declare class Comments extends API {
|
|
|
232
215
|
* }
|
|
233
216
|
*
|
|
234
217
|
* @since v2.0.0-beta.46
|
|
235
|
-
* @param {
|
|
218
|
+
* @param {Comment} comment
|
|
219
|
+
* @param {string} [comment.raw] The raw comment text (rich text is not supported)
|
|
220
|
+
* @param {object} [comment.tokens] The comment tokens (with rich-text support). If you are creating legacy-style comments (just plain text) then use the "raw" option. Please note that while PageProof will continue to support plain text comments for the foreseeable future, it's recommended that you use the new "tokenized" comments.
|
|
221
|
+
* @param {string} comment.proofId The proof id the comment should be attached to
|
|
222
|
+
* @param {number} [comment.pageNumber=1] For comments (not replies) - the page number the comment should be attached to
|
|
223
|
+
* @param {Pin} [comment.pin] For comments (not replies) - the comment's pin coordinates
|
|
224
|
+
* @param {number} [comment.pin.x] The pin's x coordinate
|
|
225
|
+
* @param {number} [comment.pin.y] The pin's y coordinate
|
|
226
|
+
* @param {number} [comment.pin.x2] For boxes or lines - the pin's x2 coordinate
|
|
227
|
+
* @param {number} [comment.pin.y2] For boxes or lines - the pin's y2 coordinate
|
|
228
|
+
* @param {string} [comment.pin.fill.image] For pin fill images - the pin's fill image if pin is different then a dot or box type (like draw or text)
|
|
229
|
+
* @param {string} [comment.pin.fill.type] For pin fill images - the pin's fill image type
|
|
230
|
+
* @param {number} [comment.mediaTime] For video & audio - the start time
|
|
231
|
+
* @param {number} [comment.mediaDuration] For video & audio - the duration
|
|
232
|
+
* @param {string} [comment.parentCommentId] For replies - the parent comment id
|
|
233
|
+
* @param {object} [comment.metadata] For web proofs - additional metadata relating to the comment snapshot. It is recommended that you do not provide metadata through the SDK currently, as the format for the metadata is not documented (and is subject to change).
|
|
234
|
+
* @param {CommentState} [comment.state] For comments (not replies) - The state of the comment (currently only supports to-dos)
|
|
235
|
+
* @param {string} [comment.creationToken] Only required if you're retrying (token can be extracted from the error object which is resolved (rejected, in this case) from the Promise)
|
|
236
236
|
* @returns {Promise<Comment>}
|
|
237
237
|
*/
|
|
238
|
-
create({ raw, tokens, proofId, pageNumber, pin,
|
|
239
|
-
/**
|
|
240
|
-
* The comment text (plain text)
|
|
241
|
-
*/
|
|
242
|
-
raw?: string;
|
|
243
|
-
/**
|
|
244
|
-
* The comment tokens (rich text)
|
|
245
|
-
*/
|
|
246
|
-
tokens?: any;
|
|
247
|
-
/**
|
|
248
|
-
* The proof ID the comment should be attached to
|
|
249
|
-
*/
|
|
250
|
-
proofId?: string;
|
|
251
|
-
/**
|
|
252
|
-
* For comments (not replies) - the page number the comment was placed on
|
|
253
|
-
*/
|
|
254
|
-
pageNumber?: number;
|
|
255
|
-
/**
|
|
256
|
-
* For comments (not replies) - the comment's pin coordinates (deprecated: provide an array of pins instead)
|
|
257
|
-
*/
|
|
258
|
-
pin?: Pin;
|
|
259
|
-
/**
|
|
260
|
-
* For comments (not replies) - the comment's pin(s) coordinates
|
|
261
|
-
*/
|
|
262
|
-
pins?: Pin[];
|
|
263
|
-
/**
|
|
264
|
-
* For audio/video proofs - the time (in seconds) that the pin was placed (deprecated: set the time within the pin object)
|
|
265
|
-
*/
|
|
266
|
-
mediaTime?: number;
|
|
267
|
-
/**
|
|
268
|
-
* For audio/video proofs - the duration (in seconds) that the pin spans (deprecated: set the duration within the pin object)
|
|
269
|
-
*/
|
|
270
|
-
mediaDuration?: number;
|
|
271
|
-
/**
|
|
272
|
-
* For replies - the parent comment ID
|
|
273
|
-
*/
|
|
274
|
-
parentCommentId?: string;
|
|
275
|
-
/**
|
|
276
|
-
* For web proofs - additional metadata relating to the comment snapshot. It is recommended that you do not provide metadata through the SDK currently, as the format for the metadata is not documented (and is subject to change).
|
|
277
|
-
*/
|
|
278
|
-
metadata?: any;
|
|
279
|
-
/**
|
|
280
|
-
* For comments (not replies) - The state of the comment (currently only supports to-dos)
|
|
281
|
-
*/
|
|
282
|
-
state?: string;
|
|
283
|
-
/**
|
|
284
|
-
* Only required if you're retrying (token can be extracted from the error object which is resolved (rejected, in this case) from the Promise)
|
|
285
|
-
*/
|
|
286
|
-
creationToken?: string;
|
|
287
|
-
}): Promise<Comment>;
|
|
238
|
+
create({ raw, tokens, proofId, pageNumber, pin, mediaTime, mediaDuration, parentCommentId, metadata, state, creationToken: retryCreationToken, }: Comment): Promise<Comment>;
|
|
288
239
|
}
|
|
289
240
|
import API from "./API";
|
|
290
241
|
import Comment from "../models/Comment";
|
package/lib/api/Comments.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";exports.__esModule=true;var _API2=require("./API");var _API3=_interopRequireDefault(_API2);var _Comment=require("../models/Comment");var _Comment2=_interopRequireDefault(_Comment);var _CommentState=require("../enum/CommentState");var _CommentState2=_interopRequireDefault(_CommentState);var _constants=require("../util/constants");var _sort=require("../util/sort");var _v=require("../util/comments/v2");var _extractMentions=require("../util/comments/extractMentions");var _extractMentions2=_interopRequireDefault(_extractMentions);var _parseComment=require("../util/comments/parseComment");var _parseComment2=_interopRequireDefault(_parseComment);var _creationToken=require("../util/creationToken");var _throttle=require("../util/throttle");var _throttle2=_interopRequireDefault(_throttle);var _getCommentState=require("../util/comments/getCommentState");var _getCommentState2=_interopRequireDefault(_getCommentState);
|
|
1
|
+
"use strict";exports.__esModule=true;var _API2=require("./API");var _API3=_interopRequireDefault(_API2);var _Comment=require("../models/Comment");var _Comment2=_interopRequireDefault(_Comment);var _CommentState=require("../enum/CommentState");var _CommentState2=_interopRequireDefault(_CommentState);var _constants=require("../util/constants");var _sort=require("../util/sort");var _v=require("../util/comments/v2");var _extractMentions=require("../util/comments/extractMentions");var _extractMentions2=_interopRequireDefault(_extractMentions);var _parseComment=require("../util/comments/parseComment");var _parseComment2=_interopRequireDefault(_parseComment);var _creationToken=require("../util/creationToken");var _throttle=require("../util/throttle");var _throttle2=_interopRequireDefault(_throttle);var _getCommentState=require("../util/comments/getCommentState");var _getCommentState2=_interopRequireDefault(_getCommentState);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}function _possibleConstructorReturn(self,call){if(!self){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return call&&(typeof call==="object"||typeof call==="function")?call:self}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function, not "+typeof superClass)}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:false,writable:true,configurable:true}});if(superClass)Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass}function getCommentDataFromPages(pages){var comments=[];Object.keys(pages).forEach(function(pageNumber){pages[pageNumber].Comments.forEach(function(commentData){comments.push(commentData)})});return comments}var _sortPages=(0,_sort.sortObjectsByKey)("pageNumber");var _sortCreatedDateDESC=(0,_sort.sortObjectsByKey)("createdDate",true);var _sortCreatedDateASC=(0,_sort.sortObjectsByKey)("createdDate",false);var sortComments=(0,_sort.combineSort)(_sortPages,_sortCreatedDateDESC);var sortReplies=(0,_sort.combineSort)(_sortPages,_sortCreatedDateASC);function mapComments(commentsData){var comments=[];var replies=[];commentsData.forEach(function(commentData){var entity=(new _Comment2.default).fromComment(commentData);if(entity.parentCommentId){replies.push(entity)}else{comments.push(entity)}});comments.sort(sortComments);var commentIds=comments.map(function(c){return c.id});var sortByParentCommentIndex=(0,_sort.sortObjectsBy)(function(r){return commentIds.indexOf(r.parentCommentId)},true);replies.sort((0,_sort.combineSort)(sortReplies,sortByParentCommentIndex));return comments.concat(replies)}var Comments=function(_API){_inherits(Comments,_API);function Comments(){_classCallCheck(this,Comments);return _possibleConstructorReturn(this,_API.apply(this,arguments))}Comments.prototype._mark=function _mark(commentId,state,value){if(Object.keys(_CommentState2.default).map(function(key){return _CommentState2.default[key]}).indexOf(state)===-1){throw new Error('Cannot mark comment state "'+state+'".')}var TODO=_CommentState2.default.TODO,DONE=_CommentState2.default.DONE,UNMARKED=_CommentState2.default.UNMARKED;var data={commentId:commentId};switch(state){case UNMARKED:{data.change=0;data.done=0;break}case TODO:{data.change=value?1:0;data.done=0;break}case DONE:{data.done=value?1:0;break}}return this.client.request("comments.state.update",data).then(function(response){return(0,_getCommentState2.default)(response.data)})};Comments.prototype._markAll=function _markAll(proofId,commentIds,state,value){if(Object.keys(_CommentState2.default).map(function(key){return _CommentState2.default[key]}).indexOf(state)===-1){throw new Error('Cannot mark comment state "'+state+'".')}var TODO=_CommentState2.default.TODO,DONE=_CommentState2.default.DONE,UNMARKED=_CommentState2.default.UNMARKED;var data={proofId:proofId,commentIds:commentIds};switch(state){case UNMARKED:{data.change=0;data.done=0;break}case TODO:{data.change=value?1:0;data.done=0;break}case DONE:{data.done=value?1:0;break}}return this.client.request("comments.state.multiple-update",data).then(function(response){return response.data.map(function(comment){return{commentId:comment.CommentId,commentState:(0,_getCommentState2.default)(comment)}})})};Comments.prototype.mark=function mark(commentId,state){return this._mark(commentId,state,true)};Comments.prototype.unmark=function unmark(commentId,state){return this._mark(commentId,state,false)};Comments.prototype.markAll=function markAll(proofId,commentIds,state){return this._markAll(proofId,commentIds,state,true)};Comments.prototype.unmarkAll=function unmarkAll(proofId,commentIds,state){return this._markAll(proofId,commentIds,state,false)};Comments.prototype.delete=function _delete(commentId){return this.client.request("comments.delete",{commentId:commentId})};Comments.prototype.load=function load(_options){var _this2=this;var options=typeof _options==="string"?{proofId:_options}:_options;var proofId=options.proofId,_options$pageNumber=options.pageNumber,pageNumber=_options$pageNumber===undefined?null:_options$pageNumber,_options$sinceDate=options.sinceDate,sinceDate=_options$sinceDate===undefined?null:_options$sinceDate,_options$async=options.async,async=_options$async===undefined?false:_options$async,_options$decrypt=options.decrypt,decrypt=_options$decrypt===undefined?true:_options$decrypt,onDecryptComment=options.onDecryptComment,onDecryptComments=options.onDecryptComments,_options$onDecryptCom=options.onDecryptCommentsThrottleMs,onDecryptCommentsThrottleMs=_options$onDecryptCom===undefined?1e3:_options$onDecryptCom,onDecryptError=options.onDecryptError;var sinceDateISO=sinceDate?sinceDate.toISOString().match(_constants.ISO_REGEX)[0]:_constants.DEFAULT_ISO_DATE;var payload={proofId:proofId,page:pageNumber,timestamp:sinceDateISO};return this.client.request(pageNumber!==null?"comments.load-page":"comments.load-all",payload).then(function(response){var comments=mapComments(response.data.Pages?getCommentDataFromPages(response.data.Pages):response.data);var wait=Promise.resolve();if(decrypt){var scheduled=[];var pendingBatch=[];var scheduleOnDecryptComments=onDecryptComments?(0,_throttle2.default)(function(){if(pendingBatch.length){onDecryptComments(pendingBatch);pendingBatch=[]}},onDecryptCommentsThrottleMs):function(){};var cached=Promise.all(comments.map(function(comment){return _this2.client.cache.auto(_constants.COMMENT_CACHE_PREFIX+comment.comment$,function(resolve){scheduled.push({comment:comment,resolve:resolve})}).then(function(rawComment){if(rawComment){comment.fromRawComment(rawComment)}return comment})}));wait=wait.then(function(){return cached});wait=wait.then(function(){var decrypted=scheduled.map(function(_ref){var comment=_ref.comment,resolve=_ref.resolve;return _this2.client.crypto().decryptComment(comment.comment$,comment.envelope,_this2.client.keyPairs.getPrivateKeyPEMs()).then(function(rawComment){comment.fromRawComment(rawComment);resolve(rawComment);if(onDecryptComment){onDecryptComment(comment)}pendingBatch.push(comment);scheduleOnDecryptComments()}).catch(function(err){if(onDecryptError){onDecryptError(err,comment)}if(!async){return Promise.reject(err)}return undefined})});if(!async){return Promise.all(decrypted)}return null})}return wait.then(function(){return comments})})};Comments.prototype.create=function create(_ref2){var _this3=this;var raw=_ref2.raw,tokens=_ref2.tokens,proofId=_ref2.proofId,_ref2$pageNumber=_ref2.pageNumber,pageNumber=_ref2$pageNumber===undefined?1:_ref2$pageNumber,pin=_ref2.pin,mediaTime=_ref2.mediaTime,mediaDuration=_ref2.mediaDuration,parentCommentId=_ref2.parentCommentId,metadata=_ref2.metadata,state=_ref2.state,retryCreationToken=_ref2.creationToken;var mentions=[];var serialized=raw||(0,_v.serialize)(tokens);{var parsed=tokens||(0,_parseComment2.default)(raw);mentions.push.apply(mentions,(0,_extractMentions2.default)(parsed))}var creationToken=retryCreationToken||(0,_creationToken.generateCreationToken)();return this.client.crypto().encryptComment(serialized,this.client.keyPairs.getPublicKeyPEMs()).then(function(_ref3){var envelope=_ref3.envelope,comment$=_ref3.comment$;return{proofId:proofId,page:parentCommentId?undefined:pageNumber,envelope:envelope,encryptedComment:comment$,xy:JSON.stringify({x:pin&&typeof pin.x==="number"?pin.x:null,y:pin&&typeof pin.y==="number"?pin.y:null,x2:pin&&typeof pin.x2==="number"?pin.x2:null,y2:pin&&typeof pin.y2==="number"?pin.y2:null,time:typeof mediaTime==="number"?mediaTime:null,duration:typeof mediaDuration==="number"?mediaDuration:null}),boxFillImage:pin.fill?pin.fill.image:undefined,boxFillType:pin.fill?pin.fill.type:undefined,parent:parentCommentId||undefined,mentions:mentions,metadata:metadata?JSON.stringify(metadata):"{}",creationToken:creationToken,change:state===_CommentState2.default.TODO?"1":undefined,done:state===_CommentState2.default.DONE?"1":undefined}}).then(function(requestData){return _this3.client.request("comments.create",requestData).then(function(response){return(new _Comment2.default).fromComment(response.data).fromRawComment(serialized)})}).catch(function(err){if(err){err.creationToken=creationToken}return Promise.reject(err)})};return Comments}(_API3.default);exports.default=Comments;
|
package/lib/api/Files.d.ts
CHANGED
|
@@ -379,14 +379,11 @@ declare class Files extends API {
|
|
|
379
379
|
onLoadError?: Function;
|
|
380
380
|
}): Promise<any>;
|
|
381
381
|
/**
|
|
382
|
-
*
|
|
383
|
-
*
|
|
384
|
-
* The file is asynchronously copied server-side but this method resolves as soon as the record is allocated for the duplicated file.
|
|
382
|
+
* Duplicate a file
|
|
385
383
|
*
|
|
386
384
|
* @example <caption>Duplicate a file</caption>
|
|
387
385
|
* await client.files.duplicate('FTRIWJJDYNE8DFFF');
|
|
388
386
|
*
|
|
389
|
-
* @since v2.0.0-beta.281
|
|
390
387
|
* @param {string} id The file id
|
|
391
388
|
* @returns {Promise<FileV2>}
|
|
392
389
|
*/
|
|
@@ -24,10 +24,6 @@ declare class TeamFeatures extends API {
|
|
|
24
24
|
* @param {object} options.emails The emails features
|
|
25
25
|
* @param {boolean} options.emails.displayComments Whether the comment should display in emails or not
|
|
26
26
|
* @param {boolean} options.emails.displayTeamName Whether using the team name or ’PageProof Team’ as the ‘from’ name in Email.
|
|
27
|
-
* @param {string} options.emails.titleTextColor The title text color in the email.
|
|
28
|
-
* @param {string} options.emails.linkTextColor The link text color in the email.
|
|
29
|
-
* @param {string} options.emails.buttonBackgroundColor The button background color in the email.
|
|
30
|
-
* @param {string} options.emails.buttonTextColor The button text color in the email.
|
|
31
27
|
* @param {object} options.comments The comments features
|
|
32
28
|
* @param {boolean} options.comments.editComments Whether the comments/replies can be edited by other users or not
|
|
33
29
|
* @param {ProofStatus|Array<ProofStatus>} options.comments.disableReplyingToCommentsInStatuses The proof status or array of proof status to disable the replies to comments (by reviewers).
|
|
@@ -42,10 +38,6 @@ declare class TeamFeatures extends API {
|
|
|
42
38
|
emails: {
|
|
43
39
|
displayComments: boolean;
|
|
44
40
|
displayTeamName: boolean;
|
|
45
|
-
titleTextColor: string;
|
|
46
|
-
linkTextColor: string;
|
|
47
|
-
buttonBackgroundColor: string;
|
|
48
|
-
buttonTextColor: string;
|
|
49
41
|
};
|
|
50
42
|
comments: {
|
|
51
43
|
editComments: boolean;
|
|
@@ -58,22 +50,5 @@ declare class TeamFeatures extends API {
|
|
|
58
50
|
messageToOwners: boolean;
|
|
59
51
|
};
|
|
60
52
|
}): Promise<any>;
|
|
61
|
-
/**
|
|
62
|
-
* Set the team sender email address for the team email notification.
|
|
63
|
-
*
|
|
64
|
-
* Note: This feature is only available to enterprise teams.
|
|
65
|
-
*
|
|
66
|
-
* @example <caption>Setting the team sender email</caption>
|
|
67
|
-
* const admin = await client.admin();
|
|
68
|
-
* const features = admin.team.features.setSenderEmail('team@example.com');
|
|
69
|
-
*
|
|
70
|
-
* @example <caption>Resetting the team sender email address back to the default</caption>
|
|
71
|
-
* const admin = await client.admin();
|
|
72
|
-
* const features = admin.team.features.setSenderEmail(null);
|
|
73
|
-
*
|
|
74
|
-
* @param {string|null} senderEmail The team sender email address.
|
|
75
|
-
* @returns {Promise<TeamSenderEmail>}
|
|
76
|
-
*/
|
|
77
|
-
setSenderEmail(senderEmail: string): Promise<TeamSenderEmail>;
|
|
78
53
|
}
|
|
79
54
|
import API from "../API";
|
|
@@ -62,10 +62,6 @@ var TeamFeatures = function (_API) {
|
|
|
62
62
|
* @param {object} options.emails The emails features
|
|
63
63
|
* @param {boolean} options.emails.displayComments Whether the comment should display in emails or not
|
|
64
64
|
* @param {boolean} options.emails.displayTeamName Whether using the team name or ’PageProof Team’ as the ‘from’ name in Email.
|
|
65
|
-
* @param {string} options.emails.titleTextColor The title text color in the email.
|
|
66
|
-
* @param {string} options.emails.linkTextColor The link text color in the email.
|
|
67
|
-
* @param {string} options.emails.buttonBackgroundColor The button background color in the email.
|
|
68
|
-
* @param {string} options.emails.buttonTextColor The button text color in the email.
|
|
69
65
|
* @param {object} options.comments The comments features
|
|
70
66
|
* @param {boolean} options.comments.editComments Whether the comments/replies can be edited by other users or not
|
|
71
67
|
* @param {ProofStatus|Array<ProofStatus>} options.comments.disableReplyingToCommentsInStatuses The proof status or array of proof status to disable the replies to comments (by reviewers).
|
|
@@ -85,10 +81,6 @@ var TeamFeatures = function (_API) {
|
|
|
85
81
|
|
|
86
82
|
var displayComments = emails && emails.displayComments;
|
|
87
83
|
var displayTeamName = emails && emails.displayTeamName;
|
|
88
|
-
var emailTitleTextColor = emails && emails.titleTextColor;
|
|
89
|
-
var emailLinkTextColor = emails && emails.linkTextColor;
|
|
90
|
-
var emailButtonBackgroundColor = emails && emails.buttonBackgroundColor;
|
|
91
|
-
var emailButtonTextColor = emails && emails.buttonTextColor;
|
|
92
84
|
var editComments = comments && comments.editComments;
|
|
93
85
|
var disableReplyingToCommentsInStatuses = comments && comments.disableReplyingToCommentsInStatuses && [].concat(comments.disableReplyingToCommentsInStatuses);
|
|
94
86
|
var proofReference = proofs && proofs.reference;
|
|
@@ -98,10 +90,6 @@ var TeamFeatures = function (_API) {
|
|
|
98
90
|
return this.client.request('admin.team.features.update', {
|
|
99
91
|
displayComments: displayComments,
|
|
100
92
|
displayTeamName: displayTeamName,
|
|
101
|
-
emailTitleTextColor: emailTitleTextColor,
|
|
102
|
-
emailLinkTextColor: emailLinkTextColor,
|
|
103
|
-
emailButtonBackgroundColor: emailButtonBackgroundColor,
|
|
104
|
-
emailButtonTextColor: emailButtonTextColor,
|
|
105
93
|
editComments: editComments,
|
|
106
94
|
disableReplyingToCommentsInStatuses: disableReplyingToCommentsInStatuses,
|
|
107
95
|
proofReference: proofReference,
|
|
@@ -111,43 +99,6 @@ var TeamFeatures = function (_API) {
|
|
|
111
99
|
});
|
|
112
100
|
};
|
|
113
101
|
|
|
114
|
-
/**
|
|
115
|
-
* Set the team sender email address for the team email notification.
|
|
116
|
-
*
|
|
117
|
-
* Note: This feature is only available to enterprise teams.
|
|
118
|
-
*
|
|
119
|
-
* @example <caption>Setting the team sender email</caption>
|
|
120
|
-
* const admin = await client.admin();
|
|
121
|
-
* const features = admin.team.features.setSenderEmail('team@example.com');
|
|
122
|
-
*
|
|
123
|
-
* @example <caption>Resetting the team sender email address back to the default</caption>
|
|
124
|
-
* const admin = await client.admin();
|
|
125
|
-
* const features = admin.team.features.setSenderEmail(null);
|
|
126
|
-
*
|
|
127
|
-
* @param {string|null} senderEmail The team sender email address.
|
|
128
|
-
* @returns {Promise<TeamSenderEmail>}
|
|
129
|
-
*/
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
TeamFeatures.prototype.setSenderEmail = function setSenderEmail(senderEmail) {
|
|
133
|
-
return this.client.request('admin.team.features.sender-email.set', {
|
|
134
|
-
senderEmail: senderEmail
|
|
135
|
-
}).then(function (response) {
|
|
136
|
-
return {
|
|
137
|
-
success: response.data.Success,
|
|
138
|
-
domain: response.data.Domain,
|
|
139
|
-
email: response.data.Email,
|
|
140
|
-
records: response.data.Records && response.data.Records.map(function (record) {
|
|
141
|
-
return {
|
|
142
|
-
version: record.Version,
|
|
143
|
-
current: record.Current,
|
|
144
|
-
new: record.New
|
|
145
|
-
};
|
|
146
|
-
})
|
|
147
|
-
};
|
|
148
|
-
});
|
|
149
|
-
};
|
|
150
|
-
|
|
151
102
|
return TeamFeatures;
|
|
152
103
|
}(_API3.default);
|
|
153
104
|
|
package/lib/models/Comment.d.ts
CHANGED
|
@@ -17,37 +17,9 @@ declare class Comment {
|
|
|
17
17
|
*
|
|
18
18
|
* This field is null for replies, as replies do not have a location on the proof.
|
|
19
19
|
*
|
|
20
|
-
* @type {
|
|
21
|
-
*/
|
|
22
|
-
pin:
|
|
23
|
-
x: number;
|
|
24
|
-
y: number;
|
|
25
|
-
x2: number | null;
|
|
26
|
-
y2: number | null;
|
|
27
|
-
time: number | null;
|
|
28
|
-
duration: number | null;
|
|
29
|
-
fill: {
|
|
30
|
-
type: string;
|
|
31
|
-
image: string;
|
|
32
|
-
} | null;
|
|
33
|
-
} | null;
|
|
34
|
-
/**
|
|
35
|
-
* The pins associated with the comment (not replies).
|
|
36
|
-
*
|
|
37
|
-
* @type {{ x: number, y: number, x2: number | null, y2: number | null, time: number | null, duration: number | null, fill: { type: string, image: string } | null }[]}
|
|
38
|
-
*/
|
|
39
|
-
pins: {
|
|
40
|
-
x: number;
|
|
41
|
-
y: number;
|
|
42
|
-
x2: number | null;
|
|
43
|
-
y2: number | null;
|
|
44
|
-
time: number | null;
|
|
45
|
-
duration: number | null;
|
|
46
|
-
fill: {
|
|
47
|
-
type: string;
|
|
48
|
-
image: string;
|
|
49
|
-
} | null;
|
|
50
|
-
}[];
|
|
20
|
+
* @type {Pin}
|
|
21
|
+
*/
|
|
22
|
+
pin: Pin;
|
|
51
23
|
/**
|
|
52
24
|
* The user who created the comment.
|
|
53
25
|
*
|
|
@@ -153,7 +125,6 @@ declare class Comment {
|
|
|
153
125
|
*
|
|
154
126
|
* On all other kinds of proofs this field is set to `undefined`.
|
|
155
127
|
*
|
|
156
|
-
* @deprecated Please use the time property on the pin object. This property will be removed in a future release.
|
|
157
128
|
* @since v2.0.0-beta.37
|
|
158
129
|
* @type {number}
|
|
159
130
|
*/
|
|
@@ -163,7 +134,6 @@ declare class Comment {
|
|
|
163
134
|
*
|
|
164
135
|
* On all other kinds of proofs this field is set to `undefined`.
|
|
165
136
|
*
|
|
166
|
-
* @deprecated Please use the duration property on the pin object. This property will be removed in a future release.
|
|
167
137
|
* @since v2.0.0-beta.37
|
|
168
138
|
* @type {number}
|
|
169
139
|
*/
|
|
@@ -181,5 +151,6 @@ declare class Comment {
|
|
|
181
151
|
*/
|
|
182
152
|
fromRawComment(rawComment: string): Comment;
|
|
183
153
|
}
|
|
154
|
+
import Pin from "./Pin";
|
|
184
155
|
import User from "./User";
|
|
185
156
|
import File from "./File";
|
package/lib/models/Comment.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 _transform=require("./transform");var _transform2=_interopRequireDefault(_transform);var _User=require("./User");var _User2=_interopRequireDefault(_User);var _File=require("./File");var _File2=_interopRequireDefault(_File);var _parseComment=require("../util/comments/parseComment");var _parseComment2=_interopRequireDefault(_parseComment);var _getCommentState=require("../util/comments/getCommentState");var _getCommentState2=_interopRequireDefault(_getCommentState);
|
|
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 _transform=require("./transform");var _transform2=_interopRequireDefault(_transform);var _User=require("./User");var _User2=_interopRequireDefault(_User);var _Pin=require("./Pin");var _Pin2=_interopRequireDefault(_Pin);var _File=require("./File");var _File2=_interopRequireDefault(_File);var _parseComment=require("../util/comments/parseComment");var _parseComment2=_interopRequireDefault(_parseComment);var _getCommentState=require("../util/comments/getCommentState");var _getCommentState2=_interopRequireDefault(_getCommentState);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 commentSchema={__prepare:function __prepare(data){data._XY=_Pin2.default.parseValue(data.XY,data.BoxFillImage,data.BoxFillType)},id:"CommentId",proofId:"ProofId",pin:function pin(data){return(new _Pin2.default).fromPin(data._XY)},user:function user(data){return(new _User2.default).fromUser(data)},comment$:"EncryptedComment",envelope:"Envelope",attachments:function attachments(data){if(data.Attachments){return data.Attachments.map(function(attachment){return(new _File2.default).fromCommentAttachment(_extends({CommentId:data.CommentId},attachment))})}return[]},agreeCount:function agreeCount(data){return data.Agrees.length},pageNumber:(0,_transform.number)("Page"),mediaTime:function mediaTime(data){return data._XY.time==null?undefined:data._XY.time},mediaDuration:function mediaDuration(data){return data._XY.duration==null?undefined:data._XY.duration},createdDate:(0,_transform.date)("Timestamp"),updatedDate:(0,_transform.date)("Updated"),parentCommentId:(0,_transform.optional)("Parent"),metadata:(0,_transform.json)("Metadata",{}),state:function state(data){return(0,_getCommentState2.default)(data)}};var Comment=function(){function Comment(){_classCallCheck(this,Comment)}Comment.prototype.fromComment=function fromComment(commentData){(0,_transform2.default)(this,commentSchema,commentData);return this};Comment.prototype.fromRawComment=function fromRawComment(rawComment){var parsed=(0,_parseComment2.default)(rawComment);this.raw=rawComment;this.tokens=parsed;return this};return Comment}();exports.default=Comment;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export default Pin;
|
|
2
|
+
declare class Pin {
|
|
3
|
+
/**
|
|
4
|
+
* @private
|
|
5
|
+
* @param {string} pinValue
|
|
6
|
+
* @param {string} image The pin fill image
|
|
7
|
+
* @param {string} type The pin fill type (like text, draw)
|
|
8
|
+
*/
|
|
9
|
+
static parseValue(pinValue: string, image: string, type: string): {
|
|
10
|
+
x: any;
|
|
11
|
+
y: any;
|
|
12
|
+
x2: any;
|
|
13
|
+
y2: any;
|
|
14
|
+
time: any;
|
|
15
|
+
duration: any;
|
|
16
|
+
fill: any;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* @type {number}
|
|
20
|
+
*/
|
|
21
|
+
x: number;
|
|
22
|
+
/**
|
|
23
|
+
* @type {number}
|
|
24
|
+
*/
|
|
25
|
+
y: number;
|
|
26
|
+
/**
|
|
27
|
+
* @type {number}
|
|
28
|
+
*/
|
|
29
|
+
x2: number;
|
|
30
|
+
/**
|
|
31
|
+
* @type {number}
|
|
32
|
+
*/
|
|
33
|
+
y2: number;
|
|
34
|
+
/**
|
|
35
|
+
* @type {object}
|
|
36
|
+
*/
|
|
37
|
+
fill: object;
|
|
38
|
+
/**
|
|
39
|
+
* @private
|
|
40
|
+
* @param {object} pinData
|
|
41
|
+
*/
|
|
42
|
+
fromPin(pinData: any): Pin;
|
|
43
|
+
}
|
|
@@ -0,0 +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 _transform=require("./transform");var _transform2=_interopRequireDefault(_transform);var _PinFill=require("./PinFill");var _PinFill2=_interopRequireDefault(_PinFill);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 pinSchema={x:"x",y:"y",x2:(0,_transform.optional)("x2"),y2:(0,_transform.optional)("y2"),fill:function fill(data){if(data.fill){return(new _PinFill2.default).fromPinFill(data.fill)}return null}};var Pin=function(){function Pin(){_classCallCheck(this,Pin)}Pin.prototype.fromPin=function fromPin(pinData){(0,_transform2.default)(this,pinSchema,pinData);return this};Pin.parseValue=function parseValue(pinValue,image,type){var obj={x:null,y:null,x2:null,y2:null,time:null,duration:null,fill:null};if(pinValue[0]==="{"){var json=JSON.parse(pinValue);obj=_extends({},obj,json)}else if(pinValue.indexOf(",")!==-1){var _pinValue$split=pinValue.split(","),x=_pinValue$split[0],y=_pinValue$split[1];obj.x=parseFloat(x);obj.y=parseFloat(y)}if(image&&type){obj.fill={type:type,image:image}}return obj};return Pin}();exports.default=Pin;
|