@verdocs/web-sdk 6.13.1 → 6.13.3
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-contact-picker.cjs.entry.js +3 -3
- package/dist/cjs/verdocs-contact-picker.cjs.entry.js.map +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 +6 -6
- package/dist/cjs/verdocs-preview_6.cjs.entry.js.map +1 -1
- package/dist/cjs/verdocs-sign.cjs.entry.js +3 -1
- 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 +26 -0
- package/dist/collection/components/embeds/verdocs-send/verdocs-send.js +5 -5
- package/dist/collection/components/embeds/verdocs-send/verdocs-send.js.map +1 -1
- package/dist/collection/components/embeds/verdocs-sign/verdocs-sign.js +4 -1
- package/dist/collection/components/embeds/verdocs-sign/verdocs-sign.js.map +1 -1
- package/dist/collection/components/envelopes/verdocs-contact-picker/verdocs-contact-picker.js +3 -3
- package/dist/collection/components/envelopes/verdocs-contact-picker/verdocs-contact-picker.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-D495hZfr.js +2 -0
- package/dist/components/p-D495hZfr.js.map +1 -0
- package/dist/components/p-K-sDaUxS.js +2 -0
- package/dist/components/p-K-sDaUxS.js.map +1 -0
- package/dist/components/{p-ByrpRZ3E.js → p-lCn8WPSe.js} +2 -2
- package/dist/components/p-lCn8WPSe.js.map +1 -0
- package/dist/components/verdocs-build.js +1 -1
- package/dist/components/verdocs-contact-picker.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-contact-picker.entry.js +3 -3
- package/dist/esm/verdocs-contact-picker.entry.js.map +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 +6 -6
- package/dist/esm/verdocs-preview_6.entry.js.map +1 -1
- package/dist/esm/verdocs-sign.entry.js +3 -1
- 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-contact-picker.entry.js +1 -1
- package/dist/esm-es5/verdocs-contact-picker.entry.js.map +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-sign/verdocs-sign.d.ts +1 -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-38800961.system.entry.js → p-3a97f4b4.system.entry.js} +2 -2
- package/dist/verdocs-web-sdk/p-3a97f4b4.system.entry.js.map +1 -0
- package/dist/verdocs-web-sdk/{p-301f0247.entry.js → p-78a18a3b.entry.js} +2 -2
- package/dist/verdocs-web-sdk/p-78a18a3b.entry.js.map +1 -0
- package/dist/verdocs-web-sdk/p-895174e4.system.entry.js +8 -0
- package/dist/verdocs-web-sdk/p-895174e4.system.entry.js.map +1 -0
- package/dist/verdocs-web-sdk/p-8f7d0062.entry.js +8 -0
- package/dist/verdocs-web-sdk/p-8f7d0062.entry.js.map +1 -0
- 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-ByrpRZ3E.js.map +0 -1
- package/dist/components/p-E2hWLZ47.js +0 -2
- package/dist/components/p-E2hWLZ47.js.map +0 -1
- package/dist/components/p-VqyGWtIp.js +0 -2
- package/dist/components/p-VqyGWtIp.js.map +0 -1
- package/dist/verdocs-web-sdk/p-2e382167.entry.js.map +0 -1
- package/dist/verdocs-web-sdk/p-301f0247.entry.js.map +0 -1
- package/dist/verdocs-web-sdk/p-38800961.system.entry.js.map +0 -1
- package/dist/verdocs-web-sdk/p-3f9102c4.system.entry.js.map +0 -1
- package/dist/verdocs-web-sdk/p-575b6f98.system.entry.js +0 -8
- package/dist/verdocs-web-sdk/p-575b6f98.system.entry.js.map +0 -1
- package/dist/verdocs-web-sdk/p-957e4cb0.entry.js +0 -2
- package/dist/verdocs-web-sdk/p-957e4cb0.entry.js.map +0 -1
- package/dist/verdocs-web-sdk/p-f3924e9e.entry.js +0 -8
- package/dist/verdocs-web-sdk/p-f3924e9e.entry.js.map +0 -1
- package/dist/verdocs-web-sdk/p-f41af68e.system.entry.js +0 -2
- package/dist/verdocs-web-sdk/p-f41af68e.system.entry.js.map +0 -1
- /package/dist/components/{p-BTrjJycH.js.map → p-06em1_P-.js.map} +0 -0
package/dist/collection/components/envelopes/verdocs-contact-picker/verdocs-contact-picker.js
CHANGED
|
@@ -156,6 +156,8 @@ export class VerdocsContactPicker {
|
|
|
156
156
|
// and show a duplicate autocomplete picker on top of our own.
|
|
157
157
|
render() {
|
|
158
158
|
const hasBasics = this.first_name && this.last_name && isValidEmail(this.email);
|
|
159
|
+
// First name is the first focused field so it's our quicksearch matching target.
|
|
160
|
+
const visibleSuggestions = (this.contactSuggestions || []).filter(suggestion => { var _a; return !this.first_name || ((_a = suggestion.first_name) === null || _a === void 0 ? void 0 : _a.toLowerCase().includes(this.first_name.toLowerCase())); });
|
|
159
161
|
const hasAuthRequirements = this.auth_methods.every(method => {
|
|
160
162
|
switch (method) {
|
|
161
163
|
case 'passcode':
|
|
@@ -201,9 +203,7 @@ export class VerdocsContactPicker {
|
|
|
201
203
|
} }))), h("div", { class: "group" }, h("div", { class: "group-label" }, "Verification"), this.authMethodsLoading ? (h("verdocs-spinner", { size: 10, mode: "dark" })) : (h("div", { class: "pills" }, verificationOptions.map(option => this.renderPill(option.label, this.auth_methods.includes(option.value), () => this.toggleAuthMethod(option.value), {
|
|
202
204
|
locked: option.locked,
|
|
203
205
|
title: option.locked ? 'Please contact sales@verdocs.com to enable this feature.' : undefined,
|
|
204
|
-
})))), this.auth_methods.includes('passcode') && (h("div", { class: "passcode" }, h("input", { id: "verdocs-passcode", name: "verdocs-passcode", type: "text", "data-lpignore": "true", autocomplete: "blocked", "aria-autocomplete": "none", "aria-label": "Passcode", value: this.passcode, placeholder: "4-8 digits", onFocus: () => (this.showSuggestions = false), onInput: (e) => (this.passcode = e.target.value) }), h("span", { class: "passcode-hint" }, "PIN or passcode shared separately with the recipient ahead of time")))), h("div", { class: "group" }, h("div", { class: "group-label" }, "Signing options"), h("div", { class: "pills" }, this.renderPill('None', signingOption === 'none', () => this.setSigningOption('none')), this.renderPill('May delegate', signingOption === 'delegator', () => this.setSigningOption('delegator')), this.renderPill('Name locked', signingOption === 'name_locked', () => this.setSigningOption('name_locked')))), h("div", { class: "field" }, h("label", { htmlFor: "verdocs-contact-picker-message" }, "Message ", h("span", { class: "optional" }, "(optional)")), h("textarea", { id: "verdocs-contact-picker-message", name: "verdocs-contact-picker-message", "data-lpignore": "true", autocomplete: "blocked", placeholder: "Add a message to the invitation", onFocus: () => (this.showSuggestions = false), onInput: (e) => (this.message = e.target.value) }, this.message))), h("div", { class: "scroll-fade" }), this.showSuggestions && (h("div", { class: "suggestions", role: "listbox", ref: el => (this.suggestionsEl = el) },
|
|
205
|
-
.filter(suggestion => { var _a; return !this.first_name || ((_a = suggestion.first_name) === null || _a === void 0 ? void 0 : _a.toLowerCase().includes(this.first_name.toLowerCase())); })
|
|
206
|
-
.map(suggestion => {
|
|
206
|
+
})))), this.auth_methods.includes('passcode') && (h("div", { class: "passcode" }, h("input", { id: "verdocs-passcode", name: "verdocs-passcode", type: "text", "data-lpignore": "true", autocomplete: "blocked", "aria-autocomplete": "none", "aria-label": "Passcode", value: this.passcode, placeholder: "4-8 digits", onFocus: () => (this.showSuggestions = false), onInput: (e) => (this.passcode = e.target.value) }), h("span", { class: "passcode-hint" }, "PIN or passcode shared separately with the recipient ahead of time")))), h("div", { class: "group" }, h("div", { class: "group-label" }, "Signing options"), h("div", { class: "pills" }, this.renderPill('None', signingOption === 'none', () => this.setSigningOption('none')), this.renderPill('May delegate', signingOption === 'delegator', () => this.setSigningOption('delegator')), this.renderPill('Name locked', signingOption === 'name_locked', () => this.setSigningOption('name_locked')))), h("div", { class: "field" }, h("label", { htmlFor: "verdocs-contact-picker-message" }, "Message ", h("span", { class: "optional" }, "(optional)")), h("textarea", { id: "verdocs-contact-picker-message", name: "verdocs-contact-picker-message", "data-lpignore": "true", autocomplete: "blocked", placeholder: "Add a message to the invitation", onFocus: () => (this.showSuggestions = false), onInput: (e) => (this.message = e.target.value) }, this.message))), h("div", { class: "scroll-fade" }), this.showSuggestions && visibleSuggestions.length > 0 && (h("div", { class: "suggestions", role: "listbox", ref: el => (this.suggestionsEl = el) }, visibleSuggestions.map(suggestion => {
|
|
207
207
|
var _a;
|
|
208
208
|
return (h("div", { key: (_a = suggestion.id) !== null && _a !== void 0 ? _a : suggestion.email, class: "suggestion", onClick: e => this.handleSelectSuggestion(e, suggestion) }, suggestion.picture ? h("img", { alt: "Avatar", class: "avatar", src: suggestion.picture }) : h("div", { class: "avatar", innerHTML: addrBookIcon }), h("div", { class: "details" }, h("div", { class: "name" }, formatFullName(suggestion)), suggestion.email && h("div", { class: "destination" }, suggestion.email), suggestion.phone && h("div", { class: "destination" }, suggestion.phone))));
|
|
209
209
|
})))), h("div", { class: "buttons" }, this.showCancel && h("verdocs-button", { label: "Cancel", variant: "text", size: "small", onClick: e => this.handleCancel(e) }), h("verdocs-button", { label: "Done", size: "small", disabled: !canSubmit, onClick: !canSubmit ? () => { } : e => this.handleSubmit(e) }))));
|
package/dist/collection/components/envelopes/verdocs-contact-picker/verdocs-contact-picker.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verdocs-contact-picker.js","sourceRoot":"","sources":["../../../../src/components/envelopes/verdocs-contact-picker/verdocs-contact-picker.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,OAAO,EAAE,CAAC,EAAE,KAAK,EAAgB,MAAM,EAAE,IAAI,EAAE,KAAK,EAAC,MAAM,eAAe,CAAC;AAC9F,OAAO,EAAC,cAAc,EAAE,qBAAqB,EAAsC,YAAY,EAAsC,eAAe,EAAC,MAAM,iBAAiB,CAAC;AAC7K,OAAO,EAAC,gBAAgB,EAAC,MAAM,2BAA2B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A,CACP,CACG;YAEN,WAAK,KAAK,EAAC,SAAS;gBACjB,IAAI,CAAC,UAAU,IAAI,sBAAgB,KAAK,EAAC,QAAQ,EAAC,OAAO,EAAC,MAAM,EAAC,IAAI,EAAC,OAAO,EAAC,OAAO,EAAE,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,GAAI;gBACrH,sBAAgB,KAAK,EAAC,MAAM,EAAC,IAAI,EAAC,OAAO,EAAC,QAAQ,EAAE,CAAC,SAAS,EAAE,OAAO,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,GAAI,CAC1H,CACD,CACR,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import {Component, Element, h, Event, EventEmitter, Listen, Prop, State} from '@stencil/core';\nimport {formatFullName, getActiveEntitlements, IEntitlement, IProfile, IRecipient, isValidEmail, TEntitlement, TRecipientAuthMethod, VerdocsEndpoint} from '@verdocs/js-sdk';\nimport {updateScrollFade} from '../../../utils/ScrollFade';\nimport {convertToE164} from '../../../utils/utils';\n\nconst addrBookIcon = `<svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" class=\"lucide lucide-book-user\"><path d=\"M15 13a3 3 0 1 0-6 0\"/><path d=\"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20\"/><circle cx=\"12\" cy=\"8\" r=\"2\"/></svg>`;\n\nconst lockIcon = `<svg focusable=\"false\" aria-hidden=\"true\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><rect x=\"3\" y=\"11\" width=\"18\" height=\"11\" rx=\"2\"/><path d=\"M7 11V7a5 5 0 0 1 10 0v4\"/></svg>`;\n\ntype TSigningOption = 'none' | 'delegator' | 'name_locked';\n\nexport interface IContactSearchEvent {\n query: string;\n}\n\nexport interface IContactSelectEvent {\n first_name: string;\n last_name: string;\n email: string;\n phone: string;\n message: string;\n delegator: boolean;\n name_locked: boolean;\n auth_methods: TRecipientAuthMethod[];\n passcode: string;\n address: string;\n zip: string;\n}\n\nexport type TPickerContact = Partial<IProfile>;\n\n/**\n * Display a contact picker suitable for filling out Recipient objects when sending Envelopes.\n *\n * This picker can also be integrated with a backend to provide contact list / suggestion / address-book style behavior. As the\n * user interacts with the component, the text entered in the name fields is sent back to the parent via the `searchContacts` event.\n * The parent can use that text as a query string to call a backend to obtain appropriate contacts to show. This list may also be\n * hard-coded ahead of time to provide the user with smart suggestions on initial display, such as \"Recently Used\" contacts, or\n * to always display the user's own contact record.\n *\n * ```ts\n * <verdocs-contact-picker\n * templateRole={role}\n * contactSuggestions={[]}\n * onNext={e => console.log('Contact completed', e.detail)}\n * />\n * ```\n */\n@Component({\n tag: 'verdocs-contact-picker',\n styleUrl: 'verdocs-contact-picker.scss',\n shadow: false,\n})\nexport class VerdocsContactPicker {\n @Element() el: HTMLElement;\n\n private namesRowEl: HTMLElement;\n private suggestionsEl: 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 = VerdocsEndpoint.getDefault();\n\n /**\n * The role that this contact will be assigned to.\n */\n @Prop() templateRole: Partial<IRecipient> | null = null;\n\n /**\n * If set, suggestions will be displayed in a drop-down list to the user. It is recommended that the number\n * of suggestions be limited to the 5 best matching records.\n */\n @Prop() contactSuggestions: TPickerContact[] = [];\n\n /**\n * Whether to show a Cancel button beside Done.\n */\n @Prop() showCancel = true;\n\n /**\n * Event fired when the user enters text in the search field. The calling application may use this to update\n * the `contactSuggestions` property.\n */\n @Event({composed: true}) searchContacts: EventEmitter<IContactSearchEvent>;\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 when the user changes the type.\n */\n @Event({composed: true}) next: EventEmitter<IContactSelectEvent>;\n\n @State() first_name: string;\n @State() last_name: string;\n @State() email: string;\n @State() phone: string;\n @State() zip: string;\n @State() address: string;\n @State() message: string;\n @State() showSuggestions: boolean = false;\n @State() showMessage: boolean = false;\n @State() delegator: boolean = false;\n @State() name_locked: boolean = false;\n @State() auth_methods: TRecipientAuthMethod[] = [];\n @State() passcode: string = '';\n\n @State() firstNameFieldId = `verdocs-contact-picker-firstname-${Math.random().toString(36).substring(2, 11)}`;\n @State() lastNameFieldId = `verdocs-contact-picker-lastname-${Math.random().toString(36).substring(2, 11)}`;\n @State() emailFieldId = `verdocs-contact-picker-email-${Math.random().toString(36).substring(2, 11)}`;\n @State() phoneFieldId = `verdocs-contact-picker-phone-${Math.random().toString(36).substring(2, 11)}`;\n\n @State() activeEntitlements: Partial<Record<TEntitlement, IEntitlement>> = {};\n @State() authMethodsLoading: boolean = true;\n\n async componentWillLoad() {\n this.endpoint.loadSession();\n\n if (this.templateRole) {\n const fullName = formatFullName(this.templateRole);\n const nameComponents = fullName.split(' ');\n const firstName = this.templateRole.first_name || nameComponents.shift() || '';\n const lastName = this.templateRole.last_name || nameComponents.join(' ') || '';\n this.first_name = firstName;\n this.last_name = lastName;\n\n this.email = this.templateRole.email || '';\n this.phone = this.templateRole.phone || '';\n // delegator and name_locked are mutually exclusive; delegator takes precedence if both are somehow set\n this.delegator = this.templateRole.delegator || false;\n this.name_locked = this.delegator ? false : this.templateRole.name_locked || false;\n this.message = this.templateRole.message || '';\n this.showMessage = this.message !== '';\n this.auth_methods = this.templateRole.auth_methods || [];\n this.passcode = this.templateRole.passcode || '';\n }\n\n // Entitlements only gate optional methods like KBA. We need error handling here in case the getActiveEntitlements\n // call fails or we stay loading forever.\n this.activeEntitlements = await getActiveEntitlements(this.endpoint).catch(e => {\n console.warn('[CONTACT PICKER] Unable to load entitlements, continuing with base auth methods only', e);\n return {} as Partial<Record<TEntitlement, IEntitlement>>;\n });\n\n this.authMethodsLoading = false;\n console.log('[CONTACT PICKER] Loaded entitlements', this.activeEntitlements);\n }\n\n // Make sure the suggestion list doesn't break the scroll region\n componentDidRender() {\n const body = this.el.querySelector('.form-body') as HTMLElement | null;\n updateScrollFade(body);\n if (this.suggestionsEl && this.namesRowEl && body) {\n this.suggestionsEl.style.top = `${this.namesRowEl.offsetTop + this.namesRowEl.offsetHeight - body.scrollTop + 4}px`;\n }\n }\n\n @Listen('click', {target: 'document'})\n handleDocumentClick(e: MouseEvent) {\n if (this.showSuggestions && !this.el.contains(e.target as Node)) {\n this.showSuggestions = false;\n }\n }\n\n handleFirstNameChange(e: any) {\n this.first_name = e.target.value;\n this.searchContacts?.emit({query: this.first_name});\n }\n\n handleLastNameChange(e: any) {\n this.last_name = e.target.value;\n this.searchContacts?.emit({query: this.last_name});\n }\n\n handleCancel(e: any) {\n e.stopPropagation();\n this.showSuggestions = false;\n this.exit?.emit();\n }\n\n handleSubmit(e: any) {\n e.stopPropagation();\n\n this.showSuggestions = false;\n this.next?.emit({\n first_name: this.first_name,\n last_name: this.last_name,\n email: this.email,\n phone: this.phone,\n message: this.message,\n delegator: this.delegator,\n name_locked: this.name_locked,\n auth_methods: this.auth_methods,\n passcode: this.passcode,\n address: this.address,\n zip: this.zip,\n });\n }\n\n handleSelectSuggestion(e: any, suggestion: TPickerContact) {\n e.stopPropagation();\n\n this.first_name = suggestion.first_name;\n this.last_name = suggestion.last_name;\n this.email = suggestion.email;\n this.phone = suggestion.phone;\n this.showSuggestions = false;\n }\n\n toggleAuthMethod(method: TRecipientAuthMethod) {\n if (this.auth_methods.includes(method)) {\n this.auth_methods = this.auth_methods.filter(selected => selected !== method);\n } else {\n this.auth_methods = [...this.auth_methods, method];\n }\n }\n\n // TODO: Decide whether we want to keep these mutually-exclusive\n setSigningOption(option: TSigningOption) {\n this.delegator = option === 'delegator';\n this.name_locked = option === 'name_locked';\n }\n\n renderPill(label: string, selected: boolean, onClick: () => void, opts: {locked?: boolean; title?: string} = {}) {\n return (\n <button\n type=\"button\"\n class={{pill: true, selected, locked: !!opts.locked}}\n aria-pressed={selected ? 'true' : 'false'}\n disabled={opts.locked && !selected}\n title={opts.title}\n onClick={onClick}\n >\n {opts.locked && <span class=\"pill-icon\" innerHTML={lockIcon} />}\n {label}\n </button>\n );\n }\n\n // The reason for the random names/IDs is to disable browser autocomplete. We set the autocomplete tags but many browsers ignore them\n // and show a duplicate autocomplete picker on top of our own.\n render() {\n const hasBasics = this.first_name && this.last_name && isValidEmail(this.email);\n\n const hasAuthRequirements = this.auth_methods.every(method => {\n switch (method) {\n case 'passcode':\n return !!this.passcode;\n case 'kba':\n return !!this.first_name && !!this.last_name;\n case 'email':\n return !!this.email;\n case 'sms':\n return !!this.phone;\n default:\n return true;\n }\n });\n\n const canSubmit = hasBasics && hasAuthRequirements;\n const hasSMSAuth = !!this.activeEntitlements.sms_auth;\n\n // TODO: We show non-entitled options disabled so folks know what's possible. We could alternatively hide them.\n const verificationOptions: {label: string; value: TRecipientAuthMethod; locked?: boolean}[] = [\n {label: 'Email OTP', value: 'email'},\n {label: 'Passcode', value: 'passcode'},\n {label: 'SMS OTP', value: 'sms', locked: !hasSMSAuth},\n {label: 'KBA', value: 'kba', locked: !this.activeEntitlements.kba_auth},\n {label: 'ID check', value: 'id', locked: !this.activeEntitlements.id_auth},\n ];\n\n const signingOption: TSigningOption = this.delegator ? 'delegator' : this.name_locked ? 'name_locked' : 'none';\n\n return (\n <form onSubmit={e => e.preventDefault()} autocomplete=\"off\">\n <div class=\"form-body-wrap\">\n <div\n class=\"form-body\"\n onScroll={(e: any) => {\n updateScrollFade(e.target);\n this.showSuggestions = false;\n }}\n >\n <div class=\"row names\" ref={el => (this.namesRowEl = el)}>\n <div class=\"field\">\n <label htmlFor={this.firstNameFieldId}>First name</label>\n <input\n id={this.firstNameFieldId}\n name={this.firstNameFieldId}\n type=\"text\"\n data-lpignore=\"true\"\n autocomplete=\"blocked\"\n aria-autocomplete=\"none\"\n value={this.first_name}\n onFocus={() => {\n // Give the blur event a chance to hide it first if going between first/last\n setTimeout(() => {\n this.showSuggestions = this.contactSuggestions?.length > 0;\n }, 100);\n }}\n onInput={e => this.handleFirstNameChange(e)}\n />\n </div>\n <div class=\"field\">\n <label htmlFor={this.lastNameFieldId}>Last name</label>\n <input\n id={this.lastNameFieldId}\n name={this.lastNameFieldId}\n type=\"text\"\n data-lpignore=\"true\"\n autocomplete=\"blocked\"\n aria-autocomplete=\"none\"\n value={this.last_name}\n onFocus={() => {\n // Give the blur event a chance to hide it first if going between first/last\n setTimeout(() => {\n this.showSuggestions = this.contactSuggestions?.length > 0;\n }, 100);\n }}\n onInput={e => this.handleLastNameChange(e)}\n />\n </div>\n </div>\n\n <div class=\"field\">\n <label htmlFor={this.emailFieldId}>Email</label>\n <input\n id={this.emailFieldId}\n name={this.emailFieldId}\n type=\"text\"\n data-lpignore=\"true\"\n autoComplete=\"blocked\"\n aria-autocomplete=\"none\"\n value={this.email}\n onFocus={() => (this.showSuggestions = false)}\n onInput={(e: any) => (this.email = e.target.value)}\n />\n </div>\n\n {hasSMSAuth && (\n <div class=\"field\">\n <label htmlFor={this.phoneFieldId}>\n Phone <span class=\"optional\">(optional)</span>\n </label>\n <input\n id={this.phoneFieldId}\n name={this.phoneFieldId}\n type=\"text\"\n data-lpignore=\"true\"\n autoComplete=\"blocked\"\n aria-autocomplete=\"none\"\n value={this.phone}\n placeholder=\"+1 (555) 000-0000\"\n onFocus={() => (this.showSuggestions = false)}\n onInput={(e: any) => {\n this.phone = convertToE164(e.target.value);\n }}\n />\n </div>\n )}\n\n <div class=\"group\">\n <div class=\"group-label\">Verification</div>\n {this.authMethodsLoading ? (\n <verdocs-spinner size={10} mode=\"dark\" />\n ) : (\n <div class=\"pills\">\n {verificationOptions.map(option =>\n this.renderPill(option.label, this.auth_methods.includes(option.value), () => this.toggleAuthMethod(option.value), {\n locked: option.locked,\n title: option.locked ? 'Please contact sales@verdocs.com to enable this feature.' : undefined,\n }),\n )}\n </div>\n )}\n\n {this.auth_methods.includes('passcode') && (\n <div class=\"passcode\">\n <input\n id=\"verdocs-passcode\"\n name=\"verdocs-passcode\"\n type=\"text\"\n data-lpignore=\"true\"\n autocomplete=\"blocked\"\n aria-autocomplete=\"none\"\n aria-label=\"Passcode\"\n value={this.passcode}\n placeholder=\"4-8 digits\"\n onFocus={() => (this.showSuggestions = false)}\n onInput={(e: any) => (this.passcode = e.target.value)}\n />\n <span class=\"passcode-hint\">PIN or passcode shared separately with the recipient ahead of time</span>\n </div>\n )}\n </div>\n\n <div class=\"group\">\n <div class=\"group-label\">Signing options</div>\n <div class=\"pills\">\n {this.renderPill('None', signingOption === 'none', () => this.setSigningOption('none'))}\n {this.renderPill('May delegate', signingOption === 'delegator', () => this.setSigningOption('delegator'))}\n {this.renderPill('Name locked', signingOption === 'name_locked', () => this.setSigningOption('name_locked'))}\n </div>\n </div>\n\n <div class=\"field\">\n <label htmlFor=\"verdocs-contact-picker-message\">\n Message <span class=\"optional\">(optional)</span>\n </label>\n <textarea\n id=\"verdocs-contact-picker-message\"\n name=\"verdocs-contact-picker-message\"\n data-lpignore=\"true\"\n autocomplete=\"blocked\"\n placeholder=\"Add a message to the invitation\"\n onFocus={() => (this.showSuggestions = false)}\n onInput={(e: any) => (this.message = e.target.value)}\n >\n {this.message}\n </textarea>\n </div>\n </div>\n <div class=\"scroll-fade\" />\n {this.showSuggestions && (\n <div class=\"suggestions\" role=\"listbox\" ref={el => (this.suggestionsEl = el)}>\n {this.contactSuggestions\n .filter(suggestion => !this.first_name || suggestion.first_name?.toLowerCase().includes(this.first_name.toLowerCase()))\n .map(suggestion => (\n <div key={suggestion.id ?? suggestion.email} class=\"suggestion\" onClick={e => this.handleSelectSuggestion(e, suggestion)}>\n {suggestion.picture ? <img alt=\"Avatar\" class=\"avatar\" src={suggestion.picture} /> : <div class=\"avatar\" innerHTML={addrBookIcon} />}\n <div class=\"details\">\n <div class=\"name\">{formatFullName(suggestion)}</div>\n {suggestion.email && <div class=\"destination\">{suggestion.email}</div>}\n {suggestion.phone && <div class=\"destination\">{suggestion.phone}</div>}\n </div>\n </div>\n ))}\n </div>\n )}\n </div>\n\n <div class=\"buttons\">\n {this.showCancel && <verdocs-button label=\"Cancel\" variant=\"text\" size=\"small\" onClick={e => this.handleCancel(e)} />}\n <verdocs-button label=\"Done\" size=\"small\" disabled={!canSubmit} onClick={!canSubmit ? () => {} : e => this.handleSubmit(e)} />\n </div>\n </form>\n );\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"verdocs-contact-picker.js","sourceRoot":"","sources":["../../../../src/components/envelopes/verdocs-contact-picker/verdocs-contact-picker.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,OAAO,EAAE,CAAC,EAAE,KAAK,EAAgB,MAAM,EAAE,IAAI,EAAE,KAAK,EAAC,MAAM,eAAe,CAAC;AAC9F,OAAO,EAAC,cAAc,EAAE,qBAAqB,EAAsC,YAAY,EAAsC,eAAe,EAAC,MAAM,iBAAiB,CAAC;AAC7K,OAAO,EAAC,gBAAgB,EAAC,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAC,aAAa,EAAC,MAAM,sBAAsB,CAAC;AAEnD,MAAM,YAAY,GAAG,mUAAmU,CAAC;AAEzV,MAAM,QAAQ,GAAG,8PAA8P,CAAC;AAwBhR;;;;;;;;;;;;;;;;GAgBG;AAMH,MAAM,OAAO,oBAAoB;IALjC;QAWE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,QAAQ,EAAC,OAAO,EAAC,MAAM,EAAC,IAAI,EAAC,OAAO,EAAC,OAAO,EAAE,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,GAAI;gBACrH,sBAAgB,KAAK,EAAC,MAAM,EAAC,IAAI,EAAC,OAAO,EAAC,QAAQ,EAAE,CAAC,SAAS,EAAE,OAAO,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,GAAI,CAC1H,CACD,CACR,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import {Component, Element, h, Event, EventEmitter, Listen, Prop, State} from '@stencil/core';\nimport {formatFullName, getActiveEntitlements, IEntitlement, IProfile, IRecipient, isValidEmail, TEntitlement, TRecipientAuthMethod, VerdocsEndpoint} from '@verdocs/js-sdk';\nimport {updateScrollFade} from '../../../utils/ScrollFade';\nimport {convertToE164} from '../../../utils/utils';\n\nconst addrBookIcon = `<svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" class=\"lucide lucide-book-user\"><path d=\"M15 13a3 3 0 1 0-6 0\"/><path d=\"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20\"/><circle cx=\"12\" cy=\"8\" r=\"2\"/></svg>`;\n\nconst lockIcon = `<svg focusable=\"false\" aria-hidden=\"true\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><rect x=\"3\" y=\"11\" width=\"18\" height=\"11\" rx=\"2\"/><path d=\"M7 11V7a5 5 0 0 1 10 0v4\"/></svg>`;\n\ntype TSigningOption = 'none' | 'delegator' | 'name_locked';\n\nexport interface IContactSearchEvent {\n query: string;\n}\n\nexport interface IContactSelectEvent {\n first_name: string;\n last_name: string;\n email: string;\n phone: string;\n message: string;\n delegator: boolean;\n name_locked: boolean;\n auth_methods: TRecipientAuthMethod[];\n passcode: string;\n address: string;\n zip: string;\n}\n\nexport type TPickerContact = Partial<IProfile>;\n\n/**\n * Display a contact picker suitable for filling out Recipient objects when sending Envelopes.\n *\n * This picker can also be integrated with a backend to provide contact list / suggestion / address-book style behavior. As the\n * user interacts with the component, the text entered in the name fields is sent back to the parent via the `searchContacts` event.\n * The parent can use that text as a query string to call a backend to obtain appropriate contacts to show. This list may also be\n * hard-coded ahead of time to provide the user with smart suggestions on initial display, such as \"Recently Used\" contacts, or\n * to always display the user's own contact record.\n *\n * ```ts\n * <verdocs-contact-picker\n * templateRole={role}\n * contactSuggestions={[]}\n * onNext={e => console.log('Contact completed', e.detail)}\n * />\n * ```\n */\n@Component({\n tag: 'verdocs-contact-picker',\n styleUrl: 'verdocs-contact-picker.scss',\n shadow: false,\n})\nexport class VerdocsContactPicker {\n @Element() el: HTMLElement;\n\n private namesRowEl: HTMLElement;\n private suggestionsEl: 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 = VerdocsEndpoint.getDefault();\n\n /**\n * The role that this contact will be assigned to.\n */\n @Prop() templateRole: Partial<IRecipient> | null = null;\n\n /**\n * If set, suggestions will be displayed in a drop-down list to the user. It is recommended that the number\n * of suggestions be limited to the 5 best matching records.\n */\n @Prop() contactSuggestions: TPickerContact[] = [];\n\n /**\n * Whether to show a Cancel button beside Done.\n */\n @Prop() showCancel = true;\n\n /**\n * Event fired when the user enters text in the search field. The calling application may use this to update\n * the `contactSuggestions` property.\n */\n @Event({composed: true}) searchContacts: EventEmitter<IContactSearchEvent>;\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 when the user changes the type.\n */\n @Event({composed: true}) next: EventEmitter<IContactSelectEvent>;\n\n @State() first_name: string;\n @State() last_name: string;\n @State() email: string;\n @State() phone: string;\n @State() zip: string;\n @State() address: string;\n @State() message: string;\n @State() showSuggestions: boolean = false;\n @State() showMessage: boolean = false;\n @State() delegator: boolean = false;\n @State() name_locked: boolean = false;\n @State() auth_methods: TRecipientAuthMethod[] = [];\n @State() passcode: string = '';\n\n @State() firstNameFieldId = `verdocs-contact-picker-firstname-${Math.random().toString(36).substring(2, 11)}`;\n @State() lastNameFieldId = `verdocs-contact-picker-lastname-${Math.random().toString(36).substring(2, 11)}`;\n @State() emailFieldId = `verdocs-contact-picker-email-${Math.random().toString(36).substring(2, 11)}`;\n @State() phoneFieldId = `verdocs-contact-picker-phone-${Math.random().toString(36).substring(2, 11)}`;\n\n @State() activeEntitlements: Partial<Record<TEntitlement, IEntitlement>> = {};\n @State() authMethodsLoading: boolean = true;\n\n async componentWillLoad() {\n this.endpoint.loadSession();\n\n if (this.templateRole) {\n const fullName = formatFullName(this.templateRole);\n const nameComponents = fullName.split(' ');\n const firstName = this.templateRole.first_name || nameComponents.shift() || '';\n const lastName = this.templateRole.last_name || nameComponents.join(' ') || '';\n this.first_name = firstName;\n this.last_name = lastName;\n\n this.email = this.templateRole.email || '';\n this.phone = this.templateRole.phone || '';\n // delegator and name_locked are mutually exclusive; delegator takes precedence if both are somehow set\n this.delegator = this.templateRole.delegator || false;\n this.name_locked = this.delegator ? false : this.templateRole.name_locked || false;\n this.message = this.templateRole.message || '';\n this.showMessage = this.message !== '';\n this.auth_methods = this.templateRole.auth_methods || [];\n this.passcode = this.templateRole.passcode || '';\n }\n\n // Entitlements only gate optional methods like KBA. We need error handling here in case the getActiveEntitlements\n // call fails or we stay loading forever.\n this.activeEntitlements = await getActiveEntitlements(this.endpoint).catch(e => {\n console.warn('[CONTACT PICKER] Unable to load entitlements, continuing with base auth methods only', e);\n return {} as Partial<Record<TEntitlement, IEntitlement>>;\n });\n\n this.authMethodsLoading = false;\n console.log('[CONTACT PICKER] Loaded entitlements', this.activeEntitlements);\n }\n\n // Make sure the suggestion list doesn't break the scroll region\n componentDidRender() {\n const body = this.el.querySelector('.form-body') as HTMLElement | null;\n updateScrollFade(body);\n if (this.suggestionsEl && this.namesRowEl && body) {\n this.suggestionsEl.style.top = `${this.namesRowEl.offsetTop + this.namesRowEl.offsetHeight - body.scrollTop + 4}px`;\n }\n }\n\n @Listen('click', {target: 'document'})\n handleDocumentClick(e: MouseEvent) {\n if (this.showSuggestions && !this.el.contains(e.target as Node)) {\n this.showSuggestions = false;\n }\n }\n\n handleFirstNameChange(e: any) {\n this.first_name = e.target.value;\n this.searchContacts?.emit({query: this.first_name});\n }\n\n handleLastNameChange(e: any) {\n this.last_name = e.target.value;\n this.searchContacts?.emit({query: this.last_name});\n }\n\n handleCancel(e: any) {\n e.stopPropagation();\n this.showSuggestions = false;\n this.exit?.emit();\n }\n\n handleSubmit(e: any) {\n e.stopPropagation();\n\n this.showSuggestions = false;\n this.next?.emit({\n first_name: this.first_name,\n last_name: this.last_name,\n email: this.email,\n phone: this.phone,\n message: this.message,\n delegator: this.delegator,\n name_locked: this.name_locked,\n auth_methods: this.auth_methods,\n passcode: this.passcode,\n address: this.address,\n zip: this.zip,\n });\n }\n\n handleSelectSuggestion(e: any, suggestion: TPickerContact) {\n e.stopPropagation();\n\n this.first_name = suggestion.first_name;\n this.last_name = suggestion.last_name;\n this.email = suggestion.email;\n this.phone = suggestion.phone;\n this.showSuggestions = false;\n }\n\n toggleAuthMethod(method: TRecipientAuthMethod) {\n if (this.auth_methods.includes(method)) {\n this.auth_methods = this.auth_methods.filter(selected => selected !== method);\n } else {\n this.auth_methods = [...this.auth_methods, method];\n }\n }\n\n // TODO: Decide whether we want to keep these mutually-exclusive\n setSigningOption(option: TSigningOption) {\n this.delegator = option === 'delegator';\n this.name_locked = option === 'name_locked';\n }\n\n renderPill(label: string, selected: boolean, onClick: () => void, opts: {locked?: boolean; title?: string} = {}) {\n return (\n <button\n type=\"button\"\n class={{pill: true, selected, locked: !!opts.locked}}\n aria-pressed={selected ? 'true' : 'false'}\n disabled={opts.locked && !selected}\n title={opts.title}\n onClick={onClick}\n >\n {opts.locked && <span class=\"pill-icon\" innerHTML={lockIcon} />}\n {label}\n </button>\n );\n }\n\n // The reason for the random names/IDs is to disable browser autocomplete. We set the autocomplete tags but many browsers ignore them\n // and show a duplicate autocomplete picker on top of our own.\n render() {\n const hasBasics = this.first_name && this.last_name && isValidEmail(this.email);\n\n // First name is the first focused field so it's our quicksearch matching target.\n const visibleSuggestions = (this.contactSuggestions || []).filter(\n suggestion => !this.first_name || suggestion.first_name?.toLowerCase().includes(this.first_name.toLowerCase()),\n );\n\n const hasAuthRequirements = this.auth_methods.every(method => {\n switch (method) {\n case 'passcode':\n return !!this.passcode;\n case 'kba':\n return !!this.first_name && !!this.last_name;\n case 'email':\n return !!this.email;\n case 'sms':\n return !!this.phone;\n default:\n return true;\n }\n });\n\n const canSubmit = hasBasics && hasAuthRequirements;\n const hasSMSAuth = !!this.activeEntitlements.sms_auth;\n\n // TODO: We show non-entitled options disabled so folks know what's possible. We could alternatively hide them.\n const verificationOptions: {label: string; value: TRecipientAuthMethod; locked?: boolean}[] = [\n {label: 'Email OTP', value: 'email'},\n {label: 'Passcode', value: 'passcode'},\n {label: 'SMS OTP', value: 'sms', locked: !hasSMSAuth},\n {label: 'KBA', value: 'kba', locked: !this.activeEntitlements.kba_auth},\n {label: 'ID check', value: 'id', locked: !this.activeEntitlements.id_auth},\n ];\n\n const signingOption: TSigningOption = this.delegator ? 'delegator' : this.name_locked ? 'name_locked' : 'none';\n\n return (\n <form onSubmit={e => e.preventDefault()} autocomplete=\"off\">\n <div class=\"form-body-wrap\">\n <div\n class=\"form-body\"\n onScroll={(e: any) => {\n updateScrollFade(e.target);\n this.showSuggestions = false;\n }}\n >\n <div class=\"row names\" ref={el => (this.namesRowEl = el)}>\n <div class=\"field\">\n <label htmlFor={this.firstNameFieldId}>First name</label>\n <input\n id={this.firstNameFieldId}\n name={this.firstNameFieldId}\n type=\"text\"\n data-lpignore=\"true\"\n autocomplete=\"blocked\"\n aria-autocomplete=\"none\"\n value={this.first_name}\n onFocus={() => {\n // Give the blur event a chance to hide it first if going between first/last\n setTimeout(() => {\n this.showSuggestions = this.contactSuggestions?.length > 0;\n }, 100);\n }}\n onInput={e => this.handleFirstNameChange(e)}\n />\n </div>\n <div class=\"field\">\n <label htmlFor={this.lastNameFieldId}>Last name</label>\n <input\n id={this.lastNameFieldId}\n name={this.lastNameFieldId}\n type=\"text\"\n data-lpignore=\"true\"\n autocomplete=\"blocked\"\n aria-autocomplete=\"none\"\n value={this.last_name}\n onFocus={() => {\n // Give the blur event a chance to hide it first if going between first/last\n setTimeout(() => {\n this.showSuggestions = this.contactSuggestions?.length > 0;\n }, 100);\n }}\n onInput={e => this.handleLastNameChange(e)}\n />\n </div>\n </div>\n\n <div class=\"field\">\n <label htmlFor={this.emailFieldId}>Email</label>\n <input\n id={this.emailFieldId}\n name={this.emailFieldId}\n type=\"text\"\n data-lpignore=\"true\"\n autoComplete=\"blocked\"\n aria-autocomplete=\"none\"\n value={this.email}\n onFocus={() => (this.showSuggestions = false)}\n onInput={(e: any) => (this.email = e.target.value)}\n />\n </div>\n\n {hasSMSAuth && (\n <div class=\"field\">\n <label htmlFor={this.phoneFieldId}>\n Phone <span class=\"optional\">(optional)</span>\n </label>\n <input\n id={this.phoneFieldId}\n name={this.phoneFieldId}\n type=\"text\"\n data-lpignore=\"true\"\n autoComplete=\"blocked\"\n aria-autocomplete=\"none\"\n value={this.phone}\n placeholder=\"+1 (555) 000-0000\"\n onFocus={() => (this.showSuggestions = false)}\n onInput={(e: any) => {\n this.phone = convertToE164(e.target.value);\n }}\n />\n </div>\n )}\n\n <div class=\"group\">\n <div class=\"group-label\">Verification</div>\n {this.authMethodsLoading ? (\n <verdocs-spinner size={10} mode=\"dark\" />\n ) : (\n <div class=\"pills\">\n {verificationOptions.map(option =>\n this.renderPill(option.label, this.auth_methods.includes(option.value), () => this.toggleAuthMethod(option.value), {\n locked: option.locked,\n title: option.locked ? 'Please contact sales@verdocs.com to enable this feature.' : undefined,\n }),\n )}\n </div>\n )}\n\n {this.auth_methods.includes('passcode') && (\n <div class=\"passcode\">\n <input\n id=\"verdocs-passcode\"\n name=\"verdocs-passcode\"\n type=\"text\"\n data-lpignore=\"true\"\n autocomplete=\"blocked\"\n aria-autocomplete=\"none\"\n aria-label=\"Passcode\"\n value={this.passcode}\n placeholder=\"4-8 digits\"\n onFocus={() => (this.showSuggestions = false)}\n onInput={(e: any) => (this.passcode = e.target.value)}\n />\n <span class=\"passcode-hint\">PIN or passcode shared separately with the recipient ahead of time</span>\n </div>\n )}\n </div>\n\n <div class=\"group\">\n <div class=\"group-label\">Signing options</div>\n <div class=\"pills\">\n {this.renderPill('None', signingOption === 'none', () => this.setSigningOption('none'))}\n {this.renderPill('May delegate', signingOption === 'delegator', () => this.setSigningOption('delegator'))}\n {this.renderPill('Name locked', signingOption === 'name_locked', () => this.setSigningOption('name_locked'))}\n </div>\n </div>\n\n <div class=\"field\">\n <label htmlFor=\"verdocs-contact-picker-message\">\n Message <span class=\"optional\">(optional)</span>\n </label>\n <textarea\n id=\"verdocs-contact-picker-message\"\n name=\"verdocs-contact-picker-message\"\n data-lpignore=\"true\"\n autocomplete=\"blocked\"\n placeholder=\"Add a message to the invitation\"\n onFocus={() => (this.showSuggestions = false)}\n onInput={(e: any) => (this.message = e.target.value)}\n >\n {this.message}\n </textarea>\n </div>\n </div>\n <div class=\"scroll-fade\" />\n {this.showSuggestions && visibleSuggestions.length > 0 && (\n <div class=\"suggestions\" role=\"listbox\" ref={el => (this.suggestionsEl = el)}>\n {visibleSuggestions.map(suggestion => (\n <div key={suggestion.id ?? suggestion.email} class=\"suggestion\" onClick={e => this.handleSelectSuggestion(e, suggestion)}>\n {suggestion.picture ? <img alt=\"Avatar\" class=\"avatar\" src={suggestion.picture} /> : <div class=\"avatar\" innerHTML={addrBookIcon} />}\n <div class=\"details\">\n <div class=\"name\">{formatFullName(suggestion)}</div>\n {suggestion.email && <div class=\"destination\">{suggestion.email}</div>}\n {suggestion.phone && <div class=\"destination\">{suggestion.phone}</div>}\n </div>\n </div>\n ))}\n </div>\n )}\n </div>\n\n <div class=\"buttons\">\n {this.showCancel && <verdocs-button label=\"Cancel\" variant=\"text\" size=\"small\" onClick={e => this.handleCancel(e)} />}\n <verdocs-button label=\"Done\" size=\"small\" disabled={!canSubmit} onClick={!canSubmit ? () => {} : e => this.handleSubmit(e)} />\n </div>\n </form>\n );\n }\n}\n"]}
|
|
@@ -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;gBACrB,OAAO,CAAC,GAAG,CAAC,yCAAyC,IAAI,CAAC,UAAU,EAAE,CAAC,CAA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ACf,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,MAAM,eAAe,CAAC;AACnF,OAAO,EAAC,WAAW,EAAE,eAAe,EAAC,MAAM,i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,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 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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["verdocsSignFooterCss","QuestionIcon","DeclineIcon","SaveIcon","VerdocsSignFooter","__stencil_proxyCustomElement","HTMLElement","constructor","registerHost","this","envelopeListenerId","endpoint","VerdocsEndpoint","getDefault","envelopeId","isDone","brand","askingQuestion","declinine","envelope","componentWillLoad","console","log","listenToEnvelope","e","_a","sdkError","emit","SDKError","message","_b","response","status","_c","data","disconnectedCallback","unlistenToEnvelope","Store","subscribe","getEnvelope","store","delListener","render","org","organization","poweredByLabel","powered_by_label","poweredByUrl","_d","powered_by_url","termsUrl","_e","terms_use_url","privacyUrl","_f","privacy_policy_url","hasPoweredBy","hasLinks","hasButtons","h","Host","key","class","href","target","rel","onClick","innerHTML","decline","finishLater","onNext","askQuestion","question","detail","onExit"],"sources":["src/components/envelopes/verdocs-sign-footer/verdocs-sign-footer.scss?tag=verdocs-sign-footer","src/components/envelopes/verdocs-sign-footer/verdocs-sign-footer.tsx"],"sourcesContent":["@import '../../../theme.scss';\n\nverdocs-sign-footer {\n left: 0;\n right: 0;\n bottom: 0;\n height: 48px;\n display: flex;\n color: #616161;\n position: fixed;\n font-size: 12px;\n padding: 0 24px;\n align-items: center;\n flex-direction: row;\n background: #ffffff;\n container-type: inline-size;\n border-top: 1px solid #e0e0e0;\n justify-content: space-between;\n font-family: $verdocs-primary-font;\n transition: 0.5s cubic-bezier(0.35, 0, 0.25, 1);\n\n a {\n color: #616161;\n cursor: pointer;\n text-decoration: none;\n border-bottom: 1px dotted #616161;\n }\n\n &.loading {\n display: none;\n }\n\n .powered-by {\n white-space: nowrap;\n }\n\n .buttons {\n flex: 0;\n gap: 16px;\n display: flex;\n flex-direction: row;\n white-space: nowrap;\n align-items: center;\n\n button {\n gap: 4px;\n border: none;\n display: flex;\n outline: none;\n cursor: pointer;\n flex-direction: row;\n align-items: center;\n background: transparent;\n }\n\n div {\n gap: 4px;\n display: flex;\n flex-direction: row;\n align-items: center;\n }\n }\n\n .links {\n flex: 0;\n gap: 8px;\n display: flex;\n flex-direction: row;\n white-space: nowrap;\n }\n\n &.just-buttons {\n .buttons {\n flex: 1;\n justify-content: center;\n }\n }\n\n @container (max-width: 720px) {\n &.has-buttons .powered-by {\n display: none;\n }\n }\n\n @container (max-width: 540px) {\n &.no-buttons .powered-by {\n display: none;\n }\n\n &.has-buttons .links {\n display: none;\n }\n\n .buttons {\n flex: 1;\n justify-content: center;\n }\n }\n}\n","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"],"mappings":"0RAAA,MAAMA,EAAuB,IAAM,+0DCMnC,MAAMC,EAAe,ipBACrB,MAAMC,EAAc,k2BACpB,MAAMC,EAAW,uyB,MAWJC,EAAiBC,EAAA,MAAAD,UAAAE,EAL9B,WAAAC,CAAAC,G,0LAMUC,KAAAC,mBAAqB,KAKrBD,KAAAE,SAA4BC,EAAgBC,aAK5CJ,KAAAK,WAAqB,GAKrBL,KAAAM,OAAS,MAKTN,KAAAO,MAAoC,KA4BnCP,KAAAQ,eAAiB,MACjBR,KAAAS,UAAY,MACZT,KAAAU,SAA6B,IAsLvC,CApLC,uBAAMC,G,UACJ,IAGE,IAAKX,KAAKK,WAAY,CACpBO,QAAQC,IAAI,yCAAyCb,KAAKK,cAC1D,M,CAGFL,KAAKc,kB,CACL,MAAOC,GACPH,QAAQC,IAAI,kCAAmCE,IAC/CC,EAAAhB,KAAKiB,YAAQ,MAAAD,SAAA,SAAAA,EAAEE,KAAK,IAAIC,EAASJ,EAAEK,SAASC,EAAAN,EAAEO,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