@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 +1 -1
- package/dist/index.mjs +98 -105
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
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
|
|
2
|
-
const
|
|
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 =
|
|
25
|
-
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
51
|
+
e.onDocumentReady?.();
|
|
53
52
|
break;
|
|
54
53
|
case "document-completed":
|
|
55
|
-
|
|
54
|
+
e.onDocumentCompleted?.(t.data.data);
|
|
56
55
|
break;
|
|
57
56
|
case "document-error":
|
|
58
|
-
|
|
57
|
+
e.onDocumentError?.(t.data.data);
|
|
59
58
|
break;
|
|
60
59
|
case "field-signed":
|
|
61
|
-
|
|
60
|
+
e.onFieldSigned?.();
|
|
62
61
|
break;
|
|
63
62
|
case "field-unsigned":
|
|
64
|
-
|
|
63
|
+
e.onFieldUnsigned?.();
|
|
65
64
|
break;
|
|
66
65
|
}
|
|
67
66
|
}
|
|
68
|
-
return (t, n) => (
|
|
67
|
+
return (t, n) => (_(), u("iframe", {
|
|
69
68
|
ref_key: "__iframe",
|
|
70
69
|
ref: s,
|
|
71
|
-
class:
|
|
72
|
-
src:
|
|
73
|
-
}, null, 10,
|
|
70
|
+
class: f(t.className),
|
|
71
|
+
src: r.value
|
|
72
|
+
}, null, 10, h));
|
|
74
73
|
}
|
|
75
|
-
}),
|
|
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 =
|
|
95
|
-
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
119
|
+
e.onDocumentReady?.();
|
|
122
120
|
break;
|
|
123
121
|
case "document-completed":
|
|
124
|
-
|
|
122
|
+
e.onDocumentCompleted?.(t.data.data);
|
|
125
123
|
break;
|
|
126
124
|
case "document-error":
|
|
127
|
-
|
|
125
|
+
e.onDocumentError?.(t.data.data);
|
|
128
126
|
break;
|
|
129
127
|
case "document-rejected":
|
|
130
|
-
|
|
128
|
+
e.onDocumentRejected?.(t.data.data);
|
|
131
129
|
break;
|
|
132
130
|
}
|
|
133
131
|
}
|
|
134
|
-
return (t, n) => (
|
|
132
|
+
return (t, n) => (_(), u("iframe", {
|
|
135
133
|
ref_key: "__iframe",
|
|
136
134
|
ref: s,
|
|
137
|
-
class:
|
|
138
|
-
src:
|
|
139
|
-
}, null, 10,
|
|
135
|
+
class: f(t.className),
|
|
136
|
+
src: r.value
|
|
137
|
+
}, null, 10, b));
|
|
140
138
|
}
|
|
141
|
-
}),
|
|
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 =
|
|
157
|
-
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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) => (
|
|
186
|
+
return (t, n) => (_(), u("iframe", {
|
|
190
187
|
ref_key: "__iframe",
|
|
191
188
|
ref: s,
|
|
192
|
-
class:
|
|
193
|
-
src:
|
|
194
|
-
}, null, 10,
|
|
189
|
+
class: f(t.className),
|
|
190
|
+
src: r.value
|
|
191
|
+
}, null, 10, D));
|
|
195
192
|
}
|
|
196
|
-
}),
|
|
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 =
|
|
212
|
-
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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) => (
|
|
240
|
+
return (t, n) => (_(), u("iframe", {
|
|
245
241
|
ref_key: "__iframe",
|
|
246
242
|
ref: s,
|
|
247
|
-
class:
|
|
248
|
-
src:
|
|
249
|
-
}, null, 10,
|
|
243
|
+
class: f(t.className),
|
|
244
|
+
src: r.value
|
|
245
|
+
}, null, 10, y));
|
|
250
246
|
}
|
|
251
|
-
}),
|
|
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 =
|
|
268
|
-
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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) => (
|
|
299
|
+
return (t, n) => (_(), u("iframe", {
|
|
305
300
|
ref_key: "__iframe",
|
|
306
301
|
ref: s,
|
|
307
|
-
class:
|
|
308
|
-
src:
|
|
309
|
-
}, null, 10,
|
|
302
|
+
class: f(t.className),
|
|
303
|
+
src: r.value
|
|
304
|
+
}, null, 10, g));
|
|
310
305
|
}
|
|
311
|
-
}),
|
|
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 =
|
|
328
|
-
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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) => (
|
|
357
|
+
return (t, n) => (_(), u("iframe", {
|
|
364
358
|
ref_key: "__iframe",
|
|
365
359
|
ref: s,
|
|
366
|
-
class:
|
|
367
|
-
src:
|
|
368
|
-
}, null, 10,
|
|
360
|
+
class: f(t.className),
|
|
361
|
+
src: r.value
|
|
362
|
+
}, null, 10, w));
|
|
369
363
|
}
|
|
370
|
-
}),
|
|
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 =
|
|
391
|
-
|
|
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
|
|
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
|
|
411
|
-
a.searchParams.append("token",
|
|
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
|
-
|
|
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
|
-
|
|
412
|
+
e.onDocumentReady?.();
|
|
420
413
|
break;
|
|
421
414
|
case "document-completed":
|
|
422
|
-
|
|
415
|
+
e.onDocumentCompleted?.(t.data.data);
|
|
423
416
|
break;
|
|
424
417
|
case "document-error":
|
|
425
|
-
|
|
418
|
+
e.onDocumentError?.(t.data.data);
|
|
426
419
|
break;
|
|
427
420
|
case "document-rejected":
|
|
428
|
-
|
|
421
|
+
e.onDocumentRejected?.(t.data.data);
|
|
429
422
|
break;
|
|
430
423
|
case "all-documents-completed":
|
|
431
|
-
|
|
424
|
+
e.onAllDocumentsCompleted?.(t.data.data);
|
|
432
425
|
break;
|
|
433
426
|
}
|
|
434
427
|
}
|
|
435
|
-
return (t, n) => (
|
|
428
|
+
return (t, n) => (_(), u("iframe", {
|
|
436
429
|
ref_key: "__iframe",
|
|
437
430
|
ref: s,
|
|
438
|
-
class:
|
|
439
|
-
src:
|
|
440
|
-
}, null, 10,
|
|
431
|
+
class: f(t.className),
|
|
432
|
+
src: r.value
|
|
433
|
+
}, null, 10, I));
|
|
441
434
|
}
|
|
442
435
|
});
|
|
443
436
|
export {
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
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.
|
|
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": "
|
|
41
|
+
"vite": "7.0.2",
|
|
42
42
|
"vite-plugin-dts": "^4.1.0"
|
|
43
43
|
}
|
|
44
44
|
}
|