@documenso/embed-vue 0.5.0 → 0.6.0

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.
@@ -0,0 +1,21 @@
1
+ import { CssVars } from './css-vars';
2
+ import { DeepPartial, EnvelopeEditorSettings } from './features-type';
3
+ export type EmbedCreateEnvelopeProps = {
4
+ className?: string;
5
+ host?: string;
6
+ presignToken: string;
7
+ externalId?: string;
8
+ type: "DOCUMENT" | "TEMPLATE";
9
+ css?: string | undefined;
10
+ cssVars?: (CssVars & Record<string, string>) | undefined;
11
+ darkModeDisabled?: boolean | undefined;
12
+ features?: DeepPartial<EnvelopeEditorSettings> & Record<string, any>;
13
+ onEnvelopeCreated?: (data: {
14
+ externalId: string | null;
15
+ envelopeId: number;
16
+ }) => void;
17
+ };
18
+ declare const _default: import('vue').DefineComponent<EmbedCreateEnvelopeProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<EmbedCreateEnvelopeProps> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
19
+ __iframe: HTMLIFrameElement;
20
+ }, HTMLIFrameElement>;
21
+ export default _default;
@@ -0,0 +1,47 @@
1
+ export type DeepPartial<T> = T extends object ? {
2
+ [K in keyof T]?: DeepPartial<T[K]>;
3
+ } : T;
4
+ /**
5
+ * Envelope editor settings (features) for create/edit envelope embeds.
6
+ * Matches ZEnvelopeEditorSettingsSchema from the app.
7
+ */
8
+ export type EnvelopeEditorSettings = {
9
+ general: {
10
+ allowConfigureEnvelopeTitle: boolean;
11
+ allowUploadAndRecipientStep: boolean;
12
+ allowAddFieldsStep: boolean;
13
+ allowPreviewStep: boolean;
14
+ minimizeLeftSidebar: boolean;
15
+ };
16
+ /** If null, envelope settings will not be available to be seen/updated. */
17
+ settings: {
18
+ allowConfigureSignatureTypes: boolean;
19
+ allowConfigureLanguage: boolean;
20
+ allowConfigureDateFormat: boolean;
21
+ allowConfigureTimezone: boolean;
22
+ allowConfigureRedirectUrl: boolean;
23
+ allowConfigureDistribution: boolean;
24
+ allowConfigureExpirationPeriod: boolean;
25
+ allowConfigureEmailSender: boolean;
26
+ allowConfigureEmailReplyTo: boolean;
27
+ } | null;
28
+ actions: {
29
+ allowAttachments: boolean;
30
+ };
31
+ /** If null, no adjustments to envelope items will be allowed. */
32
+ envelopeItems: {
33
+ allowConfigureTitle: boolean;
34
+ allowConfigureOrder: boolean;
35
+ allowUpload: boolean;
36
+ allowDelete: boolean;
37
+ } | null;
38
+ /** If null, recipients will not be configurable at all. */
39
+ recipients: {
40
+ allowConfigureSigningOrder: boolean;
41
+ allowConfigureDictateNextSigner: boolean;
42
+ allowApproverRole: boolean;
43
+ allowViewerRole: boolean;
44
+ allowCCerRole: boolean;
45
+ allowAssistantRole: boolean;
46
+ } | null;
47
+ };
package/dist/index.d.mts CHANGED
@@ -4,8 +4,13 @@ export { default as EmbedCreateDocumentV1 } from './create-document.vue';
4
4
  export { default as EmbedCreateTemplateV1 } from './create-template.vue';
5
5
  export { default as EmbedUpdateDocumentV1 } from './update-document.vue';
6
6
  export { default as EmbedUpdateTemplateV1 } from './update-template.vue';
7
+ export { default as EmbedCreateEnvelopeV2 } from './create-envelope.vue';
8
+ export { default as EmbedUpdateEnvelopeV2 } from './update-envelope.vue';
9
+ export type { EnvelopeEditorSettings } from './features-type';
7
10
  export { default as unstable_EmbedCreateDocument } from './create-document.vue';
8
11
  export { default as unstable_EmbedCreateTemplate } from './create-template.vue';
9
12
  export { default as unstable_EmbedUpdateDocument } from './update-document.vue';
10
13
  export { default as unstable_EmbedUpdateTemplate } from './update-template.vue';
14
+ export { default as unstable_EmbedCreateEnvelope } from './create-envelope.vue';
15
+ export { default as unstable_EmbedUpdateEnvelope } from './update-envelope.vue';
11
16
  export { default as unstable_EmbedMultiSignDocument } from './multisign-document.vue';
package/dist/index.d.ts CHANGED
@@ -4,8 +4,13 @@ export { default as EmbedCreateDocumentV1 } from './create-document.vue';
4
4
  export { default as EmbedCreateTemplateV1 } from './create-template.vue';
5
5
  export { default as EmbedUpdateDocumentV1 } from './update-document.vue';
6
6
  export { default as EmbedUpdateTemplateV1 } from './update-template.vue';
7
+ export { default as EmbedCreateEnvelopeV2 } from './create-envelope.vue';
8
+ export { default as EmbedUpdateEnvelopeV2 } from './update-envelope.vue';
9
+ export type { EnvelopeEditorSettings } from './features-type';
7
10
  export { default as unstable_EmbedCreateDocument } from './create-document.vue';
8
11
  export { default as unstable_EmbedCreateTemplate } from './create-template.vue';
9
12
  export { default as unstable_EmbedUpdateDocument } from './update-document.vue';
10
13
  export { default as unstable_EmbedUpdateTemplate } from './update-template.vue';
14
+ export { default as unstable_EmbedCreateEnvelope } from './create-envelope.vue';
15
+ export { default as unstable_EmbedUpdateEnvelope } from './update-envelope.vue';
11
16
  export { default as unstable_EmbedMultiSignDocument } from './multisign-document.vue';
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("vue"),f=["src"],k=n.defineComponent({__name:"direct-template",props:{className:{},host:{},token:{},externalId:{},css:{},cssVars:{},darkModeDisabled:{type:Boolean},email:{},lockEmail:{type:Boolean},name:{},lockName:{type:Boolean},additionalProps:{},onDocumentReady:{type:Function},onDocumentCompleted:{type:Function},onDocumentError:{type:Function},onFieldSigned:{type:Function},onFieldUnsigned:{type:Function}},setup(a){const e=a,s=n.ref(null);n.onMounted(()=>{window.addEventListener("message",c)}),n.onUnmounted(()=>{window.removeEventListener("message",c)});const r=n.computed(()=>{const t=e.host||"https://app.documenso.com",d=btoa(encodeURIComponent(JSON.stringify({name:e.name,lockName:e.lockName,email:e.email,lockEmail:e.lockEmail,css:e.css,cssVars:e.cssVars,darkModeDisabled:e.darkModeDisabled,...e.additionalProps}))),o=new URL(`/embed/direct/${e.token}`,t);return e.externalId&&o.searchParams.set("externalId",e.externalId),`${o}#${d}`});function c(t){if(s.value?.contentWindow===t.source)switch(t.data.action){case"document-ready":e.onDocumentReady?.();break;case"document-completed":e.onDocumentCompleted?.(t.data.data);break;case"document-error":e.onDocumentError?.(t.data.data);break;case"field-signed":e.onFieldSigned?.();break;case"field-unsigned":e.onFieldUnsigned?.();break}}return(t,d)=>(n.openBlock(),n.createElementBlock("iframe",{ref_key:"__iframe",ref:s,class:n.normalizeClass(a.className),src:r.value},null,10,f))}}),_=["src"],b=n.defineComponent({__name:"sign-document",props:{className:{},host:{},token:{},css:{},cssVars:{},darkModeDisabled:{type:Boolean},name:{},lockName:{type:Boolean},allowDocumentRejection:{type:Boolean},additionalProps:{},onDocumentReady:{type:Function},onDocumentCompleted:{type:Function},onDocumentError:{type:Function},onDocumentRejected:{type:Function}},setup(a){const e=a,s=n.ref(null);n.onMounted(()=>{window.addEventListener("message",c)}),n.onUnmounted(()=>{window.removeEventListener("message",c)});const r=n.computed(()=>{const t=e.host||"https://app.documenso.com",d=btoa(encodeURIComponent(JSON.stringify({name:e.name,lockName:e.lockName,css:e.css,cssVars:e.cssVars,darkModeDisabled:e.darkModeDisabled,allowDocumentRejection:e.allowDocumentRejection,...e.additionalProps})));return`${new URL(`/embed/sign/${e.token}`,t)}#${d}`});function c(t){if(s.value?.contentWindow===t.source)switch(t.data.action){case"document-ready":e.onDocumentReady?.();break;case"document-completed":e.onDocumentCompleted?.(t.data.data);break;case"document-error":e.onDocumentError?.(t.data.data);break;case"document-rejected":e.onDocumentRejected?.(t.data.data);break}}return(t,d)=>(n.openBlock(),n.createElementBlock("iframe",{ref_key:"__iframe",ref:s,class:n.normalizeClass(a.className),src:r.value},null,10,_))}}),y=["src"],l=n.defineComponent({__name:"create-document",props:{className:{},host:{},presignToken:{},externalId:{},css:{},cssVars:{},darkModeDisabled:{type:Boolean},features:{},additionalProps:{},onDocumentCreated:{type:Function}},setup(a){const e=a,s=n.ref(null);n.onMounted(()=>{window.addEventListener("message",c)}),n.onUnmounted(()=>{window.removeEventListener("message",c)});const r=n.computed(()=>{const t=e.host||"https://app.documenso.com",d=btoa(encodeURIComponent(JSON.stringify({externalId:e.externalId,features:e.features,css:e.css,cssVars:e.cssVars,darkModeDisabled:e.darkModeDisabled,...e.additionalProps}))),o=new URL("/embed/v1/authoring/document/create",t);return o.searchParams.set("token",e.presignToken),o.hash=d,o.toString()});function c(t){s.value?.contentWindow===t.source&&t.data.type==="document-created"&&e.onDocumentCreated?.({documentId:t.data.documentId,externalId:t.data.externalId})}return(t,d)=>(n.openBlock(),n.createElementBlock("iframe",{ref_key:"__iframe",ref:s,class:n.normalizeClass(a.className),src:r.value},null,10,y))}}),h=["src"],m=n.defineComponent({__name:"create-template",props:{className:{},host:{},presignToken:{},externalId:{},css:{},cssVars:{},darkModeDisabled:{type:Boolean},features:{},additionalProps:{},onTemplateCreated:{type:Function}},setup(a){const e=a,s=n.ref(null);n.onMounted(()=>{window.addEventListener("message",c)}),n.onUnmounted(()=>{window.removeEventListener("message",c)});const r=n.computed(()=>{const t=e.host||"https://app.documenso.com",d=btoa(encodeURIComponent(JSON.stringify({externalId:e.externalId,features:e.features,css:e.css,cssVars:e.cssVars,darkModeDisabled:e.darkModeDisabled,...e.additionalProps}))),o=new URL("/embed/v1/authoring/template/create",t);return o.searchParams.set("token",e.presignToken),o.hash=d,o.toString()});function c(t){s.value?.contentWindow===t.source&&t.data.type==="template-created"&&e.onTemplateCreated?.({templateId:t.data.templateId,externalId:t.data.externalId})}return(t,d)=>(n.openBlock(),n.createElementBlock("iframe",{ref_key:"__iframe",ref:s,class:n.normalizeClass(a.className),src:r.value},null,10,h))}}),D=["src"],i=n.defineComponent({__name:"update-document",props:{className:{},host:{},presignToken:{},documentId:{},externalId:{},css:{},cssVars:{},darkModeDisabled:{type:Boolean},features:{},onlyEditFields:{type:Boolean},additionalProps:{},onDocumentUpdated:{type:Function}},setup(a){const e=a,s=n.ref(null);n.onMounted(()=>{window.addEventListener("message",c)}),n.onUnmounted(()=>{window.removeEventListener("message",c)});const r=n.computed(()=>{const t=e.host||"https://app.documenso.com",d=btoa(encodeURIComponent(JSON.stringify({token:e.presignToken,externalId:e.externalId,features:e.features,css:e.css,cssVars:e.cssVars,darkModeDisabled:e.darkModeDisabled,onlyEditFields:e.onlyEditFields,...e.additionalProps}))),o=new URL(`/embed/v1/authoring/document/edit/${e.documentId}`,t);return o.searchParams.set("token",e.presignToken),o.hash=d,o.toString()});function c(t){s.value?.contentWindow===t.source&&t.data.type==="document-updated"&&e.onDocumentUpdated?.({documentId:t.data.documentId,externalId:t.data.externalId})}return(t,d)=>(n.openBlock(),n.createElementBlock("iframe",{ref_key:"__iframe",ref:s,class:n.normalizeClass(a.className),src:r.value},null,10,D))}}),g=["src"],u=n.defineComponent({__name:"update-template",props:{className:{},host:{},presignToken:{},templateId:{},externalId:{},css:{},cssVars:{},darkModeDisabled:{type:Boolean},features:{},onlyEditFields:{type:Boolean},additionalProps:{},onTemplateUpdated:{type:Function}},setup(a){const e=a,s=n.ref(null);n.onMounted(()=>{window.addEventListener("message",c)}),n.onUnmounted(()=>{window.removeEventListener("message",c)});const r=n.computed(()=>{const t=e.host||"https://app.documenso.com",d=btoa(encodeURIComponent(JSON.stringify({externalId:e.externalId,features:e.features,css:e.css,cssVars:e.cssVars,darkModeDisabled:e.darkModeDisabled,onlyEditFields:e.onlyEditFields,...e.additionalProps}))),o=new URL(`/embed/v1/authoring/template/edit/${e.templateId}`,t);return o.searchParams.set("token",e.presignToken),o.hash=d,o.toString()});function c(t){s.value?.contentWindow===t.source&&t.data.type==="template-updated"&&e.onTemplateUpdated?.({templateId:t.data.templateId,externalId:t.data.externalId})}return(t,d)=>(n.openBlock(),n.createElementBlock("iframe",{ref_key:"__iframe",ref:s,class:n.normalizeClass(a.className),src:r.value},null,10,g))}}),w=["src"],E=n.defineComponent({__name:"multisign-document",props:{className:{},host:{},tokens:{},css:{},cssVars:{},darkModeDisabled:{type:Boolean},name:{},lockName:{type:Boolean},allowDocumentRejection:{type:Boolean},additionalProps:{},onDocumentReady:{type:Function},onDocumentCompleted:{type:Function},onDocumentError:{type:Function},onDocumentRejected:{type:Function},onAllDocumentsCompleted:{type:Function}},setup(a){const e=a,s=n.ref(null);n.onMounted(()=>{window.addEventListener("message",c)}),n.onUnmounted(()=>{window.removeEventListener("message",c)});const r=n.computed(()=>{const t=e.host||"https://app.documenso.com",d=btoa(encodeURIComponent(JSON.stringify({name:e.name,lockName:e.lockName,css:e.css,cssVars:e.cssVars,darkModeDisabled:e.darkModeDisabled,allowDocumentRejection:e.allowDocumentRejection,...e.additionalProps}))),o=new URL("/embed/v1/multisign",t);for(const p of e.tokens)o.searchParams.append("token",p);return`${o}#${d}`});function c(t){if(s.value?.contentWindow===t.source)switch(t.data.action){case"document-ready":e.onDocumentReady?.();break;case"document-completed":e.onDocumentCompleted?.(t.data.data);break;case"document-error":e.onDocumentError?.(t.data.data);break;case"document-rejected":e.onDocumentRejected?.(t.data.data);break;case"all-documents-completed":e.onAllDocumentsCompleted?.(t.data.data);break}}return(t,d)=>(n.openBlock(),n.createElementBlock("iframe",{ref_key:"__iframe",ref:s,class:n.normalizeClass(a.className),src:r.value},null,10,w))}});exports.EmbedCreateDocumentV1=l;exports.EmbedCreateTemplateV1=m;exports.EmbedDirectTemplate=k;exports.EmbedSignDocument=b;exports.EmbedUpdateDocumentV1=i;exports.EmbedUpdateTemplateV1=u;exports.unstable_EmbedCreateDocument=l;exports.unstable_EmbedCreateTemplate=m;exports.unstable_EmbedMultiSignDocument=E;exports.unstable_EmbedUpdateDocument=i;exports.unstable_EmbedUpdateTemplate=u;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("vue"),_=["src"],b=t.defineComponent({__name:"direct-template",props:{className:{},host:{},token:{},externalId:{},css:{},cssVars:{},darkModeDisabled:{type:Boolean},email:{},lockEmail:{type:Boolean},name:{},lockName:{type:Boolean},additionalProps:{},onDocumentReady:{type:Function},onDocumentCompleted:{type:Function},onDocumentError:{type:Function},onFieldSigned:{type:Function},onFieldUnsigned:{type:Function}},setup(a){const e=a,s=t.ref(null);t.onMounted(()=>{window.addEventListener("message",c)}),t.onUnmounted(()=>{window.removeEventListener("message",c)});const r=t.computed(()=>{const n=e.host||"https://app.documenso.com",d=btoa(encodeURIComponent(JSON.stringify({name:e.name,lockName:e.lockName,email:e.email,lockEmail:e.lockEmail,css:e.css,cssVars:e.cssVars,darkModeDisabled:e.darkModeDisabled,...e.additionalProps}))),o=new URL(`/embed/direct/${e.token}`,n);return e.externalId&&o.searchParams.set("externalId",e.externalId),`${o}#${d}`});function c(n){if(s.value?.contentWindow===n.source)switch(n.data.action){case"document-ready":e.onDocumentReady?.();break;case"document-completed":e.onDocumentCompleted?.(n.data.data);break;case"document-error":e.onDocumentError?.(n.data.data);break;case"field-signed":e.onFieldSigned?.();break;case"field-unsigned":e.onFieldUnsigned?.();break}}return(n,d)=>(t.openBlock(),t.createElementBlock("iframe",{ref_key:"__iframe",ref:s,class:t.normalizeClass(a.className),src:r.value},null,10,_))}}),h=["src"],y=t.defineComponent({__name:"sign-document",props:{className:{},host:{},token:{},css:{},cssVars:{},darkModeDisabled:{type:Boolean},name:{},lockName:{type:Boolean},email:{},lockEmail:{type:Boolean},allowDocumentRejection:{type:Boolean},additionalProps:{},onDocumentReady:{type:Function},onDocumentCompleted:{type:Function},onDocumentError:{type:Function},onDocumentRejected:{type:Function}},setup(a){const e=a,s=t.ref(null);t.onMounted(()=>{window.addEventListener("message",c)}),t.onUnmounted(()=>{window.removeEventListener("message",c)});const r=t.computed(()=>{const n=e.host||"https://app.documenso.com",d=btoa(encodeURIComponent(JSON.stringify({name:e.name,lockName:e.lockName,email:e.email,lockEmail:e.lockEmail,css:e.css,cssVars:e.cssVars,darkModeDisabled:e.darkModeDisabled,allowDocumentRejection:e.allowDocumentRejection,...e.additionalProps})));return`${new URL(`/embed/sign/${e.token}`,n)}#${d}`});function c(n){if(s.value?.contentWindow===n.source)switch(n.data.action){case"document-ready":e.onDocumentReady?.();break;case"document-completed":e.onDocumentCompleted?.(n.data.data);break;case"document-error":e.onDocumentError?.(n.data.data);break;case"document-rejected":e.onDocumentRejected?.(n.data.data);break}}return(n,d)=>(t.openBlock(),t.createElementBlock("iframe",{ref_key:"__iframe",ref:s,class:t.normalizeClass(a.className),src:r.value},null,10,h))}}),g=["src"],l=t.defineComponent({__name:"create-document",props:{className:{},host:{},presignToken:{},externalId:{},css:{},cssVars:{},darkModeDisabled:{type:Boolean},features:{},additionalProps:{},onDocumentCreated:{type:Function}},setup(a){const e=a,s=t.ref(null);t.onMounted(()=>{window.addEventListener("message",c)}),t.onUnmounted(()=>{window.removeEventListener("message",c)});const r=t.computed(()=>{const n=e.host||"https://app.documenso.com",d=btoa(encodeURIComponent(JSON.stringify({externalId:e.externalId,features:e.features,css:e.css,cssVars:e.cssVars,darkModeDisabled:e.darkModeDisabled,...e.additionalProps}))),o=new URL("/embed/v1/authoring/document/create",n);return o.searchParams.set("token",e.presignToken),o.hash=d,o.toString()});function c(n){s.value?.contentWindow===n.source&&n.data.type==="document-created"&&e.onDocumentCreated?.({documentId:n.data.documentId,externalId:n.data.externalId})}return(n,d)=>(t.openBlock(),t.createElementBlock("iframe",{ref_key:"__iframe",ref:s,class:t.normalizeClass(a.className),src:r.value},null,10,g))}}),w=["src"],i=t.defineComponent({__name:"create-template",props:{className:{},host:{},presignToken:{},externalId:{},css:{},cssVars:{},darkModeDisabled:{type:Boolean},features:{},additionalProps:{},onTemplateCreated:{type:Function}},setup(a){const e=a,s=t.ref(null);t.onMounted(()=>{window.addEventListener("message",c)}),t.onUnmounted(()=>{window.removeEventListener("message",c)});const r=t.computed(()=>{const n=e.host||"https://app.documenso.com",d=btoa(encodeURIComponent(JSON.stringify({externalId:e.externalId,features:e.features,css:e.css,cssVars:e.cssVars,darkModeDisabled:e.darkModeDisabled,...e.additionalProps}))),o=new URL("/embed/v1/authoring/template/create",n);return o.searchParams.set("token",e.presignToken),o.hash=d,o.toString()});function c(n){s.value?.contentWindow===n.source&&n.data.type==="template-created"&&e.onTemplateCreated?.({templateId:n.data.templateId,externalId:n.data.externalId})}return(n,d)=>(t.openBlock(),t.createElementBlock("iframe",{ref_key:"__iframe",ref:s,class:t.normalizeClass(a.className),src:r.value},null,10,w))}}),D=["src"],m=t.defineComponent({__name:"update-document",props:{className:{},host:{},presignToken:{},documentId:{},externalId:{},css:{},cssVars:{},darkModeDisabled:{type:Boolean},features:{},onlyEditFields:{type:Boolean},additionalProps:{},onDocumentUpdated:{type:Function}},setup(a){const e=a,s=t.ref(null);t.onMounted(()=>{window.addEventListener("message",c)}),t.onUnmounted(()=>{window.removeEventListener("message",c)});const r=t.computed(()=>{const n=e.host||"https://app.documenso.com",d=btoa(encodeURIComponent(JSON.stringify({token:e.presignToken,externalId:e.externalId,features:e.features,css:e.css,cssVars:e.cssVars,darkModeDisabled:e.darkModeDisabled,onlyEditFields:e.onlyEditFields,...e.additionalProps}))),o=new URL(`/embed/v1/authoring/document/edit/${e.documentId}`,n);return o.searchParams.set("token",e.presignToken),o.hash=d,o.toString()});function c(n){s.value?.contentWindow===n.source&&n.data.type==="document-updated"&&e.onDocumentUpdated?.({documentId:n.data.documentId,externalId:n.data.externalId})}return(n,d)=>(t.openBlock(),t.createElementBlock("iframe",{ref_key:"__iframe",ref:s,class:t.normalizeClass(a.className),src:r.value},null,10,D))}}),E=["src"],p=t.defineComponent({__name:"update-template",props:{className:{},host:{},presignToken:{},templateId:{},externalId:{},css:{},cssVars:{},darkModeDisabled:{type:Boolean},features:{},onlyEditFields:{type:Boolean},additionalProps:{},onTemplateUpdated:{type:Function}},setup(a){const e=a,s=t.ref(null);t.onMounted(()=>{window.addEventListener("message",c)}),t.onUnmounted(()=>{window.removeEventListener("message",c)});const r=t.computed(()=>{const n=e.host||"https://app.documenso.com",d=btoa(encodeURIComponent(JSON.stringify({externalId:e.externalId,features:e.features,css:e.css,cssVars:e.cssVars,darkModeDisabled:e.darkModeDisabled,onlyEditFields:e.onlyEditFields,...e.additionalProps}))),o=new URL(`/embed/v1/authoring/template/edit/${e.templateId}`,n);return o.searchParams.set("token",e.presignToken),o.hash=d,o.toString()});function c(n){s.value?.contentWindow===n.source&&n.data.type==="template-updated"&&e.onTemplateUpdated?.({templateId:n.data.templateId,externalId:n.data.externalId})}return(n,d)=>(t.openBlock(),t.createElementBlock("iframe",{ref_key:"__iframe",ref:s,class:t.normalizeClass(a.className),src:r.value},null,10,E))}}),I=["src"],u=t.defineComponent({__name:"create-envelope",props:{className:{},host:{},presignToken:{},externalId:{},type:{},css:{},cssVars:{},darkModeDisabled:{type:Boolean},features:{},onEnvelopeCreated:{type:Function}},setup(a){const e=a,s=t.ref(null);t.onMounted(()=>{window.addEventListener("message",c)}),t.onUnmounted(()=>{window.removeEventListener("message",c)});const r=t.computed(()=>{const n=e.host||"https://app.documenso.com",d=btoa(encodeURIComponent(JSON.stringify({externalId:e.externalId,type:e.type,features:e.features,css:e.css,cssVars:e.cssVars,darkModeDisabled:e.darkModeDisabled}))),o=new URL("/embed/v2/authoring/envelope/create",n);return o.searchParams.set("token",e.presignToken),o.hash=d,o.toString()});function c(n){s.value?.contentWindow===n.source&&n.data.type==="envelope-created"&&e.onEnvelopeCreated?.({envelopeId:n.data.envelopeId,externalId:n.data.externalId})}return(n,d)=>(t.openBlock(),t.createElementBlock("iframe",{ref_key:"__iframe",ref:s,class:t.normalizeClass(a.className),src:r.value},null,10,I))}}),U=["src"],f=t.defineComponent({__name:"update-envelope",props:{className:{},host:{},presignToken:{},externalId:{},envelopeId:{},css:{},cssVars:{},darkModeDisabled:{type:Boolean},features:{},onEnvelopeUpdated:{type:Function}},setup(a){const e=a,s=t.ref(null);t.onMounted(()=>{window.addEventListener("message",c)}),t.onUnmounted(()=>{window.removeEventListener("message",c)});const r=t.computed(()=>{const n=e.host||"https://app.documenso.com",d=btoa(encodeURIComponent(JSON.stringify({externalId:e.externalId,features:e.features,css:e.css,cssVars:e.cssVars,darkModeDisabled:e.darkModeDisabled}))),o=new URL(`/embed/v2/authoring/envelope/edit/${e.envelopeId}`,n);return o.searchParams.set("token",e.presignToken),o.hash=d,o.toString()});function c(n){s.value?.contentWindow===n.source&&n.data.type==="envelope-updated"&&e.onEnvelopeUpdated?.({envelopeId:n.data.envelopeId,externalId:n.data.externalId})}return(n,d)=>(t.openBlock(),t.createElementBlock("iframe",{ref_key:"__iframe",ref:s,class:t.normalizeClass(a.className),src:r.value},null,10,U))}}),C=["src"],M=t.defineComponent({__name:"multisign-document",props:{className:{},host:{},tokens:{},css:{},cssVars:{},darkModeDisabled:{type:Boolean},name:{},lockName:{type:Boolean},allowDocumentRejection:{type:Boolean},additionalProps:{},onDocumentReady:{type:Function},onDocumentCompleted:{type:Function},onDocumentError:{type:Function},onDocumentRejected:{type:Function},onAllDocumentsCompleted:{type:Function}},setup(a){const e=a,s=t.ref(null);t.onMounted(()=>{window.addEventListener("message",c)}),t.onUnmounted(()=>{window.removeEventListener("message",c)});const r=t.computed(()=>{const n=e.host||"https://app.documenso.com",d=btoa(encodeURIComponent(JSON.stringify({name:e.name,lockName:e.lockName,css:e.css,cssVars:e.cssVars,darkModeDisabled:e.darkModeDisabled,allowDocumentRejection:e.allowDocumentRejection,...e.additionalProps}))),o=new URL("/embed/v1/multisign",n);for(const k of e.tokens)o.searchParams.append("token",k);return`${o}#${d}`});function c(n){if(s.value?.contentWindow===n.source)switch(n.data.action){case"document-ready":e.onDocumentReady?.();break;case"document-completed":e.onDocumentCompleted?.(n.data.data);break;case"document-error":e.onDocumentError?.(n.data.data);break;case"document-rejected":e.onDocumentRejected?.(n.data.data);break;case"all-documents-completed":e.onAllDocumentsCompleted?.(n.data.data);break}}return(n,d)=>(t.openBlock(),t.createElementBlock("iframe",{ref_key:"__iframe",ref:s,class:t.normalizeClass(a.className),src:r.value},null,10,C))}});exports.EmbedCreateDocumentV1=l;exports.EmbedCreateEnvelopeV2=u;exports.EmbedCreateTemplateV1=i;exports.EmbedDirectTemplate=b;exports.EmbedSignDocument=y;exports.EmbedUpdateDocumentV1=m;exports.EmbedUpdateEnvelopeV2=f;exports.EmbedUpdateTemplateV1=p;exports.unstable_EmbedCreateDocument=l;exports.unstable_EmbedCreateEnvelope=u;exports.unstable_EmbedCreateTemplate=i;exports.unstable_EmbedMultiSignDocument=M;exports.unstable_EmbedUpdateDocument=m;exports.unstable_EmbedUpdateEnvelope=f;exports.unstable_EmbedUpdateTemplate=p;
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
- import { defineComponent as r, ref as i, onMounted as l, onUnmounted as m, computed as u, openBlock as p, createElementBlock as f, normalizeClass as k } from "vue";
2
- const b = ["src"], U = /* @__PURE__ */ r({
1
+ import { defineComponent as r, ref as l, onMounted as i, onUnmounted as m, computed as p, openBlock as u, createElementBlock as f, normalizeClass as _ } from "vue";
2
+ const h = ["src"], v = /* @__PURE__ */ r({
3
3
  __name: "direct-template",
4
4
  props: {
5
5
  className: {},
@@ -21,13 +21,13 @@ const b = ["src"], U = /* @__PURE__ */ r({
21
21
  onFieldUnsigned: { type: Function }
22
22
  },
23
23
  setup(s) {
24
- const e = s, n = i(null);
25
- l(() => {
24
+ const e = s, n = l(null);
25
+ i(() => {
26
26
  window.addEventListener("message", o);
27
27
  }), m(() => {
28
28
  window.removeEventListener("message", o);
29
29
  });
30
- const d = u(() => {
30
+ const d = p(() => {
31
31
  const t = e.host || "https://app.documenso.com", c = btoa(
32
32
  encodeURIComponent(
33
33
  JSON.stringify({
@@ -64,14 +64,14 @@ const b = ["src"], U = /* @__PURE__ */ r({
64
64
  break;
65
65
  }
66
66
  }
67
- return (t, c) => (p(), f("iframe", {
67
+ return (t, c) => (u(), f("iframe", {
68
68
  ref_key: "__iframe",
69
69
  ref: n,
70
- class: k(s.className),
70
+ class: _(s.className),
71
71
  src: d.value
72
- }, null, 10, b));
72
+ }, null, 10, h));
73
73
  }
74
- }), h = ["src"], x = /* @__PURE__ */ r({
74
+ }), b = ["src"], M = /* @__PURE__ */ r({
75
75
  __name: "sign-document",
76
76
  props: {
77
77
  className: {},
@@ -82,6 +82,8 @@ const b = ["src"], U = /* @__PURE__ */ r({
82
82
  darkModeDisabled: { type: Boolean },
83
83
  name: {},
84
84
  lockName: { type: Boolean },
85
+ email: {},
86
+ lockEmail: { type: Boolean },
85
87
  allowDocumentRejection: { type: Boolean },
86
88
  additionalProps: {},
87
89
  onDocumentReady: { type: Function },
@@ -90,18 +92,20 @@ const b = ["src"], U = /* @__PURE__ */ r({
90
92
  onDocumentRejected: { type: Function }
91
93
  },
92
94
  setup(s) {
93
- const e = s, n = i(null);
94
- l(() => {
95
+ const e = s, n = l(null);
96
+ i(() => {
95
97
  window.addEventListener("message", o);
96
98
  }), m(() => {
97
99
  window.removeEventListener("message", o);
98
100
  });
99
- const d = u(() => {
101
+ const d = p(() => {
100
102
  const t = e.host || "https://app.documenso.com", c = btoa(
101
103
  encodeURIComponent(
102
104
  JSON.stringify({
103
105
  name: e.name,
104
106
  lockName: e.lockName,
107
+ email: e.email,
108
+ lockEmail: e.lockEmail,
105
109
  css: e.css,
106
110
  cssVars: e.cssVars,
107
111
  darkModeDisabled: e.darkModeDisabled,
@@ -129,14 +133,14 @@ const b = ["src"], U = /* @__PURE__ */ r({
129
133
  break;
130
134
  }
131
135
  }
132
- return (t, c) => (p(), f("iframe", {
136
+ return (t, c) => (u(), f("iframe", {
133
137
  ref_key: "__iframe",
134
138
  ref: n,
135
- class: k(s.className),
139
+ class: _(s.className),
136
140
  src: d.value
137
- }, null, 10, h));
141
+ }, null, 10, b));
138
142
  }
139
- }), y = ["src"], M = /* @__PURE__ */ r({
143
+ }), y = ["src"], N = /* @__PURE__ */ r({
140
144
  __name: "create-document",
141
145
  props: {
142
146
  className: {},
@@ -151,13 +155,13 @@ const b = ["src"], U = /* @__PURE__ */ r({
151
155
  onDocumentCreated: { type: Function }
152
156
  },
153
157
  setup(s) {
154
- const e = s, n = i(null);
155
- l(() => {
158
+ const e = s, n = l(null);
159
+ i(() => {
156
160
  window.addEventListener("message", o);
157
161
  }), m(() => {
158
162
  window.removeEventListener("message", o);
159
163
  });
160
- const d = u(() => {
164
+ const d = p(() => {
161
165
  const t = e.host || "https://app.documenso.com", c = btoa(
162
166
  encodeURIComponent(
163
167
  JSON.stringify({
@@ -178,14 +182,14 @@ const b = ["src"], U = /* @__PURE__ */ r({
178
182
  externalId: t.data.externalId
179
183
  });
180
184
  }
181
- return (t, c) => (p(), f("iframe", {
185
+ return (t, c) => (u(), f("iframe", {
182
186
  ref_key: "__iframe",
183
187
  ref: n,
184
- class: k(s.className),
188
+ class: _(s.className),
185
189
  src: d.value
186
190
  }, null, 10, y));
187
191
  }
188
- }), D = ["src"], N = /* @__PURE__ */ r({
192
+ }), g = ["src"], R = /* @__PURE__ */ r({
189
193
  __name: "create-template",
190
194
  props: {
191
195
  className: {},
@@ -200,13 +204,13 @@ const b = ["src"], U = /* @__PURE__ */ r({
200
204
  onTemplateCreated: { type: Function }
201
205
  },
202
206
  setup(s) {
203
- const e = s, n = i(null);
204
- l(() => {
207
+ const e = s, n = l(null);
208
+ i(() => {
205
209
  window.addEventListener("message", o);
206
210
  }), m(() => {
207
211
  window.removeEventListener("message", o);
208
212
  });
209
- const d = u(() => {
213
+ const d = p(() => {
210
214
  const t = e.host || "https://app.documenso.com", c = btoa(
211
215
  encodeURIComponent(
212
216
  JSON.stringify({
@@ -227,14 +231,14 @@ const b = ["src"], U = /* @__PURE__ */ r({
227
231
  externalId: t.data.externalId
228
232
  });
229
233
  }
230
- return (t, c) => (p(), f("iframe", {
234
+ return (t, c) => (u(), f("iframe", {
231
235
  ref_key: "__iframe",
232
236
  ref: n,
233
- class: k(s.className),
237
+ class: _(s.className),
234
238
  src: d.value
235
- }, null, 10, D));
239
+ }, null, 10, g));
236
240
  }
237
- }), g = ["src"], R = /* @__PURE__ */ r({
241
+ }), w = ["src"], V = /* @__PURE__ */ r({
238
242
  __name: "update-document",
239
243
  props: {
240
244
  className: {},
@@ -251,13 +255,13 @@ const b = ["src"], U = /* @__PURE__ */ r({
251
255
  onDocumentUpdated: { type: Function }
252
256
  },
253
257
  setup(s) {
254
- const e = s, n = i(null);
255
- l(() => {
258
+ const e = s, n = l(null);
259
+ i(() => {
256
260
  window.addEventListener("message", o);
257
261
  }), m(() => {
258
262
  window.removeEventListener("message", o);
259
263
  });
260
- const d = u(() => {
264
+ const d = p(() => {
261
265
  const t = e.host || "https://app.documenso.com", c = btoa(
262
266
  encodeURIComponent(
263
267
  JSON.stringify({
@@ -283,14 +287,14 @@ const b = ["src"], U = /* @__PURE__ */ r({
283
287
  externalId: t.data.externalId
284
288
  });
285
289
  }
286
- return (t, c) => (p(), f("iframe", {
290
+ return (t, c) => (u(), f("iframe", {
287
291
  ref_key: "__iframe",
288
292
  ref: n,
289
- class: k(s.className),
293
+ class: _(s.className),
290
294
  src: d.value
291
- }, null, 10, g));
295
+ }, null, 10, w));
292
296
  }
293
- }), w = ["src"], F = /* @__PURE__ */ r({
297
+ }), D = ["src"], C = /* @__PURE__ */ r({
294
298
  __name: "update-template",
295
299
  props: {
296
300
  className: {},
@@ -307,13 +311,13 @@ const b = ["src"], U = /* @__PURE__ */ r({
307
311
  onTemplateUpdated: { type: Function }
308
312
  },
309
313
  setup(s) {
310
- const e = s, n = i(null);
311
- l(() => {
314
+ const e = s, n = l(null);
315
+ i(() => {
312
316
  window.addEventListener("message", o);
313
317
  }), m(() => {
314
318
  window.removeEventListener("message", o);
315
319
  });
316
- const d = u(() => {
320
+ const d = p(() => {
317
321
  const t = e.host || "https://app.documenso.com", c = btoa(
318
322
  encodeURIComponent(
319
323
  JSON.stringify({
@@ -338,14 +342,114 @@ const b = ["src"], U = /* @__PURE__ */ r({
338
342
  externalId: t.data.externalId
339
343
  });
340
344
  }
341
- return (t, c) => (p(), f("iframe", {
345
+ return (t, c) => (u(), f("iframe", {
342
346
  ref_key: "__iframe",
343
347
  ref: n,
344
- class: k(s.className),
348
+ class: _(s.className),
345
349
  src: d.value
346
- }, null, 10, w));
350
+ }, null, 10, D));
347
351
  }
348
- }), I = ["src"], C = /* @__PURE__ */ r({
352
+ }), I = ["src"], F = /* @__PURE__ */ r({
353
+ __name: "create-envelope",
354
+ props: {
355
+ className: {},
356
+ host: {},
357
+ presignToken: {},
358
+ externalId: {},
359
+ type: {},
360
+ css: {},
361
+ cssVars: {},
362
+ darkModeDisabled: { type: Boolean },
363
+ features: {},
364
+ onEnvelopeCreated: { type: Function }
365
+ },
366
+ setup(s) {
367
+ const e = s, n = l(null);
368
+ i(() => {
369
+ window.addEventListener("message", o);
370
+ }), m(() => {
371
+ window.removeEventListener("message", o);
372
+ });
373
+ const d = p(() => {
374
+ const t = e.host || "https://app.documenso.com", c = btoa(
375
+ encodeURIComponent(
376
+ JSON.stringify({
377
+ externalId: e.externalId,
378
+ type: e.type,
379
+ features: e.features,
380
+ css: e.css,
381
+ cssVars: e.cssVars,
382
+ darkModeDisabled: e.darkModeDisabled
383
+ })
384
+ )
385
+ ), a = new URL("/embed/v2/authoring/envelope/create", t);
386
+ return a.searchParams.set("token", e.presignToken), a.hash = c, a.toString();
387
+ });
388
+ function o(t) {
389
+ n.value?.contentWindow === t.source && t.data.type === "envelope-created" && e.onEnvelopeCreated?.({
390
+ envelopeId: t.data.envelopeId,
391
+ externalId: t.data.externalId
392
+ });
393
+ }
394
+ return (t, c) => (u(), f("iframe", {
395
+ ref_key: "__iframe",
396
+ ref: n,
397
+ class: _(s.className),
398
+ src: d.value
399
+ }, null, 10, I));
400
+ }
401
+ }), E = ["src"], L = /* @__PURE__ */ r({
402
+ __name: "update-envelope",
403
+ props: {
404
+ className: {},
405
+ host: {},
406
+ presignToken: {},
407
+ externalId: {},
408
+ envelopeId: {},
409
+ css: {},
410
+ cssVars: {},
411
+ darkModeDisabled: { type: Boolean },
412
+ features: {},
413
+ onEnvelopeUpdated: { type: Function }
414
+ },
415
+ setup(s) {
416
+ const e = s, n = l(null);
417
+ i(() => {
418
+ window.addEventListener("message", o);
419
+ }), m(() => {
420
+ window.removeEventListener("message", o);
421
+ });
422
+ const d = p(() => {
423
+ const t = e.host || "https://app.documenso.com", c = btoa(
424
+ encodeURIComponent(
425
+ JSON.stringify({
426
+ externalId: e.externalId,
427
+ features: e.features,
428
+ css: e.css,
429
+ cssVars: e.cssVars,
430
+ darkModeDisabled: e.darkModeDisabled
431
+ })
432
+ )
433
+ ), a = new URL(
434
+ `/embed/v2/authoring/envelope/edit/${e.envelopeId}`,
435
+ t
436
+ );
437
+ return a.searchParams.set("token", e.presignToken), a.hash = c, a.toString();
438
+ });
439
+ function o(t) {
440
+ n.value?.contentWindow === t.source && t.data.type === "envelope-updated" && e.onEnvelopeUpdated?.({
441
+ envelopeId: t.data.envelopeId,
442
+ externalId: t.data.externalId
443
+ });
444
+ }
445
+ return (t, c) => (u(), f("iframe", {
446
+ ref_key: "__iframe",
447
+ ref: n,
448
+ class: _(s.className),
449
+ src: d.value
450
+ }, null, 10, E));
451
+ }
452
+ }), x = ["src"], $ = /* @__PURE__ */ r({
349
453
  __name: "multisign-document",
350
454
  props: {
351
455
  className: {},
@@ -365,13 +469,13 @@ const b = ["src"], U = /* @__PURE__ */ r({
365
469
  onAllDocumentsCompleted: { type: Function }
366
470
  },
367
471
  setup(s) {
368
- const e = s, n = i(null);
369
- l(() => {
472
+ const e = s, n = l(null);
473
+ i(() => {
370
474
  window.addEventListener("message", o);
371
475
  }), m(() => {
372
476
  window.removeEventListener("message", o);
373
477
  });
374
- const d = u(() => {
478
+ const d = p(() => {
375
479
  const t = e.host || "https://app.documenso.com", c = btoa(
376
480
  encodeURIComponent(
377
481
  JSON.stringify({
@@ -385,8 +489,8 @@ const b = ["src"], U = /* @__PURE__ */ r({
385
489
  })
386
490
  )
387
491
  ), a = new URL("/embed/v1/multisign", t);
388
- for (const _ of e.tokens)
389
- a.searchParams.append("token", _);
492
+ for (const k of e.tokens)
493
+ a.searchParams.append("token", k);
390
494
  return `${a}#${c}`;
391
495
  });
392
496
  function o(t) {
@@ -409,24 +513,28 @@ const b = ["src"], U = /* @__PURE__ */ r({
409
513
  break;
410
514
  }
411
515
  }
412
- return (t, c) => (p(), f("iframe", {
516
+ return (t, c) => (u(), f("iframe", {
413
517
  ref_key: "__iframe",
414
518
  ref: n,
415
- class: k(s.className),
519
+ class: _(s.className),
416
520
  src: d.value
417
- }, null, 10, I));
521
+ }, null, 10, x));
418
522
  }
419
523
  });
420
524
  export {
421
- M as EmbedCreateDocumentV1,
422
- N as EmbedCreateTemplateV1,
423
- U as EmbedDirectTemplate,
424
- x as EmbedSignDocument,
425
- R as EmbedUpdateDocumentV1,
426
- F as EmbedUpdateTemplateV1,
427
- M as unstable_EmbedCreateDocument,
428
- N as unstable_EmbedCreateTemplate,
429
- C as unstable_EmbedMultiSignDocument,
430
- R as unstable_EmbedUpdateDocument,
431
- F as unstable_EmbedUpdateTemplate
525
+ N as EmbedCreateDocumentV1,
526
+ F as EmbedCreateEnvelopeV2,
527
+ R as EmbedCreateTemplateV1,
528
+ v as EmbedDirectTemplate,
529
+ M as EmbedSignDocument,
530
+ V as EmbedUpdateDocumentV1,
531
+ L as EmbedUpdateEnvelopeV2,
532
+ C as EmbedUpdateTemplateV1,
533
+ N as unstable_EmbedCreateDocument,
534
+ F as unstable_EmbedCreateEnvelope,
535
+ R as unstable_EmbedCreateTemplate,
536
+ $ as unstable_EmbedMultiSignDocument,
537
+ V as unstable_EmbedUpdateDocument,
538
+ L as unstable_EmbedUpdateEnvelope,
539
+ C as unstable_EmbedUpdateTemplate
432
540
  };
@@ -8,6 +8,8 @@ export type EmbedSignDocumentProps = {
8
8
  darkModeDisabled?: boolean | undefined;
9
9
  name?: string | undefined;
10
10
  lockName?: boolean | undefined;
11
+ email?: string | undefined;
12
+ lockEmail?: boolean | undefined;
11
13
  allowDocumentRejection?: boolean | undefined;
12
14
  additionalProps?: Record<string, string | number | boolean> | undefined;
13
15
  onDocumentReady?: () => void;
@@ -0,0 +1,21 @@
1
+ import { CssVars } from './css-vars';
2
+ import { DeepPartial, EnvelopeEditorSettings } from './features-type';
3
+ export type EmbedUpdateEnvelopeProps = {
4
+ className?: string;
5
+ host?: string;
6
+ presignToken: string;
7
+ externalId?: string;
8
+ envelopeId: string;
9
+ css?: string | undefined;
10
+ cssVars?: (CssVars & Record<string, string>) | undefined;
11
+ darkModeDisabled?: boolean | undefined;
12
+ features?: DeepPartial<EnvelopeEditorSettings> & Record<string, any>;
13
+ onEnvelopeUpdated?: (data: {
14
+ externalId: string | null;
15
+ envelopeId: string;
16
+ }) => void;
17
+ };
18
+ declare const _default: import('vue').DefineComponent<EmbedUpdateEnvelopeProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<EmbedUpdateEnvelopeProps> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
19
+ __iframe: HTMLIFrameElement;
20
+ }, HTMLIFrameElement>;
21
+ export default _default;
package/package.json CHANGED
@@ -1,7 +1,12 @@
1
1
  {
2
2
  "name": "@documenso/embed-vue",
3
- "version": "0.5.0",
3
+ "version": "0.6.0",
4
4
  "license": "MIT",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "https://github.com/documenso/embeds",
8
+ "directory": "packages/vue"
9
+ },
5
10
  "files": [
6
11
  "dist"
7
12
  ],