@verdocs/web-sdk 1.4.6 → 1.4.7
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/dist/cjs/{Auth-e68977a3.js → Auth-4ec35ac7.js} +10 -3
- package/dist/cjs/{Token-1ec62bd3.js → Token-ac80819a.js} +1 -0
- package/dist/cjs/verdocs-auth.cjs.entry.js +2 -2
- package/dist/cjs/verdocs-search-activity_2.cjs.entry.js +2 -2
- package/dist/cjs/verdocs-sign.cjs.entry.js +1 -1
- package/dist/components/Auth.js +10 -3
- package/dist/components/Token.js +1 -1
- package/dist/docs.json +1 -1
- package/dist/esm/{Auth-b330f209.js → Auth-15cd42a8.js} +10 -3
- package/dist/esm/{Token-a587e3ad.js → Token-ce37bd9d.js} +1 -1
- package/dist/esm/verdocs-auth.entry.js +2 -2
- package/dist/esm/verdocs-search-activity_2.entry.js +2 -2
- package/dist/esm/verdocs-sign.entry.js +1 -1
- package/dist/esm-es5/Auth-15cd42a8.js +1 -0
- package/dist/esm-es5/{Token-a587e3ad.js → Token-ce37bd9d.js} +1 -1
- package/dist/esm-es5/verdocs-auth.entry.js +1 -1
- package/dist/esm-es5/verdocs-search-activity_2.entry.js +1 -1
- package/dist/esm-es5/verdocs-sign.entry.js +1 -1
- package/dist/verdocs-web-sdk/{p-203fd748.system.entry.js → p-0c0b4a10.system.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-9428614b.system.entry.js → p-2b57857d.system.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-0b1fb53f.entry.js → p-69ef22bd.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-6348272c.js → p-737b2e99.js} +1 -1
- package/dist/verdocs-web-sdk/p-8730dc92.system.js +1 -0
- package/dist/verdocs-web-sdk/p-88a300c5.system.js +1 -1
- package/dist/verdocs-web-sdk/{p-0c30002e.entry.js → p-a7cfe6fc.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-216a4759.system.entry.js → p-b9164c4b.system.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-e3659c64.system.js → p-cec13589.system.js} +1 -1
- package/dist/verdocs-web-sdk/p-e6e2894e.js +1 -0
- package/dist/verdocs-web-sdk/{p-da850d97.entry.js → p-ea6d6dc7.entry.js} +1 -1
- package/dist/verdocs-web-sdk/verdocs-web-sdk.esm.js +1 -1
- package/package.json +2 -2
- package/dist/esm-es5/Auth-b330f209.js +0 -1
- package/dist/verdocs-web-sdk/p-3820c9a2.js +0 -1
- package/dist/verdocs-web-sdk/p-e93ac86f.system.js +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const Token = require('./Token-
|
|
3
|
+
const Token = require('./Token-ac80819a.js');
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Authenticate to Verdocs via user/password authentication
|
|
@@ -72,9 +72,16 @@ var endSession = function (source, persist) {
|
|
|
72
72
|
if (persist === void 0) { persist = false; }
|
|
73
73
|
return clearSession(source, persist);
|
|
74
74
|
};
|
|
75
|
-
var
|
|
75
|
+
var SESSION_LISTENERS_KEY = Symbol.for('verdocs-session-listeners');
|
|
76
|
+
if (!Token.globalThis_1[SESSION_LISTENERS_KEY]) {
|
|
77
|
+
Token.globalThis_1[SESSION_LISTENERS_KEY] = new Map();
|
|
78
|
+
}
|
|
79
|
+
var LISTENER_ID_KEY = Symbol.for('verdocs-session-listener-id');
|
|
80
|
+
if (!Token.globalThis_1[LISTENER_ID_KEY]) {
|
|
81
|
+
Token.globalThis_1[LISTENER_ID_KEY] = 0;
|
|
82
|
+
}
|
|
76
83
|
var notifySessionListeners = function (source, session) {
|
|
77
|
-
|
|
84
|
+
Token.globalThis_1[SESSION_LISTENERS_KEY].forEach(function (listener) {
|
|
78
85
|
try {
|
|
79
86
|
listener(source, session);
|
|
80
87
|
}
|
|
@@ -2327,4 +2327,5 @@ var decodeAccessTokenBody = function (token) {
|
|
|
2327
2327
|
exports.VerdocsEndpoint = VerdocsEndpoint;
|
|
2328
2328
|
exports.decodeAccessTokenBody = decodeAccessTokenBody;
|
|
2329
2329
|
exports.getEndpoint = getEndpoint;
|
|
2330
|
+
exports.globalThis_1 = globalThis_1;
|
|
2330
2331
|
exports.setActiveEndpoint = setActiveEndpoint;
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-589f3be8.js');
|
|
6
|
-
const Auth = require('./Auth-
|
|
7
|
-
const Token = require('./Token-
|
|
6
|
+
const Auth = require('./Auth-4ec35ac7.js');
|
|
7
|
+
const Token = require('./Token-ac80819a.js');
|
|
8
8
|
require('./buffer-es6-bc8199b1.js');
|
|
9
9
|
|
|
10
10
|
const verdocsAuthCss = "verdocs-auth{font-family:\"Inter\", -apple-system, \"Segoe UI\", \"Roboto\", \"Helvetica Neue\", sans-serif;background-color:#4c56cb;padding:40px;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center}verdocs-auth .login-form,verdocs-auth .signup-form{background:#f5f5fa;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;border-radius:8px;-ms-flex-direction:column;flex-direction:column;display:-ms-flexbox;display:flex;padding:20px;width:300px;max-width:100%}verdocs-auth .logo{margin:20px 0 30px;width:128px;max-width:100%}verdocs-auth h3{text-align:center;font-weight:400;font-size:16px;line-height:1.75;margin:0}verdocs-auth h4{text-align:center;font-weight:400;font-size:14px;line-height:1.43;margin:0}verdocs-auth .status-result{display:none}verdocs-auth .status-result.debug{white-space:pre-wrap;font-size:14px;background:#fff;padding:10px;display:block;-ms-flex-direction:row;flex-direction:row;-ms-flex-pack:center;justify-content:center}verdocs-auth form{width:100%}verdocs-auth verdocs-text-input{margin-bottom:10px}";
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-589f3be8.js');
|
|
6
|
-
const Auth = require('./Auth-
|
|
7
|
-
const Token = require('./Token-
|
|
6
|
+
const Auth = require('./Auth-4ec35ac7.js');
|
|
7
|
+
const Token = require('./Token-ac80819a.js');
|
|
8
8
|
require('./buffer-es6-bc8199b1.js');
|
|
9
9
|
|
|
10
10
|
/**
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-589f3be8.js');
|
|
6
|
-
const Token = require('./Token-
|
|
6
|
+
const Token = require('./Token-ac80819a.js');
|
|
7
7
|
const bufferEs6 = require('./buffer-es6-bc8199b1.js');
|
|
8
8
|
|
|
9
9
|
/**
|
package/dist/components/Auth.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { g as getEndpoint, d as decodeAccessTokenBody } from './Token.js';
|
|
1
|
+
import { a as globalThis_1, g as getEndpoint, d as decodeAccessTokenBody } from './Token.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Authenticate to Verdocs via user/password authentication
|
|
@@ -70,9 +70,16 @@ var endSession = function (source, persist) {
|
|
|
70
70
|
if (persist === void 0) { persist = false; }
|
|
71
71
|
return clearSession(source, persist);
|
|
72
72
|
};
|
|
73
|
-
var
|
|
73
|
+
var SESSION_LISTENERS_KEY = Symbol.for('verdocs-session-listeners');
|
|
74
|
+
if (!globalThis_1[SESSION_LISTENERS_KEY]) {
|
|
75
|
+
globalThis_1[SESSION_LISTENERS_KEY] = new Map();
|
|
76
|
+
}
|
|
77
|
+
var LISTENER_ID_KEY = Symbol.for('verdocs-session-listener-id');
|
|
78
|
+
if (!globalThis_1[LISTENER_ID_KEY]) {
|
|
79
|
+
globalThis_1[LISTENER_ID_KEY] = 0;
|
|
80
|
+
}
|
|
74
81
|
var notifySessionListeners = function (source, session) {
|
|
75
|
-
|
|
82
|
+
globalThis_1[SESSION_LISTENERS_KEY].forEach(function (listener) {
|
|
76
83
|
try {
|
|
77
84
|
listener(source, session);
|
|
78
85
|
}
|
package/dist/components/Token.js
CHANGED
|
@@ -2322,4 +2322,4 @@ var decodeAccessTokenBody = function (token) {
|
|
|
2322
2322
|
return decoded;
|
|
2323
2323
|
};
|
|
2324
2324
|
|
|
2325
|
-
export { VerdocsEndpoint as V, decodeAccessTokenBody as d, getEndpoint as g, setActiveEndpoint as s };
|
|
2325
|
+
export { VerdocsEndpoint as V, globalThis_1 as a, decodeAccessTokenBody as d, getEndpoint as g, setActiveEndpoint as s };
|
package/dist/docs.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { g as getEndpoint, d as decodeAccessTokenBody } from './Token-
|
|
1
|
+
import { g as globalThis_1, a as getEndpoint, d as decodeAccessTokenBody } from './Token-ce37bd9d.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Authenticate to Verdocs via user/password authentication
|
|
@@ -70,9 +70,16 @@ var endSession = function (source, persist) {
|
|
|
70
70
|
if (persist === void 0) { persist = false; }
|
|
71
71
|
return clearSession(source, persist);
|
|
72
72
|
};
|
|
73
|
-
var
|
|
73
|
+
var SESSION_LISTENERS_KEY = Symbol.for('verdocs-session-listeners');
|
|
74
|
+
if (!globalThis_1[SESSION_LISTENERS_KEY]) {
|
|
75
|
+
globalThis_1[SESSION_LISTENERS_KEY] = new Map();
|
|
76
|
+
}
|
|
77
|
+
var LISTENER_ID_KEY = Symbol.for('verdocs-session-listener-id');
|
|
78
|
+
if (!globalThis_1[LISTENER_ID_KEY]) {
|
|
79
|
+
globalThis_1[LISTENER_ID_KEY] = 0;
|
|
80
|
+
}
|
|
74
81
|
var notifySessionListeners = function (source, session) {
|
|
75
|
-
|
|
82
|
+
globalThis_1[SESSION_LISTENERS_KEY].forEach(function (listener) {
|
|
76
83
|
try {
|
|
77
84
|
listener(source, session);
|
|
78
85
|
}
|
|
@@ -2322,4 +2322,4 @@ var decodeAccessTokenBody = function (token) {
|
|
|
2322
2322
|
return decoded;
|
|
2323
2323
|
};
|
|
2324
2324
|
|
|
2325
|
-
export { VerdocsEndpoint as V, decodeAccessTokenBody as d,
|
|
2325
|
+
export { VerdocsEndpoint as V, getEndpoint as a, decodeAccessTokenBody as d, globalThis_1 as g, setActiveEndpoint as s };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { r as registerInstance, c as createEvent, h } from './index-859bc689.js';
|
|
2
|
-
import { l as loadSession, a as authenticateUser, s as setSession, e as endSession } from './Auth-
|
|
3
|
-
import { V as VerdocsEndpoint, s as setActiveEndpoint } from './Token-
|
|
2
|
+
import { l as loadSession, a as authenticateUser, s as setSession, e as endSession } from './Auth-15cd42a8.js';
|
|
3
|
+
import { V as VerdocsEndpoint, s as setActiveEndpoint } from './Token-ce37bd9d.js';
|
|
4
4
|
import './buffer-es6-136673c8.js';
|
|
5
5
|
|
|
6
6
|
const verdocsAuthCss = "verdocs-auth{font-family:\"Inter\", -apple-system, \"Segoe UI\", \"Roboto\", \"Helvetica Neue\", sans-serif;background-color:#4c56cb;padding:40px;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center}verdocs-auth .login-form,verdocs-auth .signup-form{background:#f5f5fa;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;border-radius:8px;-ms-flex-direction:column;flex-direction:column;display:-ms-flexbox;display:flex;padding:20px;width:300px;max-width:100%}verdocs-auth .logo{margin:20px 0 30px;width:128px;max-width:100%}verdocs-auth h3{text-align:center;font-weight:400;font-size:16px;line-height:1.75;margin:0}verdocs-auth h4{text-align:center;font-weight:400;font-size:14px;line-height:1.43;margin:0}verdocs-auth .status-result{display:none}verdocs-auth .status-result.debug{white-space:pre-wrap;font-size:14px;background:#fff;padding:10px;display:block;-ms-flex-direction:row;flex-direction:row;-ms-flex-pack:center;justify-content:center}verdocs-auth form{width:100%}verdocs-auth verdocs-text-input{margin-bottom:10px}";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { r as registerInstance, c as createEvent, h } from './index-859bc689.js';
|
|
2
|
-
import { l as loadSession } from './Auth-
|
|
3
|
-
import {
|
|
2
|
+
import { l as loadSession } from './Auth-15cd42a8.js';
|
|
3
|
+
import { a as getEndpoint } from './Token-ce37bd9d.js';
|
|
4
4
|
import './buffer-es6-136673c8.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { r as registerInstance, h, H as Host } from './index-859bc689.js';
|
|
2
|
-
import {
|
|
2
|
+
import { a as getEndpoint, d as decodeAccessTokenBody, V as VerdocsEndpoint, s as setActiveEndpoint } from './Token-ce37bd9d.js';
|
|
3
3
|
import { B as Buffer } from './buffer-es6-136673c8.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{g as globalThis_1,a as getEndpoint,d as decodeAccessTokenBody}from"./Token-ce37bd9d.js";var authenticateUser=function(e){return getEndpoint().api.post("/authentication/login",e).then((function(e){return e.data}))};var clearSession=function(e,n){getEndpoint().setAuthorization(null);if(n){localStorage.removeItem(e)}notifySessionListeners(e,null);return null};var setSession=function(e,n,o){if(o===void 0){o=false}if(n===null){return clearSession(e,o)}var t=decodeAccessTokenBody(n||"");if(t===null||t.exp&&t.exp*1e3<(new Date).getTime()){return clearSession(e,o)}if(o){localStorage.setItem(e,n)}getEndpoint().setAuthorization(n);notifySessionListeners(e,t);return t};var loadSession=function(e){var n=localStorage.getItem(e);if(!n){return null}var o=decodeAccessTokenBody(n);if(!o){return null}if(o.exp&&o.exp*1e3<(new Date).getTime()){localStorage.removeItem(e);return null}getEndpoint().setAuthorization(n);notifySessionListeners(e,o);return o};var endSession=function(e,n){if(n===void 0){n=false}return clearSession(e,n)};var SESSION_LISTENERS_KEY=Symbol.for("verdocs-session-listeners");if(!globalThis_1[SESSION_LISTENERS_KEY]){globalThis_1[SESSION_LISTENERS_KEY]=new Map}var LISTENER_ID_KEY=Symbol.for("verdocs-session-listener-id");if(!globalThis_1[LISTENER_ID_KEY]){globalThis_1[LISTENER_ID_KEY]=0}var notifySessionListeners=function(e,n){globalThis_1[SESSION_LISTENERS_KEY].forEach((function(o){try{o(e,n)}catch(e){}}))};export{authenticateUser as a,endSession as e,loadSession as l,setSession as s};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{B as Buffer,p as process_1}from"./buffer-es6-136673c8.js";var bind=function e(t,r){return function e(){var n=new Array(arguments.length);for(var i=0;i<n.length;i++){n[i]=arguments[i]}return t.apply(r,n)}};var toString=Object.prototype.toString;var kindOf=function(e){return function(t){var r=toString.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())}}(Object.create(null));function kindOfTest(e){e=e.toLowerCase();return function t(r){return kindOf(r)===e}}function isArray(e){return Array.isArray(e)}function isUndefined(e){return typeof e==="undefined"}function isBuffer(e){return e!==null&&!isUndefined(e)&&e.constructor!==null&&!isUndefined(e.constructor)&&typeof e.constructor.isBuffer==="function"&&e.constructor.isBuffer(e)}var isArrayBuffer=kindOfTest("ArrayBuffer");function isArrayBufferView(e){var t;if(typeof ArrayBuffer!=="undefined"&&ArrayBuffer.isView){t=ArrayBuffer.isView(e)}else{t=e&&e.buffer&&isArrayBuffer(e.buffer)}return t}function isString(e){return typeof e==="string"}function isNumber(e){return typeof e==="number"}function isObject(e){return e!==null&&typeof e==="object"}function isPlainObject(e){if(kindOf(e)!=="object"){return false}var t=Object.getPrototypeOf(e);return t===null||t===Object.prototype}var isDate=kindOfTest("Date");var isFile=kindOfTest("File");var isBlob=kindOfTest("Blob");var isFileList=kindOfTest("FileList");function isFunction(e){return toString.call(e)==="[object Function]"}function isStream(e){return isObject(e)&&isFunction(e.pipe)}function isFormData(e){var t="[object FormData]";return e&&(typeof FormData==="function"&&e instanceof FormData||toString.call(e)===t||isFunction(e.toString)&&e.toString()===t)}var isURLSearchParams=kindOfTest("URLSearchParams");function trim(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}function isStandardBrowserEnv(){if(typeof navigator!=="undefined"&&(navigator.product==="ReactNative"||navigator.product==="NativeScript"||navigator.product==="NS")){return false}return typeof window!=="undefined"&&typeof document!=="undefined"}function forEach(e,t){if(e===null||typeof e==="undefined"){return}if(typeof e!=="object"){e=[e]}if(isArray(e)){for(var r=0,n=e.length;r<n;r++){t.call(null,e[r],r,e)}}else{for(var i in e){if(Object.prototype.hasOwnProperty.call(e,i)){t.call(null,e[i],i,e)}}}}function merge(){var e={};function t(t,r){if(isPlainObject(e[r])&&isPlainObject(t)){e[r]=merge(e[r],t)}else if(isPlainObject(t)){e[r]=merge({},t)}else if(isArray(t)){e[r]=t.slice()}else{e[r]=t}}for(var r=0,n=arguments.length;r<n;r++){forEach(arguments[r],t)}return e}function extend(e,t,r){forEach(t,(function t(n,i){if(r&&typeof n==="function"){e[i]=bind(n,r)}else{e[i]=n}}));return e}function stripBOM(e){if(e.charCodeAt(0)===65279){e=e.slice(1)}return e}function inherits(e,t,r,n){e.prototype=Object.create(t.prototype,n);e.prototype.constructor=e;r&&Object.assign(e.prototype,r)}function toFlatObject(e,t,r){var n;var i;var o;var s={};t=t||{};do{n=Object.getOwnPropertyNames(e);i=n.length;while(i-- >0){o=n[i];if(!s[o]){t[o]=e[o];s[o]=true}}e=Object.getPrototypeOf(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t}function endsWith(e,t,r){e=String(e);if(r===undefined||r>e.length){r=e.length}r-=t.length;var n=e.indexOf(t,r);return n!==-1&&n===r}function toArray(e){if(!e)return null;var t=e.length;if(isUndefined(t))return null;var r=new Array(t);while(t-- >0){r[t]=e[t]}return r}var isTypedArray=function(e){return function(t){return e&&t instanceof e}}(typeof Uint8Array!=="undefined"&&Object.getPrototypeOf(Uint8Array));var utils={isArray:isArray,isArrayBuffer:isArrayBuffer,isBuffer:isBuffer,isFormData:isFormData,isArrayBufferView:isArrayBufferView,isString:isString,isNumber:isNumber,isObject:isObject,isPlainObject:isPlainObject,isUndefined:isUndefined,isDate:isDate,isFile:isFile,isBlob:isBlob,isFunction:isFunction,isStream:isStream,isURLSearchParams:isURLSearchParams,isStandardBrowserEnv:isStandardBrowserEnv,forEach:forEach,merge:merge,extend:extend,trim:trim,stripBOM:stripBOM,inherits:inherits,toFlatObject:toFlatObject,kindOf:kindOf,kindOfTest:kindOfTest,endsWith:endsWith,toArray:toArray,isTypedArray:isTypedArray,isFileList:isFileList};function encode(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}var buildURL=function e(t,r,n){if(!r){return t}var i;if(n){i=n(r)}else if(utils.isURLSearchParams(r)){i=r.toString()}else{var o=[];utils.forEach(r,(function e(t,r){if(t===null||typeof t==="undefined"){return}if(utils.isArray(t)){r=r+"[]"}else{t=[t]}utils.forEach(t,(function e(t){if(utils.isDate(t)){t=t.toISOString()}else if(utils.isObject(t)){t=JSON.stringify(t)}o.push(encode(r)+"="+encode(t))}))}));i=o.join("&")}if(i){var s=t.indexOf("#");if(s!==-1){t=t.slice(0,s)}t+=(t.indexOf("?")===-1?"?":"&")+i}return t};function InterceptorManager(){this.handlers=[]}InterceptorManager.prototype.use=function e(t,r,n){this.handlers.push({fulfilled:t,rejected:r,synchronous:n?n.synchronous:false,runWhen:n?n.runWhen:null});return this.handlers.length-1};InterceptorManager.prototype.eject=function e(t){if(this.handlers[t]){this.handlers[t]=null}};InterceptorManager.prototype.forEach=function e(t){utils.forEach(this.handlers,(function e(r){if(r!==null){t(r)}}))};var InterceptorManager_1=InterceptorManager;var normalizeHeaderName=function e(t,r){utils.forEach(t,(function e(n,i){if(i!==r&&i.toUpperCase()===r.toUpperCase()){t[r]=n;delete t[i]}}))};function AxiosError(e,t,r,n,i){Error.call(this);this.message=e;this.name="AxiosError";t&&(this.code=t);r&&(this.config=r);n&&(this.request=n);i&&(this.response=i)}utils.inherits(AxiosError,Error,{toJSON:function e(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code,status:this.response&&this.response.status?this.response.status:null}}});var prototype=AxiosError.prototype;var descriptors={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED"].forEach((function(e){descriptors[e]={value:e}}));Object.defineProperties(AxiosError,descriptors);Object.defineProperty(prototype,"isAxiosError",{value:true});AxiosError.from=function(e,t,r,n,i,o){var s=Object.create(prototype);utils.toFlatObject(e,s,(function e(t){return t!==Error.prototype}));AxiosError.call(s,e.message,t,r,n,i);s.name=e.name;o&&Object.assign(s,o);return s};var AxiosError_1=AxiosError;var transitional={silentJSONParsing:true,forcedJSONParsing:true,clarifyTimeoutError:false};function toFormData(e,t){t=t||new FormData;var r=[];function n(e){if(e===null)return"";if(utils.isDate(e)){return e.toISOString()}if(utils.isArrayBuffer(e)||utils.isTypedArray(e)){return typeof Blob==="function"?new Blob([e]):Buffer.from(e)}return e}function i(e,o){if(utils.isPlainObject(e)||utils.isArray(e)){if(r.indexOf(e)!==-1){throw Error("Circular reference detected in "+o)}r.push(e);utils.forEach(e,(function e(r,s){if(utils.isUndefined(r))return;var a=o?o+"."+s:s;var u;if(r&&!o&&typeof r==="object"){if(utils.endsWith(s,"{}")){r=JSON.stringify(r)}else if(utils.endsWith(s,"[]")&&(u=utils.toArray(r))){u.forEach((function(e){!utils.isUndefined(e)&&t.append(a,n(e))}));return}}i(r,a)}));r.pop()}else{t.append(o,n(e))}}i(e);return t}var toFormData_1=toFormData;var settle=function e(t,r,n){var i=n.config.validateStatus;if(!n.status||!i||i(n.status)){t(n)}else{r(new AxiosError_1("Request failed with status code "+n.status,[AxiosError_1.ERR_BAD_REQUEST,AxiosError_1.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}};var cookies=utils.isStandardBrowserEnv()?function e(){return{write:function e(t,r,n,i,o,s){var a=[];a.push(t+"="+encodeURIComponent(r));if(utils.isNumber(n)){a.push("expires="+new Date(n).toGMTString())}if(utils.isString(i)){a.push("path="+i)}if(utils.isString(o)){a.push("domain="+o)}if(s===true){a.push("secure")}document.cookie=a.join("; ")},read:function e(t){var r=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return r?decodeURIComponent(r[3]):null},remove:function e(t){this.write(t,"",Date.now()-864e5)}}}():function e(){return{write:function e(){},read:function e(){return null},remove:function e(){}}}();var isAbsoluteURL=function e(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)};var combineURLs=function e(t,r){return r?t.replace(/\/+$/,"")+"/"+r.replace(/^\/+/,""):t};var buildFullPath=function e(t,r){if(t&&!isAbsoluteURL(r)){return combineURLs(t,r)}return r};var ignoreDuplicateOf=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];var parseHeaders=function e(t){var r={};var n;var i;var o;if(!t){return r}utils.forEach(t.split("\n"),(function e(t){o=t.indexOf(":");n=utils.trim(t.substr(0,o)).toLowerCase();i=utils.trim(t.substr(o+1));if(n){if(r[n]&&ignoreDuplicateOf.indexOf(n)>=0){return}if(n==="set-cookie"){r[n]=(r[n]?r[n]:[]).concat([i])}else{r[n]=r[n]?r[n]+", "+i:i}}}));return r};var isURLSameOrigin=utils.isStandardBrowserEnv()?function e(){var t=/(msie|trident)/i.test(navigator.userAgent);var r=document.createElement("a");var n;function i(e){var n=e;if(t){r.setAttribute("href",n);n=r.href}r.setAttribute("href",n);return{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:r.port,pathname:r.pathname.charAt(0)==="/"?r.pathname:"/"+r.pathname}}n=i(window.location.href);return function e(t){var r=utils.isString(t)?i(t):t;return r.protocol===n.protocol&&r.host===n.host}}():function e(){return function e(){return true}}();function CanceledError(e){AxiosError_1.call(this,e==null?"canceled":e,AxiosError_1.ERR_CANCELED);this.name="CanceledError"}utils.inherits(CanceledError,AxiosError_1,{__CANCEL__:true});var CanceledError_1=CanceledError;var parseProtocol=function e(t){var r=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return r&&r[1]||""};var xhr=function e(t){return new Promise((function e(r,n){var i=t.data;var o=t.headers;var s=t.responseType;var a;function u(){if(t.cancelToken){t.cancelToken.unsubscribe(a)}if(t.signal){t.signal.removeEventListener("abort",a)}}if(utils.isFormData(i)&&utils.isStandardBrowserEnv()){delete o["Content-Type"]}var f=new XMLHttpRequest;if(t.auth){var l=t.auth.username||"";var c=t.auth.password?unescape(encodeURIComponent(t.auth.password)):"";o.Authorization="Basic "+btoa(l+":"+c)}var d=buildFullPath(t.baseURL,t.url);f.open(t.method.toUpperCase(),buildURL(d,t.params,t.paramsSerializer),true);f.timeout=t.timeout;function p(){if(!f){return}var e="getAllResponseHeaders"in f?parseHeaders(f.getAllResponseHeaders()):null;var i=!s||s==="text"||s==="json"?f.responseText:f.response;var o={data:i,status:f.status,statusText:f.statusText,headers:e,config:t,request:f};settle((function e(t){r(t);u()}),(function e(t){n(t);u()}),o);f=null}if("onloadend"in f){f.onloadend=p}else{f.onreadystatechange=function e(){if(!f||f.readyState!==4){return}if(f.status===0&&!(f.responseURL&&f.responseURL.indexOf("file:")===0)){return}setTimeout(p)}}f.onabort=function e(){if(!f){return}n(new AxiosError_1("Request aborted",AxiosError_1.ECONNABORTED,t,f));f=null};f.onerror=function e(){n(new AxiosError_1("Network Error",AxiosError_1.ERR_NETWORK,t,f,f));f=null};f.ontimeout=function e(){var r=t.timeout?"timeout of "+t.timeout+"ms exceeded":"timeout exceeded";var i=t.transitional||transitional;if(t.timeoutErrorMessage){r=t.timeoutErrorMessage}n(new AxiosError_1(r,i.clarifyTimeoutError?AxiosError_1.ETIMEDOUT:AxiosError_1.ECONNABORTED,t,f));f=null};if(utils.isStandardBrowserEnv()){var h=(t.withCredentials||isURLSameOrigin(d))&&t.xsrfCookieName?cookies.read(t.xsrfCookieName):undefined;if(h){o[t.xsrfHeaderName]=h}}if("setRequestHeader"in f){utils.forEach(o,(function e(t,r){if(typeof i==="undefined"&&r.toLowerCase()==="content-type"){delete o[r]}else{f.setRequestHeader(r,t)}}))}if(!utils.isUndefined(t.withCredentials)){f.withCredentials=!!t.withCredentials}if(s&&s!=="json"){f.responseType=t.responseType}if(typeof t.onDownloadProgress==="function"){f.addEventListener("progress",t.onDownloadProgress)}if(typeof t.onUploadProgress==="function"&&f.upload){f.upload.addEventListener("progress",t.onUploadProgress)}if(t.cancelToken||t.signal){a=function(e){if(!f){return}n(!e||e&&e.type?new CanceledError_1:e);f.abort();f=null};t.cancelToken&&t.cancelToken.subscribe(a);if(t.signal){t.signal.aborted?a():t.signal.addEventListener("abort",a)}}if(!i){i=null}var v=parseProtocol(d);if(v&&["http","https","file"].indexOf(v)===-1){n(new AxiosError_1("Unsupported protocol "+v+":",AxiosError_1.ERR_BAD_REQUEST,t));return}f.send(i)}))};var _null=null;var DEFAULT_CONTENT_TYPE={"Content-Type":"application/x-www-form-urlencoded"};function setContentTypeIfUnset(e,t){if(!utils.isUndefined(e)&&utils.isUndefined(e["Content-Type"])){e["Content-Type"]=t}}function getDefaultAdapter(){var e;if(typeof XMLHttpRequest!=="undefined"){e=xhr}else if(typeof process_1!=="undefined"&&Object.prototype.toString.call(process_1)==="[object process]"){e=xhr}return e}function stringifySafely(e,t,r){if(utils.isString(e)){try{(t||JSON.parse)(e);return utils.trim(e)}catch(e){if(e.name!=="SyntaxError"){throw e}}}return(r||JSON.stringify)(e)}var defaults={transitional:transitional,adapter:getDefaultAdapter(),transformRequest:[function e(t,r){normalizeHeaderName(r,"Accept");normalizeHeaderName(r,"Content-Type");if(utils.isFormData(t)||utils.isArrayBuffer(t)||utils.isBuffer(t)||utils.isStream(t)||utils.isFile(t)||utils.isBlob(t)){return t}if(utils.isArrayBufferView(t)){return t.buffer}if(utils.isURLSearchParams(t)){setContentTypeIfUnset(r,"application/x-www-form-urlencoded;charset=utf-8");return t.toString()}var n=utils.isObject(t);var i=r&&r["Content-Type"];var o;if((o=utils.isFileList(t))||n&&i==="multipart/form-data"){var s=this.env&&this.env.FormData;return toFormData_1(o?{"files[]":t}:t,s&&new s)}else if(n||i==="application/json"){setContentTypeIfUnset(r,"application/json");return stringifySafely(t)}return t}],transformResponse:[function e(t){var r=this.transitional||defaults.transitional;var n=r&&r.silentJSONParsing;var i=r&&r.forcedJSONParsing;var o=!n&&this.responseType==="json";if(o||i&&utils.isString(t)&&t.length){try{return JSON.parse(t)}catch(e){if(o){if(e.name==="SyntaxError"){throw AxiosError_1.from(e,AxiosError_1.ERR_BAD_RESPONSE,this,null,this.response)}throw e}}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:_null},validateStatus:function e(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};utils.forEach(["delete","get","head"],(function e(t){defaults.headers[t]={}}));utils.forEach(["post","put","patch"],(function e(t){defaults.headers[t]=utils.merge(DEFAULT_CONTENT_TYPE)}));var defaults_1=defaults;var transformData=function e(t,r,n){var i=this||defaults_1;utils.forEach(n,(function e(n){t=n.call(i,t,r)}));return t};var isCancel=function e(t){return!!(t&&t.__CANCEL__)};function throwIfCancellationRequested(e){if(e.cancelToken){e.cancelToken.throwIfRequested()}if(e.signal&&e.signal.aborted){throw new CanceledError_1}}var dispatchRequest=function e(t){throwIfCancellationRequested(t);t.headers=t.headers||{};t.data=transformData.call(t,t.data,t.headers,t.transformRequest);t.headers=utils.merge(t.headers.common||{},t.headers[t.method]||{},t.headers);utils.forEach(["delete","get","head","post","put","patch","common"],(function e(r){delete t.headers[r]}));var r=t.adapter||defaults_1.adapter;return r(t).then((function e(r){throwIfCancellationRequested(t);r.data=transformData.call(t,r.data,r.headers,t.transformResponse);return r}),(function e(r){if(!isCancel(r)){throwIfCancellationRequested(t);if(r&&r.response){r.response.data=transformData.call(t,r.response.data,r.response.headers,t.transformResponse)}}return Promise.reject(r)}))};var mergeConfig=function e(t,r){r=r||{};var n={};function i(e,t){if(utils.isPlainObject(e)&&utils.isPlainObject(t)){return utils.merge(e,t)}else if(utils.isPlainObject(t)){return utils.merge({},t)}else if(utils.isArray(t)){return t.slice()}return t}function o(e){if(!utils.isUndefined(r[e])){return i(t[e],r[e])}else if(!utils.isUndefined(t[e])){return i(undefined,t[e])}}function s(e){if(!utils.isUndefined(r[e])){return i(undefined,r[e])}}function a(e){if(!utils.isUndefined(r[e])){return i(undefined,r[e])}else if(!utils.isUndefined(t[e])){return i(undefined,t[e])}}function u(e){if(e in r){return i(t[e],r[e])}else if(e in t){return i(undefined,t[e])}}var f={url:s,method:s,data:s,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,beforeRedirect:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:u};utils.forEach(Object.keys(t).concat(Object.keys(r)),(function e(t){var r=f[t]||o;var i=r(t);utils.isUndefined(i)&&r!==u||(n[t]=i)}));return n};var data={version:"0.27.2"};var VERSION=data.version;var validators$1={};["object","boolean","number","function","string","symbol"].forEach((function(e,t){validators$1[e]=function r(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}}));var deprecatedWarnings={};validators$1.transitional=function e(t,r,n){function i(e,t){return"[Axios v"+VERSION+"] Transitional option '"+e+"'"+t+(n?". "+n:"")}return function(e,n,o){if(t===false){throw new AxiosError_1(i(n," has been removed"+(r?" in "+r:"")),AxiosError_1.ERR_DEPRECATED)}if(r&&!deprecatedWarnings[n]){deprecatedWarnings[n]=true;console.warn(i(n," has been deprecated since v"+r+" and will be removed in the near future"))}return t?t(e,n,o):true}};function assertOptions(e,t,r){if(typeof e!=="object"){throw new AxiosError_1("options must be an object",AxiosError_1.ERR_BAD_OPTION_VALUE)}var n=Object.keys(e);var i=n.length;while(i-- >0){var o=n[i];var s=t[o];if(s){var a=e[o];var u=a===undefined||s(a,o,e);if(u!==true){throw new AxiosError_1("option "+o+" must be "+u,AxiosError_1.ERR_BAD_OPTION_VALUE)}continue}if(r!==true){throw new AxiosError_1("Unknown option "+o,AxiosError_1.ERR_BAD_OPTION)}}}var validator={assertOptions:assertOptions,validators:validators$1};var validators=validator.validators;function Axios(e){this.defaults=e;this.interceptors={request:new InterceptorManager_1,response:new InterceptorManager_1}}Axios.prototype.request=function e(t,r){if(typeof t==="string"){r=r||{};r.url=t}else{r=t||{}}r=mergeConfig(this.defaults,r);if(r.method){r.method=r.method.toLowerCase()}else if(this.defaults.method){r.method=this.defaults.method.toLowerCase()}else{r.method="get"}var n=r.transitional;if(n!==undefined){validator.assertOptions(n,{silentJSONParsing:validators.transitional(validators.boolean),forcedJSONParsing:validators.transitional(validators.boolean),clarifyTimeoutError:validators.transitional(validators.boolean)},false)}var i=[];var o=true;this.interceptors.request.forEach((function e(t){if(typeof t.runWhen==="function"&&t.runWhen(r)===false){return}o=o&&t.synchronous;i.unshift(t.fulfilled,t.rejected)}));var s=[];this.interceptors.response.forEach((function e(t){s.push(t.fulfilled,t.rejected)}));var a;if(!o){var u=[dispatchRequest,undefined];Array.prototype.unshift.apply(u,i);u=u.concat(s);a=Promise.resolve(r);while(u.length){a=a.then(u.shift(),u.shift())}return a}var f=r;while(i.length){var l=i.shift();var c=i.shift();try{f=l(f)}catch(e){c(e);break}}try{a=dispatchRequest(f)}catch(e){return Promise.reject(e)}while(s.length){a=a.then(s.shift(),s.shift())}return a};Axios.prototype.getUri=function e(t){t=mergeConfig(this.defaults,t);var r=buildFullPath(t.baseURL,t.url);return buildURL(r,t.params,t.paramsSerializer)};utils.forEach(["delete","get","head","options"],(function e(t){Axios.prototype[t]=function(e,r){return this.request(mergeConfig(r||{},{method:t,url:e,data:(r||{}).data}))}}));utils.forEach(["post","put","patch"],(function e(t){function r(e){return function r(n,i,o){return this.request(mergeConfig(o||{},{method:t,headers:e?{"Content-Type":"multipart/form-data"}:{},url:n,data:i}))}}Axios.prototype[t]=r();Axios.prototype[t+"Form"]=r(true)}));var Axios_1=Axios;function CancelToken(e){if(typeof e!=="function"){throw new TypeError("executor must be a function.")}var t;this.promise=new Promise((function e(r){t=r}));var r=this;this.promise.then((function(e){if(!r._listeners)return;var t;var n=r._listeners.length;for(t=0;t<n;t++){r._listeners[t](e)}r._listeners=null}));this.promise.then=function(e){var t;var n=new Promise((function(e){r.subscribe(e);t=e})).then(e);n.cancel=function e(){r.unsubscribe(t)};return n};e((function e(n){if(r.reason){return}r.reason=new CanceledError_1(n);t(r.reason)}))}CancelToken.prototype.throwIfRequested=function e(){if(this.reason){throw this.reason}};CancelToken.prototype.subscribe=function e(t){if(this.reason){t(this.reason);return}if(this._listeners){this._listeners.push(t)}else{this._listeners=[t]}};CancelToken.prototype.unsubscribe=function e(t){if(!this._listeners){return}var r=this._listeners.indexOf(t);if(r!==-1){this._listeners.splice(r,1)}};CancelToken.source=function e(){var t;var r=new CancelToken((function e(r){t=r}));return{token:r,cancel:t}};var CancelToken_1=CancelToken;var spread=function e(t){return function e(r){return t.apply(null,r)}};var isAxiosError=function e(t){return utils.isObject(t)&&t.isAxiosError===true};function createInstance(e){var t=new Axios_1(e);var r=bind(Axios_1.prototype.request,t);utils.extend(r,Axios_1.prototype,t);utils.extend(r,t);r.create=function t(r){return createInstance(mergeConfig(e,r))};return r}var axios$1=createInstance(defaults_1);axios$1.Axios=Axios_1;axios$1.CanceledError=CanceledError_1;axios$1.CancelToken=CancelToken_1;axios$1.isCancel=isCancel;axios$1.VERSION=data.version;axios$1.toFormData=toFormData_1;axios$1.AxiosError=AxiosError_1;axios$1.Cancel=axios$1.CanceledError;axios$1.all=function e(t){return Promise.all(t)};axios$1.spread=spread;axios$1.isAxiosError=isAxiosError;var axios_1=axios$1;var _default=axios$1;axios_1.default=_default;var axios=axios_1;var requestLogger=function(e){console.debug("[JS-SDK] ".concat(e.method.toUpperCase()," ").concat(e.baseURL).concat(e.url),e.data?JSON.stringify(e.data):"");return e};var VerdocsEndpoint=function(){function e(){this.requestLoggerId=null;this.api=axios.create({baseURL:"https://api.verdocs.com",timeout:3e3})}e.prototype.setTimeout=function(e){this.api.defaults.timeout=e;return this};e.prototype.setClientID=function(e){this.api.defaults.headers.common["X-Client-ID"]=e;return this};e.prototype.setAuthorization=function(e){if(e){this.api.defaults.headers.common.Authorization="Bearer ".concat(e)}else{delete this.api.defaults.headers.common.Authorization}return this};e.prototype.setSigningAuthorization=function(e){if(e){this.api.defaults.headers.common.signer="Bearer ".concat(e)}else{delete this.api.defaults.headers.common.signer}return this};e.prototype.setBaseURL=function(e){this.api.defaults.baseURL=e;return this};e.prototype.logRequests=function(e){if(e&&this.requestLoggerId===null){this.requestLoggerId=this.api.interceptors.request.use(requestLogger)}else if(!e&&this.requestLoggerId!==null){this.api.interceptors.request.eject(this.requestLoggerId)}return this};return e}();var naiveFallback=function(){if(typeof self==="object"&&self)return self;if(typeof window==="object"&&window)return window;throw new Error("Unable to resolve global `this`")};var globalThis_1=function(){if(this)return this;if(typeof globalThis==="object"&&globalThis)return globalThis;try{Object.defineProperty(Object.prototype,"__global__",{get:function(){return this},configurable:true})}catch(e){return naiveFallback()}try{if(!__global__)return naiveFallback();return __global__}finally{delete Object.prototype.__global__}}();var ENDPOINT_KEY=Symbol.for("verdocs-api-endpoint");if(!globalThis_1[ENDPOINT_KEY]){globalThis_1[ENDPOINT_KEY]=new VerdocsEndpoint}var globalEndpoint=globalThis_1[ENDPOINT_KEY];var activeEndpoint=globalEndpoint;var getEndpoint=function(){return activeEndpoint};var setActiveEndpoint=function(e){activeEndpoint=e||globalEndpoint};var b64="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";var b64re=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/;var AtoB=function(e){e=String(e).replace(/[\t\n\f\r ]+/g,"");if(!b64re.test(e))throw new TypeError("Failed to execute 'atob' on 'Window': The string to be decoded is not correctly encoded.");e+="==".slice(2-(e.length&3));var t;var r="";var n;var i;var o=0;for(;o<e.length;){t=b64.indexOf(e.charAt(o++))<<18|b64.indexOf(e.charAt(o++))<<12|(n=b64.indexOf(e.charAt(o++)))<<6|(i=b64.indexOf(e.charAt(o++)));r+=n===64?String.fromCharCode(t>>16&255):i===64?String.fromCharCode(t>>16&255,t>>8&255):String.fromCharCode(t>>16&255,t>>8&255,t&255)}return r};var decodeTokenBody=function(e){return JSON.parse(AtoB((e||"").split(".")[1]||""))};var decodeAccessTokenBody=function(e){var t;try{t=decodeTokenBody(e);if(t===null){return null}}catch(e){return null}Object.keys(t).forEach((function(e){if(typeof e==="string"&&e.startsWith("https://verdocs.com/")){t[e.replace("https://verdocs.com/","")]=t[e];delete t[e]}}));return t};export{VerdocsEndpoint as V,decodeAccessTokenBody as d,getEndpoint as g,setActiveEndpoint as s};
|
|
1
|
+
import{B as Buffer,p as process_1}from"./buffer-es6-136673c8.js";var bind=function e(t,r){return function e(){var n=new Array(arguments.length);for(var i=0;i<n.length;i++){n[i]=arguments[i]}return t.apply(r,n)}};var toString=Object.prototype.toString;var kindOf=function(e){return function(t){var r=toString.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())}}(Object.create(null));function kindOfTest(e){e=e.toLowerCase();return function t(r){return kindOf(r)===e}}function isArray(e){return Array.isArray(e)}function isUndefined(e){return typeof e==="undefined"}function isBuffer(e){return e!==null&&!isUndefined(e)&&e.constructor!==null&&!isUndefined(e.constructor)&&typeof e.constructor.isBuffer==="function"&&e.constructor.isBuffer(e)}var isArrayBuffer=kindOfTest("ArrayBuffer");function isArrayBufferView(e){var t;if(typeof ArrayBuffer!=="undefined"&&ArrayBuffer.isView){t=ArrayBuffer.isView(e)}else{t=e&&e.buffer&&isArrayBuffer(e.buffer)}return t}function isString(e){return typeof e==="string"}function isNumber(e){return typeof e==="number"}function isObject(e){return e!==null&&typeof e==="object"}function isPlainObject(e){if(kindOf(e)!=="object"){return false}var t=Object.getPrototypeOf(e);return t===null||t===Object.prototype}var isDate=kindOfTest("Date");var isFile=kindOfTest("File");var isBlob=kindOfTest("Blob");var isFileList=kindOfTest("FileList");function isFunction(e){return toString.call(e)==="[object Function]"}function isStream(e){return isObject(e)&&isFunction(e.pipe)}function isFormData(e){var t="[object FormData]";return e&&(typeof FormData==="function"&&e instanceof FormData||toString.call(e)===t||isFunction(e.toString)&&e.toString()===t)}var isURLSearchParams=kindOfTest("URLSearchParams");function trim(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}function isStandardBrowserEnv(){if(typeof navigator!=="undefined"&&(navigator.product==="ReactNative"||navigator.product==="NativeScript"||navigator.product==="NS")){return false}return typeof window!=="undefined"&&typeof document!=="undefined"}function forEach(e,t){if(e===null||typeof e==="undefined"){return}if(typeof e!=="object"){e=[e]}if(isArray(e)){for(var r=0,n=e.length;r<n;r++){t.call(null,e[r],r,e)}}else{for(var i in e){if(Object.prototype.hasOwnProperty.call(e,i)){t.call(null,e[i],i,e)}}}}function merge(){var e={};function t(t,r){if(isPlainObject(e[r])&&isPlainObject(t)){e[r]=merge(e[r],t)}else if(isPlainObject(t)){e[r]=merge({},t)}else if(isArray(t)){e[r]=t.slice()}else{e[r]=t}}for(var r=0,n=arguments.length;r<n;r++){forEach(arguments[r],t)}return e}function extend(e,t,r){forEach(t,(function t(n,i){if(r&&typeof n==="function"){e[i]=bind(n,r)}else{e[i]=n}}));return e}function stripBOM(e){if(e.charCodeAt(0)===65279){e=e.slice(1)}return e}function inherits(e,t,r,n){e.prototype=Object.create(t.prototype,n);e.prototype.constructor=e;r&&Object.assign(e.prototype,r)}function toFlatObject(e,t,r){var n;var i;var o;var s={};t=t||{};do{n=Object.getOwnPropertyNames(e);i=n.length;while(i-- >0){o=n[i];if(!s[o]){t[o]=e[o];s[o]=true}}e=Object.getPrototypeOf(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t}function endsWith(e,t,r){e=String(e);if(r===undefined||r>e.length){r=e.length}r-=t.length;var n=e.indexOf(t,r);return n!==-1&&n===r}function toArray(e){if(!e)return null;var t=e.length;if(isUndefined(t))return null;var r=new Array(t);while(t-- >0){r[t]=e[t]}return r}var isTypedArray=function(e){return function(t){return e&&t instanceof e}}(typeof Uint8Array!=="undefined"&&Object.getPrototypeOf(Uint8Array));var utils={isArray:isArray,isArrayBuffer:isArrayBuffer,isBuffer:isBuffer,isFormData:isFormData,isArrayBufferView:isArrayBufferView,isString:isString,isNumber:isNumber,isObject:isObject,isPlainObject:isPlainObject,isUndefined:isUndefined,isDate:isDate,isFile:isFile,isBlob:isBlob,isFunction:isFunction,isStream:isStream,isURLSearchParams:isURLSearchParams,isStandardBrowserEnv:isStandardBrowserEnv,forEach:forEach,merge:merge,extend:extend,trim:trim,stripBOM:stripBOM,inherits:inherits,toFlatObject:toFlatObject,kindOf:kindOf,kindOfTest:kindOfTest,endsWith:endsWith,toArray:toArray,isTypedArray:isTypedArray,isFileList:isFileList};function encode(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}var buildURL=function e(t,r,n){if(!r){return t}var i;if(n){i=n(r)}else if(utils.isURLSearchParams(r)){i=r.toString()}else{var o=[];utils.forEach(r,(function e(t,r){if(t===null||typeof t==="undefined"){return}if(utils.isArray(t)){r=r+"[]"}else{t=[t]}utils.forEach(t,(function e(t){if(utils.isDate(t)){t=t.toISOString()}else if(utils.isObject(t)){t=JSON.stringify(t)}o.push(encode(r)+"="+encode(t))}))}));i=o.join("&")}if(i){var s=t.indexOf("#");if(s!==-1){t=t.slice(0,s)}t+=(t.indexOf("?")===-1?"?":"&")+i}return t};function InterceptorManager(){this.handlers=[]}InterceptorManager.prototype.use=function e(t,r,n){this.handlers.push({fulfilled:t,rejected:r,synchronous:n?n.synchronous:false,runWhen:n?n.runWhen:null});return this.handlers.length-1};InterceptorManager.prototype.eject=function e(t){if(this.handlers[t]){this.handlers[t]=null}};InterceptorManager.prototype.forEach=function e(t){utils.forEach(this.handlers,(function e(r){if(r!==null){t(r)}}))};var InterceptorManager_1=InterceptorManager;var normalizeHeaderName=function e(t,r){utils.forEach(t,(function e(n,i){if(i!==r&&i.toUpperCase()===r.toUpperCase()){t[r]=n;delete t[i]}}))};function AxiosError(e,t,r,n,i){Error.call(this);this.message=e;this.name="AxiosError";t&&(this.code=t);r&&(this.config=r);n&&(this.request=n);i&&(this.response=i)}utils.inherits(AxiosError,Error,{toJSON:function e(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code,status:this.response&&this.response.status?this.response.status:null}}});var prototype=AxiosError.prototype;var descriptors={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED"].forEach((function(e){descriptors[e]={value:e}}));Object.defineProperties(AxiosError,descriptors);Object.defineProperty(prototype,"isAxiosError",{value:true});AxiosError.from=function(e,t,r,n,i,o){var s=Object.create(prototype);utils.toFlatObject(e,s,(function e(t){return t!==Error.prototype}));AxiosError.call(s,e.message,t,r,n,i);s.name=e.name;o&&Object.assign(s,o);return s};var AxiosError_1=AxiosError;var transitional={silentJSONParsing:true,forcedJSONParsing:true,clarifyTimeoutError:false};function toFormData(e,t){t=t||new FormData;var r=[];function n(e){if(e===null)return"";if(utils.isDate(e)){return e.toISOString()}if(utils.isArrayBuffer(e)||utils.isTypedArray(e)){return typeof Blob==="function"?new Blob([e]):Buffer.from(e)}return e}function i(e,o){if(utils.isPlainObject(e)||utils.isArray(e)){if(r.indexOf(e)!==-1){throw Error("Circular reference detected in "+o)}r.push(e);utils.forEach(e,(function e(r,s){if(utils.isUndefined(r))return;var a=o?o+"."+s:s;var u;if(r&&!o&&typeof r==="object"){if(utils.endsWith(s,"{}")){r=JSON.stringify(r)}else if(utils.endsWith(s,"[]")&&(u=utils.toArray(r))){u.forEach((function(e){!utils.isUndefined(e)&&t.append(a,n(e))}));return}}i(r,a)}));r.pop()}else{t.append(o,n(e))}}i(e);return t}var toFormData_1=toFormData;var settle=function e(t,r,n){var i=n.config.validateStatus;if(!n.status||!i||i(n.status)){t(n)}else{r(new AxiosError_1("Request failed with status code "+n.status,[AxiosError_1.ERR_BAD_REQUEST,AxiosError_1.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}};var cookies=utils.isStandardBrowserEnv()?function e(){return{write:function e(t,r,n,i,o,s){var a=[];a.push(t+"="+encodeURIComponent(r));if(utils.isNumber(n)){a.push("expires="+new Date(n).toGMTString())}if(utils.isString(i)){a.push("path="+i)}if(utils.isString(o)){a.push("domain="+o)}if(s===true){a.push("secure")}document.cookie=a.join("; ")},read:function e(t){var r=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return r?decodeURIComponent(r[3]):null},remove:function e(t){this.write(t,"",Date.now()-864e5)}}}():function e(){return{write:function e(){},read:function e(){return null},remove:function e(){}}}();var isAbsoluteURL=function e(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)};var combineURLs=function e(t,r){return r?t.replace(/\/+$/,"")+"/"+r.replace(/^\/+/,""):t};var buildFullPath=function e(t,r){if(t&&!isAbsoluteURL(r)){return combineURLs(t,r)}return r};var ignoreDuplicateOf=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];var parseHeaders=function e(t){var r={};var n;var i;var o;if(!t){return r}utils.forEach(t.split("\n"),(function e(t){o=t.indexOf(":");n=utils.trim(t.substr(0,o)).toLowerCase();i=utils.trim(t.substr(o+1));if(n){if(r[n]&&ignoreDuplicateOf.indexOf(n)>=0){return}if(n==="set-cookie"){r[n]=(r[n]?r[n]:[]).concat([i])}else{r[n]=r[n]?r[n]+", "+i:i}}}));return r};var isURLSameOrigin=utils.isStandardBrowserEnv()?function e(){var t=/(msie|trident)/i.test(navigator.userAgent);var r=document.createElement("a");var n;function i(e){var n=e;if(t){r.setAttribute("href",n);n=r.href}r.setAttribute("href",n);return{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:r.port,pathname:r.pathname.charAt(0)==="/"?r.pathname:"/"+r.pathname}}n=i(window.location.href);return function e(t){var r=utils.isString(t)?i(t):t;return r.protocol===n.protocol&&r.host===n.host}}():function e(){return function e(){return true}}();function CanceledError(e){AxiosError_1.call(this,e==null?"canceled":e,AxiosError_1.ERR_CANCELED);this.name="CanceledError"}utils.inherits(CanceledError,AxiosError_1,{__CANCEL__:true});var CanceledError_1=CanceledError;var parseProtocol=function e(t){var r=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return r&&r[1]||""};var xhr=function e(t){return new Promise((function e(r,n){var i=t.data;var o=t.headers;var s=t.responseType;var a;function u(){if(t.cancelToken){t.cancelToken.unsubscribe(a)}if(t.signal){t.signal.removeEventListener("abort",a)}}if(utils.isFormData(i)&&utils.isStandardBrowserEnv()){delete o["Content-Type"]}var f=new XMLHttpRequest;if(t.auth){var l=t.auth.username||"";var c=t.auth.password?unescape(encodeURIComponent(t.auth.password)):"";o.Authorization="Basic "+btoa(l+":"+c)}var d=buildFullPath(t.baseURL,t.url);f.open(t.method.toUpperCase(),buildURL(d,t.params,t.paramsSerializer),true);f.timeout=t.timeout;function p(){if(!f){return}var e="getAllResponseHeaders"in f?parseHeaders(f.getAllResponseHeaders()):null;var i=!s||s==="text"||s==="json"?f.responseText:f.response;var o={data:i,status:f.status,statusText:f.statusText,headers:e,config:t,request:f};settle((function e(t){r(t);u()}),(function e(t){n(t);u()}),o);f=null}if("onloadend"in f){f.onloadend=p}else{f.onreadystatechange=function e(){if(!f||f.readyState!==4){return}if(f.status===0&&!(f.responseURL&&f.responseURL.indexOf("file:")===0)){return}setTimeout(p)}}f.onabort=function e(){if(!f){return}n(new AxiosError_1("Request aborted",AxiosError_1.ECONNABORTED,t,f));f=null};f.onerror=function e(){n(new AxiosError_1("Network Error",AxiosError_1.ERR_NETWORK,t,f,f));f=null};f.ontimeout=function e(){var r=t.timeout?"timeout of "+t.timeout+"ms exceeded":"timeout exceeded";var i=t.transitional||transitional;if(t.timeoutErrorMessage){r=t.timeoutErrorMessage}n(new AxiosError_1(r,i.clarifyTimeoutError?AxiosError_1.ETIMEDOUT:AxiosError_1.ECONNABORTED,t,f));f=null};if(utils.isStandardBrowserEnv()){var h=(t.withCredentials||isURLSameOrigin(d))&&t.xsrfCookieName?cookies.read(t.xsrfCookieName):undefined;if(h){o[t.xsrfHeaderName]=h}}if("setRequestHeader"in f){utils.forEach(o,(function e(t,r){if(typeof i==="undefined"&&r.toLowerCase()==="content-type"){delete o[r]}else{f.setRequestHeader(r,t)}}))}if(!utils.isUndefined(t.withCredentials)){f.withCredentials=!!t.withCredentials}if(s&&s!=="json"){f.responseType=t.responseType}if(typeof t.onDownloadProgress==="function"){f.addEventListener("progress",t.onDownloadProgress)}if(typeof t.onUploadProgress==="function"&&f.upload){f.upload.addEventListener("progress",t.onUploadProgress)}if(t.cancelToken||t.signal){a=function(e){if(!f){return}n(!e||e&&e.type?new CanceledError_1:e);f.abort();f=null};t.cancelToken&&t.cancelToken.subscribe(a);if(t.signal){t.signal.aborted?a():t.signal.addEventListener("abort",a)}}if(!i){i=null}var v=parseProtocol(d);if(v&&["http","https","file"].indexOf(v)===-1){n(new AxiosError_1("Unsupported protocol "+v+":",AxiosError_1.ERR_BAD_REQUEST,t));return}f.send(i)}))};var _null=null;var DEFAULT_CONTENT_TYPE={"Content-Type":"application/x-www-form-urlencoded"};function setContentTypeIfUnset(e,t){if(!utils.isUndefined(e)&&utils.isUndefined(e["Content-Type"])){e["Content-Type"]=t}}function getDefaultAdapter(){var e;if(typeof XMLHttpRequest!=="undefined"){e=xhr}else if(typeof process_1!=="undefined"&&Object.prototype.toString.call(process_1)==="[object process]"){e=xhr}return e}function stringifySafely(e,t,r){if(utils.isString(e)){try{(t||JSON.parse)(e);return utils.trim(e)}catch(e){if(e.name!=="SyntaxError"){throw e}}}return(r||JSON.stringify)(e)}var defaults={transitional:transitional,adapter:getDefaultAdapter(),transformRequest:[function e(t,r){normalizeHeaderName(r,"Accept");normalizeHeaderName(r,"Content-Type");if(utils.isFormData(t)||utils.isArrayBuffer(t)||utils.isBuffer(t)||utils.isStream(t)||utils.isFile(t)||utils.isBlob(t)){return t}if(utils.isArrayBufferView(t)){return t.buffer}if(utils.isURLSearchParams(t)){setContentTypeIfUnset(r,"application/x-www-form-urlencoded;charset=utf-8");return t.toString()}var n=utils.isObject(t);var i=r&&r["Content-Type"];var o;if((o=utils.isFileList(t))||n&&i==="multipart/form-data"){var s=this.env&&this.env.FormData;return toFormData_1(o?{"files[]":t}:t,s&&new s)}else if(n||i==="application/json"){setContentTypeIfUnset(r,"application/json");return stringifySafely(t)}return t}],transformResponse:[function e(t){var r=this.transitional||defaults.transitional;var n=r&&r.silentJSONParsing;var i=r&&r.forcedJSONParsing;var o=!n&&this.responseType==="json";if(o||i&&utils.isString(t)&&t.length){try{return JSON.parse(t)}catch(e){if(o){if(e.name==="SyntaxError"){throw AxiosError_1.from(e,AxiosError_1.ERR_BAD_RESPONSE,this,null,this.response)}throw e}}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:_null},validateStatus:function e(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};utils.forEach(["delete","get","head"],(function e(t){defaults.headers[t]={}}));utils.forEach(["post","put","patch"],(function e(t){defaults.headers[t]=utils.merge(DEFAULT_CONTENT_TYPE)}));var defaults_1=defaults;var transformData=function e(t,r,n){var i=this||defaults_1;utils.forEach(n,(function e(n){t=n.call(i,t,r)}));return t};var isCancel=function e(t){return!!(t&&t.__CANCEL__)};function throwIfCancellationRequested(e){if(e.cancelToken){e.cancelToken.throwIfRequested()}if(e.signal&&e.signal.aborted){throw new CanceledError_1}}var dispatchRequest=function e(t){throwIfCancellationRequested(t);t.headers=t.headers||{};t.data=transformData.call(t,t.data,t.headers,t.transformRequest);t.headers=utils.merge(t.headers.common||{},t.headers[t.method]||{},t.headers);utils.forEach(["delete","get","head","post","put","patch","common"],(function e(r){delete t.headers[r]}));var r=t.adapter||defaults_1.adapter;return r(t).then((function e(r){throwIfCancellationRequested(t);r.data=transformData.call(t,r.data,r.headers,t.transformResponse);return r}),(function e(r){if(!isCancel(r)){throwIfCancellationRequested(t);if(r&&r.response){r.response.data=transformData.call(t,r.response.data,r.response.headers,t.transformResponse)}}return Promise.reject(r)}))};var mergeConfig=function e(t,r){r=r||{};var n={};function i(e,t){if(utils.isPlainObject(e)&&utils.isPlainObject(t)){return utils.merge(e,t)}else if(utils.isPlainObject(t)){return utils.merge({},t)}else if(utils.isArray(t)){return t.slice()}return t}function o(e){if(!utils.isUndefined(r[e])){return i(t[e],r[e])}else if(!utils.isUndefined(t[e])){return i(undefined,t[e])}}function s(e){if(!utils.isUndefined(r[e])){return i(undefined,r[e])}}function a(e){if(!utils.isUndefined(r[e])){return i(undefined,r[e])}else if(!utils.isUndefined(t[e])){return i(undefined,t[e])}}function u(e){if(e in r){return i(t[e],r[e])}else if(e in t){return i(undefined,t[e])}}var f={url:s,method:s,data:s,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,beforeRedirect:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:u};utils.forEach(Object.keys(t).concat(Object.keys(r)),(function e(t){var r=f[t]||o;var i=r(t);utils.isUndefined(i)&&r!==u||(n[t]=i)}));return n};var data={version:"0.27.2"};var VERSION=data.version;var validators$1={};["object","boolean","number","function","string","symbol"].forEach((function(e,t){validators$1[e]=function r(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}}));var deprecatedWarnings={};validators$1.transitional=function e(t,r,n){function i(e,t){return"[Axios v"+VERSION+"] Transitional option '"+e+"'"+t+(n?". "+n:"")}return function(e,n,o){if(t===false){throw new AxiosError_1(i(n," has been removed"+(r?" in "+r:"")),AxiosError_1.ERR_DEPRECATED)}if(r&&!deprecatedWarnings[n]){deprecatedWarnings[n]=true;console.warn(i(n," has been deprecated since v"+r+" and will be removed in the near future"))}return t?t(e,n,o):true}};function assertOptions(e,t,r){if(typeof e!=="object"){throw new AxiosError_1("options must be an object",AxiosError_1.ERR_BAD_OPTION_VALUE)}var n=Object.keys(e);var i=n.length;while(i-- >0){var o=n[i];var s=t[o];if(s){var a=e[o];var u=a===undefined||s(a,o,e);if(u!==true){throw new AxiosError_1("option "+o+" must be "+u,AxiosError_1.ERR_BAD_OPTION_VALUE)}continue}if(r!==true){throw new AxiosError_1("Unknown option "+o,AxiosError_1.ERR_BAD_OPTION)}}}var validator={assertOptions:assertOptions,validators:validators$1};var validators=validator.validators;function Axios(e){this.defaults=e;this.interceptors={request:new InterceptorManager_1,response:new InterceptorManager_1}}Axios.prototype.request=function e(t,r){if(typeof t==="string"){r=r||{};r.url=t}else{r=t||{}}r=mergeConfig(this.defaults,r);if(r.method){r.method=r.method.toLowerCase()}else if(this.defaults.method){r.method=this.defaults.method.toLowerCase()}else{r.method="get"}var n=r.transitional;if(n!==undefined){validator.assertOptions(n,{silentJSONParsing:validators.transitional(validators.boolean),forcedJSONParsing:validators.transitional(validators.boolean),clarifyTimeoutError:validators.transitional(validators.boolean)},false)}var i=[];var o=true;this.interceptors.request.forEach((function e(t){if(typeof t.runWhen==="function"&&t.runWhen(r)===false){return}o=o&&t.synchronous;i.unshift(t.fulfilled,t.rejected)}));var s=[];this.interceptors.response.forEach((function e(t){s.push(t.fulfilled,t.rejected)}));var a;if(!o){var u=[dispatchRequest,undefined];Array.prototype.unshift.apply(u,i);u=u.concat(s);a=Promise.resolve(r);while(u.length){a=a.then(u.shift(),u.shift())}return a}var f=r;while(i.length){var l=i.shift();var c=i.shift();try{f=l(f)}catch(e){c(e);break}}try{a=dispatchRequest(f)}catch(e){return Promise.reject(e)}while(s.length){a=a.then(s.shift(),s.shift())}return a};Axios.prototype.getUri=function e(t){t=mergeConfig(this.defaults,t);var r=buildFullPath(t.baseURL,t.url);return buildURL(r,t.params,t.paramsSerializer)};utils.forEach(["delete","get","head","options"],(function e(t){Axios.prototype[t]=function(e,r){return this.request(mergeConfig(r||{},{method:t,url:e,data:(r||{}).data}))}}));utils.forEach(["post","put","patch"],(function e(t){function r(e){return function r(n,i,o){return this.request(mergeConfig(o||{},{method:t,headers:e?{"Content-Type":"multipart/form-data"}:{},url:n,data:i}))}}Axios.prototype[t]=r();Axios.prototype[t+"Form"]=r(true)}));var Axios_1=Axios;function CancelToken(e){if(typeof e!=="function"){throw new TypeError("executor must be a function.")}var t;this.promise=new Promise((function e(r){t=r}));var r=this;this.promise.then((function(e){if(!r._listeners)return;var t;var n=r._listeners.length;for(t=0;t<n;t++){r._listeners[t](e)}r._listeners=null}));this.promise.then=function(e){var t;var n=new Promise((function(e){r.subscribe(e);t=e})).then(e);n.cancel=function e(){r.unsubscribe(t)};return n};e((function e(n){if(r.reason){return}r.reason=new CanceledError_1(n);t(r.reason)}))}CancelToken.prototype.throwIfRequested=function e(){if(this.reason){throw this.reason}};CancelToken.prototype.subscribe=function e(t){if(this.reason){t(this.reason);return}if(this._listeners){this._listeners.push(t)}else{this._listeners=[t]}};CancelToken.prototype.unsubscribe=function e(t){if(!this._listeners){return}var r=this._listeners.indexOf(t);if(r!==-1){this._listeners.splice(r,1)}};CancelToken.source=function e(){var t;var r=new CancelToken((function e(r){t=r}));return{token:r,cancel:t}};var CancelToken_1=CancelToken;var spread=function e(t){return function e(r){return t.apply(null,r)}};var isAxiosError=function e(t){return utils.isObject(t)&&t.isAxiosError===true};function createInstance(e){var t=new Axios_1(e);var r=bind(Axios_1.prototype.request,t);utils.extend(r,Axios_1.prototype,t);utils.extend(r,t);r.create=function t(r){return createInstance(mergeConfig(e,r))};return r}var axios$1=createInstance(defaults_1);axios$1.Axios=Axios_1;axios$1.CanceledError=CanceledError_1;axios$1.CancelToken=CancelToken_1;axios$1.isCancel=isCancel;axios$1.VERSION=data.version;axios$1.toFormData=toFormData_1;axios$1.AxiosError=AxiosError_1;axios$1.Cancel=axios$1.CanceledError;axios$1.all=function e(t){return Promise.all(t)};axios$1.spread=spread;axios$1.isAxiosError=isAxiosError;var axios_1=axios$1;var _default=axios$1;axios_1.default=_default;var axios=axios_1;var requestLogger=function(e){console.debug("[JS-SDK] ".concat(e.method.toUpperCase()," ").concat(e.baseURL).concat(e.url),e.data?JSON.stringify(e.data):"");return e};var VerdocsEndpoint=function(){function e(){this.requestLoggerId=null;this.api=axios.create({baseURL:"https://api.verdocs.com",timeout:3e3})}e.prototype.setTimeout=function(e){this.api.defaults.timeout=e;return this};e.prototype.setClientID=function(e){this.api.defaults.headers.common["X-Client-ID"]=e;return this};e.prototype.setAuthorization=function(e){if(e){this.api.defaults.headers.common.Authorization="Bearer ".concat(e)}else{delete this.api.defaults.headers.common.Authorization}return this};e.prototype.setSigningAuthorization=function(e){if(e){this.api.defaults.headers.common.signer="Bearer ".concat(e)}else{delete this.api.defaults.headers.common.signer}return this};e.prototype.setBaseURL=function(e){this.api.defaults.baseURL=e;return this};e.prototype.logRequests=function(e){if(e&&this.requestLoggerId===null){this.requestLoggerId=this.api.interceptors.request.use(requestLogger)}else if(!e&&this.requestLoggerId!==null){this.api.interceptors.request.eject(this.requestLoggerId)}return this};return e}();var naiveFallback=function(){if(typeof self==="object"&&self)return self;if(typeof window==="object"&&window)return window;throw new Error("Unable to resolve global `this`")};var globalThis_1=function(){if(this)return this;if(typeof globalThis==="object"&&globalThis)return globalThis;try{Object.defineProperty(Object.prototype,"__global__",{get:function(){return this},configurable:true})}catch(e){return naiveFallback()}try{if(!__global__)return naiveFallback();return __global__}finally{delete Object.prototype.__global__}}();var ENDPOINT_KEY=Symbol.for("verdocs-api-endpoint");if(!globalThis_1[ENDPOINT_KEY]){globalThis_1[ENDPOINT_KEY]=new VerdocsEndpoint}var globalEndpoint=globalThis_1[ENDPOINT_KEY];var activeEndpoint=globalEndpoint;var getEndpoint=function(){return activeEndpoint};var setActiveEndpoint=function(e){activeEndpoint=e||globalEndpoint};var b64="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";var b64re=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/;var AtoB=function(e){e=String(e).replace(/[\t\n\f\r ]+/g,"");if(!b64re.test(e))throw new TypeError("Failed to execute 'atob' on 'Window': The string to be decoded is not correctly encoded.");e+="==".slice(2-(e.length&3));var t;var r="";var n;var i;var o=0;for(;o<e.length;){t=b64.indexOf(e.charAt(o++))<<18|b64.indexOf(e.charAt(o++))<<12|(n=b64.indexOf(e.charAt(o++)))<<6|(i=b64.indexOf(e.charAt(o++)));r+=n===64?String.fromCharCode(t>>16&255):i===64?String.fromCharCode(t>>16&255,t>>8&255):String.fromCharCode(t>>16&255,t>>8&255,t&255)}return r};var decodeTokenBody=function(e){return JSON.parse(AtoB((e||"").split(".")[1]||""))};var decodeAccessTokenBody=function(e){var t;try{t=decodeTokenBody(e);if(t===null){return null}}catch(e){return null}Object.keys(t).forEach((function(e){if(typeof e==="string"&&e.startsWith("https://verdocs.com/")){t[e.replace("https://verdocs.com/","")]=t[e];delete t[e]}}));return t};export{VerdocsEndpoint as V,getEndpoint as a,decodeAccessTokenBody as d,globalThis_1 as g,setActiveEndpoint as s};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as registerInstance,c as createEvent,h}from"./index-859bc689.js";import{l as loadSession,a as authenticateUser,s as setSession,e as endSession}from"./Auth-
|
|
1
|
+
import{r as registerInstance,c as createEvent,h}from"./index-859bc689.js";import{l as loadSession,a as authenticateUser,s as setSession,e as endSession}from"./Auth-15cd42a8.js";import{V as VerdocsEndpoint,s as setActiveEndpoint}from"./Token-ce37bd9d.js";import"./buffer-es6-136673c8.js";var verdocsAuthCss='verdocs-auth{font-family:"Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif;background-color:#4c56cb;padding:40px;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center}verdocs-auth .login-form,verdocs-auth .signup-form{background:#f5f5fa;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;border-radius:8px;-ms-flex-direction:column;flex-direction:column;display:-ms-flexbox;display:flex;padding:20px;width:300px;max-width:100%}verdocs-auth .logo{margin:20px 0 30px;width:128px;max-width:100%}verdocs-auth h3{text-align:center;font-weight:400;font-size:16px;line-height:1.75;margin:0}verdocs-auth h4{text-align:center;font-weight:400;font-size:14px;line-height:1.43;margin:0}verdocs-auth .status-result{display:none}verdocs-auth .status-result.debug{white-space:pre-wrap;font-size:14px;background:#fff;padding:10px;display:block;-ms-flex-direction:row;flex-direction:row;-ms-flex-pack:center;justify-content:center}verdocs-auth form{width:100%}verdocs-auth verdocs-text-input{margin-bottom:10px}';var BASE_URL="https://stage-api.verdocs.com/";var SOURCE="verdocs-stage";var VerdocsAuth=function(){function e(e){registerInstance(this,e);this.authenticated=createEvent(this,"authenticated",7);this.visible=true;this.logo="https://verdocs.com/assets/blue-logo.svg";this.debug=false;this.isAuthenticated=false;this.displayMode="login";this.username="";this.password="";this.loggingIn=false;this.activeSession=null;this.loginError=null}e.prototype.componentWillLoad=function(){var e=(new VerdocsEndpoint).setBaseURL(BASE_URL);setActiveEndpoint(e)};e.prototype.componentDidLoad=function(){var e=loadSession(SOURCE);if(e!==null){this.isAuthenticated=true;this.activeSession=e;this.authenticated.emit({authenticated:true,session:e})}else{this.authenticated.emit({authenticated:false,session:null})}};e.prototype.handleLogin=function(){var e=this;this.loggingIn=true;authenticateUser({username:this.username,password:this.password}).then((function(t){e.loggingIn=false;var n=setSession(SOURCE,t.accessToken,true);e.activeSession=n;e.isAuthenticated=true;e.authenticated.emit({authenticated:true,session:n})})).catch((function(t){var n;console.log("[VERDOCS] Login error",t.response,JSON.stringify(t));e.loggingIn=false;e.activeSession=null;e.authenticated.emit({authenticated:false,session:null});if(((n=t===null||t===void 0?void 0:t.response)===null||n===void 0?void 0:n.status)===403){e.loginError="Please check your username and password and try again."}}))};e.prototype.handleLogout=function(){endSession(SOURCE);this.isAuthenticated=false;this.authenticated.emit({authenticated:false,session:null})};e.prototype.handleClearError=function(){this.loginError=null};e.prototype.render=function(){var e=this;if(!this.visible){return h("div",{style:{display:"none"}},"Verdocs Auth Placeholder")}if(this.isAuthenticated){if(this.debug){return h("div",{class:"status-result debug"},h("verdocs-button",{label:"Logout",disabled:this.loggingIn,onPress:function(){return e.handleLogout()}}))}return h("div",{class:"status-result"},"Authenticated")}if(this.displayMode==="signup"){return h("div",{class:"signup-form"},h("img",{src:this.logo,alt:"Verdocs Logo",class:"logo"}),h("h3",null,"Sign up for an account"),h("h4",null,"Already have an account?",h("verdocs-button",{label:"Log In",variant:"text",onClick:function(){return e.displayMode="login"},disabled:this.loggingIn})),h("form",{onSubmit:function(){return e.handleLogin()}},h("verdocs-text-input",{label:"Email",autocomplete:"username",value:this.username,onFieldInput:function(t){return e.username=t.detail},disabled:this.loggingIn}),h("verdocs-text-input",{label:"Password",type:"password",autocomplete:"current-password",value:this.password,onFieldInput:function(t){return e.password=t.detail},disabled:this.loggingIn}),h("verdocs-button",{label:"Signup",disabled:this.loggingIn,onPress:function(){return e.handleLogin()},style:{display:"flex",justifyContent:"center",margin:"30px auto 0"}})))}return h("div",{class:"login-form"},h("img",{src:this.logo,alt:"Verdocs Logo",class:"logo"}),h("h3",null,"Log in to your account"),h("h4",null,"Don't have an account?",h("verdocs-button",{label:"Sign Up",variant:"text",onClick:function(){return e.displayMode="signup"},disabled:this.loggingIn})),h("form",{onSubmit:function(){return e.handleLogin()}},h("verdocs-text-input",{label:"Email",autocomplete:"username",value:this.username,onFieldInput:function(t){return e.username=t.detail},disabled:this.loggingIn}),h("verdocs-text-input",{label:"Password",type:"password",autocomplete:"current-password",value:this.password,onFieldInput:function(t){return e.password=t.detail},disabled:this.loggingIn}),h("verdocs-button",{label:"Forgot Your Password?",variant:"text",onClick:function(){return e.displayMode="signup"},disabled:this.loggingIn,style:{display:"flex",justifyContent:"center",margin:"10px auto 20px"}}),h("verdocs-button",{label:"Login",disabled:this.loggingIn,onPress:function(){return e.handleLogin()},style:{display:"flex",justifyContent:"center",margin:"10px auto 0"}})),this.loginError?h("verdocs-ok-dialog",{open:true,heading:"Login Error",message:this.loginError,onClosed:function(){return e.handleClearError()}}):h("div",null))};return e}();VerdocsAuth.style=verdocsAuthCss;export{VerdocsAuth as verdocs_auth};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as registerInstance,c as createEvent,h}from"./index-859bc689.js";import{l as loadSession}from"./Auth-b330f209.js";import{g as getEndpoint}from"./Token-a587e3ad.js";import"./buffer-es6-136673c8.js";var __awaiter=undefined&&undefined.__awaiter||function(e,t,r,n){function i(e){return e instanceof r?e:new r((function(t){t(e)}))}return new(r||(r=Promise))((function(r,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n["throw"](e))}catch(e){o(e)}}function c(e){e.done?r(e.value):i(e.value).then(s,a)}c((n=n.apply(e,t||[])).next())}))};var __generator=undefined&&undefined.__generator||function(e,t){var r={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,i,o,s;return s={next:a(0),throw:a(1),return:a(2)},typeof Symbol==="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(e){return function(t){return c([e,t])}}function c(s){if(n)throw new TypeError("Generator is already executing.");while(r)try{if(n=1,i&&(o=s[0]&2?i["return"]:s[0]?i["throw"]||((o=i["return"])&&o.call(i),0):i.next)&&!(o=o.call(i,s[1])).done)return o;if(i=0,o)s=[s[0]&2,o.value];switch(s[0]){case 0:case 1:o=s;break;case 4:r.label++;return{value:s[1],done:false};case 5:r.label++;i=s[1];s=[0];continue;case 7:s=r.ops.pop();r.trys.pop();continue;default:if(!(o=r.trys,o=o.length>0&&o[o.length-1])&&(s[0]===6||s[0]===2)){r=0;continue}if(s[0]===3&&(!o||s[1]>o[0]&&s[1]<o[3])){r.label=s[1];break}if(s[0]===6&&r.label<o[1]){r.label=o[1];o=s;break}if(o&&r.label<o[2]){r.label=o[2];r.ops.push(s);break}if(o[2])r.ops.pop();r.trys.pop();continue}s=t.call(e,r)}catch(e){s=[6,e];i=0}finally{n=o=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:true}}};var getSearchHistory=function(){return __awaiter(void 0,void 0,void 0,(function(){return __generator(this,(function(e){return[2,getEndpoint().api.get("/search/history").then((function(e){return e.data}))]}))}))};var getTemplates=function(e){return getEndpoint().api.get("/templates/",{params:e}).then((function(e){return e.data}))};var DocumentIcon='<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="#000000"><path d="M0 0h24v24H0V0z" fill="none"/><path d="M8 16h8v2H8zm0-4h8v2H8zm6-10H6c-1.1 0-2 .9-2 2v16c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8l-6-6zm4 18H6V4h7v5h5v11z"/></svg>';var verdocsSearchActivityCss='verdocs-search-activity{font-family:"Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif}verdocs-search-activity .container{display:-ms-flexbox;display:flex;width:240px;color:#ffffff;-ms-flex-direction:column;flex-direction:column;text-transform:uppercase;padding:10px 10px 20px 10px;background-color:var(--verdocs-background-dark)}verdocs-search-activity .title{font-size:22px;font-weight:700;line-height:30px}verdocs-search-activity .items{display:-ms-flexbox;display:flex;margin-top:20px;-ms-flex-direction:column;flex-direction:column}verdocs-search-activity .item{border:none;display:-ms-flexbox;display:flex;text-align:left;margin-bottom:20px;-ms-flex-direction:row;flex-direction:row;background:transparent}verdocs-search-activity .item:hover{cursor:pointer}verdocs-search-activity .icon{-ms-flex:0 0 22px;flex:0 0 22px;margin-right:14px}verdocs-search-activity .icon svg{fill:#707ae5;width:22px;height:22px}verdocs-search-activity .details{display:-ms-flexbox;display:flex;overflow:hidden;-ms-flex-direction:column;flex-direction:column}verdocs-search-activity .item-title{font-size:16px;font-weight:400;color:#ffffff;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}verdocs-search-activity .info{font-size:14px;font-weight:500;line-height:23px;color:#aeb4bf}verdocs-search-activity .empty{text-transform:none;line-height:22px;color:#ccc}';var SOURCE="verdocs-stage";var VerdocsSearchActivity=function(){function e(e){registerInstance(this,e);this.entrySelected=createEvent(this,"entrySelected",7);this.type="recent";this.emptyMessage="You do not have any starred searches.";this.authFailure=false;this.title="Recent Searches";this.recent=[];this.saved=[];this.starred=[]}e.prototype.componentWillLoad=function(){var e=this;loadSession(SOURCE);var t=function(t){var r;console.warn("[Verdocs/search-activity] Error getting search data",t);if(((r=t===null||t===void 0?void 0:t.response)===null||r===void 0?void 0:r.status)===401){e.authFailure=true}};switch(this.type){case"recent":this.title="Recent Searches";this.emptyMessage="You do not have any recent searches.";getSearchHistory().then((function(t){return e.recent=t.recent})).catch(t);break;case"saved":this.title="Saved Searches";this.emptyMessage="You do not have any saved searches.";getSearchHistory().then((function(t){return e.saved=t.saved})).catch(t);break;case"starred":this.title="My Starred items";this.emptyMessage="You do not have any starred templates.";getTemplates({is_starred:true}).then((function(t){return e.starred=t})).catch(t);break}};e.prototype.handleSelectEntry=function(e){this.entrySelected.emit(e)};e.prototype.computePagesText=function(e){if(e<2){return"".concat(e," Page")}else{return"".concat(e," Pages")}};e.prototype.computeRecipientsText=function(e){if(typeof e==="object"){return e.join(", ")}else if(e>1){return"".concat(e," Recipients")}else{return"".concat(e," Recipient")}};e.prototype.render=function(){var e=this;var t=this.recent.length<1&&this.saved.length<1&&this.starred.length<1;return h("div",{class:"container"},h("p",{class:"title"},this.title),h("div",{class:"items"},this.recent.map((function(t){return h("button",{class:"item",onClick:function(){return e.handleSelectEntry(t)}},h("div",{class:"icon",innerHTML:DocumentIcon}),h("div",{class:"details"},h("div",{class:"item-title"},t.params.q),h("div",{class:"info"},"Test")))})),this.saved.map((function(t){return h("button",{class:"item",onClick:function(){return e.handleSelectEntry(t)}},h("div",{class:"icon",innerHTML:DocumentIcon}),h("div",{class:"details"},h("div",{class:"item-title"},t.params.q),h("div",{class:"info"})))})),t&&h("div",{class:"empty"},this.authFailure?"Authentication required":this.emptyMessage)))};return e}();VerdocsSearchActivity.style=verdocsSearchActivityCss;var SearchIcon='<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M23.4809 20.7176L17.9111 15.2536C19.0961 13.6368 19.727 11.6926 19.7128 9.70131C19.7201 7.53345 18.9846 5.42606 17.6244 3.71753C16.2642 2.009 14.3581 0.798456 12.2123 0.280282C10.0665 -0.237892 7.80552 -0.0336342 5.79227 0.86026C3.77902 1.75415 2.13038 3.28582 1.1111 5.20931C0.0918114 7.1328 -0.238985 9.33652 0.171813 11.4666C0.582612 13.5967 1.71117 15.5296 3.37628 16.9548C5.0414 18.3801 7.14646 19.2151 9.35344 19.3257C11.5604 19.4364 13.7413 18.8162 15.5458 17.5649L21.1372 23.05L21.1563 23.0663C21.4841 23.3487 21.9039 23.507 22.3401 23.5128C22.7823 23.5125 23.2063 23.3402 23.5191 23.0337V23.0337C23.6749 22.8812 23.7979 22.6995 23.8804 22.4993C23.963 22.2991 24.0036 22.0847 23.9997 21.8688C23.9959 21.6529 23.9477 21.44 23.858 21.2428C23.7683 21.0456 23.639 20.8682 23.4778 20.7212L23.4809 20.7176ZM14.5167 14.1975C13.4564 15.2349 12.0623 15.8797 10.5719 16.022C9.08145 16.1644 7.58681 15.7955 6.34249 14.9781C5.09816 14.1608 4.18109 12.9456 3.74751 11.5395C3.31393 10.1334 3.39064 8.6233 3.96455 7.26643C4.53846 5.90955 5.57409 4.7898 6.89507 4.09787C8.21606 3.40594 9.74071 3.18461 11.2093 3.4716C12.678 3.75858 13.9998 4.53612 14.9497 5.6718C15.8996 6.80748 16.4188 8.23105 16.4189 9.7001C16.4196 10.5357 16.2519 11.3632 15.9254 12.135C15.599 12.9069 15.1202 13.6078 14.5167 14.1975V14.1975Z" fill="white"/>\n</svg>\n';var CloseIcon='<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M14.0739 11.7565L19.7127 6.23228C20.0875 5.85692 20.0875 5.25309 19.7127 4.87773L19.0213 4.20046C18.6382 3.82511 18.0219 3.82511 17.6387 4.20046L12 9.72472L6.36127 4.20046C5.97814 3.82511 5.36179 3.82511 4.97866 4.20046L4.28735 4.87773C3.90422 5.25309 3.90422 5.85692 4.28735 6.23228L9.92608 11.7565L4.28735 17.2808C3.90422 17.6561 3.90422 18.26 4.28735 18.6353L4.97866 19.3126C5.36179 19.688 5.97814 19.688 6.36127 19.3126L12 13.7883L17.6387 19.3126C18.0219 19.688 18.6382 19.688 19.0213 19.3126L19.7127 18.6353C20.0958 18.26 20.0958 17.6561 19.7127 17.2808L14.0739 11.7565Z" fill="white"/>\n</svg>\n';var verdocsSearchBoxCss='verdocs-search-box{font-family:"Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif}verdocs-search-box form{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;height:45px;-webkit-box-sizing:border-box;box-sizing:border-box;margin:5px 0 0;border-radius:5px;-ms-flex-align:center;align-items:center;background-color:#fff;padding:0 8px;border-width:1px;border-style:solid;border-color:var(--verdocs-container-border-color)}verdocs-search-box form input{-webkit-box-sizing:border-box;box-sizing:border-box;height:43px;width:100%;font-size:18px;border:none}verdocs-search-box form input:focus{outline:none}verdocs-search-box form button.search{cursor:pointer;display:-ms-inline-flexbox;display:inline-flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;-webkit-box-sizing:border-box;box-sizing:border-box;border-radius:4px;border:none;width:100px;height:28px;font-weight:700;font-size:10px;letter-spacing:1px;background-color:#50be80;text-transform:uppercase;color:#fff}verdocs-search-box form .type{background-color:#707ae5;height:30px;display:-ms-inline-flexbox;display:inline-flex;padding:1px 0 2px 10px;font-size:13px;line-height:16px;border-radius:4px;-ms-flex-pack:center;justify-content:center;text-transform:uppercase;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;color:#fff;margin-right:10px}verdocs-search-box form .type button{border:none;color:#fff;margin:5px 0 0 8px;background:transparent}verdocs-search-box form svg{width:12px;height:12px;margin-right:6px}verdocs-search-box ::-webkit-input-placeholder{color:#aeb4bf}verdocs-search-box ::-moz-placeholder{color:#aeb4bf}verdocs-search-box :-ms-input-placeholder{color:#aeb4bf}verdocs-search-box ::-ms-input-placeholder{color:#aeb4bf}verdocs-search-box ::placeholder{color:#aeb4bf}';var VerdocsSearchBox=function(){function e(e){registerInstance(this,e);this.searchClicked=createEvent(this,"searchClicked",7);this.typeChanged=createEvent(this,"typeChanged",7);this.queryChanged=createEvent(this,"queryChanged",7);this.placeholder="search documents, templates, people...";this.type="all";this.query=""}e.prototype.handleSearch=function(e){this.searchClicked.emit({type:this.type,query:this.query});e.preventDefault();return false};e.prototype.handleChange=function(e){this.queryChanged.emit(e.target.value)};e.prototype.handleClearFilter=function(){this.typeChanged.emit("all")};e.prototype.handleKeyUp=function(e){if(e.key==="Enter"){this.searchClicked.emit({type:this.type,query:this.query})}};e.prototype.render=function(){var e=this;return h("form",{onSubmit:function(t){return e.handleSearch(t)}},this.type!==undefined&&this.type!=="all"&&h("span",{class:"type"},this.type,"s ",h("button",{class:"remove",innerHTML:CloseIcon,onClick:function(){return e.handleClearFilter()}})),h("input",{type:"text",placeholder:this.placeholder,value:this.query,onInput:function(t){return e.handleChange(t)},onKeyUp:function(t){return e.handleKeyUp(t)}}),h("button",{onClick:function(t){return e.handleSearch(t)},class:"search"},h("span",{innerHTML:SearchIcon}),"Search"))};return e}();VerdocsSearchBox.style=verdocsSearchBoxCss;export{VerdocsSearchActivity as verdocs_search_activity,VerdocsSearchBox as verdocs_search_box};
|
|
1
|
+
import{r as registerInstance,c as createEvent,h}from"./index-859bc689.js";import{l as loadSession}from"./Auth-15cd42a8.js";import{a as getEndpoint}from"./Token-ce37bd9d.js";import"./buffer-es6-136673c8.js";var __awaiter=undefined&&undefined.__awaiter||function(e,t,r,n){function i(e){return e instanceof r?e:new r((function(t){t(e)}))}return new(r||(r=Promise))((function(r,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n["throw"](e))}catch(e){o(e)}}function c(e){e.done?r(e.value):i(e.value).then(s,a)}c((n=n.apply(e,t||[])).next())}))};var __generator=undefined&&undefined.__generator||function(e,t){var r={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,i,o,s;return s={next:a(0),throw:a(1),return:a(2)},typeof Symbol==="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(e){return function(t){return c([e,t])}}function c(s){if(n)throw new TypeError("Generator is already executing.");while(r)try{if(n=1,i&&(o=s[0]&2?i["return"]:s[0]?i["throw"]||((o=i["return"])&&o.call(i),0):i.next)&&!(o=o.call(i,s[1])).done)return o;if(i=0,o)s=[s[0]&2,o.value];switch(s[0]){case 0:case 1:o=s;break;case 4:r.label++;return{value:s[1],done:false};case 5:r.label++;i=s[1];s=[0];continue;case 7:s=r.ops.pop();r.trys.pop();continue;default:if(!(o=r.trys,o=o.length>0&&o[o.length-1])&&(s[0]===6||s[0]===2)){r=0;continue}if(s[0]===3&&(!o||s[1]>o[0]&&s[1]<o[3])){r.label=s[1];break}if(s[0]===6&&r.label<o[1]){r.label=o[1];o=s;break}if(o&&r.label<o[2]){r.label=o[2];r.ops.push(s);break}if(o[2])r.ops.pop();r.trys.pop();continue}s=t.call(e,r)}catch(e){s=[6,e];i=0}finally{n=o=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:true}}};var getSearchHistory=function(){return __awaiter(void 0,void 0,void 0,(function(){return __generator(this,(function(e){return[2,getEndpoint().api.get("/search/history").then((function(e){return e.data}))]}))}))};var getTemplates=function(e){return getEndpoint().api.get("/templates/",{params:e}).then((function(e){return e.data}))};var DocumentIcon='<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="#000000"><path d="M0 0h24v24H0V0z" fill="none"/><path d="M8 16h8v2H8zm0-4h8v2H8zm6-10H6c-1.1 0-2 .9-2 2v16c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8l-6-6zm4 18H6V4h7v5h5v11z"/></svg>';var verdocsSearchActivityCss='verdocs-search-activity{font-family:"Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif}verdocs-search-activity .container{display:-ms-flexbox;display:flex;width:240px;color:#ffffff;-ms-flex-direction:column;flex-direction:column;text-transform:uppercase;padding:10px 10px 20px 10px;background-color:var(--verdocs-background-dark)}verdocs-search-activity .title{font-size:22px;font-weight:700;line-height:30px}verdocs-search-activity .items{display:-ms-flexbox;display:flex;margin-top:20px;-ms-flex-direction:column;flex-direction:column}verdocs-search-activity .item{border:none;display:-ms-flexbox;display:flex;text-align:left;margin-bottom:20px;-ms-flex-direction:row;flex-direction:row;background:transparent}verdocs-search-activity .item:hover{cursor:pointer}verdocs-search-activity .icon{-ms-flex:0 0 22px;flex:0 0 22px;margin-right:14px}verdocs-search-activity .icon svg{fill:#707ae5;width:22px;height:22px}verdocs-search-activity .details{display:-ms-flexbox;display:flex;overflow:hidden;-ms-flex-direction:column;flex-direction:column}verdocs-search-activity .item-title{font-size:16px;font-weight:400;color:#ffffff;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}verdocs-search-activity .info{font-size:14px;font-weight:500;line-height:23px;color:#aeb4bf}verdocs-search-activity .empty{text-transform:none;line-height:22px;color:#ccc}';var SOURCE="verdocs-stage";var VerdocsSearchActivity=function(){function e(e){registerInstance(this,e);this.entrySelected=createEvent(this,"entrySelected",7);this.type="recent";this.emptyMessage="You do not have any starred searches.";this.authFailure=false;this.title="Recent Searches";this.recent=[];this.saved=[];this.starred=[]}e.prototype.componentWillLoad=function(){var e=this;loadSession(SOURCE);var t=function(t){var r;console.warn("[Verdocs/search-activity] Error getting search data",t);if(((r=t===null||t===void 0?void 0:t.response)===null||r===void 0?void 0:r.status)===401){e.authFailure=true}};switch(this.type){case"recent":this.title="Recent Searches";this.emptyMessage="You do not have any recent searches.";getSearchHistory().then((function(t){return e.recent=t.recent})).catch(t);break;case"saved":this.title="Saved Searches";this.emptyMessage="You do not have any saved searches.";getSearchHistory().then((function(t){return e.saved=t.saved})).catch(t);break;case"starred":this.title="My Starred items";this.emptyMessage="You do not have any starred templates.";getTemplates({is_starred:true}).then((function(t){return e.starred=t})).catch(t);break}};e.prototype.handleSelectEntry=function(e){this.entrySelected.emit(e)};e.prototype.computePagesText=function(e){if(e<2){return"".concat(e," Page")}else{return"".concat(e," Pages")}};e.prototype.computeRecipientsText=function(e){if(typeof e==="object"){return e.join(", ")}else if(e>1){return"".concat(e," Recipients")}else{return"".concat(e," Recipient")}};e.prototype.render=function(){var e=this;var t=this.recent.length<1&&this.saved.length<1&&this.starred.length<1;return h("div",{class:"container"},h("p",{class:"title"},this.title),h("div",{class:"items"},this.recent.map((function(t){return h("button",{class:"item",onClick:function(){return e.handleSelectEntry(t)}},h("div",{class:"icon",innerHTML:DocumentIcon}),h("div",{class:"details"},h("div",{class:"item-title"},t.params.q),h("div",{class:"info"},"Test")))})),this.saved.map((function(t){return h("button",{class:"item",onClick:function(){return e.handleSelectEntry(t)}},h("div",{class:"icon",innerHTML:DocumentIcon}),h("div",{class:"details"},h("div",{class:"item-title"},t.params.q),h("div",{class:"info"})))})),t&&h("div",{class:"empty"},this.authFailure?"Authentication required":this.emptyMessage)))};return e}();VerdocsSearchActivity.style=verdocsSearchActivityCss;var SearchIcon='<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M23.4809 20.7176L17.9111 15.2536C19.0961 13.6368 19.727 11.6926 19.7128 9.70131C19.7201 7.53345 18.9846 5.42606 17.6244 3.71753C16.2642 2.009 14.3581 0.798456 12.2123 0.280282C10.0665 -0.237892 7.80552 -0.0336342 5.79227 0.86026C3.77902 1.75415 2.13038 3.28582 1.1111 5.20931C0.0918114 7.1328 -0.238985 9.33652 0.171813 11.4666C0.582612 13.5967 1.71117 15.5296 3.37628 16.9548C5.0414 18.3801 7.14646 19.2151 9.35344 19.3257C11.5604 19.4364 13.7413 18.8162 15.5458 17.5649L21.1372 23.05L21.1563 23.0663C21.4841 23.3487 21.9039 23.507 22.3401 23.5128C22.7823 23.5125 23.2063 23.3402 23.5191 23.0337V23.0337C23.6749 22.8812 23.7979 22.6995 23.8804 22.4993C23.963 22.2991 24.0036 22.0847 23.9997 21.8688C23.9959 21.6529 23.9477 21.44 23.858 21.2428C23.7683 21.0456 23.639 20.8682 23.4778 20.7212L23.4809 20.7176ZM14.5167 14.1975C13.4564 15.2349 12.0623 15.8797 10.5719 16.022C9.08145 16.1644 7.58681 15.7955 6.34249 14.9781C5.09816 14.1608 4.18109 12.9456 3.74751 11.5395C3.31393 10.1334 3.39064 8.6233 3.96455 7.26643C4.53846 5.90955 5.57409 4.7898 6.89507 4.09787C8.21606 3.40594 9.74071 3.18461 11.2093 3.4716C12.678 3.75858 13.9998 4.53612 14.9497 5.6718C15.8996 6.80748 16.4188 8.23105 16.4189 9.7001C16.4196 10.5357 16.2519 11.3632 15.9254 12.135C15.599 12.9069 15.1202 13.6078 14.5167 14.1975V14.1975Z" fill="white"/>\n</svg>\n';var CloseIcon='<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M14.0739 11.7565L19.7127 6.23228C20.0875 5.85692 20.0875 5.25309 19.7127 4.87773L19.0213 4.20046C18.6382 3.82511 18.0219 3.82511 17.6387 4.20046L12 9.72472L6.36127 4.20046C5.97814 3.82511 5.36179 3.82511 4.97866 4.20046L4.28735 4.87773C3.90422 5.25309 3.90422 5.85692 4.28735 6.23228L9.92608 11.7565L4.28735 17.2808C3.90422 17.6561 3.90422 18.26 4.28735 18.6353L4.97866 19.3126C5.36179 19.688 5.97814 19.688 6.36127 19.3126L12 13.7883L17.6387 19.3126C18.0219 19.688 18.6382 19.688 19.0213 19.3126L19.7127 18.6353C20.0958 18.26 20.0958 17.6561 19.7127 17.2808L14.0739 11.7565Z" fill="white"/>\n</svg>\n';var verdocsSearchBoxCss='verdocs-search-box{font-family:"Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif}verdocs-search-box form{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;height:45px;-webkit-box-sizing:border-box;box-sizing:border-box;margin:5px 0 0;border-radius:5px;-ms-flex-align:center;align-items:center;background-color:#fff;padding:0 8px;border-width:1px;border-style:solid;border-color:var(--verdocs-container-border-color)}verdocs-search-box form input{-webkit-box-sizing:border-box;box-sizing:border-box;height:43px;width:100%;font-size:18px;border:none}verdocs-search-box form input:focus{outline:none}verdocs-search-box form button.search{cursor:pointer;display:-ms-inline-flexbox;display:inline-flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;-webkit-box-sizing:border-box;box-sizing:border-box;border-radius:4px;border:none;width:100px;height:28px;font-weight:700;font-size:10px;letter-spacing:1px;background-color:#50be80;text-transform:uppercase;color:#fff}verdocs-search-box form .type{background-color:#707ae5;height:30px;display:-ms-inline-flexbox;display:inline-flex;padding:1px 0 2px 10px;font-size:13px;line-height:16px;border-radius:4px;-ms-flex-pack:center;justify-content:center;text-transform:uppercase;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;color:#fff;margin-right:10px}verdocs-search-box form .type button{border:none;color:#fff;margin:5px 0 0 8px;background:transparent}verdocs-search-box form svg{width:12px;height:12px;margin-right:6px}verdocs-search-box ::-webkit-input-placeholder{color:#aeb4bf}verdocs-search-box ::-moz-placeholder{color:#aeb4bf}verdocs-search-box :-ms-input-placeholder{color:#aeb4bf}verdocs-search-box ::-ms-input-placeholder{color:#aeb4bf}verdocs-search-box ::placeholder{color:#aeb4bf}';var VerdocsSearchBox=function(){function e(e){registerInstance(this,e);this.searchClicked=createEvent(this,"searchClicked",7);this.typeChanged=createEvent(this,"typeChanged",7);this.queryChanged=createEvent(this,"queryChanged",7);this.placeholder="search documents, templates, people...";this.type="all";this.query=""}e.prototype.handleSearch=function(e){this.searchClicked.emit({type:this.type,query:this.query});e.preventDefault();return false};e.prototype.handleChange=function(e){this.queryChanged.emit(e.target.value)};e.prototype.handleClearFilter=function(){this.typeChanged.emit("all")};e.prototype.handleKeyUp=function(e){if(e.key==="Enter"){this.searchClicked.emit({type:this.type,query:this.query})}};e.prototype.render=function(){var e=this;return h("form",{onSubmit:function(t){return e.handleSearch(t)}},this.type!==undefined&&this.type!=="all"&&h("span",{class:"type"},this.type,"s ",h("button",{class:"remove",innerHTML:CloseIcon,onClick:function(){return e.handleClearFilter()}})),h("input",{type:"text",placeholder:this.placeholder,value:this.query,onInput:function(t){return e.handleChange(t)},onKeyUp:function(t){return e.handleKeyUp(t)}}),h("button",{onClick:function(t){return e.handleSearch(t)},class:"search"},h("span",{innerHTML:SearchIcon}),"Search"))};return e}();VerdocsSearchBox.style=verdocsSearchBoxCss;export{VerdocsSearchActivity as verdocs_search_activity,VerdocsSearchBox as verdocs_search_box};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var __awaiter=this&&this.__awaiter||function(e,t,n,o){function i(e){return e instanceof n?e:new n((function(t){t(e)}))}return new(n||(n=Promise))((function(n,r){function a(e){try{s(o.next(e))}catch(e){r(e)}}function c(e){try{s(o["throw"](e))}catch(e){r(e)}}function s(e){e.done?n(e.value):i(e.value).then(a,c)}s((o=o.apply(e,t||[])).next())}))};var __generator=this&&this.__generator||function(e,t){var n={label:0,sent:function(){if(r[0]&1)throw r[1];return r[1]},trys:[],ops:[]},o,i,r,a;return a={next:c(0),throw:c(1),return:c(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function c(e){return function(t){return s([e,t])}}function s(a){if(o)throw new TypeError("Generator is already executing.");while(n)try{if(o=1,i&&(r=a[0]&2?i["return"]:a[0]?i["throw"]||((r=i["return"])&&r.call(i),0):i.next)&&!(r=r.call(i,a[1])).done)return r;if(i=0,r)a=[a[0]&2,r.value];switch(a[0]){case 0:case 1:r=a;break;case 4:n.label++;return{value:a[1],done:false};case 5:n.label++;i=a[1];a=[0];continue;case 7:a=n.ops.pop();n.trys.pop();continue;default:if(!(r=n.trys,r=r.length>0&&r[r.length-1])&&(a[0]===6||a[0]===2)){n=0;continue}if(a[0]===3&&(!r||a[1]>r[0]&&a[1]<r[3])){n.label=a[1];break}if(a[0]===6&&n.label<r[1]){n.label=r[1];r=a;break}if(r&&n.label<r[2]){n.label=r[2];n.ops.push(a);break}if(r[2])n.ops.pop();n.trys.pop();continue}a=t.call(e,n)}catch(e){a=[6,e];i=0}finally{o=r=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}};import{r as registerInstance,h,H as Host}from"./index-859bc689.js";import{g as getEndpoint,d as decodeAccessTokenBody,V as VerdocsEndpoint,s as setActiveEndpoint}from"./Token-a587e3ad.js";import{B as Buffer}from"./buffer-es6-136673c8.js";function getRGBA(e){switch(e%10){case 0:return e===0?"rgba(255, 193, 7, 0.4)":"rgba(134, 134, 134, 0.3)";case 1:return"rgba(156, 39, 176, .4)";case 2:return"rgba(33, 150, 243, .4)";case 3:return"rgba(220, 231, 117, 0.3)";case 4:return"rgba(121, 134, 203, 0.3)";case 5:return"rgba(77, 182, 172, 0.3)";case 6:return"rgba(255, 202, 165, 0.3)";case 7:return"rgba(2, 247, 190, 0.3)";case 8:return"rgba(255, 138, 101, 0.3)";case 9:return"rgba(82, 255, 79, 0.3)";default:return"rgba(229, 115, 155, 0.3)"}}function rescale(e,t){return e*t}var __assign=undefined&&undefined.__assign||function(){__assign=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++){t=arguments[n];for(var i in t)if(Object.prototype.hasOwnProperty.call(t,i))e[i]=t[i]}return e};return __assign.apply(this,arguments)};var __awaiter$1=undefined&&undefined.__awaiter||function(e,t,n,o){function i(e){return e instanceof n?e:new n((function(t){t(e)}))}return new(n||(n=Promise))((function(n,r){function a(e){try{s(o.next(e))}catch(e){r(e)}}function c(e){try{s(o["throw"](e))}catch(e){r(e)}}function s(e){e.done?n(e.value):i(e.value).then(a,c)}s((o=o.apply(e,t||[])).next())}))};var __generator$1=undefined&&undefined.__generator||function(e,t){var n={label:0,sent:function(){if(r[0]&1)throw r[1];return r[1]},trys:[],ops:[]},o,i,r,a;return a={next:c(0),throw:c(1),return:c(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function c(e){return function(t){return s([e,t])}}function s(a){if(o)throw new TypeError("Generator is already executing.");while(n)try{if(o=1,i&&(r=a[0]&2?i["return"]:a[0]?i["throw"]||((r=i["return"])&&r.call(i),0):i.next)&&!(r=r.call(i,a[1])).done)return r;if(i=0,r)a=[a[0]&2,r.value];switch(a[0]){case 0:case 1:r=a;break;case 4:n.label++;return{value:a[1],done:false};case 5:n.label++;i=a[1];a=[0];continue;case 7:a=n.ops.pop();n.trys.pop();continue;default:if(!(r=n.trys,r=r.length>0&&r[r.length-1])&&(a[0]===6||a[0]===2)){n=0;continue}if(a[0]===3&&(!r||a[1]>r[0]&&a[1]<r[3])){n.label=a[1];break}if(a[0]===6&&n.label<r[1]){n.label=r[1];r=a;break}if(r&&n.label<r[2]){n.label=r[2];n.ops.push(a);break}if(r[2])n.ops.pop();n.trys.pop();continue}a=t.call(e,n)}catch(e){a=[6,e];i=0}finally{o=r=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}};var updateRecipientStatus=function(e,t,n,o){return __awaiter$1(void 0,void 0,void 0,(function(){return __generator$1(this,(function(i){return[2,getEndpoint().api.put("/documents/".concat(e,"/recipients/").concat(t),__assign({role_name:t,action:n},o||{})).then((function(e){return e.data}))]}))}))};var e164Regex=new RegExp(/\+[1-9]\d{6,14}/g);function simpleE164Validator(e){return e!==null&&e.length<16&&e.length>6&&e164Regex.test(e)||e===""||e===null}var EmailRegEx=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;var isValidEmail=function(e){return EmailRegEx.test(e)};var isValidPhone=function(e){return simpleE164Validator(e)};var __awaiter=undefined&&undefined.__awaiter||function(e,t,n,o){function i(e){return e instanceof n?e:new n((function(t){t(e)}))}return new(n||(n=Promise))((function(n,r){function a(e){try{s(o.next(e))}catch(e){r(e)}}function c(e){try{s(o["throw"](e))}catch(e){r(e)}}function s(e){e.done?n(e.value):i(e.value).then(a,c)}s((o=o.apply(e,t||[])).next())}))};var __generator=undefined&&undefined.__generator||function(e,t){var n={label:0,sent:function(){if(r[0]&1)throw r[1];return r[1]},trys:[],ops:[]},o,i,r,a;return a={next:c(0),throw:c(1),return:c(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function c(e){return function(t){return s([e,t])}}function s(a){if(o)throw new TypeError("Generator is already executing.");while(n)try{if(o=1,i&&(r=a[0]&2?i["return"]:a[0]?i["throw"]||((r=i["return"])&&r.call(i),0):i.next)&&!(r=r.call(i,a[1])).done)return r;if(i=0,r)a=[a[0]&2,r.value];switch(a[0]){case 0:case 1:r=a;break;case 4:n.label++;return{value:a[1],done:false};case 5:n.label++;i=a[1];a=[0];continue;case 7:a=n.ops.pop();n.trys.pop();continue;default:if(!(r=n.trys,r=r.length>0&&r[r.length-1])&&(a[0]===6||a[0]===2)){n=0;continue}if(a[0]===3&&(!r||a[1]>r[0]&&a[1]<r[3])){n.label=a[1];break}if(a[0]===6&&n.label<r[1]){n.label=r[1];r=a;break}if(r&&n.label<r[2]){n.label=r[2];n.ops.push(a);break}if(r[2])n.ops.pop();n.trys.pop();continue}a=t.call(e,n)}catch(e){a=[6,e];i=0}finally{o=r=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}};var getSigningSession=function(e){return __awaiter(void 0,void 0,void 0,(function(){return __generator(this,(function(t){return[2,getEndpoint().api.get("/documents/".concat(e.documentId,"/recipients/").concat(encodeURIComponent(e.roleId),"/invitation/").concat(e.inviteCode)).then((function(e){var t,n;var o=((t=e.headers)===null||t===void 0?void 0:t.signer_token)||"";var i=decodeAccessTokenBody(o);getEndpoint().setAuthorization((n=e.headers)===null||n===void 0?void 0:n.signer_token);return{recipient:e.data,session:i,signerToken:o}}))]}))}))};var getDocument=function(e){return __awaiter(void 0,void 0,void 0,(function(){return __generator(this,(function(t){return[2,getEndpoint().api.get("/documents/".concat(e)).then((function(e){return e.data}))]}))}))};var getDocumentFile=function(e,t){return __awaiter(void 0,void 0,void 0,(function(){return __generator(this,(function(n){return[2,getEndpoint().api.get("/documents/".concat(e,"/envelope_documents/").concat(t,"?file=true"),{responseType:"arraybuffer"}).then((function(e){return Buffer.from(e.data,"binary").toString("base64")}))]}))}))};var updateDocumentField=function(e,t,n){return __awaiter(void 0,void 0,void 0,(function(){return __generator(this,(function(o){return[2,getEndpoint().api.put("/documents/".concat(e,"/fields/").concat(t),n).then((function(e){return e.data}))]}))}))};var verdocsSignCss='verdocs-sign{font-family:"Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif;position:relative;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;min-height:600px;-webkit-box-sizing:border-box;box-sizing:border-box;overflow:hidden}verdocs-sign.storybook{max-height:600px}verdocs-sign div{-webkit-box-sizing:border-box;box-sizing:border-box}verdocs-sign .header{-ms-flex:0 0 115px;flex:0 0 115px;z-index:1000;background-color:#33354c;-webkit-box-shadow:0 4px 4px 0 rgba(0, 0, 0, 0.24), 0 0 4px 0 rgba(0, 0, 0, 0.12);box-shadow:0 4px 4px 0 rgba(0, 0, 0, 0.24), 0 0 4px 0 rgba(0, 0, 0, 0.12);-webkit-transition:all 0.25s;transition:all 0.25s}verdocs-sign .intro{background-color:#ffffff;width:100%;margin:0 auto;padding:20px;max-width:1028px;color:rgba(0, 0, 0, 0.87)}verdocs-sign .toolbar{width:100%;margin:0 auto;padding:0 20px;max-width:1028px;position:relative}verdocs-sign .tools{width:100%;color:#fff;height:56px;padding:4px;display:-ms-flexbox;display:flex;font-size:12px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;background-color:#33354c}verdocs-sign .cover{top:0;left:0;right:0;bottom:0;z-index:999;position:absolute;background:rgba(0, 0, 0, 0.5)}verdocs-sign .document{-ms-flex:1;flex:1;height:100%;position:relative;overflow-y:scroll}verdocs-sign .agree-checkbox{-ms-flex:0 0 20px;flex:0 0 20px;display:-ms-flexbox;display:flex;width:20px;height:20px;border-radius:3px;background:#ffffff;position:relative;margin:0 10px 0 30px}verdocs-sign .agree-checkbox label{left:2px;top:2px;width:16px;height:16px;cursor:pointer;position:absolute;background:#33354c;-webkit-box-shadow:inset 0 -1px 1px rgba(255, 255, 255, 0.8);box-shadow:inset 0 -1px 1px rgba(255, 255, 255, 0.8)}verdocs-sign .agree-checkbox label:after{top:2px;left:3px;width:8px;opacity:0;height:5px;content:"";position:absolute;background:transparent;filter:alpha(opacity=0);-webkit-transform:rotate(-45deg);transform:rotate(-45deg);border:2px solid #fcfff4;border-top:none;border-right:none}verdocs-sign .agree-checkbox label:hover::after{filter:alpha(opacity=30);opacity:0.3}verdocs-sign .agree-checkbox input[type=checkbox]:checked+label:after{filter:alpha(opacity=100);opacity:1}verdocs-sign.agreed .intro{display:none}verdocs-sign.agreed .header{-ms-flex:0 0 56px;flex:0 0 56px}verdocs-sign.agreed .agree-checkbox{background:#ccc}verdocs-sign.agreed .agree-checkbox label{cursor:default}verdocs-sign .page-controls{position:absolute;left:50%;-webkit-transform:translateX(-50%);transform:translateX(-50%);z-index:500}';var BASE_URL="https://stage-api.verdocs.com";var VerdocsSign=function(){function e(e){registerInstance(this,e);this.documentid=null;this.roleid=null;this.invitecode=null;this.endpoint=null;this.recipient=null;this.signerToken=null;this.pdfUrl=null;this.recipientIndex=-1;this.document=null;this.fields=[];this.hasSignature=false;this.nextButtonLabel="Start";this.focusedField=""}e.prototype.componentWillLoad=function(){var e=(new VerdocsEndpoint).setBaseURL(BASE_URL);setActiveEndpoint(e)};e.prototype.componentDidLoad=function(){return __awaiter(this,void 0,void 0,(function(){var e,t,n,o,i,r;var a=this;return __generator(this,(function(c){switch(c.label){case 0:c.trys.push([0,3,,4]);console.log("[SIGN] Processing invite code",this.documentid,this.roleid,this.invitecode);return[4,getSigningSession({documentId:this.documentid,roleId:this.roleid,inviteCode:this.invitecode})];case 1:e=c.sent(),t=e.session,n=e.recipient,o=e.signerToken;console.log("[SIGN] Got signing session",t);console.log("[SIGN] Recipient",n);this.recipient=n;this.signerToken=o;getEndpoint().setSigningAuthorization(o);if(this.recipient.agreed){this.nextButtonLabel="Next"}return[4,getDocument(this.documentid)];case 2:i=c.sent();this.document=i;console.log("[SIGN] Document",i);this.pdfUrl="".concat(BASE_URL,"/documents/").concat(this.documentid,"/envelope_documents/").concat(i.envelope_document_id,"?file=true");this.recipientIndex=this.document.recipients.findIndex((function(e){return e.role_name==a.roleid}));if(this.recipientIndex>-1){console.log("Found recipient",this.document.recipients[this.recipientIndex])}this.fields=this.document.fields.filter((function(e){return e.recipient_role===a.roleid}));console.log("Loaded fields",this.fields);return[3,4];case 3:r=c.sent();console.log("Error with signing session",r);return[3,4];case 4:return[2]}}))}))};e.prototype.handleClickAgree=function(){var e=this;console.log("agree clicked");updateRecipientStatus(this.documentid,this.roleid,"update",{agreed:true}).then((function(t){console.log("update result",t);e.nextButtonLabel="Next";e.recipient=t})).catch((function(e){console.log("update failure",e)}))};e.prototype.savePDF=function(){return __awaiter(this,void 0,void 0,(function(){var e,t,n,o;return __generator(this,(function(i){switch(i.label){case 0:e="".concat(this.document.name," - ").concat(this.document.updated_at.split("T")[0],".pdf");return[4,getDocumentFile(this.documentid,this.document.envelope_document_id)];case 1:t=i.sent();n=new XMLHttpRequest;n.responseType="blob";n.onload=function(){var t=document.createElement("a");t.href=window.URL.createObjectURL(n.response);t.download=e;t.style.display="none";document.body.appendChild(t);t.click();t.remove()};o="data:application/pdf;base64,".concat(t);console.log("url",o.length,o);n.open("GET","data:application/pdf;base64,".concat(t));n.send();return[2]}}))}))};e.prototype.handleOptionSelected=function(e){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){switch(e.detail.id){case"later":if(!(window===null||window===void 0?void 0:window["STORYBOOK_ENV"])){window.alert("User intends to sign later.")}break;case"claim":break;case"decline":break;case"print":break;case"download":this.savePDF().catch((function(){}));break}return[2]}))}))};e.prototype.handleFieldChange=function(e,t,n){return __awaiter(this,void 0,void 0,(function(){var o;return __generator(this,(function(i){console.log("fieldChange",e,t.detail);switch(e.type){case"textbox":updateDocumentField(this.documentid,e.name,{prepared:false,value:t.detail}).then((function(e){return console.log("Update result",e)})).catch((function(e){return console.log("Error updating",e)}));break;case"checkbox_group":updateDocumentField(this.documentid,e.name,{prepared:false,value:{options:[{id:n,checked:t.detail}]}}).then((function(e){return console.log("Update result",e)})).catch((function(e){return console.log("Error updating",e)}));break;case"radio_button_group":o=e.settings.options.map((function(e){return{id:e.id,selected:n===e.id}}));updateDocumentField(this.documentid,e.name,{prepared:false,value:{options:o}}).then((function(e){return console.log("Update result",e)})).catch((function(e){return console.log("Error updating",e)}));break;case"dropdown":updateDocumentField(this.documentid,e.name,{prepared:false,value:t.detail}).then((function(e){return console.log("Update result",e)})).catch((function(e){return console.log("Error updating",e)}));break;case"initial":console.log("Got initial",t.detail);break;case"signature":console.log("Got signature",t.detail);break}return[2]}))}))};e.prototype.renderCheckboxGroupOption=function(e,t,n,o){var i=this;var r=rescale(e.xRatio,n.x);var a=rescale(e.yRatio,n.y);var c={left:"".concat(r,"px"),bottom:"".concat(a,"px"),position:"absolute",transform:"scale(".concat(e.xRatio,", ").concat(e.yRatio,")"),backgroundColor:getRGBA(this.recipientIndex)};return h("verdocs-field-checkbox",{style:c,order:o,value:n.checked,onFieldChange:function(e){return i.handleFieldChange(t,e,n.id)}})};e.prototype.renderRadioGroupOption=function(e,t,n,o){var i=this;var r=rescale(e.xRatio,n.x);var a=rescale(e.yRatio,n.y);var c={left:"".concat(r,"px"),bottom:"".concat(a,"px"),position:"absolute",transform:"scale(".concat(e.xRatio,", ").concat(e.yRatio,")"),backgroundColor:getRGBA(this.recipientIndex)};return h("verdocs-field-radio-button",{style:c,order:o,value:n.id,name:t.name,checked:n.selected,onFieldChange:function(e){return i.handleFieldChange(t,e,n.id)}})};e.prototype.renderField=function(e,t){var n=this;var o=e.required,i=o===void 0?false:o,r=e.settings,a=r===void 0?{}:r;var c=a.x,s=c===void 0?0:c,d=a.y,l=d===void 0?0:d,u=a.base64,p=u===void 0?"":u,f=a.placeholder,g=f===void 0?"":f,v=a.options,b=v===void 0?[]:v,x=a.value,m=x===void 0?"":x,y=a.result,w=y===void 0?"":y;var _=this.pdfPageInfo.pages.find((function(t){return t.pageNumber===e.page}));if(!_){console.log("Unable to render invalid field",e);return h("div",{class:"invalid-field"},"Invalid field.")}var k=rescale(_.xRatio,s);var R=rescale(_.yRatio,l);var S={left:"".concat(k,"px"),bottom:"".concat(R,"px"),position:"absolute",transform:"scale(".concat(_.xRatio,", ").concat(_.yRatio,")"),backgroundColor:e.settings.rgba||getRGBA(this.recipientIndex)};if(e.settings.height){S.height="".concat(e.settings.height,"px")}if(e.settings.width){S.width="".concat(e.settings.width,"px")}console.log("rendering field",e.type,e);var E="field-".concat(e.name);switch(e.type){case"signature":return h("verdocs-field-signature",{style:S,value:p,required:i,id:E});case"initial":return h("verdocs-field-initial",{style:S,required:i,id:E});case"textbox":return h("verdocs-field-textbox",{style:S,order:t,value:w||"",placeholder:g,id:E,onFieldChange:function(t){return n.handleFieldChange(e,t)}});case"textarea":return h("verdocs-field-textarea",{style:S,placeholder:g||"",id:E});case"date":return h("verdocs-field-date",{style:S,order:t,value:w||"",placeholder:g,required:i,id:E});case"dropdown":return h("verdocs-field-dropdown",{style:S,options:b,value:m,required:i,id:E,onFieldChange:function(t){return n.handleFieldChange(e,t)}});case"checkbox":return h("verdocs-field-checkbox",{style:S,value:w||"",id:E});case"checkbox_group":return e.settings.options.map((function(t,o){return n.renderCheckboxGroupOption(_,e,t,o)}));case"radio_button_group":return e.settings.options.map((function(t,o){return n.renderRadioGroupOption(_,e,t,o)}));case"attachment":return h("verdocs-field-attachment",{style:S,value:w||"",id:E});case"payment":return h("verdocs-field-payment",{style:S,field:e,id:E});default:console.log("[SIGN] Skipping unsupported field type",e)}return h("div",{style:{display:"none"}},'Unsupported field type "',e.type,'"')};e.prototype.isFieldValid=function(e){var t,n,o,i,r,a,c,s,d,l,u,p;switch(e.type){case"textbox":switch(((t=e.settings)===null||t===void 0?void 0:t.validator)||""){case"email":return isValidEmail(((n=e.settings)===null||n===void 0?void 0:n.result)||"");case"phone":return isValidPhone(((o=e.settings)===null||o===void 0?void 0:o.result)||"");default:return!!((i=e.settings)===null||i===void 0?void 0:i.result)}case"signature":case"initial":case"textarea":case"date":case"attachment":return!!((r=e.settings)===null||r===void 0?void 0:r.result);case"dropdown":return!!((a=e.settings)===null||a===void 0?void 0:a.value);case"checkbox_group":var f=(((s=(c=e.settings)===null||c===void 0?void 0:c.options)===null||s===void 0?void 0:s.filter((function(e){return e.checked})))||[]).length;return f>=(((d=e.settings)===null||d===void 0?void 0:d.minimum_checked)||0)&&f<=(((l=e.settings)===null||l===void 0?void 0:l.maximum_checked)||999);case"radio_button_group":return(((p=(u=e.settings)===null||u===void 0?void 0:u.options)===null||p===void 0?void 0:p.filter((function(e){return e.selected})))||[]).length>0;default:return false}};e.prototype.handleDocumentRendered=function(e){console.log("[SIGN] Document rendered",e.detail);this.pdfPageInfo=e.detail};e.prototype.handleNext=function(){var e=this;var t=this.fields.filter((function(e){return e.required}));console.log("required Fields",t);var n=t.findIndex((function(t){return t.name===e.focusedField}));console.log("focused Index",n);var o=n+1;if(o>=t.length){o=0}var i=t[o];console.log("next required fielod",i);if(i){var r=document.getElementById("field-".concat(i.name));r===null||r===void 0?void 0:r.focusField();this.focusedField=i.name}};e.prototype.render=function(){var e=this;var t,n,o,i,r;var a=[{id:"later",label:"Finish Later"},{id:"claim",label:"Claim the Document",disabled:true},{id:"decline",label:"Decline to Sign"},{id:"print",label:"Print Without Signing"},{id:"download",label:"Download"}];return h(Host,{class:{storybook:!!(window===null||window===void 0?void 0:window["STORYBOOK_ENV"]),agreed:(t=this.recipient)===null||t===void 0?void 0:t.agreed}},h("div",{class:"header"},h("div",{class:"intro"},"Please review and act on these documents."),h("div",{class:"toolbar"},h("div",{class:"tools"},h("verdocs-dropdown",{options:a,onOptionSelected:function(t){return e.handleOptionSelected(t)}}),!((n=this.recipient)===null||n===void 0?void 0:n.agreed)?h("div",{style:{flex:"1",flexDirection:"row",display:"flex",alignItems:"center"}},h("div",{class:"agree-checkbox"},h("input",{type:"checkbox",value:"None",id:"agree-checkbox-element",name:"agree",onChange:function(){return e.handleClickAgree()}}),h("label",{htmlFor:"agree-checkbox-element"})),"I agree to use electronic records and signatures."):h("div",{style:{flex:"1"}}),h("verdocs-button",{label:this.nextButtonLabel,disabled:!((o=this.recipient)===null||o===void 0?void 0:o.agreed),onClick:function(){return e.handleNext()}})))),!((i=this.recipient)===null||i===void 0?void 0:i.agreed)?h("div",{class:"cover"}):h("div",{style:{display:"none"}}),h("div",{class:"document"},this.pdfUrl?h("verdocs-view",{source:this.pdfUrl,token:this.signerToken,onDocumentRendered:function(t){return e.handleDocumentRendered(t)}}):h("verdocs-loader",null),(((r=this.pdfPageInfo)===null||r===void 0?void 0:r.pages)||[]).map((function(t){var n;return h("div",{class:"page-controls",style:{height:"".concat(t.height,"px"),width:"".concat(t.width,"px"),top:"".concat(t.canvasTop,"px"),margin:"0 auto"}},((n=e.pdfPageInfo)===null||n===void 0?void 0:n.numRendered)>0?e.fields.filter((function(e){return e.page===t.pageNumber})).map((function(t,n){return e.renderField(t,n)})):h("div",{style:{display:"none"}},"Waiting for PDF to render..."))}))))};return e}();VerdocsSign.style=verdocsSignCss;export{VerdocsSign as verdocs_sign};
|
|
1
|
+
var __awaiter=this&&this.__awaiter||function(e,t,n,o){function i(e){return e instanceof n?e:new n((function(t){t(e)}))}return new(n||(n=Promise))((function(n,r){function a(e){try{s(o.next(e))}catch(e){r(e)}}function c(e){try{s(o["throw"](e))}catch(e){r(e)}}function s(e){e.done?n(e.value):i(e.value).then(a,c)}s((o=o.apply(e,t||[])).next())}))};var __generator=this&&this.__generator||function(e,t){var n={label:0,sent:function(){if(r[0]&1)throw r[1];return r[1]},trys:[],ops:[]},o,i,r,a;return a={next:c(0),throw:c(1),return:c(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function c(e){return function(t){return s([e,t])}}function s(a){if(o)throw new TypeError("Generator is already executing.");while(n)try{if(o=1,i&&(r=a[0]&2?i["return"]:a[0]?i["throw"]||((r=i["return"])&&r.call(i),0):i.next)&&!(r=r.call(i,a[1])).done)return r;if(i=0,r)a=[a[0]&2,r.value];switch(a[0]){case 0:case 1:r=a;break;case 4:n.label++;return{value:a[1],done:false};case 5:n.label++;i=a[1];a=[0];continue;case 7:a=n.ops.pop();n.trys.pop();continue;default:if(!(r=n.trys,r=r.length>0&&r[r.length-1])&&(a[0]===6||a[0]===2)){n=0;continue}if(a[0]===3&&(!r||a[1]>r[0]&&a[1]<r[3])){n.label=a[1];break}if(a[0]===6&&n.label<r[1]){n.label=r[1];r=a;break}if(r&&n.label<r[2]){n.label=r[2];n.ops.push(a);break}if(r[2])n.ops.pop();n.trys.pop();continue}a=t.call(e,n)}catch(e){a=[6,e];i=0}finally{o=r=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}};import{r as registerInstance,h,H as Host}from"./index-859bc689.js";import{a as getEndpoint,d as decodeAccessTokenBody,V as VerdocsEndpoint,s as setActiveEndpoint}from"./Token-ce37bd9d.js";import{B as Buffer}from"./buffer-es6-136673c8.js";function getRGBA(e){switch(e%10){case 0:return e===0?"rgba(255, 193, 7, 0.4)":"rgba(134, 134, 134, 0.3)";case 1:return"rgba(156, 39, 176, .4)";case 2:return"rgba(33, 150, 243, .4)";case 3:return"rgba(220, 231, 117, 0.3)";case 4:return"rgba(121, 134, 203, 0.3)";case 5:return"rgba(77, 182, 172, 0.3)";case 6:return"rgba(255, 202, 165, 0.3)";case 7:return"rgba(2, 247, 190, 0.3)";case 8:return"rgba(255, 138, 101, 0.3)";case 9:return"rgba(82, 255, 79, 0.3)";default:return"rgba(229, 115, 155, 0.3)"}}function rescale(e,t){return e*t}var __assign=undefined&&undefined.__assign||function(){__assign=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++){t=arguments[n];for(var i in t)if(Object.prototype.hasOwnProperty.call(t,i))e[i]=t[i]}return e};return __assign.apply(this,arguments)};var __awaiter$1=undefined&&undefined.__awaiter||function(e,t,n,o){function i(e){return e instanceof n?e:new n((function(t){t(e)}))}return new(n||(n=Promise))((function(n,r){function a(e){try{s(o.next(e))}catch(e){r(e)}}function c(e){try{s(o["throw"](e))}catch(e){r(e)}}function s(e){e.done?n(e.value):i(e.value).then(a,c)}s((o=o.apply(e,t||[])).next())}))};var __generator$1=undefined&&undefined.__generator||function(e,t){var n={label:0,sent:function(){if(r[0]&1)throw r[1];return r[1]},trys:[],ops:[]},o,i,r,a;return a={next:c(0),throw:c(1),return:c(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function c(e){return function(t){return s([e,t])}}function s(a){if(o)throw new TypeError("Generator is already executing.");while(n)try{if(o=1,i&&(r=a[0]&2?i["return"]:a[0]?i["throw"]||((r=i["return"])&&r.call(i),0):i.next)&&!(r=r.call(i,a[1])).done)return r;if(i=0,r)a=[a[0]&2,r.value];switch(a[0]){case 0:case 1:r=a;break;case 4:n.label++;return{value:a[1],done:false};case 5:n.label++;i=a[1];a=[0];continue;case 7:a=n.ops.pop();n.trys.pop();continue;default:if(!(r=n.trys,r=r.length>0&&r[r.length-1])&&(a[0]===6||a[0]===2)){n=0;continue}if(a[0]===3&&(!r||a[1]>r[0]&&a[1]<r[3])){n.label=a[1];break}if(a[0]===6&&n.label<r[1]){n.label=r[1];r=a;break}if(r&&n.label<r[2]){n.label=r[2];n.ops.push(a);break}if(r[2])n.ops.pop();n.trys.pop();continue}a=t.call(e,n)}catch(e){a=[6,e];i=0}finally{o=r=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}};var updateRecipientStatus=function(e,t,n,o){return __awaiter$1(void 0,void 0,void 0,(function(){return __generator$1(this,(function(i){return[2,getEndpoint().api.put("/documents/".concat(e,"/recipients/").concat(t),__assign({role_name:t,action:n},o||{})).then((function(e){return e.data}))]}))}))};var e164Regex=new RegExp(/\+[1-9]\d{6,14}/g);function simpleE164Validator(e){return e!==null&&e.length<16&&e.length>6&&e164Regex.test(e)||e===""||e===null}var EmailRegEx=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;var isValidEmail=function(e){return EmailRegEx.test(e)};var isValidPhone=function(e){return simpleE164Validator(e)};var __awaiter=undefined&&undefined.__awaiter||function(e,t,n,o){function i(e){return e instanceof n?e:new n((function(t){t(e)}))}return new(n||(n=Promise))((function(n,r){function a(e){try{s(o.next(e))}catch(e){r(e)}}function c(e){try{s(o["throw"](e))}catch(e){r(e)}}function s(e){e.done?n(e.value):i(e.value).then(a,c)}s((o=o.apply(e,t||[])).next())}))};var __generator=undefined&&undefined.__generator||function(e,t){var n={label:0,sent:function(){if(r[0]&1)throw r[1];return r[1]},trys:[],ops:[]},o,i,r,a;return a={next:c(0),throw:c(1),return:c(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function c(e){return function(t){return s([e,t])}}function s(a){if(o)throw new TypeError("Generator is already executing.");while(n)try{if(o=1,i&&(r=a[0]&2?i["return"]:a[0]?i["throw"]||((r=i["return"])&&r.call(i),0):i.next)&&!(r=r.call(i,a[1])).done)return r;if(i=0,r)a=[a[0]&2,r.value];switch(a[0]){case 0:case 1:r=a;break;case 4:n.label++;return{value:a[1],done:false};case 5:n.label++;i=a[1];a=[0];continue;case 7:a=n.ops.pop();n.trys.pop();continue;default:if(!(r=n.trys,r=r.length>0&&r[r.length-1])&&(a[0]===6||a[0]===2)){n=0;continue}if(a[0]===3&&(!r||a[1]>r[0]&&a[1]<r[3])){n.label=a[1];break}if(a[0]===6&&n.label<r[1]){n.label=r[1];r=a;break}if(r&&n.label<r[2]){n.label=r[2];n.ops.push(a);break}if(r[2])n.ops.pop();n.trys.pop();continue}a=t.call(e,n)}catch(e){a=[6,e];i=0}finally{o=r=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}};var getSigningSession=function(e){return __awaiter(void 0,void 0,void 0,(function(){return __generator(this,(function(t){return[2,getEndpoint().api.get("/documents/".concat(e.documentId,"/recipients/").concat(encodeURIComponent(e.roleId),"/invitation/").concat(e.inviteCode)).then((function(e){var t,n;var o=((t=e.headers)===null||t===void 0?void 0:t.signer_token)||"";var i=decodeAccessTokenBody(o);getEndpoint().setAuthorization((n=e.headers)===null||n===void 0?void 0:n.signer_token);return{recipient:e.data,session:i,signerToken:o}}))]}))}))};var getDocument=function(e){return __awaiter(void 0,void 0,void 0,(function(){return __generator(this,(function(t){return[2,getEndpoint().api.get("/documents/".concat(e)).then((function(e){return e.data}))]}))}))};var getDocumentFile=function(e,t){return __awaiter(void 0,void 0,void 0,(function(){return __generator(this,(function(n){return[2,getEndpoint().api.get("/documents/".concat(e,"/envelope_documents/").concat(t,"?file=true"),{responseType:"arraybuffer"}).then((function(e){return Buffer.from(e.data,"binary").toString("base64")}))]}))}))};var updateDocumentField=function(e,t,n){return __awaiter(void 0,void 0,void 0,(function(){return __generator(this,(function(o){return[2,getEndpoint().api.put("/documents/".concat(e,"/fields/").concat(t),n).then((function(e){return e.data}))]}))}))};var verdocsSignCss='verdocs-sign{font-family:"Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif;position:relative;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;min-height:600px;-webkit-box-sizing:border-box;box-sizing:border-box;overflow:hidden}verdocs-sign.storybook{max-height:600px}verdocs-sign div{-webkit-box-sizing:border-box;box-sizing:border-box}verdocs-sign .header{-ms-flex:0 0 115px;flex:0 0 115px;z-index:1000;background-color:#33354c;-webkit-box-shadow:0 4px 4px 0 rgba(0, 0, 0, 0.24), 0 0 4px 0 rgba(0, 0, 0, 0.12);box-shadow:0 4px 4px 0 rgba(0, 0, 0, 0.24), 0 0 4px 0 rgba(0, 0, 0, 0.12);-webkit-transition:all 0.25s;transition:all 0.25s}verdocs-sign .intro{background-color:#ffffff;width:100%;margin:0 auto;padding:20px;max-width:1028px;color:rgba(0, 0, 0, 0.87)}verdocs-sign .toolbar{width:100%;margin:0 auto;padding:0 20px;max-width:1028px;position:relative}verdocs-sign .tools{width:100%;color:#fff;height:56px;padding:4px;display:-ms-flexbox;display:flex;font-size:12px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;background-color:#33354c}verdocs-sign .cover{top:0;left:0;right:0;bottom:0;z-index:999;position:absolute;background:rgba(0, 0, 0, 0.5)}verdocs-sign .document{-ms-flex:1;flex:1;height:100%;position:relative;overflow-y:scroll}verdocs-sign .agree-checkbox{-ms-flex:0 0 20px;flex:0 0 20px;display:-ms-flexbox;display:flex;width:20px;height:20px;border-radius:3px;background:#ffffff;position:relative;margin:0 10px 0 30px}verdocs-sign .agree-checkbox label{left:2px;top:2px;width:16px;height:16px;cursor:pointer;position:absolute;background:#33354c;-webkit-box-shadow:inset 0 -1px 1px rgba(255, 255, 255, 0.8);box-shadow:inset 0 -1px 1px rgba(255, 255, 255, 0.8)}verdocs-sign .agree-checkbox label:after{top:2px;left:3px;width:8px;opacity:0;height:5px;content:"";position:absolute;background:transparent;filter:alpha(opacity=0);-webkit-transform:rotate(-45deg);transform:rotate(-45deg);border:2px solid #fcfff4;border-top:none;border-right:none}verdocs-sign .agree-checkbox label:hover::after{filter:alpha(opacity=30);opacity:0.3}verdocs-sign .agree-checkbox input[type=checkbox]:checked+label:after{filter:alpha(opacity=100);opacity:1}verdocs-sign.agreed .intro{display:none}verdocs-sign.agreed .header{-ms-flex:0 0 56px;flex:0 0 56px}verdocs-sign.agreed .agree-checkbox{background:#ccc}verdocs-sign.agreed .agree-checkbox label{cursor:default}verdocs-sign .page-controls{position:absolute;left:50%;-webkit-transform:translateX(-50%);transform:translateX(-50%);z-index:500}';var BASE_URL="https://stage-api.verdocs.com";var VerdocsSign=function(){function e(e){registerInstance(this,e);this.documentid=null;this.roleid=null;this.invitecode=null;this.endpoint=null;this.recipient=null;this.signerToken=null;this.pdfUrl=null;this.recipientIndex=-1;this.document=null;this.fields=[];this.hasSignature=false;this.nextButtonLabel="Start";this.focusedField=""}e.prototype.componentWillLoad=function(){var e=(new VerdocsEndpoint).setBaseURL(BASE_URL);setActiveEndpoint(e)};e.prototype.componentDidLoad=function(){return __awaiter(this,void 0,void 0,(function(){var e,t,n,o,i,r;var a=this;return __generator(this,(function(c){switch(c.label){case 0:c.trys.push([0,3,,4]);console.log("[SIGN] Processing invite code",this.documentid,this.roleid,this.invitecode);return[4,getSigningSession({documentId:this.documentid,roleId:this.roleid,inviteCode:this.invitecode})];case 1:e=c.sent(),t=e.session,n=e.recipient,o=e.signerToken;console.log("[SIGN] Got signing session",t);console.log("[SIGN] Recipient",n);this.recipient=n;this.signerToken=o;getEndpoint().setSigningAuthorization(o);if(this.recipient.agreed){this.nextButtonLabel="Next"}return[4,getDocument(this.documentid)];case 2:i=c.sent();this.document=i;console.log("[SIGN] Document",i);this.pdfUrl="".concat(BASE_URL,"/documents/").concat(this.documentid,"/envelope_documents/").concat(i.envelope_document_id,"?file=true");this.recipientIndex=this.document.recipients.findIndex((function(e){return e.role_name==a.roleid}));if(this.recipientIndex>-1){console.log("Found recipient",this.document.recipients[this.recipientIndex])}this.fields=this.document.fields.filter((function(e){return e.recipient_role===a.roleid}));console.log("Loaded fields",this.fields);return[3,4];case 3:r=c.sent();console.log("Error with signing session",r);return[3,4];case 4:return[2]}}))}))};e.prototype.handleClickAgree=function(){var e=this;console.log("agree clicked");updateRecipientStatus(this.documentid,this.roleid,"update",{agreed:true}).then((function(t){console.log("update result",t);e.nextButtonLabel="Next";e.recipient=t})).catch((function(e){console.log("update failure",e)}))};e.prototype.savePDF=function(){return __awaiter(this,void 0,void 0,(function(){var e,t,n,o;return __generator(this,(function(i){switch(i.label){case 0:e="".concat(this.document.name," - ").concat(this.document.updated_at.split("T")[0],".pdf");return[4,getDocumentFile(this.documentid,this.document.envelope_document_id)];case 1:t=i.sent();n=new XMLHttpRequest;n.responseType="blob";n.onload=function(){var t=document.createElement("a");t.href=window.URL.createObjectURL(n.response);t.download=e;t.style.display="none";document.body.appendChild(t);t.click();t.remove()};o="data:application/pdf;base64,".concat(t);console.log("url",o.length,o);n.open("GET","data:application/pdf;base64,".concat(t));n.send();return[2]}}))}))};e.prototype.handleOptionSelected=function(e){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){switch(e.detail.id){case"later":if(!(window===null||window===void 0?void 0:window["STORYBOOK_ENV"])){window.alert("User intends to sign later.")}break;case"claim":break;case"decline":break;case"print":break;case"download":this.savePDF().catch((function(){}));break}return[2]}))}))};e.prototype.handleFieldChange=function(e,t,n){return __awaiter(this,void 0,void 0,(function(){var o;return __generator(this,(function(i){console.log("fieldChange",e,t.detail);switch(e.type){case"textbox":updateDocumentField(this.documentid,e.name,{prepared:false,value:t.detail}).then((function(e){return console.log("Update result",e)})).catch((function(e){return console.log("Error updating",e)}));break;case"checkbox_group":updateDocumentField(this.documentid,e.name,{prepared:false,value:{options:[{id:n,checked:t.detail}]}}).then((function(e){return console.log("Update result",e)})).catch((function(e){return console.log("Error updating",e)}));break;case"radio_button_group":o=e.settings.options.map((function(e){return{id:e.id,selected:n===e.id}}));updateDocumentField(this.documentid,e.name,{prepared:false,value:{options:o}}).then((function(e){return console.log("Update result",e)})).catch((function(e){return console.log("Error updating",e)}));break;case"dropdown":updateDocumentField(this.documentid,e.name,{prepared:false,value:t.detail}).then((function(e){return console.log("Update result",e)})).catch((function(e){return console.log("Error updating",e)}));break;case"initial":console.log("Got initial",t.detail);break;case"signature":console.log("Got signature",t.detail);break}return[2]}))}))};e.prototype.renderCheckboxGroupOption=function(e,t,n,o){var i=this;var r=rescale(e.xRatio,n.x);var a=rescale(e.yRatio,n.y);var c={left:"".concat(r,"px"),bottom:"".concat(a,"px"),position:"absolute",transform:"scale(".concat(e.xRatio,", ").concat(e.yRatio,")"),backgroundColor:getRGBA(this.recipientIndex)};return h("verdocs-field-checkbox",{style:c,order:o,value:n.checked,onFieldChange:function(e){return i.handleFieldChange(t,e,n.id)}})};e.prototype.renderRadioGroupOption=function(e,t,n,o){var i=this;var r=rescale(e.xRatio,n.x);var a=rescale(e.yRatio,n.y);var c={left:"".concat(r,"px"),bottom:"".concat(a,"px"),position:"absolute",transform:"scale(".concat(e.xRatio,", ").concat(e.yRatio,")"),backgroundColor:getRGBA(this.recipientIndex)};return h("verdocs-field-radio-button",{style:c,order:o,value:n.id,name:t.name,checked:n.selected,onFieldChange:function(e){return i.handleFieldChange(t,e,n.id)}})};e.prototype.renderField=function(e,t){var n=this;var o=e.required,i=o===void 0?false:o,r=e.settings,a=r===void 0?{}:r;var c=a.x,s=c===void 0?0:c,d=a.y,l=d===void 0?0:d,u=a.base64,p=u===void 0?"":u,f=a.placeholder,g=f===void 0?"":f,v=a.options,b=v===void 0?[]:v,x=a.value,m=x===void 0?"":x,y=a.result,w=y===void 0?"":y;var _=this.pdfPageInfo.pages.find((function(t){return t.pageNumber===e.page}));if(!_){console.log("Unable to render invalid field",e);return h("div",{class:"invalid-field"},"Invalid field.")}var k=rescale(_.xRatio,s);var R=rescale(_.yRatio,l);var S={left:"".concat(k,"px"),bottom:"".concat(R,"px"),position:"absolute",transform:"scale(".concat(_.xRatio,", ").concat(_.yRatio,")"),backgroundColor:e.settings.rgba||getRGBA(this.recipientIndex)};if(e.settings.height){S.height="".concat(e.settings.height,"px")}if(e.settings.width){S.width="".concat(e.settings.width,"px")}console.log("rendering field",e.type,e);var E="field-".concat(e.name);switch(e.type){case"signature":return h("verdocs-field-signature",{style:S,value:p,required:i,id:E});case"initial":return h("verdocs-field-initial",{style:S,required:i,id:E});case"textbox":return h("verdocs-field-textbox",{style:S,order:t,value:w||"",placeholder:g,id:E,onFieldChange:function(t){return n.handleFieldChange(e,t)}});case"textarea":return h("verdocs-field-textarea",{style:S,placeholder:g||"",id:E});case"date":return h("verdocs-field-date",{style:S,order:t,value:w||"",placeholder:g,required:i,id:E});case"dropdown":return h("verdocs-field-dropdown",{style:S,options:b,value:m,required:i,id:E,onFieldChange:function(t){return n.handleFieldChange(e,t)}});case"checkbox":return h("verdocs-field-checkbox",{style:S,value:w||"",id:E});case"checkbox_group":return e.settings.options.map((function(t,o){return n.renderCheckboxGroupOption(_,e,t,o)}));case"radio_button_group":return e.settings.options.map((function(t,o){return n.renderRadioGroupOption(_,e,t,o)}));case"attachment":return h("verdocs-field-attachment",{style:S,value:w||"",id:E});case"payment":return h("verdocs-field-payment",{style:S,field:e,id:E});default:console.log("[SIGN] Skipping unsupported field type",e)}return h("div",{style:{display:"none"}},'Unsupported field type "',e.type,'"')};e.prototype.isFieldValid=function(e){var t,n,o,i,r,a,c,s,d,l,u,p;switch(e.type){case"textbox":switch(((t=e.settings)===null||t===void 0?void 0:t.validator)||""){case"email":return isValidEmail(((n=e.settings)===null||n===void 0?void 0:n.result)||"");case"phone":return isValidPhone(((o=e.settings)===null||o===void 0?void 0:o.result)||"");default:return!!((i=e.settings)===null||i===void 0?void 0:i.result)}case"signature":case"initial":case"textarea":case"date":case"attachment":return!!((r=e.settings)===null||r===void 0?void 0:r.result);case"dropdown":return!!((a=e.settings)===null||a===void 0?void 0:a.value);case"checkbox_group":var f=(((s=(c=e.settings)===null||c===void 0?void 0:c.options)===null||s===void 0?void 0:s.filter((function(e){return e.checked})))||[]).length;return f>=(((d=e.settings)===null||d===void 0?void 0:d.minimum_checked)||0)&&f<=(((l=e.settings)===null||l===void 0?void 0:l.maximum_checked)||999);case"radio_button_group":return(((p=(u=e.settings)===null||u===void 0?void 0:u.options)===null||p===void 0?void 0:p.filter((function(e){return e.selected})))||[]).length>0;default:return false}};e.prototype.handleDocumentRendered=function(e){console.log("[SIGN] Document rendered",e.detail);this.pdfPageInfo=e.detail};e.prototype.handleNext=function(){var e=this;var t=this.fields.filter((function(e){return e.required}));console.log("required Fields",t);var n=t.findIndex((function(t){return t.name===e.focusedField}));console.log("focused Index",n);var o=n+1;if(o>=t.length){o=0}var i=t[o];console.log("next required fielod",i);if(i){var r=document.getElementById("field-".concat(i.name));r===null||r===void 0?void 0:r.focusField();this.focusedField=i.name}};e.prototype.render=function(){var e=this;var t,n,o,i,r;var a=[{id:"later",label:"Finish Later"},{id:"claim",label:"Claim the Document",disabled:true},{id:"decline",label:"Decline to Sign"},{id:"print",label:"Print Without Signing"},{id:"download",label:"Download"}];return h(Host,{class:{storybook:!!(window===null||window===void 0?void 0:window["STORYBOOK_ENV"]),agreed:(t=this.recipient)===null||t===void 0?void 0:t.agreed}},h("div",{class:"header"},h("div",{class:"intro"},"Please review and act on these documents."),h("div",{class:"toolbar"},h("div",{class:"tools"},h("verdocs-dropdown",{options:a,onOptionSelected:function(t){return e.handleOptionSelected(t)}}),!((n=this.recipient)===null||n===void 0?void 0:n.agreed)?h("div",{style:{flex:"1",flexDirection:"row",display:"flex",alignItems:"center"}},h("div",{class:"agree-checkbox"},h("input",{type:"checkbox",value:"None",id:"agree-checkbox-element",name:"agree",onChange:function(){return e.handleClickAgree()}}),h("label",{htmlFor:"agree-checkbox-element"})),"I agree to use electronic records and signatures."):h("div",{style:{flex:"1"}}),h("verdocs-button",{label:this.nextButtonLabel,disabled:!((o=this.recipient)===null||o===void 0?void 0:o.agreed),onClick:function(){return e.handleNext()}})))),!((i=this.recipient)===null||i===void 0?void 0:i.agreed)?h("div",{class:"cover"}):h("div",{style:{display:"none"}}),h("div",{class:"document"},this.pdfUrl?h("verdocs-view",{source:this.pdfUrl,token:this.signerToken,onDocumentRendered:function(t){return e.handleDocumentRendered(t)}}):h("verdocs-loader",null),(((r=this.pdfPageInfo)===null||r===void 0?void 0:r.pages)||[]).map((function(t){var n;return h("div",{class:"page-controls",style:{height:"".concat(t.height,"px"),width:"".concat(t.width,"px"),top:"".concat(t.canvasTop,"px"),margin:"0 auto"}},((n=e.pdfPageInfo)===null||n===void 0?void 0:n.numRendered)>0?e.fields.filter((function(e){return e.page===t.pageNumber})).map((function(t,n){return e.renderField(t,n)})):h("div",{style:{display:"none"}},"Waiting for PDF to render..."))}))))};return e}();VerdocsSign.style=verdocsSignCss;export{VerdocsSign as verdocs_sign};
|