@pageproof/sdk-pr 486.0.1686095297325 → 487.0.1687752232134
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,8 +1,20 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 2.0.0-beta.305
|
|
4
|
+
|
|
5
|
+
Released on the 19th of June 2023.
|
|
6
|
+
|
|
7
|
+
- [[PP-3050](https://goto.pageproof.dev/PP-3050)] Added support for importing comments from annotations on a PDF file. Currently only available as a private preview.
|
|
8
|
+
|
|
9
|
+
## 2.0.0-beta.304
|
|
10
|
+
|
|
11
|
+
Released on the 11th of May 2023.
|
|
12
|
+
|
|
13
|
+
- [[PP-5014](https://goto.pageproof.dev/PP-5014)] Added additional fields to the Team Account Features model to expose trial and extended team type information. See [TeamAccountFeatures](https://docs.pageproof.tech/@pageproof/sdk/beta/class/src/models/TeamAccountFeatures.js~TeamAccountFeatures.html).
|
|
14
|
+
|
|
3
15
|
## 2.0.0-beta.303
|
|
4
16
|
|
|
5
|
-
Released on the 23th of January
|
|
17
|
+
Released on the 23th of January 2023.
|
|
6
18
|
|
|
7
19
|
- [[PP-2876](https://goto.pageproof.dev/PP-2876)] Added support for automatically setting newly created comments to to-do if the user has permission to do so. See [CreateCommentOptions](https://docs.pageproof.tech/@pageproof/sdk/beta/typedef/index.html#static-typedef-CreateCommentOptions).
|
|
8
20
|
|
package/lib/api/Accounts.d.ts
CHANGED
|
@@ -54,11 +54,13 @@ declare class Accounts extends API {
|
|
|
54
54
|
* @param {object} [options] Further, more advanced options
|
|
55
55
|
* @param {string} [options.activationCode] The user's activation code (optional, if that information isn't available to you)
|
|
56
56
|
* @param {string} [options.referrer] The unique identifier for the referrer of the account creation. Omit if you are unsure about this option.
|
|
57
|
+
* @param {string} [options.mondaySessionToken] A session token from monday.com if the user is coming from monday.com
|
|
57
58
|
* @returns {Promise<Session>}
|
|
58
59
|
*/
|
|
59
60
|
register(email: string, password: string, options?: {
|
|
60
61
|
activationCode?: string;
|
|
61
62
|
referrer?: string;
|
|
63
|
+
mondaySessionToken?: string;
|
|
62
64
|
}): Promise<Session>;
|
|
63
65
|
/**
|
|
64
66
|
* Generates a new activation code for a newly created account. The activation code is sent to the user's email
|
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);var _AccountsMFA=require("./AccountsMFA");var _AccountsMFA2=_interopRequireDefault(_AccountsMFA);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}function _possibleConstructorReturn(self,call){if(!self){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return call&&(typeof call==="object"||typeof call==="function")?call:self}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function, not "+typeof superClass)}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:false,writable:true,configurable:true}});if(superClass)Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass}var Accounts=function(_API){_inherits(Accounts,_API);function Accounts(client){_classCallCheck(this,Accounts);var _this=_possibleConstructorReturn(this,_API.call(this,client));_this.sso=new _AccountsSSO2.default(client);_this.mfa=new _AccountsMFA2.default(client);return _this}Accounts.prototype._generateCredentials=function _generateCredentials(password){var _this2=this;return this.client.crypto().generatePasswordHash(password).then(function(passwordHash){return Promise.all([passwordHash,_this2.client.crypto().generateKeyPair()])}).then(function(_ref){var passwordHash=_ref[0],keyPair=_ref[1];return Promise.all([passwordHash,keyPair,_this2.client.crypto().encryptPrivateKey(keyPair.privateKeyPEM,password)])})};Accounts.prototype.register=function register(email,password){var _this3=this;var options=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{};if(typeof options==="string"){console.warn("Warning: Passing the user's activation code during account creation has been moved into an options object. For compatibility reasons, the legacy behaviour still functions as expected, but please update your code as this will be changed in a future version.");options={activationCode:options}}return this._generateCredentials(password).then(function(_ref2){var passwordHash=_ref2[0],keyPair=_ref2[1],privateKeyPEM$=_ref2[2];return Promise.all([keyPair,_this3.client.request("accounts.register",{email:email,password:passwordHash,privateKey:privateKeyPEM$,publicKey:keyPair.publicKeyPEM,referrer:options.referrer})])}).then(function(_ref3){var keyPair=_ref3[0];return Promise.all([keyPair,_this3.login(email,password,undefined,false)])}).then(function(_ref4){var keyPair=_ref4[0],session=_ref4[1];return Promise.all([keyPair,session,options.activationCode?_this3.activate(options.activationCode).catch(function(){return _this3.generateActivationCode()}):_this3.generateActivationCode()])}).then(function(_ref5){var keyPair=_ref5[0],session=_ref5[1];session.privateKeyPEM=keyPair.privateKeyPEM;return session})};Accounts.prototype.generateActivationCode=function generateActivationCode(){return this.client.request("accounts.generate-activation-code",{userId:this.client.session.userId})};Accounts.prototype.activate=function activate(activationCode){var _this4=this;return this.client.request("accounts.activate",{userId:this.client.session.userId,authCode:activationCode}).then(function(){_this4.client.session.user.hasActivated=true})};Accounts.prototype.login=function login(email,password,totp){var _this5=this;var _decryptPrivateKey=arguments.length>3&&arguments[3]!==undefined?arguments[3]:true;return this.client.crypto().generatePasswordHash(password).then(function(passwordHash){return _this5.client.request("accounts.login",{email:email,password:passwordHash,totp:totp})}).then(function(response){var session=(new _Session2.default).fromSession(response.data);session.user.email=email;return session}).then(function(session){if(_decryptPrivateKey){return _this5.client.crypto().decryptPrivateKey(session.privateKeyPEM$,password).then(function(privateKeyPEM){session.privateKeyPEM=privateKeyPEM;return session})}return session}).then(function(session){_this5.client.setSession(session);return session})};Accounts.prototype.resetPassword=function resetPassword(_ref6){var _this6=this;var email=_ref6.email,code=_ref6.code,password=_ref6.password;return this._generateCredentials(password).then(function(_ref7){var passwordHash=_ref7[0],keyPair=_ref7[1],privateKeyPEM$=_ref7[2];return Promise.all([keyPair,_this6.client.request("accounts.reset-password",{email:email,secret:code,newPassword:passwordHash,newPrivateKey:privateKeyPEM$,newPublicKey:keyPair.publicKeyPEM})])}).then(function(_ref8){var keyPair=_ref8[0];return Promise.all([keyPair,_this6.login(email,password,undefined,false)])}).then(function(_ref9){var keyPair=_ref9[0],session=_ref9[1];session.privateKeyPEM=keyPair.privateKeyPEM;return session})};Accounts.prototype.forgotPassword=function forgotPassword(email){return this.client.request("accounts.forgot-password",{email:email})};Accounts.prototype.setPasswordRequest=function setPasswordRequest(email){return this.client.request("accounts.set-password-request",{email:email})};Accounts.prototype.setPassword=function setPassword(_ref10){var _this7=this;var email=_ref10.email,code=_ref10.code,password=_ref10.password;return this._generateCredentials(password).then(function(_ref11){var passwordHash=_ref11[0],keyPair=_ref11[1],privateKeyPEM$=_ref11[2];return Promise.all([keyPair,_this7.client.request("accounts.set-password",{email:email,secret:code,newPassword:passwordHash,newPrivateKey:privateKeyPEM$,newPublicKey:keyPair.publicKeyPEM})])}).then(function(_ref12){var keyPair=_ref12[0];return Promise.all([keyPair,_this7.login(email,password,undefined,false)])}).then(function(_ref13){var keyPair=_ref13[0],session=_ref13[1];session.privateKeyPEM=keyPair.privateKeyPEM;return session})};Accounts.prototype.logout=function logout(){var _this8=this;return this.client.request("accounts.logout").catch(function(err){_this8.client.setSession(null);return Promise.reject(err)}).then(function(){_this8.client.setSession(null)})};return Accounts}(_API3.default);exports.default=Accounts;
|
|
1
|
+
"use strict";exports.__esModule=true;var _API2=require("./API");var _API3=_interopRequireDefault(_API2);var _Session=require("../models/Session");var _Session2=_interopRequireDefault(_Session);var _AccountsSSO=require("./AccountsSSO");var _AccountsSSO2=_interopRequireDefault(_AccountsSSO);var _AccountsMFA=require("./AccountsMFA");var _AccountsMFA2=_interopRequireDefault(_AccountsMFA);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}function _possibleConstructorReturn(self,call){if(!self){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return call&&(typeof call==="object"||typeof call==="function")?call:self}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function, not "+typeof superClass)}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:false,writable:true,configurable:true}});if(superClass)Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass}var Accounts=function(_API){_inherits(Accounts,_API);function Accounts(client){_classCallCheck(this,Accounts);var _this=_possibleConstructorReturn(this,_API.call(this,client));_this.sso=new _AccountsSSO2.default(client);_this.mfa=new _AccountsMFA2.default(client);return _this}Accounts.prototype._generateCredentials=function _generateCredentials(password){var _this2=this;return this.client.crypto().generatePasswordHash(password).then(function(passwordHash){return Promise.all([passwordHash,_this2.client.crypto().generateKeyPair()])}).then(function(_ref){var passwordHash=_ref[0],keyPair=_ref[1];return Promise.all([passwordHash,keyPair,_this2.client.crypto().encryptPrivateKey(keyPair.privateKeyPEM,password)])})};Accounts.prototype.register=function register(email,password){var _this3=this;var options=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{};if(typeof options==="string"){console.warn("Warning: Passing the user's activation code during account creation has been moved into an options object. For compatibility reasons, the legacy behaviour still functions as expected, but please update your code as this will be changed in a future version.");options={activationCode:options}}return this._generateCredentials(password).then(function(_ref2){var passwordHash=_ref2[0],keyPair=_ref2[1],privateKeyPEM$=_ref2[2];return Promise.all([keyPair,_this3.client.request("accounts.register",{email:email,password:passwordHash,privateKey:privateKeyPEM$,publicKey:keyPair.publicKeyPEM,referrer:options.referrer,mondaySessionToken:options.mondaySessionToken})])}).then(function(_ref3){var keyPair=_ref3[0];return Promise.all([keyPair,_this3.login(email,password,undefined,false)])}).then(function(_ref4){var keyPair=_ref4[0],session=_ref4[1];return Promise.all([keyPair,session,options.activationCode?_this3.activate(options.activationCode).catch(function(){return _this3.generateActivationCode()}):_this3.generateActivationCode()])}).then(function(_ref5){var keyPair=_ref5[0],session=_ref5[1];session.privateKeyPEM=keyPair.privateKeyPEM;return session})};Accounts.prototype.generateActivationCode=function generateActivationCode(){return this.client.request("accounts.generate-activation-code",{userId:this.client.session.userId})};Accounts.prototype.activate=function activate(activationCode){var _this4=this;return this.client.request("accounts.activate",{userId:this.client.session.userId,authCode:activationCode}).then(function(){_this4.client.session.user.hasActivated=true})};Accounts.prototype.login=function login(email,password,totp){var _this5=this;var _decryptPrivateKey=arguments.length>3&&arguments[3]!==undefined?arguments[3]:true;return this.client.crypto().generatePasswordHash(password).then(function(passwordHash){return _this5.client.request("accounts.login",{email:email,password:passwordHash,totp:totp})}).then(function(response){var session=(new _Session2.default).fromSession(response.data);session.user.email=email;return session}).then(function(session){if(_decryptPrivateKey){return _this5.client.crypto().decryptPrivateKey(session.privateKeyPEM$,password).then(function(privateKeyPEM){session.privateKeyPEM=privateKeyPEM;return session})}return session}).then(function(session){_this5.client.setSession(session);return session})};Accounts.prototype.resetPassword=function resetPassword(_ref6){var _this6=this;var email=_ref6.email,code=_ref6.code,password=_ref6.password;return this._generateCredentials(password).then(function(_ref7){var passwordHash=_ref7[0],keyPair=_ref7[1],privateKeyPEM$=_ref7[2];return Promise.all([keyPair,_this6.client.request("accounts.reset-password",{email:email,secret:code,newPassword:passwordHash,newPrivateKey:privateKeyPEM$,newPublicKey:keyPair.publicKeyPEM})])}).then(function(_ref8){var keyPair=_ref8[0];return Promise.all([keyPair,_this6.login(email,password,undefined,false)])}).then(function(_ref9){var keyPair=_ref9[0],session=_ref9[1];session.privateKeyPEM=keyPair.privateKeyPEM;return session})};Accounts.prototype.forgotPassword=function forgotPassword(email){return this.client.request("accounts.forgot-password",{email:email})};Accounts.prototype.setPasswordRequest=function setPasswordRequest(email){return this.client.request("accounts.set-password-request",{email:email})};Accounts.prototype.setPassword=function setPassword(_ref10){var _this7=this;var email=_ref10.email,code=_ref10.code,password=_ref10.password;return this._generateCredentials(password).then(function(_ref11){var passwordHash=_ref11[0],keyPair=_ref11[1],privateKeyPEM$=_ref11[2];return Promise.all([keyPair,_this7.client.request("accounts.set-password",{email:email,secret:code,newPassword:passwordHash,newPrivateKey:privateKeyPEM$,newPublicKey:keyPair.publicKeyPEM})])}).then(function(_ref12){var keyPair=_ref12[0];return Promise.all([keyPair,_this7.login(email,password,undefined,false)])}).then(function(_ref13){var keyPair=_ref13[0],session=_ref13[1];session.privateKeyPEM=keyPair.privateKeyPEM;return session})};Accounts.prototype.logout=function logout(){var _this8=this;return this.client.request("accounts.logout").catch(function(err){_this8.client.setSession(null);return Promise.reject(err)}).then(function(){_this8.client.setSession(null)})};return Accounts}(_API3.default);exports.default=Accounts;
|
|
@@ -21,6 +21,18 @@ declare class TeamAccountFeatures {
|
|
|
21
21
|
* @type {string}
|
|
22
22
|
*/
|
|
23
23
|
teamType: string;
|
|
24
|
+
/**
|
|
25
|
+
* Whether the team type is the "plus" variant, e.g. Enterprise Plus
|
|
26
|
+
*
|
|
27
|
+
* @type {boolean}
|
|
28
|
+
*/
|
|
29
|
+
teamIsPlus: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Whether the team account is on trial or not
|
|
32
|
+
*
|
|
33
|
+
* @type {boolean}
|
|
34
|
+
*/
|
|
35
|
+
teamIsTrial: boolean;
|
|
24
36
|
/** @private */
|
|
25
37
|
fromTeamAccountFeatures(teamAccountFeaturesData: any): TeamAccountFeatures;
|
|
26
38
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";exports.__esModule=true;var _transform=require("./transform");var _transform2=_interopRequireDefault(_transform);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}var TeamAccountFeatureSchema={teamId:"Id",teamName:"Name",teamType:"Type"};var TeamAccountFeatures=function(){function TeamAccountFeatures(){_classCallCheck(this,TeamAccountFeatures)}TeamAccountFeatures.prototype.fromTeamAccountFeatures=function fromTeamAccountFeatures(teamAccountFeaturesData){(0,_transform2.default)(this,TeamAccountFeatureSchema,teamAccountFeaturesData);return this};return TeamAccountFeatures}();exports.default=TeamAccountFeatures;
|
|
1
|
+
"use strict";exports.__esModule=true;var _transform=require("./transform");var _transform2=_interopRequireDefault(_transform);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}var TeamAccountFeatureSchema={teamId:"Id",teamName:"Name",teamType:"Type",teamIsPlus:"IsPlus",teamIsTrial:"IsTrial"};var TeamAccountFeatures=function(){function TeamAccountFeatures(){_classCallCheck(this,TeamAccountFeatures)}TeamAccountFeatures.prototype.fromTeamAccountFeatures=function fromTeamAccountFeatures(teamAccountFeaturesData){(0,_transform2.default)(this,TeamAccountFeatureSchema,teamAccountFeaturesData);return this};return TeamAccountFeatures}();exports.default=TeamAccountFeatures;
|