@documenso/embed-vue 0.2.1-rc.2 → 0.2.2

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
@@ -2,3 +2,5 @@ export { default as EmbedDirectTemplate } from './direct-template.vue';
2
2
  export { default as EmbedSignDocument } from './sign-document.vue';
3
3
  export { default as unstable_EmbedCreateDocument } from './create-document.vue';
4
4
  export { default as unstable_EmbedCreateTemplate } from './create-template.vue';
5
+ export { default as unstable_EmbedUpdateDocument } from './update-document.vue';
6
+ export { default as unstable_EmbedUpdateTemplate } from './update-template.vue';
package/dist/index.d.ts CHANGED
@@ -2,3 +2,5 @@ export { default as EmbedDirectTemplate } from './direct-template.vue';
2
2
  export { default as EmbedSignDocument } from './sign-document.vue';
3
3
  export { default as unstable_EmbedCreateDocument } from './create-document.vue';
4
4
  export { default as unstable_EmbedCreateTemplate } from './create-template.vue';
5
+ export { default as unstable_EmbedUpdateDocument } from './update-document.vue';
6
+ export { default as unstable_EmbedUpdateTemplate } from './update-template.vue';
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("vue"),p=["src"],f=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(d){const e=d,s=t.ref();t.onMounted(()=>{window.addEventListener("message",c)}),t.onUnmounted(()=>{window.removeEventListener("message",c)});const r=t.computed(()=>{const n=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}`,n);return e.externalId&&a.searchParams.set("externalId",e.externalId),`${a}#${o}`});function c(n){var o,a,i,m,l,u;if(((o=s.value)==null?void 0:o.contentWindow)===n.source)switch(n.data.action){case"document-ready":(a=e.onDocumentReady)==null||a.call(e);break;case"document-completed":(i=e.onDocumentCompleted)==null||i.call(e,n.data.data);break;case"document-error":(m=e.onDocumentError)==null||m.call(e,n.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(n,o)=>(t.openBlock(),t.createElementBlock("iframe",{ref_key:"__iframe",ref:s,class:t.normalizeClass(n.className),src:r.value},null,10,p))}}),k=["src"],_=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(d){const e=d,s=t.ref();t.onMounted(()=>{window.addEventListener("message",c)}),t.onUnmounted(()=>{window.removeEventListener("message",c)});const r=t.computed(()=>{const n=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}`,n)}#${o}`});function c(n){var o,a,i,m,l;if(((o=s.value)==null?void 0:o.contentWindow)===n.source)switch(n.data.action){case"document-ready":(a=e.onDocumentReady)==null||a.call(e);break;case"document-completed":(i=e.onDocumentCompleted)==null||i.call(e,n.data.data);break;case"document-error":(m=e.onDocumentError)==null||m.call(e,n.data.data);break;case"document-rejected":(l=e.onDocumentRejected)==null||l.call(e,n.data.data);break}}return(n,o)=>(t.openBlock(),t.createElementBlock("iframe",{ref_key:"__iframe",ref:s,class:t.normalizeClass(n.className),src:r.value},null,10,k))}}),b=["src"],y=t.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=t.ref();t.onMounted(()=>{window.addEventListener("message",c)}),t.onUnmounted(()=>{window.removeEventListener("message",c)});const r=t.computed(()=>{const n=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})));return`${new URL("/embed/v1/authoring/document/create",n)}#${o}`});function c(n){var o,a;if(((o=s.value)==null?void 0:o.contentWindow)===n.source)switch(n.data.type){case"document-created":(a=e.onDocumentCreated)==null||a.call(e,{documentId:n.data.documentId,externalId:n.data.externalId});break}}return(n,o)=>(t.openBlock(),t.createElementBlock("iframe",{ref_key:"__iframe",ref:s,class:t.normalizeClass(n.className),src:r.value},null,10,b))}}),D=["src"],g=t.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=t.ref();t.onMounted(()=>{window.addEventListener("message",c)}),t.onUnmounted(()=>{window.removeEventListener("message",c)});const r=t.computed(()=>{const n=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})));return`${new URL("/embed/v1/authoring/template/create",n)}#${o}`});function c(n){var o,a;if(((o=s.value)==null?void 0:o.contentWindow)===n.source)switch(n.data.type){case"template-created":(a=e.onTemplateCreated)==null||a.call(e,{templateId:n.data.templateId,externalId:n.data.externalId});break}}return(n,o)=>(t.openBlock(),t.createElementBlock("iframe",{ref_key:"__iframe",ref:s,class:t.normalizeClass(n.className),src:r.value},null,10,D))}});exports.EmbedDirectTemplate=f;exports.EmbedSignDocument=_;exports.unstable_EmbedCreateDocument=y;exports.unstable_EmbedCreateTemplate=g;
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;
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 b, normalizeClass as y } from "vue";
2
- const g = ["src"], N = /* @__PURE__ */ l({
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({
3
3
  __name: "direct-template",
4
4
  props: {
5
5
  className: {},
@@ -21,14 +21,14 @@ const g = ["src"], N = /* @__PURE__ */ l({
21
21
  onFieldUnsigned: { type: Function }
22
22
  },
23
23
  setup(c) {
24
- const e = c, o = u();
25
- p(() => {
26
- window.addEventListener("message", s);
27
- }), _(() => {
28
- window.removeEventListener("message", s);
24
+ const e = c, n = i();
25
+ m(() => {
26
+ window.addEventListener("message", o);
27
+ }), l(() => {
28
+ window.removeEventListener("message", o);
29
29
  });
30
- const d = f(() => {
31
- const a = e.host || "https://app.documenso.com", n = btoa(
30
+ const d = u(() => {
31
+ const a = e.host || "https://app.documenso.com", s = btoa(
32
32
  encodeURIComponent(
33
33
  JSON.stringify({
34
34
  name: e.name,
@@ -42,37 +42,37 @@ const g = ["src"], N = /* @__PURE__ */ l({
42
42
  })
43
43
  )
44
44
  ), t = new URL(`/embed/direct/${e.token}`, a);
45
- return e.externalId && t.searchParams.set("externalId", e.externalId), `${t}#${n}`;
45
+ return e.externalId && t.searchParams.set("externalId", e.externalId), `${t}#${s}`;
46
46
  });
47
- function s(a) {
48
- var n, t, r, i, m, D;
49
- if (((n = o.value) == null ? void 0 : n.contentWindow) === a.source)
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
50
  switch (a.data.action) {
51
51
  case "document-ready":
52
52
  (t = e.onDocumentReady) == null || t.call(e);
53
53
  break;
54
54
  case "document-completed":
55
- (r = e.onDocumentCompleted) == null || r.call(e, a.data.data);
55
+ (k = e.onDocumentCompleted) == null || k.call(e, a.data.data);
56
56
  break;
57
57
  case "document-error":
58
- (i = e.onDocumentError) == null || i.call(e, a.data.data);
58
+ (h = e.onDocumentError) == null || h.call(e, a.data.data);
59
59
  break;
60
60
  case "field-signed":
61
- (m = e.onFieldSigned) == null || m.call(e);
61
+ (b = e.onFieldSigned) == null || b.call(e);
62
62
  break;
63
63
  case "field-unsigned":
64
- (D = e.onFieldUnsigned) == null || D.call(e);
64
+ (g = e.onFieldUnsigned) == null || g.call(e);
65
65
  break;
66
66
  }
67
67
  }
68
- return (a, n) => (k(), b("iframe", {
68
+ return (a, s) => (p(), _("iframe", {
69
69
  ref_key: "__iframe",
70
- ref: o,
71
- class: y(a.className),
70
+ ref: n,
71
+ class: f(a.className),
72
72
  src: d.value
73
- }, null, 10, g));
73
+ }, null, 10, w));
74
74
  }
75
- }), h = ["src"], U = /* @__PURE__ */ l({
75
+ }), y = ["src"], N = /* @__PURE__ */ r({
76
76
  __name: "sign-document",
77
77
  props: {
78
78
  className: {},
@@ -91,14 +91,14 @@ const g = ["src"], N = /* @__PURE__ */ l({
91
91
  onDocumentRejected: { type: Function }
92
92
  },
93
93
  setup(c) {
94
- const e = c, o = u();
95
- p(() => {
96
- window.addEventListener("message", s);
97
- }), _(() => {
98
- window.removeEventListener("message", s);
94
+ const e = c, n = i();
95
+ m(() => {
96
+ window.addEventListener("message", o);
97
+ }), l(() => {
98
+ window.removeEventListener("message", o);
99
99
  });
100
- const d = f(() => {
101
- const a = e.host || "https://app.documenso.com", n = btoa(
100
+ const d = u(() => {
101
+ const a = e.host || "https://app.documenso.com", s = btoa(
102
102
  encodeURIComponent(
103
103
  JSON.stringify({
104
104
  name: e.name,
@@ -111,34 +111,34 @@ const g = ["src"], N = /* @__PURE__ */ l({
111
111
  })
112
112
  )
113
113
  );
114
- return `${new URL(`/embed/sign/${e.token}`, a)}#${n}`;
114
+ return `${new URL(`/embed/sign/${e.token}`, a)}#${s}`;
115
115
  });
116
- function s(a) {
117
- var n, t, r, i, m;
118
- if (((n = o.value) == null ? void 0 : n.contentWindow) === a.source)
116
+ function o(a) {
117
+ var s, t, k, h, b;
118
+ if (((s = n.value) == null ? void 0 : s.contentWindow) === a.source)
119
119
  switch (a.data.action) {
120
120
  case "document-ready":
121
121
  (t = e.onDocumentReady) == null || t.call(e);
122
122
  break;
123
123
  case "document-completed":
124
- (r = e.onDocumentCompleted) == null || r.call(e, a.data.data);
124
+ (k = e.onDocumentCompleted) == null || k.call(e, a.data.data);
125
125
  break;
126
126
  case "document-error":
127
- (i = e.onDocumentError) == null || i.call(e, a.data.data);
127
+ (h = e.onDocumentError) == null || h.call(e, a.data.data);
128
128
  break;
129
129
  case "document-rejected":
130
- (m = e.onDocumentRejected) == null || m.call(e, a.data.data);
130
+ (b = e.onDocumentRejected) == null || b.call(e, a.data.data);
131
131
  break;
132
132
  }
133
133
  }
134
- return (a, n) => (k(), b("iframe", {
134
+ return (a, s) => (p(), _("iframe", {
135
135
  ref_key: "__iframe",
136
- ref: o,
137
- class: y(a.className),
136
+ ref: n,
137
+ class: f(a.className),
138
138
  src: d.value
139
- }, null, 10, h));
139
+ }, null, 10, y));
140
140
  }
141
- }), w = ["src"], M = /* @__PURE__ */ l({
141
+ }), D = ["src"], R = /* @__PURE__ */ r({
142
142
  __name: "create-document",
143
143
  props: {
144
144
  className: {},
@@ -153,17 +153,16 @@ const g = ["src"], N = /* @__PURE__ */ l({
153
153
  onDocumentCreated: { type: Function }
154
154
  },
155
155
  setup(c) {
156
- const e = c, o = u();
157
- p(() => {
158
- window.addEventListener("message", s);
159
- }), _(() => {
160
- window.removeEventListener("message", s);
156
+ const e = c, n = i();
157
+ m(() => {
158
+ window.addEventListener("message", o);
159
+ }), l(() => {
160
+ window.removeEventListener("message", o);
161
161
  });
162
- const d = f(() => {
163
- const a = e.host || "https://app.documenso.com", n = btoa(
162
+ const d = u(() => {
163
+ const a = e.host || "https://app.documenso.com", s = btoa(
164
164
  encodeURIComponent(
165
165
  JSON.stringify({
166
- token: e.presignToken,
167
166
  externalId: e.externalId,
168
167
  features: e.features,
169
168
  css: e.css,
@@ -172,12 +171,12 @@ const g = ["src"], N = /* @__PURE__ */ l({
172
171
  ...e.additionalProps
173
172
  })
174
173
  )
175
- );
176
- return `${new URL("/embed/v1/authoring/document/create", a)}#${n}`;
174
+ ), t = new URL("/embed/v1/authoring/document/create", a);
175
+ return t.searchParams.set("token", e.presignToken), t.hash = s, t.toString();
177
176
  });
178
- function s(a) {
179
- var n, t;
180
- if (((n = o.value) == null ? void 0 : n.contentWindow) === a.source)
177
+ function o(a) {
178
+ var s, t;
179
+ if (((s = n.value) == null ? void 0 : s.contentWindow) === a.source)
181
180
  switch (a.data.type) {
182
181
  case "document-created":
183
182
  (t = e.onDocumentCreated) == null || t.call(e, {
@@ -187,14 +186,14 @@ const g = ["src"], N = /* @__PURE__ */ l({
187
186
  break;
188
187
  }
189
188
  }
190
- return (a, n) => (k(), b("iframe", {
189
+ return (a, s) => (p(), _("iframe", {
191
190
  ref_key: "__iframe",
192
- ref: o,
193
- class: y(a.className),
191
+ ref: n,
192
+ class: f(a.className),
194
193
  src: d.value
195
- }, null, 10, w));
194
+ }, null, 10, D));
196
195
  }
197
- }), I = ["src"], R = /* @__PURE__ */ l({
196
+ }), I = ["src"], C = /* @__PURE__ */ r({
198
197
  __name: "create-template",
199
198
  props: {
200
199
  className: {},
@@ -209,17 +208,16 @@ const g = ["src"], N = /* @__PURE__ */ l({
209
208
  onTemplateCreated: { type: Function }
210
209
  },
211
210
  setup(c) {
212
- const e = c, o = u();
213
- p(() => {
214
- window.addEventListener("message", s);
215
- }), _(() => {
216
- window.removeEventListener("message", s);
211
+ const e = c, n = i();
212
+ m(() => {
213
+ window.addEventListener("message", o);
214
+ }), l(() => {
215
+ window.removeEventListener("message", o);
217
216
  });
218
- const d = f(() => {
219
- const a = e.host || "https://app.documenso.com", n = btoa(
217
+ const d = u(() => {
218
+ const a = e.host || "https://app.documenso.com", s = btoa(
220
219
  encodeURIComponent(
221
220
  JSON.stringify({
222
- token: e.presignToken,
223
221
  externalId: e.externalId,
224
222
  features: e.features,
225
223
  css: e.css,
@@ -228,12 +226,12 @@ const g = ["src"], N = /* @__PURE__ */ l({
228
226
  ...e.additionalProps
229
227
  })
230
228
  )
231
- );
232
- return `${new URL("/embed/v1/authoring/template/create", a)}#${n}`;
229
+ ), t = new URL("/embed/v1/authoring/template/create", a);
230
+ return t.searchParams.set("token", e.presignToken), t.hash = s, t.toString();
233
231
  });
234
- function s(a) {
235
- var n, t;
236
- if (((n = o.value) == null ? void 0 : n.contentWindow) === a.source)
232
+ function o(a) {
233
+ var s, t;
234
+ if (((s = n.value) == null ? void 0 : s.contentWindow) === a.source)
237
235
  switch (a.data.type) {
238
236
  case "template-created":
239
237
  (t = e.onTemplateCreated) == null || t.call(e, {
@@ -243,17 +241,138 @@ const g = ["src"], N = /* @__PURE__ */ l({
243
241
  break;
244
242
  }
245
243
  }
246
- return (a, n) => (k(), b("iframe", {
244
+ return (a, s) => (p(), _("iframe", {
247
245
  ref_key: "__iframe",
248
- ref: o,
249
- class: y(a.className),
246
+ ref: n,
247
+ class: f(a.className),
250
248
  src: d.value
251
249
  }, null, 10, I));
252
250
  }
251
+ }), U = ["src"], L = /* @__PURE__ */ r({
252
+ __name: "update-document",
253
+ props: {
254
+ className: {},
255
+ host: {},
256
+ presignToken: {},
257
+ documentId: {},
258
+ externalId: {},
259
+ css: {},
260
+ cssVars: {},
261
+ darkModeDisabled: { type: Boolean },
262
+ features: {},
263
+ additionalProps: {},
264
+ onDocumentUpdated: { type: Function }
265
+ },
266
+ setup(c) {
267
+ const e = c, n = i();
268
+ m(() => {
269
+ window.addEventListener("message", o);
270
+ }), l(() => {
271
+ window.removeEventListener("message", o);
272
+ });
273
+ const d = u(() => {
274
+ const a = e.host || "https://app.documenso.com", s = btoa(
275
+ encodeURIComponent(
276
+ JSON.stringify({
277
+ token: e.presignToken,
278
+ externalId: e.externalId,
279
+ features: e.features,
280
+ css: e.css,
281
+ cssVars: e.cssVars,
282
+ darkModeDisabled: e.darkModeDisabled,
283
+ ...e.additionalProps
284
+ })
285
+ )
286
+ ), t = new URL(
287
+ `/embed/v1/authoring/document/edit/${e.documentId}`,
288
+ a
289
+ );
290
+ return t.searchParams.set("token", e.presignToken), t.hash = s, t.toString();
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) {
296
+ case "document-updated":
297
+ (t = e.onDocumentUpdated) == null || t.call(e, {
298
+ documentId: a.data.documentId,
299
+ externalId: a.data.externalId
300
+ });
301
+ break;
302
+ }
303
+ }
304
+ return (a, s) => (p(), _("iframe", {
305
+ ref_key: "__iframe",
306
+ ref: n,
307
+ class: f(a.className),
308
+ src: d.value
309
+ }, null, 10, U));
310
+ }
311
+ }), E = ["src"], V = /* @__PURE__ */ r({
312
+ __name: "update-template",
313
+ props: {
314
+ className: {},
315
+ host: {},
316
+ presignToken: {},
317
+ templateId: {},
318
+ externalId: {},
319
+ css: {},
320
+ cssVars: {},
321
+ darkModeDisabled: { type: Boolean },
322
+ features: {},
323
+ additionalProps: {},
324
+ onTemplateUpdated: { type: Function }
325
+ },
326
+ setup(c) {
327
+ const e = c, n = i();
328
+ m(() => {
329
+ window.addEventListener("message", o);
330
+ }), l(() => {
331
+ window.removeEventListener("message", o);
332
+ });
333
+ const d = u(() => {
334
+ const a = e.host || "https://app.documenso.com", s = btoa(
335
+ encodeURIComponent(
336
+ JSON.stringify({
337
+ externalId: e.externalId,
338
+ features: e.features,
339
+ css: e.css,
340
+ cssVars: e.cssVars,
341
+ darkModeDisabled: e.darkModeDisabled,
342
+ ...e.additionalProps
343
+ })
344
+ )
345
+ ), t = new URL(
346
+ `/embed/v1/authoring/template/edit/${e.templateId}`,
347
+ a
348
+ );
349
+ return t.searchParams.set("token", e.presignToken), t.hash = s, t.toString();
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) {
355
+ case "template-updated":
356
+ (t = e.onTemplateUpdated) == null || t.call(e, {
357
+ templateId: a.data.templateId,
358
+ externalId: a.data.externalId
359
+ });
360
+ break;
361
+ }
362
+ }
363
+ return (a, s) => (p(), _("iframe", {
364
+ ref_key: "__iframe",
365
+ ref: n,
366
+ class: f(a.className),
367
+ src: d.value
368
+ }, null, 10, E));
369
+ }
253
370
  });
254
371
  export {
255
- N as EmbedDirectTemplate,
256
- U as EmbedSignDocument,
257
- M as unstable_EmbedCreateDocument,
258
- R as unstable_EmbedCreateTemplate
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
259
378
  };
@@ -0,0 +1,35 @@
1
+ import { CssVars } from './css-vars';
2
+ export type EmbedUpdateDocumentProps = {
3
+ className?: string;
4
+ host?: string;
5
+ presignToken: string;
6
+ documentId: number;
7
+ externalId?: string;
8
+ css?: string | undefined;
9
+ cssVars?: (CssVars & Record<string, string>) | undefined;
10
+ darkModeDisabled?: boolean | undefined;
11
+ features?: {
12
+ allowConfigureSignatureTypes?: boolean;
13
+ allowConfigureLanguage?: boolean;
14
+ allowConfigureDateFormat?: boolean;
15
+ allowConfigureTimezone?: boolean;
16
+ allowConfigureRedirectUrl?: boolean;
17
+ allowConfigureCommunication?: boolean;
18
+ };
19
+ additionalProps?: Record<string, string | number | boolean> | undefined;
20
+ onDocumentUpdated?: (data: {
21
+ externalId: string;
22
+ documentId: number;
23
+ }) => void;
24
+ };
25
+ declare const _default: import('vue').DefineComponent<__VLS_TypePropsToOption<EmbedUpdateDocumentProps>, {}, unknown, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<globalThis.ExtractPropTypes<__VLS_TypePropsToOption<EmbedUpdateDocumentProps>>>, {}, {}>;
26
+ export default _default;
27
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
28
+ type __VLS_TypePropsToOption<T> = {
29
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
30
+ type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
31
+ } : {
32
+ type: import('vue').PropType<T[K]>;
33
+ required: true;
34
+ };
35
+ };
@@ -0,0 +1,35 @@
1
+ import { CssVars } from './css-vars';
2
+ export type EmbedUpdateTemplateProps = {
3
+ className?: string;
4
+ host?: string;
5
+ presignToken: string;
6
+ templateId: number;
7
+ externalId?: string;
8
+ css?: string | undefined;
9
+ cssVars?: (CssVars & Record<string, string>) | undefined;
10
+ darkModeDisabled?: boolean | undefined;
11
+ features?: {
12
+ allowConfigureSignatureTypes?: boolean;
13
+ allowConfigureLanguage?: boolean;
14
+ allowConfigureDateFormat?: boolean;
15
+ allowConfigureTimezone?: boolean;
16
+ allowConfigureRedirectUrl?: boolean;
17
+ allowConfigureCommunication?: boolean;
18
+ };
19
+ additionalProps?: Record<string, string | number | boolean> | undefined;
20
+ onTemplateUpdated?: (data: {
21
+ externalId: string;
22
+ templateId: number;
23
+ }) => void;
24
+ };
25
+ declare const _default: import('vue').DefineComponent<__VLS_TypePropsToOption<EmbedUpdateTemplateProps>, {}, unknown, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<globalThis.ExtractPropTypes<__VLS_TypePropsToOption<EmbedUpdateTemplateProps>>>, {}, {}>;
26
+ export default _default;
27
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
28
+ type __VLS_TypePropsToOption<T> = {
29
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
30
+ type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
31
+ } : {
32
+ type: import('vue').PropType<T[K]>;
33
+ required: true;
34
+ };
35
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@documenso/embed-vue",
3
- "version": "0.2.1-rc.2",
3
+ "version": "0.2.2",
4
4
  "license": "MIT",
5
5
  "files": [
6
6
  "dist"