@documenso/embed-vue 0.2.1 → 0.2.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/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/update/${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/update/${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 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",a=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}#${a}`});function c(t){var a,o,m,i,l,u;if(((a=s.value)==null?void 0:a.contentWindow)===t.source)switch(t.data.action){case"document-ready":(o=e.onDocumentReady)==null||o.call(e);break;case"document-completed":(m=e.onDocumentCompleted)==null||m.call(e,t.data.data);break;case"document-error":(i=e.onDocumentError)==null||i.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,a)=>(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",a=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)}#${a}`});function c(t){var a,o,m,i,l;if(((a=s.value)==null?void 0:a.contentWindow)===t.source)switch(t.data.action){case"document-ready":(o=e.onDocumentReady)==null||o.call(e);break;case"document-completed":(m=e.onDocumentCompleted)==null||m.call(e,t.data.data);break;case"document-error":(i=e.onDocumentError)==null||i.call(e,t.data.data);break;case"document-rejected":(l=e.onDocumentRejected)==null||l.call(e,t.data.data);break}}return(t,a)=>(n.openBlock(),n.createElementBlock("iframe",{ref_key:"__iframe",ref:s,class:n.normalizeClass(t.className),src:r.value},null,10,k))}}),b=["src"],h=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",a=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=a,o.toString()});function c(t){var a,o;if(((a=s.value)==null?void 0:a.contentWindow)===t.source)switch(t.data.type){case"document-created":(o=e.onDocumentCreated)==null||o.call(e,{documentId:t.data.documentId,externalId:t.data.externalId});break}}return(t,a)=>(n.openBlock(),n.createElementBlock("iframe",{ref_key:"__iframe",ref:s,class:n.normalizeClass(t.className),src:r.value},null,10,b))}}),y=["src"],D=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",a=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=a,o.toString()});function c(t){var a,o;if(((a=s.value)==null?void 0:a.contentWindow)===t.source)switch(t.data.type){case"template-created":(o=e.onTemplateCreated)==null||o.call(e,{templateId:t.data.templateId,externalId:t.data.externalId});break}}return(t,a)=>(n.openBlock(),n.createElementBlock("iframe",{ref_key:"__iframe",ref:s,class:n.normalizeClass(t.className),src:r.value},null,10,y))}}),g=["src"],w=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",a=btoa(encodeURIComponent(JSON.stringify({token:e.presignToken,externalId:e.externalId,features:e.features,css:e.css,cssVars:e.cssVars,darkModeDisabled:e.darkModeDisabled,...e.additionalProps}))),o=new URL(`/embed/v1/authoring/document/edit/${e.documentId}`,t);return o.searchParams.set("token",e.presignToken),o.hash=a,o.toString()});function c(t){var a,o;if(((a=s.value)==null?void 0:a.contentWindow)===t.source)switch(t.data.type){case"document-updated":(o=e.onDocumentUpdated)==null||o.call(e,{documentId:t.data.documentId,externalId:t.data.externalId});break}}return(t,a)=>(n.openBlock(),n.createElementBlock("iframe",{ref_key:"__iframe",ref:s,class:n.normalizeClass(t.className),src:r.value},null,10,g))}}),I=["src"],E=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",a=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/edit/${e.templateId}`,t);return o.searchParams.set("token",e.presignToken),o.hash=a,o.toString()});function c(t){var a,o;if(((a=s.value)==null?void 0:a.contentWindow)===t.source)switch(t.data.type){case"template-updated":(o=e.onTemplateUpdated)==null||o.call(e,{templateId:t.data.templateId,externalId:t.data.externalId});break}}return(t,a)=>(n.openBlock(),n.createElementBlock("iframe",{ref_key:"__iframe",ref:s,class:n.normalizeClass(t.className),src:r.value},null,10,I))}}),M=["src"],U=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(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",a=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 m of e.tokens)o.searchParams.append("token",m);return`${o}#${a}`});function c(t){var a,o,m,i,l,u;if(((a=s.value)==null?void 0:a.contentWindow)===t.source)switch(t.data.action){case"document-ready":(o=e.onDocumentReady)==null||o.call(e);break;case"document-completed":(m=e.onDocumentCompleted)==null||m.call(e,t.data.data);break;case"document-error":(i=e.onDocumentError)==null||i.call(e,t.data.data);break;case"document-rejected":(l=e.onDocumentRejected)==null||l.call(e,t.data.data);break;case"all-documents-completed":(u=e.onAllDocumentsCompleted)==null||u.call(e,t.data.data);break}}return(t,a)=>(n.openBlock(),n.createElementBlock("iframe",{ref_key:"__iframe",ref:s,class:n.normalizeClass(t.className),src:r.value},null,10,M))}});exports.EmbedDirectTemplate=f;exports.EmbedSignDocument=_;exports.unstable_EmbedCreateDocument=h;exports.unstable_EmbedCreateTemplate=D;exports.unstable_EmbedMultiSignDocument=U;exports.unstable_EmbedUpdateDocument=w;exports.unstable_EmbedUpdateTemplate=E;
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 l, ref as u, onMounted as p, onUnmounted as _, computed as f, openBlock as k, createElementBlock as h, normalizeClass as b } from "vue";
2
+ const y = ["src"], R = /* @__PURE__ */ l({
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();
25
- m(() => {
24
+ const e = c, s = u();
25
+ p(() => {
26
26
  window.addEventListener("message", o);
27
- }), l(() => {
27
+ }), _(() => {
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 d = f(() => {
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,38 @@ 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
+ var n, a, r, i, m, D;
49
+ if (((n = s.value) == null ? void 0 : n.contentWindow) === t.source)
50
+ switch (t.data.action) {
51
51
  case "document-ready":
52
- (t = e.onDocumentReady) == null || t.call(e);
52
+ (a = e.onDocumentReady) == null || a.call(e);
53
53
  break;
54
54
  case "document-completed":
55
- (k = e.onDocumentCompleted) == null || k.call(e, a.data.data);
55
+ (r = e.onDocumentCompleted) == null || r.call(e, t.data.data);
56
56
  break;
57
57
  case "document-error":
58
- (h = e.onDocumentError) == null || h.call(e, a.data.data);
58
+ (i = e.onDocumentError) == null || i.call(e, t.data.data);
59
59
  break;
60
60
  case "field-signed":
61
- (b = e.onFieldSigned) == null || b.call(e);
61
+ (m = e.onFieldSigned) == null || m.call(e);
62
62
  break;
63
63
  case "field-unsigned":
64
- (g = e.onFieldUnsigned) == null || g.call(e);
64
+ (D = e.onFieldUnsigned) == null || D.call(e);
65
65
  break;
66
66
  }
67
67
  }
68
- return (a, s) => (p(), _("iframe", {
68
+ return (t, n) => (k(), h("iframe", {
69
69
  ref_key: "__iframe",
70
- ref: n,
71
- class: f(a.className),
70
+ ref: s,
71
+ class: b(t.className),
72
72
  src: d.value
73
- }, null, 10, w));
73
+ }, null, 10, y));
74
74
  }
75
- }), y = ["src"], N = /* @__PURE__ */ r({
75
+ }), g = ["src"], x = /* @__PURE__ */ l({
76
76
  __name: "sign-document",
77
77
  props: {
78
78
  className: {},
@@ -91,14 +91,14 @@ const w = ["src"], M = /* @__PURE__ */ r({
91
91
  onDocumentRejected: { type: Function }
92
92
  },
93
93
  setup(c) {
94
- const e = c, n = i();
95
- m(() => {
94
+ const e = c, s = u();
95
+ p(() => {
96
96
  window.addEventListener("message", o);
97
- }), l(() => {
97
+ }), _(() => {
98
98
  window.removeEventListener("message", o);
99
99
  });
100
- const d = u(() => {
101
- const a = e.host || "https://app.documenso.com", s = btoa(
100
+ const d = f(() => {
101
+ const t = e.host || "https://app.documenso.com", n = btoa(
102
102
  encodeURIComponent(
103
103
  JSON.stringify({
104
104
  name: e.name,
@@ -111,34 +111,34 @@ const w = ["src"], M = /* @__PURE__ */ r({
111
111
  })
112
112
  )
113
113
  );
114
- return `${new URL(`/embed/sign/${e.token}`, a)}#${s}`;
114
+ return `${new URL(`/embed/sign/${e.token}`, t)}#${n}`;
115
115
  });
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) {
116
+ function o(t) {
117
+ var n, a, r, i, m;
118
+ if (((n = s.value) == null ? void 0 : n.contentWindow) === t.source)
119
+ switch (t.data.action) {
120
120
  case "document-ready":
121
- (t = e.onDocumentReady) == null || t.call(e);
121
+ (a = e.onDocumentReady) == null || a.call(e);
122
122
  break;
123
123
  case "document-completed":
124
- (k = e.onDocumentCompleted) == null || k.call(e, a.data.data);
124
+ (r = e.onDocumentCompleted) == null || r.call(e, t.data.data);
125
125
  break;
126
126
  case "document-error":
127
- (h = e.onDocumentError) == null || h.call(e, a.data.data);
127
+ (i = e.onDocumentError) == null || i.call(e, t.data.data);
128
128
  break;
129
129
  case "document-rejected":
130
- (b = e.onDocumentRejected) == null || b.call(e, a.data.data);
130
+ (m = e.onDocumentRejected) == null || m.call(e, t.data.data);
131
131
  break;
132
132
  }
133
133
  }
134
- return (a, s) => (p(), _("iframe", {
134
+ return (t, n) => (k(), h("iframe", {
135
135
  ref_key: "__iframe",
136
- ref: n,
137
- class: f(a.className),
136
+ ref: s,
137
+ class: b(t.className),
138
138
  src: d.value
139
- }, null, 10, y));
139
+ }, null, 10, g));
140
140
  }
141
- }), D = ["src"], R = /* @__PURE__ */ r({
141
+ }), w = ["src"], C = /* @__PURE__ */ l({
142
142
  __name: "create-document",
143
143
  props: {
144
144
  className: {},
@@ -153,14 +153,14 @@ const w = ["src"], M = /* @__PURE__ */ r({
153
153
  onDocumentCreated: { type: Function }
154
154
  },
155
155
  setup(c) {
156
- const e = c, n = i();
157
- m(() => {
156
+ const e = c, s = u();
157
+ p(() => {
158
158
  window.addEventListener("message", o);
159
- }), l(() => {
159
+ }), _(() => {
160
160
  window.removeEventListener("message", o);
161
161
  });
162
- const d = u(() => {
163
- const a = e.host || "https://app.documenso.com", s = btoa(
162
+ const d = f(() => {
163
+ const t = e.host || "https://app.documenso.com", n = btoa(
164
164
  encodeURIComponent(
165
165
  JSON.stringify({
166
166
  externalId: e.externalId,
@@ -171,29 +171,29 @@ const w = ["src"], M = /* @__PURE__ */ r({
171
171
  ...e.additionalProps
172
172
  })
173
173
  )
174
- ), t = new URL("/embed/v1/authoring/document/create", a);
175
- return t.searchParams.set("token", e.presignToken), t.hash = s, t.toString();
174
+ ), a = new URL("/embed/v1/authoring/document/create", t);
175
+ return a.searchParams.set("token", e.presignToken), a.hash = n, a.toString();
176
176
  });
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) {
177
+ function o(t) {
178
+ var n, a;
179
+ if (((n = s.value) == null ? void 0 : n.contentWindow) === t.source)
180
+ switch (t.data.type) {
181
181
  case "document-created":
182
- (t = e.onDocumentCreated) == null || t.call(e, {
183
- documentId: a.data.documentId,
184
- externalId: a.data.externalId
182
+ (a = e.onDocumentCreated) == null || a.call(e, {
183
+ documentId: t.data.documentId,
184
+ externalId: t.data.externalId
185
185
  });
186
186
  break;
187
187
  }
188
188
  }
189
- return (a, s) => (p(), _("iframe", {
189
+ return (t, n) => (k(), h("iframe", {
190
190
  ref_key: "__iframe",
191
- ref: n,
192
- class: f(a.className),
191
+ ref: s,
192
+ class: b(t.className),
193
193
  src: d.value
194
- }, null, 10, D));
194
+ }, null, 10, w));
195
195
  }
196
- }), I = ["src"], C = /* @__PURE__ */ r({
196
+ }), I = ["src"], F = /* @__PURE__ */ l({
197
197
  __name: "create-template",
198
198
  props: {
199
199
  className: {},
@@ -208,14 +208,14 @@ const w = ["src"], M = /* @__PURE__ */ r({
208
208
  onTemplateCreated: { type: Function }
209
209
  },
210
210
  setup(c) {
211
- const e = c, n = i();
212
- m(() => {
211
+ const e = c, s = u();
212
+ p(() => {
213
213
  window.addEventListener("message", o);
214
- }), l(() => {
214
+ }), _(() => {
215
215
  window.removeEventListener("message", o);
216
216
  });
217
- const d = u(() => {
218
- const a = e.host || "https://app.documenso.com", s = btoa(
217
+ const d = f(() => {
218
+ const t = e.host || "https://app.documenso.com", n = btoa(
219
219
  encodeURIComponent(
220
220
  JSON.stringify({
221
221
  externalId: e.externalId,
@@ -226,29 +226,29 @@ const w = ["src"], M = /* @__PURE__ */ r({
226
226
  ...e.additionalProps
227
227
  })
228
228
  )
229
- ), t = new URL("/embed/v1/authoring/template/create", a);
230
- return t.searchParams.set("token", e.presignToken), t.hash = s, t.toString();
229
+ ), a = new URL("/embed/v1/authoring/template/create", t);
230
+ return a.searchParams.set("token", e.presignToken), a.hash = n, a.toString();
231
231
  });
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) {
232
+ function o(t) {
233
+ var n, a;
234
+ if (((n = s.value) == null ? void 0 : n.contentWindow) === t.source)
235
+ switch (t.data.type) {
236
236
  case "template-created":
237
- (t = e.onTemplateCreated) == null || t.call(e, {
238
- templateId: a.data.templateId,
239
- externalId: a.data.externalId
237
+ (a = e.onTemplateCreated) == null || a.call(e, {
238
+ templateId: t.data.templateId,
239
+ externalId: t.data.externalId
240
240
  });
241
241
  break;
242
242
  }
243
243
  }
244
- return (a, s) => (p(), _("iframe", {
244
+ return (t, n) => (k(), h("iframe", {
245
245
  ref_key: "__iframe",
246
- ref: n,
247
- class: f(a.className),
246
+ ref: s,
247
+ class: b(t.className),
248
248
  src: d.value
249
249
  }, null, 10, I));
250
250
  }
251
- }), U = ["src"], L = /* @__PURE__ */ r({
251
+ }), E = ["src"], $ = /* @__PURE__ */ l({
252
252
  __name: "update-document",
253
253
  props: {
254
254
  className: {},
@@ -264,14 +264,14 @@ const w = ["src"], M = /* @__PURE__ */ r({
264
264
  onDocumentUpdated: { type: Function }
265
265
  },
266
266
  setup(c) {
267
- const e = c, n = i();
268
- m(() => {
267
+ const e = c, s = u();
268
+ p(() => {
269
269
  window.addEventListener("message", o);
270
- }), l(() => {
270
+ }), _(() => {
271
271
  window.removeEventListener("message", o);
272
272
  });
273
- const d = u(() => {
274
- const a = e.host || "https://app.documenso.com", s = btoa(
273
+ const d = f(() => {
274
+ const t = e.host || "https://app.documenso.com", n = btoa(
275
275
  encodeURIComponent(
276
276
  JSON.stringify({
277
277
  token: e.presignToken,
@@ -283,32 +283,32 @@ const w = ["src"], M = /* @__PURE__ */ r({
283
283
  ...e.additionalProps
284
284
  })
285
285
  )
286
- ), t = new URL(
287
- `/embed/v1/authoring/document/update/${e.documentId}`,
288
- a
286
+ ), a = new URL(
287
+ `/embed/v1/authoring/document/edit/${e.documentId}`,
288
+ t
289
289
  );
290
- return t.searchParams.set("token", e.presignToken), t.hash = s, t.toString();
290
+ return a.searchParams.set("token", e.presignToken), a.hash = n, a.toString();
291
291
  });
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) {
292
+ function o(t) {
293
+ var n, a;
294
+ if (((n = s.value) == null ? void 0 : n.contentWindow) === t.source)
295
+ switch (t.data.type) {
296
296
  case "document-updated":
297
- (t = e.onDocumentUpdated) == null || t.call(e, {
298
- documentId: a.data.documentId,
299
- externalId: a.data.externalId
297
+ (a = e.onDocumentUpdated) == null || a.call(e, {
298
+ documentId: t.data.documentId,
299
+ externalId: t.data.externalId
300
300
  });
301
301
  break;
302
302
  }
303
303
  }
304
- return (a, s) => (p(), _("iframe", {
304
+ return (t, n) => (k(), h("iframe", {
305
305
  ref_key: "__iframe",
306
- ref: n,
307
- class: f(a.className),
306
+ ref: s,
307
+ class: b(t.className),
308
308
  src: d.value
309
- }, null, 10, U));
309
+ }, null, 10, E));
310
310
  }
311
- }), E = ["src"], V = /* @__PURE__ */ r({
311
+ }), U = ["src"], L = /* @__PURE__ */ l({
312
312
  __name: "update-template",
313
313
  props: {
314
314
  className: {},
@@ -324,14 +324,14 @@ const w = ["src"], M = /* @__PURE__ */ r({
324
324
  onTemplateUpdated: { type: Function }
325
325
  },
326
326
  setup(c) {
327
- const e = c, n = i();
328
- m(() => {
327
+ const e = c, s = u();
328
+ p(() => {
329
329
  window.addEventListener("message", o);
330
- }), l(() => {
330
+ }), _(() => {
331
331
  window.removeEventListener("message", o);
332
332
  });
333
- const d = u(() => {
334
- const a = e.host || "https://app.documenso.com", s = btoa(
333
+ const d = f(() => {
334
+ const t = e.host || "https://app.documenso.com", n = btoa(
335
335
  encodeURIComponent(
336
336
  JSON.stringify({
337
337
  externalId: e.externalId,
@@ -342,37 +342,110 @@ const w = ["src"], M = /* @__PURE__ */ r({
342
342
  ...e.additionalProps
343
343
  })
344
344
  )
345
- ), t = new URL(
346
- `/embed/v1/authoring/template/update/${e.templateId}`,
347
- a
345
+ ), a = new URL(
346
+ `/embed/v1/authoring/template/edit/${e.templateId}`,
347
+ t
348
348
  );
349
- return t.searchParams.set("token", e.presignToken), t.hash = s, t.toString();
349
+ return a.searchParams.set("token", e.presignToken), a.hash = n, a.toString();
350
350
  });
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) {
351
+ function o(t) {
352
+ var n, a;
353
+ if (((n = s.value) == null ? void 0 : n.contentWindow) === t.source)
354
+ switch (t.data.type) {
355
355
  case "template-updated":
356
- (t = e.onTemplateUpdated) == null || t.call(e, {
357
- templateId: a.data.templateId,
358
- externalId: a.data.externalId
356
+ (a = e.onTemplateUpdated) == null || a.call(e, {
357
+ templateId: t.data.templateId,
358
+ externalId: t.data.externalId
359
359
  });
360
360
  break;
361
361
  }
362
362
  }
363
- return (a, s) => (p(), _("iframe", {
363
+ return (t, n) => (k(), h("iframe", {
364
364
  ref_key: "__iframe",
365
- ref: n,
366
- class: f(a.className),
365
+ ref: s,
366
+ class: b(t.className),
367
367
  src: d.value
368
- }, null, 10, E));
368
+ }, null, 10, U));
369
+ }
370
+ }), M = ["src"], V = /* @__PURE__ */ l({
371
+ __name: "multisign-document",
372
+ props: {
373
+ className: {},
374
+ host: {},
375
+ tokens: {},
376
+ css: {},
377
+ cssVars: {},
378
+ darkModeDisabled: { type: Boolean },
379
+ name: {},
380
+ lockName: { type: Boolean },
381
+ allowDocumentRejection: { type: Boolean },
382
+ additionalProps: {},
383
+ onDocumentReady: { type: Function },
384
+ onDocumentCompleted: { type: Function },
385
+ onDocumentError: { type: Function },
386
+ onDocumentRejected: { type: Function },
387
+ onAllDocumentsCompleted: { type: Function }
388
+ },
389
+ setup(c) {
390
+ const e = c, s = u();
391
+ p(() => {
392
+ window.addEventListener("message", o);
393
+ }), _(() => {
394
+ window.removeEventListener("message", o);
395
+ });
396
+ const d = f(() => {
397
+ const t = e.host || "https://app.documenso.com", n = btoa(
398
+ encodeURIComponent(
399
+ JSON.stringify({
400
+ name: e.name,
401
+ lockName: e.lockName,
402
+ css: e.css,
403
+ cssVars: e.cssVars,
404
+ darkModeDisabled: e.darkModeDisabled,
405
+ allowDocumentRejection: e.allowDocumentRejection,
406
+ ...e.additionalProps
407
+ })
408
+ )
409
+ ), a = new URL("/embed/v1/multisign", t);
410
+ for (const r of e.tokens)
411
+ a.searchParams.append("token", r);
412
+ return `${a}#${n}`;
413
+ });
414
+ function o(t) {
415
+ var n, a, r, i, m, D;
416
+ if (((n = s.value) == null ? void 0 : n.contentWindow) === t.source)
417
+ switch (t.data.action) {
418
+ case "document-ready":
419
+ (a = e.onDocumentReady) == null || a.call(e);
420
+ break;
421
+ case "document-completed":
422
+ (r = e.onDocumentCompleted) == null || r.call(e, t.data.data);
423
+ break;
424
+ case "document-error":
425
+ (i = e.onDocumentError) == null || i.call(e, t.data.data);
426
+ break;
427
+ case "document-rejected":
428
+ (m = e.onDocumentRejected) == null || m.call(e, t.data.data);
429
+ break;
430
+ case "all-documents-completed":
431
+ (D = e.onAllDocumentsCompleted) == null || D.call(e, t.data.data);
432
+ break;
433
+ }
434
+ }
435
+ return (t, n) => (k(), h("iframe", {
436
+ ref_key: "__iframe",
437
+ ref: s,
438
+ class: b(t.className),
439
+ src: d.value
440
+ }, null, 10, M));
369
441
  }
370
442
  });
371
443
  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
444
+ R as EmbedDirectTemplate,
445
+ x as EmbedSignDocument,
446
+ C as unstable_EmbedCreateDocument,
447
+ F as unstable_EmbedCreateTemplate,
448
+ V as unstable_EmbedMultiSignDocument,
449
+ $ as unstable_EmbedUpdateDocument,
450
+ L as unstable_EmbedUpdateTemplate
378
451
  };
@@ -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.1",
3
+ "version": "0.2.3",
4
4
  "license": "MIT",
5
5
  "files": [
6
6
  "dist"