@documenso/embed-vue 0.2.2 → 0.3.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.
package/dist/index.d.mts CHANGED
@@ -4,3 +4,4 @@ export { default as unstable_EmbedCreateDocument } from './create-document.vue';
4
4
  export { default as unstable_EmbedCreateTemplate } from './create-template.vue';
5
5
  export { default as unstable_EmbedUpdateDocument } from './update-document.vue';
6
6
  export { default as unstable_EmbedUpdateTemplate } from './update-template.vue';
7
+ export { default as unstable_EmbedMultiSignDocument } from './multisign-document.vue';
package/dist/index.d.ts CHANGED
@@ -4,3 +4,4 @@ export { default as unstable_EmbedCreateDocument } from './create-document.vue';
4
4
  export { default as unstable_EmbedCreateTemplate } from './create-template.vue';
5
5
  export { default as unstable_EmbedUpdateDocument } from './update-document.vue';
6
6
  export { default as unstable_EmbedUpdateTemplate } from './update-template.vue';
7
+ 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"),p=["src"],f=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(d){const e=d,s=n.ref();n.onMounted(()=>{window.addEventListener("message",c)}),n.onUnmounted(()=>{window.removeEventListener("message",c)});const r=n.computed(()=>{const t=e.host||"https://app.documenso.com",o=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}))),a=new URL(`/embed/direct/${e.token}`,t);return e.externalId&&a.searchParams.set("externalId",e.externalId),`${a}#${o}`});function c(t){var o,a,i,m,l,u;if(((o=s.value)==null?void 0:o.contentWindow)===t.source)switch(t.data.action){case"document-ready":(a=e.onDocumentReady)==null||a.call(e);break;case"document-completed":(i=e.onDocumentCompleted)==null||i.call(e,t.data.data);break;case"document-error":(m=e.onDocumentError)==null||m.call(e,t.data.data);break;case"field-signed":(l=e.onFieldSigned)==null||l.call(e);break;case"field-unsigned":(u=e.onFieldUnsigned)==null||u.call(e);break}}return(t,o)=>(n.openBlock(),n.createElementBlock("iframe",{ref_key:"__iframe",ref:s,class:n.normalizeClass(t.className),src:r.value},null,10,p))}}),k=["src"],_=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(d){const e=d,s=n.ref();n.onMounted(()=>{window.addEventListener("message",c)}),n.onUnmounted(()=>{window.removeEventListener("message",c)});const r=n.computed(()=>{const t=e.host||"https://app.documenso.com",o=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)}#${o}`});function c(t){var o,a,i,m,l;if(((o=s.value)==null?void 0:o.contentWindow)===t.source)switch(t.data.action){case"document-ready":(a=e.onDocumentReady)==null||a.call(e);break;case"document-completed":(i=e.onDocumentCompleted)==null||i.call(e,t.data.data);break;case"document-error":(m=e.onDocumentError)==null||m.call(e,t.data.data);break;case"document-rejected":(l=e.onDocumentRejected)==null||l.call(e,t.data.data);break}}return(t,o)=>(n.openBlock(),n.createElementBlock("iframe",{ref_key:"__iframe",ref:s,class:n.normalizeClass(t.className),src:r.value},null,10,k))}}),h=["src"],b=n.defineComponent({__name:"create-document",props:{className:{},host:{},presignToken:{},externalId:{},css:{},cssVars:{},darkModeDisabled:{type:Boolean},features:{},additionalProps:{},onDocumentCreated:{type:Function}},setup(d){const e=d,s=n.ref();n.onMounted(()=>{window.addEventListener("message",c)}),n.onUnmounted(()=>{window.removeEventListener("message",c)});const r=n.computed(()=>{const t=e.host||"https://app.documenso.com",o=btoa(encodeURIComponent(JSON.stringify({externalId:e.externalId,features:e.features,css:e.css,cssVars:e.cssVars,darkModeDisabled:e.darkModeDisabled,...e.additionalProps}))),a=new URL("/embed/v1/authoring/document/create",t);return a.searchParams.set("token",e.presignToken),a.hash=o,a.toString()});function c(t){var o,a;if(((o=s.value)==null?void 0:o.contentWindow)===t.source)switch(t.data.type){case"document-created":(a=e.onDocumentCreated)==null||a.call(e,{documentId:t.data.documentId,externalId:t.data.externalId});break}}return(t,o)=>(n.openBlock(),n.createElementBlock("iframe",{ref_key:"__iframe",ref:s,class:n.normalizeClass(t.className),src:r.value},null,10,h))}}),g=["src"],y=n.defineComponent({__name:"create-template",props:{className:{},host:{},presignToken:{},externalId:{},css:{},cssVars:{},darkModeDisabled:{type:Boolean},features:{},additionalProps:{},onTemplateCreated:{type:Function}},setup(d){const e=d,s=n.ref();n.onMounted(()=>{window.addEventListener("message",c)}),n.onUnmounted(()=>{window.removeEventListener("message",c)});const r=n.computed(()=>{const t=e.host||"https://app.documenso.com",o=btoa(encodeURIComponent(JSON.stringify({externalId:e.externalId,features:e.features,css:e.css,cssVars:e.cssVars,darkModeDisabled:e.darkModeDisabled,...e.additionalProps}))),a=new URL("/embed/v1/authoring/template/create",t);return a.searchParams.set("token",e.presignToken),a.hash=o,a.toString()});function c(t){var o,a;if(((o=s.value)==null?void 0:o.contentWindow)===t.source)switch(t.data.type){case"template-created":(a=e.onTemplateCreated)==null||a.call(e,{templateId:t.data.templateId,externalId:t.data.externalId});break}}return(t,o)=>(n.openBlock(),n.createElementBlock("iframe",{ref_key:"__iframe",ref:s,class:n.normalizeClass(t.className),src:r.value},null,10,g))}}),w=["src"],D=n.defineComponent({__name:"update-document",props:{className:{},host:{},presignToken:{},documentId:{},externalId:{},css:{},cssVars:{},darkModeDisabled:{type:Boolean},features:{},additionalProps:{},onDocumentUpdated:{type:Function}},setup(d){const e=d,s=n.ref();n.onMounted(()=>{window.addEventListener("message",c)}),n.onUnmounted(()=>{window.removeEventListener("message",c)});const r=n.computed(()=>{const t=e.host||"https://app.documenso.com",o=btoa(encodeURIComponent(JSON.stringify({token:e.presignToken,externalId:e.externalId,features:e.features,css:e.css,cssVars:e.cssVars,darkModeDisabled:e.darkModeDisabled,...e.additionalProps}))),a=new URL(`/embed/v1/authoring/document/edit/${e.documentId}`,t);return a.searchParams.set("token",e.presignToken),a.hash=o,a.toString()});function c(t){var o,a;if(((o=s.value)==null?void 0:o.contentWindow)===t.source)switch(t.data.type){case"document-updated":(a=e.onDocumentUpdated)==null||a.call(e,{documentId:t.data.documentId,externalId:t.data.externalId});break}}return(t,o)=>(n.openBlock(),n.createElementBlock("iframe",{ref_key:"__iframe",ref:s,class:n.normalizeClass(t.className),src:r.value},null,10,w))}}),I=["src"],U=n.defineComponent({__name:"update-template",props:{className:{},host:{},presignToken:{},templateId:{},externalId:{},css:{},cssVars:{},darkModeDisabled:{type:Boolean},features:{},additionalProps:{},onTemplateUpdated:{type:Function}},setup(d){const e=d,s=n.ref();n.onMounted(()=>{window.addEventListener("message",c)}),n.onUnmounted(()=>{window.removeEventListener("message",c)});const r=n.computed(()=>{const t=e.host||"https://app.documenso.com",o=btoa(encodeURIComponent(JSON.stringify({externalId:e.externalId,features:e.features,css:e.css,cssVars:e.cssVars,darkModeDisabled:e.darkModeDisabled,...e.additionalProps}))),a=new URL(`/embed/v1/authoring/template/edit/${e.templateId}`,t);return a.searchParams.set("token",e.presignToken),a.hash=o,a.toString()});function c(t){var o,a;if(((o=s.value)==null?void 0:o.contentWindow)===t.source)switch(t.data.type){case"template-updated":(a=e.onTemplateUpdated)==null||a.call(e,{templateId:t.data.templateId,externalId:t.data.externalId});break}}return(t,o)=>(n.openBlock(),n.createElementBlock("iframe",{ref_key:"__iframe",ref:s,class:n.normalizeClass(t.className),src:r.value},null,10,I))}});exports.EmbedDirectTemplate=f;exports.EmbedSignDocument=_;exports.unstable_EmbedCreateDocument=b;exports.unstable_EmbedCreateTemplate=y;exports.unstable_EmbedUpdateDocument=D;exports.unstable_EmbedUpdateTemplate=U;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("vue"),i=["src"],l=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(r){const e=r,a=t.ref();t.onMounted(()=>{window.addEventListener("message",s)}),t.onUnmounted(()=>{window.removeEventListener("message",s)});const d=t.computed(()=>{const o=e.host||"https://app.documenso.com",c=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}))),n=new URL(`/embed/direct/${e.token}`,o);return e.externalId&&n.searchParams.set("externalId",e.externalId),`${n}#${c}`});function s(o){if(a.value?.contentWindow===o.source)switch(o.data.action){case"document-ready":e.onDocumentReady?.();break;case"document-completed":e.onDocumentCompleted?.(o.data.data);break;case"document-error":e.onDocumentError?.(o.data.data);break;case"field-signed":e.onFieldSigned?.();break;case"field-unsigned":e.onFieldUnsigned?.();break}}return(o,c)=>(t.openBlock(),t.createElementBlock("iframe",{ref_key:"__iframe",ref:a,class:t.normalizeClass(o.className),src:d.value},null,10,i))}}),p=["src"],u=t.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(r){const e=r,a=t.ref();t.onMounted(()=>{window.addEventListener("message",s)}),t.onUnmounted(()=>{window.removeEventListener("message",s)});const d=t.computed(()=>{const o=e.host||"https://app.documenso.com",c=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}`,o)}#${c}`});function s(o){if(a.value?.contentWindow===o.source)switch(o.data.action){case"document-ready":e.onDocumentReady?.();break;case"document-completed":e.onDocumentCompleted?.(o.data.data);break;case"document-error":e.onDocumentError?.(o.data.data);break;case"document-rejected":e.onDocumentRejected?.(o.data.data);break}}return(o,c)=>(t.openBlock(),t.createElementBlock("iframe",{ref_key:"__iframe",ref:a,class:t.normalizeClass(o.className),src:d.value},null,10,p))}}),f=["src"],k=t.defineComponent({__name:"create-document",props:{className:{},host:{},presignToken:{},externalId:{},css:{},cssVars:{},darkModeDisabled:{type:Boolean},features:{},additionalProps:{},onDocumentCreated:{type:Function}},setup(r){const e=r,a=t.ref();t.onMounted(()=>{window.addEventListener("message",s)}),t.onUnmounted(()=>{window.removeEventListener("message",s)});const d=t.computed(()=>{const o=e.host||"https://app.documenso.com",c=btoa(encodeURIComponent(JSON.stringify({externalId:e.externalId,features:e.features,css:e.css,cssVars:e.cssVars,darkModeDisabled:e.darkModeDisabled,...e.additionalProps}))),n=new URL("/embed/v1/authoring/document/create",o);return n.searchParams.set("token",e.presignToken),n.hash=c,n.toString()});function s(o){if(a.value?.contentWindow===o.source)switch(o.data.type){case"document-created":e.onDocumentCreated?.({documentId:o.data.documentId,externalId:o.data.externalId});break}}return(o,c)=>(t.openBlock(),t.createElementBlock("iframe",{ref_key:"__iframe",ref:a,class:t.normalizeClass(o.className),src:d.value},null,10,f))}}),_=["src"],b=t.defineComponent({__name:"create-template",props:{className:{},host:{},presignToken:{},externalId:{},css:{},cssVars:{},darkModeDisabled:{type:Boolean},features:{},additionalProps:{},onTemplateCreated:{type:Function}},setup(r){const e=r,a=t.ref();t.onMounted(()=>{window.addEventListener("message",s)}),t.onUnmounted(()=>{window.removeEventListener("message",s)});const d=t.computed(()=>{const o=e.host||"https://app.documenso.com",c=btoa(encodeURIComponent(JSON.stringify({externalId:e.externalId,features:e.features,css:e.css,cssVars:e.cssVars,darkModeDisabled:e.darkModeDisabled,...e.additionalProps}))),n=new URL("/embed/v1/authoring/template/create",o);return n.searchParams.set("token",e.presignToken),n.hash=c,n.toString()});function s(o){if(a.value?.contentWindow===o.source)switch(o.data.type){case"template-created":e.onTemplateCreated?.({templateId:o.data.templateId,externalId:o.data.externalId});break}}return(o,c)=>(t.openBlock(),t.createElementBlock("iframe",{ref_key:"__iframe",ref:a,class:t.normalizeClass(o.className),src:d.value},null,10,_))}}),h=["src"],y=t.defineComponent({__name:"update-document",props:{className:{},host:{},presignToken:{},documentId:{},externalId:{},css:{},cssVars:{},darkModeDisabled:{type:Boolean},features:{},additionalProps:{},onDocumentUpdated:{type:Function}},setup(r){const e=r,a=t.ref();t.onMounted(()=>{window.addEventListener("message",s)}),t.onUnmounted(()=>{window.removeEventListener("message",s)});const d=t.computed(()=>{const o=e.host||"https://app.documenso.com",c=btoa(encodeURIComponent(JSON.stringify({token:e.presignToken,externalId:e.externalId,features:e.features,css:e.css,cssVars:e.cssVars,darkModeDisabled:e.darkModeDisabled,...e.additionalProps}))),n=new URL(`/embed/v1/authoring/document/edit/${e.documentId}`,o);return n.searchParams.set("token",e.presignToken),n.hash=c,n.toString()});function s(o){if(a.value?.contentWindow===o.source)switch(o.data.type){case"document-updated":e.onDocumentUpdated?.({documentId:o.data.documentId,externalId:o.data.externalId});break}}return(o,c)=>(t.openBlock(),t.createElementBlock("iframe",{ref_key:"__iframe",ref:a,class:t.normalizeClass(o.className),src:d.value},null,10,h))}}),D=["src"],g=t.defineComponent({__name:"update-template",props:{className:{},host:{},presignToken:{},templateId:{},externalId:{},css:{},cssVars:{},darkModeDisabled:{type:Boolean},features:{},additionalProps:{},onTemplateUpdated:{type:Function}},setup(r){const e=r,a=t.ref();t.onMounted(()=>{window.addEventListener("message",s)}),t.onUnmounted(()=>{window.removeEventListener("message",s)});const d=t.computed(()=>{const o=e.host||"https://app.documenso.com",c=btoa(encodeURIComponent(JSON.stringify({externalId:e.externalId,features:e.features,css:e.css,cssVars:e.cssVars,darkModeDisabled:e.darkModeDisabled,...e.additionalProps}))),n=new URL(`/embed/v1/authoring/template/edit/${e.templateId}`,o);return n.searchParams.set("token",e.presignToken),n.hash=c,n.toString()});function s(o){if(a.value?.contentWindow===o.source)switch(o.data.type){case"template-updated":e.onTemplateUpdated?.({templateId:o.data.templateId,externalId:o.data.externalId});break}}return(o,c)=>(t.openBlock(),t.createElementBlock("iframe",{ref_key:"__iframe",ref:a,class:t.normalizeClass(o.className),src:d.value},null,10,D))}}),w=["src"],I=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(r){const e=r,a=t.ref();t.onMounted(()=>{window.addEventListener("message",s)}),t.onUnmounted(()=>{window.removeEventListener("message",s)});const d=t.computed(()=>{const o=e.host||"https://app.documenso.com",c=btoa(encodeURIComponent(JSON.stringify({name:e.name,lockName:e.lockName,css:e.css,cssVars:e.cssVars,darkModeDisabled:e.darkModeDisabled,allowDocumentRejection:e.allowDocumentRejection,...e.additionalProps}))),n=new URL("/embed/v1/multisign",o);for(const m of e.tokens)n.searchParams.append("token",m);return`${n}#${c}`});function s(o){if(a.value?.contentWindow===o.source)switch(o.data.action){case"document-ready":e.onDocumentReady?.();break;case"document-completed":e.onDocumentCompleted?.(o.data.data);break;case"document-error":e.onDocumentError?.(o.data.data);break;case"document-rejected":e.onDocumentRejected?.(o.data.data);break;case"all-documents-completed":e.onAllDocumentsCompleted?.(o.data.data);break}}return(o,c)=>(t.openBlock(),t.createElementBlock("iframe",{ref_key:"__iframe",ref:a,class:t.normalizeClass(o.className),src:d.value},null,10,w))}});exports.EmbedDirectTemplate=l;exports.EmbedSignDocument=u;exports.unstable_EmbedCreateDocument=k;exports.unstable_EmbedCreateTemplate=b;exports.unstable_EmbedMultiSignDocument=I;exports.unstable_EmbedUpdateDocument=y;exports.unstable_EmbedUpdateTemplate=g;
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
- import { defineComponent as r, ref as i, onMounted as m, onUnmounted as l, computed as u, openBlock as p, createElementBlock as _, normalizeClass as f } from "vue";
2
- const w = ["src"], M = /* @__PURE__ */ r({
1
+ import { defineComponent as d, ref as i, onMounted as m, onUnmounted as l, computed as p, createElementBlock as u, openBlock as _, normalizeClass as f } from "vue";
2
+ const h = ["src"], U = /* @__PURE__ */ d({
3
3
  __name: "direct-template",
4
4
  props: {
5
5
  className: {},
@@ -21,14 +21,14 @@ const w = ["src"], M = /* @__PURE__ */ r({
21
21
  onFieldUnsigned: { type: Function }
22
22
  },
23
23
  setup(c) {
24
- const e = c, n = i();
24
+ const e = c, s = i();
25
25
  m(() => {
26
26
  window.addEventListener("message", o);
27
27
  }), l(() => {
28
28
  window.removeEventListener("message", o);
29
29
  });
30
- const d = u(() => {
31
- const a = e.host || "https://app.documenso.com", s = btoa(
30
+ const r = p(() => {
31
+ const t = e.host || "https://app.documenso.com", n = btoa(
32
32
  encodeURIComponent(
33
33
  JSON.stringify({
34
34
  name: e.name,
@@ -41,38 +41,37 @@ const w = ["src"], M = /* @__PURE__ */ r({
41
41
  ...e.additionalProps
42
42
  })
43
43
  )
44
- ), t = new URL(`/embed/direct/${e.token}`, a);
45
- return e.externalId && t.searchParams.set("externalId", e.externalId), `${t}#${s}`;
44
+ ), a = new URL(`/embed/direct/${e.token}`, t);
45
+ return e.externalId && a.searchParams.set("externalId", e.externalId), `${a}#${n}`;
46
46
  });
47
- function o(a) {
48
- var s, t, k, h, b, g;
49
- if (((s = n.value) == null ? void 0 : s.contentWindow) === a.source)
50
- switch (a.data.action) {
47
+ function o(t) {
48
+ if (s.value?.contentWindow === t.source)
49
+ switch (t.data.action) {
51
50
  case "document-ready":
52
- (t = e.onDocumentReady) == null || t.call(e);
51
+ e.onDocumentReady?.();
53
52
  break;
54
53
  case "document-completed":
55
- (k = e.onDocumentCompleted) == null || k.call(e, a.data.data);
54
+ e.onDocumentCompleted?.(t.data.data);
56
55
  break;
57
56
  case "document-error":
58
- (h = e.onDocumentError) == null || h.call(e, a.data.data);
57
+ e.onDocumentError?.(t.data.data);
59
58
  break;
60
59
  case "field-signed":
61
- (b = e.onFieldSigned) == null || b.call(e);
60
+ e.onFieldSigned?.();
62
61
  break;
63
62
  case "field-unsigned":
64
- (g = e.onFieldUnsigned) == null || g.call(e);
63
+ e.onFieldUnsigned?.();
65
64
  break;
66
65
  }
67
66
  }
68
- return (a, s) => (p(), _("iframe", {
67
+ return (t, n) => (_(), u("iframe", {
69
68
  ref_key: "__iframe",
70
- ref: n,
71
- class: f(a.className),
72
- src: d.value
73
- }, null, 10, w));
69
+ ref: s,
70
+ class: f(t.className),
71
+ src: r.value
72
+ }, null, 10, h));
74
73
  }
75
- }), y = ["src"], N = /* @__PURE__ */ r({
74
+ }), b = ["src"], M = /* @__PURE__ */ d({
76
75
  __name: "sign-document",
77
76
  props: {
78
77
  className: {},
@@ -91,14 +90,14 @@ const w = ["src"], M = /* @__PURE__ */ r({
91
90
  onDocumentRejected: { type: Function }
92
91
  },
93
92
  setup(c) {
94
- const e = c, n = i();
93
+ const e = c, s = i();
95
94
  m(() => {
96
95
  window.addEventListener("message", o);
97
96
  }), l(() => {
98
97
  window.removeEventListener("message", o);
99
98
  });
100
- const d = u(() => {
101
- const a = e.host || "https://app.documenso.com", s = btoa(
99
+ const r = p(() => {
100
+ const t = e.host || "https://app.documenso.com", n = btoa(
102
101
  encodeURIComponent(
103
102
  JSON.stringify({
104
103
  name: e.name,
@@ -111,34 +110,33 @@ const w = ["src"], M = /* @__PURE__ */ r({
111
110
  })
112
111
  )
113
112
  );
114
- return `${new URL(`/embed/sign/${e.token}`, a)}#${s}`;
113
+ return `${new URL(`/embed/sign/${e.token}`, t)}#${n}`;
115
114
  });
116
- function o(a) {
117
- var s, t, k, h, b;
118
- if (((s = n.value) == null ? void 0 : s.contentWindow) === a.source)
119
- switch (a.data.action) {
115
+ function o(t) {
116
+ if (s.value?.contentWindow === t.source)
117
+ switch (t.data.action) {
120
118
  case "document-ready":
121
- (t = e.onDocumentReady) == null || t.call(e);
119
+ e.onDocumentReady?.();
122
120
  break;
123
121
  case "document-completed":
124
- (k = e.onDocumentCompleted) == null || k.call(e, a.data.data);
122
+ e.onDocumentCompleted?.(t.data.data);
125
123
  break;
126
124
  case "document-error":
127
- (h = e.onDocumentError) == null || h.call(e, a.data.data);
125
+ e.onDocumentError?.(t.data.data);
128
126
  break;
129
127
  case "document-rejected":
130
- (b = e.onDocumentRejected) == null || b.call(e, a.data.data);
128
+ e.onDocumentRejected?.(t.data.data);
131
129
  break;
132
130
  }
133
131
  }
134
- return (a, s) => (p(), _("iframe", {
132
+ return (t, n) => (_(), u("iframe", {
135
133
  ref_key: "__iframe",
136
- ref: n,
137
- class: f(a.className),
138
- src: d.value
139
- }, null, 10, y));
134
+ ref: s,
135
+ class: f(t.className),
136
+ src: r.value
137
+ }, null, 10, b));
140
138
  }
141
- }), D = ["src"], R = /* @__PURE__ */ r({
139
+ }), D = ["src"], N = /* @__PURE__ */ d({
142
140
  __name: "create-document",
143
141
  props: {
144
142
  className: {},
@@ -153,14 +151,14 @@ const w = ["src"], M = /* @__PURE__ */ r({
153
151
  onDocumentCreated: { type: Function }
154
152
  },
155
153
  setup(c) {
156
- const e = c, n = i();
154
+ const e = c, s = i();
157
155
  m(() => {
158
156
  window.addEventListener("message", o);
159
157
  }), l(() => {
160
158
  window.removeEventListener("message", o);
161
159
  });
162
- const d = u(() => {
163
- const a = e.host || "https://app.documenso.com", s = btoa(
160
+ const r = p(() => {
161
+ const t = e.host || "https://app.documenso.com", n = btoa(
164
162
  encodeURIComponent(
165
163
  JSON.stringify({
166
164
  externalId: e.externalId,
@@ -171,29 +169,28 @@ const w = ["src"], M = /* @__PURE__ */ r({
171
169
  ...e.additionalProps
172
170
  })
173
171
  )
174
- ), t = new URL("/embed/v1/authoring/document/create", a);
175
- return t.searchParams.set("token", e.presignToken), t.hash = s, t.toString();
172
+ ), a = new URL("/embed/v1/authoring/document/create", t);
173
+ return a.searchParams.set("token", e.presignToken), a.hash = n, a.toString();
176
174
  });
177
- function o(a) {
178
- var s, t;
179
- if (((s = n.value) == null ? void 0 : s.contentWindow) === a.source)
180
- switch (a.data.type) {
175
+ function o(t) {
176
+ if (s.value?.contentWindow === t.source)
177
+ switch (t.data.type) {
181
178
  case "document-created":
182
- (t = e.onDocumentCreated) == null || t.call(e, {
183
- documentId: a.data.documentId,
184
- externalId: a.data.externalId
179
+ e.onDocumentCreated?.({
180
+ documentId: t.data.documentId,
181
+ externalId: t.data.externalId
185
182
  });
186
183
  break;
187
184
  }
188
185
  }
189
- return (a, s) => (p(), _("iframe", {
186
+ return (t, n) => (_(), u("iframe", {
190
187
  ref_key: "__iframe",
191
- ref: n,
192
- class: f(a.className),
193
- src: d.value
188
+ ref: s,
189
+ class: f(t.className),
190
+ src: r.value
194
191
  }, null, 10, D));
195
192
  }
196
- }), I = ["src"], C = /* @__PURE__ */ r({
193
+ }), y = ["src"], R = /* @__PURE__ */ d({
197
194
  __name: "create-template",
198
195
  props: {
199
196
  className: {},
@@ -208,14 +205,14 @@ const w = ["src"], M = /* @__PURE__ */ r({
208
205
  onTemplateCreated: { type: Function }
209
206
  },
210
207
  setup(c) {
211
- const e = c, n = i();
208
+ const e = c, s = i();
212
209
  m(() => {
213
210
  window.addEventListener("message", o);
214
211
  }), l(() => {
215
212
  window.removeEventListener("message", o);
216
213
  });
217
- const d = u(() => {
218
- const a = e.host || "https://app.documenso.com", s = btoa(
214
+ const r = p(() => {
215
+ const t = e.host || "https://app.documenso.com", n = btoa(
219
216
  encodeURIComponent(
220
217
  JSON.stringify({
221
218
  externalId: e.externalId,
@@ -226,29 +223,28 @@ const w = ["src"], M = /* @__PURE__ */ r({
226
223
  ...e.additionalProps
227
224
  })
228
225
  )
229
- ), t = new URL("/embed/v1/authoring/template/create", a);
230
- return t.searchParams.set("token", e.presignToken), t.hash = s, t.toString();
226
+ ), a = new URL("/embed/v1/authoring/template/create", t);
227
+ return a.searchParams.set("token", e.presignToken), a.hash = n, a.toString();
231
228
  });
232
- function o(a) {
233
- var s, t;
234
- if (((s = n.value) == null ? void 0 : s.contentWindow) === a.source)
235
- switch (a.data.type) {
229
+ function o(t) {
230
+ if (s.value?.contentWindow === t.source)
231
+ switch (t.data.type) {
236
232
  case "template-created":
237
- (t = e.onTemplateCreated) == null || t.call(e, {
238
- templateId: a.data.templateId,
239
- externalId: a.data.externalId
233
+ e.onTemplateCreated?.({
234
+ templateId: t.data.templateId,
235
+ externalId: t.data.externalId
240
236
  });
241
237
  break;
242
238
  }
243
239
  }
244
- return (a, s) => (p(), _("iframe", {
240
+ return (t, n) => (_(), u("iframe", {
245
241
  ref_key: "__iframe",
246
- ref: n,
247
- class: f(a.className),
248
- src: d.value
249
- }, null, 10, I));
242
+ ref: s,
243
+ class: f(t.className),
244
+ src: r.value
245
+ }, null, 10, y));
250
246
  }
251
- }), U = ["src"], L = /* @__PURE__ */ r({
247
+ }), g = ["src"], x = /* @__PURE__ */ d({
252
248
  __name: "update-document",
253
249
  props: {
254
250
  className: {},
@@ -264,14 +260,14 @@ const w = ["src"], M = /* @__PURE__ */ r({
264
260
  onDocumentUpdated: { type: Function }
265
261
  },
266
262
  setup(c) {
267
- const e = c, n = i();
263
+ const e = c, s = i();
268
264
  m(() => {
269
265
  window.addEventListener("message", o);
270
266
  }), l(() => {
271
267
  window.removeEventListener("message", o);
272
268
  });
273
- const d = u(() => {
274
- const a = e.host || "https://app.documenso.com", s = btoa(
269
+ const r = p(() => {
270
+ const t = e.host || "https://app.documenso.com", n = btoa(
275
271
  encodeURIComponent(
276
272
  JSON.stringify({
277
273
  token: e.presignToken,
@@ -283,32 +279,31 @@ const w = ["src"], M = /* @__PURE__ */ r({
283
279
  ...e.additionalProps
284
280
  })
285
281
  )
286
- ), t = new URL(
282
+ ), a = new URL(
287
283
  `/embed/v1/authoring/document/edit/${e.documentId}`,
288
- a
284
+ t
289
285
  );
290
- return t.searchParams.set("token", e.presignToken), t.hash = s, t.toString();
286
+ return a.searchParams.set("token", e.presignToken), a.hash = n, a.toString();
291
287
  });
292
- function o(a) {
293
- var s, t;
294
- if (((s = n.value) == null ? void 0 : s.contentWindow) === a.source)
295
- switch (a.data.type) {
288
+ function o(t) {
289
+ if (s.value?.contentWindow === t.source)
290
+ switch (t.data.type) {
296
291
  case "document-updated":
297
- (t = e.onDocumentUpdated) == null || t.call(e, {
298
- documentId: a.data.documentId,
299
- externalId: a.data.externalId
292
+ e.onDocumentUpdated?.({
293
+ documentId: t.data.documentId,
294
+ externalId: t.data.externalId
300
295
  });
301
296
  break;
302
297
  }
303
298
  }
304
- return (a, s) => (p(), _("iframe", {
299
+ return (t, n) => (_(), u("iframe", {
305
300
  ref_key: "__iframe",
306
- ref: n,
307
- class: f(a.className),
308
- src: d.value
309
- }, null, 10, U));
301
+ ref: s,
302
+ class: f(t.className),
303
+ src: r.value
304
+ }, null, 10, g));
310
305
  }
311
- }), E = ["src"], V = /* @__PURE__ */ r({
306
+ }), w = ["src"], C = /* @__PURE__ */ d({
312
307
  __name: "update-template",
313
308
  props: {
314
309
  className: {},
@@ -324,14 +319,14 @@ const w = ["src"], M = /* @__PURE__ */ r({
324
319
  onTemplateUpdated: { type: Function }
325
320
  },
326
321
  setup(c) {
327
- const e = c, n = i();
322
+ const e = c, s = i();
328
323
  m(() => {
329
324
  window.addEventListener("message", o);
330
325
  }), l(() => {
331
326
  window.removeEventListener("message", o);
332
327
  });
333
- const d = u(() => {
334
- const a = e.host || "https://app.documenso.com", s = btoa(
328
+ const r = p(() => {
329
+ const t = e.host || "https://app.documenso.com", n = btoa(
335
330
  encodeURIComponent(
336
331
  JSON.stringify({
337
332
  externalId: e.externalId,
@@ -342,37 +337,108 @@ const w = ["src"], M = /* @__PURE__ */ r({
342
337
  ...e.additionalProps
343
338
  })
344
339
  )
345
- ), t = new URL(
340
+ ), a = new URL(
346
341
  `/embed/v1/authoring/template/edit/${e.templateId}`,
347
- a
342
+ t
348
343
  );
349
- return t.searchParams.set("token", e.presignToken), t.hash = s, t.toString();
344
+ return a.searchParams.set("token", e.presignToken), a.hash = n, a.toString();
350
345
  });
351
- function o(a) {
352
- var s, t;
353
- if (((s = n.value) == null ? void 0 : s.contentWindow) === a.source)
354
- switch (a.data.type) {
346
+ function o(t) {
347
+ if (s.value?.contentWindow === t.source)
348
+ switch (t.data.type) {
355
349
  case "template-updated":
356
- (t = e.onTemplateUpdated) == null || t.call(e, {
357
- templateId: a.data.templateId,
358
- externalId: a.data.externalId
350
+ e.onTemplateUpdated?.({
351
+ templateId: t.data.templateId,
352
+ externalId: t.data.externalId
359
353
  });
360
354
  break;
361
355
  }
362
356
  }
363
- return (a, s) => (p(), _("iframe", {
357
+ return (t, n) => (_(), u("iframe", {
364
358
  ref_key: "__iframe",
365
- ref: n,
366
- class: f(a.className),
367
- src: d.value
368
- }, null, 10, E));
359
+ ref: s,
360
+ class: f(t.className),
361
+ src: r.value
362
+ }, null, 10, w));
363
+ }
364
+ }), I = ["src"], F = /* @__PURE__ */ d({
365
+ __name: "multisign-document",
366
+ props: {
367
+ className: {},
368
+ host: {},
369
+ tokens: {},
370
+ css: {},
371
+ cssVars: {},
372
+ darkModeDisabled: { type: Boolean },
373
+ name: {},
374
+ lockName: { type: Boolean },
375
+ allowDocumentRejection: { type: Boolean },
376
+ additionalProps: {},
377
+ onDocumentReady: { type: Function },
378
+ onDocumentCompleted: { type: Function },
379
+ onDocumentError: { type: Function },
380
+ onDocumentRejected: { type: Function },
381
+ onAllDocumentsCompleted: { type: Function }
382
+ },
383
+ setup(c) {
384
+ const e = c, s = i();
385
+ m(() => {
386
+ window.addEventListener("message", o);
387
+ }), l(() => {
388
+ window.removeEventListener("message", o);
389
+ });
390
+ const r = p(() => {
391
+ const t = e.host || "https://app.documenso.com", n = btoa(
392
+ encodeURIComponent(
393
+ JSON.stringify({
394
+ name: e.name,
395
+ lockName: e.lockName,
396
+ css: e.css,
397
+ cssVars: e.cssVars,
398
+ darkModeDisabled: e.darkModeDisabled,
399
+ allowDocumentRejection: e.allowDocumentRejection,
400
+ ...e.additionalProps
401
+ })
402
+ )
403
+ ), a = new URL("/embed/v1/multisign", t);
404
+ for (const k of e.tokens)
405
+ a.searchParams.append("token", k);
406
+ return `${a}#${n}`;
407
+ });
408
+ function o(t) {
409
+ if (s.value?.contentWindow === t.source)
410
+ switch (t.data.action) {
411
+ case "document-ready":
412
+ e.onDocumentReady?.();
413
+ break;
414
+ case "document-completed":
415
+ e.onDocumentCompleted?.(t.data.data);
416
+ break;
417
+ case "document-error":
418
+ e.onDocumentError?.(t.data.data);
419
+ break;
420
+ case "document-rejected":
421
+ e.onDocumentRejected?.(t.data.data);
422
+ break;
423
+ case "all-documents-completed":
424
+ e.onAllDocumentsCompleted?.(t.data.data);
425
+ break;
426
+ }
427
+ }
428
+ return (t, n) => (_(), u("iframe", {
429
+ ref_key: "__iframe",
430
+ ref: s,
431
+ class: f(t.className),
432
+ src: r.value
433
+ }, null, 10, I));
369
434
  }
370
435
  });
371
436
  export {
372
- M as EmbedDirectTemplate,
373
- N as EmbedSignDocument,
374
- R as unstable_EmbedCreateDocument,
375
- C as unstable_EmbedCreateTemplate,
376
- L as unstable_EmbedUpdateDocument,
377
- V as unstable_EmbedUpdateTemplate
437
+ U as EmbedDirectTemplate,
438
+ M as EmbedSignDocument,
439
+ N as unstable_EmbedCreateDocument,
440
+ R as unstable_EmbedCreateTemplate,
441
+ F as unstable_EmbedMultiSignDocument,
442
+ x as unstable_EmbedUpdateDocument,
443
+ C as unstable_EmbedUpdateTemplate
378
444
  };
@@ -0,0 +1,46 @@
1
+ import { CssVars } from './css-vars';
2
+ export type EmbedMultiSignDocumentProps = {
3
+ className?: string;
4
+ host?: string;
5
+ tokens: string[];
6
+ css?: string | undefined;
7
+ cssVars?: (CssVars & Record<string, string>) | undefined;
8
+ darkModeDisabled?: boolean | undefined;
9
+ name?: string | undefined;
10
+ lockName?: boolean | undefined;
11
+ allowDocumentRejection?: boolean | undefined;
12
+ additionalProps?: Record<string, string | number | boolean> | undefined;
13
+ onDocumentReady?: () => void;
14
+ onDocumentCompleted?: (data: {
15
+ token: string;
16
+ documentId: number;
17
+ recipientId: number;
18
+ }) => void;
19
+ onDocumentError?: (error: string) => void;
20
+ onDocumentRejected?: (data: {
21
+ token: string;
22
+ documentId: number;
23
+ recipientId: number;
24
+ reason: string;
25
+ }) => void;
26
+ onAllDocumentsCompleted?: (data: {
27
+ documents: Array<{
28
+ token: string;
29
+ documentId: number;
30
+ recipientId: number;
31
+ action: "document-completed" | "document-rejected";
32
+ reason?: string;
33
+ }>;
34
+ }) => void;
35
+ };
36
+ declare const _default: import('vue').DefineComponent<__VLS_TypePropsToOption<EmbedMultiSignDocumentProps>, {}, unknown, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<globalThis.ExtractPropTypes<__VLS_TypePropsToOption<EmbedMultiSignDocumentProps>>>, {}, {}>;
37
+ export default _default;
38
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
39
+ type __VLS_TypePropsToOption<T> = {
40
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
41
+ type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
42
+ } : {
43
+ type: import('vue').PropType<T[K]>;
44
+ required: true;
45
+ };
46
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@documenso/embed-vue",
3
- "version": "0.2.2",
3
+ "version": "0.3.0",
4
4
  "license": "MIT",
5
5
  "files": [
6
6
  "dist"
@@ -38,7 +38,7 @@
38
38
  "@documenso/embed": "*",
39
39
  "@vitejs/plugin-vue": "^5.1.3",
40
40
  "unplugin-auto-import": "^0.18.2",
41
- "vite": "^5.4.2",
41
+ "vite": "7.0.2",
42
42
  "vite-plugin-dts": "^4.1.0"
43
43
  }
44
44
  }