@verdocs/web-sdk 6.13.0 → 6.13.2
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/loader.cjs.js +1 -1
- package/dist/cjs/verdocs-download-dialog_4.cjs.entry.js +13 -4
- package/dist/cjs/verdocs-download-dialog_4.cjs.entry.js.map +1 -1
- package/dist/cjs/verdocs-preview_6.cjs.entry.js +47 -2
- package/dist/cjs/verdocs-preview_6.cjs.entry.js.map +1 -1
- package/dist/cjs/verdocs-sign.cjs.entry.js +42 -8
- package/dist/cjs/verdocs-sign.cjs.entry.js.map +1 -1
- package/dist/cjs/verdocs-web-sdk.cjs.js +1 -1
- package/dist/collection/components/embeds/verdocs-send/verdocs-send.css +55 -0
- package/dist/collection/components/embeds/verdocs-send/verdocs-send.js +49 -1
- package/dist/collection/components/embeds/verdocs-send/verdocs-send.js.map +1 -1
- package/dist/collection/components/embeds/verdocs-sign/verdocs-sign.js +43 -8
- package/dist/collection/components/embeds/verdocs-sign/verdocs-sign.js.map +1 -1
- package/dist/collection/components/envelopes/verdocs-sign-footer/verdocs-sign-footer.js +36 -4
- package/dist/collection/components/envelopes/verdocs-sign-footer/verdocs-sign-footer.js.map +1 -1
- package/dist/components/{p-BTrjJycH.js → p-06em1_P-.js} +2 -2
- package/dist/components/p-Blr31TcJ.js +2 -0
- package/dist/components/p-Blr31TcJ.js.map +1 -0
- package/dist/components/p-D495hZfr.js +2 -0
- package/dist/components/p-D495hZfr.js.map +1 -0
- package/dist/components/verdocs-build.js +1 -1
- package/dist/components/verdocs-send.js +1 -1
- package/dist/components/verdocs-sign-footer.js +1 -1
- package/dist/components/verdocs-sign.js +1 -1
- package/dist/components/verdocs-sign.js.map +1 -1
- package/dist/components/verdocs-view.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/verdocs-download-dialog_4.entry.js +13 -4
- package/dist/esm/verdocs-download-dialog_4.entry.js.map +1 -1
- package/dist/esm/verdocs-preview_6.entry.js +48 -3
- package/dist/esm/verdocs-preview_6.entry.js.map +1 -1
- package/dist/esm/verdocs-sign.entry.js +42 -8
- package/dist/esm/verdocs-sign.entry.js.map +1 -1
- package/dist/esm/verdocs-web-sdk.js +1 -1
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/verdocs-download-dialog_4.entry.js +1 -1
- package/dist/esm-es5/verdocs-download-dialog_4.entry.js.map +1 -1
- package/dist/esm-es5/verdocs-preview_6.entry.js +2 -2
- package/dist/esm-es5/verdocs-preview_6.entry.js.map +1 -1
- package/dist/esm-es5/verdocs-sign.entry.js +1 -1
- package/dist/esm-es5/verdocs-sign.entry.js.map +1 -1
- package/dist/esm-es5/verdocs-web-sdk.js +1 -1
- package/dist/types/components/embeds/verdocs-send/verdocs-send.d.ts +15 -1
- package/dist/types/components/embeds/verdocs-sign/verdocs-sign.d.ts +2 -0
- package/dist/types/components/envelopes/verdocs-sign-footer/verdocs-sign-footer.d.ts +4 -0
- package/dist/types/components.d.ts +10 -0
- package/dist/verdocs-web-sdk/p-1b818cdf.entry.js +8 -0
- package/dist/verdocs-web-sdk/p-1b818cdf.entry.js.map +1 -0
- package/dist/verdocs-web-sdk/p-24dcc54e.system.entry.js +8 -0
- package/dist/verdocs-web-sdk/{p-987d5653.entry.js.map → p-24dcc54e.system.entry.js.map} +1 -1
- package/dist/verdocs-web-sdk/p-935267a6.entry.js +2 -0
- package/dist/verdocs-web-sdk/p-935267a6.entry.js.map +1 -0
- package/dist/verdocs-web-sdk/p-BdZ5Ghsa.system.js +1 -1
- package/dist/verdocs-web-sdk/p-a9899fce.system.entry.js +2 -0
- package/dist/verdocs-web-sdk/p-a9899fce.system.entry.js.map +1 -0
- package/dist/verdocs-web-sdk/{p-2e382167.entry.js → p-ea6c0b55.entry.js} +2 -2
- package/dist/verdocs-web-sdk/p-ea6c0b55.entry.js.map +1 -0
- package/dist/verdocs-web-sdk/{p-3f9102c4.system.entry.js → p-eccac670.system.entry.js} +2 -2
- package/dist/verdocs-web-sdk/p-eccac670.system.entry.js.map +1 -0
- package/dist/verdocs-web-sdk/verdocs-web-sdk.esm.js +1 -1
- package/package.json +3 -3
- package/dist/components/p-CnUZ9w2T.js +0 -2
- package/dist/components/p-CnUZ9w2T.js.map +0 -1
- package/dist/components/p-E2hWLZ47.js +0 -2
- package/dist/components/p-E2hWLZ47.js.map +0 -1
- package/dist/verdocs-web-sdk/p-2a6a3bc6.entry.js +0 -2
- package/dist/verdocs-web-sdk/p-2a6a3bc6.entry.js.map +0 -1
- package/dist/verdocs-web-sdk/p-2e382167.entry.js.map +0 -1
- package/dist/verdocs-web-sdk/p-3f9102c4.system.entry.js.map +0 -1
- package/dist/verdocs-web-sdk/p-5404f6bf.system.entry.js +0 -2
- package/dist/verdocs-web-sdk/p-5404f6bf.system.entry.js.map +0 -1
- package/dist/verdocs-web-sdk/p-788c8d67.system.entry.js +0 -8
- package/dist/verdocs-web-sdk/p-788c8d67.system.entry.js.map +0 -1
- package/dist/verdocs-web-sdk/p-987d5653.entry.js +0 -8
- /package/dist/components/{p-BTrjJycH.js.map → p-06em1_P-.js.map} +0 -0
|
@@ -24,6 +24,10 @@ export class VerdocsSignFooter {
|
|
|
24
24
|
* If the recipient is "done," some buttons will be hidden.
|
|
25
25
|
*/
|
|
26
26
|
this.isDone = false;
|
|
27
|
+
/**
|
|
28
|
+
* The envelope's brand, if any.
|
|
29
|
+
*/
|
|
30
|
+
this.brand = null;
|
|
27
31
|
/**
|
|
28
32
|
* Event fired when the envelope is updated in any way. May be used for tasks such as cache invalidation or reporting to other systems.
|
|
29
33
|
*/
|
|
@@ -136,11 +140,16 @@ export class VerdocsSignFooter {
|
|
|
136
140
|
// }
|
|
137
141
|
// }
|
|
138
142
|
render() {
|
|
139
|
-
var _a, _b, _c, _d, _e, _f
|
|
140
|
-
const
|
|
141
|
-
const
|
|
143
|
+
var _a, _b, _c, _d, _e, _f;
|
|
144
|
+
const org = (_a = this.envelope) === null || _a === void 0 ? void 0 : _a.organization;
|
|
145
|
+
const poweredByLabel = ((_b = this.brand) === null || _b === void 0 ? void 0 : _b.powered_by_label) || (org === null || org === void 0 ? void 0 : org.powered_by_label);
|
|
146
|
+
const poweredByUrl = ((_c = this.brand) === null || _c === void 0 ? void 0 : _c.powered_by_label) ? (_d = this.brand) === null || _d === void 0 ? void 0 : _d.powered_by_url : org === null || org === void 0 ? void 0 : org.powered_by_url;
|
|
147
|
+
const termsUrl = ((_e = this.brand) === null || _e === void 0 ? void 0 : _e.terms_use_url) || (org === null || org === void 0 ? void 0 : org.terms_use_url);
|
|
148
|
+
const privacyUrl = ((_f = this.brand) === null || _f === void 0 ? void 0 : _f.privacy_policy_url) || (org === null || org === void 0 ? void 0 : org.privacy_policy_url);
|
|
149
|
+
const hasPoweredBy = !!poweredByLabel;
|
|
150
|
+
const hasLinks = !!termsUrl || !!privacyUrl;
|
|
142
151
|
const hasButtons = !this.isDone;
|
|
143
|
-
return (h(Host, { key: '
|
|
152
|
+
return (h(Host, { key: '91d822a2405449adbfb2cce4c87a4086958e4e79', class: { 'has-buttons': hasButtons, 'no-buttons': !hasButtons, 'has-powered-by': hasPoweredBy, 'has-links': hasLinks, 'just-buttons': !hasPoweredBy && !hasLinks } }, poweredByLabel && (h("div", { key: '5f856e6ba57091e30e455657fb304c6718d9b80c', class: "powered-by" }, poweredByUrl ? (h("a", { href: poweredByUrl, target: "_blank", rel: "noopener noreferrer" }, h("span", null, poweredByLabel))) : (h("span", null, poweredByLabel)))), !this.isDone && (h("div", { key: 'a9090f99ebc82d1b6602e52edd6d92f8eb94efcc', class: "buttons" }, h("button", { key: '08c7596ba10f3240dd29dc9d30f92ea3d6e4b0c3', onClick: () => (this.askingQuestion = true) }, h("span", { key: '19ba5c915fab3c7e38598f0cf90b1a8c82cc86d8', innerHTML: QuestionIcon }), "Ask Sender a Question"), h("button", { key: '12189b38952064e2a65e6c28f7a5f95d75f12ba7', onClick: () => { var _a; return (_a = this.decline) === null || _a === void 0 ? void 0 : _a.emit(); } }, h("span", { key: 'a5df4760b465ad3c8be1cec7ddbc8d4c88dfa3e2', innerHTML: DeclineIcon }), "Decline Signing"), h("button", { key: 'dfd2079149f39c688bd535474ed2a5d86b9be75d', onClick: () => { var _a; return (_a = this.finishLater) === null || _a === void 0 ? void 0 : _a.emit(); } }, h("span", { key: '35da50d7a9dd7fdf9d0748248cc1a5d98b9d3d11', innerHTML: SaveIcon }), "Finish Later"))), h("div", { key: '7d50e834619ee75a6651d8dc8a0f8e2bcc3c17ad', class: "links" }, termsUrl && (h("a", { key: '02fb19b915a6c22156a91001e90941219efc529c', href: termsUrl, target: "_blank", rel: "noopener noreferrer" }, h("span", { key: '752ca1e97fd782fdefe6fdd0d1b2831ea54ca80c' }, "Terms of Use"))), privacyUrl && (h("a", { key: 'd27725658461073751f76b7c33e76df527b6ea7c', href: privacyUrl, target: "_blank", rel: "noopener noreferrer" }, h("span", { key: '1e7ef9f0a9e88a877bb432b8bf5e4311b759d651' }, "Privacy Policy")))), this.askingQuestion && (h("verdocs-question-dialog", { key: 'c2ceb8bd5237792f3ef42f919bd837c11dff9a12', onNext: e => {
|
|
144
153
|
var _a;
|
|
145
154
|
(_a = this.askQuestion) === null || _a === void 0 ? void 0 : _a.emit({ question: e.detail.question });
|
|
146
155
|
this.askingQuestion = false;
|
|
@@ -223,6 +232,29 @@ export class VerdocsSignFooter {
|
|
|
223
232
|
"reflect": false,
|
|
224
233
|
"attribute": "is-done",
|
|
225
234
|
"defaultValue": "false"
|
|
235
|
+
},
|
|
236
|
+
"brand": {
|
|
237
|
+
"type": "unknown",
|
|
238
|
+
"mutable": false,
|
|
239
|
+
"complexType": {
|
|
240
|
+
"original": "Record<string, any> | null",
|
|
241
|
+
"resolved": "any | string",
|
|
242
|
+
"references": {
|
|
243
|
+
"Record": {
|
|
244
|
+
"location": "global",
|
|
245
|
+
"id": "global::Record"
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
},
|
|
249
|
+
"required": false,
|
|
250
|
+
"optional": false,
|
|
251
|
+
"docs": {
|
|
252
|
+
"tags": [],
|
|
253
|
+
"text": "The envelope's brand, if any."
|
|
254
|
+
},
|
|
255
|
+
"getter": false,
|
|
256
|
+
"setter": false,
|
|
257
|
+
"defaultValue": "null"
|
|
226
258
|
}
|
|
227
259
|
};
|
|
228
260
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verdocs-sign-footer.js","sourceRoot":"","sources":["../../../../src/components/envelopes/verdocs-sign-footer/verdocs-sign-footer.tsx"],"names":[],"mappings":"AACA,OAAO,EAAC,SAAS,EAAE,CAAC,EAAE,KAAK,EAAgB,IAAI,EAAE,IAAI,EAAE,KAAK,EAAC,MAAM,eAAe,CAAC;AACnF,OAAO,EAAC,WAAW,EAAE,eAAe,EAAC,MAAM,iBAAiB,CAAC;AAC7D,OAAO,EAAC,QAAQ,EAAC,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAC,KAAK,EAAC,MAAM,0BAA0B,CAAC;AAE/C,MAAM,YAAY,GAAG,gpBAAgpB,CAAC;AACtqB,MAAM,WAAW,GAAG,i2BAAi2B,CAAC;AACt3B,MAAM,QAAQ,GAAG,syBAAsyB,CAAC;AAExzB;;;GAGG;AAMH,MAAM,OAAO,iBAAiB;IAL9B;QAMU,uBAAkB,GAAG,IAAI,CAAC;QAElC;;WAEG;QACK,aAAQ,GAAoB,eAAe,CAAC,UAAU,EAAE,CAAC;QAEjE;;WAEG;QACK,eAAU,GAAW,EAAE,CAAC;QAEhC;;WAEG;QACK,WAAM,GAAG,KAAK,CAAC;QAuBvB;;WAEG;QACH,2HAA2H;QAElH,mBAAc,GAAG,KAAK,CAAC;QACvB,cAAS,GAAG,KAAK,CAAC;QAClB,aAAQ,GAAqB,IAAI,CAAC;KAiL5C;IA/KC,KAAK,CAAC,iBAAiB;;QACrB,IAAI,CAAC;YACH,mFAAmF;YACnF,yBAAyB;YACzB,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC;gBACr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AAE,QAAQ,GAAI;mCAEtB,CACL,CACP;YAED,4DAAK,KAAK,EAAC,OAAO;gBACf,CAAA,MAAA,MAAA,IAAI,CAAC,QAAQ,0CAAE,YAAY,0CAAE,aAAa,KAAI,CAC7C,0DAAG,IAAI,EAAE,MAAA,MAAA,IAAI,CAAC,QAAQ,0CAAE,YAAY,0CAAE,aAAa,EAAE,MAAM,EAAC,QAAQ,EAAC,GAAG,EAAC,qBAAqB;oBAC5F,8EAAyB,CACvB,CACL;gBACA,CAAA,MAAA,MAAA,IAAI,CAAC,QAAQ,0CAAE,YAAY,0CAAE,kBAAkB,KAAI,CAClD,0DAAG,IAAI,EAAE,MAAA,MAAA,IAAI,CAAC,QAAQ,0CAAE,YAAY,0CAAE,kBAAkB,EAAE,MAAM,EAAC,QAAQ,EAAC,GAAG,EAAC,qBAAqB;oBACjG,gFAA2B,CACzB,CACL,CACG;YAEL,IAAI,CAAC,cAAc,IAAI,CACtB,gFACE,MAAM,EAAE,CAAC,CAAC,EAAE;;oBACV,MAAA,IAAI,CAAC,WAAW,0CAAE,IAAI,CAAC,EAAC,QAAQ,EAAE,CAAC,CAAC,MAAM,CAAC,QAAQ,EAAC,CAAC,CAAC;oBACtD,IAAI,CAAC,cAAc,GAAG,KAAK,CAAC;gBAC9B,CAAC,EACD,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC,IAAI,CAAC,cAAc,GAAG,KAAK,CAAC,GAC3C,CACH,CACI,CACR,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import {IEnvelope} from '@verdocs/js-sdk';\nimport {Component, h, Event, EventEmitter, Host, Prop, State} from '@stencil/core';\nimport {getEnvelope, VerdocsEndpoint} from '@verdocs/js-sdk';\nimport {SDKError} from '../../../utils/errors';\nimport {Store} from '../../../utils/Datastore';\n\nconst QuestionIcon = `<svg width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M10.4809 13.8423H15.4C16.2962 13.8423 17 13.1288 17 12.2764V5.56582C17 4.71348 16.2962 4 15.4 4H4.6C3.70383 4 3 4.71348 3 5.56582V12.2764C3 13.1288 3.70383 13.8423 4.6 13.8423H6.19908L6.2 17L6.20346 16.9997L6.20502 16.9988L10.4809 13.8423ZM6.79895 17.8034C6.35668 18.1298 5.73 18.0406 5.39921 17.6042C5.26989 17.4335 5.2 17.2262 5.2 17.0133L5.19937 14.8423H4.6C3.16406 14.8423 2 13.6935 2 12.2764V5.56582C2 4.14876 3.16406 3 4.6 3H15.4C16.8359 3 18 4.14876 18 5.56582V12.2764C18 13.6935 16.8359 14.8423 15.4 14.8423H10.81L6.79895 17.8034Z\" fill=\"#424242\"/></svg>`;\nconst DeclineIcon = `<svg width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M7.14645 7.14645C7.34171 6.95118 7.65829 6.95118 7.85355 7.14645L10 9.29289L12.1464 7.14645C12.3417 6.95118 12.6583 6.95118 12.8536 7.14645C13.0488 7.34171 13.0488 7.65829 12.8536 7.85355L10.7071 10L12.8536 12.1464C13.0488 12.3417 13.0488 12.6583 12.8536 12.8536C12.6583 13.0488 12.3417 13.0488 12.1464 12.8536L10 10.7071L7.85355 12.8536C7.65829 13.0488 7.34171 13.0488 7.14645 12.8536C6.95118 12.6583 6.95118 12.3417 7.14645 12.1464L9.29289 10L7.14645 7.85355C6.95118 7.65829 6.95118 7.34171 7.14645 7.14645ZM3 6C3 4.34315 4.34315 3 6 3H14C15.6569 3 17 4.34315 17 6V14C17 15.6569 15.6569 17 14 17H6C4.34315 17 3 15.6569 3 14V6ZM6 4C4.89543 4 4 4.89543 4 6V14C4 15.1046 4.89543 16 6 16H14C15.1046 16 16 15.1046 16 14V6C16 4.89543 15.1046 4 14 4H6Z\" fill=\"#424242\"/></svg>`;\nconst SaveIcon = `<svg width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M3 5C3 3.89543 3.89543 3 5 3H13.3787C13.9091 3 14.4178 3.21071 14.7929 3.58579L16.4142 5.20711C16.7893 5.58218 17 6.09089 17 6.62132V15C17 16.1046 16.1046 17 15 17H5C3.89543 17 3 16.1046 3 15V5ZM5 4C4.44772 4 4 4.44772 4 5V15C4 15.5523 4.44772 16 5 16L5 11.5C5 10.6716 5.67157 10 6.5 10H13.5C14.3284 10 15 10.6716 15 11.5V16C15.5523 16 16 15.5523 16 15V6.62132C16 6.3561 15.8946 6.10175 15.7071 5.91421L14.0858 4.29289C13.8983 4.10536 13.6439 4 13.3787 4L13 4V6.5C13 7.32843 12.3284 8 11.5 8L7.5 8C6.67157 8 6 7.32843 6 6.5L6 4H5ZM7 4L7 6.5C7 6.77614 7.22386 7 7.5 7L11.5 7C11.7761 7 12 6.77614 12 6.5V4L7 4ZM14 16V11.5C14 11.2239 13.7761 11 13.5 11H6.5C6.22386 11 6 11.2239 6 11.5V16H14Z\" fill=\"#424242\"/></svg>`;\n\n/**\n * Typically presented by the `verdocs-sign` component. Displays a footer toolbar\n * with a few convenience functions for the envelope recipient to use.\n */\n@Component({\n tag: 'verdocs-sign-footer',\n styleUrl: 'verdocs-sign-footer.scss',\n shadow: false,\n})\nexport class VerdocsSignFooter {\n private envelopeListenerId = null;\n\n /**\n * The endpoint to use to communicate with Verdocs. If not set, the default endpoint will be used.\n */\n @Prop() endpoint: VerdocsEndpoint = VerdocsEndpoint.getDefault();\n\n /**\n * The envelope ID to render. Set ONE OF templateId or envelopeId. If both are set, envelopeId will be ignored.\n */\n @Prop() envelopeId: string = '';\n\n /**\n * If the recipient is \"done,\" some buttons will be hidden.\n */\n @Prop() isDone = false;\n\n /**\n * Event fired if the user asks the sender a question. The parent component is responsible for handling this.\n */\n @Event({composed: true}) askQuestion: EventEmitter<{question: string}>;\n\n /**\n * Event fired if the user asks the sender a question. The parent component is responsible for handling this.\n */\n @Event({composed: true}) decline: EventEmitter;\n\n /**\n * Event fired if the user asks the sender a question. The parent component is responsible for handling this.\n */\n @Event({composed: true}) finishLater: EventEmitter;\n\n /**\n * Event fired if an error occurs. The event details will contain information about the error. Most errors will\n * terminate the process, and the calling application should correct the condition and re-render the component.\n */\n @Event({composed: true}) sdkError: EventEmitter<SDKError>;\n\n /**\n * Event fired when the envelope is updated in any way. May be used for tasks such as cache invalidation or reporting to other systems.\n */\n // @Event({composed: true}) envelopeUpdated: EventEmitter<{endpoint: VerdocsEndpoint; envelope: IEnvelope; event: string}>;\n\n @State() askingQuestion = false;\n @State() declinine = false;\n @State() envelope: IEnvelope | null = null;\n\n async componentWillLoad() {\n try {\n // NOTE: The caller must have a signing session already active and shared to us via\n // the endpoint property.\n if (!this.envelopeId) {\n console.log(`[FOOTER] Missing required envelope ID ${this.envelopeId}`);\n return;\n }\n\n this.listenToEnvelope();\n } catch (e) {\n console.log('[FOOTER] Error loading envelope', e);\n this.sdkError?.emit(new SDKError(e.message, e.response?.status, e.response?.data));\n }\n }\n\n disconnectedCallback() {\n this.unlistenToEnvelope();\n }\n\n async listenToEnvelope() {\n console.log('[FOOTER] Loading envelope', this.envelopeId);\n this.unlistenToEnvelope();\n Store.subscribe(\n 'envelopes',\n this.envelopeId,\n () => getEnvelope(this.endpoint, this.envelopeId),\n false,\n (envelope: IEnvelope) => {\n this.envelope = envelope;\n },\n );\n }\n\n unlistenToEnvelope() {\n if (this.envelopeListenerId) {\n Store.store.delListener(this.envelopeListenerId);\n this.envelopeListenerId = null;\n }\n }\n\n // handleRecipientAction(recipient: IRecipient, id: string) {\n // console.log('[SIDEBAR] Recipient action', id, recipient);\n // switch (id) {\n // case 'update':\n // this.showUpdateDialog = recipient.role_name;\n // break;\n //\n // case 'reminder':\n // remindRecipient(this.endpoint, this.envelopeId, recipient.role_name)\n // .then(() => {\n // VerdocsToast('Reminder Sent', {style: 'success'});\n // })\n // .catch(e => {\n // console.log('[SIDEBAR] Error resending invitation', e);\n // VerdocsToast('Error resending invitation: ' + e.message, {style: 'error'});\n // });\n // break;\n //\n // case 'reinvite':\n // this.showReinviteDialog = recipient.role_name;\n // break;\n //\n // case 'inperson':\n // this.showRecipientDialog = recipient.role_name;\n // break;\n //\n // case 'modify':\n // VerdocsToast('This feature will be enabled in a future release. Please try again later.', {style: 'info'});\n // break;\n //\n // case 'details':\n // VerdocsToast('This feature will be enabled in a future release. Please try again later.', {style: 'info'});\n // break;\n // }\n // }\n\n // handleUpdateRecipient(originalRecipient: IRecipient, updatedRecipient: IRecipient) {\n // console.log('Updating recipient', originalRecipient, updatedRecipient);\n // const fields: any = {};\n // if (updatedRecipient.email !== originalRecipient.email) {\n // fields.email = updatedRecipient.email;\n // }\n // if (updatedRecipient.phone !== originalRecipient.phone) {\n // fields.phone = updatedRecipient.phone;\n // }\n // if (updatedRecipient.message !== originalRecipient.message) {\n // fields.message = updatedRecipient.message;\n // }\n // if (updatedRecipient.first_name !== originalRecipient.first_name) {\n // fields.first_name = updatedRecipient.first_name;\n // }\n // if (updatedRecipient.last_name !== originalRecipient.last_name) {\n // fields.last_name = updatedRecipient.last_name;\n // }\n //\n // if (Object.keys(fields).length > 0) {\n // updateRecipient(this.endpoint, this.envelopeId, originalRecipient.role_name, fields)\n // .then(r => {\n // // TODO: Reload the envelope?\n // VerdocsToast('Recipient updated', {style: 'success'});\n // console.log('[SIDEBAR] Updated recipient', r);\n // Store.getEnvelope(this.endpoint, this.envelopeId, true);\n // this.showUpdateDialog = '';\n // })\n // .catch(e => {\n // VerdocsToast(e.response.data.error, {style: 'error'});\n // this.showUpdateDialog = '';\n // });\n // } else {\n // this.showUpdateDialog = '';\n // }\n // }\n\n render() {\n const hasPoweredBy = !!this.envelope?.organization?.powered_by_label;\n const hasLinks = !!this.envelope?.organization?.terms_use_url || !!this.envelope?.organization?.privacy_policy_url;\n const hasButtons = !this.isDone;\n\n return (\n <Host class={{'has-buttons': hasButtons, 'no-buttons': !hasButtons, 'has-powered-by': hasPoweredBy, 'has-links': hasLinks, 'just-buttons': !hasPoweredBy && !hasLinks}}>\n {this.envelope?.organization?.powered_by_label && (\n <div class=\"powered-by\">\n {this.envelope?.organization?.powered_by_url ? (\n <a href={this.envelope?.organization?.powered_by_url} target=\"_blank\" rel=\"noopener noreferrer\">\n <span>{this.envelope?.organization?.powered_by_label}</span>\n </a>\n ) : (\n <span>{this.envelope?.organization?.powered_by_label}</span>\n )}\n </div>\n )}\n\n {!this.isDone && (\n <div class=\"buttons\">\n <button onClick={() => (this.askingQuestion = true)}>\n <span innerHTML={QuestionIcon} />\n Ask Sender a Question\n </button>\n <button onClick={() => this.decline?.emit()}>\n <span innerHTML={DeclineIcon} />\n Decline Signing\n </button>\n <button onClick={() => this.finishLater?.emit()}>\n <span innerHTML={SaveIcon} />\n Finish Later\n </button>\n </div>\n )}\n\n <div class=\"links\">\n {this.envelope?.organization?.terms_use_url && (\n <a href={this.envelope?.organization?.terms_use_url} target=\"_blank\" rel=\"noopener noreferrer\">\n <span>Terms of Use</span>\n </a>\n )}\n {this.envelope?.organization?.privacy_policy_url && (\n <a href={this.envelope?.organization?.privacy_policy_url} target=\"_blank\" rel=\"noopener noreferrer\">\n <span>Privacy Policy</span>\n </a>\n )}\n </div>\n\n {this.askingQuestion && (\n <verdocs-question-dialog\n onNext={e => {\n this.askQuestion?.emit({question: e.detail.question});\n this.askingQuestion = false;\n }}\n onExit={() => (this.askingQuestion = false)}\n />\n )}\n </Host>\n );\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"verdocs-sign-footer.js","sourceRoot":"","sources":["../../../../src/components/envelopes/verdocs-sign-footer/verdocs-sign-footer.tsx"],"names":[],"mappings":"AACA,OAAO,EAAC,SAAS,EAAE,CAAC,EAAE,KAAK,EAAgB,IAAI,EAAE,IAAI,EAAE,KAAK,EAAC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A,UAAU,IAAI,CACb,0DAAG,IAAI,EAAE,UAAU,EAAE,MAAM,EAAC,QAAQ,EAAC,GAAG,EAAC,qBAAqB;oBAC5D,gFAA2B,CACzB,CACL,CACG;YAEL,IAAI,CAAC,cAAc,IAAI,CACtB,gFACE,MAAM,EAAE,CAAC,CAAC,EAAE;;oBACV,MAAA,IAAI,CAAC,WAAW,0CAAE,IAAI,CAAC,EAAC,QAAQ,EAAE,CAAC,CAAC,MAAM,CAAC,QAAQ,EAAC,CAAC,CAAC;oBACtD,IAAI,CAAC,cAAc,GAAG,KAAK,CAAC;gBAC9B,CAAC,EACD,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC,IAAI,CAAC,cAAc,GAAG,KAAK,CAAC,GAC3C,CACH,CACI,CACR,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import {IEnvelope} from '@verdocs/js-sdk';\nimport {Component, h, Event, EventEmitter, Host, Prop, State} from '@stencil/core';\nimport {getEnvelope, VerdocsEndpoint} from '@verdocs/js-sdk';\nimport {SDKError} from '../../../utils/errors';\nimport {Store} from '../../../utils/Datastore';\n\nconst QuestionIcon = `<svg width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M10.4809 13.8423H15.4C16.2962 13.8423 17 13.1288 17 12.2764V5.56582C17 4.71348 16.2962 4 15.4 4H4.6C3.70383 4 3 4.71348 3 5.56582V12.2764C3 13.1288 3.70383 13.8423 4.6 13.8423H6.19908L6.2 17L6.20346 16.9997L6.20502 16.9988L10.4809 13.8423ZM6.79895 17.8034C6.35668 18.1298 5.73 18.0406 5.39921 17.6042C5.26989 17.4335 5.2 17.2262 5.2 17.0133L5.19937 14.8423H4.6C3.16406 14.8423 2 13.6935 2 12.2764V5.56582C2 4.14876 3.16406 3 4.6 3H15.4C16.8359 3 18 4.14876 18 5.56582V12.2764C18 13.6935 16.8359 14.8423 15.4 14.8423H10.81L6.79895 17.8034Z\" fill=\"#424242\"/></svg>`;\nconst DeclineIcon = `<svg width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M7.14645 7.14645C7.34171 6.95118 7.65829 6.95118 7.85355 7.14645L10 9.29289L12.1464 7.14645C12.3417 6.95118 12.6583 6.95118 12.8536 7.14645C13.0488 7.34171 13.0488 7.65829 12.8536 7.85355L10.7071 10L12.8536 12.1464C13.0488 12.3417 13.0488 12.6583 12.8536 12.8536C12.6583 13.0488 12.3417 13.0488 12.1464 12.8536L10 10.7071L7.85355 12.8536C7.65829 13.0488 7.34171 13.0488 7.14645 12.8536C6.95118 12.6583 6.95118 12.3417 7.14645 12.1464L9.29289 10L7.14645 7.85355C6.95118 7.65829 6.95118 7.34171 7.14645 7.14645ZM3 6C3 4.34315 4.34315 3 6 3H14C15.6569 3 17 4.34315 17 6V14C17 15.6569 15.6569 17 14 17H6C4.34315 17 3 15.6569 3 14V6ZM6 4C4.89543 4 4 4.89543 4 6V14C4 15.1046 4.89543 16 6 16H14C15.1046 16 16 15.1046 16 14V6C16 4.89543 15.1046 4 14 4H6Z\" fill=\"#424242\"/></svg>`;\nconst SaveIcon = `<svg width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M3 5C3 3.89543 3.89543 3 5 3H13.3787C13.9091 3 14.4178 3.21071 14.7929 3.58579L16.4142 5.20711C16.7893 5.58218 17 6.09089 17 6.62132V15C17 16.1046 16.1046 17 15 17H5C3.89543 17 3 16.1046 3 15V5ZM5 4C4.44772 4 4 4.44772 4 5V15C4 15.5523 4.44772 16 5 16L5 11.5C5 10.6716 5.67157 10 6.5 10H13.5C14.3284 10 15 10.6716 15 11.5V16C15.5523 16 16 15.5523 16 15V6.62132C16 6.3561 15.8946 6.10175 15.7071 5.91421L14.0858 4.29289C13.8983 4.10536 13.6439 4 13.3787 4L13 4V6.5C13 7.32843 12.3284 8 11.5 8L7.5 8C6.67157 8 6 7.32843 6 6.5L6 4H5ZM7 4L7 6.5C7 6.77614 7.22386 7 7.5 7L11.5 7C11.7761 7 12 6.77614 12 6.5V4L7 4ZM14 16V11.5C14 11.2239 13.7761 11 13.5 11H6.5C6.22386 11 6 11.2239 6 11.5V16H14Z\" fill=\"#424242\"/></svg>`;\n\n/**\n * Typically presented by the `verdocs-sign` component. Displays a footer toolbar\n * with a few convenience functions for the envelope recipient to use.\n */\n@Component({\n tag: 'verdocs-sign-footer',\n styleUrl: 'verdocs-sign-footer.scss',\n shadow: false,\n})\nexport class VerdocsSignFooter {\n private envelopeListenerId = null;\n\n /**\n * The endpoint to use to communicate with Verdocs. If not set, the default endpoint will be used.\n */\n @Prop() endpoint: VerdocsEndpoint = VerdocsEndpoint.getDefault();\n\n /**\n * The envelope ID to render. Set ONE OF templateId or envelopeId. If both are set, envelopeId will be ignored.\n */\n @Prop() envelopeId: string = '';\n\n /**\n * If the recipient is \"done,\" some buttons will be hidden.\n */\n @Prop() isDone = false;\n\n /**\n * The envelope's brand, if any.\n */\n @Prop() brand: Record<string, any> | null = null;\n\n /**\n * Event fired if the user asks the sender a question. The parent component is responsible for handling this.\n */\n @Event({composed: true}) askQuestion: EventEmitter<{question: string}>;\n\n /**\n * Event fired if the user asks the sender a question. The parent component is responsible for handling this.\n */\n @Event({composed: true}) decline: EventEmitter;\n\n /**\n * Event fired if the user asks the sender a question. The parent component is responsible for handling this.\n */\n @Event({composed: true}) finishLater: EventEmitter;\n\n /**\n * Event fired if an error occurs. The event details will contain information about the error. Most errors will\n * terminate the process, and the calling application should correct the condition and re-render the component.\n */\n @Event({composed: true}) sdkError: EventEmitter<SDKError>;\n\n /**\n * Event fired when the envelope is updated in any way. May be used for tasks such as cache invalidation or reporting to other systems.\n */\n // @Event({composed: true}) envelopeUpdated: EventEmitter<{endpoint: VerdocsEndpoint; envelope: IEnvelope; event: string}>;\n\n @State() askingQuestion = false;\n @State() declinine = false;\n @State() envelope: IEnvelope | null = null;\n\n async componentWillLoad() {\n try {\n // NOTE: The caller must have a signing session already active and shared to us via\n // the endpoint property.\n if (!this.envelopeId) {\n console.log(`[FOOTER] Missing required envelope ID ${this.envelopeId}`);\n return;\n }\n\n this.listenToEnvelope();\n } catch (e) {\n console.log('[FOOTER] Error loading envelope', e);\n this.sdkError?.emit(new SDKError(e.message, e.response?.status, e.response?.data));\n }\n }\n\n disconnectedCallback() {\n this.unlistenToEnvelope();\n }\n\n async listenToEnvelope() {\n console.log('[FOOTER] Loading envelope', this.envelopeId);\n this.unlistenToEnvelope();\n Store.subscribe(\n 'envelopes',\n this.envelopeId,\n () => getEnvelope(this.endpoint, this.envelopeId),\n false,\n (envelope: IEnvelope) => {\n this.envelope = envelope;\n },\n );\n }\n\n unlistenToEnvelope() {\n if (this.envelopeListenerId) {\n Store.store.delListener(this.envelopeListenerId);\n this.envelopeListenerId = null;\n }\n }\n\n // handleRecipientAction(recipient: IRecipient, id: string) {\n // console.log('[SIDEBAR] Recipient action', id, recipient);\n // switch (id) {\n // case 'update':\n // this.showUpdateDialog = recipient.role_name;\n // break;\n //\n // case 'reminder':\n // remindRecipient(this.endpoint, this.envelopeId, recipient.role_name)\n // .then(() => {\n // VerdocsToast('Reminder Sent', {style: 'success'});\n // })\n // .catch(e => {\n // console.log('[SIDEBAR] Error resending invitation', e);\n // VerdocsToast('Error resending invitation: ' + e.message, {style: 'error'});\n // });\n // break;\n //\n // case 'reinvite':\n // this.showReinviteDialog = recipient.role_name;\n // break;\n //\n // case 'inperson':\n // this.showRecipientDialog = recipient.role_name;\n // break;\n //\n // case 'modify':\n // VerdocsToast('This feature will be enabled in a future release. Please try again later.', {style: 'info'});\n // break;\n //\n // case 'details':\n // VerdocsToast('This feature will be enabled in a future release. Please try again later.', {style: 'info'});\n // break;\n // }\n // }\n\n // handleUpdateRecipient(originalRecipient: IRecipient, updatedRecipient: IRecipient) {\n // console.log('Updating recipient', originalRecipient, updatedRecipient);\n // const fields: any = {};\n // if (updatedRecipient.email !== originalRecipient.email) {\n // fields.email = updatedRecipient.email;\n // }\n // if (updatedRecipient.phone !== originalRecipient.phone) {\n // fields.phone = updatedRecipient.phone;\n // }\n // if (updatedRecipient.message !== originalRecipient.message) {\n // fields.message = updatedRecipient.message;\n // }\n // if (updatedRecipient.first_name !== originalRecipient.first_name) {\n // fields.first_name = updatedRecipient.first_name;\n // }\n // if (updatedRecipient.last_name !== originalRecipient.last_name) {\n // fields.last_name = updatedRecipient.last_name;\n // }\n //\n // if (Object.keys(fields).length > 0) {\n // updateRecipient(this.endpoint, this.envelopeId, originalRecipient.role_name, fields)\n // .then(r => {\n // // TODO: Reload the envelope?\n // VerdocsToast('Recipient updated', {style: 'success'});\n // console.log('[SIDEBAR] Updated recipient', r);\n // Store.getEnvelope(this.endpoint, this.envelopeId, true);\n // this.showUpdateDialog = '';\n // })\n // .catch(e => {\n // VerdocsToast(e.response.data.error, {style: 'error'});\n // this.showUpdateDialog = '';\n // });\n // } else {\n // this.showUpdateDialog = '';\n // }\n // }\n\n render() {\n const org = this.envelope?.organization;\n const poweredByLabel = this.brand?.powered_by_label || org?.powered_by_label;\n const poweredByUrl = this.brand?.powered_by_label ? this.brand?.powered_by_url : org?.powered_by_url;\n const termsUrl = this.brand?.terms_use_url || org?.terms_use_url;\n const privacyUrl = this.brand?.privacy_policy_url || org?.privacy_policy_url;\n const hasPoweredBy = !!poweredByLabel;\n const hasLinks = !!termsUrl || !!privacyUrl;\n const hasButtons = !this.isDone;\n\n return (\n <Host class={{'has-buttons': hasButtons, 'no-buttons': !hasButtons, 'has-powered-by': hasPoweredBy, 'has-links': hasLinks, 'just-buttons': !hasPoweredBy && !hasLinks}}>\n {poweredByLabel && (\n <div class=\"powered-by\">\n {poweredByUrl ? (\n <a href={poweredByUrl} target=\"_blank\" rel=\"noopener noreferrer\">\n <span>{poweredByLabel}</span>\n </a>\n ) : (\n <span>{poweredByLabel}</span>\n )}\n </div>\n )}\n\n {!this.isDone && (\n <div class=\"buttons\">\n <button onClick={() => (this.askingQuestion = true)}>\n <span innerHTML={QuestionIcon} />\n Ask Sender a Question\n </button>\n <button onClick={() => this.decline?.emit()}>\n <span innerHTML={DeclineIcon} />\n Decline Signing\n </button>\n <button onClick={() => this.finishLater?.emit()}>\n <span innerHTML={SaveIcon} />\n Finish Later\n </button>\n </div>\n )}\n\n <div class=\"links\">\n {termsUrl && (\n <a href={termsUrl} target=\"_blank\" rel=\"noopener noreferrer\">\n <span>Terms of Use</span>\n </a>\n )}\n {privacyUrl && (\n <a href={privacyUrl} target=\"_blank\" rel=\"noopener noreferrer\">\n <span>Privacy Policy</span>\n </a>\n )}\n </div>\n\n {this.askingQuestion && (\n <verdocs-question-dialog\n onNext={e => {\n this.askQuestion?.emit({question: e.detail.question});\n this.askingQuestion = false;\n }}\n onExit={() => (this.askingQuestion = false)}\n />\n )}\n </Host>\n );\n }\n}\n"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{p as e,H as o,c as i,h as t,d as s,F as n,t as l}from"./p-yZBlG3YQ.js";import{VerdocsEndpoint as r,getEnvelope as d,getEnvelopesZip as a,getEnvelopeDocumentDownloadLink as c,cancelEnvelope as h,getCombinedEnvelopeDocumentDownloadLink as v,getMyRecipient as m,integerSequence as p}from"@verdocs/js-sdk";import{D as f}from"./p-17OorOnH.js";import{V as u}from"./p-D97GxsI-.js";import{S as w}from"./p-C1sRVZWv.js";import{S as g}from"./p-C7hFgM52.js";import{d as x}from"./p-C90lxyUX.js";import{d as b}from"./p-PVw56Shw.js";import{d as C}from"./p-DscL0SIM.js";import{d as y}from"./p-C8yiLtCJ.js";import{d as k}from"./p-DqzFuSNN.js";import{d as z}from"./p-5FU3bYQ3.js";import{d as L}from"./p-8J_y0V9M.js";import{d as V}from"./p-E2hWLZ47.js";const E=()=>`verdocs-view{display:-ms-flexbox;display:flex;overflow:hidden;min-height:600px;position:relative;-ms-flex-direction:column;flex-direction:column;-webkit-box-sizing:border-box;box-sizing:border-box;font-family:var(--verdocs-primary-font, "Inter", "Barlow", sans-serif);background-color:#f5f5f5}verdocs-view div,verdocs-view canvas{-webkit-box-sizing:border-box;box-sizing:border-box}verdocs-view .document{-ms-flex:1;flex:1;width:100%;height:100%;display:-ms-flexbox;display:flex;row-gap:15px;min-height:200px;max-width:1200px;position:relative;overflow-y:scroll;-ms-flex-align:center;align-items:center;-webkit-box-sizing:border-box;box-sizing:border-box;-ms-flex-direction:column;flex-direction:column;padding-right:15px}verdocs-view .document .inner{width:100%;max-width:1028px}verdocs-view .signed-document-container{width:64%;margin:0 auto;-webkit-transition:all 0.3s ease;transition:all 0.3s ease;padding:15px;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-ms-flex-align:center;align-items:center;gap:15px}verdocs-view .signed-document-container.zoom-normal{width:64%}verdocs-view .signed-document-container.zoom-zoom1{width:80%}verdocs-view .signed-document-container.zoom-zoom2{width:100%}@media (max-width: 768px){verdocs-view .signed-document-container{width:100%}verdocs-view .signed-document-container.zoom-normal,verdocs-view .signed-document-container.zoom-zoom1,verdocs-view .signed-document-container.zoom-zoom2{width:100%}verdocs-view .controls-toolbar .center-controls{display:none}verdocs-view .controls-toolbar .right-controls .icon-button.minus,verdocs-view .controls-toolbar .right-controls .icon-button.plus{display:none}}verdocs-view .loading-indicator{top:0;left:0;right:0;bottom:0;display:-ms-flexbox;display:flex;z-index:10000;position:fixed;background-color:rgba(0, 0, 0, 0.7);-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center}verdocs-view verdocs-ok-dialog .background-overlay{-ms-flex-align:start;align-items:flex-start;padding-top:100px}#verdocs-view-header{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:justify;justify-content:space-between;height:54px;padding:0 12px 0 24px;background-color:#ffffff;border-bottom:1px solid #e0e0e0;-webkit-box-shadow:none;box-shadow:none;font-family:"Inter", sans-serif;color:#424242;z-index:1000;width:100%;-webkit-box-sizing:border-box;box-sizing:border-box}#verdocs-view-header .left-controls{-ms-flex:1;flex:1;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}#verdocs-view-header .left-controls .title{font-weight:500;font-size:16px;color:#242424;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}#verdocs-view-header .center-controls{-ms-flex:1;flex:1;display:none;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;gap:10px;font-size:14px}#verdocs-view-header .right-controls{-ms-flex:1;flex:1;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:end;justify-content:flex-end}#verdocs-view-header .right-controls .icon-button{width:32px;height:32px;display:-ms-flexbox;display:flex;color:#424242;cursor:pointer;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;-webkit-transition:background-color 0.2s;transition:background-color 0.2s}#verdocs-view-header .right-controls .icon-button:hover{background-color:#f5f5f5}#verdocs-view-header .right-controls .icon-button.disabled{opacity:0.3;pointer-events:none}#verdocs-view-header .right-controls .icon-button svg{display:block;width:20px;height:20px}@media print{#verdocs-view-header{display:none !important}verdocs-view{min-height:auto;background-color:white}verdocs-view .document{overflow:visible;height:auto;display:block;padding:0}verdocs-view .signed-document-container{width:100%;margin:0}}`;const H=`<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M11 8C11.2761 8 11.5 8.22386 11.5 8.5C11.5 8.77614 11.2761 9 11 9H6C5.72386 9 5.5 8.77614 5.5 8.5C5.5 8.22386 5.72386 8 6 8H11ZM14 8.5C14 5.46243 11.5376 3 8.5 3C5.46243 3 3 5.46243 3 8.5C3 11.5376 5.46243 14 8.5 14C9.83879 14 11.0659 13.5217 12.0196 12.7266L16.1464 16.8536L16.2157 16.9114C16.4106 17.0464 16.68 17.0271 16.8536 16.8536C17.0488 16.6583 17.0488 16.3417 16.8536 16.1464L12.7266 12.0196C13.5217 11.0659 14 9.83879 14 8.5ZM4 8.5C4 6.01472 6.01472 4 8.5 4C10.9853 4 13 6.01472 13 8.5C13 10.9853 10.9853 13 8.5 13C6.01472 13 4 10.9853 4 8.5Z" fill="#424242" /></svg>`;const I=`<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M11.5 8.5C11.5 8.22386 11.2761 8 11 8H9V6C9 5.72386 8.77614 5.5 8.5 5.5C8.22386 5.5 8 5.72386 8 6V8H6C5.72386 8 5.5 8.22386 5.5 8.5C5.5 8.77614 5.72386 9 6 9H8V11C8 11.2761 8.22386 11.5 8.5 11.5C8.77614 11.5 9 11.2761 9 11V9H11C11.2761 9 11.5 8.77614 11.5 8.5ZM8.5 3C11.5376 3 14 5.46243 14 8.5C14 9.83879 13.5217 11.0659 12.7266 12.0196L16.8536 16.1464C17.0488 16.3417 17.0488 16.6583 16.8536 16.8536C16.68 17.0271 16.4106 17.0464 16.2157 16.9114L16.1464 16.8536L12.0196 12.7266C11.0659 13.5217 9.83879 14 8.5 14C5.46243 14 3 11.5376 3 8.5C3 5.46243 5.46243 3 8.5 3ZM8.5 4C6.01472 4 4 6.01472 4 8.5C4 10.9853 6.01472 13 8.5 13C10.9853 13 13 10.9853 13 8.5C13 6.01472 10.9853 4 8.5 4Z" fill="#424242" /></svg>`;const M=`<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M15.5 16.9988C15.7761 16.9988 16 17.2226 16 17.4988C16 17.7442 15.8231 17.9484 15.5899 17.9907L15.5 17.9988H4.5C4.22386 17.9988 4 17.7749 4 17.4988C4 17.2533 4.17688 17.0492 4.41012 17.0068L4.5 16.9988H15.5ZM10.0001 2.00098C10.2456 2.00098 10.4497 2.17798 10.492 2.41124L10.5 2.50112L10.496 14.295L14.1414 10.6466C14.3148 10.4729 14.5842 10.4534 14.7792 10.5882L14.8485 10.646C15.0222 10.8194 15.0418 11.0888 14.907 11.2838L14.8492 11.3531L10.3574 15.8531C10.285 15.9257 10.1957 15.9714 10.1021 15.9901L9.99608 15.9999C9.83511 15.9999 9.69192 15.9237 9.60051 15.8056L5.14386 11.3537C4.94846 11.1586 4.94823 10.842 5.14336 10.6466C5.3168 10.4729 5.58621 10.4534 5.78117 10.5883L5.85046 10.6461L9.496 14.287L9.5 2.50083C9.50008 2.22469 9.724 2.00098 10.0001 2.00098Z" fill="#424242"/></svg>`;const j=`<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M5 4.5C5 3.67157 5.67157 3 6.5 3H13.5C14.3284 3 15 3.67157 15 4.5V5H15.5C16.8807 5 18 6.11929 18 7.5V12.5C18 13.3284 17.3284 14 16.5 14H15V15.5C15 16.3284 14.3284 17 13.5 17H6.5C5.67157 17 5 16.3284 5 15.5V14H3.5C2.67157 14 2 13.3284 2 12.5V7.5C2 6.11929 3.11929 5 4.5 5H5V4.5ZM6 5H14V4.5C14 4.22386 13.7761 4 13.5 4H6.5C6.22386 4 6 4.22386 6 4.5V5ZM5 13V11.5C5 10.6716 5.67157 10 6.5 10H13.5C14.3284 10 15 10.6716 15 11.5V13H16.5C16.7761 13 17 12.7761 17 12.5V7.5C17 6.67157 16.3284 6 15.5 6H4.5C3.67157 6 3 6.67157 3 7.5V12.5C3 12.7761 3.22386 13 3.5 13H5ZM6.5 11C6.22386 11 6 11.2239 6 11.5V15.5C6 15.7761 6.22386 16 6.5 16H13.5C13.7761 16 14 15.7761 14 15.5V11.5C14 11.2239 13.7761 11 13.5 11H6.5Z" fill="#424242"/></svg>`;const Z=e(class e extends o{constructor(e){super();if(e!==false){this.__registerHost()}this.sdkError=i(this,"sdkError");this.envelopeUpdated=i(this,"envelopeUpdated");this.another=i(this,"another");this.view=i(this,"view");this.next=i(this,"next");this.envelopeListenerId=null;this.endpoint=null;this.envelopeId="";this.headerTargetId=null;this.canceling=false;this.showCancelDone=false;this.showLoadError=false;this.loading=true;this.envelope=null;this.zoomLevel="normal";this.showDownloadDialog=false;this.polling=false;this.pollingInterval=null}async componentWillLoad(){var e,o,i;this.updateZoomFromWindow();window.addEventListener("resize",(()=>this.updateZoomFromWindow()));if(!this.endpoint){this.endpoint=r.getDefault();this.endpoint.loadSession()}if(!this.envelopeId){console.error(`[VIEW] Missing required envelopeId`);return}await this.listenToEnvelope();if(!this.envelope){try{console.log("[VIEW] Loading envelope...");this.envelope=await d(this.endpoint,this.envelopeId);console.log("[VIEW] Loaded envelope",this.envelope)}catch(t){this.showLoadError=true;(e=this.sdkError)===null||e===void 0?void 0:e.emit(new w(t.message,(o=t.response)===null||o===void 0?void 0:o.status,(i=t.response)===null||i===void 0?void 0:i.data))}}}componentDidRender(){const e=this.headerTargetId?document.getElementById(this.headerTargetId):null;const o=document.getElementById("verdocs-view-header");if(e&&o){console.log("[VIEW] Moving header");o.remove();e.append(o)}}disconnectedCallback(){this.stopPolling();this.unlistenToEnvelope();window.removeEventListener("resize",(()=>this.updateZoomFromWindow()))}updateZoomFromWindow(){const e=window.innerWidth;if(e<768){if(this.zoomLevel!=="zoom2")this.zoomLevel="zoom2"}else if(e<1024){if(this.zoomLevel!=="zoom1")this.zoomLevel="zoom1"}else{if(this.zoomLevel!=="normal")this.zoomLevel="normal"}}async listenToEnvelope(){console.log("[VIEW] Loading envelope",this.envelopeId);this.unlistenToEnvelope();g.subscribe("envelopes",this.envelopeId,(()=>d(this.endpoint,this.envelopeId)),true,(e=>{this.envelope=e;this.loading=false}))}unlistenToEnvelope(){if(this.envelopeListenerId){g.store.delListener(this.envelopeListenerId);this.envelopeListenerId=null}}handlePageRendered(e){}async handleOptionSelected(e){var o,i,t,s;switch(e.detail.id){case"cancel":if(confirm("Are you sure you wish to cancel this envelope? This action cannot be undone.")){this.canceling=true;h(this.endpoint,this.envelopeId).then((e=>{this.canceling=false;console.log("[VIEW] Envelope canceled",e);return d(this.endpoint,this.envelopeId)})).then((e=>{console.log("[VIEW] Loaded new envelope details",e);this.envelope=e})).catch((e=>{var o,i,t;this.canceling=false;console.log("[VIEW] Error canceling envelope",e);(o=this.sdkError)===null||o===void 0?void 0:o.emit(new w(e.message,(i=e.response)===null||i===void 0?void 0:i.status,(t=e.response)===null||t===void 0?void 0:t.data))}));this.showCancelDone=true;(o=this.envelopeUpdated)===null||o===void 0?void 0:o.emit({endpoint:this.endpoint,envelope:this.envelope,event:"canceled"})}break;case"print":window.print();(i=this.envelopeUpdated)===null||i===void 0?void 0:i.emit({endpoint:this.endpoint,envelope:this.envelope,event:"printed"});break;case"download":this.showDownloadDialog=true;this.startPolling();break;case"download-attachments":try{const e=this.envelope.documents.find((e=>e.type==="attachment"));if(e){const o=await c(this.endpoint,e.id);window.open(o,"_blank")}}catch(e){console.log("Unable to download document",e);u(((s=(t=e.response)===null||t===void 0?void 0:t.data)===null||s===void 0?void 0:s.error)||"Unable to download document. Please try again later.",{style:"error"})}break;case"download-certificate":{const e=this.envelope.documents.find((e=>e.type==="certificate"));if(e){const o=await c(this.endpoint,e.id);window.open(o,"_blank")}}break;case"download-all":a(this.endpoint,[this.envelope.id]).then((()=>{var e;(e=this.envelopeUpdated)===null||e===void 0?void 0:e.emit({endpoint:this.endpoint,envelope:this.envelope,event:"downloaded"})})).catch((e=>{console.log("Error downloading Zip",e)}));break}}startPolling(){this.stopPolling();const e=()=>{var e,o,i,t,s,n;const l=((e=this.envelope)===null||e===void 0?void 0:e.status)==="complete"||!!((o=this.envelope)===null||o===void 0?void 0:o.signed);const r=(t=(i=this.envelope)===null||i===void 0?void 0:i.documents)===null||t===void 0?void 0:t.some((e=>e.type==="certificate"));const d=(n=(s=this.envelope)===null||s===void 0?void 0:s.recipients)===null||n===void 0?void 0:n.every((e=>e.status==="submitted"));if(l&&r)return false;if(!d)return false;return true};if(!e()){return}this.polling=true;this.pollingInterval=setInterval((async()=>{try{const o=await d(this.endpoint,this.envelopeId);this.envelope=o;g.updateEnvelope(this.envelopeId,o);if(!e()){this.stopPolling()}}catch(e){console.error("[VIEW] Polling error",e);this.stopPolling()}}),5e3)}stopPolling(){if(this.pollingInterval){clearInterval(this.pollingInterval);this.pollingInterval=null}this.polling=false}handleZoomIn(){if(this.zoomLevel==="normal"){this.zoomLevel="zoom1"}else if(this.zoomLevel==="zoom1"){this.zoomLevel="zoom2"}}handleZoomOut(){if(this.zoomLevel==="zoom1"){this.zoomLevel="normal"}else if(this.zoomLevel==="zoom2"){this.zoomLevel="zoom1"}}async handleDownloadDocuments(e){var o,i;const{action:t,documentId:s}=e.detail;console.log("[VIEW] Download action selected:",t,s);try{switch(t){case f.certificate:const e=this.envelope.documents.find((e=>e.type==="certificate"));if(!e){u("Certificate not yet available.",{style:"info"});break}const t=await c(this.endpoint,e.id);window.open(t,"_blank");break;case f.combined:const n=s||((o=this.envelope.documents.find((e=>e.type==="certificate")))===null||o===void 0?void 0:o.id);const l=await v(this.endpoint,n);window.open(l,"_blank");break;case f.document:const r=s||((i=this.envelope.documents.find((e=>e.type==="attachment")))===null||i===void 0?void 0:i.id);if(!r)break;const d=await c(this.endpoint,r);window.open(d,"_blank");break;case f.zip:const h=await a(this.endpoint,[this.envelopeId]);const m=window.URL.createObjectURL(h.data);const p=document.createElement("a");p.href=m;p.download=`${this.envelope.name}.zip`;document.body.appendChild(p);p.click();p.remove();window.URL.revokeObjectURL(m);break}}catch(e){console.error("Download error",e);u("Unable to complete download request.",{style:"error"})}}render(){var e;if(this.loading){return t(s,null,t("verdocs-loader",null))}if(this.showLoadError){return t(s,null,t("verdocs-ok-dialog",{heading:"Unable to View Envelope",message:`Sorry, that envelope is not valid.`,buttonLabel:"OK",onNext:()=>{this.showLoadError=false}}))}if(!this.envelope){return t(s,null,t("img",{src:"https://public-assets.verdocs.com/loading-placeholder.png",style:{width:"612px",height:"792px",boxShadow:"0 0 10px 5px #0000000f",marginTop:"15px"},alt:"Placeholder page"}))}const o=m(this.endpoint.session,this.envelope);return t(s,null,t("div",{class:"controls-toolbar",id:"verdocs-view-header"},t("div",{class:"left-controls"},t("div",{class:"title"},this.envelope.name)),t("div",{class:"center-controls"}),t("div",{class:"right-controls"},t("div",{class:{"icon-button":true,minus:true,disabled:this.zoomLevel==="normal"},innerHTML:H,onClick:()=>this.handleZoomOut()}),t("div",{class:{"icon-button":true,plus:true,disabled:this.zoomLevel==="zoom2"},innerHTML:I,onClick:()=>this.handleZoomIn()}),t("div",{class:"icon-button download",innerHTML:M,onClick:()=>this.handleOptionSelected({detail:{id:"download"}})}),t("div",{class:"icon-button print",innerHTML:j,onClick:()=>this.handleOptionSelected({detail:{id:"print"}})}))),t("div",{class:`document signed-document-container zoom-${this.zoomLevel}`,style:{paddingTop:this.headerTargetId?"70px":"15px"}},(((e=this.envelope)===null||e===void 0?void 0:e.documents)||[]).filter((e=>e.type!=="certificate")).map((e=>{const o=p(1,e.pages);return t(n,null,o.map((o=>{var i;const s=((i=e.page_sizes)===null||i===void 0?void 0:i[o])||{width:612,height:792};return t("verdocs-envelope-document-page",{envelopeId:this.envelopeId,documentId:e.id,endpoint:this.endpoint,type:"filled",virtualWidth:s.width,virtualHeight:s.height,pageNumber:o,onPageRendered:e=>this.handlePageRendered(e),layers:[{name:"page",type:"canvas"},{name:"controls",type:"div"}]})})))}))),this.showCancelDone&&t("verdocs-ok-dialog",{heading:"Cancelled",message:`This envelope has been cancelled successfully.`,onNext:()=>{this.showCancelDone=false}}),this.canceling&&t("div",{class:"loading-indicator"},t("verdocs-loader",null)),this.showDownloadDialog&&t("verdocs-download-dialog",{signed:this.envelope.status==="complete"||this.envelope.signed,polling:this.polling,documents:this.envelope.documents,onExit:()=>{this.showDownloadDialog=false;this.stopPolling()},onDownload:e=>this.handleDownloadDocuments(e)}),!!o&&t("verdocs-sign-footer",{endpoint:this.endpoint,envelopeId:this.envelopeId,isDone:true,onAskQuestion:()=>{},onDecline:()=>{},onFinishLater:()=>{}}))}get component(){return this}static get style(){return E()}},[0,"verdocs-view",{endpoint:[16],envelopeId:[1,"envelope-id"],headerTargetId:[1,"header-target-id"],canceling:[32],showCancelDone:[32],showLoadError:[32],loading:[32],envelope:[32],zoomLevel:[32],showDownloadDialog:[32],polling:[32]}]);function D(){if(typeof customElements==="undefined"){return}const e=["verdocs-view","verdocs-dialog","verdocs-download-dialog","verdocs-envelope-document-page","verdocs-flag","verdocs-loader","verdocs-ok-dialog","verdocs-question-dialog","verdocs-sign-footer"];e.forEach((e=>{switch(e){case"verdocs-view":if(!customElements.get(l(e))){customElements.define(l(e),Z)}break;case"verdocs-dialog":if(!customElements.get(l(e))){x()}break;case"verdocs-download-dialog":if(!customElements.get(l(e))){b()}break;case"verdocs-envelope-document-page":if(!customElements.get(l(e))){C()}break;case"verdocs-flag":if(!customElements.get(l(e))){y()}break;case"verdocs-loader":if(!customElements.get(l(e))){k()}break;case"verdocs-ok-dialog":if(!customElements.get(l(e))){z()}break;case"verdocs-question-dialog":if(!customElements.get(l(e))){L()}break;case"verdocs-sign-footer":if(!customElements.get(l(e))){V()}break}}))}export{Z as V,D as d};
|
|
2
|
-
//# sourceMappingURL=p-
|
|
1
|
+
import{p as e,H as o,c as i,h as t,d as s,F as n,t as l}from"./p-yZBlG3YQ.js";import{VerdocsEndpoint as r,getEnvelope as d,getEnvelopesZip as a,getEnvelopeDocumentDownloadLink as c,cancelEnvelope as h,getCombinedEnvelopeDocumentDownloadLink as v,getMyRecipient as m,integerSequence as p}from"@verdocs/js-sdk";import{D as f}from"./p-17OorOnH.js";import{V as u}from"./p-D97GxsI-.js";import{S as w}from"./p-C1sRVZWv.js";import{S as g}from"./p-C7hFgM52.js";import{d as x}from"./p-C90lxyUX.js";import{d as b}from"./p-PVw56Shw.js";import{d as C}from"./p-DscL0SIM.js";import{d as y}from"./p-C8yiLtCJ.js";import{d as k}from"./p-DqzFuSNN.js";import{d as z}from"./p-5FU3bYQ3.js";import{d as L}from"./p-8J_y0V9M.js";import{d as V}from"./p-D495hZfr.js";const E=()=>`verdocs-view{display:-ms-flexbox;display:flex;overflow:hidden;min-height:600px;position:relative;-ms-flex-direction:column;flex-direction:column;-webkit-box-sizing:border-box;box-sizing:border-box;font-family:var(--verdocs-primary-font, "Inter", "Barlow", sans-serif);background-color:#f5f5f5}verdocs-view div,verdocs-view canvas{-webkit-box-sizing:border-box;box-sizing:border-box}verdocs-view .document{-ms-flex:1;flex:1;width:100%;height:100%;display:-ms-flexbox;display:flex;row-gap:15px;min-height:200px;max-width:1200px;position:relative;overflow-y:scroll;-ms-flex-align:center;align-items:center;-webkit-box-sizing:border-box;box-sizing:border-box;-ms-flex-direction:column;flex-direction:column;padding-right:15px}verdocs-view .document .inner{width:100%;max-width:1028px}verdocs-view .signed-document-container{width:64%;margin:0 auto;-webkit-transition:all 0.3s ease;transition:all 0.3s ease;padding:15px;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-ms-flex-align:center;align-items:center;gap:15px}verdocs-view .signed-document-container.zoom-normal{width:64%}verdocs-view .signed-document-container.zoom-zoom1{width:80%}verdocs-view .signed-document-container.zoom-zoom2{width:100%}@media (max-width: 768px){verdocs-view .signed-document-container{width:100%}verdocs-view .signed-document-container.zoom-normal,verdocs-view .signed-document-container.zoom-zoom1,verdocs-view .signed-document-container.zoom-zoom2{width:100%}verdocs-view .controls-toolbar .center-controls{display:none}verdocs-view .controls-toolbar .right-controls .icon-button.minus,verdocs-view .controls-toolbar .right-controls .icon-button.plus{display:none}}verdocs-view .loading-indicator{top:0;left:0;right:0;bottom:0;display:-ms-flexbox;display:flex;z-index:10000;position:fixed;background-color:rgba(0, 0, 0, 0.7);-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center}verdocs-view verdocs-ok-dialog .background-overlay{-ms-flex-align:start;align-items:flex-start;padding-top:100px}#verdocs-view-header{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:justify;justify-content:space-between;height:54px;padding:0 12px 0 24px;background-color:#ffffff;border-bottom:1px solid #e0e0e0;-webkit-box-shadow:none;box-shadow:none;font-family:"Inter", sans-serif;color:#424242;z-index:1000;width:100%;-webkit-box-sizing:border-box;box-sizing:border-box}#verdocs-view-header .left-controls{-ms-flex:1;flex:1;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}#verdocs-view-header .left-controls .title{font-weight:500;font-size:16px;color:#242424;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}#verdocs-view-header .center-controls{-ms-flex:1;flex:1;display:none;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;gap:10px;font-size:14px}#verdocs-view-header .right-controls{-ms-flex:1;flex:1;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:end;justify-content:flex-end}#verdocs-view-header .right-controls .icon-button{width:32px;height:32px;display:-ms-flexbox;display:flex;color:#424242;cursor:pointer;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;-webkit-transition:background-color 0.2s;transition:background-color 0.2s}#verdocs-view-header .right-controls .icon-button:hover{background-color:#f5f5f5}#verdocs-view-header .right-controls .icon-button.disabled{opacity:0.3;pointer-events:none}#verdocs-view-header .right-controls .icon-button svg{display:block;width:20px;height:20px}@media print{#verdocs-view-header{display:none !important}verdocs-view{min-height:auto;background-color:white}verdocs-view .document{overflow:visible;height:auto;display:block;padding:0}verdocs-view .signed-document-container{width:100%;margin:0}}`;const H=`<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M11 8C11.2761 8 11.5 8.22386 11.5 8.5C11.5 8.77614 11.2761 9 11 9H6C5.72386 9 5.5 8.77614 5.5 8.5C5.5 8.22386 5.72386 8 6 8H11ZM14 8.5C14 5.46243 11.5376 3 8.5 3C5.46243 3 3 5.46243 3 8.5C3 11.5376 5.46243 14 8.5 14C9.83879 14 11.0659 13.5217 12.0196 12.7266L16.1464 16.8536L16.2157 16.9114C16.4106 17.0464 16.68 17.0271 16.8536 16.8536C17.0488 16.6583 17.0488 16.3417 16.8536 16.1464L12.7266 12.0196C13.5217 11.0659 14 9.83879 14 8.5ZM4 8.5C4 6.01472 6.01472 4 8.5 4C10.9853 4 13 6.01472 13 8.5C13 10.9853 10.9853 13 8.5 13C6.01472 13 4 10.9853 4 8.5Z" fill="#424242" /></svg>`;const I=`<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M11.5 8.5C11.5 8.22386 11.2761 8 11 8H9V6C9 5.72386 8.77614 5.5 8.5 5.5C8.22386 5.5 8 5.72386 8 6V8H6C5.72386 8 5.5 8.22386 5.5 8.5C5.5 8.77614 5.72386 9 6 9H8V11C8 11.2761 8.22386 11.5 8.5 11.5C8.77614 11.5 9 11.2761 9 11V9H11C11.2761 9 11.5 8.77614 11.5 8.5ZM8.5 3C11.5376 3 14 5.46243 14 8.5C14 9.83879 13.5217 11.0659 12.7266 12.0196L16.8536 16.1464C17.0488 16.3417 17.0488 16.6583 16.8536 16.8536C16.68 17.0271 16.4106 17.0464 16.2157 16.9114L16.1464 16.8536L12.0196 12.7266C11.0659 13.5217 9.83879 14 8.5 14C5.46243 14 3 11.5376 3 8.5C3 5.46243 5.46243 3 8.5 3ZM8.5 4C6.01472 4 4 6.01472 4 8.5C4 10.9853 6.01472 13 8.5 13C10.9853 13 13 10.9853 13 8.5C13 6.01472 10.9853 4 8.5 4Z" fill="#424242" /></svg>`;const M=`<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M15.5 16.9988C15.7761 16.9988 16 17.2226 16 17.4988C16 17.7442 15.8231 17.9484 15.5899 17.9907L15.5 17.9988H4.5C4.22386 17.9988 4 17.7749 4 17.4988C4 17.2533 4.17688 17.0492 4.41012 17.0068L4.5 16.9988H15.5ZM10.0001 2.00098C10.2456 2.00098 10.4497 2.17798 10.492 2.41124L10.5 2.50112L10.496 14.295L14.1414 10.6466C14.3148 10.4729 14.5842 10.4534 14.7792 10.5882L14.8485 10.646C15.0222 10.8194 15.0418 11.0888 14.907 11.2838L14.8492 11.3531L10.3574 15.8531C10.285 15.9257 10.1957 15.9714 10.1021 15.9901L9.99608 15.9999C9.83511 15.9999 9.69192 15.9237 9.60051 15.8056L5.14386 11.3537C4.94846 11.1586 4.94823 10.842 5.14336 10.6466C5.3168 10.4729 5.58621 10.4534 5.78117 10.5883L5.85046 10.6461L9.496 14.287L9.5 2.50083C9.50008 2.22469 9.724 2.00098 10.0001 2.00098Z" fill="#424242"/></svg>`;const j=`<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M5 4.5C5 3.67157 5.67157 3 6.5 3H13.5C14.3284 3 15 3.67157 15 4.5V5H15.5C16.8807 5 18 6.11929 18 7.5V12.5C18 13.3284 17.3284 14 16.5 14H15V15.5C15 16.3284 14.3284 17 13.5 17H6.5C5.67157 17 5 16.3284 5 15.5V14H3.5C2.67157 14 2 13.3284 2 12.5V7.5C2 6.11929 3.11929 5 4.5 5H5V4.5ZM6 5H14V4.5C14 4.22386 13.7761 4 13.5 4H6.5C6.22386 4 6 4.22386 6 4.5V5ZM5 13V11.5C5 10.6716 5.67157 10 6.5 10H13.5C14.3284 10 15 10.6716 15 11.5V13H16.5C16.7761 13 17 12.7761 17 12.5V7.5C17 6.67157 16.3284 6 15.5 6H4.5C3.67157 6 3 6.67157 3 7.5V12.5C3 12.7761 3.22386 13 3.5 13H5ZM6.5 11C6.22386 11 6 11.2239 6 11.5V15.5C6 15.7761 6.22386 16 6.5 16H13.5C13.7761 16 14 15.7761 14 15.5V11.5C14 11.2239 13.7761 11 13.5 11H6.5Z" fill="#424242"/></svg>`;const Z=e(class e extends o{constructor(e){super();if(e!==false){this.__registerHost()}this.sdkError=i(this,"sdkError");this.envelopeUpdated=i(this,"envelopeUpdated");this.another=i(this,"another");this.view=i(this,"view");this.next=i(this,"next");this.envelopeListenerId=null;this.endpoint=null;this.envelopeId="";this.headerTargetId=null;this.canceling=false;this.showCancelDone=false;this.showLoadError=false;this.loading=true;this.envelope=null;this.zoomLevel="normal";this.showDownloadDialog=false;this.polling=false;this.pollingInterval=null}async componentWillLoad(){var e,o,i;this.updateZoomFromWindow();window.addEventListener("resize",(()=>this.updateZoomFromWindow()));if(!this.endpoint){this.endpoint=r.getDefault();this.endpoint.loadSession()}if(!this.envelopeId){console.error(`[VIEW] Missing required envelopeId`);return}await this.listenToEnvelope();if(!this.envelope){try{console.log("[VIEW] Loading envelope...");this.envelope=await d(this.endpoint,this.envelopeId);console.log("[VIEW] Loaded envelope",this.envelope)}catch(t){this.showLoadError=true;(e=this.sdkError)===null||e===void 0?void 0:e.emit(new w(t.message,(o=t.response)===null||o===void 0?void 0:o.status,(i=t.response)===null||i===void 0?void 0:i.data))}}}componentDidRender(){const e=this.headerTargetId?document.getElementById(this.headerTargetId):null;const o=document.getElementById("verdocs-view-header");if(e&&o){console.log("[VIEW] Moving header");o.remove();e.append(o)}}disconnectedCallback(){this.stopPolling();this.unlistenToEnvelope();window.removeEventListener("resize",(()=>this.updateZoomFromWindow()))}updateZoomFromWindow(){const e=window.innerWidth;if(e<768){if(this.zoomLevel!=="zoom2")this.zoomLevel="zoom2"}else if(e<1024){if(this.zoomLevel!=="zoom1")this.zoomLevel="zoom1"}else{if(this.zoomLevel!=="normal")this.zoomLevel="normal"}}async listenToEnvelope(){console.log("[VIEW] Loading envelope",this.envelopeId);this.unlistenToEnvelope();g.subscribe("envelopes",this.envelopeId,(()=>d(this.endpoint,this.envelopeId)),true,(e=>{this.envelope=e;this.loading=false}))}unlistenToEnvelope(){if(this.envelopeListenerId){g.store.delListener(this.envelopeListenerId);this.envelopeListenerId=null}}handlePageRendered(e){}async handleOptionSelected(e){var o,i,t,s;switch(e.detail.id){case"cancel":if(confirm("Are you sure you wish to cancel this envelope? This action cannot be undone.")){this.canceling=true;h(this.endpoint,this.envelopeId).then((e=>{this.canceling=false;console.log("[VIEW] Envelope canceled",e);return d(this.endpoint,this.envelopeId)})).then((e=>{console.log("[VIEW] Loaded new envelope details",e);this.envelope=e})).catch((e=>{var o,i,t;this.canceling=false;console.log("[VIEW] Error canceling envelope",e);(o=this.sdkError)===null||o===void 0?void 0:o.emit(new w(e.message,(i=e.response)===null||i===void 0?void 0:i.status,(t=e.response)===null||t===void 0?void 0:t.data))}));this.showCancelDone=true;(o=this.envelopeUpdated)===null||o===void 0?void 0:o.emit({endpoint:this.endpoint,envelope:this.envelope,event:"canceled"})}break;case"print":window.print();(i=this.envelopeUpdated)===null||i===void 0?void 0:i.emit({endpoint:this.endpoint,envelope:this.envelope,event:"printed"});break;case"download":this.showDownloadDialog=true;this.startPolling();break;case"download-attachments":try{const e=this.envelope.documents.find((e=>e.type==="attachment"));if(e){const o=await c(this.endpoint,e.id);window.open(o,"_blank")}}catch(e){console.log("Unable to download document",e);u(((s=(t=e.response)===null||t===void 0?void 0:t.data)===null||s===void 0?void 0:s.error)||"Unable to download document. Please try again later.",{style:"error"})}break;case"download-certificate":{const e=this.envelope.documents.find((e=>e.type==="certificate"));if(e){const o=await c(this.endpoint,e.id);window.open(o,"_blank")}}break;case"download-all":a(this.endpoint,[this.envelope.id]).then((()=>{var e;(e=this.envelopeUpdated)===null||e===void 0?void 0:e.emit({endpoint:this.endpoint,envelope:this.envelope,event:"downloaded"})})).catch((e=>{console.log("Error downloading Zip",e)}));break}}startPolling(){this.stopPolling();const e=()=>{var e,o,i,t,s,n;const l=((e=this.envelope)===null||e===void 0?void 0:e.status)==="complete"||!!((o=this.envelope)===null||o===void 0?void 0:o.signed);const r=(t=(i=this.envelope)===null||i===void 0?void 0:i.documents)===null||t===void 0?void 0:t.some((e=>e.type==="certificate"));const d=(n=(s=this.envelope)===null||s===void 0?void 0:s.recipients)===null||n===void 0?void 0:n.every((e=>e.status==="submitted"));if(l&&r)return false;if(!d)return false;return true};if(!e()){return}this.polling=true;this.pollingInterval=setInterval((async()=>{try{const o=await d(this.endpoint,this.envelopeId);this.envelope=o;g.updateEnvelope(this.envelopeId,o);if(!e()){this.stopPolling()}}catch(e){console.error("[VIEW] Polling error",e);this.stopPolling()}}),5e3)}stopPolling(){if(this.pollingInterval){clearInterval(this.pollingInterval);this.pollingInterval=null}this.polling=false}handleZoomIn(){if(this.zoomLevel==="normal"){this.zoomLevel="zoom1"}else if(this.zoomLevel==="zoom1"){this.zoomLevel="zoom2"}}handleZoomOut(){if(this.zoomLevel==="zoom1"){this.zoomLevel="normal"}else if(this.zoomLevel==="zoom2"){this.zoomLevel="zoom1"}}async handleDownloadDocuments(e){var o,i;const{action:t,documentId:s}=e.detail;console.log("[VIEW] Download action selected:",t,s);try{switch(t){case f.certificate:const e=this.envelope.documents.find((e=>e.type==="certificate"));if(!e){u("Certificate not yet available.",{style:"info"});break}const t=await c(this.endpoint,e.id);window.open(t,"_blank");break;case f.combined:const n=s||((o=this.envelope.documents.find((e=>e.type==="certificate")))===null||o===void 0?void 0:o.id);const l=await v(this.endpoint,n);window.open(l,"_blank");break;case f.document:const r=s||((i=this.envelope.documents.find((e=>e.type==="attachment")))===null||i===void 0?void 0:i.id);if(!r)break;const d=await c(this.endpoint,r);window.open(d,"_blank");break;case f.zip:const h=await a(this.endpoint,[this.envelopeId]);const m=window.URL.createObjectURL(h.data);const p=document.createElement("a");p.href=m;p.download=`${this.envelope.name}.zip`;document.body.appendChild(p);p.click();p.remove();window.URL.revokeObjectURL(m);break}}catch(e){console.error("Download error",e);u("Unable to complete download request.",{style:"error"})}}render(){var e;if(this.loading){return t(s,null,t("verdocs-loader",null))}if(this.showLoadError){return t(s,null,t("verdocs-ok-dialog",{heading:"Unable to View Envelope",message:`Sorry, that envelope is not valid.`,buttonLabel:"OK",onNext:()=>{this.showLoadError=false}}))}if(!this.envelope){return t(s,null,t("img",{src:"https://public-assets.verdocs.com/loading-placeholder.png",style:{width:"612px",height:"792px",boxShadow:"0 0 10px 5px #0000000f",marginTop:"15px"},alt:"Placeholder page"}))}const o=m(this.endpoint.session,this.envelope);return t(s,null,t("div",{class:"controls-toolbar",id:"verdocs-view-header"},t("div",{class:"left-controls"},t("div",{class:"title"},this.envelope.name)),t("div",{class:"center-controls"}),t("div",{class:"right-controls"},t("div",{class:{"icon-button":true,minus:true,disabled:this.zoomLevel==="normal"},innerHTML:H,onClick:()=>this.handleZoomOut()}),t("div",{class:{"icon-button":true,plus:true,disabled:this.zoomLevel==="zoom2"},innerHTML:I,onClick:()=>this.handleZoomIn()}),t("div",{class:"icon-button download",innerHTML:M,onClick:()=>this.handleOptionSelected({detail:{id:"download"}})}),t("div",{class:"icon-button print",innerHTML:j,onClick:()=>this.handleOptionSelected({detail:{id:"print"}})}))),t("div",{class:`document signed-document-container zoom-${this.zoomLevel}`,style:{paddingTop:this.headerTargetId?"70px":"15px"}},(((e=this.envelope)===null||e===void 0?void 0:e.documents)||[]).filter((e=>e.type!=="certificate")).map((e=>{const o=p(1,e.pages);return t(n,null,o.map((o=>{var i;const s=((i=e.page_sizes)===null||i===void 0?void 0:i[o])||{width:612,height:792};return t("verdocs-envelope-document-page",{envelopeId:this.envelopeId,documentId:e.id,endpoint:this.endpoint,type:"filled",virtualWidth:s.width,virtualHeight:s.height,pageNumber:o,onPageRendered:e=>this.handlePageRendered(e),layers:[{name:"page",type:"canvas"},{name:"controls",type:"div"}]})})))}))),this.showCancelDone&&t("verdocs-ok-dialog",{heading:"Cancelled",message:`This envelope has been cancelled successfully.`,onNext:()=>{this.showCancelDone=false}}),this.canceling&&t("div",{class:"loading-indicator"},t("verdocs-loader",null)),this.showDownloadDialog&&t("verdocs-download-dialog",{signed:this.envelope.status==="complete"||this.envelope.signed,polling:this.polling,documents:this.envelope.documents,onExit:()=>{this.showDownloadDialog=false;this.stopPolling()},onDownload:e=>this.handleDownloadDocuments(e)}),!!o&&t("verdocs-sign-footer",{endpoint:this.endpoint,envelopeId:this.envelopeId,isDone:true,onAskQuestion:()=>{},onDecline:()=>{},onFinishLater:()=>{}}))}get component(){return this}static get style(){return E()}},[0,"verdocs-view",{endpoint:[16],envelopeId:[1,"envelope-id"],headerTargetId:[1,"header-target-id"],canceling:[32],showCancelDone:[32],showLoadError:[32],loading:[32],envelope:[32],zoomLevel:[32],showDownloadDialog:[32],polling:[32]}]);function D(){if(typeof customElements==="undefined"){return}const e=["verdocs-view","verdocs-dialog","verdocs-download-dialog","verdocs-envelope-document-page","verdocs-flag","verdocs-loader","verdocs-ok-dialog","verdocs-question-dialog","verdocs-sign-footer"];e.forEach((e=>{switch(e){case"verdocs-view":if(!customElements.get(l(e))){customElements.define(l(e),Z)}break;case"verdocs-dialog":if(!customElements.get(l(e))){x()}break;case"verdocs-download-dialog":if(!customElements.get(l(e))){b()}break;case"verdocs-envelope-document-page":if(!customElements.get(l(e))){C()}break;case"verdocs-flag":if(!customElements.get(l(e))){y()}break;case"verdocs-loader":if(!customElements.get(l(e))){k()}break;case"verdocs-ok-dialog":if(!customElements.get(l(e))){z()}break;case"verdocs-question-dialog":if(!customElements.get(l(e))){L()}break;case"verdocs-sign-footer":if(!customElements.get(l(e))){V()}break}}))}export{Z as V,D as d};
|
|
2
|
+
//# sourceMappingURL=p-06em1_P-.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{p as e,H as s,c as i,h as t,d as n,t as o}from"./p-yZBlG3YQ.js";import{getTemplate as r,getBrands as d,getOrganization as a,formatFullName as l,getOrganizationContacts as c,isValidEmail as p,createEnvelope as h,getRGBA as f}from"@verdocs/js-sdk";import{D as v,g as u}from"./p-Cq60Emo_.js";import{u as m,d as x}from"./p-ByrpRZ3E.js";import{V as b}from"./p-D97GxsI-.js";import{S as g}from"./p-C1sRVZWv.js";import{S as w}from"./p-C7hFgM52.js";import{d as k}from"./p-Bb5V9TQx.js";import{d as y}from"./p-DGNIsXfr.js";import{d as S}from"./p-C-v22G3g.js";import{d as E}from"./p-C8yiLtCJ.js";import{d as D}from"./p-DqzFuSNN.js";import{d as C}from"./p-DreV6Npp.js";const z=e=>((e===null||e===void 0?void 0:e.roles)||[]).map((e=>e.name));const N=(e,s)=>Math.max(z(e).findIndex((e=>e===s)),0);const j=()=>`verdocs-send{--send-ink:var(--verdocs-body-color, #111827);--send-ink-2:#374151;--send-muted:#6b7280;--send-faint:#9ca3af;--send-rule:#e5e7eb;--send-control-border:#d1d5db;--send-accent:var(--verdocs-link-color, #4c56cb);--send-accent-tint:#f4f5fc;--send-accent-tint-2:#e6e7f8;--send-warning-bg:#fffbeb;--send-warning-border:#fde68a;--send-warning-icon:#d97706;--send-warning-text:#78350f;--send-radius:var(--verdocs-dialog-radius, 8px);--send-min-height:480px;--send-max-width:480px;display:none;position:relative;overflow:hidden;width:100%;max-width:var(--verdocs-send-max-width, var(--send-max-width));-webkit-box-sizing:border-box;box-sizing:border-box;background:#ffffff;color:var(--send-ink);font-size:14px;border-radius:var(--send-radius);border:1px solid var(--send-rule);font-family:var(--verdocs-primary-font, "Inter", "Barlow", sans-serif)}verdocs-send *{-webkit-box-sizing:border-box;box-sizing:border-box}verdocs-send.sendable{display:block}verdocs-send .track{position:relative;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;min-height:var(--send-min-height);-webkit-transition:-webkit-transform 220ms ease-out;transition:-webkit-transform 220ms ease-out;transition:transform 220ms ease-out;transition:transform 220ms ease-out, -webkit-transform 220ms ease-out}verdocs-send.detail-open .track{-webkit-transform:translateX(-100%);transform:translateX(-100%)}@media (prefers-reduced-motion: reduce){verdocs-send .track{-webkit-transition:none;transition:none}}verdocs-send .pane{padding:16px;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}verdocs-send .main-pane{-ms-flex:1;flex:1}verdocs-send .detail-pane{position:absolute;top:0;left:100%;bottom:0;width:100%;overflow:hidden}verdocs-send .detail{-ms-flex:1;flex:1;min-height:0;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}verdocs-send .detail-body-wrap{position:relative;-ms-flex:1;flex:1;min-height:0;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}verdocs-send .detail-body{-ms-flex:1;flex:1;min-height:0;overflow-y:auto}verdocs-send .scroll-fade{position:absolute;left:0;right:0;bottom:0;height:36px;opacity:0;pointer-events:none;-webkit-transition:opacity 150ms ease-out;transition:opacity 150ms ease-out;background:-webkit-gradient(linear, left top, left bottom, from(rgba(255, 255, 255, 0)), to(#ffffff));background:linear-gradient(rgba(255, 255, 255, 0), #ffffff)}verdocs-send .scrollable:not(.at-end)>.scroll-fade{opacity:1}verdocs-send .recipient-detail verdocs-contact-picker{-ms-flex:1;flex:1;min-height:0;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}verdocs-send .section-title{font-size:12px;font-weight:600;color:var(--send-ink-2);margin:0 0 6px 0}verdocs-send .delivery-title{margin-top:16px}verdocs-send .step{font-size:11px;color:var(--send-muted);padding:10px 0 4px 0}verdocs-send .recipient,verdocs-send .kv{all:unset;display:-ms-flexbox;display:flex;width:100%;cursor:pointer;-ms-flex-align:center;align-items:center;-webkit-column-gap:10px;-moz-column-gap:10px;column-gap:10px;border-top:1px solid var(--send-rule);color:var(--send-ink);font-family:inherit}verdocs-send .recipient:focus-visible,verdocs-send .kv:focus-visible{outline:2px solid var(--send-accent);outline-offset:-2px;border-radius:4px}verdocs-send .recipient .chevron,verdocs-send .kv .chevron{-ms-flex:0 0 16px;flex:0 0 16px;width:16px;height:16px;color:var(--send-faint)}verdocs-send .recipient .chevron svg,verdocs-send .kv .chevron svg{width:16px;height:16px;display:block}verdocs-send .recipient{padding:8px 6px 8px 0}verdocs-send .recipient:last-child{border-bottom:1px solid var(--send-rule)}verdocs-send .recipient .who{-ms-flex:1;flex:1;min-width:0;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}verdocs-send .recipient .role-name{font-size:13px;font-weight:600}verdocs-send .recipient .who-detail{font-size:12px;color:var(--send-muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}verdocs-send .recipient .who-detail.configure{color:var(--send-accent);font-weight:500}verdocs-send .recipient .options{display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;gap:4px;margin-top:3px}verdocs-send .recipient .pill{height:18px;padding:0 6px;border-radius:999px;font-size:10px;font-weight:500;display:-ms-inline-flexbox;display:inline-flex;-ms-flex-align:center;align-items:center;background:var(--send-accent-tint);color:var(--send-ink-2)}verdocs-send .role-dot{-ms-flex:0 0 10px;flex:0 0 10px;width:10px;height:10px;border-radius:50%;border:1px solid rgba(0, 0, 0, 0.1)}verdocs-send .kv{height:40px;padding:0 6px 0 0;font-size:13px}verdocs-send .kv:last-child{border-bottom:1px solid var(--send-rule)}verdocs-send .kv:disabled{cursor:default;color:var(--send-muted)}verdocs-send .kv .key{-ms-flex:0 0 84px;flex:0 0 84px;color:var(--send-muted)}verdocs-send .kv .value{-ms-flex:1;flex:1;min-width:0;font-weight:500;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}verdocs-send .kv .value small{font-size:inherit;font-weight:400;color:var(--send-muted)}verdocs-send .kv .value.off{color:var(--send-warning-icon)}verdocs-send .main-spacer,verdocs-send .detail-spacer{-ms-flex:1;flex:1}verdocs-send .buttons{display:-ms-flexbox;display:flex;margin-top:14px;-webkit-column-gap:10px;-moz-column-gap:10px;column-gap:10px;-ms-flex-wrap:wrap;flex-wrap:wrap;-ms-flex-direction:row;flex-direction:row;-ms-flex-align:center;align-items:center;-ms-flex-pack:end;justify-content:flex-end}verdocs-send .buttons .error-message{width:100%;color:#cc0000;font-size:13px;margin-bottom:10px}verdocs-send .detail-header{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-webkit-column-gap:8px;-moz-column-gap:8px;column-gap:8px;margin:-2px 0 14px 0}verdocs-send .detail-header .back{all:unset;display:-ms-inline-flexbox;display:inline-flex;-ms-flex-align:center;align-items:center;cursor:pointer;font-size:13px;font-weight:500;color:var(--send-accent);font-family:inherit;-ms-flex:0 0 52px;flex:0 0 52px}verdocs-send .detail-header .back .icon,verdocs-send .detail-header .back .icon svg{width:16px;height:16px;display:block}verdocs-send .detail-header .back:focus-visible{outline:2px solid var(--send-accent);outline-offset:2px;border-radius:4px}verdocs-send .detail-header .detail-title{-ms-flex:1;flex:1;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;-webkit-column-gap:8px;-moz-column-gap:8px;column-gap:8px;font-size:14px;font-weight:600;text-align:center}verdocs-send .detail-header .detail-header-spacer{-ms-flex:0 0 52px;flex:0 0 52px}verdocs-send .detail-footer{margin-top:10px;padding-top:12px;border-top:1px solid var(--send-rule)}verdocs-send .detail-footer verdocs-button,verdocs-send .detail-footer verdocs-button button{width:100%}verdocs-send .hint{font-size:12px;line-height:1.5;color:var(--send-muted);margin:10px 0 0 0}verdocs-send .option-list{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}verdocs-send .option{all:unset;display:-ms-flexbox;display:flex;width:100%;cursor:pointer;-ms-flex-align:center;align-items:center;-webkit-column-gap:10px;-moz-column-gap:10px;column-gap:10px;padding:10px 0;font-size:13px;font-family:inherit;color:var(--send-ink);border-top:1px solid var(--send-rule)}verdocs-send .option:first-child{border-top:0}verdocs-send .option:focus-visible{outline:2px solid var(--send-accent);outline-offset:-2px;border-radius:4px}verdocs-send .option .radio{-ms-flex:0 0 16px;flex:0 0 16px;width:16px;height:16px;border-radius:50%;border:1px solid var(--send-control-border);display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center}verdocs-send .option.selected .radio{border-color:var(--send-accent)}verdocs-send .option.selected .radio::after{content:"";width:8px;height:8px;border-radius:50%;background:var(--send-accent)}verdocs-send .option .swatch{-ms-flex:0 0 22px;flex:0 0 22px;width:22px;height:22px;border-radius:5px;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;font-size:9px;font-weight:700;color:#ffffff;overflow:hidden}verdocs-send .option .swatch.logo{background:#ffffff;border:1px solid var(--send-rule)}verdocs-send .option .swatch img{width:100%;height:100%;-o-object-fit:contain;object-fit:contain;display:block}verdocs-send .option .option-label{-ms-flex:1;flex:1;min-width:0;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}verdocs-send .option .option-label small{font-size:11px;color:var(--send-muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}verdocs-send .option-divider{height:0;margin:2px 0;border-top:1px solid var(--send-control-border)}verdocs-send .option-divider+.option{border-top:0}verdocs-send .hint a{color:var(--send-accent);font-weight:500;text-decoration:none;border-bottom:1px solid var(--send-accent-tint-2)}verdocs-send .hint a .icon,verdocs-send .hint a .icon svg{width:11px;height:11px;display:inline-block;vertical-align:-1px;margin-left:2px}verdocs-send .expires-field{position:relative}verdocs-send .expires-field input{width:100%;height:36px;padding:0 52px 0 10px;font-size:14px;font-family:inherit;color:var(--send-ink);background:#ffffff;border:1px solid var(--send-control-border);border-radius:6px;outline:none}verdocs-send .expires-field input:focus{border-color:var(--send-accent);-webkit-box-shadow:0 0 0 2px var(--send-accent-tint-2);box-shadow:0 0 0 2px var(--send-accent-tint-2)}verdocs-send .expires-field input::-webkit-input-placeholder{color:var(--send-faint)}verdocs-send .expires-field input::-moz-placeholder{color:var(--send-faint)}verdocs-send .expires-field input:-ms-input-placeholder{color:var(--send-faint)}verdocs-send .expires-field input::-ms-input-placeholder{color:var(--send-faint)}verdocs-send .expires-field input::placeholder{color:var(--send-faint)}verdocs-send .expires-field .suffix{position:absolute;right:10px;top:0;height:36px;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;font-size:13px;color:var(--send-muted);pointer-events:none}verdocs-send .sender-field{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;row-gap:4px;margin:0 0 10px 0}verdocs-send .sender-field label{font-size:12px;font-weight:500;color:var(--send-ink-2)}verdocs-send .sender-field input{width:100%;height:36px;padding:0 10px;font-size:14px;font-family:inherit;color:var(--send-ink);background:#ffffff;border:1px solid var(--send-control-border);border-radius:6px;outline:none}verdocs-send .sender-field input:focus{border-color:var(--send-accent);-webkit-box-shadow:0 0 0 2px var(--send-accent-tint-2);box-shadow:0 0 0 2px var(--send-accent-tint-2)}verdocs-send .sender-field .field-error{font-size:12px;color:#cc0000}verdocs-send .notice{display:-ms-flexbox;display:flex;-webkit-column-gap:10px;-moz-column-gap:10px;column-gap:10px;margin-top:4px;padding:10px 12px;font-size:12px;line-height:1.5;border-radius:6px;color:var(--send-ink-2);background:var(--send-accent-tint);border:1px solid var(--send-accent-tint-2)}verdocs-send .notice>.icon{-ms-flex:0 0 18px;flex:0 0 18px;width:18px;height:18px;margin-top:1px;color:var(--send-accent)}verdocs-send .notice>.icon svg{width:18px;height:18px;display:block}verdocs-send .warning{display:-ms-flexbox;display:flex;-webkit-column-gap:10px;-moz-column-gap:10px;column-gap:10px;margin-top:12px;padding:10px 12px;font-size:12px;line-height:1.5;border-radius:6px;color:var(--send-warning-text);background:var(--send-warning-bg);border:1px solid var(--send-warning-border)}verdocs-send .warning>.icon{-ms-flex:0 0 18px;flex:0 0 18px;width:18px;height:18px;margin-top:1px;color:var(--send-warning-icon)}verdocs-send .warning>.icon svg{width:18px;height:18px;display:block}verdocs-send .warning a{color:var(--send-accent);font-weight:500;text-decoration:none;border-bottom:1px solid var(--send-accent-tint-2)}verdocs-send .warning a .icon,verdocs-send .warning a .icon svg{width:11px;height:11px;display:inline-block;vertical-align:-1px;margin-left:2px}verdocs-send verdocs-checkbox{display:block;padding:4px 0;font-size:13px}`;const M='<svg focusable="false" aria-hidden="true" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m9 6 6 6-6 6"/></svg>';const B='<svg focusable="false" aria-hidden="true" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m15 18-6-6 6-6"/></svg>';const I='<svg focusable="false" aria-hidden="true" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z"/><path d="M12 9v4M12 17h.01"/></svg>';const _='<svg focusable="false" aria-hidden="true" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><path d="M12 16v-4M12 8h.01"/></svg>';const T='<svg focusable="false" aria-hidden="true" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M15 3h6v6M10 14 21 3M21 14v7H3V3h7"/></svg>';const L="https://app.verdocs.com/assets/blue-logo.svg";const $=.25;const R=60;const V=500;const H=1;const O=120;const G=120;const A={email:"Email",passcode:"Passcode",sms:"SMS",kba:"KBA",id:"ID check"};const P=e(class e extends s{constructor(e){super();if(e!==false){this.__registerHost()}this.beforeSend=i(this,"beforeSend");this.send=i(this,"send");this.exit=i(this,"exit");this.sdkError=i(this,"sdkError");this.searchContacts=i(this,"searchContacts");this.templateListenerId=null;this.endpoint=v;this.templateId=null;this.environment="";this.showCancel=true;this.brandKey="";this.swipeStart=null;this.swallowNextClick=false;this.loadedOrganizationId="";this.containerId=`verdocs-send-${Math.random().toString(36).substring(2,11)}`;this.view="main";this.editingRoleId="";this.sessionContacts=[];this.sending=false;this.brands=[];this.organization=null;this.expiresInDays="";this.noContact=false;this.senderDefaults={name:"",email:""};this.senderName="";this.senderEmail="";this.rolesCompleted={};this.loading=true;this.template=null}disconnectedCallback(){this.unlistenToTemplate()}componentDidLoad(){this.el.addEventListener("click",(e=>{if(this.swallowNextClick){this.swallowNextClick=false;e.stopPropagation();e.preventDefault()}}),true)}componentDidRender(){var e,s;m(this.el.querySelector(".detail-body"));(e=this.el.querySelector(".main-pane"))===null||e===void 0?void 0:e.toggleAttribute("inert",this.view!=="main");(s=this.el.querySelector(".detail-pane"))===null||s===void 0?void 0:s.toggleAttribute("inert",this.view==="main")}async listenToTemplate(){console.log("[SEND] Loading template",this.templateId);this.unlistenToTemplate();w.subscribe("templates",this.templateId,(()=>r(this.endpoint,this.templateId)),true,(e=>{console.log("[SEND] Got new template",e);this.template=e;this.loading=false;this.rolesCompleted={};this.view="main";this.editingRoleId="";this.recomputeRolesCompleted();this.loadBrands()}))}loadBrands(){var e;const s=(e=this.template)===null||e===void 0?void 0:e.organization_id;if(!s||s===this.loadedOrganizationId){return}const i=!!this.loadedOrganizationId;this.loadedOrganizationId=s;this.brands=[];this.organization=null;if(i){this.brandKey=""}const t=()=>{var e;return((e=this.template)===null||e===void 0?void 0:e.organization_id)===s};d(this.endpoint,s).then((e=>{if(t()){this.brands=e||[]}})).catch((e=>console.log("[SEND] Unable to load brands",e)));a(this.endpoint,s).then((e=>{if(t()){this.organization=e}})).catch((e=>console.log("[SEND] Unable to load organization",e)))}handleExpiryInput(e){const s=(e.target.value||"").replace(/[^0-9]/g,"");this.expiresInDays=s?String(Math.min(Math.max(Number(s),H),O)):"";e.target.value=this.expiresInDays}effectiveExpiryDays(){const e=Number(this.expiresInDays);return e>=H?e:G}expiresAt(){return new Date(Date.now()+this.effectiveExpiryDays()*24*60*60*1e3)}unlistenToTemplate(){if(this.templateListenerId){w.store.delListener(this.templateListenerId);this.templateListenerId=null}}async reset(){this.rolesCompleted={};this.view="main";this.editingRoleId="";this.brandKey="";this.expiresInDays="";this.noContact=false;this.senderName="";this.senderEmail=""}brandSenderName(){var e;const s=this.brandKey?this.brands.find((e=>e.key===this.brandKey)):this.getDefaultBrand();return(s===null||s===void 0?void 0:s.email_display_name)||(s===null||s===void 0?void 0:s.email_sender_name)||((e=this.organization)===null||e===void 0?void 0:e.name)||""}effectiveSenderName(){return this.senderName||this.brandSenderName()}effectiveSenderEmail(){return this.senderEmail||this.senderDefaults.email}senderOverrides(){const e=this.senderName.trim();const s=this.senderEmail.trim();return{sender_name:e&&e!==this.brandSenderName()?e:undefined,sender_email:s&&s!==this.senderDefaults.email?s:undefined}}onTemplateIdChanged(e){console.log("[SEND] Template ID changed",e);this.listenToTemplate()}async componentWillLoad(){var e,s,i;try{this.endpoint.onSessionChanged(((e,s,i)=>{if(!i){return}const t={id:i.id,first_name:i.first_name,last_name:i.last_name,email:i.email,phone:i.phone};if(i){this.senderDefaults={name:l(i),email:i.email||""};this.sessionContacts=[t];c(this.endpoint).then((e=>{console.log("[SEND] Got contacts",e);this.sessionContacts=[...e,t]})).catch((e=>{console.log("[SEND] Error getting contacts",e)}))}}));this.endpoint.loadSession();if(!this.endpoint.session){console.log("[SEND] Unable to start Send operation, must be authenticated");return}if(!this.templateId){console.log(`[SEND] Missing required template ID ${this.templateId}`);return}this.listenToTemplate()}catch(t){console.log("[SEND] Error with send session",t);(e=this.sdkError)===null||e===void 0?void 0:e.emit(new g(t.message,(s=t.response)===null||s===void 0?void 0:s.status,(i=t.response)===null||i===void 0?void 0:i.data))}}recomputeRolesCompleted(){var e;this.rolesCompleted={};const s={};(((e=this.template)===null||e===void 0?void 0:e.roles)||[]).forEach((e=>{const i=e.sequence;s[i]||(s[i]=[]);const t=`r-${i}-${s[i].length}`;s[i].push({...e,id:t,role_name:e.name,first_name:e.first_name,last_name:e.last_name});if(e.first_name&&p(e.email)){this.rolesCompleted[t]={...e,id:t,role_name:e.name,first_name:e.first_name,last_name:e.last_name}}}))}getSequenceNumbers(){var e;const s={};(((e=this.template)===null||e===void 0?void 0:e.roles)||[]).forEach((e=>{s[e.sequence]=true}));return Object.keys(s).map((e=>+e)).sort(((e,s)=>e-s))}getRolesAtLevel(e){var s;const i=(((s=this.template)===null||s===void 0?void 0:s.roles)||[]).filter((s=>s.sequence===e)).map(((s,i)=>({...s,id:`r-${e}-${i}`,role_name:s.name,first_name:s.first_name,last_name:s.last_name})));return i}getRoleById(e){for(const s of this.getSequenceNumbers()){const i=this.getRolesAtLevel(s).find((s=>s.id===e));if(i){return i}}return null}getRecipientOptionLabels(e){if(!e){return[]}const s=(e.auth_methods||[]).filter((e=>e!=="email")).map((e=>A[e]||e));if(e.delegator){s.push("May delegate")}if(e.name_locked){s.push("Name locked")}return s}getDefaultBrand(){var e;const s=(e=this.organization)===null||e===void 0?void 0:e.default_brand_id;return s&&this.brands.find((e=>e.id===s))||null}getDefaultBrandLabel(){var e;const s=(e=this.getDefaultBrand())===null||e===void 0?void 0:e.name;return`Default (${s||"Verdocs"})`}getSelectedBrandLabel(){if(!this.brandKey){return this.getDefaultBrandLabel()}const e=this.brands.find((e=>e.key===this.brandKey));return(e===null||e===void 0?void 0:e.name)||(e===null||e===void 0?void 0:e.key)||this.brandKey}showView(e){this.view=e}handleSelectContact(e,s){e.preventDefault();this.rolesCompleted={...this.rolesCompleted,[s.id]:{...s,...e.detail}};this.editingRoleId="";this.view="main"}handleClickRole(e,s){e.stopPropagation();this.editingRoleId=s.id;this.view="recipient"}handleSend(e){var s;if(this.sending){console.log("[SEND] Skipping duplicate send",e);return}console.log("[SEND] Sending",e);e.preventDefault();e.stopPropagation();this.sending=true;const i=Intl.DateTimeFormat().resolvedOptions();const t={template_id:this.templateId,name:((s=this.template)===null||s===void 0?void 0:s.name)||"New Envelope",environment:this.environment,initial_reminder:0,followup_reminders:0,recipients:Object.values(this.rolesCompleted),timezone:i.timeZone,locale:i.locale,expires_at:this.expiresAt().toISOString()};t.no_contact=this.noContact;const{sender_name:n,sender_email:o}=this.senderOverrides();if(n){t.sender_name=n}if(o){t.sender_email=o}if(this.brandKey){t.brand_key=this.brandKey}const r=this.beforeSend.emit({...t,name:t.name,template:this.template});if(r.defaultPrevented){console.log("[SEND] Send cancelled by parent",t);this.sending=false;return}console.log("[SEND] Creating envelope",t);h(this.endpoint,t).then((e=>{var s;console.log("[SEND] Send envelope",e);this.reset().catch((e=>console.log("Unknown Error",e)));this.sending=false;(s=this.send)===null||s===void 0?void 0:s.emit({...t,name:t.name,envelope_id:e.id,envelope:e})})).catch((e=>{var s,i,t;console.log("[SEND] Send error",e);b(((i=(s=e.response)===null||s===void 0?void 0:s.data)===null||i===void 0?void 0:i.error)||"Error creating envelope, please try again later.");this.sending=false;(t=this.sdkError)===null||t===void 0?void 0:t.emit(e)}))}handleCancel(e){var s;e.stopPropagation();(s=this.exit)===null||s===void 0?void 0:s.emit()}handleSwipeStart(e){var s,i;this.swallowNextClick=false;const t=e.currentTarget;const n=t.getBoundingClientRect();const o=!!((i=(s=e.target)===null||s===void 0?void 0:s.closest)===null||i===void 0?void 0:i.call(s,"input, textarea, select, [contenteditable]"));if(this.view==="main"||o||e.clientX-n.left>n.width*$){this.swipeStart=null;return}this.swipeStart={x:e.clientX,y:e.clientY,time:Date.now()}}handleSwipeEnd(e){const s=this.swipeStart;this.swipeStart=null;if(!s){return}const i=e.clientX-s.x;const t=Math.abs(e.clientY-s.y);if(i>=R&&i>t&&Date.now()-s.time<=V){this.swallowNextClick=true;this.showView("main")}}renderDetailHeader(e){return t("div",{class:"detail-header"},t("button",{type:"button",class:"back",onClick:()=>this.showView("main")},t("span",{class:"icon",innerHTML:B}),"Back"),t("div",{class:"detail-title"},e),t("div",{class:"detail-header-spacer"}))}renderDetailBody(e){return t("div",{class:"detail-body-wrap"},t("div",{class:"detail-body",onScroll:e=>m(e.target)},e),t("div",{class:"scroll-fade"}))}renderDoneButton(){return t("div",{class:"detail-footer"},t("verdocs-button",{label:"Done",size:"small",onClick:()=>this.showView("main")}))}renderRecipientView(){var e;const s=this.getRoleById(this.editingRoleId);if(!s){return t("div",{class:"detail recipient-detail"},this.renderDetailHeader("Recipient"))}const i=N(this.template,s.role_name);return t("div",{class:"detail recipient-detail"},this.renderDetailHeader([t("span",{class:"role-dot",style:{backgroundColor:f(i)}}),s.role_name]),t("verdocs-contact-picker",{key:s.id,showCancel:false,onExit:()=>this.showView("main"),onNext:e=>this.handleSelectContact(e,s),contactSuggestions:this.sessionContacts,templateRole:(e=this.rolesCompleted[s.id])!==null&&e!==void 0?e:s,onSearchContacts:e=>{var s;return(s=this.searchContacts)===null||s===void 0?void 0:s.emit(e.detail)}}))}renderBrandSwatch(e,s){const i=(e===null||e===void 0?void 0:e.favicon_url)||(e===null||e===void 0?void 0:e.thumbnail_url)||(e?null:L);if(i){return t("span",{class:"swatch logo"},t("img",{src:i,alt:""}))}return t("span",{class:"swatch",style:{backgroundColor:(e===null||e===void 0?void 0:e.primary_color)||"#4c56cb"}},s.substring(0,2).toUpperCase())}renderBrandOption(e,s,i,n){return t("button",{type:"button",class:{option:true,selected:this.brandKey===e},onClick:()=>this.brandKey=e},t("span",{class:"radio"}),n,t("span",{class:"option-label"},s,t("small",null,i)))}renderBrandView(){const e=this.getDefaultBrand();const s=this.brands.filter((s=>s.id!==(e===null||e===void 0?void 0:e.id))).sort(((e,s)=>(e.name||e.key).localeCompare(s.name||s.key)));const i=this.brands.length>0;return t("div",{class:"detail"},this.renderDetailHeader("Brand"),this.renderDetailBody([t("div",{class:"option-list"},this.renderBrandOption("",this.getDefaultBrandLabel(),"Organization default",this.renderBrandSwatch(e,(e===null||e===void 0?void 0:e.name)||"V")),s.length>0&&t("div",{class:"option-divider"}),s.map((e=>this.renderBrandOption(e.key,e.name||e.key,e.key,this.renderBrandSwatch(e,e.name||e.key))))),!i&&t("p",{class:"hint"},"Configure the look and feel of the signing experience by"," ",t("a",{href:`${u(this.endpoint)}/settings/branding`,target:"_blank",rel:"noopener"},"Creating a Brand",t("span",{class:"icon",innerHTML:T})),".")]),this.renderDoneButton())}renderExpiresView(){const e=this.expiresAt();const s=`${e.toLocaleDateString(undefined,{month:"short",day:"numeric",year:"numeric"})} at ${e.toLocaleTimeString(undefined,{hour:"numeric",minute:"2-digit"})}`;return t("div",{class:"detail"},this.renderDetailHeader("Expiration"),this.renderDetailBody([t("div",{class:"expires-field"},t("input",{type:"text",inputMode:"numeric","aria-label":"Expires in (days)",placeholder:String(G),value:this.expiresInDays,disabled:this.sending,onInput:e=>this.handleExpiryInput(e)}),t("span",{class:"suffix"},"days")),t("p",{class:"hint"},"This envelope will expire on ",s,". Expirations may be set from ",H,"-",O," days. If left blank, this will default to ",G,".")]),this.renderDoneButton())}renderSenderView(){const e=!this.senderEmail.trim()||p(this.senderEmail.trim());return t("div",{class:"detail"},this.renderDetailHeader("Sender"),this.renderDetailBody([t("div",{class:"sender-field"},t("label",{htmlFor:`${this.containerId}-sender-name`},"Name"),t("input",{id:`${this.containerId}-sender-name`,type:"text",value:this.effectiveSenderName(),disabled:this.sending,onInput:e=>this.senderName=e.target.value})),t("div",{class:"sender-field"},t("label",{htmlFor:`${this.containerId}-sender-email`},"Email"),t("input",{id:`${this.containerId}-sender-email`,type:"email",value:this.effectiveSenderEmail(),disabled:this.sending,onInput:e=>this.senderEmail=e.target.value}),!e&&t("div",{class:"field-error"},"Enter a valid email address.")),t("div",{class:"notice"},t("span",{class:"icon",innerHTML:_}),t("div",null,'The name is what recipients see as the sender, for example "Sentry <notifications@verdocs.com>", and starts as your brand\'s name. The email is where status updates about this envelope are sent and what the certificate shows as the sender. Delivery from your own address needs a custom sender set up under Settings.'))]),this.renderDoneButton())}renderNotificationsView(){return t("div",{class:"detail"},this.renderDetailHeader("Notifications"),this.renderDetailBody([t("verdocs-checkbox",{size:"small",label:"Disable notifications",checked:this.noContact,onInput:e=>this.noContact=!!e.target.checked}),this.noContact&&t("div",{class:"warning"},t("span",{class:"icon",innerHTML:I}),t("div",null,"Disabling notifications turns off invitations and reminders to recipients as well as status updates to you. You may obtain invite links in the recipient summary or via an API call. We strongly recommend enabling"," ",t("a",{href:`${u(this.endpoint)}/settings/webhooks`,target:"_blank",rel:"noopener"},"Webhooks",t("span",{class:"icon",innerHTML:T}))," ","to help automate this process."))]),this.renderDoneButton())}renderDetail(){switch(this.view){case"recipient":return this.renderRecipientView();case"brand":return this.renderBrandView();case"expires":return this.renderExpiresView();case"notifications":return this.renderNotificationsView();case"sender":return this.renderSenderView();default:return null}}render(){var e;if(this.loading){return t(n,null,t("verdocs-loader",null))}if(!this.endpoint.session){return t(n,{style:{display:"flex"}},t("verdocs-component-error",{message:"You must be authenticated to use this module."}))}const s=this.getSequenceNumbers();const i=Object.values(this.rolesCompleted).filter((e=>p(e.email)&&e.first_name&&e.last_name));const o=i.length>=z(this.template).length;const r=i.map((e=>e.email.toLowerCase()));const d=new Set(r).size<r.length;const a=this.expiresAt();const c=a.toLocaleDateString(undefined,{month:"short",day:"numeric"});return t(n,{class:{sendable:(e=this.template)===null||e===void 0?void 0:e.is_sendable,"detail-open":this.view!=="main"}},t("div",{class:"track"},t("div",{class:"pane main-pane","aria-hidden":this.view!=="main"?"true":"false"},t("div",{class:"section-title"},"Recipients"),t("div",{class:"recipients"},s.map((e=>[s.length>1&&t("div",{class:"step"},"Step ",e),this.getRolesAtLevel(e).map((e=>{const s=N(this.template,e.role_name);const n=this.rolesCompleted[e.id];const o=n&&i.findIndex((s=>s.role_name===e.role_name))>-1;const r=this.getRecipientOptionLabels(n);return t("button",{type:"button",class:"recipient","data-ri":s,"data-rn":e.role_name,onClick:s=>this.handleClickRole(s,e)},t("span",{class:"role-dot",style:{backgroundColor:f(s)}}),t("span",{class:"who"},t("span",{class:"role-name"},e.role_name),o?t("span",{class:"who-detail"},l(n)," · ",n.email):t("span",{class:"who-detail configure"},"Configure recipient"),r.length>0&&t("span",{class:"options"},r.map((e=>t("span",{class:"pill"},e))))),t("span",{class:"chevron",innerHTML:M}))}))]))),t("div",{class:"section-title delivery-title"},"Delivery"),t("div",{class:"delivery"},t("button",{type:"button",class:"kv",onClick:()=>this.showView("brand"),disabled:this.sending},t("span",{class:"key"},"Brand"),t("span",{class:"value"},this.getSelectedBrandLabel()),t("span",{class:"chevron",innerHTML:M})),t("button",{type:"button",class:"kv",onClick:()=>this.showView("expires"),disabled:this.sending},t("span",{class:"key"},"Expires"),t("span",{class:"value"},this.effectiveExpiryDays()," days ",t("small",null,"· ",c)),t("span",{class:"chevron",innerHTML:M})),t("button",{type:"button",class:"kv",onClick:()=>this.showView("sender"),disabled:this.sending},t("span",{class:"key"},"Sender"),t("span",{class:"value"},this.effectiveSenderName()||this.effectiveSenderEmail(),this.effectiveSenderName()&&this.effectiveSenderEmail()?t("small",null," · ",this.effectiveSenderEmail()):null),t("span",{class:"chevron",innerHTML:M})),t("button",{type:"button",class:"kv",onClick:()=>this.showView("notifications"),disabled:this.sending},t("span",{class:"key"},"Notifications"),t("span",{class:{value:true,off:this.noContact}},this.noContact?"Off":"On"),t("span",{class:"chevron",innerHTML:M}))),t("div",{class:"main-spacer"}),t("div",{class:"buttons"},d&&t("div",{class:"error-message"},"Recipients cannot share the same email."),this.sending&&t("verdocs-spinner",null),this.showCancel&&t("verdocs-button",{label:"Cancel",size:"small",variant:"outline",onClick:e=>this.handleCancel(e),disabled:this.sending}),t("verdocs-button",{label:"Send",size:"small",disabled:!o||this.sending||d,onClick:e=>this.handleSend(e)}))),t("div",{class:"pane detail-pane","aria-hidden":this.view==="main"?"true":"false",onPointerDown:e=>this.handleSwipeStart(e),onPointerUp:e=>this.handleSwipeEnd(e),onPointerCancel:()=>this.swipeStart=null},this.renderDetail())))}get el(){return this}static get watchers(){return{templateId:[{onTemplateIdChanged:0}]}}static get style(){return j()}},[0,"verdocs-send",{endpoint:[16],templateId:[513,"template-id"],environment:[1],showCancel:[4,"show-cancel"],brandKey:[1025,"brand-key"],containerId:[32],view:[32],editingRoleId:[32],sessionContacts:[32],sending:[32],brands:[32],organization:[32],expiresInDays:[32],noContact:[32],senderDefaults:[32],senderName:[32],senderEmail:[32],rolesCompleted:[32],loading:[32],template:[32],reset:[64]},undefined,{templateId:[{onTemplateIdChanged:0}]}]);function U(){if(typeof customElements==="undefined"){return}const e=["verdocs-send","verdocs-button","verdocs-checkbox","verdocs-component-error","verdocs-contact-picker","verdocs-flag","verdocs-loader","verdocs-spinner"];e.forEach((e=>{switch(e){case"verdocs-send":if(!customElements.get(o(e))){customElements.define(o(e),P)}break;case"verdocs-button":if(!customElements.get(o(e))){k()}break;case"verdocs-checkbox":if(!customElements.get(o(e))){y()}break;case"verdocs-component-error":if(!customElements.get(o(e))){S()}break;case"verdocs-contact-picker":if(!customElements.get(o(e))){x()}break;case"verdocs-flag":if(!customElements.get(o(e))){E()}break;case"verdocs-loader":if(!customElements.get(o(e))){D()}break;case"verdocs-spinner":if(!customElements.get(o(e))){C()}break}}))}export{P as V,U as d};
|
|
2
|
+
//# sourceMappingURL=p-Blr31TcJ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["getRoleNames","template","roles","map","role","name","getRoleIndex","role_name","Math","max","findIndex","verdocsSendCss","chevronRightIcon","chevronLeftIcon","warningIcon","infoIcon","externalLinkIcon","VERDOCS_LOGO_URL","SWIPE_START_FRACTION","SWIPE_MIN_DISTANCE","SWIPE_MAX_DURATION","MIN_EXPIRY_DAYS","MAX_EXPIRY_DAYS","DEFAULT_EXPIRY_DAYS","AUTH_METHOD_LABELS","email","passcode","sms","kba","id","VerdocsSend","__stencil_proxyCustomElement","HTMLElement","constructor","registerHost","this","templateListenerId","endpoint","DefaultEndpoint","templateId","environment","showCancel","brandKey","swipeStart","swallowNextClick","loadedOrganizationId","containerId","random","toString","substring","view","editingRoleId","sessionContacts","sending","brands","organization","expiresInDays","noContact","senderDefaults","senderName","senderEmail","rolesCompleted","loading","disconnectedCallback","unlistenToTemplate","componentDidLoad","el","addEventListener","e","stopPropagation","preventDefault","componentDidRender","updateScrollFade","querySelector","_a","toggleAttribute","_b","listenToTemplate","console","log","Store","subscribe","getTemplate","recomputeRolesCompleted","loadBrands","organizationId","organization_id","changedOrganization","stillCurrent","getBrands","then","catch","getOrganization","handleExpiryInput","digits","target","value","replace","String","min","Number","effectiveExpiryDays","days","expiresAt","Date","now","store","delListener","reset","brandSenderName","brand","find","b","key","getDefaultBrand","email_display_name","email_sender_name","effectiveSenderName","effectiveSenderEmail","senderOverrides","trim","sender_name","undefined","sender_email","onTemplateIdChanged","newTemplateId","componentWillLoad","onSessionChanged","_endpoint","_session","profile","me","first_name","last_name","phone","formatFullName","getOrganizationContacts","contacts","loadSession","session","sdkError","emit","SDKError","message","response","status","_c","data","rolesAtLevel","forEach","level","sequence","length","push","isValidEmail","getSequenceNumbers","sequences","Object","keys","s","sort","a","getRolesAtLevel","filter","index","getRoleById","match","getRecipientOptionLabels","recipient","labels","auth_methods","method","delegator","name_locked","defaultId","default_brand_id","getDefaultBrandLabel","getSelectedBrandLabel","showView","handleSelectContact","detail","handleClickRole","handleSend","localeData","Intl","DateTimeFormat","resolvedOptions","details","template_id","initial_reminder","followup_reminders","recipients","values","timezone","timeZone","locale","expires_at","toISOString","no_contact","brand_key","beforeSendResult","beforeSend","defaultPrevented","createEnvelope","r","send","envelope_id","envelope","VerdocsToast","error","handleCancel","exit","handleSwipeStart","pane","currentTarget","rect","getBoundingClientRect","onTextEntry","closest","call","clientX","left","width","x","y","clientY","time","handleSwipeEnd","start","dx","dy","abs","renderDetailHeader","title","h","class","type","onClick","innerHTML","renderDetailBody","content","onScroll","renderDoneButton","label","size","renderRecipientView","roleIndex","style","backgroundColor","getRGBA","onExit","onNext","contactSuggestions","templateRole","onSearchContacts","searchContacts","renderBrandSwatch","fallbackInitial","image","favicon_url","thumbnail_url","src","alt","primary_color","toUpperCase","renderBrandOption","sub","swatch","option","selected","renderBrandView","defaultBrand","others","localeCompare","hasBrands","href","getWebAppUrl","rel","renderExpiresView","when","toLocaleDateString","month","day","year","toLocaleTimeString","hour","minute","inputMode","placeholder","disabled","onInput","renderSenderView","validEmail","htmlFor","renderNotificationsView","checked","renderDetail","render","Host","display","levels","rolesAssigned","allRolesAssigned","assignedEmails","toLowerCase","hasDuplicateEmails","Set","expiresShort","sendable","is_sendable","completed","assigned","optionLabels","off","variant","onPointerDown","onPointerUp","onPointerCancel"],"sources":["src/utils/Templates.ts","src/components/embeds/verdocs-send/verdocs-send.scss?tag=verdocs-send","src/components/embeds/verdocs-send/verdocs-send.tsx"],"sourcesContent":["import {ITemplate} from '@verdocs/js-sdk';\n\nexport const getRoleNames = (template: ITemplate | null) => (template?.roles || []).map(role => role.name);\n\nexport const getRoleIndex = (template: ITemplate | null, role_name: string) =>\n Math.max(\n getRoleNames(template).findIndex(name => name === role_name),\n 0,\n );\n","@import '../../../theme.scss';\n\nverdocs-send {\n --send-ink: var(--verdocs-body-color, #111827);\n --send-ink-2: #374151;\n --send-muted: #6b7280;\n --send-faint: #9ca3af;\n --send-rule: #e5e7eb;\n --send-control-border: #d1d5db;\n --send-accent: var(--verdocs-link-color, #{$secondary-color});\n --send-accent-tint: #f4f5fc;\n --send-accent-tint-2: #e6e7f8;\n --send-warning-bg: #fffbeb;\n --send-warning-border: #fde68a;\n --send-warning-icon: #d97706;\n --send-warning-text: #78350f;\n --send-radius: var(--verdocs-dialog-radius, 8px);\n --send-min-height: 480px;\n --send-max-width: 480px;\n\n display: none;\n position: relative;\n overflow: hidden;\n width: 100%;\n max-width: var(--verdocs-send-max-width, var(--send-max-width));\n box-sizing: border-box;\n background: #ffffff;\n color: var(--send-ink);\n font-size: 14px;\n border-radius: var(--send-radius);\n border: 1px solid var(--send-rule);\n font-family: $verdocs-primary-font;\n\n * {\n box-sizing: border-box;\n }\n\n &.sendable {\n display: block;\n }\n\n // The main pane sets the card's height. The detail pane sits beside it, off-canvas to the\n // right, and the track slides one pane-width left when a detail view is open. Detail views\n // taller than the card scroll inside it.\n .track {\n position: relative;\n display: flex;\n flex-direction: column;\n min-height: var(--send-min-height);\n transition: transform 220ms ease-out;\n }\n\n &.detail-open .track {\n transform: translateX(-100%);\n }\n\n @media (prefers-reduced-motion: reduce) {\n .track {\n transition: none;\n }\n }\n\n .pane {\n padding: 16px;\n display: flex;\n flex-direction: column;\n }\n\n .main-pane {\n flex: 1;\n }\n\n .detail-pane {\n position: absolute;\n top: 0;\n left: 100%;\n bottom: 0;\n width: 100%;\n overflow: hidden;\n }\n\n .detail {\n flex: 1;\n min-height: 0;\n display: flex;\n flex-direction: column;\n }\n\n // The body scrolls between a fixed header and a pinned Done button. The fade sits over the\n // body's bottom edge and shows only while there is more below (classes set by updateScrollFade).\n .detail-body-wrap {\n position: relative;\n flex: 1;\n min-height: 0;\n display: flex;\n flex-direction: column;\n }\n\n .detail-body {\n flex: 1;\n min-height: 0;\n overflow-y: auto;\n }\n\n .scroll-fade {\n position: absolute;\n left: 0;\n right: 0;\n bottom: 0;\n height: 36px;\n opacity: 0;\n pointer-events: none;\n transition: opacity 150ms ease-out;\n background: linear-gradient(rgba(255, 255, 255, 0), #ffffff);\n }\n\n .scrollable:not(.at-end) > .scroll-fade {\n opacity: 1;\n }\n\n .recipient-detail verdocs-contact-picker {\n flex: 1;\n min-height: 0;\n display: flex;\n flex-direction: column;\n }\n\n .section-title {\n font-size: 12px;\n font-weight: 600;\n color: var(--send-ink-2);\n margin: 0 0 6px 0;\n }\n\n .delivery-title {\n margin-top: 16px;\n }\n\n .step {\n font-size: 11px;\n color: var(--send-muted);\n padding: 10px 0 4px 0;\n }\n\n .recipient,\n .kv {\n all: unset;\n display: flex;\n width: 100%;\n cursor: pointer;\n align-items: center;\n column-gap: 10px;\n border-top: 1px solid var(--send-rule);\n color: var(--send-ink);\n font-family: inherit;\n\n &:focus-visible {\n outline: 2px solid var(--send-accent);\n outline-offset: -2px;\n border-radius: 4px;\n }\n\n .chevron {\n flex: 0 0 16px;\n width: 16px;\n height: 16px;\n color: var(--send-faint);\n\n svg {\n width: 16px;\n height: 16px;\n display: block;\n }\n }\n }\n\n .recipient {\n padding: 8px 6px 8px 0;\n\n &:last-child {\n border-bottom: 1px solid var(--send-rule);\n }\n\n .who {\n flex: 1;\n min-width: 0;\n display: flex;\n flex-direction: column;\n }\n\n .role-name {\n font-size: 13px;\n font-weight: 600;\n }\n\n .who-detail {\n font-size: 12px;\n color: var(--send-muted);\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n\n &.configure {\n color: var(--send-accent);\n font-weight: 500;\n }\n }\n\n .options {\n display: flex;\n flex-wrap: wrap;\n gap: 4px;\n margin-top: 3px;\n }\n\n .pill {\n height: 18px;\n padding: 0 6px;\n border-radius: 999px;\n font-size: 10px;\n font-weight: 500;\n display: inline-flex;\n align-items: center;\n background: var(--send-accent-tint);\n color: var(--send-ink-2);\n }\n }\n\n .role-dot {\n flex: 0 0 10px;\n width: 10px;\n height: 10px;\n border-radius: 50%;\n border: 1px solid rgba(0, 0, 0, 0.1);\n }\n\n .kv {\n height: 40px;\n padding: 0 6px 0 0;\n font-size: 13px;\n\n &:last-child {\n border-bottom: 1px solid var(--send-rule);\n }\n\n &:disabled {\n cursor: default;\n color: var(--send-muted);\n }\n\n .key {\n flex: 0 0 84px;\n color: var(--send-muted);\n }\n\n .value {\n flex: 1;\n min-width: 0;\n font-weight: 500;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n\n small {\n font-size: inherit;\n font-weight: 400;\n color: var(--send-muted);\n }\n\n &.off {\n color: var(--send-warning-icon);\n }\n }\n }\n\n .main-spacer,\n .detail-spacer {\n flex: 1;\n }\n\n .buttons {\n display: flex;\n margin-top: 14px;\n column-gap: 10px;\n flex-wrap: wrap;\n flex-direction: row;\n align-items: center;\n justify-content: flex-end;\n\n .error-message {\n width: 100%;\n color: $verdocs-red-1;\n font-size: 13px;\n margin-bottom: 10px;\n }\n }\n\n // Detail views\n .detail-header {\n display: flex;\n align-items: center;\n column-gap: 8px;\n margin: -2px 0 14px 0;\n\n .back {\n all: unset;\n display: inline-flex;\n align-items: center;\n cursor: pointer;\n font-size: 13px;\n font-weight: 500;\n color: var(--send-accent);\n font-family: inherit;\n flex: 0 0 52px;\n\n .icon,\n .icon svg {\n width: 16px;\n height: 16px;\n display: block;\n }\n\n &:focus-visible {\n outline: 2px solid var(--send-accent);\n outline-offset: 2px;\n border-radius: 4px;\n }\n }\n\n .detail-title {\n flex: 1;\n display: flex;\n align-items: center;\n justify-content: center;\n column-gap: 8px;\n font-size: 14px;\n font-weight: 600;\n text-align: center;\n }\n\n .detail-header-spacer {\n flex: 0 0 52px;\n }\n }\n\n .detail-footer {\n margin-top: 10px;\n padding-top: 12px;\n border-top: 1px solid var(--send-rule);\n\n verdocs-button,\n verdocs-button button {\n width: 100%;\n }\n }\n\n .hint {\n font-size: 12px;\n line-height: 1.5;\n color: var(--send-muted);\n margin: 10px 0 0 0;\n }\n\n .option-list {\n display: flex;\n flex-direction: column;\n }\n\n .option {\n all: unset;\n display: flex;\n width: 100%;\n cursor: pointer;\n align-items: center;\n column-gap: 10px;\n padding: 10px 0;\n font-size: 13px;\n font-family: inherit;\n color: var(--send-ink);\n border-top: 1px solid var(--send-rule);\n\n &:first-child {\n border-top: 0;\n }\n\n &:focus-visible {\n outline: 2px solid var(--send-accent);\n outline-offset: -2px;\n border-radius: 4px;\n }\n\n .radio {\n flex: 0 0 16px;\n width: 16px;\n height: 16px;\n border-radius: 50%;\n border: 1px solid var(--send-control-border);\n display: flex;\n align-items: center;\n justify-content: center;\n }\n\n &.selected .radio {\n border-color: var(--send-accent);\n\n &::after {\n content: '';\n width: 8px;\n height: 8px;\n border-radius: 50%;\n background: var(--send-accent);\n }\n }\n\n .swatch {\n flex: 0 0 22px;\n width: 22px;\n height: 22px;\n border-radius: 5px;\n display: flex;\n align-items: center;\n justify-content: center;\n font-size: 9px;\n font-weight: 700;\n color: #ffffff;\n overflow: hidden;\n\n &.logo {\n background: #ffffff;\n border: 1px solid var(--send-rule);\n }\n\n img {\n width: 100%;\n height: 100%;\n object-fit: contain;\n display: block;\n }\n }\n\n .option-label {\n flex: 1;\n min-width: 0;\n display: flex;\n flex-direction: column;\n\n small {\n font-size: 11px;\n color: var(--send-muted);\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n }\n }\n }\n\n .option-divider {\n height: 0;\n margin: 2px 0;\n border-top: 1px solid var(--send-control-border);\n\n + .option {\n border-top: 0;\n }\n }\n\n .hint a {\n color: var(--send-accent);\n font-weight: 500;\n text-decoration: none;\n border-bottom: 1px solid var(--send-accent-tint-2);\n\n .icon,\n .icon svg {\n width: 11px;\n height: 11px;\n display: inline-block;\n vertical-align: -1px;\n margin-left: 2px;\n }\n }\n\n .expires-field {\n position: relative;\n\n input {\n width: 100%;\n height: 36px;\n padding: 0 52px 0 10px;\n font-size: 14px;\n font-family: inherit;\n color: var(--send-ink);\n background: #ffffff;\n border: 1px solid var(--send-control-border);\n border-radius: 6px;\n outline: none;\n\n &:focus {\n border-color: var(--send-accent);\n box-shadow: 0 0 0 2px var(--send-accent-tint-2);\n }\n\n &::placeholder {\n color: var(--send-faint);\n }\n }\n\n .suffix {\n position: absolute;\n right: 10px;\n top: 0;\n height: 36px;\n display: flex;\n align-items: center;\n font-size: 13px;\n color: var(--send-muted);\n pointer-events: none;\n }\n }\n\n .sender-field {\n display: flex;\n flex-direction: column;\n row-gap: 4px;\n margin: 0 0 10px 0;\n\n label {\n font-size: 12px;\n font-weight: 500;\n color: var(--send-ink-2);\n }\n\n input {\n width: 100%;\n height: 36px;\n padding: 0 10px;\n font-size: 14px;\n font-family: inherit;\n color: var(--send-ink);\n background: #ffffff;\n border: 1px solid var(--send-control-border);\n border-radius: 6px;\n outline: none;\n\n &:focus {\n border-color: var(--send-accent);\n box-shadow: 0 0 0 2px var(--send-accent-tint-2);\n }\n }\n\n .field-error {\n font-size: 12px;\n color: $verdocs-red-1;\n }\n }\n\n .notice {\n display: flex;\n column-gap: 10px;\n margin-top: 4px;\n padding: 10px 12px;\n font-size: 12px;\n line-height: 1.5;\n border-radius: 6px;\n color: var(--send-ink-2);\n background: var(--send-accent-tint);\n border: 1px solid var(--send-accent-tint-2);\n\n > .icon {\n flex: 0 0 18px;\n width: 18px;\n height: 18px;\n margin-top: 1px;\n color: var(--send-accent);\n\n svg {\n width: 18px;\n height: 18px;\n display: block;\n }\n }\n }\n\n .warning {\n display: flex;\n column-gap: 10px;\n margin-top: 12px;\n padding: 10px 12px;\n font-size: 12px;\n line-height: 1.5;\n border-radius: 6px;\n color: var(--send-warning-text);\n background: var(--send-warning-bg);\n border: 1px solid var(--send-warning-border);\n\n > .icon {\n flex: 0 0 18px;\n width: 18px;\n height: 18px;\n margin-top: 1px;\n color: var(--send-warning-icon);\n\n svg {\n width: 18px;\n height: 18px;\n display: block;\n }\n }\n\n a {\n color: var(--send-accent);\n font-weight: 500;\n text-decoration: none;\n border-bottom: 1px solid var(--send-accent-tint-2);\n\n .icon,\n .icon svg {\n width: 11px;\n height: 11px;\n display: inline-block;\n vertical-align: -1px;\n margin-left: 2px;\n }\n }\n }\n\n verdocs-checkbox {\n display: block;\n padding: 4px 0;\n font-size: 13px;\n }\n}\n","import type {IBrand, IOrganization, TRecipientAuthMethod} from '@verdocs/js-sdk';\nimport {Component, Element, Prop, State, h, Event, EventEmitter, Host, Method, Watch} from '@stencil/core';\nimport type {ICreateEnvelopeFromTemplateRequest, ICreateEnvelopeRecipientFromTemplate, IEnvelope, IRecipient, ITemplate} from '@verdocs/js-sdk';\nimport {createEnvelope, formatFullName, getBrands, getOrganization, getTemplate, getOrganizationContacts, getRGBA, isValidEmail, VerdocsEndpoint} from '@verdocs/js-sdk';\nimport {IContactSearchEvent} from '../../envelopes/verdocs-contact-picker/verdocs-contact-picker';\nimport {DefaultEndpoint, getWebAppUrl} from '../../../utils/Environment';\nimport {getRoleIndex, getRoleNames} from '../../../utils/Templates';\nimport {updateScrollFade} from '../../../utils/ScrollFade';\nimport {VerdocsToast} from '../../../utils/Toast';\nimport {SDKError} from '../../../utils/errors';\nimport {Store} from '../../../utils/Datastore';\n\nconst chevronRightIcon =\n '<svg focusable=\"false\" aria-hidden=\"true\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"m9 6 6 6-6 6\"/></svg>';\n\nconst chevronLeftIcon =\n '<svg focusable=\"false\" aria-hidden=\"true\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"m15 18-6-6 6-6\"/></svg>';\n\nconst warningIcon =\n '<svg focusable=\"false\" aria-hidden=\"true\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z\"/><path d=\"M12 9v4M12 17h.01\"/></svg>';\n\nconst infoIcon =\n '<svg focusable=\"false\" aria-hidden=\"true\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><circle cx=\"12\" cy=\"12\" r=\"10\"/><path d=\"M12 16v-4M12 8h.01\"/></svg>';\n\nconst externalLinkIcon =\n '<svg focusable=\"false\" aria-hidden=\"true\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M15 3h6v6M10 14 21 3M21 14v7H3V3h7\"/></svg>';\n\nconst VERDOCS_LOGO_URL = 'https://app.verdocs.com/assets/blue-logo.svg';\n\n// Swipe mechanics for mobile users in detail views\nconst SWIPE_START_FRACTION = 0.25;\nconst SWIPE_MIN_DISTANCE = 60;\nconst SWIPE_MAX_DURATION = 500;\n\n// Expiration controls. The API is less strict, but Web users prefer a simpler setup so we just range-limit it 1..120 here.\nconst MIN_EXPIRY_DAYS = 1;\nconst MAX_EXPIRY_DAYS = 120;\nconst DEFAULT_EXPIRY_DAYS = 120;\n\nconst AUTH_METHOD_LABELS: Record<TRecipientAuthMethod, string> = {\n email: 'Email',\n passcode: 'Passcode',\n sms: 'SMS',\n kba: 'KBA',\n id: 'ID check',\n};\n\ntype TSendView = 'main' | 'recipient' | 'brand' | 'expires' | 'notifications' | 'sender';\n\nexport interface ISendEventDetail extends ICreateEnvelopeFromTemplateRequest {\n name: string;\n template_id: string;\n recipients: ICreateEnvelopeRecipientFromTemplate[];\n template: ITemplate;\n}\n\nexport interface ISentEventDetail extends ICreateEnvelopeFromTemplateRequest {\n name: string;\n template_id: string;\n recipients: ICreateEnvelopeRecipientFromTemplate[];\n envelope_id: string;\n envelope: IEnvelope;\n}\n\n/**\n * Display a form to send a template to one or more recipients in an envelope for signing.\n * Host applications should ensure the template is \"sendable\" before displaying this component.\n * To be sendable, a template must have at least one document attached, at least one participant\n * defined, and at least one field assigned to every \"signer\" participant. This component will\n * hide itself if the template is not sendable.\n *\n * ```ts\n * <verdocs-send\n * templateId={TEMPLATE_ID}\n * onBeforeSend={({ detail })) => { console.log('Sending... Show a spinner...', detail) }\n * onSend={({ detail }) => { console.log('Sent! Hide the spinner...', detail) }\n * onExit={({ detail }) => { console.log('Send cancelled.', detail) }\n * onSdkError={({ detail }) => { console.log('SDK error', detail) }\n * />\n * ```\n */\n@Component({\n tag: 'verdocs-send',\n styleUrl: 'verdocs-send.scss',\n shadow: false,\n})\nexport class VerdocsSend {\n private templateListenerId = null;\n\n @Element() el: HTMLElement;\n\n /**\n * The endpoint to use to communicate with Verdocs. If not set, the default endpoint will be used.\n */\n @Prop() endpoint: VerdocsEndpoint = DefaultEndpoint;\n\n /**\n * The ID of the template to create the document from.\n */\n @Prop({reflect: true}) templateId: string | null = null;\n\n /**\n * The environment the control is being called from, e.g. 'web'. This has an impact on how certain\n * operations such as email communications are handled to ensure users receive the correct URLs for\n * their invitations. Setting this to unknown values may produce unexpected/incorrect behaviors.\n * If environment is not known, do this set this property.\n */\n @Prop() environment: string = '';\n\n /**\n * Whether to show the cancel button. It may be useful to disable this in environments where\n * the embed is shown in a non-wizard flow with its own navigation for the user to exit.\n */\n @Prop() showCancel = true;\n\n /**\n * Preselect a brand by key, overriding the organization default.\n */\n @Prop({mutable: true}) brandKey = '';\n\n /**\n * The user is sending an envelope the form and clicked send.\n */\n @Event({composed: true}) beforeSend: EventEmitter<ISendEventDetail>;\n\n /**\n * The user completed the form and clicked send.\n */\n @Event({composed: true}) send: EventEmitter<ISentEventDetail>;\n\n /**\n * Event fired when the step is cancelled. This is called exit to avoid conflicts with the JS-reserved \"cancel\" event name.\n */\n @Event({composed: true}) exit: EventEmitter;\n\n /**\n * Event fired if an error occurs. The event details will contain information about the error. Most errors will\n * terminate the process, and the calling application should correct the condition and re-render the component.\n */\n @Event({composed: true}) sdkError: EventEmitter<SDKError>;\n\n /**\n * Event fired when the user enters text in a search field. The parent application may use this to update\n * the `contactSuggestions` property.\n */\n @Event({composed: true}) searchContacts: EventEmitter<IContactSearchEvent>;\n\n private swipeStart: {x: number; y: number; time: number} | null = null;\n private swallowNextClick = false;\n private loadedOrganizationId = '';\n\n @State() containerId = `verdocs-send-${Math.random().toString(36).substring(2, 11)}`;\n @State() view: TSendView = 'main';\n @State() editingRoleId = '';\n @State() sessionContacts: {id: string; first_name: string; last_name: string; email: string; phone: string}[] = [];\n @State() sending = false;\n @State() brands: IBrand[] = [];\n @State() organization: IOrganization | null = null;\n @State() expiresInDays = '';\n @State() noContact = false;\n @State() senderDefaults = {name: '', email: ''};\n @State() senderName = '';\n @State() senderEmail = '';\n @State() rolesCompleted: Record<string, Partial<IRecipient>> = {};\n\n @State() loading = true;\n @State() template: ITemplate | null = null;\n\n disconnectedCallback() {\n this.unlistenToTemplate();\n }\n\n componentDidLoad() {\n this.el.addEventListener(\n 'click',\n e => {\n if (this.swallowNextClick) {\n this.swallowNextClick = false;\n e.stopPropagation();\n e.preventDefault();\n }\n },\n true,\n );\n }\n\n // Make off-canvas controls leave the tab order\n componentDidRender() {\n updateScrollFade(this.el.querySelector('.detail-body'));\n this.el.querySelector('.main-pane')?.toggleAttribute('inert', this.view !== 'main');\n this.el.querySelector('.detail-pane')?.toggleAttribute('inert', this.view === 'main');\n }\n\n async listenToTemplate() {\n console.log('[SEND] Loading template', this.templateId);\n this.unlistenToTemplate();\n Store.subscribe(\n 'templates',\n this.templateId,\n () => getTemplate(this.endpoint, this.templateId),\n true,\n (template: ITemplate) => {\n console.log('[SEND] Got new template', template);\n this.template = template;\n this.loading = false;\n this.rolesCompleted = {};\n this.view = 'main';\n this.editingRoleId = '';\n this.recomputeRolesCompleted();\n this.loadBrands();\n },\n );\n }\n\n loadBrands() {\n const organizationId = this.template?.organization_id;\n if (!organizationId || organizationId === this.loadedOrganizationId) {\n return;\n }\n\n const changedOrganization = !!this.loadedOrganizationId;\n this.loadedOrganizationId = organizationId;\n this.brands = [];\n this.organization = null;\n if (changedOrganization) {\n this.brandKey = '';\n }\n\n const stillCurrent = () => this.template?.organization_id === organizationId;\n\n getBrands(this.endpoint, organizationId)\n .then(brands => {\n if (stillCurrent()) {\n this.brands = brands || [];\n }\n })\n .catch(e => console.log('[SEND] Unable to load brands', e));\n\n getOrganization(this.endpoint, organizationId)\n .then(organization => {\n if (stillCurrent()) {\n this.organization = organization;\n }\n })\n .catch(e => console.log('[SEND] Unable to load organization', e));\n }\n\n handleExpiryInput(e: any) {\n const digits = (e.target.value || '').replace(/[^0-9]/g, '');\n this.expiresInDays = digits ? String(Math.min(Math.max(Number(digits), MIN_EXPIRY_DAYS), MAX_EXPIRY_DAYS)) : '';\n e.target.value = this.expiresInDays;\n }\n\n effectiveExpiryDays(): number {\n const days = Number(this.expiresInDays);\n return days >= MIN_EXPIRY_DAYS ? days : DEFAULT_EXPIRY_DAYS;\n }\n\n expiresAt(): Date {\n return new Date(Date.now() + this.effectiveExpiryDays() * 24 * 60 * 60 * 1000);\n }\n\n unlistenToTemplate() {\n if (this.templateListenerId) {\n Store.store.delListener(this.templateListenerId);\n this.templateListenerId = null;\n }\n }\n\n @Method()\n async reset() {\n this.rolesCompleted = {};\n this.view = 'main';\n this.editingRoleId = '';\n this.brandKey = '';\n this.expiresInDays = '';\n this.noContact = false;\n this.senderName = '';\n this.senderEmail = '';\n }\n\n // The sender_name defaults to the custom sender identity if configued/active, the brand\n // next, and then the org name.\n brandSenderName() {\n const brand = this.brandKey ? this.brands.find(b => b.key === this.brandKey) : this.getDefaultBrand();\n return brand?.email_display_name || brand?.email_sender_name || this.organization?.name || '';\n }\n\n effectiveSenderName() {\n return this.senderName || this.brandSenderName();\n }\n\n effectiveSenderEmail() {\n return this.senderEmail || this.senderDefaults.email;\n }\n\n senderOverrides() {\n const name = this.senderName.trim();\n const email = this.senderEmail.trim();\n return {\n sender_name: name && name !== this.brandSenderName() ? name : undefined,\n sender_email: email && email !== this.senderDefaults.email ? email : undefined,\n };\n }\n\n @Watch('templateId')\n onTemplateIdChanged(newTemplateId: string) {\n console.log('[SEND] Template ID changed', newTemplateId);\n this.listenToTemplate();\n }\n\n async componentWillLoad() {\n try {\n this.endpoint.onSessionChanged((_endpoint, _session, profile) => {\n if (!profile) {\n return;\n }\n\n const me = {\n id: profile.id,\n first_name: profile.first_name,\n last_name: profile.last_name,\n email: profile.email,\n phone: profile.phone,\n };\n\n if (profile) {\n this.senderDefaults = {name: formatFullName(profile), email: profile.email || ''};\n this.sessionContacts = [me];\n\n getOrganizationContacts(this.endpoint)\n .then(contacts => {\n console.log('[SEND] Got contacts', contacts);\n this.sessionContacts = [...contacts, me];\n })\n .catch(e => {\n console.log('[SEND] Error getting contacts', e);\n });\n }\n });\n\n this.endpoint.loadSession();\n\n if (!this.endpoint.session) {\n console.log('[SEND] Unable to start Send operation, must be authenticated');\n return;\n }\n\n if (!this.templateId) {\n console.log(`[SEND] Missing required template ID ${this.templateId}`);\n return;\n }\n\n this.listenToTemplate();\n } catch (e) {\n console.log('[SEND] Error with send session', e);\n this.sdkError?.emit(new SDKError(e.message, e.response?.status, e.response?.data));\n }\n }\n\n recomputeRolesCompleted() {\n this.rolesCompleted = {};\n\n const rolesAtLevel: Record<number, Partial<IRecipient>[]> = {};\n (this.template?.roles || []).forEach(role => {\n const level = role.sequence;\n rolesAtLevel[level] ||= [];\n const id = `r-${level}-${rolesAtLevel[level].length}`;\n rolesAtLevel[level].push({...role, id, role_name: role.name, first_name: role.first_name, last_name: role.last_name});\n\n // if (role.first_name && (isValidEmail(role.email) || isValidPhone(role.phone))) {\n if (role.first_name && isValidEmail(role.email)) {\n this.rolesCompleted[id] = {...role, id, role_name: role.name, first_name: role.first_name, last_name: role.last_name};\n }\n });\n }\n\n getSequenceNumbers() {\n // This is cleaner with a Set but we found a regression in some target environments where\n // this breaks down. Reverting to an older technique while we diagnose it.\n const sequences: Record<number, boolean> = {};\n (this.template?.roles || []).forEach(role => {\n sequences[role.sequence] = true;\n });\n return Object.keys(sequences)\n .map(s => +s)\n .sort((a, b) => a - b);\n }\n\n getRolesAtLevel(level: number) {\n const rolesAtLevel = (this.template?.roles || [])\n .filter(role => role.sequence === level)\n .map((role, index) => ({\n ...role,\n id: `r-${level}-${index}`,\n role_name: role.name,\n first_name: role.first_name,\n last_name: role.last_name,\n }));\n return rolesAtLevel as Partial<IRecipient>[];\n }\n\n getRoleById(id: string): Partial<IRecipient> | null {\n for (const level of this.getSequenceNumbers()) {\n const match = this.getRolesAtLevel(level).find(role => role.id === id);\n if (match) {\n return match;\n }\n }\n\n return null;\n }\n\n // We only show options the sender switched on.\n getRecipientOptionLabels(recipient: Partial<IRecipient> | undefined): string[] {\n if (!recipient) {\n return [];\n }\n\n const labels = (recipient.auth_methods || []).filter(method => method !== 'email').map(method => AUTH_METHOD_LABELS[method] || method);\n if (recipient.delegator) {\n labels.push('May delegate');\n }\n\n if (recipient.name_locked) {\n labels.push('Name locked');\n }\n\n return labels;\n }\n\n getDefaultBrand(): IBrand | null {\n const defaultId = this.organization?.default_brand_id;\n return (defaultId && this.brands.find(brand => brand.id === defaultId)) || null;\n }\n\n getDefaultBrandLabel() {\n const name = this.getDefaultBrand()?.name;\n return `Default (${name || 'Verdocs'})`;\n }\n\n getSelectedBrandLabel() {\n if (!this.brandKey) {\n return this.getDefaultBrandLabel();\n }\n\n const brand = this.brands.find(b => b.key === this.brandKey);\n return brand?.name || brand?.key || this.brandKey;\n }\n\n showView(view: TSendView) {\n this.view = view;\n }\n\n handleSelectContact(e: any, role: Partial<IRecipient>) {\n e.preventDefault();\n this.rolesCompleted = {...this.rolesCompleted, [role.id]: {...role, ...e.detail}};\n this.editingRoleId = '';\n this.view = 'main';\n }\n\n handleClickRole(e: any, role: Partial<IRecipient>) {\n e.stopPropagation();\n this.editingRoleId = role.id;\n this.view = 'recipient';\n }\n\n handleSend(e: any) {\n if (this.sending) {\n console.log('[SEND] Skipping duplicate send', e);\n return;\n }\n\n console.log('[SEND] Sending', e);\n e.preventDefault();\n e.stopPropagation();\n\n this.sending = true;\n const localeData = Intl.DateTimeFormat().resolvedOptions();\n\n const details: ICreateEnvelopeFromTemplateRequest = {\n template_id: this.templateId,\n name: this.template?.name || 'New Envelope',\n environment: this.environment,\n initial_reminder: 0,\n followup_reminders: 0,\n recipients: Object.values(this.rolesCompleted) as ICreateEnvelopeRecipientFromTemplate[],\n timezone: localeData.timeZone,\n locale: localeData.locale,\n expires_at: this.expiresAt().toISOString(),\n };\n\n details.no_contact = this.noContact;\n const {sender_name, sender_email} = this.senderOverrides();\n if (sender_name) {\n details.sender_name = sender_name;\n }\n if (sender_email) {\n details.sender_email = sender_email;\n }\n if (this.brandKey) {\n details.brand_key = this.brandKey;\n }\n\n const beforeSendResult = this.beforeSend.emit({...details, name: details.name!, template: this.template});\n if (beforeSendResult.defaultPrevented) {\n console.log('[SEND] Send cancelled by parent', details);\n this.sending = false;\n return;\n }\n\n console.log('[SEND] Creating envelope', details);\n createEnvelope(this.endpoint, details)\n .then(r => {\n console.log('[SEND] Send envelope', r);\n this.reset().catch((e: any) => console.log('Unknown Error', e));\n this.sending = false;\n this.send?.emit({...details, name: details.name!, envelope_id: r.id, envelope: r});\n })\n .catch(e => {\n console.log('[SEND] Send error', e);\n VerdocsToast(e.response?.data?.error || 'Error creating envelope, please try again later.');\n this.sending = false;\n this.sdkError?.emit(e);\n });\n }\n\n handleCancel(e: any) {\n e.stopPropagation();\n this.exit?.emit();\n }\n\n handleSwipeStart(e: PointerEvent) {\n this.swallowNextClick = false;\n const pane = e.currentTarget as HTMLElement;\n const rect = pane.getBoundingClientRect();\n const onTextEntry = !!(e.target as HTMLElement)?.closest?.('input, textarea, select, [contenteditable]');\n if (this.view === 'main' || onTextEntry || e.clientX - rect.left > rect.width * SWIPE_START_FRACTION) {\n this.swipeStart = null;\n return;\n }\n\n this.swipeStart = {x: e.clientX, y: e.clientY, time: Date.now()};\n }\n\n handleSwipeEnd(e: PointerEvent) {\n const start = this.swipeStart;\n this.swipeStart = null;\n if (!start) {\n return;\n }\n\n const dx = e.clientX - start.x;\n const dy = Math.abs(e.clientY - start.y);\n if (dx >= SWIPE_MIN_DISTANCE && dx > dy && Date.now() - start.time <= SWIPE_MAX_DURATION) {\n this.swallowNextClick = true;\n this.showView('main');\n }\n }\n\n renderDetailHeader(title: any) {\n return (\n <div class=\"detail-header\">\n <button type=\"button\" class=\"back\" onClick={() => this.showView('main')}>\n <span class=\"icon\" innerHTML={chevronLeftIcon} />\n Back\n </button>\n <div class=\"detail-title\">{title}</div>\n <div class=\"detail-header-spacer\" />\n </div>\n );\n }\n\n renderDetailBody(content: any) {\n return (\n <div class=\"detail-body-wrap\">\n <div class=\"detail-body\" onScroll={(e: any) => updateScrollFade(e.target)}>\n {content}\n </div>\n <div class=\"scroll-fade\" />\n </div>\n );\n }\n\n renderDoneButton() {\n return (\n <div class=\"detail-footer\">\n <verdocs-button label=\"Done\" size=\"small\" onClick={() => this.showView('main')} />\n </div>\n );\n }\n\n renderRecipientView() {\n const role = this.getRoleById(this.editingRoleId);\n if (!role) {\n return <div class=\"detail recipient-detail\">{this.renderDetailHeader('Recipient')}</div>;\n }\n\n const roleIndex = getRoleIndex(this.template, role.role_name);\n return (\n <div class=\"detail recipient-detail\">\n {this.renderDetailHeader([<span class=\"role-dot\" style={{backgroundColor: getRGBA(roleIndex)}} />, role.role_name])}\n <verdocs-contact-picker\n key={role.id}\n showCancel={false}\n onExit={() => this.showView('main')}\n onNext={e => this.handleSelectContact(e, role)}\n contactSuggestions={this.sessionContacts}\n templateRole={(this.rolesCompleted[role.id] ?? role) as IRecipient}\n onSearchContacts={e => this.searchContacts?.emit(e.detail)}\n />\n </div>\n );\n }\n\n renderBrandSwatch(brand: IBrand | null, fallbackInitial: string) {\n const image = brand?.favicon_url || brand?.thumbnail_url || (brand ? null : VERDOCS_LOGO_URL);\n if (image) {\n return (\n <span class=\"swatch logo\">\n <img src={image} alt=\"\" />\n </span>\n );\n }\n\n return (\n <span class=\"swatch\" style={{backgroundColor: brand?.primary_color || '#4c56cb'}}>\n {fallbackInitial.substring(0, 2).toUpperCase()}\n </span>\n );\n }\n\n renderBrandOption(key: string, label: string, sub: string, swatch: any) {\n return (\n <button type=\"button\" class={{option: true, selected: this.brandKey === key}} onClick={() => (this.brandKey = key)}>\n <span class=\"radio\" />\n {swatch}\n <span class=\"option-label\">\n {label}\n <small>{sub}</small>\n </span>\n </button>\n );\n }\n\n renderBrandView() {\n const defaultBrand = this.getDefaultBrand();\n const others = this.brands.filter(brand => brand.id !== defaultBrand?.id).sort((a, b) => (a.name || a.key).localeCompare(b.name || b.key));\n const hasBrands = this.brands.length > 0;\n\n return (\n <div class=\"detail\">\n {this.renderDetailHeader('Brand')}\n {this.renderDetailBody([\n <div class=\"option-list\">\n {this.renderBrandOption('', this.getDefaultBrandLabel(), 'Organization default', this.renderBrandSwatch(defaultBrand, defaultBrand?.name || 'V'))}\n {others.length > 0 && <div class=\"option-divider\" />}\n {others.map(brand => this.renderBrandOption(brand.key, brand.name || brand.key, brand.key, this.renderBrandSwatch(brand, brand.name || brand.key)))}\n </div>,\n !hasBrands && (\n <p class=\"hint\">\n Configure the look and feel of the signing experience by{' '}\n <a href={`${getWebAppUrl(this.endpoint)}/settings/branding`} target=\"_blank\" rel=\"noopener\">\n Creating a Brand\n <span class=\"icon\" innerHTML={externalLinkIcon} />\n </a>\n .\n </p>\n ),\n ])}\n {this.renderDoneButton()}\n </div>\n );\n }\n\n renderExpiresView() {\n const expiresAt = this.expiresAt();\n const when = `${expiresAt.toLocaleDateString(undefined, {month: 'short', day: 'numeric', year: 'numeric'})} at ${expiresAt.toLocaleTimeString(undefined, {hour: 'numeric', minute: '2-digit'})}`;\n\n return (\n <div class=\"detail\">\n {this.renderDetailHeader('Expiration')}\n {this.renderDetailBody([\n <div class=\"expires-field\">\n <input\n type=\"text\"\n inputMode=\"numeric\"\n aria-label=\"Expires in (days)\"\n placeholder={String(DEFAULT_EXPIRY_DAYS)}\n value={this.expiresInDays}\n disabled={this.sending}\n onInput={(e: any) => this.handleExpiryInput(e)}\n />\n <span class=\"suffix\">days</span>\n </div>,\n <p class=\"hint\">\n This envelope will expire on {when}. Expirations may be set from {MIN_EXPIRY_DAYS}-{MAX_EXPIRY_DAYS} days. If left blank, this will default to {DEFAULT_EXPIRY_DAYS}.\n </p>,\n ])}\n {this.renderDoneButton()}\n </div>\n );\n }\n\n renderSenderView() {\n const validEmail = !this.senderEmail.trim() || isValidEmail(this.senderEmail.trim());\n return (\n <div class=\"detail\">\n {this.renderDetailHeader('Sender')}\n {this.renderDetailBody([\n <div class=\"sender-field\">\n <label htmlFor={`${this.containerId}-sender-name`}>Name</label>\n <input\n id={`${this.containerId}-sender-name`}\n type=\"text\"\n value={this.effectiveSenderName()}\n disabled={this.sending}\n onInput={(e: any) => (this.senderName = e.target.value)}\n />\n </div>,\n <div class=\"sender-field\">\n <label htmlFor={`${this.containerId}-sender-email`}>Email</label>\n <input\n id={`${this.containerId}-sender-email`}\n type=\"email\"\n value={this.effectiveSenderEmail()}\n disabled={this.sending}\n onInput={(e: any) => (this.senderEmail = e.target.value)}\n />\n {!validEmail && <div class=\"field-error\">Enter a valid email address.</div>}\n </div>,\n <div class=\"notice\">\n <span class=\"icon\" innerHTML={infoIcon} />\n <div>\n The name is what recipients see as the sender, for example \"Sentry <notifications@verdocs.com>\", and starts as your brand's name. The email is where status\n updates about this envelope are sent and what the certificate shows as the sender. Delivery from your own address needs a custom sender set up under Settings.\n </div>\n </div>,\n ])}\n {this.renderDoneButton()}\n </div>\n );\n }\n\n renderNotificationsView() {\n return (\n <div class=\"detail\">\n {this.renderDetailHeader('Notifications')}\n {this.renderDetailBody([\n <verdocs-checkbox size=\"small\" label=\"Disable notifications\" checked={this.noContact} onInput={(e: any) => (this.noContact = !!e.target.checked)} />,\n this.noContact && (\n <div class=\"warning\">\n <span class=\"icon\" innerHTML={warningIcon} />\n <div>\n Disabling notifications turns off invitations and reminders to recipients as well as status updates to you. You may obtain invite links in the recipient summary or\n via an API call. We strongly recommend enabling{' '}\n <a href={`${getWebAppUrl(this.endpoint)}/settings/webhooks`} target=\"_blank\" rel=\"noopener\">\n Webhooks\n <span class=\"icon\" innerHTML={externalLinkIcon} />\n </a>{' '}\n to help automate this process.\n </div>\n </div>\n ),\n ])}\n {this.renderDoneButton()}\n </div>\n );\n }\n\n renderDetail() {\n switch (this.view) {\n case 'recipient':\n return this.renderRecipientView();\n case 'brand':\n return this.renderBrandView();\n case 'expires':\n return this.renderExpiresView();\n case 'notifications':\n return this.renderNotificationsView();\n case 'sender':\n return this.renderSenderView();\n default:\n return null;\n }\n }\n\n render() {\n if (this.loading) {\n return (\n <Host>\n <verdocs-loader />\n </Host>\n );\n }\n\n if (!this.endpoint.session) {\n return (\n <Host style={{display: 'flex'}}>\n <verdocs-component-error message=\"You must be authenticated to use this module.\" />\n </Host>\n );\n }\n\n const levels = this.getSequenceNumbers();\n const rolesAssigned = Object.values(this.rolesCompleted).filter(recipient => isValidEmail(recipient.email) && recipient.first_name && recipient.last_name);\n const allRolesAssigned = rolesAssigned.length >= getRoleNames(this.template).length;\n const assignedEmails = rolesAssigned.map(r => r.email.toLowerCase());\n const hasDuplicateEmails = new Set(assignedEmails).size < assignedEmails.length;\n const expiresAt = this.expiresAt();\n const expiresShort = expiresAt.toLocaleDateString(undefined, {month: 'short', day: 'numeric'});\n\n return (\n <Host class={{'sendable': this.template?.is_sendable, 'detail-open': this.view !== 'main'}}>\n <div class=\"track\">\n <div class=\"pane main-pane\" aria-hidden={this.view !== 'main' ? 'true' : 'false'}>\n <div class=\"section-title\">Recipients</div>\n <div class=\"recipients\">\n {levels.map(level => [\n levels.length > 1 && <div class=\"step\">Step {level}</div>,\n this.getRolesAtLevel(level).map(role => {\n const roleIndex = getRoleIndex(this.template, role.role_name);\n const completed = this.rolesCompleted[role.id];\n const assigned = completed && rolesAssigned.findIndex(r => r.role_name === role.role_name) > -1;\n const optionLabels = this.getRecipientOptionLabels(completed);\n\n return (\n <button type=\"button\" class=\"recipient\" data-ri={roleIndex} data-rn={role.role_name} onClick={e => this.handleClickRole(e, role)}>\n <span class=\"role-dot\" style={{backgroundColor: getRGBA(roleIndex)}} />\n <span class=\"who\">\n <span class=\"role-name\">{role.role_name}</span>\n {assigned ? (\n <span class=\"who-detail\">\n {formatFullName(completed)} · {completed.email}\n </span>\n ) : (\n <span class=\"who-detail configure\">Configure recipient</span>\n )}\n {optionLabels.length > 0 && (\n <span class=\"options\">\n {optionLabels.map(label => (\n <span class=\"pill\">{label}</span>\n ))}\n </span>\n )}\n </span>\n <span class=\"chevron\" innerHTML={chevronRightIcon} />\n </button>\n );\n }),\n ])}\n </div>\n\n <div class=\"section-title delivery-title\">Delivery</div>\n <div class=\"delivery\">\n <button type=\"button\" class=\"kv\" onClick={() => this.showView('brand')} disabled={this.sending}>\n <span class=\"key\">Brand</span>\n <span class=\"value\">{this.getSelectedBrandLabel()}</span>\n <span class=\"chevron\" innerHTML={chevronRightIcon} />\n </button>\n <button type=\"button\" class=\"kv\" onClick={() => this.showView('expires')} disabled={this.sending}>\n <span class=\"key\">Expires</span>\n <span class=\"value\">\n {this.effectiveExpiryDays()} days <small>· {expiresShort}</small>\n </span>\n <span class=\"chevron\" innerHTML={chevronRightIcon} />\n </button>\n <button type=\"button\" class=\"kv\" onClick={() => this.showView('sender')} disabled={this.sending}>\n <span class=\"key\">Sender</span>\n <span class=\"value\">\n {this.effectiveSenderName() || this.effectiveSenderEmail()}\n {this.effectiveSenderName() && this.effectiveSenderEmail() ? <small> · {this.effectiveSenderEmail()}</small> : null}\n </span>\n <span class=\"chevron\" innerHTML={chevronRightIcon} />\n </button>\n <button type=\"button\" class=\"kv\" onClick={() => this.showView('notifications')} disabled={this.sending}>\n <span class=\"key\">Notifications</span>\n <span class={{value: true, off: this.noContact}}>{this.noContact ? 'Off' : 'On'}</span>\n <span class=\"chevron\" innerHTML={chevronRightIcon} />\n </button>\n </div>\n\n <div class=\"main-spacer\" />\n\n <div class=\"buttons\">\n {hasDuplicateEmails && <div class=\"error-message\">Recipients cannot share the same email.</div>}\n {this.sending && <verdocs-spinner />}\n {this.showCancel && <verdocs-button label=\"Cancel\" size=\"small\" variant=\"outline\" onClick={e => this.handleCancel(e)} disabled={this.sending} />}\n <verdocs-button label=\"Send\" size=\"small\" disabled={!allRolesAssigned || this.sending || hasDuplicateEmails} onClick={e => this.handleSend(e)} />\n </div>\n </div>\n\n <div\n class=\"pane detail-pane\"\n aria-hidden={this.view === 'main' ? 'true' : 'false'}\n onPointerDown={e => this.handleSwipeStart(e)}\n onPointerUp={e => this.handleSwipeEnd(e)}\n onPointerCancel={() => (this.swipeStart = null)}\n >\n {this.renderDetail()}\n </div>\n </div>\n </Host>\n );\n }\n}\n"],"mappings":"upBAEO,MAAMA,EAAgBC,KAAgCA,IAAQ,MAARA,SAAQ,SAARA,EAAUC,QAAS,IAAIC,KAAIC,GAAQA,EAAKC,OAE9F,MAAMC,EAAe,CAACL,EAA4BM,IACvDC,KAAKC,IACHT,EAAaC,GAAUS,WAAUL,GAAQA,IAASE,IAClD,GCPJ,MAAMI,EAAiB,IAAM,uhYCY7B,MAAMC,EACJ,iMAEF,MAAMC,EACJ,mMAEF,MAAMC,EACJ,2RAEF,MAAMC,EACJ,uOAEF,MAAMC,EACJ,uNAEF,MAAMC,EAAmB,+CAGzB,MAAMC,EAAuB,IAC7B,MAAMC,EAAqB,GAC3B,MAAMC,EAAqB,IAG3B,MAAMC,EAAkB,EACxB,MAAMC,EAAkB,IACxB,MAAMC,EAAsB,IAE5B,MAAMC,EAA2D,CAC/DC,MAAO,QACPC,SAAU,WACVC,IAAK,MACLC,IAAK,MACLC,GAAI,Y,MA0COC,EAAWC,EAAA,MAAAD,UAAAE,EALxB,WAAAC,CAAAC,G,iNAMUC,KAAAC,mBAAqB,KAOrBD,KAAAE,SAA4BC,EAKbH,KAAAI,WAA4B,KAQ3CJ,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BoH,EAAA,mBAAWvM,KAAKmF,wBAAkC,MAEjHoH,EAAA,QAAMC,MAAM,UAAUG,UAAWlO,KAEnC8N,EAAA,UAAQE,KAAK,SAASD,MAAM,KAAKE,QAAS,IAAM1M,KAAK+I,SAAS,iBAAkB+G,SAAU9P,KAAKkB,SAC7FqL,EAAA,QAAMC,MAAM,OAAK,iBACjBD,EAAA,QAAMC,MAAO,CAAC3I,MAAO,KAAMyN,IAAKtR,KAAKsB,YAAatB,KAAKsB,UAAY,MAAQ,MAC3EiL,EAAA,QAAMC,MAAM,UAAUG,UAAWlO,MAIrC8N,EAAA,OAAKC,MAAM,gBAEXD,EAAA,OAAKC,MAAM,WACRsE,GAAsBvE,EAAA,OAAKC,MAAM,iBAAe,2CAChDxM,KAAKkB,SAAWqL,EAAA,wBAChBvM,KAAKM,YAAciM,EAAA,kBAAgBS,MAAM,SAASC,KAAK,QAAQsE,QAAQ,UAAU7E,QAASzK,GAAKjC,KAAK+K,aAAa9I,GAAI6N,SAAU9P,KAAKkB,UACrIqL,EAAA,kBAAgBS,MAAM,OAAOC,KAAK,QAAQ6C,UAAWa,GAAoB3Q,KAAKkB,SAAW4P,EAAoBpE,QAASzK,GAAKjC,KAAKmJ,WAAWlH,OAI/IsK,EAAA,OACEC,MAAM,mBAAkB,cACXxM,KAAKe,OAAS,OAAS,OAAS,QAC7CyQ,cAAevP,GAAKjC,KAAKiL,iBAAiBhJ,GAC1CwP,YAAaxP,GAAKjC,KAAKgM,eAAe/J,GACtCyP,gBAAiB,IAAO1R,KAAKQ,WAAa,MAEzCR,KAAKqQ,iB","ignoreList":[]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{p as e,H as s,c as o,h as i,d as t,t as n}from"./p-yZBlG3YQ.js";import{VerdocsEndpoint as r,getEnvelope as d}from"@verdocs/js-sdk";import{S as l}from"./p-C1sRVZWv.js";import{S as a}from"./p-C7hFgM52.js";import{d as c}from"./p-C90lxyUX.js";import{d as f}from"./p-8J_y0V9M.js";const p=()=>`verdocs-sign-footer{left:0;right:0;bottom:0;height:48px;display:-ms-flexbox;display:flex;color:#616161;position:fixed;font-size:12px;padding:0 24px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;background:#ffffff;container-type:inline-size;border-top:1px solid #e0e0e0;-ms-flex-pack:justify;justify-content:space-between;font-family:var(--verdocs-primary-font, "Inter", "Barlow", sans-serif);-webkit-transition:0.5s cubic-bezier(0.35, 0, 0.25, 1);transition:0.5s cubic-bezier(0.35, 0, 0.25, 1)}verdocs-sign-footer a{color:#616161;cursor:pointer;text-decoration:none;border-bottom:1px dotted #616161}verdocs-sign-footer.loading{display:none}verdocs-sign-footer .powered-by{white-space:nowrap}verdocs-sign-footer .buttons{-ms-flex:0;flex:0;gap:16px;display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;white-space:nowrap;-ms-flex-align:center;align-items:center}verdocs-sign-footer .buttons button{gap:4px;border:none;display:-ms-flexbox;display:flex;outline:none;cursor:pointer;-ms-flex-direction:row;flex-direction:row;-ms-flex-align:center;align-items:center;background:transparent}verdocs-sign-footer .buttons div{gap:4px;display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;-ms-flex-align:center;align-items:center}verdocs-sign-footer .links{-ms-flex:0;flex:0;gap:8px;display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;white-space:nowrap}verdocs-sign-footer.just-buttons .buttons{-ms-flex:1;flex:1;-ms-flex-pack:center;justify-content:center}@container (max-width: 720px){verdocs-sign-footer.has-buttons .powered-by{display:none}}@container (max-width: 540px){verdocs-sign-footer.no-buttons .powered-by{display:none}verdocs-sign-footer.has-buttons .links{display:none}verdocs-sign-footer .buttons{-ms-flex:1;flex:1;-ms-flex-pack:center;justify-content:center}}`;const v=`<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M10.4809 13.8423H15.4C16.2962 13.8423 17 13.1288 17 12.2764V5.56582C17 4.71348 16.2962 4 15.4 4H4.6C3.70383 4 3 4.71348 3 5.56582V12.2764C3 13.1288 3.70383 13.8423 4.6 13.8423H6.19908L6.2 17L6.20346 16.9997L6.20502 16.9988L10.4809 13.8423ZM6.79895 17.8034C6.35668 18.1298 5.73 18.0406 5.39921 17.6042C5.26989 17.4335 5.2 17.2262 5.2 17.0133L5.19937 14.8423H4.6C3.16406 14.8423 2 13.6935 2 12.2764V5.56582C2 4.14876 3.16406 3 4.6 3H15.4C16.8359 3 18 4.14876 18 5.56582V12.2764C18 13.6935 16.8359 14.8423 15.4 14.8423H10.81L6.79895 17.8034Z" fill="#424242"/></svg>`;const b=`<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M7.14645 7.14645C7.34171 6.95118 7.65829 6.95118 7.85355 7.14645L10 9.29289L12.1464 7.14645C12.3417 6.95118 12.6583 6.95118 12.8536 7.14645C13.0488 7.34171 13.0488 7.65829 12.8536 7.85355L10.7071 10L12.8536 12.1464C13.0488 12.3417 13.0488 12.6583 12.8536 12.8536C12.6583 13.0488 12.3417 13.0488 12.1464 12.8536L10 10.7071L7.85355 12.8536C7.65829 13.0488 7.34171 13.0488 7.14645 12.8536C6.95118 12.6583 6.95118 12.3417 7.14645 12.1464L9.29289 10L7.14645 7.85355C6.95118 7.65829 6.95118 7.34171 7.14645 7.14645ZM3 6C3 4.34315 4.34315 3 6 3H14C15.6569 3 17 4.34315 17 6V14C17 15.6569 15.6569 17 14 17H6C4.34315 17 3 15.6569 3 14V6ZM6 4C4.89543 4 4 4.89543 4 6V14C4 15.1046 4.89543 16 6 16H14C15.1046 16 16 15.1046 16 14V6C16 4.89543 15.1046 4 14 4H6Z" fill="#424242"/></svg>`;const h=`<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M3 5C3 3.89543 3.89543 3 5 3H13.3787C13.9091 3 14.4178 3.21071 14.7929 3.58579L16.4142 5.20711C16.7893 5.58218 17 6.09089 17 6.62132V15C17 16.1046 16.1046 17 15 17H5C3.89543 17 3 16.1046 3 15V5ZM5 4C4.44772 4 4 4.44772 4 5V15C4 15.5523 4.44772 16 5 16L5 11.5C5 10.6716 5.67157 10 6.5 10H13.5C14.3284 10 15 10.6716 15 11.5V16C15.5523 16 16 15.5523 16 15V6.62132C16 6.3561 15.8946 6.10175 15.7071 5.91421L14.0858 4.29289C13.8983 4.10536 13.6439 4 13.3787 4L13 4V6.5C13 7.32843 12.3284 8 11.5 8L7.5 8C6.67157 8 6 7.32843 6 6.5L6 4H5ZM7 4L7 6.5C7 6.77614 7.22386 7 7.5 7L11.5 7C11.7761 7 12 6.77614 12 6.5V4L7 4ZM14 16V11.5C14 11.2239 13.7761 11 13.5 11H6.5C6.22386 11 6 11.2239 6 11.5V16H14Z" fill="#424242"/></svg>`;const u=e(class e extends s{constructor(e){super();if(e!==false){this.__registerHost()}this.askQuestion=o(this,"askQuestion");this.decline=o(this,"decline");this.finishLater=o(this,"finishLater");this.sdkError=o(this,"sdkError");this.envelopeListenerId=null;this.endpoint=r.getDefault();this.envelopeId="";this.isDone=false;this.brand=null;this.askingQuestion=false;this.declinine=false;this.envelope=null}async componentWillLoad(){var e,s,o;try{if(!this.envelopeId){console.log(`[FOOTER] Missing required envelope ID ${this.envelopeId}`);return}this.listenToEnvelope()}catch(i){console.log("[FOOTER] Error loading envelope",i);(e=this.sdkError)===null||e===void 0?void 0:e.emit(new l(i.message,(s=i.response)===null||s===void 0?void 0:s.status,(o=i.response)===null||o===void 0?void 0:o.data))}}disconnectedCallback(){this.unlistenToEnvelope()}async listenToEnvelope(){console.log("[FOOTER] Loading envelope",this.envelopeId);this.unlistenToEnvelope();a.subscribe("envelopes",this.envelopeId,(()=>d(this.endpoint,this.envelopeId)),false,(e=>{this.envelope=e}))}unlistenToEnvelope(){if(this.envelopeListenerId){a.store.delListener(this.envelopeListenerId);this.envelopeListenerId=null}}render(){var e,s,o,n,r,d;const l=(e=this.envelope)===null||e===void 0?void 0:e.organization;const a=((s=this.brand)===null||s===void 0?void 0:s.powered_by_label)||(l===null||l===void 0?void 0:l.powered_by_label);const c=((o=this.brand)===null||o===void 0?void 0:o.powered_by_label)?(n=this.brand)===null||n===void 0?void 0:n.powered_by_url:l===null||l===void 0?void 0:l.powered_by_url;const f=((r=this.brand)===null||r===void 0?void 0:r.terms_use_url)||(l===null||l===void 0?void 0:l.terms_use_url);const p=((d=this.brand)===null||d===void 0?void 0:d.privacy_policy_url)||(l===null||l===void 0?void 0:l.privacy_policy_url);const u=!!a;const x=!!f||!!p;const g=!this.isDone;return i(t,{key:"91d822a2405449adbfb2cce4c87a4086958e4e79",class:{"has-buttons":g,"no-buttons":!g,"has-powered-by":u,"has-links":x,"just-buttons":!u&&!x}},a&&i("div",{key:"5f856e6ba57091e30e455657fb304c6718d9b80c",class:"powered-by"},c?i("a",{href:c,target:"_blank",rel:"noopener noreferrer"},i("span",null,a)):i("span",null,a)),!this.isDone&&i("div",{key:"a9090f99ebc82d1b6602e52edd6d92f8eb94efcc",class:"buttons"},i("button",{key:"08c7596ba10f3240dd29dc9d30f92ea3d6e4b0c3",onClick:()=>this.askingQuestion=true},i("span",{key:"19ba5c915fab3c7e38598f0cf90b1a8c82cc86d8",innerHTML:v}),"Ask Sender a Question"),i("button",{key:"12189b38952064e2a65e6c28f7a5f95d75f12ba7",onClick:()=>{var e;return(e=this.decline)===null||e===void 0?void 0:e.emit()}},i("span",{key:"a5df4760b465ad3c8be1cec7ddbc8d4c88dfa3e2",innerHTML:b}),"Decline Signing"),i("button",{key:"dfd2079149f39c688bd535474ed2a5d86b9be75d",onClick:()=>{var e;return(e=this.finishLater)===null||e===void 0?void 0:e.emit()}},i("span",{key:"35da50d7a9dd7fdf9d0748248cc1a5d98b9d3d11",innerHTML:h}),"Finish Later")),i("div",{key:"7d50e834619ee75a6651d8dc8a0f8e2bcc3c17ad",class:"links"},f&&i("a",{key:"02fb19b915a6c22156a91001e90941219efc529c",href:f,target:"_blank",rel:"noopener noreferrer"},i("span",{key:"752ca1e97fd782fdefe6fdd0d1b2831ea54ca80c"},"Terms of Use")),p&&i("a",{key:"d27725658461073751f76b7c33e76df527b6ea7c",href:p,target:"_blank",rel:"noopener noreferrer"},i("span",{key:"1e7ef9f0a9e88a877bb432b8bf5e4311b759d651"},"Privacy Policy"))),this.askingQuestion&&i("verdocs-question-dialog",{key:"c2ceb8bd5237792f3ef42f919bd837c11dff9a12",onNext:e=>{var s;(s=this.askQuestion)===null||s===void 0?void 0:s.emit({question:e.detail.question});this.askingQuestion=false},onExit:()=>this.askingQuestion=false}))}static get style(){return p()}},[0,"verdocs-sign-footer",{endpoint:[16],envelopeId:[1,"envelope-id"],isDone:[4,"is-done"],brand:[16],askingQuestion:[32],declinine:[32],envelope:[32]}]);function x(){if(typeof customElements==="undefined"){return}const e=["verdocs-sign-footer","verdocs-dialog","verdocs-question-dialog"];e.forEach((e=>{switch(e){case"verdocs-sign-footer":if(!customElements.get(n(e))){customElements.define(n(e),u)}break;case"verdocs-dialog":if(!customElements.get(n(e))){c()}break;case"verdocs-question-dialog":if(!customElements.get(n(e))){f()}break}}))}export{u as V,x as d};
|
|
2
|
+
//# sourceMappingURL=p-D495hZfr.js.map
|