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